{"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n\n static int? getVal(char c)\n {\n if (c >= 'a' && c <= 'f')\n return 10 + (c - 'a');\n if (c >= 'A' && c <= 'F')\n return 10 + (c - 'A');\n if (c >= '0' && c <= '9')\n return c - '0';\n return null;\n }\n\n static char? convert(char? A, char? B)\n {\n if (A == null || B == null)\n return null;\n var x = getVal(A.Value);\n var y = getVal(B.Value);\n if (x == null || y == null)\n return null;\n var res = x.Value * 16 + y.Value;\n return (char)res;\n }\n\n static void Main(string[] args)\n {\n var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = nm[0];\n var a = nm[1];\n var x = nm[2];\n var b = nm[3];\n var y = nm[4];\n for (int i = 0; i < n; i++)\n {\n var c1 = (a - 1 + i) % n;\n var c2 = (b - 1 - i) % n;\n c2 = c2 < 0 ? c2 + n : c2;\n if (c1 == c2 )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (c1 == x - 1 || c2 == y - 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n //100 2 97 84 89\n //5 1 4 3 2\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n\n List ax = new List();\n List by = new List();\n Queue qax = new Queue();\n Queue qby = new Queue();\n\n //Daniel\n if (a > x)\n {\n int c = a + 1;\n while (c <= n)\n {\n qax.Enqueue(c++);\n }\n }\n int sa = (a > x)? 1: a + 1;\n for (int i = sa; i <= x; i++)\n {\n qax.Enqueue(i);\n }\n\n //vlad\n if (b < y)\n {\n int c = b - 1;\n while (c > 0)\n {\n qby.Enqueue(c--);\n }\n }\n\n int sb = (b < y) ? n : b - 1;\n for (int i = sb ; i >=y; i--)\n {\n qby.Enqueue(i);\n }\n //100 2 97 84 89\n //yes\n while (qax.Count > 0 && qby.Count > 0)\n {\n int t1 = qax.Dequeue();\n int t2 = qby.Dequeue();\n if (t1 == t2)\n {\n yes = true;\n break;\n }\n }\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Circle_Metro\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int n = Next(), a = Next(), x = Next(), b = Next(), y = Next();\n\n while (true)\n {\n a++;\n b--;\n if (a > n)\n a = 1;\n if (b == 0)\n b = n;\n if (a == b)\n return true;\n if (a == x || b == y)\n return false;\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"5 1 4 3 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n var a = cin.NextInt() - 1;\n var x = cin.NextInt() - 1;\n var b = cin.NextInt() - 1;\n var y = cin.NextInt() - 1;\n\n for (var t = 0; t <= n+5; t++) {\n if (a == b) {\n System.Console.WriteLine(\"YES\");\n return;\n }\n if (a == x || b == y) break;\n a = (a + 1) % n;\n b = (b + n - 1) % n;\n }\n System.Console.WriteLine(\"NO\");\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "/* Date: 27.05.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tint n, a, b, x, y;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tn = int.Parse (ss [0]);\n\t\t\ta = int.Parse (ss [1]);\n\t\t\tx = int.Parse (ss [2]);\n\t\t\tb = int.Parse (ss [3]);\n\t\t\ty = int.Parse (ss [4]);\n\t\t}\n\n\t\tbool ok = false;\n\t\tfor ( int i=0; i <= n; i++ )\n\t\t{\n\t\t\tif ( a == b )\n\t\t\t{\n\t\t\t\tok = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( a == x || b == y )\n\t\t\t\tbreak;\n\n\t\t\ta++; b--;\n\t\t\tif ( a > n )\n\t\t\t\ta = 1;\n\t\t\tif ( b < 1 )\n\t\t\t\tb = n;\n\n# if ( ! ONLINE_JUDGE )\n\t\t\tsw.WriteLine (\"*** \" + a + \" \" + b);\n# endif\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( ok )\n\t\t\tConsole.WriteLine (\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine (\"NO\");\n# else\n\t\tif ( ok )\n\t\t\tsw.WriteLine (\"YES\");\n\t\telse\n\t\t\tsw.WriteLine (\"NO\");\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t=x>a?x-a:x+n-a;\n t=Math.Min(t,y>b?b+n-y:b-y);\n while(t-->-1)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n\n private void Go()\n {\n int n = GetInt();\n int a = GetInt()-1;\n int x = GetInt()-1;\n int b = GetInt()-1;\n int y = GetInt()-1;\n\n int first = a;\n int second = b;\n\n while(true)\n {\n if (first == second)\n { Wl(\"YES\"); return; }\n if (first == x)\n { Wl(\"NO\"); return; }\n if(second == y)\n { Wl(\"NO\"); return; }\n first = (first + 1) % n;\n second = (second + n - 1) % n;\n }\n }\n\n #region Template\n\n private static StringBuilder output = new StringBuilder();\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n output.Length = 0;\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n Console.Write(output);\n timer.Stop();\n Console.Error.WriteLine(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n do\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n } while (string.IsNullOrEmpty(ioEnum.Current));\n\n return ioEnum.Current;\n }\n\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n W(o);\n output.Append(Console.Out.NewLine);\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n W(enumerable);\n output.Append(Console.Out.NewLine);\n }\n\n private static void W(T o)\n {\n if (o is double)\n {\n Wd((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wd((o as float?).Value, \"\");\n }\n else\n output.Append(o.ToString());\n }\n\n private static void W(IEnumerable enumerable)\n {\n W(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wd(double d, string format)\n {\n W(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace globalLogin\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] str)\n\t\t{\n\t\t\tint[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n\t\t\tSolution sol = new Solution();\n\t\t\tConsole.WriteLine(sol.Intersect(info[0], info[1], info[2], info[3], info[4]) ? \"YES\" : \"NO\");\n\t\t}\n\t}\n\n\n\tinternal class Solution\n\t{\n\t\tpublic bool Intersect(int n, int a, int x, int b, int y)\n\t\t{\n\t\t\t--a;\n\t\t\t--b;\n\t\t\t--x;\n\t\t\t--y;\n\t\t\tint stationA = a;\n\t\t\tint stationB = b;\n\t\t\t// bool AInTrain = false, BInTrain = false;\n\n\t\t\tfor(int i = 0; i <= 2 * n; ++i, \n\t\t\t\tstationA = (stationA + 1) % n,\n\t\t\t\tstationB = ((stationB - 1) % n + n) % n)\n\t\t\t{\n\t\t\t\tif(stationA == stationB)\n\t\t\t\t\treturn true;\n\n\t\t\t \tif(stationA == x || stationB == y)\n\t\t\t\t \treturn false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar arr = Ints();\n\t\t\tvar n = arr[0];\n\t\t\tvar a = --arr[1];\n\t\t\tvar x = --arr[2];\n\t\t\tvar b = --arr[3];\n\t\t\tvar y = --arr[4];\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (a == b)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (a == x || b == y)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ta = (a + 1) % n;\n\t\t\t\tb = (b - 1 + n) % n;\n\t\t\t}\n\n\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[3]);\n\t\t}\n\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t}\n\n\t\tstatic long Long()\n\t\t{\n\t\t\treturn Int64.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (long, long) Long2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (long, long, long) Long3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic long[] Longs()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t}\n\n\t\tstatic string Str()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic void Swap(ref T a, ref T b)\n\t\t{\n\t\t\tvar t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] rez = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int a = rez[1], b = rez[3];\n bool check = (rez[3] - rez[1] + rez[0]) % rez[0] > 0 && (rez[4] - rez[2] + rez[0]) % rez[0] < 0;\n while(a!=rez[2]&&b!=rez[4])\n {\n if (++a > rez[0]) a = 1;\n if (--b < 1) b = rez[0];\n if (a==b)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (b < a && check ) break;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace Contest\n{\n\n class Program\n {\n private int N, A, X, B, Y;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n A = sc.NextInt()-1;\n X = sc.NextInt()-1;\n B = sc.NextInt()-1;\n Y = sc.NextInt()-1;\n\n for (int i = 0; i < N; i++)\n {\n A++;\n A %= N;\n B--;\n B += N;\n B %= N;\n if (A == B)\n {\n Console.WriteLine(\"YES\");\n return;\n \n }\n\n if (A == X || B == Y)\n {\n Console.WriteLine(\"NO\");\n return;\n \n } \n }\n }\n\n static void Main() => new Program().Solve();\n }\n}\n\nclass Scanner\n{\n public Scanner()\n {\n _stream = new StreamReader(Console.OpenStandardInput());\n _pos = 0;\n _line = new string[0];\n _separator = ' ';\n }\n private char _separator;\n private StreamReader _stream;\n private int _pos;\n private string[] _line;\n #region get a element\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = _stream.ReadLine().Split(_separator);\n _pos = 0;\n }\n return _line[_pos++];\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n #endregion\n #region convert array\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n #endregion\n #region get array\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = _stream.ReadLine().Split(_separator);\n _pos = _line.Length;\n return _line;\n }\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var a = input.ReadInt();\n var x = input.ReadInt();\n var b = input.ReadInt();\n var y = input.ReadInt();\n for (var i = 0; i < n && a != b && a != x && b != y; i++)\n {\n if (++a > n)\n a = 1;\n if (--b < 1)\n b = n;\n }\n Console.Write(a == b ? \"YES\" : \"NO\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint N = int.Parse(str[0]);\n\t\tint A = int.Parse(str[1]);\n\t\tint X = int.Parse(str[2]);\n\t\tint B = int.Parse(str[3]);\n\t\tint Y = int.Parse(str[4]);\n\t\tstring ans = \"NO\";\n\t\tint a1 = A;\n\t\tint b1 = B;\n\t\tfor(var i=0;i<=110;i++){\n\t\t\tif(a1==b1){\n\t\t\t\tans = \"YES\";\n\t\t\t}\n\t\t\tif(a1==X){\n\t\t\t break;\n\t\t\t}\n\t\t\tif(b1==Y){\n\t\t\t break;\n\t\t\t}\n\t\t\ta1 += 1;\n\t\t\tif(a1> N){\n\t\t\t\ta1 = 1;\n\t\t\t}\n\t\t\tb1 -= 1;\n\t\t\tif(b1<=0){\n\t\t\t\tb1 = N;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public static class A\n {\n public static void Main()\n {\n var numbers = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n var n = numbers[0];\n var a = numbers[1];\n var x = numbers[2];\n var b = numbers[3];\n var y = numbers[4];\n\n var pointA = a;\n var pointB = b;\n while (pointA != x && pointB != y)\n {\n if (pointA == pointB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (pointA == n)\n {\n pointA = 1;\n }\n else\n {\n pointA++;\n }\n\n if (pointB == 1)\n {\n pointB = n;\n }\n else\n {\n pointB--;\n }\n }\n if (pointA == pointB)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n Solution sol = new Solution();\n System.Console.WriteLine(sol.Check(info) ? \"YES\" : \"NO\");\n }\n }\n\n internal class Solution\n {\n public bool Check(int[] info)\n {\n int n = info[0];\n int a = info[1] - 1;\n int x = info[2] - 1;\n int b = info[3] - 1;\n int y = info[4] - 1;\n\n int stationTrainA = 0;\n int stationTrainB = n - 1;\n bool aInTheTrain = false;\n bool bInTheTrain = false;\n for(int i = 0; i <= 2 * n ; ++i, stationTrainA = (stationTrainA + 1) % n, stationTrainB = ((stationTrainB - 1) % n + n) % n)\n {\n if(stationTrainA == a)\n aInTheTrain = true;\n if(stationTrainB == b)\n bInTheTrain = true;\n\n // System.Console.WriteLine(\"(\" + stationTrainA + \", \" + aInTheTrain + \") (\" + stationTrainB + \", \" + bInTheTrain + \")\");\n if(aInTheTrain && bInTheTrain && stationTrainA == stationTrainB)\n return true;\n\n if(stationTrainA == x && aInTheTrain)\n {\n aInTheTrain = false;\n break;\n }\n if(stationTrainB == y && bInTheTrain)\n {\n bInTheTrain = false;\n break;\n }\n }\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n Solution sol = new Solution();\n System.Console.WriteLine(sol.Check(info) ? \"YES\" : \"NO\");\n }\n }\n\n internal class Solution\n {\n public bool Check(int[] info)\n {\n int n = info[0];\n int a = info[1] - 1;\n int x = info[2] - 1;\n int b = info[3] - 1;\n int y = info[4] - 1;\n\n int stationTrainA = 0;\n int stationTrainB = n - 1;\n bool aInTheTrain = false;\n bool bInTheTrain = false;\n for(int i = 0; i <= n ; ++i, stationTrainA = (stationTrainA + 1) % n, stationTrainB = ((stationTrainB - 1) % n + n) % n)\n {\n if(stationTrainA == a)\n aInTheTrain = true;\n if(stationTrainB == b)\n bInTheTrain = true;\n\n // System.Console.WriteLine(\"(\" + stationTrainA + \", \" + aInTheTrain + \") (\" + stationTrainB + \", \" + bInTheTrain + \")\");\n if(aInTheTrain && bInTheTrain && stationTrainA == stationTrainB)\n return true;\n\n if(stationTrainA == x)\n aInTheTrain = false;\n if(stationTrainB == y)\n bInTheTrain = false;\n }\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace globalLogin\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] str)\n\t\t{\n\t\t\tint[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n\t\t\tSolution sol = new Solution();\n\t\t\tConsole.WriteLine(sol.Intersect(info[0], info[1], info[2], info[3], info[4]) ? \"YES\" : \"NO\");\n\t\t}\n\t}\n\n\n\tinternal class Solution\n\t{\n\t\tpublic bool Intersect(int n, int a, int x, int b, int y)\n\t\t{\n\t\t\tint stationA = 0;\n\t\t\tint stationB = n - 1;\n\t\t\t--x;\n\t\t\t--y;\n\t\t\tbool AInTrain = false, BInTrain = false;\n\n\t\t\tfor(int i = 0; i <= 2 * n; ++i, \n\t\t\t\tstationA = ++stationA % n,\n\t\t\t\tstationB = ((stationB - 1) % n + n) %n)\n\t\t\t{\n\t\t\t\tif(stationA == a)\n\t\t\t\t\tAInTrain = true;\n\t\t\t\tif(stationB == b)\n\t\t\t\t\tBInTrain = true;\n\n\t\t\t\tif(stationA == stationB && BInTrain == AInTrain && AInTrain == true)\n\t\t\t\t\treturn true;\n\n\t\t\t\tif(stationA == x || stationB == y)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] info = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n Solution sol = new Solution();\n System.Console.WriteLine(sol.Check(info) ? \"YES\" : \"NO\");\n }\n }\n\n internal class Solution\n {\n public bool Check(int[] info)\n {\n int n = info[0];\n int a = info[1] - 1;\n int x = info[2] - 1;\n int b = info[3] - 1;\n int y = info[4] - 1;\n\n int stationTrainA = 0;\n int stationTrainB = n - 1;\n bool aInTheTrain = false;\n bool bInTheTrain = false;\n for(int i = 0; i <= n ; ++i, stationTrainA = (stationTrainA + 1) % n, stationTrainB = ((stationTrainB - 1) % n + n) % n)\n {\n if(stationTrainA == a)\n aInTheTrain = true;\n if(stationTrainB == b)\n bInTheTrain = true;\n\n // System.Console.WriteLine(\"(\" + stationTrainA + \", \" + aInTheTrain + \") (\" + stationTrainB + \", \" + bInTheTrain + \")\");\n if(aInTheTrain && bInTheTrain && stationTrainA == stationTrainB)\n return true;\n\n if(stationTrainA == x)\n {\n aInTheTrain = false;\n break;\n }\n if(stationTrainB == y)\n {\n bInTheTrain = false;\n break;\n }\n }\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] rez = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int a = rez[1], b = rez[3];\n while(a!=rez[2]||b!=rez[4])\n {\n a++;\n b--;\n if (a > rez[0]) a = 1;\n if (b < 1) b = rez[0];\n if (a==b)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (b < a) break;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n if (a == b)\n {\n Console.WriteLine(\"YES\");\n }\n else if( x == y && (x - a) == (y - b))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n while (a <= x && b >= y)\n {\n a++;\n b--;\n if (a == b)\n {\n yes = true;\n break;\n }\n }\n\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n if (a <= x && b >= y )\n {\n while (a <= x && b >= y)\n {\n a++;\n b--;\n if (a == b)\n {\n yes = true;\n break;\n }\n }\n\n \n }\n else\n {\n\n\n List ax = new List();\n List by = new List();\n int i = a + 1;\n for (; i <= n; i++)\n {\n ax.Add(i);\n }\n i = 1;\n while (i <=x )\n {\n ax.Add(i);\n i++;\n }\n \n for ( int k = b -1; k >= 1; k--)\n {\n by.Add(k);\n }\n i = n;\n while (i >= y)\n {\n by.Add(i);\n i--;\n }\n for (i = 0; i < ax.Count && i < by.Count; i++)\n {\n if(ax[i] == by[i])\n {\n yes = true;\n break;\n }\n }\n\n\n }\n\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n /*if (a <= x && b >= y )\n {\n while (a <= x && b >= y)\n {\n a++;\n b--;\n if (a == b)\n {\n yes = true;\n break;\n }\n }\n\n \n }\n else\n {*/\n int p = n;\n int h = n;\n if (a <= x && b >= y)\n {\n n = x;\n p = 0;\n h = 101;\n \n }\n List ax = new List();\n List by = new List();\n int i = a + 1;\n for (; i <= n; i++)\n {\n ax.Add(i);\n }\n while (h <= x)\n {\n ax.Add(i);\n i++;\n }\n\n for (int k = b - 1; k >= 1; k--)\n {\n by.Add(k);\n }\n \n while (p >= y)\n {\n by.Add(p);\n p--;\n }\n for (i = 0; i < ax.Count && i < by.Count; i++)\n {\n if (ax[i] == by[i])\n {\n yes = true;\n break;\n }\n }\n\n\n //}\n\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace leetcode\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n //100 2 97 84 89\n //5 1 4 3 2\n bool yes = false;\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n\n int b = int.Parse(s[3]);\n int y = int.Parse(s[4]);\n\n\n List ax = new List();\n List by = new List();\n Queue qax = new Queue();\n Queue qby = new Queue();\n\n //Daniel\n if (a > x)\n {\n int c = a + 1;\n while (c <= n)\n {\n qax.Enqueue(c++);\n }\n }\n int sa = (a > x)? 1: a + 1;\n for (int i = sa; i <= x; i++)\n {\n qax.Enqueue(i);\n }\n\n //vlad\n if (b < y)\n {\n int c = b - 1;\n while (c > 0)\n {\n qby.Enqueue(c--);\n }\n }\n\n int sb = (b < y) ? n : b;\n for (int i = sb; i >=y; i--)\n {\n qby.Enqueue(i);\n }\n //100 2 97 84 89\n //yes\n while (qax.Count > 0 && qby.Count > 0)\n {\n int t1 = qax.Dequeue();\n int t2 = qby.Dequeue();\n if (t1 == t2)\n {\n yes = true;\n break;\n }\n }\n Console.WriteLine(yes == true ? \"YES\" : \"NO\");\n\n\n }\n }\n}\n"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"5 1 4 3 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n var a = cin.NextInt() - 1;\n var x = cin.NextInt() - 1;\n var b = cin.NextInt() - 1;\n var y = cin.NextInt() - 1;\n\n for (var t = 0; t <= n+5; t++) {\n if (a == b) {\n System.Console.WriteLine(\"YES\");\n return;\n }\n if (a == x || b == y) break;\n a = (a + 1) % n;\n b = (b - 1) % n;\n }\n System.Console.WriteLine(\"NO\");\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "/* Date: 27.05.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tint n, a, b, x, y;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tn = int.Parse (ss [0]);\n\t\t\ta = int.Parse (ss [1]);\n\t\t\tx = int.Parse (ss [2]);\n\t\t\tb = int.Parse (ss [3]);\n\t\t\ty = int.Parse (ss [4]);\n\t\t}\n\n\t\tbool ok = false;\n\t\tfor ( int i=0; i <= n; i++ )\n\t\t{\n\t\t\tif ( a == b )\n\t\t\t{\n\t\t\t\tok = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta++; b--;\n\t\t\tif ( a > n )\n\t\t\t\ta = 1;\n\t\t\tif ( b < 1 )\n\t\t\t\tb = n;\n\n# if ( ! ONLINE_JUDGE )\n\t\t\tsw.WriteLine (\"*** \" + a + \" \" + b);\n# endif\n\n\t\t\tif ( a == x || b == y )\n\t\t\t\tbreak;\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( ok )\n\t\t\tConsole.WriteLine (\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine (\"NO\");\n# else\n\t\tif ( ok )\n\t\t\tsw.WriteLine (\"YES\");\n\t\telse\n\t\t\tsw.WriteLine (\"NO\");\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "/* Date: 27.05.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tint n, a, b, x, y;\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\tn = int.Parse (ss [0]);\n\t\t\ta = int.Parse (ss [1]);\n\t\t\tx = int.Parse (ss [2]);\n\t\t\tb = int.Parse (ss [3]);\n\t\t\ty = int.Parse (ss [4]);\n\t\t}\n\n\t\tbool ok = false;\n\t\tfor ( int i=0; i <= n; i++ )\n\t\t{\n\t\t\tif ( a == b )\n\t\t\t{\n\t\t\t\tok = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta++; b--;\n\t\t\tif ( a > n )\n\t\t\t\ta = 1;\n\t\t\tif ( b < 1 )\n\t\t\t\tb = n;\n\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tif ( ok )\n\t\t\tConsole.WriteLine (\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine (\"NO\");\n# else\n\t\tif ( ok )\n\t\t\tsw.WriteLine (\"YES\");\n\t\telse\n\t\t\tsw.WriteLine (\"NO\");\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t = n;\n while(t-->0)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n break;\n }\n else\n {\n a = a == n ? 1 : a++;\n b = b == 1 ? n : b--;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t = n;\n while(t-->-1)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t=x>a?x-a:x+n-a;\n t=Math.Min(t,y>b?y-b:y+n-b);\n while(t-->=-1)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t=x>a?x-a:x+n-a;\n t=Math.Min(t,y>b?y-b:y+n-b);\n while(t-->=0)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nclass problem\n{\n static void Main()\n {\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n int n = v[0], a = v[1], x = v[2], b = v[3], y = v[4];\n int t = n;\n while(t-->0)\n {\n if(a == b)\n {\n Console.WriteLine( \"YES\" );\n return;\n }\n else\n {\n a = a == n ? 1 : a+1;\n b = b == 1 ? n : b-1;\n }\n }\n Console.WriteLine( \"NO\" );\n\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n\n static int? getVal(char c)\n {\n if (c >= 'a' && c <= 'f')\n return 10 + (c - 'a');\n if (c >= 'A' && c <= 'F')\n return 10 + (c - 'A');\n if (c >= '0' && c <= '9')\n return c - '0';\n return null;\n }\n\n static char? convert(char? A, char? B)\n {\n if (A == null || B == null)\n return null;\n var x = getVal(A.Value);\n var y = getVal(B.Value);\n if (x == null || y == null)\n return null;\n var res = x.Value * 16 + y.Value;\n return (char)res;\n }\n\n static void Main(string[] args)\n {\n var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = nm[0];\n var a = nm[1];\n var x = nm[2];\n var b = nm[3];\n var y = nm[4];\n for (int i = 0; i < n; i++)\n {\n var c1 = (a + i) % (n+1);\n var c2 = (b - i) % (n+1);\n c2 = c2 < 0 ? c2 + (n+1) : c2;\n if (c1 == c2 )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (c1 == x || c2 == y)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n\n static int? getVal(char c)\n {\n if (c >= 'a' && c <= 'f')\n return 10 + (c - 'a');\n if (c >= 'A' && c <= 'F')\n return 10 + (c - 'A');\n if (c >= '0' && c <= '9')\n return c - '0';\n return null;\n }\n\n static char? convert(char? A, char? B)\n {\n if (A == null || B == null)\n return null;\n var x = getVal(A.Value);\n var y = getVal(B.Value);\n if (x == null || y == null)\n return null;\n var res = x.Value * 16 + y.Value;\n return (char)res;\n }\n\n static void Main(string[] args)\n {\n var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = nm[0];\n var a = nm[1];\n var x = nm[2];\n var b = nm[3];\n var y = nm[4];\n for (int i = 0; i < n; i++)\n {\n var c1 = (a + i) % n;\n var c2 = (b - i) % n;\n c2 = c2 < 0 ? c2 + n : c2;\n if (c1 == c2 )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (c1 == x || c2 == y)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n\n static int? getVal(char c)\n {\n if (c >= 'a' && c <= 'f')\n return 10 + (c - 'a');\n if (c >= 'A' && c <= 'F')\n return 10 + (c - 'A');\n if (c >= '0' && c <= '9')\n return c - '0';\n return null;\n }\n\n static char? convert(char? A, char? B)\n {\n if (A == null || B == null)\n return null;\n var x = getVal(A.Value);\n var y = getVal(B.Value);\n if (x == null || y == null)\n return null;\n var res = x.Value * 16 + y.Value;\n return (char)res;\n }\n\n static void Main(string[] args)\n {\n var nm = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n var n = nm[0];\n var a = nm[1];\n var x = nm[2];\n var b = nm[3];\n var y = nm[4];\n for (int i = 0; i < n; i++)\n {\n var c1 = (a + i) % n;\n var c2 = (b - i) % n;\n c2 = c2 < 0 ? c2 + n : c2;\n if (c1 == c2 )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (c1 == x || c2 == y)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}"}], "src_uid": "5b889751f82c9f32f223cdee0c0095e4"} {"source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main( )\n {\n string input = Console.ReadLine();\n string[] separ = new string[] {\" \"};\n string[] resulting = input.Split(separ, StringSplitOptions.None);\n uint[] mas = new uint[8];\n for (int i = 0; i < 8; i++)\n {\n mas[i] = uint.Parse(resulting[i]);\n }\n Console.WriteLine(Math.Min(Math.Min(mas[1]*mas[2]/mas[6],mas[3]*mas[4]), mas[5]/mas[7])/mas[0]);\n Console.ReadLine();\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\n\nnamespace fun\n{\n class Program\n {\n private static TextReader cin = Console.In;\n private static TextWriter cout = Console.Out;\n static void Main(string[] args)\n {\n string s = cin.ReadLine() ;\n int n = int.Parse(s.Split(' ')[0]);\n int k = int.Parse(s.Split(' ')[1]);\n int l = int.Parse(s.Split(' ')[2]);\n int c = int.Parse(s.Split(' ')[3]);\n int d = int.Parse(s.Split(' ')[4]);\n int p = int.Parse(s.Split(' ')[5]);\n int nl = int.Parse(s.Split(' ')[6]);\n int np = int.Parse(s.Split(' ')[7]);\n cout.WriteLine(Math.Min(Math.Min(c * d, k * l / nl), p / np) / n);\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int[] parameters;\n int[] ingredients = new int[3];//handles milimeters, limes, and salt variables\n\n parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n\n ingredients[0] = parameters[1] * parameters[2];//quantity of drink available for toasts\n ingredients[0] /= parameters[6];\n\n ingredients[1] = parameters[3] * parameters[4];//limes available for toasts\n\n ingredients[2] = parameters[5] / parameters[7];//salt available for toasts\n\n Array.Sort(ingredients);\n\n Console.WriteLine(Math.Min(ingredients[0], ingredients[1]) / parameters[0]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var z = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = z[0], k = z[1], l = z[2], c = z[3], d = z[4], p = z[5], nl = z[6], np = z[7];\n var ans = Math.Min(k * l / nl, Math.Min(c * d, p / np)) / n;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _151A_SoftDrinking.Run();\n\n }\n }\n class _151A_SoftDrinking\n {\n public static void Run()\n {\n var ln = Console.ReadLine().Trim().Split(' ');\n var a = new short[8];\n for (short i = 0; i < 8; i++)\n a[i] = short.Parse(ln[i]);\n\n var d = a[1]*a[2];\n var l = a[3]*a[4];\n\n var min = Math.Min(d/a[6], Math.Min(l, a[5]/a[7])) / a[0];\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program {\n\n #region input\n\n static long readLong() {\n long num;\n long.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static ulong readULong() {\n ulong num;\n ulong.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static int readInt() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static bool readBool() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num != 0;\n }\n\n static long[] readLongs() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n long[] parsed = new long[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n long.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static int[] readInts() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n int.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static void readInts(out int a,out int b) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n int.TryParse(nums[0],out a);\n int.TryParse(nums[1],out b);\n }\n\n static BitArray readBools() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != \"0\") {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static BitArray readBools(string off) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != off) {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static void waist() {\n Console.ReadLine();\n }\n\n #endregion\n\n #region utility\n\n static void print(List l) {\n for(int i = 0; i < l.Count; i++) {\n if(i != 0) {\n Console.Write(\" \");\n }\n Console.Write((l[i]));\n }\n Console.WriteLine();\n }\n\n static long largeModolu(long a,long b,long m) {\n long prev = a;\n long sum = (b & 1) > 0 ? a : 1;\n int digits = (int)(Math.Ceiling(Math.Log(b,2)));\n for(int i = 1; i < digits; i++) {\n prev = (prev * prev) % (m);\n if((b & (1l << i)) > 0) {\n sum = (sum * prev) % (m);\n }\n }\n return sum;\n }\n\n static long GCD(long a,long b) {\n long temp;\n if(a > b) {\n temp = b;\n b = a;\n a = temp;\n }\n while(b != 0) {\n temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n }\n\n class SortableKVP where T : IComparable {\n List> data { set; get; }\n\n public int count {\n get {\n return data.Count;\n }\n }\n\n public T this[int index] {\n get {\n return data[index].Item2;\n }\n }\n\n public int originalIndex(int sortedIndex) {\n return data[sortedIndex].Item1;\n }\n\n public void sort() {\n data.Sort((a,b) => a.Item2.CompareTo(b.Item2));\n }\n\n public void add(T item) {\n data.Add(new Tuple(data.Count,item));\n }\n\n public void removeAt(int sortedIndex) {\n data.RemoveAt(sortedIndex);\n }\n\n public SortableKVP() {\n data = new List>();\n }\n\n public SortableKVP(T[] data) {\n this.data = new List>(data.Length);\n for(int i = 0; i < data.Length; i++) {\n this.data.Add(new Tuple(i,data[i]));\n }\n }\n }\n\n #endregion\n\n static void Main(string[] args) {\n long[] input = readLongs();\n Console.WriteLine(Math.Min(Math.Min(input[1] * input[2] / input[6],input[3] * input[4]),input[5] / input[7]) / input[0]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._151A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int l = int.Parse(input[2]);\n int c = int.Parse(input[3]);\n int d = int.Parse(input[4]);\n int p = int.Parse(input[5]);\n int nl = int.Parse(input[6]);\n int np = int.Parse(input[7]);\n int drinkHas = k * l;\n int sliceHas = c * d;\n int drinkNeed = n * nl;\n int sliceNeed = n;\n int saltNeed = n * np;\n int ans = Math.Min(drinkHas / drinkNeed, Math.Min(sliceHas / sliceNeed, p / saltNeed));\n Console.WriteLine(ans.ToString());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getList();\n\t\t\tvar ans = Min(Min(l[1] * l[2] / l[6], l[5] / l[7]), l[3] * l[4]) / l[0];\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _151A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var ans = Math.Min( (s[1] * s[2] / s[6]), Math.Min(s[5]/s[7], s[3]*s[4]))/s[0];\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \",col));\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n//----------------------------------------------------------------------------\n\n static void Main(string[] args)\n {\n int[] a = ReadIntArrayLine();\n\n int n=a[0], k=a[1], l=a[2], c=a[3], d=a[4], p=a[5], nl=a[6], np=a[7];\n\n int pd = (k * l) / nl;\n int pl = c * d;\n int ps = p / np;\n\n\n PrintLn(Math.Min(pd, Math.Min(pl, ps))/n);\n\n }\n \n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar number = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\t\t\tvar friends = number[0];\n\t\t\tvar bottles = number[1];\n\t\t\tvar milliliters = number[2];\n\t\t\tvar limes = number[3];\n\t\t\tvar slices = number[4];\n\t\t\tvar salt = number[5];\n\t\t\tvar nl = number[6];\n\t\t\tvar np = number[7];\n\n\t\t\tvar totalDrink = bottles * milliliters;\n\t\t\tvar toasts = totalDrink / nl;\n\t\t\tvar toastsWithLimes = limes * slices;\n\t\t\tvar toastsWithSalt = salt / np;\n\n\t\t\tConsole.WriteLine(Math.Min(toasts, Math.Min(toastsWithLimes, toastsWithSalt)) / friends);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] arr = new int[10];\n int size = 0;\n\n foreach(var tmp in Console.ReadLine().Split())\n {\n arr[size] = Convert.ToInt32(tmp);\n size++;\n }\n\n int n = arr[0];\n\n int remaining_vodka = arr[1] * arr[2];\n int remaining_limes = arr[3] * arr[4];\n int remaining_salt = arr[5];\n int vodka_for_one_tost = arr[6];\n int salt_for_one_tost = arr[7];\n\n int counter = 0;\n\n while(remaining_vodka >= (n * vodka_for_one_tost) && (remaining_salt >= n * salt_for_one_tost) && remaining_limes >= n) \n {\n remaining_vodka -= n * vodka_for_one_tost;\n remaining_salt -= n * salt_for_one_tost;\n remaining_limes-= n;\n counter++;\n }\n Console.WriteLine(counter);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray(); \n int rez = Math.Min(n[1]*n[2]/n[6],Math.Min(n[3]*n[4],n[5]/n[7]))/n[0];\n\n Console.WriteLine(rez);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Test {\n static public void Main(String[] args){\n string [] tmp = Console.ReadLine().Split();\n int n = Int32.Parse(tmp[0]);\n int ltotal = Int32.Parse(tmp[1])*Int32.Parse(tmp[2]);\n int limetotal = Int32.Parse(tmp[3])*Int32.Parse(tmp[4]);\n int stotal = Int32.Parse(tmp[5]);\n \n int nl = Int32.Parse(tmp[6]);\n int np = Int32.Parse(tmp[7]);\n \n int[] toasts = new int[3];\n toasts[0] = ltotal/nl;\n toasts[1] = limetotal;\n toasts[2] = stotal/np;\n \n int ans = (toasts.Min())/n;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace softdrink\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string[] s = a.Split(' ');\n int n, k, l, c, d, p, nl, np;\n n = Convert.ToInt16(s[0]);\n k = Convert.ToInt16(s[1]);\n l = Convert.ToInt16(s[2]);\n c = Convert.ToInt16(s[3]);\n d = Convert.ToInt16(s[4]);\n p = Convert.ToInt16(s[5]);\n nl = Convert.ToInt16(s[6]);\n np = Convert.ToInt16(s[7]);\n int totaldrink = k * l;\n int totallime = c * d;\n int totalsalt = p;\n int td = totaldrink / nl;\n int ts = totalsalt / np;\n int tl = totallime;\n int min = td;\n if (min < ts)\n min = td;\n else\n min = ts;\n if (min < tl)\n ;\n else\n min = tl;\n int result = min /n;\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n int[] inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = inputs[0];\n int k = inputs[1];\n int l = inputs[2];\n int c = inputs[3];\n int d = inputs[4];\n int p = inputs[5];\n int nl = inputs[6];\n int np = inputs[7];\n int k1 = (k*l)/nl;\n int k2 = (c*d);\n int k3 = p/np;\n int min = Math.Min(Math.Min(k1,k2),k3);\n Console.WriteLine(min/n);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _107a\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n int n = sc.nextInt();\n int k = sc.nextInt();\n int l = sc.nextInt();\n int c = sc.nextInt();\n int d = sc.nextInt();\n int p = sc.nextInt();\n int nl = sc.nextInt();\n int np = sc.nextInt();\n\n\n int one = k * l / (nl * n);\n int two = (c * d) / n;\n int three = p / (np * n);\n\n Console.WriteLine(Math.Min(Math.Min(one, two), three));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar n = cin.NextInt();\n\t\t\tvar k = cin.NextInt();\n\t\t\tvar l = cin.NextInt();\n\t\t\tvar c = cin.NextInt();\n\t\t\tvar d = cin.NextInt();\n\t\t\tvar p = cin.NextInt();\n\t\t\tvar nl = cin.NextInt();\n\t\t\tvar np = cin.NextInt();\n\t\t\tvar result = Math.Min(Math.Min(k*l/nl, c*d), p/np)/n;\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _151A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int l = int.Parse(tokens[2]);\n int c = int.Parse(tokens[3]);\n int d = int.Parse(tokens[4]);\n int p = int.Parse(tokens[5]);\n int nl = int.Parse(tokens[6]);\n int np = int.Parse(tokens[7]);\n\n Console.WriteLine(Math.Min((k * l) / (n * nl), Math.Min((c * d) / n, p / (n * np))));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Hasirovka\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] chysla = Console.ReadLine().Split(' ');\n int n = Int32.Parse(chysla[0]), k = Int32.Parse(chysla[1]), l = Int32.Parse(chysla[2]), c = Int32.Parse(chysla[3]), d = Int32.Parse(chysla[4]),\n p = Int32.Parse(chysla[5]), nl = Int32.Parse(chysla[6]), np = Int32.Parse(chysla[7]);\n int[] tosty = new int[3];\n tosty[0] = (k * l)/nl;\n tosty[1] = c * d;\n tosty[2] = p / np;\n int k_tostiv = tosty.Min() / n;\n Console.WriteLine(k_tostiv);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = ReadArray();\n var res = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n res[i] = ReadNextInt(input, i);\n }\n return res;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var a = new List(ReadIntArray());\n var res = Math.Min((a[1]*a[2])/a[6], a[3]*a[4]);\n res = Math.Min(res, a[5]/a[7]);\n Console.WriteLine(res/a[0]);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Problem\n{\n class Program\n {\n static void Main()\n {\n var lst = Console.ReadLine().Split(new [] {' '});\n var n = int.Parse(lst[0]);\n var k = int.Parse(lst[1]);\n var l = int.Parse(lst[2]);\n var c = int.Parse(lst[3]);\n var d = int.Parse(lst[4]);\n var p = int.Parse(lst[5]);\n var nl = int.Parse(lst[6]);\n var np = int.Parse(lst[7]);\n var lime = c*d/n;\n var salt = p/(n*np);\n var tmp = Math.Min(lime, salt);\n var gas = k*l/(nl*n);\n Console.WriteLine(Math.Min(tmp, gas));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nstatic class Problem_A\n{\n static void Main(string[] args)\n {\n#if TRACE\n Console.SetIn(File.OpenText(\"../../in.txt\"));\n#endif\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int res = int.MaxValue;\n\n res = Math.Min(res, input[3] * input[4]);\n res = Math.Min(res, input[5] / input[7]);\n res = Math.Min(res, input[1] * input[2] / input[6]);\n\n Console.WriteLine(res / input[0]);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace AcmSolution4\n{\n class Program\n {\n private static void Do()\n {\n var a = GetInts();\n var n = a[0];\n var a1 = a[1] * a[2] / a[6];\n var a2 = a[3] * a[4];\n var a3 = a[5] / a[7];\n\n WL(Math.Min(a1, Math.Min(a2, a3)) / n);\n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ACM_HOME\n Do();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(\"Answer: \" + GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadLine();\n#endif\n }\n\n #region Utils\n const double Epsilon = 0.00000000000001;\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n\n static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n #endregion\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems.A\n{\n class A115_Party\n {\n public static void Main()\n {\n //while(true)\n //{\n int n, k, l, c, d, p, nl, np; \n string[] a = Console.ReadLine().Split(' ');\n n = int.Parse(a[0]);\n k = int.Parse(a[1]);\n l = int.Parse(a[2]);\n c = int.Parse(a[3]);\n d = int.Parse(a[4]);\n p = int.Parse(a[5]);\n nl = int.Parse(a[6]);\n np = int.Parse(a[7]);\n var totalMl = k * l;\n var totalLime = c * d;\n nl *= n;\n np *= n;\n int toasts = 0;\n while(nl<=totalMl && np<=p && n<=totalLime)\n {\n toasts++;\n \n totalMl -= nl;\n totalLime -= n;\n p -= np;\n }\n Console.WriteLine(toasts);\n // }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int l = int.Parse(tokens[2]);\n int c = int.Parse(tokens[3]);\n int d = int.Parse(tokens[4]);\n int p = int.Parse(tokens[5]);\n int nl = int.Parse(tokens[6]);\n int np = int.Parse(tokens[7]);\n\n int a = k*l/nl;\n int b = c*d;\n int x = p/np;\n\n int res1 = Math.Min(a, b);\n int res2 = Math.Min(res1, x);\n int res = res2/n;\n\n Console.WriteLine(res);\n\n\n }\n }\n\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = int.Parse(s.Split(' ')[0]), k = int.Parse(s.Split(' ')[1]), l = int.Parse(s.Split(' ')[2]), \n c = int.Parse(s.Split(' ')[3]), d = int.Parse(s.Split(' ')[4]), p = int.Parse(s.Split(' ')[5]), \n nl = int.Parse(s.Split(' ')[6]), np = int.Parse(s.Split(' ')[7]);\n int tostb = k * l / nl / n;\n int tosts = p / np / n;\n int tostd = d * c / n;\n Console.WriteLine(Math.Min(Math.Min(tostb, tosts), Math.Min(tosts, tostd)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Aux = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n int n,k,l,c,d,p,nl,np;\n n = Aux[0];\n k = Aux[1];\n l = Aux[2];\n c = Aux[3];\n d = Aux[4];\n p = Aux[5];\n nl = Aux[6];\n np = Aux[7];\n int Aux1 = (k*l)/nl;\n int Aux2 = c * d;\n int Aux3 = p / np;\n Console.WriteLine(Math.Min(Math.Min(Aux1,Aux2),Aux3)/n);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n\n\n\n s = Console.ReadLine();\n string[] b = s.Split(' ');\n int[] numbers = new int[8];\n\n\n for (int i = 0; i < b.Length; i++)\n {\n numbers[i] = int.Parse(b[i]);\n\n }\n int x, y, z;\n x = (numbers[1] * numbers[2]) / numbers[6];\n y = numbers[3] * numbers[4];\n z = numbers[5] / numbers[7];\n \n\n int min = x;\n if (y < min || z int.Parse(s)).ToArray();\n int n = nklcdpnlnp[0];\n int k = nklcdpnlnp[1];\n int l = nklcdpnlnp[2];\n int c = nklcdpnlnp[3];\n int d = nklcdpnlnp[4];\n int p = nklcdpnlnp[5];\n int nl = nklcdpnlnp[6];\n int np = nklcdpnlnp[7];\n\n int gas = k * l;\n int limes = c * d;\n int tost = Enumerable.Min(new int[] { gas / (n * nl), p / (n * np), limes / n });\n Console.WriteLine(tost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, k, l, c, d, p, nl, np;\n string[] t = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(t[0]);\n k = int.Parse(t[1]);\n l = int.Parse(t[2]);\n c = int.Parse(t[3]);\n d = int.Parse(t[4]);\n p = int.Parse(t[5]);\n nl = int.Parse(t[6]);\n np = int.Parse(t[7]);\n int max = ((k * l) / (nl * n));\n int cur = (c * d) / n;\n if (cur < max)\n max = cur;\n cur = p / (np * n);\n if (cur < max)\n max = cur;\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _151A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] tokens = line.Split(' ');\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int l = int.Parse(tokens[2]);\n int c = int.Parse(tokens[3]);\n int d = int.Parse(tokens[4]);\n int p = int.Parse(tokens[5]);\n int nl = int.Parse(tokens[6]);\n int np = int.Parse(tokens[7]);\n\n int slices = c * d;\n int drink = k * l;\n\n int each_toast_drink = nl * n;\n int each_toast_salt = np * n;\n int each_toast_slices = n;\n\n int toast_num = 0;\n while(slices / each_toast_slices >= 1 && drink / each_toast_drink >= 1 && p / each_toast_salt >= 1)\n {\n toast_num++;\n slices -= each_toast_slices;\n drink -= each_toast_drink;\n p -= each_toast_salt;\n }\n\n Console.WriteLine(toast_num);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k= Convert.ToInt32(s[1]);\n int l= Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n int[] a = new int[3];\n int gas = k * l;\n int g = gas / nl; a[0] = g;\n int lai = c * d; a[1] = lai;\n int soli = p / np; a[2] = soli;\n int min = 100000000;\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] < min) { min = a[i]; }\n }\n Console.WriteLine(min / n);\n \n\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string[] s1 = str1.Split(' ');\n int n = Convert.ToInt32(s1[0]);\n int k = Convert.ToInt32(s1[1]);\n int l = Convert.ToInt32(s1[2]);\n int c = Convert.ToInt32(s1[3]);\n int d = Convert.ToInt32(s1[4]);\n int p = Convert.ToInt32(s1[5]);\n int nl = Convert.ToInt32(s1[6]);\n int np = Convert.ToInt32(s1[7]);\n int kl = (k * l)/nl;\n int cd = c * d;\n int p_np = p / np;\n int[] arr = new int[3];\n arr[0] = kl;\n arr[1] = cd;\n arr[2] = p_np;\n Array.Sort(arr);\n Console.WriteLine(arr[0] / n);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace TestProject\n{\n class Program\n {\n static void Main(string[] args)\n {\n var vals = Console.ReadLine().Split(' ');\n int.TryParse(vals[0], out int n); // \u041a\u043e\u043b-\u0432\u043e \u043b\u044e\u0434\u0435\u0439\n int.TryParse(vals[1], out int k); // \u041a\u043e\u043b-\u0432\u043e \u0431\u0443\u0442\u044b\u043b\u043e\u043a\n int.TryParse(vals[2], out int l); // \u041e\u0431\u044a\u0435\u043c 1 \u0431\u0443\u0442\u044b\u043b\u043a\u0438\n int.TryParse(vals[3], out int c); // \u041a\u043e\u043b-\u0432\u043e \u043b\u0430\u0439\u043c\u043e\u0432\n int.TryParse(vals[4], out int d); // \u041a\u043e\u043b-\u0432\u043e \u0434\u043e\u043b\u0435\u043a \u0432 1 \u043b\u0430\u0439\u043c\u0435\n int.TryParse(vals[5], out int p); // \u041a\u043e\u043b-\u0432\u043e \u0441\u043e\u043b\u0438\n int.TryParse(vals[6], out int nl); // \u041a\u043e\u043b-\u0432\u043e \u043c\u0438\u043b\u0438\u043b\u0438\u0442\u0440\u043e\u0432 1 \u0434\u043e\u0437\u0430, \u043d\u0430 1 \u0434\u043e\u0437\u0443 1 \u043b\u043e\u043c\u0442\u0438\u043a \u043b\u0430\u0439\u043c\u0430\n int.TryParse(vals[7], out int np); // \u041a\u043e\u043b-\u0432\u043e \u0441\u043e\u043b\u0438 1 \u0434\u043e\u0437\u0430\n\n // \u0414\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u043e\u0441\u0442\u0430 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u0434\u0440\u0443\u0437\u0435\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f nl \u043c\u0438\u043b\u043b\u0438\u043b\u0438\u0442\u0440\u043e\u0432 \u0433\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u0438, \u043e\u0434\u043d\u0430 \u0434\u043e\u043b\u044c\u043a\u0430 \u043b\u0430\u0439\u043c\u0430 \u0438 np \u0433\u0440\u0430\u043c\u043c\u043e\u0432 \u0441\u043e\u043b\u0438. \n // \u0414\u0440\u0443\u0437\u044c\u044f \u0445\u043e\u0442\u044f\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u043e\u0441\u0442\u043e\u0432, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u0438\u0442\u044c \u043f\u043e\u0440\u043e\u0432\u043d\u0443. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0441\u0442\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e?\n\n var a1 = k * l; // \u041e\u0431\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u0433\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u0438\n var a2 = c * d; // \u041e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b-\u0432\u043e \u0434\u043e\u0437 \u0434\u043e\u043b\u0435\u043a\n var a3 = a1 / nl; // \u041a\u043e\u043b-\u0432\u043e \u0434\u043e\u0437 \u0433\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u0438\n var a4 = p / np; // \u041a\u043e\u043b-\u0432\u043e \u0434\u043e\u0437 \u0441\u043e\u043b\u0438\n\n var min = new int[] { a2, a3, a4 }.Min();\n\n if (min > 0)\n {\n var cnt = 0;\n while (min >= n)\n {\n ++cnt;\n min -= n;\n }\n Console.WriteLine(cnt);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace temp\n{\n class MainClass\n {\n private static Int32[] read_ints(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int32[] ret = new Int32[n];\n for (Int32 i = 0; i < n; i++)\n ret[i] = Convert.ToInt32(str[i]);\n return ret;\n }\n\n private static Int32 read_int() {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n private static Int64[] read_longs(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int64[] ret = new Int64[n];\n for (Int64 i = 0; i < n; i++)\n ret[i] = Convert.ToInt64(str[i]);\n return ret;\n }\n\n private static Int64 read_long() {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n private static string read_line() {\n return Console.ReadLine();\n }\n\n public static void Main (string[] args)\n {\n int[] arr = read_ints(8);\n int friends = arr[0];\n int drink = arr[1]*arr[2];\n int lemons = arr[3]*arr[4];\n int salt = arr[5];\n int cnt = 0;\n while (true) {\n bool fail = false;\n for (int i = 0; i < friends; i++) {\n if (arr[6] <= drink)\n drink -= arr[6];\n else {\n fail = true;\n break;\n }\n if (arr[7] <= salt)\n salt -= arr[7];\n else {\n fail = true;\n break;\n }\n if (lemons > 0)\n lemons--;\n else {\n fail = true;\n break;\n }\n }\n if (fail)\n break;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Soft_drinking_toasts_number\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n, k, l, c, d, p, nl, np;\n n = Convert.ToInt32(line[0]);\n k = Convert.ToInt32(line[1]);\n l = Convert.ToInt32(line[2]);\n c = Convert.ToInt32(line[3]);\n d = Convert.ToInt32(line[4]);\n p = Convert.ToInt32(line[5]);\n nl = Convert.ToInt32(line[6]);\n np = Convert.ToInt32(line[7]);\n int dozeAlcool = k * l / nl;\n int feliiLamaie = c * d;\n int dozaSare = p / np;\n int a = Math.Min(dozeAlcool, dozaSare);\n int b = Math.Min(a, feliiLamaie);\n Console.WriteLine(b / n);\n }\n }\n}\n"}, {"source_code": "\ufeff using System;\n using System.Collections.Generic;\n using System.IO;\n\n public class pA\n {\n public static void Main ( )\n {\n #if false\n Console.SetIn ( new StreamReader ( @\"e:\\zin.txt\" ) );\n #endif\n int x = calc ( );\n Console.WriteLine ( x );\n }\n\n private static int calc ( )\n {\n int[] q = ReadLineToInts ( );\n int i=0;\n int n = q[i++];\n int k = q[i++];\n int l = q[i++];\n int c = q[i++];\n int d = q[i++];\n int p = q[i++];\n int nl = q[i++];\n int np = q[i++];\n int tdrink = k * l / nl;\n int tlime = c * d;\n int tsalt = p / np;\n return Math.Min ( Math.Min ( tdrink, tlime ), tsalt ) / n;\n }\n\n public static int[] ReadLineToInts ( )\n {\n string line = Console.ReadLine ( );\n string[] arStrings = line.Split ( new char[] { ' ' } );\n\n int N = arStrings.Length;\n int[] ints = new int[N];\n for ( int i=0; i < N; i++ )\n ints[i] = int.Parse ( arStrings[i] );\n return ints;\n }\n\n\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace SoftDrinking\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int totalMl = input[1] * input[2];\n int totalLimeSlices = input[3] * input[4];\n int salt = input[5];\n int res = 0;\n while ((totalMl - input[6]) >= 0 && (totalLimeSlices - 1) >= 0 && (salt - input[7]) >= 0)\n {\n res++;\n totalMl -= input[6];\n salt -= input[7];\n totalLimeSlices--;\n }\n Console.WriteLine(res / input[0]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\nusing System.Reflection;\n\nclass Program\n{\n static void solve()\n {\n int[] arr = RA();\n\n int n = arr[0], k = arr[1], l = arr[2], c = arr[3], d = arr[4], p = arr[5], nl = arr[6], np = arr[7];\n\n int tosts = k * l / nl;\n int laims = d * c;\n int soli = p / np;\n\n Console.WriteLine(Math.Min(tosts, Math.Min(laims, soli)) / n);\n }\n\n #region\n struct quat { public T1 fst; public T2 snd; public T3 thr; public T4 frt;}\n struct trip { public T1 fst; public T2 snd; public T3 thr;}\n struct pair { public T1 fst; public T2 snd;}\n static long LCM(long a, long b) { return a / GCD(a, b) * b; }\n static long GCD(long a, long b) { if (b == 0) return a; else return GCD(b, a % b); }\n static void Swap(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }\n static double Dist(double x1, double y1, double x2, double y2) { return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)); }\n static long Factorial(int n) { long ans = 1; for (int i = 2; i <= n; i++)ans *= i; return ans; }\n static void Fill(T[] d, T v) { for (int i = 0; i < d.Length; i++)d[i] = v; }\n static void Fill(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }\n static T[] RA() { return RLine().Split().Select(v => (T)Convert.ChangeType(v, typeof(T))).ToArray(); }\n\n static void Main()\n {\n#if DEBUG\n StreamWriter fout;\n Console.SetIn(new StreamReader(\"input.txt\"));\n Console.SetOut(fout = new StreamWriter(\"output.txt\"));\n#endif\n solve();\n#if DEBUG\n fout.Close();\n#endif\n }\n\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RC()\n {\n return Console.Read();\n }\n\n static double RD()\n {\n bool m = false;\n double val = 0;\n int c = 0, r = 1;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-')\n {\n }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read()) >= '0' && c <= '9')\n val = val * 10 + (m ? -(c - 48) : (c - 48));\n if (c == '.')\n while ((c = Console.Read()) >= '0' && c <= '9')\n {\n val += ((double)(c - 48)) / (r *= 10);\n }\n\n return val;\n }\n\n static long RL()\n {\n long val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-')\n {\n }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9)\n val = val * 10 + (m ? -c : c);\n return val;\n }\n\n static int RI()\n {\n bool m = false;\n int val = 0, c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-')\n {\n }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9)\n val = val * 10 + (m ? -c : c);\n return val;\n }\n}\n #endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k= Convert.ToInt32(s[1]);\n int l= Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n int[] a = new int[3];\n int gas = k * l;\n int g = gas / nl; a[0] = g;\n int lai = c * d; a[1] = lai;\n int soli = p / np; a[2] = soli;\n int min = 100000000;\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] < min) { min = a[i]; }\n }\n Console.WriteLine(min / n);\n \n\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\npublic class CasketOfStar\n{\npublic static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int [] arr = str.Split().Select(s => int.Parse(s)).ToArray();\n int t1 = ((arr[1] * arr[2]) / arr[6]) / arr[0];\n int t2 = (arr[5] / arr[7]) / arr[0];\n int t3 = (arr[3] * arr[4]) / arr[0];\n Console.WriteLine(Math.Min(Math.Min(t1,t2),t3));\n }\n \n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().Trim(); \n List arr = s.Split(' ').Select(str => int.Parse(str)).ToList();\n\n int n = arr[0];\n int k = arr[1];\n int l = arr[2];\n int c = arr[3];\n int d = arr[4];\n int p = arr[5];\n int nl = arr[6];\n int np = arr[7];\n \n int vol = k * l;\n\n int tostCount = vol / nl;\n int tostCount2 = c * d;\n int tostCount3 = p / np;\n\n tostCount = Math.Min(tostCount3, Math.Min(tostCount2, tostCount));\n\n int res = tostCount / n;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int l = int.Parse(input[2]);\n int c = int.Parse(input[3]);\n int d = int.Parse(input[4]);\n int p = int.Parse(input[5]);\n int nl = int.Parse(input[6]);\n int np = int.Parse(input[7]);\n\n int lReal = k * l;\n int dReal = c * d;\n int pReal = p;\n\n int lNum = lReal / nl / n;\n int dNum = dReal / 1 / n;\n int pNum = pReal / np / n;\n\n int count = Math.Min(lNum,Math.Min(dNum,pNum));\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Collections;\n\n namespace SolvingAlgorithms\n {\n class Program\n {\n static void Main(string[] args)\n {\n \n string input;\n input = Console.ReadLine();\n string[] split = input.Split(' ');\n int []Constraint=new int[split.Length];\n for (int i = 0; i < split.Length; i++)\n {\n Constraint[i] = Convert.ToInt32( split[i]);\n }\n\n int mmOfdrinks = Constraint[1] * Constraint[2];\n int numberOFtoasts = mmOfdrinks / Constraint[6];\n int limes = Constraint[3] * Constraint[4];\n int salt = Constraint[5] / Constraint[7];\n List iList = new List();\n iList.Add(numberOFtoasts);\n iList.Add(limes);\n iList.Add(salt);\n int min = iList.Min();\n min /= Constraint[0];\n Console.WriteLine(min.ToString());\n \n \n }\n\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Soft_Drinking\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]);\n int k = int.Parse(r[1]);\n int l = int.Parse(r[2]);\n int c = int.Parse(r[3]);\n int d = int.Parse(r[4]);\n int p = int.Parse(r[5]);\n int nl = int.Parse(r[6]);\n int np = int.Parse(r[7]);\n int br = Math.Min(Math.Min(k * l / nl, c * d), p / np);\n Console.WriteLine(br / n);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _151_A_Soft_Drink\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n int l = int.Parse(s[2]);\n int c = int.Parse(s[3]);\n int d = int.Parse(s[4]);\n int p = int.Parse(s[5]);\n int nl = int.Parse(s[6]);\n int np = int.Parse(s[7]);\n\n\n int min1= Math.Min((k * l) / nl, c*d);\n int min2 = Math.Min(min1, p/np);\n Console.WriteLine(min2/n);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool byKey;\n\n public PComparer(bool byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey)\n return Comparer.Default.Compare(x.Key, y.Key);\n else\n return Comparer.Default.Compare(x.Value, y.Value);\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n }\n\n \n\n #endregion\n \n\n private void Solve()\n {\n var n = io.NextInt();\n var k = io.NextInt();\n var l = io.NextInt();\n var c = io.NextInt(); \n var d = io.NextInt();\n var p = io.NextInt();\n var nl = io.NextInt();\n var np = io.NextInt();\n\n var kl = ((k * l) / nl) / n;\n var cd = (c * d) / n;\n var pnp = (p / np) / n;\n\n\n\n io.Print(Math.Min(kl, Math.Min(cd, pnp)));\n }\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace pr\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int n = data[0];\n int k = data[1];\n int l = data[2];\n int c = data[3];\n int d = data[4];\n int p = data[5];\n int nl = data[6];\n int np = data[7];\n int t1 = (k * l) / nl;\n int t2 = c * d;\n int t3 = p / np;\n Console.WriteLine((Min(Min(t1,t2), t3))/n);\n\n }\n\n static int Min(int a, int b)\n {\n return a < b ? a : b;\n }\n }\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Soft_Drinking\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] values = Console.ReadLine().Split(' ');\n int[] val = new int[values.Length];\n for (int i = 0; i < values.Length; i++)\n val[i] = Convert.ToInt32(values[i]);\n int shots = (val[2] * val[1]) / val[6];\n int limes = val[3] * val[4];\n int salts = val[5] / val[7];\n int min = int.MaxValue;\n if (shots < min)\n min = shots;\n if (salts < min)\n min = salts;\n if (limes < min)\n min = limes;\n Console.WriteLine(min/val[0]);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Reflection;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.v2.TaskV2Attribute]\n#endif\n\tclass Task151A\n\t{\n\t\tprivate class Solver\n\t\t{\n\t\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\t\tprivate TextWriter output = Console.Out;\n\n\t\t\tpublic void Solve()\n\t\t\t{\n\t\t\t\tint n, k, l, c, d, p, nl, np;\n\t\t\t\tinput.Line().Read(out n).Read(out k).Read(out l).Read(out c).Read(out d).Read(out p).Read(out nl).Read(out np);\n\n\t\t\t\toutput.WriteLine(Math.Min(Math.Min(k * l / nl, c * d), p / np) / n);\n\t\t\t}\n\t\t}\n\n\t\t#region\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Solver();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic String ReadLine()\n\t\t\t{\n\t\t\t\treturn Console.In.ReadLine();\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Crap\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp1 = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(tmp1[0]);\n int k = Convert.ToInt32(tmp1[1]);\n int l = Convert.ToInt32(tmp1[2]);\n int c = Convert.ToInt32(tmp1[3]);\n int d = Convert.ToInt32(tmp1[4]);\n int p = Convert.ToInt32(tmp1[5]);\n int nl = Convert.ToInt32(tmp1[6]);\n int np = Convert.ToInt32(tmp1[7]);\n\n int bottleToasts = (k * l) / nl;\n int limeToasts = (c * d);\n int saltToasts = (p) / np;\n int tmp = Math.Min(limeToasts, saltToasts);\n Console.WriteLine((Math.Min(bottleToasts, tmp))/n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static int Min(int a, int b, int c)\n {\n if (a <= b && a <= c)\n return a;\n else if (b <= a && b <= c)\n return b;\n else\n return c;\n }\n\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k = Convert.ToInt32(s[1]);\n int l = Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n\n int tostov = 0;\n\n int gazirovki = (k * l)/nl;\n int limon = c * d;\n int soli = p / np;\n\n tostov = Min(gazirovki, limon, soli)/n;\n Console.WriteLine(tostov);\n\n\n }\n }\n}"}, {"source_code": "using System;\nclass Codeforce\n{ \n static void Main()\n { \n string []s= Console.ReadLine().Split();\n \n int n=int.Parse(s[0]);\n int k=int.Parse(s[1]);\n int l=int.Parse(s[2]);\n int c=int.Parse(s[3]);\n int d=int.Parse(s[4]);\n int p=int.Parse(s[5]);\n int nl=int.Parse(s[6]);\n int np=int.Parse(s[7]);\n \n Console.WriteLine(Math.Min(Math.Min(k*l/nl,c*d),p/np)/n);\n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _151A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int n = a[0], k = a[1], l = a[2], c = a[3], d = a[4], p = a[5], nl = a[6], np = a[7];\n int x1 = k * l / nl, x2 = c * d, x3 = p / np;\n Console.WriteLine(Math.Min(x1, Math.Min(x2, x3)) / n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int n = a[0], k = a[1], l = a[2], c = a[3], d = a[4], p = a[5], nl = a[6], np = a[7];\n Console.WriteLine(Math.Min(k * l / nl, Math.Min(c * d, p / np))/n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF107\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int l = int.Parse(tokens[2]);\n int c = int.Parse(tokens[3]);\n int d = int.Parse(tokens[4]);\n int p = int.Parse(tokens[5]);\n int nl = int.Parse(tokens[6]);\n int np = int.Parse(tokens[7]);\n\n int bound1 = (k * l) / nl;\n int bound2 = (c * d);\n int bound3 = p / np;\n\n int answer = Math.Min(Math.Min(bound1, bound2), bound3) / n;\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] arr = Console.ReadLine().Split(' ');\n int n = Int32.Parse(arr[0]);\n int k = Int32.Parse(arr[1]);\n int l = Int32.Parse(arr[2]);\n int c = Int32.Parse(arr[3]);\n int d = Int32.Parse(arr[4]);\n int p = Int32.Parse(arr[5]);\n int nl = Int32.Parse(arr[6]);\n int np = Int32.Parse(arr[7]);\n\n Console.WriteLine(Math.Min(Math.Min(k * l / nl, c * d), p / np) / n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp5\n{\n public class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var res = Min(s[1] * s[2] / s[6], s[3] * s[4], s[5] / s[7]) / s[0];\n Console.WriteLine(res);\n }\n static int Min(int a, int b, int c)\n {\n return Math.Min(Math.Min(a, b), c);\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class A\n{\n public partial class Myon\n {\n\n static void Main()\n {\n A p = new A();\n p.solve();\n }\n\n }\n\n public void solve()\n {\n int[] tmp = intSplit(' ');\n int n = tmp[0];\n int k = tmp[1];\n int l = tmp[2];\n int c = tmp[3];\n int d = tmp[4];\n int p = tmp[5];\n int nl = tmp[6];\n int np = tmp[7];\n\n int res = int.MaxValue;\n res = Math.Min(res,k * l / nl);\n res = Math.Min(res, c * d);\n res = Math.Min(res,p / np);\n Console.WriteLine(res/n);\n\n\n }\n\n string stringRead()\n { return Console.ReadLine(); }\n\n int intRead()\n { return int.Parse(Console.ReadLine()); }\n\n long longRead()\n { return long.Parse(Console.ReadLine()); }\n\n string[] stringSplit(char a)\n { return Console.ReadLine().Split(a); }\n\n int[] intSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), int.Parse); }\n\n long[] longSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), long.Parse); }\n\n void write(string str)\n {\n Console.WriteLine(str);\n }\n\n}"}, {"source_code": "using System;\n\nnamespace SoftDrinking\n{\n class Program\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int l = int.Parse(input[2]);\n int c = int.Parse(input[3]);\n int d = int.Parse(input[4]);\n int p = int.Parse(input[5]);\n int nl = int.Parse(input[6]);\n int np = int.Parse(input[7]);\n\n Console.WriteLine( Math.Min(Math.Min((k*l)/nl, c*d), p/np) / n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u0413\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u043e\u043f\u0438\u0442\u0438\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k = Convert.ToInt32(s[1]);\n int l = Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n int gaz = (k * l) / nl;\n int lime = c * d;\n int salt = p / np;\n Tosti(gaz,lime,salt,n);\n }\n\n static void Tosti(int gaz, int lime, int salt, int chelov)\n {\n int min1=1000000;\n int[] min = new int[3];\n min[0] = gaz;\n min[1] = lime;\n min[2] = salt;\n for (int i = 0; i < 3; i++)\n if (min[i] < min1)\n min1 = min[i];\n Console.WriteLine(min1/chelov);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n //2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97\n static void Main(string[] args)\n { \n\n \n\n string input = Console.ReadLine();\n\n string[] results = input.Split(' ');\n\n List num = new List(); \n\n foreach( var r in results)\n {\n num.Add(Convert.ToInt32(r));\n }\n\n int value1 = num[1] * num[2] / num[6];\n int value2 = num[3] * num[4];\n int value3 = num[5] / num[7];\n\n Console.WriteLine(Math.Min(Math.Min(value1, value2), value3) / num[0]); \n\n\n \n \n\n \n\n\n\n\n\n\n\n\n }\n}\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\t\t\tlong l = inputs1[2];\n\t\t\tlong c = inputs1[3];\n\t\t\tlong d = inputs1[4];\n\t\t\tlong p = inputs1[5];\n\t\t\tlong nl = inputs1[6];\n\t\t\tlong np = inputs1[7];\n\n\t\t\tlong gaz = (k * l) / (n * nl);\n\t\t\tlong lime = (c * d) / n;\n\t\t\tlong salt = p / (n * np);\n\n\t\t\tConsole.WriteLine(Math.Min(gaz, Math.Min(lime, salt)));\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] iData = Console.ReadLine().Split(' ').Select(it => Convert.ToInt32(it)).ToArray();\n\n List lst = new List();\n int iCountTostGas = (iData[1] * iData[2]) / iData[6];\n lst.Add(iCountTostGas);\n int iCountTostLaim = iData[3] * iData[4];\n lst.Add(iCountTostLaim);\n int iCountTostSolt = iData[5] / iData[7];\n lst.Add(iCountTostSolt);\n\n\n int iCountTost = lst.Min() / iData[0];\n\n Console.WriteLine(iCountTost);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n int n = int.Parse(tmp[0]);\n int k = int.Parse(tmp[1]);\n int l = int.Parse(tmp[2]);\n int c = int.Parse(tmp[3]);\n int d = int.Parse(tmp[4]);\n int p = int.Parse(tmp[5]);\n int nl = int.Parse(tmp[6]);\n int np = int.Parse(tmp[7]);\n int temp = (k * l / nl) ;\n int temp1 = c*d ;\n int temp2 = (p / np) ;\n int buf = Math.Min(temp, temp1);\n int ans = Math.Min(buf, temp2);\n Console.WriteLine((int)ans/n);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace SimpleProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0].ToString());\n int k = int.Parse(s[1].ToString());\n int l = int.Parse(s[2].ToString());\n int c = int.Parse(s[3].ToString());\n int d = int.Parse(s[4].ToString());\n int p = int.Parse(s[5].ToString());\n int nl = int.Parse(s[6].ToString());\n int np = int.Parse(s[7].ToString());\n\n int T = k * l / (n*nl);\n int Z = c * d / n;\n int P = p / (np*n);\n\n Console.WriteLine(Math.Min(Math.Min(T,Z),P));\n\n \n // Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass A107\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tstring[] ss = Console.ReadLine().Split(' ');\n\n\t\t\tint n = int.Parse(ss[0]);\n\t\t\tint k = int.Parse(ss[1]);\n\t\t\tint l = int.Parse(ss[2]);\n\t\t\tint c = int.Parse(ss[3]);\n\t\t\tint d = int.Parse(ss[4]);\n\t\t\tint p = int.Parse(ss[5]);\n\t\t\tint nl = int.Parse(ss[6]);\n\t\t\tint np = int.Parse(ss[7]);\n\n\t\t\tint a1 = k * l / (n*nl);\n\t\t\tint a2 = c*d / n;\n\t\t\tint a3 = p / (np*n);\n\n\t\t\tif (a1 > a2)\n\t\t\t\ta1 = a2;\n\t\t\tif (a1 > a3)\n\t\t\t\ta1 = a3;\n\n\n\t\t\tConsole.WriteLine(a1);\n//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\n\n//long a = long.Parse(Console.In.ReadLine());\n//int a = int.Parse(Console.In.ReadLine());\n\n//string[] ss = Console.In.ReadLine().Split(new char[] { ' ' });\n//long l = long.Parse(ss[0]);\n//int l = int.Parse(ss[0]);\n\nclass temp\n{\n static void Main()\n {\n new temp().myMain();\n }\n\n void myMain()\n {\n //Console.SetIn(new StreamReader(new FileStream(\"../../in.txt\", FileMode.Open)));\n //StreamWriter out_sw = new StreamWriter(new FileStream(\"../../out.txt\", FileMode.Create));\n //Console.SetOut(out_sw);\n\n string[] ss = Console.In.ReadLine().Split(new char[] { ' ' });\n int n = int.Parse(ss[0]);\n int k = int.Parse(ss[1]);\n int l = int.Parse(ss[2]);\n int c = int.Parse(ss[3]);\n int d = int.Parse(ss[4]);\n int p = int.Parse(ss[5]);\n int nl = int.Parse(ss[6]);\n int np = int.Parse(ss[7]);\n\n int val1 = (k * l)/nl;\n int val2 = c * d;\n int val3 = p / np;\n\n int min = val1;\n if (val2 < min) min = val2;\n if (val3 < min) min = val3;\n\n int res = min / n;\n\n Console.Out.WriteLine(res);\n //out_sw.Close();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Temp\n{\n using System.IO;\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n }\n\n static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(int[] numbers)\n {\n var list = Console.ReadLine().Split();\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n } \n\n class Program\n { \n static void Main()\n {\n new Solution().Solve();\n } \n }\n\n class Solution\n {\n private int n, k, l, c, d, p, nl, np;\n\n public void Solve()\n {\n //DirectToFiles(); \n \n int[] a = new int[8];\n Reader.ReadInt(a);\n n = a[0];\n k = a[1];\n l = a[2];\n c = a[3];\n d = a[4];\n p = a[5];\n nl = a[6];\n np = a[7];\n\n int x1 = (k * l) / (n * nl);\n int x2 = (c * d) / n;\n int x3 = p / (n * np);\n\n int answer = Math.Min(x1, Math.Min(x2, x3));\n\n Console.WriteLine(answer);\n\n //CloseFiles();\n }\n\n private StreamReader InputStream;\n\n private StreamWriter OutStream;\n\n private void DirectToFiles()\n {\n InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(InputStream);\n OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(OutStream);\n }\n\n private void CloseFiles()\n {\n OutStream.Flush();\n\n InputStream.Dispose();\n OutStream.Dispose();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Programming_Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n, k, l, c, d, p, nl, np,drink, slice, salt, ans; \n var line = Console.ReadLine();\n var num = line.Split(' ');\n n = int.Parse(num[0]);\n k= int.Parse(num[1]);\n l= int.Parse(num[2]);\n c= int.Parse(num[3]);\n d= int.Parse(num[4]);\n p= int.Parse(num[5]);\n nl= int.Parse(num[6]);\n np= int.Parse(num[7]);\n\n drink = (k * l) / nl;\n slice = (c * d);\n salt = p / np;\n ans =Math.Min(slice, salt);\n ans =Math.Min(ans, drink);\n ans /= n;\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Program\n {\n public static void Main(string[] args)\n {\n int n;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(input[0]);\n n=Math.Min(Math.Min((int.Parse(input[3]) * int.Parse(input[4])), int.Parse(input[1]) * int.Parse(input[2])/int.Parse(input[6])),\n int.Parse(input[5]) / int.Parse(input[7]))/n;\n }\n Console.WriteLine(n);\n }\n }"}, {"source_code": "\ufeffusing System;\nclass MyBuild\n{\n static void Main()\n {\n \n string input = Console.ReadLine();\n string[] strnum = input.Split(' ');\n int[] numsin = Array.ConvertAll(strnum, int.Parse);\n\n int milliliters = numsin[1] * numsin[2];\n int totalslices = numsin[3] * numsin[4];\n int salt = numsin[5];\n \n int toastchecker = 3;\n int toastcounter = -1;\n\n while (toastchecker ==3)\n {\n toastchecker = 0;\n\n milliliters -= numsin[0] * numsin[6];\n totalslices -= numsin[0];\n salt -= numsin[0] * numsin[7];\n\n if (milliliters >= 0)\n {\n toastchecker++;\n }\n if (totalslices >= 0)\n {\n toastchecker++;\n }\n if (salt >= 0)\n {\n toastchecker++;\n }\n\n toastcounter++;\n }\n\n Console.WriteLine(toastcounter);\n\n }\n}\n"}, {"source_code": "using System;\n\nclass A151 {\n static int Min3(int a1, int a2, int a3) {\n return Math.Min(a1, Math.Min(a2, a3));\n }\n \n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var k = int.Parse(line[1]);\n var l = int.Parse(line[2]);\n var c = int.Parse(line[3]);\n var d = int.Parse(line[4]);\n var p = int.Parse(line[5]);\n var nl = int.Parse(line[6]);\n var np = int.Parse(line[7]);\n Console.WriteLine(Min3(k * l / nl, c * d, p / np) / n);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Math.Min((int)a[1] * a[2] / (a[6] * a[0]), Math.Min((int)a[3] * a[4] / a[0], (int)a[5] / (a[7] * a[0]))));\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n var ab= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt64);\n \n Console.Write(Math.Min(Math.Min(ab[1]*ab[2]/ab[0]/ab[6],ab[3]*ab[4]/ab[0]),ab[5]/ab[0]/ab[7]));\n }\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass Program {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var k = s[1]; var l = s[2]; var c = s[3]; var d = s[4];\n var p = s[5]; var nl = s[6]; var np = s[7];\n Console.WriteLine(new [] {k*l/nl, c*d, p/np}.Min() / n);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main() {\n //n, k, l, c, d, p, nl, np\n uint[] n = Console.ReadLine().Split(new char[1] { ' ' }).Select(a => uint.Parse(a)).ToArray();\n Console.WriteLine(Math.Min(Math.Min(( n[1] * n[2] ) / n[6], n[3] * n[4]), n[5] / n[7]) / n[0]);\n\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static char[] SPACE = new[] { ' ' };\n\n static void Main(string[] args)\n {\n#if DEBUG\n using (var input = new StreamReader(\"input.txt\"))\n using (var output = new StreamWriter(\"output.txt\"))\n {\n Console.SetIn(input);\n Console.SetOut(output);\n\n int n = 0;\n do\n {\n Console.WriteLine();\n Console.WriteLine(\"Sample {0}\", ++n);\n Prog();\n } while (Console.ReadLine() == string.Empty);\n }\n#else\n Prog();\n#endif\n }\n\n static int __ptr = 0;\n static string[] __input;\n static int NextInt()\n {\n return int.Parse(__input[__ptr++]);\n }\n static long NextLong()\n {\n return long.Parse(__input[__ptr++]);\n }\n static void ReadTokens(int n)\n {\n __ptr = 0;\n __input = Console.ReadLine().Split(SPACE, n);\n }\n\n //\n\n static void Prog()\n {\n // n, k, l, c, d, p, nl, np\n\n ReadTokens(8);\n int n = NextInt();\n int k = NextInt();\n int l = NextInt();\n int c = NextInt();\n int d = NextInt();\n int p = NextInt();\n int nl = NextInt();\n int np = NextInt();\n\n Console.WriteLine(Math.Min(Math.Min(k * l / nl / n, c * d / n), p / np / n));\n\n /*\n ReadTokens(1);\n int n = NextInt();\n\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine();\n\n bool b = false;\n int bIndex = 1;\n\n if (char.IsLetter(s[0]) && char.IsNumber(s[1]))\n {\n for (int j = 2; j < s.Length; j++)\n {\n if (char.IsLetter(s[j]))\n {\n b = true;\n bIndex = j;\n break;\n }\n }\n }\n\n if (b)\n {\n int a = int.Parse(s.Substring(1, bIndex - 1));\n int bb = int.Parse(s.Substring(bIndex + 1));\n\n Console.Write(bb);\n Console.Write(' ');\n Console.Write(To26(bb));\n Console.Write(' ');\n Console.Write(a);\n }\n else\n {\n\n }\n\n\n\n }\n */\n }\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\n\nnamespace _151A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] x = Console.ReadLine().Split(' ');\n int m = 0, y = 0, z = 0, k = 0;\n m = int.Parse(x[1]) * int.Parse(x[2]);\n y = m / int.Parse(x[6]);\n z = int.Parse(x[3]) * int.Parse(x[4]);\n k = int.Parse(x[5]) / int.Parse(x[7]);\n if (y '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Soft_Drinking\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next(), k = Next(), l = Next(), c = Next(), d = Next(), p = Next(), nl = Next(), np = Next();\n\n writer.WriteLine(Math.Min(Math.Min(k*l/nl, p/np), c*d)/n);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace softdrinking\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int[] b = new int[3];\n b[0] = (a[1] * a[2]) / a[6];\n b[1] = a[5] / a[7];\n b[2] = (a[3] * a[4]);\n Console.WriteLine(b.Min() / a[0]);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), k = int.Parse(s[1]), l = int.Parse(s[2]), c = int.Parse(s[3]), d = int.Parse(s[4]), p = int.Parse(s[5]), nl = int.Parse(s[6]), np = int.Parse(s[7]);\n int ans = Math.Min(k * l / nl, Math.Min(c * d, p / np)) / n;\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // Soft Drinking (implementation)\n class _151A\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(ss[0]);\n int k = int.Parse(ss[1]);\n int l = int.Parse(ss[2]);\n int c = int.Parse(ss[3]);\n int d = int.Parse(ss[4]);\n int p = int.Parse(ss[5]);\n int nl = int.Parse(ss[6]);\n int np = int.Parse(ss[7]);\n int min = int.MaxValue;\n min = Math.Min(min, (k * l) / (n * nl));\n min = Math.Min(min, (c * d) / n);\n min = Math.Min(min, p / (n * np));\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace broze\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int f = (n[1] * n[2]) / n[6];\n int s = n[3] * n[4];\n int t = n[5]/n[7];\n int v = Math.Min(f, s);\n Console.WriteLine(Math.Min(v,t)/n[0]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication30\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = 0;\n int k = 0;\n int l = 0;\n int c = 0;\n int d = 0;\n int p = 0;\n int nl = 0;\n int np = 0;\n int counter = 0;\n string temp = \"\";\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n np = int.Parse(temp + s[i]);\n else if (s[i] != ' ')\n temp += s[i];\n else if (s[i] == ' ')\n {\n int x = int.Parse(temp);\n if (counter == 0)\n { n = x; counter++; }\n else if (counter == 1)\n { k = x; counter++; }\n else if (counter == 2)\n { l = x; counter++; }\n else if (counter == 3)\n { c = x; counter++; }\n else if (counter == 4)\n { d = x; counter++; }\n else if (counter == 5)\n { p = x; counter++; }\n else if (counter == 6)\n { nl = x; counter++; }\n temp = \"\";\n }\n }\n int overallDrink = k * l;\n int overallDrinkIsEnoughForToasts = overallDrink / nl;\n int limesEnoughForToasts = c * d;\n int saltEnoughForToasts = p / np;\n int min;\n if (overallDrinkIsEnoughForToasts <= limesEnoughForToasts && overallDrinkIsEnoughForToasts <= saltEnoughForToasts)\n min = overallDrinkIsEnoughForToasts;\n else if (limesEnoughForToasts <= overallDrinkIsEnoughForToasts && limesEnoughForToasts <= saltEnoughForToasts)\n min = limesEnoughForToasts;\n else\n min = saltEnoughForToasts;\n Console.WriteLine(min / n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int k = Next();\n int l = Next();\n int c = Next();\n int d = Next();\n int p = Next();\n int nl = Next();\n int np = Next();\n int ans = Math.Min(k * l / nl, Math.Min(c * d, p / np)) / n;\n writer.WriteLine(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int k = int.Parse(ss[1]);\n int l = int.Parse(ss[2]);\n int c = int.Parse(ss[3]);\n int d = int.Parse(ss[4]);\n int p = int.Parse(ss[5]);\n int nl = int.Parse(ss[6]);\n int np = int.Parse(ss[7]);\n int kolBut = k * l /nl/ n;\n int kolLime = c * d / n;\n int kolSol = p / np / n;\n int[] m = { kolBut, kolLime, kolSol };\n Array.Sort(m);\n Console.WriteLine(m[0]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mass = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int cola = (mass[1] * mass[2]) / mass[6];\n int lime = mass[3] * mass[4];\n int salt = (mass[5] / mass[7]);\n int min = Math.Min(cola, lime);\n Console.Write(Math.Min(min, salt) / mass[0]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();\n\n int friends = line[0];\n int bottles = line[1];\n int milliliters = line[2];\n int limes = line[3];\n int slices = line[4];\n int salt = line[5];\n int wantedLiters = line[6];\n int wantedSalt = line[7];\n\n int a = ((bottles * milliliters)/wantedLiters)/friends; //All milliliters\n int b = (limes * slices)/friends;\n int c = (salt / wantedSalt)/friends;\n\n Console.WriteLine(Math.Min(a, Math.Min(b, c)));\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar number = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\t\t\tvar friends = number[0];\n\t\t\tvar bottles = number[1];\n\t\t\tvar milliliters = number[2];\n\t\t\tvar limes = number[3];\n\t\t\tvar slices = number[4];\n\t\t\tvar salt = number[5];\n\t\t\tvar nl = number[6];\n\t\t\tvar np = number[7];\n\n\t\t\tvar totalDrink = bottles * milliliters;\n\t\t\tvar toasts = totalDrink / friends;\n\t\t\tvar toastsWithLimes = limes * slices;\n\t\t\tvar toastsWithSalt = salt / np;\n\n\t\t\tConsole.WriteLine(Math.Min(toasts, Math.Min(toastsWithLimes, toastsWithSalt)) / nl);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] arr = new int[10];\n int size = 0;\n\n foreach(var tmp in Console.ReadLine().Split())\n {\n arr[size] = Convert.ToInt32(tmp);\n size++;\n }\n\n int n = arr[0];\n\n int remaining_vodka = arr[1] * arr[2];\n int remaining_limes = arr[3] * arr[4];\n int remaining_salt = arr[5];\n int vodka_for_one_tost = arr[6];\n int salt_for_one_tost = arr[7];\n\n int counter = 0;\n\n while(remaining_vodka >= n * vodka_for_one_tost && remaining_salt >= n * salt_for_one_tost && remaining_limes >= 1) \n {\n remaining_vodka -= n * vodka_for_one_tost;\n remaining_salt -= n * salt_for_one_tost;\n remaining_limes--;\n counter++;\n }\n Console.WriteLine(counter);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n int[] inputs = \"10 1000 1000 25 23 1 50 1\".Split(' ').Select(int.Parse).ToArray();\n int n = inputs[0];\n int k = inputs[1];\n int l = inputs[2];\n int c = inputs[3];\n int d = inputs[4];\n int p = inputs[5];\n int nl = inputs[6];\n int np = inputs[7];\n int k1 = (k*l)/nl;\n int k2 = (c*d);\n int k3 = p/np;\n int min = Math.Min(Math.Min(k1,k2),k3);\n Console.WriteLine(min/n);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Hasirovka\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] chysla = Console.ReadLine().Split(' ');\n int n = Int32.Parse(chysla[0]), k = Int32.Parse(chysla[1]), l = Int32.Parse(chysla[2]), c = Int32.Parse(chysla[3]), d = Int32.Parse(chysla[4]),\n p = Int32.Parse(chysla[5]), nl = Int32.Parse(chysla[6]), np = Int32.Parse(chysla[7]);\n int[] tosty = new int[3];\n tosty[0] = k * l/n;\n tosty[1] = c * d;\n tosty[2] = p / np;\n int k_tostiv = tosty.Min() / n;\n Console.WriteLine(k_tostiv);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Hasirovka\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] chysla = new string[8];\n chysla= str.Split(' ');\n int n, k, l, c, d, p, nl, np;\n n = Int32.Parse(chysla[0]);\n k = Int32.Parse(chysla[1]);\n l=Int32.Parse(chysla[2]);\n c=Int32.Parse(chysla[3]);\n d=Int32.Parse(chysla[4]);\n p=Int32.Parse(chysla[5]);\n nl=Int32.Parse(chysla[6]);\n np = Int32.Parse(chysla[7]);\n int[] tosty = new int[3];\n tosty[0] = k * l/n;\n tosty[1] = c * d;\n tosty[2] = p / np;\n int k_tostiv = tosty.Min() / n;\n Console.WriteLine(k_tostiv);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems.A\n{\n class A115_Party\n {\n public static void Main()\n {\n //while(true)\n //{\n int n, k, l, c, d, p, nl, np; \n string[] a = Console.ReadLine().Split(' ');\n n = int.Parse(a[0]);\n k = int.Parse(a[1]);\n l = int.Parse(a[2]);\n c = int.Parse(a[3]);\n d = int.Parse(a[4]);\n p = int.Parse(a[5]);\n nl = int.Parse(a[6]);\n np = int.Parse(a[7]);\n var totalMl = k * l;\n var totalLime = c * d;\n nl *= n;\n np *= n;\n int toasts = 0;\n while(nl iList = new List();\n iList.Add(numberOFtoasts);\n iList.Add(limes);\n iList.Add(salt);\n int min = iList.Min();\n min /= Constraint[0];\n Console.WriteLine(min.ToString());\n \n \n }\n\n }\n }"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Collections;\n\n namespace SolvingAlgorithms\n {\n class Program\n {\n static void Main(string[] args)\n {\n \n string input;\n input = Console.ReadLine();\n string[] split = input.Split(' ');\n int []Constraint=new int[split.Length];\n for (int i = 0; i < split.Length; i++)\n {\n Constraint[i] = Convert.ToInt32( split[i]);\n }\n\n int mmOfdrinks = Constraint[1] * Constraint[2];\n int numberOFtoasts = mmOfdrinks / Constraint[0];\n int limes = Constraint[3] * Constraint[4];\n int salt = Constraint[5] / Constraint[7];\n List iList = new List();\n iList.Add(numberOFtoasts);\n iList.Add(limes);\n iList.Add(salt);\n int min = iList.Min();\n min /= Constraint[0];\n Console.WriteLine(min.ToString());\n \n \n }\n\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int n = a[0], k = a[1], l = a[2], c = a[3], d = a[4], p = a[5], nl = a[6], np = a[7];\n Console.WriteLine(Math.Min(k * l / nl, Math.Min(c * d, p / np)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp5\n{\n public class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var res = Min(s[1] * s[2] / s[0], s[3] * s[4], s[5] / s[7]) / s[0];\n Console.WriteLine(res);\n }\n static int Min(int a, int b, int c)\n {\n return Math.Min(Math.Min(a, b), c);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u0413\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u043e\u043f\u0438\u0442\u0438\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k = Convert.ToInt32(s[1]);\n int l = Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n int gaz = (k * l) / nl;\n int lime = c * d;\n int salt = p / np; \n }\n\n static void Tosti(int gaz, int lime, int salt, int chelov)\n {\n int min1=99999999;\n int[] min = new int[3];\n min[0]= gaz/chelov;\n min[1] = lime / chelov;\n min[2] = salt / chelov;\n for (int i = 0; i < 4; i++)\n if (min[i] < min1)\n min1 = min[i];\n Console.WriteLine(min1);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u0413\u0430\u0437\u0438\u0440\u043e\u0432\u043a\u043e\u043f\u0438\u0442\u0438\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int k = Convert.ToInt32(s[1]);\n int l = Convert.ToInt32(s[2]);\n int c = Convert.ToInt32(s[3]);\n int d = Convert.ToInt32(s[4]);\n int p = Convert.ToInt32(s[5]);\n int nl = Convert.ToInt32(s[6]);\n int np = Convert.ToInt32(s[7]);\n int gaz = (k * l) / nl;\n int lime = c * d;\n int salt = p / np;\n Tosti(gaz,lime,salt,n);\n }\n\n static void Tosti(int gaz, int lime, int salt, int chelov)\n {\n int min1=100;\n int[] min = new int[3];\n min[0] = gaz;\n min[1] = lime;\n min[2] = salt;\n for (int i = 0; i < 3; i++)\n if (min[i] < min1)\n min1 = min[i];\n Console.WriteLine(min1/chelov);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n //2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97\n static void Main(string[] args)\n { \n\n \n\n string input = Console.ReadLine();\n\n string[] results = input.Split(' ');\n\n List num = new List(); \n\n foreach( var r in results)\n {\n num.Add(Convert.ToInt32(r));\n }\n\n int value1 = num[6] * num[2] / num[0];\n int value2 = num[3] * num[4];\n int value3 = num[5] / num[7];\n\n Console.WriteLine(Math.Min(Math.Min(value1, value2), value3) / num[1]); \n\n\n \n \n\n \n\n\n\n\n\n\n\n\n }\n}\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n //2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97\n static void Main(string[] args)\n { \n\n \n\n string input = Console.ReadLine();\n\n string[] results = input.Split(' ');\n\n List num = new List(); \n\n foreach( var r in results)\n {\n num.Add(Convert.ToInt32(r));\n }\n\n int value1 = num[1] * num[2] / num[0];\n int value2 = num[3] * num[4];\n int value3 = num[5] / num[6];\n\n Console.WriteLine(Math.Min(Math.Min(value1, value2), value3) / num[6]); \n\n\n \n \n\n \n\n\n\n\n\n\n\n\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Programming_Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n, k, l, c, d, p, nl, np;\n var line = Console.ReadLine();\n var num = line.Split(' ');\n n = int.Parse(num[0]);\n k= int.Parse(num[1]);\n l= int.Parse(num[2]);\n c= int.Parse(num[3]);\n d= int.Parse(num[4]);\n p= int.Parse(num[5]);\n nl= int.Parse(num[6]);\n np= int.Parse(num[7]);\n\n int v1 = (k * l) / n;\n int v2 = c * d;\n int v3 = (p / nl);\n int[] arr = { v1, v2, v3 };\n int ans = (arr.Min()) / n;\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass MyBuild\n{\n static void Main()\n { \n string input = Console.ReadLine();\n string[] strnum = input.Split(' ');\n int[] numsin = Array.ConvertAll(strnum, int.Parse);\n\n int milliliters = numsin[1] * numsin[2];\n int totalslices = numsin[3] * numsin[4];\n int salt = numsin[5];\n \n int toastchecker = 3;\n int toastcounter = -1;\n\n while (toastchecker ==3)\n {\n toastchecker = 0;\n\n milliliters -= numsin[0] * numsin[6];\n totalslices -= numsin[0];\n salt -= numsin[0] * numsin[7];\n\n if (milliliters >= 0)\n {\n toastchecker++;\n }\n if (totalslices > 0)\n {\n toastchecker++;\n }\n if (salt > 0)\n {\n toastchecker++;\n }\n\n toastcounter++;\n }\n\n Console.WriteLine(toastcounter);\n \n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _318A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] fline = Console.ReadLine().Split(' ');\n int y = 1,z=2;\n int[] x = new int[int.Parse(fline[0])];\n \n \n for (int i = 1; i <= x.Length; i++)\n {\n if (i <= x.Length / 2)\n {\n x[i - 1] = y;\n y += 2;\n } \n else\n {\n x[i - 1] = z;\n z += 2;\n }\n }\n if (x.Length%2!=0&& int.Parse(fline[1]) > 1)\n {\n Console.WriteLine(x[int.Parse(fline[1]) - 2]);\n }\n else\n {\n Console.WriteLine(x[int.Parse(fline[1]) - 1]);\n }\n \n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var z = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = z[0], k = z[1], l = z[2], c = z[3], d = z[4], p = z[5], nl = z[6], np = z[7];\n var ans = Math.Min((k * l) / n, Math.Min(c * d, p / np)) / n;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var z = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = z[0], k = z[1], l = z[2], c = z[3], d = z[4], p = z[5], nl = z[6], np = z[7];\n var ans = Math.Min((k * l) / n, Math.Min((c * d) / n, p / np)) / n;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var z = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = z[0], k = z[1], l = z[2], c = z[3], d = z[4], p = z[5], nl = z[6], np = z[7];\n var ans = Math.Min((k * l) / n, Math.Min(c * d, p * np)) / n;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _151A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var ans = Math.Min( (s[1] * s[2] / s[6]), Math.Min(s[5], s[3]*s[4]))/s[0];\n Console.WriteLine(ans);\n }\n }\n}\n"}], "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string[] sp = Console.ReadLine().Split();\n\n int[] a = new int[3];\n\n for (int i = 0; i < 3; ++i)\n {\n a[i] = int.Parse(sp[i]);\n }\n\n\n HashSet hashSet = new HashSet();\n\n a[0] %= a[1];\n int d = -1;\n int pos = 0;\n while (a[0] != 0 && (!hashSet.Contains(a[0])))\n {\n hashSet.Add(a[0]);\n a[0] *= 10;\n d = a[0] / a[1];\n if (d == a[2])\n {\n break;\n }\n\n ++pos;\n a[0] %= a[1];\n }\n\n Console.WriteLine((d == a[2] || a[0] == a[2]) ? pos + 1 : -1);\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problemB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sp = Console.ReadLine().Split();\n int[] a = new int[3];\n for (int i = 0; i < 3; ++i)\n a[i] = int.Parse(sp[i]);\n\n System.Collections.Generic.HashSet hashSet = new System.Collections.Generic.HashSet();\n\n a[0] %= a[1];\n int d = -1;\n int pos = 0;\n while(a[0] != 0 && (!hashSet.Contains(a[0])))\n {\n hashSet.Add(a[0]);\n a[0] *= 10;\n d = a[0] / a[1];\n if (d == a[2])\n break;\n ++pos;\n a[0] %= a[1];\n }\n Console.WriteLine((d == a[2] || a[0] == a[2]) ? pos+1 : -1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int a,b,c;\n\n public void Solve()\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n c = ioHelper.ReadNextInt();\n\n HashSet reminders = new HashSet();\n\n int curPos = 1;\n int rez = -1;\n\n a *= 10;\n\n do\n {\n if (rez != -1)\n break;\n\n if (reminders.Contains(a))\n break;\n\n while (a < b)\n {\n a *= 10;\n if (c == 0)\n { rez = curPos; break; }\n curPos++;\n }\n\n if (rez != -1)\n break;\n\n if (reminders.Contains(a))\n break;\n\n reminders.Add(a);\n var vl = a / b;\n\n int numDig = 0;\n int foundAt = -1;\n int curDigit = 0;\n while(vl > 0)\n {\n var digit = vl % 10;\n if (digit == c)\n foundAt = curDigit;\n numDig++;\n vl /= 10;\n }\n\n if(foundAt != -1)\n {\n rez = curPos + numDig - foundAt - 1;\n }\n\n curPos += numDig;\n\n //curPos++;\n a %= b;\n if (a == 0 && c == 0)\n rez = curPos;\n else\n a *= 10;\n } while (a != 0);\n\n ioHelper.WriteLine(rez.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Position_in_Fraction\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int a = Next();\n int b = Next();\n int c = Next();\n\n a %= b;\n a *= 10;\n\n var h = new HashSet {a};\n for (int i = 1;; i++)\n {\n while (a < b)\n {\n a *= 10;\n if (c == 0)\n return i;\n i++;\n }\n\n int cc = a/b;\n\n if (cc == c)\n return i;\n\n int aa = (a - cc*b)*10;\n\n if (!h.Add(aa))\n return -1;\n\n a = aa;\n\n if (a == 0)\n {\n if (c == 0)\n return i + 1;\n return -1;\n }\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test\n{\n class Program\n {\n static void Main()\n {\n string txt;\n while ((txt = Console.ReadLine()) != null)\n {\n var lst = txt.Split(' ');\n var a = int.Parse(lst[0]);\n var b = int.Parse(lst[1]);\n var c = int.Parse(lst[2]);\n var m = a % b;\n var pos = -1;\n\n if (m == 0)\n {\n if (c == 0)\n {\n pos = 1;\n }\n }\n else\n {\n var p = 1;\n var ms = new List();\n while (true)\n {\n ms.Add(m);\n m *= 10;\n var x = m / b;\n if (x == c)\n {\n pos = p;\n break;\n }\n\n m %= b;\n if (m == 0)\n {\n if (c == 0)\n {\n pos = p + 1;\n }\n\n break;\n }\n\n if (ms.Contains(m))\n {\n break;\n }\n p++;\n }\n }\n Console.WriteLine(pos);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(BigInteger.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((double.Parse(b.ToString()) - 1.0)/ double.Parse(data[0].ToString())))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n var lastZero = s.Length;\n for (var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _900B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n\n for (int i = 1; i <= b; i++)\n {\n a %= b;\n a *= 10;\n\n if (a / b == c)\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public string[] StringArray()\n {\n Line = Console.ReadLine().Split(Separator);\n Index = Line.Length;\n return Line;\n }\n\n public int[] IntArray()\n {\n var l = StringArray();\n var res = new int[l.Length];\n for (int i = 0; i < l.Length; i++)\n {\n res[i] = int.Parse(l[i]);\n }\n return res;\n }\n\n public long[] LongArray()\n {\n var l = StringArray();\n var res = new long[l.Length];\n for (int i = 0; i < l.Length; i++)\n {\n res[i] = long.Parse(l[i]);\n }\n return res;\n }\n}\n\nclass Program\n{\n private int A, B, C;\n private void Scan()\n {\n var sc = new Scanner();\n A = sc.NextInt();\n B = sc.NextInt();\n C = sc.NextInt();\n }\n\n public void Solve()\n {\n Scan();\n var b = new bool[100001];\n for (int i = 1; ; i++)\n {\n if(b[A])\n {\n Console.WriteLine(-1);\n return;\n }\n b[A] = true;\n A *= 10;\n if (A / B == C)\n {\n Console.WriteLine(i);\n return;\n }\n A %= B;\n }\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int a,b,c;\n\n public void Solve()\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n c = ioHelper.ReadNextInt();\n\n HashSet reminders = new HashSet();\n\n int curPos = 1;\n int rez = -1;\n\n a *= 10;\n\n do\n {\n if (rez != -1)\n break;\n\n if (reminders.Contains(a))\n break;\n\n while (a < b)\n {\n a *= 10;\n curPos++;\n if (c == 0)\n { rez = curPos; break; }\n }\n\n if (rez != -1)\n break;\n\n if (reminders.Contains(a))\n break;\n\n reminders.Add(a);\n var vl = a / b;\n\n int numDig = 0;\n int foundAt = -1;\n int curDigit = 0;\n while(vl > 0)\n {\n var digit = vl % 10;\n if (digit == c)\n foundAt = curDigit;\n numDig++;\n vl /= 10;\n }\n\n if(foundAt != -1)\n {\n rez = curPos + numDig - foundAt - 1;\n }\n\n curPos += numDig;\n\n //curPos++;\n a %= b;\n if (a == 0 && c == 0)\n rez = curPos;\n else\n a *= 10;\n } while (a != 0);\n\n ioHelper.WriteLine(rez.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Position_in_Fraction\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int a = Next();\n int b = Next();\n int c = Next();\n\n a %= b;\n a *= 10;\n\n var h = new HashSet {a};\n for (int i = 1;; i++)\n {\n while (a < b)\n {\n a *= 10;\n i++;\n if (c == 0)\n return i;\n }\n\n int cc = a/b;\n\n if (cc == c)\n return i;\n\n int aa = (a - cc*b)*10;\n\n if (!h.Add(aa))\n return -1;\n\n a = aa;\n\n if (a == 0)\n {\n if (c == 0)\n return i + 1;\n return -1;\n }\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string[] sp = Console.ReadLine().Split();\n\n int[] a = new int[3];\n\n for (int i = 0; i < 3; ++i)\n {\n a[i] = int.Parse(sp[i]);\n }\n\n\n HashSet hashSet = new HashSet();\n\n a[0] %= a[1];\n int d = -1;\n int pos = 0;\n while (a[0] != 0 && (!hashSet.Contains(a[0])))\n {\n hashSet.Add(a[0]);\n a[0] *= 10;\n d = a[0] / a[1];\n if (d == a[2])\n {\n break;\n }\n\n ++pos;\n a[0] %= a[1];\n }\n\n Console.WriteLine((d == a[2] || a[0] == a[2]) ? pos : -1);\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n static void Main()\n {\n string txt;\n while ((txt = Console.ReadLine()) != null)\n {\n var lst = txt.Split(' ').Select(int.Parse).ToList();\n var end = lst.Count - 2;\n var pos = -1;\n for (int i = 0; i < end; i++)\n {\n var b = lst[i + 1];\n if (b == 0)\n {\n continue;\n }\n var a = lst[i];\n var p = i + 2;\n var c = lst[i + p];\n var x = a % b;\n if (x == 0 && c == 0)\n {\n pos = p;\n }\n else\n {\n var t = (x / b).ToString();\n if (t.Length > 5)\n {\n if (t[5] == c)\n {\n pos = p;\n break;\n }\n }\n else if (c == 0)\n {\n pos = p;\n break;\n }\n }\n }\n Console.WriteLine(pos);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a *= 10000000000000;\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((b - 1.0)/ data[0]))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(BigInteger.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((double.Parse(b.ToString()) - 1.0)/ double.Parse(data[0].ToString())))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a *= 10000000000000;\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n var h = (b - 1)/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(BigInteger.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((double.Parse(b.ToString()) - 1.0)/ double.Parse(data[0].ToString())))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(BigInteger.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n a = a * new BigInteger(1000000000000000);\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n var added = 0;\n long h = (long)Math.Floor(((double.Parse(b.ToString()) - 1.0)/ double.Parse(data[0].ToString())))/10;\n while(h > 0)\n {\n added++;\n h /= 10;\n }\n if(added != 0 && c == 0)\n {\n writer.WriteLine(1);\n writer.Flush();\n return;\n }\n var lastZero = s.Length;\n for (var i = s.Length-1; i >= 0; i--)\n {\n if (s[i] != '0')\n {\n break;\n }\n lastZero = i;\n }\n for (var i = 0; i < s.Length; i++)\n {\n if(lastZero ==i && s2 == \"0\")\n {\n break;\n }\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(added + i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n\n /* Iterative Function to calculate (x^y)%p in O(log y) */\n static long power(long x, long y, long p)\n {\n long res = 1; // Initialize result\n\n x = x % p; // Update x if it is more than or \n // equal to p\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if ((y & 1) != 0)\n res = (res * x) % p;\n\n // y must be even now\n y = y >> 1; // y = y/2\n x = (x * x) % p;\n }\n return res;\n }\n static void program(TextReader input)\n {\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n a *= 10000000000000;\n var res = a / b;\n var s = res.ToString();\n var s2 = c.ToString();\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i].ToString() == s2)\n {\n writer.WriteLine(i + 1);\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(-1);\n writer.Flush();\n \n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 2 1\\n1 3 5 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 2 0\\n5 3 1 7\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"25\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"5 3 1\\n3 3 3 3 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}], "src_uid": "0bc7bf67b96e2898cfd8d129ad486910"} {"source_code": "//Rextester.Program.Main is the entry point for your code. Don't change it.\n//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64 k = Convert.ToInt64(Console.ReadLine());\n Int64 A = Convert.ToInt64(Console.ReadLine());\n Int64 B = Convert.ToInt64(Console.ReadLine());\n \n Int64 cost = 0;\n \n while(n > 1) {\n if(n%k == 0 && k > 1) {\n if (B < (A * (n - n/k))) {\n cost += B;\n n /= k;\n }\n else {\n cost += (A * (n - n/k));\n n /= k;\n }\n }\n else {\n if(k > 1) {\n if(n - (n%k) == 0) {\n cost += (A * (n%k - 1));\n n -= (n%k + 1);\n }\n else {\n cost += (A * (n%k));\n n -= (n%k);\n }\n }\n else {\n cost += (A * (n-1));\n n = 1;\n }\n }\n }\n \n Console.WriteLine(cost);\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acyclic\n{\n class Apop\n {\n public static void Main()\n {\n ulong n = UInt64.Parse(Console.ReadLine());\n ulong k = UInt64.Parse(Console.ReadLine());\n ulong A = UInt64.Parse(Console.ReadLine());\n ulong B = UInt64.Parse(Console.ReadLine());\n\n ulong koszt = 0;\n ulong Akoszt = 0;\n ulong Bkoszt = 0;\n if (k<=1) koszt += A * (n - 1);\n else\n {\n while(n!=1)\n {\n if(n 1)\n {\n while (x >= 1)\n {\n if (x == 1)\n {\n cost += subCost;\n break;\n }\n int rem = x % div;\n if (rem == 0)\n {\n BigInteger sC = (BigInteger)subCost * (BigInteger)(x - x / div);\n x /= div;\n if (divCost < sC)\n {\n cost += divCost;\n }\n else\n {\n cost += sC;\n }\n }\n else\n {\n cost += (BigInteger)subCost * (BigInteger)rem;\n x -= rem;\n }\n }\n cost -= subCost;\n }\n else\n {\n cost = (BigInteger)subCost * (BigInteger)(x - 1);\n }\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Principal;\n\nnamespace Quserty2\n{\n public class Program\n {\n static ulong totalPrice = 0;\n\n static void Main(string[] args)\n {\n ulong n, k, A, B;\n\n n = ulong.Parse(Console.ReadLine());\n k = ulong.Parse(Console.ReadLine());\n A = ulong.Parse(Console.ReadLine());\n B = ulong.Parse(Console.ReadLine());\n\n if (k == 1)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n ulong last = 0;\n\n uint index = 1;\n if (n / k < k)\n {\n while (true)\n {\n var current = k * index;\n if (current > n)\n break;\n last = current;\n index++;\n }\n }\n else\n {\n var n2 = n;\n while (true)\n {\n if (n2 % k == 0)\n {\n last = n2;\n break;\n }\n\n if (n2 <= 1)\n {\n break;\n }\n\n --n2;\n }\n }\n\n\n if (last == 0)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n totalPrice += (n - last) * A;\n n = last;\n\n for (;;)\n {\n if (n == 1)\n break;\n\n if (last <= 1)\n {\n break;\n }\n\n if (n < last)\n {\n last -= k;\n continue;\n }\n\n totalPrice += (n - last) * A;\n n = last;\n\n var divisionPrice = B;\n var minusPrice = (n - n / k) * A;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n var divisionResult = n / k;\n n = divisionResult;\n var numberOfkTimesInDivisionResult = (last - n) / k;\n last -= numberOfkTimesInDivisionResult * k;\n continue;\n }\n else\n {\n totalPrice += (n - 1) * A;\n Console.WriteLine(totalPrice);\n return;\n }\n }\n\n if (n > 1)\n {\n totalPrice += (n - 1) * A;\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long x, k, a, b;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n x = long.Parse(input[0]);\n k = long.Parse(input[1]);\n a = long.Parse(input[2]);\n b = long.Parse(input[3]);\n }\n long result = 0L;\n for (long smllr; x > 1L;)\n {\n if ((smllr = x % k) == 0L)\n {\n if (((x - (smllr = x / k)) * a) <= b) { result += a * (x - 1L); x = 1L; break; }\n else { x = smllr; result += b; }\n }\n else { result += smllr * a; x -= smllr; }\n }\n Console.WriteLine(x == 0L ? result - a : result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _940B\n {\n public static void Main()\n {\n long n = long.Parse(Console.ReadLine());\n long k = long.Parse(Console.ReadLine());\n long a = long.Parse(Console.ReadLine());\n long b = long.Parse(Console.ReadLine());\n\n var queue = new Queue(new long[] { n });\n var amount = new Dictionary { { n, 0 } };\n\n while (queue.Any())\n {\n long x = queue.Dequeue();\n\n if (!amount.ContainsKey(1) || amount[x] + a * (x - 1) < amount[1])\n {\n amount[1] = amount[x] + a * (x - 1);\n }\n\n long mod = x % k;\n long div = x / k;\n\n if (mod > 0)\n {\n if (!amount.ContainsKey(x - mod) || amount[x] + a * mod < amount[x - mod])\n {\n queue.Enqueue(x - mod);\n amount[x - mod] = amount[x] + a * mod;\n }\n }\n else\n {\n if (!amount.ContainsKey(div) || amount[x] + b < amount[div])\n {\n queue.Enqueue(div);\n amount[div] = amount[x] + b;\n }\n }\n }\n\n Console.WriteLine(amount[1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Our_Tanya_is_Crying_Out_Loud\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long n = Next(), k = Next(), A = Next(), B = Next();\n\n if (k == 1)\n return (n - 1)*A;\n\n long ans = 0;\n while (n >= k)\n {\n long x = n/k;\n long m = x*k;\n long delta = n - m;\n ans += delta*A;\n n = m;\n x = n/k;\n ans += Math.Min(B, (n - x)*A);\n n = x;\n }\n\n ans += (n - 1)*A;\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long k = long.Parse(Console.ReadLine());\n \n long A = long.Parse(Console.ReadLine());\n long B = long.Parse(Console.ReadLine());\n \n long X = n;\n \n long ans = 0;\n if(k==1||k>n){\n ans = ((n-1) * A);\n Console.WriteLine(ans);\n return;\n }\n \n \n while(X>1){\n if(X%k==0){\n long val = X/k;\n long diff = X-val;\n if(diff*A>B){\n ans += B;\n X /= k;\n }else{\n ans += (A*diff);\n X -= diff;\n }\n }else{\n if(X>k){\n long mod = X%k;\n ans += (A * mod);\n X = X-mod;\n }else{\n ans += (X-1)*A;\n break;\n }\n }\n }\n \n Console.WriteLine(ans);\n }\n }\n}\n \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\n//using tuple = System.IComparable;\n//using bsearchTx = System.Int32;\n\npublic sealed class Solution : Helper\n{\n public void __stdioMain()\n {\n checked\n {\n //\n var n = readInt32();\n var k = readInt32();\n long a = readInt32();\n long b = readInt32();\n //\n long res = 0;\n if (k == 1)\n {\n write((n - 1) * a);\n return;\n }\n while (n > 1)\n {\n if (n % k == 0)\n {\n \n {\n var costa = a * (n - (n / k));\n if (costa < b)\n {\n res += costa;\n }\n else\n {\n res += b;\n }\n n = n / k;\n }\n \n }\n else\n {\n var rem = n % k;\n n -= rem;\n assert(n % k == 0);\n if (n == 0)\n {\n n++;\n rem--;\n }\n res += rem * a;\n }\n }\n assert(n == 1);\n write(res);\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class Helper\n{\n\n [DebuggerDisplay(\"{Value}\")]\n internal class Accumulator where T : struct\n {\n Func merge; public T? ValueNullable { get; private set; }\n public Accumulator(Func merge_CHECKED) { this.merge = merge_CHECKED; }\n public Accumulator Add(T value) { ValueNullable = ValueNullable.HasValue ? merge(ValueNullable.Value, value) : value; return this; }\n }\n //\n static bool MULTI_TCs = false;\n #region STDIO\n#if !DEBUG\n static void Main()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? readInt32() : 1;\n for (var i = 1; i <= cnt; i++) new Solution().__stdioMain();\n Console.Out.Flush();\n }\n#endif\n // OUTput\n internal string autoSeparator;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(autoSeparator))Console.Write(autoSeparator); }\n internal void write(char c) { Console.Write(c); writeSeparator(); }\n internal void write(string s) { Console.Write(s); writeSeparator(); }\n internal void write(long i64) { Console.Write(i64); writeSeparator(); }\n internal void write(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static int readInt32() { return Convert.ToInt32(readLong64()); }\n #endregion\n}\nstatic partial class Extension\n{\n //\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class Helper\n{\n internal static IEnumerable seq(int low, int high, int step = 1) { checked { for (var i = low; i <= high; i += step) yield return i; } }\n internal static IEnumerable rev(int low, int high, int stepPositive = 1) { checked { for (var i = high; i >= low; i -= stepPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool isNotNull, T value) where T : struct { return isNotNull ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static void assert(bool truthy) { if (!truthy) throw new PlatformNotSupportedException(\"ASSERT\"); }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n internal static List ll(T emptyExample) { return new List(); }\n}\n[DebuggerNonUserCode]\nstatic partial class Extension\n{\n internal static IEnumerable Select(this IEnumerable stream, Func getter) { return stream.Select(_ => getter()); }\n internal static void elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); }\n internal static IEnumerable Select(this int count, Func getter) { for (var i = 0; i < count; i++) yield return getter(); }\n internal static void elect(this int count, Action act) { for (var i = 0; i < count; i++) act(); }\n internal static int GetUpperBound(this IList list) { return list.Count - 1; }\n internal static int getUpperBound(this int count) { return count - 1; }\n internal static int getUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static IEnumerable indices(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static T? firstOrNullable(this IEnumerable stream) where T : struct { foreach (var val in stream) return val; return null; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static IEnumerable skip(this IList list, int count) { for (var i = count; i < list.Count; i++) yield return list[i]; }\n internal static IEnumerable reverseView(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return list[i]; }\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n //\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static List ll(this IEnumerable stream) { return stream.ToList(); }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n internal static T removeOrDequeue(this SortedSet pq, bool minimum = true) { var t = minimum ? pq.Min : pq.Max; pq.Remove(t); return t; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine()), k = Convert.ToInt64(Console.ReadLine()), a = Convert.ToInt64(Console.ReadLine()), b = Convert.ToInt64(Console.ReadLine());\n long ans = 0;\n if (k != 1)\n {\n while (n != 1)\n {\n if (n % k != 0 && n / k != 0)\n {\n ans += n % k * a; n -= n % k;\n }\n else if (n < k)\n {\n ans += ((n - 1) * a);\n n = 1;\n }\n else\n {\n if (b <= a * (n - (n / k)))\n {\n ans += b; n /= k;\n }\n else\n {\n ans += a * (n - (n / k)); n /= k;\n }\n }\n\n }\n\n Console.WriteLine(ans);\n }\n else\n {\n ans = a * (n - 1);\n Console.WriteLine(ans);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Scanner\n {\n private string[] line = new string[0];\n private int index = 0;\n public string Next()\n {\n if (line.Length <= index)\n {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public string[] Array()\n {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n public int[] IntArray()\n {\n return Array().Select(int.Parse).ToArray();\n }\n public long[] LongArray()\n {\n return Array().Select(long.Parse).ToArray();\n }\n }\n\n class Program\n {\n private long N, K, A, B;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n K = sc.NextInt();\n A = sc.NextInt();\n B = sc.NextInt();\n }\n\n public void Solve()\n {\n Scan();\n long ans = 0;\n if (K == 1)\n {\n Console.WriteLine((N - 1) * A);\n return;\n }\n while (N > 1)\n {\n if (N % K == 0)\n {\n long aa = (N / K * (K - 1)) * A;\n ans += Math.Min(aa, B);\n N /= K;\n }\n else\n {\n if (N / K == 0)\n {\n ans += (N - 1) * A;\n N = 1;\n }\n else\n {\n ans += (N % K) * A;\n N -= N % K;\n }\n }\n }\n Console.WriteLine(ans);\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _940B\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = ulong.Parse(Console.ReadLine());\n var k = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10e7\u10dd\u10e4\u10d8\n var a = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10dd\u10d9\u10da\u10d4\u10d1\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n var b = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n ulong totalPrice = 0;\n\n if (k == 1 || n / k < 1)\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n while (n > 1)\n {\n if (n % k != 0)\n {\n if (n / k < k && n > k)\n {\n var division = k;\n var i = 1;\n while (k * (ulong)i < n)\n {\n division = k * (ulong)i;\n i++;\n }\n\n totalPrice += (n - division) * a;\n n = division;\n }\n else\n {\n ulong counter = 0;\n while (n % k != 0 && n > 1)\n {\n counter++;\n n--;\n }\n\n totalPrice += counter * a;\n }\n }\n\n if (n == 1)\n break;\n\n if (b > (n - n / k) * a) //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d0 \u10e3\u10e4\u10e0\u10dd \u10eb\u10d5\u10d8\u10e0\u10d8\u10d0\n totalPrice += (n - n / k) * a;\n\n else\n totalPrice += b;\n\n n = n / k;\n\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Tanya{\n\tstatic void Main(){\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tint k = Convert.ToInt32(Console.ReadLine());\n\t\tint A = Convert.ToInt32(Console.ReadLine());\n\t\tint B = Convert.ToInt32(Console.ReadLine());\n\t\tlong mincoins = 0;\n\t\tint x = n;\n\t\tlong costA;\n\t\tif (k == 1){\n\t\t\tmincoins = mincoins + (long) A*(x-1);\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}else if (n == 1){\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}else if (n > 1){\n\t\t\twhile (x > 1){\n\t\t\t\tif (x % k == 0){\n\t\t\t\t\tcostA = (long) A*(x - (x/k));\n\t\t\t\t\tif (costA < (long) B){\n\t\t\t\t\t\tif (x > k){\n\t\t\t\t\t\t\tx = x / k;\n\t\t\t\t\t\t\tmincoins = mincoins + costA;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tx = x - (k-1);\n\t\t\t\t\t\t\tmincoins = mincoins + (long) A*(k-1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tx = x / k;\n\t\t\t\t\t\tmincoins = mincoins + B;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tif ((x - x%k) > 0){\n\t\t\t\t\t\tmincoins = mincoins + (long) A*(x%k);\n\t\t\t\t\t\tx = x - (x%k);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmincoins = mincoins + (long) A*((x%k)-1);\n\t\t\t\t\t\tx = x - ((x%k)-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _940B\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = ulong.Parse(Console.ReadLine());\n var k = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10e7\u10dd\u10e4\u10d8\n var a = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10dd\u10d9\u10da\u10d4\u10d1\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n var b = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n ulong totalPrice = 0;\n\n if (k == 1 || n / k < 1)\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n while (n > 1)\n {\n if (n % k != 0)\n {\n if (n / k < 100 && n > k)\n {\n var division = k;\n var i = 1;\n while (k * (ulong)i < n)\n {\n division = k * (ulong)i;\n i++;\n }\n\n totalPrice += (n - division) * a;\n n = division;\n }\n else\n {\n ulong counter = 0;\n while (n % k != 0 && n > 1)\n {\n counter++;\n n--;\n }\n\n totalPrice += counter * a;\n }\n }\n\n if (n == 1)\n break;\n\n if (b > (n - n / k) * a) //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d0 \u10e3\u10e4\u10e0\u10dd \u10eb\u10d5\u10d8\u10e0\u10d8\u10d0\n totalPrice += (n - n / k) * a;\n\n else\n totalPrice += b;\n\n n = n / k;\n\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _940B\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = ulong.Parse(Console.ReadLine());\n var k = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10e7\u10dd\u10e4\u10d8\n var a = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10dd\u10d9\u10da\u10d4\u10d1\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n var b = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n ulong totalPrice = 0;\n\n if (k == 1 || n / k < 1)\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n while (n > 1)\n {\n if (n % k != 0)\n {\n if (n / k < 10 && n > k)\n {\n var division = k;\n var i = 1;\n while (k * (ulong)i < n)\n {\n division = k * (ulong)i;\n i++;\n }\n\n totalPrice += (n - division) * a;\n n = division;\n }\n else\n {\n ulong counter = 0;\n while (n % k != 0 && n > 1)\n {\n counter++;\n n--;\n }\n\n totalPrice += counter * a;\n }\n }\n\n if (n == 1)\n break;\n\n if (b > (n - n / k) * a) //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d0 \u10e3\u10e4\u10e0\u10dd \u10eb\u10d5\u10d8\u10e0\u10d8\u10d0\n totalPrice += (n - n / k) * a;\n\n else\n totalPrice += b;\n\n n = n / k;\n\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tanja\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long k = long.Parse(Console.ReadLine());\n long a = long.Parse(Console.ReadLine());\n long b = long.Parse(Console.ReadLine());\n\n long cost = 0;\n long t = k * a;\n if (n k)\n {\n long rem = n % k;\n if (rem == 0)\n {\n cost += Math.Min(b, (n - n / k) * a);\n n /= k;\n }\n else\n {\n cost += rem * a;\n n -= rem;\n }\n }\n\n if (n == k)\n cost += Math.Min(b, (n - 1) * a);\n else\n cost += (n - 1) * a;\n }\n \n Console.Write(cost);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n ulong k = ulong.Parse(Console.ReadLine());\n ulong a = ulong.Parse(Console.ReadLine());\n ulong b = ulong.Parse(Console.ReadLine());\n ulong sum = 0;\n if (k == 1)\n {\n Console.WriteLine(a * (n - 1));\n return;\n }\n while (n != 1)\n {\n if (n % k == 0)\n {\n ulong v1 = a * (n - n / k), v2 = b;\n sum += Math.Min(v1, v2);\n n /= k;\n }\n else\n {\n ulong n2 = n / k;\n n2 = n2 * k;\n if (n2 != 0)\n {\n sum += a * (n - n2);\n n = n2;\n }\n else\n {\n sum += a * (n - 1);\n break;\n }\n }\n }\n Console.WriteLine(sum);\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int x, k, a, b;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n x = int.Parse(input[0]);\n k = int.Parse(input[1]);\n a = int.Parse(input[2]);\n b = int.Parse(input[3]);\n }\n int result = 0;\n for(int smllr; x>1; )\n {\n if((smllr=x%k)==0)\n {\n if (((x - (smllr = x / k)) * a) <= b) { result = a * (x - 1); x = 1; break; }\n else { x = smllr; result += b; }\n }\n else { result += smllr * a; x -= smllr; }\n }\n Console.WriteLine(x==0? result-a:result);\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long x, k, a, b;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n x = long.Parse(input[0]);\n k = long.Parse(input[1]);\n a = long.Parse(input[2]);\n b = long.Parse(input[3]);\n }\n long result = 0L;\n for(long smllr; x>1L; )\n {\n if((smllr=x%k)==0L)\n {\n if (((x - (smllr = x / k)) * a) <= b) { result = a * (x - 1L); x = 1L; break; }\n else { x = smllr; result += b; }\n }\n else { result += smllr * a; x -= smllr; }\n }\n Console.WriteLine(x==0L? result-a:result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _940B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int k = int.Parse(Console.ReadLine());\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n\n var queue = new Queue(new int[] { n });\n var amount = new Dictionary { { n, 0 } };\n\n while (queue.Any())\n {\n int x = queue.Dequeue();\n\n if (!amount.ContainsKey(1) || amount[x] + a * (x - 1) < amount[1])\n {\n amount[1] = amount[x] + a * (x - 1);\n }\n\n int mod = x % k;\n int div = x / k;\n\n if (mod > 0)\n {\n if (!amount.ContainsKey(x - mod) || amount[x] + a * mod < amount[x - mod])\n {\n queue.Enqueue(x - mod);\n amount[x - mod] = amount[x] + a * mod;\n }\n }\n else\n {\n if (!amount.ContainsKey(div) || amount[x] + b < amount[div])\n {\n queue.Enqueue(div);\n amount[div] = amount[x] + b;\n }\n }\n }\n\n Console.WriteLine(amount[1]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine()), k = Convert.ToInt32(Console.ReadLine()), a = Convert.ToInt32(Console.ReadLine()), b = Convert.ToInt32(Console.ReadLine());\n int ans = 0;\n while ( n!=1)\n {\n if ( n%k!=0 && n/k!=0)\n {\n ans+= n % k * a;n -= n % k;\n }\n else if ( n 1){\n\t\t\twhile (x > 1){\n\t\t\t\tif (x % k == 0){\n\t\t\t\t\tcostA = A*(x - (x/k));\n\t\t\t\t\tif (costA < B){\n\t\t\t\t\t\tif ((x - k) > 0){\n\t\t\t\t\t\t\tmincoins = mincoins + (A*k);\n\t\t\t\t\t\t\tx = x - k;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tx = x - 1;\n\t\t\t\t\t\t\tmincoins = mincoins + A;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tx = x / k;\n\t\t\t\t\t\tmincoins = mincoins + B;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tif ((x - x%k) > 0){\n\t\t\t\t\t\tmincoins = mincoins + A*(x%k);\n\t\t\t\t\t\tx = x - (x%k);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tx = x - 1;\n\t\t\t\t\t\tmincoins = mincoins + A;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nclass Tanya{\n\tstatic void Main(){\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tint k = Convert.ToInt32(Console.ReadLine());\n\t\tint A = Convert.ToInt32(Console.ReadLine());\n\t\tint B = Convert.ToInt32(Console.ReadLine());\n\t\tlong mincoins = 0;\n\t\tint x = n;\n\t\tint costA;\n\t\tif (k == 1){\n\t\t\tmincoins = mincoins + (long) A*(x-1);\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}else if (n == 1){\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}else if (n > 1){\n\t\t\twhile (x > 1){\n\t\t\t\tif (x % k == 0){\n\t\t\t\t\tcostA = A*(x - (x/k));\n\t\t\t\t\tif (costA < B){\n\t\t\t\t\t\tif (x > k){\n\t\t\t\t\t\t\tx = x / k;\n\t\t\t\t\t\t\tmincoins = mincoins + (long) costA;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tx = x - (k-1);\n\t\t\t\t\t\t\tmincoins = mincoins + (long) A*(k-1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tx = x / k;\n\t\t\t\t\t\tmincoins = mincoins + B;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tif ((x - x%k) > 0){\n\t\t\t\t\t\tmincoins = mincoins + (long) A*(x%k);\n\t\t\t\t\t\tx = x - (x%k);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmincoins = mincoins + (long) A*((x%k)-1);\n\t\t\t\t\t\tx = x - ((x%k)-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(mincoins);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _940B\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = ulong.Parse(Console.ReadLine());\n var k = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10e7\u10dd\u10e4\u10d8\n var a = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10db\u10dd\u10d9\u10da\u10d4\u10d1\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n var b = ulong.Parse(Console.ReadLine()); //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d8\u10e1 \u10e4\u10d0\u10e1\u10d8\n ulong totalPrice = 0;\n\n if (k == 1 || n / k < 1)\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n while (n > 1)\n {\n if (n % k != 0)\n {\n if (n / k < 100)\n {\n var division = k;\n var i = 1;\n while (division < n)\n {\n division = k * (ulong)i;\n i++;\n }\n\n totalPrice += (n - division) * a;\n n = division;\n }\n else\n {\n ulong counter = 0;\n while (n % k != 0 && n > 1)\n {\n counter++;\n n--;\n }\n\n totalPrice += counter * a;\n }\n }\n\n if (n == 1)\n break;\n\n if (b > (n - n / k) * a) //\u10d2\u10d0\u10e7\u10dd\u10e4\u10d0 \u10e3\u10e4\u10e0\u10dd \u10eb\u10d5\u10d8\u10e0\u10d8\u10d0\n totalPrice += (n - n / k) * a;\n\n else\n totalPrice += b;\n\n n = n / k;\n\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _940B\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = uint.Parse(Console.ReadLine());\n var k = uint.Parse(Console.ReadLine());\n var a = uint.Parse(Console.ReadLine());\n var b = uint.Parse(Console.ReadLine());\n ulong totalPrice = 0;\n\n if (k == 1)\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n var multipliers = new List();\n uint index = 1;\n while (true)\n {\n var current = k * index;\n if (current > n)\n break;\n multipliers.Add(current);\n index++;\n }\n\n if (!multipliers.Any())\n {\n Console.WriteLine((n - 1) * a);\n return;\n }\n\n var last = multipliers.Last();\n totalPrice += (n - last) * a;\n n = last;\n\n for (int i = multipliers.Count - 1; i >= 0; --i)\n {\n if (n < multipliers[i])\n {\n continue;\n }\n\n totalPrice += (n - multipliers[i]) * (ulong)a;\n\n uint divisionPrice = b;\n var minusPrice = (n - n / k) * (ulong)a;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n n = n / k;\n }\n\n else\n {\n totalPrice += (n - 1) * (ulong)a;\n Console.WriteLine(totalPrice);\n return;\n }\n }\n\n if (n > 1)\n {\n totalPrice += (n - 1) * a;\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tanja\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long k = long.Parse(Console.ReadLine());\n long a = long.Parse(Console.ReadLine());\n long b = long.Parse(Console.ReadLine());\n\n long cost = 0;\n if (b >= k * a || n k)\n {\n long rem = n % k;\n if (rem == 0)\n {\n cost += b;\n n /= k;\n }\n else\n {\n cost += rem * a;\n n -= rem;\n }\n }\n\n if (n == k)\n cost += Math.Min(b, (n - 1) * a);\n else\n cost += (n - 1) * a;\n }\n \n Console.Write(cost);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int div = int.Parse(Console.ReadLine());\n int subCost = int.Parse(Console.ReadLine());\n int divCost = int.Parse(Console.ReadLine());\n int cost = 0;\n while (x >= 1)\n {\n if (x == 1)\n {\n cost += subCost;\n break;\n }\n int rem = x % div;\n if (rem == 0)\n {\n int sC = subCost * (x - x / div);\n x /= div;\n if (divCost < sC)\n {\n cost += divCost;\n }\n else\n {\n cost += sC;\n }\n }\n else\n {\n cost += subCost * rem;\n x -= rem;\n }\n }\n cost -= subCost;\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int div = int.Parse(Console.ReadLine());\n int subCost = int.Parse(Console.ReadLine());\n int divCost = int.Parse(Console.ReadLine());\n int cost = 0;\n while (x >= 1)\n {\n if (x == 1)\n {\n cost += subCost;\n break;\n }\n int rem = x % div;\n Console.WriteLine(\"rem: \" + rem + \" x: \" + x);\n if (rem == 0)\n {\n int sC = subCost * (x - x / div);\n x /= div;\n if (divCost < sC)\n {\n cost += divCost;\n }\n else\n {\n cost += sC;\n }\n }\n else\n {\n cost += subCost * rem;\n x -= rem;\n }\n }\n cost -= subCost;\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int div = int.Parse(Console.ReadLine());\n int subCost = int.Parse(Console.ReadLine());\n int divCost = int.Parse(Console.ReadLine());\n Console.WriteLine(subCost);\n Console.WriteLine(divCost);\n BigInteger cost = 0;\n if (div > 1)\n {\n while (x >= 1)\n {\n if (x == 1)\n {\n cost += subCost;\n break;\n }\n int rem = x % div;\n Console.WriteLine(\"rem: \" + rem + \" x: \" + x + \" cost:\" + cost);\n if (rem == 0)\n {\n BigInteger sC = (BigInteger)subCost * (BigInteger)(x - x / div);\n x /= div;\n if (divCost < sC)\n {\n Console.WriteLine(\"dividing\");\n cost += divCost;\n }\n else\n {\n Console.WriteLine(\"subtracting\");\n cost += sC;\n }\n }\n else\n {\n Console.WriteLine(\"subtracting \" + subCost + \"rem\" + rem + subCost * rem);\n cost += (BigInteger)subCost * (BigInteger)rem;\n x -= rem;\n }\n }\n cost -= subCost;\n }\n else\n {\n cost = (BigInteger)subCost * (BigInteger)(x - 1);\n }\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Principal;\n\nnamespace Quserty2\n{\n public class Program\n {\n static ulong totalPrice = 0;\n\n static void Main(string[] args)\n {\n ulong n, k, A, B;\n\n n = ulong.Parse(Console.ReadLine());\n k = ulong.Parse(Console.ReadLine());\n A = ulong.Parse(Console.ReadLine());\n B = ulong.Parse(Console.ReadLine());\n\n if (k == 1)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n ulong last = 0;\n\n uint index = 1;\n if (n / k < k)\n {\n while (true)\n {\n var current = k * index;\n if (current > n)\n break;\n last = current;\n index++;\n }\n }\n else\n {\n var n2 = n;\n while (n2 % k != 0 && n2 > 1)\n {\n --n2;\n }\n\n last = n2;\n }\n\n\n if (last == 0)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n totalPrice += (n - last) * A;\n n = last;\n\n for (;;)\n {\n if (last <= 1)\n {\n break;\n }\n\n if (n < last)\n {\n last -= k;\n continue;\n }\n\n totalPrice += (n - last) * A;\n\n var divisionPrice = B;\n var minusPrice = (n - n / k) * A;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n var divisionResult = n / k;\n var numberOfkTimesInDivisionResult = (n - divisionResult) / k;\n last -= (numberOfkTimesInDivisionResult == 0 ? 1 : numberOfkTimesInDivisionResult) * k;\n n = divisionResult;\n continue;\n }\n else\n {\n totalPrice += (n - 1) * A;\n Console.WriteLine(totalPrice);\n return;\n }\n }\n\n if (n > 1)\n {\n totalPrice += (n - 1) * A;\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Security.Principal;\n\nnamespace Quserty2\n{\n public class Program\n {\n static void Main(string[] args)\n {\n uint n, k, A, B;\n\n n = uint.Parse(Console.ReadLine());\n k = uint.Parse(Console.ReadLine());\n A = uint.Parse(Console.ReadLine());\n B = uint.Parse(Console.ReadLine());\n\n ulong totalPrice = 0;\n\n while (n > 1)\n {\n if (n % k == 0)\n {\n var divisionPrice = B;\n var minusPrice = (n - n / k) * A;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n n = n / k;\n }\n else\n {\n Console.WriteLine(totalPrice + n * A);\n return;\n }\n }\n else\n {\n totalPrice += A;\n n--;\n }\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Principal;\n\nnamespace Quserty2\n{\n public class Program\n {\n static ulong totalPrice = 0;\n\n static void Main(string[] args)\n {\n ulong n, k, A, B;\n\n n = ulong.Parse(Console.ReadLine());\n k = ulong.Parse(Console.ReadLine());\n A = ulong.Parse(Console.ReadLine());\n B = ulong.Parse(Console.ReadLine());\n\n if (k == 1)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n ulong last = 0;\n\n uint index = 1;\n if (n / k < k)\n {\n while (true)\n {\n var current = k * index;\n if (current > n)\n break;\n last = current;\n index++;\n }\n }\n else\n {\n var n2 = n;\n while (n2 % k != 0 && n2 > 1)\n {\n --n2;\n }\n\n last = n2;\n }\n\n\n if (last == 0)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n totalPrice += (n - last) * A;\n n = last;\n\n for (;;)\n {\n if (last <= 1)\n {\n break;\n }\n\n if (n < last)\n {\n last -= k;\n continue;\n }\n\n totalPrice += (n - last) * A;\n\n var divisionPrice = B;\n var minusPrice = (n - n / k) * A;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n var divisionResult = n / k;\n last -= (n - divisionResult) / k;\n n = divisionResult;\n continue;\n }\n else\n {\n totalPrice += (n - 1) * A;\n Console.WriteLine(totalPrice);\n return;\n }\n }\n\n if (n > 1)\n {\n totalPrice += (n - 1) * A;\n }\n\n Console.WriteLine(totalPrice);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Principal;\n\nnamespace Quserty2\n{\n public class Program\n {\n static void Main(string[] args)\n {\n uint n, k, A, B;\n\n n = uint.Parse(Console.ReadLine());\n k = uint.Parse(Console.ReadLine());\n A = uint.Parse(Console.ReadLine());\n B = uint.Parse(Console.ReadLine());\n\n if (k == 1)\n {\n Console.WriteLine((n - 1) * A);\n return;\n }\n\n ulong totalPrice = 0;\n\n List multipliers = new List();\n\n\n uint index = 1;\n while (true)\n {\n var current = k * index;\n if(current > n)\n break;\n multipliers.Add(current);\n index++;\n }\n\n var last = multipliers.Last();\n totalPrice += (n - last) * A;\n n = last;\n\n for (int i = multipliers.Count - 1; i >= 0; --i)\n {\n if (n < multipliers[i])\n {\n continue;\n }\n\n totalPrice += (n - multipliers[i]) * A;\n\n var divisionPrice = B;\n var minusPrice = (n - n / k) * A;\n if (divisionPrice < minusPrice)\n {\n totalPrice += divisionPrice;\n n = n / k;\n }\n\n else\n {\n Console.WriteLine(totalPrice + (n - 1) * A);\n return;\n }\n }\n\n if (n > 1)\n totalPrice += (n - 1) * A;\n\n Console.WriteLine(totalPrice);\n }\n }\n}"}, {"source_code": "//Rextester.Program.Main is the entry point for your code. Don't change it.\n//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var k = Convert.ToInt32(Console.ReadLine());\n var A = Convert.ToInt32(Console.ReadLine());\n var B = Convert.ToInt32(Console.ReadLine());\n \n var cost = 0;\n \n while(n > 1) {\n if(n%k == 0) {\n if (B < (A * (n - n/k))) {\n cost += B;\n n /= k;\n }\n else {\n cost += (A * (n - n/k));\n n /= k;\n }\n }\n else {\n if(n - (n%k) == 0) {\n cost += (A * (n%k - 1));\n n -= (n%k + 1);\n }\n else {\n cost += (A * (n%k));\n n -= (n%k);\n }\n }\n }\n \n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "//Rextester.Program.Main is the entry point for your code. Don't change it.\n//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n UInt64 n = Convert.ToUInt64(Console.ReadLine());\n UInt64 k = Convert.ToUInt64(Console.ReadLine());\n UInt64 A = Convert.ToUInt64(Console.ReadLine());\n UInt64 B = Convert.ToUInt64(Console.ReadLine());\n \n UInt64 cost = 0;\n \n while(n > 1) {\n if(n%k == 0) {\n if (B < (A * (n - n/k))) {\n cost += B;\n n /= k;\n }\n else {\n cost += (A * (n - n/k));\n n /= k;\n }\n }\n else {\n if(n - (n%k) == 0) {\n cost += (A * (n%k - 1));\n n -= (n%k + 1);\n }\n else {\n cost += (A * (n%k));\n n -= (n%k);\n }\n }\n }\n \n Console.WriteLine(cost);\n }\n }\n}"}], "src_uid": "f838fae7c98bf51cfa0b9bd158650b10"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int A, B, C, D;\n sc.Make(out A, out B, out C, out D);\n var res = 0L;\n for (int z = C; z <= D; z++)\n {\n long l = Min(B, z - C);\n long r = Min(B, z - B)+1;\n res += Max(0, (Min(r, A) - l)) * (B - A + 1);\n chmax(ref l, A);\n chmax(ref r, A);\n res += (B - l) * (B - l + 1L) / 2 - (B - r) * (B - r+1) / 2;\n }\n Console.WriteLine(res);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing CompLib.Collections.Generic;\nusing CompLib.Util;\n\npublic class Program\n{\n int A, B, C, D;\n public void Solve()\n {\n var sc = new Scanner();\n A = sc.NextInt();\n B = sc.NextInt();\n C = sc.NextInt();\n D = sc.NextInt();\n\n // a<=x<=b<=y<=c<=z<=d \u306ax,y,z\u306a\u4e09\u89d2\u5f62\u304c\u3044\u304f\u3064\u304b?\n\n // x+y = i\u306e\u3084\u3064\u3044\u304f\u3064\u304b?\n var st = new LazySegmentTree((l, r) => l + r, 0, (l, r) => l * r, (l, r) => l + r, 0);\n for (int x = A; x <= B; x++)\n {\n int min = x + B;\n int max = x + C;\n st.Update(min, max + 1, 1);\n }\n long ans = 0;\n for (int z = C; z <= D; z++)\n {\n // x+y > z\n\n ans += st.Query(z + 1, B + C + 1);\n }\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\n\nnamespace CompLib.Collections.Generic\n{\n using System;\n\n public class LazySegmentTree\n {\n private const int N = 1 << 20;\n private readonly T[] _array;\n private readonly T[] _tmp;\n private readonly bool[] _flag;\n\n\n private readonly T _identity, _updateIdentity;\n private readonly Func _operation, _update;\n private readonly Func _multiplication;\n\n /// \n /// \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf updateIdentity\u3067\u521d\u671f\u5316\n /// \n /// \u533a\u9593\u6f14\u7b97\u7528\u306e\u6f14\u7b97\n /// (T, operation)\u306e\u5358\u4f4d\u5143\n /// (T, operation)\u306e\u30b9\u30ab\u30e9\u30fc\u4e57\u7b97\n /// \u533a\u9593\u66f4\u65b0\u7528\u306e\u6f14\u7b97\n /// (T, update)\u306e\u5de6\u5358\u4f4d\u5143\n public LazySegmentTree(Func operation, T identity, Func multiplication, Func update,\n T updateIdentity)\n {\n _operation = operation;\n _identity = identity;\n _multiplication = multiplication;\n _update = update;\n _updateIdentity = updateIdentity;\n _array = new T[2 * N];\n for (int i = 0; i < N; i++)\n {\n _array[i + N] = _updateIdentity;\n }\n\n for (int i = N - 1; i >= 1; i--)\n {\n _array[i] = _operation(_array[i * 2], _array[i * 2 + 1]);\n }\n\n _tmp = new T[2 * N];\n for (int i = 1; i < 2 * N; i++)\n {\n _tmp[i] = _updateIdentity;\n }\n\n _flag = new bool[2 * N];\n }\n\n private void Eval(int k, int l, int r)\n {\n if (_flag[k])\n {\n if (r - l > 1)\n {\n _tmp[k * 2] = _update(_tmp[k * 2], _tmp[k]);\n _flag[k * 2] = true;\n _tmp[k * 2 + 1] = _update(_tmp[k * 2 + 1], _tmp[k]);\n _flag[k * 2 + 1] = true;\n }\n\n _array[k] = _update(_array[k], _multiplication(_tmp[k], r - l));\n _tmp[k] = _updateIdentity;\n _flag[k] = false;\n }\n }\n\n private void Update(int left, int right, int k, int l, int r, T n)\n {\n Eval(k, l, r);\n if (r <= left || right <= l) return;\n if (left <= l && r <= right)\n {\n // \u672c\u5f53\u306f _update(tmp[k], n)\u3060\u3051\u3069 \u4e0a\u3067Eval()\u3057\u305f\u306e\u3067 _tmp[k]\u306f\u5358\u4f4d\u5143\n _tmp[k] = n;\n _flag[k] = true;\n Eval(k, l, r);\n }\n else\n {\n Update(left, right, k * 2, l, (l + r) / 2, n);\n Update(left, right, k * 2 + 1, (l + r) / 2, r, n);\n _array[k] = _operation(_array[k * 2], _array[k * 2 + 1]);\n }\n }\n\n /// \n /// [left, right)\u3092update(A[i], n)\u306b\u66f4\u65b0\u3059\u308b\n /// \n /// \u53f3\u7aef\n /// \u5de6\u7aef\n /// \u5024\n public void Update(int left, int right, T n) => Update(left, right, 1, 0, N, n);\n\n /// \n /// A[i]\u3092update(A[i] ,n)\u306b\u66f4\u65b0\u3059\u308b\n /// \n /// index\n /// \u5024\n public void Update(int i, T n) => Update(i, i + 1, n);\n\n private T Query(int left, int right, int k, int l, int r)\n {\n Eval(k, l, r);\n if (r <= left || right <= l) return _identity;\n if (left <= l && r <= right) return _array[k];\n return _operation(Query(left, right, k * 2, l, (l + r) / 2), Query(left, right, k * 2 + 1, (l + r) / 2, r));\n }\n\n /// \n /// A[left] op A[left+1] ... A[right-1]\u3092\u6c42\u3081\u308b O(log N)\n /// \n /// \u5de6\u7aef\n /// \u53f3\u7aef\n /// \n public T Query(int left, int right) => Query(left, right, 1, 0, N);\n\n public T this[int i]\n {\n get { return Query(i, i + 1); }\n }\n\n public T[] ToArray()\n {\n T[] result = new T[N];\n for (int i = 0; i < N; i++)\n {\n result[i] = this[i];\n }\n\n return result;\n }\n }\n}\n\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n while (_index >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n _line = Console.ReadLine().Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tpublic class C\n\t{\n\t\tconst int N = (int)2e6;\n\t\tpublic static int Main()\n\t\t{\n\t\t\tint [] input = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n\t\t\t\n\t\t\tlong [] a = new long[N];\n\t\t\t\n\t\t\tint A = input[0];\n\t\t\tint B = input[1];\n\t\t\tint C = input[2];\n\t\t\tint D = input[3];\n\t\t\t\n\t\t\tfor (int i = A; i <= B; ++i)\n\t\t\t{\n\t\t\t\t++a[i + B];\n\t\t\t\t--a[i + C + 1];\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 1; i < N; ++i)\n\t\t\t{\n\t\t\t\ta[i] += a[i - 1];\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 1; i < N; ++i)\n\t\t\t{\n\t\t\t\ta[i] += a[i - 1];\n\t\t\t}\n\t\t\t\n\t\t\tlong result = 0;\n\t\t\tfor (int i = C; i <= D; ++i)\n\t\t\t{\n\t\t\t\tresult += a[N - 1] - a[i];\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(result);\n\t\t\t\n\t\t\treturn 0;\n\t\t}\n\t}\n} \n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class CODEFORCES2\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var A = NN;\n var B = NN;\n var C = NN;\n var D = NN;\n var range = D - C + 1;\n var ans = 0L;\n for (var i = 0; i < range; i++)\n {\n var z = C + i;\n var miny = B;\n var needx = z - miny + 1;\n if (needx > B)\n {\n var herasi = B - needx;\n miny -= herasi;\n needx += herasi;\n if (miny > C)\n {\n continue;\n }\n }\n var cntx = B - Max(A, needx) + 1;\n var nokoriacnt = (B - A + 1) - cntx + 1;\n var bcnt = C - miny + 1;\n var mincnt = Min(nokoriacnt, bcnt);\n var s = mincnt * (2 * cntx + mincnt - 1) / 2;\n var nokorib = bcnt - mincnt;\n var thiscnt = s + nokorib * (B - A + 1);\n ans += thiscnt;\n }\n Console.WriteLine(ans);\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[1024];\n int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n byte read()\n {\n if (isEof) throw new EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n public LIB_FastIODebug() { }\n public override string Scan() => NextString();\n public override long Long() => long.Parse(NextString());\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R1355.C\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long answer)\n {\n tw.WriteLine(answer);\n }\n\n private static long Parse(TextReader tr)\n {\n var t = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n return Calc(t[0], t[1], t[2], t[3]);\n }\n\n public static long Calc(long a, long b, long c, long d)\n {\n var res = 0L;\n\n var arr = new long[Math.Max(b + c, d) + 2];\n\n for (var x = a; x <= b; ++x)\n {\n ++arr[x + b];\n --arr[x + c + 1];\n }\n\n var s = new long[arr.Length];\n\n for (var x = a + b; x <= b + c; ++x)\n s[x] = arr[x] + s[x - 1];\n\n var pre = new long[arr.Length];\n for (var x = a + b; x < pre.Length; ++x)\n pre[x] = pre[x - 1] + s[x];\n\n for (var z = c; z <= d; ++z)\n {\n res += pre[b + c] - pre[z];\n }\n\n return res;\n }\n\n public static long Calc0(long a, long b, long c, long d)\n {\n var res = 0L;\n\n for (var x = a; x <= b; ++x)\n {\n for (var y = b; y <= c; ++y)\n {\n for (var z = c; z <= d; ++z)\n {\n if (x + y > z)\n ++res;\n }\n }\n }\n\n return res;\n }\n }\n}\n"}, {"source_code": "using CodeforcesRound643Div2.Questions;\nusing CodeforcesRound643Div2.Extensions;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesRound643Div2.Questions\n{\n public class QuestionC_Review : AtCoderQuestionBase\n {\n public override IEnumerable Solve(TextReader inputStream)\n {\n var (a, b, c, d) = inputStream.ReadValue();\n var xyCount = new long[1000002];\n for (int x = a; x <= b; x++)\n {\n xyCount[x + b] += 1;\n xyCount[x + c + 1] -= 1;\n }\n\n for (int prefixSum = 0; prefixSum < 2; prefixSum++)\n {\n for (int i = 1; i < xyCount.Length; i++)\n {\n xyCount[i] += xyCount[i - 1];\n }\n }\n\n long count = 0;\n for (int z = c; z <= d; z++)\n {\n count += xyCount[xyCount.Length - 1] - xyCount[z];\n }\n\n yield return count;\n }\n }\n}\n\n\nnamespace CodeforcesRound643Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionC_Review(); // \u554f\u984c\u306b\u5408\u308f\u305b\u3066\u66f8\u304d\u63db\u3048\n var answers = question.Solve(Console.In);\n\n var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(writer);\n foreach (var answer in answers)\n {\n Console.WriteLine(answer);\n }\n Console.Out.Flush();\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound643Div2.Questions\n{\n\n public interface IAtCoderQuestion\n {\n IEnumerable Solve(string input);\n IEnumerable Solve(TextReader inputStream);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public IEnumerable Solve(string input)\n {\n var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));\n var reader = new StreamReader(stream, Encoding.Unicode);\n\n return Solve(reader);\n }\n\n public abstract IEnumerable Solve(TextReader inputStream);\n }\n}\n\n#endregion\n\n#region Extensions\n\nnamespace CodeforcesRound643Div2.Extensions\n{\n internal static class TextReaderExtensions\n {\n internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));\n internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));\n internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));\n internal static string ReadString(this TextReader reader) => reader.ReadLine();\n\n internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();\n internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();\n internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();\n internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);\n\n // Supports primitive type only.\n internal static T1 ReadValue(this TextReader reader) => (T1)Convert.ChangeType(reader.ReadLine(), typeof(T1));\n\n internal static (T1, T2) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n return (v1, v2);\n }\n\n internal static (T1, T2, T3) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n return (v1, v2, v3);\n }\n\n internal static (T1, T2, T3, T4) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n return (v1, v2, v3, v4);\n }\n\n internal static (T1, T2, T3, T4, T5) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n return (v1, v2, v3, v4, v5);\n }\n\n internal static (T1, T2, T3, T4, T5, T6) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n return (v1, v2, v3, v4, v5, v6);\n }\n\n internal static (T1, T2, T3, T4, T5, T6, T7) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n return (v1, v2, v3, v4, v5, v6, v7);\n }\n }\n}\n\n#endregion"}, {"source_code": "using CodeforcesRound643Div2.Questions;\nusing CodeforcesRound643Div2.Extensions;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesRound643Div2.Questions\n{\n public class QuestionC : AtCoderQuestionBase\n {\n public override IEnumerable Solve(TextReader inputStream)\n {\n var (a, b, c, d) = inputStream.ReadValue();\n\n long count = 0;\n for (long x = a; x <= b; x++)\n {\n var minY = Math.Max(BoundaryBinarySearch(y => x + y > c, 0, c), b);\n var maxY = c;\n long width = maxY - minY + 1;\n if (width <= 0)\n {\n continue;\n }\n\n long begin = x + minY - 1;\n long overall = (begin + begin + width - 1) * width / 2;\n\n long overBegin = Math.Max(x + minY - d - 1, 1);\n long overEnd = x + maxY - d - 1;\n\n long over = overEnd > 0 ? (overBegin + overEnd) * (overEnd - overBegin + 1) / 2 : 0;\n long withRestriction = Math.Max(overall - (c - 1) * width - over, 0);\n\n\n count += withRestriction;\n }\n\n yield return count;\n }\n private static int BoundaryBinarySearch(Predicate predicate, int ng, int ok)\n {\n // \u3081\u3050\u308b\u5f0f\u4e8c\u5206\u63a2\u7d22\n // Span.BinarySearch\u3060\u3068\u3067\u304d\u305d\u3046\u3067\u3067\u304d\u306a\u3044\uff08lower_bound\u304c\u30c0\u30e1\uff09\n while (Math.Abs(ok - ng) > 1)\n {\n int mid = (ok + ng) / 2;\n\n if (predicate(mid))\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n return ok;\n }\n }\n}\n\n\nnamespace CodeforcesRound643Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionC(); // \u554f\u984c\u306b\u5408\u308f\u305b\u3066\u66f8\u304d\u63db\u3048\n var answers = question.Solve(Console.In);\n\n var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(writer);\n foreach (var answer in answers)\n {\n Console.WriteLine(answer);\n }\n Console.Out.Flush();\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound643Div2.Questions\n{\n\n public interface IAtCoderQuestion\n {\n IEnumerable Solve(string input);\n IEnumerable Solve(TextReader inputStream);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public IEnumerable Solve(string input)\n {\n var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));\n var reader = new StreamReader(stream, Encoding.Unicode);\n\n return Solve(reader);\n }\n\n public abstract IEnumerable Solve(TextReader inputStream);\n }\n}\n\n#endregion\n\n#region Extensions\n\nnamespace CodeforcesRound643Div2.Extensions\n{\n internal static class TextReaderExtensions\n {\n internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));\n internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));\n internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));\n internal static string ReadString(this TextReader reader) => reader.ReadLine();\n\n internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();\n internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();\n internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();\n internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);\n\n // Supports primitive type only.\n internal static T1 ReadValue(this TextReader reader) => (T1)Convert.ChangeType(reader.ReadLine(), typeof(T1));\n\n internal static (T1, T2) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n return (v1, v2);\n }\n\n internal static (T1, T2, T3) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n return (v1, v2, v3);\n }\n\n internal static (T1, T2, T3, T4) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n return (v1, v2, v3, v4);\n }\n\n internal static (T1, T2, T3, T4, T5) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n return (v1, v2, v3, v4, v5);\n }\n\n internal static (T1, T2, T3, T4, T5, T6) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n return (v1, v2, v3, v4, v5, v6);\n }\n\n internal static (T1, T2, T3, T4, T5, T6, T7) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n return (v1, v2, v3, v4, v5, v6, v7);\n }\n }\n}\n\n#endregion"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class CODEFORCES2\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var A = NN;\n var B = NN;\n var C = NN;\n var D = NN;\n var range = D - C + 1;\n var ans = 0L;\n for (var i = 0; i < range; i++)\n {\n var z = C + i;\n var miny = B;\n var needx = z - miny + 1;\n if (needx > B)\n {\n var herasi = B - needx;\n miny -= herasi;\n if (miny > C)\n {\n continue;\n }\n }\n var cntx = B - Max(A, needx) + 1;\n var nokoriacnt = (B - A + 1) - cntx + 1;\n var bcnt = C - B + 1;\n var mincnt = Min(nokoriacnt, bcnt);\n var s = mincnt * (2 * cntx + mincnt - 1) / 2;\n var nokorib = bcnt - mincnt;\n var thiscnt = s + nokorib * (B - A + 1);\n ans += thiscnt;\n }\n Console.WriteLine(ans);\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[1024];\n int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n byte read()\n {\n if (isEof) throw new EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n public LIB_FastIODebug() { }\n public override string Scan() => NextString();\n public override long Long() => long.Parse(NextString());\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R1355.C\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long answer)\n {\n tw.WriteLine(answer);\n }\n\n private static long Parse(TextReader tr)\n {\n var t = tr.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n return Calc(t[0], t[1], t[2], t[3]);\n }\n\n public static long Calc(long a, long b, long c, long d)\n {\n var res = 0L;\n\n for (var x = a; x <= b; ++x)\n {\n var yMin = Math.Max(b, c + 1 - x);\n var zMax = Math.Min(d + 1, x + yMin);\n var zNum = zMax - c;\n\n var yNum = c + 1 - yMin;\n\n res += zNum * yNum;\n res += (yNum - 1) * yNum / 2;\n }\n\n return res;\n }\n }\n}\n"}], "src_uid": "4f92791b9ec658829f667fcea1faee01"} {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\n\r\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\r\npublic class Solution\r\n{\r\n public void Solve()\r\n {\r\n int n = ReadInt();\r\n int mod = ReadInt();\r\n\r\n var dp = new long[n + 1];\r\n dp[1] = 1;\r\n long sum = 1;\r\n for (int i = 2; i <= n; i++)\r\n {\r\n dp[i] = sum;\r\n int j;\r\n for (j = 2; j * j <= i; j++)\r\n dp[i] = (dp[i] + dp[i / j]) % mod;\r\n int p = j - 1;\r\n for (j = i / j; j > 0; j--)\r\n {\r\n int o = i / j;\r\n dp[i] = (dp[i] + (o - p) * dp[j]) % mod;\r\n p = o;\r\n }\r\n sum = (sum + dp[i]) % mod;\r\n }\r\n\r\n Write(dp[n]);\r\n }\r\n\r\n #region Main\r\n\r\n protected static TextReader reader;\r\n protected static TextWriter writer;\r\n static void Main()\r\n {\r\n#if DEBUGLOCAL\r\n reader = new StreamReader(\"..\\\\..\\\\..\\\\input.txt\");\r\n //reader = new StreamReader(Console.OpenStandardInput());\r\n writer = Console.Out;\r\n //writer = new StreamWriter(\"..\\\\..\\\\..\\\\output.txt\");\r\n#else\r\n reader = new StreamReader(Console.OpenStandardInput());\r\n writer = new StreamWriter(Console.OpenStandardOutput());\r\n //reader = new StreamReader(\"ysys.in\");\r\n //writer = new StreamWriter(\"output.txt\");\r\n#endif\r\n try\r\n {\r\n new Solution().Solve();\r\n //var thread = new Thread(new Solution().Solve, 1024 * 1024 * 128);\r\n //thread.Start();\r\n //thread.Join();\r\n }\r\n catch (Exception ex)\r\n {\r\n#if DEBUGLOCAL\r\n Console.WriteLine(ex);\r\n#else\r\n throw;\r\n#endif\r\n }\r\n reader.Close();\r\n writer.Close();\r\n }\r\n\r\n #endregion\r\n\r\n #region Read / Write\r\n private static Queue currentLineTokens = new Queue();\r\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\r\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\r\n public static int ReadInt() { return int.Parse(ReadToken()); }\r\n public static long ReadLong() { return long.Parse(ReadToken()); }\r\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\r\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\r\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\r\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\r\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\r\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\r\n {\r\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\r\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\r\n return ret;\r\n }\r\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\r\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\r\n public static void Write(params object[] array) { WriteArray(array); }\r\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\r\n private class SDictionary : Dictionary\r\n {\r\n public new TValue this[TKey key]\r\n {\r\n get { return ContainsKey(key) ? base[key] : default(TValue); }\r\n set { base[key] = value; }\r\n }\r\n }\r\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\r\n #endregion\r\n}", "positive_code": [{"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing static System.Console;\r\nusing System.Linq;\r\n\r\nclass cf740\r\n{\r\n static int NN => int.Parse(ReadLine());\r\n static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();\r\n static void Main()\r\n {\r\n var c = NList;\r\n var (n, key) = (c[0], c[1]);\r\n var suball = 0L;\r\n var dp = new long[n + 1];\r\n dp[n] = 1;\r\n for (var i = n; i > 1; --i)\r\n {\r\n var val = (dp[i] + suball) % key;\r\n suball = (suball + val) % key;\r\n var last = i;\r\n for (var j = 2; j * j <= i; ++j)\r\n {\r\n dp[i / j] = (dp[i / j] + val) % key;\r\n last = i / j;\r\n }\r\n var sub = 0;\r\n for (var j = 1; j < last; ++j)\r\n {\r\n var mul = i - i / (j + 1) - sub;\r\n dp[j] = (dp[j] + val * mul) % key;\r\n sub += mul;\r\n }\r\n }\r\n WriteLine((dp[1] + suball) % key);\r\n }\r\n}\r\n"}, {"source_code": "using System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing static System.Console;\r\n\r\nnamespace CodeForces\r\n{\r\n public class Program\r\n {\r\n static void Main()\r\n {\r\n Stopwatch stopwatch = Stopwatch.StartNew();\r\n Solve(In, Out);\r\n PrintTime(stopwatch);\r\n }\r\n public static void Solve(TextReader In, TextWriter Out)\r\n {\r\n int[] input = In.ReadLine().Split().Select(str => int.Parse(str)).ToArray();\r\n int N = input[0], m = input[1];\r\n\r\n int[] f = new int[N * 2 + 1];\r\n f[N] = 1;\r\n for (long n = N - 1; n > 0; n--)\r\n {\r\n f[n] = 2 * f[n + 1] % m;\r\n for (int i = 2; i <= N / n; i++)\r\n {\r\n f[n] = (f[n] + f[i * n] - f[(n + 1) * i]) % m;\r\n if (f[n] < 0)\r\n {\r\n f[n] += m;\r\n }\r\n }\r\n }\r\n int res = (f[1] - f[2]) % m;\r\n if (res < 0)\r\n {\r\n res += m;\r\n }\r\n\r\n Out.WriteLine(res);\r\n }\r\n\r\n [Conditional(\"DEBUG\")]\r\n internal static void PrintTime(Stopwatch stopwatch) => WriteLine(stopwatch.Elapsed);\r\n }\r\n}"}], "negative_code": [], "src_uid": "a524aa54e83fd0223489a19531bf0e79"} {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\n//using System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var h = sc.Integer();\n var n = sc.Long();\n long l = 1;\n long r = 1L << h;\n long count = 0;\n var goL = true;\n for (int i = 0; i < h; i++)\n {\n var m = (l + r) >> 1;\n //Debug.WriteLine(m);\n count++;\n if (n <= m)\n {\n if (!goL)\n {\n count += (1L << (h - i)) - 1;\n }\n goL = false;\n r = m - 1;\n }\n else\n {\n if (goL)\n {\n count += (1L << (h - i)) - 1;\n }\n goL = true;\n l = m + 1;\n }\n }\n IO.Printer.Out.WriteLine(count);\n\n }\n\n\n internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Linq;\n public class Printer : StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n public void Flush() { str.Flush(); }\n\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.Remoting.Messaging;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static bool l;\n static BigInteger ans, he;\n\n static BigInteger pow2(int t)\n {\n BigInteger res = 1;\n for (int i = 0; i < t; i++)\n res *= 2;\n return res;\n }\n\n static void bin(BigInteger left, BigInteger right, BigInteger go)\n {\n while (left != right)\n {\n BigInteger mid = (left + right) / 2;\n if (mid < go)\n {\n left = mid + 1;\n if (l)\n {\n ans += he;\n }\n else\n ans++;\n l = true;\n }\n else\n {\n right = mid;\n if (!l)\n {\n ans += he;\n }\n else\n ans++;\n l = false;\n }\n he /= 2;\n }\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] str = s.Split();\n int h = int.Parse(str[0]);\n he = pow2(h);\n BigInteger n = BigInteger.Parse(str[1]);\n l = true;\n ans = 0;\n bin(1, he, n);\n Console.Write(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public Int64 ReadNextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n return double.Parse(ReadNextToken());\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n\n\n class Program\n {\n protected IOHelper ioHelper;\n\n Int64 [,] count;\n bool[,] wayOut;\n\n int h;\n Int64 exit;\n\n \n public void Solve()\n {\n h = ioHelper.ReadNextInt();\n exit = ioHelper.ReadNextInt64();\n\n count = new Int64[h + 1, 2];\n wayOut = new bool[h + 1, 2];\n \n int curH=0, wayIn;\n\n for(wayIn = 0; wayIn< 2; wayIn++)\n {\n count[curH,wayIn] = 1;\n wayOut[curH, wayIn] = wayIn != 1;\n }\n\n for (curH = 1; curH <= h; curH++)\n {\n for (wayIn = 0; wayIn < 2; wayIn++)\n {\n count[curH, wayIn] = 0;\n bool wOut = wayOut[curH - 1, 1 - wayIn];\n count[curH, wayIn] += count[curH - 1, 1 - wayIn];\n int wwOut = wOut ? 1 : 0;\n if (wwOut == wayIn)\n wwOut = 1 - wwOut;\n bool wOut2 = wayOut[curH - 1, 1 - wwOut];\n count[curH, wayIn] += count[curH - 1, 1 - wwOut];\n\n count[curH, wayIn]++;\n wayOut[curH, wayIn] = wOut2; \n }\n }\n\n curH = h-1;\n wayIn = 0;\n\n Int64 result = 0;\n\n do\n {\n Int64 totalLeaves = (Int64)Math.Pow(2, h);\n result++;\n if (h == 0)\n break;\n if (wayIn == 0)\n {\n if (exit <= totalLeaves / 2)\n {\n wayIn = 1 - wayIn;\n }\n else\n {\n result += count[h - 1, 1 - wayIn];\n wayIn = wayIn;\n exit -= totalLeaves / 2;\n }\n }\n else\n {\n if (exit > totalLeaves / 2)\n {\n wayIn = 1 - wayIn;\n exit -= totalLeaves / 2;\n }\n else\n {\n result += count[h - 1, 1 - wayIn];\n wayIn = wayIn;\n }\n }\n h--;\n }\n while (true);\n result--;\n ioHelper.WriteLine(result.ToString());\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Guess_Your_Way_Out\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var h = (int) Next();\n long n = Next() - 1;\n\n long sum = 0;\n\n long l = 0;\n long r = (((long) 1) << h) - 1;\n bool left = true;\n for (; h > 0; h--)\n {\n long mid = (r + l + 1)/2;\n\n sum++;\n\n if (mid > n)\n {\n if (!left)\n {\n sum += (((long) 1) << h) - 1;\n }\n\n r = mid - 1;\n left = false;\n }\n else\n {\n if (left)\n {\n sum += (((long) 1) << h) - 1;\n }\n\n l = mid;\n left = true;\n }\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int h = ReadInt();\n long n = ReadLong() - 1;\n bool left = true;\n long ans = h;\n for (; h >= 0; h--)\n if ((n >> h - 1 & 1) == 0)\n {\n if (!left)\n ans += (1L << h) - 1;\n left = false;\n }\n else\n {\n if (left)\n ans += (1L << h) - 1;\n left = true;\n }\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"game.in\");\n //writer = new StreamWriter(\"game.out\");\n#endif\n try\n {\n var thread = new Thread(new Solver().Solve, 1024 * 1024 * 256);\n thread.Start();\n thread.Join();\n// object result = new Solver().Solve();\n// if (result != null)\n// writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n long[] arr = Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray();\n long lvl = arr[0] + 1;\n long n = arr[1], total = 1, totallists = 0 ;\n double lists = Math.Pow(2, arr[0])/ 2, max = Math.Pow(2, arr[0]), min = 1;\n bool direction = true;\n for (int i = 1; i < lvl; i++) {\n totallists += (long)Math.Pow(2, i);\n }\n while (totallists != 0){\n if (n <= lists && direction == false)\n {\n total += totallists / 2 + 1;\n totallists = (totallists/2) - 1;\n max = lists;\n lists = Math.Floor((max + min)/2);\n }\n else if (n <= lists && direction == true) {\n total++;\n totallists = (totallists/2) - 1;\n direction = !direction;\n max = lists;\n lists = Math.Floor((max + min) / 2);\n }\n else if (n > lists && direction == true)\n {\n total += totallists / 2 + 1;\n totallists = (totallists/2) - 1;\n min = lists;\n lists = Math.Floor((max + min) / 2);\n }\n else if (n > lists && direction == false) {\n total++;\n totallists = (totallists/2) - 1;\n direction = !direction;\n min = lists;\n lists = Math.Floor((max + min) / 2);\n }\n\n }\n Console.WriteLine(total - 1);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var h = _.NextInt();\n\n var n = Convert.ToString(_.NextLong() - 1, 2).PadLeft(h, '0').ToCharArray().Select(x => x - '0').ToArray();\n\n long nVisited = 0;\n var nextDir = 0;\n const long long1 = 1;\n for (var level = 0; level < h; level++)\n {\n var dir = n[level];\n if (dir != nextDir)\n {\n nVisited += long1 << (h - level);\n }\n else\n {\n nVisited += 1;\n }\n nextDir = (dir + 1) % 2;\n }\n _.WriteLine(nVisited);\n }\n\n\n\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public byte[] NextByteArray() { return NextStringArray().Select(byte.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p3\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\t//p2 o = new p2();\n\t\t\t//o.foo();\n\n\t\t\tp3 o = new p3();\n\t\t\to.foo();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring[] sp = Console.ReadLine().Split(' ');\n\t\t\tint h = int.Parse(sp[0]);\n\t\t\tInt64 n = Int64.Parse(sp[1]);\n\n\t\t\tConsole.WriteLine(bar(h, n, 'L'));\n\t\t}\n\n\t\tprivate long bar(int h, Int64 n, char next)\n\t\t{\n\t\t\tif (h == 0)\n\t\t\t\treturn 0;\n\n\t\t\tInt64 l = 1L << (h - 1);\n\t\t\tif (next == 'L')\n\t\t\t{\n\t\t\t\tif (n <= l)\n\t\t\t\t{\n\t\t\t\t\treturn 1 + bar(h - 1, n, 'R');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn (1L << h) + bar(h - 1, n - l, 'L');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n <= l)\n\t\t\t\t{\n\t\t\t\t\treturn (1L << h) + bar(h - 1, n, 'R');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn 1 + bar(h - 1, n - l, 'L');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring[] input = Console.ReadLine ().Split (' ');\n\t\t\tint h = Convert.ToInt32 (input [0]); \n\t\t\tulong n = Convert.ToUInt64 (input [1]);\n\t\t\tint i = 0, b= 0, j = 1;\n\t\t\tulong k = 0, residue = 0, branch = 0, side = 0, total = 0, leafs = 1;\n\t\t\tbool line = true;\n\t\t\twhile (i < h) {\n\t\t\t\tleafs = leafs * 2;\n\t\t\t\ti += 1;\n\t\t\t}\n\n\t\t\tside = leafs;\n\t\t\tresidue = n;\n\t\t\ti = 0;\n\t\t\twhile (i < h) {\n\t\t\t\tside = side / 2;\n\t\t\t\tif (residue >= 2) {\n\t\t\t\t\tif (residue <= side) {\n\t\t\t\t\t\tif (line == true) {\n\t\t\t\t\t\t\tline = !line;\n\t\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb = i;\n\t\t\t\t\t\t\tk = 1;\n\t\t\t\t\t\t\tbranch = 0;\n\t\t\t\t\t\t\twhile (b < h) {\n\t\t\t\t\t\t\t\tbranch += k; \n\t\t\t\t\t\t\t\tk = k * 2;\n\t\t\t\t\t\t\t\tb += 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttotal += branch + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresidue = residue - side;\n\t\t\t\t\t\tif (line == false) {\n\t\t\t\t\t\t\tline = !line;\n\t\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb = i;\n\t\t\t\t\t\t\tk = 1;\n\t\t\t\t\t\t\tbranch = 0;\n\t\t\t\t\t\t\twhile (b < h) {\n\t\t\t\t\t\t\t\tbranch += k; \n\t\t\t\t\t\t\t\tk = k * 2;\n\t\t\t\t\t\t\t\tb += 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttotal += branch + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (residue == 0) {\n\t\t\t\t\tif (line == false) {\n\t\t\t\t\t\tline = !line;\n\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tb = i;\n\t\t\t\t\t\tk = 1;\n\t\t\t\t\t\tbranch = 0;\n\t\t\t\t\t\twhile (b < h) {\n\t\t\t\t\t\t\tbranch += k; \n\t\t\t\t\t\t\tk = k * 2;\n\t\t\t\t\t\t\tb += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttotal += branch + 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (line == true) {\n\t\t\t\t\t\tline = !line;\n\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tb = i;\n\t\t\t\t\t\tk = 1;\n\t\t\t\t\t\tbranch = 0;\n\t\t\t\t\t\twhile (b < h) {\n\t\t\t\t\t\t\tbranch += k; \n\t\t\t\t\t\t\tk = k * 2;\n\t\t\t\t\t\t\tb += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttotal += branch + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ti += 1;\n\t\t\t\tj = j * 2;\n\t\t\t}\n\n\t\t\tConsole.WriteLine (total);\n\t\t}\n\t}\n}"}], "negative_code": [{"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p3\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\t//p2 o = new p2();\n\t\t\t//o.foo();\n\n\t\t\tp3 o = new p3();\n\t\t\to.foo();\n\t\t}\n\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring[] sp = Console.ReadLine().Split(' ');\n\t\t\tint h = int.Parse(sp[0]);\n\t\t\tInt64 n = Int64.Parse(sp[1]);\n\n\t\t\tConsole.WriteLine(bar(h, n, true));\n\t\t}\n\n\t\tprivate long bar(int h, Int64 n, bool left)\n\t\t{\n\t\t\tif (h == 0)\n\t\t\t\treturn 0;\n\n\t\t\tInt64 l = 1L << (h - 1);\n\t\t\tif (left)\n\t\t\t{\n\t\t\t\tif (n <= l)\n\t\t\t\t{\n\t\t\t\t\treturn 1 + bar(h - 1, n, !left);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn (1L << h) + bar(h - 1, n - l, left);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n <= l)\n\t\t\t\t{\n\t\t\t\t\treturn (1L << h) + bar(h - 1, n, !left);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn 1 + bar(h - 1, n - l, left);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\n//using System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var h = sc.Integer();\n var n = sc.Long();\n long l = 1;\n long r = 1L << h;\n long count = 0;\n var goL = true;\n for (int i = 0; i < h; i++)\n {\n var m = (l + r) >> 1;\n //Debug.WriteLine(m);\n count++;\n if (n <= m)\n {\n if (!goL)\n {\n count += 1L << (h - i) - 1;\n }\n goL = false;\n r = m - 1;\n }\n else\n {\n if (goL)\n {\n count += (1L << (h - i)) - 1;\n }\n goL = true;\n l = m + 1;\n }\n }\n IO.Printer.Out.WriteLine(count);\n\n }\n\n\n internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Linq;\n public class Printer : StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n public void Flush() { str.Flush(); }\n\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Guess_Your_Way_Out\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var h = (int) Next();\n long n = Next() - 1;\n\n long sum = 0;\n\n long l = 0;\n long r = (((long) 1) << h) - 1;\n bool left = true;\n for (; h > 0; h--)\n {\n long mid = (r + l + 1)/2;\n\n sum++;\n\n if (mid > n)\n {\n if (!left)\n {\n sum += (((long) 1) << (h - 1)) - 1;\n }\n\n r = mid-1;\n left = false;\n }\n else\n {\n if (left)\n {\n sum += (((long)1) << h) - 1;\n }\n\n l = mid;\n left = true;\n }\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var h = _.NextInt();\n\n var n = Convert.ToString(_.NextLong() - 1, 2).PadLeft(h, '0').ToCharArray();\n\n // var level = 0;\n long nVisited = 0;\n var nextDir = 0;\n const long long1 = 1;\n for (var level = 0; level < h; level++)\n {\n var dir = n[level];\n\n if (level == h - 1)\n {\n switch (dir)\n {\n case '1':\n nVisited += nextDir == 1 ? 1 : 2;\n break;\n case '0':\n nVisited += nextDir == 1 ? 2 : 1;\n break;\n default:\n Debug.Assert(false);\n break;\n }\n }\n else\n {\n switch (dir)\n {\n case '1':\n nVisited += long1 << (h - level);\n nextDir = 0;\n break;\n case '0':\n nVisited += 1;\n nextDir = 1 ;\n break;\n default:\n Debug.Assert(false);\n break;\n }\n }\n }\n _.WriteLine(nVisited);\n }\n\n\n\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public byte[] NextByteArray() { return NextStringArray().Select(byte.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}], "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781"} {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Text;\nusing System.IO;\n\ndelegate double F (double x);\n\ndelegate decimal Fdec (decimal x);\n\npartial class Program\n{\n\tpublic static StreamReader sr;\n\tpublic static StreamWriter sw;\n\n\tstatic void Main (string[] args)\n\t{\n\n#if FileIO\n\t\tsr = new StreamReader (\"input.in\");\n\t\tsw = new StreamWriter (\"input.out\");\n\t\tConsole.SetIn (sr);\n\t\tConsole.SetOut (sw);\n#endif\n\n\t\tB ();\n\n#if Online\n\t\tConsole.ReadLine ();\n#endif\n\n#if FileIO\n\t\tsr.Close ();\n\t\tsw.Close ();\n#endif\n\n\t}\n\n\tstatic void A ()\n\t{\n\t}\n\n\tstatic void B ()\n\t{\n\t\tint a, b, w, x, c;\n\t\ta = NextInt ();\n\t\tb = NextInt ();\n\t\tw = NextInt ();\n\t\tx = NextInt ();\n\t\tc = NextInt ();\n\t\tlong time = long.MaxValue;\n\t\tlong[] t = new long[1001];\n\t\tlong[] d = new long[1001];\n\t\tint[] last = new int[1001];\n\t\tlong[] th = new long[1001];\n\t\tlong[] th_t = new long[1001];\n\t\tint[] last_th = new int[1001];\n\t\tfor (int i=0; i=x) {\n\t\t\t\t_b -= x;\n\t\t\t\t++j;\n\t\t\t}\n\t\t\twhile (_b_a-th[_b]) {\n\t\t\t\t_a -= th [_b];\n\t\t\t\t_c -= th_t [_b];\n\t\t\t\ttime -= th_t [_b];\n\t\t\t\t_b = last_th [_b];\n\t\t\t}\n\t\t\twhile (_c-t[_b]>_a-d[_b]) {\n\t\t\t\ttime -= t [_b];\n\t\t\t\t_c -= t [_b];\n\t\t\t\t_a -= d [_b];\n\t\t\t\t_b = last [_b];\n\t\t\t}\n\t\t\twhile (_b>=x && _c>_a) {\n\t\t\t\t--_c;\n\t\t\t\t--time;\n\t\t\t\t_b -= x;\n\t\t\t}\n\t\t\twhile (_b_a) {\n\t\t\t\t--_a;\n\t\t\t\t--_c;\n\t\t\t\t_b = w - (x - _b);\n\t\t\t\t--time;\n\t\t\t}\n\t\t\tif (time >= 0) {\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (right);\n\t}\n\n\tstatic void C ()\n\t{\n\n\t}\n\t\n\tstatic void D ()\n\t{\n\n\t}\n\n\tstatic void E ()\n\t{\n\n\t}\n\n\tstatic void TestGen ()\n\t{\n\n\t}\n\n}\n\npublic static class MyMath\n{\n\tpublic static long BinPow (long a, long n, long mod)\n\t{\n\t\tlong res = 1;\n\t\twhile (n > 0) {\n\t\t\tif ((n & 1) == 1) {\n\t\t\t\tres = (res * a) % mod;\n\t\t\t}\n\t\t\ta = (a * a) % mod;\n\t\t\tn >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long GCD (long a, long b)\n\t{\n\t\twhile (b != 0)\n\t\t\tb = a % (a = b);\n\t\treturn a;\n\t}\n\n\tpublic static int GCD (int a, int b)\n\t{\n\t\twhile (b != 0)\n\t\t\tb = a % (a = b);\n\t\treturn a;\n\t}\n\n\tpublic static long LCM (long a, long b)\n\t{\n\t\treturn (a * b) / GCD (a, b);\n\t}\n\n\tpublic static int LCM (int a, int b)\n\t{\n\t\treturn (a * b) / GCD (a, b);\n\t}\n}\n\nstatic class ArrayUtils\n{\n\tstatic void Swap (T[] a, int l, int r)\n\t{\n\t\tT t = a [l];\n\t\ta [l] = a [r];\n\t\ta [r] = t;\n\t}\n\n\tpublic static bool NextPermutation (int[] a)\n\t{\n\t\tbool isOkay = false;\n\t\tint n = a.Length;\n\t\tfor (int i=n-2; i>=0; i--) {\n\t\t\tif (a [i] < a [i + 1]) {\n\t\t\t\tisOkay = true;\n\t\t\t\tint j = i + 1;\n\t\t\t\twhile (j+1a[i]) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tSwap (a, i, j);\n\t\t\t\tfor (j=1; i+j> 1);\n\t\t\tif (val <= a [mid]) {\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (a [left] == val)\n\t\t\treturn left;\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tpublic static double Bisection (F f, double left, double right, double eps)\n\t{\n\t\tdouble mid;\n\t\twhile (right - left > eps) {\n\t\t\tmid = left + ((right - left) / 2d);\n\t\t\tif (Math.Sign (f (mid)) != Math.Sign (f (left)))\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid;\n\t\t}\n\t\treturn (left + right) / 2d;\n\t}\n\n\tpublic static decimal TernarySearchDec (Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n\t{\n\t\tdecimal m1, m2;\n\t\twhile (r - l > eps) {\n\t\t\tm1 = l + (r - l) / 3m;\n\t\t\tm2 = r - (r - l) / 3m;\n\t\t\tif (f (m1) < f (m2))\n\t\t\tif (isMax)\n\t\t\t\tl = m1;\n\t\t\telse\n\t\t\t\tr = m2;\n\t\t\telse\n if (isMax)\n\t\t\t\tr = m2;\n\t\t\telse\n\t\t\t\tl = m1;\n\t\t}\n\t\treturn r;\n\t}\n\n\tpublic static double TernarySearch (F f, double eps, double l, double r, bool isMax)\n\t{\n\t\tdouble m1, m2;\n\t\twhile (r - l > eps) {\n\t\t\tm1 = l + (r - l) / 3d;\n\t\t\tm2 = r - (r - l) / 3d;\n\t\t\tif (f (m1) < f (m2))\n\t\t\tif (isMax)\n\t\t\t\tl = m1;\n\t\t\telse\n\t\t\t\tr = m2;\n\t\t\telse\n if (isMax)\n\t\t\t\tr = m2;\n\t\t\telse\n\t\t\t\tl = m1;\n\t\t}\n\t\treturn r;\n\t}\n\n\tpublic static void Merge_Sort (T[]A, int p, int r, Comparison comp)\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tMerge_Sort (A, p, r, L, R, comp);\n\t}\n\n\tpublic static void Merge (T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n\t{\n\t\tfor (int i = p; i <= q; i++)\n\t\t\tL [i] = A [i];\n\t\tfor (int i = q + 1; i <= r; i++)\n\t\t\tR [i] = A [i];\n\n\t\tfor (int k = p, i = p, j = q + 1; k <= r; k++) {\n\t\t\tif (i > q) {\n\t\t\t\tfor (; k <= r; k++, j++)\n\t\t\t\t\tA [k] = R [j];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (j > r) {\n\t\t\t\tfor (; k <= r; k++, i++)\n\t\t\t\t\tA [k] = L [i];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (comp (L [i], R [j]) <= 0) {\n\t\t\t\tA [k] = L [i];\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tA [k] = R [j];\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void Merge_Sort (T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n\t{\n\t\tif (p >= r)\n\t\t\treturn;\n\t\tint q = p + ((r - p) >> 1);\n\t\tMerge_Sort (A, p, q, L, R, comp);\n\t\tMerge_Sort (A, q + 1, r, L, R, comp);\n\t\tMerge (A, p, q, r, L, R, comp);\n\t}\n\n\tpublic static void Merge_Sort (T[]A, int p, int r)where T:IComparable\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tMerge_Sort (A, p, r, L, R);\n\t}\n\n\tpublic static void Merge (T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n\t{\n\t\tfor (int i = p; i <= q; i++)\n\t\t\tL [i] = A [i];\n\t\tfor (int i = q + 1; i <= r; i++)\n\t\t\tR [i] = A [i];\n\n\t\tfor (int k = p, i = p, j = q + 1; k <= r; k++) {\n\t\t\tif (i > q) {\n\t\t\t\tfor (; k <= r; k++, j++)\n\t\t\t\t\tA [k] = R [j];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (j > r) {\n\t\t\t\tfor (; k <= r; k++, i++)\n\t\t\t\t\tA [k] = L [i];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (L [i].CompareTo (R [j]) <= 0) {\n\t\t\t\tA [k] = L [i];\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tA [k] = R [j];\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void Merge_Sort (T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n\t{\n\t\tif (p >= r)\n\t\t\treturn;\n\t\tint q = p + ((r - p) >> 1);\n\t\tMerge_Sort (A, p, q, L, R);\n\t\tMerge_Sort (A, q + 1, r, L, R);\n\t\tMerge (A, p, q, r, L, R);\n\t}\n\n\tpublic static void Merge_Sort_Non_Recursive (T[] A, int p, int r) where T : IComparable\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tint k = 1;\n\t\twhile (k < r - p + 1) {\n\t\t\tint i = 0;\n\t\t\twhile (i < r) {\n\t\t\t\tint _r = Math.Min (i + 2 * k - 1, r);\n\t\t\t\tint q = Math.Min (i + k - 1, r);\n\t\t\t\tMerge (A, i, q, _r, L, R);\n\t\t\t\ti += 2 * k;\n\t\t\t}\n\t\t\tk <<= 1;\n\t\t}\n\t}\n\n\tpublic static void Merge_Sort_Non_Recursive (T[] A, int p, int r, Comparison comp)\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tint k = 1;\n\t\twhile (k < r - p + 1) {\n\t\t\tint i = 0;\n\t\t\twhile (i < r) {\n\t\t\t\tint _r = Math.Min (i + 2 * k - 1, r);\n\t\t\t\tint q = Math.Min (i + k - 1, r);\n\t\t\t\tMerge (A, i, q, _r, L, R, comp);\n\t\t\t\ti += 2 * k;\n\t\t\t}\n\t\t\tk <<= 1;\n\t\t}\n\t}\n\n\tpublic static void Shake (T[] a)\n\t{\n\t\tRandom rnd = new Random (Environment.TickCount);\n\t\tint b;\n\t\tfor (int i = 0; i < a.Length; i++) {\n\t\t\tb = rnd.Next (i, a.Length);\n\t\t\tSwap (a, i, b);\n\t\t}\n\t}\n}\n\npartial class Program\n{\n\tstatic string[] tokens = new string[0];\n\tstatic int cur_token = 0;\n\n\tstatic void ReadArray (char sep)\n\t{\n\t\tcur_token = 0;\n\t\ttokens = Console.ReadLine ().Split (sep);\n\t}\n\n\tstatic int ReadInt ()\n\t{\n\t\treturn int.Parse (Console.ReadLine ());\n\t}\n\n\tstatic long ReadLong ()\n\t{\n\t\treturn long.Parse (Console.ReadLine ());\n\t}\n\n\tstatic int NextInt ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn int.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic long NextLong ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn long.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic double NextDouble ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn double.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic decimal NextDecimal ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn decimal.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic string NextToken ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn tokens [cur_token++];\n\t}\n\n\tstatic string ReadLine ()\n\t{\n\t\treturn Console.ReadLine ();\n\t}\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] inArray = ReadIntLine();\n double a = inArray[0], b = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n Console.WriteLine(Math.Max(0, Result));\n }\n public static double[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] arr = new double[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = double.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split(' ');\n double c = double.Parse(numbers[4]), a = double.Parse(numbers[0]), b = double.Parse(numbers[1]), w = double.Parse(numbers[2]), x = double.Parse(numbers[3]);\n double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n Console.WriteLine(Math.Max(0, Result)); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int w = ReadInt();\n int x = ReadInt();\n int c = ReadInt();\n\n if (c <= a)\n {\n Write(0);\n return;\n }\n\n long l = 1, r = 1000000000000000;\n while (l < r)\n {\n long mid = (l + r) / 2;\n long bb = b - x * mid;\n long v = bb < 0 ? (-bb - 1) / w + 1 : 0;\n if (a - v >= c - mid)\n r = mid;\n else\n l = mid + 1;\n }\n\n Write(l);\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"hull.in\");\n //writer = new StreamWriter(\"hull.out\");\n#endif\n try\n {\n// var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n// thread.Start();\n// thread.Join();\n new Solver().Solve(); \n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}\n public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine());return currentLineTokens.Dequeue();}\n public static int ReadInt(){return int.Parse(ReadToken());}\n public static long ReadLong(){return long.Parse(ReadToken());}\n public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}\n public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}\n public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}\n public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}\n public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}\n public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}\n public static void WriteArray(IEnumerable array){writer.WriteLine(string.Join(\" \", array));}\n public static void Write(params object[] array){WriteArray(array);}\n public static void WriteLines(IEnumerable array){foreach (var a in array)writer.WriteLine(a);}\n private class SDictionary : Dictionary{public new TValue this[TKey key]{\n get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}\n private static T[] Init(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}\n #endregion\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inArray = ReadIntLine();\n int Multiplier = 1000000;\n int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n int Tau = 1, aChange = 0;\n int b = initialB;\n\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n\n while (b != initialB)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n Tau++;\n }\n int Result = 0;\n\n double steps = (a - c) / (aChange - Tau);\n double stepsDec = steps - (steps % 1);\n int ss = 0;\n if (steps - stepsDec > 0)\n {\n ss = (int)stepsDec - 1;\n }\n else\n {\n ss = (int)stepsDec - 1;\n } \n Result = Tau * ss;\n c = c - Tau * ss;\n a = a - aChange * ss;\n \n while (c != a)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n a--;\n }\n c--;\n Result++;\n }\n if (Result < 0)\n Result = 0;\n Console.WriteLine(Result);\n }\n public static int[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] arr = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inArray = ReadIntLine();\n int Multiplier = 1000000;\n int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n int Tau = 1, aChange = 0;\n int b = initialB;\n\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n\n while (b!=initialB)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n Tau++;\n }\n int Result = 0;\n while (c > a)\n {\n c = c - Tau * Multiplier;\n a = a - aChange * Multiplier;\n Result += Tau * Multiplier;\n }\n\n Result -= Tau * Multiplier;\n c = c + Tau * Multiplier;\n a = a + aChange * Multiplier;\n b = initialB;\n\n while (c != a)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n a--;\n }\n c--;\n Result++;\n }\n if (Result < 0)\n Result = 0;\n Console.WriteLine(Result + \" \" + Tau + \" \" + aChange);\n } \n public static int[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] arr = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] inArray = ReadIntLine();\n double a = inArray[0], b = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n //double K = Math.Floor(((C - A + 0.0) * X - B) / (W - X));\n //double Result = Math.Floor(C - A + K);\n double Result = Math.Floor((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n if (Result == 3)\n Result = 4;\n Console.WriteLine(Math.Max(0, Result));\n }\n public static double[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] arr = new double[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = double.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] inArray = ReadIntLine();\n double A = inArray[0], B = inArray[1], W = inArray[2], X = inArray[3], C = inArray[4];\n double K = (long)Math.Floor(((C - A + 0.0) * X - B) / (W - X));\n double Result = (long)Math.Floor(C - A + K);\n Console.WriteLine(Math.Max(0, Result));\n }\n public static double[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] arr = new double[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inArray = ReadIntLine();\n int Multiplier = 1000000, Multiplier2 = 100000, Multiplier3 = 10000;\n int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n int Tau = 1, aChange = 0;\n int b = initialB;\n\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n\n while (b != initialB)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n Tau++;\n }\n int Result = 0;\n\n double steps = (a - c) / (aChange - Tau);\n double stepsDec = steps - (steps % 1);\n int ss = 0;\n if (steps - stepsDec > 0)\n {\n ss = (int)stepsDec;\n }\n else\n {\n ss = (int)stepsDec - 1;\n } \n Result = Tau * ss;\n c = c - Tau * ss;\n a = a - aChange * ss;\n \n while (c != a)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n a--;\n }\n c--;\n Result++;\n }\n if (Result < 0)\n Result = 0;\n Console.WriteLine(Result);\n }\n public static int[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] arr = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inArray = ReadIntLine();\n int Multiplier = 1000000, Multiplier2 = 100000, Multiplier3 = 10000;\n int a = inArray[0], initialB = inArray[1], w = inArray[2], x = inArray[3], c = inArray[4];\n int Tau = 1, aChange = 0;\n int b = initialB;\n\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n\n while (b != initialB)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n aChange++;\n }\n Tau++;\n }\n int Result = 0;\n\n double steps = (a - c) / (aChange - Tau);\n int ss = Convert.ToInt32(Math.Floor(steps) - 1);\n Result = Tau * ss;\n c = c - Tau * ss;\n a = a - aChange * ss;\n \n while (c != a)\n {\n if (b >= x)\n {\n b = b - x;\n }\n else\n {\n b = w - x + b;\n a--;\n }\n c--;\n Result++;\n }\n if (Result < 0)\n Result = 0;\n Console.WriteLine(Result);\n }\n public static int[] ReadIntLine()\n {\n string[] temp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] arr = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n arr[i] = int.Parse(temp[i]);\n return arr;\n }\n\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Text;\nusing System.IO;\n\ndelegate double F (double x);\n\ndelegate decimal Fdec (decimal x);\n\npartial class Program\n{\n\tpublic static StreamReader sr;\n\tpublic static StreamWriter sw;\n\n\tstatic void Main (string[] args)\n\t{\n\n#if FileIO\n\t\tsr = new StreamReader (\"input.in\");\n\t\tsw = new StreamWriter (\"input.out\");\n\t\tConsole.SetIn (sr);\n\t\tConsole.SetOut (sw);\n#endif\n\n\t\tB ();\n\n#if Online\n\t\tConsole.ReadLine ();\n#endif\n\n#if FileIO\n\t\tsr.Close ();\n\t\tsw.Close ();\n#endif\n\n\t}\n\n\tstatic void A ()\n\t{\n\t}\n\n\tstatic void B ()\n\t{\n\t\tint a, b, w, x, c;\n\t\ta = NextInt ();\n\t\tb = NextInt ();\n\t\tw = NextInt ();\n\t\tx = NextInt ();\n\t\tc = NextInt ();\n\t\tlong time = (long)Math.Max (a, c) * 10;\n\t\tlong[] t = new long[1001];\n\t\tlong[] d = new long[1001];\n\t\tint[] last = new int[1001];\n\t\tlong[] th = new long[1001];\n\t\tlong[] th_t = new long[1001];\n\t\tint[] last_th = new int[1001];\n\t\tfor (int i=0; i=x) {\n\t\t\t\t_b -= x;\n\t\t\t\t++j;\n\t\t\t}\n\t\t\twhile (_b_a-th[_b]) {\n\t\t\t\t_a -= th [_b];\n\t\t\t\t_c -= th_t [_b];\n\t\t\t\ttime -= th_t [_b];\n\t\t\t\t_b = last_th [_b];\n\t\t\t}\n\t\t\twhile (_c-t[_b]>_a-d[_b]) {\n\t\t\t\ttime -= t [_b];\n\t\t\t\t_c -= t [_b];\n\t\t\t\t_a -= d [_b];\n\t\t\t\t_b = last [_b];\n\t\t\t}\n\t\t\twhile (_b>=x && _c>_a) {\n\t\t\t\t--_c;\n\t\t\t\t--time;\n\t\t\t\t_b -= x;\n\t\t\t}\n\t\t\twhile (_b_a) {\n\t\t\t\t--_a;\n\t\t\t\t--_c;\n\t\t\t\t_b = w - (x - _b);\n\t\t\t\t--time;\n\t\t\t}\n\t\t\tif (time >= 0) {\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (right);\n\t}\n\n\tstatic void C ()\n\t{\n\n\t}\n\t\n\tstatic void D ()\n\t{\n\n\t}\n\n\tstatic void E ()\n\t{\n\n\t}\n\n\tstatic void TestGen ()\n\t{\n\n\t}\n\n}\n\npublic static class MyMath\n{\n\tpublic static long BinPow (long a, long n, long mod)\n\t{\n\t\tlong res = 1;\n\t\twhile (n > 0) {\n\t\t\tif ((n & 1) == 1) {\n\t\t\t\tres = (res * a) % mod;\n\t\t\t}\n\t\t\ta = (a * a) % mod;\n\t\t\tn >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long GCD (long a, long b)\n\t{\n\t\twhile (b != 0)\n\t\t\tb = a % (a = b);\n\t\treturn a;\n\t}\n\n\tpublic static int GCD (int a, int b)\n\t{\n\t\twhile (b != 0)\n\t\t\tb = a % (a = b);\n\t\treturn a;\n\t}\n\n\tpublic static long LCM (long a, long b)\n\t{\n\t\treturn (a * b) / GCD (a, b);\n\t}\n\n\tpublic static int LCM (int a, int b)\n\t{\n\t\treturn (a * b) / GCD (a, b);\n\t}\n}\n\nstatic class ArrayUtils\n{\n\tstatic void Swap (T[] a, int l, int r)\n\t{\n\t\tT t = a [l];\n\t\ta [l] = a [r];\n\t\ta [r] = t;\n\t}\n\n\tpublic static bool NextPermutation (int[] a)\n\t{\n\t\tbool isOkay = false;\n\t\tint n = a.Length;\n\t\tfor (int i=n-2; i>=0; i--) {\n\t\t\tif (a [i] < a [i + 1]) {\n\t\t\t\tisOkay = true;\n\t\t\t\tint j = i + 1;\n\t\t\t\twhile (j+1a[i]) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tSwap (a, i, j);\n\t\t\t\tfor (j=1; i+j> 1);\n\t\t\tif (val <= a [mid]) {\n\t\t\t\tright = mid;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (a [left] == val)\n\t\t\treturn left;\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tpublic static double Bisection (F f, double left, double right, double eps)\n\t{\n\t\tdouble mid;\n\t\twhile (right - left > eps) {\n\t\t\tmid = left + ((right - left) / 2d);\n\t\t\tif (Math.Sign (f (mid)) != Math.Sign (f (left)))\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid;\n\t\t}\n\t\treturn (left + right) / 2d;\n\t}\n\n\tpublic static decimal TernarySearchDec (Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n\t{\n\t\tdecimal m1, m2;\n\t\twhile (r - l > eps) {\n\t\t\tm1 = l + (r - l) / 3m;\n\t\t\tm2 = r - (r - l) / 3m;\n\t\t\tif (f (m1) < f (m2))\n\t\t\tif (isMax)\n\t\t\t\tl = m1;\n\t\t\telse\n\t\t\t\tr = m2;\n\t\t\telse\n if (isMax)\n\t\t\t\tr = m2;\n\t\t\telse\n\t\t\t\tl = m1;\n\t\t}\n\t\treturn r;\n\t}\n\n\tpublic static double TernarySearch (F f, double eps, double l, double r, bool isMax)\n\t{\n\t\tdouble m1, m2;\n\t\twhile (r - l > eps) {\n\t\t\tm1 = l + (r - l) / 3d;\n\t\t\tm2 = r - (r - l) / 3d;\n\t\t\tif (f (m1) < f (m2))\n\t\t\tif (isMax)\n\t\t\t\tl = m1;\n\t\t\telse\n\t\t\t\tr = m2;\n\t\t\telse\n if (isMax)\n\t\t\t\tr = m2;\n\t\t\telse\n\t\t\t\tl = m1;\n\t\t}\n\t\treturn r;\n\t}\n\n\tpublic static void Merge_Sort (T[]A, int p, int r, Comparison comp)\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tMerge_Sort (A, p, r, L, R, comp);\n\t}\n\n\tpublic static void Merge (T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n\t{\n\t\tfor (int i = p; i <= q; i++)\n\t\t\tL [i] = A [i];\n\t\tfor (int i = q + 1; i <= r; i++)\n\t\t\tR [i] = A [i];\n\n\t\tfor (int k = p, i = p, j = q + 1; k <= r; k++) {\n\t\t\tif (i > q) {\n\t\t\t\tfor (; k <= r; k++, j++)\n\t\t\t\t\tA [k] = R [j];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (j > r) {\n\t\t\t\tfor (; k <= r; k++, i++)\n\t\t\t\t\tA [k] = L [i];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (comp (L [i], R [j]) <= 0) {\n\t\t\t\tA [k] = L [i];\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tA [k] = R [j];\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void Merge_Sort (T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n\t{\n\t\tif (p >= r)\n\t\t\treturn;\n\t\tint q = p + ((r - p) >> 1);\n\t\tMerge_Sort (A, p, q, L, R, comp);\n\t\tMerge_Sort (A, q + 1, r, L, R, comp);\n\t\tMerge (A, p, q, r, L, R, comp);\n\t}\n\n\tpublic static void Merge_Sort (T[]A, int p, int r)where T:IComparable\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tMerge_Sort (A, p, r, L, R);\n\t}\n\n\tpublic static void Merge (T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n\t{\n\t\tfor (int i = p; i <= q; i++)\n\t\t\tL [i] = A [i];\n\t\tfor (int i = q + 1; i <= r; i++)\n\t\t\tR [i] = A [i];\n\n\t\tfor (int k = p, i = p, j = q + 1; k <= r; k++) {\n\t\t\tif (i > q) {\n\t\t\t\tfor (; k <= r; k++, j++)\n\t\t\t\t\tA [k] = R [j];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (j > r) {\n\t\t\t\tfor (; k <= r; k++, i++)\n\t\t\t\t\tA [k] = L [i];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (L [i].CompareTo (R [j]) <= 0) {\n\t\t\t\tA [k] = L [i];\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tA [k] = R [j];\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void Merge_Sort (T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n\t{\n\t\tif (p >= r)\n\t\t\treturn;\n\t\tint q = p + ((r - p) >> 1);\n\t\tMerge_Sort (A, p, q, L, R);\n\t\tMerge_Sort (A, q + 1, r, L, R);\n\t\tMerge (A, p, q, r, L, R);\n\t}\n\n\tpublic static void Merge_Sort_Non_Recursive (T[] A, int p, int r) where T : IComparable\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tint k = 1;\n\t\twhile (k < r - p + 1) {\n\t\t\tint i = 0;\n\t\t\twhile (i < r) {\n\t\t\t\tint _r = Math.Min (i + 2 * k - 1, r);\n\t\t\t\tint q = Math.Min (i + k - 1, r);\n\t\t\t\tMerge (A, i, q, _r, L, R);\n\t\t\t\ti += 2 * k;\n\t\t\t}\n\t\t\tk <<= 1;\n\t\t}\n\t}\n\n\tpublic static void Merge_Sort_Non_Recursive (T[] A, int p, int r, Comparison comp)\n\t{\n\t\tT[] L = new T[A.Length];\n\t\tT[] R = new T[A.Length];\n\t\tint k = 1;\n\t\twhile (k < r - p + 1) {\n\t\t\tint i = 0;\n\t\t\twhile (i < r) {\n\t\t\t\tint _r = Math.Min (i + 2 * k - 1, r);\n\t\t\t\tint q = Math.Min (i + k - 1, r);\n\t\t\t\tMerge (A, i, q, _r, L, R, comp);\n\t\t\t\ti += 2 * k;\n\t\t\t}\n\t\t\tk <<= 1;\n\t\t}\n\t}\n\n\tpublic static void Shake (T[] a)\n\t{\n\t\tRandom rnd = new Random (Environment.TickCount);\n\t\tint b;\n\t\tfor (int i = 0; i < a.Length; i++) {\n\t\t\tb = rnd.Next (i, a.Length);\n\t\t\tSwap (a, i, b);\n\t\t}\n\t}\n}\n\npartial class Program\n{\n\tstatic string[] tokens = new string[0];\n\tstatic int cur_token = 0;\n\n\tstatic void ReadArray (char sep)\n\t{\n\t\tcur_token = 0;\n\t\ttokens = Console.ReadLine ().Split (sep);\n\t}\n\n\tstatic int ReadInt ()\n\t{\n\t\treturn int.Parse (Console.ReadLine ());\n\t}\n\n\tstatic long ReadLong ()\n\t{\n\t\treturn long.Parse (Console.ReadLine ());\n\t}\n\n\tstatic int NextInt ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn int.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic long NextLong ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn long.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic double NextDouble ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn double.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic decimal NextDecimal ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn decimal.Parse (tokens [cur_token++]);\n\t}\n\n\tstatic string NextToken ()\n\t{\n\t\tif (cur_token == tokens.Length)\n\t\t\tReadArray (' ');\n\t\treturn tokens [cur_token++];\n\t}\n\n\tstatic string ReadLine ()\n\t{\n\t\treturn Console.ReadLine ();\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []numbers = Console.ReadLine().Split(' ');\n int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);\n int seconds = 0;\n while (c > a)\n {\n c = c - seconds;\n if (b >= x)\n b = b - x;\n if (b < x)\n {\n a = a - (b + seconds * x) / w;\n b\u2009=\u2009(b\u2009+\u2009seconds*x) % w;\n }\n seconds++;\n }\n seconds -= 1;\n Console.WriteLine(seconds);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split(' ');\n int c = int.Parse(numbers[4]), a = int.Parse(numbers[0]), b = int.Parse(numbers[1]), w = int.Parse(numbers[2]), x = int.Parse(numbers[3]);\n double Result = Math.Ceiling((-b + (c - a) * x + 0.0) / (w - x)) + c - a;\n Console.WriteLine(Math.Max(0, Result)); \n }\n }\n}"}], "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143"} {"source_code": "//using MetadataExtractor;\n//using MetadataExtractor.Formats.Exif;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n /*public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }*/\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n class Coord\n {\n public int x;\n public int y;\n public double d;\n }\n\n\n public static double dist(int x1,int y1,int x2,int y2)\n {\n int dx = x2 - x1;\n int dy = y2 - y1;\n\n return Math.Sqrt(dx * dx + dy * dy);\n\n }\n static void Main(string[] args)\n {\n\t\t\tvar t1 = ReadLine().Split(':').Select(x=>Convert.ToInt32(x)).ToArray();\n\t\t\tvar t2 = ReadLine().Split(':').Select(x=>Convert.ToInt32(x)).ToArray();\n\t\t\t\n\t\t\tint m1 = t1[0]*60+t1[1];\n\t\t\tint m2 = t2[0]*60+t2[1];\n\t\t\t\n\t\t\tint mid = m1+ (m2-m1)/2;\n\t\t\t\n\t\t\t\n\t\t\tvar h = (mid/60 < 10)? (\"0\"+(mid/60)):(\"\"+mid/60);\n\t\t\tvar m = (mid%60 < 10)? (\"0\"+(mid%60)):(\"\"+mid%60);\n\t\t\t\n\t\t\tPrintLn(h+\":\"+m);\n\t\t\t\n }\n\n\n\n }\n\n\n\n\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int h1, h2, m1, m2;\n var l = sc.Next().Split(':');\n h1 = int.Parse(l[0]);\n m1 = int.Parse(l[1]);\n\n l = sc.Next().Split(':');\n h2 = int.Parse(l[0]);\n m2 = int.Parse(l[1]);\n\n int h3 = h1 + h2 + (m1 + m2) / 60;\n\n int m3 = (m1 + m2) % 60;\n\n int h4 = h3 / 2;\n\n if (h3 % 2 == 1) m3 += 60;\n\n int m4 = m3 / 2;\n\n Console.WriteLine($\"{h4:D2}:{m4:D2}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Contest\n{\n class Scanner\n {\n public Scanner()\n {\n _stream = new StreamReader(Console.OpenStandardInput());\n _pos = 0;\n _line = new string[0];\n _separator = ' ';\n }\n\n private char _separator;\n private StreamReader _stream;\n private int _pos;\n private string[] _line;\n\n #region get a element\n\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = _stream.ReadLine().Split(_separator);\n _pos = 0;\n }\n\n return _line[_pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n\n #endregion\n\n #region convert array\n\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n\n #endregion\n\n #region get row elements\n\n #region get array\n\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = _stream.ReadLine().Split(_separator);\n\n _pos = _line.Length;\n return _line;\n }\n\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n\n #endregion\n\n #region get 2~4 elements\n\n public void GetRow(out string a, out string b)\n {\n a = Next();\n b = Next();\n }\n\n public void GetRow(out string a, out string b, out string c)\n {\n a = Next();\n b = Next();\n c = Next();\n }\n\n public void GetRow(out string a, out string b, out string c, out string d)\n {\n a = Next();\n b = Next();\n c = Next();\n d = Next();\n }\n\n public void GetIntRow(out int a, out int b)\n {\n a = NextInt();\n b = NextInt();\n }\n\n public void GetIntRow(out int a, out int b, out int c)\n {\n a = NextInt();\n b = NextInt();\n c = NextInt();\n }\n\n public void GetIntRow(out int a, out int b, out int c, out int d)\n {\n a = NextInt();\n b = NextInt();\n c = NextInt();\n d = NextInt();\n }\n\n public void GetLongRow(out long a, out long b)\n {\n a = NextLong();\n b = NextLong();\n }\n\n public void GetLongRow(out long a, out long b, out long c)\n {\n a = NextLong();\n b = NextLong();\n c = NextLong();\n }\n\n public void GetLongRow(out long a, out long b, out long c, out long d)\n {\n a = NextLong();\n b = NextLong();\n c = NextLong();\n d = NextLong();\n }\n\n public void GetDoubleRow(out double a, out double b)\n {\n a = NextDouble();\n b = NextDouble();\n }\n\n public void GetDoubleRow(out double a, out double b, out double c)\n {\n a = NextDouble();\n b = NextDouble();\n c = NextDouble();\n }\n\n public void GetDoubleRow(out double a, out double b, out double c, out double d)\n {\n a = NextDouble();\n b = NextDouble();\n c = NextDouble();\n d = NextDouble();\n }\n\n #endregion\n\n #endregion\n\n #region get 2~4 column elements\n\n public void GetColumn(int n, out string[] a)\n {\n a = new string[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b)\n {\n a = new string[n];\n b = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i]);\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b, out string[] c)\n {\n a = new string[n];\n b = new string[n];\n c = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i], out c[i]);\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b, out string[] c, out string[] d)\n {\n a = new string[n];\n b = new string[n];\n c = new string[n];\n d = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i], out c[i], out d[i]);\n }\n }\n\n public void GetIntColumn(int n, out int[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToIntArray(sa);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b, out int[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n c = ToIntArray(sc);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b, out int[] c, out int[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n c = ToIntArray(sc);\n d = ToIntArray(sd);\n }\n\n public void GetLongColumn(int n, out long[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToLongArray(sa);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b, out long[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n c = ToLongArray(sc);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b, out long[] c, out long[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n c = ToLongArray(sc);\n d = ToLongArray(sd);\n }\n\n public void GetDoubleColumn(int n, out double[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToDoubleArray(sa);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b, out double[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n c = ToDoubleArray(sc);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b, out double[] c, out double[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n c = ToDoubleArray(sc);\n d = ToDoubleArray(sd);\n }\n\n #endregion\n\n #region get matrix\n\n public string[][] GetMatrix(int h)\n {\n string[][] result = new string[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = Array();\n }\n\n return result;\n\n }\n\n public int[][] GetIntMatrix(int h)\n {\n int[][] result = new int[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = IntArray();\n }\n\n return result;\n }\n\n public long[][] GetLongMatrix(int h)\n {\n long[][] result = new long[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = LongArray();\n }\n\n return result;\n }\n\n public double[][] GetDoubleMatrix(int h)\n {\n double[][] result = new double[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = DoubleArray();\n }\n\n return result;\n }\n\n public char[][] GetCharMatrix(int h)\n {\n char[][] result = new char[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = Next().ToCharArray();\n }\n\n return result;\n }\n\n #endregion\n }\n\n class Program\n {\n\n public void Solve()\n {\n var sc = new Scanner();\n string[] h1 = sc.Next().Split(':');\n string[] h2 = sc.Next().Split(':');\n int minute1 = int.Parse(h1[0])*60 + int.Parse(h1[1]);\n int minute2 = int.Parse(h2[0])*60 + int.Parse(h2[1]);\n\n int med = (minute1 + minute2) / 2;\n\n Console.WriteLine(\"{0:d2}:{1:d2}\", med / 60, med % 60);\n }\n\n static void Main(string[] args) => new Program().Solve();\n }\n}"}, {"source_code": "\ufeff//#define INCREASE_STACK\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tprivate static LineReader In { get; set; }\n\n\t\tprivate static TextWriter Out { get; set; }\n\n\t\tpublic static void Main()\n\t\t{\n#if ONLINE_JUDGE\n\t\t\tIn = new LineReader(Console.In);\n\t\t\tOut = Console.Out;\n#else\n\t\t\tIn = new LineReader(File.OpenText(\"input.txt\"));\n\t\t\tOut = new StreamWriter(\"../../output.txt\", false);\n#endif\n\n\t\t\ttry\n\t\t\t{\n#if INCREASE_STACK\n\t\t\t\tvar thread = new Thread(Solve, 32 * 1024 * 1024);\n\t\t\t\tthread.Start();\n\t\t\t\tthread.Join();\n#else\n\t\t\t\tSolve();\n#endif\n\t\t\t}\n\t\t\tfinally\n\t\t\t{\n\t\t\t\tOut.Dispose();\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Solve()\n\t\t{\n\t\t\tstring a = In.Read();\n\t\t\tint minuteOfDay1 = int.Parse(a.Substring(0, 2)) * 60 + int.Parse(a.Substring(3, 2));\n\n\t\t\tstring b = In.Read();\n\t\t\tint minuteOfDay2 = int.Parse(b.Substring(0, 2)) * 60 + int.Parse(b.Substring(3, 2));\n\n\t\t\tint minuteOfDay3 = (minuteOfDay1 + minuteOfDay2) / 2;\n\t\t\tOut.WriteLine($\"{(minuteOfDay3 / 60):D2}:{(minuteOfDay3 % 60):D2}\");\n\t\t}\n\t}\n\n\tpublic class Line\n\t{\n\t\tprivate readonly string _line;\n\n\t\tpublic Line(string line)\n\t\t{\n\t\t\t_line = line;\n\t\t}\n\n\t\tpublic static implicit operator string(Line line)\n\t\t{\n\t\t\treturn line._line;\n\t\t}\n\n\t\tpublic static implicit operator int(Line line)\n\t\t{\n\t\t\treturn int.Parse(line._line);\n\t\t}\n\n\t\tpublic static implicit operator int[] (Line line)\n\t\t{\n\t\t\treturn line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t}\n\n\t\tpublic static implicit operator long[] (Line line)\n\t\t{\n\t\t\treturn line._line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t}\n\t}\n\n\tpublic class LineReader\n\t{\n\t\tprivate readonly TextReader _reader;\n\n\t\tpublic LineReader(TextReader reader)\n\t\t{\n\t\t\t_reader = reader;\n\t\t}\n\n\t\tpublic Line Read()\n\t\t{\n\t\t\tstring line = _reader.ReadLine();\n\t\t\treturn line == null\n\t\t\t\t? null\n\t\t\t\t: new Line(line.Trim());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Globalization;\nusing System.Collections.Generic;\n\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s1 = Console.ReadLine().Split(':');\n var s2 = Console.ReadLine().Split(':');\n int h1 = int.Parse(s1[0]);\n int m1 = int.Parse(s1[1]);\n int h2 = int.Parse(s2[0]);\n int m2 = int.Parse(s2[1]);\n int minutes = (h2 * 60 + m2 - h1 * 60 - m1) / 2 + h1 * 60 + m1;\n Console.WriteLine(string.Format(\"{0}:{1}\", (minutes / 60).ToString(\"D2\"), (minutes % 60).ToString(\"D2\")));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var s1 = input.ReadToken();\n var s2 = input.ReadToken();\n var d1 = TimeSpan.ParseExact(s1, \"hh\\\\:mm\", null);\n var d2 = TimeSpan.ParseExact(s2, \"hh\\\\:mm\", null);\n var dd = (d2 - d1).TotalMinutes / 2;\n Write(d1.Add(TimeSpan.FromMinutes(dd)).ToString(\"hh\\\\:mm\"));\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _12oct\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] line = Console.ReadLine().Split(':');\n string[] line2 = Console.ReadLine().Split(':');\n int h1 = Convert.ToInt32(line[0]);\n int m1 = Convert.ToInt32(line[1]);\n int h2 = Convert.ToInt32(line2[0]);\n int m2 = Convert.ToInt32(line2[1]);\n\n int h3 = 0;\n int m3 = 0;\n\n int min1 = h1 * 60 + m1;\n int min2 = h2 * 60 + m2;\n\n int r = (min2 + min1) / 2;\n\n h3 = r / 60;\n m3 = r % 60; \n\n string Rh3 = Convert.ToString(h3);\n string Rm3 = Convert.ToString(m3);\n if (Rh3.Length == 1) Rh3 = \"0\" + Convert.ToString(h3);\n if (Rm3.Length == 1) Rm3 = \"0\" + Convert.ToString(m3);\n Console.WriteLine(Rh3 + \":\" + Rm3);\n \n\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace TestConsoleApplication\n{\n public class CodeForces\n {\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Parse(Console.ReadLine());\n DateTime end = DateTime.Parse(Console.ReadLine());\n DateTime middle = start.Add(TimeSpan.FromMinutes(end.Subtract(start).TotalMinutes / 2));\n Console.Write(middle.Hour.ToString().PadLeft(2,'0') + \":\" + middle.Minute.ToString().PadLeft(2, '0'));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\n\nnamespace ConsoleApp\n{\n static class Program\n {\n static void Main()\n {\n var begin = DateTime.Parse(ReadLine());\n var end = DateTime.Parse(ReadLine());\n\n WriteLine((begin + TimeSpan.FromMinutes((end.Hour * 60 + end.Minute - begin.Hour * 60 - begin.Minute) / 2)).ToString(\"HH:mm\"));\n }\n\n static List Arr()\n {\n return ReadLine().Split().Select(int.Parse).ToList();\n }\n\n static int Value()\n {\n return int.Parse(ReadLine());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] hm1 = Console.ReadLine().Split(new char[] { ':' }).ToArray();\n string[] hm2 = Console.ReadLine().Split(new char[] { ':' }).ToArray();\n int h1 = hm1[0][0] == '0' ? Convert.ToInt32(hm1[0][1].ToString()) : Convert.ToInt32(hm1[0]);\n int h2 = hm2[0][0] == '0' ? Convert.ToInt32(hm2[0][1].ToString()) : Convert.ToInt32(hm2[0]);\n int m1 = hm1[1][0] == '0' ? Convert.ToInt32(hm1[1][1].ToString()) : Convert.ToInt32(hm1[1]);\n int m2 = hm2[1][0] == '0' ? Convert.ToInt32(hm2[1][1].ToString()) : Convert.ToInt32(hm2[1]);\n\n int mm1 = h1 * 60 + m1;\n int mm2 = h2 * 60 + m2;\n\n int mean = (mm2 - mm1) / 2;\n\n int ph = (mm1 + mean) / 60;\n int pm = (mm1 + mean) % 60;\n string sh = ph / 10 > 0 ? ph.ToString() : string.Concat(\"0\", ph);\n string sm = pm / 10 > 0 ? pm.ToString() : string.Concat(\"0\", pm);\n Console.WriteLine(string.Concat(sh, \":\", sm));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int n=int.Parse(Console.ReadLine());\n \n \n string s=Console.ReadLine();\n string s1=Console.ReadLine();\n int a1=0;\n int a2=0;\n int[]a=new int[4];\n a1=(int.Parse(Convert.ToString(s[0]))*10+int.Parse(Convert.ToString(s[1])))*60+(int.Parse(Convert.ToString(s[3]))*10+int.Parse(Convert.ToString(s[4])));\n a2=(int.Parse(Convert.ToString(s1[0]))*10+int.Parse(Convert.ToString(s1[1])))*60+(int.Parse(Convert.ToString(s1[3]))*10+int.Parse(Convert.ToString(s1[4])));\n int chas=((a1+a2)/2)/60;\n int min=((a1+a2)/2)-chas*60;\n if((chas>9)&&(min>9))\n Console.WriteLine(\"{0}:{1}\",chas,min);\n else if((chas<=9)&&(min>9))\n Console.WriteLine(\"0{0}:{1}\",chas,min);\n else if((chas<=9)&&(min<=9))\n Console.WriteLine(\"0{0}:0{1}\",chas,min);\n else\n Console.WriteLine(\"{0}:0{1}\",chas,min);\n\n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n public static void func1(int h1, int m1, int h2, int m2)\n {\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult) / 2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n if (mResult >= 60)\n {\n mResult = mResult % 60;\n hResult++;\n }\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResult;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResult;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResultS + \":\" + mResultS);\n\n }\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n var s = Console.ReadLine();\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n s = Console.ReadLine();\n strings = s.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n func1(h1, m1, h2, m2);\n\n //func1(10, 0, 11, 0); //10 30\n //func1(11, 10, 11, 12);//11 11\n //func1(1, 2, 3, 2);// 2 2 \n //func1(17, 30, 18, 40);// 2 2 \n //func1(23, 56, 23, 58);// 2 2 \n //func1(12, 58, 13, 2);// 2 2 \n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace div07._03\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mas1 = Console.ReadLine().Split(':').Select(x => int.Parse(x)).ToArray();\n int[] mas2 = Console.ReadLine().Split(':').Select(x => int.Parse(x)).ToArray();\n\n if (mas1[0] == mas2[0])\n {\n int temp = ((mas2[1] - mas1[1]) / 2) + mas1[1];\n Console.WriteLine(String.Format(\"{0:D2}:{1:D2}\", mas2[0], temp));// mas2[0] + \":\" + temp);\n return;\n }\n if (mas1[0] == mas2[0] + 1)\n {\n int temp = (60 - mas1[1] + mas2[1]) / 2;\n\n if (mas1[1] + temp > 59)\n {\n mas1[0]++;\n mas1[1] = mas1[1] + temp - 60;\n\n Console.WriteLine(String.Format(\"{0:D2}:{1:D2}\", mas1[0], mas1[1]));\n return;\n }\n else\n {\n Console.WriteLine(String.Format(\"{0:D2}:{1:D2}\", mas1[0], mas1[1] + temp)); // (mas1[0] + \":\" + (mas1[1] + temp));\n return;\n }\n }\n else\n {\n int temp = (((mas2[0] - mas1[0] - 1) * 60) + (60 - mas1[1] + mas2[1])) / 2;\n\n mas1[0] += temp / 60;\n mas1[1] += temp % 60;\n if (mas1[1] > 59)\n {\n mas1[0]++;\n mas1[1] -= 60;\n }\n Console.WriteLine(String.Format(\"{0:D2}:{1:D2}\", mas1[0] , mas1[1]));\n return;\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication43\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n string[] s1 = Console.ReadLine().Split(':');\n int n = Convert.ToInt32(s[1]) + Convert.ToInt32(s[0]) * 60;\n int f = Convert.ToInt32(s1[1]) + Convert.ToInt32(s1[0]) * 60;\n // Console.WriteLine(n);\n // Console.WriteLine(f);\n int sh = 0;\n int sm = 0;\n int h = (n + f) / 2;\n sh = h / 60;\n sm = h % 60;\n Console.WriteLine(sh/10+\"\"+sh%10 +\":\" + sm/10+\"\"+sm%10);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Middle_of_the_Contest\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int h1 = Next();\n int m1 = Next();\n int h2 = Next();\n int m2 = Next();\n\n int t1 = h1*60 + m1;\n int t2 = h2*60 + m2;\n int t = (t1 + t2)/2;\n writer.Write((t/60).ToString(\"00\"));\n writer.Write(':');\n writer.WriteLine((t % 60).ToString(\"00\"));\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n int[] a = reader.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(token => int.Parse(token)).ToArray();\n int h1 = a[0];\n int m1 = a[1];\n\n a = reader.ReadLine().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(token => int.Parse(token)).ToArray();\n int h2 = a[0];\n int m2 = a[1];\n\n int diff = (h2 * 60 + m2 - (h1 * 60 + m1)) / 2;\n int m3 = (m1 + diff) % 60;\n int h3 = h1 + ((m1 + diff) / 60);\n\n writer.WriteLine(h3.ToString(\"D2\") + \":\" + m3.ToString(\"D2\"));\n }\n\n\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n Stopwatch watch = new Stopwatch();\n watch.Start();\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Program().Solve();\n#if DEBUG\n watch.Stop();\n writer.WriteLine(\"Stopwatch: \" + watch.ElapsedMilliseconds + \"ms\");\n#endif\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n private string[] ReadArray() => reader.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n private int[] ReadIntArray() => ReadArray().Select(token => int.Parse(token)).ToArray();\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication42\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var arr = input.Split(':');\n\n var startH = int.Parse(arr[0]);\n var startM = int.Parse(arr[1]);\n\n input = Console.ReadLine();\n arr = input.Split(':');\n\n var endtH = int.Parse(arr[0]);\n var endM = int.Parse(arr[1]);\n\n var countH = 0;\n var countM = 0;\n\n if (startH == endtH)\n {\n countM = endM - startM;\n }\n else\n {\n if (startH > endtH)\n {\n var ostM = 60 - startM;\n var startH_2 = startH + 1;\n var ostH = 24 - startH_2;\n\n countH = (ostH) + endtH;\n countM = (countH * 60) + ostM + endM;\n }\n else\n {\n var ostM = 60 - startM;\n var startH_2 = startH + 1;\n if (startH_2 == 24)\n {\n startH_2 = 0;\n }\n\n countH = endtH - startH_2;\n countM = (countH * 60) + ostM + endM;\n }\n }\n countM = countM / 2;\n\n var resCountH = countM / 60;\n var resCountM = countM % 60;\n\n var s1 = (((startH + resCountH) + ((startM + resCountM) / 60)) % 24).ToString().PadLeft(2, '0');\n var s2 = ((startM + resCountM) % 60).ToString().PadLeft(2, '0');\n\n Console.WriteLine(string.Format(\"{0}:{1}\", s1, s2));\n //Console.ReadLine();\n //var input = Console.ReadLine();\n //var arr = input.Split();\n\n //var n = int.Parse(arr[0]);\n //var k = int.Parse(arr[1]);\n\n //if (n == k)\n //{\n // Console.WriteLine(2);\n //}\n //else\n //{\n // if (k == 2)\n // {\n\n // }\n // else\n // {\n // Console.WriteLine((n - k + 1));\n // }\n //}\n ////Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 64 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;\n var s1 = sr.NextString().Split(new[] {':'});\n var h1 = int.Parse(s1[0]);\n var m1 = int.Parse(s1[1]);\n var s2 = sr.NextString().Split(new[] {':'});\n var h2 = int.Parse(s2[0]);\n var m2 = int.Parse(s2[1]);\n var d1 = new DateTime(1, 1, 1, h1, m1, 0);\n var d2 = new DateTime(1, 1, 1, h2, m2, 0);\n var d = (d2 - d1).Ticks / 2;\n var d3 = d1.AddTicks(d);\n var h = d3.Hour.ToString();\n var m = d3.Minute.ToString();\n if (h.Length == 1)\n {\n h = \"0\" + h;\n }\n\n if (m.Length == 1)\n {\n m = \"0\" + m;\n }\n sw.WriteLine(h + \":\" + m);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n \ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp39\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr1 = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), int.Parse);\n int h1 = arr1[0];\n int m1 = arr1[1];\n\n var arr2 = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), int.Parse);\n int h2 = arr2[0];\n int m2 = arr2[1];\n\n int m3 = ((h2 - h1) * 60 + (m2 - m1))/2;\n \n int h3 = m3 / 60 + h1;\n if (m3 % 60 + m1 >= 60)\n {\n h3 += 1;\n m3 = m3 % 60 + m1 - 60;\n }\n else {\n m3 = m3 % 60 + m1;\n }\n \n string strm3 = Convert.ToString(m3);\n string strh3 = Convert.ToString(h3);\n if (m3 < 10)\n {\n strm3 = \"0\";\n strm3 += Convert.ToString(m3);\n }\n if (h3 < 10)\n {\n strh3 = \"0\";\n strh3 += Convert.ToString(h3);\n }\n\n Console.WriteLine(strh3 + \":\" + strm3);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n { string zero = \"0\";\n string ft = Console.ReadLine();\n string st = Console.ReadLine();\n string[] t1 = ft.Split(':');\n string[] t2 = st.Split(':');\n int h1 = Convert.ToInt32(t1[0]);\n int m1 = Convert.ToInt32(t1[1]);\n int h2 = Convert.ToInt32(t2[0]);\n int m2 = Convert.ToInt32(t2[1]);\n int[] answer = new int[2];\n\n int time1 = h1 * 60 + m1;\n int time2 = h2 * 60 + m2;\n int tin = (time1 + time2) / 2;\n answer[0] = tin / 60;\n answer[1] = tin % 60;\n\n\n string fa = Convert.ToString(answer[0]);\n string sa = Convert.ToString(answer[1]);\n if (answer[0] < 10)\n fa = zero + fa;\n if (answer[1] < 10)\n sa = zero + sa;\n Console.WriteLine(fa + \":\" + sa);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n\n string[] time1 = Console.ReadLine().Split(':');\n string[] time2 = Console.ReadLine().Split(':');\n int result = 0;\n int minut;\n if ((int.Parse(time2[0]) - (int.Parse(time1[0]) + 1)) != -1)\n {\n result += (int.Parse(time2[0]) - (int.Parse(time1[0]) + 1)) * 60;\n\n result += 60 - int.Parse(time1[1]);\n result += int.Parse(time2[1]);\n }\n else\n result += int.Parse(time2[1]) - int.Parse(time1[1]);\n result /= 2;\n int resul_h = result / 60;\n int result_min = result % 60;\n resul_h += int.Parse(time1[0]);\n if(result_min+ int.Parse(time1[1])>=60)\n {\n resul_h++;\n result_min = (result_min + int.Parse(time1[1])) % 60;\n }\n else\n {\n result_min = result_min + int.Parse(time1[1]);\n }\n string h = resul_h.ToString();\n string min = result_min.ToString();\n if (resul_h < 10)\n h = \"0\" + h;\n if (result_min < 10)\n min = \"0\" + min;\n Console.WriteLine($\"{h}:{min}\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int start = int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n s = Console.ReadLine();\n int end= int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n int middle = (end - start)/2;\n int hour = start / 60 + middle / 60;\n int minute = start % 60 + middle % 60 ;\n if (minute >= 60)\n {\n hour += minute / 60;\n minute = minute % 60;\n };\n s = hour.ToString();\n string s1= minute.ToString();\n if (minute < 10)\n s1 = \"0\"+s1;\n if (hour < 10)\n s = \"0\" +s;\n Console.WriteLine(s+\":\"+s1);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string[] s1 = a.Split(':');\n string[] s2 = b.Split(':');\n int a1 = Convert.ToInt32(s1[0]);\n int b1 = Convert.ToInt32(s1[1]);\n int a2 = Convert.ToInt32(s2[0]);\n int b2 = Convert.ToInt32(s2[1]);\n int c1 = (a1 + a2), c2 = (b1 + b2);\n if (c2 >= 60)\n {\n c2 -= 60;\n c1++;\n }\n if (c1 % 2 == 1)\n {\n c1--;\n c2 += 60;\n }\n c1 /= 2;\n c2 /= 2;\n s1[0] = c1.ToString();\n s1[1] = c2.ToString();\n if (s1[0].Length == 1) s1[0] = '0' + s1[0];\n if (s1[1].Length == 1) s1[1] = '0' + s1[1];\n Console.WriteLine(s1[0].ToString() + \":\" + s1[1].ToString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int h1 = int.Parse(s.Substring(0, 2));\n int m1 = int.Parse(s.Substring(3, 2));\n int q1 = h1 * 60 + m1;\n s = Console.ReadLine();\n int h2 = int.Parse(s.Substring(0, 2));\n int m2 = int.Parse(s.Substring(3, 2));\n int q2 = h2 * 60 + m2;\n int dq = q2 - q1;\n dq /= 2;\n dq += q1;\n h1 = dq / 60;\n m1 = dq % 60;\n \n Console.WriteLine($\"{h1/10}{h1%10}:{m1/10}{m1%10}\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace BasicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n var h1m1 = Array.ConvertAll(Console.ReadLine().Split(':'), int.Parse);\n var h2m2 = Array.ConvertAll(Console.ReadLine().Split(':'), int.Parse);\n int hour = h1m1[0] + h2m2[0];\n int min= h1m1[1] + h2m2[1];\n int totalmin = (hour * 60 + min) / 2;\n hour = totalmin / 60;\n min = totalmin % 60;\n string hh=Convert.ToString(hour), mm=Convert.ToString(min);\n if (hh.Length == 1) { hh = \"0\" + hh; }\n if (mm.Length == 1) { mm = \"0\" + mm; }\n\n Console.WriteLine(hh + \":\" + mm);\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n if(( start[0] + end[0] ) % 2 == 0)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n\n else\n if(start[1]+end[1]<60)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] +60) / 2 );\n else\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2 +1, ( start[1] + end[1] -60) / 2 );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] t1 = Console.ReadLine().Split(':');\n string[] t2 = Console.ReadLine().Split(':');\n\n int h1 = Convert.ToInt32(t1[0]);\n int m1 = Convert.ToInt32(t1[1]);\n\n int h2 = Convert.ToInt32(t2[0]);\n int m2 = Convert.ToInt32(t2[1]);\n\n int t3 = h1 * 60 + m1;\n int t4 = h2 * 60 + m2;\n\n int t = (t3 + t4) / 2;\n int h = t / 60;\n int m = t % 60;\n\n\n\n if (h > 0 && h < 10 || h == 0)\n {\n if (m > 0 && m < 10 || m == 0)\n {\n Console.WriteLine(\"0\" + h + \":\" + \"0\" + m);\n }\n else\n {\n Console.WriteLine(\"0\" + h + \":\" + m);\n }\n }\n else if (m > 0 && m < 10 || m == 0)\n {\n\n Console.WriteLine(h + \":\" + \"0\" + m);\n\n }\n else\n {\n Console.WriteLine(h + \":\" + m);\n }\n \n //Console.WriteLine(h + \":\" + m);\n \n \n\n\n\n }\n }\n}\n"}, {"source_code": "// Problem: 1133A - Middle of the Contest\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass MiddleOfTheContest\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n string t = words[0];\n short tBeginMin = TimeToMin (t);\n if (tBeginMin == -1)\n return -1;\n words = ReadSplitLine (1);\n if (words == null)\n return -1;\n t = words[0];\n short tEndMin = TimeToMin (t);\n if (tEndMin == -1)\n return -1;\n if (tBeginMin >= tEndMin)\n return -1;\n ushort tContestMin = Convert.ToUInt16 (tEndMin-tBeginMin);\n if (tContestMin%2 == 1)\n return -1;\n ushort tMidMin = Convert.ToUInt16 ((tBeginMin+tEndMin)/2);\n Console.WriteLine (\"{0:D2}:{1:D2}\",tMidMin/60,tMidMin%60);\n return 0;\n }\n \n static short TimeToMin (string t)\n {\n if (t.Length != 5)\n return -1;\n if (t[2] != ':')\n return -1;\n if (!Char.IsDigit (t[0]) || !Char.IsDigit (t[1]) || !Char.IsDigit (t[3]) || !Char.IsDigit (t[4]))\n return -1;\n byte hour = Convert.ToByte ((t[0]-'0')*10+(t[1]-'0'));\n if (hour > 23)\n return -1;\n ushort tMin = Convert.ToUInt16 (hour*60);\n byte min = Convert.ToByte ((t[3]-'0')*10+(t[4]-'0'));\n if (min > 59)\n return -1;\n tMin += min;\n return (short)tMin;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] s = Console.ReadLine().Split(':');\n int a = int.Parse(s[0]) * 60 + int.Parse(s[1]);\n s = Console.ReadLine().Split(':');\n int b = int.Parse(s[0]) * 60 + int.Parse(s[1]);\n\n int ans = a + (b - a) / 2;\n string h = Convert.ToString(ans / 60);\n string m = Convert.ToString(ans % 60);\n if (h.Length == 1)\n h = \"0\" + h;\n if (m.Length == 1)\n m = \"0\" + m;\n Console.WriteLine(h+\":\"+m);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n List time0 = Console.ReadLine().Split(':').ToList().ConvertAll(int.Parse);\n int minutsBegin = 60 * time0[0] + time0[1];\n List timeK = Console.ReadLine().Split(':').ToList().ConvertAll(int.Parse);\n int minutsEnd = 60 * timeK[0] + timeK[1];\n int minuteAverage = (minutsBegin + minutsEnd) / 2;\n int hourEnd = minuteAverage / 60;\n int minuteEnd = minuteAverage % 60;\n Console.WriteLine(String.Format(\"{0:00}\", hourEnd)+\":\"+ String.Format(\"{0:00}\", minuteEnd));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine().Split(':');\n var end = Console.ReadLine().Split(':');\n var h1 = Convert.ToInt32(start[0]);\n var m1 = Convert.ToInt32(start[1]);\n var h2 = Convert.ToInt32(end[0]);\n var m2 = Convert.ToInt32(end[1]);\n var min1 = h1 * 60 + m1;\n var min2 = h2 * 60 + m2;\n var midmin = (min1 + min2) / 2;\n Console.WriteLine(\"{0:00}:{1:00}\", midmin / 60, midmin % 60);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine().Split(new char[] {':'}).Select(int.Parse).ToArray();\n var startSec = start[0]*60 + start[1];\n var end = Console.ReadLine().Split(new char[] { ':' }).Select(int.Parse).ToArray();\n var endSec = end[0]*60 + end[1];\n var middleTime = 0;\n if (endSec > startSec)\n {\n middleTime = (endSec + startSec)/2;\n }\n\n\n var h = middleTime/60;\n var m = middleTime - h*60;\n Console.WriteLine(h.ToString(\"D2\") + \":\"+ m.ToString(\"D2\"));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine().Split(new char[] {':'}).Select(int.Parse).ToArray();\n var startSec = start[0]*60 + start[1];\n var end = Console.ReadLine().Split(new char[] { ':' }).Select(int.Parse).ToArray();\n var endSec = end[0]*60 + end[1];\n var middleTime = 0;\n if (endSec > startSec)\n {\n middleTime = (endSec + startSec)/2;\n }\n else\n {\n middleTime = endSec + 60*24 - startSec;\n }\n\n var h = middleTime/60;\n var m = middleTime - h*60;\n Console.WriteLine(h.ToString(\"D2\") + \":\"+ m.ToString(\"D2\"));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _544._2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a, b;\n int h1, h2, m1, m2, time1, time2, h_mid, m_mid;\n double mid_time;\n a = Console.ReadLine();\n h1 = Convert.ToInt32(a.Substring(0, a.Length - 3));\n m1 = Convert.ToInt32(a.Substring(3));\n b = Console.ReadLine();\n h2 = Convert.ToInt32(b.Substring(0, b.Length - 3));\n m2 = Convert.ToInt32(b.Substring(3));\n time1 = h1 * 60 + m1;\n time2 = h2 * 60 + m2;\n mid_time = time1 + (time2 - time1) / 2;\n h_mid = Convert.ToInt32(Math.Floor(mid_time / 60));\n m_mid = Convert.ToInt32(mid_time) - h_mid * 60;\n if (h_mid < 10) Console.Write('0');\n Console.Write(h_mid);\n Console.Write(':');\n if (m_mid < 10) Console.Write('0');\n Console.Write(m_mid);\n }\n }\n}\n"}, {"source_code": "using System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Solution {\n static void Main(string[] args) { \n\t\tvar arr = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), Convert.ToInt32);\n var h1 = arr[0];\n var m1 = arr[1];\n arr = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), Convert.ToInt32);\n var h2 = arr[0];\n var m2 = arr[1];\n\n var tm = h1*60+h2*60+m1+m2;\n tm = tm /2;\n \n \n Console.WriteLine($\"{(tm/60).ToString().PadLeft(2, '0')}:{(tm%60).ToString().PadLeft(2, '0')}\"); \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string time1 = Console.ReadLine();\n string time2 = Console.ReadLine();\n\n DateTime start1 = DateTime.Now.Date;\n DateTime start2 = DateTime.Now.Date;\n\n start1=start1.AddHours(Convert.ToInt32(time1.Split(':').FirstOrDefault()));\n start1=start1.AddMinutes(Convert.ToInt32(time1.Split(':').LastOrDefault()));\n\n start2=start2.AddHours(Convert.ToInt32(time2.Split(':').FirstOrDefault()));\n start2=start2.AddMinutes(Convert.ToInt32(time2.Split(':').LastOrDefault()));\n\n var sub = start2.Subtract(start1);\n\n start1=start1.AddMinutes(sub.TotalMinutes/2);\n\n Console.WriteLine(start1.ToString(\"HH:mm\"));\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace opDiv3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] time = Console.ReadLine().Split(new char[] {':'});\n int h1 = Convert.ToInt32(time[0]);\n int m1 = Convert.ToInt32(time[1]);\n\n string[] time2 = Console.ReadLine().Split(new char[] { ':' });\n int h2 = Convert.ToInt32(time2[0]);\n int m2 = Convert.ToInt32(time2[1]);\n\n double h3 = ((h2 - h1)/2.0)+h1;\n int m3 = ((m2 - m1) / 2) + m1;\n\n if (h3 % 1 != 0)\n {\n m3+=30;\n h3 -=0.5;\n \n }\n\n if (m3 >= 60)\n {\n m3 -= 60;\n h3++;\n }\n\n if(m3<0)\n {\n h3--;\n m3 *= -1;\n }\n \n if (m3 < 10 && h3 < 10) Console.WriteLine(\"0\" + h3 + \":\"+\"0\" + m3);\n else if (m3 < 10) Console.WriteLine(h3 + \":\" + \"0\" + m3);\n else if (h3 < 10) Console.WriteLine(\"0\"+h3 + \":\" + m3);\n else Console.WriteLine( h3 + \":\" + m3);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int h1 = Convert.ToInt32(input.Split(':')[0]);\n int m1 = Convert.ToInt32(input.Split(':')[1]);\n\n input = Console.ReadLine();\n int h2 = Convert.ToInt32(input.Split(':')[0]);\n int m2 = Convert.ToInt32(input.Split(':')[1]);\n\n int delta = 0;\n if (h2 == h1)\n {\n delta = m2 - m1;\n }\n else if ((h2 - h1) == 1)\n {\n delta = m2 + (60 - m1);\n }\n else\n {\n delta = m2 + (60 - m1) + (h2 - h1 - 1) * 60;\n }\n\n int d2 = delta / 2;\n if (delta / 2 >= (60 - m1))\n {\n h1++;\n d2 = d2 - (60 - m1);\n\n h1 = h1 + d2 / 60;\n m1 = d2 % 60;\n }\n else\n {\n m1 = m1 + d2;\n }\n\n string q0 = Convert.ToString(h1);\n string q1 = Convert.ToString(m1);\n if (q0.Length == 1)\n {\n q0 = '0' + q0;\n }\n\n if (q1.Length == 1)\n {\n q1 = '0' + q1;\n }\n //Console.WriteLine(d2/60);\n Console.WriteLine(q0 + ':' + q1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HULK\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(':');\n string[] ss = Console.ReadLine().Split(':');\n int time1 = Convert.ToInt32(s[0]) * 60 +Convert.ToInt32( s[1]);\n int time2 = Convert.ToInt32(ss[0]) * 60 + Convert.ToInt32(ss[1]);\n int raznitsa = (time2 - time1)/2;\n int time3 = time1 + raznitsa;\n int chasi = time3 / 60;\n string chasi1=\"0\";\n if (chasi<10)chasi1=chasi1 + Convert.ToString(chasi);\n else chasi1 = Convert.ToString(chasi);\n int minuti = time3 % 60;\n string minuti1 = \"0\";\n if (minuti < 10) minuti1 = minuti1 + Convert.ToString(minuti);\n else minuti1 = Convert.ToString(minuti); \n Console.WriteLine(chasi1+\":\"+minuti1);\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring a = Console.ReadLine();\n\t\tstring b = Console.ReadLine();\n\t\tint x1 = int.Parse(a.Split(':')[0]);\n\t\tint y1 = int.Parse(a.Split(':')[1]);\n\t\tint x2 = int.Parse(b.Split(':')[0]);\n\t\tint y2 = int.Parse(b.Split(':')[1]);\n\t\tint ans = (x2 * 60 - x1 * 60 + y2 - y1)/2 + x1 * 60 + y1;\n\t\tif(ans %60 < 10 && ans /60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans / 60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans %60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HULK\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(':');\n string[] ss = Console.ReadLine().Split(':');\n int time1 = Convert.ToInt32(s[0]) * 60 +Convert.ToInt32( s[1]);\n int time2 = Convert.ToInt32(ss[0]) * 60 + Convert.ToInt32(ss[1]);\n int raznitsa = (time2 - time1)/2;\n int time3 = time1 + raznitsa;\n int chasi = time3 / 60;\n string chasi1=\"0\";\n if (chasi<10)chasi1=chasi1 + Convert.ToString(chasi);\n else chasi1 = Convert.ToString(chasi);\n int minuti = time3 % 60;\n string minuti1 = \"0\";\n if (minuti < 10) minuti1 = minuti1 + Convert.ToString(minuti);\n else minuti1 = Convert.ToString(minuti); \n Console.WriteLine(chasi1+\":\"+minuti1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1133A\n {\n public static void Main()\n {\n var t1 = Console.ReadLine().Split(':');\n var t2 = Console.ReadLine().Split(':');\n\n int h1 = int.Parse(t1[0]);\n int m1 = int.Parse(t1[1]);\n\n int h2 = int.Parse(t2[0]);\n int m2 = int.Parse(t2[1]);\n\n int h3 = ((h1 + h2) * 60 + m1 + m2) / 2 / 60;\n int m3 = ((h1 + h2) * 60 + m1 + m2) / 2 % 60;\n\n Console.WriteLine(string.Join(\":\", h3.ToString().PadLeft(2, '0'), m3.ToString().PadLeft(2, '0')));\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CAPTAIN_AMERICA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n int time1 = Convert.ToInt32(s[0]) * 60 + Convert.ToInt32(s[1]);\n\n string[] s1 = Console.ReadLine().Split(':');\n int time2 = Convert.ToInt32(s1[0]) * 60 + Convert.ToInt32(s1[1]);\n int time3 = (time2 - time1) / 2;\n int otvetHours = Convert.ToInt32(s[0]);\n int otvetMinutes = Convert.ToInt32(s[1]);\n while (time3 >= 60)\n {\n time3 = time3 - 60;\n otvetHours++;\n }\n otvetMinutes += time3;\n string otvet = Convert.ToString(otvetHours) +\":\"+ Convert.ToString(otvetMinutes);\n if (otvetHours < 10)\n {\n otvet = \"0\" + otvet;\n }\n if (otvetMinutes < 10)\n {\n string answer = otvet.Substring(0, 3);\n answer += \"0\"; \n answer+=otvetMinutes;\n Console.WriteLine(answer);\n }\n else\n {\n Console.WriteLine(otvet);\n }\n }\n }\n}\n// 23:59\n//1\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CAPTAIN_AMERICA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n int time1 = Convert.ToInt32(s[0]) * 60 + Convert.ToInt32(s[1]);\n\n string[] s1 = Console.ReadLine().Split(':');\n int time2 = Convert.ToInt32(s1[0]) * 60 + Convert.ToInt32(s1[1]);\n int time3 = (time2 - time1) / 2;\n int otvetHours = Convert.ToInt32(s[0]);\n int otvetMinutes = Convert.ToInt32(s[1]);\n while (time3 >= 60)\n {\n time3 = time3 - 60;\n otvetHours++;\n }\n otvetMinutes += time3;\n string otvet = Convert.ToString(otvetHours) +\":\"+ Convert.ToString(otvetMinutes);\n if (otvetHours < 10)\n {\n otvet = \"0\" + otvet;\n }\n if (otvetMinutes < 10)\n {\n string answer = otvet.Substring(0, 3);\n answer += s[1];\n Console.WriteLine(answer);\n }\n else\n {\n Console.WriteLine(otvet);\n }\n }\n }\n}\n// 23:59\n//1\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring a = Console.ReadLine();\n\t\tstring b = Console.ReadLine();\n\t\tint x1 = int.Parse(a.Split(':')[0]);\n\t\tint y1 = int.Parse(a.Split(':')[1]);\n\t\tint x2 = int.Parse(b.Split(':')[0]);\n\t\tint y2 = int.Parse(b.Split(':')[1]);\n\t\tint ans = (x2 * 60 - x1 * 60 + y2 - y1)/2 + x1 * 60 + y1;\n\t\tConsole.WriteLine(\"{0}:{1}\",ans/60, ans%60);\n\t}\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring a = Console.ReadLine();\n\t\tstring b = Console.ReadLine();\n\t\tint x1 = int.Parse(a.Split(':')[0]);\n\t\tint y1 = int.Parse(a.Split(':')[1]);\n\t\tint x2 = int.Parse(b.Split(':')[0]);\n\t\tint y2 = int.Parse(b.Split(':')[1]);\n\t\tint ans = (x2 * 60 - x1 * 60 + y2 - y1)/2 + x1 * 60 + y1;\n\t\tif(ans / 60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans %60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans %60 < 10 && ans /60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring a = Console.ReadLine();\n\t\tstring b = Console.ReadLine();\n\t\tint x1 = int.Parse(a.Split(':')[0]);\n\t\tint y1 = int.Parse(a.Split(':')[1]);\n\t\tint x2 = int.Parse(b.Split(':')[0]);\n\t\tint y2 = int.Parse(b.Split(':')[1]);\n\t\tint ans = (x2 * 60 - x1 * 60 + y2 - y1)/2 + x1 * 60 + y1;\n\t\tif(ans / 60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans %60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse if(ans %60 < 10 && ans /60 < 10)\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:0{1}\",ans/60, ans%60);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"0{0}:{1}\",ans/60, ans%60);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _12oct\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] line = Console.ReadLine().Split(':');\n string[] line2 = Console.ReadLine().Split(':');\n int h1 = Convert.ToInt32(line[0]);\n int m1 = Convert.ToInt32(line[1]);\n int h2 = Convert.ToInt32(line2[0]);\n int m2 = Convert.ToInt32(line2[1]);\n\n int h3 = 0;\n int m3 = 0;\n\n if(m1 == 0 && m2 == 0)\n {\n h3 = ((h2 - h1) / 2) + h1;\n m3 = 30;\n }\n else\n {\n if(m1 == m2)\n {\n h3 = ((h2 - h1) / 2) + h1;\n m3 = m1;\n }\n else\n {\n h3 = ((h2 - h1) / 2) + h1;\n m3 = ((m2 - m1) / 2) + m1;\n }\n }\n string Rh3 = Convert.ToString(h3);\n string Rm3 = Convert.ToString(m3);\n if (Rh3.Length == 1) Rh3 = \"0\" + Convert.ToString(h3);\n if (Rm3.Length == 1) Rm3 = \"0\" + Convert.ToString(m3);\n Console.WriteLine(Rh3 + \":\" + Rm3);\n \n\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace TestConsoleApplication\n{\n public class CodeForces\n {\n public static void Main(string[] args)\n {\n DateTime start = DateTime.Parse(Console.ReadLine());\n DateTime end = DateTime.Parse(Console.ReadLine());\n DateTime middle = start.Add(TimeSpan.FromMinutes(end.Subtract(start).TotalMinutes / 2));\n Console.Write(middle.Hour + \":\" + middle.Minute);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n public static void func1(int h1, int m1, int h2, int m2)\n {\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult) / 2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n if (mResult > 60)\n {\n mResult = mResult % 60;\n hResult++;\n }\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResult;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResult;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResultS + \":\" + mResultS);\n\n }\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n var s = Console.ReadLine();\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n s = Console.ReadLine();\n strings = s.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n func1(h1, m1, h2, m2);\n\n //func1(10, 0, 11, 0); //10 30\n //func1(11, 10, 11, 12);//11 11\n //func1(1, 2, 3, 2);// 2 2 \n //func1(17, 30, 18, 40);// 2 2 \n\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n //var s = Console.ReadLine();\n var s = \"01:02\";\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n var s1 = \"03:02\";\n // s = Console.ReadLine();\n strings = s1.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult)/2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResultS;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResultS;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResultS + \":\" + mResultS);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n var s = Console.ReadLine();\n //var s = \"01:02\";\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n //var s1 = \"03:02\";\n s = Console.ReadLine();\n strings = s.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult)/2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResultS;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResultS;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResultS + \":\" + mResultS);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n public static void func1(int h1, int m1, int h2, int m2)\n {\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult) / 2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResult;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResult;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResultS + \":\" + mResultS);\n\n }\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n var s = Console.ReadLine();\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n s = Console.ReadLine();\n strings = s.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n func1(h1, m1, h2, m2);\n\n //func1(10, 0, 11, 0); //10 30\n //func1(11, 10, 11, 12);//11 11\n //func1(1, 2, 3, 2);// 2 2 \n\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTest\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int h1;\n int m1;\n int h2;\n int m2;\n\n var s = Console.ReadLine();\n //var s = \"11:10\";\n\n var strings = s.Split(':');\n h1 = int.Parse(strings[0]);\n m1 = int.Parse(strings[1]);\n\n //var s1 = \"11:12\";\n s = Console.ReadLine();\n strings = s.Split(':');\n h2 = int.Parse(strings[0]);\n m2 = int.Parse(strings[1]);\n\n int hTempResult = h2 - h1;\n int mTmpResult = m2 - m1;\n\n int mDif = (hTempResult * 60 + mTmpResult)/2;\n int hPlus = mDif / 60;\n int mPlus = mDif % 60;\n\n\n int hResult = h1 + hPlus;\n int mResult = m1 + mPlus;\n\n var hResultS = \"\";\n\n if (hResult < 10)\n hResultS = \"0\" + hResultS;\n else\n hResultS = hResult.ToString();\n\n var mResultS = \"\";\n\n if (mResult < 10)\n mResultS = \"0\" + mResultS;\n else\n mResultS = mResult.ToString();\n\n Console.WriteLine(hResult + \":\" + mResult);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication43\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n string[] s1 = Console.ReadLine().Split(':');\n int n = Convert.ToInt32(s[1]) + Convert.ToInt32(s[0]) * 60;\n int f = Convert.ToInt32(s1[1]) + Convert.ToInt32(s1[0]) * 60;\n Console.WriteLine(n);\n Console.WriteLine(f);\n int sh = 0;\n int sm = 0;\n int h = (n + f) / 2;\n sh = h / 60;\n sm = h % 60;\n Console.WriteLine(sh/10+\"\"+sh%10 +\":\" + sm/10+\"\"+sm%10);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication43\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n string[] s1 = Console.ReadLine().Split(':');\n int a = (Convert.ToInt32(s[0]) + Convert.ToInt32(s1[0])) /2;\n if (a < 10)\n {\n \n }\n int b = (Convert.ToInt32(s[1]) + Convert.ToInt32(s1[1]))/2;\n if (b == 0)\n {\n b = 30;\n }\n Console.WriteLine(a/10+\"\"+a%10+\":\"+b/10+\"\" +b%10);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication43\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n string[] s1 = Console.ReadLine().Split(':');\n int a = (Convert.ToInt32(s[0]) + Convert.ToInt32(s1[0])) /2;\n if (a < 10)\n {\n \n }\n int b = (Convert.ToInt32(s[1]) + Convert.ToInt32(s1[1]))/2;\n if (Convert.ToInt32(s[0]) + Convert.ToInt32(s1[0]) % 2 != 0)\n {\n b += 30;\n }\n if (b == 0)\n {\n b = 30;\n }\n Console.WriteLine(a/10+\"\"+a%10+\":\"+b/10+\"\" +b%10);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp39\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr1 = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), int.Parse);\n int h1 = arr1[0];\n int m1 = arr1[1];\n\n var arr2 = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), int.Parse);\n int h2 = arr2[0];\n int m2 = arr2[1];\n\n int m3 = ((h2 - h1) * 60 + (m2 - m1))/2;\n int h3 = m3 / 60 + h1;\n\n m3 = m3 % 60 + m1;\n string strm3 = Convert.ToString(m3);\n string strh3 = Convert.ToString(h3);\n if (m3 < 10)\n {\n strm3 = \"0\";\n strm3 += Convert.ToString(m3);\n }\n if (h3 < 10)\n {\n strh3 = \"0\";\n strh3 += Convert.ToString(h3);\n }\n\n Console.WriteLine(strh3 + \":\" + strm3);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n { string zero = \"0\";\n string ft = Console.ReadLine();\n string st = Console.ReadLine();\n string[] t1 = ft.Split(':');\n string[] t2 = st.Split(':');\n int h1 = Convert.ToInt32(t1[0]);\n int m1 = Convert.ToInt32(t1[1]);\n int h2 = Convert.ToInt32(t2[0]);\n int m2 = Convert.ToInt32(t2[1]);\n int[] answer = new int[2];\n if (h1 == h2 && m1 < m2)\n {\n answer[1] = (m1 + m2) / 2;\n answer[0] = h1;\n }\n else if (h1 < h2 && m1 == m2)\n {\n answer[0] = (h1 + h2) / 2;\n answer[1] = m1;\n }\n if (h1 < h2 && m1 < m2)\n {\n answer[1] = (m1 + m2) / 2;\n answer[0] = (h1+h2)/2;\n }\n string fa = Convert.ToString(answer[0]);\n string sa = Convert.ToString(answer[1]);\n if (answer[0] < 10)\n fa = zero + fa;\n if (answer[1] < 10)\n sa = zero + sa;\n Console.WriteLine(fa + \":\" + sa);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n { string zero = \"0\";\n string ft = Console.ReadLine();\n string st = Console.ReadLine();\n string[] t1 = ft.Split(':');\n string[] t2 = st.Split(':');\n int h1 = Convert.ToInt32(t1[0]);\n int m1 = Convert.ToInt32(t1[1]);\n int h2 = Convert.ToInt32(t2[0]);\n int m2 = Convert.ToInt32(t2[1]);\n int[] answer = new int[2];\n if (h1 == h2 && m1 < m2)\n {\n answer[1] = (m1 + m2) / 2;\n answer[0] = h1;\n }\n else if (h1 < h2 && m1 == m2)\n { if ((h2 - h1) % 2 == 0) { \n answer[0] = (h1 + h2) / 2;\n answer[1] = m1; }\n else\n {\n answer[0] = (h1 + h2) / 2;\n\n answer[1] = 30;\n }\n \n }\n if (h1 < h2 && m1 < m2)\n {\n answer[1] = (m1 + m2) / 2;\n answer[0] = (h1+h2)/2;\n }\n string fa = Convert.ToString(answer[0]);\n string sa = Convert.ToString(answer[1]);\n if (answer[0] < 10)\n fa = zero + fa;\n if (answer[1] < 10)\n sa = zero + sa;\n Console.WriteLine(fa + \":\" + sa);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int start = int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n s = Console.ReadLine();\n int end= int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n int middle = (end - start)/2;\n int hour = start / 60 + middle / 60;\n int minute = start % 60 + middle % 60 ;\n if (minute > 60)\n {\n hour += minute / 60;\n minute = minute % 60;\n };\n s = hour.ToString();\n string s1= minute.ToString();\n if (minute < 10)\n s = \"0\"+s;\n if (hour < 10)\n s1 = \"0\" +s1;\n Console.WriteLine(s+\":\"+s1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int start = int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n s = Console.ReadLine();\n int end= int.Parse(s.Substring(0, 2)) * 60 + int.Parse(s.Substring(3, 2));\n int middle = (end - start)/2;\n int hour = start / 60 + middle / 60;\n int minute = start % 60 + middle % 60 ;\n if (minute > 60)\n {\n hour += minute / 60;\n minute = minute % 60;\n };\n s = hour.ToString();\n string s1= minute.ToString();\n if (minute < 10)\n s1 = \"0\"+s1;\n if (hour < 10)\n s = \"0\" +s;\n Console.WriteLine(s+\":\"+s1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int h1 = int.Parse(s.Substring(0, 2));\n int m1 = int.Parse(s.Substring(3, 2));\n s = Console.ReadLine();\n int h2 = int.Parse(s.Substring(0, 2));\n int m2 = int.Parse(s.Substring(3, 2));\n int dh = h2 - h1;\n int dm = m2 - m1;\n dm += dh * 60;\n dm /= 2;\n dh = dm / 60;\n dm = dm % 60;\n h1 += dh;\n m1 += dm;\n \n Console.WriteLine($\"{h1/10}{h1%10}:{m1/10}{m1%10}\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n if(( start[0] + end[0] ) % 2 == 0)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n\n else\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] +60)%60 / 2 );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n if(( start[0] + end[0] ) % 2 == 0)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n\n else\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] +60) / 2 );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n if(( start[0] + end[0] ) % 2 == 0)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n\n else\n if(start[1]+end[1]<60)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] )%60 / 2 );\n else\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2 +1, ( start[1] + end[1] -60) % 60 / 2 );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n var start=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n var end=Array.ConvertAll( Console.ReadLine().Split( ':' ),Convert.ToInt32);\n if(( start[0] + end[0] ) % 2 == 0)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n\n else\n if(start[1]+end[1]<60)\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2, ( start[1] + end[1] ) / 2 );\n else\n Console.WriteLine( \"{0:00}\" + \":\" + \"{1:00}\", ( start[0] + end[0] ) / 2 +1, ( start[1] + end[1] -60) / 2 );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _544\n{\n class Program\n {\n static void Main(string[] args)\n\n\n {\n string a, b;\n int h1, h2, m1, m2, sum_h, sum_m;\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 hh:mm\");\n a = Console.ReadLine();\n h1 = Convert.ToInt32(a.Substring(0, a.Length - 3));\n m1 = Convert.ToInt32(a.Substring(3));\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 hh:mm\");\n b = Console.ReadLine();\n h2 = Convert.ToInt32(b.Substring(0, b.Length - 3));\n m2 = Convert.ToInt32(b.Substring(3));\n if ((h1 == h2) || (h2 - h1 == 1)) sum_h = h1;\n else sum_h = (h1 + h2) / 2;\n if (m1 == 0 && m2 == 0) sum_m = 30;\n else if (m1 == m2) sum_m = m1;\n else sum_m = (m1 + m2) / 2;\n Console.WriteLine(\"\u0412\u0440\u0435\u043c\u044f \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430:\");\n if (sum_h < 10) Console.Write('0');\n Console.Write(sum_h);\n Console.Write(':');\n if (sum_m < 10) Console.Write('0');\n Console.Write(sum_m);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _544\n{\n class Program\n {\n static void Main(string[] args)\n\n\n {\n string a, b;\n int h1, h2, m1, m2, sum_h, sum_m;\n a = Console.ReadLine();\n h1 = Convert.ToInt32(a.Substring(0, a.Length - 3));\n m1 = Convert.ToInt32(a.Substring(3));\n b = Console.ReadLine();\n h2 = Convert.ToInt32(b.Substring(0, b.Length - 3));\n m2 = Convert.ToInt32(b.Substring(3));\n if ((h1 == h2) || (h2 - h1 == 1)) sum_h = h1;\n else sum_h = (h1 + h2) / 2;\n if (m1 == 0 && m2 == 0) sum_m = 30;\n else if (m1 == m2) sum_m = m1;\n else sum_m = (m1 + m2) / 2;\n if (sum_h < 10) Console.Write('0');\n Console.Write(sum_h);\n Console.Write(':');\n if (sum_m < 10) Console.Write('0');\n Console.Write(sum_m);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _544\n{\n class Program\n {\n static void Main(string[] args)\n\n\n {\n string a, b;\n int h1, h2, m1, m2, sum_h, sum_m;\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 hh:mm\");\n a = Console.ReadLine();\n h1 = Convert.ToInt32(a.Substring(0, a.Length - 3));\n m1 = Convert.ToInt32(a.Substring(3));\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 hh:mm\");\n b = Console.ReadLine();\n h2 = Convert.ToInt32(b.Substring(0, b.Length - 3));\n m2 = Convert.ToInt32(b.Substring(3));\n if ((h1 == h2) || (h2 - h1 == 1)) sum_h = h1;\n else sum_h = (h1 + h2) / 2;\n if (m1 == 0 && m2 == 0) sum_m = 30;\n else if (m1 == m2) sum_m = m1;\n else sum_m = (m1 + m2) / 2;\n Console.WriteLine(\"\u0412\u0440\u0435\u043c\u044f \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u0441\u0442\u0430:\");\n if (sum_h < 10) Console.Write('0');\n Console.Write(sum_h);\n Console.Write(':');\n if (sum_m < 10) Console.Write('0');\n Console.Write(sum_m);\n }\n }\n}\n"}, {"source_code": "using System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Solution {\n static void Main(string[] args) { \n\t\tvar arr = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), Convert.ToInt32);\n var h1 = arr[0];\n var m1 = arr[1];\n arr = Array.ConvertAll(Console.ReadLine().Trim().Split(':'), Convert.ToInt32);\n var h2 = arr[0];\n var m2 = arr[1];\n\n var tm = h1*60+h2*60+m1+m2;\n tm = tm /2;\n\n \n Console.WriteLine($\"{tm/60}:{tm%60}\"); \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace opDiv3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] time = Console.ReadLine().Split(new char[] {':'});\n int h1 = Convert.ToInt32(time[0]);\n int m1 = Convert.ToInt32(time[1]);\n\n string[] time2 = Console.ReadLine().Split(new char[] { ':' });\n int h2 = Convert.ToInt32(time2[0]);\n int m2 = Convert.ToInt32(time2[1]);\n\n double h3 = ((h2 - h1)/2.00)+h1;\n int m3 = ((m2 - m1) / 2) + m1;\n\n if (h3 % 1 != 0)\n {\n m3+=30;\n h3 = Math.Round(h3);\n }\n\n if(m3<0)\n {\n h3--;\n m3 *= -1;\n }\n\n if (m3 < 10 && h3 < 10) Console.WriteLine(\"0\" + h3 + \":\"+\"0\" + m3);\n else if (m3 < 10) Console.WriteLine(h3 + \":\" + \"0\" + m3);\n else if (h3 < 10) Console.WriteLine(\"0\"+h3 + \":\" + m3);\n else Console.WriteLine( h3 + \":\" + m3);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace opDiv3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] time = Console.ReadLine().Split(new char[] {':'});\n int h1 = Convert.ToInt32(time[0]);\n int m1 = Convert.ToInt32(time[1]);\n\n string[] time2 = Console.ReadLine().Split(new char[] { ':' });\n int h2 = Convert.ToInt32(time2[0]);\n int m2 = Convert.ToInt32(time2[1]);\n\n double h3 = ((h2 - h1)/2.0)+h1;\n int m3 = ((m2 - m1) / 2) + m1;\n\n if (h3 % 1 != 0)\n {\n m3+=30;\n h3 -=0.5;\n \n }\n\n if(m3<0)\n {\n h3--;\n m3 *= -1;\n }\n \n if (m3 < 10 && h3 < 10) Console.WriteLine(\"0\" + h3 + \":\"+\"0\" + m3);\n else if (m3 < 10) Console.WriteLine(h3 + \":\" + \"0\" + m3);\n else if (h3 < 10) Console.WriteLine(\"0\"+h3 + \":\" + m3);\n else Console.WriteLine( h3 + \":\" + m3);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace opDiv3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] time = Console.ReadLine().Split(new char[] {':'});\n int h1 = Convert.ToInt32(time[0]);\n int m1 = Convert.ToInt32(time[1]);\n\n string[] time2 = Console.ReadLine().Split(new char[] { ':' });\n int h2 = Convert.ToInt32(time2[0]);\n int m2 = Convert.ToInt32(time2[1]);\n\n double h3 = ((h2 - h1)/2.0)+h1;\n int m3 = ((m2 - m1) / 2) + m1;\n\n if (h3 % 1 != 0)\n {\n m3+=30;\n h3 -=0.5;\n \n }\n\n if (m3 > 60)\n {\n m3 -= 60;\n h3++;\n }\n\n if(m3<0)\n {\n h3--;\n m3 *= -1;\n }\n \n if (m3 < 10 && h3 < 10) Console.WriteLine(\"0\" + h3 + \":\"+\"0\" + m3);\n else if (m3 < 10) Console.WriteLine(h3 + \":\" + \"0\" + m3);\n else if (h3 < 10) Console.WriteLine(\"0\"+h3 + \":\" + m3);\n else Console.WriteLine( h3 + \":\" + m3);\n }\n }\n}\n"}, {"source_code": "//using MetadataExtractor;\n//using MetadataExtractor.Formats.Exif;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n /*public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }*/\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n class Coord\n {\n public int x;\n public int y;\n public double d;\n }\n\n\n public static double dist(int x1,int y1,int x2,int y2)\n {\n int dx = x2 - x1;\n int dy = y2 - y1;\n\n return Math.Sqrt(dx * dx + dy * dy);\n\n }\n static void Main(string[] args)\n {\n\t\t\tvar t1 = ReadLine().Split(':').Select(x=>Convert.ToInt32(x)).ToArray();\n\t\t\tvar t2 = ReadLine().Split(':').Select(x=>Convert.ToInt32(x)).ToArray();\n\t\t\t\n\t\t\tint m1 = t1[0]*60+t1[1];\n\t\t\tint m2 = t2[0]*60+t2[1];\n\t\t\t\n\t\t\tint mid = m1+ (m2-m1)/2;\n\t\t\t\n\t\t\tPrintLn(mid/60+\":\"+mid%60);\n\t\t\t\n }\n\n\n\n }\n\n\n\n\n}"}], "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50"} {"source_code": "\ufeff// using a C# contest template, relevant code is at the bottom in the Run() function\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemA {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static bool isLocal = Type.GetType(\"HaitaoLocal\") != null;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (isLocal) {\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ri { get { return RI(); } }\n static string rs { get { return RS(); } }\n static long rl { get { return RL(); } }\n static double rd { get { return RD(); } }\n static int RI() {\n return Int32.Parse(NextToken());\n }\n static string RS() {\n return NextToken();\n }\n static long RL() {\n return Int64.Parse(NextToken());\n }\n static double RD() {\n return Double.Parse(NextToken());\n }\n static int[] RIA(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RI();\n }\n return ret;\n }\n static string[] RSA(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RS();\n }\n return ret;\n }\n static long[] RLA(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RL();\n }\n return ret;\n }\n static double[] RDA(int length) {\n double[] ret = new double[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RD();\n }\n return ret;\n }\n static StringBuilder outputBuilder;\n static CultureInfo outputCulture = new CultureInfo(\"en-US\");\n static void Out(object obj) {\n Type type = obj.GetType();\n string str = obj.ToString();\n if (type == typeof(double) || type == typeof(float)) {\n str = ((double)obj).ToString(outputCulture);\n }\n outputBuilder.Append(str + \" \");\n }\n static void Outl() {\n Outl(\"\");\n }\n static void Outl(object obj) {\n Out(obj);\n outputBuilder.Append(\"\\n\");\n }\n static void Flush() {\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n outputBuilder = new StringBuilder();\n }\n static void Log(string label, object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.Write(label + \": \");\n Console.ForegroundColor = t;\n Log(obj);\n }\n static void Log(object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.White;\n Console.WriteLine(ToStringRecursive(obj));\n Console.ForegroundColor = t;\n }\n static string ToStringRecursive(object obj) {\n StringBuilder sb = new StringBuilder();\n if (!(obj is string) && (obj is System.Collections.IEnumerable)) {\n System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;\n sb.Append(\"{\");\n bool first = true;\n foreach (object el in en) {\n if (!first) sb.Append(\", \");\n sb.Append(ToStringRecursive(el));\n first = false;\n }\n sb.Append(\"}\");\n return sb.ToString();\n }\n return obj.ToString();\n }\n\n public static void Main(string[] args) {\n long startTick = 0;\n if (isLocal) {\n startTick = Environment.TickCount;\n fileReader = new StreamReader(inputFileName);\n }\n\n outputBuilder = new StringBuilder();\n Run();\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.WriteLine();\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n\n if (isLocal) {\n long runTime = Environment.TickCount - startTick;\n if (runTime > 32) {\n Log(\"time\", runTime);\n Log(\"\");\n }\n }\n }\n\n\n\n static void Run() {\n int N = ri;\n int ans = 0;\n if (N % 2 == 1) ans = N / 2;\n else if (N > 2) {\n int p = 2;\n while (p * 2 <= N) p *= 2;\n ans = (N - p) / 2;\n }\n Outl(ans);\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Collective_Mindsets__easy_\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n\n writer.WriteLine(n%2 == 0 ? Calc(n) : (n - 1)/2);\n writer.Flush();\n }\n\n private static int Calc(int n)\n {\n int k = 1;\n while (2*k <= n)\n {\n k <<= 1;\n }\n return (n - k)/2;\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeff// using a C# contest template, relevant code is at the bottom in the Run() function\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemA {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static bool isLocal = Type.GetType(\"HaitaoLocal\") != null;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (isLocal) {\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ri { get { return RI(); } }\n static string rs { get { return RS(); } }\n static long rl { get { return RL(); } }\n static double rd { get { return RD(); } }\n static int RI() {\n return Int32.Parse(NextToken());\n }\n static string RS() {\n return NextToken();\n }\n static long RL() {\n return Int64.Parse(NextToken());\n }\n static double RD() {\n return Double.Parse(NextToken());\n }\n static int[] RIA(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RI();\n }\n return ret;\n }\n static string[] RSA(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RS();\n }\n return ret;\n }\n static long[] RLA(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RL();\n }\n return ret;\n }\n static double[] RDA(int length) {\n double[] ret = new double[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RD();\n }\n return ret;\n }\n static StringBuilder outputBuilder;\n static CultureInfo outputCulture = new CultureInfo(\"en-US\");\n static void Out(object obj) {\n Type type = obj.GetType();\n string str = obj.ToString();\n if (type == typeof(double) || type == typeof(float)) {\n str = ((double)obj).ToString(outputCulture);\n }\n outputBuilder.Append(str + \" \");\n }\n static void Outl() {\n Outl(\"\");\n }\n static void Outl(object obj) {\n Out(obj);\n outputBuilder.Append(\"\\n\");\n }\n static void Flush() {\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n outputBuilder = new StringBuilder();\n }\n static void Log(string label, object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.Write(label + \": \");\n Console.ForegroundColor = t;\n Log(obj);\n }\n static void Log(object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.White;\n Console.WriteLine(ToStringRecursive(obj));\n Console.ForegroundColor = t;\n }\n static string ToStringRecursive(object obj) {\n StringBuilder sb = new StringBuilder();\n if (!(obj is string) && (obj is System.Collections.IEnumerable)) {\n System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;\n sb.Append(\"{\");\n bool first = true;\n foreach (object el in en) {\n if (!first) sb.Append(\", \");\n sb.Append(ToStringRecursive(el));\n first = false;\n }\n sb.Append(\"}\");\n return sb.ToString();\n }\n return obj.ToString();\n }\n\n public static void Main(string[] args) {\n long startTick = 0;\n if (isLocal) {\n startTick = Environment.TickCount;\n fileReader = new StreamReader(inputFileName);\n }\n\n outputBuilder = new StringBuilder();\n Run();\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.WriteLine();\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n\n if (isLocal) {\n long runTime = Environment.TickCount - startTick;\n if (runTime > 32) {\n Log(\"time\", runTime);\n Log(\"\");\n }\n }\n }\n\n\n\n static void Run() {\n int N = ri;\n int ans = 0;\n if (N % 2 == 1) ans = N / 2;\n else if (N > 2) {\n int p = 2;\n while (p * 2 < N) p *= 2;\n ans = (N - p) / 2;\n }\n Outl(ans);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Collective_Mindsets__easy_\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n\n writer.WriteLine((n + 1)/2 - 1);\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Collective_Mindsets__easy_\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n\n writer.WriteLine(n%2 == 0 ? 0 : (n + 1)/2 - 1);\n writer.Flush();\n }\n }\n}"}], "src_uid": "422abdf2f705c069e540d4f5c09a4948"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Web.Script.Serialization;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n long h1 = ReadInt();\n long h2 = ReadInt();\n long a = ReadInt();\n long b = ReadInt();\n\n h1 += 8 * a;\n\n if (a <= b && h1 < h2)\n {\n Console.Write(-1);\n return;\n }\n\n if (a <= b)\n {\n Console.Write(0);\n return;\n }\n\n\n long d1 = (h2 - h1);\n long d2 = (12 * (a - b));\n\n long days = Math.Max(0, (d1 + d2 - 1) / d2);\n\n Console.Write(days);\n }\n\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'A' || ans > 'Z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while (ans >= 'A' && ans <= 'Z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}", "positive_code": [{"source_code": "using System;\n\nnamespace _652A\n{\n class Program\n {\n static void Main()\n {\n var s1 = Console.ReadLine().Split();\n var h1 = int.Parse(s1[0]);\n var h2 = int.Parse(s1[1]);\n var h = h1;\n var s2 = Console.ReadLine().Split();\n var a = int.Parse(s2[0]);\n var b = int.Parse(s2[1]);\n var days = 0;\n while(true)\n { \n h += 8 * a;\n if (h >= h2) break;\n days++;\n h -= 12 * b;\n h += 4 * a; \n if (h <= h1) { days = -1; break; }\n \n }\n Console.WriteLine(days);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8 * upSpeed)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n else if (downSpeed == upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8 * upSpeed)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int day = 0;\n int startPosition;\n int currentPosition;\n int applePosition;\n int upSpeed;\n int downSpeed;\n byte hour = 14;\n string input = Console.ReadLine();\n startPosition = int.Parse(input.Split(' ')[0]);\n applePosition = int.Parse(input.Split(' ')[1]);\n currentPosition = startPosition;\n input = Console.ReadLine();\n upSpeed = int.Parse(input.Split(' ')[0]);\n downSpeed = int.Parse(input.Split(' ')[1]);\n bool flag = upSpeed <= downSpeed;\n while (true)\n {\n if (hour >= 10 && hour < 22)\n {\n currentPosition += upSpeed;\n }\n else\n {\n currentPosition -= downSpeed;\n }\n if (currentPosition >= applePosition)\n {\n break;\n }\n if (hour == 24)\n {\n if (flag)\n {\n day = -1;\n break;\n }\n hour = 0;\n day++;\n \n }\n hour++;\n }\n Console.WriteLine(day.ToString());\n // Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t//int n = int.Parse(Console.ReadLine());\n\t\t\tstring num = Console.ReadLine();\n\t\t\tstring[] numArr = num.Split(null);\n\t\t\tint h1 = int.Parse(numArr[0]);\n\t\t\tint h2 = int.Parse(numArr[1]);\n\n\t\t\tnum = Console.ReadLine();\n\t\t\tnumArr = num.Split(null);\n\t\t\tint a = int.Parse(numArr[0]);\n\t\t\tint b = int.Parse(numArr[1]);\n\t\t\tint diff = (a - b) * 12;\n\t\t\th1 = h1 + (a * 8);\n\t\t\tint ans = 0;\n\t\t\tif (h1 >= h2)\n\t\t\t{\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t\telse if (a <= b)\n\t\t\t{\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tans = (h2 - h1) / diff;\n\t\t\t\tans += ((h2 - h1) % diff == 0) ? 0 : 1;\n\t\t\t}\n\n\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\nusing E = System.Linq.Enumerable;\n\nnamespace ProbA {\n class Program {\n protected IOHelper io;\n\n public Program(string inputFile, string outputFile) {\n io = new IOHelper(inputFile, outputFile, Encoding.Default);\n\n int h1 = io.NextInt(), h2 = io.NextInt();\n int a = io.NextInt(), b = io.NextInt();\n int days = 0, lastday = h1;\n while (h1 < h2) {\n h1 += 8 * a;\n if (h1 >= h2) break;\n h1 -= 12 * b;\n ++days;\n h1 += 4 * a;\n if (h1 >= h2) break;\n if (lastday >= h1) break;\n }\n if (lastday >= h1) io.WriteLine(-1);\n else io.WriteLine(days);\n io.Dispose();\n }\n\n static void Main(string[] args) {\n Program myProgram = new Program(null, null);\n }\n }\n\n class IOHelper : IDisposable {\n public StreamReader reader;\n public StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding) {\n if (inputFile == null)\n reader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n reader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n writer = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n writer = new StreamWriter(outputFile, false, encoding);\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public bool hasNext() {\n if (curTokenIdx >= curLine.Length) {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n return curTokenIdx < curLine.Length;\n }\n\n public string NextToken() {\n return hasNext() ? curLine[curTokenIdx++] : null;\n }\n\n public int NextInt() {\n return int.Parse(NextToken());\n }\n\n public double NextDouble() {\n string tkn = NextToken();\n return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);\n }\n\n public void Write(double val, int precision) {\n writer.Write(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void Write(object stringToWrite) {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(double val, int precision) {\n writer.WriteLine(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void WriteLine(object stringToWrite) {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose() {\n try {\n if (reader != null) {\n reader.Dispose();\n }\n if (writer != null) {\n writer.Flush();\n writer.Dispose();\n }\n } catch { };\n }\n\n\n public void Flush() {\n if (writer != null) {\n writer.Flush();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\nclass Program\n{\nstatic void Main(string[] args)\n{\nint day = 0;\nint startPosition;\nint currentPosition;\nint applePosition;\nint upSpeed;\nint downSpeed;\nbyte hour = 14;\nstring input = Console.ReadLine();\nstartPosition = int.Parse(input.Split(' ')[0]);\napplePosition = int.Parse(input.Split(' ')[1]);\ncurrentPosition = startPosition;\ninput = Console.ReadLine();\nupSpeed = int.Parse(input.Split(' ')[0]);\ndownSpeed = int.Parse(input.Split(' ')[1]);\nbool flag = upSpeed <= downSpeed;\nwhile (true)\n{\nif (hour >= 10 && hour < 22)\n{\ncurrentPosition += upSpeed;\n}\nelse\n{\ncurrentPosition -= downSpeed;\n}\nif (currentPosition >= applePosition)\n{\nbreak;\n}\nif (hour == 24)\n{\nif (flag)\n{\nday = -1;\nbreak;\n}\nhour = 0;\nday++;\n}\nhour++;\n}\nConsole.WriteLine(day.ToString());\n}\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring[] h = Console.ReadLine().Split(null);\n\t\t\tint h1 = int.Parse(h[0]);\n\t\t\tint h2 = int.Parse(h[1]);\n\n\t\t\th = Console.ReadLine().Split(null);\n\t\t\tint a = int.Parse(h[0]);\n\t\t\tint b = int.Parse(h[1]);\n\n\t\t\th1 = h1 - 4 * a;\n\n\t\t\tint increase = 12 * a;\n\t\t\tint decrease = 12 * b;\n\n\t\t\tif(h2-h1 <= increase)\n\t\t\t{\n\t\t\t\tConsole.Write(\"0\");\n\t\t\t}\n\t\t\telse if (decrease >= increase)\n\t\t\t{\n\t\t\t\tConsole.Write(\"-1\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint days = 0;\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\th1 = h1 + increase;\n\t\t\t\t\tif (h1 >= h2)\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\th1 = h1 - decrease;\n\t\t\t\t\tdays++;\n\t\t\t\t}\n\n\t\t\t\tConsole.Write(days);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Gabriel_and_Caterpillar\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int h1 = Next(), h2 = Next(), a = Next(), b = Next();\n\n int delta = h2 - 8*a - h1;\n if (delta <= 0)\n writer.WriteLine(\"0\");\n else\n {\n if (a <= b)\n writer.WriteLine(\"-1\");\n else\n {\n writer.WriteLine(1 + (delta-1)/(12*(a - b)));\n }\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _10a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var h1 = d[0];\n var h2 = d[1];\n\n d = readIntArray();\n var a = d[0];\n var b = d[1];\n var up = (22 - 14 + 14 - 10) * a;\n var down = (10 + 2) * b;\n\n //var diff = h2 - h1;\n //if (diff <= 8 * a)\n //{\n // Console.WriteLine(0);\n // return;\n //}\n\n var dc = 0;\n var pos = h1 + 8 * a;\n while (true)\n {\n if (pos >= h2)\n {\n Console.WriteLine(dc);\n return;\n }\n\n if (12 * a <= 12 * b)\n {\n Console.WriteLine(-1);\n return;\n }\n\n pos -= 12 * b;\n pos += 12 * a;\n dc++;\n }\n\n //if (down >= up)\n //{\n // Console.WriteLine(-1);\n // return;\n //}\n\n //var di = up - down;\n //var count = diff / di;\n //var rem = diff % di;\n //if (rem <= 8 * a)\n //{\n // Console.WriteLine(count);\n // return;\n //}\n //else\n //{\n // Console.WriteLine(count + 1);\n // return;\n //}\n\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass PS\n{\n\n static void Main(String[] args) {\n Console.WriteLine(solve());\n }\n\n static int solve() {\n var tmp = Console.ReadLine().Split(' ');\n int h1 = int.Parse(tmp[0]);\n int h2 = int.Parse(tmp[1]);\n\n tmp = Console.ReadLine().Split(' ');\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n\n h1 += 8 * a;\n if (h1 >= h2) return 0;\n if (b >= a) return -1;\n h1 -= 12 * b;\n\n int d = 1;\n while (h1 < h2) {\n h1 += 12 * a;\n if (h1 >= h2) return d;\n d++;\n h1 -= 12 * b;\n }\n return d;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out) {\n\t\t\t\ttask.Solve(1, sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(int testNumber, InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar h1 = input[0];\n\t\t\tvar h2 = input[1];\n\t\t\tinput = sr.ReadArray(Int64.Parse);\n\t\t\tvar a = input[0];\n\t\t\tvar b = input[1];\n\t\t\tconst int count = 8;\n\t\t\tif (a * count + h1 >= h2) {\n\t\t\t\tsw.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (a <= b) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t}\n\t\t\th1 += a * count;\n\t\t\tvar day = 1;\n\t\t\tfor (var i = 0; i < 100001; i++,day++) {\n\t\t\t\th1 -= b * 12;\n\t\t\t\th1 += a * 12;\n\t\t\t\tif (h1 >= h2) {\n\t\t\t\t\tsw.WriteLine(day);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class InputReader : IDisposable\n\t{\n\t\tprivate bool isDispose;\n\t\tprivate readonly TextReader sr;\n\n\t\tpublic InputReader(TextReader stream)\n\t\t{\n\t\t\tsr = stream;\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tDispose(true);\n\t\t\tGC.SuppressFinalize(this);\n\t\t}\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tvar result = sr.ReadLine();\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int NextInt32()\n\t\t{\n\t\t\treturn Int32.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextInt64()\n\t\t{\n\t\t\treturn Int64.Parse(NextString());\n\t\t}\n\n\t\tpublic string[] NextSplitStrings()\n\t\t{\n\t\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t}\n\n\t\tpublic T[] ReadArray(Func func)\n\t\t{\n\t\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t\t}\n\n\t\tpublic T[] ReadArrayFromString(Func func, string str)\n\t\t{\n\t\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t.ToArray();\n\t\t}\n\n\t\tprotected void Dispose(bool dispose)\n\t\t{\n\t\t\tif (!isDispose) {\n\t\t\t\tif (dispose)\n\t\t\t\t\tsr.Close();\n\t\t\t\tisDispose = true;\n\t\t\t}\n\t\t}\n\n\t\t~InputReader()\n\t\t{\n\t\t\tDispose(false);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void SetTwo(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Main()\n {\n long h1;\n long h2;\n SetTwo(out h1, out h2);\n\n long a;\n long b;\n SetTwo(out a, out b);\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n Print(BinarySearchGe(1, 100000, h2, f));\n }\n\n private static long BinarySearchGe(long low, long high, long goal, Func f)\n {\n if (f(high) < goal)\n {\n return -1;\n }\n\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return low;\n }\n\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 >= h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u <= d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace;\n float num = (float)Math.Ceiling(hDif / dif);\n Console.WriteLine(num);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Main()\n {\n long h1;\n long h2;\n ReadLine(out h1, out h2);\n\n long a;\n long b;\n ReadLine(out a, out b);\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n Print(BinarySearchGe(1, 100000, h2, f));\n }\n\n private static long BinarySearchGe(long low, long high, long goal, Func f)\n {\n if (f(high) < goal)\n {\n return -1;\n }\n\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return low;\n }\n\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n var result = BinarySearch(1, 100000, h2, f);\n\n Print(result);\n\n //for (var i = 1; ; i++)\n //{\n // if (h2 <= h1 + a8 + (a12 - b12) * i)\n // {\n // Print(i);\n // return;\n // }\n //}\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n if (goal < f(low)) return low;\n if (goal < f(high)) return high;\n return -1;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n Print(BinarySearchGe(1, 100000, h2, f));\n }\n\n private static long BinarySearchGe(long low, long high, long goal, Func f)\n {\n if (f(high) < goal)\n {\n return -1;\n }\n\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return low;\n }\n\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n Print(BinarySearchGe(1, 100000, h2, f));\n }\n\n private static long BinarySearchGe(long low, long high, long goal, Func f)\n {\n if (f(high) < goal)\n {\n return -1;\n }\n\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return low;\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Gabriel\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string tmp = Console.ReadLine();\n string[] tmp1 = tmp.Split(' ');\n int[] heights = Array.ConvertAll(tmp1, int.Parse);\n string grow = Console.ReadLine();\n string[] shrink = grow.Split(' ');\n int[] gs = Array.ConvertAll(shrink, int.Parse);\n int h1 = heights[0];\n int h2 = heights[1];\n\n int h = h1;\n\n int days = 0;\n int a = gs[0];\n int b = gs[1];\n while (true) \n {\n h += 8 * a;\n if (h >= h2) break;\n days++;\n h -= 12 * b;\n h += 4 * a;\n if (h <= h1) { days = -1; break; }\n \n\n }\n Console.WriteLine(days);\n\n \n \n\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int h1 = ReadInt();\n int h2 = ReadInt();\n int a = ReadInt();\n int b = ReadInt();\n\n h1 += a * 8;\n if (h1 >= h2)\n {\n Write(0);\n return;\n }\n\n if (b >= a)\n {\n Write(-1);\n return;\n }\n\n Write((h2 - h1 - 1) / (12 * (a - b)) + 1);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\n\npublic static class P\n{\n public static void Main()\n {\n var h = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var h1 = h[0];\n var h2 = h[1];\n var ab = Console.ReadLine().Split().Select(long.Parse).ToArray();\n h1 += ab[0] * 8;\n if (h2 <= h1)\n {\n Console.WriteLine(0);\n return;\n }\n if (ab[0] <= ab[1])\n {\n Console.WriteLine(-1);\n return;\n }\n int day = 1;\n while (true)\n {\n h1 -= ab[1] * 12;\n h1 += ab[0] * 12;\n if (h2 <= h1)\n {\n Console.WriteLine(day);\n return;\n }\n day++;\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Capellitar\n{\n\tstatic void Main()\n\t{\n\t\tstring[] tmp = Console.ReadLine().Split();\n\t\tuint h1 = uint.Parse( tmp[0] );\n\t\tuint h2 = uint.Parse( tmp[1] );\n\t\ttmp = Console.ReadLine().Split();\n\t\tuint a = uint.Parse( tmp[0] );\n\t\tuint b = uint.Parse( tmp[1] );\n\t\tif( b >= a && (h1+a*8) < h2 )\n\t\t\tConsole.WriteLine( -1 );\n\t\telse {\n\t\t\tuint days = 0;\n\t\t\th1 += 8*a;\n\t\t\twhile( !(h1 >= h2) )\n\t\t\t{\n\t\t\t\th1 -= 12*b;\n\t\t\t\th1 += 12*a;\n\t\t\t\tdays++;\n\t\t\t}\n\t\t\tConsole.WriteLine( days );\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tstring[] Temp;\n\t\t\tint h1, h2, a, b;\n\n\t\t\tTemp = Console.ReadLine ().Split (' ');\n\t\t\th1 = int.Parse (Temp [0]);\n\t\t\th2 = int.Parse (Temp [1]);\n\t\t\tTemp = Console.ReadLine ().Split (' ');\n\t\t\ta = int.Parse (Temp [0]);\n\t\t\tb = int.Parse (Temp [1]);\n\n\t\t\tbool itCant = false;\n\t\t\tint lasth1 = h1;\n\n\t\t\tint Days = 0;\n\t\t\th1 -= a * 4;\n\n\t\t\twhile (h1 < h2) {\n\t\t\t\t//8\n\n\t\t\t\th1 += a * 12;\n\t\t\t\tif (h1 >= h2)\n\t\t\t\t\tbreak;\n\n\t\t\t\t//12\n\t\t\t\th1 -= b * 8;\n\t\t\t\tif (lasth1 >= h1) {\n\n\t\t\t\t\titCant = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\th1 -= b * 4;\n\n\t\t\t\tDays++;\n\t\t\t}\n\n\t\t\tif (itCant)\n\t\t\t\tConsole.WriteLine (\"-1\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (Days);\n\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int h1, h2,a,b;\n sc.Make(out h1, out h2, out a, out b);\n var d = h2 - h1;\n if (d <= a * 8) Fail(0);\n if (a <= b) Fail(-1);\n WriteLine((d - a * 8+(a-b)*12-1) / ((a - b) * 12));\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n public static T[] Shuffle(this IList A) { T[] rt = A.ToArray(); Random rnd = new Random(); for (int i = rt.Length - 1; i >= 1; i--) swap(ref rt[i], ref rt[rnd.Next(i + 1)]); return rt; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed >= upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8 * upSpeed)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n //else if (downSpeed == upSpeed)\n //{\n // if ((heightApple - heightCaterpillar) <= 8 * upSpeed)\n // {\n // daysPass = 0;\n // break;\n // }\n // else\n // {\n // daysPass = -1;\n // break;\n // }\n //}\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program pr = new Program();\n pr.test();\n }\n void test()\n {\n \n string Stroka_1 = Console.ReadLine();\n \n string Stroka_2 = Console.ReadLine();\n int H1, H2, h1, i = 0, our = 14, a = 0, b = 0, day = 0;\n string[] str1 = Stroka_1.Split(' ');\n string[] str2 = Stroka_2.Split(' '); \n H1 = int.Parse(str1[i]);\n i++; \n H2 = int.Parse(str1[i]); \n i = 0;\n a = int.Parse(str2[i]);\n i++;\n b = int.Parse(str2[i]);\n \n h1 = H1;\n while (true)\n {\n while (our != 22)\n {\n h1 += a;\n if (h1 >= H2)\n {\n Console.Write(day);\n \n return;\n }\n else our++;\n }\n day++;\n while (our != 10)\n {\n h1 -= b;\n our--;\n }\n if ((h1 + 4 * a) <= H1)\n {\n Console.Write(\"-1\");\n \n return;\n } \n }\n } \n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\n\npublic static class P\n{\n public static void Main()\n {\n var h = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var h1 = h[0];\n var h2 = h[1];\n var ab = Console.ReadLine().Split().Select(long.Parse).ToArray();\n h1 += ab[0] * 8;\n if (h2 <= h1)\n {\n Console.WriteLine(0);\n return;\n }\n if (ab[0] <= ab[1])\n {\n Console.WriteLine(-1);\n return;\n }\n int day = 1;\n while (true)\n {\n h1 -= ab[1] * 10;\n h1 += ab[0] * 10;\n if (h2 <= h1)\n {\n Console.WriteLine(day);\n return;\n }\n day++;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if ((upSpeed == 1) && (heightApple - heightCaterpillar) > 8 || (heightApple - heightCaterpillar) < downSpeed)\n {\n daysPass = -1;\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 3;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n Console.WriteLine(\"Looping\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime <= 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n // Console.WriteLine(\"Looping\" + wormPos);\n if ((((downSpeed > upSpeed) || upSpeed == 1 && downSpeed == 1) && (heightApple - heightCaterpillar) > 8))\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if (upSpeed == 1 && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n if (downSpeed > upSpeed)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n }\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed)\n {\n daysPass = -1;\n break;\n }\n else if (downSpeed == upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if (upSpeed == 1 && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if ((upSpeed == 1) && (heightApple - heightCaterpillar) > 8 || downSpeed > heightApple || downSpeed > (heightApple - heightCaterpillar))\n {\n daysPass = -1;\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed)\n {\n daysPass = -1;\n Console.WriteLine(daysPass + \" Breaked\");\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n // Console.WriteLine(\"Looping\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n // Console.WriteLine(\"Looping\" + wormPos);\n if ((downSpeed > upSpeed || (heightApple - heightCaterpillar) > 8))\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if ((upSpeed == 1) && (heightApple - heightCaterpillar) > 8 || (heightApple - heightCaterpillar) > downSpeed)\n {\n daysPass = -1;\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n else if (downSpeed == upSpeed)\n {\n if ((heightApple - heightCaterpillar) <= 8)\n {\n daysPass = 0;\n break;\n }\n else\n {\n daysPass = -1;\n break;\n }\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if (upSpeed == 1 && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n\n if ((upSpeed == 1) && (heightApple - heightCaterpillar) > 8 || downSpeed > heightApple)\n {\n daysPass = -1;\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec <= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n //Console.WriteLine(\"Looping\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime <= 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n Console.WriteLine(wormPos + \" pos\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 3;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed && (heightApple - heightCaterpillar) > 8)\n {\n daysPass = -1;\n //Console.WriteLine(daysPass + \" Breaked\");\n break;\n // return;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n // Console.WriteLine(\"Looping\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n\n string[] tokens = Console.ReadLine().Split();\n string[] tokens2 = Console.ReadLine().Split();\n\n int htCtr = int.Parse(tokens[0]);\n\n //Parse element 1\n int htApple = int.Parse(tokens[1]);\n\n int up = int.Parse(tokens2[0]);\n\n //Parse element 1\n int down = int.Parse(tokens2[1]);\n\n p.Ankush(htCtr, htApple, up, down);\n // p.Ankush(12, 120, 5, 3);\n }\n\n public void Ankush(int heightCaterpillar, int heightApple, int upSpeed, int downSpeed)\n {\n int wormPos = heightCaterpillar;\n\n int daytime = 4;\n int nightDec = 0;\n int daysPass = 0;\n\n while (wormPos < heightApple)\n {\n if (downSpeed > upSpeed)\n {\n daysPass = -1;\n // Console.WriteLine(daysPass + \" Breaked\");\n break;\n }\n\n if (daytime < 12)\n {\n wormPos += upSpeed;\n daytime++;\n }\n else\n {\n nightDec++;\n wormPos -= downSpeed;\n if (nightDec >= 12)\n {\n nightDec = 0;\n daytime = 0;\n daysPass++;\n }\n }\n // Console.WriteLine(\"Looping\");\n\n }\n\n Console.WriteLine(daysPass);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tpublic class Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t//int n = int.Parse(Console.ReadLine());\n\t\t\tstring num = Console.ReadLine();\n\t\t\tstring[] numArr = num.Split(null);\n\t\t\tint h1 = int.Parse(numArr[0]);\n\t\t\tint h2 = int.Parse(numArr[1]);\n\n\t\t\tnum = Console.ReadLine();\n\t\t\tnumArr = num.Split(null);\n\t\t\tint a = int.Parse(numArr[0]);\n\t\t\tint b = int.Parse(numArr[1]);\n\t\t\tint diff = (a - b) * 12;\n\t\t\th1 = h1 + (a * 8);\n\t\t\tint ans = 0;\n\t\t\tif (h1 > h2)\n\t\t\t{\n\t\t\t\tans = 0;\n\t\t\t}\n\t\t\telse if (a <= b)\n\t\t\t{\n\t\t\t\tans = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tans = (h2 - h1) / diff;\n\t\t\t\tans += ((h2 - h1) % diff == 0) ? 0 : 1;\n\t\t\t}\n\n\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Gabriel_and_Caterpillar\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int h1 = Next(), h2 = Next(), a = Next(), b = Next();\n\n int delta = h2 - 8*a - h1;\n if (delta <= 0)\n writer.WriteLine(\"0\");\n else\n {\n if (a <= b)\n writer.WriteLine(\"-1\");\n else\n {\n writer.WriteLine(1 + delta/(12*(a - b)));\n }\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n var result = BinarySearch(1, 100000, h2, f);\n\n Print(result);\n\n //for (var i = 1; ; i++)\n //{\n // if (h2 <= h1 + a8 + (a12 - b12) * i)\n // {\n // Print(i);\n // return;\n // }\n //}\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return low;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n //ReadLine(out h1, out h2);\n\n long a, b;\n //ReadLine(out a, out b);\n\n h1 = 0;\n h2 = 28;\n a = 2;\n b = 1;\n\n h1 += 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a <= b)\n {\n Print(-1);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - h1) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n h1 = h1 + 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n h1 += -12 * b;\n\n for (long i = 1; ; i++)\n {\n h1 += 12 * (a - b);\n if (h2 <= h1 + 12 * a)\n {\n if (h2 <= h1 + 12 - b)\n Print(i );\n else\n Print(i-1);\n return;\n }\n }\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n h1 += 8 * a;\n Print((h2 - h1) / d + 1);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n h1 = h1 + 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n h1 += -12 * b;\n\n for (long i = 1; ; i++)\n {\n h1 += 12 * (a - b);\n if (h2 <= h1 + 12 * a)\n {\n Print(i);\n return;\n }\n }\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n h1 -= 4 * a;\n\n if (a <= b && 12 * a + h1 < h2)\n {\n Print(-1);\n return;\n }\n\n if (a <= b)\n {\n Print(0);\n return;\n }\n\n var d1 = h2 - h1 - 12 * a;\n var d2 = 12 * (a - b);\n\n Print((d1 + d2 - 1) / d2);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n h1 += 8 * a;\n Print((h2 - h1) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var h = (22 - 14) * a + h1;\n\n var firsth = h;\n\n if (h2 <= h)\n {\n Print(0);\n return;\n }\n h = h - 12 * b;\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n for (long i = 1; i < long.MaxValue; i++)\n {\n h = h + 12 * a;\n if (h2 <= h)\n {\n Print(i);\n return;\n }\n h = h - 12 * b;\n\n if (h <= firsth)\n {\n Print(-1);\n return;\n }\n }\n\n Console.ReadKey();\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n Print(BinarySearchGt(1, 100000, h2, f));\n }\n\n private static long BinarySearchGt(long low, long high, long goal, Func f)\n {\n if (f(high) <= goal)\n {\n return -1;\n }\n\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid + 1;\n }\n }\n\n return low;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n h1 += 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var b2 = 12 * b;\n\n h1 += -b2;\n\n var a2 = 12 * a;\n\n for (var i = 1; ; i += 2)\n {\n h1 += a2;\n if (h2 <= h1)\n {\n h1 = h1 - a2 + b2;\n if (h2 <= h1)\n {\n Print(i - 1);\n }\n else\n {\n Print(i);\n }\n return;\n }\n h1 -= b2;\n }\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n Func f = i => h1 + a8 + (a12 - b12) * i;\n\n var result = BinarySearch(1, 100000, h2, f);\n\n Print(result);\n\n //for (var i = 1; ; i++)\n //{\n // if (h2 <= h1 + a8 + (a12 - b12) * i)\n // {\n // Print(i);\n // return;\n // }\n //}\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return goal < f(low) ? low : high;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - (h1 + 8 * a + 1) + d) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - (h1 + 8 * a) + d) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n h1 += 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a <= b)\n {\n Print(-1);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - h1) / d + 1);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n //h1 = 10;\n //h2 = 13;\n //a = 1;\n //b = 1;\n\n h1 += 8 * a;\n\n if (h2 <= h1)\n {\n Print(0);\n return;\n }\n\n if (a <= b)\n {\n Print(-1);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - h1) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n Print(1 + (h2 - (h1 + 8 * a + 1)) / (12 * (a - b)));\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - h1 - 8 * a + d - 1) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n var d = 12 * (a - b);\n\n Print((h2 - (h1 + 8 * a - 1) + d) / d);\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var h1 = xs[0];\n var h2 = xs[1];\n\n xs = Console.ReadLine().Split().Select(int.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n\n var a8 = 8 * a;\n\n if (h2 <= h1 + a8)\n {\n Print(0);\n return;\n }\n\n if (a < b)\n {\n Print(-1);\n return;\n }\n\n var a12 = 12 * a;\n var b12 = 12 * b;\n\n for (var i = 1; ; i++)\n {\n if (h2 <= h1 + a8 + (a12 + b12) * i)\n {\n Print(i);\n return;\n }\n }\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return -1;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n long h1, h2;\n ReadLine(out h1, out h2);\n\n long a, b;\n ReadLine(out a, out b);\n\n if (a <= b)\n {\n Print(8 * a + h1 < h2 ? -1 : 0);\n return;\n }\n\n Print(1 + (h2 - (h1 + 8 * a)) / 12 * (a - b));\n }\n\n private static void ReadLine(out long a, out long b)\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n a = xs[0];\n b = xs[1];\n }\n\n private static void Print(long x)\n {\n Console.WriteLine(x.ToString(CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Gabriel\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string tmp = Console.ReadLine();\n string[] tmp1 = tmp.Split(' ');\n int[] heights = Array.ConvertAll(tmp1, int.Parse);\n string grow = Console.ReadLine();\n string[] shrink = grow.Split(' ');\n int[] gs = Array.ConvertAll(shrink, int.Parse);\n int h1 = heights[0];\n int h2 = heights[1];\n\n int h = h1;\n\n int days = 0;\n int a = gs[0];\n int b = gs[1];\n while (true) \n {\n h += 8 * a;\n if (h >= h2) break;\n days++;\n h -= 12 * b;\n h += 4 * a;\n if (h <= h1) days = -1; break;\n \n\n }\n Console.WriteLine(days);\n\n \n \n\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace; \n if(Math.Floor(hDif / dif) == float.PositiveInfinity)\n {\n Console.WriteLine(-1);\n return;\n }\n float num = hDif / dif;\n if (Math.Floor(num) == (num))\n {\n num--;\n }\n Console.WriteLine(Math.Floor(hDif / dif)+1);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace; \n Console.WriteLine(Math.Floor(hDif / dif)+1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace; \n if(Math.Floor(hDif / dif) == float.PositiveInfinity)\n {\n Console.WriteLine(-1);\n return;\n }\n float num = hDif / dif;\n if (Math.Floor(num) == (num))\n {\n num--;\n }\n Console.WriteLine(Math.Floor(num)+1);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace; \n if(Math.Floor(hDif / dif) == float.PositiveInfinity)\n {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(Math.Floor(hDif / dif)+1);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace;\n if (Math.Floor(hDif / dif) == float.PositiveInfinity)\n {\n Console.WriteLine(-1);\n return;\n }\n float num = hDif / dif;\n if (Math.Floor(num) != (num))\n {\n num = (float)Math.Floor(num) + 1;\n }\n Console.WriteLine(num);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u <= d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d *= 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace;\n float num = (float)Math.Ceiling(hDif / dif);\n Console.WriteLine(num);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_652A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h1, h2, u, d;\n string[] tempStr = Console.ReadLine().Split(' ');\n h1 = int.Parse(tempStr[0]);\n h2 = int.Parse(tempStr[1]);\n tempStr = Console.ReadLine().Split(' ');\n u = int.Parse(tempStr[0]);\n d = int.Parse(tempStr[1]);\n int curentCatPlace = h1;\n if(8*u + h1 > h2)\n {\n Console.WriteLine(0);\n return;\n }\n else\n {\n if (u < d)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n curentCatPlace += 8 * u;\n d += 12;\n u *= 12;\n float dif = u - d;\n float hDif = h2 - curentCatPlace; \n Console.WriteLine(Math.Floor(hDif / dif)+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\nusing E = System.Linq.Enumerable;\n\nnamespace ProbA {\n class Program {\n protected IOHelper io;\n\n public Program(string inputFile, string outputFile) {\n io = new IOHelper(inputFile, outputFile, Encoding.Default);\n\n int h1 = io.NextInt(), h2 = io.NextInt();\n int a = io.NextInt(), b = io.NextInt();\n int days = 0, lastday = h1;\n while (h1 < h2) {\n h1 += 8 * a;\n if (h1 >= h2) break;\n h1 -= 12 * b;\n h1 += 4 * a;\n if (h1 >= h2) break;\n ++days;\n if (lastday >= h1) break;\n }\n if (lastday >= h1) io.WriteLine(-1);\n else io.WriteLine(days);\n io.Dispose();\n }\n\n static void Main(string[] args) {\n Program myProgram = new Program(null, null);\n }\n }\n\n class IOHelper : IDisposable {\n public StreamReader reader;\n public StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding) {\n if (inputFile == null)\n reader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n reader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n writer = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n writer = new StreamWriter(outputFile, false, encoding);\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public bool hasNext() {\n if (curTokenIdx >= curLine.Length) {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n return curTokenIdx < curLine.Length;\n }\n\n public string NextToken() {\n return hasNext() ? curLine[curTokenIdx++] : null;\n }\n\n public int NextInt() {\n return int.Parse(NextToken());\n }\n\n public double NextDouble() {\n string tkn = NextToken();\n return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);\n }\n\n public void Write(double val, int precision) {\n writer.Write(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void Write(object stringToWrite) {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(double val, int precision) {\n writer.WriteLine(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void WriteLine(object stringToWrite) {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose() {\n try {\n if (reader != null) {\n reader.Dispose();\n }\n if (writer != null) {\n writer.Flush();\n writer.Dispose();\n }\n } catch { };\n }\n\n\n public void Flush() {\n if (writer != null) {\n writer.Flush();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Web.Script.Serialization;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n long h1 = ReadInt();\n long h2 = ReadInt();\n long a = ReadInt();\n long b = ReadInt();\n\n h1 -= 4 * a;\n\n if (a <= b && (12 * a + h1) < h2)\n {\n Console.Write(-1);\n return;\n }\n\n if (a <= b)\n {\n Console.Write(0);\n return;\n }\n\n\n long d1 = (h2 - h1 - 12 * a);\n long d2 = (12 * (a - b));\n\n long days = (d1 + d2 - 1) / d2;\n\n Console.Write(days);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'A' || ans > 'Z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while (ans >= 'A' && ans <= 'Z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Web.Script.Serialization;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n long h1 = ReadInt();\n long h2 = ReadInt();\n long a = ReadInt();\n long b = ReadInt();\n\n h1 -= 4 * a;\n\n if (a <= b && (12 * a + h1) < h2)\n {\n Console.Write(-1);\n return;\n }\n\n if (a <= b)\n {\n Console.Write(0);\n return;\n }\n\n\n long d1 = (h2 - h1);\n long d2 = (12 * (a - b));\n\n long days = (d1 + d2 - 1) / d2;\n\n Console.Write(days);\n }\n\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'A' || ans > 'Z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while (ans >= 'A' && ans <= 'Z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Web.Script.Serialization;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n long h1 = ReadInt();\n long h2 = ReadInt();\n long a = ReadInt();\n long b = ReadInt();\n\n h1 += 8 * a;\n\n if (a <= b && h1 < h2)\n {\n Console.Write(-1);\n return;\n }\n\n if (a <= b)\n {\n Console.Write(0);\n return;\n }\n\n\n long d1 = (h2 - h1);\n long d2 = (12 * (a - b));\n\n long days = (d1 + d2 - 1) / d2;\n\n Console.Write(days);\n }\n\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'A' || ans > 'Z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while (ans >= 'A' && ans <= 'Z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}], "src_uid": "2c39638f07c3d789ba4c323a205487d7"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(long power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n long m = Convert.ToInt64(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n sw.WriteLine(count % 1000000007);\n }\n\n sw.Flush();\n }\n\n static long CalCount(string s, string[] fStrings, long num)\n {\n if (num < 10)\n return ContainCount(s, fStrings[num]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n List result = new List();\n int index = 0;\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n int count = ContainCount(s, fStrings[i]);\n if (count > 1)\n {\n if(index == 0)\n index = i;\n\n result.Add(count);\n }\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n if(result.Count == 0)\n return 0;\n\n index -= 2;\n Matrix power = Matrix.PowerMod(num - index + 1, m, 1000000007);\n\n if (result[0] == 2)\n {\n if (result[1] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (num - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n if (p.Length > s.Length) return 0;\n int k = -1, count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(long power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n long m = Convert.ToInt64(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n sw.WriteLine(count % 1000000007);\n }\n\n sw.Flush();\n }\n\n static long CalCount(string s, string[] fStrings, long num)\n {\n if (num < 10)\n return ContainCount(s, fStrings[num]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n List result = new List();\n int index = 0;\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n int count = ContainCount(s, fStrings[i]);\n if (count > 1)\n {\n if(index == 0)\n index = i;\n\n result.Add(count);\n }\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n if(result.Count == 0)\n return 0;\n\n index -= 2;\n Matrix power = Matrix.PowerMod(num - index + 1, m, 1000000007);\n\n if (result[0] == 2)\n {\n if (result[1] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (num - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n if (p.Length > s.Length) return 0;\n int k = -1, count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(long power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n long m = Convert.ToInt64(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n sw.WriteLine(count % 1000000007);\n }\n\n sw.Flush();\n }\n\n static long CalCount(string s, string[] fStrings, long num)\n {\n if (num < 10)\n return ContainCount(s, fStrings[num]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n List result = new List();\n int index = 0;\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n int count = ContainCount(s, fStrings[i]);\n if (count > 1)\n {\n if(index == 0)\n index = i;\n\n result.Add(count);\n }\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n if(result.Count == 0)\n return 0;\n\n index -= 2;\n Matrix power = Matrix.PowerMod(num - index + 1, m, 1000000007);\n\n if (result[0] == 2)\n {\n if (result[1] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (num - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n if (p.Length > s.Length) return 0;\n int k = -1, count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n }\n }\n\n static long CalCount(string s, string[] fStrings, int f)\n {\n if (f < 16)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n List result = new List();\n int index = 0;\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n int count = ContainCount(s, fStrings[i]);\n if (count > 1)\n {\n if(index == 0)\n index = i;\n\n result.Add(count);\n }\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n if(result.Count == 0)\n return 0;\n \n index--;\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (result[0] == 2)\n {\n if (result[1] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n if (p.Length > s.Length) return 0;\n int k = -1, count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n }\n }\n\n static long CalCount(string s, string[] fStrings, int f)\n {\n if (f < 16)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n int[] result = new int[fStrings.Length];\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n if (fStrings[i].Length > s.Length)\n result[i] = ContainCount(s, fStrings[i]);\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n int index = -1;\n\n for (int i = 0; i < result.Length; i++)\n {\n if (result[i] > 1)\n {\n index = i;\n break;\n }\n }\n\n if (index < 0)\n return 0;\n \n index--;\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (result[index + 1] == 2)\n {\n if (result[index + 2] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n int k = -1;\n int count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public Int64 A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(Int64 mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, Int64 mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n Int64 count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n }\n }\n\n static Int64 CalCount(string s, string[] fStrings, int f)\n {\n if (f < fStrings.Length)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n int[] result = new int[fStrings.Length];\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n if (fStrings[i].Length > s.Length)\n result[i] = ContainCount(s, fStrings[i]);\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n int index = Array.LastIndexOf(result, 1);\n\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (index < 0)\n return -1;\n else if (result[index + 1] == 2)\n {\n if (result[index + 2] == 3)\n return power.A2;\n else\n return power.A2 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n int k = -1;\n int count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n }\n } \n\n static long CalCount(string s, string[] fStrings, int f)\n {\n if (f < 20)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n int[] result = new int[fStrings.Length];\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n if (fStrings[i].Length > s.Length)\n result[i] = ContainCount(s, fStrings[i]);\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n int index = Array.LastIndexOf(result, 1);\n\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (index < 0)\n return 0;\n else if (result[index + 1] == 2)\n {\n if (result[index + 2] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n int k = -1;\n int count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n }\n }\n\n static long CalCount(string s, string[] fStrings, int f)\n {\n if (f < 16)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n int[] result = new int[fStrings.Length];\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n if (fStrings[i].Length > s.Length)\n result[i] = ContainCount(s, fStrings[i]);\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n int index = Array.IndexOf(result, 1);\n if (index < 0)\n return 0;\n\n if (result[index + 1] == 1)\n index++;\n\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (result[index + 1] == 2)\n {\n if (result[index + 2] == 3)\n return power.A2;\n else\n return power.A1 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n int k = -1;\n int count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n struct Matrix\n {\n public long A1, A2, A3, A4;\n\n public static Matrix Mul(Matrix m1, Matrix m2)\n {\n Matrix result = new Matrix();\n result.A1 = m1.A1 * m2.A1 + m1.A2 * m2.A3;\n result.A2 = m1.A1 * m2.A2 + m1.A2 * m2.A4;\n result.A3 = m1.A3 * m2.A1 + m1.A4 * m2.A3;\n result.A4 = m1.A3 * m2.A2 + m1.A4 * m2.A4;\n return result;\n }\n\n public void Mod(long mod)\n {\n A1 %= mod; A2 %= mod; A3 %= mod; A4 %= mod;\n }\n\n public static Matrix PowerMod(int power, Matrix m, long mod)\n {\n Matrix modLast = m, result = new Matrix();\n\n while (power != 0)\n {\n if ((power & 1) == 1)\n {\n if (result.A1 == 0)\n result = modLast;\n else\n result = Matrix.Mul(result, modLast);\n\n result.Mod(mod);\n }\n\n modLast = Matrix.Mul(modLast, modLast);\n modLast.Mod(mod);\n power >>= 1;\n }\n\n return result;\n }\n }\n\n static void Main(string[] args)\n {\n string[] fStrings = new string[31];\n fStrings[0] = \"a\"; fStrings[1] = \"b\";\n\n for (int i = 2; i < fStrings.Length; i++)\n fStrings[i] = fStrings[i - 1] + fStrings[i - 2];\n\n string[] inputStr = Console.ReadLine().Split(' ');\n int m = Convert.ToInt32(inputStr[0]);\n int n = Convert.ToInt32(inputStr[1]);\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n long count = CalCount(s, fStrings, m - 1);\n Console.WriteLine(count % 1000000007);\n } \n }\n\n static long CalCount(string s, string[] fStrings, int f)\n {\n if (f < fStrings.Length)\n return ContainCount(s, fStrings[f]);\n\n Matrix m = new Matrix { A1 = 1, A2 = 1, A3 = 1, A4 = 0 };\n int[] result = new int[fStrings.Length];\n\n for (int i = 0; i < fStrings.Length; i++)\n {\n if (fStrings[i].Length > s.Length)\n result[i] = ContainCount(s, fStrings[i]);\n\n if (fStrings[i].Length > s.Length * 10)\n break;\n }\n\n int index = Array.LastIndexOf(result, 1);\n\n Matrix power = Matrix.PowerMod(f - index + 1, m, 1000000007);\n\n if (index < 0)\n return -1;\n else if (result[index + 1] == 2)\n {\n if (result[index + 2] == 3)\n return power.A2;\n else\n return power.A2 - 1;\n }\n else\n return power.A1 - (f - index) % 2;\n }\n\n static int ContainCount(string p, string s)\n {\n int k = -1;\n int count = 0;\n\n while (true)\n {\n k = s.IndexOf(p, k + 1);\n if (k == -1) break;\n count++;\n }\n\n return count;\n }\n }\n}\n"}], "src_uid": "8983915e904ba763d893d56e94d9f7f0"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kfactorization\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n\n List factors = new List();\n\n int p = 2;\n\n while (n>1 && factors.Count 1) factors.Add(n);\n\n if (factors.Count==k)\n {\n foreach (var factor in factors)\n {\n Console.Write(\"{0} \", factor);\n }\n }\n else\n {\n Console.Write(-1);\n }\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n \n public void Solve(Scanner sc)\n {\n int N, K;\n sc.Make(out N, out K);\n var f = Factorize(N);\n var res = new List();\n var rest = 1L;\n foreach(var e in f)\n {\n var a = e.Value;\n while (res.Count != K-1&&a>0)\n {\n res.Add(e.Key);a--;\n }\n rest *= (long)Pow(e.Key, a);\n }\n if (rest == 1) Fail(-1);\n res.Add(rest);\n Console.WriteLine(string.Join(\" \", res));\n }\n\n public static Dictionary Factorize(long num)\n {\n var dic = new Dictionary();\n for (var i = 2L; i * i <= num; i++)\n {\n var ct = 0;\n while (num % i == 0)\n {\n ct++;\n num /= i;\n }\n if (ct != 0) dic[i] = ct;\n }\n if (num != 1) dic[num] = 1;\n return dic;\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace ed19a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadIntArray();\n var n = d[0];\n var k = d[1];\n var res = new int[k];\n var ri = 0;\n for (int i = 2; i <= Math.Sqrt(n) + 1; i++)\n {\n if (ri == k)\n {\n break;\n }\n\n if (n % i != 0)\n {\n continue;\n }\n\n while (n % i == 0)\n {\n if (ri == k)\n {\n break;\n //res[0] *= i;\n }\n else\n {\n res[ri] = i;\n ri++;\n }\n \n n /= i;\n }\n }\n\n if (n != 1)\n {\n if (ri < k)\n {\n res[ri] = n;\n ri++;\n }\n else\n {\n res[0] *= n;\n }\n }\n\n if (ri != k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(string.Join(\" \", res));\n }\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n \n int n = int.Parse(token[0]);\n int k = int.Parse(token[1]);\n \n int ans = -1;\n List l = new List();\n int iv =2;\n int nval = n;\n \n if(k==1)\n {\n Console.WriteLine(n);\n return;\n }\n \n while(iv=k-1)\n {\n if(nval!=1)\n l.Add(nval);\n break;\n }\n }\n \n if(l.Count int.Parse(s)).ToArray();\n List primeNumbers = new List();\n var number = input[0];\n var factors = input[1];\n\n for (int b = 2; number > 1; b++)\n {\n if (number % b == 0)\n {\n while (number % b == 0)\n {\n number /= b;\n primeNumbers.Add(b);\n }\n }\n }\n\n if (primeNumbers.Count() < factors)\n {\n Console.WriteLine(-1);\n }\n else\n {\n StringBuilder message = new StringBuilder();\n for (int i = 0; i < factors - 1; i++)\n {\n message.Append(primeNumbers[0] + \" \");\n primeNumbers.RemoveAt(0);\n }\n message.Append(primeNumbers.Aggregate(1, (accum, current) => accum * current));\n Console.WriteLine(message.ToString());\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF3\n{\n class Program\n {\n public static int SmallDiv(int n)\n {\n int div = 1;\n for (int i = 2; i <= n/2; i++)\n if (n % i == 0)\n {\n div = i;\n break;\n }\n\n return (div == 1) ? n : div;\n }\n\n static void Main(string[] args)\n {\n string[] a = Console.ReadLine().Split(' ');\n int n = int.Parse(a[0]);\n int k = int.Parse(a[1]);\n string s = \"\";\n int div;\n\n for (int i = 0; i < k; i++)\n {\n div = SmallDiv(n);\n if(i < k - 1 && div == n)\n {\n s = \"-1\";\n break;\n }\n s += (i != k - 1) ? div : n;\n s += \" \";\n n /= div;\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar list = new List();\n\n\t\t\tint i = 2;\n\t\t\tint copy = n;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (copy % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tcopy /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (copy > 1) \n\t\t\t{\n\t\t\t\tlist.Add(copy);\n\t\t\t}\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace k_Factorization\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var list = new List(k);\n int i = 2;\n while (n > 1 && list.Count < k - 1)\n {\n if (n%i == 0)\n {\n list.Add(i);\n n /= i;\n }\n else\n {\n if (i == 2)\n i = 3;\n else i += 2;\n }\n }\n\n if (n > 1)\n list.Add(n);\n\n if (list.Count == k)\n {\n foreach (int i1 in list)\n {\n writer.Write(i1);\n writer.Write(' ');\n }\n }\n else\n {\n writer.WriteLine(\"-1\");\n }\n\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _797A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]), k = int.Parse(input[1]);\n List factors = new List();\n for (int div = 2; div <= n; div++)\n {\n while (n % div == 0)\n {\n factors.Add(div);\n n /= div;\n }\n }\n if (k > factors.Count)\n Console.WriteLine(\"-1\");\n else\n {\n var newFactors = new int[k];\n for (int i = 0; i < k; i++)\n newFactors[i] = factors[i];\n for (int i = k; i < factors.Count; i++)\n newFactors[k - 1] *= factors[i];\n Console.WriteLine(string.Join(\" \", newFactors));\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeff\ufeffusing System.Globalization;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar factorize = Factorize(n);\n\t\t\tif (factorize.Sum(item => item.Value) < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar count = 0;\n\t\t\tvar result = new List();\n\t\t\tforeach (var item in factorize) {\n\t\t\t\tfor (var i = 0; i < item.Value; i++) {\n\t\t\t\t\tif (result.Count == k) {\n\t\t\t\t\t\tresult[result.Count - 1] *= item.Key;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult.Add(item.Key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar sb = new StringBuilder();\n\t\t\tforeach (var item in result) {\n\t\t\t\tsb.Append(item + \" \");\n\t\t\t}\n\n\t\t\tsw.Write(sb);\n\t\t}\n\n\t\tprivate Dictionary Factorize(int n)\n\t\t{\n\t\t\tvar result = new Dictionary();\n\t\t\tvar initN = n;\n\t\t\tfor (var i = 2; i <= initN; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tvar count = 0;\n\t\t\t\t\twhile (n % i == 0) {\n\t\t\t\t\t\tn /= i;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t\tresult.Add(i, count);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int k = Convert.ToInt32(s[1]);\n if(k==1){Console.WriteLine(n);return;}\n List l = new List();\n int t=n;\n for (int i = 2; i < n; )\n {\n if (t % i == 0) {l.Add(i);t/=i;}\n else\n i++;\n }\n if (l.Count >= k)\n {\n long a = 1;\n for (int i = 0; i < l.Count-k+1; i++)\n {\n a *= l[i];\n }\n Console.Write(a+\" \");\n for (int i = l.Count-k+1; i ();\n for (int x = 2; x * x <= n; x++)\n {\n while (n % x == 0)\n {\n ls.Add(x);\n n /= x;\n }\n }\n\n if (n != 1) ls.Add(n);\n\n if (ls.Count < k)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n int[] ans = new int[k];\n for (int i = 0; i < k; i++)\n {\n ans[i] = ls[i];\n }\n\n for (int i = k; i < ls.Count; i++)\n {\n ans[0] *= ls[i];\n }\n\n Console.WriteLine(string.Join(\" \", ans));\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] A = new int[30];\n int pr = 1, j = 2, sz = 1;\n string[] a = Console.ReadLine().Split(' ');\n int n = int.Parse(a[0]);\n int k = int.Parse(a[1]);\n \n for (int i = 1; i < k && n > 1; i++) {\n\n while (n % j != 0) {\n j++;\n }\n n /= j;\n A[sz++] = j;\n }\n\n if (n > 1)\n {\n A[sz++] = n;\n for (int i = 1; i < sz; i++)\n {\n Console.Write(A[i]);\n Console.Write(' ');\n }\n }\n else\n {\n Console.Write(-1);\n }\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public decimal a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = decimal.Parse(q[0]);\n b = decimal.Parse(q[1]);\n }\n public PairVariable(decimal a, decimal b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n bool[] p = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n if (!p[i])\n {\n for (int e = i + i; e <= n; e+=i)\n {\n p[e] = true;\n }\n }\n }\n int k = 0;\n for (int i = 0; i < p.Length; i++)\n {\n if (!p[i])\n {\n k++;\n }\n }\n int[] arr = new int[k];\n k = 0;\n for (int i = 2; i < p.Length; i++)\n {\n if (!p[i])\n {\n arr[k] = i;\n k++;\n }\n }\n List r = new List();\n while (n != 1)\n {\n\n int t = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n if (n % arr[i] == 0)\n {\n t = arr[i];\n break;\n }\n }\n r.Add(t);\n n /= t;\n }\n /*for (int i = 0; i < r.Count; i++)\n {\n Console.WriteLine(r[i]);\n }*/\n if (m > r.Count)\n {\n Console.WriteLine(-1);\n\n }\n else\n {\n // Console.WriteLine(r.Count);\n int ans = 1;\n for (int i = 0; i < m-1; i++)\n {\n Console.Write(r[i]+\" \");\n }\n for (int i = m-1; i < r.Count; i++)\n {\n ans *= r[i];\n }\n Console.WriteLine(ans);\n }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tpublic const long MOD = 1000000007;\n\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tMain main = new Main();\n\t\t\t\tmain.ReadData();\n\t\t\t\tmain.Process();\n\t\t\t\tmain.WriteAnswer();\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tclass Main\n\t{\n\t\tprivate int _n;\n\t\tprivate int _k;\n\n\t\tprivate List _result = new List();\n\n\t\tpublic void Process()\n\t\t{\n\t\t\tList dividers = new List();\n\t\t\tint n = _n;\n\t\t\tfor (int i = 2; i <= _n; i++)\n\t\t\t{\n\t\t\t\twhile (n % i == 0)\n\t\t\t\t{\n\t\t\t\t\tdividers.Add(i);\n\t\t\t\t\tn = n / i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dividers.Count >= _k)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < _k -1; i++)\n\t\t\t\t{\n\t\t\t\t\t_result.Add(dividers[i]);\n\t\t\t\t}\n\t\t\t\tint prod = 1;\n\t\t\t\tfor (int i = _k-1; i < dividers.Count; i++)\n\t\t\t\t{\n\t\t\t\t\tprod *= dividers[i];\n\t\t\t\t}\n\t\t\t\t_result.Add(prod);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate long Nok(long x, long y)\n\t\t{\n\t\t\treturn x*y/Nod(x, y);\n\t\t}\n\t\tprivate long Nod(long x, long y)\n\t\t{\n\t\t\tlong max = Math.Max(x, y);\n\t\t\tlong min = Math.Min(x, y);\n\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tlong rem = max % min;\n\t\t\t\tif (rem == 0)\n\t\t\t\t{\n\t\t\t\t\treturn min;\n\t\t\t\t}\n\t\t\t\tmax = min;\n\t\t\t\tmin = rem;\n\t\t\t}\n\t\t}\n\n\t\tpublic void ReadData()\n\t\t{\n#if DEVELOPMENT\n\t\t\tTextReader textReader = new StreamReader(\"input.txt\");\n#else\n\t\t\tTextReader textReader = Console.In;\n#endif\n\t\t\tusing (TextReader reader = textReader)\n\t\t\t{\n\t\t\t\tstring readLine = reader.ReadLine();\n\t\t\t\tstring[] strings = readLine.Split(' ');\n\t\t\t\t_n = int.Parse(strings[0]);\n\t\t\t\t_k = int.Parse(strings[1]);\n\t\t\t}\n\t\t}\n\n\t\tpublic void WriteAnswer()\n\t\t{\n\t\t\tusing (TextWriter writer = Console.Out)\n\t\t\t{\n\t\t\t\tif (_result.Count == 0)\n\t\t\t\t{\n\t\t\t\t\twriter.WriteLine(-1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twriter.WriteLine(string.Join(\" \", _result));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Position\n\t{\n\t\tpublic int Row { get; set; }\n\t\tpublic int Place { get; set; }\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Configuration;\nusing System.Data;\nusing System.Diagnostics;\n\nnamespace testing\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n int j = 0;\n int k = 2;\n string ans = \"\";\n while (a > 1 && j < b - 1)\n {\n if (a % k == 0)\n {\n a /= k;\n j++;\n ans += k + \" \";\n }\n else\n {\n if (k == 2)\n {\n k = 3;\n }\n else\n {\n k += 2;\n }\n }\n }\n if (a == 1)\n {\n ans = \"-1\";\n }\n else\n {\n ans += a;\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp26\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int k = inp0[0];\n int n = inp0[1];\n List l = new List();\n for (int i = 0; i < n-1; i++)\n {\n for (int j = 2; j <= Math.Sqrt(k); j++)\n {\n if (k%j==0)\n {\n k /= j;\n l.Add(j);\n break;\n }\n }\n }\n if (l.Count < n - 1)\n {\n Console.WriteLine(-1);\n }\n else\n {\n foreach (int item in l)\n {\n Console.Write(item + \" \");\n\n }\n Console.Write(k);\n }\n }\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace K_Factorization\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int orign = int.Parse(input[0]), k = int.Parse(input[1]);\n int n = orign;\n int sum = 0, index = 2, mult = 1;\n string answer = \"\";\n while (sum + 1 < k && index <= Math.Sqrt(n))\n {\n if (n % index == 0 && IsPrime(index))\n {\n while (n % index == 0 && sum + 1 < k)\n {\n answer += index + \" \";\n n /= index;\n sum++;\n mult *= index;\n }\n }\n index++;\n }\n if (sum + 1 < k || mult == orign)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n answer += orign / mult;\n Console.WriteLine(answer);\n }\n static bool IsPrime(int x)\n {\n for (int i = 2; i <= Math.Sqrt(x); i++)\n if (x % i == 0)\n return false;\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static int[] readArray()\n {\n string[] s = Console.ReadLine().Split(' ');\n int len = s.Length;\n int[] data = new int[len];\n for (int i = 0; i < len; i++)\n {\n data[i] = int.Parse(s[i]);\n }\n return data;\n }\n static int readInt()\n {\n string s = Console.ReadLine();\n return int.Parse(s);\n }\n\n \n static void Main(string[] args)\n {\n int[] nk = readArray();\n int n = nk[0];\n int k = nk[1];\n\n List answer = new List();\n\n for(int i = 1; i < k; i++)\n {\n for(int j = 2; j * j <= n; j++)\n {\n if (n % j == 0)\n {\n answer.Add(j);\n n /= j;\n break;\n }\n }\n }\n\n if (n > 1)\n {\n answer.Add(n);\n }\n\n if (answer.Count == k)\n {\n foreach(int t in answer)\n {\n Console.Write(t + \" \");\n }\n }else\n {\n Console.Write(-1);\n }\n\n } \n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace K.Factorization\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n List primeNumbers = new List();\n var number = input[0];\n var factors = input[1];\n\n for (int b = 2; number > 1; b++)\n {\n if (number % b == 0)\n {\n while (number % b == 0)\n {\n number /= b;\n primeNumbers.Add(b);\n }\n }\n }\n\n if (primeNumbers.Count() < factors)\n Console.WriteLine(-1);\n else\n {\n StringBuilder message = new StringBuilder();\n for (int i = 0; i < factors - 1; i++)\n {\n message.Append(primeNumbers[0] + \" \");\n primeNumbers.RemoveAt(0);\n }\n message.Append(primeNumbers.Aggregate(1, (accum, current) => accum * current));\n Console.WriteLine(message.ToString());\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n class _797A\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n var divisors = new LinkedList();\n\n for (int i = 2; i <= n; i++)\n {\n while (n % i == 0)\n {\n divisors.AddLast(i);\n n /= i;\n }\n }\n\n while (divisors.Count > k)\n {\n int first = divisors.First.Value;\n divisors.RemoveFirst();\n\n int second = divisors.First.Value;\n divisors.RemoveFirst();\n\n divisors.AddFirst(first * second);\n }\n\n Console.WriteLine(divisors.Count < k ? \"-1\" : string.Join(\" \", divisors));\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace ed19a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadIntArray();\n var n = d[0];\n var k = d[1];\n var res = new int[k];\n var ri = 0;\n for (int i = 2; i <= Math.Sqrt(n) + 1; i++)\n {\n if (ri == k)\n {\n break;\n }\n\n if (n % i != 0)\n {\n continue;\n }\n\n while (n % i == 0)\n {\n if (ri == k)\n {\n break;\n //res[0] *= i;\n }\n else\n {\n res[ri] = i;\n ri++;\n }\n \n n /= i;\n }\n }\n\n if (n != 1)\n {\n res[0] *= n;\n }\n\n if (ri != k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(string.Join(\" \", res));\n }\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n \n int n = int.Parse(token[0]);\n int k = int.Parse(token[1]);\n \n int ans = -1;\n List l = new List();\n int iv =2;\n int nval = n;\n \n while(iv=k-1)\n {\n if(nval!=1)\n l.Add(nval);\n break;\n }\n }\n \n if(l.Count();\n\n\t\t\tint i = 2;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tn /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tlist.Add(n);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint k = inputs1[1];\n\t\t\tvar list = new List();\n\n\t\t\tint i = 2;\n\t\t\tint copy = n;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (copy % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tcopy /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tlist.Add(copy);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar list = new List();\n\n\t\t\tint i = 2;\n\t\t\tint copy = n;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (copy % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tcopy /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tlist.Add(copy);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar list = new List();\n\n\t\t\tint i = 2;\n\t\t\tint copy = n;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (copy % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tcopy /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist.Add(copy);\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input4.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar list = new List();\n\n\t\t\tint i = 2;\n\t\t\tint copy = n;\n\t\t\twhile (i <= Math.Sqrt(n))\n\t\t\t{\n\t\t\t\tif (copy % i == 0) \n\t\t\t\t{\n\t\t\t\t\tif (list.Count != k - 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tcopy /= i;\n\t\t\t\t\t\tlist.Add(i);\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tlist.Add(copy);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist.Add(copy);\n\n\t\t\tif (list.Count != k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tforeach (var item in list) \n\t\t\t\t{\n\t\t\t\t\tConsole.Write($\"{item} \");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int k = sc.NextInt();\n var ls = new List();\n for (int x = 2; x * x <= n; x++)\n {\n while (n % x == 0)\n {\n ls.Add(x);\n n /= x;\n }\n }\n\n if (ls.Count < k)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n int[] ans = new int[k];\n for (int i = 0; i < k; i++)\n {\n ans[i] = ls[i];\n }\n\n for (int i = k; i < ls.Count; i++)\n {\n ans[0] *= ls[i];\n }\n\n Console.WriteLine(string.Join(\" \", ans));\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kfactorization\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n\n List factors = new List();\n\n int p = 2;\n\n while (n>1)\n {\n if (n%p==0)\n {\n factors.Add(p);\n n /= p;\n if (factors.Count == k - 1) break;\n }\n else\n {\n p++;\n }\n }\n\n if (n > 1) factors.Add(n);\n\n if (factors.Count==k)\n {\n foreach (var factor in factors)\n {\n Console.Write(\"{0} \", factor);\n }\n }\n else\n {\n Console.Write(-1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeff\ufeffusing System.Globalization;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar factorize = Factorize(n);\n\t\t\tif (factorize.Count == 0) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (factorize.Sum(item => item.Value) < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar count = 0;\n\t\t\tvar result = new List();\n\t\t\tforeach (var item in factorize) {\n\t\t\t\tfor (var i = 0; i < item.Value; i++) {\n\t\t\t\t\tif (result.Count == k) {\n\t\t\t\t\t\tresult[result.Count - 1] *= item.Key;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult.Add(item.Key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar sb = new StringBuilder();\n\t\t\tforeach (var item in result) {\n\t\t\t\tsb.Append(item + \" \");\n\t\t\t}\n\n\t\t\tsw.Write(sb);\n\t\t}\n\n\t\tprivate Dictionary Factorize(int n)\n\t\t{\n\t\t\tvar result = new Dictionary();\n\t\t\tvar initN = n;\n\t\t\tfor (var i = 2; i < initN; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tvar count = 0;\n\t\t\t\t\twhile (n % i == 0) {\n\t\t\t\t\t\tn /= i;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t\tresult.Add(i, count);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeff\ufeffusing System.Globalization;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar factorize = Factorize(n);\n\t\t\tif (factorize.Count == 0) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (factorize.Sum(item => item.Value) < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar count = 0;\n\t\t\tvar result = new List();\n\t\t\tforeach (var item in factorize) {\n\t\t\t\tfor (var i = 0; i < item.Value; i++) {\n\t\t\t\t\tif (result.Count == k) {\n\t\t\t\t\t\tresult[result.Count - 1] *= item.Key;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult.Add(item.Key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar sb = new StringBuilder();\n\t\t\tforeach (var item in result) {\n\t\t\t\tsb.Append(item + \" \");\n\t\t\t}\n\n\t\t\tsw.Write(sb);\n\t\t}\n\n\t\tprivate Dictionary Factorize(int n)\n\t\t{\n\t\t\tvar mid = (int) Math.Sqrt(n);\n\t\t\tvar result = new Dictionary();\n\t\t\tfor (var i = 2; i <= mid; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tvar count = 0;\n\t\t\t\t\twhile (n % i == 0) {\n\t\t\t\t\t\tn /= i;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t\tresult.Add(i, count);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] A = new int[30];\n int pr = 1, j = 2, sz = 1;\n string[] a = Console.ReadLine().Split(' ');\n int n = int.Parse(a[0]);\n int k = int.Parse(a[1]);\n \n for (int i = 1; i < k; i++) {\n\n while (n % j != 0) {\n j++;\n }\n\n pr *= j;\n A[sz++] = j;\n }\n\n if (n / pr > 1)\n {\n A[sz++] = n / pr;\n for (int i = 1; i < sz; i++)\n {\n Console.Write(A[i]);\n Console.Write(' ');\n }\n }\n else\n {\n Console.Write(-1);\n }\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication254\n{\n class Program\n {\n\n static int sum = 1;\n static Dictionary> d = new Dictionary>();\n static int k = 0;\n static string ans = \"\";\n static void dfs(int v)\n {\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n ulong n = ulong.Parse(ss[0]);\n k = int.Parse(ss[1]);\n ulong del = 0;\n if (k == 1)\n {\n Console.WriteLine(n);\n return;\n }\n for (ulong i = 2; i <= n; i++)\n {\n if (n % i == 0)\n {\n del = i;\n break;\n }\n }\n ulong c = 0;\n bool ans = false;\n ulong f = (ulong)(Math.Pow(del, (k - 1)));\n \n for (ulong i = 2; i <= n; i++)\n {\n if (f * i == n)\n {\n c = i;\n ans = true;\n break;\n }\n }\n if (!ans)\n {\n Console.WriteLine(-1);\n return;\n }\n for (int i = 0; i < k-1; i++)\n {\n Console.Write(del+\" \");\n }\n Console.WriteLine(c);\n\n\n\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication254\n{\n class Program\n {\n\n static int sum = 1;\n static Dictionary> d = new Dictionary>();\n static int k = 0;\n static string ans = \"\";\n static void dfs(int v)\n {\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n k = int.Parse(ss[1]);\n int del = 0;\n if (k == 1)\n {\n Console.WriteLine(n);\n return;\n }\n for (int i = 2; i <= n; i++)\n {\n if (n % i == 0)\n {\n del = i;\n break;\n }\n }\n int c = 0;\n bool ans = false;\n int f = (int)(Math.Pow(del, (k - 1)));\n \n for (int i = 2; i <= n; i++)\n {\n if (f * i == n)\n {\n c = i;\n ans = true;\n break;\n }\n }\n if (!ans)\n {\n Console.WriteLine(-1);\n return;\n }\n for (int i = 0; i < k-1; i++)\n {\n Console.Write(del+\" \");\n }\n Console.WriteLine(c);\n\n\n\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Configuration;\nusing System.Data;\nusing System.Diagnostics;\n\nnamespace testing\n{\n class Program\n {\n static void Main(string[] args)\n { \n string[] input = Console.ReadLine().Split();\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n int j = 0;\n string ans = \"\";\n for (int i=0; i g;\n\n class Dsu\n {\n public readonly List parent;\n\n public Dsu(int n)\n {\n parent = Enumerable.Range(0, n).ToList();\n g = new List();\n for (int i = 0; i < n; i++)\n g.Add(new int[] { -1, -1 });\n }\n\n public int FindSet(int v)\n {\n if (v == parent[v])\n return v;\n return parent[v] = FindSet(parent[v]);\n }\n\n public void UnionSets(int a, int b)\n {\n a = FindSet(a);\n b = FindSet(b);\n if (a != b)\n {\n parent[a] = parent[b] = parent.Count;\n g.Add(new[] { a, b });\n parent.Add(parent.Count);\n }\n }\n }\n\n int[] c;\n int[] tree;\n\n int Cmp(int l, int r)\n {\n return c2[l] > c2[r] ? l : r;\n }\n\n void Build(int x, int xl, int xr)\n {\n if (xl == xr)\n {\n tree[x] = xl;\n return; \n }\n int xm = (xl + xr) / 2;\n Build(x * 2, xl, xm);\n Build(x * 2 + 1, xm + 1, xr);\n tree[x] = Cmp(tree[2 * x], tree[2 * x + 1]);\n }\n\n void Set(int x, int xl, int xr, int idx)\n {\n if (xl == xr)\n {\n c2[xl] = 0;\n return;\n }\n\n int xm = (xl + xr) / 2;\n if (idx <= xm)\n Set(x * 2, xl, xm, idx);\n else\n Set(x * 2 + 1, xm + 1, xr, idx);\n tree[x] = Cmp(tree[2 * x], tree[2 * x + 1]);\n }\n\n int Query(int x, int xl, int xr, int l, int r)\n {\n if (l == xl && r == xr)\n return tree[x];\n int xm = (xl + xr) / 2;\n if (r <= xm)\n return Query(x * 2, xl, xm, l, r);\n if (l > xm)\n return Query(x * 2 + 1, xm + 1, xr, l, r);\n return Cmp(Query(x * 2, xl, xm, l, xm), Query(x * 2 + 1, xm + 1, xr, xm + 1, r));\n }\n\n int n;\n bool[] vis;\n int[] tin, tout, c2;\n int timer;\n void Dfs(int x)\n {\n if (x < n)\n c2[timer] = c[x];\n vis[x] = true;\n tin[x] = timer++;\n foreach (int e in g[x])\n if (e != -1)\n Dfs(e);\n tout[x] = timer;\n }\n\n public void Solve()\n {\n n = ReadInt();\n int m = ReadInt();\n int q = ReadInt();\n c = ReadIntArray();\n var a = ReadIntMatrix(m);\n var b = ReadIntMatrix(q);\n\n //n = 200000;\n //m = 199999;\n //q = 500000;\n //c = new int[n];\n //var rnd = new Random(13);\n //for (int i = 0; i < n; i++)\n // c[i] = rnd.Next(n) + 1;\n //a = new int[m][];\n //for (int i = 0; i < m; i++)\n // a[i] = new[] { i + 1, i + 2 };\n //b = new int[q][];\n //int cnt = 1;\n //for (int i = 0; i < q; i++)\n //{\n // b[i] = new int[2];\n // b[i][0] = rnd.Next(2) + 1;\n // if (cnt > m)\n // b[i][0] = 1;\n // if (b[i][0] == 1)\n // {\n // b[i][1] = rnd.Next(n) + 1;\n // }\n // else\n // {\n // b[i][1] = cnt++;\n // }\n //}\n\n var f = new bool[m];\n for (int i = 0; i < q; i++)\n {\n b[i][1]--;\n if (b[i][0] == 2)\n f[b[i][1]] = true;\n }\n\n var dsu = new Dsu(n);\n for (int i = 0; i < m; i++)\n {\n a[i][0]--;\n a[i][1]--;\n if (!f[i])\n dsu.UnionSets(a[i][0], a[i][1]);\n }\n\n for (int i = q - 1; i >= 0; i--)\n {\n if (b[i][0] == 1)\n {\n b[i][1] = dsu.FindSet(b[i][1]);\n }\n else\n {\n dsu.UnionSets(a[b[i][1]][0], a[b[i][1]][1]);\n }\n }\n\n int n2 = dsu.parent.Count;\n tin = new int[n2];\n tout = new int[n2];\n vis = new bool[n2];\n c2 = new int[n2];\n for (int i = n2 - 1; i >= 0; i--)\n if (!vis[i])\n Dfs(i);\n\n tree = new int[4 * n2];\n Build(1, 0, n2 - 1);\n for (int i = 0; i < q; i++)\n if (b[i][0] == 1)\n {\n int x = Query(1, 0, n2 - 1, tin[b[i][1]], tout[b[i][1]] - 1);\n Write(c2[x]);\n Set(1, 0, n2 - 1, x);\n }\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //new Solver().Solve();\n var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n thread.Start();\n thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n var procTgtEdgeIndex = new bool[m];\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n procTgtEdgeIndex[i] = true;\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue();\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n var leftVs = new List();\n var rightVs = new List();\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Item2] || p != param[que.Peek.Item2]) que.Pop();\n else\n {\n used[que.Peek.Item2] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!procTgtEdgeIndex[item.param - 1]) continue;\n leftQ.Clear();\n rightQ.Clear();\n var color = param[leftV];\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n leftVs.Clear();\n rightVs.Clear();\n leftVs.Add(lv);\n rightVs.Add(rv);\n var procVs = leftVs;\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n if (color != param[v]) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n if (color != param[v]) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue();\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n if (!used[item2]) tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public (long, int) Peek => (heap[0], dat[0]);\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[16];\n dat = new int[16];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key <= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] < heap[i2]) i1 = i2;\n if (key >= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n var procTgtEdgeIndex = new bool[m];\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n procTgtEdgeIndex[i] = true;\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value] || p != param[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!procTgtEdgeIndex[item.param - 1]) continue;\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n var color = param[leftV];\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n var leftVs = new List();\n var rightVs = new List();\n leftVs.Add(lv);\n rightVs.Add(rv);\n var procVs = leftVs;\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n if (color != param[v]) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n if (color != param[v]) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n if (!used[item2]) tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public (long, int) Peek => (heap[0], dat[0]);\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[8];\n dat = new int[8];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key >= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] > heap[i2]) i1 = i2;\n if (key <= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[8];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n var procTgtEdgeIndex = new bool[m];\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n procTgtEdgeIndex[i] = true;\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n var leftVs = new List();\n var rightVs = new List();\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value] || p != param[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!procTgtEdgeIndex[item.param - 1]) continue;\n leftQ.Clear();\n rightQ.Clear();\n var color = param[leftV];\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n leftVs.Clear();\n rightVs.Clear();\n leftVs.Add(lv);\n rightVs.Add(rv);\n var procVs = leftVs;\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n if (color != param[v]) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n if (color != param[v]) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n if (!used[item2]) tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public (long, int) Peek => (heap[0], dat[0]);\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[16];\n dat = new int[16];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key <= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] < heap[i2]) i1 = i2;\n if (key >= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n var procTgtEdgeIndex = new bool[m];\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n procTgtEdgeIndex[i] = true;\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value] || p != param[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!procTgtEdgeIndex[item.param - 1]) continue;\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n var color = param[leftV];\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n var leftVs = new List();\n var rightVs = new List();\n leftVs.Add(lv);\n rightVs.Add(rv);\n var procVs = leftVs;\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n if (color != param[v]) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n if (color != param[v]) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n if (!used[item2]) tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public (long, int) Peek => (heap[0], dat[0]);\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[16];\n dat = new int[16];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key >= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] > heap[i2]) i1 = i2;\n if (key <= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.X;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.Y; }\n foreach (var item in y.List()) x.Add(item);\n return (rt, x);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = NN;\n var m = NN;\n var q = NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = NN - 1, b = NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = NN, param = NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new HashSet()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push(pList[i], i);\n }\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!graph[leftV].Contains(rightV)) continue;\n var leftQ = new Queue();\n var rightQ = new Queue();\n leftQ.Enqueue(leftV);\n rightQ.Enqueue(rightV);\n var color = param[leftV];\n var procV = leftV;\n var done = new bool[n];\n done[leftV] = true;\n done[rightV] = true;\n while (true)\n {\n if (leftQ.Count == 0) break;\n if (rightQ.Count == 0)\n {\n procV = rightV;\n break;\n }\n foreach (var item2 in graph[leftQ.Dequeue()])\n {\n if (done[item2]) continue;\n if (param[item2] != color) continue;\n done[item2] = true;\n leftQ.Enqueue(item2);\n }\n foreach (var item2 in graph[rightQ.Dequeue()])\n {\n if (done[item2]) continue;\n if (param[item2] != color) continue;\n done[item2] = true;\n rightQ.Enqueue(item2);\n }\n }\n var procColorFrom = param[procV];\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var procQ = new Queue();\n procQ.Enqueue(procV);\n done = new bool[n];\n done[leftV] = true;\n done[rightV] = true;\n tmpq.Push(pList[procV], (int)procV);\n param[procV] = procColorTo;\n while (procQ.Count > 0)\n {\n foreach (var item2 in graph[procQ.Dequeue()])\n {\n if (done[item2]) continue;\n if (param[item2] != procColorFrom) continue;\n if (!used[item2]) tmpq.Push(pList[item2], (int)item2);\n param[item2] = procColorTo;\n done[item2] = true;\n procQ.Enqueue(item2);\n }\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[16384];\n dat = new int[16384];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key >= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] > heap[i2]) i1 = i2;\n if (key <= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16384];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n foreach (var item in y.List()) x.Add(item);\n return x;\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (d[x] > d[y]) { var t = x; x = y; y = t; }\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n if (x != y)\n {\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = f(v[x], v[y]);\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y, (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = NN;\n var m = NN;\n var q = NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = NN - 1, b = NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = NN, param = NN }).ToArray();\n var deleteTgt = new bool[m];\n var uf = new LIB_UnionFind(pList.Select((e, idx) =>\n {\n var ret = new LIB_PriorityQueue();\n ret.Push(e, idx);\n return ret;\n }), (x, y) =>\n {\n if (x.Count > y.Count)\n {\n for (var i = 0; i < y.Count; i++)\n {\n x.Push(y.heap[i], y.dat[i]);\n }\n return x;\n }\n else\n {\n for (var i = 0; i < x.Count; i++)\n {\n y.Push(x.heap[i], x.dat[i]);\n }\n return y;\n }\n });\n foreach (var item in query)\n {\n if (item.t == 2) deleteTgt[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleteTgt[i])\n {\n uf.Unite(ab[i].a, ab[i].b);\n }\n }\n var ans = new List();\n for (var qqq = q - 1; qqq >= 0; qqq--)\n {\n if (query[qqq].t == 1)\n {\n var v = query[qqq].param - 1;\n ans.Add(uf.Calc(v));\n }\n else\n {\n var i = query[qqq].param - 1;\n uf.Unite(ab[i].a, ab[i].b);\n }\n }\n ans.Reverse();\n var deleted = new bool[n];\n foreach (var item in ans)\n {\n var ok = false;\n while (item.Count > 0)\n {\n var value = item.Pop();\n if (!deleted[value.Value])\n {\n deleted[value.Value] = true;\n Console.WriteLine(value.Key);\n ok = true;\n break;\n }\n }\n if (!ok) Console.WriteLine(0);\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_PriorityQueue\n {\n public long[] heap;\n public int[] dat;\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[163];\n dat = new int[163];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key <= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] < heap[i2]) i1 = i2;\n if (key >= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16384];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.X;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.Y; }\n foreach (var item in y.List()) x.Add(item);\n return (rt, x);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n if (x.Count > y.Count) { var t = x; x = y; y = t; }\n foreach (var item in x.List()) y.Add(item);\n return y;\n }, (x, y) =>\n {\n var rev = false;\n if (x.Count > y.Count)\n {\n var t = x; x = y; y = t;\n rev = true;\n }\n foreach (var item in x.List().ToArray())\n {\n if (y.ContainsKey(item)) y.Remove(item);\n }\n if (rev) return (y, x);\n else return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n Stack hv;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n hv = new Stack();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n if (x != y)\n {\n hv.Push(v[y]);\n hv.Push(v[x]);\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n var popv1 = hv.Pop();\n var popv2 = hv.Pop();\n var undoValue = rf(popv1, popv2);\n v[pop1.Item1] = undoValue.Item1;\n v[pop2.Item1] = undoValue.Item2;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y, (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = NN;\n var m = NN;\n var q = NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = NN - 1, b = NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = NN, param = NN }).ToArray();\n var deleteTgt = new bool[m];\n var uf = new LIB_UnionFind(pList.Select((e, idx) =>\n {\n var ret = new LIB_PriorityQueue();\n ret.Push(e, idx);\n return ret;\n }), (x, y) =>\n {\n if (x.Count > y.Count)\n {\n for (var i = 0; i < y.Count; i++)\n {\n x.Push(y.heap[i], y.dat[i]);\n }\n return x;\n }\n else\n {\n for (var i = 0; i < x.Count; i++)\n {\n y.Push(x.heap[i], x.dat[i]);\n }\n return y;\n }\n });\n foreach (var item in query)\n {\n if (item.t == 2) deleteTgt[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleteTgt[i])\n {\n uf.Unite(ab[i].a, ab[i].b);\n }\n }\n var ans = new List();\n for (var qqq = q - 1; qqq >= 0; qqq--)\n {\n if (query[qqq].t == 1)\n {\n var v = query[qqq].param - 1;\n ans.Add(uf.Calc(v));\n }\n else\n {\n var i = query[qqq].param - 1;\n uf.Unite(ab[i].a, ab[i].b);\n }\n }\n ans.Reverse();\n var deleted = new bool[n + 1];\n foreach (var item in ans)\n {\n var ok = false;\n while (item.Count > 0)\n {\n var value = item.Pop();\n if (!deleted[value.Key])\n {\n deleted[value.Key] = true;\n Console.WriteLine(value.Key);\n ok = true;\n break;\n }\n }\n if (!ok) Console.WriteLine(0);\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_PriorityQueue\n {\n public long[] heap;\n public int[] dat;\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[163];\n dat = new int[163];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key <= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] < heap[i2]) i1 = i2;\n if (key >= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[16384];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.X;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.Y; }\n foreach (var item in y.List()) x.Add(item);\n return (rt, x);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n if (x.Count > y.Count) { var t = x; x = y; y = t; }\n foreach (var item in x.List()) y.Add(item);\n return y;\n }, (x, y) =>\n {\n var rev = false;\n if (x.Count > y.Count)\n {\n var t = x; x = y; y = t;\n rev = true;\n }\n foreach (var item in x.List().ToArray())\n {\n if (y.ContainsKey(item)) y.Remove(item);\n else x.Remove(item);\n }\n if (rev) return (y, x);\n else return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n Stack hv;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n hv = new Stack();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n if (x != y)\n {\n hv.Push(v[x]);\n hv.Push(v[y]);\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n var popv1 = hv.Pop();\n var popv2 = hv.Pop();\n var undoValue = rf(popv1, popv2);\n v[pop1.Item1] = undoValue.Item1;\n v[pop2.Item1] = undoValue.Item2;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y, (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n //if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n foreach (var item in y.List().ToArray())\n {\n if (x.ContainsKey(item)) x.Remove(item);\n else y.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value] || p != param[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!graph[leftV].Contains(rightV)) continue;\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n var color = param[leftV];\n var procV = leftV;\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n var leftVs = new List();\n var rightVs = new List();\n leftVs.Add(leftV);\n rightVs.Add(rightV);\n var procVs = new List();\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n procVs = leftVs;\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procV = rightV;\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n if (!used[item2]) tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[128];\n dat = new int[128];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key >= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] > heap[i2]) i1 = i2;\n if (key <= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[128];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var graph = Repeat(0, n).Select(_ => new List()).ToArray();\n var uf = new LIB_UnionFind(n);\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i])\n {\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2)\n {\n var i = item.param - 1;\n if (uf.Unite(ab[i].a, ab[i].b))\n {\n graph[ab[i].a].Add(ab[i].b);\n graph[ab[i].b].Add(ab[i].a);\n }\n }\n }\n var param = new int[n];\n var qList = new List>();\n var used = new bool[n];\n {\n var done = new bool[n];\n for (var i = 0; i < n; i++)\n {\n if (!done[i])\n {\n var c = qList.Count();\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n var que = new Queue();\n que.Enqueue(i);\n done[i] = true;\n param[i] = c;\n while (que.Count > 0)\n {\n var v = que.Dequeue();\n foreach (var item in graph[v])\n {\n if (done[item]) continue;\n done[item] = true;\n param[item] = c;\n que.Enqueue(item);\n }\n }\n }\n qList[param[i]].Push((int)pList[i], i);\n }\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var v = item.param - 1;\n var p = param[v];\n var que = qList[p];\n var value = 0L;\n while (que.Count > 0)\n {\n if (used[que.Peek.Value] || p != param[que.Peek.Value]) que.Pop();\n else\n {\n used[que.Peek.Value] = true;\n value = que.Pop().Key;\n break;\n }\n }\n Console.WriteLine(value);\n }\n else\n {\n var leftV = ab[item.param - 1].a;\n var rightV = ab[item.param - 1].b;\n if (!graph[leftV].Contains(rightV)) continue;\n var leftQ = new Queue<(int, int)>();\n var rightQ = new Queue<(int, int)>();\n var color = param[leftV];\n var procV = leftV;\n var lidx = 0;\n var ridx = 0;\n var lv = leftV;\n var rv = rightV;\n var lp = rightV;\n var rp = leftV;\n var exit = false;\n var leftVs = new List();\n var rightVs = new List();\n leftVs.Add(leftV);\n rightVs.Add(rightV);\n var procVs = new List();\n while (true)\n {\n var leftOK = false;\n while (true)\n {\n while (graph[lv].Count > lidx)\n {\n var v = graph[lv][lidx++];\n if (v == lp) continue;\n leftQ.Enqueue((v, lv));\n leftVs.Add(v);\n leftOK = true;\n break;\n }\n if (leftOK) break;\n if (leftQ.Count == 0)\n {\n procVs = leftVs;\n exit = true;\n break;\n }\n var pop = leftQ.Dequeue();\n lv = pop.Item1;\n lp = pop.Item2;\n lidx = 0;\n }\n if (exit) break;\n var rightOK = false;\n while (true)\n {\n while (graph[rv].Count > ridx)\n {\n var v = graph[rv][ridx++];\n if (v == rp) continue;\n rightQ.Enqueue((v, rv));\n rightVs.Add(v);\n rightOK = true;\n break;\n }\n if (rightOK) break;\n if (rightQ.Count == 0)\n {\n procV = rightV;\n procVs = rightVs;\n exit = true;\n break;\n }\n var pop = rightQ.Dequeue();\n rv = pop.Item1;\n rp = pop.Item2;\n ridx = 0;\n }\n if (exit) break;\n }\n var procColorFrom = param[procV];\n var procColorTo = qList.Count;\n var tmpq = new LIB_PriorityQueue(false);\n qList.Add(tmpq);\n foreach (var item2 in procVs)\n {\n tmpq.Push((int)pList[item2], item2);\n param[item2] = procColorTo;\n }\n }\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_PriorityQueue\n {\n long[] heap;\n int[] dat;\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue()\n {\n heap = new long[128];\n dat = new int[128];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(long key, int val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = key;\n dat[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (key >= heap[ni]) break;\n heap[i] = heap[ni];\n dat[i] = dat[ni];\n i = ni;\n }\n heap[i] = key;\n dat[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop()\n {\n var ret = new KeyValuePair(heap[0], dat[0]);\n var key = heap[--Count];\n var val = dat[Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && heap[i1] > heap[i2]) i1 = i2;\n if (key <= heap[i1]) break;\n heap[i] = heap[i1];\n dat[i] = dat[i1];\n i = i1;\n }\n heap[i] = key;\n dat[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new long[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n var tmp2 = new int[Count << 1];\n for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];\n dat = tmp2;\n }\n }\n class LIB_PriorityQueue\n {\n T[] heap;\n Comparison comp;\n public T Peek => heap[0];\n public long Count\n {\n get;\n private set;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n heap = new T[cap];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n heap = new T[128];\n comp = asc ? cmp : (x, y) => cmp(y, x);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T val)\n {\n if (Count == heap.Length) Expand();\n var i = Count++;\n heap[i] = val;\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (comp(val, heap[ni]) >= 0) break;\n heap[i] = heap[ni];\n i = ni;\n }\n heap[i] = val;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop()\n {\n var ret = heap[0];\n var val = heap[--Count];\n if (Count == 0) return ret;\n var i = 0; while ((i << 1) + 1 < Count)\n {\n var i1 = (i << 1) + 1;\n var i2 = (i << 1) + 2;\n if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;\n if (comp(val, heap[i1]) <= 0) break;\n heap[i] = heap[i1]; i = i1;\n }\n heap[i] = val;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Expand()\n {\n var tmp = new T[Count << 1];\n for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];\n heap = tmp;\n }\n }\n class LIB_PriorityQueue\n {\n LIB_PriorityQueue> q;\n public KeyValuePair Peek => q.Peek;\n public long Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>(cap, (x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(Comparison cmp, bool asc = true)\n {\n q = new LIB_PriorityQueue>((x, y) => cmp(x.Key, y.Key), asc);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_PriorityQueue(bool asc = true) : this(Comparer.Default.Compare, asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(new KeyValuePair(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Pop() => q.Pop();\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n T[] v;\n Func f;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n d[x] = d[x] + d[y];\n v[x] = f(v[x], v[y]);\n d[y] = (int)x;\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n if (x.Count < y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n foreach (var item in x.List().ToArray())\n {\n if (y.ContainsKey(item)) y.Remove(item);\n else x.Remove(item);\n }\n return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n else\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n (v[pop1.Item1], v[pop2.Item1]) = rf(v[pop1.Item1], v[pop2.Item1]);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n static List> g;\n\n class Dsu\n {\n public readonly List parent;\n\n public Dsu(int n)\n {\n parent = Enumerable.Range(0, n).ToList();\n g = Init>(n).ToList();\n }\n\n public int FindSet(int v)\n {\n if (v == parent[v])\n return v;\n return parent[v] = FindSet(parent[v]);\n }\n\n public void UnionSets(int a, int b)\n {\n a = FindSet(a);\n b = FindSet(b);\n if (a != b)\n {\n parent[a] = parent[b] = parent.Count;\n g.Add(new List());\n g[parent.Count].Add(a);\n g[parent.Count].Add(b);\n parent.Add(parent.Count);\n }\n }\n }\n\n int[] c;\n int[] tree;\n\n int Cmp(int l, int r)\n {\n return c2[l] > c2[r] ? l : r;\n }\n\n void Build(int x, int xl, int xr)\n {\n if (xl == xr)\n {\n tree[x] = xl;\n return; \n }\n int xm = (xl + xr) / 2;\n Build(x * 2, xl, xm);\n Build(x * 2 + 1, xm + 1, xr);\n tree[x] = Cmp(tree[2 * x], tree[2 * x + 1]);\n }\n\n void Set(int x, int xl, int xr, int idx)\n {\n if (xl == xr)\n {\n c2[xl] = 0;\n return;\n }\n\n int xm = (xl + xr) / 2;\n if (idx <= xm)\n Set(x * 2, xl, xm, idx);\n else\n Set(x * 2 + 1, xm + 1, xr, idx);\n tree[x] = Cmp(tree[2 * x], tree[2 * x + 1]);\n }\n\n int Query(int x, int xl, int xr, int l, int r)\n {\n if (l == xl && r == xr)\n return tree[x];\n int xm = (xl + xr) / 2;\n if (r <= xm)\n return Query(x * 2, xl, xm, l, r);\n if (l > xm)\n return Query(x * 2 + 1, xm + 1, xr, l, r);\n return Cmp(Query(x * 2, xl, xm, l, xm), Query(x * 2 + 1, xm + 1, xr, xm + 1, r));\n }\n\n int n;\n bool[] vis;\n int[] tin, tout, c2;\n int timer;\n void Dfs(int x)\n {\n if (x < n)\n c2[timer] = c[x];\n vis[x] = true;\n tin[x] = timer++;\n foreach (int e in g[x])\n Dfs(e);\n tout[x] = timer;\n }\n\n public void Solve()\n {\n n = ReadInt();\n int m = ReadInt();\n int q = ReadInt();\n c = ReadIntArray();\n var a = ReadIntMatrix(m);\n var b = ReadIntMatrix(q);\n\n n = 200000;\n m = 199999;\n q = 500000;\n c = new int[n];\n var rnd = new Random(13);\n for (int i = 0; i < n; i++)\n c[i] = rnd.Next(n) + 1;\n a = new int[m][];\n for (int i = 0; i < m; i++)\n a[i] = new[] { i + 1, i + 2 };\n b = new int[q][];\n int cnt = 1;\n for (int i = 0; i < q; i++)\n {\n b[i] = new int[2];\n b[i][0] = rnd.Next(2) + 1;\n if (cnt > m)\n b[i][0] = 1;\n if (b[i][0] == 1)\n {\n b[i][1] = rnd.Next(n) + 1;\n }\n else\n {\n b[i][1] = cnt++;\n }\n }\n\n var f = new bool[m];\n for (int i = 0; i < q; i++)\n {\n b[i][1]--;\n if (b[i][0] == 2)\n f[b[i][1]] = true;\n }\n\n var dsu = new Dsu(n);\n for (int i = 0; i < m; i++)\n {\n a[i][0]--;\n a[i][1]--;\n if (!f[i])\n dsu.UnionSets(a[i][0], a[i][1]);\n }\n\n for (int i = q - 1; i >= 0; i--)\n {\n if (b[i][0] == 1)\n {\n b[i][1] = dsu.FindSet(b[i][1]);\n }\n else\n {\n dsu.UnionSets(a[b[i][1]][0], a[b[i][1]][1]);\n }\n }\n\n int n2 = dsu.parent.Count;\n tin = new int[n2];\n tout = new int[n2];\n vis = new bool[n2];\n c2 = new int[n2];\n for (int i = n2 - 1; i >= 0; i--)\n if (!vis[i])\n Dfs(i);\n\n tree = new int[4 * n2];\n Build(1, 0, n2 - 1);\n for (int i = 0; i < q; i++)\n if (b[i][0] == 1)\n {\n int x = Query(1, 0, n2 - 1, tin[b[i][1]], tout[b[i][1]] - 1);\n Write(c2[x]);\n Set(1, 0, n2 - 1, x);\n }\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //new Solver().Solve();\n var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n thread.Start();\n thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemD\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = (int)NN;\n var m = (int)NN;\n var q = (int)NN;\n var pList = NNList(n);\n var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();\n var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();\n var uf = new LIB_UnionFind>(Range(0, n).Select(e =>\n {\n var ret = new LIB_RedBlackTree();\n ret.Add(pList[e]);\n return ret;\n }), (x, y) =>\n {\n var rt = LIB_UnionFind.RootVtx.Y;\n if (x.Count > y.Count) { var t = x; x = y; y = t; rt = LIB_UnionFind.RootVtx.X; }\n foreach (var item in x.List()) y.Add(item);\n return (rt, y);\n }, (x, y) =>\n {\n var rev = false;\n if (x.Count > y.Count)\n {\n var t = x; x = y; y = t;\n rev = true;\n }\n foreach (var item in x.List().ToArray())\n {\n if (y.ContainsKey(item)) y.Remove(item);\n else x.Remove(item);\n }\n if (rev) return (y, x);\n else return (x, y);\n });\n var deleted = new bool[m];\n foreach (var item in query)\n {\n if (item.t == 2) deleted[item.param - 1] = true;\n }\n for (var i = 0; i < m; i++)\n {\n if (!deleted[i]) uf.Unite(ab[i].a, ab[i].b);\n }\n foreach (var item in query.Reverse())\n {\n if (item.t == 2) uf.Unite(ab[item.param - 1].a, ab[item.param - 1].b);\n }\n foreach (var item in query)\n {\n if (item.t == 1)\n {\n var set = uf.Calc(item.param - 1);\n var value = 0L;\n if (set.Count > 0)\n {\n value = set.Max();\n set.Remove(value);\n }\n Console.WriteLine(value);\n }\n else uf.Undo();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n static bool Chmax(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }\n static bool Chmin(this ref T lhs, T rhs) where T : struct, IComparable { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }\n }\n}\nnamespace Library {\n class LIB_RedBlackTree\n {\n static public LIB_RedBlackTree CreateRangeUpdateRangeMin() => new LIB_RedBlackTree(long.MaxValue, long.MinValue + 100, Math.Min, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMin() => new LIB_RedBlackTree(long.MaxValue, 0, Math.Min, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeMax() => new LIB_RedBlackTree(long.MinValue, long.MaxValue - 100, Math.Max, (x, y, c) => y, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeMax() => new LIB_RedBlackTree(long.MinValue, 0, Math.Max, (x, y, c) => x + y, (x, y) => x + y);\n static public LIB_RedBlackTree CreateRangeUpdateRangeSum() => new LIB_RedBlackTree(0, long.MaxValue, (x, y) => x + y, (x, y, c) => y * c, (x, y) => y);\n static public LIB_RedBlackTree CreateRangeAddRangeSum() => new LIB_RedBlackTree(0, 0, (x, y) => x + y, (x, y, c) => x + y * c, (x, y) => x + y);\n }\n class LIB_RedBlackTree where ValueE : IEquatable\n {\n bool ope;\n class Node\n {\n public Node left;\n public Node right;\n public Key key;\n public ValueT val;\n public ValueT dat;\n public ValueE lazy;\n public bool isBlack;\n public int cnt;\n public bool needRecalc;\n }\n Func f;\n Func g;\n Func h;\n ValueT ti;\n ValueE ei;\n Comparison c;\n Node root;\n bool isNeedFix;\n Node lmax;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h, Comparison c, bool ope = true)\n {\n this.ti = ti;\n this.ei = ei;\n this.f = f;\n this.g = g;\n this.h = h;\n this.c = c;\n this.ope = ope;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(ValueT ti, ValueE ei, Func f, Func g, Func h) : this(ti, ei, f, g, h, Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsRed(Node n) => n != null && !n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IsBlack(Node n) => n != null && n.isBlack;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n int Cnt(Node n) => n == null ? 0 : n.cnt;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Eval(Node n)\n {\n if (n == null || ei.Equals(n.lazy)) return;\n n.val = g(n.val, n.lazy, 1);\n if (!n.needRecalc) n.dat = g(n.dat, n.lazy, Cnt(n));\n if (n.left != null) n.left.lazy = h(n.left.lazy, n.lazy);\n if (n.right != null) n.right.lazy = h(n.right.lazy, n.lazy);\n n.lazy = ei;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Recalc(Node n)\n {\n if (n == null) return;\n Eval(n);\n if (!n.needRecalc) return;\n n.needRecalc = false;\n n.dat = n.val;\n if (n.left != null)\n {\n Recalc(n.left);\n n.dat = f(n.left.dat, n.dat);\n }\n if (n.right != null)\n {\n Recalc(n.right);\n n.dat = f(n.dat, n.right.dat);\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateL(Node n)\n {\n if (ope) { Eval(n); Eval(n.right); }\n Node m = n.right, t = m.left;\n m.left = n; n.right = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateR(Node n)\n {\n if (ope) { Eval(n); Eval(n.left); }\n Node m = n.left, t = m.right;\n m.right = n; n.left = t;\n n.cnt -= m.cnt - Cnt(t);\n m.cnt += n.cnt - Cnt(t);\n n.needRecalc = true; m.needRecalc = true;\n return m;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateLR(Node n)\n {\n n.left = RotateL(n.left);\n return RotateR(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RotateRL(Node n)\n {\n n.right = RotateR(n.right);\n return RotateL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, ValueT val)\n {\n root = Add(root, key, val);\n root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Add(Node n, Key key, ValueT val)\n {\n if (n == null)\n {\n isNeedFix = true;\n return new Node() { key = key, val = val, dat = val, lazy = ei, cnt = 1 };\n }\n if (ope) Eval(n);\n if (c(key, n.key) < 0) n.left = Add(n.left, key, val);\n else n.right = Add(n.right, key, val);\n n.needRecalc = true;\n ++n.cnt;\n return Balance(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Balance(Node n)\n {\n if (!isNeedFix || !IsBlack(n)) return n;\n if (IsRed(n.left) && IsRed(n.left.left))\n {\n n = RotateR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.left) && IsRed(n.left.right))\n {\n n = RotateLR(n);\n n.left.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.left))\n {\n n = RotateRL(n);\n n.right.isBlack = true;\n }\n else if (IsRed(n.right) && IsRed(n.right.right))\n {\n n = RotateL(n);\n n.right.isBlack = true;\n }\n else isNeedFix = false;\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key)\n {\n root = Remove(root, key);\n if (root != null) root.isBlack = true;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Remove(Node n, Key key)\n {\n if (ope) Eval(n);\n --n.cnt;\n var r = c(key, n.key);\n if (r < 0)\n {\n n.left = Remove(n.left, key);\n n.needRecalc = true;\n return BalanceL(n);\n }\n if (r > 0)\n {\n n.right = Remove(n.right, key);\n n.needRecalc = true;\n return BalanceR(n);\n }\n if (n.left == null)\n {\n isNeedFix = n.isBlack;\n return n.right;\n }\n n.left = RemoveMax(n.left);\n n.key = lmax.key;\n n.val = lmax.val;\n n.needRecalc = true;\n return BalanceL(n);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RemoveMax(Node n)\n {\n if (ope) Eval(n);\n --n.cnt;\n if (n.right != null)\n {\n n.right = RemoveMax(n.right);\n n.needRecalc = true;\n return BalanceR(n);\n }\n lmax = n;\n isNeedFix = n.isBlack;\n return n.left;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceL(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.right) && IsRed(n.right.left))\n {\n var b = n.isBlack;\n n = RotateRL(n);\n n.isBlack = b;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right) && IsRed(n.right.right))\n {\n var b = n.isBlack;\n n = RotateL(n);\n n.isBlack = b;\n n.right.isBlack = true;\n n.left.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.right))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.right.isBlack = false;\n }\n else\n {\n n = RotateL(n);\n n.isBlack = true;\n n.left.isBlack = false;\n n.left = BalanceL(n.left);\n isNeedFix = false;\n }\n return n;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BalanceR(Node n)\n {\n if (!isNeedFix) return n;\n if (IsBlack(n.left) && IsRed(n.left.right))\n {\n var b = n.isBlack;\n n = RotateLR(n);\n n.isBlack = b; n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left) && IsRed(n.left.left))\n {\n var b = n.isBlack;\n n = RotateR(n);\n n.isBlack = b;\n n.left.isBlack = true;\n n.right.isBlack = true;\n isNeedFix = false;\n }\n else if (IsBlack(n.left))\n {\n isNeedFix = n.isBlack;\n n.isBlack = true;\n n.left.isBlack = false;\n }\n else\n {\n n = RotateR(n);\n n.isBlack = true;\n n.right.isBlack = false;\n n.right = BalanceR(n.right);\n isNeedFix = false;\n }\n return n;\n }\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return At(root, i); }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n KeyValuePair At(Node n, long i)\n {\n if (ope) Eval(n);\n if (n.left == null)\n {\n if (i == 0) return new KeyValuePair(n.key, n.val);\n else return At(n.right, i - 1);\n }\n if (n.left.cnt == i) return new KeyValuePair(n.key, n.val);\n if (n.left.cnt > i) return At(n.left, i);\n return At(n.right, i - n.left.cnt - 1);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key)\n {\n var t = LowerBound(key);\n return t < Cnt(root) && c(At(root, t).Key, key) == 0;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => UpperBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long UpperBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r < 0) return UpperBound(n.left, key);\n return Cnt(n.left) + 1 + UpperBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => LowerBound(root, key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n long LowerBound(Node n, Key key)\n {\n if (n == null) return 0;\n var r = c(key, n.key);\n if (r <= 0) return LowerBound(n.left, key);\n return Cnt(n.left) + 1 + LowerBound(n.right, key);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min()\n {\n Node n = root.left, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.left;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max()\n {\n Node n = root.right, p = root;\n while (n != null)\n {\n p = n;\n if (ope) Eval(p);\n n = n.right;\n }\n return new KeyValuePair(p.key, p.val);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Update(long l, long r, ValueE val) => Update(root, l, r, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n void Update(Node n, long l, long r, ValueE val)\n {\n if (n == null) return;\n Eval(n);\n n.needRecalc = true;\n var lc = Cnt(n.left);\n if (lc < l) Update(n.right, l - lc - 1, r - lc - 1, val);\n else if (r <= lc) Update(n.left, l, r, val);\n else if (l <= 0 && Cnt(n) <= r) n.lazy = val;\n else\n {\n n.val = g(n.val, val, 1);\n if (l < lc) Update(n.left, l, lc, val);\n if (lc + 1 < r) Update(n.right, 0, r - lc - 1, val);\n }\n return;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public ValueT Query(long l, long r) => Query(root, l, r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n ValueT Query(Node n, long l, long r)\n {\n var v1 = ti; var v2 = ti; var v3 = ti;\n if (n == null) return ti;\n Eval(n);\n var lc = Cnt(n.left);\n if (lc < l) v3 = Query(n.right, l - lc - 1, r - lc - 1);\n else if (r <= lc) v1 = Query(n.left, l, r);\n else if (l <= 0 && Cnt(n) <= r)\n {\n Recalc(n);\n v2 = n.dat;\n }\n else\n {\n if (l < lc) v1 = Query(n.left, l, lc);\n if (lc + 1 < r) v3 = Query(n.right, 0, r - lc - 1);\n v2 = n.val;\n }\n return f(f(v1, v2), v3);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => root != null;\n public long Count => Cnt(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => L(root);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable> L(Node n)\n {\n if (n == null) yield break;\n foreach (var i in L(n.left)) yield return i;\n yield return new KeyValuePair(n.key, n.val);\n foreach (var i in L(n.right)) yield return i;\n }\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(default(Value), 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(Key key, Value val) => tree.Add(key, val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(Key key) => tree.Remove(key);\n public KeyValuePair this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i]; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(Key key) => tree.ContainsKey(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(Key key) => tree.UpperBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(Key key) => tree.LowerBound(key);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Min() => tree.Min();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public KeyValuePair Max() => tree.Max();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable> List() => tree.List();\n }\n class LIB_RedBlackTree\n {\n LIB_RedBlackTree tree;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree(Comparison c) { tree = new LIB_RedBlackTree(0, 0, null, null, null, c, false); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_RedBlackTree() : this(Comparer.Default.Compare) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T val) => tree.Add(val, 0);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T val) => tree.Remove(val);\n public T this[long i]\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return tree[i].Key; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool ContainsKey(T val) => tree.ContainsKey(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long UpperBound(T val) => tree.UpperBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LowerBound(T val) => tree.LowerBound(val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() => tree.Min().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() => tree.Max().Key;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => tree.Any();\n public long Count => tree.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => tree.List().Select(e => e.Key);\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[2048];\n int len, ptr;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 2048)) <= 0)\n {\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = (ret << 3) + (ret << 1) + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n class LIB_UnionFind\n {\n int[] d;\n Stack<(int, int)> h;\n Stack hv;\n T[] v;\n Func f;\n Func rf;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(IEnumerable s, Func func, Func revFunc)\n {\n v = s.ToArray();\n d = Enumerable.Repeat(-1, v.Length).ToArray();\n f = func;\n rf = revFunc;\n h = new Stack<(int, int)>();\n hv = new Stack();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y)\n {\n x = Root(x);\n y = Root(y);\n if (x != y)\n {\n var (root, value) = f(v[x], v[y]);\n if (root == LIB_UnionFind.RootVtx.X)\n {\n h.Push(((int)y, d[y]));\n h.Push(((int)x, d[x]));\n hv.Push(v[y]);\n hv.Push(v[x]);\n d[x] = d[x] + d[y];\n d[y] = (int)x;\n v[x] = value;\n }\n else\n {\n h.Push(((int)x, d[x]));\n h.Push(((int)y, d[y]));\n hv.Push(v[x]);\n hv.Push(v[y]);\n d[y] = d[x] + d[y];\n d[x] = (int)y;\n v[y] = value;\n }\n }\n return x != y;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Undo()\n {\n var pop1 = h.Pop();\n var pop2 = h.Pop();\n if (pop1.Item1 == pop2.Item1) return;\n d[pop1.Item1] = pop1.Item2;\n d[pop2.Item1] = pop2.Item2;\n var popv1 = hv.Pop();\n var popv2 = hv.Pop();\n (v[pop1.Item1], v[pop2.Item1]) = rf(popv1, popv2);\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Calc(long x) => v[Root(x)];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Snapshot() => h.Clear();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Rollback()\n {\n while (h.Count > 0) Undo();\n }\n }\n class LIB_UnionFind : LIB_UnionFind\n {\n public enum RootVtx { X, Y };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => (RootVtx.X, x + y), (x, y) =>\n {\n if (x < y) return (x, y - x);\n else return (x - y, y);\n })\n { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n new private void Calc(long x) { }\n }\n}\n"}], "src_uid": "ad014bde729222db14f38caa521e4167"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Int64.Parse(Console.ReadLine());\n if (n == 5)\n {\n Console.WriteLine(1);\n return;\n }\n Console.WriteLine((n % 3) + 1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(3);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(1);\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n \n \n if (n == 5)\n Console.Write(1);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n //test 3\n if (n == 4)\n Console.Write(2);\n //test 4\n if (n == 2)\n Console.Write(3);\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Comp1\n{\n class TaskA\n {\n static void Main(string[] args)\n {\n\n long a;\n string str;\n str = Console.ReadLine();\n a = long.Parse(str); \n \n if (a == 5)\n Console.WriteLine('1');\n else\n Console.WriteLine(a % 3 + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"1\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 2;\n else if (a == 2)\n res = 3;\n else if (a == 3)\n res = 1;\n else if (a == 4)\n res = 2;\n else if (a == 5)\n res = 1;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\n class Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n Console.WriteLine(input > 2 ? input==5?input-4:input - 2 : input + 1);\n }\n }"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"3\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _171d\n{\n class Program\n {\n static void Main(string[] args)\n {\n int val = int.Parse(Console.ReadLine());\n Console.WriteLine(((val % 5) % 3) + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Broken_checker\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n if (n==5)\n writer.WriteLine(\"1\");\n else\n writer.WriteLine((n%3) + 1);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 2, 3, 1, 2, 1};\n\n return b[a - 1];\n }\n}"}], "negative_code": [{"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n switch(input)\n {\n case 3:\n input = 1;\n break;\n case 1:\n input = 2;\n break;\n case 2:\n input = 4;\n break;\n case 4:\n input = 5;\n break;\n case 5:\n input = 3;\n break;\n }\n Console.WriteLine(input);\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n Console.WriteLine(input > 2 ? input - 2 : input + 1);\n }\n }"}, {"source_code": "using System;\n class Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n Console.WriteLine(input > 2 ? input - 2 : input);\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n Console.WriteLine(input > 3 ? input - 3 : input);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _171d\n{\n class Program\n {\n static void Main(string[] args)\n {\n int val = int.Parse(Console.ReadLine());\n Console.WriteLine((val % 3) + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Broken_checker\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n writer.WriteLine(\"1\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Broken_checker\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n writer.WriteLine((n%3) + 1);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 2, 2, 1, 2, 3};\n\n return b[a - 1];\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 3, 2, 1, 2, 3};\n\n return b[a - 1];\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 2, 3, 2, 2, 3};\n\n return b[a - 1];\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 3, 2, 1, 3, 1};\n\n return b[a - 1];\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 2, 3, 1, 1, 3};\n\n return b[a - 1];\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int a = ReadInt();\n int[] b = new int[] { 2, 3, 1, 2, 3};\n\n return b[a - 1];\n }\n}"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(2);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(3);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(2);\n break;\n case 3:\n Console.WriteLine(3);\n break;\n case 4:\n Console.WriteLine(1);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(1);\n break;\n case 2:\n Console.WriteLine(1);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(1);\n break;\n case 5:\n Console.WriteLine(1);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(3);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(3);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(1);\n break;\n case 2:\n Console.WriteLine(2);\n break;\n case 3:\n Console.WriteLine(3);\n break;\n case 4:\n Console.WriteLine(1);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(2);\n break;\n case 2:\n Console.WriteLine(1);\n break;\n case 3:\n Console.WriteLine(2);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(3);\n break;\n case 2:\n Console.WriteLine(1);\n break;\n case 3:\n Console.WriteLine(3);\n break;\n case 4:\n Console.WriteLine(1);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(3);\n break;\n case 2:\n Console.WriteLine(2);\n break;\n case 3:\n Console.WriteLine(3);\n break;\n case 4:\n Console.WriteLine(1);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _171D\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n switch(n)\n {\n case 1:\n Console.WriteLine(3);\n break;\n case 2:\n Console.WriteLine(2);\n break;\n case 3:\n Console.WriteLine(1);\n break;\n case 4:\n Console.WriteLine(2);\n break;\n case 5:\n Console.WriteLine(2);\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 1;\n else if (a == 2)\n res = 2;\n else if (a == 3)\n res = 2;\n else if (a == 4)\n res = 3;\n else if (a == 5)\n res = 2;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 2;\n else if (a == 2)\n res = 3;\n else if (a == 3)\n res = 1;\n else if (a == 4)\n res = 1;\n else if (a == 5)\n res = 1;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 1;\n else if (a == 2)\n res = 2;\n else if (a == 3)\n res = 1;\n else if (a == 4)\n res = 1;\n else if (a == 5)\n res = 1;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 1;\n else if (a == 2)\n res = 1;\n else if (a == 3)\n res = 1;\n else if (a == 4)\n res = 1;\n else if (a == 5)\n res = 1;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n //if (a == 1)\n // res = 1;\n //else if (a == 2)\n // res = 2;\n //else if (a == 3)\n // res = 2;\n //else if (a == 4)\n // res = 3;\n //else if (a == 5)\n // res = 2;\n res = Math.Max(a%4, 1);\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n //if (a == 1)\n // res = 1;\n //else if (a == 2)\n // res = 2;\n //else if (a == 3)\n // res = 2;\n //else if (a == 4)\n // res = 3;\n //else if (a == 5)\n // res = 2;\n res = Math.Max(a%3, 1);\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"D1\";\n \n private static void Solve()\n {\n var a = ReadInt();\n var res = 1;\n if (a == 1)\n res = 2;\n else if (a == 2)\n res = 2;\n else if (a == 3)\n res = 1;\n else if (a == 4)\n res = 1;\n else if (a == 5)\n res = 1;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n // Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"3\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"3\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"3\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"3\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"3\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"2\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"2\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"3\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "using System;\nclass program\n{\n static void Main()\n{\nswitch(Console.ReadLine())\n{\n case (\"1\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"2\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"3\"):\nConsole.WriteLine(\"2\");\nbreak;\n case (\"4\"):\nConsole.WriteLine(\"1\");\nbreak;\n case (\"5\"):\nConsole.WriteLine(\"1\");\nbreak;\n}\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(1);\n if (n == 5)\n Console.Write(1);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n //test 3\n if (n == 4)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n //if (n == 2)\n // Console.Write(2);\n \n if (n == 4)\n Console.Write(2);\n //if (n == 5)\n // Console.Write(2);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n /*\n if (n == 1)\n Console.Write(3);\n if (n == 2)\n Console.Write(2);\n if (n == 3)\n Console.Write(1);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(2);\n */\n if (n == 3)\n Console.Write(1);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n if (n == 1)\n Console.Write(2);\n /*\n if (n == 2)\n Console.Write(1);\n if (n == 4)\n Console.Write(3);\n if (n == 5)\n Console.Write(3);\n */\n // test 1\n if (n == 3)\n Console.Write(1);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(3);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(1);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(2);\n /*\n if (n == 4)\n Console.Write(2);\n if (n == 5)\n Console.Write(2);\n */\n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n /*\n if (n == 1)\n Console.Write(3);\n if (n == 2)\n Console.Write(2);\n if (n == 3)\n Console.Write(1);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(2);\n */\n if (n == 2)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n if (n == 1)\n Console.Write(3);\n if (n == 2)\n Console.Write(2);\n if (n == 3)\n Console.Write(1);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n if (n == 1)\n Console.Write(3);\n /*if (n == 2)\n Console.Write(2);\n if (n == 3)\n Console.Write(1);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(2);\n */\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n if (n == 1)\n Console.Write(3);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n if (n == 1)\n Console.Write(1);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n if (n == 1)\n Console.Write(1);\n if (n == 2)\n Console.Write(2);\n if (n == 3)\n Console.Write(3);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(2);\n if (n == 4)\n Console.Write(2);\n if (n == 5)\n Console.Write(2);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n if (n == 1)\n Console.Write(2);\n if (n == 2)\n Console.Write(1);\n if (n == 4)\n Console.Write(3);\n if (n == 5)\n Console.Write(3);\n // test 1\n if (n == 3)\n Console.Write(1);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(3);\n /*\n if (n == 5)\n Console.Write(3);\n */\n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n //test 3\n if (n == 4)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n //string s = Console.ReadLine();\n //string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n n = Convert.ToInt32(Console.ReadLine());\n /*int k = 12;\n int sum = 1;\n if (n == 1)\n Console.Write(1);\n else\n {\n for (int i = 2; i <= n; i++)\n {\n sum += k;\n k += 12;\n }\n }\n Console.Write(sum);\n * */\n \n \n \n if (n == 2)\n Console.Write(1);\n if (n == 4)\n Console.Write(1);\n if (n == 5)\n Console.Write(1);\n \n // test 1\n if (n == 3)\n Console.Write(1);\n //test 2\n if (n == 1)\n Console.Write(2);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 5) Console.Write(\"1\");\n else Console.Write(\"2\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"1\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.Write(\"3\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.Write(Math.Abs(4-n));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"3\"); break; }\n case 2: { Console.Write(\"1\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"1\"); break; }\n case 2: { Console.Write(\"2\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"3\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"3\"); break; }\n case 2: { Console.Write(\"2\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"3\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"2\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.Write(\"2\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"3\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"1\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"3\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.Write(\"1\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"3\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"3\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"3\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 3) Console.Write(\"1\");\n else Console.Write(\"2\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"2\"); break; }\n case 2: { Console.Write(\"3\"); break; }\n case 3: { Console.Write(\"1\"); break; }\n case 4: { Console.Write(\"2\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskD\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n switch (n)\n {\n case 1: { Console.Write(\"3\"); break; }\n case 2: { Console.Write(\"2\"); break; }\n case 3: { Console.Write(\"2\"); break; }\n case 4: { Console.Write(\"3\"); break; }\n case 5: { Console.Write(\"2\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Int64.Parse(Console.ReadLine());\n Console.WriteLine(Math.Abs(n - 2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Int64.Parse(Console.ReadLine());\n Console.WriteLine((n / 2) + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 1 2\n\t\t\t// 1 2 2 \n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 2\n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 1 4\n\t\t\t// 1 2 2 \n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 2\n\t\t\t// 1 2 2 \n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 \n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 1\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 \n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 1 2\n\t\t\t// 1 2 2 \n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 1 4\n\t\t\t// 1 2 2 \n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2); //\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(3);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 171D\")]\n#endif\n\tclass Task171D\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n;\n\t\t\tinput.Line().Read(out n);\n\n\t\t\t// 3 2\n\t\t\t// 1 2\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\toutput.WriteLine(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\toutput.WriteLine(2);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task171D();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Comp1\n{\n class TaskA\n {\n static void Main(string[] args)\n {\n\n long a;\n string str;\n str = Console.ReadLine();\n a = long.Parse(str); \n \n Console.WriteLine(a % 3 + 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Comp1\n{\n class TaskA\n {\n static void Main(string[] args)\n {\n\n long a;\n string str;\n str = Console.ReadLine();\n a = long.Parse(str); \n \n Console.WriteLine(a % 2 + 1);\n }\n }\n}"}], "src_uid": "c702e07fed684b7741d8337aafa005fb"} {"source_code": "/* Date: 05.07.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\040\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\040\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n\t\ts = (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** n = \" + n);\n\t\ts = (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tint k0 = 0, k1 = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tif ( s [i] == '0' )\n\t\t\t\tk0++;\n\t\t\telse\n\t\t\t\tk1++;\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** k0 = \" + k0);\n\t\tsw.WriteLine (\"*** k1 = \" + k1);\n# endif\n\n# if ( ONLINE_JUDGE )\n\t\tif ( k1 != k0 )\n\t\t{\n\t\t\tConsole.WriteLine (\"1\");\n\t\t\tConsole.WriteLine (s);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine (\"2\");\n\t\t\tConsole.Write (s [0] + \" \");\n\t\t\tfor ( int i=1; i < n; i++ )\n\t\t\t\tConsole.Write (s [i]);\n\t\t\tConsole.WriteLine ();\n\t\t}\n# else\n\t\tif ( k1 != k0 )\n\t\t{\n\t\t\tsw.WriteLine (\"1\");\n\t\t\tsw.WriteLine (s);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsw.WriteLine (\"2\");\n\t\t\tsw.Write (s [0] + \" \");\n\t\t\tfor ( int i=1; i < n; i++ )\n\t\t\t\tsw.Write (s [i]);\n\t\t\tsw.WriteLine ();\n\t\t}\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n int n=int.Parse(Console.ReadLine());\n string s=Console.ReadLine();\n int x=0;\n int z=0;\n int o=0;\n for(int i=0;i0)\n {\n Console.WriteLine(2);\n for(int i=0;i v == '1') == str.Count(v => v == '0'))\n WriteLine($\"2\\n{new string(str.Take(1).ToArray())} {new string(str.Skip(1).ToArray())}\");\n else WriteLine($\"1\\n{str}\");\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static char[][] gred(int h)\n => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();\n public static int[] ar1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => num).ToArray();\n public static long[] arL1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();\n public static string[] strs(int n)\n => Enumerable.Repeat(0, n).Select(_ => read).ToArray();\n public static int[][] ar2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();\n public static long[][] arL2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();\n public static List[] edge(int n)\n => Enumerable.Repeat(0, n).Select(_ => new List()).ToArray();\n public static T getValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n private static Queue sc = new Queue();\n public static T Next(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return getValue(sc.Dequeue()); }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}"}, {"source_code": "// you can also use other imports, for example:\n// using System.Collections.Generic;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\nusing System;\nusing System.Linq;\n\ninternal class Solution\n{\n private static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var str = Console.ReadLine();\n\n var arr = new int[2];\n\n foreach (var item in str)\n {\n if (item == '1')\n {\n arr[1]++;\n }\n else\n {\n arr[0]++;\n }\n }\n\n if (arr[1] != arr[0])\n {\n Console.WriteLine(1.ToString());\n Console.WriteLine(str);\n }\n else\n {\n Console.WriteLine(2.ToString());\n Console.WriteLine(str.Substring(0, str.Length - 1) + \" \" + str[str.Length - 1]);\n }\n\n Console.ReadLine();\n }\n\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tConsole.ReadLine();\n\t string s = Console.ReadLine();\n\t\tint count = 0;\n\t\tfor(int i = 0 ; i < s.Length; i++)\n\t\t{\n\t\t\tif (s[i] == '1') count++; \n\t\t\tif (s[i] == '0') count--;\t\t\t\n\t\t}\t\t\n\t\tif(count == 0)\n\t\t{\t\t\n\t\t\tConsole.WriteLine(2);\n\t\t\tConsole.WriteLine(\"{0} {1}\", s[0], s.Substring(1));\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(1);\n\t\t\tConsole.WriteLine(s);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Keanu_Reeves\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n string s = reader.ReadLine();\n s = reader.ReadLine();\n\n if (s.Length == s.Count(t => t == '1')*2)\n {\n writer.WriteLine(\"2\");\n writer.Write(s[0]);\n writer.Write(' ');\n writer.WriteLine(s.Substring(1));\n }\n else\n {\n writer.WriteLine(\"1\");\n writer.WriteLine(s);\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Keanu_Reeves\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n int count0 = 0;\n int count1 = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == '0')\n {\n count0++;\n }\n else\n {\n count1++;\n }\n }\n if (count0 < count1 || count0 > count1)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n }\n else\n {\n Console.WriteLine(2);\n Console.Write(s[0] + \" \");\n for (int i = 1; i < n; i++)\n {\n Console.Write(s[i]);\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff//\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\n using System.Collections.Generic;\n using System.Globalization;\nusing System.IO;\nusing System.Linq;\n using System.Text;\n using System.Threading;\n\n namespace CF\n{\n internal class Program\n {\n private const int stackSize = 64 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n \n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var s = sr.NextString();\n var oneCount = s.Count(ch => ch == '1');\n var zeroCount = s.Count(ch => ch == '0');\n if (oneCount != zeroCount)\n {\n sw.WriteLine(1);\n sw.WriteLine(s);\n }\n else\n {\n sw.WriteLine(2);\n sw.Write(s[0]);\n sw.Write(\" \");\n sw.Write(s.Substring(1));\n }\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Threading;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(ReadLine());\n string b = ReadLine();\n solve(b);\n }\n public static void solve(string b)\n {\n int c = b.Count(x => x == '0');\n int d = b.Count(x => x == '1');\n if (c != d)\n {\n WriteLine(1);\n WriteLine(b);\n }\n else\n {\n WriteLine(2);\n string z = b.Substring(0, 1);\n string x = b.Substring(1, b.Length-1);\n WriteLine($\"{z} {x}\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var s = input.ReadToken();\n var z = s.Count(c => c == '0');\n if (n % 2 == 1 || z != n - z)\n {\n WriteLine(1);\n WriteLine(s);\n }\n else\n {\n WriteLine(2);\n WriteLine($\"{s[0]} {s.Substring(1)}\");\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n\n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u041f\u0440\u043e\u04331\n{\n\n class Program\n {\n public static bool isGood(string str)\n {\n int flag = 0;\n for(int i =0; i c == '1');\n int zrs_ctr = str.Count(c => c == '0');\n if (str.Length % 2 == 1 || ones_ctr != zrs_ctr)\n {\n Console.WriteLine(1);\n Console.WriteLine(str);\n return;\n }\n Console.WriteLine(2);\n Console.WriteLine(str.Substring(0,str.Length-1)+\" \"+str.Substring(str.Length-1,1));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n class Kianu\n{\n static void Main()\n {\n int a = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n int ed=0, nul=0;\n foreach(char el in s)\n {\n if (el == '1') ed++;\n else if (el == '0') nul++;\n }\n if (ed != nul) Console.WriteLine(1+\"\\n\"+s);\n else\n {\n Console.WriteLine(2);\n for (int i = 0; i < s.Length - 1; i++)\n {\n Console.Write(s[i]);\n }\n Console.WriteLine(\" \" + s[s.Length - 1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n int so0 = 0,so1 = 0;\n for (int i = 0; i < n; i++)\n if (s[i] == '1') so1++;\n else so0++;\n if (so0 == so1)\n {\n Console.WriteLine(2);\n Console.WriteLine(s[0] + \" \" + s.Substring(1));\n }\n else\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Console = System.Console;\n\nnamespace ConsoleApp3\n{\n public class problemA572\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n int zeroes = 0;\n foreach (var c in s)\n {\n if (c == '0')\n zeroes++;\n }\n\n int ones = n - zeroes;\n if (zeroes != ones)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n }\n else\n {\n Console.WriteLine(2);\n Console.WriteLine($\"{s.Substring(0, n-1)} {s[n-1]}\");\n }\n }\n\n }\n}\n"}, {"source_code": "// Problem: 1189A - Keanu Reeves\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass KeanuReeves\n {\n public static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delimiters = new char[] {' ', '\\t'};\n string[] words = line.Split (delimiters,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 100)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delimiters,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n string s = words[0];\n if (s.Length != n)\n return -1;\n byte countZero = 0;\n for (byte i = 0; i < n; i++)\n {\n char c = s[i];\n if (c != '0' && c != '1')\n return -1;\n if (c == '0')\n countZero++;\n }\n byte countOne = Convert.ToByte (n-countZero);\n if (countZero != countOne)\n {\n Console.WriteLine (1);\n Console.WriteLine (s);\n }\n else\n {\n Console.WriteLine (2);\n Console.WriteLine (s.Substring (0,n-1) + \" \" + s[n-1]);\n }\n return 0;\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var q = Console.ReadLine();\n var count = 0;\n foreach (char c in q)\n if (c == '1') count++;\n if(count*2!=q.Length)\n {\n Console.WriteLine(1);\n Console.WriteLine(q);\n return;\n }\n Console.WriteLine(2);\n Console.WriteLine(q[0] +\" \"+ q.Substring(1, n - 1));\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int zero = 0, one = 0;\n if (n % 2 != 0)\n Console.WriteLine(1 + \"\\n\" + s);\n else\n {\n foreach (char c in s)\n switch (c)\n {\n case '0': zero++; break;\n case '1': one++; break;\n }\n if (zero == one)\n Console.WriteLine(2 + \"\\n\" + s.Substring(0, n - 1) + \" \" + s.Substring(n - 1));\n else Console.WriteLine(1 + \"\\n\" + s);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int zero = 0;\n foreach (char c in s)\n if (c == '0')\n zero++;\n if (zero==n-zero)\n Console.WriteLine(2 + \"\\n\" + s.Substring(0, n - 1) + \" \" + s.Substring(n - 1));\n else Console.WriteLine(1 + \"\\n\" + s);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n string s = sc.Next();\n\n int cnt0 = s.Count(ch => ch == '0');\n int cnt1 = n - cnt0;\n\n if (cnt0 != cnt1)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n return;\n }\n\n Console.WriteLine(2);\n Console.WriteLine($\"{s[0]} {s.Substring(1)}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\nusing System.Text;\n\nnamespace Program\n{\n public static class CODEFORCES1\n {\n static public void Solve()\n {\n var n = NN;\n var s = NS;\n\n var outlines = new List();\n var startidx = 0;\n while (true)\n {\n var tmp = \"\";\n var sum = 0;\n var maxtmp = \"\";\n var maxidx = startidx;\n for (var i = startidx; i < n; i++)\n {\n sum += s[i] == '0' ? -1 : 1;\n tmp += s[i];\n\n if (sum != 0)\n {\n maxtmp = tmp;\n maxidx = i;\n }\n }\n if (startidx == n) break;\n outlines.Add(maxtmp);\n startidx = maxidx + 1;\n }\n Console.WriteLine(outlines.Count);\n Console.WriteLine(string.Join(\" \", outlines));\n }\n\n static public void Main(string[] args)\n {\n if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); }\n Solve();\n Console.Out.Flush();\n }\n static Random rand = new Random();\n static class Console_\n {\n private static Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n }\n static long NN => long.Parse(Console_.NextString());\n static double ND => double.Parse(Console_.NextString());\n static string NS => Console_.NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => rand.Next());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l, Comparison comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }\n static long LCM(long a, long b) => a * b / GCD(a, b);\n class PQ where T : IComparable\n {\n private List h;\n private Comparison c;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { h = new List(cap); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { h = new List(); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }\n public T Peek => h[0];\n public int Count => h.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }\n }\n class PQ where TKey : IComparable\n {\n private PQ> q;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { q = new PQ>(cap, (x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { q = new PQ>((x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TKey k, TValue v) => q.Push(Tuple.Create(k, v));\n public Tuple Peek => q.Peek;\n public int Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple Pop() => q.Pop();\n }\n struct Mod : IEquatable\n {\n static public long _mod = 1000000007;\n private long _val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; }\n static public implicit operator Mod(long x) => new Mod(x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator long(Mod x) => x._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(Mod x, Mod y) => x._val + y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, Mod y) => x._val - y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator *(Mod x, Mod y) => x._val * y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(Mod x, Mod y) => x._val == y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(Mod x, Mod y) => x._val != y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IEquatable.Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override int GetHashCode() => _val.GetHashCode();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => _val.ToString();\n static private List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static private void Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod Comb(long n, long k) { Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n struct Mat\n {\n private T[,] m;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mat(T[,] v) { m = (T[,])v.Clone(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator Mat(T[,] v) => new Mat(v);\n public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, Mat b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat Pow(Mat x, long y) { var n = x.m.GetLength(0); var t = (Mat)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mat Pow(Mat x, long y) => Mat.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static T Pow(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void _Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Comb(long n, long k) { _Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KianuRivz\n{\n class Class1\n {\n static void Main()\n {\n int ed = 0 , nol = 0;\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++) if (s[i] == '1') ed++; else nol++;\n if (ed != nol) Console.WriteLine($\"1\\n{s}\");\n if (ed == nol)\n {\n Console.WriteLine(\"2\");\n Console.Write(s.Substring(0, s.Length - 1));\n Console.Write($\" {s[s.Length - 1]}\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforce572div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int[] A = str.ToArray().Select(x => x - '0').ToArray();\n int[] acc = new int[n + 1];\n for (int i = 1; i <= n; ++i)\n acc[i] = acc[i - 1] + A[i - 1];\n\n if (n % 2 == 1 || acc[n] != n / 2 || n == acc[n] || acc[n] == 0)\n {\n Console.WriteLine(\"1\" + Environment.NewLine + str);\n return;\n }\n\n for (int i = 1; i <= n; ++i)\n if (Check(acc[i], i) && Check(acc[n] - acc[i], n - i))\n {\n Console.WriteLine(\"2\" + Environment.NewLine + str.Substring(0, i) + \" \" + str.Substring(i, n - i));\n return;\n }\n\n }\n\n private static bool Check(int n, int l)\n {\n return l % 2 == 1 || n == l || n == 0 || n != l / 2;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n if (s.Count(x=>x=='1')==s.Count(x=>x=='0'))\n Console.WriteLine(\"2\\n\"+s.Remove(s.Length-1,1)+\" \"+s[s.Length-1]);\n else\n Console.WriteLine(\"1\\n\" + s);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nusing static System.Math;\n\nclass Program\n{\n static void Main()\n {\n var N = int.Parse(ReadLine());\n var s = ReadLine();\n var c = s.Count(x => x == '0');\n if (c == 0 || c == N)\n {\n WriteLine(1);\n WriteLine(s);\n return;\n }\n if (N-c!=c)\n {\n WriteLine(1);\n WriteLine(s);\n return;\n }\n if (s.Skip(1).Count(x => x == '0') == s.Skip(1).Count(x => x == '1'))\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 2) + \" \" + s.Substring(2));\n }\n else\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 1) + \" \" + s.Substring(1));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(\" \");\n //int n = Convert.ToInt32(s[0]);\n //int k = Convert.ToInt32(s[1]);\n\n //int time = 240 - k;\n //int i;\n //for (i = 1; i <= n; i++)\n //{\n // int task = i * 5;\n // if (time - task < 0)\n // {\n // break;\n // }\n\n // else\n // {\n // time -= task;\n\n // }\n //}\n //i--;\n //Console.WriteLine(i);\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n //int N = Convert.ToInt32(s[0]);\n //int M = Convert.ToInt32(s[1]);\n\n //if (N < 200 || M < N)\n //{\n // int K = N - M;\n // K++;\n // Console.WriteLine(K);\n //}\n #endregion\n\n #region\n //string s = Console.ReadLine();\n //var a = s.Count(c => c == 'a');\n //var res = a - 1;\n //Console.WriteLine(Math.Min(s.Length, res + a));\n\n //int n = Convert.ToInt32(Console.ReadLine());\n //int k = 0;\n //for (int i = 1; i < n; i++)\n //{\n // if (n % i == 0)\n // k++;\n //}\n //Console.WriteLine(k);\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n\n //int a = Convert.ToInt32(s[0]);\n //int b = Convert.ToInt32(s[1]);\n //int i = 0;\n //while (a <= b)\n //{\n // a *= 3;\n // b *= 2;\n // i++;\n //}\n //Console.WriteLine(i);\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n\n //int n = Convert.ToInt32(s[0]);\n //int m = Convert.ToInt32(s[1]);\n //int k = Convert.ToInt32(s[2]);\n\n //if (m < n || k < n)\n //{\n // Console.WriteLine(\"No\");\n //}\n //else\n //{\n // Console.WriteLine(\"Yes\");\n //}\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n //int t = Convert.ToInt32(str);\n\n //string a = \"I hate\";\n //string b = \" that I love\";\n //string c = \" that I hate\";\n\n //for (int i = 0; i < t-1; i++)\n //{\n // if (i % 2 == 1)\n // {\n // a += c;\n // }\n // else if( i % 2 == 0)\n // {\n // a += b;\n // }\n //}\n // Console.WriteLine($\"{a} it\");\n #endregion\n\n #region\n //int n = Convert.ToInt32(Console.ReadLine());\n //int a = n % 2;\n //if (a == 0)\n //{\n // Console.WriteLine(\"Mahmoud\");\n //}\n //else\n //{\n // Console.WriteLine(\"Ehab\");\n //}\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n\n //int n = Convert.ToInt32(s[0]);\n //int k = Convert.ToInt32(s[1]);\n\n //int count = 0;\n //while (count < k)\n //{\n // if (n % 10 == 0)\n // {\n // n = n / 10;\n // }\n // else\n // {\n // n = n - 1;\n // }\n // count++;\n //}\n //Console.WriteLine(n);\n #endregion\n\n #region\n //string[] s = Console.ReadLine().Split(' ');\n //int x = int.Parse(s[0]);\n //int y = int.Parse(s[1]);\n //int z = int.Parse(s[2]);\n\n //if ((x + y >= z) && (y + z >= x) && (x + z >= y))\n //{\n // Console.WriteLine(\"YES\");\n //}\n //else\n //{\n // Console.WriteLine(\"NO\");\n //}\n #endregion\n\n #region\n //int x = Convert.ToInt32(Console.ReadLine());\n\n // int count = 0;\n\n // count += x / 100;\n // x %= 100;\n // count += x / 20;\n // x %= 20;\n // count += x / 10;\n // x %= 10;\n // count += x / 5;\n // x %= 5;\n // count += x;\n\n //Console.WriteLine(count);\n #endregion\n\n #region\n //int n = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < n; i++)\n //{\n // string str = Console.ReadLine();\n // if (str.EndsWith(\"desu\") || str.EndsWith(\"masu\"))\n // {\n // Console.WriteLine(\"JAPANESE\");\n // }\n // else if (str.EndsWith(\"mnida\"))\n // {\n // Console.WriteLine(\"KOREAN\");\n // }\n // else if (str.EndsWith(\"po\"))\n // {\n // Console.WriteLine(\"FILIPINO\");\n // }\n //}\n #endregion\n\n #region\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n //int N = Convert.ToInt32(s[0]);\n //int K = Convert.ToInt32(s[1]);\n\n //int a = N * 2 / K;\n //int b = N * 5 / K;\n //int c = N * 8 / K;\n\n //int sum = a + b + c;\n\n //if (N * 2 % K != 0)\n // sum++;\n\n //if (N * 5 % K != 0)\n // sum++;\n\n //if (N * 8 % K != 0)\n // sum++;\n\n //Console.WriteLine(sum);\n #endregion\n\n #region\n //int n = Convert.ToInt32(Console.ReadLine());\n\n //for(int i = 0; i < n; i++)\n //{\n // string str = Console.ReadLine();\n // string[] s = str.Split(' ');\n // int k = Convert.ToInt32(s[0]);\n // int t = Convert.ToInt32(s[1]);\n\n // if(k < 24 || t < 60)\n // {\n // int c = 24 - k;\n // int b = 60 - t;\n\n // int v = 0;\n\n // if(c == 1)\n // {\n // v = b;\n // }\n // else\n // {\n // v = c * 60 - t; \n // }\n\n // Console.WriteLine(v);\n // }\n //}\n #endregion\n\n #region\n //int n = Convert.ToInt32(Console.ReadLine());\n\n //for(int i = 3; i == n; i++)\n //{\n // string str = Console.ReadLine();\n // string[] s = str.Split(' ');\n // int a = Convert.ToInt32(s[0]);\n // int b = Convert.ToInt32(s[1]);\n // int c = Convert.ToInt32(s[2]);\n\n // if(a < 2 || b < 2 || c < 2)\n // {\n // Console.WriteLine(\"NO\");\n // }\n // else\n // {\n // Console.WriteLine(\"YES\");\n // }\n //}\n #endregion\n\n #region\n //int n = Convert.ToInt32(Console.ReadLine());\n\n //if(n >= 4 || n <= 1000)\n //{\n // int v = n / 2;\n // Console.WriteLine(v);\n //}\n #endregion\n\n #region\n /* int t = Convert.ToInt32(Console.ReadLine());\n\n while (--t >= 0)\n {\n int n = Convert.ToInt32(Console.ReadLine()); ;\n string str = Console.ReadLine(); \n int max = 0;\n int m = 0;\n var hasAngry = false;\n for (var i = 0; i < n; i++)\n {\n if (str[i] == 'A')\n {\n hasAngry = true;\n m = 0;\n }\n else if (str[i] == 'P' && hasAngry)\n {\n m++;\n }\n\n if (m > max)\n max = m;\n }\n Console.WriteLine(max);\n\n }*/\n #endregion\n\n #region\n /* string str = Console.ReadLine();\n string[] s = str.Split(\" \");\n int k2 = Convert.ToInt32(s[0]);\n int k3 = Convert.ToInt32(s[1]);\n int k5 = Convert.ToInt32(s[2]);\n int k6 = Convert.ToInt32(s[3]);\n\n int r = 0;\n\n if (k2 <= k5 && k2 <= k6)\n {\n r = 256 * k2;\n k2 = 0;\n }\n else if (k5 <= k2 && k5 <= k6)\n {\n r = 256 * k5;\n k2 -= k5;\n }\n else if (k6 <= k2 && k6 <= k5)\n {\n r = 256 * k6;\n k2 -= k6;\n }\n\n if (k2 > 0)\n {\n if (k3 > k2)\n {\n r += 32 * k2;\n }\n else\n {\n r += 32 * k3;\n }\n }\n Console.WriteLine(r);*/\n #endregion\n\n #region\n int n = Convert.ToInt32(Console.ReadLine()); //\u041a\u0438\u0430\u043d\u0443 \u0420\u0438\u0432\u0437 \n string s = Console.ReadLine();\n int a = 0;\n int b = 0;\n foreach (char el in s)\n {\n if (el == '1')\n a++;\n else if (el == '0')\n b++;\n }\n if (a != b)\n Console.WriteLine(1 + \"\\n\" + s);\n else\n {\n Console.WriteLine(2);\n for (int i = 0; i < s.Length - 1; i++)\n {\n Console.Write(s[i]);\n }\n Console.WriteLine(\" \" + s[s.Length - 1]);\n }\n #endregion\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n var cnt0 = 0;\n var cnt1 = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == '0')\n cnt0++;\n else\n cnt1++;\n }\n\n if (cnt0 != cnt1)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n return;\n }\n\n var sb = new StringBuilder();\n var p = 0;\n var cur0 = 0;\n var cur1 = 0;\n for (p = 0; p < n; p++)\n {\n sb.Append(s[p]);\n if (s[p] == '0')\n {\n cnt0--;\n cur0++;\n }\n else\n {\n cnt1--;\n cur1++;\n }\n if (cnt0 != cnt1 && cur0 != cur1)\n {\n p++;\n break;\n }\n }\n\n var s1 = sb.ToString();\n sb.Clear();\n for (; p < n; p++)\n sb.Append(s[p]);\n var s2 = sb.ToString();\n Console.WriteLine(2);\n Console.WriteLine(s1+\" \"+s2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DailyCP\n{\n public class cf_572_1\n {\n static void Main(string[] args)\n {\n var obje = new cf_572_1();\n obje.Solve();\n }\n\n public void Solve()\n {\n int leng = Convert.ToInt32(Console.ReadLine());\n string value = Console.ReadLine();\n Queue breaks = new Queue();\n int lkup = -1;\n while (true)\n {\n int s = lkup+1;\n int onesTillNow = 0;\n for (int i = s; i < value.Length; i++)\n {\n if (value[i] == '1')\n {\n onesTillNow++;\n }\n \n if (onesTillNow != ((i-s) - onesTillNow + 1))\n {\n lkup = i;\n }\n }\n breaks.Enqueue(lkup);\n if (lkup == value.Length - 1)\n {\n break;\n }\n }\n Console.WriteLine(breaks.Count);\n while (breaks.Count > 0)\n {\n int b = breaks.Dequeue();\n for(int j=0;j 0)\n {\n b = breaks.Dequeue();\n }\n } \n } \n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task_01\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var s = Console.ReadLine() ?? \"\";\n\n if (s.Length % 2 == 1)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n return;\n }\n\n var zeroCount = s.Count(ch => ch == '0');\n if (zeroCount != s.Length /2)\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n return;\n }\n else\n {\n Console.WriteLine(2);\n Console.WriteLine(s.Substring(0, s.Length - 1) + \" \" + s.Substring(s.Length - 1));\n return;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n string s = sc.Next();\n int cnt1 = s.Count(c => c == '1');\n int cnt0 = n - cnt1;\n if (cnt1 == cnt0)\n {\n Console.WriteLine(2);\n Console.WriteLine($\"{s[0]} {s.Substring(1)}\");\n }\n else\n {\n Console.WriteLine(1);\n Console.WriteLine(s);\n }\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n Console.ReadLine();\n var s = Console.ReadLine();\n if (s.Count(x => x == '0') * 2 == s.Length)\n Console.WriteLine($\"2\\r\\n{s[0]} {s.Substring(1)}\");\n else\n Console.WriteLine($\"1\\r\\n{s}\");\n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n for (int i = 1; i <= 31; i++)\n sum += i;\n\n string lengthOfInput = Console.ReadLine();\n string input = Console.ReadLine();\n\n var inputChars = input.ToCharArray();\n int numberdifference = 0;\n for(int i = 0; i answer = new List();\n Console.ReadLine();\n s = Console.ReadLine();\n\n foreach (char c in s)\n {\n if (c == '0')\n {\n i0++;\n }\n else\n {\n i1++;\n }\n }\n if (i0 == i1)\n {\n Console.WriteLine(2);\n Console.Write(s[0]);\n Console.Write(\" \");\n for (int i = 1; i < s.Length; ++i)\n Console.Write(s[i]);\n\n }\n else\n {\n Console.WriteLine(1);\n Console.Write(s);\n }\n\n }\n\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace \u041e\u043b\u0438\u043c\u043f\u041f\u0440\u043e\u04331\n{\n\n class Program\n {\n public static bool isGood(string str)\n {\n int flag = 0;\n for(int i =0; i e == '0' ? -1 : 1).ToArray();\n var ruiseki = new long[n + 1];\n for (var i = 1; i <= n; i++)\n {\n ruiseki[i] = ruiseki[i - 1] + ary[i - 1];\n }\n\n var outlines = new List();\n\n var startIdx = 1;\n while (true)\n {\n var maxIdx = startIdx;\n var ok = false;\n for (var i = startIdx; i <= n; i++)\n {\n if (((ruiseki[i] - ruiseki[startIdx - 1]) != 0 && (ruiseki[n] - ruiseki[i] - ruiseki[startIdx - 1]) != 0) || ((ruiseki[i] - ruiseki[startIdx - 1]) != 0 && i == n))\n {\n maxIdx = i;\n ok = true;\n break;\n }\n else if (ruiseki[i] - ruiseki[startIdx - 1] != 0)\n {\n maxIdx = i;\n }\n }\n outlines.Add(s.Substring(startIdx - 1, maxIdx - startIdx + 1));\n if (ok)\n {\n outlines.Add(s.Substring(maxIdx));\n break;\n }\n startIdx = maxIdx + 1;\n }\n Console.WriteLine(outlines.Where(e => e.Length != 0).Count());\n Console.WriteLine(string.Join(\" \", outlines));\n\n }\n\n static public void Main(string[] args)\n {\n if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); }\n Solve();\n Console.Out.Flush();\n }\n static Random rand = new Random();\n static class Console_\n {\n private static Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n }\n static long NN => long.Parse(Console_.NextString());\n static double ND => double.Parse(Console_.NextString());\n static string NS => Console_.NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => rand.Next());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l, Comparison comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }\n static long LCM(long a, long b) => a * b / GCD(a, b);\n class PQ where T : IComparable\n {\n private List h;\n private Comparison c;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { h = new List(cap); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { h = new List(); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }\n public T Peek => h[0];\n public int Count => h.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }\n }\n class PQ where TKey : IComparable\n {\n private PQ> q;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { q = new PQ>(cap, (x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { q = new PQ>((x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TKey k, TValue v) => q.Push(Tuple.Create(k, v));\n public Tuple Peek => q.Peek;\n public int Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple Pop() => q.Pop();\n }\n struct Mod : IEquatable\n {\n static public long _mod = 1000000007;\n private long _val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; }\n static public implicit operator Mod(long x) => new Mod(x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator long(Mod x) => x._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(Mod x, Mod y) => x._val + y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, Mod y) => x._val - y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator *(Mod x, Mod y) => x._val * y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(Mod x, Mod y) => x._val == y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(Mod x, Mod y) => x._val != y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IEquatable.Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override int GetHashCode() => _val.GetHashCode();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => _val.ToString();\n static private List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static private void Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod Comb(long n, long k) { Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n struct Mat\n {\n private T[,] m;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mat(T[,] v) { m = (T[,])v.Clone(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator Mat(T[,] v) => new Mat(v);\n public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, Mat b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat Pow(Mat x, long y) { var n = x.m.GetLength(0); var t = (Mat)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mat Pow(Mat x, long y) => Mat.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static T Pow(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void _Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Comb(long n, long k) { _Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KianuRivz\n{\n class Class1\n {\n static void Main()\n {\n int ed = 0 , nol = 0;\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++) if (s[i] == 0) ed++; else nol++;\n if (ed != nol) Console.WriteLine(\"1\\n1\");\n if (ed == nol)\n {\n for (int i = 0; i < s.Length - 1; i++) Console.Write(s[i]);\n Console.Write($\" {s[s.Length - 1]}\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KianuRivz\n{\n class Class1\n {\n static void Main()\n {\n int ed = 0 , nol = 0;\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++) if (s[i] == '1') ed++; else nol++;\n if (ed != nol) Console.WriteLine(\"1\\n1\");\n if (ed == nol)\n {\n Console.WriteLine(\"2\");\n Console.Write(s.Substring(0, s.Length - 1));\n Console.Write($\" {s[s.Length - 1]}\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KianuRivz\n{\n class Class1\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length-1; i++) Console.Write(s[i]);\n Console.Write($\" {s[s.Length-1]}\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.IO.Pipes;\n\nnamespace consoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int inputLength = int.Parse(Console.ReadLine());\n string inputNumber = Console.ReadLine();\n\n int j;\n int SplitAmmount = 0;\n bool istGut = false;\n List splittedStrings = new List();\n\n do\n {\n SplitAmmount++;\n splittedStrings.Clear();\n for(int i = 0; i x - '0').ToArray();\n int[] acc = new int[n + 1];\n for (int i = 1; i <= n; ++i)\n acc[i] = acc[i - 1] + A[i - 1];\n \n if(acc[n] != n / 2)\n {\n Console.WriteLine(\"1\" + Environment.NewLine + str);\n return;\n }\n\n for(int i = 1; i <= n; ++i)\n if(Check(acc[i], i) && Check(acc[n] - acc[i], n - i))\n {\n Console.WriteLine(\"2\" + Environment.NewLine + str.Substring(0, i) + \" \" + str.Substring(i, n - i));\n return;\n }\n\n }\n\n private static bool Check(int n, int l)\n {\n return n == l || n == 0 || n != l / 2;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n \nnamespace codeforce572div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int[] A = str.ToArray().Select(x => x - '0').ToArray();\n int[] acc = new int[n + 1];\n for (int i = 1; i <= n; ++i)\n acc[i] = acc[i - 1] + A[i - 1];\n \n if(acc[n] != n / 2 || n == acc[n] || acc[n] == 0)\n {\n Console.WriteLine(\"1\" + Environment.NewLine + str);\n return;\n }\n \n for(int i = 1; i <= n; ++i)\n if(Check(acc[i], i) && Check(acc[n] - acc[i], n - i))\n {\n Console.WriteLine(\"2\" + Environment.NewLine + str.Substring(0, i) + \" \" + str.Substring(i, n - i));\n return;\n }\n \n }\n \n private static bool Check(int n, int l)\n {\n return n == l || n == 0 || n != l / 2;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforce572div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int[] A = str.ToArray().Select(x => x - '0').ToArray();\n int[] acc = new int[n + 1];\n for (int i = 1; i <= n; ++i)\n acc[i] = acc[i - 1] + A[i - 1];\n \n if(acc[n] != n / 2)\n {\n Console.WriteLine(str);\n return;\n }\n\n for(int i = 1; i <= n; ++i)\n if(Check(acc[i], i) && Check(acc[n] - acc[i], n - i))\n {\n Console.WriteLine(str.Substring(0, i) + \" \" + str.Substring(i, n - i));\n return;\n }\n\n }\n\n private static bool Check(int n, int l)\n {\n return n == l || n == 0 || n != l / 2;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n if (s.Count(x=>x==1)!=s.Count(x=>x==0)||s.Length==1)\n Console.WriteLine(\"1\\n\"+s); \n else\n\n Console.WriteLine(\"2\\n\"+s.Remove(s.Length-1,1)+\" \"+s[s.Length-1]);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nusing static System.Math;\n\nclass Program\n{\n static void Main()\n {\n var N = int.Parse(ReadLine());\n var s = ReadLine();\n var c = s.Count(x => x == '0');\n if (c == 0 || c == N)\n {\n WriteLine(1);\n WriteLine(s);\n return;\n }\n if (s.Skip(1).Count(x => x == '0') == s.Skip(1).Count(x => x == '1'))\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 2) + \" \" + s.Substring(2));\n }\n else\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 1) + \" \" + s.Substring(1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nusing static System.Math;\n\nclass Program\n{\n static void Main()\n {\n var N = int.Parse(ReadLine());\n var s = ReadLine();\n if (N == 1)\n {\n WriteLine(1);\n WriteLine(s);\n return;\n }\n if (s.Skip(1).Count(x => x == '0') == s.Skip(1).Count(x => x == '1'))\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 2) + \" \" + s.Substring(2));\n }\n else\n {\n WriteLine(2);\n WriteLine(s.Substring(0, 1) + \" \" + s.Substring(1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var s = input.ReadToken();\n if (n % 2 == 1)\n {\n WriteLine(1);\n WriteLine(s);\n }\n else\n {\n WriteLine(2);\n WriteLine($\"{s[0]} {s.Substring(1)}\");\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n\n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Threading;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(ReadLine());\n string b = ReadLine();\n solve(b);\n }\n public static void solve(string b)\n {\n int c = b.Count(x => x == '0');\n int d = b.Count(x => x == '1');\n if (c != d)\n {\n WriteLine(1);\n WriteLine(b);\n }\n else\n {\n WriteLine(2);\n string z = b.Substring(0, 1);\n string x = b.Substring(1, b.Length-2);\n WriteLine($\"{z} {x}\");\n }\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine();\n\n var zeroes = 0;\n for (var i = 0; i < n; i++)\n if (s[i] == '0')\n zeroes++;\n\n Console.WriteLine(n - zeroes == zeroes ? $\"1 {s}\" : $\"2 {s.Substring(0, n - 1)} {s[n - 1]}\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n int n=int.Parse(Console.ReadLine());\n string s=Console.ReadLine();\n int x=0;\n for(int i=0;i0)\n {\n Console.WriteLine(2);\n for(int i=0;i int.Parse(_)).ToArray();\n bool f = ChkSquare(g, (lx[1] - 1) % 3 * 3, (lx[0] - 1) % 3 * 3);\n if (!f)\n {\n for (int i = 0; i < 9; i++)\n for (int j = 0; j < 9; j++)\n if (g[i, j] == 0)\n g[i, j] = 3;\n }\n else\n {\n int x = (lx[1] - 1) % 3 * 3, y = (lx[0] - 1) % 3 * 3;\n for (int i = x; i < x + 3; i++)\n for (int j = y; j < y + 3; j++)\n {\n if (g[i, j] == 0)\n g[i, j] = 3;\n }\n }\n\n\n for (int j = 0; j < 9; j++)\n {\n for (int i = 0; i < 9; i++)\n {\n if (i != 0 && i % 3 == 0)\n Console.Write(\" \");\n switch (g[i, j])\n {\n case 0:\n Console.Write(\".\");\n break;\n case 1:\n Console.Write(\"x\");\n break;\n case 2:\n Console.Write(\"o\");\n break;\n case 3:\n Console.Write(\"!\");\n break;\n }\n }\n if (j + 1 != 0 && (j + 1) % 3 == 0)\n Console.WriteLine();\n Console.WriteLine();\n }\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var f = new char[9][];\n ReadField(f);\n var x = input.ReadInt() - 1;\n var y = input.ReadInt() - 1;\n var fx = x % 3;\n var fy = y % 3;\n if (!TryFillField(f, fx, fy))\n FillAll(f);\n PrintField(f);\n }\n\n private void ReadField(char[][] f)\n {\n for (int i = 0; i < 9; i++)\n {\n if (i != 0 && i % 3 == 0)\n input.ReadLine();\n f[i] = string.Join(\"\", input.ReadLine().Split()).ToCharArray();\n }\n }\n\n private void PrintField(char[][] f)\n {\n var sb = new StringBuilder();\n for (int i = 0; i < 9; i++)\n {\n if (i != 0 && i % 3 == 0)\n sb.AppendLine();\n for (int j = 0; j < 9; j++)\n {\n if (j != 0 && j % 3 == 0)\n sb.Append(' ');\n sb.Append(f[i][j]);\n }\n sb.AppendLine();\n }\n Console.Write(sb);\n }\n\n private void FillAll(char[][] f)\n {\n for (int i = 0; i < 9; i++)\n for (int j = 0; j < 9; j++)\n if (f[i][j] == '.')\n f[i][j] = '!';\n }\n\n private bool TryFillField(char[][] f, int fx, int fy)\n {\n bool result = false;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int lx = fx * 3 + i;\n int ly = fy * 3 + j;\n if (f[lx][ly] == '.')\n {\n f[lx][ly] = '!';\n result = true;\n }\n }\n }\n return result;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private const string ABC = \"abcdefghijklmnopqrstuvwxyz\";\n\n private static void AddCount(Dictionary counter, T item)\n {\n int count;\n if (counter.TryGetValue(item, out count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n int count;\n return counter.TryGetValue(item, out count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Set : SortedSet\n {\n }\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n char[,] a = new char[9, 9];\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n string temp = ReadString();\n while (temp == \"\")\n temp = ReadString();\n for (int td = 0; td < 3; td++)\n {\n a[i, j * 3 + td] = temp[td];\n }\n }\n }\n\n int x = ReadInt() - 1, y = ReadInt() - 1;\n\n int kx = x % 3;\n int ky = y % 3;\n\n bool f = false;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n f |= (a[kx * 3 + i, ky * 3 + j] == '.');\n }\n }\n\n if (f)\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (a[kx * 3 + i, ky * 3 + j] == '.')\n a[kx * 3 + i, ky * 3 + j] = '!';\n }\n }\n }\n else\n {\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n if (a[ i, j] == '.')\n a[i, j] = '!';\n }\n }\n }\n\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n for (int td = 0; td < 3; td++)\n {\n sw.Write(a[i, j * 3 + td]);\n }\n sw.Write(\" \");\n }\n sw.WriteLine();\n if (i % 3 == 2)\n sw.WriteLine();\n }\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n class Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _904B\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n int[,][,] matrix = new int[3, 3][,];\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n matrix[i, j] = new int[3, 3];\n for (int Y = 0; Y < 3; Y++)\n {\n for (int y = 0; y < 3; y++)\n {\n string[] line = Console.ReadLine().Split(' ');\n for (int X = 0; X < 3; X++)\n {\n for (int x = 0; x < 3; x++)\n {\n matrix[X, Y][x, y] = line[X][x] == '.' ? 0 : (line[X][x] == 'x' ? 1 : 2);\n }\n }\n }\n if (Y != 2)\n Console.ReadLine();\n }\n string[] lastLine = Console.ReadLine().Split(' ');\n int lastY = int.Parse(lastLine[0]) - 1, lastX = int.Parse(lastLine[1]) - 1;\n int posX = lastX % 3, posY = lastY % 3;\n List> found = new List>();\n for (int x = 0; x < 3; x++)\n for (int y = 0; y < 3; y++)\n if (matrix[posX,posY][x,y] == 0)\n found.Add(new Tuple(x, y));\n if (found.Count == 0)\n {\n for (int X = 0; X < 3; X++)\n for (int Y = 0; Y < 3; Y++)\n for (int x = 0; x < 3; x++)\n for (int y = 0; y < 3; y++)\n {\n if (matrix[X, Y][x, y] == 0)\n matrix[X, Y][x, y] = 10;\n }\n }\n else\n {\n foreach (var p in found)\n matrix[posX, posY][p.Item1, p.Item2] = 10;\n }\n var sb = new StringBuilder();\n for (int Y = 0; Y < 3; Y++)\n {\n for (int y = 0; y < 3; y++)\n {\n for (int X = 0; X < 3; X++)\n {\n for (int x = 0; x < 3; x++)\n {\n switch (matrix[X, Y][x, y])\n {\n case 0:\n sb.Append('.');\n break;\n case 1:\n sb.Append('x');\n break;\n case 2:\n sb.Append('o');\n break;\n case 10:\n sb.Append('!');\n break;\n }\n }\n if (X != 2)\n sb.Append(' ');\n }\n sb.AppendLine();\n }\n if (Y != 2)\n sb.AppendLine();\n }\n Console.Write(sb);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Tic_Tac_Toe\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n var nn = new int[9,9];\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n nn[i, j] = Next();\n }\n }\n\n int x = (Next() - 1)%3;\n int y = (Next() - 1)%3;\n\n x *= 3;\n y *= 3;\n bool f = false;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (nn[x + i, y + j] == 0)\n {\n f = true;\n nn[x + i, y + j] = 2;\n }\n }\n }\n\n\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n if (j == 3 || j == 6)\n writer.Write(' ');\n switch (nn[i, j])\n {\n case 0:\n writer.Write(f ? '.' : '!');\n break;\n case 1:\n writer.Write('x');\n break;\n case -1:\n writer.Write('o');\n break;\n case 2:\n writer.Write('!');\n break;\n }\n }\n writer.WriteLine();\n if (i == 2 || i == 5)\n writer.WriteLine();\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == '.')\n return 0;\n if (c == 'x')\n return 1;\n if (c == 'o')\n return -1;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.NET\n{\n class Table\n {\n List> Components { get; set; }\n }\n class Program\n {\n private static void WriteFull(List values)\n {\n for (int i = 0; i < 9; i++)\n {\n for(int j = 0; j < 9; j++)\n {\n if (values[i][j] == '.')\n {\n Console.Write('!');\n }\n else Console.Write(values[i][j]);\n if (j== 2 || j == 5)\n {\n Console.Write(' ');\n }\n }\n if (i == 2 || i == 5)\n {\n Console.WriteLine();\n }\n Console.WriteLine();\n }\n }\n static void Main(string[] args)\n {\n List lines = new List();\n string line = null;\n for (int i = 0; i < 11; i++)\n {\n line = Console.ReadLine();\n if (line != string.Empty)\n {\n line = line.Replace(\" \", \"\");\n lines.Add(line);\n }\n }\n\n line = Console.ReadLine();\n int x = line.Split(' ').Select(xx => int.Parse(xx)).ToArray()[0];\n int y = line.Split(' ').Select(xx => int.Parse(xx)).ToArray()[1];\n\n int linie = x % 3;\n if (linie == 0) linie = 3;\n int coloana = y % 3;\n if (coloana == 0) coloana = 3;\n if (linie == 1 && coloana == 1)\n {\n bool isFull = true;\n for (int i = 1; i<=3; i++)\n {\n for (int j = 1; j<=3; j++)\n {\n if (lines[i-1][j-1] == '.')\n {\n isFull = false;\n break; \n }\n }\n }\n\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i<=9; i++)\n {\n for (int j = 1; j<=9; j++)\n {\n if (lines[i-1][j-1] != '.')\n {\n Console.Write(lines[i-1][j-1]);\n }\n else\n {\n if (i >= 1 && i <= 3 && j >= 1 && j <= 3)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 1 && coloana == 2)\n {\n bool isFull = true;\n for (int i = 1; i <= 3; i++)\n {\n for (int j = 4; j <= 6; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 1 && i <= 3 && j >= 4 && j <= 6)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n \n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6)\n {\n Console.WriteLine();\n }\n\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 1 && coloana == 3)\n {\n bool isFull = true;\n for (int i = 1; i <= 3; i++)\n {\n for (int j = 7; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 1 && i <= 3 && j >= 7 && j <= 9)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n \n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 2 && coloana == 1)\n {\n bool isFull = true;\n for (int i = 4; i <= 6; i++)\n {\n for (int j = 1; j <= 3; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 4 && i <= 6 && j >= 1 && j <= 3)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n\n if (i == 3 || i == 6) Console.WriteLine();\n\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 2 && coloana == 2)\n {\n bool isFull = true;\n for (int i = 4; i <= 6; i++)\n {\n for (int j = 4; j <= 6; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 4 && i <= 6 && j >= 4 && j <= 6)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 2 && coloana == 3)\n {\n bool isFull = true;\n for (int i = 4; i <= 6; i++)\n {\n for (int j = 7; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 4 && i <= 6 && j >= 7 && j <= 9)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 3 && coloana == 1)\n {\n bool isFull = true;\n for (int i = 7; i <= 9; i++)\n {\n for (int j = 1; j <= 3; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 7 && i <= 9 && j >= 1 && j <= 3)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else if (linie == 3 && coloana == 2)\n {\n bool isFull = true;\n for (int i = 7; i <= 9; i++)\n {\n for (int j = 4; j <= 6; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 7 && i <= 9 && j >= 4 && j <= 6)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine();\n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n else\n {\n bool isFull = true;\n for (int i = 7; i <= 9; i++)\n {\n for (int j = 7; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] == '.')\n {\n isFull = false;\n break;\n }\n }\n }\n if (isFull)\n {\n WriteFull(lines);\n Console.ReadLine();\n return;\n\n }\n\n for (int i = 1; i <= 9; i++)\n {\n for (int j = 1; j <= 9; j++)\n {\n if (lines[i - 1][j - 1] != '.')\n {\n Console.Write(lines[i - 1][j - 1]);\n }\n else\n {\n if (i >= 7 && i <= 9 && j >= 7 && j <= 9)\n {\n Console.Write('!');\n }\n else Console.Write(lines[i - 1][j - 1]);\n }\n if (j == 3 || j == 6) Console.Write(' ');\n }\n if (i == 3 || i == 6) Console.WriteLine(); \n Console.WriteLine();\n }\n\n Console.ReadLine();\n return;\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsProg\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] fields = new char[9, 9];\n int counter = 0, counter1 = 0;\n for(int i = 0; i < 9; i++)\n { \n string chars = Console.ReadLine();\n for(int k = 0; k < 11; k++)\n {\n if (k == 3 || k == 7)\n {\n counter1++;\n continue;\n }\n fields[i, counter] = chars[counter1];\n counter++;\n counter1++;\n }\n counter = 0;\n counter1 = 0;\n if (i == 2 || i == 5)\n Console.ReadLine();\n }\n string data = Console.ReadLine();\n int x = ((int.Parse(data[0].ToString())-1)%3+1)*3-3;\n int y = ((int.Parse(data[2].ToString()) - 1) % 3 + 1) * 3 - 3;\n bool check = true;\n for (int i = x; i < x + 3; i++)\n for (int k = y; k < y + 3; k++)\n if (fields[i, k] == '.')\n {\n fields[i, k] = '!';\n check = false;\n }\n for(int i = 0; i < 9; i++)\n {\n for(int k = 0; k < 9; k++)\n {\n if (k == 3 || k == 6)\n Console.Write(\" \");\n if (check)\n {\n if (fields[i, k] == '.')\n Console.Write('!');\n else\n Console.Write(fields[i, k]); \n }\n else\n Console.Write(fields[i, k]);\n }\n Console.WriteLine();\n if (i == 2 || i == 5)\n Console.WriteLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.Text;\n\nnamespace TechnoCup2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] layer1 = Console.ReadLine().Split(' ');\n string[] layer2 = Console.ReadLine().Split(' ');\n string[] layer3 = Console.ReadLine().Split(' ');\n Console.ReadLine();\n string[] layer4 = Console.ReadLine().Split(' ');\n string[] layer5 = Console.ReadLine().Split(' ');\n string[] layer6 = Console.ReadLine().Split(' ');\n Console.ReadLine();\n string[] layer7 = Console.ReadLine().Split(' ');\n string[] layer8 = Console.ReadLine().Split(' ');\n string[] layer9 = Console.ReadLine().Split(' ');\n string[] coordinates = Console.ReadLine().Split(' ');\n BigField bigField = new BigField();\n bigField.fields[0, 0] = new Field(layer1[0], layer2[0], layer3[0]);\n bigField.fields[1, 0] = new Field(layer1[1], layer2[1], layer3[1]);\n bigField.fields[2, 0] = new Field(layer1[2], layer2[2], layer3[2]);\n\n bigField.fields[0, 1] = new Field(layer4[0], layer5[0], layer6[0]);\n bigField.fields[1, 1] = new Field(layer4[1], layer5[1], layer6[1]);\n bigField.fields[2, 1] = new Field(layer4[2], layer5[2], layer6[2]);\n\n bigField.fields[0, 2] = new Field(layer7[0], layer8[0], layer9[0]);\n bigField.fields[1, 2] = new Field(layer7[1], layer8[1], layer9[1]);\n bigField.fields[2, 2] = new Field(layer7[2], layer8[2], layer9[2]);\n\n int[] coordinatesNumeric = new int[] { Convert.ToInt32(coordinates[1]), Convert.ToInt32(coordinates[0]) };\n int[] coordinatesInternal = new int[] { coordinatesNumeric[0] % 3, coordinatesNumeric[1] % 3 };\n if (coordinatesInternal[0] == 0)\n coordinatesInternal[0] = 3;\n if (coordinatesInternal[1] == 0)\n coordinatesInternal[1] = 3;\n\n //int[] coordinatesExternal = new int[] { (coordinatesNumeric[0] - coordinatesInternal[0]) / 3, (coordinatesNumeric[1] - coordinatesInternal[1]) / 3 };\n\n if (bigField.fields[coordinatesInternal[0] - 1, coordinatesInternal[1] - 1].isFullBusy)\n {\n bigField.SetFullEmpty();\n }\n else\n {\n bigField.fields[coordinatesInternal[0] - 1, coordinatesInternal[1] - 1].SetEmpty();\n }\n for(int i = 0; i < 9; i++)\n {\n if (i % 3 == 0 && i != 0)\n Console.WriteLine();\n Console.WriteLine(bigField.printLayer(i));\n }\n //Console.ReadKey();\n }\n }\n class Field\n {\n public int[,] busy;\n public Field(string layer1, string layer2, string layer3)\n {\n fill(layer1, layer2, layer3);\n }\n public void fill(string layer1, string layer2, string layer3)\n {\n busy = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n if (layer1[i] == 'o')\n busy[i, 0] = 1;\n if (layer2[i] == 'o')\n busy[i, 1] = 1;\n if (layer3[i] == 'o')\n busy[i, 2] = 1;\n \n if (layer1[i] == 'x')\n busy[i, 0] = 2;\n if (layer2[i] == 'x')\n busy[i, 1] = 2;\n if (layer3[i] == 'x')\n busy[i, 2] = 2;\n }\n }\n public bool isFullBusy { get\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n if (busy[i, j] == 0)\n return false;\n }\n return true;\n }\n }\n public void SetEmpty()\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n if (busy[i, j] == 0)\n busy[i, j] = 3;\n }\n }\n public string printLayer(int layerNum)\n {\n StringBuilder sb = new StringBuilder();\n for(int i = 0; i < 3; i++)\n {\n switch(busy[i, layerNum])\n {\n case 1:\n sb.Append(\"o\");\n break;\n case 2:\n sb.Append(\"x\");\n break;\n case 3:\n sb.Append(\"!\");\n break;\n default:\n sb.Append(\".\");\n break;\n }\n }\n return sb.ToString();\n }\n \n }\n class BigField\n {\n public Field[,] fields;\n public BigField()\n {\n fields = new Field[3, 3];\n }\n public void SetFullEmpty()\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n fields[i, j].SetEmpty();\n }\n }\n public string printLayer(int layerNum)\n {\n int internalLayer = layerNum % 3;\n /*if (internalLayer == 0 && layerNum != 0)\n internalLayer = 3;*/\n layerNum = (layerNum - internalLayer) / 3;\n StringBuilder sb = new StringBuilder(0);\n for(int i = 0; i < 3; i++)\n {\n sb.Append(fields[i, layerNum].printLayer(internalLayer));\n if (i != 2)\n sb.Append(\" \");\n }\n return sb.ToString();\n }\n }\n}\n/*class Program\n{\n static void Main(string[] args)\n {\n string length = Console.ReadLine();\n string input = Console.ReadLine();\n int changing = 0;\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i <= input.Length - 2; i += 2)\n {\n if (input[i] == input[i + 1])\n {\n if (input[i] == 'a') { sb.Append(input[i] + \"b\"); }\n else { sb.Append(input[i] + \"a\"); }\n changing++;\n }\n else\n sb.Append(input[i] + \"\" + input[i + 1]);\n }\n Console.WriteLine(changing);\n Console.WriteLine(sb.ToString());\n Console.ReadKey();\n }\n}*/\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Set : SortedSet\n {\n }\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n char[,] a = new char[9, 9];\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n string temp = ReadString();\n while (temp == \"\")\n temp = ReadString();\n for (int td = 0; td < 3; td++)\n {\n a[i, j * 3 + td] = temp[td];\n }\n }\n }\n\n int x = ReadInt() - 1, y = ReadInt() - 1;\n\n int kx = x % 3;\n int ky = y % 3;\n\n bool f = false;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n f |= (a[kx * 3 + i, ky * 3 + j] == '.');\n }\n }\n\n if (f)\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (a[kx * 3 + i, ky * 3 + j] == '.')\n a[kx * 3 + i, ky * 3 + j] = '!';\n }\n }\n }\n else\n {\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n if (a[ i, j] == '.')\n a[i, j] = '!';\n }\n }\n }\n\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n for (int td = 0; td < 3; td++)\n {\n sw.Write(a[i, j * 3 + td]);\n }\n sw.Write(\" \");\n }\n sw.WriteLine();\n }\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n class Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.Text;\n\nnamespace TechnoCup2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] layer1 = Console.ReadLine().Split(' ');\n string[] layer2 = Console.ReadLine().Split(' ');\n string[] layer3 = Console.ReadLine().Split(' ');\n Console.ReadLine();\n string[] layer4 = Console.ReadLine().Split(' ');\n string[] layer5 = Console.ReadLine().Split(' ');\n string[] layer6 = Console.ReadLine().Split(' ');\n Console.ReadLine();\n string[] layer7 = Console.ReadLine().Split(' ');\n string[] layer8 = Console.ReadLine().Split(' ');\n string[] layer9 = Console.ReadLine().Split(' ');\n string[] coordinates = Console.ReadLine().Split(' ');\n BigField bigField = new BigField();\n bigField.fields[0, 0] = new Field(layer1[0], layer2[0], layer3[0]);\n bigField.fields[1, 0] = new Field(layer1[1], layer2[1], layer3[1]);\n bigField.fields[2, 0] = new Field(layer1[2], layer2[2], layer3[2]);\n\n bigField.fields[0, 1] = new Field(layer4[0], layer5[0], layer6[0]);\n bigField.fields[1, 1] = new Field(layer4[1], layer5[1], layer6[1]);\n bigField.fields[2, 1] = new Field(layer4[2], layer5[2], layer6[2]);\n\n bigField.fields[0, 2] = new Field(layer7[0], layer8[0], layer9[0]);\n bigField.fields[1, 2] = new Field(layer7[1], layer8[1], layer9[1]);\n bigField.fields[2, 2] = new Field(layer7[2], layer8[2], layer9[2]);\n\n int[] coordinatesNumeric = new int[] { Convert.ToInt32(coordinates[1]), Convert.ToInt32(coordinates[0]) };\n int[] coordinatesInternal = new int[] { coordinatesNumeric[0] % 3, coordinatesNumeric[1] % 3 };\n if (coordinatesInternal[0] == 0)\n coordinatesInternal[0] = 3;\n if (coordinatesInternal[1] == 0)\n coordinatesInternal[1] = 3;\n\n //int[] coordinatesExternal = new int[] { (coordinatesNumeric[0] - coordinatesInternal[0]) / 3, (coordinatesNumeric[1] - coordinatesInternal[1]) / 3 };\n\n if (bigField.fields[coordinatesInternal[0] - 1, coordinatesInternal[1] - 1].isFullBusy)\n {\n bigField.SetFullEmpty();\n }\n else\n {\n bigField.fields[coordinatesInternal[0] - 1, coordinatesInternal[1] - 1].SetEmpty();\n }\n for(int i = 0; i < 9; i++)\n {\n if (i % 3 == 0)\n Console.WriteLine();\n Console.WriteLine(bigField.printLayer(i));\n }\n //Console.ReadKey();\n }\n }\n class Field\n {\n public int[,] busy;\n public Field(string layer1, string layer2, string layer3)\n {\n fill(layer1, layer2, layer3);\n }\n public void fill(string layer1, string layer2, string layer3)\n {\n busy = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n if (layer1[i] == 'o')\n busy[i, 0] = 1;\n if (layer2[i] == 'o')\n busy[i, 1] = 1;\n if (layer3[i] == 'o')\n busy[i, 2] = 1;\n \n if (layer1[i] == 'x')\n busy[i, 0] = 2;\n if (layer2[i] == 'x')\n busy[i, 1] = 2;\n if (layer3[i] == 'x')\n busy[i, 2] = 2;\n }\n }\n public bool isFullBusy { get\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n if (busy[i, j] == 0)\n return false;\n }\n return true;\n }\n }\n public void SetEmpty()\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n if (busy[i, j] == 0)\n busy[i, j] = 3;\n }\n }\n public string printLayer(int layerNum)\n {\n StringBuilder sb = new StringBuilder();\n for(int i = 0; i < 3; i++)\n {\n switch(busy[i, layerNum])\n {\n case 1:\n sb.Append(\"o\");\n break;\n case 2:\n sb.Append(\"x\");\n break;\n case 3:\n sb.Append(\"!\");\n break;\n default:\n sb.Append(\".\");\n break;\n }\n }\n return sb.ToString();\n }\n \n }\n class BigField\n {\n public Field[,] fields;\n public BigField()\n {\n fields = new Field[3, 3];\n }\n public void SetFullEmpty()\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n fields[i, j].SetEmpty();\n }\n }\n public string printLayer(int layerNum)\n {\n int internalLayer = layerNum % 3;\n /*if (internalLayer == 0 && layerNum != 0)\n internalLayer = 3;*/\n layerNum = (layerNum - internalLayer) / 3;\n StringBuilder sb = new StringBuilder(0);\n for(int i = 0; i < 3; i++)\n {\n sb.Append(fields[i, layerNum].printLayer(internalLayer));\n if (i != 2)\n sb.Append(\" \");\n }\n return sb.ToString();\n }\n }\n}"}], "src_uid": "8f0fad22f629332868c39969492264d3"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n public class Train\n {\n public static void Main(string[] args)\n {\n var tokens = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(x => int.Parse(x));\n var n = tokens[0];\n var m = tokens[1];\n var k = tokens[2];\n var dir = Console.ReadLine();\n var d = dir == \"to head\" ? -1 : 1;\n var state = Console.ReadLine();\n var time = 0;\n var caught = false;\n for (int i = 0; i < state.Length - 1; i++)\n {\n if (state[i] == '0')\n {\n if (m + d > 0 && m + d <= n)\n {\n m += d;\n }\n k += d;\n if (k == 1 || k == n)\n {\n d = -d;\n }\n if (m == k)\n {\n caught = true;\n time = i + 1;\n break;\n }\n }\n else\n {\n m = d == -1 ? n : 1;\n k += d;\n if (k == 1 || k == n)\n {\n d = -d;\n }\n }\n }\n if (caught)\n {\n Console.WriteLine(\"Controller \" + time);\n }\n else\n {\n Console.WriteLine(\"Stowaway\");\n }\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n toS = Console.ReadLine().Trim();\n s = Console.ReadLine().Trim();\n#endif\n kn = toS[3] == 'h' ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i+1==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n && kn>0) kn = -1;\n if (k == 1 && kn<0) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n // test\n static CodeforcesUtils CF = new CodeforcesUtils( new[]{\n\n@\"\n5 3 2\nto head\n0001001\n\"\n,\n@\"\n3 2 1\nto tail\n0001\n\"\n });\n\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = int.Parse(ss[2]);\n\n int dir = 1;\n if( CF.ReadLine() == \"to head\" )\n dir = -1;\n\n var s = CF.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n CF.WriteLine(\"Stowaway\");\n return;\n }\n\n k += dir;\n if (k < 1)\n {\n k = 2;\n dir = +1;\n }\n if (k > n)\n {\n k = n - 1;\n dir = -1;\n }\n\n if (s[i] == '1')\n {\n if (dir == 1)\n m = 1;\n else\n m = n;\n }\n else\n {\n if (m == k)\n {\n if (m == 1 || m == n)\n {\n CF.WriteLine(\"Controller \" + (i + 1));\n return;\n }\n m += dir;\n }\n }\n }\n\n }\n\n\n\n #region test\n\n static void Main(string[] args)\n {\n System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(\"ru-RU\");\n\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public CodeforcesUtils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public CodeforcesUtils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n public void Close()\n {\n if( _sr!= null)\n _sr.Close();\n if( _sw != null)\n _sw.Close();\n }\n\n System.IO.StreamReader _sr=null;\n System.IO.StreamWriter _sw=null;\n \n }\n\n #endregion\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nclass B\n{\n static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n var k = int.Parse(line[2]);\n\n var kto = (Console.ReadLine() == \"to head\") ? -1 : 1;\n var stat = Console.ReadLine();\n\n\n for (var i = 0; i < stat.Length; i++)\n {\n if (stat[i] == '1') m = 0;\n else if (m == k + kto)\n if ((m > 1) && (m < k)) m--;\n else if ((m < n) && (m > k)) m++;\n\n k += kto;\n if (k == 1) kto = 1;\n else if (k == n) kto = -1;\n\n if (m == k)\n {\n Console.WriteLine(\"Controller \" + (i + 1));\n return;\n }\n\n if (stat[i] == '1') if ((k > 1) && ((kto == 1) || (k == n))) m = 1; else m = n;\n }\n\n Console.WriteLine(\"Stowaway\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n\n if (S == C && code[0]!='1')\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] == '1')\n {\n S = C;\n }\n \n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", i+1);\n return;\n }\n \n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round68\n{\n class B\n {\n public static void Main()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int n = xs[0],\n m = xs[1],\n k = xs[2];\n int dx = Console.ReadLine() == \"to head\" ? -1 : 1;\n var s = Console.ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n if (!(1 <= k + dx && k + dx <= n))\n dx = -dx;\n k += dx;\n if (s[i] == '1')\n {\n m = k - dx;\n }\n else\n {\n if (1 <= m + dx && m + dx <= n)\n m += dx;\n if (k == m)\n {\n Console.WriteLine(\"Controller {0}\", i + 1);\n return;\n }\n }\n }\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class _74b\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var split = line.Split(new[] { ' ' });\n var n = int.Parse(split[0]);\n var m = int.Parse(split[1]);\n var k = int.Parse(split[2]);\n line = Console.ReadLine();\n var dir = line.Contains(\"tail\") ? 1 : -1;\n line = Console.ReadLine();\n for (var i = 0; i < line.Length; i++)\n {\n if (k == 1 && dir == -1)\n {\n dir = 1;\n k = 2;\n }\n else if (k == n && dir == 1)\n {\n dir = -1;\n k = n - 1;\n }\n else\n {\n k += dir;\n }\n if (line[i] == '0')\n {\n if (m != n && m != 1)\n {\n m += dir;\n }\n if (k == m)\n {\n Console.WriteLine(\"Controller {0}\", i + 1);\n return;\n }\n }\n else\n {\n if (dir == -1)\n {\n if (k == n)\n {\n m = 1;\n }\n else\n {\n m = n;\n }\n }\n else\n {\n if (k == 1)\n {\n m = n;\n }\n else\n {\n m = 1;\n }\n }\n }\n }\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] a = GetInts();\n int n = a[0], m = a[1], k = a[2];\n\n bool toHead = GetStr().Equals(\"to head\");\n string s = GetStr();\n\n int min = -1;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (toHead)\n {\n k -= 1;\n if (k == 0)\n {\n k = 2;\n toHead = false;\n }\n }\n else\n {\n k += 1;\n if (k > n)\n {\n k = n - 1;\n toHead = true;\n }\n }\n\n if (s[i] == '1') // stop\n {\n if (toHead)\n m = k + 1;\n else\n m = k - 1;\n }\n else if (m == k)\n {\n if (!toHead) \n m += 1;\n else \n m -= 1;\n if (m < 1 || m > n)\n {\n min = i + 1;\n break;\n }\n }\n }\n\n if (min == -1)\n WL(\"Stowaway\");\n else\n WL(\"Controller \" + min);\n\n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static int GetInt(string s)\n {\n return int.Parse(s);\n }\n\n static int[] GetInts()\n {\n string[] ss = GetStrs();\n int[] nums = new int[ss.Length];\n\n int i = 0;\n foreach (string s in ss)\n nums[i++] = GetInt(s);\n\n return nums;\n }\n\n static string[] GetStrs()\n {\n return Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]) - 1; // rabbit\n int k = int.Parse(line[2]) - 1;\n int dir = Console.ReadLine() == \"to tail\" ? 1 : -1;\n string s = Console.ReadLine();\n\n if (k == 0)\n dir = 1;\n if (k == n - 1)\n dir = -1;\n\n bool rabbitbefore = m < k;\n bool caught = false;\n int time = 0;\n for (; time < s.Length; time++)\n {\n k += dir;\n\n if (s[time] == '1')\n {\n rabbitbefore = (dir == 1);\n }\n else\n {\n if (k == 0 && rabbitbefore || k == n - 1 && !rabbitbefore)\n {\n caught = true;\n break;\n }\n }\n\n if (k == 0 || k == n - 1)\n dir = -dir;\n }\n\n if(caught)\n Console.WriteLine(\"Controller {0}\", time + 1);\n else\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\nstatic void Main()\n{\nstring s1 = Console.ReadLine();\nint n = int.Parse(s1.Split(' ')[0]) - 1;\nint win = -1;\nint z0 = int.Parse(s1.Split(' ')[1]) - 1;\nint c0 = int.Parse(s1.Split(' ')[2]) - 1;\n\nstring s2 = Console.ReadLine();\n\nstring s3 = Console.ReadLine();\n\nfor (int i=0; i c0)\n {\n if (z0 != n)\n z0++;\n }\n else\n {\n if (z0 != 0)\n z0--;\n } \n }\n \n if (s3[i] != '1')\n peremesh(n, ref c0, ref s2);\n\n \n if (c0 == z0)\n {\n Console.WriteLine(\"Controller {0}\", (i+1).ToString());\n win = 1;\n break;\n }\n}\nif (win != 1)\nConsole.WriteLine(\"Stowaway\");\n\nConsole.ReadKey();\n\n}\n\nstatic void peremesh(int n, ref int place, ref string dir)\n{\nif (dir == \"to tail\")\n{\nif (place < n)\nplace++;\nelse\n{\ndir = \"to head\";\nplace--;\n}\n}\nelse\nif (place > 0)\nplace--;\nelse\n{\ndir = \"to tail\";\nplace++;\n}\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int k = int.Parse(input[2]);\n int r;\n if (Console.ReadLine().Equals(\"to head\"))\n r = -1;\n else\n r = 1;\n string time = Console.ReadLine();\n for (int i = 0; i < time.Length; i++)\n {\n if (k == n || k == 1)\n {\n if (k == 1)\n {\n if (r == -1)\n r = (-1) * r;\n }\n else\n {\n if (r == 1)\n r = (-1) * r;\n }\n }\n if (time[i].Equals('0'))\n {\n if (Math.Abs(m - k) > 1)\n k += r;\n else\n {\n if (m == k)\n {\n Console.WriteLine(\"Controller\" + \" \" + (i + 1).ToString());\n return;\n }\n else\n {\n if (m == 1 || m == n)\n {\n k += r;\n if (m == k)\n {\n Console.WriteLine(\"Controller\" + \" \" + (i + 1).ToString());\n return;\n }\n }\n else\n {\n m += r;\n k += r;\n }\n }\n }\n }\n else\n {\n k += r;\n if (r == 1)\n m = 1;\n else\n m = n;\n }\n }\n Console.WriteLine(\"Stowaway\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(tmp[0]);\n int zayc = int.Parse(tmp[1]);\n int controller = int.Parse(tmp[2]);\n int minut = -5;\n string naprav = Console.ReadLine();\n int znak = 0;\n if (naprav == \"to head\") \n {\n znak = -1;\n }\n else\n {\n znak = 1;\n }\n\n string mask = Console.ReadLine();\n bool win = true;\n\n\n\n for (int i = 0; i < mask.Length; i++)\n {\n if ((controller == 1) && (znak == -1))\n {\n znak = -znak;\n }\n if ((controller == n) && (znak == 1))\n {\n znak = -znak;\n }\n if (mask[i] == '0')\n {\n if (zayc == 1 || zayc == n)\n {\n\n }\n else\n {\n if (zayc < controller)\n zayc--;\n else\n zayc++;\n }\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n break;\n }\n\n }\n else\n {\n controller += znak;\n if (znak == 1)\n {\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller == n)\n {\n zayc = 1;\n }\n if(controller !=1)\n if(controller !=n)\n {\n zayc = 1;\n }\n }\n else\n {\n if (controller == n)\n {\n zayc = 1;\n }\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller != 1)\n if (controller != n)\n {\n zayc = n;\n }\n }\n }\n\n }\n\n if (win)\n {\n Console.WriteLine(\"Stowaway\");\n }\n else\n {\n Console.WriteLine(\"Controller \" + minut);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest_74\n{\n class Program\n {\n static void A()\n {\n int n = int.Parse(Console.ReadLine());\n Dictionary p = new Dictionary();\n for (int i = 0; i < n; i++)\n {\n var t = Console.ReadLine().Split(' ');\n p.Add(t[0], int.Parse(t[1]) * 100 - int.Parse(t[2]) * 50 + int.Parse(t[3]) + int.Parse(t[4]) + int.Parse(t[5]) + int.Parse(t[6]) + int.Parse(t[7]));\n }\n\n int max = int.MinValue;\n string name = \"\";\n foreach (var e in p)\n {\n if (e.Value > max)\n {\n max = e.Value;\n name = e.Key;\n }\n }\n\n Console.WriteLine(name);\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int a = int.Parse(t[1]);\n int b = int.Parse(t[2]);\n string dir = Console.ReadLine();\n int d = 1;\n if (dir.IndexOf(\"tail\") == -1)\n d = -1;\n string s = Console.ReadLine();\n int l = s.Length;\n for (int i = 0; i < l; i++)\n {\n \n if ((b + d > n) || (b +d < 1))\n d *= -1;\n b += d;\n switch (s[i])\n {\n case '0':\n if ((a + d <= n) && (a + d > 0))\n a += d;\n break;\n case '1':\n a = (b - d);\n break;\n }\n if (a == b)\n {\n Console.WriteLine(\"Controller \" + (i+1));\n return;\n }\n }\n Console.WriteLine(\"Stowaway\");\n }\n\n static void Main(string[] args)\n {\n B();\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n for (int i = 0; i < code.Length; i++)\n {\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n else if (code[i]=='1')\n {\n if (dir == -1)\n {\n S = C;\n \n }\n else if (dir == 1)\n {\n S = C;\n \n }\n\n }\n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n \n for (int i = 0; i < code.Length; i++)\n {\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n else if (code[i]=='1')\n {\n if (dir == -1)\n {\n S = C + 1;\n if (C == 0)\n S = L;\n }\n else if (dir == 1)\n {\n S = C - 1;\n if (C == L)\n S = 1;\n }\n\n }\n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] == '1')\n {\n S = C;\n }\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n \n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n\n if (S == C && code[0]!='1')\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] == '1')\n {\n S = C;\n }\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n \n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace A.Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int L, S, C;\n L = Convert.ToInt32(data[0]);\n S = Convert.ToInt32(data[1]);\n C = Convert.ToInt32(data[2]);\n int dir = Console.ReadLine().Trim() == \"to head\" ? -1 : 1;\n string code = Console.ReadLine().Trim();\n\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n for (int i = 0; i < code.Length; i++)\n {\n if (C == 1 && dir == -1) dir = 1;\n if (C == L && dir == 1) dir = -1;\n C = C + dir;\n if (S == C)\n {\n Console.WriteLine(\"Controller {0}\", C);\n return;\n }\n if (code[i] == '0')\n {\n if (S > C && S != L)\n {\n S++;\n }\n else if (S < C && S != 1)\n {\n S--;\n }\n\n }\n else if (code[i]=='1')\n {\n if (dir == -1)\n {\n S = C + 1;\n if (C == 0)\n S = L;\n }\n else if (dir == 1)\n {\n S = C - 1;\n if (C == L)\n S = 1;\n }\n\n }\n }\n Console.WriteLine(\"Stowaway\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(tmp[0]);\n int zayc = int.Parse(tmp[1]);\n int controller = int.Parse(tmp[2]);\n int minut = -5;\n string naprav = Console.ReadLine();\n int znak = 0;\n if (naprav == \"to head\") \n {\n znak = -1;\n }\n else\n {\n znak = 1;\n }\n\n string mask = Console.ReadLine();\n bool win = true;\n\n\n\n for (int i = 0; i < mask.Length; i++)\n {\n\n if ((controller == 1) && (znak == -1))\n {\n znak = -znak;\n }\n if ((controller == n) && (znak == 1))\n {\n znak = -znak;\n }\n if (mask[i] == '0')\n {\n if (zayc == 1 || zayc == n)\n {\n\n }\n else\n {\n if (zayc < controller)\n zayc--;\n else\n zayc++;\n }\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n\n }\n else\n {\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n if (znak == 1)\n {\n if (controller == 1)\n {\n zayc = n;\n }\n else\n {\n zayc = 1;\n }\n }\n else\n {\n if (controller == n)\n {\n zayc = 1;\n }\n else\n {\n zayc = n;\n }\n }\n }\n\n }\n\n if (win)\n {\n Console.WriteLine(\"Stowaway\");\n }\n else\n {\n Console.WriteLine(\"Controller \" + minut);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(tmp[0]);\n int zayc = int.Parse(tmp[1]);\n int controller = int.Parse(tmp[2]);\n int minut = -5;\n string naprav = Console.ReadLine();\n int znak = 0;\n if (naprav == \"to head\") \n {\n znak = -1;\n }\n else\n {\n znak = 1;\n }\n\n string mask = Console.ReadLine();\n bool win = true;\n\n\n\n for (int i = 0; i < mask.Length; i++)\n {\n\n if ((controller == 1) && (znak == -1))\n {\n znak = -znak;\n }\n if ((controller == n) && (znak == 1))\n {\n znak = -znak;\n }\n if (mask[i] == '0')\n {\n if (zayc == 1 || zayc == n)\n {\n\n }\n else\n {\n if (zayc < controller)\n zayc--;\n else\n zayc++;\n }\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n\n }\n else\n {\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n if (znak == 1)\n {\n zayc = 0;\n }\n else\n {\n zayc = n;\n }\n }\n\n }\n\n if (win)\n {\n Console.WriteLine(\"Stowaway\");\n }\n else\n {\n Console.WriteLine(\"Controller \" + minut);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(tmp[0]);\n int zayc = int.Parse(tmp[1]);\n int controller = int.Parse(tmp[2]);\n int minut = -5;\n string naprav = Console.ReadLine();\n int znak = 0;\n if (naprav == \"to head\") \n {\n znak = -1;\n }\n else\n {\n znak = 1;\n }\n\n string mask = Console.ReadLine();\n bool win = true;\n\n\n\n for (int i = 0; i < mask.Length; i++)\n {\n\n if ((controller == 1) && (znak == -1))\n {\n znak = -znak;\n }\n if ((controller == n) && (znak == 1))\n {\n znak = -znak;\n }\n if (mask[i] == '0')\n {\n if (zayc == 1 || zayc == n)\n {\n\n }\n else\n {\n if (zayc < controller)\n zayc--;\n else\n zayc++;\n }\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n\n }\n else\n {\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n if (znak == 1)\n {\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller == n)\n {\n zayc = 1;\n }\n if(controller !=1)\n if(controller !=n)\n {\n zayc = 1;\n }\n }\n else\n {\n if (controller == n)\n {\n zayc = 1;\n }\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller != 1)\n if (controller != n)\n {\n zayc = n;\n }\n }\n }\n\n }\n\n if (win)\n {\n Console.WriteLine(\"Stowaway\");\n }\n else\n {\n Console.WriteLine(\"Controller \" + minut);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(tmp[0]);\n int zayc = int.Parse(tmp[1]);\n int controller = int.Parse(tmp[2]);\n int minut = -5;\n string naprav = Console.ReadLine();\n int znak = 0;\n if (naprav == \"to head\") \n {\n znak = -1;\n }\n else\n {\n znak = 1;\n }\n\n string mask = Console.ReadLine();\n bool win = true;\n\n\n\n for (int i = 0; i < mask.Length; i++)\n {\n\n if ((controller == 1) && (znak == -1))\n {\n znak = -znak;\n }\n if ((controller == n) && (znak == 1))\n {\n znak = -znak;\n }\n if (mask[i] == '0')\n {\n if (zayc == 1 || zayc == n)\n {\n\n }\n else\n {\n if (zayc < controller)\n zayc--;\n else\n zayc++;\n }\n controller += znak;\n if (controller == zayc)\n {\n win = false;\n minut = i+1;\n }\n\n }\n else\n {\n controller += znak;\n if (znak == 1)\n {\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller == n)\n {\n zayc = 1;\n }\n if(controller !=1)\n if(controller !=n)\n {\n zayc = 1;\n }\n }\n else\n {\n if (controller == n)\n {\n zayc = 1;\n }\n if (controller == 1)\n {\n zayc = n;\n }\n if (controller != 1)\n if (controller != n)\n {\n zayc = n;\n }\n }\n }\n\n }\n\n if (win)\n {\n Console.WriteLine(\"Stowaway\");\n }\n else\n {\n Console.WriteLine(\"Controller \" + minut);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest_74\n{\n class Program\n {\n static void A()\n {\n int n = int.Parse(Console.ReadLine());\n Dictionary p = new Dictionary();\n for (int i = 0; i < n; i++)\n {\n var t = Console.ReadLine().Split(' ');\n p.Add(t[0], int.Parse(t[1]) * 100 - int.Parse(t[2]) * 50 + int.Parse(t[3]) + int.Parse(t[4]) + int.Parse(t[5]) + int.Parse(t[6]) + int.Parse(t[7]));\n }\n\n int max = int.MinValue;\n string name = \"\";\n foreach (var e in p)\n {\n if (e.Value > max)\n {\n max = e.Value;\n name = e.Key;\n }\n }\n\n Console.WriteLine(name);\n }\n\n static void B()\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int a = int.Parse(t[1]);\n int b = int.Parse(t[2]);\n string dir = Console.ReadLine();\n int d = 1;\n if (dir.IndexOf(\"tail\") == -1)\n d = -1;\n string s = Console.ReadLine();\n int l = s.Length;\n for (int i = 0; i < l; i++)\n {\n b += d;\n if (b > l)\n b %= l;\n if (b < 1)\n b = l;\n switch (s[i])\n {\n case '0':\n if ((a + d < l) && (a + d > 0))\n a += d;\n break;\n case '1':\n a = b + d;\n break;\n }\n if (a == b)\n {\n Console.WriteLine(\"Controller \" + (i+1));\n return;\n }\n }\n Console.WriteLine(\"Stowaway\");\n }\n\n static void Main(string[] args)\n {\n B();\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i+1==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n && kn>0) kn = -1;\n if (k == 1 && kn<0) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 1; i <= o; i++)\n {\n if (z == k)\n {\n win = \"Controller 0\";\n break;\n }\n if (i==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i-1] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+i.ToString();\n break;\n }\n }\n else // stop\n {\n z = k;\n k += kn;\n\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i==(o-1))\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n // kn = toS[3] == 'h' ? -1 : 1;\n kn = n>4 ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i+1==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n && kn>0) kn = -1;\n if (k == 1 && kn<0) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i+1==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n && kn>0) kn = -1;\n if (k == 1 && kn<0) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i==(o-1))\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1);\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"\u0421ontroller 1\";\n break;\n }\n if (i==(o-1))\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"\u0421ontroller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i==(o-1))\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic ;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS[3] == 'h' ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 0; i < o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i+1==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n && kn>0) kn = -1;\n if (k == 1 && kn<0) kn = 1;\n\n if (s[i] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+(i+1).ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n for (int i = 1; i <= o; i++)\n {\n if (i==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i-1] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+i.ToString();\n break;\n }\n }\n else // stop\n {\n z = k;\n k += kn;\n\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 1; i <= o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i-1] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+i.ToString();\n break;\n }\n }\n else // stop\n {\n k += kn;\n if (kn > 0)\n {\n if (k > 1) z = 1;\n else z = n;\n }\n if (kn < 0)\n {\n if (k < n) z = n;\n else z = 1;\n }\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n for (int i = 1; i <= o; i++)\n {\n if (i==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i-1] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+i;\n break;\n }\n }\n else // stop\n {\n z = k;\n k += kn;\n\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeff#define DEBUG\n#undef DEBUG\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace OlympSchool_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,z,k,kn,zn;\n string s;\n string[] st;\n string toS;\n\n#if DEBUG\n StreamReader sr = new StreamReader(\"b68.txt\");\n s = sr.ReadLine();\n#else\n s = Console.ReadLine();\n#endif\n st = s.Split(' ');\n n = int.Parse(st[0].Trim());\n z = int.Parse(st[1].Trim());\n k = int.Parse(st[2].Trim());\n#if DEBUG\n toS = sr.ReadLine().Trim();\n s = sr.ReadLine().Trim();\n#else\n s = Console.ReadLine().Trim();\n toS = Console.ReadLine().Trim();\n#endif\n kn = toS == \"to head\" ? -1 : 1;\n int o = s.Length;\n string win=\"\";\n\n for (int i = 1; i <= o; i++)\n {\n if (z == k)\n {\n win = \"Controller 1\";\n break;\n }\n if (i==o)\n {\n win = \"Stowaway\";\n break;\n }\n\n if (k == n) kn = -1;\n if (k == 1) kn = 1;\n\n if (s[i-1] == '0') //go\n {\n if (z > k) zn = 1;\n else zn = -1;\n\n if (zn > 0 && z < n) z++;\n if (zn < 0 && z > 1) z--;\n\n k += kn;\n if(k==z)\n {\n win = \"Controller \"+i.ToString();\n break;\n }\n }\n else // stop\n {\n z = k;\n k += kn;\n\n }\n }\n\n\n Console.WriteLine(win);\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round68\n{\n class B\n {\n public static void Main()\n {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int n = xs[0],\n m = xs[1],\n k = xs[2];\n int dx = Console.ReadLine() == \"to head\" ? -1 : 1;\n var s = Console.ReadLine();\n\n for (int i = 0; i < n; i++)\n {\n if (!(1 <= k + dx && k + dx <= n))\n dx = -dx;\n k += dx;\n if (s[i] == '1')\n {\n m = k - dx;\n }\n else\n {\n if (1 <= m + dx && m + dx <= n)\n m += dx;\n if (k == m)\n {\n Console.WriteLine(\"Controller {0}\", i + 1);\n return;\n }\n }\n }\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]) - 1; // rabbit\n int k = int.Parse(line[2]) - 1;\n int dir = Console.ReadLine() == \"to tail\" ? 1 : -1;\n string s = Console.ReadLine();\n\n if (k == 0)\n dir = 1;\n if (k == n - 1)\n dir = -1;\n\n bool caught = false;\n int time = 0;\n bool afterstop = false;\n bool before = false;\n for (; time < s.Length && !caught; time++)\n {\n //k += dir;\n if (s[time] == '0' && !afterstop)\n {\n if (m == 0 && (k == 1 || k == 2) && dir == -1)\n {\n caught = true;\n time++;\n break;\n }\n\n if (m == n - 1 && (k == n - 2 || k == n - 3) && dir == 1)\n {\n caught = true;\n time++;\n break;\n }\n\n if (Math.Abs(k - m) > 2)\n {\n k += dir;\n m += -dir;\n }\n else\n {\n k += dir;\n m += dir;\n }\n }\n else if (s[time] == '1')\n {\n afterstop = true;\n k += dir;\n before = dir > 0;\n }\n else if (s[time] == '0' && afterstop)\n {\n k += dir;\n if (k == 0 && before || k == n - 1 && !before)\n {\n caught = true;\n break;\n }\n }\n\n if (k == 0)\n dir = 1;\n if (k == n - 1)\n dir = -1;\n }\n\n if(caught)\n Console.WriteLine(\"Controller {0}\", time);\n else\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]) - 1; // rabbit\n int k = int.Parse(line[2]) - 1;\n int dir = Console.ReadLine() == \"to tail\" ? 1 : -1;\n string s = Console.ReadLine();\n\n if (k == 0)\n dir = 1;\n if (k == n - 1)\n dir = -1;\n\n bool caught = false;\n int time = 0;\n bool afterstop = false;\n bool before = false;\n for (; time < s.Length && !caught; time++)\n {\n //k += dir;\n if (s[time] == '0' && !afterstop)\n {\n if (m == 0 && (k == 1) && dir == -1)\n {\n caught = true;\n time++;\n break;\n }\n\n if (m == n - 1 && (k == n - 2) && dir == 1)\n {\n caught = true;\n time++;\n break;\n }\n\n if (Math.Abs(k - m) > 2)\n {\n k += dir;\n m += -dir;\n }\n else\n {\n k += dir;\n m += dir;\n }\n }\n else if (s[time] == '1')\n {\n afterstop = true;\n k += dir;\n before = dir > 0;\n }\n else if (s[time] == '0' && afterstop)\n {\n k += dir;\n if (k == 0 && before || k == n - 1 && !before)\n {\n caught = true;\n break;\n }\n }\n\n if (k == 0)\n dir = 1;\n if (k == n - 1)\n dir = -1;\n }\n\n if(caught)\n Console.WriteLine(\"Controller {0}\", time);\n else\n Console.WriteLine(\"Stowaway\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\nstatic void Main()\n{\nstring s1 = Console.ReadLine();\nint n = int.Parse(s1.Split(' ')[0]) - 1;\nint win = -1;\nint z0 = int.Parse(s1.Split(' ')[1]) - 1;\nint c0 = int.Parse(s1.Split(' ')[2]) - 1;\n\nstring s2 = Console.ReadLine();\n\nstring s3 = Console.ReadLine();\n\nfor (int i=0; i c0)\n {\n if (z0 != n)\n z0++;\n }\n else\n {\n if (z0 != 0)\n z0--;\n } \n }\n \n if (s3[i] != '0')\n peremesh(n, c0, ref s2, out c0);\n\n \n if (c0 == z0)\n {\n Console.WriteLine(\"Controller\");\n win = 1;\n break;\n }\n}\nif (win != 1)\nConsole.WriteLine(\"Stowaway\");\n\nConsole.ReadKey();\n\n}\n\nstatic void peremesh(int n, int place, ref string dir, out int N)\n{\nN = -1;\nif (dir == \"to tail\")\n{\nif (place < n)\nplace++;\nelse\n{\ndir = \"to head\";\nplace--;\n}\n}\nelse\nif (place > 0)\nplace--;\nelse\n{\ndir = \"to tail\";\nplace++;\n}\n}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\nstatic void Main()\n{\nstring s1 = Console.ReadLine();\nint n = int.Parse(s1.Split(' ')[0]) - 1;\nint win = -1;\nint z0 = int.Parse(s1.Split(' ')[1]) - 1;\nint c0 = int.Parse(s1.Split(' ')[2]) - 1;\n\nstring s2 = Console.ReadLine();\n\nstring s3 = Console.ReadLine();\n\nfor (int i=0; i c0)\n {\n if (z0 != n)\n z0++;\n }\n else\n {\n if (z0 != 0)\n z0--;\n } \n }\n peremesh(n, c0, ref s2, out c0);\n\n if (c0 == z0)\n {\n Console.WriteLine(\"Controller\");\n win = 1;\n break;\n }\n}\nif (win != 1)\nConsole.WriteLine(\"Stowaway\");\n\nConsole.ReadKey();\n\n}\n\nstatic void peremesh(int n, int place, ref string dir, out int N)\n{\nN = -1;\nif (dir == \"to tail\")\n{\nif (place < n)\nplace++;\nelse\n{\ndir = \"to head\";\nplace--;\n}\n}\nelse\nif (place > 0)\nplace--;\nelse\n{\ndir = \"to tail\";\nplace++;\n}\n}\n}"}], "src_uid": "2222ce16926fdc697384add731819f75"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class B\n {\n private static ThreadStart s_threadStart = new B().Go;\n private static bool s_time = false;\n\n int k;\n Dictionary memo = new Dictionary();\n long Get(int n)\n {\n if (n < k) return 0;\n if (n < k + 2) return 1;\n if (!memo.ContainsKey(n))\n {\n memo[n] = 2 * Get(n - 1) - Get(n - k - 1);\n }\n\n return memo[n];\n }\n\n private void Go()\n {\n int s = GetInt();\n k = GetInt();\n memo.Clear();\n\n List res = new List();\n\n while (s > 0)\n {\n int n = k;\n long x = Get(n);\n long y;\n while (x <= s)\n {\n n++;\n y = Get(n);\n\n if (y > s)\n {\n res.Add(x);\n s -= (int)x;\n }\n\n x = y;\n }\n }\n\n Wl(res.Count + 1);\n Console.Write(\"0\");\n foreach (long x in res)\n Console.Write(\" \" + x);\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n }\n\n #endregion\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Temp\n{ \n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3, out int int4)\n {\n int[] numbers = new int[4];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(double[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = double.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(out double a, out double b)\n {\n double[] numbers = new double[2];\n ReadDouble(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadDouble(out double int1, out double int2, out double int3)\n {\n double[] numbers = new double[3];\n ReadDouble(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1); \n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)),GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0 ||\n 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n class Program\n { \n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int s, k;\n Reader.ReadInt(out s, out k);\n\n List result = new List { 0 };\n\n int[] f = new int[100];\n f[0] = 1;\n\n int t = 0;\n while (f[t] < s)\n {\n t++;\n int sum = 0;\n for (int j = Math.Max(0, t - k); j < t; j++)\n {\n sum += f[j];\n }\n\n f[t] = sum; \n }\n\n for (int i = t; i >= 0; i--)\n {\n if (s >= f[i])\n {\n result.Add(f[i]);\n s -= f[i];\n if (s == 0)\n {\n break;\n }\n }\n }\n\n Console.WriteLine(result.Count);\n foreach (var i in result)\n {\n Console.Write(\"{0} \", i);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Well_known_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int s = Next();\n int k = Next();\n\n var list = new List {1};\n\n int index0 = -k;\n\n int sum = 1;\n while (sum <= s)\n {\n list.Add(sum);\n\n sum += sum;\n index0++;\n if (index0 >= 0)\n sum -= list[index0];\n }\n\n var ans = new List();\n list.Reverse();\n\n foreach (int i in list)\n {\n if (s >= i)\n {\n ans.Add(i);\n s -= i;\n if (s == 0)\n break;\n }\n }\n\n if (ans.Count == 1)\n ans.Add(0);\n\n writer.WriteLine(ans.Count);\n foreach (int an in ans)\n {\n writer.Write(an);\n writer.Write(' ');\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class wellknownnumbers\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tstring[] p = Console.ReadLine().Split();\n\t\tlong s = long.Parse(p[0]);\n\t\tlong k = long.Parse(p[1]);\n\t\tlong[] nums = new long[50];\n\t\tnums[0] = 1;\n\t\tint start = 0;\n\t\tfor(int i = 1; nums[i-1] < s && i < 50; i++)\n\t\t{\n\t\t\tnums[i] = 0;\n\t\t\tfor (int j = i - 1; j >= i - k && j >= 0; j--)\n\t\t\t\tnums[i] += nums[j];\n\t\t\tif (nums[i] <= s) start = i;\n\t\t}\n\t\tList ans = new List();\n\t\tfor (int i = start; i >= 0 && s > 0; i--)\n\t\t{\n\t\t\tif (nums[i] <= s)\n\t\t\t{\n\t\t\t\tans.Add(nums[i]);\n\t\t\t\ts -= nums[i];\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans.Count + 1);\n\t\tforeach (long a in ans)\n\t\t\tConsole.Write(a + \" \");\n\t\tConsole.WriteLine(\"0\");\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class B\n\t{\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint s = NextInt(), k = NextInt();\n\t\t\tvar f = new List();\n\t\t\tf.Add( 1 );\n\t\t\twhile ( true )\n\t\t\t{\n\t\t\t\tlong tmp = 0;\n\t\t\t\tfor ( int i = f.Count - 1, tot = k; i >= 0 && tot > 0; --i, --tot )\n\t\t\t\t{\n\t\t\t\t\ttmp += f[i];\n\t\t\t\t}\n\t\t\t\tif ( tmp > 1000000000 ) break;\n\t\t\t\tf.Add( (int)tmp );\n\t\t\t}\n\t\t\tif ( f.Count( x => x == 1 ) > 1 ) f.Remove( 1 );\n\t\t\tvar res = new List();\n\t\t\twhile ( s > 0 )\n\t\t\t{\n\t\t\t\tint j = f.Count - 1;\n\t\t\t\twhile ( f[j] > s ) --j;\n\t\t\t\tres.Add( f[j] );\n\t\t\t\ts -= f[j];\n\t\t\t}\n\t\t\tif ( res.Count == 1 ) res.Add( 0 );\n\t\t\tOut.WriteLine( res.Count );\n\t\t\tforeach ( var re in res )\n\t\t\t{\n\t\t\t\tOut.Write( re + \" \" );\n\t\t\t}\n\t\t}\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew B().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class B\n\t{\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint s = NextInt(), k = NextInt();\n\t\t\tvar f = new List();\n\t\t\tf.Add( 1 );\n\t\t\twhile ( true )\n\t\t\t{\n\t\t\t\tlong tmp = 0;\n\t\t\t\tfor ( int i = f.Count - 1, tot = k; i >= 0 && tot > 0; --i, --tot )\n\t\t\t\t{\n\t\t\t\t\ttmp += f[i];\n\t\t\t\t}\n\t\t\t\tif ( tmp > 1000000000 ) break;\n\t\t\t\tf.Add( (int)tmp );\n\t\t\t}\n\t\t\tif ( f.Count( x => x == 1 ) > 1 ) f.Remove( 1 );\n\t\t\tvar res = new List();\n\t\t\twhile ( s > 0 )\n\t\t\t{\n\t\t\t\tint j = f.Count - 1;\n\t\t\t\twhile ( f[j] > s ) --j;\n\t\t\t\tres.Add( f[j] );\n\t\t\t\ts -= f[j];\n\t\t\t}\n\t\t\tOut.WriteLine( res.Count );\n\t\t\tforeach ( var re in res )\n\t\t\t{\n\t\t\t\tOut.Write( re + \" \" );\n\t\t\t}\n\t\t}\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew B().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Temp\n{ \n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3, out int int4)\n {\n int[] numbers = new int[4];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(double[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = double.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(out double a, out double b)\n {\n double[] numbers = new double[2];\n ReadDouble(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadDouble(out double int1, out double int2, out double int3)\n {\n double[] numbers = new double[3];\n ReadDouble(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1); \n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)),GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0 ||\n 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n class Program\n { \n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int s, k;\n Reader.ReadInt(out s, out k);\n\n List result = new List();\n\n int[] f = new int[100];\n f[0] = 1;\n\n int t = 0;\n while (f[t] < s)\n {\n t++;\n int sum = 0;\n for (int j = Math.Max(0, t - k); j < t; j++)\n {\n sum += f[j];\n }\n\n f[t] = sum; \n }\n\n for (int i = t; i >= 0; i--)\n {\n if (s >= f[i])\n {\n result.Add(f[i]);\n s -= f[i];\n if (s == 0)\n {\n break;\n }\n }\n }\n\n Console.WriteLine(result.Count);\n foreach (var i in result)\n {\n Console.Write(\"{0} \", i);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Temp\n{ \n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3, out int int4)\n {\n int[] numbers = new int[4];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(double[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = double.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(out double a, out double b)\n {\n double[] numbers = new double[2];\n ReadDouble(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadDouble(out double int1, out double int2, out double int3)\n {\n double[] numbers = new double[3];\n ReadDouble(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1); \n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)),GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0 ||\n 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n class Program\n { \n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int s, k;\n Reader.ReadInt(out s, out k);\n\n List result = new List();\n\n int[] f = new int[100];\n f[0] = 1;\n\n int t = 0;\n while (f[t] < s)\n {\n t++;\n int sum = 0;\n for (int j = Math.Max(0, t - k); j < t; j++)\n {\n sum += f[j];\n }\n\n f[t] = sum; \n }\n\n if (f[t] == s)\n {\n t--;\n }\n\n for (int i = t; i >= 0; i--)\n {\n if (s >= f[i])\n {\n result.Add(f[i]);\n s -= f[i];\n if (s == 0)\n {\n break;\n }\n }\n }\n\n Console.WriteLine(result.Count);\n foreach (var i in result)\n {\n Console.Write(\"{0} \", i);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Well_known_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int s = Next();\n int k = Next();\n\n var list = new List {1};\n\n int index0 = -k;\n\n int sum = 1;\n while (sum < s)\n {\n list.Add(sum);\n\n sum += sum;\n index0++;\n if (index0 >= 0)\n sum -= list[index0];\n }\n\n var ans = new List();\n list.Reverse();\n\n foreach (int i in list)\n {\n if (s >= i)\n {\n ans.Add(i);\n s -= i;\n if (s == 0)\n break;\n }\n }\n\n writer.WriteLine(ans.Count);\n foreach (int an in ans)\n {\n writer.Write(an);\n writer.Write(' ');\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "da793333b977ed179fdba900aa604b52"} {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring path = Console.ReadLine();\n\t\tint h = 0;\n\t\tint v = 0;\n\t\tint hmin = 0;\n\t\tint hmax = 0;\n\t\tint vmin = 0;\n\t\tint vmax = 0;\n\t\t\n\t\tforeach(var item in path)\n\t\t{\n\t\t\tif(item == 'L')\n\t\t\t{\n\t\t\t\th--;\n\t\t\t\tif(h < hmin)\n\t\t\t\t{\n\t\t\t\t\thmin = h;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(item == 'R')\n\t\t\t{\n\t\t\t\th++;\n\t\t\t\tif(h > hmax)\n\t\t\t\t{\n\t\t\t\t\thmax = h;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(item == 'U')\n\t\t\t{\n\t\t\t\tv--;\n\t\t\t\tif(v < vmin)\n\t\t\t\t{\n\t\t\t\t\tvmin = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t\tif(v > vmax)\n\t\t\t\t{\n\t\t\t\t\tvmax = v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint width = hmax - hmin + 1;\n\t\tint height = vmax - vmin + 1;\n\t\tbool[,] field = new bool[height, width];\n\t\t\n\t\th = -hmin;\n\t\tv = -vmin;\n\t\tfield[v, h] = true;\n\n\t\tforeach(var item in path)\n\t\t{\n\t\t\tif(item == 'L')\n\t\t\t{\n\t\t\t\th--;\n\t\t\t\tif((h != 0 && field[v, h - 1] == true) ||\n\t\t\t\t\t(v != 0 && field[v - 1, h] == true) ||\n\t\t\t\t\t(v != height - 1 && field[v + 1, h] == true))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(item == 'R')\n\t\t\t{\n\t\t\t\th++;\n\t\t\t\tif((h != width - 1 && field[v, h + 1] == true) ||\n\t\t\t\t\t(v != 0 && field[v - 1, h] == true) ||\n\t\t\t\t\t(v != height - 1 && field[v + 1, h] == true))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(item == 'U')\n\t\t\t{\n\t\t\t\tv--;\n\t\t\t\tif((h != 0 && field[v, h - 1] == true) ||\n\t\t\t\t\t(h != width - 1 && field[v, h + 1] == true) ||\n\t\t\t\t\t(v != 0 && field[v - 1, h] == true))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tv++;\n\t\t\t\tif((h != 0 && field[v, h - 1] == true) ||\n\t\t\t\t\t(h != width - 1 && field[v, h + 1] == true) ||\n\t\t\t\t\t(v != height - 1 && field[v + 1, h] == true))\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(field[v, h] == true)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"BUG\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tfield[v, h] = true;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(\"OK\");\n\t}\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round8\n{\n class E\n {\n public static void Main()\n {\n int[,] map = new int[500, 500];\n int x = 250;\n int y = 250;\n map[x, y] = 1;\n string s = Console.ReadLine();\n foreach (var c in s)\n {\n if (c == 'L') x--;\n else if (c == 'R') x++;\n else if (c == 'U') y--;\n else if (c == 'D') y++;\n\n int check = map[x,y]+map[x+1,y]+map[x-1,y]+map[x,y+1]+map[x,y-1];\n if (check != 1)\n {\n Console.Write(\"BUG\");\n return;\n }\n\n map[x,y] = 1;\n }\n Console.Write(\"OK\");\n }\n }\n}\n"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n // class PairInt{\n // public int fst;\n // public int snd;\n\n // // void Add(Pair p) {\n // // fst += p.fst;\n // // snd += p.snd;\n // // }\n // }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n // int T = sc.NextInt();\n\n // for (int t = 0; t < T; ++t) {\n // }\n\n string s = sc.Next();\n\n var visited = new HashSet>();\n var dir = new Dictionary>{\n {'R', new Tuple(1, 0)},\n {'L', new Tuple(-1, 0)},\n {'U', new Tuple(0, 1)},\n {'D', new Tuple(0, -1)}\n };\n \n\n var pos = new Tuple(0, 0);\n visited.Add(pos);\n\n foreach (var e in s) {\n var prev = pos;\n pos = new Tuple(pos.Item1 + dir[e].Item1, pos.Item2 + dir[e].Item2);\n\n if (visited.Contains(pos)) {\n wr.Write(\"BUG\");\n wr.Flush();\n return;\n }\n\n visited.Add(pos);\n\n foreach (var d in dir.Values) {\n var nbr = new Tuple(pos.Item1 + d.Item1, pos.Item2 + d.Item2);\n if (visited.Contains(nbr) && !(nbr.Equals(prev))) {\n // wr.Write(e);\n // wr.Write(pos);\n // wr.Write(nbr);\n wr.Write(\"BUG\");\n wr.Flush();\n return;\n }\n }\n }\n\n // debug(pos);\n // foreach (var e in visited) {\n // debug(e);\n // }\n\n wr.Write(\"OK\");\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Beta82\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n int[,] coord = new int[101, 2];\n\n bool flag = false;\n int i = 1;\n coord[0,0] =0; coord[0, 1] = 0;\n\n int x=0,y=0;\n while (!flag&&i<=line.Length)\n {\n switch (line[i-1])\n {\n case 'L': coord[i, 0] = x - 1; coord[i, 1] = y; break;\n case 'R': coord[i, 0] = x + 1; coord[i, 1] = y; break;\n case 'U': coord[i, 0] = x; coord[i, 1] = y+1; break;\n case 'D': coord[i, 0] = x; coord[i, 1] = y-1; break;\n default: break;\n }\n x = coord[i, 0];\n y = coord[i, 1];\n int iter=0;\n for (int j = 0; j < i; j++)\n {\n /*if ((coord[j, 0] + 1 == coord[i, 0]) || (coord[j, 0] - 1 == coord[i, 0]) || (coord[j, 0] == coord[i, 0]))\n {\n if ((coord[j, 1] + 1 == coord[i, 1]) || (coord[j, 1] - 1 == coord[i, 1]) || (coord[j, 1] == coord[i, 1]))\n {\n if ((coord[j, 0] == coord[i, 0]) && (coord[j, 1] == coord[i, 1]))\n iter = 10;\n iter++;\n }\n }*/\n\n\n if (((coord[j, 0] + 1 == coord[i, 0]) || (coord[j, 0] - 1 == coord[i, 0])) && (coord[j, 1] == coord[i, 1]))\n {\n iter++;\n }\n if (((coord[j, 1] + 1 == coord[i, 1]) || (coord[j, 1] - 1 == coord[i, 1])) && (coord[j, 0] == coord[i, 0]))\n {\n iter++;\n }\n\n if ((coord[j, 1] == coord[i, 1]) && (coord[j, 0] == coord[i, 0]))\n {\n iter++;\n }\n }\n if (iter > 1)\n flag = true;\n i++;\n }\n\n if (flag)\n Console.WriteLine(\"BUG\");\n else\n Console.WriteLine(\"OK\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n int L = 2 * n + 1;\n bool[,] vis = new bool[L, L];\n int x = n;\n int y = n;\n vis[x, y] = true;\n \n foreach (char c in t)\n {\n\n switch (c)\n {\n case 'U':\n y++;\n break;\n case 'D':\n y--;\n break;\n case 'L':\n x--;\n break;\n default:\n x++;\n break;\n }\n vis[x, y] = true;\n \n }\n int ex = x;\n int ey = y;\n x = n;\n y = n;\n Queue q = new Queue();\n q.Enqueue(x); q.Enqueue(y);\n int[,] d = new int[L, L];\n for (int i = 0; i < L; i++)\n for (int j = 0; j < L; j++)\n d[i, j] = -1;\n d[x, y] = 0;\n while (q.Count > 0)\n {\n x = q.Dequeue();\n y = q.Dequeue();\n for(int dx=-1;dx<=1;dx++)\n for (int dy = -1; dy <= 1; dy++)\n {\n if (Math.Abs(dx) + Math.Abs(dy) != 1)\n continue;\n int nx = x + dx;\n int ny = y + dy;\n if (nx < 0 || nx >= L || ny < 0 || ny >= L || !vis[nx, ny] || d[nx, ny] != -1)\n continue;\n d[nx, ny] = d[x, y] + 1;\n q.Enqueue(nx); q.Enqueue(ny);\n }\n }\n if (d[ex, ey] != t.Length)\n Console.WriteLine(\"BUG\");\n else\n Console.WriteLine(\"OK\");\n\n \n }\n\n \n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int x = n;\n int y = n;\n vis[x, y] = true;\n bool ok = true;\n int ex = -1;\n int ey = -1;\n for (int i = 0; i < t.Length; i++)\n {\n int nx, ny;\n nx=x;\n ny=y;\n if (t[i] == 'D')\n ny--;\n if (t[i] == 'U')\n ny++;\n if (t[i] == 'L')\n nx--;\n if (t[i] == 'R')\n nx++;\n vis[nx, ny] = true;\n x = nx;\n y = ny;\n ex = x;\n ey = y;\n \n }\n if (!ok)\n ;\n else\n {\n int[,] d = new int[2 * n + 1, 2 * n + 1];\n d[n, n] = 0;\n for (int i = 0; i < 2 * n + 1; i++)\n for (int j = 0; j < 2 * n+1; j++)\n if (i != n || j != n)\n d[i, j] = -1;\n Queue q = new Queue();\n x = n;\n y = n;\n q.Enqueue(x);\n q.Enqueue(y);\n while (q.Count > 0)\n {\n x = q.Dequeue();\n y = q.Dequeue();\n for (int dx = -1; dx <= 1; dx++)\n for (int dy = -1; dy <= 1; dy++)\n if (dx == 0 ^ dy == 0)\n {\n int nx = x + dx;\n int ny = y + dy;\n if (nx < 0 || nx > 2 * n || ny < 0 || ny > 2 * n || !vis[nx, ny] || d[nx, ny] != -1)\n continue;\n d[nx, ny] = 1 + d[x, y];\n q.Enqueue(nx);\n q.Enqueue(ny);\n\n }\n }\n if (d[ex, ey] == t.Length)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Obsession_with_Robots\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n var nn = new int[205,205];\n int x = 100, y = 100, move = 1;\n nn[x, y] = move++;\n foreach (char c in s)\n {\n switch (c)\n {\n case 'U':\n y++;\n break;\n case 'D':\n y--;\n break;\n case 'L':\n x++;\n break;\n case 'R':\n x--;\n break;\n }\n\n if (nn[x, y] == 0)\n nn[x, y] = move++;\n else\n {\n writer.WriteLine(\"BUG\");\n writer.Flush();\n return;\n }\n }\n\n var dx = new[] {0, 0, -1, 1};\n var dy = new[] {1, -1, 0, 0};\n for (int i = 1; i < 204; i++)\n {\n for (int j = 1; j < 204; j++)\n {\n if (nn[i, j] == 0)\n continue;\n\n for (int k = 0; k < dx.Length; k++)\n {\n if (nn[i + dx[k], j + dy[k]] == 0)\n continue;\n\n if (Math.Abs(nn[i + dx[k], j + dy[k]] - nn[i, j]) > 1)\n {\n writer.WriteLine(\"BUG\");\n writer.Flush();\n return;\n }\n }\n }\n }\n\n writer.WriteLine(\"OK\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n int pos = 0;\n HashSet vis = new HashSet();\n vis.Add(pos);\n for (int i = 0; i < s.Length; ++i)\n {\n int old = pos;\n if (s[i] == 'U') pos += 1000;\n else if (s[i] == 'D') pos -= 1000;\n else if (s[i] == 'R') ++pos;\n else --pos;\n if (vis.Contains(pos) || pos - 1 != old && vis.Contains(pos - 1) || pos + 1 != old && vis.Contains(pos + 1) || pos - 1000 != old && vis.Contains(pos-1000) || pos + 1000 != old && vis.Contains(pos+1000))\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n vis.Add(pos);\n }\n Console.WriteLine(\"OK\");\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _8b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var s = Console.ReadLine();\n var n = s.Length;\n var t = new int[2 * n + 5, 2 * n + 5];\n var x = n;\n var y = n;\n t[y, x] = 1;\n for (int i = 0; i < n; i++)\n {\n var next = s[i];\n if (next == 'L')\n {\n y--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y + 1, x - 1] = 1;\n t[y + 1, x + 1] = 1;\n t[y + 1 - 1, x] = 1;\n t[y + 1 + 1, x] = 1;\n }\n }\n else if (next == 'R')\n {\n y++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y - 1, x - 1] = 1;\n t[y - 1, x + 1] = 1;\n t[y - 1 - 1, x] = 1;\n t[y - 1 + 1, x] = 1;\n }\n }\n else if (next == 'U')\n {\n x++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y, x - 1 - 1] = 1;\n t[y , x + 1 - 1] = 1;\n t[y - 1, x - 1] = 1;\n t[y + 1, x - 1] = 1;\n }\n }\n else if (next == 'D')\n {\n x--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n t[y, x - 1 + 1] = 1;\n t[y, x + 1 + 1] = 1;\n t[y - 1, x + 1] = 1;\n t[y + 1, x + 1] = 1;\n }\n }\n }\n\n Console.WriteLine(\"OK\");\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n class C\n {\n static string _input =\n@\"\nRRRUL\n\";\n\n #region test\n\n static List _lines;\n\n static string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n static void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n static void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n #endregion\n\n static void Main(string[] args)\n {\n string s = ReadLine();\n\n //s = new string('U', 100);\n\n int x=0;\n int y=0;\n List list = new List();\n list.Add(\"0.0\");\n \n foreach (char c in s)\n {\n int nx = x;\n int ny = y;\n\n switch (c)\n {\n case 'U': ny--; break;\n case 'D': ny++; break;\n case 'R': nx++; break;\n case 'L': nx--; break;\n }\n\n string key = nx + \".\" + ny;\n if (list.Contains(key))\n {\n Write(\"BUG\");\n return;\n }\n list.Add(key);\n\n {\n key = (x+1) + \".\" + y;\n if (!list.Contains(key))\n list.Add(key);\n }\n {\n key = (x -1) + \".\" + y;\n if (!list.Contains(key))\n list.Add(key);\n }\n {\n key = x + \".\" + (y+1);\n if (!list.Contains(key))\n list.Add(key);\n }\n {\n key = x+ \".\" + (y-1);\n if (!list.Contains(key))\n list.Add(key);\n }\n\n x = nx;\n y = ny;\n\n }\n Write(\"OK\");\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n #region constants\n\n private const int N = 100;\n private const int D = 2 * N + 7;\n\n #endregion\n static void Main(string[] args)\n {\n var visited = new int[D, D];\n for (int i = 0; i < D; i++)\n for (int j = 0; j < D; j++)\n {\n visited[i, j] = 0;\n }\n int x = D / 2, y = D / 2;\n visited[x, y] = 1;\n bool isPosible = true;\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; ++i)\n {\n if (s[i] == 'U') ++y;\n else if (s[i] == 'D') --y;\n else if (s[i] == 'R') ++x;\n else if (s[i] == 'L') --x;\n if (visited[x, y] == 1)\n {\n isPosible = false;\n break;\n }\n else if (visited[x, y + 1] + visited[x, y - 1] + visited[x + 1, y] + visited[x - 1, y] > 1)\n {\n isPosible = false;\n break;\n }\n visited[x, y] = 1;\n }\n Console.WriteLine(isPosible ? \"OK\" : \"BUG\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar steps = sr.NextString();\n\t\t\tvar matrix = new bool[300, 300];\n\t\t\tvar sx = 150;\n\t\t\tvar sy = 150;\n\t\t\tmatrix[sx, sy] = true;\n\t\t\tfor (var i = 0; i < steps.Length; i++) {\n\t\t\t\tvar next = steps[i];\n\t\t\t\tvar dx = 0;\n\t\t\t\tvar dy = 0;\n\t\t\t\tif (next == 'U')\n\t\t\t\t\tdy--;\n\t\t\t\tif (next == 'D')\n\t\t\t\t\tdy++;\n\t\t\t\tif (next == 'L')\n\t\t\t\t\tdx--;\n\t\t\t\tif (next == 'R')\n\t\t\t\t\tdx++;\n\t\t\t\tsx += dx;\n\t\t\t\tsy += dy;\n\t\t\t\tif (matrix[sx, sy]) {\n\t\t\t\t\tsw.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tmatrix[sx, sy] = true;\n\t\t\t\tvar count = 0;\n\t\t\t\tif (matrix[sx + 1, sy])\n\t\t\t\t\tcount++;\n\t\t\t\tif (matrix[sx, sy + 1])\n\t\t\t\t\tcount++;\n\t\t\t\tif (matrix[sx - 1, sy])\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif (matrix[sx, sy - 1])\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif (count > 1)\n\t\t\t\t{\n\t\t\t\t\tsw.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_8_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool[,] mas = new bool[400, 400];\n int i = 200;\n int j = 200;\n int previ = 200;\n int prevj = 200;\n mas[i,j]=true;\n bool b = false;\n for (int ii = 0; ii < s.Length; ii++)\n {\n if (s[ii] == 'L')\n {\n j--;\n if (mas[i + 1, j] || mas[i - 1, j] || mas[i, j - 1])\n {\n Console.WriteLine(\"BUG\");\n b = true;\n break;\n }\n }\n else\n if (s[ii] == 'R')\n {\n j++;\n if (mas[i + 1, j] || mas[i-1, j ] || mas[i, j + 1])\n {\n Console.WriteLine(\"BUG\");\n b = true;\n break;\n }\n }\n else\n if (s[ii] == 'U')\n {\n i--;\n if (mas[i - 1, j] || mas[i, j - 1] || mas[i, j + 1])\n {\n Console.WriteLine(\"BUG\");\n b = true;\n break;\n }\n }\n else\n if (s[ii] == 'D')\n {\n i++;\n if (mas[i+1,j]||mas[i,j-1] ||mas[i,j+1])\n {\n Console.WriteLine(\"BUG\");\n b = true;\n break;\n }\n }\n \n if (mas[i, j])\n {\n Console.WriteLine(\"BUG\");\n b = true;\n break;\n }\n else\n mas[i, j] = true;\n\n\n }\n if (!b) Console.WriteLine(\"OK\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool[,] map;\n \n string s = Console.ReadLine();\n int l, r, u, d;\n int x, X, y, Y;\n x = X = y = Y = 0;\n l = r = u = d = 0;\n foreach (char c in s)\n {\n switch (c)\n {\n case('L'):\n l++;\n break;\n case('R'):\n l--;\n break;\n case('U'):\n u++;\n break;\n case('D'):\n u--;\n break;\n }\n if (l > X)\n {\n X = l;\n }\n if (l < x) x = l;\n if (u < y) y = u;\n if (u > Y) Y = u;\n \n\n }\n map = new bool[Y - y+1, X - x+1];\n int ly=Y-y+1;\n int lx=X-x+1;\n int startx = X;\n int starty = Y;\n int i = starty;\n int j = startx;\n foreach (char c in s)\n {\n map[i, j] = true;\n switch (c)\n {\n case ('L'):\n j--;\n break;\n case ('R'):\n j++;\n break;\n case ('U'):\n i--;\n break;\n case ('D'):\n i++;\n break;\n }\n }\n map[i,j]=true;\n int[,] a = new int[ly, lx];\n for (int k = 0; k= dist)\n {\n a[i, j] = dist;\n if (i + 1 < ly && map[i + 1, j]) findRoad(a, map, i + 1, j, a[i, j] + 1, lx, ly);\n if (i > 0 && map[i - 1, j]) findRoad(a, map, i - 1, j, a[i, j] + 1, lx, ly);\n if (j + 1 < lx && map[i, j + 1]) findRoad(a, map, i, j + 1, a[i, j] + 1, lx, ly);\n if (j > 0 && map[i, j - 1]) findRoad(a, map, i, j - 1, a[i, j] + 1, lx, ly);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\n\nclass Problem\n{\n const int INF = 1987654321;\n const string inFile = \"..\\\\..\\\\test.in\";\n\n public void Process()\n {\n TextReader reader = Console.In;\n\n#if LOCAL_SITE_SUPERKINHLUAN\n // comment out this line when submit\n reader = new StreamReader(inFile);\n#endif\n\n string s = reader.ReadLine();\n string res = Solve(s);\n Console.WriteLine(res);\n }\n\n int[] dx = new int[] { -1, 0, 1, 0 };\n int[] dy = new int[] { 0, 1, 0, -1 };\n\n\n private string Solve(string s)\n {\n int[,] a = new int[300, 300];\n int x = 150, y = 150;\n a[x, y] = 1;\n for (int i = 0; i < s.Length; i++)\n {\n int count = a[x, y];\n\n char c = s[i];\n if (c == 'U') x++;\n else if (c == 'D') x--;\n else if (c == 'L') y++;\n else if (c == 'R') y--;\n\n if (a[x,y] > 0)\n return \"BUG\";\n\n a[x, y] = count + 1;\n\n for (int t = 0; t < 4; t++)\n {\n int u = x + dx[t];\n int v = y + dy[t];\n\n if (a[u, v] > 0 && a[u, v] != count)\n return \"BUG\";\n }\n }\n return \"OK\";\n }\n\n public static void Main()\n {\n Problem p = new Problem();\n p.Process();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Collections.Generic;\n// Powered by caide (code generator, tester, and library code inliner)\n\nclass Solution {\n public void solve(TextReader input, TextWriter output) {\n string steps = input.ReadLine();\n\n int n = steps.Length * 2 + 3;\n int[,] map = new int[n, n];\n\n int x = n / 2;\n int y = x;\n map[x, y] = 1;\n foreach (char step in steps)\n {\n if (step == 'L')\n x--;\n if (step == 'R')\n x++;\n if (step == 'U')\n y++;\n if (step == 'D')\n y--;\n map[x, y]++;\n\n \n int val = map[x, y - 1] +\n map[x - 1, y] + map[x, y] + map[x + 1, y]\n + map[x, y + 1];\n if(val > 2)\n {\n output.WriteLine(\"BUG\");\n return;\n }\n }\n\n output.WriteLine(\"OK\");\n }\n}\n\nclass CaideConstants {\n public const string InputFile = null;\n public const string OutputFile = null;\n}\npublic class Program {\n public static void Main(string[] args) {\n Solution solution = new Solution();\n using (System.IO.TextReader input =\n CaideConstants.InputFile == null ? System.Console.In :\n new System.IO.StreamReader(CaideConstants.InputFile))\n using (System.IO.TextWriter output =\n CaideConstants.OutputFile == null ? System.Console.Out:\n new System.IO.StreamWriter(CaideConstants.OutputFile))\n\n solution.solve(input, output);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static byte[][] matr;\n\n static void Main(string[] args)\n {\n matr = new byte[300][];\n for (int i = 0; i < 300; i++) matr[i] = new byte[300];\n string path = Console.ReadLine();\n int col = 150;\n int row = 150;\n matr[col][row] = 1;\n char[] pathChar = path.ToCharArray();\n for (int i = 0; i < path.Length; i++)\n {\n if (pathChar[i] == 'U') row++;\n if (pathChar[i] == 'D') row--;\n if (pathChar[i] == 'R') col++;\n if (pathChar[i] == 'L') col--;\n if (matr[col][row] == 0 \n && (matr[col - 1][row] == 0 || pathChar[i] == 'R')\n && (matr[col + 1][row] == 0 || pathChar[i] == 'L')\n && (matr[col][row - 1] == 0 || pathChar[i] == 'U')\n && (matr[col][row + 1] == 0 || pathChar[i] == 'D')\n ) matr[col][row] = 1;\n else\n {\n Console.WriteLine(\"BUG\");\n Console.ReadKey();\n return;\n }\n }\n Console.WriteLine(\"OK\");\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace Main\n{\n class Program\n {\n public static void Main(String[] args)\n {\n// Console.SetIn(new StreamReader(\"c:\\\\a.txt\"));\n\n var movementString = Console.ReadLine().ToCharArray();\n\n HashSet> pos = new HashSet>();\n\n Console.WriteLine(IsShortestPathCandidate(movementString, 0, pos, 0, 0) ? \"OK\" : \"BUG\");\n }\n\n private static bool IsShortestPathCandidate(char[] movementString, int i, HashSet> pos, int x, int y)\n {\n if (pos.Contains(new Tuple(x, y)))\n return false;\n\n if (AdjacentVisitedPoints(x, y, pos) > 1)\n return false;\n\n if (i == movementString.Length)\n return true;\n\n pos.Add(new Tuple(x, y));\n\n switch (movementString[i])\n {\n case 'L':\n return IsShortestPathCandidate(movementString, i + 1, pos, x, y - 1);\n case 'R':\n return IsShortestPathCandidate(movementString, i + 1, pos, x, y + 1);\n case 'U':\n return IsShortestPathCandidate(movementString, i + 1, pos, x - 1, y);\n default:\n return IsShortestPathCandidate(movementString, i + 1, pos, x + 1, y);\n }\n }\n\n private static int AdjacentVisitedPoints(int x, int y, HashSet> pos)\n {\n int vis = 0;\n\n if (pos.Contains(new Tuple(x + 1, y)))\n vis++;\n\n if (pos.Contains(new Tuple(x - 1, y)))\n vis++;\n\n if (pos.Contains(new Tuple(x, y + 1)))\n vis++;\n\n if (pos.Contains(new Tuple(x, y - 1)))\n vis++;\n\n return vis;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int SIZE = 300;\n int[] dr = { 0, 1, 0, -1 };\n int[] dc = { 1, 0, -1, 0 };\n string dir = \"RULD\";\n\n public void Solve()\n {\n int r = SIZE / 2;\n int c = SIZE / 2;\n var f = new bool[SIZE, SIZE];\n f[r, c] = true;\n string s = ReadToken();\n foreach (char ch in s)\n {\n r += dr[dir.IndexOf(ch)];\n c += dc[dir.IndexOf(ch)];\n f[r, c] = true;\n }\n\n var vis = new bool[SIZE, SIZE];\n var q = new Queue>();\n q.Enqueue(Tuple.Create(SIZE / 2, SIZE / 2));\n vis[SIZE / 2, SIZE / 2] = true;\n int step = 0;\n while (true)\n {\n var nq = new Queue>();\n while (q.Count > 0)\n {\n var t = q.Dequeue();\n if (t.Item1 == r && t.Item2 == c)\n {\n Write(step == s.Length ? \"OK\" : \"BUG\");\n return;\n }\n for (int k = 0; k < 4; k++)\n {\n int nr = t.Item1 + dr[k];\n int nc = t.Item2 + dc[k];\n if (f[nr, nc] && !vis[nr, nc])\n {\n vis[nr, nc] = true;\n nq.Enqueue(Tuple.Create(nr, nc));\n }\n }\n }\n q = nq;\n step++;\n }\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace NS\n{\n\tclass MainClass\n\t{\n\t\tstatic List xa, ya;\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar s = Console.ReadLine ();\n\n\t\t\txa = new List ();\n\t\t\tya = new List ();\n\t\t\tint x = 0;\n\t\t\tint y = 0;\n\t\t\txa.Add(0);\n\t\t\tya.Add(0);\n\t\t\tforeach (var c in s) {\n\t\t\t\tif (c=='L')\n\t\t\t\t\tx--;\n\t\t\t\tif (c=='R')\n\t\t\t\t\tx++;\n\t\t\t\tif (c=='U')\n\t\t\t\t\ty++;\n\t\t\t\tif (c=='D')\n\t\t\t\t\ty--;\n\n\t\t\t\tfor(int i = 0; i hs = new HashSet();\n int x = 0;\n int y = 0;\n hs.Add(string.Format(\"{0},{1}\", x, y));\n for (int i = 0; i < s.Length; i++)\n {\n string key_prev = string.Format(\"{0},{1}\", x, y);\n if (s[i] == 'U') y--;\n else if (s[i] == 'D') y++;\n else if (s[i] == 'L') x--;\n else if (s[i] == 'R') x++;\n string key = string.Format(\"{0},{1}\", x, y);\n string key_u = string.Format(\"{0},{1}\", x, y - 1);\n string key_d = string.Format(\"{0},{1}\", x, y + 1);\n string key_l = string.Format(\"{0},{1}\", x - 1, y);\n string key_r = string.Format(\"{0},{1}\", x + 1, y);\n if (hs.Contains(key))\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n if ((key_prev != key_u && hs.Contains(key_u)) ||\n (key_prev != key_d && hs.Contains(key_d)) ||\n (key_prev != key_l && hs.Contains(key_l)) ||\n (key_prev != key_r && hs.Contains(key_r)))\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n hs.Add(key);\n }\n Console.WriteLine(\"OK\");\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n var vx = tekx; var vy = teky;\n for (int i = 0; i < s.Length; i++)\n {\n var oldx = tekx;\n var oldy = teky;\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n //if(i>0 && ( s[])) was = true;\n for (int x = 0; x < 2;x++ )\n //for (int y = 0; y < 2; y++)\n {\n var newx = tekx - 1 + 2 * x;\n var newy = teky;\n if ((oldx != newx || oldy != newy) && mas[newx, newy]) was = true;\n newx = tekx;\n newy = teky - 1 + 2 * x;\n if ((oldx != newx || oldy != newy) && mas[newx, newy]) was = true;\n }\n //if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n if (vx == tekx && vy == teky) was = true;\n vx = oldx; vy = oldy;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n//using System.Linq;\n\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string path = Console.ReadLine();\n\n List coords = new List();\n coords.Add(\"0;0\");\n int lastX = 0, lastY = 0; char lastCh = path[0];\n foreach (char ch in path) \n {\n if (ch == 'L') { lastX--; }\n if (ch == 'R') { lastX++; }\n if (ch == 'U') { lastY++; }\n if (ch == 'D') { lastY--; }\n string[] checkStrs = strs(ch, lastX, lastY);\n foreach (string checkStr in checkStrs) if (coords.Contains(checkStr)) { Console.WriteLine(\"BUG\"); return; }\n if ((ch == 'L' && lastCh == 'R') || (ch == 'R' && lastCh == 'L') || (ch == 'U' && lastCh == 'D') || (ch == 'D' && lastCh == 'U')) { Console.WriteLine(\"BUG\"); return; }\n coords.Add(string.Format(\"{0};{1}\", lastX, lastY)); lastCh = ch;\n }\n Console.WriteLine(\"OK\");\n }\n\n static string[] strs(char ch, int x, int y)\n {\n List checkCoords = new List();\n string up = string.Format(\"{0};{1}\", x, y + 1);\n string down = string.Format(\"{0};{1}\", x, y - 1);\n string left = string.Format(\"{0};{1}\", x - 1, y);\n string right = string.Format(\"{0};{1}\", x + 1, y);\n if (ch == 'U') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'D') { checkCoords.Add(down); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'L') { checkCoords.Add(up); checkCoords.Add(down); checkCoords.Add(left); }\n if (ch == 'R') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(down); }\n return checkCoords.ToArray();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int[] dp;\n private static int n;\n private static void Fill(int mask, int time)\n {\n if (dp[mask] > 0 && dp[mask] <= time) return;\n dp[mask] = time;\n\n for (int i = 0; i < n; i++)\n if (((mask >> i) & 1) == 0)\n {\n mask |= (1 << i);\n Fill(mask, time + 2 * Dist(i));\n for (int j = i + 1; j < n; j++)\n if (((mask >> j) & 1) == 0)\n {\n Fill(mask | (1 << j), time + Dist(i) + Dist(j) + Dist(i, j));\n }\n\n return;\n }\n }\n\n private static int Dist(int id)\n {\n return x[id] * x[id] + y[id] * y[id];\n }\n\n private static int Dist(int id1, int id2)\n {\n int dx = x[id1] - x[id2];\n int dy = y[id1] - y[id2];\n return dx * dx + dy * dy;\n }\n\n private static int[] x, y;\n private static void Solve()\n {\n int xs = RI();\n int ys = RI();\n n = RI();\n x = new int[n];\n y = new int[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = RI() - xs;\n y[i] = RI() - ys;\n }\n\n dp = new int[1 << n];\n\n Fill(0, 0);\n }\n\n static void Main(string[] args)\n {\n int[,] map = new int[222, 222];\n\n int x = 105;\n int y = 105;\n map[x, y] = 1;\n foreach (char ch in Console.ReadLine())\n {\n if (ch == 'U') y++;\n if (ch == 'D') y--;\n if (ch == 'L') x--;\n if (ch == 'R') x++;\n\n int count = map[x - 1, y] + map[x + 1, y] + map[x, y - 1] + map[x, y + 1];\n count += 2 * map[x, y];\n map[x, y] = 1;\n\n if (count > 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "negative_code": [{"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _8b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var s = Console.ReadLine();\n var n = s.Length;\n var t = new int[2 * n + 1, 2 * n + 1];\n var x = n;\n var y = n;\n t[y, x] = 1;\n for (int i = 0; i < n; i++)\n {\n var next = s[i];\n if (next == 'L')\n {\n y--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n }\n }\n else if (next == 'R')\n {\n y++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n }\n }\n else if (next == 'U')\n {\n x++;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n }\n }\n else if (next == 'D')\n {\n x--;\n if (t[y, x] == 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n else\n {\n\n t[y, x] = 1;\n }\n }\n }\n\n Console.WriteLine(\"OK\");\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar steps = sr.NextString();\n\t\t\tvar matrix = new bool[300, 300];\n\t\t\tvar sx = 150;\n\t\t\tvar sy = 150;\n\t\t\tmatrix[sx, sy] = true;\n\t\t\tfor (var i = 0; i < steps.Length; i++) {\n\t\t\t\tvar next = steps[i];\n\t\t\t\tvar dx = 0;\n\t\t\t\tvar dy = 0;\n\t\t\t\tif (next == 'U')\n\t\t\t\t\tdy--;\n\t\t\t\tif (next == 'D')\n\t\t\t\t\tdy++;\n\t\t\t\tif (next == 'L')\n\t\t\t\t\tdx--;\n\t\t\t\tif (next == 'R')\n\t\t\t\t\tdx++;\n\t\t\t\tsx += dx;\n\t\t\t\tsy += dy;\n\t\t\t\tif (matrix[sx, sy]) {\n\t\t\t\t\tsw.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tmatrix[sx, sy] = true;\n\t\t\t}\n\t\t\tvar count = 0;\n\t\t\tif (matrix[sx + 1, sy])\n\t\t\t\tcount++;\n\t\t\tif (matrix[sx, sy + 1])\n\t\t\t\tcount++;\n\t\t\tif (matrix[sx -1, sy]) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (matrix[sx, sy - 1]) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count > 1) {\n\t\t\t\tsw.WriteLine(\"BUG\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar steps = sr.NextString();\n\t\t\tvar matrix = new bool[300, 300];\n\t\t\tvar sx = 150;\n\t\t\tvar sy = 150;\n\t\t\tmatrix[sx, sy] = true;\n\t\t\tfor (var i = 0; i < steps.Length; i++) {\n\t\t\t\tvar next = steps[i];\n\t\t\t\tvar dx = 0;\n\t\t\t\tvar dy = 0;\n\t\t\t\tif (next == 'U')\n\t\t\t\t\tdy--;\n\t\t\t\tif (next == 'D')\n\t\t\t\t\tdy++;\n\t\t\t\tif (next == 'L')\n\t\t\t\t\tdx--;\n\t\t\t\tif (next == 'R')\n\t\t\t\t\tdx++;\n\t\t\t\tsx += dx;\n\t\t\t\tsy += dy;\n\t\t\t\tif (matrix[sx, sy]) {\n\t\t\t\t\tsw.WriteLine(\"BUG\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tmatrix[sx, sy] = true;\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine().Trim();\n\n HashSet hs = new HashSet();\n int x = 0;\n int y = 0;\n hs.Add(string.Format(\"{0},{1}\", x, y));\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'U') y--;\n else if (s[i] == 'D') y++;\n else if (s[i] == 'L') x--;\n else if (s[i] == 'R') x++;\n string key = string.Format(\"{0},{1}\", x, y);\n if (hs.Contains(key))\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n hs.Add(key);\n }\n Console.WriteLine(\"OK\");\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n for (int i = 0; i < s.Length; i++)\n {\n var oldx = tekx;\n var oldy = teky;\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n if(i>0 &&s[i-1]==s[i]) was = true;\n for (int x = 0; x < 2;x++ )\n for (int y = 0; y < 2; y++)\n {\n var newx = tekx - 1 + 2 * x;\n var newy = teky - 1 + 2 * y;\n if (oldx != newx && oldy != newy && mas[newx, newy]) was = true;\n }\n //if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n var vx = tekx; var vy = teky;\n for (int i = 0; i < s.Length; i++)\n {\n var oldx = tekx;\n var oldy = teky;\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n //if(i>0 && ( s[])) was = true;\n for (int x = 0; x < 2;x++ )\n //for (int y = 0; y < 2; y++)\n {\n var newx = tekx - 1 + 2 * x;\n var newy = teky;\n if (oldx != newx && oldy != newy && mas[newx, newy]) was = true;\n newx = tekx;\n newy = teky - 1 + 2 * x;\n if (oldx != newx && oldy != newy && mas[newx, newy]) was = true;\n }\n //if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n if (vx == tekx && vy == teky) was = true;\n vx = oldx; vy = oldy;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n for (int i = 0; i < s.Length; i++)\n {\n var oldx = tekx;\n var oldy = teky;\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n for (int x = 0; x < 2;x++ )\n for (int y = 0; y < 2; y++)\n {\n var newx = tekx - 1 + 2 * x;\n var newy = teky - 1 + 2 * y;\n if (oldx != newx && oldy != newy && mas[newx, newy]) was = true;\n }\n //if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\npublic class Example\n{\n\n public static void Main()\n {\n string s = Console.ReadLine();\n\n bool[,] mas = new bool[300, 300];\n mas[150, 150] = true;\n int tekx = 150; int teky = 150;\n bool was = false;\n var vx = tekx; var vy = teky;\n for (int i = 0; i < s.Length; i++)\n {\n var oldx = tekx;\n var oldy = teky;\n if (s[i] == 'U') teky--;\n if (s[i] == 'D') teky++;\n if (s[i] == 'L') tekx--;\n if (s[i] == 'R') tekx++;\n //if(i>0 && ( s[])) was = true;\n for (int x = 0; x < 2;x++ )\n for (int y = 0; y < 2; y++)\n {\n var newx = tekx - 1 + 2 * x;\n var newy = teky - 1 + 2 * y;\n if (oldx != newx && oldy != newy && mas[newx, newy]) was = true;\n }\n //if (mas[tekx, teky]) was = true;\n mas[tekx, teky] = true;\n if (vx == tekx && vy == teky) was = true;\n vx = oldx; vy = oldy;\n }\n if (was) Console.WriteLine(\"BUG\"); else Console.WriteLine(\"OK\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n//using System.Linq;\n\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string path = Console.ReadLine();\n\n List coords = new List();\n coords.Add(\"0;0\"); \n int lastX = 0, lastY = 0;\n foreach (char ch in path) \n {\n if (ch == 'L') lastX--;\n if (ch == 'R') lastX++;\n if (ch == 'U') lastY++;\n if (ch == 'D') lastY--;\n if (coords.Contains(string.Format(\"{0};{1}\", lastX, lastY))) { Console.WriteLine(\"BUG\"); return; }\n }\n Console.WriteLine(\"OK\");\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n//using System.Linq;\n\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string path = Console.ReadLine();\n\n List coords = new List();\n coords.Add(\"0;0\");\n int lastX = 0, lastY = 0; char lastCh = path[0];\n foreach (char ch in path) \n {\n if (ch == 'L') { lastX--; }\n if (ch == 'R') { lastX++; }\n if (ch == 'U') { lastY++; }\n if (ch == 'D') { lastY--; }\n string[] checkStrs = strs(ch, lastX, lastY);\n foreach (string checkStr in checkStrs) if (coords.Contains(checkStr)) { Console.WriteLine(\"BUG\"); return; }\n if ((ch == 'L' && lastCh == 'R') || (ch == 'R' && lastCh == 'L') || (ch == 'U' && lastCh == 'D') || (ch == 'D' && lastCh == 'U')) { Console.WriteLine(\"BUG\"); return; }\n coords.Add(string.Format(\"{0};{1}\", lastX, lastY));\n }\n Console.WriteLine(\"OK\");\n }\n\n static string[] strs(char ch, int x, int y)\n {\n List checkCoords = new List();\n string up = string.Format(\"{0};{1}\", x, y + 1);\n string down = string.Format(\"{0};{1}\", x, y - 1);\n string left = string.Format(\"{0};{1}\", x - 1, y);\n string right = string.Format(\"{0};{1}\", x + 1, y);\n if (ch == 'U') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'D') { checkCoords.Add(down); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'L') { checkCoords.Add(up); checkCoords.Add(down); checkCoords.Add(left); }\n if (ch == 'R') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(down); }\n return checkCoords.ToArray();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n//using System.Linq;\n\n\nnamespace consoleTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string path = Console.ReadLine();\n\n List coords = new List();\n coords.Add(\"0;0\"); \n int lastX = 0, lastY = 0;\n foreach (char ch in path) \n {\n if (ch == 'L') { lastX--; }\n if (ch == 'R') { lastX++; }\n if (ch == 'U') { lastY++; }\n if (ch == 'D') { lastY--; }\n string[] checkStrs = strs(ch, lastX, lastY);\n foreach (string checkStr in checkStrs) if (coords.Contains(checkStr)) { Console.WriteLine(\"BUG\"); return; }\n coords.Add(string.Format(\"{0};{1}\", lastX, lastY));\n }\n Console.WriteLine(\"OK\");\n }\n\n static string[] strs(char ch, int x, int y)\n {\n List checkCoords = new List();\n string up = string.Format(\"{0};{1}\", x, y + 1);\n string down = string.Format(\"{0};{1}\", x, y - 1);\n string left = string.Format(\"{0};{1}\", x - 1, y);\n string right = string.Format(\"{0};{1}\", x + 1, y);\n if (ch == 'U') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'D') { checkCoords.Add(down); checkCoords.Add(right); checkCoords.Add(left); }\n if (ch == 'L') { checkCoords.Add(up); checkCoords.Add(down); checkCoords.Add(left); }\n if (ch == 'R') { checkCoords.Add(up); checkCoords.Add(right); checkCoords.Add(down); }\n return checkCoords.ToArray();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static void Solve()\n {\n int xs = RI();\n int ys = RI();\n int n = RI();\n int[] x = new int[n];\n int[] y = new int[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = RI() - xs;\n y[i] = RI() - ys;\n }\n\n\n }\n\n static void Main(string[] args)\n {\n int[,] map = new int[222, 222];\n\n int x = 105;\n int y = 105;\n map[x, y] = 1;\n foreach (char ch in Console.ReadLine())\n {\n if (ch == 'U') y++;\n if (ch == 'D') y--;\n if (ch == 'L') x--;\n if (ch == 'R') x++;\n map[x, y] = 1;\n\n int count = map[x - 1, y] + map[x + 1, y] + map[x, y - 1] + map[x, y + 1];\n\n if (count > 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] map = new int[222, 222];\n\n int x = 105;\n int y = 105;\n map[x, y] = 1;\n foreach (char ch in Console.ReadLine())\n {\n if (ch == 'U') y++;\n if (ch == 'D') y--;\n if (ch == 'L') x--;\n if (ch == 'R') x++;\n\n\n int count = map[x - 1, y] + map[x + 1, y] + map[x, y - 1] + map[x, y + 1];\n\n if (count > 1)\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n bool[,] map = new bool[222, 222];\n\n int x = 102;\n int y = 102;\n map[x, y] = true;\n foreach(char ch in Console.ReadLine())\n {\n if (ch == 'U') y++;\n if (ch == 'D') y--;\n if (ch == 'L') x--;\n if (ch == 'R') x++;\n\n if (map[x, y])\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n // class PairInt{\n // public int fst;\n // public int snd;\n\n // // void Add(Pair p) {\n // // fst += p.fst;\n // // snd += p.snd;\n // // }\n // }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n // int T = sc.NextInt();\n\n // for (int t = 0; t < T; ++t) {\n // }\n\n string s = sc.Next();\n\n var visited = new HashSet>();\n var dir = new Dictionary>{\n {'R', new Tuple(1, 0)},\n {'L', new Tuple(-1, 0)},\n {'U', new Tuple(0, 1)},\n {'D', new Tuple(0, -1)}\n };\n \n\n var pos = new Tuple(0, 0);\n visited.Add(pos);\n\n foreach (var e in s) {\n var prev = pos;\n pos = new Tuple(pos.Item1 + dir[e].Item1, pos.Item2 + dir[e].Item2);\n\n visited.Add(pos);\n\n foreach (var d in dir.Values) {\n var nbr = new Tuple(pos.Item1 + d.Item1, pos.Item2 + d.Item2);\n if (visited.Contains(nbr) && !(nbr.Equals(prev))) {\n // wr.Write(e);\n // wr.Write(pos);\n // wr.Write(nbr);\n wr.Write(\"BUG\");\n wr.Flush();\n return;\n }\n }\n }\n\n // debug(pos);\n // foreach (var e in visited) {\n // debug(e);\n // }\n\n wr.Write(\"OK\");\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Beta82\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n int[,] coord = new int[100, 2];\n\n bool flag = false;\n int i = 0;\n int x=0,y=0;\n while (!flag&&i 1)\n flag = true;\n i++;\n }\n\n if (flag)\n Console.WriteLine(\"BUG\");\n else\n Console.WriteLine(\"OK\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int x = n;\n int y = n;\n vis[x, y] = true;\n bool ok = true;\n int ex = -1;\n int ey = -1;\n for (int i = 0; i < t.Length; i++)\n {\n int nx, ny;\n nx=x;\n ny=y;\n if (t[i] == 'D')\n ny--;\n if (t[i] == 'U')\n ny++;\n if (t[i] == 'L')\n nx--;\n if (t[i] == 'R')\n nx++;\n vis[nx, ny] = true;\n x = nx;\n y = ny;\n ex = x;\n ey = y;\n \n\n\n\n }\n if (!ok)\n ;\n else\n {\n int[,] d = new int[2 * n + 1, 2 * n + 1];\n d[n, n] = 0;\n for (int i = 0; i < 2 * n + 1; i++)\n for (int j = 0; j < 2 * n; j++)\n if (i != n || j != n)\n d[i, j] = -1;\n Queue q = new Queue();\n x = n;\n y = n;\n q.Enqueue(x);\n q.Enqueue(y);\n while (q.Count > 0)\n {\n x = q.Dequeue();\n y = q.Dequeue();\n for (int dx = -1; dx <= 1; dx++)\n for (int dy = -1; dy <= 1; dy++)\n if (dx == 0 ^ dy == 0)\n {\n int nx = x + dx;\n int ny = y + dy;\n if (nx < 0 || nx >= 2 * n || ny < 0 || ny >= 2 * n || !vis[nx, ny] || d[nx, ny] != -1)\n continue;\n d[nx, ny] = 1 + d[x, y];\n q.Enqueue(nx);\n q.Enqueue(ny);\n\n }\n }\n if (d[ex, ey] == t.Length)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int r = n;\n int c = n;\n vis[r, c] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nr, nc;\n nr=r;\n nc=c;\n switch (t[i])\n {\n case 'D':\n nr--;\n break;\n case 'U':\n nr++;\n break;\n case 'L':\n nc--;\n break;\n default:\n nc++;\n break;\n }\n if (vis[nr, nc])\n {\n ok = false;\n break;\n }\n vis[nr, nc] = true;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int x = n;\n int y = n;\n vis[x, y] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nx, ny;\n nx=x;\n ny=y;\n if (t[i] == 'D')\n ny--;\n if (t[i] == 'U')\n ny++;\n if (t[i] == 'L')\n nx--;\n if (t[i] == 'R')\n nx++;\n if (vis[nx, ny])\n {\n ok = false;\n break;\n }\n vis[nx, ny] = true;\n x = nx;\n y = ny;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int r = n;\n int c = n;\n vis[r, c] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nr, nc;\n nr=r;\n nc=c;\n switch (t[i])\n {\n case 'D':\n nr--;\n break;\n case 'U':\n nr++;\n break;\n case 'L':\n nc--;\n break;\n default:\n nc++;\n break;\n }\n if (vis[nr, nc])\n {\n ok = false;\n break;\n }\n vis[nr, nc] = true;\n r = nr;\n c = nc;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int r = n;\n int c = n;\n vis[r, c] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nr, nc;\n nr=r;\n nc=c;\n switch (t[i])\n {\n case 'D':\n nr++;\n break;\n case 'U':\n nr--;\n break;\n case 'L':\n nc--;\n break;\n default:\n nc++;\n break;\n }\n if (vis[nr, nc])\n {\n ok = false;\n break;\n }\n vis[nr, nc] = true;\n r = nr;\n c = nc;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int r = n;\n int c = n;\n vis[r, c] = true;\n bool ok = true;\n for (int i = 0; i < t.Length; i++)\n {\n int nr, nc;\n nr=r;\n nc=c;\n switch (t[i])\n {\n case 'D':\n nr--;\n break;\n case 'U':\n nr++;\n break;\n case 'L':\n nc--;\n break;\n default:\n nc++;\n break;\n }\n if (vis[nr, nc])\n {\n ok = false;\n break;\n }\n vis[nr, nc] = true;\n r = nr;\n c = nc;\n\n \n\n\n\n }\n if (ok)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n string t = Console.ReadLine();\n int n = t.Length;\n bool[,] vis = new bool[2 * n + 1, 2 * n + 1];\n int x = n;\n int y = n;\n vis[x, y] = true;\n bool ok = true;\n int ex = -1;\n int ey = -1;\n for (int i = 0; i < t.Length; i++)\n {\n int nx, ny;\n nx=x;\n ny=y;\n if (t[i] == 'D')\n ny--;\n if (t[i] == 'U')\n ny++;\n if (t[i] == 'L')\n nx--;\n if (t[i] == 'R')\n nx++;\n vis[nx, ny] = true;\n x = nx;\n y = ny;\n ex = x;\n ey = y;\n \n }\n if (!ok)\n ;\n else\n {\n int[,] d = new int[2 * n + 1, 2 * n + 1];\n d[n, n] = 0;\n for (int i = 0; i < 2 * n + 1; i++)\n for (int j = 0; j < 2 * n+1; j++)\n if (i != n || j != n)\n d[i, j] = -1;\n Queue q = new Queue();\n x = n;\n y = n;\n q.Enqueue(x);\n q.Enqueue(y);\n while (q.Count > 0)\n {\n x = q.Dequeue();\n y = q.Dequeue();\n for (int dx = -1; dx <= 1; dx++)\n for (int dy = -1; dy <= 1; dy++)\n if (dx == 0 ^ dy == 0)\n {\n int nx = x + dx;\n int ny = y + dy;\n if (nx < 0 || nx >= 2 * n || ny < 0 || ny >= 2 * n || !vis[nx, ny] || d[nx, ny] != -1)\n continue;\n d[nx, ny] = 1 + d[x, y];\n q.Enqueue(nx);\n q.Enqueue(ny);\n\n }\n }\n if (d[ex, ey] == t.Length)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"BUG\");\n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n int pos = 0;\n HashSet vis = new HashSet();\n vis.Add(pos);\n for (int i = 0; i < s.Length; ++i)\n {\n if (s[i] == 'U') pos += 1000;\n else if (s[i] == 'D') pos -= 1000;\n else if (s[i] == 'R') ++pos;\n else --pos;\n if (vis.Contains(pos))\n {\n Console.WriteLine(\"BUG\");\n return;\n }\n }\n Console.WriteLine(\"OK\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n class C\n {\n static string _input =\n@\"\nLLUUUR\n\";\n\n #region test\n\n static List _lines;\n\n static string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n static void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n static void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n #endregion\n\n static void Main(string[] args)\n {\n string s = ReadLine();\n\n //s = new string('U', 100);\n\n int x=0;\n int y=0;\n List list = new List();\n list.Add(\"0.0\");\n \n foreach (char c in s)\n {\n switch (c)\n {\n case 'U': y--; break;\n case 'D': y++; break;\n case 'R': x++; break;\n case 'L': x--; break;\n }\n string key = x + \".\" + y;\n if (list.Contains(key))\n {\n Write(\"BUG\");\n return;\n }\n list.Add(key);\n }\n Write(\"OK\");\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\n\nclass Problem\n{\n const int INF = 1987654321;\n const string inFile = \"..\\\\..\\\\test.in\";\n\n public void Process()\n {\n TextReader reader = Console.In;\n\n#if LOCAL_SITE_SUPERKINHLUAN\n // comment out this line when submit\n reader = new StreamReader(inFile);\n#endif\n\n string s = reader.ReadLine();\n string res = Solve(s);\n Console.WriteLine(res);\n }\n\n private string Solve(string s)\n {\n bool[,] a = new bool[300, 300];\n int x = 150, y = 150;\n for (int i = 0; i < s.Length; i++)\n {\n a[x,y] = true;\n char c = s[i];\n if (c == 'U') x++;\n else if (c == 'D') x--;\n else if (c == 'L') y++;\n else if (c == 'R') y--;\n\n if (a[x, y])\n return \"BUG\";\n }\n return \"OK\";\n }\n\n public static void Main()\n {\n Problem p = new Problem();\n p.Process();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static byte[][] matr;\n\n static void Main(string[] args)\n {\n matr = new byte[300][];\n for (int i = 0; i < 300; i++) matr[i] = new byte[300];\n string path = Console.ReadLine();\n int col = 150;\n int row = 150;\n matr[col][row] = 1;\n char[] pathChar = path.ToCharArray();\n for (int i = 0; i < path.Length; i++)\n {\n if (pathChar[i] == 'U') row++;\n if (pathChar[i] == 'D') row--;\n if (pathChar[i] == 'R') col++;\n if (pathChar[i] == 'L') col--;\n if (matr[col][row] == 0) matr[col][row] = 1;\n else\n {\n Console.WriteLine(\"BUG\");\n Console.ReadKey();\n return;\n }\n }\n Console.WriteLine(\"OK\");\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static byte[][] matr;\n\n static void Main(string[] args)\n {\n matr = new byte[300][];\n for (int i = 0; i < 300; i++) matr[i] = new byte[300];\n string path = Console.ReadLine();\n int col = 150;\n int row = 150;\n matr[col][row] = 1;\n char[] pathChar = path.ToCharArray();\n for (int i = 0; i < path.Length; i++)\n {\n if (pathChar[i] == 'U') row++;\n if (pathChar[i] == 'D') row--;\n if (pathChar[i] == 'R') col++;\n if (pathChar[i] == 'L') col--;\n if (matr[col][row] == 0 \n && matr[col - 1][row] == 0\n && matr[col + 1][row] == 0\n && matr[col][row - 1] == 0\n && matr[col][row + 1] == 0\n ) matr[col][row] = 1;\n else\n {\n Console.WriteLine(\"BUG\");\n Console.ReadKey();\n return;\n }\n }\n Console.WriteLine(\"OK\");\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace b\n{\n class Program\n {\n\n class Point\n {\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public bool Eq(Point an)\n {\n return (this.x == an.x && this.y == an.y);\n }\n\n public int x, y;\n }\n\n static void Main(string[] args)\n {\n string way = Console.ReadLine();\n Point[] pts = new Point[way.Length+1];\n pts[0] = new Point(0, 0);\n bool bug = false;\n for (int i = 0; i < way.Length; i++)\n {\n\n switch (way[i])\n {\n case 'L':\n pts[i + 1] = new Point(pts[i].x-1, pts[i].y);\n break;\n case 'R':\n pts[i + 1] = new Point(pts[i].x+1, pts[i].y);\n break;\n case 'U':\n pts[i + 1] = new Point(pts[i].x, pts[i].y+1);\n break;\n case 'D':\n pts[i + 1] = new Point(pts[i].x, pts[i].y-1);\n break;\n }\n\n for (int j = 0; j < i + 1; j++)\n {\n if (pts[i+1].Eq(pts[j]))\n {\n bug = true;\n break;\n }\n }\n if (bug) break;\n }\n if (bug) Console.WriteLine(\"BUG\");\n else Console.WriteLine(\"OK\");\n }\n }\n}\n"}], "src_uid": "bb7805cc9d1cc907b64371b209c564b3"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 4 == 2) Console.WriteLine(\"1 B\");\n if (n % 4 == 0) Console.WriteLine(\"1 A\");\n if (n % 4 == 1) Console.WriteLine(\"0 A\");\n if (n % 4 == 3) Console.WriteLine(\"2 A\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int q;\n q = int.Parse (Console.ReadLine());\n if (q % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n else if (q % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n else if (q % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n else\n {\n Console.WriteLine(\"1 A\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olimp1\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n var ostatok = number % 4;\n\n if (ostatok == 1)\n Console.WriteLine(\"0 A\");\n\n else if (ostatok == 3)\n Console.WriteLine(\"2 A\");\n\n else if (ostatok == 2)\n Console.WriteLine(\"1 B\");\n \n else if (ostatok == 0)\n Console.WriteLine(\"1 A\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n\n int n = t % 4;\n switch (n)\n {\n case 0:\n Console.WriteLine(\"1 A\");\n break;\n case 1:\n Console.WriteLine(\"0 A\");\n break;\n case 2:\n Console.WriteLine(\"1 B\");\n break;\n case 3:\n Console.WriteLine(\"2 A\");\n break;\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n char[] c = new char[] { 'D', 'A', 'C', 'B' };\n int[] w = new int[] { 0, 3, 1, 2 };\n\n int mx = 0;\n int idx = 0;\n int v = 0;\n for (int i = 0; i < 3; ++i)\n {\n if(mx < w[(n + i) % 4])\n {\n mx = w[(n + i) % 4];\n idx = (n + i) % 4;\n v = n + i;\n }\n }\n\n Console.WriteLine(Math.Abs(n - v) + \" \" + c[idx]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n // Console.SetIn(new StreamReader(\"text.txt\"));\n int count = int.Parse(Console.ReadLine());\n int rez = 0;\n string hp = \"\";\n for (int i = 0; i < 4; i++)\n {\n rez = ((count - i) % 4 == 0) ? i : rez;\n }\n\n\n Console.WriteLine(rez==0?\"1 A\": rez == 1 ? \"0 A\":rez == 2 ? \"1 B\": \"2 A\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int rem = x % 4;\n if (rem == 1)\n Console.WriteLine(\"0 A\");\n if (rem == 2)\n Console.WriteLine(\"1 B\");\n if (rem == 3)\n Console.WriteLine(\"2 A\");\n if (rem==0)\n Console.WriteLine(\"1 A\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace _571\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n \n //solve_571C3();\n\n int[] tests = new int[] {2, 5, 1, 6, 8, 10, 13, 15, 20, 10, 3};\n\n //size 3 mean 4 elements. Because the counting starts from 0.\n //runPrefSumForEveryIndex(tests, 3);\n //Console.WriteLine();\n //runPrefXorForEveryIndex(tests, 3);\n solve_573A();\n }\n\n public static void solve_573A()\n {\n int x = Convert.ToInt32(Console.ReadLine());\n\n int mod1 = x % 4;\n int mod2 = 0;\n int mod3 = int.MaxValue;\n int count = 0;\n char l = 'A';\n\n mod2 = ++x % 4;\n mod3 = ++x % 4;\n\n if (mod1 == 3)\n {\n mod1 = 2;\n }\n else if (mod1 == 2)\n {\n mod1 = 3;\n }\n else if (mod1 == 0)\n {\n mod1 = 4;\n }\n \n if (mod2 == 3)\n {\n mod2 = 2;\n }\n else if (mod2 == 2)\n {\n mod2 = 3;\n }\n else if (mod2 == 0)\n {\n mod2 = 4;\n }\n \n if (mod3 == 3)\n {\n mod3 = 2;\n }\n else if (mod3 == 2)\n {\n mod3 = 3;\n }\n else if (mod3 == 0)\n {\n mod3 = 4;\n }\n\n int mod = Math.Min(Math.Min(mod1, mod2), mod3);\n\n if (mod == mod2)\n {\n count = 1;\n }\n else if (mod == mod3)\n {\n count = 2;\n }\n\n switch(mod)\n {\n case 1:\n l = 'A';\n break;\n case 2:\n l = 'B';\n break;\n case 3:\n l = 'C';\n break;\n case 4:\n l = 'D';\n break;\n }\n\n Console.Write(\"{0} {1}\", count, l);\n }\n\n public static void runPrefSumForEveryIndex(int[] nums, int size) //Func algo)\n {\n for (int i = 0; i < nums.Length - size; i++)\n {\n Console.WriteLine(\"l={0}, r={1}, sum={2} \", i, size + i, prefixSum(nums, i, size + i));\n }\n }\n public static void runPrefXorForEveryIndex(int[] nums, int size) //Func algo)\n {\n for (int i = 0; i < nums.Length - size; i++)\n {\n Console.WriteLine(\"l={0}, r={1}, sum={2} \", i, size + i, prefixXor(nums, i, size + i));\n }\n }\n\n public static int prefixSum(int[] nums, int l, int r)\n {\n int[] prefs = new int[nums.Length];\n\n prefs[0] = nums[0];\n for (int i = 1; i < nums.Length; i++)\n {\n prefs[i] = prefs[i - 1] + nums[i];\n }\n\n int res = 0;\n if (l > 0) \n {\n res = prefs[r] - prefs[l - 1];\n }\n else\n {\n res = prefs[r];\n }\n\n return res;\n }\n\n public static int prefixXor(int[] nums, int l, int r)\n {\n int[] prefs = new int[nums.Length];\n\n prefs[0] = nums[0];\n\n for (int i = 1; i < nums.Length; i++)\n {\n prefs[i] = prefs[i - 1] ^ nums[i];\n }\n\n int res = 0;\n\n if (l > 0)\n {\n res = prefs[r] ^ prefs[l - 1];\n }\n else\n {\n res = prefs[r];\n }\n\n return res;\n }\n\n //https://codeforces.com/contest/1186/submission/56222680\n public static void solve_571C3()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n int[] pref = new int[a.Length + 1];\n\n pref[0] = 0;\n\n for (int i = 0; i < a.Length; i++) \n {\n if (a[i] == '1')\n {\n pref[i + 1] = pref[i] + 1;\n }\n else\n {\n pref[i + 1] = pref[i];\n }\n }\n\n int count = 0;\n\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i] == '1')\n {\n count++;\n }\n }\n\n int ans = 0;\n for (int i = 0; i <= a.Length - b.Length; i++)\n {\n int sum = pref[i + b.Length] - pref[i] + count;\n if (sum % 2 == 0)\n {\n ans++;\n }\n }\n\n Console.WriteLine(ans);\n }\n\n //https://codeforces.com/contest/1186/submission/56245924\n public static void solve_571C2()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n int aone = 0;\n int bone = 0;\n \n for (int i = 0; i < b.Length; i++) \n {\n if (a[i] == '1')\n {\n aone++;\n }\n if (b[i] == '1')\n {\n bone++;\n }\n }\n\n int ans = 0;\n\n if (Math.Abs(aone - bone) % 2 == 0)\n {\n ans++;\n }\n\n for (int i = b.Length; i < a.Length; i++)\n {\n if (a[i] == '1')\n {\n aone++;\n }\n\n if (a[i - b.Length] == '1')\n {\n aone--;\n }\n\n if (Math.Abs(aone - bone) % 2 == 0)\n {\n ans++;\n }\n }\n\n Console.WriteLine(ans);\n }\n \n public static void solve_571C1()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n int c1 = 0;\n for (int i = 0; i < b.Length; i++) \n {\n if (b[i] == '1')\n {\n c1++;\n }\n }\n\n int sum = 0;\n\n for (int i = 0; i < b.Length; i++)\n {\n /*\n Here we count the sum of all ons we have in the string.\n Because it is a char type we need to convert it into int to be able\n to sum. But we can avoid conversion of types if we use the char arithmetique\n We can subtract 1 from 0 or 1 from 1 and we will get either 1 or 0.\n Because the ascii code for 1 is 49 and ascii code for 0 is 48.\n 49 - 48 = 1 (if 1 - 0)\n 49 - 49 = 0 (if 1 - 1)\n */\n sum += b[i] - '0';\n }\n\n int ans = (sum + c1) % 2 == 0 ? 1 : 0;\n\n for (int i = b.Length; i < a.Length; i++)\n {\n /*\n So in the loop above we counted how many Ones we have in the string b.\n Now we just count how many Ones we have in the string a and add the number to the same\n counter Sum.\n */\n sum += a[i] - '0';\n\n \n sum -= a[i - b.Length] - '0';\n ans += (sum + c1) % 2 == 0 ? 1 : 0;\n }\n\n Console.WriteLine(ans);\n\n }\n\n //http://codeforces.com/contest/1186/submission/56199529\n public static void solve_571C()\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n }\n\n public static void solve_571A()\n {\n string[] nmk = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(nmk[0]);\n int m = Convert.ToInt32(nmk[1]);\n int k = Convert.ToInt32(nmk[2]);\n\n string answer = \"YES\";\n\n if (m < n || k < n)\n {\n answer = \"NO\";\n }\n \n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Console\n{\n class Program\n {\n static void Main()\n {\n var input = int.Parse(System.Console.ReadLine());\n var n = input / 4;\n var category = string.Empty;\n string result;\n switch (input % 4)\n {\n case 0: category = \"D\";\n break;\n case 1: category = \"A\";\n break;\n case 2: category = \"C\";\n break;\n case 3: category = \"B\";\n break;\n }\n \n switch (category)\n {\n case \"A\":\n {\n System.Console.WriteLine(\"0 A\");\n break;\n }\n case \"B\":\n {\n System.Console.WriteLine(\"2 A\");\n break;\n }\n case \"C\":\n {\n System.Console.WriteLine(\"1 B\");\n break;\n }\n case \"D\":\n {\n System.Console.WriteLine(\"1 A\");\n break;\n }\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n char b = 'Z';\n int a = -1;\n string s = \"DACB\";\n for (int i = 0; i <= 2; i++)\n {\n int tb = (n + i) % 4;\n if (s[tb] < b)\n {\n a = i;\n b = s[tb];\n }\n }\nConsole.WriteLine($\"{a} {b}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = int.Parse(Console.ReadLine());\n var cat = N % 4;\n var rankA = rank(cat);\n var index = 0;\n for (var i = 0; i <= 2; i++)\n {\n var newrank = rank( (N + i) % 4 );\n if (newrank < rankA)\n {\n rankA = newrank;\n index = i;\n }\n }\n Console.WriteLine($\"{index} {rankA.ToString()}\");\n }\n\n\n private static char rank(int N){\n switch (N)\n {\n case 1: return 'A';\n case 3: return 'B';\n case 2: return 'C';\n case 0 : default: return 'D';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var x = input.ReadInt();\n var l = new[] { 'D', 'A', 'C', 'B' };\n Func c = (int i, int k) => l[(i + k) % 4];\n var d = 0;\n if (c(x, d) > c(x, 1))\n d = 1;\n if (c(x, d) > c(x, 2))\n d = 2;\n Write(d + \" \" + c(x, d));\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd()\n {\n return reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() =>\n (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() =>\n (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() =>\n (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1191_TokitsukazeAndEnhancement\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n char ch = 'x';\n int t = n % 4;\n switch(n % 4)\n {\n case 0: ch = 'A';\n t = 1;\n break; \n case 1: ch = 'A';\n t = 0;\n break;\n case 2: ch = 'B';\n t = 1;\n break;\n default: ch = 'A';\n t = 2;\n break;\n }\n\n Console.WriteLine(\"{0} {1}\",t,ch);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TestApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Int32.Parse(Console.ReadLine());\n int remainder = input % 4;\n\n if (remainder == 0)\n {\n Console.WriteLine(\"1 A\");\n }\n else if(remainder == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n else if(remainder == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n else if(remainder == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine()) % 4;\n Console.WriteLine($\"{Math.Abs(n - 1)} {(n == 2 ? \"B\" : \"A\")}\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n\t\t\twriter.WriteLine(valueToWrite.ToString(\"F8\"));\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n\n char GetCat(int v)\n {\n switch(v%4)\n {\n case 0: return 'D';\n case 1: return 'A';\n case 2: return 'C';\n case 3: return 'B';\n default: return 'Z';\n }\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n int bv = 0;\n char bc = GetCat(n);\n\n if(GetCat(n+1) < bc)\n {\n bv = 1;\n bc = GetCat(n + 1);\n }\n\n if (GetCat(n + 2) < bc)\n {\n bv = 2;\n bc = GetCat(n + 2);\n }\n\n ioHelper.WriteLine($\"{bv} {bc}\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n int n=int.Parse(Console.ReadLine());\n char[]c=new char[3];\n if(n%4==1)\n c[0]='A';\n else if(n%4==3)\n c[0]='B';\n else if(n%4==2)\n c[0]='C';\n else if(n%4==0)\n c[0]='D';\n \n \n if((n+1)%4==1)\n c[1]='A';\n else if((n+1)%4==3)\n c[1]='B';\n else if((n+1)%4==2)\n c[1]='C';\n else if((n+1)%4==0)\n c[1]='D';\n \n \n if((n+2)%4==1)\n c[2]='A';\n else if((n+2)%4==3)\n c[2]='B';\n else if((n+2)%4==2)\n c[2]='C';\n else if((n+2)%4==0)\n c[2]='D';\n \n \n \n string alph=\"ABCD\";\n \n int min=999999;\n int treo=0;\n string orf=\"\";\n for(int i=0;i<3;i++)\n {\n if(alph.Contains(c[i]))\n {\n if(alph.IndexOf(c[i]) ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static T[] create(int n, Func f)\n => Enumerable.Repeat(0, n).Select(f).ToArray();\n public static char[][] gred(int h)\n => create(h, _ => read.ToCharArray());\n public static int[] ar1D(int n)\n => create(n, _ => num);\n public static long[] arL1D(int n)\n => create(n, _ => numL);\n public static string[] strs(int n)\n => create(n, _ => read);\n public static int[][] ar2D(int n)\n => create(n, _ => ar);\n public static long[][] arL2D(int n)\n => create(n, _ => arL);\n public static List[] edge(int n)\n => create(n, _ => new List());\n public static T GetValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)\n {\n Make(out v1, out v2, out v3, out v4, out v5);\n v6 = Next();\n }\n private static Queue sc = new Queue();\n public static T Next(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue(sc.Dequeue()); }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int a = n;\n char l = ' ', ln = ' ';\n if (n % 4 == 1)\n Console.WriteLine(\"0 A\");\n else\n {\n switch (n % 4)\n {\n case 0: l = 'D'; break;\n case 2: l = 'C'; break;\n case 3: l = 'B'; break;\n }\n for (int i = 1; i < 4; i++)\n {\n a++;\n switch (a % 4)\n {\n case 0: ln = 'D';break;\n case 1: ln = 'A'; break;\n case 2:ln = 'C';break;\n case 3:ln = 'B';break;\n }\n if (ln < l)\n break;\n }\n Console.WriteLine((a - n) + \" \" + ln.ToString());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n int hp = Convert.ToInt32(Console.ReadLine());\n if (hp % 4 == 0)\n {\n Console.WriteLine(\"1 A\");\n return;\n }\n if (hp % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n return;\n }\n if (hp % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n return;\n }\n if (hp % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n return;\n }\n}\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Tokitsukaze_and_Enhancement\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static string Solve(string[] args)\n {\n switch (Next()%4)\n {\n case 0:\n return \"1 A\";\n case 1:\n return \"0 A\";\n case 2:\n return \"1 B\";\n case 3:\n return \"2 A\";\n }\n return \"\";\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Tokitsukaze_and_Enhancement\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int y = x % 4;\n if (y == 0)\n {\n Console.Write(\"1 A\");\n }\n else if (y == 3)\n {\n Console.Write(\"2 A\");\n }\n else if (y == 2)\n {\n Console.Write(\"1 B\");\n }\n else\n {\n Console.Write(\"0 A\");\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int hp = n % 4;\n if (hp == 0) Console.WriteLine(1 + \" A\");\n else if (hp == 1) Console.WriteLine(0 + \" A\");\n else if (hp == 2) Console.WriteLine(1 + \" B\");\n else Console.WriteLine(2 + \" A\"); \n }\n }\n}"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"33\"\n*/\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld : Helpers {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n\n var best = 'E';\n var besti = -1;\n for (var v = 0; v <= 2; v++) {\n if (Category(v + n) < best) {\n besti = v;\n best = Category(v + n);\n }\n }\n\n System.Console.WriteLine(\"{0} {1}\", besti, best);\n }\n\n static char Category(int n) {\n var d = n % 4;\n return (new []{'D', 'A', 'C', 'B'})[d];\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic class Helpers {\n public static string Show(IEnumerable arr) {\n return string.Join(\" \", arr);\n }\n\n public static void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int x = int.Parse(Console.ReadLine());\n char[] s = { 'D', 'A', 'C', 'B' };\n int n = x / 4;\n int k = x % 4;\n int a = 0;\n switch (k)\n {\n case 0:\n a = 1;\n break;\n case 2:\n a = 1;\n break;\n case 3:\n a = 2;\n break;\n }\n \n Console.WriteLine($\"{a} {s[(x + a) % 4]}\");\n }\n}\n"}, {"source_code": "\n using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int rem = x % 4;\n if (rem == 1)\n Console.WriteLine(\"0 A\");\n if (rem == 2)\n Console.WriteLine(\"1 B\");\n if (rem == 3)\n Console.WriteLine(\"2 A\");\n if (rem==0)\n Console.WriteLine(\"1 A\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main()\n {\n var healthPoints = int.Parse(Console.ReadLine());\n if (healthPoints % 4 == 1)\n Console.WriteLine(\"0 A\");\n else if (healthPoints % 4 == 2)\n Console.WriteLine(\"1 B\");\n else if (healthPoints % 4 == 3)\n Console.WriteLine(\"2 A\");\n else if (healthPoints % 4 == 0)\n Console.WriteLine(\"1 A\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static Stack GetBinaryNumber(long number)\n {\n Stack result = new Stack();\n while (number != 0)\n {\n result.Push(number % 2 == 1);\n number /= 2;\n }\n return result;\n }\n static long FastDegree(long number, long pow)\n {\n long result = 1;\n Stack StackPow = GetBinaryNumber(pow);\n while (StackPow.Count != 0)\n {\n result *= result;\n result %= (int)(1e9 + 7);\n if (StackPow.Pop())\n {\n result *= number;\n result %= (int)(1e9 + 7);\n }\n }\n return result;\n }\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if(x%4 == 1)\n {\n Console.WriteLine(\"0 A\");\n } else if(x%4 == 3)\n {\n Console.WriteLine(\"2 A\");\n } else if(x%4 == 2)\n {\n Console.WriteLine(\"1 B\");\n } else if(x%4 == 0)\n {\n Console.WriteLine(\"1 A\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n if(a%4==1)\n {\n Console.WriteLine(\"0 A\");\n }\n if(a%4==3)\n {\n Console.WriteLine(\"2 A\");\n }\n if(a%4==2)\n {\n Console.WriteLine(\"1 B\");\n }\n if(a%4==0)\n {\n Console.WriteLine(\"1 A\");\n }\n }\n }\n}\n"}, {"source_code": "/* Date: 12.07.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\040\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\040\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** n = \" + n);\n# endif\n\n\t\tint a = 0;\n\t\tn %= 4;\n\t\tchar c = 'A';\n\t\tif ( n == 1 )\n\t\t{\n\t\t\ta = 0; c = 'A';\n\t\t}\n\t\telse if ( n == 2 )\n\t\t{\n\t\t\ta = 1; c = 'B';\n\t\t}\n\t\telse if ( n == 3 )\n\t\t{\n\t\t\ta = 2; c = 'A';\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta = 1; c = 'A';\n\t\t}\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (a + \" \" + c);\n# else\n\t\tsw.WriteLine (a + \" \" + c);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 4 == 0)\n {\n Console.WriteLine(\"1 A\");\n }\n if (n % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n if (n % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n if (n % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing static System.Console;\nusing static System.Math;\n\n\nnamespace CodeForces\n{\n class codeForcesssssssss\n {\n static void Main(string[] args)\n {\n int N = int.Parse(ReadLine());\n if (N % 4 == 0)\n {\n WriteLine(\"1 A\");\n }\n else if(N % 4 == 1)\n {\n WriteLine(\"0 A\");\n }\n else if (N % 4 == 2)\n {\n WriteLine(\"1 B\");\n }\n else\n {\n WriteLine(\"2 A\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 4 == 1) Console.WriteLine(0 + \" A\");\n else if (n % 4 == 2) Console.WriteLine(1 + \" B\");\n else if (n % 4 == 3) Console.WriteLine(2 + \" A\");\n else if (n % 4 == 0) Console.WriteLine(1 + \" A\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class Class2\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var res = $\"{Math.Abs(n % 4 - 1)} {(n % 4 == 2 ? \"B\" : \"A\")}\";\n Console.WriteLine(res);\n }\n}"}, {"source_code": "// Problem: 1191A - Tokitsukaze and Enhancement\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass TokitsukazeAndEnhancement\n {\n public static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = new char[] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n byte x;\n if (!Byte.TryParse (words[0], out x))\n return -1;\n if (x < 30 || x > 100)\n return -1;\n byte remain = Convert.ToByte (x%4);\n string[] answers = new string[] {\"1 A\", \"0 A\", \"1 B\", \"2 A\"};\n Console.WriteLine (answers[remain]);\n return 0;\n }\n }\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n switch (int.Parse(Console.ReadLine()) % 4)\n {\n case 0: Console.WriteLine(1 + \" A\"); break;\n case 1: Console.WriteLine(0 + \" A\"); break;\n case 2: Console.WriteLine(1 + \" B\"); break;\n case 3: Console.WriteLine(2 + \" A\"); break;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n else if (n % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n else if (n % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n else\n {\n Console.WriteLine(\"1 A\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\nusing System.Text;\n\nnamespace Program\n{\n public static class CODEFORCES1\n {\n static public void Solve()\n {\n var x = NN;\n var mod = x % 4;\n if (mod == 1)\n {\n Console.WriteLine(\"0 A\");\n return;\n }\n else if (mod == 2)\n {\n Console.WriteLine(\"1 B\");\n return;\n }\n else if (mod == 3)\n {\n Console.WriteLine(\"2 A\");\n return;\n }\n else\n {\n Console.WriteLine(\"1 A\");\n return;\n }\n }\n\n static public void Main(string[] args) { if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } Solve(); Console.Out.Flush(); }\n static Random rand = new Random();\n static class Console_\n {\n static Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n }\n static long NN => long.Parse(Console_.NextString());\n static double ND => double.Parse(Console_.NextString());\n static string NS => Console_.NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => rand.Next());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l, Comparison comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }\n static long LCM(long a, long b) => a * b / GCD(a, b);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mat Pow(Mat x, long y) => Mat.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static T Pow(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void _B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Comb(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Perm(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }\n class PQ where T : IComparable\n {\n List h; Comparison c; public T Peek => h[0]; public int Count => h.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { h = new List(cap); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { h = new List(); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }\n }\n class PQ where TK : IComparable\n {\n PQ> q; public Tuple Peek => q.Peek; public int Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { q = new PQ>(cap, (x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { q = new PQ>((x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TK k, TV v) => q.Push(Tuple.Create(k, v));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple Pop() => q.Pop();\n }\n public class UF\n {\n long[] d;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public UF(long s) { d = Repeat(-1L, s).ToArray(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Unite(long x, long y) { x = Root(x); y = Root(y); if (x != y) { if (d[y] < d[x]) { var t = y; y = x; x = t; } d[x] += d[y]; d[y] = x; } return x != y; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool IsSame(long x, long y) => Root(x) == Root(y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Root(long x) => d[x] < 0 ? x : d[x] = Root(d[x]);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long Count(long x) => -d[Root(d[x])];\n }\n struct Mod : IEquatable\n {\n static public long _mod = 1000000007; long _val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; }\n static public implicit operator Mod(long x) => new Mod(x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator long(Mod x) => x._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(Mod x, Mod y) => x._val + y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, Mod y) => x._val - y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator *(Mod x, Mod y) => x._val * y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(Mod x, Mod y) => x._val == y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(Mod x, Mod y) => x._val != y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IEquatable.Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override int GetHashCode() => _val.GetHashCode();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => _val.ToString();\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }\n }\n struct Mat\n {\n T[,] m;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mat(T[,] v) { m = (T[,])v.Clone(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator Mat(T[,] v) => new Mat(v);\n public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, Mat b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat Pow(Mat x, long y) { var n = x.m.GetLength(0); var t = (Mat)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }\n }\n class Tree\n {\n long N; int l; List[] p; int[] d; long[][] pr; long r; Tuple[] e; Tuple[] b; bool lca; bool euler; bool bfs;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tree(List[] p_, long r_) { N = p_.Length; p = p_; r = r_; lca = false; euler = false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple[] FromRoot() { if (!bfs) { var nb = new List>(); var q = new Queue(); var d = new bool[N]; nb.Add(Tuple.Create(r, -1L)); d[r] = true; q.Enqueue(r); while (q.Count > 0) { var w = q.Dequeue(); foreach (var i in p[w]) { if (d[i]) continue; d[i] = true; q.Enqueue(i); nb.Add(Tuple.Create(i, w)); } } b = nb.ToArray(); bfs = true; } return b; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple[] FromLeaf() => FromRoot().Reverse().ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple[] Euler() { if (!euler) { var ne = new List>(); var s = new Stack>(); var d = new bool[N]; d[r] = true; s.Push(Tuple.Create(r, -1L)); while (s.Count > 0) { var w = s.Peek(); var ad = true; foreach (var i in p[w.Item1]) { if (d[i]) continue; d[i] = true; ad = false; s.Push(Tuple.Create(i, w.Item1)); } if (!ad || p[w.Item1].Count == 1) ne.Add(Tuple.Create(w.Item1, w.Item2, 1)); if (ad) { s.Pop(); ne.Add(Tuple.Create(w.Item1, w.Item2, -1)); } } e = ne.ToArray(); euler = true; } return e; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long LCA(long u, long v) { if (!lca) { l = 0; while (N > (1 << l)) l++; d = new int[N]; pr = Repeat(0, l).Select(_ => new long[N]).ToArray(); d[r] = 0; pr[0][r] = -1; var q = new Stack(); q.Push(r); while (q.Count > 0) { var w = q.Pop(); foreach (var i in p[w]) { if (i == pr[0][w]) continue; q.Push(i); d[i] = d[w] + 1; pr[0][i] = w; } } for (var k = 0; k + 1 < l; k++) for (var w = 0; w < N; w++) if (pr[k][w] < 0) pr[k + 1][w] = -1; else pr[k + 1][w] = pr[k][pr[k][w]]; lca = true; } if (d[u] > d[v]) { var t = u; u = v; v = t; } for (var k = 0; k < l; k++) if ((((d[v] - d[u]) >> k) & 1) != 0) v = pr[k][v]; if (u == v) return u; for (var k = l - 1; k >= 0; k--) if (pr[k][u] != pr[k][v]) { u = pr[k][u]; v = pr[k][v]; } return pr[0][u]; }\n }\n class BT where T : IComparable\n {\n class Node { public Node l; public Node r; public T v; public bool b; }\n Comparison c; Node r; bool ch; T lm;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public BT(Comparison _c) { c = _c; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public BT() : this((x, y) => x.CompareTo(y)) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool R(Node n) => n != null && !n.b;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool B(Node n) => n != null && n.b;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RtL(Node n) { Node m = n.r, t = m.l; m.l = n; n.r = t; return m; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RtR(Node n) { Node m = n.l, t = m.r; m.r = n; n.l = t; return m; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RtLR(Node n) { n.l = RtL(n.l); return RtR(n); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RtRL(Node n) { n.r = RtR(n.r); return RtL(n); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(T x) { r = A(r, x); r.b = true; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node A(Node n, T x) { if (n == null) { ch = true; return new Node() { v = x }; } var r = c(x, n.v); if (r < 0) { n.l = A(n.l, x); return Bl(n); } if (r > 0) { n.r = A(n.r, x); return Bl(n); } ch = false; return n; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Bl(Node n) { if (!ch) return n; if (!B(n)) return n; if (R(n.l) && R(n.l.l)) { n = RtR(n); n.l.b = true; } else if (R(n.l) && R(n.l.r)) { n = RtLR(n); n.l.b = true; } else if (R(n.r) && R(n.r.l)) { n = RtRL(n); n.r.b = true; } else if (R(n.r) && R(n.r.r)) { n = RtL(n); n.r.b = true; } else ch = false; return n; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Remove(T x) { r = Rm(r, x); if (r != null) r.b = true; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node Rm(Node n, T x) { if (n == null) { ch = false; return n; } var r = c(x, n.v); if (r < 0) { n.l = Rm(n.l, x); return BlL(n); } if (r > 0) { n.r = Rm(n.r, x); return BlR(n); } if (n.l == null) { ch = n.b; return n.r; } n.l = RmM(n.l); n.v = lm; return BlL(n); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node RmM(Node n) { if (n.r != null) { n.r = RmM(n.r); return BlR(n); } lm = n.v; ch = n.b; return n.l; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BlL(Node n) { if (!ch) return n; if (B(n.r) && R(n.r.l)) { var b = n.b; n = RtRL(n); n.b = b; n.l.b = true; ch = false; } else if (B(n.r) && R(n.r.r)) { var b = n.b; n = RtL(n); n.b = b; n.r.b = true; n.l.b = true; ch = false; } else if (B(n.r)) { ch = n.b; n.b = true; n.r.b = false; } else { n = RtL(n); n.b = true; n.l.b = false; n.l = BlL(n.l); ch = false; } return n; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Node BlR(Node n) { if (!ch) return n; if (B(n.l) && R(n.l.r)) { var b = n.b; n = RtLR(n); n.b = b; n.r.b = true; ch = false; } else if (B(n.l) && R(n.l.l)) { var b = n.b; n = RtR(n); n.b = b; n.l.b = true; n.r.b = true; ch = false; } else if (B(n.l)) { ch = n.b; n.b = true; n.l.b = false; } else { n = RtR(n); n.b = true; n.r.b = false; n.r = BlR(n.r); ch = false; } return n; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Have(T x) { var t = FindUpper(x); return t.Item1 && t.Item2.CompareTo(x) == 0; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple FindUpper(T x) { var v = FU(r, x); return v == null ? Tuple.Create(false, default(T)) : v; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Tuple FU(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) { var v = FU(n.l, x); return v == null ? Tuple.Create(true, n.v) : v; } if (r > 0) return FU(n.r, x); return Tuple.Create(true, n.v); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple FindLower(T x) { var v = FL(r, x); return v == null ? Tuple.Create(false, default(T)) : v; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n Tuple FL(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) return FL(n.l, x); if (r > 0) { var v = FL(n.r, x); return v == null ? Tuple.Create(true, n.v) : v; } return Tuple.Create(true, n.v); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Min() { Node n = r, p = null; while (n != null) { p = n; n = n.l; } return p == null ? default(T) : p.v; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Max() { Node n = r, p = null; while (n != null) { p = n; n = n.r; } return p == null ? default(T) : p.v; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => r != null;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CountSlow() => L(r).Count();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public IEnumerable List() => L(r);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n IEnumerable L(Node n) { if (n == null) yield break; foreach (var i in L(n.l)) yield return i; yield return n.v; foreach (var i in L(n.r)) yield return i; }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tint x = int.Parse(input1);\n\t\t\tswitch (x % 4) \n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\tConsole.WriteLine(\"0 A\");\n\t\t\t\t\treturn;\n\t\t\t\tcase 3:\n\t\t\t\t\tConsole.WriteLine(\"2 A\");\n\t\t\t\t\treturn;\n\t\t\t\tcase 2:\n\t\t\t\t\tConsole.WriteLine(\"1 B\");\n\t\t\t\t\treturn;\n\t\t\t\tdefault:\n\t\t\t\t\tConsole.WriteLine(\"1 A\");\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n for (int i = 0; i < 3; i++) \n if ((x + i) % 4 == 1)\n {\n Console.WriteLine(\"{0} A\", i);\n return;\n }\n\n for (int i = 0; i < 3; i++)\n if ((x + i) % 4 == 3)\n {\n Console.WriteLine(\"{0} B\", i);\n return;\n }\n for (int i = 0; i < 3; i++)\n if ((x + i) % 4 == 2)\n {\n Console.WriteLine(\"{0} C\", i);\n return;\n }\n\n for (int i = 0; i < 3; i++)\n if ((x + i) % 4 == 0)\n {\n Console.WriteLine(\"{0} D\", i);\n return;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Task_01\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine()) % 4;\n switch (n)\n {\n case 0: Console.WriteLine(\"1 A\"); break;\n case 1: Console.WriteLine(\"0 A\"); break;\n case 2: Console.WriteLine(\"1 B\"); break;\n case 3: Console.WriteLine(\"2 A\"); break;\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int rem = x % 4;\n if (rem == 1)\n Console.WriteLine(\"0 A\");\n if (rem == 2)\n Console.WriteLine(\"1 B\");\n if (rem == 3)\n Console.WriteLine(\"0 B\");\n if (rem==0)\n Console.WriteLine(\"1 A\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1191_TokitsukazeAndEnhancement\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n char ch = 'x';\n int t = n % 4;\n switch(n % 4)\n {\n case 0: ch = 'A';\n t = 1;\n break; \n case 1: ch = 'A';\n t = 0;\n break;\n case 2: ch = 'B';\n t = 1;\n break;\n default: ch = 'D';\n t = 2;\n break;\n }\n\n Console.WriteLine(\"{0} {1}\",t,ch);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n int n=int.Parse(Console.ReadLine());\n char[]c=new char[3];\n if(n%4==1)\n c[0]='A';\n else if(n%4==3)\n c[0]='B';\n else if(n%4==2)\n c[0]='C';\n else if(n%4==0)\n c[0]='D';\n \n \n if((n+1)%4==1)\n c[1]='A';\n else if((n+1)%4==3)\n c[1]='B';\n else if((n+1)%4==2)\n c[1]='C';\n else if((n+1)%4==0)\n c[1]='D';\n \n \n if((n+2)%4==1)\n c[2]='A';\n else if((n+2)%4==3)\n c[2]='B';\n else if((n+2)%4==2)\n c[2]='C';\n else if((n+2)%4==0)\n c[2]='D';\n \n \n \n string alph=\"ABCD\";\n \n int min=999999;\n for(int i=0;i<3;i++)\n {\n if(alph.Contains(c[i]))\n min=Math.Min(alph.IndexOf(c[i]),min);\n }\n Console.WriteLine(\"{0} {1}\",min+1,alph[min]);\n //Console.WriteLine(alph.IndexOf(c[1]));\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\n//using Debug;\n//using static System.Globalization.CultureInfo;\nusing System.Text;\nclass Program\n{\n static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n Solve();\n Console.Out.Flush();\n //WriteLine(Solve());\n }\n static void Solve()\n { var num = Input.num;\n var str = new[] { \"D\", \"A\", \"B\", \"C\" };\n WriteLine($\"{num % 4} {str[num % 4]}\");\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static T[] create(int n, Func f)\n => Enumerable.Repeat(0, n).Select(f).ToArray();\n public static char[][] gred(int h)\n => create(h, _ => read.ToCharArray());\n public static int[] ar1D(int n)\n => create(n, _ => num);\n public static long[] arL1D(int n)\n => create(n, _ => numL);\n public static string[] strs(int n)\n => create(n, _ => read);\n public static int[][] ar2D(int n)\n => create(n, _ => ar);\n public static long[][] arL2D(int n)\n => create(n, _ => arL);\n public static List[] edge(int n)\n => create(n, _ => new List());\n public static T GetValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)\n {\n Make(out v1, out v2, out v3, out v4, out v5);\n v6 = Next();\n }\n private static Queue sc = new Queue();\n public static T Next(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue(sc.Dequeue()); }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\n//using Debug;\n//using static System.Globalization.CultureInfo;\nusing System.Text;\nclass Program\n{\n static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n Solve();\n Console.Out.Flush();\n //WriteLine(Solve());\n }\n static void Solve()\n { var num = Input.num;\n var str = new[] { \"D\", \"A\", \"B\", \"C\" };\n WriteLine($\"{Min(2,(num+3) % 4)} {str[num % 4]}\");\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static T[] create(int n, Func f)\n => Enumerable.Repeat(0, n).Select(f).ToArray();\n public static char[][] gred(int h)\n => create(h, _ => read.ToCharArray());\n public static int[] ar1D(int n)\n => create(n, _ => num);\n public static long[] arL1D(int n)\n => create(n, _ => numL);\n public static string[] strs(int n)\n => create(n, _ => read);\n public static int[][] ar2D(int n)\n => create(n, _ => ar);\n public static long[][] arL2D(int n)\n => create(n, _ => arL);\n public static List[] edge(int n)\n => create(n, _ => new List());\n public static T GetValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)\n {\n Make(out v1, out v2, out v3, out v4, out v5);\n v6 = Next();\n }\n private static Queue sc = new Queue();\n public static T Next(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue(sc.Dequeue()); }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\n//using Debug;\n//using static System.Globalization.CultureInfo;\nusing System.Text;\nclass Program\n{\n static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n Solve();\n Console.Out.Flush();\n //WriteLine(Solve());\n }\n static void Solve()\n {\n var num = Input.num;\n var str = new[] { \"D\", \"A\", \"B\", \"C\" };\n var a = new[] { 2, 0, 1, 2 };\n WriteLine($\"{a[num%4]} {str[num % 4]}\");\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static T[] create(int n, Func f)\n => Enumerable.Repeat(0, n).Select(f).ToArray();\n public static char[][] gred(int h)\n => create(h, _ => read.ToCharArray());\n public static int[] ar1D(int n)\n => create(n, _ => num);\n public static long[] arL1D(int n)\n => create(n, _ => numL);\n public static string[] strs(int n)\n => create(n, _ => read);\n public static int[][] ar2D(int n)\n => create(n, _ => ar);\n public static long[][] arL2D(int n)\n => create(n, _ => arL);\n public static List[] edge(int n)\n => create(n, _ => new List());\n public static T GetValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)\n {\n Make(out v1, out v2, out v3, out v4, out v5);\n v6 = Next();\n }\n private static Queue sc = new Queue();\n public static T Next(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue(sc.Dequeue()); }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int a = n;\n char l = ' ', ln = ' ';\n if (n % 4 == 1)\n Console.WriteLine(\"0 A\");\n else\n {\n switch (n % 4)\n {\n case 0: l = 'D'; break;\n case 2: l = 'C'; break;\n case 3: l = 'B'; break;\n }\n for (int i = 1; i < 4; i++)\n {\n a++;\n switch (a % 4)\n {\n case 0: ln = 'D';break;\n case 2:ln = 'C';break;\n case 3:ln = 'B';break;\n }\n if (ln < l)\n break;\n }\n Console.WriteLine((a - n) + \" \" + ln.ToString());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 4 == 0)\n {\n Console.WriteLine(\"2 B\");\n }\n if (n % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n if (n % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n if (n % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 4 == 0)\n {\n Console.WriteLine(\"2 C\");\n }\n if (n % 4 == 1)\n {\n Console.WriteLine(\"0 A\");\n }\n if (n % 4 == 2)\n {\n Console.WriteLine(\"1 B\");\n }\n if (n % 4 == 3)\n {\n Console.WriteLine(\"2 A\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 4 == 1) Console.WriteLine(0 + \" A\");\n else if (n % 4 == 2) Console.WriteLine(1 + \" B\");\n else if (n % 4 == 3) Console.WriteLine(2 + \"A\");\n else if (n % 4 == 0) Console.WriteLine(1 + \"A\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n == 100) Console.WriteLine(0 + \" C\");\n else if (n == 99) Console.WriteLine(0 + \" B\");\n else if (n % 4 == 1) Console.WriteLine(0 + \" A\");\n else if (n % 4 == 2) Console.WriteLine(1 + \" B\");\n else if (n % 4 == 3) Console.WriteLine(2 + \"A\");\n else if (n % 4 == 0) Console.WriteLine(1 + \"A\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing static System.Math;\nusing System.Text;\n\nnamespace Program\n{\n public static class CODEFORCES1\n {\n static public void Solve()\n {\n var x = NN;\n var mod = x % 4;\n if (mod == 1)\n {\n Console.WriteLine(\"0 A\");\n return;\n }\n else if (mod == 2)\n {\n Console.WriteLine(\"1 B\");\n return;\n }\n else if (mod == 3)\n {\n Console.WriteLine(\"1 A\");\n return;\n }\n else\n {\n Console.WriteLine(\"1 A\");\n return;\n }\n }\n\n static public void Main(string[] args)\n {\n if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); }\n Solve();\n Console.Out.Flush();\n }\n static Random rand = new Random();\n static class Console_\n {\n private static Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n }\n static long NN => long.Parse(Console_.NextString());\n static double ND => double.Parse(Console_.NextString());\n static string NS => Console_.NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => rand.Next());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void RevSort(T[] l, Comparison comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static IEnumerable Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }\n static long LCM(long a, long b) => a * b / GCD(a, b);\n class PQ where T : IComparable\n {\n private List h;\n private Comparison c;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { h = new List(cap); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { h = new List(); this.c = asc ? c : (x, y) => c(y, x); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }\n public T Peek => h[0];\n public int Count => h.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }\n }\n class PQ where TKey : IComparable\n {\n private PQ> q;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, Comparison c, bool asc = true) { q = new PQ>(cap, (x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(Comparison c, bool asc = true) { q = new PQ>((x, y) => c(x.Item1, y.Item1), asc); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Push(TKey k, TValue v) => q.Push(Tuple.Create(k, v));\n public Tuple Peek => q.Peek;\n public int Count => q.Count;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Tuple Pop() => q.Pop();\n }\n struct Mod : IEquatable\n {\n static public long _mod = 1000000007;\n private long _val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; }\n static public implicit operator Mod(long x) => new Mod(x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator long(Mod x) => x._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator +(Mod x, Mod y) => x._val + y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator -(Mod x, Mod y) => x._val - y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator *(Mod x, Mod y) => x._val * y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(Mod x, Mod y) => x._val == y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(Mod x, Mod y) => x._val != y._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n bool IEquatable.Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override int GetHashCode() => _val.GetHashCode();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => _val.ToString();\n static private List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static private void Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mod Comb(long n, long k) { Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n struct Mat\n {\n private T[,] m;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public Mat(T[,] v) { m = (T[,])v.Clone(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator Mat(T[,] v) => new Mat(v);\n public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator +(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator -(Mat a, Mat b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat operator *(Mat a, Mat b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public Mat Pow(Mat x, long y) { var n = x.m.GetLength(0); var t = (Mat)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static Mat Pow(Mat x, long y) => Mat.Pow(x, y);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static T Pow(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; }\n static List _fact = new List() { 1 };\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void _Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static long Comb(long n, long k) { _Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }\n }\n}\n"}], "src_uid": "488e809bd0c55531b0b47f577996627e"} {"source_code": "using System;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nclass Solution\n{\n\tclass SlideMin\n\t{\n\t\tint i = 0;\n\t\tList lst = new List();\n\t\tpublic void Push(int x)\n\t\t{\n\t\t\twhile (lst.Count > i && lst.Last() > x) lst.RemoveAt(lst.Count-1);\t\t\t\n\t\t\tlst.Add(x);\n\t\t}\n\t\tpublic void Pop(int x)\n\t\t{\n\t\t\tif (lst[i] == x) i++;\n\t\t}\n\t\tpublic int Top()\n\t\t{\n\t\t\treturn lst[i];\n\t\t}\n\t};\n\n\tint n, m, a, b;\n\tint[,] M;\n\n\tvoid Make(int g, int x, int y, int z)\n\t{\n\t\tM = new int[n, m];\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t{\n\t\t\t\tM[i, j] = g;\n\t\t\t\tg = (int)(((long)g * x + y) % z);\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid Run()\n\t{\n\t\tvar A = Array.ConvertAll(cin.ReadLine().Split(), int.Parse);\n\t\tn = A[0]; m = A[1]; a = A[2]; b = A[3];\n\t\tA = Array.ConvertAll(cin.ReadLine().Split(), int.Parse);\n\t\tMake(A[0], A[1], A[2], A[3]);\n\n\t\tint[,] MinRow = new int[n, m - b + 1];\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tSlideMin slide = new SlideMin();\n\t\t\tfor (int j = 0; j < b; j++)\n\t\t\t{\n\t\t\t\tslide.Push(M[i, j]);\n\t\t\t}\n\t\t\tfor (int j = 0; j < m - b + 1; j++)\n\t\t\t{\n\t\t\t\tMinRow[i, j] = slide.Top();\n\t\t\t\tif (j == m - b) break;\n\t\t\t\tslide.Pop(M[i, j]);\n\t\t\t\tslide.Push(M[i, j + b]);\n\t\t\t}\n\t\t}\n\n\t\tlong ans = 0;\n\t\tfor (int j = 0; j < m - b + 1; j++)\n\t\t{\n\t\t\tSlideMin slide = new SlideMin();\n\t\t\tfor (int i = 0; i < a; i++)\n\t\t\t{\n\t\t\t\tslide.Push(MinRow[i, j]);\n\t\t\t}\n\t\t\tfor (int i = 0; i < n - a + 1; i++)\n\t\t\t{\n\t\t\t\tans += slide.Top();\n\t\t\t\tif (i == n - a) break;\n\t\t\t\tslide.Pop(MinRow[i, j]);\n\t\t\t\tslide.Push(MinRow[i + a, j]);\n\t\t\t}\n\t\t}\n\n\t\tcout.Write(ans);\n\t}\n\n\tstatic TextReader cin;\n\tstatic TextWriter cout;\n\n\tstatic void Main()\n\t{\n#if NARUT_LOCAL\n\t\tcin = new StreamReader(\"io/test.in\", Encoding.ASCII);\n#else\n\t\tcin = new StreamReader(Console.OpenStandardInput(), Encoding.ASCII);\n#endif\n\t\tcout = new StreamWriter(Console.OpenStandardOutput(), Encoding.ASCII) { AutoFlush = false };\n\t\t(new Solution()).Run();\n\t\tcin.Close();\n\t\tcout.Close();\n\t}\n}\n", "positive_code": [{"source_code": "using CompLib.Util;\nusing System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n private int N, M, A, B;\n private int G0, X, Y, Z;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n A = sc.NextInt();\n B = sc.NextInt();\n\n G0 = sc.NextInt();\n X = sc.NextInt();\n Y = sc.NextInt();\n Z = sc.NextInt();\n\n int[] H = new int[N * M];\n H[0] = G0;\n for (int i = 1; i < N * M; i++)\n {\n H[i] = (int) (((long) H[i - 1] * X + Y) % Z);\n }\n\n MinimumQueue[] q = new MinimumQueue[N];\n for (int i = 0; i < N; i++)\n {\n q[i] = new MinimumQueue();\n for (int j = 0; j < B - 1; j++)\n {\n q[i].Enqueue(H[i * M + j]);\n }\n }\n\n long ans = 0;\n for (int j = B - 1; j < M; j++)\n {\n var q2 = new MinimumQueue();\n for (int i = 0; i < N; i++)\n {\n q[i].Enqueue(H[i * M + j]);\n q2.Enqueue(q[i].Min());\n if (i >= A - 1)\n {\n ans += q2.Min();\n q2.Dequeue();\n }\n\n q[i].Dequeue();\n }\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nclass MinimumStack\n{\n private readonly Stack<(int num, int min)> stack;\n\n public MinimumStack()\n {\n stack = new Stack<(int num, int min)>();\n }\n\n public void Push(int num)\n {\n if (Count == 0) stack.Push((num, num));\n else stack.Push((num, Math.Min(num, stack.Peek().min)));\n }\n\n public int Peek()\n {\n return stack.Peek().num;\n }\n\n public int Pop()\n {\n return stack.Pop().num;\n }\n\n public int Min()\n {\n return Count == 0 ? int.MaxValue : stack.Peek().min;\n }\n\n public int Count => stack.Count;\n}\n\nclass MinimumQueue\n{\n private readonly MinimumStack s1, s2;\n\n public MinimumQueue()\n {\n s1 = new MinimumStack();\n s2 = new MinimumStack();\n }\n\n public void Enqueue(int l)\n {\n s2.Push(l);\n }\n\n private void Exec()\n {\n if (s1.Count == 0)\n {\n while (s2.Count > 0)\n {\n s1.Push(s2.Pop());\n }\n }\n }\n\n public int Peek()\n {\n Exec();\n return s1.Peek();\n }\n\n public int Dequeue()\n {\n Exec();\n return s1.Pop();\n }\n\n public int Min()\n {\n return Math.Min(s1.Min(), s2.Min());\n }\n\n public int Count => s1.Count + s2.Count;\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N, M, A, B;\n private int G0, X, Y, Z;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n A = sc.NextInt();\n B = sc.NextInt();\n\n\n int[] g = new int[N * M];\n g[0] = sc.NextInt();\n X = sc.NextInt();\n Y = sc.NextInt();\n Z = sc.NextInt();\n for (int i = 1; i < N * M; i++)\n {\n g[i] = (int) (((long) g[i - 1] * X + Y) % Z);\n }\n\n var mq = new MinQueue[N];\n for (int i = 0; i < N; i++)\n {\n mq[i] = new MinQueue();\n }\n\n for (int j = 0; j < B - 1; j++)\n {\n for (int i = 0; i < N; i++)\n {\n mq[i].Enqueue(g[i * M + j]);\n }\n }\n\n long ans = 0;\n for (int j = B - 1; j < M; j++)\n {\n for (int i = 0; i < N; i++)\n {\n mq[i].Enqueue(g[i * M + j]);\n }\n\n var mq2 = new MinQueue();\n for (int i = 0; i < A - 1; i++)\n {\n mq2.Enqueue(mq[i].GetMin());\n }\n\n for (int i = A - 1; i < N; i++)\n {\n mq2.Enqueue(mq[i].GetMin());\n ans += mq2.GetMin();\n mq2.Dequeue();\n }\n\n for (int i = 0; i < N; i++)\n {\n mq[i].Dequeue();\n }\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nclass MinStack\n{\n private Stack<(int val, int min)> S;\n\n public MinStack()\n {\n S = new Stack<(int val, int min)>();\n }\n\n public int GetMin()\n {\n if (S.Count == 0) return int.MaxValue;\n return S.Peek().min;\n }\n\n public void Push(int val)\n {\n S.Push((val, Math.Min(val, GetMin())));\n }\n\n public int Pop()\n {\n return S.Pop().val;\n }\n\n public int Count\n {\n get { return S.Count; }\n }\n}\n\nclass MinQueue\n{\n public MinStack L, R;\n\n public MinQueue()\n {\n L = new MinStack();\n R = new MinStack();\n }\n\n public void Enqueue(int val)\n {\n R.Push(val);\n }\n\n public void Dequeue()\n {\n if (L.Count == 0)\n {\n while (R.Count > 0)\n {\n L.Push(R.Pop());\n }\n }\n\n L.Pop();\n }\n\n public int GetMin()\n {\n return Math.Min(L.GetMin(), R.GetMin());\n }\n}\n\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "/*\ncsc -debug E.cs && mono --debug E.exe <<< \"3 4 2 1\n1 2 3 59\"\n*/\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic struct QueueItem {\n public ulong Val;\n public int Index;\n}\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n var m = cin.NextInt();\n var a = cin.NextInt();\n var b = cin.NextInt();\n\n var Arr = Helpers.CreateArray(n, _ => new ulong[m]);\n {\n var g0 = cin.NextUlong();\n var x = cin.NextUlong();\n var y = cin.NextUlong();\n var z = cin.NextUlong();\n for (var i = 0; i < n; i++)\n for (var j = 0; j < m; j++) {\n Arr[i][j] = g0;\n g0 = (g0 * x + y) % z;\n }\n }\n\n// System.Console.WriteLine(\"Arr:\");\n// foreach (var row in Arr)\n// System.Console.WriteLine(row.Join());\n\n var QVers = new Deque[m];\n for (var j = 0; j < m; j++) {\n var Q = new Deque();\n for (var i = 0; i < a; i++) {\n var x = Arr[i][j];\n AppendRight(Q, i, x);\n }\n QVers[j] = Q;\n }\n\n var ans = 0ul;\n\n for (var i = a - 1; i < n; i++) {\n var rowAns = 0ul;\n\n var Q = new Deque();\n for (var j = 0; j < b; j++) {\n AppendRight(Q, j, QVers[j].Left.Val);\n }\n\n rowAns += Q.Left.Val;\n for (var j = b; j < m; j++) {\n Shift(Q, j - b);\n AppendRight(Q, j, QVers[j].Left.Val);\n rowAns += Q.Left.Val;\n }\n\n for (var j = 0; j < m; j++) {\n Shift(QVers[j], i - a + 1);\n if (i + 1 < n)\n AppendRight(QVers[j], i + 1, Arr[i + 1][j]);\n }\n\n// System.Console.WriteLine(new {i, rowAns});\n ans += rowAns;\n }\n// System.Console.WriteLine(new {brute = SolveBrute(Arr, n, m, a, b)});\n\n System.Console.WriteLine(ans);\n }\n\n static ulong SolveBrute(ulong[][] Arr, int n, int m, int a, int b) {\n var ans = 0ul;\n\n for (var i = a-1; i < n; i++)\n for (var j = b-1; j < m; j++) {\n var min = Arr[i][j];\n for (var ii = 0; ii < a; ii++)\n for (var jj = 0; jj < b; jj++)\n min = Math.Min(min, Arr[i - ii][j - jj]);\n ans += min;\n }\n\n return ans;\n }\n\n static void AppendRight(Deque Q, int i, ulong x) {\n while (Q.Count > 0 && Q.Right.Val >= x) Q.RemoveRight();\n Q.AppendRight(new QueueItem{ Val = x, Index = i });\n }\n\n static void Shift(Deque Q, int i) {\n if (Q.Left.Index == i) Q.RemoveLeft();\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic class Deque : IEnumerable {\n private T[] arr;\n private int index;\n private int count;\n private int n;\n\n public Deque(T[] arr) {\n this.arr = arr;\n n = arr.Length;\n count = arr.Length;\n }\n\n public Deque(int capacity = 8) {\n n = capacity;\n arr = new T[capacity];\n }\n\n public int Count => count;\n\n public T Left => this[0];\n public T Right => this[count - 1];\n\n public T this[int i] {\n get {\n if (i < 0 || i >= count) throw new InvalidOperationException(string.Format(\"Index {0} is out of range (count = {1})\", i, count));\n return arr[(index + i) % n];\n }\n }\n\n public void AppendRight(T val) {\n EnsureSize();\n arr[(index + count) % n] = val;\n count++;\n }\n\n public void AppendLeft(T val) {\n EnsureSize();\n index = (index + n - 1) % n;\n arr[index] = val;\n count++;\n }\n\n public T RemoveLeft() {\n if (count == 0) throw new InvalidOperationException(\"Can't remove left because deque is empty\");\n\n var result = arr[index];\n index = (index + 1) % n;\n count--;\n return result;\n }\n\n public T RemoveRight() {\n if (count == 0) throw new InvalidOperationException(\"Can't remove right because deque is empty\");\n\n var result = arr[(index + count + n - 1) % n];\n count--;\n return result;\n }\n\n private void EnsureSize() {\n if (count == arr.Length) {\n var newArr = new T[arr.Length * 2];\n var left = Math.Min(count, arr.Length - index);\n Array.Copy(arr, index, newArr, 0, left);\n if (left < count)\n Array.Copy(arr, 0, newArr, left, count - left);\n arr = newArr;\n index = 0;\n n = newArr.Length;\n }\n }\n\n public IEnumerator GetEnumerator()\n {\n for (var i = 0; i < count; i++) {\n yield return arr[(index + i) % n];\n }\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n}\n\npublic static class Helpers {\n public static string Join(this IEnumerable arr) {\n return string.Join(\" \", arr);\n }\n\n public static void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing CompLib.Collections.Generic;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N, M, A, B;\n private int G0, X, Y, Z;\n\n private long[] H;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextInt();\n A = sc.NextInt();\n B = sc.NextInt();\n G0 = sc.NextInt();\n X = sc.NextInt();\n Y = sc.NextInt();\n Z = sc.NextInt();\n\n /*\n * N*M\u30b0\u30ea\u30c3\u30c9\n * \u30bb\u30eb(i,j) \u306f\u9ad8\u3055H[i,j]\n *\n * \u753b\u9762\u306b\u306f a*b\u306e\u7bc4\u56f2\u304c\u53ce\u307e\u308b\n *\n * \u8868\u793a\u3055\u308c\u3066\u308b\u7bc4\u56f2\u3067\u6700\u5c0f\u306eH\u306e\u7dcf\u548c\n *\n * \n * g_i = (g_{i-1}*x+y) % Z\n * H[i,j] = g_{(i-1)*m+j-1}\n */\n\n var st = new SegmentTree[N];\n for (int i = 0; i < N; i++)\n {\n st[i] = new SegmentTree(M);\n for (int j = 0; j < M; j++)\n {\n if (i == 0 && j == 0) st[i][j] = G0;\n else\n {\n st[i][j] = (int) ((long) st[i / M][i % M] * X + Y) % Z;\n }\n }\n }\n\n long ans = 0;\n for (int j = 0; j + B <= M; j++)\n {\n var st2 = new SegmentTree(A);\n for (int i = 0; i < A - 1; i++) st2[i] = st[i].Query(j, j + B);\n for (int i = A - 1; i < N; i++)\n {\n st2[i % A] = st[i].Query(j, j + B);\n ans += st2.Root();\n }\n }\n\n Console.WriteLine(ans);\n }\n\n int Conv(int i, int j)\n {\n return i * M + j;\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Collections.Generic\n{\n using System;\n\n public class SegmentTree\n {\n private readonly int N;\n private int[] _array;\n\n private const int _identity = int.MaxValue;\n\n public SegmentTree(int size)\n {\n N = 1;\n while (N < size) N *= 2;\n\n _array = new int[N * 2];\n for (int i = 1; i < N * 2; i++)\n {\n _array[i] = _identity;\n }\n }\n\n /// \n /// A[i]\u3092n\u306b\u66f4\u65b0 O(log N)\n /// \n /// \n /// \n public void Update(int i, int n)\n {\n i += N;\n _array[i] = n;\n while (i > 1)\n {\n i /= 2;\n _array[i] = System.Math.Min(_array[i * 2], _array[i * 2 + 1]);\n }\n }\n\n private int Query(int left, int right, int k, int l, int r)\n {\n if (r <= left || right <= l)\n {\n return _identity;\n }\n\n if (left <= l && r <= right)\n {\n return _array[k];\n }\n\n return Math.Min(Query(left, right, k * 2, l, (l + r) / 2),\n Query(left, right, k * 2 + 1, (l + r) / 2, r));\n }\n\n public int Root() => _array[1];\n\n /// \n /// A[left] op A[left+1] ... op A[right-1]\u3092\u6c42\u3081\u308b\n /// \n /// \n /// \n /// \n public int Query(int left, int right)\n {\n return Query(left, right, 1, 0, N);\n }\n\n public int this[int i]\n {\n set { Update(i, value); }\n get { return _array[i + N]; }\n }\n }\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}], "src_uid": "4618fbffb2b9d321a6d22c11590a4773"} {"source_code": "using System;\nusing System.Collections.Generic;\n\nusing System.Text;\n\nnamespace e_olimp\n{\n class Program\n {\n static int[] parseInt(string s)\n {\n string[] temp = s.Split(' ');\n List res = new List();\n for (int i = 0; i < temp.Length; i++)\n {\n res.Add(Convert.ToInt32(temp[i]));\n }\n return res.ToArray();\n }\n\n static int round(double a)\n {\n a *= 100000000000;\n long res = (long)a;\n for (int i = 0; i < 11; i++)\n {\n if (res % 10 > 4)\n {\n res /= 10;\n res++;\n }\n else\n res /= 10;\n }\n return (int)res;\n }\n static void Main(string[] args)\n {\n bool tf = true;\n int[,] A = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n int[] p = parseInt(Console.ReadLine());\n for (int j = 0; j < 3; j++)\n {\n A[i, j] = p[j];\n }\n }\n\n int sum = A[1, 0] + A[1, 2];\n\n for (int i = 0; sum - i >= 0; i++)\n {\n int tmp11 = i + A[0, 1] + A[0, 2];\n int tmp12 = i + A[1, 0] + A[2, 0];\n int tmp21 = sum - i + A[2, 0] + A[2, 1];\n int tmp22 = sum - i + A[0, 2] + A[1, 2];\n if (tmp11 == tmp12 && tmp12 == tmp21 && tmp21 == tmp22)\n {\n int res = tmp22 - sum;\n A[0, 0] = i;\n A[2, 2] = sum - i;\n A[1, 1] = res;\n for (int k = 0; k < 3; k++)\n {\n for (int z = 0; z < 3; z++)\n {\n Console.Write(A[k,z]);\n if(z < 2)\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n return;\n }\n }\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] matrix = new int[3][];\n int[] s = new int[3];\n\n for (int i = 0; i < 3; i++)\n {\n matrix[i] = new int[3];\n s[i] = 0;\n\n string[] lineParts = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < 3; j++)\n {\n matrix[i][j] = int.Parse(lineParts[j]);\n s[i] += matrix[i][j];\n }\n }\n\n int max = Math.Max(s[0], Math.Max(s[1], s[2]));\n\n matrix[0][0] = max - matrix[0][1] - matrix[0][2] + 1;\n matrix[1][1] = max - matrix[1][0] - matrix[1][2] + 1;\n matrix[2][2] = max - matrix[2][0] - matrix[2][1] + 1;\n\n int diff = (max + 1 - matrix[0][0] - matrix[1][1] - matrix[2][2]) / 2;\n\n for (int i = 0; i < 3; i++)\n {\n matrix[i][i] += diff;\n Console.WriteLine(matrix[i][0] + \" \" + matrix[i][1] + \" \" + matrix[i][2]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Test{\n static void Main(){\n int [, ] a = new int [3, 3];\n int [] r = new int[3];\n int [] d = new int[3];\n for(int i = 0; i < 3; i++){\n string [] line = Console.ReadLine().Split();\n a[i, 0] = int.Parse(line[0]);\n a[i, 1] = int.Parse(line[1]);\n a[i, 2] = int.Parse(line[2]);\n r[i] = a[i, 0] + a[i, 1] + a[i, 2];\n }\n int x = 0;\n int r_ref = r[0];\n \n \n int r_max = r.Max();\n int sum_r = 0;\n \n for(int k = 0; k < 3; k++){\n r[k] = r_max - r[k];\n sum_r += r[k];\n }\n \n r_ref += r[0];\n\n while(true){\n if(sum_r == r_ref){\n break;\n }\n sum_r += 3;\n r_ref++;\n x++;\n }\n \n for(int j = 0; j < 3; j++){\n a[j, j] += r[j] + x;\n Console.WriteLine(\"{0} {1} {2}\", a[j, 0], a[j, 1], a[j, 2]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar magic = new int[3,3];\n\t\t\tfor (var i =0; i < 3; i++)\n\t\t\t{\n\t\t\t\tfor (var j = 0; j < 3; j++)\n\t\t\t\t{\n\t\t\t\t\tmagic[i, j] = cin.NextInt();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var a = 0; a < 100005; a++)\n\t\t\t{\n\t\t\t\tvar sum = a + magic[1, 0] + magic[2, 0];\n\t\t\t\tvar mid = sum - magic[1, 0] - magic[1, 2];\n\t\t\t\tvar bot = sum - magic[2, 0] - magic[2, 1];\n\t\t\t\tif (sum == a + mid + bot)\n\t\t\t\t{\n\t\t\t\t\tmagic[0, 0] = a;\n\t\t\t\t\tmagic[1, 1] = mid;\n\t\t\t\t\tmagic[2, 2] = bot;\n\t\t\t\t\tfor (var i = 0; i < 3; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (var j = 0; j < 3; j++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (j > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tConsole.Write(\" \");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tConsole.Write(magic[i, j]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tConsole.WriteLine();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _259B\n {\n public static void Main()\n {\n int[][] square = new int[3][];\n int totalSum = 0;\n\n for (int i = 0; i < 3; i++)\n {\n square[i] = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n totalSum += square[i].Sum();\n }\n\n square[0][0] = totalSum / 2 - square[0].Sum();\n square[1][1] = totalSum / 2 - square[1].Sum();\n square[2][2] = totalSum / 2 - square[2].Sum();\n\n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(string.Join(\" \", square[i]));\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cf157\n{\n class B\n {\n static int[,] mat = new int[3, 3];\n\n static bool check(int sum)\n {\n if (mat[1, 0] + mat[1, 1] + mat[1, 2] != sum)\n return false;\n if (mat[0, 0] + mat[1, 1] + mat[2, 2] != sum)\n return false;\n if (mat[2, 0] + mat[1, 1] + mat[0, 2] != sum)\n return false;\n if (mat[2, 0] + mat[2, 1] + mat[2, 2] != sum)\n return false;\n return true;\n }\n\n static void Main(string[] args)\n {\n for (int i = 0; i < 3; i++)\n {\n string[] s = Console.ReadLine().Split();\n for (int j = 0; j < 3; j++)\n {\n mat[i, j] = int.Parse(s[j]);\n }\n }\n for (int i = 1; i <= 100000; i++)\n {\n mat[0,0]=i;\n int sum = i + mat[1, 0] + mat[2, 0];\n mat[1, 1] = sum - mat[0, 1] - mat[2, 1];\n mat[2, 2] = sum - mat[0, 2] - mat[1, 2];\n if (check(sum))\n {\n for (int k = 0; k < 3; k++)\n {\n Console.WriteLine(mat[k,0]+\" \"+mat[k,1]+\" \"+mat[k,2]);\n }\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string test = \"A1\";\n\n private static void Solve()\n {\n var a = ReadIntArray();\n var b = ReadIntArray();\n var c = ReadIntArray();\n var aSum = a.Sum();\n var bSum = b.Sum();\n var cSum = c.Sum();\n var v1Sum = a[0] + b[0] + c[0];\n var v2Sum = a[1] + b[1] + c[1];\n var v3Sum = a[2] + b[2] + c[2];\n var d2Sum = a[2] + b[1] + c[0];\n for (int a0 = 1; a0 <= 100000; a0++)\n {\n var b1 = aSum + a0 - bSum;\n var c2 = aSum + a0 - cSum;\n if (b1 > 0 && b1 <= 100000 && c2 > 0 && c2 <= 100000)\n {\n if (v1Sum + a0 == v2Sum + b1 && v1Sum + a0 == v3Sum + c2\n && v1Sum +a0 == aSum + a0)\n {\n if (aSum + a0 == a0 + b1 + c2 &&\n aSum + a0 == d2Sum + b1)\n {\n WriteLine(a0 + \" \" + a[1] + \" \" + a[2] );\n WriteLine(b[0] + \" \" + b1 + \" \" + b[2]);\n WriteLine(c[0] + \" \" + c[1] + \" \" + c2);\n return;\n }\n }\n }\n }\n }\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n private static void Read(out int n1, out int n2, out int n3)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n private static void Read(out int n1, out int n2, out int n3, out int n4)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n n4 = int.Parse(input[3]);\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null) \n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n \n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] mas = s.Split(' ');\n int a=int.Parse(mas[0]);\n int b=int.Parse(mas[1]);\n int c = int.Parse(mas[2]);\n s = Console.ReadLine();\n mas = s.Split(' ');\n int d = int.Parse(mas[0]);\n int e = int.Parse(mas[1]);\n int f = int.Parse(mas[2]);\n s = Console.ReadLine();\n mas = s.Split(' ');\n int g = int.Parse(mas[0]);\n int h = int.Parse(mas[1]);\n int i = int.Parse(mas[2]);\n e = (h + b) / 2;\n i = (b + 2 * c - h) / 2;\n a = e + f - g;\n Console.WriteLine(\"{0} {1} {2}\", a, b, c);\n Console.WriteLine(\"{0} {1} {2}\", d, e, f);\n Console.WriteLine(\"{0} {1} {2}\", g, h, i);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matr = new int[3,3];\n\n for (int i = 0; i < 3; i++)\n {\n int j = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n {\n matr[i, j] = Convert.ToInt32(s);\n j++;\n }\n }\n\n matr[1, 1] = (3*matr[0, 2] + matr[2, 0] - matr[1, 0] - matr[2, 1])/2;\n int sum = matr[1, 0] + matr[1, 1] + matr[1, 2];\n\n matr[0, 0] = sum - matr[0, 1] - matr[0, 2];\n matr[2, 2] = sum - matr[2, 0] - matr[2, 1];\n\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n Console.Write(matr[i,j]+\" \");\n }\n\n Console.WriteLine();\n }\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\n\nnamespace codeforces_round_157_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[3,3];\n int sum = 0;\n int sum2 = 0;\n for (int i = 0; i < 3; i++)\n {\n string[] st = Console.ReadLine().Split(' ');\n for (int j = 0; j < 3; j++)\n {\n arr[i, j] = Int32.Parse(st[j]);\n sum += arr[i, j];\n }\n }\n sum /= 2;\n arr[0,0] = sum - (arr[0, 1] + arr[0, 2]);\n arr[2, 2] = sum - (arr[0, 2] + arr[1, 2]);\n arr[1, 1] = (arr[0, 0] + arr[2, 2])/2;\n int x = 0;\n foreach (int i in arr)\n {\n if (x++ < 2)\n Console.Write(i+\" \");\n else\n {\n Console.WriteLine(i);\n x = 0;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication12_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[,] a = new int[3, 3];\n string[] data=new string[3];\n for (int i = 0; i < 3; i++)\n {\n data = Console.ReadLine().Split(' ');\n a[i, 0] = int.Parse(data[0]);\n a[i, 1] = int.Parse(data[1]);\n a[i, 2] = int.Parse(data[2]);\n }\n\n a[0, 0] = (a[1, 2] + a[2, 1]) / 2;\n a[1, 1] = (a[0, 2] + a[2, 0]) / 2;\n a[2, 2] = (a[1, 0] + a[0, 1]) / 2;\n \n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(a[i, 0] + \" \" + a[i, 1] + \" \" + a[i, 2]);\n }\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Little_Elephant_and_Magic_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] magic = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n string[] s = Console.ReadLine().Split();\n for (int j = 0; j < 3; j++)\n {\n magic[i, j] = Int32.Parse(s[j]);\n }\n }\n magic[0, 0] = (-magic[0, 1] - magic[0, 2] + magic[1, 0] + magic[1, 2] + magic[2, 0] + magic[2, 1]) / 2;\n magic[1, 1] = (magic[0, 1] + magic[0, 2] - magic[1, 0] - magic[1, 2] + magic[2, 0] + magic[2, 1]) / 2;\n magic[2, 2] = (magic[0, 1] + magic[0, 2] + magic[1, 0] + magic[1, 2] - magic[2, 0] - magic[2, 1]) / 2;\n for (int i = 0; i < 3; i++)\n { \n for (int j = 0; j < 3; j++)\n {\n Console.Write(magic[i, j] + \" \");\n }\n Console.WriteLine();\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ProblemB\n{\n class Program\n {\n static void Main(string[] args)\n {\n // Console.SetIn(System.IO.File.OpenText(\"input.txt\"));\n\n int[,] input = new int[3, 3];\n for (int row = 0; row < 3; row++)\n {\n string[] sRow = Console.ReadLine().Split();\n for (int column = 0; column < 3; column++)\n input[row, column] = int.Parse(sRow[column]);\n }\n\n int x1 = input[0, 1] + input[0, 2];\n int x2 = input[1, 0] + input[1, 2];\n int x3 = input[2, 0] + input[2, 1];\n int max = Math.Max(Math.Max(x1, x2), x3) + 1;\n\n int r1 = max - x1;\n int r2 = max - x2;\n int r3 = max - x3;\n\n int lsum = r1 + r2 + r3;\n\n int x = (max - lsum) / 2;\n input[0, 0] = r1 + x;\n input[1, 1] = r2 + x;\n input[2, 2] = r3 + x;\n\n for (int row = 0; row < 3; row++)\n {\n string sRow = Console.ReadLine();\n for (int column = 0; column < 3; column++)\n { \n if(column != 2)\n Console.Write(input[row, column].ToString() + \" \");\n else\n Console.Write(input[row, column].ToString());\n }\n Console.WriteLine(\"\\r\\n\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program_R157_Div2_B\n {\n static void Main(string[] args)\n {\n int[] a = new int[10];\n int sum;\n for (int i = 0; i < 3; i++)\n {\n string[] s = (Console.ReadLine().Split());\n a[i * 3 + 1] = Convert.ToInt32(s[0]);\n a[i * 3 + 2] = Convert.ToInt32(s[1]);\n a[i * 3 + 3] = Convert.ToInt32(s[2]);\n }\n\n for (int i = 1; i <= 100000; i++)\n {\n a[5] = i;\n sum = a[4] + a[5] + a[6];\n if (sum == a[2] + a[5] + a[8]\n && sum == a[3] + a[5] + a[7])\n {\n a[1] = sum - a[2] - a[3];\n a[9] = sum - a[7] - a[8];\n if (sum == a[1] + a[4] + a[7] \n && sum == a[3] + a[6] + a[9]\n && sum == a[1] + a[5] + a[9])\n break;\n }\n }\n\n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(\"{0} {1} {2}\", a[i * 3 + 1], a[i * 3 + 2], a[i * 3 + 3]);\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Coderandom\n{\n class Program\n {\n static void Print(int[,] m,int[]a)\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (i==j)\n {\n Console.Write(a[i]+\" \");\n }\n else\n {\n Console.Write(m[i,j]+\" \");\n }\n }\n Console.WriteLine();\n }\n }\n static void Main(string[] args)\n {\n int[,] matrix = new int[3, 3];\n int [] mas = new int[3];\n int[]ind = new int[3];\n for (int i = 0; i < 3; i++)\n {\n string[] ss = Console.ReadLine().Split(' ');\n\n\n for (int j = 0; j < 3; j++)\n {\n matrix[i, j] = int.Parse(ss[j]);\n mas[i] += matrix[i, j]; \n }\n }\n\n\n for (int i = 0; i < 100001; i++)\n {\n ind[0] = i ;\n ind[1] = mas[0]+i - mas[1];\n ind[2] = mas[0] + i - mas[2]; \n\n if(ind[0]+ind[2]+ind[1]==i+mas[0]) break;\n }\n\n Print(matrix,ind);\n\n\n \n\n\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace souomoun\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string c = Console.ReadLine();\n int[] la = new int[3];\n int[] lb = new int[3];\n int[] lc = new int[3];\n la[0] = int.Parse(a.Split(' ')[0]);\n la[1] = int.Parse(a.Split(' ')[1]);\n la[2] = int.Parse(a.Split(' ')[2]);\n lb[0] = int.Parse(b.Split(' ')[0]);\n lb[1] = int.Parse(b.Split(' ')[1]);\n lb[2] = int.Parse(b.Split(' ')[2]);\n lc[0] = int.Parse(c.Split(' ')[0]);\n lc[1] = int.Parse(c.Split(' ')[1]);\n lc[2] = int.Parse(c.Split(' ')[2]);\n int k = 0;\n for (; ; )\n {\n int aa = la[1] + lb[2];\n if (la[1] == 0 || lb[2] == 0) { aa = -1; }\n int ab = lc[1] + lb[2];\n if (lc[1] == 0 || lb[2] == 0) { ab = -1; }\n int ac = lc[1] + lb[0];\n if (lc[1] == 0 || lb[0] == 0) { ac = -1; }\n int ad = la[1] + lb[0];\n if (la[1] == 0 || lb[0] == 0) { ad = -1; }\n int aa2 = lc[0];\n int ab2 = la[0];\n int ac2 = la[2];\n int ad2 = lc[2];\n if (aa2 == 0 && aa != -1) { lc[0] = aa / 2; }\n if (ab2 == 0 && ab != -1) { la[0] = ab / 2; }\n if (ac2 == 0 && ac != -1) { la[2] = ac / 2; }\n if (ad2 == 0 && ad != -1) { lc[2] = ad / 2; }\n int az = 0;\n int bz = 0;\n int cz = 0;\n int dz = 0;\n if (la[1] == 0) { az++; dz++; }\n if (lb[0] == 0) { cz++; dz++; }\n if (lb[2] == 0) { az++; bz++; }\n if (lc[1] == 0) { bz++; cz++; }\n if (az == 1 && aa2 != 0) { if (la[1] == 0) { la[1] = aa2 * 2 - lb[2]; } if (lb[2] == 0) { lb[2] = aa2 * 2 - la[1]; } }\n if (bz == 1 && ab2 != 0) { if (lc[1] == 0) { lc[1] = ab2 * 2 - lb[2]; } if (lb[2] == 0) { lb[2] = ab2 * 2 - lc[1]; } }\n if (cz == 1 && ac2 != 0) { if (lc[1] == 0) { lc[1] = ac2 * 2 - lb[0]; } if (lb[0] == 0) { lb[0] = ac2 * 2 - lc[1]; } }\n if (dz == 1 && ad2 != 0) { if (la[1] == 0) { la[1] = ad2 * 2 - lb[0]; } if (lb[0] == 0) { lb[0] = ad2 * 2 - la[1]; } }\n k++;\n if (k == 3) { break; }\n }\n if (lb[1] == 0) { lb[1] = la[0] + la[1] + la[2] - lb[0] - lb[2]; }\n Console.WriteLine(\"\" + la[0] + \" \" + la[1] + \" \" + la[2] + \"\");\n Console.WriteLine(\"\" + lb[0] + \" \" + lb[1] + \" \" + lb[2] + \"\");\n Console.WriteLine(\"\" + lc[0] + \" \" + lc[1] + \" \" + lc[2] + \"\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CDF157\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] a = new int[3, 3];\n string[] input;\n for (int i = 0; i < 3; i++)\n {\n input = Console.ReadLine().Split(' ');\n for (int j = 0; j < 3; j++)\n a[i, j] = int.Parse(input[j]);\n }\n int e = (a[0, 1] + a[0, 2] + a[1, 0] + a[1, 2] + a[2, 0] + a[2, 1]) / 2;\n a[0,0] = e - a[0, 1] - a[0, 2];\n a[1,1]= e - a[1, 0] - a[1, 2];\n a[2,2] = e - a[2, 0] - a[2, 1];\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n Console.Write(a[i, j] + \" \");\n Console.WriteLine();\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class B\n {\n private static ThreadStart s_threadStart = new B().Go;\n private static bool s_time = false;\n\n private void Go()\n {\n List> data = new List>();\n data.Add(GetIntArr(3));\n data.Add(GetIntArr(3));\n data.Add(GetIntArr(3));\n\n int A = data[0][1] + data[0][2];\n int B = data[0][2] + data[2][0];\n int C = data[2][0] + data[2][1];\n\n data[0][0] = (B + C - A) / 2;\n data[1][1] = (A + C - B) / 2;\n data[2][2] = (A + B - C) / 2;\n\n for(int i = 0; i< 3;i++)\n Wl(data[i][0]+\" \"+data[i][1]+\" \"+data[i][2]);\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n }\n\n #endregion\n }\n}"}, {"source_code": "using System.Text;\nusing System;\nnamespace CodeForces {\n public class Round157ProblemB {\n public const int INPUT_SIZE = 3;\n\n public static void Main(String[] args) {\n // Console.WriteLine(\"20, 30, 10, 30, 20, 10\");\n // int[] cards = new int[] {20, 30, 10, 30, 20, 10};\n // string[] pairs = Problem254A.GetPairs(cards);\n // foreach (string pair in pairs) {\n // Console.WriteLine(pair);\n // }\n\n // Console.WriteLine(\"1, 2\");\n // cards = new int[] {1, 2};\n // pairs = Problem254A.GetPairs(cards);\n // foreach (string pair in pairs) {\n // Console.WriteLine(pair);\n // }\n\n Round157ProblemB p = new Round157ProblemB();\n int[,] input = p.GetInput();\n\n p.GetOutput(ref input);\n\n p.PrintOutput(input);\n }\n\n public int[,] GetInput() {\n int[,] input = new int[INPUT_SIZE,INPUT_SIZE];\n int i = 0;\n while (i < INPUT_SIZE) {\n string[] strs = Console.ReadLine().Split(' ');\n for (int j = 0; j < INPUT_SIZE; j++) {\n input[i,j] = int.Parse(strs[j]);\n }\n\n i++;\n }\n\n return input;\n }\n\n public void GetOutput(ref int[,] input) {\n int s1 = input[0,1] + input[0,2];\n int s2 = input[1,0] + input[1,2];\n int s3 = input[2,0] + input[2,1];\n while (true) {\n int sum = s1 + input[0,0];\n int input11 = sum - s2;\n if (input[0,0] + input11 == s3) {\n input[1,1] = input11;\n input[2,2] = sum - s3;\n return;\n }\n else {\n input[0,0]++;\n }\n }\n }\n\n public void PrintOutput(int[,] input) {\n StringBuilder sb = new StringBuilder();\n int count = 1;\n foreach (int i in input) {\n sb.Append(i);\n if (count % 3 == 0) {\n sb.Append(Environment.NewLine);\n count = 1;\n }\n else {\n sb.Append(\" \");\n count++;\n }\n }\n\n Console.WriteLine(sb.ToString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Temp\n{\n internal class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0);\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.GetIdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3, out int int4)\n {\n int[] numbers = new int[4];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(double[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = double.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(out double a, out double b)\n {\n double[] numbers = new double[2];\n ReadDouble(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadDouble(out double int1, out double int2, out double int3)\n {\n double[] numbers = new double[3];\n ReadDouble(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n }\n\n public class Graph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n internal class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.ReadInt(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.ReadInt(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n // OpenFiles();\n\n new Solution().Solve();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int n = 3;\n int[][] a = new int[3][];\n for (int i = 0; i < 3; i++)\n {\n a[i] = new int[3];\n }\n for (int i = 0; i < 3; i++)\n {\n Reader.ReadInt(a[i]);\n }\n\n for (int x = 1; x < 100001; x++)\n {\n a[0][0] = x;\n int s = a[0].Sum();\n a[1][1] = s - a[1][0] - a[1][2];\n a[2][2] = s - a[2][0] - a[2][1];\n\n bool ok = true;\n\n for (int i = 0; i < 3; i++)\n {\n if (s != a[0][i] + a[1][i] + a[2][i])\n {\n ok = false;\n }\n }\n\n if (s != a[0][0] + a[1][1] + a[2][2])\n {\n ok = false;\n }\n\n if (s != a[0][2] + a[1][1] + a[2][0])\n {\n ok = false;\n }\n\n if (ok)\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n Console.Write(\"{0} \", a[i][j]);\n }\n Console.WriteLine();\n }\n return;\n }\n }\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\n// ~\n\nnamespace CF {\n class Program {\n\n\n\n static void Main(string[] args) {\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n TextWriter writer = Console.Out;\n#else\n\t\t\tTextReader reader = Console.In;\n TextWriter writer = Console.Out;\n#endif\n\n var vals1 = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var s1 = vals1.Sum();\n var vals2 = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var s2 = vals2.Sum();\n var vals3 = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var s3 = vals3.Sum();\n\n int x = 0;\n int y = 0;\n int z = 0;\n\n for (int i = 0; i <= 3 * 100000; i++) {\n\n x = i - s1;\n y = i - s2;\n z = i - s3;\n\n if (x > 0 && y > 0 && z > 0 \n && x + y + z == i\n && vals3[0] + y + vals1[2] == i\n && x + vals2[0] + vals3[0] == i\n && y + vals1[1] + vals3[1] == i\n && z + vals1[2] + vals2[2] == i \n ) {\n break;\n }\n\n }\n\n Console.WriteLine(x + \" \" + vals1[1] + \" \" + vals1[2]);\n Console.WriteLine(vals2[0] + \" \" + y + \" \" + vals2[2]);\n Console.WriteLine(vals3[0] + \" \" + vals3[1] + \" \" + z);\n\n\n //writer.Close();\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}"}, {"source_code": "using System;\nclass CFR156D2B\n{\n\tstatic void Main()\n\t{\n\t\tint[,] a = new int[3, 3];\n\t\tint sum = 0;\n\t\tstring[] data;\n\t\tfor (int i = 0; i < 3; i++)\n\t\t{\n\t\t\tdata = Console.ReadLine().Split(' ');\n\t\t\ta[0, i] = int.Parse(data[0]);\n\t\t\ta[1, i] = int.Parse(data[1]);\n\t\t\ta[2, i] = int.Parse(data[2]);\n\t\t\tsum += a[0, i] + a[1, i] + a[2, i];\n\t\t}\n\t\tsum /= 2;\n\t\ta[0, 0] = sum - (a[1, 0] + a[2, 0]);\n\t\ta[1, 1] = sum - (a[0, 1] + a[2, 1]);\n\t\ta[2, 2] = sum - (a[0, 2] + a[1, 2]);\n\t\t\n\t\tfor (int i = 0; i < 3; i++)\n\t\t{\n\t\t\tConsole.WriteLine(a[0, i] + \" \" + a[1, i] + \" \" + a[2, i]);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[3, 3];\n for (int i = 0; i < 3; i++)\n {\n String line = Console.ReadLine();\n String[] ps = line.Split(' ');\n for (int j = 0; j < 3; j++)\n {\n arr[i, j] = int.Parse(ps[j]);\n }\n }\n\n arr[0, 0] = ((arr[1, 0] + arr[1, 2]) - (arr[0, 1] + arr[0, 2]) + (arr[2, 0] + arr[2, 1])) / 2;\n arr[1, 1] = (arr[2, 0] + arr[2, 1]) - arr[0, 0];\n arr[2, 2] = (arr[0, 0] + arr[0, 1]) - arr[1, 2];\n for (int i = 0; i < 3; i++)\n {\n\n for (int j = 0; j < 3; j++)\n {\n Console.Write(arr[i, j] + \" \");\n }\n Console.WriteLine();\n }\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var m = Enumerable.Range(0,3).Select(i =>\n Console.ReadLine().Split(' ').Select(int.Parse).ToArray())\n .ToArray();\n m[0][0] = m[1][1] = m[2][2] = 1;\n var r = new int[3];\n var c = new int[3];\n for (var y=0;y<3;y++)for (var x=0;x<3;x++){r[y]+=m[y][x];c[x]+=m[y][x]; }\n \n var d1 = m[0][0]+m[1][1]+m[2][2];\n var d2 = m[0][2]+m[1][1]+m[2][0];\n\n var max = new [] { r[0], r[1], r[2],\n c[0], c[1], c[2]}.Max();\n for (var i = 0; i < 3 ; i++) {\n m[i][i]+=max-r[i];\n }\n var d = (max - m[0][0]-m[1][1]-m[2][2]) / 2;\n m[0][0]+=d;\n m[1][1]+=d;\n m[2][2]+=d;\n for (var y = 0; y < 3 ; y++) Console.WriteLine(string.Join(\" \", m[y]));\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n//BF4\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main( ) {\n int[] L1 = Console.ReadLine().Split(new char[ 1 ] { ' ' }).Select(a => int.Parse(a)).ToArray();\n int[] L2 = Console.ReadLine().Split(new char[ 1 ] { ' ' }).Select(a => int.Parse(a)).ToArray();\n int[] L3 = Console.ReadLine().Split(new char[ 1 ] { ' ' }).Select(a => int.Parse(a)).ToArray();\n long L1S = L1.Sum(), L2S = L2.Sum(), L3S = L3.Sum();\n long LS = ( L1S + L2S + L3S ) / 2;\n Console.WriteLine(\"{0} {1} {2}\\n{3} {4} {5}\\n{6} {7} {8}\", LS - L1S, L1[ 1 ], L1[ 2 ], L2[ 0 ], LS - L2S, L2[ 2 ], L3[ 0 ], L3[ 1 ], LS - L3S);\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] s1 = Console.ReadLine().Split(' ');\n string[] s2 = Console.ReadLine().Split(' ');\n string[] s3 = Console.ReadLine().Split(' ');\n\n int a = int.Parse(s1[0]);\n int b = int.Parse(s1[1]);\n int c = int.Parse(s1[2]);\n int d = int.Parse(s2[0]);\n int e = int.Parse(s2[1]);\n int f = int.Parse(s2[2]);\n int h = int.Parse(s3[0]);\n int i = int.Parse(s3[1]);\n int j = int.Parse(s3[2]);\n\n for (int q = 1; q < 100001; q++ )\n {\n e = q;\n int summ = b + e + i;\n a = summ - b - c;\n j = summ - f - c;\n \n if(a+e+j == summ)\n {\n Console.WriteLine(a+\" \"+b+\" \"+c);\n Console.WriteLine(d + \" \" + e + \" \" + f);\n Console.WriteLine(h + \" \" + i + \" \" + j);\n return;\n }\n }\n }\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\n\nnamespace CodeForces\n{\n class Prob259B\n {\n //Little Elephant loves magic squares very much.\n\n //A magic square is a 3\u2009\u00d7\u20093 table, each cell contains some positive integer. At that the sums of integers in \n //all rows, columns and diagonals of the table are equal.\n\n //The Little Elephant remembered one magic square. He started writing this square on a piece of paper, but as \n //he wrote, he forgot all three elements of the main diagonal of the magic square. Fortunately, the Little \n //Elephant clearly remembered that all elements of the magic square did not exceed 10^5.\n\n //Help the Little Elephant, restore the original magic square, given the Elephant's notes.\n\n int[][] square;\n\n public Prob259B(String[] s)\n {\n square = new int[s.Length][];\n String[] temp;\n for (int i = 0; i < s.Length; ++i)\n {\n temp = s[i].Split(' ');\n square[i] = new int[temp.Length];\n for (int j = 0; j < temp.Length; ++j)\n {\n square[i][j] = Convert.ToInt32(temp[j]);\n }\n }\n }\n\n public String solve()\n {\n int[] rowSums = new int[square.Length];\n for (int i = 0; i < square.Length; ++i)\n {\n rowSums[i] = 0;\n for (int j = 0; j < square[i].Length; ++j)\n {\n rowSums[i] += square[i][j];\n }\n }\n int trueSum = rowSums[0];\n int upperLeft = 0;\n for (int i = 1; i < rowSums.Length; ++i)\n {\n upperLeft += rowSums[i];\n }\n upperLeft -= trueSum;\n upperLeft /= 2;\n trueSum += upperLeft;\n\n StringBuilder result = new StringBuilder();\n for (int i = 0; i < square.Length; ++i)\n {\n for (int j = 0; j < square[i].Length; ++j)\n {\n if (square[i][j] == 0)\n {\n result.Append(trueSum - rowSums[i]);\n }\n else\n {\n result.Append(square[i][j]);\n }\n if (j < square[i].Length - 1)\n {\n result.Append(\" \");\n }\n }\n if (i < square.Length - 1)\n {\n result.Append(\"\\n\");\n }\n }\n return result.ToString();\n }\n\n public override String ToString()\n {\n StringBuilder result = new StringBuilder();\n for (int i = 0; i < square.Length; ++i)\n {\n result.Append(\"(\" + String.Join(\",\", square[i]) + \") \");\n }\n return result.ToString();\n }\n\n static void Main(string[] arg)\n {\n int numDims = 3;\n String[] input = new String[numDims];\n for (int i = 0; i < numDims; ++i)\n {\n input[i] = Console.ReadLine();\n }\n Prob259B prob = new Prob259B(input);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Little_Elephant_and_Magic_Square\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n const int n = 3;\n var nn = new int[n][];\n for (int i = 0; i < n; i++)\n {\n nn[i] = new int[n];\n for (int j = 0; j < n; j++)\n {\n nn[i][j] = Next();\n }\n }\n\n int a = nn[0].Sum();\n int b = nn[1].Sum();\n int c = nn[2].Sum();\n\n int x = (b + c - a)/2;\n nn[0][0] = x;\n nn[1][1] = x + a - b;\n nn[2][2] = x + a - c;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n writer.Write(nn[i][j]);\n writer.Write(' ');\n }\n writer.WriteLine();\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int[][] m = new int[3][];\n int[] c = new int[3];\n for (int i = 0; i < 3; i++) {\n m[i] = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n c[i] = m[i].Sum();\n }\n int s = c.Sum() / 2;\n for (int i = 0; i < 3; i++) {\n m[i][i] = s - c[i];\n for (int j = 0; j < 3; j++) {\n Console.Write(\"{0} \", m[i][j]);\n }\n Console.WriteLine();\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var m=util.RangeN(1,3).Map(_=>read().ToIntA()).ToArray();\n var i=0;\n while(true)\n {\n var a0=i;\n var s=a0+m[0][1]+m[0][2];\n var a1=s-m[1][0]-m[1][2];\n var a2=s-a0-a1;\n if( (m[2][0]+a1+m[0][2])==s &&\n (m[0][2]+m[1][2]+a2)==s)\n {\n m[0][0]=a0;\n m[1][1]=a1;\n m[2][2]=a2;\n break;\n }\n i++;\n }\n m.Map(v=>string.Format(\"{0} {1} {2}\",v[0],v[1],v[2]))\n .Foreach(st=>write(st));\n }\n \n}\n\n\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n\n public static int[] ToIntA(this IEnumerable args)\n {\n return args.Map(ToInt).ToArray();\n }\n \n public static int[] ToIntA(this string s)\n {\n return ToIntA(SplitBySpace(s));\n }\n \n public static string[] SplitBySpace(this string s)\n {\n return s.Split(new[]{\" \"},StringSplitOptions.RemoveEmptyEntries);\n }\n \n public static void Foreach(this IEnumerable l,Action f)\n {\n foreach(var i in l) f(i);\n }\n}\n\nstatic class FuncExts\n{\n public static IEnumerable Map(this IEnumerable l,Func f)\n {\n return l.Select(f);\n }\n \n public static IEnumerable Flt(this IEnumerable l,Func f)\n {\n return l.Where(f);\n }\n \n public static T Nth(this IEnumerable l,int n)\n {\n var list = l as IList;\n return (list!=null)?list[n-1]:l.Skip(n-1).First();\n }\n \n public static T Rd(this IEnumerable l,T df,Func f)\n {\n return Fold(l,df,f);\n }\n \n public static U Fold(this IEnumerable l,U df,Func f)\n {\n foreach(var i in l)\n {\n df=f(df,i);\n }\n return df;\n }\n \n public static IEnumerable Scan(this IEnumerable l,Func f,U df)\n {\n foreach(var i in l)\n {\n df=f(df,i);\n yield return df;\n }\n }\n}\n\nstatic class util\n{\n public static IEnumerable RangeN(int from,int to)\n {\n while(from<=to)\n {\n yield return from;\n from++;\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace LittleElephantandMagicSquare\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar r1 = Console.ReadLine().Split(' ').ToList().Select(int.Parse).ToList();\n\t\t\tvar r2 = Console.ReadLine().Split(' ').ToList().Select(int.Parse).ToList();\n\t\t\tvar r3 = Console.ReadLine().Split(' ').ToList().Select(int.Parse).ToList();\n\n\t\t\tint sr1 = r1.Sum (); int sr2 = r2.Sum (); int sr3 = r3.Sum ();\n\n\t\t\tint x = (sr3 + (sr2 - sr1)) / 2; int y = sr3 - x; int z = sr1 + x - sr3;\n\n\t\t\tr1 [0] = x; r2 [1] = y; r3 [2] = z;\n\n\t\t\tstring tmp = \"\";\n\t\t\tr1.ForEach (c => tmp += c + \" \");\n\t\t\tConsole.WriteLine (tmp);\n\t\t\ttmp = \"\";\n\t\t\tr2.ForEach (c => tmp += c + \" \");\n\t\t\tConsole.WriteLine (tmp);\n\t\t\ttmp = \"\";\n\t\t\tr3.ForEach (c => tmp += c + \" \");\n\t\t\tConsole.WriteLine (tmp);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int a = Next();\n int b = Next();\n int c = Next();\n int d = Next();\n int e = Next();\n int f = Next();\n int g = Next();\n int h = Next();\n int k = Next();\n int dd = d + g - c - f;\n for(a = 0; a <= 100000; a++) {\n k = a + dd;\n if(k > 100000)\n continue;\n if(k < 0)\n continue;\n e = a + b + c - d - f;\n if(e > 100000)\n continue;\n if(e < 0)\n continue;\n long s = a + b + c;\n bool ans = true;\n ans &= d + e + f == s;\n ans &= g + h + k == s;\n ans &= a + d + g == s;\n ans &= b + e + h == s;\n ans &= c + f + k == s;\n ans &= a + e + k == s;\n if(ans)\n break;\n }\n writer.WriteLine(\"{0} {1} {2}\", a, b, c);\n writer.WriteLine(\"{0} {1} {2}\", d, e, f);\n writer.WriteLine(\"{0} {1} {2}\", g, h, k);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var ar = new int[9];\n for (int i = 0; i < 9; i++)\n {\n ar[i] = Next();\n }\n var sum = ar.Sum() / 2;\n ar[0] = sum - ar[1] - ar[2];\n ar[4] = sum - ar[3] - ar[5];\n ar[8] = sum - ar[6] - ar[7];\n WriteArray(ar.Take(3));\n WriteArray(ar.Skip(3).Take(3));\n WriteArray(ar.Skip(6));\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class StringInt\n\t\t{\n\t\t\tpublic string x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class StringString\n\t\t{\n\t\t\tpublic string x;\n\n\t\t\tpublic string y;\n\t\t}\n\n\t\tpublic class IntInt\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class SIComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(StringInt x, StringInt y)\n\t\t\t{\n\t\t\t\treturn x.x.CompareTo(y.x);\n\t\t\t}\n\t\t}\n\n\t\tpublic class XComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(int x, int y)\n\t\t\t{\n\t\t\t\tif (x % 10 > y % 10)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List getLongList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long getLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Edge\n\t\t{\n\t\t\tpublic int v;\n\n\t\t\tpublic int w;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic bool was;\n\t\t}\n\n\t\tpublic static bool isPrime(int x)\n\t\t{\n\t\t\tfor (var i = 2; i * i <= x; ++i)\n\t\t\t\tif (x % i == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = new List> { getList(), getList(), getList() };\n\t\t\tvar a1 = l[0][1];\n\t\t\tvar a2 = l[0][2];\n\t\t\tvar a3 = l[1][0];\n\t\t\tvar a4 = l[1][2];\n\t\t\tvar a5 = l[2][0];\n\t\t\tvar a6 = l[2][1];\n\t\t\tvar z = (a1 + 2 * a2 - a6) / 2;\n\t\t\tvar x = a2 + a5 - z;\n\t\t\tvar y = x + a1 + a2 - a3 - a4;\n\t\t\tConsole.WriteLine(\"{0} {1} {2}\", x, a1, a2);\n\t\t\tConsole.WriteLine(\"{0} {1} {2}\", a3, y, a4);\n\t\t\tConsole.WriteLine(\"{0} {1} {2}\", a5, a6, z);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] matrix = new int[3][];\n int[] s = new int[3];\n\n for (int i = 0; i < 3; i++)\n {\n matrix[i] = new int[3];\n s[i] = 0;\n\n string[] lineParts = Console.ReadLine().Split(' ');\n\n for (int j = 0; j < 3; j++)\n {\n matrix[i][j] = int.Parse(lineParts[j]);\n s[i] += matrix[i][j];\n }\n }\n\n int max = Math.Max(s[0], Math.Max(s[1], s[2]));\n\n matrix[0][0] = max - matrix[0][1] - matrix[0][2] + 1;\n matrix[1][1] = max - matrix[1][0] - matrix[1][2] + 1;\n matrix[2][2] = max - matrix[2][0] - matrix[2][1] + 1;\n\n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(matrix[i][0] + \" \" + matrix[i][1] + \" \" + matrix[i][2]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\n\nnamespace codeforces_round_157_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[3,3];\n int sum = 0;\n int sum2 = 0;\n for (int i = 0; i < 3; i++)\n {\n string[] st = Console.ReadLine().Split(' ');\n for (int j = 0; j < 3; j++)\n {\n arr[i, j] = Int32.Parse(st[j]);\n sum += arr[i, j];\n }\n }\n arr[0,0] = sum - (arr[0, 1] + arr[0, 2]);\n arr[2, 2] = sum - (arr[0, 2] + arr[1, 2]);\n arr[1, 1] = (arr[0, 0] + arr[2, 2])/2;\n int x = 0;\n foreach (int i in arr)\n {\n if (x++ < 2)\n Console.Write(i+\" \");\n else\n {\n Console.WriteLine(i);\n x = 0;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\n\nnamespace codeforces_round_157_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[3,3];\n int sum = 0;\n int sum2 = 0;\n for (int i = 0; i < 3; i++)\n {\n string[] st = Console.ReadLine().Split(' ');\n for (int j = 0; j < 3; j++)\n {\n arr[i, j] = Int32.Parse(st[j]);\n sum += arr[i, j];\n }\n }\n Console.WriteLine(sum /= 2);\n arr[0,0] = sum - (arr[0, 1] + arr[0, 2]);\n arr[2, 2] = sum - (arr[0, 2] + arr[1, 2]);\n arr[1, 1] = (arr[0, 0] + arr[2, 2])/2;\n int x = 0;\n foreach (int i in arr)\n {\n if (x++ < 2)\n Console.Write(i+\" \");\n else\n {\n Console.WriteLine(i);\n x = 0;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication12_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string z1 = \"\", z2 = \"\", z3=\"\";\n string k1 = \"\", k2 = \"\", k3 = \"\";\n z1 = Console.ReadLine();\n z1 = z1.Replace(\" \",\"\");\n z2 = Console.ReadLine();\n z2 = z2.Replace(\" \", \"\");\n z3 = Console.ReadLine();\n z3 = z3.Replace(\" \", \"\");\n k1 = Convert.ToString(Convert.ToInt32(\n (z2.Substring(2,1))+Convert.ToInt32(z3.Substring(1,1)))/2\n );\n z1.Replace(\"0\", k1);\n\n k2 = Convert.ToString(Convert.ToInt32(\n (z1.Substring(2, 1)) + Convert.ToInt32(z3.Substring(0, 1))) / 2\n );\n z2.Replace(\"0\", k2);\n\n k3= Convert.ToString(Convert.ToInt32(\n (z2.Substring(0, 1)) + Convert.ToInt32(z1.Substring(1, 1))) / 2\n );\n\n z3.Replace(\"0\", k3);\n\n Console.WriteLine(z1.Substring(0, 1) + \" \" + z1.Substring(1, 1) + \" \" + z1.Substring(2, 1));\n Console.WriteLine(z2.Substring(0, 1) + \" \" + z2.Substring(1, 1) + \" \" + z2.Substring(2, 1));\n Console.WriteLine(z3.Substring(0, 1) + \" \" + z3.Substring(1, 1) + \" \" + z3.Substring(2, 1));\n\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication12_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string z1 = \"\", z2 = \"\", z3=\"\";\n string k1 = \"\", k2 = \"\", k3 = \"\";\n int y12 = 0, y13 = 0;\n int y21 = 0, y23 = 0;\n int y31 = 0, y32 = 0;\n\n z1 = Console.ReadLine();\n z1 = z1.Replace(\" \",\"\");\n z2 = Console.ReadLine();\n z2 = z2.Replace(\" \", \"\");\n z3 = Console.ReadLine();\n z3 = z3.Replace(\" \", \"\");\n\n y12=Convert.ToInt32((z1.Substring(1,1)));\n y13=Convert.ToInt32((z1.Substring(2,1)));\n \n y21=Convert.ToInt32((z2.Substring(0,1)));\n y23=Convert.ToInt32((z2.Substring(2,1)));\n\n y31=Convert.ToInt32((z3.Substring(0,1)));\n y32=Convert.ToInt32((z3.Substring(1,1)));\n\n\n\n\n k1 = Convert.ToString((y23+y32)/2); \n z1= z1.Replace(\"0\", k1);\n\n\n\n k2 = Convert.ToString(Convert.ToInt32((y13+y31)/2));\n z2=z2.Replace(\"0\", k2);\n\n k3= Convert.ToString(Convert.ToInt32((y21+y12)/2));\n z3=z3.Replace(\"0\", k3);\n\n Console.WriteLine(z1.Substring(0, 1) + \" \" + z1.Substring(1, 1) + \" \" + z1.Substring(2, 1));\n Console.WriteLine(z2.Substring(0, 1) + \" \" + z2.Substring(1, 1) + \" \" + z2.Substring(2, 1));\n Console.WriteLine(z3.Substring(0, 1) + \" \" + z3.Substring(1, 1) + \" \" + z3.Substring(2, 1));\n\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication12_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[,] a = new int[3, 3];\n string[] data=new string[3];\n for (int i = 0; i < 3; i++)\n {\n data = Console.ReadLine().Split(' ');\n a[0, i] = int.Parse(data[0]);\n a[1, i] = int.Parse(data[1]);\n a[2, i] = int.Parse(data[2]);\n }\n\n a[0, 0] = (a[1, 2] + a[2, 1]) / 2;\n a[1, 1] = (a[0, 2] + a[2, 0]) / 2;\n a[2, 2] = (a[1, 0] + a[0, 1]) / 2;\n \n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(a[i, 0] + \" \" + a[i, 1] + \" \" + a[i, 2]);\n }\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program_R157_Div2_B\n {\n static void Main(string[] args)\n {\n int[] a = new int[10];\n int sum;\n for (int i = 0; i < 3; i++)\n {\n string[] s = (Console.ReadLine().Split());\n a[i * 3 + 1] = Convert.ToInt32(s[0]);\n a[i * 3 + 2] = Convert.ToInt32(s[1]);\n a[i * 3 + 3] = Convert.ToInt32(s[2]);\n }\n\n for (int i = 1; i < 100000; i++)\n {\n a[5] = i;\n sum = a[4] + a[5] + a[6];\n if (sum == a[2] + a[5] + a[8]\n && sum == a[3] + a[5] + a[7])\n {\n a[1] = sum - a[2] - a[3];\n a[9] = sum - a[7] - a[8];\n if (sum == a[1] + a[4] + a[7] \n && sum == a[3] + a[6] + a[9]\n && sum == a[1] + a[5] + a[9])\n break;\n }\n }\n\n for (int i = 0; i < 3; i++)\n {\n Console.WriteLine(\"{0} {1} {2}\", a[i * 3 + 1], a[i * 3 + 2], a[i * 3 + 3]);\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Coderandom\n{\n class Program\n {\n static void Print(int[,] m,int[]a)\n {\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (i==j)\n {\n Console.Write(a[i]+\" \");\n }\n else\n {\n Console.Write(m[i,j]+\" \");\n }\n }\n Console.WriteLine();\n }\n }\n static void Main(string[] args)\n {\n int[,] matrix = new int[3, 3];\n int [] mas = new int[3];\n int[]ind = new int[3];\n for (int i = 0; i < 3; i++)\n {\n string[] ss = Console.ReadLine().Split(' ');\n\n\n for (int j = 0; j < 3; j++)\n {\n matrix[i, j] = int.Parse(ss[j]);\n mas[i] += matrix[i, j]; \n }\n }\n\n\n for (int i = 0; i < 100000; i++)\n {\n ind[0] = i ;\n ind[1] = mas[0]+i - mas[1];\n ind[2] = mas[0] + i - mas[2]; \n\n if(ind[0]+ind[2]+ind[1]==i+mas[0]) break;\n }\n\n Print(matrix,ind);\n\n\n \n\n\n }\n }\n}\n\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var m = Enumerable.Range(0,3).Select(i =>\n Console.ReadLine().Split(' ').Select(int.Parse).ToArray())\n .ToArray();\n m[0][0] = m[1][1] = m[2][2] = 1;\n var r = new int[3];\n var c = new int[3];\n for (var y=0;y<3;y++)for (var x=0;x<3;x++){r[y]+=m[y][x];c[x]+=m[y][x]; }\n \n var d1 = m[0][0]+m[1][1]+m[2][2];\n var d2 = m[0][2]+m[1][1]+m[2][0];\n\n var max = new [] { r[0], r[1], r[2],\n c[0], c[1], c[2]}.Max();\n for (var i = 0; i < 3 ; i++) {\n m[i][i]+=max-r[i];\n }\n var d = (max - m[0][0]-m[1][1]-m[2][2]) / 3;\n m[0][0]+=d;\n m[1][1]+=d;\n m[2][2]+=d;\n for (var y = 0; y < 3 ; y++) Console.WriteLine(string.Join(\" \", m[y]));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Little_Elephant_and_Magic_Square\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n const int n = 3;\n var nn = new int[n][];\n for (int i = 0; i < n; i++)\n {\n nn[i] = new int[n];\n for (int j = 0; j < n; j++)\n {\n nn[i][j] = Next();\n }\n }\n\n int a = nn[0].Sum();\n int b = nn[1].Sum();\n int c = nn[2].Sum();\n\n int x = (b + c - a)/2;\n nn[0][0] = x;\n nn[1][1] = x + a - b;\n nn[2][2] = x + a - c;\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "0c42eafb73d1e30f168958a06a0f9bca"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int diff = Math.Abs(a - b);\n if (diff == 1)\n Console.WriteLine(1);\n else\n {\n int k = ((diff / 2) * 2) / 2;\n int s = (k * (k + 1) / 2) * 2;\n\n if (diff % 2 == 1)\n s += k + 1;\n Console.WriteLine(s);\n }\n }\n }\n} \n\n", "positive_code": [{"source_code": "using System;\nclass Program\n{\n static int Sum(int a)\n {\n while (a > 1)\n return a + Sum(--a);\n return a;\n }\n static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n if ((a - b) % 2 == 0)\n Console.WriteLine(Sum(Math.Abs(a - b) / 2) * 2);\n else Console.WriteLine(Sum(Math.Abs(a - b) / 2) + Sum(Math.Abs(a - b) / 2 + Math.Abs(a - b) % 2));\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _17._03._2018\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int sum = f(Math.Abs(b-a)/2)*2;\n if (Math.Abs(b - a) % 2 == 1)\n sum += Math.Abs(b - a) / 2 + 1;\n Console.WriteLine(sum);\n }\n\n static int f(int j)\n {\n int sum = 0;\n for (int i = 1; i<=j; i++)\n sum += i;\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.WriteLine(\"Hello World!\");\n FriendsMeeting.FriendsWithBenefits();\n }\n }\n class FriendsMeeting\n {\n public static void FriendsWithBenefits()\n {\n int p1 = int.Parse(Console.ReadLine());\n int p2 = int.Parse(Console.ReadLine());\n int diff = Math.Abs(p2 - p1);\n int prim_sum = diff / 2;\n int aux_sum = diff % 2 == 0 ? 0 : prim_sum + 1;\n Console.WriteLine(prim_sum*(prim_sum+1)+aux_sum);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemA\n{\n\tpublic class Problem\n\t{\n\t\tpublic int a;\n\t\tpublic int b;\n\n\t\tpublic int[] ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\ta = ReadLine()[0];\n\t\t\tb = ReadLine()[0];\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar answer = 0;\n\t\t\tvar dist = Math.Abs(a - b);\n\t\t\tanswer = (dist / 2) * (dist / 2 + 1) + (dist % 2 == 1 ? dist / 2 + 1 : 0);\n\t\t\tConsole.WriteLine(answer);\n\t\t}\n\t}\n\n\tclass ProblemA\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\npublic class task\n{\n private static void Main()\n {\n int b = Math.Abs(int.Parse(Console.ReadLine()) - int.Parse(Console.ReadLine()));\n if (b % 2 != 0)\n Console.WriteLine((b + 1) / 2 + (1 + ((b - 1) / 2)) * ((b-1) / 2));\n else\n Console.WriteLine((1 + b/2) * b/2);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = Math.Abs(a - b);\n int d = c / 2;\n int e = c - d;\n int f = (1 + d) * d / 2;\n int g = (1 + e) * e / 2;\n int h = f + g;\n Console.WriteLine(h);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R468A.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R468A();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R468A : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var a = this.ReadInt32();\n var b = this.ReadInt32();\n var delta = Math.Abs(b - a);\n var s1 = delta / 2;\n var s2 = delta / 2;\n if (delta % 2 == 1)\n {\n s2++;\n }\n \n\n yield return ((s1+1)*s1/2+ (s2 + 1) * s2 / 2).ToString();\n }\n }\n\n internal class R468B : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n internal class R468C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n internal class R468D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int suba = Convert.ToInt32(Console.ReadLine());\n int subb = Convert.ToInt32(Console.ReadLine());\n\n int b = (suba>subb)?suba:subb;\n int a = (suba < subb) ? suba : subb;\n\n\n int cen = (b +a+1) / 2;\n int usb = (cen - a) * (cen - a + 1) / 2;\n int usa = (b - cen) * (b - cen + 1) / 2;\n\n Console.WriteLine(usa + usb);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Solve());\n }\n static int Solve()\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int count = 0, currentInc = 1;\n int distance = Math.Abs(a - b);\n\n if (distance == 1) return 1;\n\n for (int i = 0; i 0; i--)\n {\n evenTiredness += i;\n }\n\n var minTiredness = 2 * evenTiredness;\n \n if (difference % 2 != 0)\n {\n minTiredness += half + 1; \n }\n\n return minTiredness;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Technocup_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Math.Abs(a - b) / 2;\n if (Math.Abs(a - b) == 1) c = 1;\n else\n if (Math.Abs(a - b)%2 == 1) c = c * (c + 1) + c + 1;\n else c = c * (c + 1);\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n \n if (a > b)\n {\n int x = a;\n a = b;\n b = x;\n }\n \n int m = (a + b + 1) / 2;\n Console.WriteLine(Sum(m - a) + Sum(b - m));\n }\n static int Sum(int n)\n {\n return (1 + n) * n / 2;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int t = a;\n a = a > b ? b : a;\n b = b > a ? b : t;\n int[] kq = new int[b-a + 1];\n for(int i = 0; i < kq.Length; i++)\n kq[i] = (a + i) * (a + i) - (a + i) * (a + b) + (a * a + b * b + b - a) / 2;\n Console.WriteLine(kq.Min());\n }\n }\n}\n"}, {"source_code": "// Problem: 931A - Friends Meeting\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass FriendsMeeting\n {\n public static int Main ()\n {\n ushort a = 0;\n ushort b = 0;\n if (!ReadCheckPos (ref a) || !ReadCheckPos (ref b))\n return -1;\n if (a == b)\n return -1;\n ushort tmp = Convert.ToUInt16 (a+b);\n ushort meetPos = Convert.ToUInt16 (tmp/2);\n ushort minStep = Convert.ToUInt16 (meetPos-Math.Min (a,b));\n uint ans = Convert.ToUInt32 (minStep*(minStep+1));\n if (tmp%2 == 1)\n ans += Convert.ToUInt32 (minStep+1);\n Console.WriteLine (ans);\n return 0;\n }\n \n static bool ReadCheckPos (ref ushort pos)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return false;\n string[] words = line.Split ();\n if (words.Length != 1)\n return false;\n if (!UInt16.TryParse (words[0], out pos))\n return false;\n if (pos < 1 || pos > 1000)\n return false;\n return true;\n }\n }\n"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = int.Parse(Console.ReadLine());\n int c2 = int.Parse(Console.ReadLine());\n int rez = 0, a= Math.Abs(c2-c1);\n if (a<=2)\n rez = a;\n else\n {\n for (int i = 1; i <= a/2; i++)\n {\n rez += i;\n }\n rez *= 2;\n if (a % 2 != 0)\n rez += a / 2 + 1;\n\n }\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\n\nclass Program\n{\n static void Main()\n {\n var a = int.Parse(ReadLine());\n var b = int.Parse(ReadLine());\n var d = Math.Abs(b - a);\n WriteLine(d % 2 == 0 ? d / 2 * (d / 2 + 1) : (d / 2 ) * (d / 2 + 1) + d / 2 + 1);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _931A\n {\n public static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n\n int x = (a + b) / 2;\n\n int da = Math.Abs(a - x);\n int db = Math.Abs(b - x);\n\n Console.WriteLine(da * (da + 1) / 2 + db * (db + 1) / 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n private static int a, b;\n static void Main(string[] args)\n {\n a = int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n int m = (a + b) / 2;\n int c1 = Math.Abs(m - a);\n int c2 = Math.Abs(m - b);\n Console.WriteLine(c1 * (c1 + 1) / 2 + c2 * (c2 + 1) / 2);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MeetFriend\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int at = 0; \n int bt = 0; \n for (int i = 1; a!=b; i++)\n {\n if (a < b)\n {\n a++;\n at += i;\n\n if (a == b)\n {\n break;\n }\n b--;\n bt += i;\n if (a == b)\n {\n break;\n }\n }\n if (a > b)\n {\n a--;\n at += i;\n\n if (a == b)\n {\n break;\n }\n b++;\n bt += i;\n if (a == b)\n {\n break;\n }\n }\n\n\n }\n Console.WriteLine(at+bt);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(ReadLine());\n int b = Convert.ToInt32(ReadLine());\n int sum = 0;\n int dif = Math.Abs(a - b);\n sum += (dif / 2 * (dif / 2 + 1));\n if(dif%2==1)\n {\n sum += dif / 2 + 1;\n }\n WriteLine(sum);\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n=int.Parse(Console.ReadLine());\n int m=int.Parse(Console.ReadLine());\n int sred=(n+m)/2;\n int sum=0;\n int o=0;\n for(int i=Math.Min(n,m);isred;i--)\n {\n o++;\n sum+=o;\n }\n Console.WriteLine(sum);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olimp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, a1 = 0, b1 = 0;\n int x1 = int.Parse(Console.ReadLine());\n int x2 = int.Parse(Console.ReadLine());\n if (x1 >= x2)\n {\n a = (x1 - x2) / 2;\n b = (x1 - x2) - a;\n for(int i = 0; i!= a+1; i++)\n {\n a1 += i;\n }\n for (int i = 0; i != b+1; i++)\n {\n b1 += i;\n }\n }\n else\n {\n a = (x2 - x1) / 2;\n b = (x2 - x1) - a;\n for (int i = 0; i != a+1; i++)\n {\n a1 += i;\n }\n for (int i = 0; i != b+1; i++)\n {\n b1 += i;\n }\n }\n Console.WriteLine(a1+b1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static long nsum (int x)\n {\n return (long)x * (x + 1) / 2;\n }\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine()), b = int.Parse(Console.ReadLine());\n int dist = Math.Abs(b - a);\n Console.WriteLine(nsum((dist + 1) / 2) + nsum(dist / 2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Introduction\n{\n\n class Program\n {\n static Reader reader = new Reader();\n static void Main(string[] args)\n {\n int number1 = reader.NextInt();\n int number2 = reader.NextInt();\n int count = 0;\n int i, j;\n for (i = 1; i <= Math.Truncate((double)Math.Abs((double)(number1 - number2) / 2)); i++)\n count += i;\n for (j = 1; j <= Math.Ceiling((double)Math.Abs((double)(number1 - number2) / 2)); j++)\n count += j;\n Console.Write(count);\n }\n }\n\n #region Reader Class\n internal class Reader\n {\n int s_index = 0;\n List s_tokens;\n\n public string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n public int NextInt()\n {\n String s = Next();\n\n return int.Parse(s);\n }\n\n public long NextLong()\n {\n String s = Next();\n\n return long.Parse(s);\n }\n\n public bool HasNext()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = null;\n s_index = 0;\n var nextLine = Console.ReadLine();\n if (nextLine != null)\n {\n s_tokens = nextLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n if (s_tokens.Count == 0)\n {\n continue;\n }\n }\n return false;\n }\n return false;\n }\n }\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Friends_Meeting\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int a = Next();\n int b = Next();\n\n if (a > b)\n {\n int c = a;\n a = b;\n b = c;\n }\n\n int ans = 0;\n\n for (int i = 1; a < b; i++)\n {\n if (a < b)\n {\n a++;\n ans += i;\n }\n if (a < b)\n {\n b--;\n ans += i;\n }\n }\n\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n { \n static void Main(string[] args)\n { \n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n \n int diff = Math.Abs(a-b);\n \n int ans = 0;\n \n if(diff%2==0){\n int h = diff/2;\n ans = h*(1+h)/2;\n ans = ans * 2;\n }else{\n int h1 = (diff+1)/2;\n int h2 = (diff-1)/2;\n \n int a1 = h1*(1+h1)/2;\n int a2 = h2*(1+h2)/2;\n \n ans = a2 + a1;\n }\n \n Console.WriteLine(ans);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n \n int D = Math.Abs(a-b);\n \n int ans = 0;int cnt = 1;\n for(int i=0;i0 && i%2==0)cnt++;\n ans += cnt;\n }\n Console.WriteLine(ans);\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n\n\n static void Main(string[] args)\n {\n //var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n //var a = s[0];\n //var b = s[1];\n\n\n var a = int.Parse(Console.ReadLine());\n var b = int.Parse(Console.ReadLine());\n\n \n\n int c = Math.Min(a, b);\n b = Math.Max(a, b);\n a = c;\n\n\n int mid = (a + b) / 2;\n\n int bS = b - mid;\n int aS = mid - a;\n\n int bE = (bS * (bS + 1)) / 2;\n int aE = (aS * (aS + 1)) / 2;\n\n\n\n Console.WriteLine(bE + aE);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplateClean\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int a = int.Parse(Console.ReadLine());\n\n int b = int.Parse(Console.ReadLine());\n\n int way = a > b ? a- b : b - a;\n\n int mySteps = 0;\n\n int friendSteps = 0;\n\n int res = 0;\n\n for (int i = 0; i < way; i++)\n {\n if (i % 2 == 0)\n {\n mySteps++;\n\n res += mySteps;\n }\n\n else\n {\n friendSteps++;\n\n res += friendSteps;\n }\n }\n\n\n Console.WriteLine(res);\n\n //Console.ReadKey();\n\n }\n\n\n }\n\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Contest\n{\n class Scanner\n {\n private string[] line = new string[0];\n private int index = 0;\n public string Next()\n {\n if (line.Length <= index)\n {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public string[] Array()\n {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n public int[] IntArray()\n {\n return Array().Select(int.Parse).ToArray();\n }\n public long[] LongArray()\n {\n return Array().Select(long.Parse).ToArray();\n }\n }\n\n class Program\n {\n private int A, B;\n private void Scan()\n {\n var sc = new Scanner();\n A = sc.NextInt();\n B = sc.NextInt();\n }\n\n private int AA(int n)\n {\n return n * (n + 1) / 2;\n }\n\n public void Solve()\n {\n Scan();\n var dist = Math.Abs(A - B);\n Console.WriteLine(AA(dist / 2) + AA((dist + 1) / 2));\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n }\n}"}, {"source_code": "/* Date: 04.03.2018 * Time: 22:45 */\n// *\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\029\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\029\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tstring ss;\n\t\tint a, b;\n\n# if ( ONLINE_JUDGE )\n\t\ta = int.Parse (Console.ReadLine ());\n\t\tb = int.Parse (Console.ReadLine ());\n# else\n\t\ta = int.Parse (sr.ReadLine ());\n\t\tb = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"a = \" + a + \" b = \" + b);\n# endif\n\n\t\tif (a > b )\n\t\t{\n\t\t\tint c = a; a = b; b = c;\n\t\t}\n\n\t\tint n = (b - a)/2;\n\t\tint k = n*(n+1);\n\t\tif ( (b - a)%2 == 1 )\n\t\t\tk += n + 1;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n {\n static void Main(string[] args)\n { \n new FriendsMeeting().Solve();\n }\n }\n \n public abstract class ISolution\n {\n public static Func ReadInt = () => int.Parse(Console.ReadLine().Trim());\n public static Func ReadShort = () => short.Parse(Console.ReadLine().Trim());\n public static Func ReadString = () => Console.ReadLine().Trim();\n public static Func ReadByte = () => byte.Parse(Console.ReadLine().Trim());\n public static StringBuilder output = new StringBuilder();\n public static Func ReadArrString = () => ReadString().Split(' ').ToArray();\n public abstract void Solve();\n }\n\npublic class FriendsMeeting : ISolution\n {\n public override void Solve()\n {\n var a1 = ReadInt();\n var b1 = ReadInt();\n var a = Math.Min(a1, b1);\n var b = Math.Max(a1, b1);\n var dist = Math.Abs(b - a);\n Console.WriteLine(Math.Min(distance(dist), distance((b - (int)Math.Floor((double)(a + b) / 2))) + distance(((int)Math.Floor((double)(a + b) / 2) - a))));\n }\n\n public int distance(int k)\n {\n return (k * (k + 1)) / 2;\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace G4\n{\n class Program\n {\n static int[] Soliders;\n static int N, K;\n\n static void Main(string[] args)\n {\n int[] Steps = new int[10];\n Steps[0] = 1;\n for (int i = 1; i < 10; i++)\n {\n Steps[i] = Steps[i - 1] * 10;\n }\n\n //string sin = Console.ReadLine();\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int max = Math.Max(a, b);\n int min = Math.Min(a, b);\n a = min;\n b = max;\n int y = 0;\n int h1 = (b-a) / 2;\n int h2 = (b-a+1) / 2;\n y += (((h1 * (h1 + 1)) / 2) + ((h2 * (h2 + 1)) / 2));\n Console.Write(y);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace test1 {\n class Program {\n static void Main(string[] args) {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n\n int d = Math.Abs(a - b);\n\n int temp = 0;\n for (int i = 1; i <= d / 2; i++)\n temp += i;\n\n temp *= 2;\n\n if (d % 2 == 1)\n temp += d / 2 + d % 2;\n\n Console.WriteLine(temp);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Friends_Meeting\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int total = 0;\n int s = (Math.Abs(a - b)) / 2;\n for (int i = 1; i <= s; i++)\n {\n total += i;\n }\n if (Math.Abs(a - b) % 2 == 0){\n total*=2;\n }\n else\n {\n for (int i = 1; i <= Math.Abs(a - b)-s; i++)\n {\n total += i;\n }\n }\n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace CF\n{\n public static class FromConsole\n {\n public static T To(this string input) where T : IConvertible\n {\n return (T)Convert.ChangeType(input, typeof(T));\n }\n\n public static T[] ToArrayOf(this string input, char? delimiter = null) where T : IConvertible\n {\n IEnumerable sequence = delimiter == null ? input.Select(x => x.ToString()) : input.Split(delimiter.Value);\n\n return sequence.Select(x => x.ToString().To()).ToArray();\n }\n\n public static T[] ToArrayOf(int count) where T : IConvertible\n {\n T[] output = new T[count];\n\n for (int i = 0; i < count; i++)\n {\n output[i] = Console.ReadLine().To();\n }\n\n return output;\n }\n\n public static T[] ToArrayOf(T value, int count)\n {\n return Enumerable.Repeat(value, count).ToArray();\n }\n\n public static T[][] ToMatrixOf(int n, char? delimiter = null) where T : IConvertible\n {\n T[][] output = new T[n][];\n\n for (int i = 0; i < n; i++)\n {\n output[i] = Console.ReadLine().ToArrayOf(delimiter);\n }\n\n return output;\n }\n\n public static T[][] ToMatrixOf(T value, int n, int m)\n {\n T[][] output = new T[n][];\n\n for (int i = 0; i < n; i++)\n {\n output[i] = ToArrayOf(value, m);\n }\n\n return output;\n }\n\n public static Tuple IndexOf(this T[][] input, params T[] targets)\n {\n for (int i = 0; i < input.Length; i++)\n {\n for (int j = 0; j < input[0].Length; j++)\n {\n if (targets.Any(x => x.Equals(input[i][j])))\n {\n return new Tuple(i, j);\n }\n }\n }\n\n return new Tuple(-1, -1);\n }\n\n public static void AddToList(this Dictionary> input, T k, U v)\n {\n if (input.ContainsKey(k))\n {\n input[k].Add(v);\n }\n else\n {\n input.Add(k, new List() { v });\n }\n }\n\n public static void AddAndIncrement(this Dictionary input, T k)\n {\n if (input.ContainsKey(k))\n {\n input[k]++;\n }\n else\n {\n input.Add(k, 1);\n }\n }\n\n public static string ToBinary(this long input)\n {\n return Convert.ToString(input, 2);\n }\n\n public static long ToDecimal(this string input)\n {\n return Convert.ToInt32(input, 2);\n }\n\n public static long Binomial(long n, long k)\n {\n long r = 1;\n long d;\n if (k > n) return 0;\n for (d = 1; d <= k; d++)\n {\n r *= n--;\n r /= d;\n }\n return r;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n int x = Console.ReadLine().To();\n int y = Console.ReadLine().To();\n int l = Math.Min(x, y);\n int r = Math.Max(x, y);\n\n int mid = (int)Math.Floor((l + r) / 2d);\n int leftSteps = mid - l;\n int rightSteps = r - mid;\n\n int leftScore = 0;\n for (int i = 1; i <= leftSteps; i++)\n {\n leftScore += i;\n }\n int rightScore = 0;\n for (int i = 1; i <= rightSteps; i++)\n {\n rightScore += i;\n }\n\n Console.WriteLine(leftScore + rightScore);\n //Console.ReadKey();\n } \n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint x = Convert.ToInt32(Console.ReadLine());\n\t\tint y = Convert.ToInt32(Console.ReadLine());\n\t\tint xt = 0, xi = 1;\n\t\tint yt = 0, yi = 1;\n\t\tint d;\n\t\tint f = 0;\n\t\tif(x > y) d = x - y;\n\t\telse d = y - x;\n\t\tfor(; d > 0; d--){\n\t\t\tif(f == 0){\n\t\t\t\tf = 1;\n\t\t\t\txt += xi;\n\t\t\t\txi++;\n\t\t\t} else {\n\t\t\t\tf = 0;\n\t\t\t\tyt += yi;\n\t\t\t\tyi++;\n\t\t\t}\n\t\t}\n\t\tConsole.Write(xt + yt);\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int a = int.Parse(Console.ReadLine());\n\n int b = int.Parse(Console.ReadLine());\n\n int way = a > b ? a - b : b - a;\n\n int mySteps = 0;\n\n int friendSteps = 0;\n\n int res = 0;\n\n for (int i = 0; i < way; i++)\n {\n if (i % 2 == 0)\n {\n mySteps++;\n\n res += mySteps;\n }\n\n else\n {\n friendSteps++;\n\n res += friendSteps;\n }\n }\n\n\n Console.WriteLine(res);\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int t = a;\n a = a > b ? a : b;\n b = b > a ? t : b;\n int[] kq = new int[b-a + 1];\n for(int i = 0; i < kq.Length; i++)\n kq[i] = (a + i) * (a + i) - (a + i) * (a + b) + (a * a + b * b + b - a) / 2;\n Console.WriteLine(kq.Min());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace CF\n{\n public static class FromConsole\n {\n public static T To(this string input) where T : IConvertible\n {\n return (T)Convert.ChangeType(input, typeof(T));\n }\n\n public static T[] ToArrayOf(this string input, char? delimiter = null) where T : IConvertible\n {\n IEnumerable sequence = delimiter == null ? input.Select(x => x.ToString()) : input.Split(delimiter.Value);\n\n return sequence.Select(x => x.ToString().To()).ToArray();\n }\n\n public static T[] ToArrayOf(int count) where T : IConvertible\n {\n T[] output = new T[count];\n\n for (int i = 0; i < count; i++)\n {\n output[i] = Console.ReadLine().To();\n }\n\n return output;\n }\n\n public static T[] ToArrayOf(T value, int count)\n {\n return Enumerable.Repeat(value, count).ToArray();\n }\n\n public static T[][] ToMatrixOf(int n, char? delimiter = null) where T : IConvertible\n {\n T[][] output = new T[n][];\n\n for (int i = 0; i < n; i++)\n {\n output[i] = Console.ReadLine().ToArrayOf(delimiter);\n }\n\n return output;\n }\n\n public static T[][] ToMatrixOf(T value, int n, int m)\n {\n T[][] output = new T[n][];\n\n for (int i = 0; i < n; i++)\n {\n output[i] = ToArrayOf(value, m);\n }\n\n return output;\n }\n\n public static Tuple IndexOf(this T[][] input, params T[] targets)\n {\n for (int i = 0; i < input.Length; i++)\n {\n for (int j = 0; j < input[0].Length; j++)\n {\n if (targets.Any(x => x.Equals(input[i][j])))\n {\n return new Tuple(i, j);\n }\n }\n }\n\n return new Tuple(-1, -1);\n }\n\n public static void AddToList(this Dictionary> input, T k, U v)\n {\n if (input.ContainsKey(k))\n {\n input[k].Add(v);\n }\n else\n {\n input.Add(k, new List() { v });\n }\n }\n\n public static void AddAndIncrement(this Dictionary input, T k)\n {\n if (input.ContainsKey(k))\n {\n input[k]++;\n }\n else\n {\n input.Add(k, 1);\n }\n }\n\n public static string ToBinary(this long input)\n {\n return Convert.ToString(input, 2);\n }\n\n public static long ToDecimal(this string input)\n {\n return Convert.ToInt32(input, 2);\n }\n\n public static long Binomial(long n, long k)\n {\n long r = 1;\n long d;\n if (k > n) return 0;\n for (d = 1; d <= k; d++)\n {\n r *= n--;\n r /= d;\n }\n return r;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n int l = Console.ReadLine().To();\n int r = Console.ReadLine().To();\n\n int mid = (int)Math.Floor((l + r) / 2d);\n int leftSteps = mid - l;\n int rightSteps = r - mid;\n\n int leftScore = 0;\n for (int i = 1; i <= leftSteps; i++)\n {\n leftScore += i;\n }\n int rightScore = 0;\n for (int i = 1; i <= rightSteps; i++)\n {\n rightScore += i;\n }\n\n Console.WriteLine(leftScore + rightScore);\n //Console.ReadKey();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CS_5890\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Hello World!\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = int.Parse(Console.ReadLine());\n int c2 = int.Parse(Console.ReadLine());\n int rez = 0, a= Math.Abs(c2-c1);\n if (a<=2)\n rez = a;\n else\n {\n for (int i = 1; i <= a/2; i++)\n {\n rez += i;\n }\n rez *= 2;\n if (a % 10 != 0)\n rez += a / 2 + 1;\n\n }\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\n\nclass Program\n{\n static void Main()\n {\n var a = int.Parse(ReadLine());\n var b = int.Parse(ReadLine());\n var d = Math.Abs(b - a);\n WriteLine(d / 2 % 2 != 0 ? d / 2 * (d / 2 + 1) : (d / 2 ) * (d / 2 + 1) + d / 2 + 1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n { \n static void Main(string[] args)\n { \n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n \n int diff = Math.Abs(a-b);\n \n int ans = 0;\n \n if(diff%2==0){\n int h = diff/2;\n ans = h*(1+h)/2;\n ans = ans * 2;\n }else{\n int h1 = (diff+1)/2;\n int h2 = (diff-1)/2;\n \n int a1 = h1*(1+h1)/2;\n int a2 = h2*(1+2)/2;\n \n ans = a2 + a1;\n }\n \n Console.WriteLine(ans);\n }\n \n }\n}"}], "src_uid": "d3f2c6886ed104d7baba8dd7b70058da"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces174DIV2A\n{\n class CowsAndPrimitiveRoots\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int counter = 0; bool isgood = true; int cur = 1;\n for (int x = 1; x < p; x++)\n {\n for (int i = 1; i <= p - 2; i++)\n {\n cur = cur * x;\n if ((cur %= p) == 1) { isgood = false; break; }\n }\n if (isgood && ((cur*x) % p == 1)) counter++;\n isgood = true; cur = 1;\n }\n Console.WriteLine(counter);\n Console.Read();\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CP_CS\n{\n\n class Task\n {\n\n static void Solve()\n {\n int n = ReadInt();\n Write(phi(phi(n)));\n }\n\n public static int phi(int n)\n {\n int result = n;\n for (int i = 2; i * i <= n; ++i)\n if (n % i == 0)\n {\n while (n % i == 0)\n n /= i;\n result -= result / i;\n }\n if (n > 1)\n result -= result / n;\n return result;\n }\n\n public static bool IsPrime(int number)\n {\n if (number < 2) return false;\n if (number % 2 == 0) return (number == 2);\n int root = (int)Math.Sqrt((double)number);\n for (int i = 3; i <= root; i += 2)\n {\n if (number % i == 0) return false;\n }\n return true;\n }\n\n public static double Rast(int[] xy1, int[] xy2)\n {\n return Math.Sqrt(Math.Pow(xy1[0] - xy2[0], 2) + Math.Pow(xy1[1] - xy2[1], 2));\n }\n\n static string[] Split(string str, int chunkSize)\n {\n return Enumerable.Range(0, str.Length / chunkSize)\n .Select(i => str.Substring(i * chunkSize, chunkSize)).ToArray();\n }\n\n #region -- Main -- \n\n private static TextReader reader;\n private static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"pluses.in\");\n //writer = new StreamWriter(\"pluses.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n #region -- Read / Write --\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadAndSplitLine(char divisor)\n {\n return reader.ReadLine().Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n //public static BigInteger ReadBigInteger()\n //{\n // return BigInteger.Parse(ReadToken());\n //}\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static bool[] ReadBoolArray()\n {\n return ReadAndSplitLine().ToString().ToCharArray().Select(chr => chr == '1').ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static bool[][] ReadBoolMatrix(int numberOfRows)\n {\n bool[][] matrix = new bool[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadBoolArray();\n return matrix;\n }\n\n public static bool[][] TransposeBoolMatrix(bool[][] array, int numberOfRows)\n {\n bool[][] matrix = array;\n bool[][] ret = new bool[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new bool[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion\n }\n}\n"}, {"source_code": "using System; \n\nclass P { \n static void Main() { \n var p = int.Parse(Console.ReadLine());\n var n = 0;\n for (var x = 1 ; x < p ; x++) {\n var al = x ;\n var an = 1;\n while (an <= p - 1 && al % p != 1) { \n an++;\n al = (al*x) % p;\n }\n if (an == p - 1) n++;\n }\n Console.WriteLine(n);\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Cows_and_Primitive_Roots\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int p = Next();\n\n int count = 0;\n\n for (int i = 1; i < p; i++)\n {\n int k = 1;\n for (int j = 1; j < p; j++)\n {\n k = (k*i)%p;\n if (k == 1)\n {\n if (j == p - 1)\n {\n count++;\n }\n break;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int p = Next();\n int ans = 0;\n for (int i = 1; i < p; i++) {\n int q = 1;\n bool good = true;\n for (int j = 1; j < p - 1 && good; j++) {\n q = q * i;\n q %= p;\n if (q == 1)\n good = false;\n }\n if (!good)\n continue;\n q *= i;\n q %= p;\n if (q == 1)\n ans++;\n }\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var p = int.Parse(Console.ReadLine());\n var cur = 0;\n foreach (var x in Enumerable.Range(1, p))\n {\n var a = x;\n var b = 1;\n while (b <= p - 1 && a % p != 1)\n {\n b++;\n a = (a * x) % p;\n }\n if (b == p - 1) cur++;\n }\n Console.WriteLine(cur);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tint p = int.Parse(Console.ReadLine());\n\t\tint x = 1, c = 0;\n\t\twhile(x < p){\n\t\t\tint powx = x;\n\t\t\tbool successful = true;\n\t\t\tfor(int i = 1; i <= p - 2; i++){\n\t\t\t\tif(powx % p == 1){\n\t\t\t\t\tsuccessful = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpowx %= p;\n\t\t\t\tpowx *= x;\n\t\t\t}\n\t\t\tif(successful){\n\t\t\t\tif(powx % p == 1)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t\tx++;\n\t\t}\n\t\tConsole.WriteLine(c);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar p = cin.NextInt();\n\t\t\tvar count = 0;\n\t\t\tfor (var i = 1; i < p; i++)\n\t\t\t{\n\t\t\t\tvar x = 1;\n\t\t\t\tvar isOk = true;\n\t\t\t\tfor (var j = 0; j < p - 2; j++)\n\t\t\t\t{\n\t\t\t\t\tx = (x*i)%p;\n\t\t\t\t\tif (x % p == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tisOk = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isOk)\n\t\t\t\t{\n\t\t\t\t\tx = (x*i)%p;\n\t\t\t\t\tif (x % p != 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tisOk = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isOk)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main( string[] args ) {\n int p = ReadInt();\n int count = 0;\n if ( p == 2 )\n count = 1;\n else\n for ( int x = 2; x < p; x++ ) {\n int xp = x;\n int k;\n for ( k = 1; k <= p - 2; k++ ) {\n if ( xp == 1 )\n break;\n xp = ( xp * x ) % p;\n }\n if ( k == p - 1 && xp == 1 )\n count++;\n\n }\n\n Console.Write( count );\n }\n\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt() {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split( new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries );\n _current = 0;\n }\n\n int value = int.Parse( _words[ _current ] );\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x;\n long p = int.Parse(Console.ReadLine());\n int index = 0, max = 0;\n for (int i = 1; i < p; i++)\n {\n x = i; index = 0;\n if (x % p != 1)\n index++;\n for (int j = 2; j < p - 1; j++)\n {\n x = (x * i) % p;\n if (x != 1)\n {\n index++;\n }\n else\n {\n index = 0;\n break;\n }\n }\n if (index == p - 2)\n if ((x*i % p) == 1)\n max++;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Cows_and_Primitive_Roots\n{\n class Program\n {\n static void Main(string[] args)\n {\n int p = short.Parse(Console.ReadLine());\n int count = 0;\n for (int n = 1; n < p; ++n)\n {\n bool ok = true;\n int x = 1;\n for (int i = 1; i < p - 1; ++i)\n {\n x *= n;\n x %= p;\n if (x == 1)\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n x *= n;\n x %= p;\n if (x == 1)\n {\n count += 1;\n }\n }\n }\n Console.WriteLine(count); \n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace olimp\n{\n class Program\n { \n private static int[] ReadLineInArray()\n {\n return (from str in Console.ReadLine().Split(' ', '\\t') select int.Parse(str)).ToArray();\n }\n\n private static string StringUpper(string str, params int[] who)\n {\n char[] ch = str.ToCharArray();\n\n foreach (var i in who)\n {\n if (i < ch.Length)\n ch[i] = char.ToUpper(ch[i]);\n }\n\n return new string(ch);\n }\n\n static int Euler(int n)\n {\n int result = n;\n for (int i = 2; i * i <= n; ++i)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n n /= i;\n result -= result / i;\n }\n }\n if (n > 1)\n result -= result / n;\n return result;\n }\n\n private static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int rez = 0;\n\n for (int i = 0; i < p; i++)\n {\n \n }\n\n Console.WriteLine(Euler(Euler(p))); \n }\n }\n}\n "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n {\n long x = long.Parse(Console.ReadLine()) -1;\n\n int ans = totient((int)x);\n Console.WriteLine(ans);\n }\n\n static int totient(int n)\n {\n int i, ans = n;\n\n for (i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n ans -= ans / i;\n\n while (n % i == 0)\n n /= i;\n }\n\n if (n != 1)\n ans -= ans / n;\n return ans;\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R174_Div2_A\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int cnt = 0;\n long num;\n for (long x = 1; x < p; x++)\n {\n num = 1;\n bool good = true;\n for (int j = 1; j <= p - 2; j++)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n {\n good = false;\n break;\n }\n }\n if (good)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n cnt++;\n }\n }\n \n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int p;\n int cnt = 0;\n\n p = Convert.ToInt32(Console.ReadLine());\n\n for (int j = 1; j < p; j++)\n {\n int t = j;\n if (check(p, t)) cnt++;\n }\n\n Console.WriteLine(cnt);\n }\n\n static bool check(int p, int k)\n {\n int t = 1;\n for (int i = 1; i <= p - 2; i++)\n {\n t *= k;\n\n if (t % p == 1)\n return false;\n\n t %= p;\n }\n if ((t * k) % p == 1)\n return true;\n\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace p2\n{\n class Program\n {\n public static void Main(string[] args)\n { int p,x=0,a;\n p=Convert.ToInt32(Console.ReadLine());\n for(int i=1; i 0)\n res = res * x % mod;\n }\n\n return res;\n }\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n \n int cnt = 0;\n for (int x = 1; x < n; x++)\n {\n bool tf = true;\n if (PowMod(x, n - 1, n) != 1)\n tf = false;\n if (tf)\n {\n for (int p = 1; p < n - 1; p++)\n {\n if (PowMod(x, p, n) == 1)\n {\n tf = false;\n break;\n }\n }\n }\n \n\n if (tf)\n ++cnt;\n }\n\n Console.WriteLine(cnt);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace olimp\n{\n class Program\n { \n private static int[] ReadLineInArray()\n {\n return (from str in Console.ReadLine().Split(' ', '\\t') select int.Parse(str)).ToArray();\n }\n\n private static string StringUpper(string str, params int[] who)\n {\n char[] ch = str.ToCharArray();\n\n foreach (var i in who)\n {\n if (i < ch.Length)\n ch[i] = char.ToUpper(ch[i]);\n }\n\n return new string(ch);\n }\n\n static int Euler(int n)\n {\n int result = n;\n for (int i = 2; i * i <= n; ++i)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n n /= i;\n result -= result / i;\n }\n }\n if (n > 1)\n result -= result / n;\n return result;\n }\n\n private static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int rez = 0;\n\n for (int i = 0; i < p; i++)\n {\n \n }\n\n Console.WriteLine(Euler(Euler(p)));\n // Console.ReadLine(); \n }\n }\n}\n "}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n static void Main(string[] args)\n {\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int p = int.Parse(Console.ReadLine());\n int ans = 0;\n if (p == 2)\n {\n Console.WriteLine(1);\n return;\n }\n for (int x = 1; x < p; x++)\n {\n int r = x % p;\n if (r - 1 == 0) continue;\n bool isOkay = true;\n int cur = r;\n for (int i = 2; i <= p - 2; i++)\n {\n cur *= r;\n cur %= p;\n if (cur - 1 == 0)\n {\n isOkay = false;\n break;\n }\n }\n if (isOkay)\n {\n cur *= r;\n cur %= p;\n if (cur - 1 == 0)\n ans++;\n }\n }\n\n Console.WriteLine(ans);\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n}\n\nstatic class ArrayUtils\n{\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n \n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n}"}, {"source_code": "using System;\n\nnamespace A\n{\n class Program\n {\n private static int Euler(int p)\n {\n int result = p;\n\n for (int i = 2; i * i <= p; i++)\n {\n if (p % i == 0)\n {\n while (p % i == 0)\n {\n p /= i;\n }\n result -= result / i;\n }\n }\n if (p > 1)\n {\n result -= result / p;\n }\n\n return result;\n }\n\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n\n Console.WriteLine(Euler(Euler(p)));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces174_A\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n Console.WriteLine(Eiler(Eiler(p)));\n }\n\n private static int Eiler(int n)\n {\n if (n == 1) return 1;\n int upperBound = (int) Math.Sqrt(n) + 1;\n Dictionary canonical_rep = new Dictionary();\n for (int i = 2; i <= n; i++)\n while (n%i == 0 && n != 1)\n {\n if (canonical_rep.ContainsKey(i)) canonical_rep[i]++;\n else\n canonical_rep.Add(i, 1);\n n /= i;\n }\n int result = 1;\n foreach (var divisor in canonical_rep)\n {\n result *= (int) Math.Pow(divisor.Key, divisor.Value) - (int) Math.Pow(divisor.Key, divisor.Value - 1);\n }\n return result;\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System; \n\nclass P { \n static void Main() { \n var p = int.Parse(Console.ReadLine());\n var n = 0;\n for (var x = 1 ; x < p ; x++) {\n var al = x - 1;\n var an = 1;\n while (an <= p - 1 && al % p != 0) { \n an++;\n al = (al*x - x + 1 + p) % p;\n }\n if (an == p - 1) n++;\n }\n Console.WriteLine(n);\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n private static readonly int[] primesArray = GeneratePrimes(2000).ToArray();\n private static readonly HashSet primes = new HashSet(primesArray);\n public static IEnumerable GeneratePrimes(int max)\n {\n var numbers = Enumerable.Range(2, max - 1).ToDictionary(n => n, n => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!numbers[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n numbers[j] = false;\n }\n }\n\n return numbers.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var p = int.Parse(Console.ReadLine());\n Console.WriteLine(primes.Count(d => d < p));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n public static IEnumerable GeneratePrimes(int max)\n {\n var numbers = Enumerable.Range(2, max - 1).ToDictionary(n => n, n => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!numbers[i])\n {\n continue;\n }\n for (var j = 2 * i; j <= max; j += i)\n {\n numbers[j] = false;\n }\n }\n return numbers.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var p = int.Parse(Console.ReadLine());\n var primes = GeneratePrimes(p + 1).ToArray();\n Console.WriteLine(Array.IndexOf(primes, p));\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tint p = int.Parse(Console.ReadLine());\n\t\tint x = 1, c = 0;\n\t\twhile(x < p){\n\t\t\tint powx = x;\n\t\t\tbool successful = true;\n\t\t\tfor(int i = 1; i <= p - 2; i++){\n\t\t\t\tif((powx - 1) % p == 0){\n\t\t\t\t\tsuccessful = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpowx *= x;\n\t\t\t}\n\t\t\tif(successful){\n\t\t\t\tif((powx - 1) % p == 0)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t\tx++;\n\t\t}\n\t\tConsole.WriteLine(c);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar p = cin.NextInt();\n\t\t\tvar primes = new List();\n\t\t\tprimes.Add(2);\n\t\t\tprimes.Add(3);\n\t\t\tfor (var i = 5; i < 4010; i += 2)\n\t\t\t{\n\t\t\t\tif (!primes.Any(x => i % x == 0))\n\t\t\t\t{\n\t\t\t\t\tprimes.Add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i = 0; i < primes.Count; i++)\n\t\t\t{\n\t\t\t\tif (primes[i] == p)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main( string[] args ) {\n int p = ReadInt();\n int count = 0;\n for ( int x = 1; x < p; x++ ) {\n long re = 0;\n long xp = 1;\n int k;\n for ( k = 0; k <= p - 3; k++ ) {\n xp %= p;\n re += xp;\n xp *= x;\n if ( re % p == 0 )\n break;\n }\n\n if ( k == p - 2 ) {\n xp %= p;\n re += xp;\n if ( re % p == 0 )\n count++;\n }\n\n }\n\n Console.Write( count );\n }\n\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt() {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split( new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries );\n _current = 0;\n }\n\n int value = int.Parse( _words[ _current ] );\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main( string[] args ) {\n int p = ReadInt();\n int count = 0;\n if ( p != 2 )\n for ( int x = 1; x < p; x++ ) {\n long xp = x;\n for ( int k = 1; k <= p - 1; k++ ) {\n if ( xp % p == 1 ) {\n if ( k == p - 1 )\n count++;\n else\n break;\n }\n xp = ( xp * x ) % p;\n }\n }\n\n Console.Write( count );\n }\n\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt() {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split( new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries );\n _current = 0;\n }\n\n int value = int.Parse( _words[ _current ] );\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n double x;\n double p = int.Parse(Console.ReadLine());\n int index = 0, max = 0;\n for (int i = 1; i < p; i++)\n {\n x = i; index = 0;\n for (int j = 1; j < p - 1; j++)\n {\n if (((Math.Pow(x, j) - 1) % p) != 0)\n index++;\n else\n {\n index = 0;\n continue;\n }\n }\n if (index == p - 2)\n if (((Math.Pow(x, p - 1) - 1) % p) == 0)\n max++;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n double x;\n double p = int.Parse(Console.ReadLine());\n int index = 0, max = 0;\n for (int i = 1; i <= p; i++)\n {\n x = i; index = 0;\n for (int j = 1; j < p - 1; j++)\n {\n if (((Math.Pow(x, j) - 1) % p) != 0)\n index++;\n else\n {\n index = 0;\n continue;\n }\n }\n if (index == p - 2)\n if (((Math.Pow(x, p - 1) - 1) % p) == 0)\n max++;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Cows_and_Primitive_Roots\n{\n class Program\n {\n static void Main(string[] args)\n {\n short n = short.Parse(Console.ReadLine());\n short ans = 0;\n for (int i = 2; i < n; i++)\n {\n if (IsPrime(i))\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n public static bool IsPrime(int number)\n {\n if (number <= 1) return false;\n if (number == 2) return true;\n if (number % 2 == 0) return false;\n\n var boundary = (int)Math.Floor(Math.Sqrt(number));\n\n for (int i = 3; i <= boundary; i += 2)\n if (number % i == 0)\n return false;\n\n return true;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R174_Div2_A\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int cnt = 0;\n long num;\n //Never x=1\n for (long x = 2; x < p; x++)\n {\n num = 1;\n bool good = true;\n for (int j = 1; j <= p - 2; j++)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n {\n good = false;\n break;\n }\n }\n if (good)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n cnt++;\n }\n }\n \n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R174_Div2_A\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int cnt = 0, num;\n for (int x = 1; x < p; x++)\n {\n num = 1;\n bool good = true;\n for (int j = 1; j <= p - 2; j++)\n {\n num *= x;\n if ((num - 1) % p == 0)\n {\n good = false;\n break;\n }\n }\n if (good && ((num * x) - 1) % p == 0)\n cnt++;\n } \n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R174_Div2_A\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int cnt = 0;\n long num;\n //Never x=1\n for (int x = 2; x < p; x++)\n {\n num = 1;\n bool good = true;\n for (int j = 1; j <= p - 2; j++)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n {\n good = false;\n break;\n }\n }\n if (good)\n {\n num *= x;\n num = num % p;\n if (num == 1)\n cnt++;\n }\n }\n \n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R174_Div2_A\n {\n static void Main(string[] args)\n {\n int p = int.Parse(Console.ReadLine());\n int cnt = 0, num;\n if (p > 2)\n {\n for (int x = 1; x < p; x++)\n {\n num = 1;\n bool good = true;\n for (int j = 1; j <= p - 2; j++)\n {\n num *= x;\n if ((num - 1) % p == 0)\n {\n good = false;\n break;\n }\n }\n if (good && ((num * x) - 1) % p == 0)\n cnt++;\n }\n }\n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace p2\n{\n class Program\n {\n public static void Main(string[] args)\n { double ost,p,x=1; int s=0;\n p=Convert.ToDouble(Console.ReadLine());\n for (int i = 1; i > 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n}"}], "src_uid": "3bed682b6813f1ddb54410218c233cff"} {"source_code": "\ufeffusing System.Xml;\r\nusing System.ComponentModel.Design;\r\nusing System.Security.AccessControl;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System;\r\n\r\nnamespace CodeForce\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n var rows = Int32.Parse(arr[0]);\r\n var cols = Int32.Parse(arr[1]);\r\n Console.WriteLine(GetCount(rows,cols));\r\n \r\n } \r\n\r\n\r\n\r\n private static long GetCount(int rows, int cols)\r\n {\r\n if(rows == 1)\r\n {\r\n return 1;\r\n }\r\n var res = 1L;\r\n var maxPows = new int[rows+1];\r\n var cntArr = GetCntArr(cols);\r\n for(var i = 2;i <= rows;i++)\r\n {\r\n var tmp = i;\r\n for(var j=2;j();\r\n for(var i =1;i<=rows;i++)\r\n {\r\n var tmp = 1;\r\n for(var j=1;j<=cols;j++)\r\n {\r\n tmp*=i;\r\n set.Add(tmp);\r\n }\r\n }\r\n return set.Count;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n }\r\n}\r\n", "positive_code": [{"source_code": "// Online C# Editor for free\r\n// Write, Edit and Run your C# code using C# Online Compiler\r\n \r\nusing System;\r\n\r\npublic class HelloWorld\r\n{\r\n public static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n \r\n int rows = Int32.Parse(arr[0]);\r\n int columns = Int32.Parse(arr[1]);\r\n //Console.WriteLine(rows);\r\n // Console.WriteLine(columns);\r\n Console.WriteLine(getUniqueNumbers(rows,columns)); \r\n }\r\n \r\n public static int[] precalculate(int m){\r\n var cnt = new int[21];\r\n var vis = new bool[20000002];\r\n int c=0;\r\n for(int i=1;i<=20;++i){\r\n for(int j=1;j<=m;++j){\r\n if(!vis[i*j]){\r\n vis[i*j]=true;\r\n ++c;\r\n }\r\n }\r\n cnt[i]=c;\r\n }\r\n \r\n return cnt;\r\n }\r\n \r\n public static long getUniqueNumbers(int rows, int columns){\r\n var arr = precalculate(columns);\r\n \r\n long res=1;\r\n var vis = new bool[20000002];\r\n \r\n for(int i=2;i<=rows;++i){\r\n if(vis[i])continue;\r\n long j=i;\r\n int c=0;\r\n \r\n while(j<=(long)rows){\r\n vis[j]=true;\r\n j*=i;\r\n ++c;\r\n }\r\n \r\n res+= arr[c];\r\n }\r\n \r\n return res;\r\n }\r\n \r\n}"}, {"source_code": "\ufeffusing System.Xml;\r\nusing System.ComponentModel.Design;\r\nusing System.Security.AccessControl;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System;\r\n\r\nnamespace CodeForce\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n var rows = Int32.Parse(arr[0]);\r\n var cols = Int32.Parse(arr[1]);\r\n Console.WriteLine(GetCount(rows,cols));\r\n } \r\n\r\n\r\n\r\n private static long GetCount(int rows, int cols)\r\n {\r\n if(rows == 1)\r\n {\r\n return 1;\r\n }\r\n var res = 1L;\r\n var maxPows = new int[rows+1];\r\n var cntArr = GetCntArr(cols);\r\n for(var i = 2;i <= rows;i++)\r\n {\r\n var tmp = i;\r\n for(var j=2;j();\r\n for(var i =1;i<=rows;i++)\r\n {\r\n var tmp = 1;\r\n for(var j=1;j<=cols;j++)\r\n {\r\n tmp*=i;\r\n set.Add(tmp);\r\n }\r\n }\r\n return set.Count;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n }\r\n}\r\n"}], "negative_code": [{"source_code": "\ufeffusing System.Xml;\r\nusing System.ComponentModel.Design;\r\nusing System.Security.AccessControl;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System;\r\n\r\nnamespace CodeForce\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n var rows = Int32.Parse(arr[0]);\r\n var cols = Int32.Parse(arr[1]);\r\n Console.WriteLine(GetCount(rows,cols));\r\n } \r\n\r\n\r\n\r\n private static long GetCount(int rows, int cols)\r\n {\r\n if(rows == 1)\r\n {\r\n return 1;\r\n }\r\n var res = 1L;\r\n var maxPows = new int[rows+1];\r\n var cntArr = GetCntArr(cols);\r\n for(var i = 2;i <= rows;i++)\r\n {\r\n var tmp = i;\r\n for(var j=2;j();\r\n for(var i =1;i<=rows;i++)\r\n {\r\n var tmp = 1;\r\n for(var j=1;j<=cols;j++)\r\n {\r\n tmp*=i;\r\n set.Add(tmp);\r\n }\r\n }\r\n return set.Count;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n }\r\n}\r\n"}, {"source_code": "\ufeffusing System.Xml;\r\nusing System.ComponentModel.Design;\r\nusing System.Security.AccessControl;\r\nusing System.Globalization;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System;\r\n\r\nnamespace CodeForce\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var arr = Console.ReadLine().Split(' ');\r\n var rows = Int32.Parse(arr[0]);\r\n var cols = Int32.Parse(arr[1]);\r\n Console.WriteLine(GetCount(rows,cols));\r\n } \r\n\r\n\r\n\r\n private static long GetCount(int rows, int cols)\r\n {\r\n if(rows == 1)\r\n {\r\n return 1;\r\n }\r\n var res = 1L;\r\n var maxPows = new int[rows+1];\r\n var cntArr = GetCntArr(cols);\r\n for(var i = 2;i <= rows;i++)\r\n {\r\n var tmp = i;\r\n for(var j=2;j();\r\n for(var i =1;i<=rows;i++)\r\n {\r\n var tmp = 1;\r\n for(var j=1;j<=cols;j++)\r\n {\r\n tmp*=i;\r\n set.Add(tmp);\r\n }\r\n }\r\n return set.Count;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n\r\n }\r\n}\r\n"}], "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead"} {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A411{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n char[] pass = Console.ReadLine().ToCharArray();\n\n int upperCase = 0;\n int lowerCase = 0;\n int numChar = 0;\n\n foreach (char c in pass)\n {\n if (c >= 'a' && c <= 'z') lowerCase++;\n else if (c >= 'A' && c <= 'Z') upperCase++;\n else if(c >= '0' && c <= '9' ) numChar++;\n }\n\n if (pass.Length >= 5 &&\n lowerCase >= 1 &&\n upperCase >= 1 &&\n numChar >= 1) Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too weak\");\n\t\t}\n\t}\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n\n class Interval : IComparable\n {\n public int left;\n public int right;\n\n public Interval(int l, int r)\n {\n left = l;\n right = r;\n }\n\n public int CompareTo(Interval interval)\n {\n return this.left - interval.left;\n }\n\n }\n\n\n static void Main(string[] args)\n {\n string s = ReadLine();\n\n if (s.Length < 5)\n {\n PrintLn(\"Too weak\");\n return;\n }\n\n bool hasDig = false;\n bool hasUp = false;\n bool hasLow = false;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= '0' && s[i] <= '9')\n hasDig = true;\n if (s[i] >= 'a' && s[i] <= 'z')\n hasLow = true;\n if (s[i] >= 'A' && s[i] <= 'Z')\n hasUp = true;\n }\n\n\n if (hasLow && hasUp && hasDig)\n PrintLn(\"Correct\");\n else\n PrintLn(\"Too weak\");\n\n }\n\n\n\n\n }\n\n\n}"}, {"source_code": "using System;\n\n class Program\n {\n static void Main()\n {\n bool rule1 = false, rule2 = false, rule3 = false;\n string str = Console.ReadLine();\n foreach (char chr in str)\n {\n if (rule1 | chr >= '0' && chr <= '9') rule1=true;\n if (rule2 | chr >= 'a' && chr <= 'z') rule2 = true;\n if (rule3 | chr >= 'A' && chr <= 'Z') rule3 = true;\n }\n string Result = (rule1 & rule2 & rule3&(str.Length>=5)) ? \"Correct\" : \"Too weak\";\n Console.WriteLine(Result);\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace test\n{\n class Program\n {\n static void Main()\n {\n bool flag1 = false, flag2 = false, flag3 = false;//1 - \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u0443\u043a\u0432\u0430, 2 - \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0431\u0443\u043a\u0432\u0430, 3 - \u0426\u0438\u0444\u0440\u0430.\n string pass = Console.ReadLine();\n for (int i = 0; i < pass.Length; i++)\n {\n if (pass[i] >= 65 && pass[i] <= 90 && !flag1)\n flag1 = true;\n if (pass[i] >= 97 && pass[i] <= 122 && !flag2)\n flag2 = true;\n if (Char.IsDigit(pass[i]) && !flag3)\n flag3 = true;\n }\n if (flag1 && flag2 && flag3 && pass.Length >= 5)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n\n static void Main(string[] args)\n {\n bool hasDigit = false;\n bool hasUpCase = false;\n bool hasLowCase = false;\n string pwd = Console.ReadLine();\n if (pwd.Length >= 5)\n {\n for (var i = 0; i < pwd.Length; i++)\n {\n if (Char.IsDigit(pwd[i]))\n {\n hasDigit = true;\n\n }\n if (Char.IsUpper(pwd[i]))\n {\n hasUpCase = true;\n }\n if (char.IsLower(pwd[i]))\n {\n hasLowCase = true;\n }\n\n }\n if (hasLowCase && hasUpCase && hasDigit)\n {\n Console.WriteLine(\"Correct\");\n \n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n // Console.ReadKey();\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace PasswordCheck\n{\n partial class PasswordCheck\n {\n static void Main(string[] args)\n {\n string password, digits, alphabets;\n bool weak = true;\n\n digits = \"0123456789\";\n alphabets = \"abcdefghijklmnopqrstuvwxyz\";\n password = ReadLine();\n\n if (password.Length >= 5 && HasValue(password, digits) && HasValue(password, alphabets) && HasValue(password, alphabets.ToUpper()))\n weak = false;\n\n\n if (weak)\n Console.WriteLine(\"Too weak\");\n else\n Console.WriteLine(\"Correct\");\n }\n\n private static bool HasValue(string password, string characters)\n {\n foreach (char letter in password)\n foreach (char ch in characters)\n if (letter == ch)\n return true;\n\n return false;\n }\n }\n\n partial class PasswordCheck\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n\nnamespace Algorithm\n{\n class Solver\n {\n public void Run()\n {\n string s = cin.ReadLine();\n int upper = 0, lower = 0, digit = 0, longer = 0;\n if (s.Length > 4) longer = 1;\n foreach (var c in s)\n {\n if (c >= 'A' && c <= 'Z') upper = 1;\n if (c >= 'a' && c <= 'z') lower = 1;\n if (c >= '0' && c <= '9') digit = 1;\n }\n if (upper + lower + digit + longer == 4)\n cout.WriteLine(\"Correct\");\n else\n cout.WriteLine(\"Too weak\");\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n Solver task = new Solver();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text.RegularExpressions;\n\nnamespace Password_Check\n{\n class Program\n {\n static void Main(string[] args)\n {\n var password = Console.ReadLine();\n bool match = Regex.IsMatch(password, @\"^(?=(.*\\d){1})(?=.*[a-z])(?=.*[A-Z]).{5,}$\");\n Console.WriteLine(match ? \"Correct\" : \"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace AcmSolution\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n#if !ACM_HOME\n Do();\n#else\n var tmp = Console.In;\n //Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n Console.WriteLine(Console.ReadLine());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n#endif\n Console.ReadLine();\n }\n\n \n private static void Do()\n {\n var s = new List(Console.ReadLine().ToCharArray());\n\n bool good = s.Count >= 5 && s.Any(char.IsLower) && s.Any(char.IsUpper) && s.Any(char.IsDigit);\n\n Console.WriteLine(good ? \"Correct\" : \"Too weak\");\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.00000000000000}\", d).Replace(',', '.'));\n }\n }\n\n class Scanner\n {\n string[] s;\n int i;\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public char nextChar()\n {\n return char.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.Password_Check\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Console.WriteLine(CH(str));\n // Console.ReadKey();\n }\n public static string CH(string str)\n {\n if(str.Length<5)return \"Too weak\";\n bool b1, b2, b3;\n b1 = b2 = b3 = false;\n\n for (int i = 0; i < str.Length && !(b1 && b2 && b3); i++)\n {\n if (str[i] >= '0' && str[i] <= '9') b1=true;\n if (str[i] >= 'a' && str[i] <= 'z') b2=true;\n if (str[i] >= 'A' && str[i] <= 'Z') b3=true;\n }\n if (b1 && b2 && b3) return \"Correct\";\n\n return \"Too weak\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestA\n{\n class Checker\n {\n public static bool CheckPass(string pass)\n {\n // \u041d\u0435 \u043c\u0435\u043d\u0435\u0435 5 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432\n if (pass.Length <= 4)\n return false;\n\n // 1 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u0443\u043a\u0432\u0430\n bool big = false;\n for (int i = 0; i < pass.Length; i++)\n if (pass[i] >= 'A' && pass[i] <= 'Z')\n {\n big = true;\n break;\n }\n\n if (!big)\n return false;\n\n // 1 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0431\u0443\u043a\u0432\u0430\n bool small = false;\n for (int i = 0; i < pass.Length; i++)\n if (pass[i] >= 'a' && pass[i] <= 'z')\n {\n small = true;\n break;\n }\n\n if (!small)\n return false;\n\n // 1 \u0446\u0438\u0444\u0440\u0430\n bool num = false;\n for (int i = 0; i < pass.Length; i++)\n if (pass[i] >= '0' && pass[i] <= '9')\n {\n num = true;\n break;\n }\n\n if (!num)\n return false;\n\n // \u041f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u043e\u0448\u0435\u043b\n return true;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n string pass = Console.ReadLine();\n\n if (Checker.CheckPass(pass))\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nclass Solution\n{\n\n static void Main(string[] args)\n {\n\n string pass = Console.ReadLine();\n\n if (pass.Length >=5 && pass.Any(char.IsUpper) && pass.Any(char.IsLower) && pass.Any(char.IsDigit))\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Console.WriteLine(Regex.IsMatch(str, \".{5,}\") && \n Regex.IsMatch(str, \"[a-z]{1,}\") && \n Regex.IsMatch(str, \"[A-Z]{1,}\") && \n Regex.IsMatch(str, \"[0-9]{1,}\") ? \n \"Correct\" : \n \"Too weak\");\n }\n }\n}"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.In.ReadLine();\n bool[] data = new bool[4];\n data[0] = input.Length > 4;\n for(int i = 0, crr; i 96) data[3] = true;\n else if (crr > 64 && crr < 91) data[2] = true;\n else if (crr > 47 && crr < 58) data[1] = true;\n }\n Console.WriteLine((((data[0]&&data[1])&&data[2])&&data[3])?\"Correct\":\"Too weak\");\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool f = false; bool t = false; bool k = false; bool d = false; bool h = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90) { f = true; break; }\n \n }\n for(int i=0;i= 97 && s[i] <= 'z') { k = true; break; }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= '0' && s[i] <= '9') { h = true; }\n }\n if (s.Length >= 5) { t = true; }\n \n if (f == true && t == true && k == true &&h==true) { Console.WriteLine(\"Correct\"); }\n else Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Qualification_A.Password_Check\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool small = false;\n bool big = false;\n bool digit = false;\n bool sign = false;\n bool over = false;\n if (str.Length <= 100 && str.Length >= 1 && !str.Contains(' '))\n {\n\n\n foreach (char chr in str)\n {\n if (char.IsUpper(chr))\n {\n big = true;\n continue;\n }\n else if (char.IsLower(chr))\n {\n small = true;\n continue;\n }\n else if (char.IsDigit(chr))\n {\n digit = true;\n continue;\n }\n\n else if (chr == '!' || chr == '?' || chr == '.' || chr == ',' || chr == '_')\n {\n sign = true;\n continue;\n }\n else\n {\n\n over = true;\n break;\n\n }\n }\n\n\n if (!over && small && big && digit && str.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n if (!over)\n Console.WriteLine(\"Too weak\");\n }\n\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n Regex r = new Regex(\"[A-Z]\");\n Regex r2 = new Regex(\"[0-9]\");\n Regex r3 = new Regex(\"[a-z]\");\n\n if (line.Length >= 5 && r.IsMatch(line) && r2.IsMatch(line) && r3.IsMatch(line))\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n //Console.ReadLine();\n\n //if (line.Length >= 5 && line)\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ProblemAPasswordCheck\n{\n class Program\n {\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n string abc = \"abcdefghijklmnopqrstuvwxyz\";\n string ABC = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n string numbers = \"0123456789\";\n if (text.Any(x => abc.Contains(x)) && text.Any(x => ABC.Contains(x)) && text.Any(x => numbers.Contains(x)) && text.Length >= 5)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool f = false; bool t = false; bool k = false; bool d = false; bool h = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90) { f = true; break; }\n \n }\n for(int i=0;i= 97 && s[i] <= 'z') { k = true; break; }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= '0' && s[i] <= '9') { h = true; }\n }\n if (s.Length >= 5) { t = true; }\n \n if (f == true && t == true && k == true &&h==true) { Console.WriteLine(\"Correct\"); }\n else Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\nusing System.Threading;\nusing System.Linq;\n \nclass TEST{\n\tstatic void Main(){\n\t\tvar S=Console.ReadLine();\n\t\t\n\t\tbool chk=true;\n\t\t//1\n\t\tif(S.Length<5)chk=false;\n\t\t//2,3,4\n\t\tbool chk2=false;\n\t\tfor(int i=0;i='A' && S[i]<='Z')chk2=true;\n\t\t}\n\t\tchk=chk&chk2;\n\t\tchk2=false;\n\t\tfor(int i=0;i='a' && S[i]<='z')chk2=true;\n\t\t}\n\t\tchk=chk&chk2;\n\t\tchk2=false;\n\t\tfor(int i=0;i='0' && S[i]<='9')chk2=true;\n\t\t}\n\t\tchk=chk&chk2;\n\t\t\n\t\t\n\t\tConsole.WriteLine(chk?\"Correct\":\"Too weak\");\n\t\t\n\t\t\n\t\t\n\t}\n}\n"}, {"source_code": "\ufeff\ufeffnamespace codeforce\n {\n class Program\n {\n public static void Main()\n {\n var t = System.Console.In.ReadLine();\n\n bool res = t.Length >= 5 &&\n t.IndexOfAny(new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }) != -1 &&\n t.IndexOfAny(new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) != -1 &&\n t.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}) != -1;\n\n if (res)\n {\n System.Console.Out.WriteLine(\"Correct\");\n }\n else\n {\n System.Console.Out.WriteLine(\"Too weak\");\n }\n }\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Qualification_A.Password_Check\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool small = false;\n bool big = false;\n bool digit = false;\n bool sign = false;\n bool over = false;\n if (str.Length <= 100 && str.Length >= 1 && !str.Contains(' '))\n {\n\n\n foreach (char chr in str)\n {\n if (char.IsUpper(chr))\n {\n big = true;\n continue;\n }\n else if (char.IsLower(chr))\n {\n small = true;\n continue;\n }\n else if (char.IsDigit(chr))\n {\n digit = true;\n continue;\n }\n\n else if (chr == '!' || chr == '?' || chr == '.' || chr == ',' || chr == '_')\n {\n sign = true;\n continue;\n }\n else\n {\n\n over = true;\n break;\n\n }\n }\n\n\n if (!over && small && big && digit && str.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n if (!over)\n Console.WriteLine(\"Too weak\");\n }\n\n }\n\n }\n }\n}"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace RCC2014\n{\n\tclass QR_A\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tstring s = xoi.ReadLine();\n\t\t\tbool[] valid_test = new bool[3];\n\t\t\tbool ans;\n\n\t\t\tans = (s.Length >= 5);\n\t\t\tif (ans)\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] >= 'A' && s[i] <= 'Z') valid_test[0] = true;\n\t\t\t\t\tif (s[i] >= 'a' && s[i] <= 'z') valid_test[1] = true;\n\t\t\t\t\tif (s[i] >= '0' && s[i] <= '9') valid_test[2] = true;\n\t\t\t\t}\n\t\t\t\tans = valid_test[0] && valid_test[1] && valid_test[2];\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans ? \"Correct\" : \"Too weak\");\n\t\t}\n\t}\n\t\n\tclass RCC2014_QR\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tXOI xoi = new XOI();\n\t\t\t(new QR_A()).Solve(xoi);\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\t\t\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace asdf {\n class Program {\n static void Main(string[] args) {\n string pass = Console.ReadLine();\n bool hasLower = false;\n bool hasUpper = false;\n bool hasDigit = false;\n\n if(pass.Length < 5) {\n Console.WriteLine(\"Too weak\");\n return;\n }\n\n foreach(char i in pass) {\n if(!hasUpper && i >= 'A' && i <= 'Z') {\n hasUpper = true;\n }\n if(!hasLower && i >= 'a' && i <= 'z') {\n hasLower = true;\n }\n if(!hasDigit && i >= '0' && i <= '9') {\n hasDigit = true;\n }\n if(hasDigit && hasLower && hasUpper) {\n Console.WriteLine(\"Correct\");\n return;\n }\n }\n Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430_\u043f\u0430\u0440\u043e\u043b\u044f\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] a = new int[3];\n if (s.Length < 5) Console.WriteLine(\"Too weak\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90) a[0] = 1;\n else\n if (s[i] >= 97 && s[i] <= 122) a[1] = 1;\n else\n if (s[i] >= 48 && s[i] <= 57) a[2] = 1;\n }\n\n bool f = true;\n for (int i = 0; i < 3; i++)\n {\n if (a[i] == 0) { Console.WriteLine(\"Too weak\"); f = false; break; }\n }\n if (f) Console.WriteLine(\"Correct\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string pass = Console.ReadLine();\n\n bool s1 = pass.Length >= 5, s2 = false, s3 = false, s4 = false;\n\n foreach(char c in pass)\n {\n if ((!s3 || !s2) && c.ToString().ToUpper() != c.ToString().ToLower())\n if ((!s3 || !s2) && c.ToString().ToUpper() == c.ToString()\n )\n s2 = true;\n else\n s3 = true;\n\n int t = 0;\n if(int.TryParse(c.ToString(), out t)) s4 = true;\n }\n\n Console.WriteLine(s1 && s2 && s3 && s4 ? \"Correct\" : \"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Password_Check\n{\n internal class Program\n {\n private static readonly StreamReader reader =\n new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n\n private static readonly StreamWriter writer =\n new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string ss = reader.ReadLine();\n\n int d = 0, b = 0, s = 0;\n\n foreach (char c in ss)\n {\n if (c >= '0' && c <= '9')\n d++;\n else if (c >= 'a' && c <= 'z')\n {\n s++;\n }\n else if (c >= 'A' && c <= 'Z')\n {\n b++;\n }\n }\n\n if (ss.Length >= 5 && d > 0 && s > 0 && b > 0)\n writer.WriteLine(\"Correct\");\n else\n {\n writer.WriteLine(\"Too weak\");\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n static string s = string.Empty;\n\n private static void Main(string[] args)\n {\n s = Console.ReadLine();\n\n bool containNumeral = false,\n containLargeLetter = false,\n containSmallLetter = false;\n\n var answer = \"Too weak\";\n\n if (s.Length > 4)\n {\n foreach (var c in s)\n {\n if (c >= '0' && c <= '9')\n containNumeral = true;\n else if (c >= 'a' && c <= 'z')\n containSmallLetter = true;\n else if (c >= 'A' && c <= 'Z')\n containLargeLetter = true;\n\n if (!containLargeLetter || !containSmallLetter || !containNumeral) continue;\n answer = \"Correct\";\n break;\n }\n }\n\n Console.WriteLine(answer);\n \n }\n }\n}"}, {"source_code": "using System;\n \nclass pr\n{\n public static void Main ()\n {\n int ok = 0, ok1 = 0, ok2 = 0, ok3 = 0;\n string s = Console.ReadLine();\n if (s.Length >= 5)\n ok3 = 1;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 'a' && s[i] <= 'z')\n ok = 1;\n if (s[i] >= 'A' && s[i] <= 'Z')\n ok1 = 1;\n if (s[i] >= '0' && s[i] <= '9')\n ok2 = 1;\n } \n if (ok + ok1 + ok2 + ok3 == 4)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n}\n"}, {"source_code": "using System;\n\nnamespace code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string b = Console.ReadLine();\n int sum=0;\n int k=0;\n int j=0;\n if (b.Length < 5)\n Console.WriteLine(\"Too weak\");\n else\n {\n char[] a = b.ToCharArray();\n for(int i=0; i='a' && a[i]<='z')\n {\n sum++;\n }\n if(a[i]>='A' && a[i]<='Z')\n {\n k++;\n }\n if(Char.IsDigit(a[i]))\n {\n j++;\n }\n }\n if (sum > 0 && k > 0 && j > 0)\n {\n Console.WriteLine(\"Correct\");\n }\n else Console.WriteLine(\"Too weak\");\n }\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AlgoSolution\n{\n class CodeForces_Password_Check\n {\n static void Main()\n {\n string pwd = Console.ReadLine().Trim();\n bool lenOk = false;\n bool oneLargeEngLetter = false;\n bool oneSmallEngLetter = false;\n bool oneDigit = false;\n lenOk = pwd.Length >= 5;\n for (int i = 0; i < pwd.Length; i++)\n {\n int asciiCode = (int)pwd[i];\n if (asciiCode >= 97 && asciiCode <= 122)\n oneSmallEngLetter = true;\n if (asciiCode >= 65 && asciiCode <= 90)\n oneLargeEngLetter = true;\n if (asciiCode >= 48 && asciiCode <= 57)\n oneDigit = true;\n }\n if (lenOk && oneLargeEngLetter && oneSmallEngLetter && oneDigit)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n bool x = true;\n bool y = true;\n bool z = true;\n bool zDva = true;\n\n if (str.Length >= 5)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z')\n { x = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= '0' && str[i] <= '9')\n { y = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n { z = false; break; }\n }\n if (x || y || z)\n Console.WriteLine(\"Too weak\");\n else\n Console.WriteLine(\"Correct\");\n }\n else\n Console.WriteLine(\"Too weak\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codegh\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool a=false, b=false, c=false, d = false;\n if (s.Length >= 5)\n {\n b = true;\n }\n foreach(var x in s)\n {\n if (isnumber(x))\n {\n a = true;\n }\n if (isnupper(x))\n {\n c = true;\n }\n if (isdown(x))\n {\n d = true;\n }\n\n\n\n }\n if (a && b && c && d)\n {\n Console.WriteLine(\"Correct\");\n }else\n {\n Console.WriteLine(\"Too weak\");\n }\n // Console.ReadKey();\n }\n static bool isnumber(char s1)\n {\n if ((int)(s1) >= 48 && (int)s1 <= 48 + 9)\n {\n return true;\n }\n return false;\n\n }\n static bool isnupper(char s1)\n {\n if ((int)s1 >= 65 && (int)s1 <= 90)\n {\n return true;\n }\n return false;\n\n }\n static bool isdown(char s1)\n {\n if ((int)s1 >= 97 && (int)s1 <= 122)\n {\n return true;\n }\n return false;\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n //static System.IO.StreamReader reader = new System.IO.StreamReader(@\"c:\\Users\\alessio\\Documents\\B-large.in\");\n //static System.IO.StreamWriter writer = new System.IO.StreamWriter(@\"c:\\Users\\alessio\\Documents\\result.txt\");\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n if (s.Any(e => e >= 'A' && e <= 'Z') && s.Any(e => e >= 'a' && e <= 'z') && s.Any(e => e >= '0' && e <= '9') && s.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n \nclass pr\n{\n public static void Main ()\n {\n int ok = 0, ok1 = 0, ok2 = 0, ok3 = 0;\n string s = Console.ReadLine();\n if (s.Length >= 5)\n ok3 = 1;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 'a' && s[i] <= 'z')\n ok = 1;\n if (s[i] >= 'A' && s[i] <= 'Z')\n ok1 = 1;\n if (s[i] >= '0' && s[i] <= '9')\n ok2 = 1;\n } \n if (ok + ok1 + ok2 + ok3 == 4)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class PasswordCheck {\n public static void Main() {\n var passwordChecker = new AggregateConstraint(\n new PredicateConstraint(s => s.Length >= 5),\n new PredicateConstraint(s => s.Any(char.IsUpper)),\n new PredicateConstraint(s => s.Any(char.IsLower)),\n new PredicateConstraint(s => s.Any(char.IsDigit))\n );\n\n string pw;\n while ( (pw = Console.ReadLine()) != null ) {\n bool result = passwordChecker.Check(pw);\n\n Console.WriteLine(\"{0}\", result ? \"Correct\" : \"Too weak\");\n }\n }\n}\n\npublic interface IPasswordConstraint {\n bool Check(string password);\n}\n\npublic class PredicateConstraint : IPasswordConstraint {\n private readonly Predicate mPredicate;\n \n public PredicateConstraint(Predicate predicate) {\n mPredicate = predicate;\n }\n \n public bool Check(string password) {\n return mPredicate(password);\n }\n}\n\npublic class AggregateConstraint : IPasswordConstraint {\n private readonly IEnumerable mConstraints; \n \n public AggregateConstraint(params IPasswordConstraint[] constraints) {\n mConstraints = constraints;\n }\n \n public bool Check(string password) {\n return mConstraints.All(p => p.Check(password));\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line1 = Console.ReadLine();\n if (line1.Any(char.IsUpper) && line1.Any(char.IsLower) && line1.Any(char.IsDigit) && line1.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n } else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CSharpParser\n{\n public class Solution : SolutionBase\n {\n protected override void Solve()\n {\n string s;\n Next(out s);\n if (s.Length < 5)\n {\n PrintLine(\"Too weak\");\n return;\n }\n bool big, small, digit;\n big = small = digit = false;\n for (var i = 0; i < s.Length; i++)\n {\n big |= s[i] >= 'A' && s[i] <= 'Z';\n small |= s[i] >= 'a' && s[i] <= 'z';\n digit |= s[i] >= '0' && s[i] <= '9';\n }\n PrintLine(big && small && digit ? \"Correct\" : \"Too weak\");\n }\n }\n\n public static class Algorithm\n {\n public static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n public static T Max(params T[] a)\n {\n var ans = a[0];\n var comp = Comparer.Default;\n for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) >= 0 ? ans : a[i];\n return ans;\n }\n\n public static T Min(params T[] a)\n {\n var ans = a[0];\n var comp = Comparer.Default;\n for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) <= 0 ? ans : a[i];\n return ans;\n }\n\n public static void RandomShuffle(T[] a, int index, int length)\n {\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n var rnd = new Random(DateTime.Now.Millisecond);\n for (var i = index + 1; i < last; i++) Swap(ref a[i], ref a[rnd.Next(index, i + 1)]);\n }\n\n public static void RandomShuffle(T[] a)\n {\n RandomShuffle(a, 0, a.Length);\n }\n\n public static bool NextPermutation(T[] a, int index, int length, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n for (var i = last - 1; i > index; i--)\n if (compare(a[i], a[i - 1]) > 0)\n {\n var j = i + 1;\n for (; j < last; j++) if (compare(a[j], a[i - 1]) <= 0) break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, last - i);\n return true;\n }\n Array.Reverse(a, index, length);\n return false;\n }\n\n public static bool NextPermutation(T[] a, Comparison compare = null)\n {\n return NextPermutation(a, 0, a.Length, compare);\n }\n\n public static bool PrevPermutation(T[] a, int index, int length, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n for (var i = last - 1; i > index; i--)\n if (compare(a[i], a[i - 1]) < 0)\n {\n var j = i + 1;\n for (; j < last; j++) if (compare(a[j], a[i - 1]) >= 0) break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, last - i);\n return true;\n }\n Array.Reverse(a, index, length);\n return false;\n }\n\n public static bool PrevPermutation(T[] a, Comparison compare = null)\n {\n return PrevPermutation(a, 0, a.Length, compare);\n }\n\n public static int LowerBound(IList a, int index, int length, T value, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n if (index + length > a.Count) throw new ArgumentException();\n var ans = index;\n var last = index + length;\n var p2 = 1;\n while (p2 <= length) p2 *= 2;\n for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) < 0) ans += p2;\n return ans;\n }\n\n public static int LowerBound(IList a, T value, Comparison compare = null)\n {\n return LowerBound(a, 0, a.Count, value, compare);\n }\n\n public static int UpperBound(IList a, int index, int length, T value, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n if (index + length > a.Count) throw new ArgumentException();\n var ans = index;\n var last = index + length;\n var p2 = 1;\n while (p2 <= length) p2 *= 2;\n for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) <= 0) ans += p2;\n return ans;\n }\n\n public static int UpperBound(IList a, T value, Comparison compare = null)\n {\n return UpperBound(a, 0, a.Count, value, compare);\n }\n }\n\n public class InStream : IDisposable\n {\n protected readonly TextReader InputStream;\n private string[] _tokens;\n private int _pointer;\n\n public InStream(TextReader inputStream)\n {\n InputStream = inputStream;\n }\n\n public InStream(string str)\n {\n InputStream = new StringReader(str);\n }\n\n public static InStream Freopen(string str)\n {\n return new InStream(new StreamReader(str));\n }\n\n public string NextLine()\n {\n try\n {\n return InputStream.ReadLine();\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n private string NextString()\n {\n try\n {\n while (_tokens == null || _pointer >= _tokens.Length)\n {\n _tokens = NextLine().Split(new[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n _pointer = 0;\n }\n return _tokens[_pointer++];\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n public bool Next(out T ans)\n {\n var str = NextString();\n if (str == null)\n {\n ans = default(T);\n return false;\n }\n ans = (T) Convert.ChangeType(str, typeof (T));\n return true;\n }\n\n public void Dispose()\n {\n InputStream.Close();\n }\n }\n\n public class OutStream : IDisposable\n {\n protected readonly TextWriter OutputStream;\n\n public OutStream(TextWriter outputStream)\n {\n OutputStream = outputStream;\n }\n\n public OutStream(StringBuilder strB)\n {\n OutputStream = new StringWriter(strB);\n }\n\n public static OutStream Freopen(string str)\n {\n return new OutStream(new StreamWriter(str));\n }\n\n public void Print(string format, params object[] args)\n {\n OutputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n OutputStream.WriteLine();\n }\n\n public void PrintLine()\n {\n OutputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n OutputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n OutputStream.WriteLine(o);\n }\n\n public void Dispose()\n {\n OutputStream.Close();\n }\n }\n\n public abstract class SolutionBase : IDisposable\n {\n private readonly InStream _in;\n private readonly OutStream _out;\n\n protected SolutionBase()\n {\n //System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n _in = new InStream(Console.In);\n _out = new OutStream(Console.Out);\n }\n\n protected string NextLine()\n {\n return _in.NextLine();\n }\n\n protected bool Next(out T ans)\n {\n return _in.Next(out ans);\n }\n\n protected T[] NextArray(int length)\n {\n var array = new T[length];\n for (var i = 0; i < length; i++)\n if (!_in.Next(out array[i]))\n return null;\n return array;\n }\n\n protected void PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n {\n if (printCount)\n _out.PrintLine(a.Count);\n for (var i = 0; i < a.Count; i++)\n _out.Print(\"{0}{1}\", a[i], i == a.Count - 1 ? after : between);\n }\n\n public void Print(string format, params object[] args)\n {\n _out.Print(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n _out.PrintLine(format, args);\n }\n\n public void PrintLine()\n {\n _out.PrintLine();\n }\n\n public void Print(T o)\n {\n _out.Print(o);\n }\n\n public void PrintLine(T o)\n {\n _out.PrintLine(o);\n }\n\n public void Dispose()\n {\n _out.Dispose();\n }\n\n protected abstract void Solve();\n\n public static void Main()\n {\n using (var p = new Solution()) p.Solve();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\npublic class P\n{\n static void Main()\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Length > 4 && s.Any(char.IsLower) && s.Any(char.IsUpper) && s.Any(char.IsDigit) ? \"Correct\" : \"Too weak\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n public object Solve()\n {\n string s = ReadToken();\n \n return s.Length >= 5 && s.Any(char.IsLower) && s.Any(char.IsUpper) && s.Any(char.IsDigit) ? \"Correct\" : \"Too weak\";\n }\n\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n#endif\n writer = Console.Out;\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n //Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar st = Console.ReadLine();\n\t\t\tRegex rgx1 = new Regex(\"[A-Z]\");\n\t\t\tRegex rgx2 = new Regex(\"[a-z]\");\n\t\t\tRegex rgx3 = new Regex(\"[0-9]\");\n\t\t\tif (st.Length > 4 &&\n\t\t\t rgx1.IsMatch(st) &&\n\t\t\t rgx2.IsMatch(st) &&\n\t\t\t rgx3.IsMatch(st)){\n\t\t\t\tprint(\"Correct\");\n\t\t\t} else {\n\t\t\t\tprint(\"Too weak\");\n\t\t\t}\n\t\t\t\n//\t\t\tread();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpublic static String formatDouble(Double num){\n\t\t\treturn String.Format(\"{0:0.0000000}\",num).Replace(',','.');\n\t\t}\n\t\t\n\t\tpublic static void print(object a){\n\t\t\tConsole.WriteLine(a.ToString());\n\t\t}\n\t\t\n\t\tpublic static void printList(List a){\n\t\t\tforeach (object o in a){\n\t\t\t\tConsole.WriteLine(o.ToString());\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tpublic static void printList(List a){\n\t\t\tString ou = \"\";\n\t\t\tforeach (object o in a){\n\t\t\t\tou += o.ToString();\n\t\t\t}\n\t\t\tConsole.WriteLine(\"List: \" + ou);\n\t\t}\n\t\t\n\t\tpublic static void printListList(List> a){\n\t\t\tString ou = \"\";\n\t\t\tforeach (List o in a){\n\t\t\t\tforeach (int oo in o){\n\t\t\t\t\tou += oo + \" \";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"List: \" + ou);\n\t\t}\n\t\t\n\t\tpublic static void read(){\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n\n// Remember these:\n// lis2.Take(n-1).Sum()\n// String.Format(\"{0:0}\",f).ToString(CultureInfo.InvariantCulture); -- handles printing double/float\n// Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);\n// var splstr = Console.ReadLine().Split(' ').ToList();\n// var str = Console.ReadLine();\n// var lis = new List();\n//\t\t\tforeach(string strItem in splstr ){\n//\t\t\t\tlis.Add(int.Parse(strItem));\n//\t\t\t}\n//\t\t\tfor(int i = 0; i < n; i++){\n//\t\t\t\tfor(int j = 0; j < 3; j++){\n//\t\t\t\t\tprint(lisLis[i][j]);\n//\t\t\t\t}\n//\t\t\t}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string passwd = Console.ReadLine();\n if (passwd.Length >= 5 &&\n passwd.Any(c => char.IsUpper(c)) &&\n passwd.Any(c => char.IsLower(c)) &&\n passwd.Any(c => char.IsDigit(c)))\n Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string passwd = Console.ReadLine();\n\n bool isComplex = false;\n\n if (passwd.Length >= 5)\n {\n bool hasUpper = false;\n bool hasLower = false;\n bool hasDigit = false;\n \n for (int i = 0; i < passwd.Length; i++)\n {\n if (passwd[i] >= 'a' && passwd[i] <= 'z')\n hasLower = true;\n if (passwd[i] >= 'A' && passwd[i] <= 'Z')\n hasUpper = true;\n if (passwd[i] >= '0' && passwd[i] <= '9')\n hasDigit = true;\n }\n\n if (hasLower && hasUpper && hasDigit)\n isComplex = true;\n }\n\n if (isComplex) Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too weak\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF411A {\n class Program {\n static void Main(string[] args) {\n string password = Console.ReadLine();\n if(password.Length < 5) {\n Console.WriteLine(\"Too weak\");\n return;\n }\n\n bool lowercase = false;\n bool uppercase = false;\n bool digit = false;\n\n for(int i = 0; i < password.Length; i++) {\n if(password[i] >= 'A' && password[i] <= 'Z') {\n uppercase = true;\n }\n if(password[i] >= 'a' && password[i] <= 'z') {\n lowercase = true;\n }\n if(password[i] >= '0' && password[i] <= '9') {\n digit = true;\n }\n }\n\n if(lowercase && uppercase && digit) {\n Console.WriteLine(\"Correct\");\n } else {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n var s = Console.ReadLine();\n if (s.Length >= 5 && s.Any(c => c >= 'A' && c <= 'Z') && s.Any(c => c >= 'a' && c <= 'z') &&\n s.Any(c => c >= '0' && c <= '9'))\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Password\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool ucase, lcase, num;\n ucase = lcase = num = false;\n string res=\"\";\n int co = 0;\n string inp = Console.ReadLine();\n for (int i = 0; i < inp.Length; i++ )\n {\n string s = inp.Substring(i, 1);\n if (Char.Parse(s) >= Char.Parse(\"A\") && Char.Parse(s) <= Char.Parse(\"Z\"))\n ucase = true;\n if (Char.Parse(s) >= Char.Parse(\"a\") && Char.Parse(s) <= Char.Parse(\"z\"))\n lcase = true;\n if (Char.IsNumber(s, 0))\n num = true;\n co++;\n }\n if(co>=5 && ucase && lcase && num)\n res=\"Correct\";\n else\n res=\"Too weak\";\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication31\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool big = false;\n bool small = false;\n bool num = false;\n if (s.Length >= 5)\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90)\n big = true;\n if (s[i] >= 97 && s[i] <= 122)\n small = true;\n if (s[i] >= 48 && s[i] <= 57)\n num = true;\n }\n if (big && small && num)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too weak\");\n }\n else\n Console.WriteLine(\"Too weak\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _411A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine();\n if (data.Length < 5)\n {\n Console.WriteLine(\"Too weak\");\n return;\n }\n var alpha = \"qwertyuiopasdfghjklzxcvbnm\";\n var nums = \"1234567890\";\n var checkA = \n (from c in data\n where\n alpha.Contains(c) \n select 1\n ).FirstOrDefault();\n var checkNum =\n (from c in data\n where\n nums.Contains(c)\n select 1\n ).FirstOrDefault();\n var checkAA = (from c in data\n where\n alpha.ToUpper().Contains(c)\n select 1\n ).FirstOrDefault();\n\n if (checkA + checkNum + checkAA < 3)\n {\n Console.WriteLine(\"Too weak\");\n return;\n }\n Console.WriteLine(\"Correct\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace PasswordCheck\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input = Console.ReadLine();\n bool large = false;\n bool small = false;\n bool digit = false;\n \n if(Input.Length<5)\n {\n Console.WriteLine(\"Too weak\");\n return;\n }\n for (int i = 0; i < Input.Length; i++)\n {\n if (Input[i] > 64 && Input[i] < 91)\n {\n large = true;\n }\n if (Input[i] > 97 && Input[i] < 123)\n {\n small = true;\n }\n if (Input[i] > 47 && Input[i] < 58)\n {\n digit = true;\n }\n }\n if (large && small && digit)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n static void Main(string[] args)\n {\n var pw = Console.ReadLine();\n\n if (pw == null || pw.Length < 5)\n {\n Console.WriteLine(\"Too weak\");\n return;\n }\n\n var t1 = false;\n var t2 = false;\n var t3 = false;\n\n foreach (var c in pw)\n {\n if (char.IsDigit(c))\n {\n t1 = true;\n } \n else if (char.IsUpper(c))\n {\n t2 = true;\n }\n else if (char.IsLower(c))\n {\n t3 = true;\n }\n }\n\n if (t1&t2&t3)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool f = false; bool t = false; bool k = false; bool d = false; bool h = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90) { f = true; break; }\n \n }\n for(int i=0;i= 97 && s[i] <= 'z') { k = true; break; }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= '0' && s[i] <= '9') { h = true; }\n }\n if (s.Length >= 5) { t = true; }\n char[] ss = { '!', '?', '.', ',', '_' };\n for(int i=0;i= 65 && s[i] <= 90) { f = true; break; }\n \n }\n for(int i=0;i= 97 && s[i] <= 'z') { k = true; break; }\n }\n if (s.Length >= 5) { t = true; }\n char[] ss = { '!', '?', '.', ',', '_' };\n for(int i=0;i=1 && !str.Contains(' '))\n {\n\n \n foreach (char chr in str)\n {\n if ( char.IsUpper(chr))\n {\n big = true;\n }\n else if (char.IsLower(chr))\n {\n small = true;\n }\n else if ( char.IsDigit(chr))\n {\n digit = true;\n }\n \n else if ( chr == '!' || chr == '?' || chr == '.' || chr == ',' || chr == '_')\n {\n sign = true;\n }\n else\n {\n \n over = true;\n break;\n\n }\n }\n\n\n if (!over&& small && big && digit && sign && str.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n } else\n {\n if (!over)\n Console.WriteLine(\"Too weak\");\n }\n \n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430_\u043f\u0430\u0440\u043e\u043b\u044f\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int [] a = new int[3];\n if (s.Length < 5) Console.WriteLine(\"Too weak\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90) a[0] = 1;\n else\n if (s[i] >= 97 && s[i] <= 122) a[1] = 1;\n else\n if (s[i] >= 48 && s[i] <= 57) a[2] = 1;\n }\n }\n bool f = true;\n for (int i = 0; i < 3; i++)\n {\n if (a[i] == 0) { Console.WriteLine(\"Too weak\"); f = false; break; }\n }\n if (f) Console.WriteLine(\"Correct\"); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n bool x = true;\n bool y = true;\n bool z = true;\n bool zDva = true;\n if (str.Length >= 5)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z')\n { x = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= '0' && str[i] <= '9')\n { y = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n { z = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '!' || str[i] == '?' || str[i] == '.' || str[i] == '.' || str[i] == '_')\n { zDva = false; break; }\n }\n if (x || y || z || zDva)\n Console.WriteLine(\"Too weak\");\n else\n Console.WriteLine(\"Correct\");\n }\n else\n Console.WriteLine(\"Too weak\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n bool x = true;\n bool y = true;\n bool z = true;\n bool zDva = true;\n\n if (str.Length >= 5)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z')\n { x = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= '0' && str[i] <= '9')\n { y = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n { z = false; break; }\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '!' || str[i] == '?' || str[i] == '.' || str[i] == ',' || str[i] == '_')\n { zDva = false; break; }\n }\n if (x || y || z || zDva)\n Console.WriteLine(\"Too weak\");\n else\n Console.WriteLine(\"Correct\");\n }\n else\n Console.WriteLine(\"Too weak\");\n \n }\n }\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n static void Main()\n {\n bool rule1 = false, rule2 = false, rule3 = false;\n string str = Console.ReadLine();\n foreach (char chr in str)\n {\n if (rule1 | chr >= '0' && chr <= '9') rule1=true;\n if (rule2 | chr >= 'a' && chr <= 'z') rule2 = true;\n if (rule3 | chr >= 'A' && chr <= 'Z') rule3 = true;\n }\n string Result = (rule1&rule2&rule3)?\"Correct\":\"Too weak\";\n Console.WriteLine(Result);\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace test\n{\n class Program\n {\n static void Main()\n {\n bool flag1 = false, flag2 = false, flag3 = false;//1 - \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u0443\u043a\u0432\u0430, 2 - \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0431\u0443\u043a\u0432\u0430, 3 - \u0426\u0438\u0444\u0440\u0430.\n string pass = Console.ReadLine();\n for (int i = 0; i < pass.Length; i++)\n {\n if (pass[i] >= 65 && pass[i] <= 90 && !flag1)\n flag1 = true;\n if (pass[i] >= 97 && pass[i] <= 122 && !flag2)\n flag2 = true;\n if (Char.IsDigit(pass[i]) && !flag3)\n flag3 = true;\n }\n if (flag1 && flag2 && flag3 && pass.Length >= 5)\n Console.WriteLine(\"Correct\");\n else\n Console.WriteLine(\"Too Weak\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n\nnamespace Algorithm\n{\n class Solver\n {\n public void Run()\n {\n string s = cin.ReadLine();\n int upper = 0, lower = 0, digit = 0;\n foreach (var c in s)\n {\n if (c >= 'A' && c <= 'Z') upper = 1;\n if (c >= 'a' && c <= 'z') lower = 1;\n if (c >= '0' && c <= '9') digit = 1;\n }\n if (upper + lower + digit == 3)\n cout.WriteLine(\"Correct\");\n else\n cout.WriteLine(\"Too weak\");\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n Solver task = new Solver();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Qualification_A.Password_Check\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine(); ;\n bool small = false;\n bool big = false;\n bool digit = false;\n bool sign = false;\n\n if (str.Length <= 100)\n {\n\n \n foreach (char chr in str)\n {\n if (Convert.ToInt32(chr) >= 65 && Convert.ToInt32(chr) <= 90)\n {\n big = true;\n }\n if (Convert.ToInt32(chr) >= 97 && Convert.ToInt32(chr) <= 122)\n {\n small = true;\n }\n if (char.IsDigit(chr))\n {\n digit = true;\n }\n if (chr == '!' || chr == '?' || chr == '.' || chr == ',' || chr == '_')\n {\n sign = true;\n }\n }\n\n \n if (small && big && digit && sign && str.Length >= 5)\n {\n Console.WriteLine(\"Correct\");\n } else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffnamespace codeforce\n {\n class Program\n {\n public static void Main()\n {\n var t = System.Console.In.ReadLine();\n\n bool res = t.Length > 5 &&\n t.IndexOfAny(new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }) != -1 &&\n t.IndexOfAny(new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }) != -1 &&\n t.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}) != -1;\n\n if (res)\n {\n System.Console.Out.WriteLine(\"Correct\");\n }\n else\n {\n System.Console.Out.WriteLine(\"Too weak\");\n }\n }\n }\n }"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string pass = Console.ReadLine();\n\n bool s1 = pass.Length >= 5, s2 = false, s3 = false, s4 = false;\n\n foreach(char c in pass)\n {\n if ((!s3 || !s2) && c.ToString().ToUpper() == c.ToString() && c.ToString().ToUpper() != c.ToString().ToLower())\n s2 = true;\n else\n s3 = true;\n\n int t = 0;\n if(int.TryParse(c.ToString(), out t)) s4 = true;\n }\n\n Console.WriteLine(s1 && s2 && s3 && s4 ? \"Correct\" : \"Too weak\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string pass = Console.ReadLine();\n\n bool s1 = pass.Length > 4, s2 = false, s3 = false, s4 = false;\n\n foreach(char c in pass)\n {\n if ((!s3 || !s2) && c.ToString().ToUpper() == c.ToString())\n s2 = true;\n else\n s3 = true;\n\n int t = 0;\n if(int.TryParse(c.ToString(), out t)) s4 = true;\n }\n\n Console.WriteLine(s1 && s2 && s3 && s4 ? \"Correct\" : \"Too weak\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string pass = Console.ReadLine();\n\n bool s1 = pass.Length > 5, s2 = false, s3 = false, s4 = false;\n\n foreach(char c in pass)\n {\n if ((!s3 || !s2) && c.ToString().ToUpper() == c.ToString())\n s2 = true;\n else\n s3 = true;\n\n int t = 0;\n if(int.TryParse(c.ToString(), out t)) s4 = true;\n }\n\n Console.WriteLine(s1 && s2 && s3 && s4 ? \"Correct\" : \"Too weak\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string b = Console.ReadLine();\n int sum=0;\n int k=0;\n int j=0;\n if (b.Length < 5)\n Console.WriteLine(\"Too weak\");\n else\n {\n char[] a = b.ToCharArray();\n for(int i=0; i'a' && a[i]<'z')\n {\n sum++;\n }\n if(a[i]>'A' && a[i]<'B')\n {\n k++;\n }\n if(Char.IsDigit(a[i]))\n {\n j++;\n }\n }\n if (sum > 0 && k > 0 && j > 0)\n {\n Console.WriteLine(\"Correct\");\n }\n else Console.WriteLine(\"Too weak\");\n }\n }\n }\n }"}, {"source_code": "using System;\n\nnamespace code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string b = Console.ReadLine();\n int sum=0;\n int k=0;\n int j=0;\n if (b.Length < 5)\n Console.WriteLine(\"Too weak\");\n else\n {\n char[] a = b.ToCharArray();\n for(int i=0; i'a' && a[i]<'z')\n {\n sum++;\n }\n if(a[i]>'A' && a[i]<'Z')\n {\n k++;\n }\n if(Char.IsDigit(a[i]))\n {\n j++;\n }\n }\n if (sum > 0 && k > 0 && j > 0)\n {\n Console.WriteLine(\"Correct\");\n }\n else Console.WriteLine(\"Too weak\");\n }\n }\n }\n }\n "}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line1 = Console.ReadLine();\n if (line1.Any(char.IsUpper) && line1.Any(char.IsLower) && line1.Any(char.IsDigit))\n {\n Console.WriteLine(\"Correct\");\n } else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A411{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n char[] pass = Console.ReadLine().ToCharArray();\n\n int upperCase = 0;\n int lowerCase = 0;\n int specialChar = 0;\n\n foreach (char c in pass)\n {\n if (c >= 'a' && c <= 'z') lowerCase++;\n else if (c >= 'A' && c <= 'Z') upperCase++;\n else specialChar++;\n }\n\n if (pass.Length >= 5 &&\n lowerCase >= 1 &&\n upperCase >= 1 &&\n specialChar >= 1) Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too weak\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A411{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n char[] pass = Console.ReadLine().ToCharArray();\n\n int upperCase = 0;\n int lowerCase = 0;\n int specialChar = 0;\n\n foreach (char c in pass)\n {\n if (c >= 'a' && c <= 'z') lowerCase++;\n else if (c >= 'A' && c <= 'Z') upperCase++;\n else specialChar++;\n }\n\n if (pass.Length >= 5 &&\n lowerCase >= 1 &&\n upperCase >= 1 &&\n specialChar >= 1) Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too Weak\");\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string passwd = Console.ReadLine();\n\n bool isComplex = false;\n\n if (passwd.Length >= 5)\n {\n bool hasUpper = false;\n bool hasLower = false;\n bool hasDigit = false;\n \n for (int i = 0; i < passwd.Length; i++)\n {\n if (passwd[i] >= 'a' || passwd[i] <= 'z')\n hasLower = true;\n if (passwd[i] >= 'A' || passwd[i] <= 'Z')\n hasUpper = true;\n if (passwd[i] >= '0' || passwd[i] <= '9')\n hasDigit = true;\n }\n\n if (hasLower && hasUpper && hasDigit)\n isComplex = true;\n }\n\n if (isComplex) Console.WriteLine(\"Correct\");\n else Console.WriteLine(\"Too weak\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF411A {\n class Program {\n static void Main(string[] args) {\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Password\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool ucase, lcase, num;\n ucase = lcase = num = false;\n string res=\"\";\n int co = 0;\n string inp = Console.ReadLine();\n for (int i = 0; i < inp.Length; i++ )\n {\n string s = inp.Substring(i, 1);\n if (s.ToUpper() == s)\n ucase = true;\n if (s.ToLower() == s)\n lcase = true;\n if (Char.IsNumber(s, 0))\n num = true;\n co++;\n }\n if(co>=5 && ucase && lcase && num)\n res=\"Correct\";\n else\n res=\"Too weak\";\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace PasswordCheck\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input = Console.ReadLine();\n bool large = false;\n bool small = false;\n bool digit = false;\n \n if(Input.Length<6)\n {\n Console.WriteLine(\"Too weak\");\n return;\n }\n for (int i = 0; i < Input.Length; i++)\n {\n if (Input[i] > 64 && Input[i] < 91)\n {\n large = true;\n }\n if (Input[i] > 97 && Input[i] < 123)\n {\n small = true;\n }\n if (Input[i] > 47 && Input[i] < 58)\n {\n digit = true;\n }\n }\n if (large && small && digit)\n {\n Console.WriteLine(\"Correct\");\n }\n else\n {\n Console.WriteLine(\"Too weak\");\n }\n }\n }\n}\n"}], "src_uid": "42a964b01e269491975965860ec92be7"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tprivate long result = 0L;\n\t\tprivate List daysInSeven;\n\t\tprivate List minsInSeven;\n\t\tprivate string firstStr;\n\t\tprivate string secondStr;\n\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0] - 1;\n\t\t\tvar m = input[1] - 1;\n\t\t\tdaysInSeven = ToSevenBase(n);\n\t\t\tminsInSeven = ToSevenBase(m);\n\t\t\tvar reversed = daysInSeven.ToArray().Reverse();\n\t\t\tfirstStr = reversed.Aggregate(\"\", (curr, item) => curr + item);\n\t\t\treversed = minsInSeven.ToArray().Reverse();\n\t\t\tsecondStr = reversed.Aggregate(\"\", (curr, item) => curr + item);\n\t\t\tvar leftCount = daysInSeven.Count;\n\t\t\tvar rightCount = minsInSeven.Count;\n\t\t\tif (leftCount + rightCount > 7) {\n\t\t\t\tsw.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rightCount < 0) {\n\t\t\t\trightCount = 0;\n\t\t\t}\n\t\t\tGenerate(0, 0, leftCount, rightCount, leftCount + rightCount, new char[leftCount + rightCount]);\n\n\t\t\tsw.WriteLine(result);\n\t\t}\n\n\t\tprivate void Generate(int currLeft, int currRight, int leftCount, int rightCount, int totalMax, char[] array)\n\t\t{\n\t\t\tif (currLeft + currRight == totalMax) {\n\t\t\t\tvar contains = new int[7];\n\t\t\t\tfor (var i = 0; i < array.Length; i++) {\n\t\t\t\t\tcontains[array[i] - '0']++;\n\t\t\t\t}\n\t\t\t\tvar isDifferent = contains.All(item => item <= 1);\n\t\t\t\tif (isDifferent) {\n\t\t\t\t\tvar leftStr = new String(array, 0, leftCount);\n\t\t\t\t\tvar rightStr = new String(array, leftCount, rightCount);\n\t\t\t\t\tvar leftVal = String.IsNullOrEmpty(leftStr) ? 0L : Int64.Parse(leftStr);\n\t\t\t\t\tvar rightVal = String.IsNullOrEmpty(rightStr) ? 0L : Int64.Parse(rightStr);\n\t\t\t\t\tvar firstVal = String.IsNullOrEmpty(firstStr) ? 0L :Int64.Parse(firstStr);\n\t\t\t\t\tvar secondVal = String.IsNullOrEmpty(secondStr) ? 0L : Int64.Parse(secondStr);\n\t\t\t\t\tif (leftVal <= firstVal && rightVal <= secondVal) {\n\t\t\t\t\t\tresult++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (var i = 0; i < 7; i++) {\n\t\t\t\t\tarray[currLeft + currRight] = (char) ('0' + i);\n\t\t\t\t\tif (currLeft < leftCount)\n\t\t\t\t\t\tGenerate(currLeft + 1, currRight, leftCount, rightCount, totalMax, array);\n\t\t\t\t\telse\n\t\t\t\t\t\tGenerate(currLeft, currRight + 1, leftCount, rightCount, totalMax, array);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate List ToSevenBase(long n)\n\t\t{\n\t\t\tif (n == 0) {\n\t\t\t\treturn new List { 0 };\n\t\t\t}\n\t\t\tconst int b = 7;\n\t\t\tvar list = new List();\n\t\t\tvar curr = (int)n;\n\t\t\twhile (curr > 0) {\n\t\t\t\tlist.Add(curr % b);\n\t\t\t\tcurr /= b;\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _686C\n{\n class Program\n {\n static int[] powers7 = new[] { 7, 49, 343, 2401, 16807, 117649, 823543, 5764801, 40353607, 282475249 };\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]), m = int.Parse(input[1]);\n long answer = 0;\n int firstDigits = 1, secondDigits = 1;\n for (var a = 7; a < n; a *= 7)\n firstDigits += 1;\n for (var b = 7; b < m; b *= 7)\n secondDigits += 1;\n\n if (firstDigits + secondDigits <= 7)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n int[] used = new int[7];\n for (int a = i, k = 0; k != firstDigits; a /= 7, k++)\n used[a % 7]++;\n for (int b = j, k = 0; k != secondDigits; b /= 7, k++)\n used[b % 7]++;\n\n if (used.Max() <= 1) answer++;\n }\n }\n }\n\n Console.WriteLine(answer);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var counts = new int[7];\n counts[0] = (nlog + mlog);\n var bads = 1;\n var result = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (bads == 0)\n result++;\n int digit = 0;\n while (digit < mlog)\n {\n if (mins[digit] < 6)\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit]++;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit] = 0;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n }\n digit++;\n }\n }\n for (int z = 0; z < mlog; z++)\n {\n counts[mins[z]]--;\n if (counts[mins[z]] == 1)\n bads--;\n mins[z] = 0;\n counts[mins[z]]++;\n if (counts[mins[z]] == 2)\n bads++;\n }\n var d = 0;\n while (d < nlog)\n {\n if (hour[d] < 6)\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d]++;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d] = 0;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n }\n d++;\n }\n\n }\n return result;\n }\n\n }\n\n public int logbase7(long v)\n {\n if (v <= 1)\n return 1;\n var res = 0;\n v = v - 1;\n while (v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var result = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (Check(hour, mins))\n result++;\n int digit = 0;\n while (digit < mlog)\n {\n if (mins[digit] < 6)\n {\n mins[digit]++;\n break;\n }\n else\n mins[digit] = 0;\n digit++;\n }\n }\n for (int z = 0; z < mlog; z++)\n mins[z] = 0;\n var d = 0;\n while (d < nlog)\n {\n if (hour[d] < 6)\n {\n hour[d]++;\n break;\n }\n else\n hour[d] = 0;\n d++;\n }\n\n }\n return result;\n }\n }\n\n bool Check(int[] hour, int[] mins)\n {\n bool[] set = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n if (set[hour[i]] == true)\n return false;\n else\n set[hour[i]] = true;\n for (int i = 0; i < mins.Length; i++)\n if (set[mins[i]] == true)\n return false;\n else\n set[mins[i]] = true;\n return true;\n }\n\n public int logbase7(long v)\n {\n if (v <= 1)\n return 1;\n var res = 0;\n v = v - 1;\n while (v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var log = nlog + mlog;\n\n var result = 0;\n\n\n\n var a = new int[7] { 0, 1, 2, 3, 4, 5, 6 };\n int[] prev = new int[7];\n do\n {\n if (prev != null)\n {\n var fl = true;\n for (int i = 0; i < log; i++)\n {\n if (a[i] != prev[i])\n {\n fl = false;\n break;\n }\n }\n if (fl)\n {\n continue;\n }\n }\n var v = 0;\n var pow = 1;\n for (int i = 0; i < nlog; i++)\n {\n v += a[i] * pow;\n pow *= 7;\n }\n if (v >= n)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n\n pow = 1;\n v = 0;\n for (int i = 0; i < mlog; i++)\n {\n v += a[nlog + i] * pow;\n pow *= 7;\n }\n if (v >= m)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n result++;\n Array.Copy(a, prev, 7);\n } while (NextPermutation(a));\n return result;\n }\n\n \n }\n private static bool NextPermutation(int[] numList)\n {\n /*\n Knuths\n 1. Find the largest index j such that a[j] < a[j + 1]. If no such index exists, the permutation is the last permutation.\n 2. Find the largest index l such that a[j] < a[l]. Since j + 1 is such an index, l is well defined and satisfies j < l.\n 3. Swap a[j] with a[l].\n 4. Reverse the sequence from a[j + 1] up to and including the final element a[n].\n\n */\n var largestIndex = -1;\n for (var i = numList.Length - 2; i >= 0; i--)\n {\n if (numList[i] < numList[i + 1])\n {\n largestIndex = i;\n break;\n }\n }\n\n if (largestIndex < 0) return false;\n\n var largestIndex2 = -1;\n for (var i = numList.Length - 1; i >= 0; i--)\n {\n if (numList[largestIndex] < numList[i])\n {\n largestIndex2 = i;\n break;\n }\n }\n\n var tmp = numList[largestIndex];\n numList[largestIndex] = numList[largestIndex2];\n numList[largestIndex2] = tmp;\n\n for (int i = largestIndex + 1, j = numList.Length - 1; i < j; i++, j--)\n {\n tmp = numList[i];\n numList[i] = numList[j];\n numList[j] = tmp;\n }\n\n return true;\n }\n\n public int logbase7(long v)\n {\n if (v <= 1)\n return 1;\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.C_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class AATask3\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), m = fs.NextInt();\n if (n > 823543 || m > 823543) writer.WriteLine(0);\n else\n {\n List hours = new List(6000);\n List minutes = new List(6000);\n char[] nums = new char[] { '0', '1', '2', '3', '4', '5', '6' };\n string maxHour = IntToStringFast(n - 1, nums);\n string maxMinute = IntToStringFast(m - 1, nums);\n if (maxHour.Length + maxMinute.Length > 7)\n {\n writer.WriteLine(0);\n return;\n }\n for (int i = 0; i < n; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxHour.Length) sb.Insert(0, 0);\n string hour = sb.ToString();\n if (IsUnique(hour))\n {\n hours.Add(hour);\n }\n }\n for (int i = 0; i < m; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxMinute.Length) sb.Insert(0, 0);\n string minute = sb.ToString();\n if (IsUnique(minute))\n {\n minutes.Add(minute);\n }\n }\n int ans = 0;\n foreach (string h in hours)\n {\n foreach (string min in minutes)\n {\n if (AreUnique(h, min))\n {\n ans++;\n }\n }\n }\n writer.WriteLine(ans);\n }\n }\n }\n\n private static bool AreUnique(string hour, string min)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n count[hour[i] - '0'] = true;\n }\n for (int i = 0; i < min.Length; i++)\n {\n if (count[min[i] - '0']) return false;\n }\n return true;\n }\n\n private static bool IsUnique(string hour)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n if (count[hour[i] - '0']) return false;\n else count[hour[i] - '0'] = true;\n }\n return true;\n }\n public static string IntToStringFast(int value, char[] baseChars)\n {\n // 32 is the worst cast buffer size for base 2 and int.MaxValue\n int i = 32;\n char[] buffer = new char[i];\n int targetBase = baseChars.Length;\n\n do\n {\n buffer[--i] = baseChars[value % targetBase];\n value = value / targetBase;\n }\n while (value > 0);\n\n char[] result = new char[32 - i];\n Array.Copy(buffer, i, result, 0, 32 - i);\n\n return new string(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.AccessControl;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace olimpSolve\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = p[0];\n int m = p[1];\n int t1 = (int)Math.Ceiling(Math.Log(n, 7));\n int t2 = (int) Math.Ceiling(Math.Log(m, 7));\n if (t1 == 0)\n t1 = 1;\n if (t2 == 0)\n t2 = 1;\n int result = 0;\n if (t1 + t2 <= 7)\n {\n var arr = new List();\n Generate(arr, 0, new int[t1 + t2]);\n foreach (var item in arr)\n {\n int p1 = ToDec(item, 0, t1);\n int p2 = ToDec(item, t1, item.Length);\n if (p1 < n && p2 < m)\n result++;\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n\n private static int ToDec(int[] arr, int l, int r)\n {\n int k = 0;\n for (int i = l; i < r; i++)\n {\n k = k * 7 + arr[i];\n }\n return k;\n }\n\n private static void Generate(Listarr , int index, int[] was)\n {\n if (index == was.Length)\n {\n arr.Add(was.ToArray());\n }\n else\n {\n for (int i = 0; i < 7; i++)\n {\n if (!was.Take(index).Contains(i))\n {\n was[index] = i;\n Generate(arr, index + 1, was);\n }\n } \n }\n } \n }\n}\n"}, {"source_code": "/*\n * TemplateCS\n * Copyright (C) 2014-2016 Markus Himmel\n * This file is distributed under the terms of the MIT license\n */\n\n//#define CodeJam\n#define CodeForces\n\nusing System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ProgrammingCompetitions\n{\n\tclass Program\n\t{\n\n#region GCJ\n#if CodeJam\n\t\tprivate static bool DEBUG = false;\n\n\t\tstatic void debug()\n\t\t{\n\t\t}\n\n\t\tstatic string solveCase(int num)\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n#endif\n#endregion\n\n#region CodeForces\n#if CodeForces\n#if DEBUG\n\t\tstatic Queue testInput = new Queue(new string[]\n\t\t{\n\t\t\t\"1 1\",\n\t\t});\n#endif\n\n\t\tstatic string Solve()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tint n, m;\n\t\t\t\tread(out n, out m);\n\n\t\t\t\tint h = 7;\n\t\t\t\tint nneed = 1;\n\t\t\t\twhile (h < n)\n\t\t\t\t{\n\t\t\t\t\tnneed++;\n\t\t\t\t\th *= 7;\n\t\t\t\t}\n\t\t\t\th = 7;\n\t\t\t\tint mneed = 1;\n\t\t\t\twhile (h < m)\n\t\t\t\t{\n\t\t\t\t\tmneed++;\n\t\t\t\t\th *= 7;\n\t\t\t\t}\n\t\t\t\tif (mneed + nneed > 7)\n\t\t\t\t\treturn \"0\";\n\n\t\t\t\tint res = 0;\n\n\t\t\t\t// at most 7^7\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tHashSet e = new HashSet();\n\t\t\t\t\t\tbool o = false;\n\t\t\t\t\t\tint ii = i, jj = j;\n\t\t\t\t\t\tfor (int nn = 0; nn < nneed; nn++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!e.Add(ii % 7))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\to = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tii /= 7;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (o)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tfor (int mm = 0; mm < mneed; mm++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!e.Add(jj % 7))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\to = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjj /= 7;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!o)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tres++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn res.ToString();\n\t\t\t}\n\t\t}\n#endif\n#endregion\n\n\t\t// Everything after this comment is template code\n\n\t\tprivate static T read()\n\t\t{\n\t\t\treturn (T)Convert.ChangeType(read(), typeof(T));\n\t\t}\n\n\t\tprivate static T[] readMany()\n\t\t{\n\t\t\treturn readMany(' ');\n\t\t}\n\n\t\tprivate static _[] readMany<_>(params char[] ___)\n\t\t{\n\t\t\treturn read().Split(___).Select(__ => (_)Convert.ChangeType(__, typeof(_))).ToArray();\n\t\t}\n\n\t\tprivate static string[] readMany()\n\t\t{\n\t\t\treturn readMany();\n\t\t}\n\n\t\tprivate static T[][] readMany(int n)\n\t\t{\n\t\t\tT[][] res = new T[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tres[i] = readMany();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Func map)\n\t\t{\n\t\t\tT[][] res = new T[height][];\n\t\t\tfor (int _ = 0; _ < height; _++)\n\t\t\t{\n\t\t\t\tres[_] = read().Select(c => map(c)).ToArray();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static char[][] readField(int height)\n\t\t{\n\t\t\treturn readField(height, c => c);\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Dictionary dic)\n\t\t{\n\t\t\treturn readField(height, c => dic[c]);\n\t\t}\n\n\t\tprivate static void read(out T1 t1)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4, out T5 t5)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t\tt5 = (T5)Convert.ChangeType(vals[4], typeof(T5));\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3, t4) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3, t4);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, t4, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tstatic IEnumerable range(long first, long last, long step = 1)\n\t\t{\n\t\t\tfor (long i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic IEnumerable range(int first, int last, int step = 1)\n\t\t{\n\t\t\tfor (int i = first; i <= last; i+= step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic T id(T a)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic static T[][] mkarr(int x, int y)\n\t\t{\n\t\t\tT[][] res = new T[x][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y];\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] mkarr(int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = new T[x][][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y][];\n\t\t\t\tfor (int j = 0; j < y; j++)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = new T[z];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic bool[] tf = new[] { true, false };\n\n\n#if CodeJam\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tif (DEBUG)\n\t\t\t{\n\t\t\t\tdebug();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tInitialize();\n\t\t\t\tSolveAll(solveCase);\n\t\t\t}\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tprivate static StreamReader inf;\n\t\tprivate static StreamWriter outf;\n\n\t\tprivate delegate void o(string format, params object[] args);\n\t\tprivate static o Output;\n\n\t\tpublic static void Initialize()\n\t\t{\n\t\t\tConsole.ForegroundColor = ConsoleColor.Yellow;\n\t\t\tConsole.Write(\"File name: \");\n\t\t\tstring name = Console.ReadLine();\n\t\t\tinf = new StreamReader($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.in\");\n\t\t\toutf = new StreamWriter($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.out\");\n\t\t\tConsole.ForegroundColor = ConsoleColor.White;\n\t\t\tOutput = highlightedPrint;\n\t\t\tOutput += outf.WriteLine;\n\t\t}\n\n\t\tprivate static void highlightedPrint(string format, params object[] args)\n\t\t{\n\t\t\tConsoleColor prev = Console.ForegroundColor;\n\t\t\tConsole.ForegroundColor = ConsoleColor.Green;\n\t\t\tConsole.WriteLine(format, args);\n\t\t\tConsole.ForegroundColor = prev;\n\t\t}\n\n\t\tpublic static void SolveAll(Func calc)\n\t\t{\n\t\t\tint cases = int.Parse(inf.ReadLine());\n\t\t\tfor (int _ = 1; _ <= cases; _++)\n\t\t\t{\n\t\t\t\tOutput($\"Case #{_}: {calc(_)}\");\n\t\t\t}\n\t\t\tinf.Close();\n\t\t\toutf.Close();\n\t\t\tConsole.ForegroundColor = ConsoleColor.Cyan;\n\t\t\tConsole.WriteLine(\"Eureka!\");\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n\t\t\treturn inf.ReadLine();\n\t\t}\n#endif\n\n#if CodeForces\n\t\tstatic void Main(string[] args)\n\t\t{\n#if DEBUG\n\t\t\tvar sw = new System.Diagnostics.Stopwatch();\n\t\t\tsw.Start();\n#endif\n\t\t\tstring s = Solve();\n\t\t\tif (!string.IsNullOrEmpty(s))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(s);\n\t\t\t}\n#if DEBUG\n\t\t\tsw.Stop();\n\t\t\tConsole.WriteLine(sw.Elapsed);\n\t\t\tConsole.ReadKey();\n#endif\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n#if !DEBUG\n\t\t\treturn Console.ReadLine();\n#else\n\t\t\treturn testInput.Dequeue();\n#endif\n\t\t}\n#endif\n\t}\n\n\tpublic static class ExtensionMethods\n\t{\n\t\tpublic static IEnumerable Cartesian(this IEnumerable first, IEnumerable second, Func collector)\n\t\t{\n\t\t\treturn first.SelectMany(f => second.Select(s => collector(f, s)));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, Tuple.Create);\n\t\t}\n\n\t\tpublic static IEnumerable> CartesianE(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\t// Calling CartesianE prevents selection of the wrong overload of Cartesian when you want a tuple of tuples to be returned\n\t\t\treturn first.Cartesian(second);\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> source)\n\t\t{\n\t\t\tIEnumerable> res = source.First().Select(x => single(x));\n\t\t\tforeach (IEnumerable next in source.Skip(1))\n\t\t\t{\n\t\t\t\tres = res.Cartesian(next, (sofar, n) => sofar.Concat(single(n)));\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static IEnumerable> Pow(this IEnumerable it, int num)\n\t\t{\n\t\t\treturn Enumerable.Repeat(it, num).Cartesian();\n\t\t}\n\n\t\tpublic static IEnumerable Demask(this IEnumerable> inp)\n\t\t{\n\t\t\tforeach (var pair in inp)\n\t\t\t{\n\t\t\t\tif (pair.Item2)\n\t\t\t\t{\n\t\t\t\t\tyield return pair.Item1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable>> Partition(this IEnumerable source, int groups)\n\t\t{\n\t\t\tforeach (var part in Enumerable.Range(0, groups).Pow(source.Count()).Select(x => x.ToArray()))\n\t\t\t{\n\t\t\t\tyield return Enumerable.Range(0, groups).Select(x => source.Where((item, idx) => part[idx] == x));\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Combinations(this IEnumerable it)\n\t\t{\n\t\t\tforeach (var conf in new[] { true, false }.Pow(it.Count()))\n\t\t\t{\n\t\t\t\tyield return it.Zip(conf, Tuple.Create).Demask();\n\t\t\t}\n\t\t}\n\n\t\tprivate static IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tprivate static IEnumerable ExceptSingle(this IEnumerable first, T it, IEqualityComparer comp = null)\n\t\t{\n\t\t\tcomp = comp ?? EqualityComparer.Default;\n\t\t\tbool seen = false;\n\t\t\tforeach (T a in first)\n\t\t\t{\n\t\t\t\tif (!seen && comp.Equals(a, it))\n\t\t\t\t{\n\t\t\t\t\tseen = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tyield return a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Permutations(this IEnumerable it)\n\t\t{\n\t\t\tif (it.Count() < 2)\n\t\t\t{\n\t\t\t\tyield return it;\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tforeach (T first in it)\n\t\t\t{\n\t\t\t\tforeach (IEnumerable part in Permutations(it.ExceptSingle(first)))\n\t\t\t\t{\n\t\t\t\t\tyield return single(first).Concat(part);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static T[][] Rho(this IEnumerable source, int x, int y)\n\t\t{\n\t\t\tT[][] res = Program.mkarr(x, y);\n\n\t\t\tint i = 0, j = 0;\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = item;\n\t\t\t\t\tj++;\n\t\t\t\t\tif (j == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] Rho(this IEnumerable source, int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = Program.mkarr(x, y, z);\n\n\t\t\tint i = 0, j = 0, k = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j][k] = item;\n\t\t\t\t\tk++;\n\t\t\t\t\tif (k == z)\n\t\t\t\t\t{\n\t\t\t\t\t\tk = 0;\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tif (j == y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var str = Console.ReadLine().Split(' ');\n var n = Convert.ToInt32(str[0]);\n var m = Convert.ToInt32(str[1]);\n if (n < m)\n {\n var t = n;\n n = m;\n m = t;\n }\n var nc = 0;\n var nn = n - 1;\n while (nn > 0)\n {\n ++nc;\n nn /= 7;\n }\n var mc = 0;\n var mm = m - 1;\n while (mm > 0)\n {\n ++mc;\n mm /= 7;\n }\n if (mc == 0)\n mc = 1;\n if (nc == 0)\n nc = 1;\n if (mc + nc > 7)\n {\n Console.WriteLine(0);\n }\n else\n {\n int mx = 1;\n int res = 0;\n var over = mc + nc;\n while (over > 0)\n {\n mx *= 7;\n over--;\n }\n\n var z = new int[7];\n for (int i = 0; i < mx; ++i)\n {\n for (int h = 0; h < 7; h++)\n z[h] = 0;\n var j = i;\n var c = mc + nc;\n bool good = true;\n while (c > 0)\n {\n if (z[j%7] > 0)\n {\n good = false;\n break;\n }\n z[j%7]++;\n j /= 7;\n c--;\n }\n if (good)\n {\n j = i;\n c = mc;\n int q = 1;\n while (c > 0)\n {\n q *= 7;\n j /= 7;\n c--;\n }\n var nj = i - j*q;\n if (j < n && nj < m)\n {\n res++;\n }\n }\n }\n\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\n\nclass Program\n{\n bool[] a = new bool[7];\n bool Check(int x, int v)\n {\n return x < v;\n }\n\n int GetCount(int k)\n {\n k--;\n int count = 0;\n for (;;)\n {\n count++;\n k /= 7;\n if (k == 0)\n return count;\n }\n }\n int n;\n int m;\n int countN;\n int countM;\n int res;\n\n //(0,0)\n void tutuFirst(int first, int countF)\n {\n if (countF == countN)\n {\n if (Check(first, n))\n {\n tutuSecond(0, 0);\n }\n return;\n }\n for (int j = 0; j < 7; j++)\n {\n if (a[j]) continue;\n a[j] = true;\n tutuFirst(first * 7 + j, countF + 1);\n a[j] = false;\n }\n }\n void tutuSecond(int second, int countS)\n {\n if (countS == countM)\n {\n if (Check(second, m))\n {\n res++;\n }\n return;\n }\n for (int j = 0; j < 7; j++)\n {\n if (a[j]) continue;\n a[j] = true;\n tutuSecond(second * 7 + j, countS + 1);\n a[j] = false;\n }\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n n = ri;\n m = ri;\n\n countN = GetCount(n);\n countM = GetCount(m);\n var count = countM + countN;\n\n if (count > 7)\n {\n wln(0);\n return;\n }\n\n res = 0;\n tutuFirst(0, 0);\n wln(res);\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o + \" \"); }\n static void wrt(object o) { Console.Write(o); }\n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "\ufeff// using a C# contest template, relevant code is at the bottom in the Run() function\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemA {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static bool isLocal = Type.GetType(\"HaitaoLocal\") != null;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (isLocal) {\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ri { get { return RI(); } }\n static string rs { get { return RS(); } }\n static long rl { get { return RL(); } }\n static double rd { get { return RD(); } }\n static int RI() {\n return Int32.Parse(NextToken());\n }\n static string RS() {\n return NextToken();\n }\n static long RL() {\n return Int64.Parse(NextToken());\n }\n static double RD() {\n return Double.Parse(NextToken());\n }\n static int[] RIA(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RI();\n }\n return ret;\n }\n static string[] RSA(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RS();\n }\n return ret;\n }\n static long[] RLA(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RL();\n }\n return ret;\n }\n static double[] RDA(int length) {\n double[] ret = new double[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RD();\n }\n return ret;\n }\n static StringBuilder outputBuilder;\n static CultureInfo outputCulture = new CultureInfo(\"en-US\");\n static void Out(object obj) {\n Type type = obj.GetType();\n string str = obj.ToString();\n if (type == typeof(double) || type == typeof(float)) {\n str = ((double)obj).ToString(outputCulture);\n }\n outputBuilder.Append(str + \" \");\n }\n static void Outl() {\n Outl(\"\");\n }\n static void Outl(object obj) {\n Out(obj);\n outputBuilder.Append(\"\\n\");\n }\n static void Flush() {\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n outputBuilder = new StringBuilder();\n }\n static void Log(string label, object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.Write(label + \": \");\n Console.ForegroundColor = t;\n Log(obj);\n }\n static void Log(object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.White;\n Console.WriteLine(ToStringRecursive(obj));\n Console.ForegroundColor = t;\n }\n static string ToStringRecursive(object obj) {\n StringBuilder sb = new StringBuilder();\n if (!(obj is string) && (obj is System.Collections.IEnumerable)) {\n System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;\n sb.Append(\"{\");\n bool first = true;\n foreach (object el in en) {\n if (!first) sb.Append(\", \");\n sb.Append(ToStringRecursive(el));\n first = false;\n }\n sb.Append(\"}\");\n return sb.ToString();\n }\n return obj.ToString();\n }\n\n public static void Main(string[] args) {\n long startTick = 0;\n if (isLocal) {\n startTick = Environment.TickCount;\n fileReader = new StreamReader(inputFileName);\n }\n\n outputBuilder = new StringBuilder();\n Run();\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.WriteLine();\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n\n if (isLocal) {\n long runTime = Environment.TickCount - startTick;\n if (runTime > 32) {\n Log(\"time\", runTime);\n Log(\"\");\n }\n }\n }\n\n\n\n static void Run() {\n long n = rl;\n long m = rl;\n int nd = 0;\n long tn = n-1;\n if (tn == 0) nd = 1;\n while (tn > 0) {\n tn /= 7;\n nd++;\n }\n int md = 0;\n long tm = m-1;\n if (tm == 0) md = 1;\n while (tm > 0) {\n tm /= 7;\n md++;\n }\n if (nd + md > 7) Outl(0);\n else {\n long ans = 0;\n for (int a = 0; a < n; a++) {\n for (int b = 0; b < m; b++) {\n bool[] x = new bool[7];\n List l = new List();\n int ta = a;\n while (ta > 0) {\n l.Add(ta % 7);\n ta /= 7;\n }\n int tb = b;\n while (tb > 0) {\n l.Add(tb % 7);\n tb /= 7;\n }\n if (l.Count < nd + md) {\n l.Add(0);\n }\n if (l.Count < nd + md) {\n continue;\n }\n bool flag = true;\n foreach (int i in l) {\n if (x[i]) {\n flag = false; break;\n }\n x[i] = true;\n }\n if(flag) {\n ans++;\n }\n }\n }\n Outl(ans);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Robbers__watch\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int cn = Digits(n-1);\n int cm = Digits(m-1);\n\n var p = new[] {0, 1, 2, 3, 4, 5, 6};\n int count = 0;\n var h = new HashSet();\n\n if (cn + cm <= p.Length)\n {\n do\n {\n int i = 0;\n long nn = 0, mm = 0;\n for (int j = 0; j < cn; j++)\n {\n nn = nn*7 + p[i];\n i++;\n }\n for (int j = 0; j < cm; j++)\n {\n mm = mm*7 + p[i];\n i++;\n }\n if (nn < n && mm < m)\n {\n long key = (nn << 32) + mm;\n if (h.Add(key))\n count++;\n }\n } while (NextPermutation(p));\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Digits(int n)\n {\n if (n <= 0)\n return 1;\n int count = 0;\n while (n > 0)\n {\n n /= 7;\n count++;\n }\n return count;\n }\n\n private static bool NextPermutation(int[] nn)\n {\n if (nn.Length <= 1) return false;\n int i = nn.Length - 1;\n int last = nn.Length;\n\n while (true)\n {\n int i1 = i;\n if (nn[--i] < nn[i1])\n {\n int i2 = last;\n while (!(nn[i] < nn[--i2]))\n {\n ;\n }\n int c = nn[i];\n nn[i] = nn[i2];\n nn[i2] = c;\n\n Reverse(nn, i1, last);\n return true;\n }\n if (i == 0)\n {\n Reverse(nn, 0, last);\n return false;\n }\n }\n }\n\n private static void Reverse(int[] nn, int first, int last)\n {\n while ((first != last) && (first != --last))\n {\n int c = nn[first];\n nn[first] = nn[last];\n nn[last] = c;\n first++;\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n List Fun(int x)\n {\n var ret = new List();\n if (x == 0)\n {\n ret.Add(0);\n return ret;\n }\n while (x > 0)\n {\n ret.Add(x % 7);\n x /= 7;\n }\n ret.Reverse();\n return ret;\n }\n\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n var dp = new int[1 << 7, 2];\n dp[0, 0] = 1;\n foreach (int x in Fun(n - 1))\n {\n var ndp = new int[1 << 7, 2];\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 7; k++)\n if ((i >> k & 1) == 0)\n {\n if (j == 0 && k > x)\n continue;\n int nj = j;\n if (k < x)\n nj = 1;\n ndp[i | 1 << k, nj] += dp[i, j];\n }\n dp = ndp;\n }\n\n for (int i = 0; i < 1 << 7; i++)\n {\n dp[i, 0] += dp[i, 1];\n dp[i, 1] = 0;\n }\n\n foreach (int x in Fun(m - 1))\n {\n var ndp = new int[1 << 7, 2];\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 7; k++)\n if ((i >> k & 1) == 0)\n {\n if (j == 0 && k > x)\n continue;\n int nj = j;\n if (k < x)\n nj = 1;\n ndp[i | 1 << k, nj] += dp[i, j];\n }\n dp = ndp;\n }\n\n int ans = 0;\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n ans += dp[i, j];\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII);\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private long result = 0;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/problemset/problem/681/C\n\n var input = _reader.ReadIntArray();\n var n = input[0];\n var m = input[1];\n var numbers = new HashSet();\n var maxN = GetMax(n - 1);\n var maxM = GetMax(m - 1);\n\n if (maxN + maxM > 7)\n {\n return this;\n }\n\n for (int i = 0; i < n; i++)\n {\n numbers.Clear();\n if (!ToSeven(i, maxN, numbers)) continue;\n\n for (int j = 0; j < m; j++)\n {\n if (i == j) continue;\n numbers.Clear();\n if (ToSeven(i, maxN, numbers) && ToSeven(j, maxM, numbers))\n {\n result++;\n }\n }\n }\n\n return this;\n }\n\n private int GetMax(int val)\n {\n int i = 0;\n do\n {\n i++;\n val /= 7;\n } while (val > 0);\n return i;\n }\n\n private bool ToSeven(int val, int max, HashSet nums)\n {\n for (int i = max - 1; i >= 0; i--)\n {\n var value = val % 7;\n if (nums.Contains(value)) return false;\n val /= 7;\n nums.Add(value);\n }\n\n return true;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString();\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Template\n {\n private void Solve()\n {\n var n = cin.NextInt();\n var m = cin.NextInt();\n\n var maxN = IntToString(n - 1);\n var maxM = IntToString(m - 1);\n\n var length = maxN.Length + maxM.Length;\n if (length > 7)\n {\n Console.WriteLine(0);\n return;\n }\n\n var nn = long.Parse(maxN);\n var mm = long.Parse(maxM);\n\n //var max = 7;\n //for (var i = 1; i < length; i++)\n //{\n // max *= 10;\n //}\n\n //var digits = new HashSet();\n //var cnt = 0;\n //for (var i = 0; i < max; i++)\n //{\n // digits.Clear();\n // var ok = true;\n // var num = i;\n // while (num > 0)\n // {\n // var rem = num%10;\n // if (rem > 6)\n // {\n // ok = false;\n // break;\n // }\n // if (digits.Contains(rem))\n // {\n // ok = false;\n // break;\n // }\n // digits.Add(rem);\n // num /= 10;\n // }\n // if (!ok)\n // {\n // continue;\n // }\n\n // if (length == digits.Count)\n // {\n // var str = i.ToString();\n // var first = str.Substring(0, maxN.Length);\n // var second = str.Substring(maxN.Length);\n // if (long.Parse(first) <= nn && long.Parse(second) <= mm)\n // {\n // cnt++;\n // }\n // }\n // else if (length - digits.Count == 1 && !digits.Contains(0))\n // {\n // var str = \"0\" + i.ToString();\n // var first = str.Substring(0, maxN.Length);\n // var second = str.Substring(maxN.Length);\n // if (long.Parse(first) <= nn && long.Parse(second) <= mm)\n // {\n // cnt++;\n // }\n // }\n //}\n\n //Console.WriteLine(cnt);\n\n //return;\n\n var count = 0;\n var chars = new List();\n for (var i = 0; i < n; i++)\n {\n var hasZero = false;\n\n var num = IntToString(i);\n if (num.Length < maxN.Length)\n {\n if (maxN.Length - num.Length == 1)\n {\n if (!num.Contains('0'))\n {\n hasZero = true;\n }\n else\n {\n continue;\n }\n }\n else\n {\n continue;\n }\n }\n if (num.Distinct().Count() != num.Length)\n {\n continue;\n }\n\n chars.Clear();\n if (!hasZero && !num.Contains('0'))\n {\n chars.Add('0');\n }\n\n for (var c = '1'; c <= '6'; c++)\n {\n if (!num.Contains(c))\n {\n chars.Add(c);\n }\n }\n\n var unique = new HashSet();\n do\n {\n var str = new string(chars.ToArray()).Substring(0, maxM.Length);\n if (!unique.Contains(str))\n {\n unique.Add(str);\n var value = long.Parse(str);\n if (value <= mm)\n {\n count++;\n }\n }\n } while (NextPermutation(chars));\n }\n\n Console.WriteLine(count);\n\n }\n\n private static readonly char[] baseChars = new[] {'0', '1', '2', '3', '4', '5', '6'};\n\n public static string IntToString(int value)\n {\n string result = string.Empty;\n int targetBase = baseChars.Length;\n\n do\n {\n result = baseChars[value % targetBase] + result;\n value = value / targetBase;\n }\n while (value > 0);\n\n return result;\n }\n\n public static bool NextPermutation(IList items) where T : IComparable\n {\n var i = -1;\n for (var x = items.Count - 2; x >= 0; x--)\n {\n if (items[x].CompareTo(items[x + 1]) < 0)\n {\n i = x;\n break;\n }\n }\n\n if (i == -1)\n {\n return false;\n }\n var j = 0;\n for (var x = items.Count - 1; x > i; x--)\n {\n if (items[x].CompareTo(items[i]) > 0)\n {\n j = x;\n break;\n }\n }\n var temp = items[i];\n items[i] = items[j];\n items[j] = temp;\n //Array.Reverse(items, i + 1, items.Count - (i + 1));\n var index = i + 1;\n var endIndex = index + items.Count - (i + 1) - 1;\n while (index < endIndex)\n {\n temp = items[index];\n items[index] = items[endIndex];\n items[endIndex] = temp;\n index++;\n endIndex--;\n }\n return true;\n } \n\n private static readonly Scanner cin = new Scanner();\n\n private static void Main()\n {\n#if DEBUG\n var inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n var testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n var consoleOut = Console.Out;\n for (var i = 0; i < testCases.Length; i++)\n {\n var parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n Console.SetIn(new StringReader(parts[0].Trim()));\n var stringWriter = new StringWriter();\n Console.SetOut(stringWriter);\n var sw = Stopwatch.StartNew();\n new Template().Solve();\n sw.Stop();\n var output = stringWriter.ToString();\n\n Console.SetOut(consoleOut);\n var color = ConsoleColor.Green;\n var status = \"Passed\";\n if (parts[1].Trim() != output.Trim())\n {\n color = ConsoleColor.Red;\n status = \"Failed\";\n }\n Console.ForegroundColor = color;\n Console.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n }\n Console.ReadLine();\n Console.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n }\n }\n\n internal class Scanner\n {\n private string[] s = new string[0];\n private int i;\n private readonly char[] cs = { ' ' };\n\n public string NextString()\n {\n if (i < s.Length) return s[i++];\n var line = Console.ReadLine() ?? string.Empty;\n s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 1;\n return s.First();\n }\n\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Problem_C\n{\n class Main_CLass\n {\n static void Main(string[] args)\n {\n\n Console.WriteLine((new Solution()).Solve_Problem());\n Console.ReadLine();\n }\n }\n class Solution\n {\n string[] str;\n public long Solve_Problem()\n {\n str = Console.ReadLine().Split(' ');\n long n = long.Parse(str[0]); long m = long.Parse(str[1]);\n long left_dial = Seventh_Notanion(n - 1).Length; long right_dial = Seventh_Notanion(m - 1).Length;\n long dial = left_dial + right_dial;\n if (dial > 7) return 0;\n long ans = 0;\n for (long i = 0; i < n; i++)\n for (long j = 0; j < m; j++)\n {\n string left_face = Seventh_Notanion(i);\n while (left_face.Length != left_dial) left_face = '0' + left_face;\n string right_face = Seventh_Notanion(j);\n while (right_face.Length != right_dial) right_face = '0' + right_face;\n string face = left_face + right_face;\n if (IsCorrect(face))\n ans++;\n }\n return ans;\n }\n public string Seventh_Notanion(long x)\n {\n string ans = \"\";\n while (x > 0)\n {\n ans = (x % 7).ToString() + ans;\n x /= 7;\n }\n if (ans == \"\") return \"0\";\n return ans;\n }\n public static bool IsCorrect(string s)\n {\n for (int i = 0; i < s.Length; i++)\n for (int j = i + 1; j < s.Length; j++)\n if (s[i] == s[j]) return false;\n return true;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Template\n {\n private void Solve()\n {\n var n = cin.NextInt();\n var m = cin.NextInt();\n\n var maxN = IntToString(n - 1);\n var maxM = IntToString(m - 1);\n\n var length = maxN.Length + maxM.Length;\n if (length > 7)\n {\n Console.WriteLine(0);\n return;\n }\n\n var nn = long.Parse(maxN);\n var mm = long.Parse(maxM);\n\n var max = 7;\n for (var i = 1; i < length; i++)\n {\n max *= 10;\n }\n\n var digits = new HashSet();\n var cnt = 0;\n for (var i = 0; i < max; i++)\n {\n digits.Clear();\n var ok = true;\n var num = i;\n while (num > 0)\n {\n var rem = num%10;\n if (rem > 6)\n {\n ok = false;\n break;\n }\n if (digits.Contains(rem))\n {\n ok = false;\n break;\n }\n digits.Add(rem);\n num /= 10;\n }\n if (!ok)\n {\n continue;\n }\n\n if (length == digits.Count)\n {\n var str = i.ToString();\n var first = str.Substring(0, maxN.Length);\n var second = str.Substring(maxN.Length);\n if (long.Parse(first) <= nn && long.Parse(second) <= mm)\n {\n cnt++;\n }\n }\n else if (length - digits.Count == 1 && !digits.Contains(0))\n {\n var str = \"0\" + i.ToString();\n var first = str.Substring(0, maxN.Length);\n var second = str.Substring(maxN.Length);\n if (long.Parse(first) <= nn && long.Parse(second) <= mm)\n {\n cnt++;\n }\n }\n }\n\n Console.WriteLine(cnt);\n\n return;\n\n var count = 0;\n var chars = new List();\n for (var i = 0; i < n; i++)\n {\n var hasZero = false;\n\n var num = IntToString(i);\n if (num.Length < maxN.Length)\n {\n if (maxN.Length - num.Length == 1)\n {\n if (!num.Contains('0'))\n {\n hasZero = true;\n }\n else\n {\n continue;\n }\n }\n else\n {\n continue;\n }\n }\n\n chars.Clear();\n if (!hasZero && !num.Contains('0'))\n {\n chars.Add('0');\n }\n\n for (var c = '1'; c <= '6'; c++)\n {\n if (!num.Contains(c))\n {\n chars.Add(c);\n }\n }\n\n var unique = new HashSet();\n do\n {\n var str = new string(chars.ToArray()).Substring(0, maxM.Length);\n if (!unique.Contains(str))\n {\n unique.Add(str);\n var value = long.Parse(str);\n if (value <= mm)\n {\n count++;\n }\n }\n } while (NextPermutation(chars));\n }\n\n Console.WriteLine(count);\n\n }\n\n private static readonly char[] baseChars = new[] {'0', '1', '2', '3', '4', '5', '6'};\n\n public static string IntToString(int value)\n {\n string result = string.Empty;\n int targetBase = baseChars.Length;\n\n do\n {\n result = baseChars[value % targetBase] + result;\n value = value / targetBase;\n }\n while (value > 0);\n\n return result;\n }\n\n public static bool NextPermutation(IList items) where T : IComparable\n {\n var i = -1;\n for (var x = items.Count - 2; x >= 0; x--)\n {\n if (items[x].CompareTo(items[x + 1]) < 0)\n {\n i = x;\n break;\n }\n }\n\n if (i == -1)\n {\n return false;\n }\n var j = 0;\n for (var x = items.Count - 1; x > i; x--)\n {\n if (items[x].CompareTo(items[i]) > 0)\n {\n j = x;\n break;\n }\n }\n var temp = items[i];\n items[i] = items[j];\n items[j] = temp;\n //Array.Reverse(items, i + 1, items.Count - (i + 1));\n var index = i + 1;\n var endIndex = index + items.Count - (i + 1) - 1;\n while (index < endIndex)\n {\n temp = items[index];\n items[index] = items[endIndex];\n items[endIndex] = temp;\n index++;\n endIndex--;\n }\n return true;\n } \n\n private static readonly Scanner cin = new Scanner();\n\n private static void Main()\n {\n#if DEBUG\n var inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n var testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n var consoleOut = Console.Out;\n for (var i = 0; i < testCases.Length; i++)\n {\n var parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n Console.SetIn(new StringReader(parts[0].Trim()));\n var stringWriter = new StringWriter();\n Console.SetOut(stringWriter);\n var sw = Stopwatch.StartNew();\n new Template().Solve();\n sw.Stop();\n var output = stringWriter.ToString();\n\n Console.SetOut(consoleOut);\n var color = ConsoleColor.Green;\n var status = \"Passed\";\n if (parts[1].Trim() != output.Trim())\n {\n color = ConsoleColor.Red;\n status = \"Failed\";\n }\n Console.ForegroundColor = color;\n Console.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n }\n Console.ReadLine();\n Console.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n }\n }\n\n internal class Scanner\n {\n private string[] s = new string[0];\n private int i;\n private readonly char[] cs = { ' ' };\n\n public string NextString()\n {\n if (i < s.Length) return s[i++];\n var line = Console.ReadLine() ?? string.Empty;\n s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 1;\n return s.First();\n }\n\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace ConsoleApplication45\n{\n class Program\n {\n static void Main(string[] args)\n {\n Reader input = new Reader();\n const int BASE = 7;\n int n = input.GiveNext(), m = input.GiveNext();\n int len1 = 1, len2 = 1;\n for (int i = BASE; i < n; i *= BASE) len1++;\n for (int i = BASE; i < m; i *= BASE) len2++;\n int ans = 0;\n if (len1 + len2 <= 7)\n for (int hour = 0; hour < n; hour++)\n for (int minute = 0; minute < m; minute++)\n {\n int[] digits = new int[BASE];\n for (int current_hour = hour, k = 0; k != len1; current_hour /= BASE, k++)\n digits[current_hour % BASE]++;\n for (int current_minute = minute, k = 0; k != len2; current_minute /= BASE, k++)\n digits[current_minute % BASE]++;\n if (digits.Max() <= 1) ans++;\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n class Reader\n {\n string[] elements;\n int i;\n public int GiveNext()\n {\n string ans;\n if (elements == null || i == elements.Length)\n {\n elements = Console.ReadLine().Split(' ');\n ans = elements[0];\n i = 1;\n }\n else\n {\n ans = elements[i];\n i++;\n }\n return int.Parse(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\ninternal class Program\n{\n public static int GetMaxDigitsOf7CC(int n)\n {\n int ret = 0;\n if (n == 0)\n return 1;\n while (n != 0)\n {\n ret++;\n n /= 7;\n }\n return ret;\n }\n\n private static void Main(string[] args)\n {\n int ans = 0;\n var inp = (Console.ReadLine()).Split(' ').Select(int.Parse).ToArray();\n var h = inp[0];\n var m = inp[1];\n var hr = GetMaxDigitsOf7CC(h - 1);\n var mr = GetMaxDigitsOf7CC(m - 1);\n if (hr + mr > 7)\n Console.WriteLine(\"0\");\n else\n {\n for (int i = 0; i < h; i++)\n {\n for (int j = 0; j < m; j++)\n {\n int[] mas = new int[7];\n bool is_ok = true;\n //-----------h\n int tmp = i;\n for (int z1 = 0; z1 < hr; z1++)\n {\n int ost = tmp % 7;\n mas[ost]++;\n if (mas[ost] > 1)\n {\n is_ok = false;\n break;\n }\n tmp /= 7;\n }\n //---------m\n tmp = j;\n for (int z2 = 0; z2 < mr; z2++)\n {\n int ost = tmp % 7;\n mas[ost]++;\n if (mas[ost] > 1)\n {\n is_ok = false;\n break;\n }\n tmp /= 7;\n }\n if (is_ok == true)\n {\n //Console.WriteLine(\"{0} {1}\", i, j);\n ans++;\n }\n }\n }\n Console.WriteLine(\"{0}\", ans);\n }\n //Console.ReadKey();\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private long result = 0;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/problemset/problem/681/C\n\n var input = _reader.ReadIntArray();\n var n = input[0];\n var m = input[1];\n var maxN = n / 7 + 1;\n var maxM = m / 7 + 1;\n var numbers = new HashSet();\n\n if (Math.Max(n, m) > Math.Pow(7, 7))\n {\n return this;\n }\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (i == j) continue;\n numbers.Clear();\n if (ToSeven(i, maxN, numbers) && ToSeven(j, maxM, numbers))\n {\n result++;\n }\n }\n }\n\n return this;\n }\n\n private bool ToSeven(int val, int max, HashSet nums)\n {\n for (int i = max - 1; i >= 0; i--)\n {\n var value = val % 7;\n if (nums.Contains(value)) return false;\n val /= 7;\n nums.Add(value);\n }\n\n return true;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString();\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Template\n {\n private void Solve()\n {\n var n = cin.NextInt();\n var m = cin.NextInt();\n\n var maxN = IntToString(n - 1);\n var maxM = IntToString(m - 1);\n\n var length = maxN.Length + maxM.Length;\n if (length > 7)\n {\n Console.WriteLine(0);\n return;\n }\n\n var mm = long.Parse(maxM);\n\n var count = 0;\n var chars = new List();\n for (var i = 0; i < n; i++)\n {\n var hasZero = false;\n\n var num = IntToString(i);\n if (num.Length < maxN.Length)\n {\n if (maxN.Length - num.Length == 1)\n {\n if (!num.Contains('0'))\n {\n hasZero = true;\n }\n else\n {\n continue;\n }\n }\n else\n {\n continue;\n }\n }\n\n chars.Clear();\n if (!hasZero && !num.Contains('0'))\n {\n chars.Add('0');\n }\n\n for (var c = '1'; c <= '6'; c++)\n {\n if (!num.Contains(c))\n {\n chars.Add(c);\n }\n }\n\n var unique = new HashSet();\n do\n {\n var str = new string(chars.ToArray()).Substring(0, maxM.Length);\n if (!unique.Contains(str))\n {\n unique.Add(str);\n var value = long.Parse(str);\n if (value <= mm)\n {\n count++;\n }\n }\n } while (NextPermutation(chars));\n }\n\n Console.WriteLine(count);\n\n }\n\n private static readonly char[] baseChars = new[] {'0', '1', '2', '3', '4', '5', '6'};\n\n public static string IntToString(int value)\n {\n string result = string.Empty;\n int targetBase = baseChars.Length;\n\n do\n {\n result = baseChars[value % targetBase] + result;\n value = value / targetBase;\n }\n while (value > 0);\n\n return result;\n }\n\n public static bool NextPermutation(IList items) where T : IComparable\n {\n var i = -1;\n for (var x = items.Count - 2; x >= 0; x--)\n {\n if (items[x].CompareTo(items[x + 1]) < 0)\n {\n i = x;\n break;\n }\n }\n\n if (i == -1)\n {\n return false;\n }\n var j = 0;\n for (var x = items.Count - 1; x > i; x--)\n {\n if (items[x].CompareTo(items[i]) > 0)\n {\n j = x;\n break;\n }\n }\n var temp = items[i];\n items[i] = items[j];\n items[j] = temp;\n //Array.Reverse(items, i + 1, items.Count - (i + 1));\n var index = i + 1;\n var endIndex = index + items.Count - (i + 1) - 1;\n while (index < endIndex)\n {\n temp = items[index];\n items[index] = items[endIndex];\n items[endIndex] = temp;\n index++;\n endIndex--;\n }\n return true;\n } \n\n private static readonly Scanner cin = new Scanner();\n\n private static void Main()\n {\n#if DEBUG\n var inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n var testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n var consoleOut = Console.Out;\n for (var i = 0; i < testCases.Length; i++)\n {\n var parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n Console.SetIn(new StringReader(parts[0].Trim()));\n var stringWriter = new StringWriter();\n Console.SetOut(stringWriter);\n var sw = Stopwatch.StartNew();\n new Template().Solve();\n sw.Stop();\n var output = stringWriter.ToString();\n\n Console.SetOut(consoleOut);\n var color = ConsoleColor.Green;\n var status = \"Passed\";\n if (parts[1].Trim() != output.Trim())\n {\n color = ConsoleColor.Red;\n status = \"Failed\";\n }\n Console.ForegroundColor = color;\n Console.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n }\n Console.ReadLine();\n Console.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n }\n }\n\n internal class Scanner\n {\n private string[] s = new string[0];\n private int i;\n private readonly char[] cs = { ' ' };\n\n public string NextString()\n {\n if (i < s.Length) return s[i++];\n var line = Console.ReadLine() ?? string.Empty;\n s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 1;\n return s.First();\n }\n\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\ninternal class Program\n{\n public static int GetMaxDigitsOf7CC(int n)\n {\n int ret = 0;\n if (n == 0)\n return 1;\n while (n != 0)\n {\n ret++;\n n /= 7;\n }\n return ret;\n }\n\n private static void Main(string[] args)\n {\n int ans = 0;\n var inp = (Console.ReadLine()).Split(' ').Select(int.Parse).ToArray();\n var h = inp[0];\n var m = inp[1];\n var hr = GetMaxDigitsOf7CC(h);\n var mr = GetMaxDigitsOf7CC(m);\n if (hr + mr > 7)\n Console.WriteLine(\"0\");\n else\n {\n for (int i = 0; i < h; i++)\n {\n for (int j = 0; j < m; j++)\n {\n int[] mas = new int[7];\n bool is_ok = true;\n //-----------h\n int tmp = i;\n for (int z1 = 0; z1 < hr; z1++)\n {\n int ost = tmp % 7;\n mas[ost]++;\n if (mas[ost] > 1)\n {\n is_ok = false;\n break;\n }\n tmp /= 7;\n }\n //---------m\n tmp = j;\n for (int z2 = 0; z2 < mr; z2++)\n {\n int ost = tmp % 7;\n mas[ost]++;\n if (mas[ost] > 1)\n {\n is_ok = false;\n break;\n }\n tmp /= 7;\n }\n if (is_ok == true)\n {\n //Console.WriteLine(\"{0} {1}\", i, j);\n ans++;\n }\n }\n }\n Console.WriteLine(\"{0}\", ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _686C\n{\n class Program\n {\n static int[] powers7 = new[] { 7, 49, 343, 2401, 16807, 117649, 823543, 5764801, 40353607, 282475249 };\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]), m = int.Parse(input[1]);\n long answer = 0;\n int firstDigits = 0, secondDigits = 0;\n for (var a = 7; a < n; a *= 7)\n firstDigits += 1;\n for (var b = 7; b < m; b *= 7)\n secondDigits += 1;\n\n if (firstDigits + secondDigits <= 7)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n int[] used = new int[7];\n for (int a = i, k = 0; k != firstDigits; a /= 7, k++)\n used[a % 7]++;\n for (int b = j, k = 0; k != secondDigits; b /= 7, k++)\n used[b % 7]++;\n\n if (used.Max() <= 1) answer++;\n }\n }\n }\n\n Console.WriteLine(answer);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var log = nlog + mlog;\n\n var result = 0;\n\n\n\n var a = new int[7] { 0, 1, 2, 3, 4, 5, 6 };\n int[] prev = new int[7];\n do\n {\n if (prev != null)\n {\n var fl = true;\n for (int i = 0; i < log; i++)\n {\n if (a[i] != prev[i])\n {\n fl = false;\n break;\n }\n }\n if (fl)\n {\n continue;\n }\n }\n var v = 0;\n var pow = 1;\n for (int i = 0; i < nlog; i++)\n {\n v += a[i] * pow;\n pow *= 7;\n }\n if (v >= n)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n\n pow = 1;\n v = 0;\n for (int i = 0; i < mlog; i++)\n {\n v += a[nlog + i] * pow;\n pow *= 7;\n }\n if (v >= m)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n result++;\n Array.Copy(a, prev, 7);\n } while (NextPermutation(a));\n return result;\n }\n\n \n }\n private static bool NextPermutation(int[] numList)\n {\n /*\n Knuths\n 1. Find the largest index j such that a[j] < a[j + 1]. If no such index exists, the permutation is the last permutation.\n 2. Find the largest index l such that a[j] < a[l]. Since j + 1 is such an index, l is well defined and satisfies j < l.\n 3. Swap a[j] with a[l].\n 4. Reverse the sequence from a[j + 1] up to and including the final element a[n].\n\n */\n var largestIndex = -1;\n for (var i = numList.Length - 2; i >= 0; i--)\n {\n if (numList[i] < numList[i + 1])\n {\n largestIndex = i;\n break;\n }\n }\n\n if (largestIndex < 0) return false;\n\n var largestIndex2 = -1;\n for (var i = numList.Length - 1; i >= 0; i--)\n {\n if (numList[largestIndex] < numList[i])\n {\n largestIndex2 = i;\n break;\n }\n }\n\n var tmp = numList[largestIndex];\n numList[largestIndex] = numList[largestIndex2];\n numList[largestIndex2] = tmp;\n\n for (int i = largestIndex + 1, j = numList.Length - 1; i < j; i++, j--)\n {\n tmp = numList[i];\n numList[i] = numList[j];\n numList[j] = tmp;\n }\n\n return true;\n }\n\n public int logbase7(long v)\n {\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var log = nlog + mlog;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var counts = new int[7];\n counts[0] = (nlog + mlog);\n var bads = 1;\n var result = 0;\n\n\n\n var a = new int[7] { 0, 1, 2, 3, 4, 5, 6 };\n int[] prev = new int[7];\n while (NextPermutation(a))\n {\n if (prev != null)\n {\n var fl = true;\n for (int i = 0; i < log; i++)\n {\n if (a[i] != prev[i])\n {\n fl = false;\n break;\n }\n }\n if (fl)\n {\n continue;\n }\n }\n var v = 0;\n var pow = 1;\n for (int i = 0; i < nlog; i++)\n {\n v += a[i] * pow;\n pow *= 7;\n }\n if (v >= n)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n\n pow = 1;\n v = 0;\n for (int i = 0; i < mlog; i++)\n {\n v += a[nlog + i] * pow;\n pow *= 7;\n }\n if (v >= m)\n {\n Array.Copy(a, prev, 7);\n continue;\n }\n result++;\n Array.Copy(a, prev, 7);\n }\n return result;\n }\n\n \n }\n private static bool NextPermutation(int[] numList)\n {\n /*\n Knuths\n 1. Find the largest index j such that a[j] < a[j + 1]. If no such index exists, the permutation is the last permutation.\n 2. Find the largest index l such that a[j] < a[l]. Since j + 1 is such an index, l is well defined and satisfies j < l.\n 3. Swap a[j] with a[l].\n 4. Reverse the sequence from a[j + 1] up to and including the final element a[n].\n\n */\n var largestIndex = -1;\n for (var i = numList.Length - 2; i >= 0; i--)\n {\n if (numList[i] < numList[i + 1])\n {\n largestIndex = i;\n break;\n }\n }\n\n if (largestIndex < 0) return false;\n\n var largestIndex2 = -1;\n for (var i = numList.Length - 1; i >= 0; i--)\n {\n if (numList[largestIndex] < numList[i])\n {\n largestIndex2 = i;\n break;\n }\n }\n\n var tmp = numList[largestIndex];\n numList[largestIndex] = numList[largestIndex2];\n numList[largestIndex2] = tmp;\n\n for (int i = largestIndex + 1, j = numList.Length - 1; i < j; i++, j--)\n {\n tmp = numList[i];\n numList[i] = numList[j];\n numList[j] = tmp;\n }\n\n return true;\n }\n\n public int logbase7(long v)\n {\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var counts = new int[7];\n counts[0] = (nlog + mlog);\n var bads = 1;\n var result = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (bads == 0)\n result++;\n int digit = 0;\n while(digit < mlog)\n {\n if (mins[digit] < 6)\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit]++;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit] = 0;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n }\n digit++;\n }\n }\n for (int z = 0; z < mlog; z++)\n {\n counts[mins[z]]--;\n if (counts[mins[z]] == 1)\n bads--;\n mins[z] = 0;\n counts[mins[z]]++;\n if (counts[mins[z]] == 2)\n bads++;\n }\n var d = 0;\n while (d < nlog)\n {\n if (hour[d] < 6)\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d]++;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d] = 0;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n }\n d++;\n }\n\n }\n return result;\n }\n \n }\n\n public void AllSubsets(int all, int k)\n {\n \n }\n\n public int logbase7(long v)\n {\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var counts = new int[7];\n counts[0] = (nlog + mlog);\n var bads = 1;\n var result = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (bads == 0)\n result++;\n int digit = 0;\n while(digit < mlog)\n {\n if (mins[digit] < 6)\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit]++;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[mins[digit]]--;\n if (counts[mins[digit]] == 1)\n bads--;\n mins[digit] = 0;\n counts[mins[digit]]++;\n if (counts[mins[digit]] == 2)\n bads++;\n }\n digit++;\n }\n }\n for (int z = 0; z < mlog; z++)\n {\n counts[mins[z]]--;\n if (counts[mins[z]] == 1)\n bads--;\n mins[z] = 0;\n counts[mins[z]]++;\n if (counts[mins[z]] == 2)\n bads++;\n break;\n }\n var d = 0;\n while (d < nlog)\n {\n if (hour[d] < 6)\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d]++;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n break;\n }\n else\n {\n counts[hour[d]]--;\n if (counts[hour[d]] == 1)\n bads--;\n hour[d] = 0;\n counts[hour[d]]++;\n if (counts[hour[d]] == 2)\n bads++;\n }\n d++;\n }\n\n }\n return result;\n }\n \n }\n\n public void AllSubsets(int all, int k)\n {\n \n }\n\n public int logbase7(long v)\n {\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n //FileName = \"input\";\n var n = ReadLongToken();\n var m = ReadLongToken();\n var nlog = logbase7(n);\n var mlog = logbase7(m);\n if (nlog + mlog > 7)\n return 0;\n var log = nlog + mlog;\n var hour = new int[nlog];\n var mins = new int[mlog];\n var counts = new int[7];\n counts[0] = (nlog + mlog);\n var bads = 1;\n var result = 0;\n\n\n\n var a = new int[7] { 0, 1, 2, 3, 4, 5, 6 };\n int[] prev = new int[7];\n while (NextPermutation(a))\n {\n if (prev != null)\n {\n var fl = true;\n for (int i = 0; i < log; i++)\n {\n if (a[i] != prev[i])\n {\n fl = false;\n break;\n }\n }\n if (fl)\n {\n continue;\n }\n }\n var v = 0;\n var pow = 1;\n for (int i = 0; i < nlog; i++)\n {\n v += a[i] * pow;\n pow *= 7;\n }\n if (v >= n)\n continue;\n\n pow = 1;\n v = 0;\n for (int i = 0; i < mlog; i++)\n {\n v += a[nlog + i] * pow;\n pow *= 7;\n }\n if (v >= m)\n continue;\n result++;\n Array.Copy(a, prev, 7);\n }\n return result;\n }\n\n \n }\n private static bool NextPermutation(int[] numList)\n {\n /*\n Knuths\n 1. Find the largest index j such that a[j] < a[j + 1]. If no such index exists, the permutation is the last permutation.\n 2. Find the largest index l such that a[j] < a[l]. Since j + 1 is such an index, l is well defined and satisfies j < l.\n 3. Swap a[j] with a[l].\n 4. Reverse the sequence from a[j + 1] up to and including the final element a[n].\n\n */\n var largestIndex = -1;\n for (var i = numList.Length - 2; i >= 0; i--)\n {\n if (numList[i] < numList[i + 1])\n {\n largestIndex = i;\n break;\n }\n }\n\n if (largestIndex < 0) return false;\n\n var largestIndex2 = -1;\n for (var i = numList.Length - 1; i >= 0; i--)\n {\n if (numList[largestIndex] < numList[i])\n {\n largestIndex2 = i;\n break;\n }\n }\n\n var tmp = numList[largestIndex];\n numList[largestIndex] = numList[largestIndex2];\n numList[largestIndex2] = tmp;\n\n for (int i = largestIndex + 1, j = numList.Length - 1; i < j; i++, j--)\n {\n tmp = numList[i];\n numList[i] = numList[j];\n numList[j] = tmp;\n }\n\n return true;\n }\n\n public int logbase7(long v)\n {\n var res = 0;\n v = v - 1;\n while(v > 0)\n {\n v /= 7;\n res++;\n }\n return res;\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tprivate long result = 0L;\n\t\tprivate List daysInSeven;\n\t\tprivate List minsInSeven;\n\t\tprivate string firstStr;\n\t\tprivate string secondStr;\n\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0] - 1;\n\t\t\tvar m = input[1] - 1;\n\t\t\tdaysInSeven = ToSevenBase(n);\n\t\t\tminsInSeven = ToSevenBase(m);\n\t\t\tvar reversed = daysInSeven.ToArray().Reverse();\n\t\t\tfirstStr = reversed.Aggregate(\"\", (curr, item) => curr + item);\n\t\t\treversed = minsInSeven.ToArray().Reverse();\n\t\t\tsecondStr = reversed.Aggregate(\"\", (curr, item) => curr + item);\n\t\t\tvar leftCount = daysInSeven.Count;\n\t\t\tvar rightCount = minsInSeven.Count;\n\t\t\tif (leftCount + rightCount > 7) {\n\t\t\t\trightCount -= 7 - leftCount;\n\t\t\t}\n\t\t\tif (rightCount < 0) {\n\t\t\t\trightCount = 0;\n\t\t\t}\n\t\t\tGenerate(0, 0, leftCount, rightCount, leftCount + rightCount, new char[leftCount + rightCount]);\n\n\t\t\tsw.WriteLine(result);\n\t\t}\n\n\t\tprivate void Generate(int currLeft, int currRight, int leftCount, int rightCount, int totalMax, char[] array)\n\t\t{\n\t\t\tif (currLeft + currRight == totalMax) {\n\t\t\t\tvar contains = new int[7];\n\t\t\t\tfor (var i = 0; i < array.Length; i++) {\n\t\t\t\t\tcontains[array[i] - '0']++;\n\t\t\t\t}\n\t\t\t\tvar isDifferent = contains.All(item => item <= 1);\n\t\t\t\tif (isDifferent) {\n\t\t\t\t\tvar leftStr = new String(array, 0, leftCount);\n\t\t\t\t\tvar rightStr = new String(array, leftCount, rightCount);\n\t\t\t\t\tvar leftVal = String.IsNullOrEmpty(leftStr) ? 0L : Int64.Parse(leftStr);\n\t\t\t\t\tvar rightVal = String.IsNullOrEmpty(rightStr) ? 0L : Int64.Parse(rightStr);\n\t\t\t\t\tvar firstVal = String.IsNullOrEmpty(firstStr) ? 0L :Int64.Parse(firstStr);\n\t\t\t\t\tvar secondVal = String.IsNullOrEmpty(secondStr) ? 0L : Int64.Parse(secondStr);\n\t\t\t\t\tif (leftVal <= firstVal && rightVal <= secondVal) {\n\t\t\t\t\t\tresult++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (var i = 0; i < 7; i++) {\n\t\t\t\t\tarray[currLeft + currRight] = (char) ('0' + i);\n\t\t\t\t\tif (currLeft < leftCount)\n\t\t\t\t\t\tGenerate(currLeft + 1, currRight, leftCount, rightCount, totalMax, array);\n\t\t\t\t\telse\n\t\t\t\t\t\tGenerate(currLeft, currRight + 1, leftCount, rightCount, totalMax, array);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate List ToSevenBase(long n)\n\t\t{\n\t\t\tif (n == 0) {\n\t\t\t\treturn new List { 0 };\n\t\t\t}\n\t\t\tconst int b = 7;\n\t\t\tvar list = new List();\n\t\t\tvar curr = (int)n;\n\t\t\twhile (curr > 0) {\n\t\t\t\tlist.Add(curr % b);\n\t\t\t\tcurr /= b;\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.C_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class AATask3\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), m = fs.NextInt();\n if (n > 823543 || m > 823543) writer.WriteLine(0);\n else\n {\n List hours = new List(6000);\n List minutes = new List(6000);\n char[] nums = new char[] { '0', '1', '2', '3', '4', '5', '6' };\n string maxHour = IntToStringFast(n, nums);\n string maxMinute = IntToStringFast(m, nums);\n\n for (int i = 0; i < n; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxHour.Length) sb.Insert(0, 0);\n string hour = sb.ToString();\n if (IsUnique(hour))\n {\n hours.Add(hour);\n }\n }\n for (int i = 0; i < m; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxMinute.Length) sb.Insert(0, 0);\n string minute = sb.ToString();\n if (IsUnique(minute))\n {\n minutes.Add(minute);\n }\n }\n int ans = 0;\n foreach (string h in hours)\n {\n foreach (string min in minutes)\n {\n if (AreUnique(h, min))\n {\n ans++;\n }\n }\n }\n writer.WriteLine(ans);\n }\n }\n }\n\n private static bool AreUnique(string hour, string min)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n count[hour[i] - '0'] = true;\n }\n for (int i = 0; i < min.Length; i++)\n {\n if (count[min[i] - '0']) return false;\n }\n return true;\n }\n\n private static bool IsUnique(string hour)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n if (count[hour[i] - '0']) return false;\n else count[hour[i] - '0'] = true;\n }\n return true;\n }\n public static string IntToStringFast(int value, char[] baseChars)\n {\n // 32 is the worst cast buffer size for base 2 and int.MaxValue\n int i = 32;\n char[] buffer = new char[i];\n int targetBase = baseChars.Length;\n\n do\n {\n buffer[--i] = baseChars[value % targetBase];\n value = value / targetBase;\n }\n while (value > 0);\n\n char[] result = new char[32 - i];\n Array.Copy(buffer, i, result, 0, 32 - i);\n\n return new string(result);\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.C_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class AATask3\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), m = fs.NextInt();\n if (n > 823542 || m > 823542) writer.WriteLine(0);\n else\n {\n List hours = new List(6000);\n List minutes = new List(6000);\n char[] nums = new char[] { '0', '1', '2', '3', '4', '5', '6' };\n string maxHour = IntToStringFast(n, nums);\n string maxMinute = IntToStringFast(m, nums);\n\n for (int i = 0; i < n; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxHour.Length) sb.Insert(0, 0);\n string hour = sb.ToString();\n if (IsUnique(hour))\n {\n hours.Add(hour);\n }\n }\n for (int i = 0; i < m; i++)\n {\n StringBuilder sb = new StringBuilder(IntToStringFast(i, nums));\n while (sb.Length < maxMinute.Length) sb.Insert(0, 0);\n string minute = sb.ToString();\n if (IsUnique(minute))\n {\n minutes.Add(minute);\n }\n }\n int ans = 0;\n foreach (string h in hours)\n {\n foreach (string min in minutes)\n {\n if (AreUnique(h, min))\n {\n ans++;\n }\n }\n }\n writer.WriteLine(ans);\n }\n }\n }\n\n private static bool AreUnique(string hour, string min)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n count[hour[i] - '0'] = true;\n }\n for (int i = 0; i < min.Length; i++)\n {\n if (count[min[i] - '0']) return false;\n }\n return true;\n }\n\n private static bool IsUnique(string hour)\n {\n bool[] count = new bool[7];\n for (int i = 0; i < hour.Length; i++)\n {\n if (count[hour[i] - '0']) return false;\n else count[hour[i] - '0'] = true;\n }\n return true;\n }\n public static string IntToStringFast(int value, char[] baseChars)\n {\n // 32 is the worst cast buffer size for base 2 and int.MaxValue\n int i = 32;\n char[] buffer = new char[i];\n int targetBase = baseChars.Length;\n\n do\n {\n buffer[--i] = baseChars[value % targetBase];\n value = value / targetBase;\n }\n while (value > 0);\n\n char[] result = new char[32 - i];\n Array.Copy(buffer, i, result, 0, 32 - i);\n\n return new string(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace olimpSolve\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = p[0];\n int m = p[1];\n double r1 = Math.Log(n, 7);\n double r2 = Math.Log(m, 7);\n int t1 = (int) Math.Ceiling(r1);\n int t2 = (int) Math.Ceiling(r2);\n int result = 0;\n for (int i = 0; i < Math.Min(n, 50); i++)\n {\n for (int j = 0; j < Math.Min(m, 50); j++)\n {\n string str1 = ToSevenBase(i).PadLeft(t1, '0');\n string str2 = ToSevenBase(j).PadLeft(t2, '0');\n string str = str1 + str2;\n if (str.ToCharArray().Distinct().Count() == str.Length)\n result++;\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n\n private static string ToSevenBase(int n)\n {\n string p = string.Empty;\n while (n > 0)\n {\n p += (n % 7);\n n /= 7;\n }\n return p;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.AccessControl;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace olimpSolve\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = p[0];\n int m = p[1];\n int t1 = (int)Math.Ceiling(Math.Log(n, 7));\n int t2 = (int) Math.Ceiling(Math.Log(m, 7));\n int result = 0;\n if (t1 + t2 <= 7)\n {\n var arr = new List();\n Generate(arr, 0, new int[t1 + t2]);\n foreach (var item in arr)\n {\n int p1 = ToDec(item, 0, t1);\n int p2 = ToDec(item,t1, item.Length);\n if (p1 < n && p2 < m)\n result++;\n /*for (int i = 1; i < item.Length; i++)\n {\n int p1 = ToDec(item, 0, i);\n int p2 = ToDec(item, i, item.Length);\n if (p1 < n && p2 < m)\n result++;\n }*/\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n\n private static int ToDec(int[] arr, int l, int r)\n {\n int k = 0;\n for (int i = l; i < r; i++)\n {\n k = k * 7 + arr[i];\n }\n return k;\n }\n\n private static void Generate(Listarr , int index, int[] was)\n {\n if (index == was.Length)\n {\n arr.Add(was.ToArray());\n }\n else\n {\n for (int i = 0; i < 7; i++)\n {\n if (!was.Take(index).Contains(i))\n {\n was[index] = i;\n Generate(arr, index + 1, was);\n }\n } \n }\n } \n }\n}\n"}, {"source_code": "/*\n * TemplateCS\n * Copyright (C) 2014-2016 Markus Himmel\n * This file is distributed under the terms of the MIT license\n */\n\n//#define CodeJam\n#define CodeForces\n\nusing System;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ProgrammingCompetitions\n{\n\tclass Program\n\t{\n\n#region GCJ\n#if CodeJam\n\t\tprivate static bool DEBUG = false;\n\n\t\tstatic void debug()\n\t\t{\n\t\t}\n\n\t\tstatic string solveCase(int num)\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n#endif\n#endregion\n\n#region CodeForces\n#if CodeForces\n#if DEBUG\n\t\tstatic Queue testInput = new Queue(new string[]\n\t\t{\n\t\t\t\"2401 343\",\n\t\t});\n#endif\n\n\t\tstatic string Solve()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tint n, m;\n\t\t\t\tread(out n, out m);\n\n\t\t\t\tint h = 1;\n\t\t\t\tint nneed = 0;\n\t\t\t\twhile (h < n)\n\t\t\t\t{\n\t\t\t\t\tnneed++;\n\t\t\t\t\th *= 7;\n\t\t\t\t}\n\t\t\t\th = 1;\n\t\t\t\tint mneed = 0;\n\t\t\t\twhile (h < m)\n\t\t\t\t{\n\t\t\t\t\tmneed++;\n\t\t\t\t\th *= 7;\n\t\t\t\t}\n\t\t\t\tif (mneed + nneed > 7)\n\t\t\t\t\treturn \"0\";\n\n\t\t\t\tint res = 0;\n\n\t\t\t\t// at most 7^7\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tHashSet e = new HashSet();\n\t\t\t\t\t\tbool o = false;\n\t\t\t\t\t\tint ii = i, jj = j;\n\t\t\t\t\t\tfor (int nn = 0; nn < nneed; nn++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!e.Add(ii % 7))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\to = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tii /= 7;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (o)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tfor (int mm = 0; mm < mneed; mm++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (!e.Add(jj % 7))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\to = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjj /= 7;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!o)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tres++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn res.ToString();\n\t\t\t}\n\t\t}\n#endif\n#endregion\n\n\t\t// Everything after this comment is template code\n\n\t\tprivate static T read()\n\t\t{\n\t\t\treturn (T)Convert.ChangeType(read(), typeof(T));\n\t\t}\n\n\t\tprivate static T[] readMany()\n\t\t{\n\t\t\treturn readMany(' ');\n\t\t}\n\n\t\tprivate static _[] readMany<_>(params char[] ___)\n\t\t{\n\t\t\treturn read().Split(___).Select(__ => (_)Convert.ChangeType(__, typeof(_))).ToArray();\n\t\t}\n\n\t\tprivate static string[] readMany()\n\t\t{\n\t\t\treturn readMany();\n\t\t}\n\n\t\tprivate static T[][] readMany(int n)\n\t\t{\n\t\t\tT[][] res = new T[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tres[i] = readMany();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Func map)\n\t\t{\n\t\t\tT[][] res = new T[height][];\n\t\t\tfor (int _ = 0; _ < height; _++)\n\t\t\t{\n\t\t\t\tres[_] = read().Select(c => map(c)).ToArray();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static char[][] readField(int height)\n\t\t{\n\t\t\treturn readField(height, c => c);\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Dictionary dic)\n\t\t{\n\t\t\treturn readField(height, c => dic[c]);\n\t\t}\n\n\t\tprivate static void read(out T1 t1)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4, out T5 t5)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t\tt5 = (T5)Convert.ChangeType(vals[4], typeof(T5));\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3, t4) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3, t4);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, t4, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tstatic IEnumerable range(long first, long last, long step = 1)\n\t\t{\n\t\t\tfor (long i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic IEnumerable range(int first, int last, int step = 1)\n\t\t{\n\t\t\tfor (int i = first; i <= last; i+= step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic T id(T a)\n\t\t{\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic static T[][] mkarr(int x, int y)\n\t\t{\n\t\t\tT[][] res = new T[x][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y];\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] mkarr(int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = new T[x][][];\n\t\t\tfor (int i = 0; i < x; i++)\n\t\t\t{\n\t\t\t\tres[i] = new T[y][];\n\t\t\t\tfor (int j = 0; j < y; j++)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = new T[z];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic bool[] tf = new[] { true, false };\n\n\n#if CodeJam\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tif (DEBUG)\n\t\t\t{\n\t\t\t\tdebug();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tInitialize();\n\t\t\t\tSolveAll(solveCase);\n\t\t\t}\n\t\t\tConsole.ReadKey();\n\t\t}\n\n\t\tprivate static StreamReader inf;\n\t\tprivate static StreamWriter outf;\n\n\t\tprivate delegate void o(string format, params object[] args);\n\t\tprivate static o Output;\n\n\t\tpublic static void Initialize()\n\t\t{\n\t\t\tConsole.ForegroundColor = ConsoleColor.Yellow;\n\t\t\tConsole.Write(\"File name: \");\n\t\t\tstring name = Console.ReadLine();\n\t\t\tinf = new StreamReader($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.in\");\n\t\t\toutf = new StreamWriter($\"D:\\\\Users\\\\marku\\\\Downloads\\\\{name}.out\");\n\t\t\tConsole.ForegroundColor = ConsoleColor.White;\n\t\t\tOutput = highlightedPrint;\n\t\t\tOutput += outf.WriteLine;\n\t\t}\n\n\t\tprivate static void highlightedPrint(string format, params object[] args)\n\t\t{\n\t\t\tConsoleColor prev = Console.ForegroundColor;\n\t\t\tConsole.ForegroundColor = ConsoleColor.Green;\n\t\t\tConsole.WriteLine(format, args);\n\t\t\tConsole.ForegroundColor = prev;\n\t\t}\n\n\t\tpublic static void SolveAll(Func calc)\n\t\t{\n\t\t\tint cases = int.Parse(inf.ReadLine());\n\t\t\tfor (int _ = 1; _ <= cases; _++)\n\t\t\t{\n\t\t\t\tOutput($\"Case #{_}: {calc(_)}\");\n\t\t\t}\n\t\t\tinf.Close();\n\t\t\toutf.Close();\n\t\t\tConsole.ForegroundColor = ConsoleColor.Cyan;\n\t\t\tConsole.WriteLine(\"Eureka!\");\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n\t\t\treturn inf.ReadLine();\n\t\t}\n#endif\n\n#if CodeForces\n\t\tstatic void Main(string[] args)\n\t\t{\n#if DEBUG\n\t\t\tvar sw = new System.Diagnostics.Stopwatch();\n\t\t\tsw.Start();\n#endif\n\t\t\tstring s = Solve();\n\t\t\tif (!string.IsNullOrEmpty(s))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(s);\n\t\t\t}\n#if DEBUG\n\t\t\tsw.Stop();\n\t\t\tConsole.WriteLine(sw.Elapsed);\n\t\t\tConsole.ReadKey();\n#endif\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n#if !DEBUG\n\t\t\treturn Console.ReadLine();\n#else\n\t\t\treturn testInput.Dequeue();\n#endif\n\t\t}\n#endif\n\t}\n\n\tpublic static class ExtensionMethods\n\t{\n\t\tpublic static IEnumerable Cartesian(this IEnumerable first, IEnumerable second, Func collector)\n\t\t{\n\t\t\treturn first.SelectMany(f => second.Select(s => collector(f, s)));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, Tuple.Create);\n\t\t}\n\n\t\tpublic static IEnumerable> CartesianE(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\t// Calling CartesianE prevents selection of the wrong overload of Cartesian when you want a tuple of tuples to be returned\n\t\t\treturn first.Cartesian(second);\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> source)\n\t\t{\n\t\t\tIEnumerable> res = source.First().Select(x => single(x));\n\t\t\tforeach (IEnumerable next in source.Skip(1))\n\t\t\t{\n\t\t\t\tres = res.Cartesian(next, (sofar, n) => sofar.Concat(single(n)));\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static IEnumerable> Pow(this IEnumerable it, int num)\n\t\t{\n\t\t\treturn Enumerable.Repeat(it, num).Cartesian();\n\t\t}\n\n\t\tpublic static IEnumerable Demask(this IEnumerable> inp)\n\t\t{\n\t\t\tforeach (var pair in inp)\n\t\t\t{\n\t\t\t\tif (pair.Item2)\n\t\t\t\t{\n\t\t\t\t\tyield return pair.Item1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable>> Partition(this IEnumerable source, int groups)\n\t\t{\n\t\t\tforeach (var part in Enumerable.Range(0, groups).Pow(source.Count()).Select(x => x.ToArray()))\n\t\t\t{\n\t\t\t\tyield return Enumerable.Range(0, groups).Select(x => source.Where((item, idx) => part[idx] == x));\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Combinations(this IEnumerable it)\n\t\t{\n\t\t\tforeach (var conf in new[] { true, false }.Pow(it.Count()))\n\t\t\t{\n\t\t\t\tyield return it.Zip(conf, Tuple.Create).Demask();\n\t\t\t}\n\t\t}\n\n\t\tprivate static IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tprivate static IEnumerable ExceptSingle(this IEnumerable first, T it, IEqualityComparer comp = null)\n\t\t{\n\t\t\tcomp = comp ?? EqualityComparer.Default;\n\t\t\tbool seen = false;\n\t\t\tforeach (T a in first)\n\t\t\t{\n\t\t\t\tif (!seen && comp.Equals(a, it))\n\t\t\t\t{\n\t\t\t\t\tseen = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tyield return a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Permutations(this IEnumerable it)\n\t\t{\n\t\t\tif (it.Count() < 2)\n\t\t\t{\n\t\t\t\tyield return it;\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tforeach (T first in it)\n\t\t\t{\n\t\t\t\tforeach (IEnumerable part in Permutations(it.ExceptSingle(first)))\n\t\t\t\t{\n\t\t\t\t\tyield return single(first).Concat(part);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static T[][] Rho(this IEnumerable source, int x, int y)\n\t\t{\n\t\t\tT[][] res = Program.mkarr(x, y);\n\n\t\t\tint i = 0, j = 0;\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j] = item;\n\t\t\t\t\tj++;\n\t\t\t\t\tif (j == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static T[][][] Rho(this IEnumerable source, int x, int y, int z)\n\t\t{\n\t\t\tT[][][] res = Program.mkarr(x, y, z);\n\n\t\t\tint i = 0, j = 0, k = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tforeach (T item in source)\n\t\t\t\t{\n\t\t\t\t\tres[i][j][k] = item;\n\t\t\t\t\tk++;\n\t\t\t\t\tif (k == z)\n\t\t\t\t\t{\n\t\t\t\t\t\tk = 0;\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tif (j == y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\tif (i == x)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == x)\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\n\nclass Program\n{\n bool[] a = new bool[7];\n bool Check(int x, int v)\n {\n return x < v;\n }\n\n int GetCount(int k)\n {\n k--;\n int count = 0;\n for (;;)\n {\n count++;\n k /= 7;\n if (k == 0)\n return count;\n }\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = ri;\n var m = ri;\n\n var countN = GetCount(n);\n var countM = GetCount(m);\n var count = countM + countN;\n\n if (count > 7)\n {\n wln(0);\n return;\n }\n\n int res = 0;\n int first = 0;\n int countF = 0;\n int second = 0;\n int countS = 0;\n for (int i0 = 0; i0 < 7; i0++)\n {\n if (a[i0]) continue;\n a[i0] = true;\n int t0;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i0] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break; \n }\n else\n {\n second = second * 10 + i0;\n t0 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i0;\n t0 = 1;\n countF++;\n }\n for (int i1 = 0; i1 < 7; i1++)\n {\n if (a[i1]) continue;\n a[i1] = true;\n int t1;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i1] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break;\n }\n else\n {\n second = second * 10 + i1;\n t1 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i1;\n t1 = 1;\n countF++;\n }\n for (int i2 = 0; i2 < 7; i2++)\n {\n if (a[i2]) continue;\n a[i2] = true;\n int t2;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i2] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break; \n }\n else\n {\n second = second * 10 + i2;\n t2 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i2;\n t2 = 1;\n countF++;\n }\n for (int i3 = 0; i3 < 7; i3++)\n {\n if (a[i3]) continue;\n a[i3] = true;\n int t3;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i3] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break;\n }\n else\n {\n second = second * 10 + i3;\n t3 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i3;\n t3 = 1;\n countF++;\n }\n for (int i4 = 0; i4 < 7; i4++)\n {\n if (a[i4]) continue;\n a[i4] = true;\n int t4;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i4] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break;\n }\n else\n {\n second = second * 10 + i4;\n t4 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i4;\n t4 = 1;\n countF++;\n }\n for (int i5 = 0; i5 < 7; i5++)\n {\n if (a[i5]) continue;\n a[i5] = true;\n int t5;\n if (countF == countN)\n {\n if (countS == countM)\n {\n a[i5] = false;\n if (Check(first, n) && Check(second, m))\n res++;\n break;\n }\n else\n {\n second = second * 10 + i5;\n t5 = 2;\n countS++;\n }\n }\n else\n {\n first = first * 10 + i5;\n t5 = 1;\n countF++;\n }\n for (int i6 = 0; i6 < 7; i6++)\n {\n if (a[i6]) continue;\n if (Check(first, n) && Check(second, m))\n res++;\n }\n a[i5] = false;\n\n if (t5 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n a[i4] = false;\n if (t4 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n a[i3] = false;\n if (t3 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n a[i2] = false;\n if (t2 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n a[i1] = false;\n if (t1 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n a[i0] = false;\n if (t0 == 1)\n {\n countF--;\n first /= 10;\n }\n else\n {\n countS--;\n second /= 10;\n }\n }\n wln(res);\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o + \" \"); }\n static void wrt(object o) { Console.Write(o); }\n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\n\nclass Program\n{\n bool[] a = new bool[7];\n bool Check(int x, int v)\n {\n return x < v;\n }\n\n int GetCount(int k)\n {\n k--;\n int count = 0;\n for (;;)\n {\n count++;\n k /= 7;\n if (k == 0)\n return count;\n }\n }\n int n;\n int m;\n int countN;\n int countM;\n int res;\n\n //(0,0)\n void tutuFirst(int first, int countF)\n {\n if (countF == countN)\n {\n if (Check(first, n))\n {\n tutuSecond(0, 0);\n }\n return;\n }\n for (int j = 0; j < 7; j++)\n {\n if (a[j]) continue;\n a[j] = true;\n tutuFirst(first * 10 + j, countF + 1);\n a[j] = false;\n }\n }\n void tutuSecond(int second, int countS)\n {\n if (countS == countM)\n {\n if (Check(second, m))\n {\n res++;\n }\n return;\n }\n for (int j = 0; j < 7; j++)\n {\n if (a[j]) continue;\n a[j] = true;\n tutuSecond(second * 10 + j, countS + 1);\n a[j] = false;\n }\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n n = ri;\n m = ri;\n\n countN = GetCount(n);\n countM = GetCount(m);\n var count = countM + countN;\n\n if (count > 7)\n {\n wln(0);\n return;\n }\n\n res = 0;\n tutuFirst(0, 0);\n wln(res);\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o + \" \"); }\n static void wrt(object o) { Console.Write(o); }\n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "\ufeff// using a C# contest template, relevant code is at the bottom in the Run() function\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemA {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static bool isLocal = Type.GetType(\"HaitaoLocal\") != null;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (isLocal) {\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ri { get { return RI(); } }\n static string rs { get { return RS(); } }\n static long rl { get { return RL(); } }\n static double rd { get { return RD(); } }\n static int RI() {\n return Int32.Parse(NextToken());\n }\n static string RS() {\n return NextToken();\n }\n static long RL() {\n return Int64.Parse(NextToken());\n }\n static double RD() {\n return Double.Parse(NextToken());\n }\n static int[] RIA(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RI();\n }\n return ret;\n }\n static string[] RSA(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RS();\n }\n return ret;\n }\n static long[] RLA(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RL();\n }\n return ret;\n }\n static double[] RDA(int length) {\n double[] ret = new double[length];\n for (int i = 0; i < length; i++) {\n ret[i] = RD();\n }\n return ret;\n }\n static StringBuilder outputBuilder;\n static CultureInfo outputCulture = new CultureInfo(\"en-US\");\n static void Out(object obj) {\n Type type = obj.GetType();\n string str = obj.ToString();\n if (type == typeof(double) || type == typeof(float)) {\n str = ((double)obj).ToString(outputCulture);\n }\n outputBuilder.Append(str + \" \");\n }\n static void Outl() {\n Outl(\"\");\n }\n static void Outl(object obj) {\n Out(obj);\n outputBuilder.Append(\"\\n\");\n }\n static void Flush() {\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n outputBuilder = new StringBuilder();\n }\n static void Log(string label, object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Gray;\n Console.Write(label + \": \");\n Console.ForegroundColor = t;\n Log(obj);\n }\n static void Log(object obj) {\n if (!isLocal) return;\n\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.White;\n Console.WriteLine(ToStringRecursive(obj));\n Console.ForegroundColor = t;\n }\n static string ToStringRecursive(object obj) {\n StringBuilder sb = new StringBuilder();\n if (!(obj is string) && (obj is System.Collections.IEnumerable)) {\n System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;\n sb.Append(\"{\");\n bool first = true;\n foreach (object el in en) {\n if (!first) sb.Append(\", \");\n sb.Append(ToStringRecursive(el));\n first = false;\n }\n sb.Append(\"}\");\n return sb.ToString();\n }\n return obj.ToString();\n }\n\n public static void Main(string[] args) {\n long startTick = 0;\n if (isLocal) {\n startTick = Environment.TickCount;\n fileReader = new StreamReader(inputFileName);\n }\n\n outputBuilder = new StringBuilder();\n Run();\n if (isLocal) {\n ConsoleColor t = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.Green;\n Console.WriteLine();\n Console.WriteLine(outputBuilder.ToString());\n Console.WriteLine();\n Console.ForegroundColor = t;\n } else {\n Console.WriteLine(outputBuilder.ToString());\n }\n\n if (isLocal) {\n long runTime = Environment.TickCount - startTick;\n if (runTime > 32) {\n Log(\"time\", runTime);\n Log(\"\");\n }\n }\n }\n\n\n\n static void Run() {\n long n = rl;\n long m = rl;\n int nd = 0;\n long tn = n;\n while (tn > 0) {\n tn /= 7;\n nd++;\n }\n int md = 0;\n long tm = m;\n while (tm > 0) {\n tm /= 7;\n md++;\n }\n if (nd + md > 7) Outl(0);\n else {\n long ans = 0;\n for (int a = 0; a < n; a++) {\n for (int b = 0; b < m; b++) {\n bool[] x = new bool[7];\n List l = new List();\n int ta = a;\n while (ta > 0) {\n l.Add(ta % 7);\n ta /= 7;\n }\n int tb = b;\n while (tb > 0) {\n l.Add(tb % 7);\n tb /= 7;\n }\n if (l.Count < nd + md) {\n l.Add(0);\n }\n if (l.Count < nd + md) {\n continue;\n }\n bool flag = true;\n foreach (int i in l) {\n if (x[i]) {\n flag = false; break;\n }\n x[i] = true;\n }\n if(flag) {\n ans++;\n }\n }\n }\n Outl(ans);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Robbers__watch\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int cn = Digits(n);\n int cm = Digits(m);\n\n var p = new[] {0, 1, 2, 3, 4, 5, 6};\n int count = 0;\n HashSet h = new HashSet(); \n\n if (cn + cm <= p.Length)\n {\n do\n {\n int i = 0;\n long nn = 0, mm = 0;\n for (int j = 0; j < cn; j++)\n {\n nn = nn*7 + p[i];\n i++;\n }\n for (int j = 0; j < cm; j++)\n {\n mm = mm*7 + p[i];\n i++;\n }\n if (nn < n && mm < m)\n {\n long key = (nn << 32) + mm;\n if (h.Add(key))\n count++;\n }\n } while (NextPermutation(p));\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Digits(int n)\n {\n if (n == 0)\n return 1;\n int count = 0;\n while (n > 0)\n {\n n /= 7;\n count++;\n }\n return count;\n }\n\n private static bool NextPermutation(int[] nn)\n {\n if (nn.Length <= 1) return false;\n int i = nn.Length - 1;\n int last = nn.Length;\n\n while (true)\n {\n int i1 = i;\n if (nn[--i] < nn[i1])\n {\n int i2 = last;\n while (!(nn[i] < nn[--i2]))\n {\n ;\n }\n int c = nn[i];\n nn[i] = nn[i2];\n nn[i2] = c;\n\n Reverse(nn, i1, last);\n return true;\n }\n if (i == 0)\n {\n Reverse(nn, 0, last);\n return false;\n }\n }\n }\n\n private static void Reverse(int[] nn, int first, int last)\n {\n while ((first != last) && (first != --last))\n {\n int c = nn[first];\n nn[first] = nn[last];\n nn[last] = c;\n first++;\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n List Fun(int x)\n {\n var ret = new List();\n while (x > 0)\n {\n ret.Add(x % 7);\n x /= 7;\n }\n ret.Reverse();\n return ret;\n }\n\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n var dp = new int[1 << 7, 2];\n dp[0, 0] = 1;\n foreach (int x in Fun(n - 1))\n {\n var ndp = new int[1 << 7, 2];\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 7; k++)\n if ((i >> k & 1) == 0)\n {\n if (j == 0 && k > x)\n continue;\n int nj = j;\n if (k == x)\n nj = 1;\n ndp[i | 1 << k, nj] += dp[i, j];\n }\n dp = ndp;\n }\n\n for (int i = 0; i < 1 << 7; i++)\n {\n dp[i, 0] += dp[i, 1];\n dp[i, 1] = 0;\n }\n\n foreach (int x in Fun(m - 1))\n {\n var ndp = new int[1 << 7, 2];\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n for (int k = 0; k < 7; k++)\n if ((i >> k & 1) == 0)\n {\n if (j == 0 && k > x)\n continue;\n int nj = j;\n if (k == x)\n nj = 1;\n ndp[i | 1 << k, nj] += dp[i, j];\n }\n dp = ndp;\n }\n\n int ans = 0;\n for (int i = 0; i < 1 << 7; i++)\n for (int j = 0; j < 2; j++)\n ans += dp[i, j];\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII);\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}], "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c"} {"source_code": "using System;\nusing System.Linq;\n\nnamespace A.cAPS_lOCK\n{\n class Submit\n {\n static bool AllCapital(string input)\n {\n return input.All(each => char.IsUpper(each));\n }\n static string Capitalize(string input)\n {\n if (AllCapital(input)) { return input.ToLower(); }\n else if (char.IsLower(input[0]) && AllCapital(input.Substring(1))) { return string.Format(\"{0}{1}\", char.ToUpper(input[0]), input.Substring(1).ToLower()); }\n else { return input; }\n }\n\n static void Main(string[] args)\n {\n Console.Write(Capitalize(Console.ReadLine()));\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Str = Console.ReadLine();\n char[] Ch = Str.ToCharArray();\n short Count = 0;\n if (Char.IsUpper(Ch[0]))\n {\n for (int i = 1; i < Ch.Length; i++)\n if (Char.IsUpper(Ch[i])) Count++;\n if (Ch.Length - 1 == Count)\n {\n Upper(Ch);\n Console.WriteLine(Ch);\n // Console.ReadKey();\n return;\n }\n }\n\n if (Char.IsLower(Ch[0]))\n {\n for (int i = 1; i < Ch.Length; i++)\n {\n if (Char.IsUpper(Ch[i])) Count++;\n }\n if (Count == Ch.Length - 1)\n {\n Low(Ch);\n Console.WriteLine(Ch);\n //Console.ReadKey();\n return;\n }\n else\n {\n Console.WriteLine(Ch);\n // Console.ReadKey();\n }\n }\n else\n {\n Console.WriteLine(Ch);\n // Console.ReadKey();\n }\n } \n\n static char[] Upper (char[] Ch)\n {\n for (int i = 0; i < Ch.Length; i++)\n Ch[i] = Char.ToLower(Ch[i]);\n return Ch;\n }\n\n static char[] Low (char[] Ch)\n {\n Ch[0] = Char.ToUpper(Ch[0]);\n for (int i = 1; i < Ch.Length; i++)\n Ch[i] = Char.ToLower(Ch[i]);\n return Ch;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool p=false; bool p1=false;\n if (char.ToLower(Convert.ToChar(s[0]))==s[0] ) p1=true;\n for (int i=0;i= 65 && c <= 90 && s[i] >= 65 && s[i] <= 90)\n {\n a++;\n }\n if (c >= 97 && c <= 122 && s[i] >= 65 && s[i] <= 90)\n {\n b++; \n }\n }\n if (s.Length == 1)\n {\n if (c <= 122 && c >= 97) Console.WriteLine(c2);\n else Console.WriteLine(c3); \n }\n else if (a == s.Length - 1) Console.WriteLine(c3 + s3);\n else if (b == s.Length - 1) Console.WriteLine(c2 + s3.ToLower());\n else Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CAPSLOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Word = Console.ReadLine();\n var Upper = 0;\n\n foreach (var item in Word)\n {\n if (char.IsUpper(item))\n Upper++; \n }\n if (Upper == Word.Length ) \n {\n var Lower = Word.ToLower();\n Console.WriteLine(Lower); \n }\n else if (char.IsLower(Word[0]) && Upper == Word.Length - 1)\n {\n var Lower = char.ToUpper(Word[0]) + Word.Substring(1).ToLower();\n Console.WriteLine(Lower);\n }\n else\n Console.WriteLine(Word);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp5\n{\n public class Program\n {\n //var t = int.Parse(Console.ReadLine());\n //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n static void Main()\n {\n var str = Console.ReadLine();\n var res = str;\n\n if (Regex.IsMatch(str, \"^[A-Z][A-Z]*$\"))\n res = str.ToLower();\n else if (Regex.IsMatch(str, \"^[a-z][A-Z]*$\"))\n res = str[0].ToString().ToUpper() + (str.Length > 1 ? str.Substring(1).ToLower() : \"\");\n\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(), r = s[0].ToString().ToUpper(), str = s;\n if(s.ToUpper() == s)\n str = s.ToLower();\n else if(s.Remove(0, 1).ToUpper() == s.Remove(0, 1))\n str = s.ToLower().Remove(0, 1).Insert(0, r);\n Console.WriteLine(str);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace A._cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List list = new List(input);\n bool case1 = false;\n bool case2 = false;\n for (int i = 0; i < list.Count(); i++)\n {\n if (i == 0)\n {\n if (list[i] >= 'a' && list[i] <= 'z')\n {\n case1 = true;\n }\n else\n {\n case2 = true;\n }\n }\n else if (list[i] >= 'a' && list[i] <= 'z')\n {\n case1 = false;\n case2 = false;\n }\n }\n for (int i = 0; i < list.Count(); i++)\n {\n \n if (case1 == true)\n {\n if (i == 0)\n {\n list[0] = char.ToUpper(list[0]);\n }\n else\n {\n list[i] = char.ToLower(list[i]);\n }\n }\n else if (case2 == true)\n {\n list[i] = char.ToLower(list[i]);\n }\n }\n foreach (var el in list)\n {\n Console.Write(el);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code_Forces\n{\n class Program\n {\n \n static void Main(string[] args)\n { \n \n string s = Console.ReadLine();\n int count = 0;\n char[] arr = s.ToCharArray();\n\n for (int i = 0; i < s.Length; i++)\n {\n if (arr[i] == char.ToUpper(arr[i]))\n count++;\n }\n /*\n if (arr[0] == char.ToLower(arr[0]) && count == 0)\n {\n Console.WriteLine(char.ToUpper(arr[0]));\n }\n */\n if (s.Length == 1)\n { if (arr[0]==char.ToLower(arr[0]))\n Console.WriteLine(s.ToUpper());\n else\n\n Console.WriteLine(s.ToLower());\n }\n else if (arr[0] == char.ToLower(arr[0]) && count == s.Length - 1)\n {\n for (int i = 1; i < s.Length; i++)\n {\n arr[0] = char.ToUpper(arr[0]);\n arr[i] = char.ToLower(arr[i]);\n\n }\n Console.WriteLine(arr);\n }\n\n else if (s == s.ToUpper())\n {\n Console.WriteLine(s.ToLower());\n }\n\n else\n Console.WriteLine(s);\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A131\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool mayus = true;\n\n foreach (char letter in input.Substring(1))\n {\n if (char.IsLower(letter))\n mayus = false;\n }\n\n Console.WriteLine(mayus && char.IsLower(input[0]) ?\n (char.ToUpper(input[0]) + input.Substring(1).ToLower()) : (char.IsUpper(input[0]) && mayus ? \n input.ToLower() : input));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n char[] ch = input.ToCharArray();\n\n if(ch[0] >= 97 && ch.Length == 1)\n {\n Console.WriteLine((char)(ch[0] - 32));\n }\n else if(ch[0] >= 97 && ch.Length > 1)\n {\n int count = 0;\n\n for (int i = 1; i < ch.Length; i++)\n {\n if (ch[i] >= 65 && ch[i] <= 90)\n {\n count++;\n }\n }\n\n if(count == ch.Length - 1)\n {\n ch[0] = (char)(ch[0] - 32);\n for (int i = 1; i < ch.Length; i++)\n {\n ch[i] = (char)(ch[i] + 32);\n }\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(ch);\n }\n }\n else if(ch[0] >= 65 && ch[0] <= 90 && ch.Length > 1)\n {\n int count = 0;\n\n for (int i = 1; i < ch.Length; i++)\n {\n if (ch[i] >= 65 && ch[i] <= 90)\n {\n count++;\n }\n }\n\n if (count == ch.Length - 1)\n {\n ch[0] = (char)(ch[0] + 32);\n for (int i = 1; i < ch.Length; i++)\n {\n ch[i] = (char)(ch[i] + 32);\n }\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(ch);\n }\n }\n else\n {\n Console.WriteLine((char)(ch[0] + 32));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char[] chrs = str.ToCharArray();\n if (chrs.Length > 1 && chrs.Skip(1).All(char.IsUpper) || chrs.Length == 1)\n {\n str = new string(chrs.Select(ch => char.IsUpper(ch) ? char.ToLower(ch) : char.ToUpper(ch)).ToArray());\n }\n Console.WriteLine(str);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace dev\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n char[] checkWordArray = new char[word.Length - 1];\n word.CopyTo(1, checkWordArray, 0, word.Length - 1);\n string checkWord = new string(checkWordArray);\n\n char[] newWord = new char[word.Length]; \n\n\n if ((Char.IsLower(word[0]) && checkWord == checkWord.ToUpper()) || word == word.ToUpper())\n {\n for (int i = 0; i < word.Length; i++)\n {\n if (Char.IsUpper(word[i]))\n {\n newWord[i] = Char.ToLower(word[i]);\n }\n else\n {\n newWord[i] = Char.ToUpper(word[i]);\n }\n }\n Console.WriteLine(newWord);\n }\n else\n {\n Console.WriteLine(word);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _131A\n{\n class Program\n {\n static void Reverse(string txt)\n {\n for(int i = 0; i < txt.Length; i++)\n {\n if (char.IsLower(txt[i])) //\u0435\u0441\u043b\u0438 \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f, \u0442\u043e\n {\n Console.Write(char.ToUpper(txt[i]));\n }\n else //\u0438\u043b\u0438 \u0436\u0435\n {\n Console.Write(char.ToLower(txt[i]));\n }\n }\n }\n static void Main(string[] args)\n {\n string txt = Console.ReadLine();\n if(txt.Length > 1)\n {\n if (txt.ToUpper() == txt) //\u0435\u0441\u043b\u0438 \u0432\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0431\u0443\u043a\u0432\u0430\u0445\n {\n Reverse(txt);\n }\n else\n {\n if (char.IsLower(txt[0]) && char.IsUpper(txt[1]) && txt.TrimStart(txt[0]) == txt.TrimStart(txt[0]).ToUpper()) //\u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u0430\u044f \u0438 \u0432 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u043d\u0435\u0442 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0431\u0443\u043a\u0432 \n {\n Reverse(txt);\n }\n else\n {\n Console.Write(txt); //\u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0442\u043e\n }\n }\n }\n else\n {\n Reverse(txt);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n bool uppercase = true;\n\n for (int i = 1; i < word.Length; i++)\n {\n if (word[i] >= 'a')\n uppercase = false;\n }\n\n if (uppercase == true)\n {\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] >= 'a')\n Console.Write(word[i].ToString().ToUpper());\n else\n Console.Write(word[i].ToString().ToLower());\n }\n }\n else\n Console.WriteLine(word);\n \n \n \n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AscII_Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string name = Console.ReadLine();\n bool capslock = true;\n char[] array = name.ToCharArray();\n for (int i = 1; i < array.Length; i++)\n {\n /* input the small letter */\n char c = array[i];\n if (c >= 'a' && c <= 'z')\n {\n capslock = false;\n }\n }\n if (capslock)\n {\n \n for (int i = 0; i < array.Length; i++)\n {\n \n char c = array[i];\n if (c >= 'a' && c <= 'z')\n {\n array[i] = (char)((int)c - 32);\n \n }\n if (c >= 'A' && c <= 'Z')\n {\n array[i] = (char)((int)c + 32);\n \n }\n \n }\n }\n for (int i = 0; i < array.Length; i++)\n {\n Console.Write(array[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A_CapsLock\n{\n static class Program\n {\n public static bool IsAllUppercase(this string str, int start)\n {\n int i = 0;\n for (i = start; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'z') return false; \n }\n return true;\n }\n\n static void PrintAllLowercase(this string str, int start)\n {\n int i = 0;\n char ch;\n for (i = start; i < str.Length; i++)\n {\n Console.Write(char.ToLower(str[i]));\n }\n Console.Write(\"\\n\");\n }\n static void Main(string[] args)\n {\n int i = 0;\n string str = Console.ReadLine();\n char ch;\n\n if (str.Length==1)\n {\n if (str[0] >= 'a' && str[0] <= 'z')\n {\n ch = char.ToUpper(str[0]);\n Console.WriteLine(ch);\n }\n else\n {\n ch = char.ToLower(str[0]);\n Console.WriteLine(ch);\n }\n \n }\n\n else if (str.IsAllUppercase(0))\n {\n str.PrintAllLowercase(0);\n }\n\n else if (str[0] >= 'a' && str[0] <= 'z' && str.IsAllUppercase(1))\n {\n ch = char.ToUpper(str[0]);\n Console.Write(ch);\n str.PrintAllLowercase(1);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string data = Console.ReadLine();\n\n //\u6761\u4ef6\u3068\u3057\u3066\u306f\u3001\u5168\u90e8\u5927\u6587\u5b57 OR \u6700\u521d\u5c0f\u6587\u5b57\u3067\u4ee5\u964d\u5927\u6587\u5b57\u306e\u3068\u304d\u306b\u3001\u5909\u63db\u3059\u308c\u3070\u3044\u3044\n bool flg = false;\n\n //\u3082\u3057\u5148\u982d\u5c0f\u6587\u5b57\u306a\u3089\n if (char.IsLower(data[0]))\n {\n if (data.Length == 1)\n {\n Console.WriteLine(data.ToUpper());\n return;\n }\n bool caps = true;\n //\u3082\u3057\u5f8c\u308d\u306e\u6587\u5b57\u5217\u304c\u3059\u3079\u3066\u5c0f\u6587\u5b57\u306a\u3089\u53cd\u8ee2\u3059\u308b\n for (int i = 1; i < data.Length; i++)\n {\n if (!char.IsLower(data[i]))\n caps = false;\n }\n if (caps)\n {\n Console.WriteLine(data);\n return;\n }\n //\u3067\u306f\u306a\u304f\uff0c\u3054\u3061\u3083\u6df7\u305c\u3060\u3063\u305f\u3089\u305d\u306e\u307e\u307e\u8868\u793a\n for (int i = 1; i < data.Length; i++)\n {\n if (!char.IsUpper(data[i]))\n caps = true;\n }\n if (caps)\n {\n Console.WriteLine(data);\n return;\n }\n else\n {\n Console.Write(char.ToUpper(data[0]));\n\n for (int j = 1; j < data.Length; j++)\n {\n Console.Write(char.ToLower(data[j]));\n }\n return;\n }\n }\n\n\n //\u3082\u3057\u5927\u6587\u5b57\u306a\u3089\n if (char.IsUpper(data[0]))\n {\n if (data.Length == 1)\n {\n Console.WriteLine(data.ToLower());\n return;\n }\n\n //\u5f8c\u308d\u304c\u3059\u3079\u3066\u5927\u6587\u5b57\u306a\u3089\u3072\u3063\u7e70\u308a\u8fd4\u3057\u3066\u8868\u793a\n bool caps = true;\n for (int i = 0; i < data.Length; i++)\n {\n if (!char.IsUpper(data[i]))\n caps = false;\n }\n if (caps)\n {\n Console.WriteLine(data.ToLower());\n return;\n }\n\n //\u305d\u3046\u3058\u3083\u306a\u304f\u3066\uff0c\u3054\u3061\u3083\u307e\u305c\u3060\u3063\u305f\u3089\u305d\u306e\u307e\u307e\u8868\u793a\n Console.WriteLine(data);\n //for (int i = 1; i < data.Length; i++)\n //{\n // if (!char.IsLower(data[i]))\n // caps = true;\n //}\n //if (caps)\n //{\n // Console.WriteLine(data);\n // return;\n //}\n //else\n //{\n // Console.Write(char.ToLower(data[0]));\n\n // for (int j = 1; j < data.Length; j++)\n // {\n // Console.Write(char.ToUpper(data[j]));\n // }\n // return;\n //}\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cAPS_lOCK\n{\n class Program\n {\n static public void problem()\n {\n string x = Console.ReadLine();\n\n \n if (x.ToUpper() == x)\n {\n string k = x.ToLower();\n Console.WriteLine(k);\n }\n else if (x.Substring(1).ToUpper()==x.Substring(1))\n { \n string k = x.Substring(1).ToLower();\n Console.WriteLine(char.ToUpper(x[0])+k);\n }\n else\n {\n Console.WriteLine(x);\n }\n \n }\n static void Main(string[] args)\n {\n problem();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication12\n{\n class Capslock\n {\n static void Main(string[] args)\n {\n Capslock.Run();\n }\n\n static void Run()\n {\n string data = Console.ReadLine();\n\n if (Judge(data))\n Reversal(data);\n\n Console.WriteLine((Judge(data)) ? Reversal(data) : data);\n }\n\n /// \n /// \u5224\u5b9a\u95a2\u6570\n /// \n /// \u53cd\u8ee2\u3059\u308b\u5834\u5408\u306ftrue\n static bool Judge(string input)\n {\n for (int i = 1; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n return false;\n }\n return true;\n }\n\n /// \n /// \u53cd\u8ee2\u95a2\u6570\n /// \n /// \u53cd\u8ee2\u3059\u308b\u5bfe\u8c61\u306e\u6587\u5b57\u5217\n /// \u53cd\u8ee2\u3057\u305f\u7d50\u679c\u3092\u8fd4\u3057\u307e\u3059\n static string Reversal(string input)\n {\n string temp = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n temp += char.ToUpper(input[i]);\n else\n temp += char.ToLower(input[i]);\n }\n\n return temp;\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test\n{\n static void Main()\n {\n string sTmp = Console.ReadLine();\n string [] aTmp = sTmp.Split();\n string ans = \"\";\n \n for (int i = 0 ; i96)\n {\n if (n[i] > 96) break;\n else if(n[i]<97)\n {\n \n n[i] =n[i]-32;\n }\n }*/\n }\n for(i=1;i96) //avali koochak\n {\n if (a[i] > 96) break;\n else if(a[i]>64 && a[i]<91)\n {\n for(j=i+1;j 96) break;\n }\n if(j==n.Length) //do be bad bozorg\n {\n for(j=i;j 96) break;\n else if (a[i] < 91)\n {\n for (j = i + 1; j < n.Length; j++)\n {\n if (a[j] > 96) break;\n }\n if (j == n.Length) //do be bad koochak\n {\n for (j = i; j < n.Length; j++)\n {\n a[j] += 32;\n }\n a[0] += 32;\n }\n } \n }\n }\n if (n.Length == 1)\n {\n if (a[0] > 96) a[0] -= 32;\n else if (a[0] < 91 && a[0] > 64) a[0] += 32;\n }\n /*for(i=0;i= 'a' && str[i] <= 'z')\n {\n flag = false;\n }\n else\n {\n flag = true;\n }\n output += (str[i].ToString()).ToLower();\n }\n else\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n {\n bflag = false;\n }\n else\n {\n bflag = true;\n }\n if (flag == bflag)\n {\n output += (str[i].ToString()).ToLower();\n }\n else\n {\n Console.WriteLine(str);\n return;\n }\n }\n }\n if (str.Length != 0)\n {\n if (str[0] >= 'A' && str[0] <= 'Z' && flag == true)\n {\n Console.WriteLine(str.ToLower());\n return;\n }\n if (str[0] >= 'a' && str[0] <= 'z' && flag == false)\n {\n Console.WriteLine(str);\n return;\n }\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string make(string s)\n {\n string w = \"\";\n if (char.IsLower(s[0]) && char.IsUpper(s[1])) {\n w += char.ToUpper(s[0]);\n }\n if (w.Length != 0)\n {\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsUpper(s[i]))\n {\n w += char.ToLower(s[i]);\n }\n else\n {\n w += char.ToUpper(s[i]);\n }\n }\n return w;\n }\n else\n {\n return s;\n }\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Length == 1)\n {\n if (char.IsUpper(s[0]))\n {\n Console.WriteLine(s.ToLower());\n }\n else\n {\n Console.WriteLine(s.ToUpper());\n }\n return;\n }\n bool can = true;\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n can = false;\n break;\n }\n }\n if ((can && char.IsUpper(s[0])))\n {\n Console.WriteLine(s.ToLower());\n return;\n }\n if ((can && char.IsLower(s[0])))\n {\n Console.WriteLine(make(s));\n }\n else\n {\n Console.WriteLine(s);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = \"\";\n\n str = Console.ReadLine();\n bool flag = false;\n for (int i = 1; i < str.Length; i++)\n {\n if (str[i].ToString() != str[i].ToString().ToUpper())\n {\n flag = true;\n break;\n }\n }\n if (flag)\n {\n Console.Write(str);\n }\n else\n {\n if (str[0].ToString() == str[0].ToString().ToUpper())\n {\n Console.Write(str.ToLower());\n }\n else \n {\n Console.Write(str[0].ToString().ToUpper() + str.Substring(1).ToLower());\n }\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Ejercicios\n{\n class Program\n {\n static string funcion (string str)\n {\n string newStr = \"\", first;\n\n if (str.Length == 1 && isLower(str[0]))\n return str.ToUpper();\n\n if (str.Length == 1 && isUpper(str[0]))\n return str.ToLower();\n\n if (isUpper(str[0])){\n if (rest(str))\n return str.ToLower();\n else\n return str;\n }\n else\n {\n if (rest(str))\n {\n first = str[0].ToString().ToUpper();\n newStr = str.Substring(1);\n newStr = first + newStr.ToLower();\n return newStr;\n }\n else\n {\n return str;\n }\n\n }\n }\n\n static bool rest (string str){\n for (int i = 1; i < str.Length; i++)\n {\n if (isLower(str[i]))\n return false;\n }\n return true;\n }\n\n static bool isUpper(char letter)\n {\n string alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for (int i = 0; i < alpha.Length; i++)\n {\n if (letter == alpha[i]) \n return true;\n }\n return false;\n }\n\n static bool isLower(char letter)\n {\n string alpha = \"abcdefghijklmnopqrstuvwxyz\";\n for (int i = 0; i < alpha.Length; i++)\n {\n if (letter == alpha[i])\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Console.WriteLine(funcion(str));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nnamespace Test\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n // Case 1\n if (word.Length == 1)\n {\n if (char.IsUpper(word[0]))\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.ToUpper());\n return;\n }\n\n // Case 2\n if (word.All(char.IsUpper))\n {\n Console.WriteLine(word.ToLower());\n return;\n }\n else if(word.All(char.IsLower))\n {\n Console.WriteLine(word.ToLower());\n return;\n }\n\n\n int numOfChange = 0;\n bool flag;\n if (char.IsUpper(word[0]))\n flag = true;\n else\n flag = false;\n\n for (int i = 1; i < word.Length; i++)\n {\n if (char.IsUpper(word[i]) != flag)\n {\n flag = !flag;\n numOfChange++;\n }\n\n if (numOfChange == 2)\n {\n Console.WriteLine(word);\n return;\n }\n }\n\n if(numOfChange == 1)\n {\n if(char.IsLower(word[0])&& !char.IsLower(word[1]))\n {\n StringBuilder _word = new StringBuilder();\n for (int i = 0; i < word.Length; i++)\n {\n if (char.IsLower(word[i]))\n _word.Append(char.ToUpper(word[i]));\n else\n _word.Append(char.ToLower(word[i]));\n }\n Console.WriteLine(_word);\n return;\n }\n else\n {\n Console.WriteLine(word);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cAPSlOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n StringBuilder uncapped = new StringBuilder();\n bool isCapped = true;\n\n uncapped.Append(Char.ToUpper(word[0]));\n for (int i = 1; i < word.Length; i++)\n {\n uncapped.Append(Char.ToLower(word[i]));\n if (!Char.IsUpper(word[i]))\n {\n isCapped = false;\n }\n }\n if (isCapped && Char.IsUpper(word[0]))\n {\n uncapped[0] = Char.ToLower(word[0]);\n }\n \n Console.WriteLine(\"{0}\", isCapped ? uncapped.ToString() : word);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n char[] c = n.ToCharArray();\n\n bool v = true;\n\n\n for (int i = 1; i < c.Length; i++)\n {\n if (c[i].CompareTo('a') < 0)\n {\n continue;\n }\n else\n {\n\n v = false;\n break;\n }\n }\n if (v == true)\n {\n\n for (int j = 0; j < c.Length; j++)\n {\n if (c[j].CompareTo('a') < 0)\n {\n char a = char.ToLower(c[j]);\n c[j] = a;\n continue;\n }\n if (c[j].CompareTo('a') >= 0)\n {\n char a = char.ToUpper(c[j]);\n c[j] = a;\n }\n }\n c.ToString();\n Console.WriteLine(c);\n }\n else\n {\n c.ToString();\n Console.WriteLine(c);\n }\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c95a1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine();\n \n int i=0,j=0;\n for (i = 0; i < a.Length; i++)\n {\n if (char.IsUpper(a[i]))\n {\n continue;\n }\n else\n {\n break;\n }\n }\n\n if (i == a.Length)\n {\n a = a.ToLower();\n Console.WriteLine(a);\n return;\n }\n\n if (char.IsLower(a[0]))\n {\n for (j = 1; j < a.Length; j++)\n {\n if (char.IsUpper(a[j]))\n {\n continue;\n }\n else\n {\n break;\n }\n }\n }\n\n if (j == a.Length)\n {\n string s = a[0].ToString().ToUpper();\n a = a.ToLower();\n StringBuilder sb = new StringBuilder(a); \n sb[0] = Convert.ToChar(s);\n a = sb.ToString();\n Console.WriteLine(a);\n return;\n }\n Console.WriteLine(a);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var l = s.Length;\n var c = false;\n int co = 0;\n for (var i = 0; i < l; i++)\n {\n var u = char.IsUpper(s[i]);\n if (i == 0)\n {\n c = u;\n }\n else\n {\n if (u)\n {\n co++;\n }\n else\n {\n Console.WriteLine(s);\n return;\n }\n }\n }\n\n if (c)\n {\n Console.WriteLine(s.ToLower());\n }\n else\n {\n var r = s.First().ToString().ToUpper() + s.Substring(1).ToLower();\n Console.WriteLine(r);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nclass Problem15A{\n\tstatic void Main(string[] args){\n\t\tRegex reg = new Regex(\"[A-Z]\");\n\t\tString word = Console.ReadLine();\n\t\tif((char.ToLower(word[0]) == word[0] && reg.Replace(word, \"\").Length == 1)){\n\t\t\tConsole.Write(char.ToUpper(word[0])+word.Substring(1, word.Length-1).ToLower());\n\t\t}else if(reg.Replace(word, \"\").Length == 0){\n\t\t\tConsole.Write(word.ToLower());\n\t\t} else Console.Write(word);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static void Main()\n {\n var str = Console.ReadLine();\n if (str.Length == 1)\n if ((int)str[0] > 96 && (int)str[0] < 123)\n Console.WriteLine(str.ToUpper());\n else Console.WriteLine(str.ToLower());\n else\n {\n bool firstLetterIsBig = false;\n if ((int)str[0] > 64 && (int)str[0] < 91)\n firstLetterIsBig = true;\n bool allLettersIsBig = true;\n for (var i = 1; i < str.Length; i++)\n {\n if ((int)str[i] > 96 && (int)str[i] < 123)\n {\n allLettersIsBig = false;\n break;\n }\n }\n if (allLettersIsBig)\n {\n if (firstLetterIsBig)\n Console.WriteLine(str.ToLower());\n else\n {\n str = str.ToLower();\n string result = str[0].ToString().ToUpper() + str.Substring(1, str.Length - 1);\n Console.WriteLine(result);\n }\n }\n else\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Caps\n{\n\t\tstatic void Main()\n\t\t{\n\t\t\t\tstring input = Console.ReadLine();\n\t\t\t\tstring comp = input.ToLower();\n\t\t\t\tint count = 0;\n\t\t\t\tfor(int i = 0; i < input.Length; i++)\n\t\t\t\t{\n\t\t\t\t\t\tif(input[i] == comp[i])\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==0)\n\t\t\t\t\t\tConsole.WriteLine(comp);\n\t\t\t\telse if(count==1 && input[0]==comp[0])\n\t\t\t\t{\n\t\t\t\t\tstring result = \"\";\n\t\t\t\t\tfor(int i = 0; i < input.Length; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\t\tstring tmp = comp[i].ToString();\n\t\t\t\t\t\t\tif(i==0)\n\t\t\t\t\t\t\tresult+=tmp.ToUpper();\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult+=tmp;\n\t\t\t\t\t}\n\t\t\t\t\tConsole.WriteLine(result);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tConsole.WriteLine(input);\n\t\t}\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Caps {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n char firstletter = input[0];\n if (Char.IsUpper(input[0])) {\n firstletter = Char.ToLower(input[0]);\n } else {\n firstletter = Char.ToUpper(input[0]);\n }\n string output = input.Remove(0, 1);\n int size = output.Length;\n int uppercount = 0;\n for(int i = 0; i < size; ++i) { \n if (Char.IsUpper(output[i])) {\n uppercount++;\n }\n }\n if(uppercount == output.Length) {\n output = output.ToLower();\n Console.WriteLine(firstletter + output);\n return;\n }\n Console.WriteLine(input);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ProblemSolvingPrepation\n{\n class Program\n {\n static void Main(string[] args)\n {\n String InputWord;\n InputWord = Console.ReadLine();\n bool b1 = IsCaps(InputWord);\n bool b2 = isFirstLetterNotCaps(InputWord);\n if (b1 || b2)\n {\n \n for(int i = 0; i < InputWord.Length; i++)\n {\n if(char.IsUpper(InputWord[i]))\n Console.Write(char.ToLower(InputWord[i]));\n else\n Console.Write(char.ToUpper(InputWord[i]));\n }\n }\n else\n Console.WriteLine(InputWord);\n }\n public static bool IsCaps(string inputWord)\n {\n foreach (char c in inputWord)\n {\n if (!char.IsUpper(c))\n return false;\n\n }\n return true;\n }\n public static bool isFirstLetterNotCaps(string inputWord)\n {\n if (char.IsUpper(inputWord[0]))\n return false;\n for(int i = 1; i < inputWord.Length; i++)\n {\n if (char.IsLower(inputWord[i]))\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Caps {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n char firstletter = input[0];\n if (Char.IsUpper(input[0])) {\n firstletter = Char.ToLower(input[0]);\n } else {\n firstletter = Char.ToUpper(input[0]);\n }\n string output = input.Remove(0, 1);\n int uppercount = 0;\n for(int i = 0; i < output.Length; ++i) { \n if (Char.IsUpper(output[i])) {\n uppercount++;\n }\n }\n if(uppercount == output.Length) {\n output = output.ToLower();\n Console.WriteLine(firstletter + output);\n return;\n }\n Console.WriteLine(input);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olymp_dop\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n for (int i = 1; i < s.Length; i++)\n {\n if (!(s[i] >= 'A' && s[i] <= 'Z'))\n {\n Console.WriteLine(s);\n return;\n }\n }\n if (s[0]>='a' && s[0] <= 'z')\n {\n Console.WriteLine(s[0].ToString().ToUpper() + s.Substring(1, s.Length - 1).ToLower());\n return;\n }\n Console.WriteLine(s[0].ToString().ToLower() + s.Substring(1, s.Length - 1).ToLower());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s == s.ToUpper())\n {\n Console.WriteLine(s.ToLower());\n }\n else\n if ((s.Substring(1, s.Length - 1) == s.Substring(1,s.Length-1).ToUpper()) && \n (s[0].ToString() == s[0].ToString().ToLower()))\n {\n Console.Write(s[0].ToString().ToUpper()+ s.Substring(1, s.Length - 1).ToLower());\n }\n else\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace capslock\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char ch;\n \n if (str.Length > 1)\n {\n for (int i = 1; i < str.Length; i++) \n {\n ch = str[i];\n if (ch >= 'a' && ch <= 'z')\n {\n Console.WriteLine(str);\n return; \n }\n }\n }\n \n string result = \"\";\n foreach (char character in str)\n {\n result += switchcase(character);\n }\n Console.WriteLine(result);\n }\n\n public static char switchcase(char ch)\n {\n if (ch >= 'a' && ch <= 'z')\n return (char)(ch - 32);\n if (ch >= 'A' && ch <= 'Z')\n return (char)(ch + 32);\n return ch;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C1CapsLock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string usrInput = Console.ReadLine();\n\n if (case1(usrInput))\n Console.WriteLine(usrInput.ToLower());\n else if (case2(usrInput))\n Console.WriteLine(usrInput.Substring(0, 1).ToUpper()+usrInput.Substring(1).ToLower());\n else\n Console.WriteLine(usrInput);\n Console.ReadLine();\n }\n static bool case1(string str)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (!char.IsUpper(str[i]))\n return false;\n }\n return true;\n }\n static bool case2(string str2)\n {\n return case1(str2.Substring(1)) && char.IsLower(str2[0]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n public class Program\n { \n public static void Main(String[] args )\n {\n \n var str = Console.ReadLine();\n string str2 = str.Substring(1).ToUpper();\n if (str.Substring(1) == str2)\n {\n if (str.First().ToString() == str.First().ToString().ToUpper())\n {\n Console.WriteLine(str.ToLower());\n }\n else\n {\n Console.WriteLine(str.First().ToString().ToUpper() + str.Substring(1).ToLower());\n }\n }\n \n \n else\n {\n \n Console.WriteLine(str);\n }\n \n \n } \n } \n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n string alphacap = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n char[] m = alphacap.ToCharArray();\n string small = \"abcdefghijklmnopqrstuvwxyz\";\n int sum = 0;\n int sum2=0;\n int j = 0;\n string l = \"\";\n for (int i = 0; i < word.Length; i++)\n {\n for ( j = 0; j < alphacap.Length; j++)\n {\n if (word[i] == alphacap[j] )\n {\n sum++;\n } \n }\n }\n j = 0;\n for (j = 0; j < alphacap.Length; j++)\n {\n if (word[0] == small[j])\n {\n sum2++;\n l = alphacap[j].ToString();\n break;\n }\n }\n if (sum == word.Length)\n {\n word = word.ToLower();\n Console.WriteLine(word);\n }\n else if (sum2 == 1 && sum == word.Length - 1)\n {\n word = word.ToLower();\n word = word.Remove(0, 1);\n word = word.Insert(0, l);\n Console.WriteLine(word);\n }\n else\n Console.WriteLine(word);\n \n\n \n \n \n\n \n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _36__A._cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n if (input.Length==1 && (int)input[0] >= 97 && (int)input[0] <= 122)\n {\n Console.WriteLine(input.ToUpper());\n }\n\n else if (input.Length == 1 && (int)input[0] >= 65 && (int)input[0] <= 90)\n {\n Console.WriteLine(input.ToLower());\n }\n\n\n\n\n else\n {\n\n int counter = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if ((int)input[i] >= 65 && (int)input[i] <= 90)\n {\n counter++;\n\n }\n\n }\n\n\n int counter2 = 0;\n\n if ((int)input[0] >= 97 && (int)input[0] <= 122)\n {\n for (int i = 1; i < input.Length; i++)\n {\n if ((int)input[i] >= 65 && (int)input[i] <= 90)\n {\n counter2++;\n\n }\n\n\n\n }\n\n\n }\n\n\n\n\n if (counter2 == (input.Length - 1))\n {\n char[] array = input.ToLower().ToCharArray();\n\n\n int b = (int)array[0] - 32;\n\n char gh = (char)b;\n array[0] = gh;\n\n Console.WriteLine(array);\n\n\n\n }\n else if (counter == input.Length)\n {\n\n\n Console.WriteLine(input.ToLower());\n\n\n }\n\n\n\n\n else\n {\n \n Console.WriteLine(input);\n }\n\n }\n }\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _10_CapsLock_131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n char[] letters = line.ToCharArray();\n char first;\n bool wrong = false;\n string output = \"\";\n if (letters.Length > 1)\n {\n if (char.IsUpper(letters[0]) && char.IsUpper(letters[1]))\n {\n for (int i = 2; i < line.Length; i++)\n {\n if (!char.IsUpper(line[i]))\n {\n wrong = true;\n break;\n }\n }\n if (!wrong)\n output = line.ToLower();\n else\n output = line;\n }\n else if (char.IsLower(letters[0]) && char.IsUpper(letters[1]))\n {\n for (int i = 2; i < line.Length; i++)\n {\n if (!char.IsUpper(line[i]))\n {\n wrong = true;\n break;\n }\n }\n if (!wrong)\n {\n first = line[0];\n first = char.ToUpper(first);\n string tail = line.Substring(1).ToLower();\n output += first;\n output += tail;\n }\n else\n {\n output = line;\n }\n }\n else\n {\n output = line;\n }\n }\n else\n {\n if (char.IsLower(letters[0]))\n output = line.ToUpper();\n else\n output = line.ToLower();\n }\n /*\n for (int i = 0; i < letters.Length; i++)\n {\n first = letters[i];\n if (i == 0)\n {\n if (char.IsLower(letters[i]))\n turnAround = true;\n }\n else if (i == 1)\n {\n if (turnAround)\n {\n if (!char.IsUpper(letters[i]))\n break;\n else\n {\n char.ToUpper(first);\n char.ToLower(letters[i]);\n output += first + letters[i];\n }\n }\n else\n {\n if (!char.IsUpper(letters[i]))\n break;\n else\n {\n char.ToLower(first);\n char.ToLower(letters[i]);\n output += first + letters[i];\n }\n }\n }\n else \n {\n char.ToLower(letters[i]);\n output += letters[i];\n }\n }*/\n Console.WriteLine(output);\n Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool capOn = true;\n\n if (input.Length == 1)\n {\n if (input[0] <= 'Z')\n {\n Console.WriteLine(input.ToLower());\n return;\n }\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (!(input[i] <= 'Z'))\n {\n capOn = false;\n }\n }\n \n if (capOn)\n {\n foreach (var c in input)\n {\n if (c <= 'Z')\n {\n Console.Write((char)(c+32));\n }\n else\n {\n Console.Write((char)(c-32));\n }\n }\n System.Console.WriteLine();\n }\n else\n {\n System.Console.WriteLine(input);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class cAPS_lOCK\n{\n private static void Solve()\n {\n string str = Read();\n\n if (str.All(char.IsUpper))\n Write(str.ToLower());\n else if (char.IsLower(str[0]) && str.Skip(1).All(char.IsUpper))\n Write(str[0].ToString().ToUpper() + str.Substring(1).ToLower());\n else\n Write(str);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new cAPS_lOCK().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static bool IsWrongCaps(ref string s)\n {\n if (s[0] >= 'A' && s[0] <= 'Z')\n {\n for (int i = 1; i < s.Length; i++)\n if (s[i] >= 'a' && s[i] <= 'z') return false;\n s = s.ToLower();\n }\n else\n {\n for (int j = 1; j < s.Length; j++)\n if (s[j] >= 'a' && s[j] <= 'z') return false;\n s = s[0].ToString().ToUpper() + s.Remove(0, 1).ToLower();\n }\n return true;\n }\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n if (IsWrongCaps(ref input))\n {\n Console.Write(input);\n } \n else\n Console.Write(input);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cAPSLOCK___codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine().ToString();\n string result = string.Empty;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (char.IsLower(s[0]) && i == 0)\n {\n result = char.ToUpper(s[0]).ToString();\n }\n\n else if (char.IsUpper(s[i]))\n {\n result = result + char.ToLower(s[i]).ToString();\n }\n else\n {\n result = string.Empty;\n result = s;\n break;\n }\n }\n\n Console.WriteLine(result);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n public static void check(string i)\n {\n string temp1 = i.ElementAt(0).ToString();\n string temp2 = i.Substring(1);\n string temp3 =i.Substring(1);\n temp2 = temp2.ToUpper();\n temp1 = temp1.ToUpper();\n \n if (temp1 == i.ElementAt(0).ToString()&&temp2==temp3)\n {\n string arr;\n arr = i.Substring(1);\n if (i.Substring(1) == arr)\n {\n arr = arr.ToLower();\n string temp4 = i.ElementAt(0).ToString();\n temp4 = temp4.ToLower();\n Console.WriteLine(temp4 + arr);\n return;\n }\n \n\n Console.WriteLine(i);\n \n }\n else{\n \n if (i.Substring(1)==temp2)\n {\n i = i.ToUpper();\n string arr;\n arr = i.Substring(1);\n\n arr = arr.ToLower();\n\n i = i.ElementAt(0) + arr;\n Console.WriteLine(i);\n }\n else \n {\n Console.WriteLine(i); \n }\n \n }\n }\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n check(input);\n\n\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n public class Program\n {\n public static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var sb = new StringBuilder(str);\n var firstCase = true;\n var secondCase = true;\n\n if ((char)sb[0] >= 97 && (char)sb[0] <= 122)\n {\n for (int i = 1; i < str.Length; i++)\n {\n if ((char)sb[i] >= 65 && (char)sb[i] <= 90)\n {\n firstCase = true;\n }\n else\n {\n firstCase = false;\n break;\n }\n }\n if (firstCase)\n {\n str = str.ToUpper();\n sb[0] = str[0];\n str = str.ToLower();\n for (int i = 1; i < str.Length; i++)\n {\n sb[i] = str[i];\n }\n str = sb.ToString();\n }\n\n }\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n if ((char)sb[i] >= 65 && (char)sb[i] <= 90)\n {\n secondCase = true;\n }\n else\n {\n secondCase = false;\n break;\n }\n }\n if (secondCase)\n {\n str = str.ToLower();\n }\n }\n\n\n Console.WriteLine(str);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string h = Console.ReadLine();\n if(h.ToArray().Count(x=>x.ToString().ToUpper()==x.ToString()) == h.Length)\n {\n Console.WriteLine(h.ToLower());\n }\n else if(h.ToArray().Count(x => x.ToString().ToUpper() == x.ToString()) + 1 == h.Length && h[0].ToString().ToUpper() != h[0].ToString()) //same\n {\n Console.WriteLine(h[0].ToString().ToUpper() + h.Substring(1).ToLower());\n }\n else if(h[0].ToString().ToUpper() != h[0].ToString() && h.Length == 1) //same\n {\n Console.WriteLine(h[0].ToString().ToUpper() + h.Substring(1).ToLower());\n }\n else\n {\n Console.WriteLine(h);\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CapsLock\n{\n internal class Program\n {\n private static void Main()\n {\n var line = Console.ReadLine().Trim();\n var length = line.Length;\n\n if (length == 1)\n {\n if (line[0] < 97 || line[0] > 122)\n {\n Console.WriteLine(line.ToLower());\n }\n else\n {\n Console.WriteLine(line.ToUpper());\n }\n }\n else if (AllUpper(line, length))\n {\n line = line.ToLower();\n Console.WriteLine(line);\n }\n else if (JustFirstLower(line, length))\n {\n line = line.ToLower();\n line = line[0].ToString().ToUpper() + line.Substring(1);\n Console.WriteLine(line);\n }\n else\n {\n Console.WriteLine(line);\n }\n }\n\n private static bool JustFirstLower(string line, int length)\n {\n if (line[0] < 97 || line[0] > 122)\n {\n return false;\n }\n\n for (var i = 1; i < length; i++)\n {\n if (line[i] < 65 || line[i] > 90)\n {\n return false;\n }\n }\n\n return true;\n }\n\n private static bool AllUpper(string line, int length)\n {\n for (var i = 0; i < length; i++)\n {\n if (line[i] < 65 || line[i] > 90)\n {\n return false;\n }\n }\n\n return true;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace cAPS_LOCK\n{\n\tusing string2 = StringBuilder;\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring2 s = new string2( Console.ReadLine () );\n\t\t\tstring2 s2 = new string2(s.ToString());\n\n\t\t\tbool kt = true;\n\t\t\tfor (int i = 1; i < s.Length; ++i)\n\t\t\t\tif (s [i] >= 'A' && s [i] <= 'Z') {\n\t\t\t\t\ts [i] = (char)(s [i] + 32);\n\t\t\t\t} else {\n\t\t\t\t\tkt = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (!kt)\n\t\t\t\tConsole.Write (s2);\n\t\t\telse {\n\t\t\t\tif (s [0] >= 'a' && s [0] <= 'z')\n\t\t\t\t\ts [0] = (char)(s [0] - 32);\n\t\t\t\telse if (s [0] >= 'A' && s [0] <= 'Z')\n\t\t\t\t\ts [0] = (char)(s [0] + 32);\n\t\t\t\tConsole.Write (s);\n\t\t\t}\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n class OlimpiadTaskC\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n bool lower = false;\n for (int i = 1; i < line.Length; i++)\n {\n if (char.IsLower(line[i]))\n {\n lower = true;\n break;\n }\n }\n if(char.IsLower(line[0]) && !lower)\n {\n line = line.ToLower();\n line = line.Substring(0, 1).ToUpper() + line.Remove(0, 1);\n Console.WriteLine(line);\n return;\n }\n if (!char.IsLower(line[0]) && !lower)\n {\n line = line.ToLower();\n Console.WriteLine(line);\n return;\n }\n Console.WriteLine(line);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var word = Console.ReadLine();\n\n if(Regex.IsMatch(word, \"^[a-z]{1}[A-Z]+$\"))\n {\n word = Char.ToUpper(word[0]) + word.Substring(1).ToLower();\n }\n\n else if (Regex.IsMatch(word, \"^[^a-z]+$\"))\n {\n word = word.ToLower();\n }\n\n else if (Regex.IsMatch(word, \"^[a-z]{1}$\"))\n {\n word = word.ToUpper();\n }\n\n Console.WriteLine(word);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); bool o = false, a = true;\n if (s[0].ToString().ToUpper() != s[0].ToString())\n a = false;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i].ToString().ToUpper() != s[i].ToString())\n { o = true; a = true; break; }\n }\n\n if (o == a && a == true)\n Console.WriteLine(s);\n else if (a)\n Console.WriteLine(s.ToLower());\n else Console.WriteLine(s[0].ToString().ToUpper() + s.Substring(1).ToLower());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Collections;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().ToList();\n bool f=true;\n for (int i = 1; i < s.Count; i++)\n {\n if (!Char.IsUpper(s[i])) f = false;\n }\n if (f)\n {\n for (int i = 0; i < s.Count; i++)\n {\n if (Char.IsUpper(s[i]))\n {\n Console.Write(Char.ToLower(s[i]));\n }\n else\n {\n Console.Write(Char.ToUpper(s[i]));\n }\n }\n }\n else\n {\n for (int i = 0; i < s.Count; i++)\n {\n Console.Write(s[i]);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeForcesRu_\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(s(Console.ReadLine()));\n }\n\n static string s(string s)\n {\n if (s.Length == 1)\n {\n if (s == s.ToLower())\n {\n return s.ToUpper();\n }\n\n return s.ToLower();\n }\n\n for (int i = 1; i < s.Length; i++)\n {\n if (!(s[i] >= 'A' && s[i] <= 'Z'))\n {\n return s;\n }\n }\n\n var sb = new StringBuilder(s);\n\n for (int i = 0; i < sb.Length; i++)\n {\n if (sb[i] == char.ToLower(sb[i]))\n {\n sb[i] = char.ToUpper(sb[i]);\n }\n else\n {\n sb[i] = char.ToLower(sb[i]);\n }\n }\n\n return sb.ToString();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n\t\n\t Console.WriteLine(inp.Length == 1 ? Method(inp[0]) : Method(inp));\n }\n \n public static string Method(string s)\n {\n \tif(s.All(c => char.IsUpper(c))) return s.ToLower();\n \t\n \telse if(char.IsLower(s[0]) && s.Skip(1).All(c => char.IsUpper(c))) return s.Substring(0,1).ToUpper() + s.Substring(1).ToLower();\n \t\n \telse return s;\n \t\n }\n\n public static string Method(char ch)\n {\n \tstring tmp = ch.ToString();\n \t\n \treturn char.IsUpper(tmp[0]) ? tmp.ToLower() : tmp.ToUpper();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string l = Console.ReadLine();\n List b = l.ToList();\n int count = b.FindAll(x => char.IsUpper(x)).Count;\n if (char.IsUpper(b[0]))\n count--;\n if(l.Length - count <= 1)\n {\n if (char.IsLower(l[0]))\n l = char.ToUpper(l[0]) + l.Remove(0, 1);\n else\n l = char.ToLower(l[0]) + l.Remove(0, 1);\n for (int i = 1; i < l.Length; i++)\n {\n string a = char.ToLower(l[i]).ToString();\n l = l.Remove(i, 1);\n l = l.Insert(i, a);\n }\n }\n Console.WriteLine(l);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string word;\n word = Console.ReadLine();\n\n if (IsAllUpper(word))\n {\n Console.WriteLine( word.ToLower());\n }\n \n \n else if (System.Char.IsLower(char.Parse(word.Substring(0, 1)))&& IsAllUpper(word.Substring(1,word.Length-1)))\n {\n \n \n Console.WriteLine(word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length - 1).ToLower());\n \n }\n \n else if (word.Length == 1)\n {\n Console.WriteLine(word.ToUpper());\n }\n\n else\n {\n Console.WriteLine(word);\n }\n \n Console.ReadLine();\n }\n static bool IsAllUpper(string input)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (!Char.IsUpper(input[i]))\n return false;\n }\n return true;\n }\n\n static bool IsAllLOWER(string input)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (Char.IsUpper(input[i]))\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BulkaProga\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (line.Count(x => char.IsUpper(x)) == line.Length || (line.Count(x => char.IsUpper(x)) == line.Length - 1 && char.IsLower(line[0])))\n {\n foreach (char c in line)\n {\n Console.Write(char.IsLower(c) ? c.ToString().ToUpper() : c.ToString().ToLower());\n }\n Console.Write(\"\\n\");\n }\n else\n {\n Console.WriteLine(line);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace z1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine(); var data2 = \"\";\n if(data==data.ToUpper()){ data2 += data.ToLower();}else if (data.Remove(0, 1) == data.Remove(0, 1).ToUpper())\n {\n data2 = data[0].ToString().ToUpper();\n data = data.Remove(0, 1);\n data2 += data.ToLower();\n\n }\n else\n {\n data2 += data;\n }\n Console.WriteLine(data2);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n\n\n class Program\n {\n static int getCountOfUpperCaseChars(string input)\n {\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (char.IsUpper(input[i]))\n {\n count++;\n }\n\n }\n return count;\n\n }\n\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var builder = new StringBuilder();\n\n\n int totalLength = s.Length;\n int upperCaseCount = getCountOfUpperCaseChars(s);\n\n\n\n bool conditionAllCapital;\n if (totalLength == upperCaseCount)\n {\n\n conditionAllCapital = true;\n }\n else\n {\n conditionAllCapital = false;\n }\n\n bool conditionAllCapitalExceptFirst;\n\n if (Char.IsLower(s[0]) && upperCaseCount == totalLength - 1)\n {\n\n conditionAllCapitalExceptFirst = true;\n }\n else\n {\n conditionAllCapitalExceptFirst = false;\n }\n\n if (conditionAllCapital == true || conditionAllCapitalExceptFirst == true)\n {\n for (int i = 0; i < s.Length; i++)\n {\n\n\n if (char.IsLower(s[i]))\n {\n char newword = char.ToUpper(s[i]);\n builder.Append(newword);\n }\n\n if (char.IsUpper(s[i]))\n {\n char newword = char.ToLower(s[i]);\n builder.Append(newword);\n }\n }\n }\n else\n {\n builder.Append(s);\n }\n Console.Write(builder);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void swap(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool flag = true;\n if (str.Length > 1)\n for (int i = 1; i < str.Length; i++)\n {\n if (Char.IsLower(str[i]))\n {\n flag = !flag;\n break;\n }\n }\n if (flag)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (Char.IsLower(str[i]))\n Console.Write(Char.ToUpper(str[i]));\n else\n Console.Write(Char.ToLower(str[i]));\n }\n }\n\n else\n Console.WriteLine(str);\n //System.Console.ReadKey();\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static void Main(string[] args)\n {\n char []ch = Console.ReadLine().ToCharArray();\n int k=0;\n for (int i = 0; i < ch.Length; i++)\n {\n if(Char.IsUpper(ch[i]))\n k++;\n }\n if (k == ch.Length)\n {\n for (int i = 0; i < ch.Length; i++)\n {\n ch[i] = Char.ToLower(ch[i]);\n }\n }\n if ( Char.IsLower(ch[0])&&k==ch.Length-1)\n {\n ch[0] = Char.ToUpper(ch[0]);\n for (int i = 1; i < ch.Length; i++)\n {\n ch[i] = Char.ToLower(ch[i]);\n }\n }\n\n \n Console.WriteLine(ch);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace cAPSLOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string res = Console.ReadLine();\n string abc = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int temp = res.Substring(1, res.Length - 1).Select(x => x).Where(x => abc.Contains(x.ToString())).Count();\n if (res.Length - temp == 1)\n {\n if (abc.Contains(res[0].ToString()))\n Console.WriteLine(res.ToLower());\n else\n Console.WriteLine(res.ToLower().Insert(0, res[0].ToString().ToUpper()).Remove(1, 1));\n }\n else\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DZ_1._1\n{\n class Program\n {\n static void Main(string[] args)\n {\n #region 282\u0410\n //int x = 0;\n //int timesToCount;\n //timesToCount = Convert.ToInt32(Console.ReadLine());\n\n //string[] XCOMmands = new string[timesToCount];\n\n //for (int i = 0; i < timesToCount; i++)\n //{\n // XCOMmands[i] = Console.ReadLine();\n // XCOMmands[i] = XCOMmands[i].ToLower();\n // if (XCOMmands[i] == \"x++\" || XCOMmands[i] == \"++x\") x++;\n // else if (XCOMmands[i] == \"x--\" || XCOMmands[i] == \"--x\") x--;\n //}\n\n //Console.WriteLine(x);\n ////Console.ReadKey();\n #endregion\n\n #region 112A\n //int answer = 0;\n\n //string firstString = Console.ReadLine();\n //string secondString = Console.ReadLine();\n\n //firstString = firstString.ToLower();\n //secondString = secondString.ToLower();\n\n //byte[] encodeFirstString = Encoding.ASCII.GetBytes(firstString);\n //byte[] encodeSecondString = Encoding.ASCII.GetBytes(secondString);\n\n //for (int i=0; i encodeSecondString[i])\n // {\n // answer = 1;\n // break;\n // }\n // else if (encodeFirstString[i] < encodeSecondString[i])\n // {\n // answer = -1;\n // break;\n // }\n //}\n //Console.WriteLine(answer);\n ////Console.ReadKey();\n ///\n #endregion\n\n #region 116A\n //int spaciousness = 0;\n //int passengers = 0;\n //int timesToCount = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < timesToCount; i++)\n //{\n // string temp = Console.ReadLine();\n // string[] IOnumbers = temp.Split(' ');\n // passengers-= Convert.ToInt32(IOnumbers[0]);\n // passengers+= Convert.ToInt32(IOnumbers[1]);\n\n // if (passengers > spaciousness) spaciousness = passengers;\n //}\n\n //Console.WriteLine(spaciousness);\n ////Console.ReadKey(); \n #endregion\n\n #region 133A\n //string inputText = Console.ReadLine();\n\n //if (inputText.Contains(\"H\") || inputText.Contains(\"Q\") || inputText.Contains(\"9\")) Console.WriteLine(\"YES\");\n //else Console.WriteLine(\"NO\");\n\n ////Console.ReadKey();\n #endregion\n\n #region 131A\n string inputText = Console.ReadLine();\n string substring = inputText.Substring(1, inputText.Length - 1);\n string answer = \"\";\n\n bool mistake = false;\n\n if (substring == substring.ToUpper()) mistake = true;\n\n if (mistake)\n {\n for (int i = 0; i < inputText.Length; i++)\n {\n if (char.IsLower(inputText[i])) answer += char.ToUpper(inputText[i]);\n if (char.IsUpper(inputText[i])) answer += char.ToLower(inputText[i]);\n }\n }\n else answer = inputText;\n\n Console.WriteLine(answer);\n //Console.ReadKey(); \n #endregion\n\n #region 110A\n //string inputNumber = Console.ReadLine();\n //int luckyCount = 0;\n //for (int i=0;i1)\n str1 = str.Substring(1, str.Length-1);\n\n if (char.IsLower(str.First()) && str.Length == 1 || char.IsLower(str.First()) && !str1.Any(char.IsLower))\n {\n str1 = str1.ToLower();\n Console.WriteLine(char.ToUpper(str[0]) + str1);\n\n\n }\n else if (!str.Any(char.IsLower))\n {\n str = str.ToLower();\n Console.WriteLine(str);\n\n }\n else\n Console.WriteLine(str);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A._cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n\n if (line.Length == 0) Console.WriteLine(line.ToUpper());\n else if ((int)line[0] >= 97 && isAllUpper(line.Substring(1)))\n {\n Console.Write((char)(line[0] - 32));\n foreach (char c in line.Substring(1))\n {\n Console.Write((char)(c + 32));\n }\n }\n else if (isAllUpper(line))\n {\n foreach (char c in line)\n {\n Console.Write((char)(c + 32));\n }\n }\n else\n {\n Console.WriteLine(line);\n }\n }\n\n static bool isAllUpper(string line)\n {\n foreach (int c in line)\n {\n if (c >= 97) return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class _131A_CapsLock\n {\n static void Main()\n {\n string input = Console.ReadLine();\n\n // \uccab\ubc88\uc9f8\uac00 \ub300\ubb38\uc790\n if(input[0] >= 'A' && input[0] <= 'Z')\n {\n // \uc774\ud6c4 \uc18c\ubb38\uc790\uac00 \ub098\uc624\uba74 \uadf8\ub300\ub85c \ucd9c\ub825\n for(int i = 1; i < input.Length; i++)\n {\n if (input[i] >= 'a' && input[i] <= 'z')\n {\n Console.WriteLine(input);\n return;\n }\n }\n // \ubaa8\ub450 \ub300\ubb38\uc790\uc77c\uacbd\uc6b0\n Console.WriteLine(input.ToLower());\n }\n // \uccab\ubc88\uc9f8\uac00 \uc18c\ubb38\uc790\n else\n {\n // \uc774\ud6c4 \uc18c\ubb38\uc790\uac00 \ub098\uc624\uba74 \uadf8\ub300\ub85c \ucd9c\ub825\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] >= 'a' && input[i] <= 'z')\n {\n Console.WriteLine(input);\n return;\n }\n }\n // \ubaa8\ub450 \ub300\ubb38\uc790\uc77c\uacbd\uc6b0\n Console.WriteLine(\"{0}{1}\", Char.ToUpper(input[0]), input.Remove(0, 1).ToLower());\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test {\n class Class1 {\n\n public static void Main() {\n string s = Console.ReadLine();\n int i = 1, j = s.Length;\n for (; i < j; i++) {\n if(s[i] >= 'a'){\n Console.WriteLine(s);\n return;\n }\n }\n j = 1;\n if(s[0] < 'a') \n Console.Write( (char)(s[0] + 32) );\n else \n Console.Write( (char)(s[0] - 32) );\n for (; j < i; j++) {\n Console.Write((char)(s[j] + 32));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n string str = Console.ReadLine();\n for(int i=1;i 'Z')\n {\n Console.WriteLine( str );\n return;\n }\n if(str[0] >= 'A'&&str[0]<='Z')\n Console.WriteLine( str.ToLower() );\n if(str[0] <= 'z'&&str[0]>='a')\n Console.WriteLine( str[0].ToString().ToUpper() + str.Substring( 1, str.Length - 1 ).ToLower() );\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test {\n class Class1 {\n static int change(char c) {\n if (c >= 'A' && c <= 'Z')\n return c - 'A' + 'a';\n if (c >= 'a' && c <= 'z')\n return c - 'a' + 'A';\n return c;\n }\n\n public static void Main() {\n string s = Console.ReadLine();\n bool flag = true;\n for (int i = 1; flag && i < s.Length; i++) {\n flag = s[i] < 'a';\n }\n if (!flag)\n Console.WriteLine(s);\n else\n for (int i = 0; i < s.Length; i++) {\n Console.Write((char)(change(s[i])));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char CH_1 = str[0];\n string more = \"\";\n for (int f = 1; f < str.Length; f++)\n more += str[f].ToString();\n\n string more_LOW = more.ToLower(), more_UP = more.ToUpper();\n //=================================================\n if (str.Length == 1)\n {\n if(str==str.ToUpper())\n Console.Write(str.ToLower());\n if (str == str.ToLower())\n Console.Write(str.ToUpper());\n }\n else\n {\n if (str == str.ToUpper() || (str == str.ToLower()))\n Console.Write(str.ToLower());\n else if (CH_1.ToString() == CH_1.ToString().ToUpper())// && ((more == more_LOW) || (more == more_UP)))//first U other L || U\n Console.Write(str);\n else if ((CH_1.ToString() == CH_1.ToString().ToLower()) && ((more != more_LOW) && (more != more_UP)))\n Console.Write(str);\n else\n {\n CH_1 = char.Parse(CH_1.ToString().ToUpper());\n str = str.ToLower();\n Console.Write(CH_1.ToString());\n for (int i = 1; i < str.Length; i++)\n Console.Write(str[i]);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System; \nusing System.Collections.Generic; \nusing System.Linq; \nusing System.Text; \nusing System.Threading.Tasks;\n\nnamespace add \n{ \n class Program \n { \n static void Main(string[] args) \n {\n string a=Console.ReadLine();\n string b=a.Substring(0,1);\n string c=a.Substring(1,a.Length-1);\n string d=c.ToUpper();\n if(c==d)\n {\n string e=b.ToUpper();\n if(e==b)\n {\n Console.WriteLine(b.ToLower()+d.ToLower());\n }\n else\n {\n Console.WriteLine(b.ToUpper()+d.ToLower());\n }\n \n }\n else\n {\n Console.WriteLine(a);\n }\n }\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test {\n class Class1 {\n\n public static void Main() {\n int i = 1, j = 1;\n string s = Console.ReadLine();\n for (; i < s.Length; i++) {\n if(s[i] >= 'a'){\n Console.WriteLine(s);\n return;\n }\n }\n Console.Write( s[0] < 'a' ? (char)(s[0] + 32) : (char)(s[0] - 32));\n for (; j < i; j++) {\n Console.Write((char)(s[j] + 32));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task131A\n{\n class Program\n {\n static string Answer(string str)\n {\n Dictionary d1 = new Dictionary();\n string temp = str.ToLower();\n for (char i = 'a'; i <= 'z'; i++)\n {\n d1.Add(i, (char)((int)i - 32));\n }\n short k = 0;\n Int32 index = -1;\n for (Int32 i = 0; i < str.Length; i++)\n {\n if (d1.ContainsKey(str[i]))\n {\n k++;\n index = i;\n }\n }\n if (k > 1) return str;\n if (index > 0) return str;\n if (index == -1) return temp;\n return d1[temp[0]] + temp.Substring(1);\n }\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n Console.WriteLine(Answer(temp));\n //Console.ReadLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A_CapsLock\n{\n static class Program\n {\n public static bool IsAllUppercase(this string str, int start)\n {\n int i = 0;\n for (i = start; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'z') return false; \n }\n return true;\n }\n\n static void PrintAllLowercase(this string str, int start)\n {\n int i = 0;\n char ch;\n for (i = start; i < str.Length; i++)\n {\n Console.Write(char.ToLower(str[i]));\n }\n Console.Write(\"\\n\");\n }\n static void Main(string[] args)\n {\n int i = 0;\n string str = Console.ReadLine();\n char ch;\n\n if (str.Length==1)\n {\n if (str[0] >= 'a' && str[0] <= 'z')\n {\n ch = char.ToUpper(str[0]);\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(str);\n }\n \n }\n\n else if (str.IsAllUppercase(0))\n {\n str.PrintAllLowercase(0);\n }\n\n else if (str[0] >= 'a' && str[0] <= 'z' && str.IsAllUppercase(1))\n {\n ch = char.ToUpper(str[0]);\n Console.Write(ch);\n str.PrintAllLowercase(1);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n { \n string s = Console.ReadLine();\n char c = s.First();\n string s2 = s.ToUpper();\n char c2 = s2.First();\n s2=s2.Remove(0, 1);\n string s3 = s.ToLower();\n char c3 = s3.First();\n s3 = s3.Remove(0, 1);\n \n int a=0, b = 0;\n \n\n for (int i = 1; i < s.Length; i++)\n {\n if (c >= 65 && c <= 90 && s[i] >= 65 && s[i] <= 90)\n {\n a++;\n }\n if (c >= 97 && c <= 122 && s[i] >= 65 && s[i] <= 90)\n {\n b++; \n }\n }\n if (a == s.Length-1) Console.WriteLine(c3+s3);\n else if (b == s.Length-1) Console.WriteLine(c2 + s3.ToLower());\n else Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesModulA\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n StringBuilder str = new StringBuilder(Console.ReadLine());\n int k = 0;\n for (int i =0; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z') k++;\n else if (str[0] <= 'a' && str[0] <='z' && str[i] >= 'A' && str[i] <= 'Z')\n {\n k++;\n }\n }\n if (k == str.Length || k + 1 == str.Length && str.Length > 4)\n {\n Console.Write(str);\n }\n else {\n Console.Write(char.ToUpper(str[0]));\n for (int i = 1; i < str.Length; i++)\n {\n if (str[i] >= 'A' && str[i] <= 'Z') Console.Write((char)(str[i] + 32));\n else Console.Write(str[i]);\n }\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n byte[] p = Encoding.Unicode.GetBytes(s);\n List unicode = new List();\n foreach (byte elem in s)//\u0443\u0431\u0438\u0440\u0430\u0435\u043c \"0\"\n {\n if (elem != 0)\n unicode.Add(elem);\n }\n\n if (unicode[1] > 96 && CapsCheck(unicode))//\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\n Change(unicode);\n\n foreach (byte elem in unicode)\n {\n Console.Write((char)elem);\n }\n //Console.WriteLine();\n }\n\n static bool CapsCheck(List u)\n {\n int k = 0;\n for(int i=1; i 64 && u[i] < 91)\n k++;\n }\n if (k == u.Count-1)\n return true;\n else\n return false;\n }\n\n static void Change(List u)\n {\n u[0] -= 32;\n for (int i = 1; i < u.Count; i++)\n {\n u[i] += 32;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace \u041f\u043b\u0438\u0442\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string slovo = Console.ReadLine();\n slovo.ToLower();\n slovo.ToCharArray();\n for(int i=1;i\n/// Capslock.\n/// \nclass CapsLock\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToCharArray();\n\n bool isInvalid = true;\n if (input.Length == 1)\n {\n if (char.IsLower(input[0]))\n isInvalid = false;\n }\n else\n {\n for (int i = 1; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n {\n isInvalid = false;\n break;\n }\n }\n }\n \n if (isInvalid)\n {\n input[0] = char.IsUpper(input[0]) ? char.ToLowerInvariant(input[0]) : char.ToUpperInvariant(input[0]);\n for (int i = 1; i < input.Length; i++)\n input[i] = char.ToLowerInvariant(input[i]);\n }\n\n Console.WriteLine(input);\n //Console.ReadKey();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n char[] carray = word.ToCharArray();\n\n var builder = new StringBuilder();\n\n\n for (int i = 0; i < carray.Length; i++)\n {\n\n if (i == 0)\n {\n\n if (char.IsLower(carray[0]) || char.IsUpper(carray[0]))\n {\n\n char newword = char.ToUpper(carray[0]);\n\n builder.Append(newword);\n\n\n }\n }\n else\n {\n if (char.IsLower(carray[i]) || char.IsUpper(carray[i]))\n {\n\n char secword = char.ToLower(carray[i]);\n\n builder.Append(secword);\n\n }\n\n }\n\n }\n Console.Write(builder);\n\n }\n\n }\n}\n\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String str = Console.ReadLine();\n String res = \"\";\n if (str.Equals(str.ToUpper()))\n {\n res = str.ToLower();\n Console.WriteLine(res);\n }\n\n else if (str.Equals(str.ToLower()) && str.Length!=1)\n {\n res = str.ToLower();\n Console.WriteLine(res);\n }\n\n else if (str.Equals(str.ToLower()) && str.Length == 1)\n {\n res = str.ToUpper();\n Console.WriteLine(res);\n }\n\n\n else if (check(str) == true)\n {\n for (int i = 0; i < str.Length; i++)\n {\n char c = str[i];\n if (i == 0)\n {\n c = str.ToUpper()[0];\n res += c;\n }\n else\n {\n res += Char.ToLower(c);\n }\n }\n Console.WriteLine(res);\n }\n\n else\n {\n Console.WriteLine(str);\n }\n // Console.ReadKey();\n }\n private static bool check(String s)\n {\n bool res = false;\n \n int l = 0;\n int u = 0;\n \n if (s.Equals(s.ToUpper()))\n {\n res = true;\n }\n\n else if ((s[0] == Char.ToLower(s[0])))\n {\n l++;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == Char.ToUpper(s[i]))\n {\n u++;\n }\n\n else if (s[i] == Char.ToLower(s[i]))\n {\n l++;\n }\n }\n\n\n if (l > 1 && u > 1)\n {\n res = false;\n }\n\n else\n {\n res = true;\n }\n }\n\n else if ((s[0] == Char.ToUpper(s[0])))\n {\n u++;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == Char.ToUpper(s[i]))\n {\n u++;\n }\n\n else if (s[i] == Char.ToLower(s[i]))\n {\n l++;\n }\n }\n\n if (l >= 1 && u >= 1)\n {\n res = false;\n }\n\n else\n {\n res = true;\n }\n }\n\n \n return res;\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Sample {\n public static void Main() {\n string str = Console.ReadLine();\n char[] arr =str.ToCharArray();\n int s = 0;\n for(int i=0;i=65&&(int)arr[i]<97){\n s++;\n }\n \n }\n \n if(s==arr.Length){\n Console.WriteLine(str.ToLower());\n }else if((int)arr[0]>=97&&s==arr.Length-1){\n Console.WriteLine(s);\n str = str.ToLower();\n arr =str.ToCharArray();\n arr[0] = (char)((int)(arr[0])-32);\n str = new string(arr);\n Console.Write(str);\n }else if((int)arr[0]>=97&&s>arr.Length-1){\n arr[0] = (char)((int)(arr[0])-32);\n str = new string(arr);\n Console.Write(str);\n }else{\n Console.Write(str);\n }\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string l = Console.ReadLine();\n List b = l.ToList();\n int count = b.FindAll(x => char.IsUpper(x)).Count;\n if (char.IsUpper(b[0]))\n count--;\n if(l.Length - count - 1 < 1)\n {\n l = char.ToUpper(l[0]) + l.Remove(0, 1);\n for (int i = 1; i < l.Length; i++)\n {\n string a = char.ToLower(l[i]).ToString();\n l = l.Remove(i, 1);\n l = l.Insert(i, a);\n }\n }\n Console.WriteLine(l);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n public static void check(string i)\n {\n string temp1 = i.ElementAt(0).ToString();\n string temp2 = i.Substring(1);\n string temp3 =i.Substring(1);\n temp2 = temp2.ToUpper();\n temp1 = temp1.ToUpper();\n \n if (temp1 == i.ElementAt(0).ToString()&&temp2==temp3)\n {\n string arr;\n arr = i.Substring(1);\n if (i.Substring(1) == arr)\n {\n arr = arr.ToLower();\n Console.WriteLine(i.ElementAt(0) + arr);\n return;\n }\n \n\n Console.WriteLine(i);\n \n }\n else{\n string temp4;\n temp4 = i.ElementAt(0).ToString();\n \n if (temp4 == i.ElementAt(0).ToString())\n {\n Console.WriteLine(i);\n }\n else if (temp4 != i.ElementAt(0).ToString())\n {\n \n i = i.ToUpper();\n string arr;\n arr = i.Substring(1);\n \n arr = arr.ToLower();\n \n i = i.ElementAt(0) + arr;\n Console.WriteLine(i); \n }\n \n }\n }\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n check(input);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace Test\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n int numOfChange = 0;\n bool flag;\n\n if(char.IsUpper(word[0]))\n flag = true;\n else \n flag = false;\n\n for (int i = 1; i < word.Length; i++)\n {\n if(char.IsUpper(word[i]) != flag)\n {\n flag = !flag;\n numOfChange++;\n }\n \n if(numOfChange == 2)\n {\n Console.WriteLine(word);\n return;\n } \n }\n\n \n StringBuilder _word = new StringBuilder(word.ToLower());\n\n _word[0] = char.ToUpper(_word[0]);\n Console.WriteLine(_word);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n public class Program\n { \n public static void Main(String[] args )\n {\n string str = Console.ReadLine();\n str = str.First().ToString().ToUpper() + str.Substring(1).ToLower();\n Console.WriteLine(str);\n \n } \n } \n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int noha = 0;\n int i = 0;\n int j = 1;\n string word;\n word = Console.ReadLine();\n\n if (IsAllUpper(word))\n {\n Console.WriteLine(word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length - 1).ToLower());\n }\n else if (word.Length==1)\n {\n Console.WriteLine(System.Char.ToUpper(char.Parse(word)));\n }\n else if (IsAllLOWER(word))\n {\n Console.WriteLine(word);\n }\n else \n {\n Console.WriteLine(word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length - 1).ToLower());\n }\n\n\n\n /* if (System.Char.IsLower(char.Parse(word.Substring(0, 1))))\n {\n\n for (j = 1; j < word.Length; j++)\n {\n if (System.Char.IsLower(char.Parse(word.Substring(j, 1))))\n {\n noha = 1; goto b;\n }\n\n } Console.WriteLine(word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length - 1).ToLower());\n\n }\n\n else if (System.Char.IsUpper(char.Parse(word.Substring(0, 1))))\n {\n for (i = 0; i < word.Length; i++)\n {\n if (System.Char.IsLower(char.Parse(word.Substring(i, 1))))\n {\n // noha = 1; goto b;\n }\n\n }\n Console.WriteLine(word.Substring(0, 1).ToUpper() + word.Substring(1, word.Length - 1).ToLower());\n\n }\n b: if (noha == 1) Console.WriteLine(word);*/\n Console.ReadLine();\n }\n static bool IsAllUpper(string input)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (!Char.IsUpper(input[i]))\n return false;\n }\n return true;\n }\n\n static bool IsAllLOWER(string input)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (Char.IsUpper(input[i]))\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BulkaProga\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (!char.IsUpper(line[0]) && line.Count(x => !char.IsUpper(x)) > 0 && line.Count(x => char.IsUpper(x)) == 0)\n Console.WriteLine(line[0].ToString().ToUpper() + line.Substring(1).ToLower());\n else\n Console.WriteLine(line);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CapsLock\n{\n class Test\n {\n public \n static void Main(string[] args)\n {\n\n string input = Console.ReadLine();\n if (char.IsLower(input[0]))\n {\n if (input.Remove(0, 1).Any(c => char.IsLower(c)))\n Console.WriteLine(input);\n else\n Console.WriteLine(\"{0}{1}\", Char.ToUpper(input[0]), input.Remove(0, 1).ToLower());\n }\n else\n {\n if(input.Any(c => char.IsLower(c)))\n Console.WriteLine(input);\n else\n Console.WriteLine(\"{0}{1}\", input[0], input.Remove(0, 1).ToLower());\n }\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static void _158a()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int[] points = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int kth = points[k-1];\n Console.WriteLine(points.Count(x => x > 0 && x >= kth));\n }\n static void _71a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] words=new string[n];\n for (int i = 0; i < n; i++)\n {\n words[i] = Console.ReadLine();\n }\n for (int i = 0; i < n; i++)\n {\n if (words[i].Length > 10)\n {\n //Console.WriteLine(words[i][0] + (words[i].Length - 2) + words[i].Last());\n Console.Write(words[i][0]);\n Console.Write(words[i].Length - 2);\n Console.Write(words[i].Last());\n Console.WriteLine();\n }\n else\n Console.WriteLine(words[i]);\n }\n }\n static void _118a()\n {\n string input = Console.ReadLine();\n input=input.ToLower();\n char[] vowels=new[] { 'a', 'o', 'y', 'e', 'u', 'i' };\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < input.Length; i++)\n if (!vowels.Contains(input[i]))\n sb.Append(\".\" + input[i]);\n Console.WriteLine(sb.ToString()); \n }\n static void _158b()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0; \n string s = Console.ReadLine();\n int _1,_2,_3,_4;\n _1 = _2 = _3 = _4 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case '1': _1++;\n break;\n case '2': _2++;\n break;\n case '3': _3++;\n break;\n case '4': _4++;\n break;\n }\n }\n count = _4;\n int min = Math.Min(_1, _3);\n _1 -= min; _3 -= min;\n count += min;\n count += _3;\n int d2 = _2 / 2;\n count += d2;\n _2 -= d2*2;\n if (_2 == 0)\n {\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n else\n {\n count++;\n _1 -= 2;\n if (_1 > 0)\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n Console.WriteLine(count);\n }\n static void _50a()\n {\n string[] ss = Console.ReadLine().Split();\n int m = int.Parse(ss[0]);\n int n = int.Parse(ss[1]);\n int f = 0, s = 0;\n f = m / 2 * n;\n s = n / 2 * m;\n bool first = f > s;\n if (first)\n {//gor\n if (m % 2 == 1)\n f += n / 2;\n }\n else\n { //ver\n if (n % 2 == 1)\n s += m / 2;\n }\n Console.WriteLine(first ? f : s);\n }\n static void _116a()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0, curr = 0;\n for (int i = 0; i < n; i++)\n {\n string[] ss = Console.ReadLine().Split();\n int f = int.Parse(ss[0]);\n int s = int.Parse(ss[1]);\n curr += - f + s;\n if (curr > count)\n count = curr;\n }\n Console.WriteLine(count);\n }\n static void _82a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int gr = 1, end = 5;\n while (end < n)\n {\n gr++;\n end = (int)(5 * (-1 + Math.Pow(2, gr))); \n }\n int need = 4;\n int minus = (int)Math.Pow(2, gr - 1);\n end -= minus;\n while (end >= n)\n {\n minus = (int)Math.Pow(2, gr - 1);\n end-=minus;\n need--;\n }\n Console.WriteLine(names[need]);\n } \n static void _231a()\n {\n int n = int.Parse(Console.ReadLine());\n int count=0;\n for (int i = 0; i < n; i++)\n {\n string t = Console.ReadLine();\n if (t.Count(x => x == '1') >= 2)\n count++;\n }\n Console.WriteLine(count);\n }\n static void _131a()\n {\n string s = Console.ReadLine();\n bool onlyfncaps = char.IsLower(s[0]);\n bool allcaps = false;\n if (s.All(x => char.IsLower(x))&& s.Length==1)\n {\n s = s.ToUpper();\n allcaps = true;\n }\n if (!allcaps && s.All(x => char.IsUpper(x)) && s.Length > 1)\n {\n s = s.ToLower();\n allcaps = true;\n }\n if (onlyfncaps && !allcaps)\n for (int i = 1; i < s.Length; i++)\n if (!char.IsUpper(s[i]))\n {\n onlyfncaps = false;\n break;\n }\n if (onlyfncaps&&!allcaps)\n {\n char[] tt = s.ToCharArray();\n for (int i = 0; i < s.Length; i++)\n if (char.IsUpper(tt[i]))\n {\n tt[i] = char.ToLower(tt[i]);\n }\n else\n {\n tt[i] = char.ToUpper(tt[i]);\n }\n s = string.Join(\"\", tt);\n }\n Console.WriteLine(s);\n }\n\n static void Main(string[] args)\n {\n _131a();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cAPSLOCK___codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine().ToString();\n string result = string.Empty;\n\n if (s.Length == 1)\n {\n if (char.IsLower(s[0]))\n {\n Console.WriteLine(char.ToUpper(s[0]).ToString());\n }\n else\n\n Console.WriteLine(char.ToUpper(s[0]).ToString());\n }\n else if (char.IsUpper(s[0]) && char.IsLower(s[1]))\n {\n Console.WriteLine(s);\n\n }\n\n else if (char.IsLower(s[0]))\n {\n result = char.ToUpper(s[0]).ToString();\n\n\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n Console.WriteLine(s);\n result = string.Empty;\n break;\n }\n result = result + char.ToLower(s[i]).ToString();\n }\n\n if (result != string.Empty)\n {\n Console.WriteLine(result);\n }\n\n\n }\n if ((char.IsUpper(s[0]) && s.Length > 1) && char.IsUpper(s[1]))\n {\n result = char.ToLower(s[0]).ToString() + char.ToLower(s[1]).ToString() ;\n\n for (int i = 2; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n Console.WriteLine(s);\n result = string.Empty;\n break;\n }\n result = result + char.ToLower(s[i]).ToString();\n }\n\n if (result != string.Empty)\n {\n Console.WriteLine(result);\n }\n\n\n }\n\n }\n }\n}\n"}, {"source_code": "using System; \nusing System.Collections.Generic; \nusing System.Linq; \nusing System.Text; \nusing System.Threading.Tasks;\n\nnamespace add \n{ \n class Program \n { \n static void Main(string[] args) \n {\n string a=Console.ReadLine();\n string b=a.Substring(0,1);\n string c=a.Substring(1,a.Length-1);\n string d=c.ToUpper();\n if(c==d)\n {\n Console.WriteLine(b.ToUpper()+d.ToLower());\n }\n else\n {\n Console.WriteLine(a);\n }\n }\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C1CapsLock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string usrInput = Console.ReadLine();\n\n if (case1(usrInput))\n Console.WriteLine($\"{usrInput.Substring(0, 1).ToUpper()}{usrInput.Substring(1).ToLower()}\");\n else if (case2(usrInput))\n Console.WriteLine(\"it is case 2\");\n else\n Console.WriteLine(usrInput);\n Console.ReadLine();\n //bool stringFlag = false;\n\n //for (int i = 0; i < usrInput.Length; i++)\n //{\n // if(char.IsLower(usrInput[0]))\n // {\n // for (int j = 1; j < usrInput.Length; j++)\n // {\n // if (char.IsUpper(usrInput[i]))\n // {\n\n // }\n // }\n // Console.WriteLine(\"first letter is small and all others are capital\");\n // }\n //}\n\n }\n static bool case1(string str)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (!char.IsUpper(str[i]))\n return false;\n }\n return true;\n }\n static bool case2(string str2)\n {\n return case1(str2.Substring(1)) && char.IsLower(str2[0]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static void Main(string[] args)\n {\n char []ch = Console.ReadLine().ToCharArray();\n \n for (int i = 1; i < ch.Length; i++)\n {\n if (Char.IsUpper(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n if(Char.IsLower(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n }\n ch[0] = Char.ToUpper(ch[0]);\n Console.WriteLine(ch);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C_cAPSlOCK\n{\n class Program\n {\n public static bool CheckIfAllCharsAreCaps(List list)\n {\n bool result = false;\n for (int i = 0; i < list.Count; i++)\n if (char.IsUpper(list[i]))\n result = true;\n else\n {\n result = false;\n break;\n }\n return result;\n }\n public static bool CheckIfAllCharsAreCapsExceptFirst(List list)\n {\n bool result = false;\n if (char.IsUpper(list[0]) == false)\n {\n list.RemoveAt(0);\n for (int i = 0; i < list.Count; i++)\n if (char.IsUpper(list[i]))\n result = true;\n else\n {\n result = false;\n break;\n }\n }\n return result;\n\n }\n public static string ToLowerCase(List list)\n {\n for (int i = 0; i < list.Count; i++)\n list[i] = char.Parse(list[i].ToString().ToLower());\n\n string result = string.Join(\"\", list);\n return result;\n }\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n List letters = new List();\n List temp = new List();\n\n foreach (char item in word)\n {\n temp.Add(item);\n }\n\n bool check = CheckIfAllCharsAreCaps(temp);\n bool check2 = CheckIfAllCharsAreCapsExceptFirst(temp);\n\n if (check == true)\n { \n word = ToLowerCase(temp);\n Console.WriteLine(word);\n }\n else\n if (check2 == true)\n {\n foreach (char item in word)\n letters.Add(item.ToString().ToLower());\n\n letters[0] = letters[0].ToUpper();\n word = string.Join(\"\", letters);\n Console.WriteLine(word);\n }\n else\n Console.WriteLine(word);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _123\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int size = s.Length;\n for (int i = 1; i < size; i++)\n if(!char.IsUpper(s[i]))\n {\n Console.WriteLine(s);\n }\n for (int i = 0; i < size; i++)\n if(char.IsUpper(s[i]))\n {\n Console.Write(s[i].ToString().ToLower());\n }\n else\n {\n Console.Write(s[i].ToString().ToUpper());\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string word = Console.ReadLine();\n int countUpper = 0, countLower = 0, i;\n bool t = false;\n for (i = 0; i < word.Length; i++)\n {\n if (char.IsUpper(word[0]))\n {\n t = true;\n }\n if (char.IsUpper(word[i])) countUpper++;\n else if (char.IsLower(word[i])) countLower++;\n }\n\n if (countLower == 0)\n {\n string x = word.ToLower();\n string z = x[0].ToString();\n string l = z.ToUpper();\n string sub = x.Substring(1);\n Console.WriteLine(l + sub);\n Console.ReadLine();\n }\n \n \n if(char.IsLower(word[0]))\n {\n if (countLower == 1)\n {\n string x = word.ToLower();\n string z = x[0].ToString();\n string l = z.ToUpper();\n string sub = x.Substring(1);\n Console.WriteLine(l + sub);\n Console.ReadLine();\n }\n }\n\n if (char.IsUpper(word[0]))\n {\n if(countUpper == 1)\n {\n Console.WriteLine(word);\n Console.ReadLine();\n }\n\n }\n\n if (char.IsLower(word[0]))\n {\n if(countLower > 1)\n {\n Console.WriteLine(word);\n Console.ReadLine();\n }\n }\n if (char.IsUpper(word[0]))\n {\n if (countLower >= 1)\n {\n Console.WriteLine(word);\n Console.ReadLine();\n }\n }\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task131A\n{\n class Program\n {\n static string Answer(string str)\n {\n Dictionary d1 = new Dictionary();\n string temp = str.ToLower();\n for (char i = 'a'; i <= 'z'; i++)\n {\n d1.Add(i, (char)((int)i - 32));\n }\n short k = 0;\n for (Int32 i = 0; i < str.Length; i++)\n {\n if (d1.ContainsKey(str[i]))\n {\n k++;\n }\n }\n if (k > 1) return str;\n return d1[temp[0]] + temp.Substring(1);\n }\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n Console.WriteLine(Answer(temp));\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CapsLock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ds = Console.ReadLine().ToLower();\n string a = ds[0] + \"\";\n string b =a.ToUpper();\n string res =\"\";\n if (ds.Length > 1)\n for (int i = 1; i < ds.Length; i++)\n res += ds[i];\n Console.WriteLine(b+res);\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(\"input.txt\"));\n#endif\n\n var inp = Console.ReadLine();\n if (inp == inp.ToUpper()) {\n inp = inp.ToLower();\n }\n\n if(inp.Substring(1) == inp.Substring(1).ToUpper())\n {\n if (inp.Length == 1)\n {\n inp = inp.ToLower();\n }\n else\n {\n inp = inp.Substring(0, 1).ToUpper() + inp.Substring(1).ToLower();\n }\n }\n\n Console.WriteLine(inp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Ejercicios\n{\n class Program\n {\n static string funcion (string str)\n {\n string newStr = \"\", first;\n\n if (str.Length == 1 && isLower(str[0]))\n return str.ToUpper();\n\n if (str.Length == 1 && isUpper(str[0]))\n return str;\n\n if (isUpper(str[0])){\n if (rest(str))\n return str.ToLower();\n else\n return str;\n }\n else\n {\n if (rest(str))\n {\n first = str[0].ToString().ToUpper();\n newStr = str.Substring(1);\n newStr = first + newStr.ToLower();\n return newStr;\n }\n else\n {\n return str;\n }\n\n }\n }\n\n static bool rest (string str){\n for (int i = 1; i < str.Length; i++)\n {\n if (isLower(str[i]))\n return false;\n }\n return true;\n }\n\n static bool isUpper(char letter)\n {\n string alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n for (int i = 0; i < alpha.Length; i++)\n {\n if (letter == alpha[i]) \n return true;\n }\n return false;\n }\n\n static bool isLower(char letter)\n {\n string alpha = \"abcdefghijklmnopqrstuvwxyz\";\n for (int i = 0; i < alpha.Length; i++)\n {\n if (letter == alpha[i])\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Console.WriteLine(funcion(str));\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A_cAPSLOCk\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n char[] ch = new char[s.Length];\n for (int i = 0; i < s.Length; i++) \n {\n ch[i] = s[i];\n if (i == 0 && ch[i] > 90)\n ch[i] = Convert.ToChar(ch[i] - 32);\n if (i > 0 && (ch[i] < 91))\n ch[i] = Convert.ToChar(ch[i] + 32);\n }\n\n\n s = Convert.ToString(ch[0]);\n for (int i = 1; i < ch.Length;i++)\n {\n s = s + ch[i];\n }\n\n Console.WriteLine($\"{s}\");\n\n \n \n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n string alpha = \"abcdefghijklmnopqrstuvwxyz\";\n string alphacap = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n word = word.ToLower(); \n for(int j=0;j int.Parse(x)).ToArray();\n int kth = points[k-1];\n Console.WriteLine(points.Count(x => x > 0 && x >= kth));\n }\n static void _71a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] words=new string[n];\n for (int i = 0; i < n; i++)\n {\n words[i] = Console.ReadLine();\n }\n for (int i = 0; i < n; i++)\n {\n if (words[i].Length > 10)\n {\n //Console.WriteLine(words[i][0] + (words[i].Length - 2) + words[i].Last());\n Console.Write(words[i][0]);\n Console.Write(words[i].Length - 2);\n Console.Write(words[i].Last());\n Console.WriteLine();\n }\n else\n Console.WriteLine(words[i]);\n }\n }\n static void _118a()\n {\n string input = Console.ReadLine();\n input=input.ToLower();\n char[] vowels=new[] { 'a', 'o', 'y', 'e', 'u', 'i' };\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < input.Length; i++)\n if (!vowels.Contains(input[i]))\n sb.Append(\".\" + input[i]);\n Console.WriteLine(sb.ToString()); \n }\n static void _158b()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0; \n string s = Console.ReadLine();\n int _1,_2,_3,_4;\n _1 = _2 = _3 = _4 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case '1': _1++;\n break;\n case '2': _2++;\n break;\n case '3': _3++;\n break;\n case '4': _4++;\n break;\n }\n }\n count = _4;\n int min = Math.Min(_1, _3);\n _1 -= min; _3 -= min;\n count += min;\n count += _3;\n int d2 = _2 / 2;\n count += d2;\n _2 -= d2*2;\n if (_2 == 0)\n {\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n else\n {\n count++;\n _1 -= 2;\n if (_1 > 0)\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n Console.WriteLine(count);\n }\n static void _50a()\n {\n string[] ss = Console.ReadLine().Split();\n int m = int.Parse(ss[0]);\n int n = int.Parse(ss[1]);\n int f = 0, s = 0;\n f = m / 2 * n;\n s = n / 2 * m;\n bool first = f > s;\n if (first)\n {//gor\n if (m % 2 == 1)\n f += n / 2;\n }\n else\n { //ver\n if (n % 2 == 1)\n s += m / 2;\n }\n Console.WriteLine(first ? f : s);\n }\n static void _116a()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0, curr = 0;\n for (int i = 0; i < n; i++)\n {\n string[] ss = Console.ReadLine().Split();\n int f = int.Parse(ss[0]);\n int s = int.Parse(ss[1]);\n curr += - f + s;\n if (curr > count)\n count = curr;\n }\n Console.WriteLine(count);\n }\n static void _82a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int gr = 1, end = 5;\n while (end < n)\n {\n gr++;\n end = (int)(5 * (-1 + Math.Pow(2, gr))); \n }\n int need = 4;\n int minus = (int)Math.Pow(2, gr - 1);\n end -= minus;\n while (end >= n)\n {\n minus = (int)Math.Pow(2, gr - 1);\n end-=minus;\n need--;\n }\n Console.WriteLine(names[need]);\n } \n static void _231a()\n {\n int n = int.Parse(Console.ReadLine());\n int count=0;\n for (int i = 0; i < n; i++)\n {\n string t = Console.ReadLine();\n if (t.Count(x => x == '1') >= 2)\n count++;\n }\n Console.WriteLine(count);\n }\n static void _131a()\n {\n string s = Console.ReadLine();\n bool onlyfncaps = char.IsLower(s[0]);\n bool allcaps = false;\n\n if (s.All(x => char.IsLower(x)))\n {\n s = s.ToUpper();\n allcaps = true;\n }\n if (!allcaps && s.All(x => char.IsUpper(x)))\n {\n s = s.ToLower();\n allcaps = true;\n }\n if (onlyfncaps && !allcaps)\n for (int i = 1; i < s.Length; i++)\n if (!char.IsUpper(s[i]))\n {\n onlyfncaps = false;\n break;\n }\n if (onlyfncaps)\n {\n char[] tt = s.ToCharArray();\n for (int i = 0; i < s.Length; i++)\n if (char.IsUpper(tt[i]))\n {\n tt[i] = char.ToLower(tt[i]);\n }\n else\n {\n tt[i] = char.ToUpper(tt[i]);\n }\n s = string.Join(\"\", tt);\n }\n Console.WriteLine(s);\n }\n\n static void Main(string[] args)\n {\n _131a();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CAPSLOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Word = Console.ReadLine();\n var Upper = 0;\n\n foreach (var item in Word)\n {\n if (char.IsUpper(item))\n Upper++; \n }\n if (Upper == Word.Length || char.IsLower(Word[0]))\n {\n var Lower = char.ToUpper(Word[0]) + Word.Substring(1).ToLower();\n Console.WriteLine(Lower);\n } \n else\n Console.WriteLine(Word);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n/// \n/// Capslock.\n/// \nclass CapsLock\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToCharArray();\n\n bool isValid = false;\n if (input.Length == 1)\n {\n if (char.IsUpper(input[0]))\n isValid = true;\n }\n else\n {\n for (int i = 1; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n {\n isValid = true;\n break;\n }\n }\n }\n \n if (!isValid)\n {\n input[0] = char.ToUpper(input[0]);\n for (int i = 1; i < input.Length; i++)\n input[i] = char.ToLower(input[i]);\n }\n\n Console.WriteLine(input);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n char[] ch = input.ToCharArray();\n\n if(ch[0] >= 97 && ch.Length == 1)\n {\n Console.WriteLine((char)(ch[0] - 32));\n }\n else if(ch[0] >= 97 && ch.Length > 1)\n {\n ch[0] = (char)(ch[0] - 32);\n for(int i=1; i= 65 && ch[i] <= 90)\n {\n ch[i] = (char)(ch[i] + 32);\n }\n }\n Console.WriteLine(ch);\n }\n else if(ch[0] >= 65 && ch[0] <= 90 && ch.Length > 1)\n {\n for (int i = 1; i < ch.Length; i++)\n {\n if (ch[i] >= 65 && ch[i] <= 90)\n {\n ch[i] = (char)(ch[i] + 32);\n }\n }\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(ch);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Probador_de_Codigo\n{\n class Program\n {\n static void Main(string[] args)\n {\n string entrada = Console.ReadLine();\n Console.WriteLine(entrada[0].ToString().ToUpper() + entrada.ToLower().Substring(1, entrada.Length - 1));\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n StringBuilder output = new StringBuilder();\n int upperCase = 0;\n int lowerCase = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] >= 65 && input[i] <= 97)\n upperCase++;\n else if (input[i] >= 97 && input[i] <= 123)\n lowerCase++;\n }\n if (upperCase == input.Length || upperCase == input.Length - 1)\n for (int i = 0; i < input.Length; i++)\n {\n if (input[0] >= 65 && input[0] < 97 && upperCase == input.Length-1)\n {\n output.Append(input);\n break;\n }\n else if (input[0] >= 97 && input[0] < 123 && upperCase == input.Length - 1)\n {\n if(i==0)\n output.Append(input[i].ToString().ToUpper());\n else\n output.Append(input[i].ToString().ToLower());\n }\n else\n output.Append(input[i].ToString().ToLower());\n }\n else if (lowerCase == input.Length)\n {\n for (int i = 0; i < input.Length; i++)\n {\n output.Append(input[i].ToString().ToLower());\n }\n }\n else\n output.Append(input);\n Console.WriteLine(output);\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A_CapsLock\n{\n static class Program\n {\n public static bool IsAllUppercase(this string str, int start)\n {\n int i = 0;\n for (i = start; i < str.Length; i++)\n {\n if (str[i] >= 'a' && str[i] <= 'b') return false; \n }\n return true;\n }\n\n static void PrintAllLowercase(this string str, int start)\n {\n int i = 0;\n for (i = start; i < str.Length; i++)\n {\n Console.Write(str[i]);\n }\n Console.Write(\"\\n\");\n }\n static void Main(string[] args)\n {\n int i = 0;\n string str = Console.ReadLine();\n char ch;\n\n if (str.Length==1)\n {\n if (str[0] >= 'a' && str[0] <= 'z')\n {\n ch = char.ToUpper(str[0]);\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(str);\n }\n \n }\n\n else if (str.IsAllUppercase(0))\n {\n Console.Write(str[0]);\n str.PrintAllLowercase(1);\n }\n\n else if (str[0] >= 'a' && str[0] <= 'z' && str.IsAllUppercase(1))\n {\n ch = char.ToUpper(str[0]);\n Console.Write(ch);\n str.PrintAllLowercase(1);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n String team = Console.ReadLine();\n String newTeam = team.Remove(0,1);\n String output = null;\n\n newTeam = newTeam.ToLower();\n char firstLetter = team[0];\n\n if (char.IsLower(firstLetter) == true)\n {\n output = string.Concat(team.ToUpper()[0].ToString(),newTeam);\n }\n else\n output = string.Concat(firstLetter.ToString() + newTeam);\n\n Console.WriteLine(output);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count1 = 0;//represent if all caracter is upper\n int count2 = 0;//represent if all caracter is upper expept first latter\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if (char.IsUpper(str[i]))\n {\n count1++;\n }\n }\n if(char.IsLower(str[0]))\n {\n count2++;\n }\n for (int i = 1; i < str.Length; i++)\n {\n if (char.IsLower(str[i]))\n {\n count2++;\n }\n }\n if (count1 == str.Length)\n {\n for (int i = 0; i < str.Length; i++)\n {\n char.ToUpper(str[i]);\n }\n Console.WriteLine(str);\n }\n else if (count2 == str.Length)\n {\n char.ToUpper(str[0]);\n for (int i = 1; i < str.Length; i++)\n {\n char.ToLower(str[i]);\n }\n Console.WriteLine(str);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C_cAPSlOCK\n{\n class Program\n {\n public static bool CheckIfAllCharsAreCaps(List list)\n {\n bool result = false;\n for (int i = 0; i < list.Count; i++)\n if (char.IsUpper(list[i]))\n result = true;\n else\n {\n result = false;\n break;\n }\n return result;\n }\n public static bool CheckIfAllCharsAreCapsExceptFirst(List list)\n {\n bool result = false;\n list.RemoveAt(0);\n for (int i = 0; i < list.Count; i++)\n if (char.IsUpper(list[i]))\n result = true;\n else\n {\n result = false;\n break;\n }\n return result;\n\n }\n\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n List letters = new List();\n List temp = new List();\n\n foreach (char item in word)\n {\n temp.Add(item);\n }\n\n bool check = CheckIfAllCharsAreCaps(temp);\n bool check2 = CheckIfAllCharsAreCapsExceptFirst(temp);\n\n if (check == true || check2 == true)\n {\n foreach (char item in word)\n letters.Add(item.ToString().ToLower());\n\n letters[0] = letters[0].ToUpper();\n word = string.Join(\"\", letters);\n Console.WriteLine(word);\n }\n else\n Console.WriteLine(word);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Problem\n{\n public static void Main()\n {\n string word = Console.ReadLine();\n\n bool isUpper = true;\n for (int i = 1; i < word.Length; i++)\n {\n if (word[i] > 90)\n {\n isUpper = false;\n break;\n }\n }\n\n if (isUpper)\n {\n char[] chars = word.ToCharArray();\n\n if (chars[0] < 90)\n {\n chars[0] += (char)32;\n }\n\n for (int k = 1; k < chars.Length; k++)\n {\n chars[k] += (char)32;\n }\n\n word = string.Join(string.Empty, chars);\n }\n\n Console.WriteLine(word);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Probador_de_Codigo\n{\n class Program\n {\n static void Main(string[] args)\n {\n string entrada = Console.ReadLine();\n string mayuscula = entrada.ToUpper();\n if(entrada.Substring(1, entrada.Length - 1) == mayuscula.Substring(1, mayuscula.Length - 1))\n Console.WriteLine(entrada[0].ToString().ToUpper() + entrada.ToLower().Substring(1, entrada.Length - 1));\n else\n Console.WriteLine(entrada);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static void Main(string[] args)\n {\n char []ch = Console.ReadLine().ToCharArray();\n \n for (int i = 1; i < ch.Length; i++)\n {\n if (Char.IsUpper(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n if(Char.IsLower(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n }\n ch[0] = Char.ToUpper(ch[0]);\n Console.WriteLine(ch);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace capslock\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int sayac = 0;\n string sentence = Console.ReadLine();\n for (int i = 0; i < sentence.Length; i++)\n {\n if (sentence[i]<=90)\n sayac++;\n }\n if (sayac == sentence.Length)\n {\n for (int i = 0; i < sentence.Length; i++)\n {\n Console.Write(Convert.ToChar(sentence[i] + 32));\n }\n }\n else if (sentence[0] >= 'Z' && sayac == sentence.Length - 1)\n {\n if (sentence[0] >= 'Z')\n Console.Write(Convert.ToChar(sentence[0] - 32));\n for (int i = 1; i < sentence.Length; i++)\n {\n if (sentence[i] <= (int)('Z'))\n Console.Write(Convert.ToChar(sentence[i] + 32));\n else\n Console.Write(sentence[i]);\n }\n }\n else\n Console.Write(sentence);\n //65-90 A-Z 97-122 a-z\n Console.ReadKey();\n }\n catch { }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(\"input.txt\"));\n#endif\n\n var inp = Console.ReadLine();\n if (inp == inp.ToUpper()) {\n inp = inp.ToLower();\n }\n\n if(inp.Substring(1) == inp.Substring(1).ToUpper())\n {\n if (inp.Length == 1)\n {\n inp = inp.ToUpper();\n }\n else\n {\n inp = inp.Substring(0, 1).ToUpper() + inp.Substring(1).ToLower();\n }\n }\n\n Console.WriteLine(inp);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string output = string.Empty;\n bool flag = true, bflag;\n if (str.Length != 0)\n {\n output = str[0].ToString().ToUpper();\n }\n for (int i = 1; i < str.Length; i++)\n {\n if (i == 1)\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n {\n flag = false;\n }\n else\n {\n flag = true;\n }\n }\n else\n {\n if (str[i] >= 'a' && str[i] <= 'z')\n {\n bflag = false;\n }\n else\n {\n bflag = true;\n }\n if (flag == bflag)\n {\n output += (str[i].ToString()).ToLower();\n }\n else\n {\n Console.WriteLine(str);\n return;\n }\n }\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class _131A_CapsLock\n {\n static void Main()\n {\n string input = Console.ReadLine();\n\n // \uccab\ubc88\uc9f8\uac00 \ub300\ubb38\uc790\n if(input[0] >= 'A' && input[0] <= 'Z')\n {\n // \uc774\ud6c4 \uc18c\ubb38\uc790\uac00 \ub098\uc624\uba74 \uadf8\ub300\ub85c \ucd9c\ub825\n for(int i = 1; i < input.Length; i++)\n {\n if (input[0] >= 'a' && input[0] <= 'z')\n {\n Console.WriteLine(input);\n return;\n }\n }\n // \ubaa8\ub450 \ub300\ubb38\uc790\uc77c\uacbd\uc6b0\n Console.WriteLine(input.ToLower());\n }\n // \uccab\ubc88\uc9f8\uac00 \uc18c\ubb38\uc790\n else\n {\n // \uc774\ud6c4 \uc18c\ubb38\uc790\uac00 \ub098\uc624\uba74 \uadf8\ub300\ub85c \ucd9c\ub825\n for (int i = 1; i < input.Length; i++)\n {\n if (input[0] >= 'a' && input[0] <= 'z')\n {\n Console.WriteLine(input);\n return;\n }\n }\n // \ubaa8\ub450 \ub300\ubb38\uc790\uc77c\uacbd\uc6b0\n Console.WriteLine(\"{0}{1}\", Char.ToUpper(input[0]), input.Remove(0, 1).ToLower());\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static void Main(string[] args)\n {\n char []ch = Console.ReadLine().ToCharArray();\n \n for (int i = 1; i < ch.Length; i++)\n {\n if (Char.IsUpper(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n if(Char.IsLower(ch[i]))\n ch[i] = Char.ToLower(ch[i]);\n }\n ch[0] = Char.ToUpper(ch[0]);\n Console.WriteLine(ch);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var l = s.Length;\n int co = 0;\n for (var i = 1; i < l; i++)\n {\n if (char.IsUpper(s[i]))\n {\n co++;\n }\n else\n {\n Console.WriteLine(s);\n return;\n }\n }\n\n var r = s.First().ToString().ToUpper() + s.Substring(1).ToLower();\n\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input;\n input = Console.ReadLine();\n input = input.ToUpper();\n string arr ;\n arr = input.Substring(1);\n arr = arr.ToLower();\n input = input.ElementAt(0) + arr;\n Console.WriteLine(input);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Olymp_dop\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = s[0].ToString().ToUpper() + s.Substring(1, s.Length - 1).ToLower();\n Console.WriteLine(s);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cAPSLOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n char[] line_as_char = line.ToCharArray();\n int[] line_as_int =new int[line_as_char.Length];\n \n //char[] line_chars_count;\n if (line_as_char.Length == 1)\n {\n int char_value = (int)line_as_char[0];\n if (char_value >= 65 && char_value <= 90)\n {\n Console.WriteLine(line_as_char[0]);\n return;\n }\n else\n {\n Console.WriteLine((char)(char_value - 32));\n return;\n }\n }\n else\n {\n int state_flag = 0;\n int f_char = (int)line_as_char[0];\n if(f_char >= 65 && f_char <= 90)\n {\n state_flag = 1;\n }\n\n\n int another_state = 0;\n int c_char;\n for (int i = 1; i < line_as_char.Length; i++)\n {\n c_char = (int)line_as_char[i];\n if (c_char >= 65 && c_char <= 90)\n {\n another_state = 1;\n line_as_int[i] =i;\n }\n else\n {\n another_state *= 0;\n break;\n }\n }\n\n if (((state_flag == 1) && (another_state == 1)) || ((state_flag == 0) && (another_state == 1)))\n {\n if(state_flag == 1) \n {\n line_as_char[0] = (char)((int)line_as_char[0] + 32);\n }\n else\n {\n line_as_char[0] = (char)((int)line_as_char[0] - 32);\n }\n foreach (int x in line_as_int)\n {\n if (x == 0)\n {\n continue;\n }\n line_as_char[x] = (char)((int)line_as_char[x] + 32);\n }\n\n }\n \n \n }\n\n Console.WriteLine(line_as_char);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace \u041f\u043b\u0438\u0442\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string proverka= Console.ReadLine();\n char[] slovo = proverka.ToCharArray();\n Console.Write(slovo[0].ToString().ToUpper());\n for (int i = 1; i < slovo.Length; i++)\n slovo[i].ToString().ToLower();\n for (int i = 1; i < slovo.Length; i++)\n {\n if (proverka.ToCharArray()[i] != slovo[i]) Console.WriteLine(slovo);\n else Console.WriteLine(proverka);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool flag = false;\n if (char.IsLower(s[0]))\n {\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n flag = true;\n break;\n }\n }\n }\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n flag = true;\n break;\n }\n }\n }\n\n if (!flag)\n {\n s = s.ToLower();\n string result = s[0].ToString().ToUpper();\n result += s.Remove(0, 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(s);\n }\n\n //Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static void Main(string[] args)\n {\n char []ch = Console.ReadLine().ToCharArray();\n int k=0;\n for (int i = 0; i < ch.Length; i++)\n {\n if(Char.IsUpper(ch[i]))\n k++;\n }\n if (k == ch.Length)\n {\n for (int i = 0; i < ch.Length; i++)\n {\n ch[i] = Char.ToLower(ch[i]);\n }\n }\n if (k==ch.Length-1)\n {\n ch[0] = Char.ToUpper(ch[0]);\n for (int i = 1; i < ch.Length; i++)\n {\n ch[i] = Char.ToLower(ch[i]);\n }\n }\n\n \n Console.WriteLine(ch);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass test\n{\n\tpublic static void Main()\n\t{\n\t\tstring input = Console.ReadLine();\n\t\tinput = input.ToLower();\n\t\t\n\t\tstring inputcp = input;\n\t\tinputcp = inputcp.ToUpper();\n\t\t\n\t\tConsole.Write(inputcp[0]);\n\t\t\n\t\tfor(int i=1;i 90)\n {\n isUpper = false;\n break;\n }\n }\n\n if (isUpper)\n {\n char[] chars = word.ToCharArray();\n\n if (chars[0] > 90)\n {\n chars[0] -= (char)32;\n }\n\n for (int k = 1; k < chars.Length; k++)\n {\n chars[k] += (char)32;\n }\n\n word = string.Join(string.Empty, chars);\n }\n\n Console.WriteLine(word);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count1 = 0;//represent if all caracter is upper\n int count2 = 0;//represent if all caracter is upper expept first latter\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if (char.IsUpper(str[i]))\n {\n count1++;\n }\n }\n if(char.IsLower(str[0]))\n {\n count2++;\n }\n for (int i = 1; i < str.Length; i++)\n {\n if (char.IsUpper(str[i]))\n {\n count2++;\n }\n }\n if (count1 == str.Length)\n {\n for (int i = 0; i < str.Length; i++)\n {\n char.ToUpper(str[i]);\n }\n Console.WriteLine(str);\n }\n else if (count2 == str.Length)\n {\n char.ToUpper(str[0]);\n for (int i = 1; i < str.Length; i++)\n {\n char.ToLower(str[i]);\n }\n Console.WriteLine(str);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n char[] c = n.ToCharArray();\n\n for (int i = 0; i < c.Length; i++)\n {\n\n\n if (c[i].CompareTo('a') < 0)\n {\n char a = char.ToLower(c[i]);\n c[i] = a;\n\n continue;\n }\n if (c[i].CompareTo('a') > 0)\n {\n char a = char.ToUpper(c[i]);\n c[i] = a;\n }\n\n }\n c.ToString();\n Console.WriteLine(c);\n }\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string output = string.Empty;\n for (int i = 0; i < str.Length; i++)\n {\n if (i == 0)\n {\n output = str[0].ToString().ToUpper();\n continue;\n }\n output += (str[i].ToString()).ToLower();\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var word = Console.ReadLine();\n\n if(Regex.IsMatch(word, \"^[a-z]+[A-Z]+$\"))\n {\n word = Char.ToUpper(word[0]) + word.Substring(1).ToLower();\n }\n\n else if (Regex.IsMatch(word, \"^[^a-z]+$\"))\n {\n word = word.ToLower();\n }\n\n Console.WriteLine(word);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n public static void check(string i)\n {\n string temp1 = i.ElementAt(0).ToString();\n string temp2 = i.Substring(1);\n string temp3 =i.Substring(1);\n temp2 = temp2.ToUpper();\n temp1 = temp1.ToUpper();\n \n if (temp1 == i.ElementAt(0).ToString()&&temp2==temp3)\n {\n string arr;\n arr = i.Substring(1);\n if (i.Substring(1) == arr)\n {\n arr = arr.ToLower();\n Console.WriteLine(i.ElementAt(0) + arr);\n return;\n }\n \n\n Console.WriteLine(i);\n \n }\n else{\n string temp4;\n temp4 = i.ElementAt(0).ToString();\n temp4 = temp4.ToUpper();\n if (temp4 == i.ElementAt(0).ToString())\n {\n Console.WriteLine(i);\n }\n else if (temp4 != i.ElementAt(0).ToString())\n {\n \n i = i.ToUpper();\n string arr;\n arr = i.Substring(1);\n \n arr = arr.ToLower();\n \n i = i.ElementAt(0) + arr;\n Console.WriteLine(i); \n }\n \n }\n }\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n check(input);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass test\n{\n\tpublic static void Main()\n\t{\n\t\tstring input = Console.ReadLine();\n\t\tinput = input.ToLower();\n\t\t\n\t\tConsole.WriteLine(input);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace mohity_bara_Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string g=\"\",s = Console.ReadLine();\n g += char.ToUpper(s.ElementAt(0));\n for (int i = 1; i < s.Length; i++)\n g += char.ToLower(s.ElementAt(i));\n Console.Write(g);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n string result = \"\";\n if (word.Length == 1 && Char.IsLower(word[0]))\n {\n result = word.ToUpper();\n }\n else if (Char.IsLower(word[0]) && Char.IsUpper(word[1]))\n {\n result = Char.ToUpper(word[0]).ToString() + word.Substring(1, word.Length - 1).ToLower();\n }\n else if (Char.IsUpper(word[0]) && Char.IsUpper(word[1]))\n {\n result = word.ToLower();\n }\n else if (Char.IsLower(word[0]) && Char.IsLower(word[1]))\n {\n result = word.ToUpper();\n }\n Console.WriteLine(result);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace registr_slov\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Regex pr = new Regex(@\"[A-Z]\");\n MatchCollection pro = pr.Matches(s.Substring(1));\n\n if(s.Substring(1).Length==pro.Count){\n\n \n Console.Write(s[0].ToString().ToUpper() + s.Substring(1).ToLower()); \n }\n\n \n \n else { Console.WriteLine(s); }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetStringInputFromLine();\n TextInfo textInfo = new CultureInfo(\"en-US\", false).TextInfo;\n input = textInfo.ToTitleCase(input);\n Console.WriteLine(input); ;\n\n }\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n string s = Console.ReadLine();\n char[] c = new char[s.Length];\n int [] x = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n c[i] = Convert.ToChar(s[i]);\n x[i] = Convert.ToInt32(s[i]);\n }\n if (s.Length >= 2) // \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 1 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\n {\n if ((x[0] <= 90) & (x[1] <= 90)) // \u0434\u043b\u044f HTTP\n {\n c[0] = s[0];\n for (int i = 1; i < s.Length; i++)\n c[i] = Convert.ToChar(x[i] + 32);\n }\n if (x[0] >= 97) // \u0434\u043b\u044f hELLO\n {\n int count = 0;\n for (int i = 1; i < s.Length; i++)\n {\n if (x[i] <= 90)\n count++;\n }\n if (count == s.Length - 1)\n {\n c[0] = Convert.ToChar(x[0] - 32);\n for (int i = 1; i < s.Length; i++)\n {\n c[i] = Convert.ToChar(x[i] + 32);\n }\n }\n }\n }\n else // \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 1 \u0441\u0438\u043c\u0432\u043e\u043b\n {\n if (x[0] >= 97)\n c[0] = Convert.ToChar(x[0] - 32);\n }\n\n string str2 = new string(c);\n Console.WriteLine(c);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n if (Char.IsLower(word[0]))\n {\n word = word.ToLower();\n Console.WriteLine(Char.ToUpper(word[0]));\n for(int i = 1; i < word.Length; i++)\n {\n Console.Write(word[i]);\n }\n }\n else if (Char.IsUpper(word[0]) && Char.IsLower(word[1]))\n {\n word = word;\n }\n else word = word.ToLower();\n Console.WriteLine(word);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Caps\n{\n\t\tstatic void Main()\n\t\t{\n\t\t\t\tstring input = Console.ReadLine();\n\t\t\t\tstring comp = input.ToLower();\n\t\t\t\tint count = 0;\n\t\t\t\tfor(int i = 0; i < input.Length; i++)\n\t\t\t\t{\n\t\t\t\t\t\tif(input[i] == comp[i])\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count>1)\n\t\t\t\t\tConsole.WriteLine(input);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstring result = \"\";\n\t\t\t\t\tfor(int i = 0; i < input.Length; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\t\tstring tmp = comp[i].ToString();\n\t\t\t\t\t\t\tif(i==0)\n\t\t\t\t\t\t\tresult+=tmp.ToUpper();\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult+=tmp;\n\t\t\t\t\t}\n\t\t\t\t\tConsole.WriteLine(result);\n\t\t\t\t}\n\t\t}\n}\n"}, {"source_code": "using System;\n\nnamespace _131A\n{\n class Program\n {\n static void Reverse(string txt)\n {\n for(int i = 0; i < txt.Length; i++)\n {\n if (char.IsLower(txt[i])) //\u0435\u0441\u043b\u0438 \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f, \u0442\u043e\n {\n Console.Write(char.ToUpper(txt[i]));\n }\n else //\u0438\u043b\u0438 \u0436\u0435\n {\n Console.Write(char.ToLower(txt[i]));\n }\n }\n }\n static void Main(string[] args)\n {\n string txt = Console.ReadLine();\n if(txt.Length > 1)\n {\n if (txt.ToUpper() == txt) //\u0435\u0441\u043b\u0438 \u0432\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0431\u0443\u043a\u0432\u0430\u0445\n {\n Reverse(txt);\n }\n else\n {\n if (char.IsLower(txt[0]) && char.IsUpper(txt[1]) && txt.TrimStart(txt[0]) == txt.TrimStart(txt[0]).ToUpper()) //\u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u0430\u044f \u0438 \u0432 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u043d\u0435\u0442 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0431\u0443\u043a\u0432 \n {\n Reverse(txt);\n }\n else\n {\n Console.Write(txt); //\u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0442\u043e\n }\n }\n }\n else\n {\n Console.Write(txt.ToUpper());\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication73\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char ss = ' ';\n s = s.ToUpper();\n for (int i = 0; i < 1; i++)\n {\n ss = s[i];\n s = s.Remove(i, 1);\n s = s.ToLower();\n }\n Console.WriteLine(ss+s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n if (word.Skip(1).All(Char.IsUpper))\n {\n for (int i = 0; i < word.Length; i++)\n {\n if (Char.IsUpper(word[i])) Console.Write(Char.ToLower(word[i]));\n else Console.WriteLine(word[i]);\n }\n } else Console.Write(word);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n char[] result = new char[p.Length];\n if (p[0] > 90) \n {\n result[0] = (char)(p[0] - 32);\n } else\n {\n result[0] = p[0];\n }\n for(int i = 1; i < p.Length; i++)\n {\n if(p[1] < 91)\n {\n result[i] = (char)(p[i] + 32);\n }\n else\n {\n result[i] = p[i];\n }\n }\n Console.Write(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nclass Test\n{\n static void Main()\n {\n string sTmp = Console.ReadLine();\n string [] aTmp = sTmp.Split();\n string ans = \"\";\n for (int i = 0 ; i= 'a' && str[i] <= 'z') return false; \n }\n return true;\n }\n\n static void PrintAllLowercase(this string str, int start)\n {\n int i = 0;\n char ch;\n for (i = start; i < str.Length; i++)\n {\n Console.Write(char.ToLower(str[i]));\n }\n Console.Write(\"\\n\");\n }\n static void Main(string[] args)\n {\n int i = 0;\n string str = Console.ReadLine();\n char ch;\n\n if (str.Length==1)\n {\n if (str[0] >= 'a' && str[0] <= 'z')\n {\n ch = char.ToUpper(str[0]);\n Console.WriteLine(ch);\n }\n else\n {\n Console.WriteLine(str);\n }\n \n }\n\n else if (str.IsAllUppercase(0))\n {\n Console.Write(str[0]);\n str.PrintAllLowercase(1);\n }\n\n else if (str[0] >= 'a' && str[0] <= 'z' && str.IsAllUppercase(1))\n {\n ch = char.ToUpper(str[0]);\n Console.Write(ch);\n str.PrintAllLowercase(1);\n }\n else\n {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF10Caps\n{\n class Program\n {\n static void Main(string[] args)\n {\n string b = \"\";\n string a = Console.ReadLine();\n for(int i=0;i=97 && str[0]<=122)\n {\n str = str.ToLower();\n a = (char)(str[0] - 32);\n Console.Write(a);\n for (int i = 1; i < str.Length; i++)\n Console.Write(str[i]);\n return;\n }\n if (str[1] >= 65 && str[1] <= 90)\n {\n str = str.ToLower(); \n }\n Console.Write(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CapsLock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n string fixedWord = word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower();\n\n Console.WriteLine(fixedWord); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A___cAPS_lOCK\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ip = Console.ReadLine();\n bool check = true;\n string op = string.Empty;\n for (int i = 1; i < ip.Count(); i++)\n {\n if (char.IsLower(ip[i]) == true)\n {\n check = false;\n }\n }\n if (check == true)\n {\n ip = ip.ToLower();\n string firstchar = ip[0].ToString();\n firstchar = firstchar.ToUpper();\n ip = ip.Remove(0, 1);\n op = firstchar + ip;\n }\n else\n {\n op = ip;\n }\n Console.WriteLine(op);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool flag = false;\n if (char.IsLower(s[0]))\n {\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n flag = true;\n break;\n }\n }\n }\n if (!flag)\n {\n s = s.ToLower();\n string result = s[0].ToString().ToUpper();\n result += s.Remove(0, 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(s);\n }\n \n //Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace YOLO\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n for(int i=0; i 1)\n {\n Console.WriteLine(convert(s));\n return;\n }\n\n char[] c = s.ToUpper().ToCharArray();\n c[0] = c[0].ToString().ToLower()[0];\n string ss = new string(c);\n\n if ((s == ss) & (s.Length > 1))\n {\n Console.WriteLine(convert(s));\n return;\n }\n\n Console.WriteLine(s); \n }\n\n static string convert(string s)\n {\n\n s = s.ToLower();\n char[] c = s.ToCharArray();\n c[0] = c[0].ToString().ToUpper()[0];\n\n return new string(c);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n class OlimpiadTaskC\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n bool lower = false;\n for (int i = 1; i < line.Length; i++)\n {\n if (char.IsLower(line[i]))\n {\n lower = true;\n break;\n }\n }\n if(char.IsLower(line[0]) && !lower)\n {\n line = line.ToLower();\n line = line.Substring(0, 1).ToUpper() + line.Remove(0, 1);\n Console.WriteLine(line);\n return;\n }\n if (char.IsLower(line[0]) && !false)\n {\n line = line.ToLower();\n Console.WriteLine(line);\n return;\n }\n Console.WriteLine(line);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace dev\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n char[] checkWordArray = new char[word.Length - 1];\n word.CopyTo(1, checkWordArray, 0, word.Length - 1);\n string checkWord = new string(checkWordArray);\n\n char[] newWord = new char[word.Length]; \n\n\n if ((Char.IsLower(word[0]) && checkWord == checkWord.ToUpper()) || word == word.ToUpper())\n {\n foreach(char letter in word)\n {\n if (Char.IsUpper(letter))\n {\n newWord[word.IndexOf(letter)] = Char.ToLower(letter);\n }\n else\n {\n newWord[word.IndexOf(letter)] = Char.ToUpper(letter);\n }\n }\n Console.WriteLine(newWord);\n }\n else\n {\n Console.WriteLine(word);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n// Int32 num = Convert.ToInt32(number);\n\n if (number.Length > 1)\n {\n for (int i = 1; i < number.Length; i++)\n {\n if (!char.IsUpper(number[i]))\n {\n Console.WriteLine(number);\n return;\n }\n }\n\n string first = number.Substring(0, 1).ToUpper();\n string other = number.Substring(1).ToLower();\n string result1 = first + other;\n Console.WriteLine(result1);\n }\n else\n {\n Console.WriteLine(number.ToUpper());\n }\n\n \n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String str = Console.ReadLine();\n String res = \"\";\n if (check(str) == true)\n {\n for (int i = 0; i < str.Length; i++)\n {\n char c = str[i];\n if (i == 0)\n {\n c = str.ToUpper()[0];\n res += c;\n }\n else\n {\n res += Char.ToLower(c);\n }\n }\n Console.WriteLine(res);\n }\n\n else\n {\n Console.WriteLine(str);\n }\n \n }\n private static bool check(String s)\n {\n bool res = false;\n \n int l = 0;\n int u = 0;\n \n if (s.Equals(s.ToUpper()))\n {\n res = true;\n\n }\n\n else if ((s[0] == Char.ToLower(s[0])))\n {\n l++;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == Char.ToUpper(s[i]))\n {\n u++;\n }\n\n else if (s[i] == Char.ToLower(s[i]))\n {\n l++;\n }\n }\n }\n\n if (l > 1 && u > 1)\n {\n res = false;\n }\n\n else\n {\n res = true;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static void _158a()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int[] points = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int kth = points[k-1];\n Console.WriteLine(points.Count(x => x > 0 && x >= kth));\n }\n static void _71a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] words=new string[n];\n for (int i = 0; i < n; i++)\n {\n words[i] = Console.ReadLine();\n }\n for (int i = 0; i < n; i++)\n {\n if (words[i].Length > 10)\n {\n //Console.WriteLine(words[i][0] + (words[i].Length - 2) + words[i].Last());\n Console.Write(words[i][0]);\n Console.Write(words[i].Length - 2);\n Console.Write(words[i].Last());\n Console.WriteLine();\n }\n else\n Console.WriteLine(words[i]);\n }\n }\n static void _118a()\n {\n string input = Console.ReadLine();\n input=input.ToLower();\n char[] vowels=new[] { 'a', 'o', 'y', 'e', 'u', 'i' };\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < input.Length; i++)\n if (!vowels.Contains(input[i]))\n sb.Append(\".\" + input[i]);\n Console.WriteLine(sb.ToString()); \n }\n static void _158b()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0; \n string s = Console.ReadLine();\n int _1,_2,_3,_4;\n _1 = _2 = _3 = _4 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case '1': _1++;\n break;\n case '2': _2++;\n break;\n case '3': _3++;\n break;\n case '4': _4++;\n break;\n }\n }\n count = _4;\n int min = Math.Min(_1, _3);\n _1 -= min; _3 -= min;\n count += min;\n count += _3;\n int d2 = _2 / 2;\n count += d2;\n _2 -= d2*2;\n if (_2 == 0)\n {\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n else\n {\n count++;\n _1 -= 2;\n if (_1 > 0)\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n Console.WriteLine(count);\n }\n static void _50a()\n {\n string[] ss = Console.ReadLine().Split();\n int m = int.Parse(ss[0]);\n int n = int.Parse(ss[1]);\n int f = 0, s = 0;\n f = m / 2 * n;\n s = n / 2 * m;\n bool first = f > s;\n if (first)\n {//gor\n if (m % 2 == 1)\n f += n / 2;\n }\n else\n { //ver\n if (n % 2 == 1)\n s += m / 2;\n }\n Console.WriteLine(first ? f : s);\n }\n static void _116a()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0, curr = 0;\n for (int i = 0; i < n; i++)\n {\n string[] ss = Console.ReadLine().Split();\n int f = int.Parse(ss[0]);\n int s = int.Parse(ss[1]);\n curr += - f + s;\n if (curr > count)\n count = curr;\n }\n Console.WriteLine(count);\n }\n static void _82a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int gr = 1, end = 5;\n while (end < n)\n {\n gr++;\n end = (int)(5 * (-1 + Math.Pow(2, gr))); \n }\n int need = 4;\n int minus = (int)Math.Pow(2, gr - 1);\n end -= minus;\n while (end >= n)\n {\n minus = (int)Math.Pow(2, gr - 1);\n end-=minus;\n need--;\n }\n Console.WriteLine(names[need]);\n } \n static void _231a()\n {\n int n = int.Parse(Console.ReadLine());\n int count=0;\n for (int i = 0; i < n; i++)\n {\n string t = Console.ReadLine();\n if (t.Count(x => x == '1') >= 2)\n count++;\n }\n Console.WriteLine(count);\n }\n static void _131a()\n {\n string s = Console.ReadLine();\n bool onlyfncaps = char.IsLower(s[0]);\n bool allcaps = false;\n\n if (s.All(x => char.IsLower(x)))\n {\n s = s.ToUpper();\n allcaps = true;\n }\n if (!allcaps && s.All(x => char.IsUpper(x)))\n {\n s = s.ToLower();\n allcaps = true;\n }\n if (onlyfncaps && !allcaps)\n for (int i = 1; i < s.Length; i++)\n if (!char.IsUpper(s[i]))\n {\n onlyfncaps = false;\n break;\n }\n if (onlyfncaps)\n {\n char[] tt = s.ToCharArray();\n for (int i = 0; i < s.Length; i++)\n if (char.IsUpper(tt[i]))\n {\n tt[i] = char.ToLower(tt[i]);\n }\n else\n {\n tt[i] = char.ToUpper(tt[i]);\n }\n s = string.Join(\"\", tt);\n }\n Console.WriteLine(s);\n }\n\n static void Main(string[] args)\n {\n _131a();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (char.ToLower(s[0]) + s.Substring(1).ToUpper() == s) Console.WriteLine(char.ToUpper(s[0]) + s.Substring(1).ToLower());\n else\n {\n Console.WriteLine(s);\n }\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n/// \n/// Capslock.\n/// \nclass CapsLock\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToCharArray();\n\n bool isInvalid = true;\n if (input.Length == 1)\n {\n if (char.IsLower(input[0]))\n isInvalid = false;\n }\n else\n {\n for (int i = 1; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n {\n isInvalid = false;\n break;\n }\n }\n }\n \n if (isInvalid)\n {\n input[0] = char.IsUpper(input[0]) ? char.ToLowerInvariant(input[0]) : char.ToUpperInvariant(input[0]);\n for (int i = 1; i < input.Length; i++)\n input[i] = char.ToLowerInvariant(input[i]);\n }\n\n Console.WriteLine(input);\n //Console.ReadKey();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\n\nnamespace CSharpOlympTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool change = s.Length == 1 || s.Substring(1)\n .All(c => Char.IsUpper(c));\n\n s = String.Join(string.Empty, s.Select(c => char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c)));\n\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task131A\n{\n class Program\n {\n static string Answer(string str)\n {\n Dictionary d1 = new Dictionary();\n string temp = str.ToLower();\n for (char i = 'a'; i <= 'z'; i++)\n {\n d1.Add(i, (char)((int)i - 32));\n }\n short k = 0;\n for (Int32 i = 0; i < str.Length; i++)\n {\n if (d1.ContainsKey(str[i]))\n {\n k++;\n }\n }\n if (k > 1) return str;\n return d1[temp[0]] + temp.Substring(1);\n }\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n Console.WriteLine(Answer(temp));\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Lv1Phase1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string m =Console.ReadLine();\n //correct word\n if (char.IsUpper(m[0]) && char.IsLower(m[1]))\n Console.WriteLine(m);\n //all caps word \n else if (allupper_(m))\n {\n string m1 = tooutput(m);\n Console.WriteLine(m1);\n }\n //all caps but the 1st letter\n else if (isupper_(m))\n {\n string m1 = tooutput(m);\n Console.WriteLine(m1);\n }\n \n }\n\n\n static string tooutput(string s)\n {\n StringBuilder k = new StringBuilder();\n \n for (int c = 0; c < s.Length; c++)\n {\n if (c != 0) { k.Append(char.ToLower(s[c])); }\n else { k.Append(char.ToUpper(s[c])); }\n \n }\n return k.ToString();\n }\n static bool allupper_ (string s)\n {\n \n foreach (char c in s)\n {\n if (!char.IsUpper(c)) { return false; }\n\n }\n return true;\n }\n static bool isupper_ (string s)\n {\n int i = 0;\n foreach (char c in s)\n {\n if (i != 0)\n {\n if (!char.IsUpper(c)) { return false; }\n }\n i++;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool flag = false;\n if (char.IsLower(s[0]))\n {\n for (int i = 1; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n flag = true;\n break;\n }\n }\n }\n if (!flag)\n {\n s = s.ToLower();\n string result = s[0].ToString().ToUpper();\n result += s.Remove(0, 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(s);\n }\n \n //Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n { \n string str;\n char ch;\n string str2;\n StringBuilder strbld = new StringBuilder();\n str = Console.ReadLine();\n ch = str[0];\n str2 = str.Substring(1, str.Length - 1);\n if (str.ToUpper() == str)\n Console.WriteLine(str.ToLower());\n else if (ch.ToString().ToLower() == ch.ToString() && str2.ToUpper() == str2)\n {\n ch = char.ToUpper(ch);\n str2 = str2.ToLower();\n strbld.Append(ch).Append(str2);\n Console.WriteLine(strbld.ToString());\n }\n else if ((ch.ToString().ToUpper() == ch.ToString() && str2.ToLower() == str2)||str.ToLower()==str) {\n Console.WriteLine(str);\n }\n }\n }\n}\n"}], "src_uid": "db0eb44d8cd8f293da407ba3adee10cf"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\npublic class Codeforces\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = _[0];\n var c = _[1];\n var a3 = new Stack();\n var a3ctr = 0;\n var b3 = new Stack();\n var c3 = new Stack();\n var c3ctr = 0;\n while (a > 0)\n {\n var rem = a % 3;\n a /= 3;\n a3.Push(rem);\n a3ctr++;\n }\n while (c > 0)\n {\n var rem = c % 3;\n c /= 3;\n c3.Push(rem);\n c3ctr++;\n }\n if (a3ctr > c3ctr)\n {\n for (int i = 0; i < a3ctr - c3ctr; i++)\n {\n c3.Push(0);\n }\n c3ctr = a3ctr;\n }\n else if (c3ctr > a3ctr)\n {\n for (int i = 0; i < c3ctr - a3ctr; i++)\n {\n a3.Push(0);\n }\n a3ctr = c3ctr;\n }\n long res = 0L;\n for (int i = 0; i < a3ctr; i++)\n {\n var ter = new[] { 0, 1, 2 };\n var m = c3.Pop();\n var n = a3.Pop();\n while (n-- != 0)\n {\n m--;\n if (m < 0) m = 2;\n }\n b3.Push(m);\n res += m * (long)Math.Pow(3, (a3ctr - 1 - i));\n }\n Console.WriteLine(res);\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n \n }\n \n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int c = int.Parse(ss[1]);\n string a3 = \"\";\n string c3 = \"\";\n while (a != 0)\n {\n a3 += a % 3;\n a /= 3;\n }\n while (c != 0)\n {\n c3 += c % 3;\n c /= 3;\n }\n if (c3.Length > a3.Length)\n {\n int k = c3.Length - a3.Length;\n for (int i = 1; i <= k; i++)\n {\n a3 += 0;\n }\n }\n else\n {\n\n int k = a3.Length - c3.Length;\n for (int i = 1; i <= k; i++)\n {\n c3 += 0;\n }\n }\n string x = \"\";\n string y = \"\";\n for (int i = a3.Length - 1; i >= 0; i--)\n {\n x += a3[i];\n y += c3[i];\n }\n string ans = \"\";\n for (int i = 0; i < x.Length; i++)\n {\n int t1 = int.Parse(x[i].ToString());\n int t2 = int.Parse(y[i].ToString());\n if (t2 == 0)\n {\n if (t1 == 0)\n {\n ans += 0;\n }\n if (t1 == 1)\n {\n ans += 2;\n }\n if (t1 == 2)\n {\n ans += 1;\n }\n }\n else if (t2 == 1)\n {\n if (t1 == 0)\n {\n ans += 1;\n }\n if (t1 == 1)\n {\n ans += 0;\n }\n if (t1 == 2)\n {\n ans += 2;\n }\n\n }\n else if (t2 == 2)\n {\n if (t1 == 0)\n {\n ans += 2;\n }\n if (t1 == 1)\n {\n ans += 1;\n }\n if (t1 == 2)\n {\n ans += 0;\n }\n\n }\n\n\n }\n int o = 0;\n for (int i = ans.Length - 1; i >= 0; i--)\n {\n int t = int.Parse(ans[i].ToString());\n o += (t * (int)(Math.Pow(3,ans.Length - i - 1)));\n }\n Console.WriteLine(o);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\npublic class Codeforces\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = _[0];\n var c = _[1];\n var a3 = new Stack();\n var a3ctr = 0;\n var c3 = new Stack();\n var c3ctr = 0;\n while (a > 0)\n {\n var rem = a % 3;\n a /= 3;\n a3.Push(rem);\n a3ctr++;\n }\n while (c > 0)\n {\n var rem = c % 3;\n c /= 3;\n c3.Push(rem);\n c3ctr++;\n }\n if (a3ctr > c3ctr)\n {\n for (int i = 0; i < a3ctr - c3ctr; i++)\n {\n c3.Push(0);\n }\n c3ctr = a3ctr;\n }\n else if (c3ctr > a3ctr)\n {\n for (int i = 0; i < c3ctr - a3ctr; i++)\n {\n a3.Push(0);\n }\n a3ctr = c3ctr;\n }\n long res = 0L;\n for (int i = 0; i < a3ctr; i++)\n {\n var m = c3.Pop();\n var n = a3.Pop();\n while (n-- != 0)\n {\n m--;\n if (m < 0) m = 2;\n }\n res += m * (long)Math.Pow(3, (a3ctr - 1 - i));\n }\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace AllProblems\n{\n class _136B_TernaryLogic\n {\n public static void Run()\n {\n var w = Console.ReadLine().Trim().Split(' ');\n var a = int.Parse(w[0]);\n var c = int.Parse(w[1]);\n\n var sc = ToTernary(c);\n var sa = ToTernary(a);\n \n\n var m = Math.Max(sa.Length, sc.Length);\n sc = sc.PadLeft(m, '0');\n sa = sa.PadLeft(m, '0');\n \n\n var diff = \"\";\n for (var i = 0; i < m; i++)\n {\n var s = (sc[i] - sa[i] + 3)%3;\n diff += s;\n }\n\n var ans = FromTernary(diff, m);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n static string ToTernary(int x)\n {\n var s = new StringBuilder();\n\n while (x > 0)\n {\n s.Insert(0, x%3);\n x /= 3;\n }\n\n return s.ToString();\n }\n\n static int FromTernary(string s, int len)\n {\n var x = 0;\n \n for (var i = 0; i < len; i++)\n {\n x = x * 3 + (s[i] - 48);\n }\n\n return x;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n _136B_TernaryLogic.Run();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static int[] toTernary(int x)\n {\n int[] ans = new int[20];\n\n int k = ans.Length-1;\n\n while (x > 0)\n {\n ans[k] = x % 3;\n x /= 3;\n k--;\n }\n\n return ans;\n }\n\n static void Main(string[] args)\n {\n int a = 0, c = 0;\n\n ReadInts(ref a, ref c);\n\n var at = toTernary(a);\n var ct = toTernary(c);\n\n for (int i = 0; i < ct.Length; i++)\n {\n ct[i] = (ct[i] - at[i]) % 3;\n\n if (ct[i] < 0)\n ct[i] += 3;\n }\n\n decimal ans = 0;\n\n for (int i = 0; i < ct.Length; i++)\n {\n ans = 3 * ans + ct[i];\n }\n\n\n PrintLn(ans);\n }\n\n\n }\n\n\n\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var n = s[1];\n var digits = Enumerable.Repeat(0,0).ToList();\n while (a > 0 || n > 0) {\n var d = (int)((n%3 + 3 - a%3) % 3);\n digits.Add(d);\n a /= 3; n /= 3;\n }\n var res = 0;\n for (var i = digits.Count - 1 ; i >= 0 ; i--) res = res*3+digits[i];\n Console.Write(res);\n }\n}"}, {"source_code": "using System;\nclass Test{\n\tstatic void Main(){\n\t\tstring [] line = Console.ReadLine().Split();\n\t\tint a = int.Parse(line[0]);\n\t\tint b = int.Parse(line[1]);\n\t\tint sum = 0;\n\t\tint i = 1;\n\t\twhile(a > 0 || b > 0){\n\t\t\tint mod = (b % 3) - (a % 3);\n\t\t\tif(mod < 0){\n\t\t\t\tmod += 3;\n\t\t\t}\n\t\t\ta /= 3;\n\t\t\tb /= 3;\n\t\t\tsum += mod * i;\n\t\t\ti *= 3;\n\t\t}\n\t\tConsole.WriteLine(sum);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var a = ReadNextInt(input, 0);\n var c = ReadNextInt(input, 1);\n var aStr = ConvertToString(a);\n var cStr = ConvertToString(c);\n var len = Math.Max(aStr.Length, cStr.Length);\n var bStr = new char[len];\n var index = len-1;\n var aLen = aStr.Length;\n var cLen = cStr.Length;\n var lastA = aLen - 1;\n var lastC = cLen - 1;\n while (index >=0)\n {\n if (lastA >= 0 && lastC >= 0)\n {\n bStr[index] = GetLetter(aStr[lastA], cStr[lastC]);\n lastA--;\n lastC--;\n }\n else if (lastA >= 0)\n {\n bStr[index] = GetLetter(aStr[lastA--], '0');\n }\n else\n {\n bStr[index] = GetLetter('0', cStr[lastC--]);\n }\n index--;\n }\n var bS = new string(bStr);\n int res = ConvertToInt(bS);\n Console.WriteLine(res);\n }\n\n private static string ConvertToString(int n)\n {\n if (n == 0)\n return \"0\";\n\n var c = new StringBuilder();\n while (n > 0)\n {\n c.Append(n%3);\n n /= 3;\n }\n return new string(c.ToString().Reverse().ToArray());\n }\n\n private static int ConvertToInt(string bs)\n {\n int res = 0;\n for (int i = 0; i < bs.Length; i++)\n {\n res *= 3;\n res += bs[i] - '0';\n }\n return res;\n }\n\n private static char GetLetter(char a, char c)\n {\n\n int resInt = c - a;\n if (resInt < 0)\n resInt += 3;\n return resInt.ToString()[0];\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n static string ToTrinary(Int64 Decimal)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % 3;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / 3;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length-1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString()))%3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n static string tobin(string str)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(3.0, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n\n static string sub(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(b[i].ToString()) - int.Parse(a[i].ToString()));\n if (k >= 0)\n str = (k).ToString() + str;\n else\n str = (k+3).ToString() + str;\n }\n return str;\n }\n\n static void Main(string[] args)\n {\n string[] n = Console.ReadLine().Split(' ');\n string a = ToTrinary(Int64.Parse(n[0]));\n string c = ToTrinary(Int64.Parse(n[1])); \n dop(ref a, ref c);\n string rez = sub(a, c);\n Console.WriteLine(tobin(rez));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static int[] tor(int n)\n {\n int[] r = new int[50];\n int p = 49;\n while (n > 0)\n {\n r[p--] = n % 3;\n n /= 3;\n }\n return r;\n }\n\n static long untor(int[] t)\n {\n long m = 1;\n long r = 0;\n for (int i = 49; i >= 0; i--)\n {\n r += t[i] * m;\n m *= 3;\n }\n return r;\n }\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int a = int.Parse(line[0]);\n int c = int.Parse(line[1]);\n\n int[] _a = tor(a);\n int[] _c = tor(c);\n int[] _b = new int[50];\n\n for(int i = 0; i < 50; i++)\n _b[i] = (_c[i] + 3 - _a[i]) % 3;\n\n Console.WriteLine(untor(_b));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]);\n long b = long.Parse(input[1]);\n\n string sa = \"\";\n string sb = \"\";\n\n while (a > 0)\n {\n sa = a % 3 + sa;\n a /= 3;\n }\n\n while (b > 0)\n {\n sb = b % 3 + sb;\n b /= 3;\n }\n\n while (sa.Length < sb.Length) sa = \"0\" + sa;\n while (sb.Length < sa.Length) sb = \"0\" + sb;\n\n string ans = \"\";\n\n for (int i = 0; i < sa.Length; i++)\n {\n int d1 = int.Parse(sa[i].ToString());\n int d2 = int.Parse(sb[i].ToString());\n int ians = (d2 + 3 - d1) % 3;\n ans += ians;\n }\n\n long res = 0;\n\n for (int i = 0; i < ans.Length; i++)\n {\n res *= 3;\n res = res + int.Parse(ans[i].ToString());\n }\n\n Console.WriteLine(res);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces\n{\n class Tokenizer\n {\n int pos;\n string[] tokens;\n TextReader reader;\n\n public Tokenizer(TextReader reader)\n {\n pos = 0;\n tokens = new string[] { };\n this.reader = reader;\n }\n\n\n public string NextToken()\n {\n if (pos == tokens.Length)\n {\n tokens = reader.ReadLine().Split(' ');\n pos = 0;\n }\n return tokens [pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextToken());\n }\n }\n\n class MainClass\n {\n static Tokenizer t = new Tokenizer(Console.In);\n\n static string ToBase3(int n)\n {\n StringBuilder builder = new StringBuilder();\n while (n > 0)\n {\n builder.Append((char)(n % 3 + '0'));\n n /= 3;\n }\n return new string(builder.ToString().ToCharArray().Reverse().ToArray());\n }\n\n static int FromBase3(string s)\n {\n int ret = 0;\n foreach (char d in s)\n {\n ret = ret * 3 + (d - '0');\n }\n return ret;\n }\n\n public static void Main(string[] args)\n {\n //t = new Tokenizer(File.OpenText(@\"../../in.txt\"));\n //TextReader t = Console.In;\n //t = File.OpenText(@\"../../in.txt\");\n\n string a = ToBase3(t.NextInt());\n string c = ToBase3(t.NextInt());\n\n if (a.Length < c.Length)\n a = a.PadLeft(c.Length, '0');\n else\n c = c.PadLeft(a.Length, '0');\n\n\n StringBuilder builder = new StringBuilder(a.Length);\n for (int i = 0; i < a.Length; i++)\n {\n int dc = c [i] - '0';\n int da = a [i] - '0';\n int db = dc - da + 3;\n db %= 3;\n builder.Append((char)(db + '0')); \n }\n\n Console.WriteLine(FromBase3(builder.ToString()));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace capp\n{\n class Program\n {\n static void Main(string[] args)\n {\n StringBuilder sb = new StringBuilder();\n long[] data = Array.ConvertAll(Console.ReadLine().Split(' '), z => long.Parse(z));\n long a = data[0];\n long c = data[1];\n string s1 = ConvertToAnotherSystem(a, 3);\n string s2 = ConvertToAnotherSystem(c, 3);\n long m = Math.Max(s1.Length, s2.Length);\n if (s1.Length > s2.Length)\n {\n for (long i = 0; i < m - s2.Length; i++)\n sb.Append(\"0\");\n s2 = sb.ToString() + s2;\n }\n if (s2.Length > s1.Length)\n {\n for (long i = 0; i < m - s1.Length; i++)\n sb.Append(\"0\");\n s1 = sb.ToString() + s1;\n }\n sb = new StringBuilder();\n for (int i = 0; i < s1.Length; i++)\n sb.Append((3 - long.Parse(s1[i].ToString()) + long.Parse(s2[i].ToString())) % 3);\n Console.WriteLine(ConvertBack(sb.ToString()));\n \n }\n\n\n static string ConvertToAnotherSystem(long number, long system)\n {\n StringBuilder sb = new StringBuilder();\n while (number != 0)\n {\n sb.Append(number%system);\n number /= system;\n }\n return new string(sb.ToString().Reverse().ToArray());\n }\n static long ConvertBack(string s)\n {\n long res = 0;\n long K = 1;\n for (int i = s.Length - 1; i > -1; i--)\n {\n res += long.Parse(s[i].ToString()) * K;\n K *= 3;\n }\n return res;\n }\n\n static bool IsSimple(long b)\n {\n long c = (long)Math.Round(Math.Sqrt(b));\n for (long i = 2; i <= c; i++)\n if (b % i == 0)\n return false;\n return true;\n }\n \n }\n\n public class Elem\n {\n public long Val1 { get; set; }\n public long Val2 { get; set; }\n public Elem (long val1, long val2)\n {\n Val1 = val1;\n Val2 = val2;\n }\n }\n\n \n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n\tclass Ternary_Logic\n\t{\n\t\tclass Ternary\n\t\t{\n\t\t\tpublic List trigits = new List();\n\n\t\t\tpublic Ternary()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic Ternary(int n)\n\t\t\t{\n\t\t\t\twhile (n > 0)\n\t\t\t\t{\n\t\t\t\t\ttrigits.Add(n % 3);\n\t\t\t\t\tn /= 3;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic Ternary InverseTor(Ternary t)\n\t\t\t{\n\t\t\t\tTernary res = new Ternary();\n\t\t\t\tint i = 0;\n\t\t\t\twhile (i < t.trigits.Count || i < this.trigits.Count)\n\t\t\t\t{\n\t\t\t\t\tint me = i < this.trigits.Count ? this.trigits[i] : 0;\n\t\t\t\t\tint you = i < t.trigits.Count ? t.trigits[i] : 0;\n\t\t\t\t\tres.trigits.Add((me - you + 3) % 3);\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t\tpublic int ToInt32()\n\t\t\t{\n\t\t\t\tint res = 0;\n\t\t\t\ttrigits.Reverse();\n\t\t\t\tforeach (int n in trigits)\n\t\t\t\t{\n\t\t\t\t\tres *= 3;\n\t\t\t\t\tres += n;\n\t\t\t\t}\n\t\t\t\ttrigits.Reverse();\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t}\n\n\t\tpublic static void Main(String[] args)\n\t\t{\n\t\t\tstring[] token = Console.ReadLine().Split(' ');\n\t\t\tint a = int.Parse(token[0]);\n\t\t\tint c = int.Parse(token[1]);\n\t\t\tConsole.WriteLine(new Ternary(c).InverseTor(new Ternary(a)).ToInt32());\n\t\t}\n\t}\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\ndelegate double F(double x);\ndelegate decimal Fdec(decimal x);\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if FileIO\n StreamReader sr = new StreamReader(\"army.in\");\n StreamWriter sw = new StreamWriter(\"army.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int a, c, b;\n string[] input = ReadArray();\n a = int.Parse(input[0]);\n c = int.Parse(input[1]);\n int p = 1;\n b = 0;\n do\n {\n \n int moda = a % 3;\n a /= 3;\n int modc = c % 3;\n c /= 3;\n for (int z = 0; z <= 2; z++)\n if ((moda + z) % 3 == modc)\n b += z * p;\n p *= 3;\n }\n while (a != 0 || c != 0);\n Console.WriteLine(b);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n}\n\nstatic class ArrayUtils\n{\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(int[] A, int p, int q, int r, int[] L, int[] R)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i] <= R[j])\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(int[] A, int p, int r, int[] L, int[] R)\n {\n if (!(p < r)) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n \n static void Shake(int[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n int temp, b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Sth\n{\n class Program\n {\n static int[] p1 = new int[50];\n static int[] res = new int[50];\n static void Main(string[] args)\n {\n int a, c;\n string[] lala = Console.ReadLine().Split();\n a = int.Parse(lala[0]);\n c = int.Parse(lala[1]);\n int len1=0;\n while (a > 0)\n {\n p1[len1++] = a % 3;\n a /= 3;\n }\n int len2 = 0;\n while (c > 0)\n {\n res[len2++] = c % 3;\n c /= 3;\n }\n int ans = 0;\n int step = 1;\n int ll = Math.Max(len1, len2);\n for (int i = 0; i < ll; i++)\n {\n int cif = res[i] - p1[i];\n cif += 3;\n cif %= 3;\n ans += cif * step;\n step *= 3;\n }\n Console.WriteLine(ans);\n //Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\n//mcs HelloWorld.cs\n//mono HelloWorld.exe\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar line = Console.ReadLine().Split(' ');\n\t\tvar n = Convert.ToInt32(line[0]);\n\t\tvar k = Convert.ToInt32(line[1]);\n\t\t//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));\n\t\tsolve(n, k);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\tsolve(14, 34);\n\t\tsolve(50,34);\n\t\tsolve(387420489,225159023);\n\t\tsolve(5,5);\n\t\t\n\t}\n\n\tpublic static void solve(int n, int k)\n\t{ \n\t\tvar tn = getTernary(n);\n\t\tvar tk = getTernary(k);\n\t\tif (tk.Length > tn.Length)\n\t\t\ttn = tn.PadLeft(tk.Length, '0');\n\t\tif (tn.Length > tk.Length)\n\t\t\ttk = tk.PadLeft(tn.Length, '0');\n\n\t\t//Console.WriteLine(tn + \" \" + tk);\n\t\tvar rest = new int[tn.Length];\n\t\tfor (int i = 0; i < tn.Length; i++)\n\t\t{\n\t\t\trest[i] = getTor((int)char.GetNumericValue(tn[i]), (int)char.GetNumericValue(tk[i]));\n\t\t\t//Console.Write(rest[i] + \" \");\n\t\t}\n\n\t\tlong res = 0;\n\t\tfor (int j = 0, i = rest.Length - 1; j < rest.Length; j++, i--)\n\t\t{\n\t\t\tres += (long)Math.Pow(3,j) * rest[i]; //2 + 5\n\t\t}\n\t\tConsole.WriteLine(res);\n\n\t}\n\n\tpublic static string getTernary(int n)\n\t{\n\t\tvar tn = \"\";\n\t\twhile (n != 0)\n\t\t{\n\t\t\ttn = (n % 3).ToString() + tn;\n\t\t\tn = n / 3;\n\t\t}\n\t\treturn tn;\n\t}\n\n\tpublic static int getTor(int a, int b)\n\t{\n\t\treturn (b + 3 - a) % 3;\n\t\t\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n string[] input=Console.ReadLine().Split();\n int a=int.Parse(input[0]);\n int b=int.Parse(input[1]);\n XORSumW(a,b);\n Console.ReadLine();\n }\n \n private static List split(int a)\n {\n List ret=new List();\n while(a>0)\n {\n ret.Add(a%3);\n a/=3;\n }\n return ret;\n }\n \n private static void padW(List a, List b)\n {\n if(a.Count>b.Count)\n {\n int diff=a.Count-b.Count;\n for(int i=0;i c=new List();\n \n for(int i=0;i=0)?b[i]-a[i]:3+b[i]-a[i];\n c.Add(tmp);\n }\n \n int multiplier=1;\n int num=0;\n foreach(int i in c)\n {\n num+=i*multiplier;\n multiplier*=3;\n }\n Console.WriteLine(num);\n }\n \n private static void XORSumW(int a, int b)\n {\n List adig=split(a);\n List bdig=split(b);\n padW(adig,bdig);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace timusss\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] tokens = Console.ReadLine().Split();\n int a = int.Parse(tokens[0]);\n int c = int.Parse(tokens[1]);\n\n List tera = new List();\n List terc = new List();\n\n for (int aa = a; aa > 0; aa /= 3)\n tera.Add(aa % 3);\n for (int cc = c; cc > 0; cc /= 3)\n terc.Add(cc % 3);\n\n List res = new List();\n for (int i = 0; i < terc.Count || i < tera.Count; ++i)\n {\n if (i < tera.Count)\n {\n if (i < terc.Count)\n {\n if (tera[i] <= terc[i])\n res.Add(terc[i] - tera[i]);\n else\n {\n\n res.Add(3 - tera[i] + terc[i]);\n }\n }\n else\n res.Add((3 - tera[i]) % 3);\n }\n else\n res.Add(terc[i]);\n\n }\n\n long result = 0;\n long count = 1;\n int start = 0;\n\n for (int i = start; i < res.Count; ++i)\n {\n result += count * res[i];\n count *= 3;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace tcoder\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n\n \n#endif\n\n var ex = (Console.ReadLine()).Split(' ');\n var ss1 = long.Parse(ex[0]);\n var ss2 = long.Parse(ex[1]);\n\n\n\n string ret = \"\";\n\n var l1 = int_to_bignum(ss1, 3);\n var l2 = int_to_bignum(ss2, 3);\n\n if (l1.Length < l2.Length)\n {\n l1 = l1.Insert(l1.Length, new string('0', l2.Length - l1.Length));\n }\n if (l2.Length < l1.Length)\n {\n l2 = l2.Insert(l2.Length, new string('0', l1.Length - l2.Length));\n }\n var l3 = int_to_bignum(0, 3);\n\n\n long res = 0;\n for (int i = 0; i < l1.Length; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if ((l2[i] - '0') == ((j) + (l1[i] - '0')) % 3)\n {\n ret += ((j) + (l1[i] - '0')) % 3;\n res += (long)Math.Pow(3, i)*(j) ;\n break;\n }\n }\n }\n\n \n Console.Write(res);\n }\n\n static string int_to_bignum(long s, long n)\n {\n int i;\n long t;\n bool sig = false;\n if (s >= 0) sig = true;\n string ret = \"\";\n\n int lasdigit = -1;\n t = Math.Abs(s);\n while (t > 0)\n {\n lasdigit++;\n ret += (t % n).ToString();\n t /= n;\n\n\n\n }\n if (s == 0) lasdigit = 0;\n return (ret);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static long n = 20, a=0,c=0, al=0, cl=0;\n static long[] a3 = new long[n], c3 = new long[n];\n\n static long Perform()\n {\n long result=0;\n while (a > 0)\n {\n a3[al++] = a % 3;\n a /= 3;\n }\n while (c > 0)\n {\n c3[cl++] = c % 3;\n c /= 3;\n }\n long st3 = 1;\n for (int i = 0; i < n; i++)\n {\n result+= st3*((2*a3[i]+c3[i])%3);\n st3 *= 3;\n }\n return result;\n }\n\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(token[0]);\n c = int.Parse(token[1]);\n Console.WriteLine(Perform());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce97\n{\n\tclass ProgramA\n\t{\n\t\tstatic void MainA(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint pi;\n\t\t\tint[] p = new int[100];\n\t\t\tstring s = \"\";\n\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring[] sa = s1.Split(' ');\n\n\t\t\tfor (int i = 0; i= 0; i--)\n\t\t\t{//\u0426\u0438\u043a\u043b\u043e\u043c \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443\n\t\t\t\tbuf2 += buf[i];\n\t\t\t}\n\t\t\treturn buf2; //\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring[] sa = s1.Split(' ');\n\n\t\t\tint a = int.Parse(sa[0]);\n\t\t\tint c = int.Parse(sa[1]);\n\n\t\t\tstring a3 = Trans(a, 3); // long\n\t\t\tstring c3 = Trans(c, 3); // short\n\t\t\tstring b3 = \"\";\n\n\t\t\tint l = Math.Max(a3.Length, c3.Length);\n\n\t\t\twhile (a3.Length = 0; i--)\n\t\t\t{\n\t\t\t\tansb += int.Parse(b3[i].ToString()) * bas;\n\t\t\t\tbas *= 3;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(ansb);\n//\t\t\tConsole.Read();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace ConsoleApplication2\n{\n\n \n\n class Program\n {\n\n static void Main(string[] args)\n {\n \n\n\n string[] str = Console.ReadLine().Split(' ');\n long a = long.Parse(str[0]);\n long c = long.Parse(str[1]);\n\n if(a == 0 && c ==0)\n {\n Console.WriteLine(0);\n return;\n }\n\n int length = (int)Math.Max(Math.Ceiling(Math.Log(a, 3)), Math.Ceiling(Math.Log(c, 3)))+1;\n\n //Console.WriteLine(length);\n\n int[] astr = new int[length];\n for (int i = 0; i < length; i++ )\n {\n astr[i] = (int)((a / (int)Math.Pow(3, i)) % 3);\n }\n\n\n int[] cstr = new int[length];\n for (int i = 0; i < length; i++)\n {\n cstr[i] = (int)((c / (int)Math.Pow(3, i)) % 3);\n }\n\n\n\n int[] bstr = new int[length];\n for (int i = 0; i < length; i++)\n {\n if (astr[i] <= cstr[i])\n {\n bstr[i] = cstr[i] - astr[i];\n }\n else \n {\n bstr[i] = cstr[i] - astr[i] + 3;\n }\n }\n\n\n\n /*\n for (int i = 0; i < length; i++ )\n {\n Console.Write(astr[i]);\n }\n Console.WriteLine();\n\n for (int i = 0; i < length; i++)\n {\n Console.Write(bstr[i]);\n }\n Console.WriteLine();\n\n for (int i = 0; i < length; i++)\n {\n Console.Write(cstr[i]);\n }\n Console.WriteLine();\n */\n\n long res = 0;\n for (int i = 0; i < length; i++)\n {\n //Console.WriteLine(bstr[i] + \" \" + (int)Math.Pow(3, i));\n res += bstr[i] * (long)Math.Pow(3, i);\n }\n Console.WriteLine(res);\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ternary_Logic\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n public static string Int32ToString(int value, int toBase)\n {\n string result = string.Empty;\n do\n {\n result = \"0123456789ABCDEF\"[value % toBase] + result;\n value /= toBase;\n }\n while (value > 0);\n\n return result;\n }\n\n\n private static void Main(string[] args)\n {\n int a = Next();\n int c = Next();\n\n string sa = Int32ToString(a, 3);\n string sc = Int32ToString(c, 3);\n\n if (sa.Length < sc.Length)\n {\n sa = new string('0', sc.Length - sa.Length) + sa;\n }\n else\n {\n sc = new string('0', sa.Length - sc.Length) + sc;\n }\n\n var b = 0;\n\n for (int i = 0; i < sa.Length; i++)\n {\n int delta = (sc[i] - '0') - (sa[i] - '0');\n if (delta < 0)\n delta += 3;\n\n b *= 3;\n b += delta;\n }\n\n writer.WriteLine(b);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var n = s[1];\n var digits = Enumerable.Repeat(0,0).ToList();\n while (a > 0 && n > 0) {\n var d = (int)((n%3 + 3 - a%3) % 3);\n digits.Add(d);\n a /= 3; n /= 3;\n }\n digits.Reverse();\n var res = digits.Aggregate(0, (acc,x) => acc*3+x);\n Console.Write(res);\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var n = s[1];\n var digits = Enumerable.Repeat(0,0).ToList();\n while (a > 0 && n > 0) {\n var d = (int)((n%3 + 3 - a%3) % 3);\n digits.Add(d);\n a /= 3; n /= 3;\n }\n var res = 0;\n for (var i = digits.Count - 1 ; i >= 0 ; i--) res = res*3+digits[i];\n Console.Write(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n string[] input=Console.ReadLine().Split();\n int a=int.Parse(input[0]);\n int b=int.Parse(input[1]);\n XORSumW(a,b);\n Console.ReadLine();\n }\n \n private static List split(int a)\n {\n List ret=new List();\n while(a>0)\n {\n ret.Add(a%3);\n a/=3;\n }\n return ret;\n }\n \n private static void padW(List a, List b)\n {\n if(a.Count>b.Count)\n {\n int diff=a.Count-b.Count;\n for(int i=0;i c=new List();\n \n for(int i=0;i0)?b[i]-a[i]:3+b[i]-a[i];\n c.Add(tmp);\n }\n \n int multiplier=1;\n int num=0;\n foreach(int i in c)\n {\n num+=i*multiplier;\n multiplier*=3;\n }\n Console.WriteLine(num);\n }\n \n private static void XORSumW(int a, int b)\n {\n List adig=split(a);\n List bdig=split(b);\n padW(adig,bdig);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace timusss\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] tokens = Console.ReadLine().Split();\n int a = int.Parse(tokens[0]);\n int c = int.Parse(tokens[1]);\n\n List tera = new List();\n List terc = new List();\n\n for (int aa = a; aa > 0; aa /= 3)\n tera.Add(aa % 3);\n for (int cc = c; cc > 0; cc /= 3)\n terc.Add(cc % 3);\n\n List res = new List();\n for (int i = 0; i < terc.Count || i < tera.Count; ++i)\n {\n if (i < tera.Count)\n {\n if (i < terc.Count)\n {\n if (tera[i] <= terc[i])\n res.Add(terc[i] - tera[i]);\n else\n res.Add(3 - tera[i] + terc[i]);\n }\n else\n res.Add(3 - tera[i]);\n }\n else\n res.Add(terc[i]);\n\n }\n\n long result = 0;\n long count = 1;\n int start = 0;\n while (start < res.Count && res[start] == 0)\n ++start;\n for (int i = start; i < res.Count; ++i)\n {\n result += count * res[i];\n count *= 3;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace timusss\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] tokens = Console.ReadLine().Split();\n int a = int.Parse(tokens[0]);\n int c = int.Parse(tokens[1]);\n\n List tera = new List();\n List terc = new List();\n\n for (int aa = a; aa > 0; aa /= 3)\n tera.Add(aa % 3);\n for (int cc = c; cc > 0; cc /= 3)\n terc.Add(cc % 3);\n\n List res = new List();\n for (int i = 0; i < terc.Count || i < tera.Count; ++i)\n {\n if (i < tera.Count)\n {\n if (i < terc.Count)\n {\n if (tera[i] <= terc[i])\n res.Add(terc[i] - tera[i]);\n else\n res.Add(3 - tera[i] + terc[i]);\n }\n else\n res.Add(3 - tera[i]);\n }\n else\n res.Add(terc[i]);\n\n }\n\n int result = 0;\n int count = 1;\n for (int i = 0; i < res.Count; ++i)\n {\n result += count * res[i];\n count *= 3;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace timusss\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int a = int.Parse(tokens[0]);\n int c = int.Parse(tokens[1]);\n\n List tera = new List();\n List terc = new List();\n\n for (int aa = a; aa > 0; aa /= 3)\n tera.Add(aa % 3);\n for (int cc = c; cc > 0; cc /= 3)\n terc.Add(cc % 3);\n\n List res = new List();\n for (int i = 0; i < terc.Count; ++i)\n {\n if (i < tera.Count)\n {\n\n if (tera[i] <= terc[i])\n res.Add(terc[i] - tera[i]);\n else\n res.Add(3 - tera[i] + terc[i]);\n }\n else\n res.Add(terc[i]);\n\n }\n\n int result = 0;\n int count = 1;\n for (int i = 0; i < res.Count; ++i)\n {\n result += count * res[i];\n count *= 3;\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace timusss\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] tokens = Console.ReadLine().Split();\n int a = int.Parse(tokens[0]);\n int c = int.Parse(tokens[1]);\n\n List tera = new List();\n List terc = new List();\n\n for (int aa = a; aa > 0; aa /= 3)\n tera.Add(aa % 3);\n for (int cc = c; cc > 0; cc /= 3)\n terc.Add(cc % 3);\n\n List res = new List();\n for (int i = 0; i < terc.Count || i < tera.Count; ++i)\n {\n if (i < tera.Count)\n {\n if (i < terc.Count)\n {\n if (tera[i] <= terc[i])\n res.Add(terc[i] - tera[i]);\n else\n res.Add(3 - tera[i] + terc[i]);\n }\n else\n res.Add(3 - tera[i]);\n }\n else\n res.Add(terc[i]);\n\n }\n\n long result = 0;\n long count = 1;\n for (int i = 0; i < res.Count; ++i)\n {\n result += count * res[i];\n count *= 3;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var n = s[1];\n var digits = Enumerable.Repeat(0,0).ToList();\n while (a > 0 && n > 0) {\n var d = (int)((n%3 + 3 - a%3) % 3);\n digits.Add(d);\n a /= 3; n /= 3;\n } \n var res = digits.Aggregate(0, (acc,x) => acc*3+x);\n Console.Write(res);\n }\n}"}], "src_uid": "5fb635d52ddccf6a4d5103805da02a88"} {"source_code": "using System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Num = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n Console.WriteLine((Num[1] * Num[2]) + ((Num[0] - 1) * (Num[1] + Num[2] - 1)));\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\nclass Program\n{\n static int Main()\n {\n int a, b, c;\n string []s = Console.ReadLine().Split(' ');\n a = Convert.ToInt32(s[0]);\n b = Convert.ToInt32(s[1]);\n c = Convert.ToInt32(s[2]);\n Console.WriteLine(a * b * c - (a - 1) * (b - 1) * (c - 1));\n return 0;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace AcmSolution4\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if !ACM_HOME\n Do();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n#endif\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int a,b,c;\n GetInts(out a, out b, out c);\n\n long ans = 0;\n long max = Math.Min(a + b - 1, a + c - 1);\n\n for (int i = 0; i < c - 1; i++)\n ans += Math.Min(a + i, max);\n\n for (int i = 0; i < b; i++)\n ans += Math.Min(a + i, max);\n\n WL(ans);\n }\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n\n"}, {"source_code": "using System;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] abc = Console.ReadLine().Split(' ');\n\n long a, b, c;\n a = long.Parse(abc[0]);\n b = long.Parse(abc[1]);\n c = long.Parse(abc[2]);\n\n long s = b * c + a * c + b * a - a - b - c + 1;\n\n Console.WriteLine(s);\n }\n}\n"}, {"source_code": "using System;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] abc = Console.ReadLine().Split(' ');\n\n long a, b, c;\n a = long.Parse(abc[0]);\n b = long.Parse(abc[1]);\n c = long.Parse(abc[2]);\n\n long s = b * c + a * c + b * a - a - b - c + 1;\n\n Console.WriteLine(s);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Ejercicio3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n int b;\n int c;\n string input;\n string[] inputElements;\n int result;\n\n input = Console.ReadLine();\n inputElements = input.Split(' ');\n\n a = (Convert.ToInt32(inputElements[0]));\n b = (Convert.ToInt32(inputElements[1]));\n c = (Convert.ToInt32(inputElements[2]));\n\n if (a >= 2 && b >= 2 && c >= 2 && a <= 1000 && b <= 1000 && c <= 1000)\n {\n result = ((a * b) + (b * c) + (c * a)) - (a + b + c) + 1;\n Console.WriteLine(result);\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace Solution\n{\n class Solution\n {\n public void Solve()\n {\n var ss = Console.ReadLine().Split(' ');\n var list = new int[3];\n for (int i = 0; i < 3; i++)\n list[i] = int.Parse(ss[i]);\n\n int res = 0;\n int h = list[1] + list[2] - 1;\n int max = Math.Max(list[1], list[2]);\n int min = Math.Min(list[1], list[2]);\n int d = list[0];\n for (int i = 0;i= max-1)\n d--;\n }\n Console.WriteLine(res);\n \n }\n\n\n#if !DEBUG\n static void Main(string[] args)\n {\n new Solution().Solve();\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n Int64[] n = new long[3];\n\n List nn = new List();\n\n for (int i = 0; i < 3; i++)\n nn.Add( Convert.ToInt64(inp[i]));\n\n nn.Sort();\n int k = 0;\n foreach (Int64 ii in nn)\n n[k++] = ii;\n\n Int64 sum = 0;\n\n while (n[0] != 1)\n {\n sum += n.Sum() * 2 - 6;\n n[0]--;\n n[1]--;\n n[2]--;\n }\n\n sum += n[1] * n[2];\n\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskA\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n\n string[] spl = inp.Split(' ');\n\n int a = int.Parse(spl[0]);\n int b = int.Parse(spl[1]);\n int c = int.Parse(spl[2]);\n\n int res = 0;\n\n while (Math.Min(Math.Min(a, b), c) > 1)\n {\n int o = 2 * (a + b + c) - 6;\n\n a--;\n b--;\n c--;\n\n res += o;\n }\n\n res += a * b * c;\n\n Console.WriteLine(res);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace capp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => long.Parse(x));\n long a = data[0];\n long b = data[1];\n long c = data[2];\n long s = 0;\n while (a != 1 && b != 1 && c != 1)\n s += (a-- + b-- + c--) * 2 - 6;\n s += a * b * c;\n Console.WriteLine(s);\n\n \n \n }\n }\n\n \n\n\n}\n"}, {"source_code": "//\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Threading;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace sar_cs\n{\n static class Helpers\n {\n public static string Join(this IEnumerable objs, string sep)\n {\n var sb = new StringBuilder();\n foreach (var s in objs) { if (sb.Length != 0) sb.Append(sep); sb.Append(s); }\n return sb.ToString();\n }\n\n public static string AsString(this double a, int digits)\n {\n return a.ToString(\"F\" + digits, CultureInfo.InvariantCulture);\n }\n\n public static Stopwatch SW = Stopwatch.StartNew();\n }\n\n public class Program\n {\n #region Helpers\n\n public class Parser\n {\n const int BufSize = 8000;\n TextReader s;\n char[] buf = new char[BufSize];\n int bufPos;\n int bufDataSize;\n bool eos; // eos read to buffer\n int lastChar = -2;\n int nextChar = -2;\n StringBuilder sb = new StringBuilder();\n\n void FillBuf()\n {\n if (eos) return;\n bufDataSize = s.Read(buf, 0, BufSize);\n if (bufDataSize == 0) eos = true;\n bufPos = 0;\n }\n\n int Read()\n {\n if (nextChar != -2)\n {\n lastChar = nextChar;\n nextChar = -2;\n }\n else\n {\n if (bufPos == bufDataSize) FillBuf();\n if (eos) lastChar = -1;\n else lastChar = buf[bufPos++];\n }\n return lastChar;\n }\n\n void Back()\n {\n if (lastChar == -2) throw new Exception(); // no chars were ever read\n nextChar = lastChar;\n }\n\n public Parser()\n {\n s = Console.In;\n }\n\n public int ReadInt()\n {\n int res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-') { sign = 1; c = Read(); }\n int len = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new FormatException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new FormatException();\n Back();\n return checked(res * sign);\n }\n\n public long ReadLong()\n {\n long res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = 1;\n c = Read();\n }\n int len = 0;\n\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new FormatException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new FormatException();\n Back();\n return checked(res * sign);\n }\n\n public int ReadLnInt()\n {\n int res = ReadInt(); ReadLine(); return res;\n }\n\n public long ReadLnLong()\n {\n long res = ReadLong(); ReadLine(); return res;\n }\n\n public double ReadDouble()\n {\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n\n int sign = 1;\n if (c == '-') { sign = -1; c = Read(); }\n\n sb.Length = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c); c = Read();\n }\n\n Back();\n var res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);\n return res * sign;\n }\n\n public string ReadLine()\n {\n int c = Read();\n sb.Length = 0;\n while (c != -1 && c != 13 && c != 10)\n {\n sb.Append((char)c); c = Read();\n }\n if (c == 13) { c = Read(); if (c != 10) Back(); }\n return sb.ToString();\n }\n\n public bool SeekEOF\n {\n get\n {\n L0:\n int c = Read();\n if (c == -1) return true;\n if (char.IsWhiteSpace((char)c)) goto L0;\n Back();\n return false;\n }\n }\n\n public int[] ReadIntArr(int n)\n {\n var a = new int[n]; for (int i = 0; i < n; i++) a[i] = ReadInt(); return a;\n }\n\n public long[] ReadLongArr(int n)\n {\n var a = new long[n]; for (int i = 0; i < n; i++) a[i] = ReadLong(); return a;\n }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n static void re() { Environment.Exit(55); }\n static void Swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int Sqr(int a) { return a * a; }\n static long SqrL(int a) { return (long)a * a; }\n static long Sqr(long a) { return a * a; }\n static double Sqr(double a) { return a * a; }\n\n static StringBuilder sb = new StringBuilder();\n static Random rand = new Random(5);\n\n #endregion Helpers\n\n static void Main(string[] args)\n {\n checked\n {\n //Console.SetIn(File.OpenText(\"_input\"));\n var parser = new Parser();\n while (!parser.SeekEOF)\n {\n long a = parser.ReadInt();\n long b = parser.ReadInt();\n long c = parser.ReadInt();\n long res = c * b + (b + c - 1) * (a - 1);\n\n Console.WriteLine(res);\n }\n }\n }\n\n //static void Main(string[] args)\n //{\n // new Thread(Main2, 50 << 20).Start();\n //}\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace canada1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input = \"\";\n string[] inputElements = new string[3];\n input = Console.ReadLine();\n inputElements = input.Split(' ');\n\n int a = Convert.ToInt32(inputElements[0]);\n int b = Convert.ToInt32(inputElements[1]);\n int c = Convert.ToInt32(inputElements[2]);\n\n int first = (a * b) + (b * c) + (c * a);\n int second = a + b + c;\n\n Console.WriteLine(first - second + 1);\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces {\n struct Node {\n public int X, Y, D; \n public Node(int x,int y, int d) {\n X = x;\n Y = y;\n D = d;\n } \n }\n\n class Pair : IComparable {\n public int Vertex, Danger;\n public Pair(int f, int s) {\n Vertex = f;\n Danger = s;\n }\n\n public int CompareTo(Pair other) {\n return Vertex.CompareTo(Danger);\n }\n }\n\n class Desc : IComparer {\n public int Compare(int x, int y) {\n return y.CompareTo(x);\n }\n }\n \n class Cf { \n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n Stopwatch sw = new Stopwatch();\n sw.Start();\n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve();\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n const int MOD = 1000000007;\n static int n, m;\n static void Solve() {\n int a = nextInt();\n int b = nextInt();\n int c = nextInt();\n if (a == 1) {\n Console.WriteLine(b * c);\n return;\n }\n if (b == 1) {\n Console.WriteLine(a * c);\n return;\n }\n if (c == 1) {\n Console.WriteLine(b * a);\n return;\n }\n int res = (b + a-1) * (c + a-1);\n int sum = 0;\n for (int i = 1; i < a; i++) {\n sum += i;\n }\n Console.WriteLine(res - 2 * sum);\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int[] _bitcounts; \n static void InitializeBitcounts() {\n _bitcounts = new int[65536];\n int position1 = -1;\n int position2 = -1;\n for (int i = 1; i < 65536; i++, position1++) { \n if (position1 == position2) {\n position1 = 0;\n position2 = i;\n }\n _bitcounts[i] = _bitcounts[position1] + 1;\n }\n }\n\n static int Bitcount(int value) { \n return _bitcounts[value & 65535] + _bitcounts[(value >> 16)];\n }\n\n static int First(int mask) {\n for (int i = 0; i < 32; i++) {\n if ((mask & (1 << i)) > 0)\n return i;\n }\n return -1;\n }\n\n #region math\n static long gcd(long a, long b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n\n static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n \n //static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {\n // return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),\n // Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));\n //}\n\n //static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {\n // int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));\n // if (x1 == x2 && y1 <= y && y <= y2)\n // result = (x - x1) * (x - x1);\n // else if (y1 == y2 && x1 <= x && x <= x2)\n // result = (y - y1) * (y - y1);\n // return result;\n //}\n\n static long SquaredDistance(long ax, long ay, long bx, long by) {\n return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);\n }\n #endregion\n\n #region read helpers\n static int nextPositive() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n static int nextInt() {\n int t = input.Read();\n while ((t < '0' || t > '9') && t != '-') t = input.Read();\n int sign = 1;\n if (t == '-') {\n sign = -1;\n t = input.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x * sign;\n }\n\n static long nextLong() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n long x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int[] ReadIntArray() { \n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static double[] ReadDoubleArray() {\n return input.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();\n }\n\n public static long[] ReadLongArray() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n }\n\n public static List ReadLongList() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();\n } \n\n public static string ReadLine() {\n return input.ReadLine();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n\n public static long ReadLong() {\n return long.Parse(input.ReadLine());\n }\n#endregion\n }\n \n public class SegmentTree {\n private int[] a, t;\n private int n;\n public SegmentTree(int[] a) {\n n = a.Length;\n this.a = a; \n t = new int[n << 2];\n buildSegmentTree(0, n - 1, 1);\n }\n\n private void buildSegmentTree(int l, int r, int v) {\n if (l == r)\n t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n int vl = v << 1;\n int vr = (v << 1) | 1;\n buildSegmentTree(l, m, vl);\n buildSegmentTree(m + 1, r, vr);\n t[v] = t[vl] + t[vr];\n }\n }\n\n public int QuerySegmentTree(int l, int r) {\n return querySegmentTree(1, l, r, 0, n - 1);\n }\n\n public void Update(int v, int tl, int tr, int pos, int new_val) {\n if (tl == tr)\n t[v] = new_val;\n else {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n Update(v << 1, tl, tm, pos, new_val);\n else\n Update(v << 1 + 1, tm + 1, tr, pos, new_val);\n t[v] = t[v << 1] + t[v << 1 + 1];\n }\n }\n\n private int querySegmentTree(int v, int l, int r, int tl, int tr) {\n if (l > r)\n return 0;\n if (l == tl && r == tr)\n return t[v];\n int m = (tl + tr) >> 1; \n return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);\n }\n }\n class Graph : List> {\n public Graph(int num): base(num) {\n for (int i = 0; i < num; i++) {\n this.Add(new List());\n }\n }\n }\n class Heap : IEnumerable {\n List items = new List();\n IComparer comparer;\n public Heap(IComparer comparer) {\n this.comparer = comparer;\n }\n public Heap() {\n comparer = Comparer.Default;\n }\n\n public void Add(T item) {\n items.Add(item);\n MoveUp(Count - 1);\n }\n\n public T Extract() {\n CheckHeap();\n T item = items[0];\n items.Swap(0, Count - 1);\n items.RemoveAt(Count - 1);\n MoveDown(0); \n return item;\n }\n\n public int Count {\n get {\n return items.Count;\n }\n }\n\n public bool IsEmpty {\n get {\n return items.Count == 0;\n }\n }\n\n public T Top {\n get {\n CheckHeap();\n return items[0];\n }\n }\n\n void CheckHeap() {\n if (items.Count == 0)\n throw new ArgumentException(\"Heap is empty\");\n }\n\n void MoveDown(int v) {\n int left = 2 * v + 1;\n int right = 2 * v + 2;\n if (left >= Count)\n return;\n if (right >= Count) {\n if (comparer.Compare(items[v], items[left]) < 0) {\n items.Swap(v, left); \n }\n return;\n }\n int max = comparer.Compare(items[left], items[right]) < 0 ? right : left;\n if (comparer.Compare(items[v], items[max]) < 0) {\n items.Swap(v, max);\n MoveDown(max);\n }\n }\n\n void MoveUp(int v) {\n int parent = (v - 1) / 2;\n if (comparer.Compare(items[parent], items[v]) < 0) {\n items.Swap(v, parent);\n MoveUp(parent);\n }\n }\n\n public IEnumerator GetEnumerator() {\n return items.GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n throw new NotImplementedException();\n }\n } \n public static class Extensions {\n public static void Swap(this IList arr, int i, int j) {\n T temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n\n public static int Max(this int a, int b) {\n return Math.Max(a, b);\n }\n\n public static int Min(this int a, int b) {\n return Math.Min(a, b);\n }\n\n public static void Fill(this int[] array, int val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n } \n\n public static int ToInt(this string s) {\n return int.Parse(s);\n }\n \n public static void Print(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n private static bool s_time = false;\n\n private void Go()\n {\n int a = GetInt();\n int b = GetInt();\n int c = GetInt();\n\n Wl(a * b + b * c + c * a - a - b - c + 1);\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n }\n\n #endregion\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P { \n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var b = s[1]; var c = s[2];\n var res = b*c + (a-1)*(b+c-1);\n Console.Write(res);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Tiling_with_Hexagons\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n int c = Next();\n\n a += c - 1;\n b += c - 1;\n int t = c*(c - 1);\n\n writer.WriteLine(a*b - t);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _216A\n{\n class Program\n {\n static void Main()\n {\n String[] k = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(k[0]);\n int b = Convert.ToInt32(k[1]);\n int c = Convert.ToInt32(k[2]);\n int d = 0;\n if (a > b && a>c)\n {\n d = c;\n c = a;\n a = d;\n if (a > b)\n {\n d = b;\n b = a;\n a = d;\n }\n }\n else if (a > b && a <= c)\n {\n d = b;\n b = a;\n a = d;\n }\n else if (a < b && a < c)\n {\n if (b > c)\n {\n d = b;\n b = c;\n c = d;\n }\n }\n Console.Write(calculate(a, b, c));\n }\n static int calculate(int a, int b, int c)\n {\n int output = b * (2 * a + (b - 1)) + (c - b - 1) * (a + b - 1);\n\n return output;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Tiling.With.Hexagons\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n Console.WriteLine((input[0]*input[1]) + (input[1]*(input[2]-1)) + ((input[0]-1)*(input[2]-1)));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _216A_TilingWithHexagon.Run();\n }\n }\n\n class _216A_TilingWithHexagon\n {\n public static void Run()\n {\n var l = Console.ReadLine().Trim().Split(' ');\n var a = short.Parse(l[0]);\n var b = short.Parse(l[1]);\n var c = short.Parse(l[2]);\n\n var sum = 0;\n var aa = a;\n for (short i = 0; i < b; i++)\n {\n sum += aa;\n if (i+1 < c && i+1 < b) ++aa;\n }\n\n for (short i = 0; i < c-b; i++)\n sum += aa;\n\n for (var i = aa - 1; i >= a; i--)\n sum += i;\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \",col));\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a>=lb) && (a<=ub);\n }\n\n//----------------------------------------------------------------------------\n\n\n static void Main(string[] args)\n {\n int a = 0, b = 0, c = 0;\n\n ReadInts(ref a, ref b, ref c);\n\n\n PrintLn((b+a-1)*(c+a-1)-a*(a-1));\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n int a = int.Parse(str[0]);\n int b = int.Parse(str[1]);\n int c = int.Parse(str[2]);\n if(b>c){\n int tmp = b;\n b = c;\n c = tmp;\n }\n long col = b+c-1;\n long ans = 0;\n int i;\n for(i=0 ; i arr = new List();\n arr.Add(int.Parse(str[0]));\n arr.Add(int.Parse(str[1]));\n arr.Add(int.Parse(str[2]));\n arr.Sort();\n\n int a = arr[0];\n int b = arr[1];\n int c = arr[2];\n\n long res = 0;\n\n int side = a;\n\n for (int i = 0; i < b; i++)\n {\n side = a + i;\n res += side;\n }\n\n res *= 2;\n\n res += side * (c-b-1);\n\n Console.WriteLine(res);\n\n\n\n\n\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace Tiling.With.Hexagons\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n Console.WriteLine((input[0]*input[1]) + (input[1]*(input[2]-1)) + (input[2]-1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Tiling.With.Hexagons\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n Console.WriteLine((2*input[0])+ (2 * input[1])+ (2 * input[2]));\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n long a = Int64.Parse(str[0]);\n long b = Int64.Parse(str[1]);\n long c = Int64.Parse(str[2]);\n long col = b+c-1;\n long ans = 0;\n int i;\n for( i=0 ; i 0)\n {\n Do();\n WL(GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n#endif\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int a,b,c;\n GetInts(out a, out b, out c);\n\n long ans = 0;\n for (int i = 0; i < c - 1; i++)\n ans += a + i;\n\n for (int i = 0; i < b; i++)\n ans += a + i;\n\n WL(ans);\n }\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n\n"}, {"source_code": "using System;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] abc = Console.ReadLine().Split(' ');\n\n long a, b, c;\n a = long.Parse(abc[0]);\n b = long.Parse(abc[1]);\n c = long.Parse(abc[2]);\n\n long s = (a + b + c) * 2;\n Console.WriteLine(s);\n }\n}\n"}, {"source_code": "using System;\n\n\nclass Program\n{\n static long NOD(long m, long n)\n {\n long nod = 0;\n for (long i = 1; i < (n * m + 1); i++)\n {\n if (m % i == 0 && n % i == 0)\n {\n nod = i;\n }\n }\n return nod;\n }\n\n static void Main(string[] args)\n {\n string[] abc = Console.ReadLine().Split(' ');\n\n long a, b;\n a = long.Parse(abc[0]);\n b = long.Parse(abc[1]);\n long c = 6;\n\n long max = (long)Math.Max(a, b);\n\n long nushnie = 6 - max + 1;\n\n long nod = NOD(nushnie, c);\n\n Console.WriteLine(nushnie / nod + \"/\" + c / nod);\n //Console.ReadLine();\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace canada1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input = \"\";\n string[] inputElements = new string[3];\n input = Console.ReadLine();\n inputElements = input.Split(' ');\n\n int a = Convert.ToInt32(inputElements[0]);\n int b = Convert.ToInt32(inputElements[1]);\n int c = Convert.ToInt32(inputElements[2]);\n\n Console.WriteLine((a + c) * b);\n\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces {\n struct Node {\n public int X, Y, D; \n public Node(int x,int y, int d) {\n X = x;\n Y = y;\n D = d;\n } \n }\n\n class Pair : IComparable {\n public int Vertex, Danger;\n public Pair(int f, int s) {\n Vertex = f;\n Danger = s;\n }\n\n public int CompareTo(Pair other) {\n return Vertex.CompareTo(Danger);\n }\n }\n\n class Desc : IComparer {\n public int Compare(int x, int y) {\n return y.CompareTo(x);\n }\n }\n \n class Cf { \n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n Stopwatch sw = new Stopwatch();\n sw.Start();\n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve();\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n const int MOD = 1000000007;\n static int n, m;\n static void Solve() {\n int a = nextInt();\n int b = nextInt();\n int c = nextInt();\n if (a == 1) {\n Console.WriteLine(b * c);\n return;\n }\n int res = (b + 1) * (c + 1);\n int sum = 0;\n for (int i = 1; i < a; i++) {\n sum += i;\n }\n Console.WriteLine(res - 2*sum);\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int[] _bitcounts; \n static void InitializeBitcounts() {\n _bitcounts = new int[65536];\n int position1 = -1;\n int position2 = -1;\n for (int i = 1; i < 65536; i++, position1++) { \n if (position1 == position2) {\n position1 = 0;\n position2 = i;\n }\n _bitcounts[i] = _bitcounts[position1] + 1;\n }\n }\n\n static int Bitcount(int value) { \n return _bitcounts[value & 65535] + _bitcounts[(value >> 16)];\n }\n\n static int First(int mask) {\n for (int i = 0; i < 32; i++) {\n if ((mask & (1 << i)) > 0)\n return i;\n }\n return -1;\n }\n\n #region math\n static long gcd(long a, long b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n\n static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n \n //static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {\n // return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),\n // Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));\n //}\n\n //static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {\n // int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));\n // if (x1 == x2 && y1 <= y && y <= y2)\n // result = (x - x1) * (x - x1);\n // else if (y1 == y2 && x1 <= x && x <= x2)\n // result = (y - y1) * (y - y1);\n // return result;\n //}\n\n static long SquaredDistance(long ax, long ay, long bx, long by) {\n return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);\n }\n #endregion\n\n #region read helpers\n static int nextPositive() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n static int nextInt() {\n int t = input.Read();\n while ((t < '0' || t > '9') && t != '-') t = input.Read();\n int sign = 1;\n if (t == '-') {\n sign = -1;\n t = input.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x * sign;\n }\n\n static long nextLong() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n long x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int[] ReadIntArray() { \n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static double[] ReadDoubleArray() {\n return input.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();\n }\n\n public static long[] ReadLongArray() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n }\n\n public static List ReadLongList() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();\n } \n\n public static string ReadLine() {\n return input.ReadLine();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n\n public static long ReadLong() {\n return long.Parse(input.ReadLine());\n }\n#endregion\n }\n \n public class SegmentTree {\n private int[] a, t;\n private int n;\n public SegmentTree(int[] a) {\n n = a.Length;\n this.a = a; \n t = new int[n << 2];\n buildSegmentTree(0, n - 1, 1);\n }\n\n private void buildSegmentTree(int l, int r, int v) {\n if (l == r)\n t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n int vl = v << 1;\n int vr = (v << 1) | 1;\n buildSegmentTree(l, m, vl);\n buildSegmentTree(m + 1, r, vr);\n t[v] = t[vl] + t[vr];\n }\n }\n\n public int QuerySegmentTree(int l, int r) {\n return querySegmentTree(1, l, r, 0, n - 1);\n }\n\n public void Update(int v, int tl, int tr, int pos, int new_val) {\n if (tl == tr)\n t[v] = new_val;\n else {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n Update(v << 1, tl, tm, pos, new_val);\n else\n Update(v << 1 + 1, tm + 1, tr, pos, new_val);\n t[v] = t[v << 1] + t[v << 1 + 1];\n }\n }\n\n private int querySegmentTree(int v, int l, int r, int tl, int tr) {\n if (l > r)\n return 0;\n if (l == tl && r == tr)\n return t[v];\n int m = (tl + tr) >> 1; \n return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);\n }\n }\n class Graph : List> {\n public Graph(int num): base(num) {\n for (int i = 0; i < num; i++) {\n this.Add(new List());\n }\n }\n }\n class Heap : IEnumerable {\n List items = new List();\n IComparer comparer;\n public Heap(IComparer comparer) {\n this.comparer = comparer;\n }\n public Heap() {\n comparer = Comparer.Default;\n }\n\n public void Add(T item) {\n items.Add(item);\n MoveUp(Count - 1);\n }\n\n public T Extract() {\n CheckHeap();\n T item = items[0];\n items.Swap(0, Count - 1);\n items.RemoveAt(Count - 1);\n MoveDown(0); \n return item;\n }\n\n public int Count {\n get {\n return items.Count;\n }\n }\n\n public bool IsEmpty {\n get {\n return items.Count == 0;\n }\n }\n\n public T Top {\n get {\n CheckHeap();\n return items[0];\n }\n }\n\n void CheckHeap() {\n if (items.Count == 0)\n throw new ArgumentException(\"Heap is empty\");\n }\n\n void MoveDown(int v) {\n int left = 2 * v + 1;\n int right = 2 * v + 2;\n if (left >= Count)\n return;\n if (right >= Count) {\n if (comparer.Compare(items[v], items[left]) < 0) {\n items.Swap(v, left); \n }\n return;\n }\n int max = comparer.Compare(items[left], items[right]) < 0 ? right : left;\n if (comparer.Compare(items[v], items[max]) < 0) {\n items.Swap(v, max);\n MoveDown(max);\n }\n }\n\n void MoveUp(int v) {\n int parent = (v - 1) / 2;\n if (comparer.Compare(items[parent], items[v]) < 0) {\n items.Swap(v, parent);\n MoveUp(parent);\n }\n }\n\n public IEnumerator GetEnumerator() {\n return items.GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n throw new NotImplementedException();\n }\n } \n public static class Extensions {\n public static void Swap(this IList arr, int i, int j) {\n T temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n\n public static int Max(this int a, int b) {\n return Math.Max(a, b);\n }\n\n public static int Min(this int a, int b) {\n return Math.Min(a, b);\n }\n\n public static void Fill(this int[] array, int val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n } \n\n public static int ToInt(this string s) {\n return int.Parse(s);\n }\n \n public static void Print(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces {\n struct Node {\n public int X, Y, D; \n public Node(int x,int y, int d) {\n X = x;\n Y = y;\n D = d;\n } \n }\n\n class Pair : IComparable {\n public int Vertex, Danger;\n public Pair(int f, int s) {\n Vertex = f;\n Danger = s;\n }\n\n public int CompareTo(Pair other) {\n return Vertex.CompareTo(Danger);\n }\n }\n\n class Desc : IComparer {\n public int Compare(int x, int y) {\n return y.CompareTo(x);\n }\n }\n \n class Cf { \n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n Stopwatch sw = new Stopwatch();\n sw.Start();\n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve();\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n const int MOD = 1000000007;\n static int n, m;\n static void Solve() {\n int a = nextInt();\n int b = nextInt();\n int c = nextInt();\n int res = (b + 1) * (c + 1);\n int sum = 0;\n for (int i = 1; i < a; i++) {\n sum += i;\n }\n Console.WriteLine(res - 2*sum);\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int[] _bitcounts; \n static void InitializeBitcounts() {\n _bitcounts = new int[65536];\n int position1 = -1;\n int position2 = -1;\n for (int i = 1; i < 65536; i++, position1++) { \n if (position1 == position2) {\n position1 = 0;\n position2 = i;\n }\n _bitcounts[i] = _bitcounts[position1] + 1;\n }\n }\n\n static int Bitcount(int value) { \n return _bitcounts[value & 65535] + _bitcounts[(value >> 16)];\n }\n\n static int First(int mask) {\n for (int i = 0; i < 32; i++) {\n if ((mask & (1 << i)) > 0)\n return i;\n }\n return -1;\n }\n\n #region math\n static long gcd(long a, long b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n\n static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n \n //static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {\n // return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),\n // Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));\n //}\n\n //static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {\n // int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));\n // if (x1 == x2 && y1 <= y && y <= y2)\n // result = (x - x1) * (x - x1);\n // else if (y1 == y2 && x1 <= x && x <= x2)\n // result = (y - y1) * (y - y1);\n // return result;\n //}\n\n static long SquaredDistance(long ax, long ay, long bx, long by) {\n return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);\n }\n #endregion\n\n #region read helpers\n static int nextPositive() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n static int nextInt() {\n int t = input.Read();\n while ((t < '0' || t > '9') && t != '-') t = input.Read();\n int sign = 1;\n if (t == '-') {\n sign = -1;\n t = input.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x * sign;\n }\n\n static long nextLong() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n long x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int[] ReadIntArray() { \n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static double[] ReadDoubleArray() {\n return input.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();\n }\n\n public static long[] ReadLongArray() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n }\n\n public static List ReadLongList() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();\n } \n\n public static string ReadLine() {\n return input.ReadLine();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n\n public static long ReadLong() {\n return long.Parse(input.ReadLine());\n }\n#endregion\n }\n \n public class SegmentTree {\n private int[] a, t;\n private int n;\n public SegmentTree(int[] a) {\n n = a.Length;\n this.a = a; \n t = new int[n << 2];\n buildSegmentTree(0, n - 1, 1);\n }\n\n private void buildSegmentTree(int l, int r, int v) {\n if (l == r)\n t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n int vl = v << 1;\n int vr = (v << 1) | 1;\n buildSegmentTree(l, m, vl);\n buildSegmentTree(m + 1, r, vr);\n t[v] = t[vl] + t[vr];\n }\n }\n\n public int QuerySegmentTree(int l, int r) {\n return querySegmentTree(1, l, r, 0, n - 1);\n }\n\n public void Update(int v, int tl, int tr, int pos, int new_val) {\n if (tl == tr)\n t[v] = new_val;\n else {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n Update(v << 1, tl, tm, pos, new_val);\n else\n Update(v << 1 + 1, tm + 1, tr, pos, new_val);\n t[v] = t[v << 1] + t[v << 1 + 1];\n }\n }\n\n private int querySegmentTree(int v, int l, int r, int tl, int tr) {\n if (l > r)\n return 0;\n if (l == tl && r == tr)\n return t[v];\n int m = (tl + tr) >> 1; \n return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);\n }\n }\n class Graph : List> {\n public Graph(int num): base(num) {\n for (int i = 0; i < num; i++) {\n this.Add(new List());\n }\n }\n }\n class Heap : IEnumerable {\n List items = new List();\n IComparer comparer;\n public Heap(IComparer comparer) {\n this.comparer = comparer;\n }\n public Heap() {\n comparer = Comparer.Default;\n }\n\n public void Add(T item) {\n items.Add(item);\n MoveUp(Count - 1);\n }\n\n public T Extract() {\n CheckHeap();\n T item = items[0];\n items.Swap(0, Count - 1);\n items.RemoveAt(Count - 1);\n MoveDown(0); \n return item;\n }\n\n public int Count {\n get {\n return items.Count;\n }\n }\n\n public bool IsEmpty {\n get {\n return items.Count == 0;\n }\n }\n\n public T Top {\n get {\n CheckHeap();\n return items[0];\n }\n }\n\n void CheckHeap() {\n if (items.Count == 0)\n throw new ArgumentException(\"Heap is empty\");\n }\n\n void MoveDown(int v) {\n int left = 2 * v + 1;\n int right = 2 * v + 2;\n if (left >= Count)\n return;\n if (right >= Count) {\n if (comparer.Compare(items[v], items[left]) < 0) {\n items.Swap(v, left); \n }\n return;\n }\n int max = comparer.Compare(items[left], items[right]) < 0 ? right : left;\n if (comparer.Compare(items[v], items[max]) < 0) {\n items.Swap(v, max);\n MoveDown(max);\n }\n }\n\n void MoveUp(int v) {\n int parent = (v - 1) / 2;\n if (comparer.Compare(items[parent], items[v]) < 0) {\n items.Swap(v, parent);\n MoveUp(parent);\n }\n }\n\n public IEnumerator GetEnumerator() {\n return items.GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n throw new NotImplementedException();\n }\n } \n public static class Extensions {\n public static void Swap(this IList arr, int i, int j) {\n T temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n\n public static int Max(this int a, int b) {\n return Math.Max(a, b);\n }\n\n public static int Min(this int a, int b) {\n return Math.Min(a, b);\n }\n\n public static void Fill(this int[] array, int val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n } \n\n public static int ToInt(this string s) {\n return int.Parse(s);\n }\n \n public static void Print(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces {\n struct Node {\n public int X, Y, D; \n public Node(int x,int y, int d) {\n X = x;\n Y = y;\n D = d;\n } \n }\n\n class Pair : IComparable {\n public int Vertex, Danger;\n public Pair(int f, int s) {\n Vertex = f;\n Danger = s;\n }\n\n public int CompareTo(Pair other) {\n return Vertex.CompareTo(Danger);\n }\n }\n\n class Desc : IComparer {\n public int Compare(int x, int y) {\n return y.CompareTo(x);\n }\n }\n \n class Cf { \n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n Stopwatch sw = new Stopwatch();\n sw.Start();\n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve();\n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n }\n\n const int MOD = 1000000007;\n static int n, m;\n static void Solve() {\n int a = nextInt();\n int b = nextInt();\n int c = nextInt();\n if (a == 1) {\n Console.WriteLine(b * c);\n return;\n }\n if (b == 1) {\n Console.WriteLine(a * c);\n return;\n }\n if (c == 1) {\n Console.WriteLine(b * a);\n return;\n }\n int res = (b + 1) * (c + 1);\n int sum = 0;\n for (int i = 1; i < a; i++) {\n sum += i;\n }\n Console.WriteLine(res - 2*sum);\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int[] _bitcounts; \n static void InitializeBitcounts() {\n _bitcounts = new int[65536];\n int position1 = -1;\n int position2 = -1;\n for (int i = 1; i < 65536; i++, position1++) { \n if (position1 == position2) {\n position1 = 0;\n position2 = i;\n }\n _bitcounts[i] = _bitcounts[position1] + 1;\n }\n }\n\n static int Bitcount(int value) { \n return _bitcounts[value & 65535] + _bitcounts[(value >> 16)];\n }\n\n static int First(int mask) {\n for (int i = 0; i < 32; i++) {\n if ((mask & (1 << i)) > 0)\n return i;\n }\n return -1;\n }\n\n #region math\n static long gcd(long a, long b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n\n static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n \n //static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {\n // return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),\n // Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));\n //}\n\n //static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {\n // int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));\n // if (x1 == x2 && y1 <= y && y <= y2)\n // result = (x - x1) * (x - x1);\n // else if (y1 == y2 && x1 <= x && x <= x2)\n // result = (y - y1) * (y - y1);\n // return result;\n //}\n\n static long SquaredDistance(long ax, long ay, long bx, long by) {\n return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);\n }\n #endregion\n\n #region read helpers\n static int nextPositive() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n static int nextInt() {\n int t = input.Read();\n while ((t < '0' || t > '9') && t != '-') t = input.Read();\n int sign = 1;\n if (t == '-') {\n sign = -1;\n t = input.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x * sign;\n }\n\n static long nextLong() {\n int t = input.Read();\n while (t < '0' || t > '9') t = input.Read();\n long x = 0;\n while (t >= '0' && t <= '9') {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x;\n }\n\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int[] ReadIntArray() { \n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static double[] ReadDoubleArray() {\n return input.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();\n }\n\n public static long[] ReadLongArray() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n }\n\n public static List ReadLongList() {\n return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();\n } \n\n public static string ReadLine() {\n return input.ReadLine();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n\n public static long ReadLong() {\n return long.Parse(input.ReadLine());\n }\n#endregion\n }\n \n public class SegmentTree {\n private int[] a, t;\n private int n;\n public SegmentTree(int[] a) {\n n = a.Length;\n this.a = a; \n t = new int[n << 2];\n buildSegmentTree(0, n - 1, 1);\n }\n\n private void buildSegmentTree(int l, int r, int v) {\n if (l == r)\n t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n int vl = v << 1;\n int vr = (v << 1) | 1;\n buildSegmentTree(l, m, vl);\n buildSegmentTree(m + 1, r, vr);\n t[v] = t[vl] + t[vr];\n }\n }\n\n public int QuerySegmentTree(int l, int r) {\n return querySegmentTree(1, l, r, 0, n - 1);\n }\n\n public void Update(int v, int tl, int tr, int pos, int new_val) {\n if (tl == tr)\n t[v] = new_val;\n else {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n Update(v << 1, tl, tm, pos, new_val);\n else\n Update(v << 1 + 1, tm + 1, tr, pos, new_val);\n t[v] = t[v << 1] + t[v << 1 + 1];\n }\n }\n\n private int querySegmentTree(int v, int l, int r, int tl, int tr) {\n if (l > r)\n return 0;\n if (l == tl && r == tr)\n return t[v];\n int m = (tl + tr) >> 1; \n return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);\n }\n }\n class Graph : List> {\n public Graph(int num): base(num) {\n for (int i = 0; i < num; i++) {\n this.Add(new List());\n }\n }\n }\n class Heap : IEnumerable {\n List items = new List();\n IComparer comparer;\n public Heap(IComparer comparer) {\n this.comparer = comparer;\n }\n public Heap() {\n comparer = Comparer.Default;\n }\n\n public void Add(T item) {\n items.Add(item);\n MoveUp(Count - 1);\n }\n\n public T Extract() {\n CheckHeap();\n T item = items[0];\n items.Swap(0, Count - 1);\n items.RemoveAt(Count - 1);\n MoveDown(0); \n return item;\n }\n\n public int Count {\n get {\n return items.Count;\n }\n }\n\n public bool IsEmpty {\n get {\n return items.Count == 0;\n }\n }\n\n public T Top {\n get {\n CheckHeap();\n return items[0];\n }\n }\n\n void CheckHeap() {\n if (items.Count == 0)\n throw new ArgumentException(\"Heap is empty\");\n }\n\n void MoveDown(int v) {\n int left = 2 * v + 1;\n int right = 2 * v + 2;\n if (left >= Count)\n return;\n if (right >= Count) {\n if (comparer.Compare(items[v], items[left]) < 0) {\n items.Swap(v, left); \n }\n return;\n }\n int max = comparer.Compare(items[left], items[right]) < 0 ? right : left;\n if (comparer.Compare(items[v], items[max]) < 0) {\n items.Swap(v, max);\n MoveDown(max);\n }\n }\n\n void MoveUp(int v) {\n int parent = (v - 1) / 2;\n if (comparer.Compare(items[parent], items[v]) < 0) {\n items.Swap(v, parent);\n MoveUp(parent);\n }\n }\n\n public IEnumerator GetEnumerator() {\n return items.GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n throw new NotImplementedException();\n }\n } \n public static class Extensions {\n public static void Swap(this IList arr, int i, int j) {\n T temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n\n public static int Max(this int a, int b) {\n return Math.Max(a, b);\n }\n\n public static int Min(this int a, int b) {\n return Math.Min(a, b);\n }\n\n public static void Fill(this int[] array, int val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n } \n\n public static int ToInt(this string s) {\n return int.Parse(s);\n }\n \n public static void Print(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P { \n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var a = s[0]; var b = s[1]; var c = s[2];\n var res = c * (a+b-1) + b - 1;\n Console.Write(res);\n }\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _216A_TilingWithHexagon.Run();\n }\n }\n\n class _216A_TilingWithHexagon\n {\n public static void Run()\n {\n var l = Console.ReadLine().Trim().Split(' ');\n var a = short.Parse(l[0]);\n var b = short.Parse(l[1]);\n var c = short.Parse(l[2]);\n var x = a*b + (b + 1)*(c - 1);\n\n Console.WriteLine(x);\n Console.ReadLine();\n }\n }\n}\n"}], "src_uid": "8ab25ed4955d978fe20f6872cb94b0da"} {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static List IndexesOf(this IEnumerable source, T value)\n {\n var indexes = new List();\n\n int index = 0;\n var comparer = EqualityComparer.Default; // or pass in as a parameter\n foreach (T item in source)\n {\n if (comparer.Equals(item, value))\n {\n indexes.Add(index);\n };\n index++;\n }\n return indexes;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var nab = \"4 7 10\";\n#else\n var nab = Console.ReadLine();\n#endif\n var n = Convert.ToInt32(nab.Split(' ')[0]);\n var a = Convert.ToInt32(nab.Split(' ')[1]);\n var b = Convert.ToInt32(nab.Split(' ')[2]);\n Console.WriteLine(Check(n,a,b));\n }\n\n\n static int[] get_Plates(int n1, int n2, int a, int b)\n {\n var plates = new int[n1 + n2];\n int a_portion = a / n1;//\u043f\u043e\u0444\u0438\u0433 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0442.\u043a. \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442, \u043f\u0443\u0441\u0442\u044c 10 \u0434\u043b\u044f 3 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 3 3 4 \u0430 3 3 3\n int b_portion = b / n2;\n\n if (a_portion != 0 && b_portion != 0)\n {\n //\u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0430\u0440\u0435\u043b\u043a\u0438\n for (int i = 0; i < n1; i++)\n {\n plates[i] = a_portion;\n }\n for (int i = n1; i < (n1 + n2); i++)\n {\n plates[i] = b_portion;\n }\n }\n return plates;\n }\n static string Check(int n, int a, int b)\n {\n if (a > b)\n {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n int max = 0;\n for (int i = 1; i < n; i++)\n {\n var plates = get_Plates(i, n - i, a, b);\n\n var pMin = plates.Min();\n\n#if __debug\n Console.WriteLine($\"\u043f\u043e \u0442\u0430\u0440\u0435\u043b\u043a\u0430\u043c i={i} plates={plates.ToStr()} pMin={pMin}\");\n#endif\n\n if (pMin < max) break;\n if (pMin > max) max = pMin;\n }\n\n return max.ToString();\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n int platesCount = inputData[0];\n int firstCakePieces = inputData[1];\n int secondCakePieces = inputData[2];\n\n int commonPieces = firstCakePieces + secondCakePieces;\n int minPiecesOnPlate = commonPieces / platesCount;\n\n int findedValue;\n\n if (commonPieces == platesCount)\n {\n findedValue = 1;\n }\n else if (firstCakePieces < minPiecesOnPlate)\n {\n findedValue = firstCakePieces;\n }\n else if (secondCakePieces < minPiecesOnPlate)\n {\n findedValue = secondCakePieces;\n }\n else\n {\n while (true)\n {\n int minPiecesFromFirstCake = firstCakePieces / minPiecesOnPlate;\n int minPiecesFromSecondCake = secondCakePieces / minPiecesOnPlate;\n\n if (minPiecesFromFirstCake + minPiecesFromSecondCake >= platesCount)\n {\n break;\n }\n minPiecesOnPlate--;\n }\n findedValue = minPiecesOnPlate;\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static private int Cake(int slices, int plates)\n {\n return slices / plates;\n }\n \n static private int Compute(int n, int a, int b)\n {\n int result = -1;\n for (int i = 1; i <= n - 1; i++)\n {\n result = Math.Max(Math.Min(a / i, b / (n - i)), result);\n }\n return result;\n }\n \n static public void Main()\n {\n string s1 = Console.ReadLine();\n while (s1 != null)\n {\n string[] ss = s1.Split(' ');\n int[] arr = ss.Select(t => int.Parse(t)).ToArray();\n int result = Compute(arr[0], arr[1], arr[2]);\n Console.WriteLine(result);\n s1 = Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static private int Compute(int n, int a, int b)\n {\n int result = -1;\n for (int i = 1; i <= n - 1; i++)\n {\n result = Math.Max(Math.Min(a / i, b / (n - i)), result);\n }\n return result;\n }\n \n static public void Main()\n {\n string s1 = Console.ReadLine();\n while (s1 != null)\n {\n string[] ss = s1.Split(' ');\n int[] arr = ss.Select(t => int.Parse(t)).ToArray();\n int result = Compute(arr[0], arr[1], arr[2]);\n Console.WriteLine(result);\n s1 = Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _911B\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int a = int.Parse(tokens[1]);\n int b = int.Parse(tokens[2]);\n\n for (int x = Math.Min(a, b); ; x--)\n {\n if (a / x + b / x >= n)\n {\n Console.WriteLine(x);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int a = sc.NextInt();\n int b = sc.NextInt();\n\n /*\n * n\u4eba\u3000n\u679a\u76bf\n * \n * a\u500b\u3001b\u500b\n */\n\n int ans = int.MinValue;\n for (int i = 1; i < n; i++)\n {\n int j = n - i;\n int aa = a / i;\n int bb = b / j;\n if (aa <= 0 || bb <= 0) continue;\n\n ans = Math.Max(ans, Math.Min(aa, bb));\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace example\n{\n class Program\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Split();\n int[] array = line.Select(p => int.Parse(p)).ToArray();\n int n = array[0];\n int a = array[1];\n int b = array[2];\n int x = 0;\n while (Can(n, a, b, x + 1))\n x++;\n Console.WriteLine(x);\n\n }\n\n public static bool Can(int n, int a, int b, int x)\n {\n for (int i = 1; i < n; i++)\n {\n int fa = i;\n int fb = n - i;\n\n if (a / fa >= x && b / fb >= x)\n return true;\n }\n\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int n, a, b;\n sc.Make(out n, out a, out b);\n var res = 0;\n for(int i = 1; i < n; i++)\n {\n int c = a / i;\n var d = b / (n-i);\n chmax(ref res, Min(c, d));\n }\n Console.WriteLine(res);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n internal class ProblemSolver\n {\n private long _n, _a, _b;\n\n public void Initialize(long n, long a, long b)\n {\n _n = n;\n _a = a;\n _b = b;\n }\n\n public long CalculateAndGetAnswer()\n {\n var low = Math.Min(_a, _b);\n var high = Math.Max(_a, _b);\n\n double x = (double)_n / (_a + _b);\n var lower = (long) Math.Ceiling(x * low);\n if (lower < 1)\n {\n lower = 1;\n }\n var higher = _n - lower;\n var min = Math.Max(Math.Min(_a / higher, _b / lower), Math.Min(_a / lower, _b / higher));\n\n lower = (long)Math.Floor(x * low);\n if (lower < 1)\n {\n lower = 1;\n }\n\n higher = _n - lower;\n var min2 = Math.Max(Math.Min(_a / higher, _b / lower), Math.Min(_a / lower, _b / higher));\n\n return Math.Max(min, min2);\n }\n }\n\n internal class ConsoleHelper\n {\n private readonly ProblemSolver _solver = new ProblemSolver();\n public string CaseOutput { get; private set; }\n\n public T LineToValue(string line) where T : struct\n {\n return (T)Convert.ChangeType(line.Split()[0], typeof(T));\n }\n\n public List LineToList(string line) where T : struct\n {\n return line.Split(' ').Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n public void ReadCaseInput(string caseInput)\n {\n using (var stringReader = new StringReader(caseInput))\n {\n var list = LineToList(stringReader.ReadLine());\n _solver.Initialize(list[0], list[1], list[2]);\n }\n }\n\n public void CalculateAnswer()\n {\n CaseOutput = _solver.CalculateAndGetAnswer().ToString();\n }\n }\n\n internal class Program\n {\n private static void Main(string[] args)\n {\n var consoleHelper = new ConsoleHelper();\n long t = 1;\n for (var i = 0; i < t; i++)\n {\n var stringBuilder = new StringBuilder();\n stringBuilder.AppendLine(Console.ReadLine());\n stringBuilder.AppendLine(Console.ReadLine());\n\n consoleHelper.ReadCaseInput(stringBuilder.ToString());\n consoleHelper.CalculateAnswer();\n\n Console.WriteLine(consoleHelper.CaseOutput);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System; \nusing System.Linq;\nusing System.Collections.Generic;\n\nclass P\n{\n static void Main()\n {\n int[] NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int N = NAB[0];\n int A = NAB[1];\n int B = NAB[2];\n int max = 0;\n for (int i = 1; i < N; i++)\n {\n max = Math.Max(max, Math.Min((A / i), (B / (N - i))));\n }\n Console.WriteLine(max);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n \n int n = int.Parse(token[0]);\n int a = int.Parse(token[1]);\n int b = int.Parse(token[2]);\n \n int min = Math.Min(a,b);\n int max = Math.Max(a,b);\n \n int ans = int.MinValue;\n \n\n for(int i=1;i new MainClass().Stream();\n IO io = new IO();\n Mat mat = new Mat();\n void Stream() {\n Solve();\n //Test();\n io.Flush();\n }\n void Test() { }\n void FOR(int a, int b, Action act) {\n for(int i = a; i < b; ++i) act(i);\n }\n void FORR(int a, int b, Action act) {\n for(int i = a - 1; i >= b; --i) act(i);\n }\n }\n #region Default\n class IO {\n #region INPUT\n int _buffCnt;\n string[] _nextBuff;\n private readonly char[] _splitCharacter = new char[] {' '};\n private readonly StreamWriter _sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n };\n public IO() {\n _nextBuff = new string[0];\n _buffCnt = 0;\n Console.SetOut(_sw);\n }\n private string Next() {\n if(_buffCnt < _nextBuff.Length) return _nextBuff[_buffCnt++];\n var str = Scan;\n while(str == \"\") str = Scan;\n _nextBuff = str.Split(_splitCharacter, StringSplitOptions.RemoveEmptyEntries);\n _buffCnt = 0;\n return _nextBuff[_buffCnt++];\n }\n private string Scan => Console.ReadLine();\n private string[] Arr => Scan.Split(' ');\n private void Read (out T v) => v = SuitType (Next());\n private T ConvertType (TU v) => (T)Convert.ChangeType(v, typeof(T));\n private bool TypeEqual () => typeof(T) == typeof(TU);\n private T SuitType (string s)\n =>\n TypeEqual ()\n ? ConvertType (int.Parse(s))\n : TypeEqual ()\n ? ConvertType (long.Parse(s))\n : TypeEqual ()\n ? ConvertType (double.Parse(s))\n : TypeEqual () ? ConvertType (char.Parse(s)) : ConvertType (s);\n public string String => Next();\n public char Char => char.Parse(Next());\n public int Int => int.Parse(Next());\n public long Long => long.Parse(Next());\n public double Double => double.Parse(Next());\n public string[] ArrString => Arr;\n public char[] ArrChar => Array.ConvertAll(Arr, char.Parse);\n public int[] ArrInt => Array.ConvertAll(Arr, int.Parse);\n public long[] ArrLong => Array.ConvertAll(Arr, long.Parse);\n public double[] ArrDouble => Array.ConvertAll(Arr, double.Parse);\n public void Flush() => Console.Out.Flush();\n private T i () { return SuitType (String); }\n public void i (out T v) => Read(out v);\n public void i (out T t, out TU u) {\n i(out t);\n i(out u);\n }\n public void i (out T t, out TU u, out TV v) {\n i(out t, out u);\n i(out v);\n }\n public void i (out T t, out TU u, out TV v, out TW w) {\n i(out t, out u, out v);\n i(out w);\n }\n public void i (out T t, out TU u, out TV v, out TW w, out TX x) {\n i(out t, out u, out v, out w);\n i(out x);\n }\n public void ini (out T[] a, int n) {\n a = new T[n];\n for(int i = 0; i < n; ++i) a[i] = i ();\n }\n public void ini (out T[] a, out TU[] b, int n) {\n a = new T[n];\n b = new TU[n];\n for(int i = 0; i < n; ++i) {\n a[i] = i ();\n b[i] = i ();\n }\n }\n public void ini (out T[] a, out TU[] b, out TV[] c, int n) {\n a = new T[n];\n b = new TU[n];\n c = new TV[n];\n for(int i = 0; i < n; ++i) {\n a[i] = i ();\n b[i] = i ();\n c[i] = i ();\n }\n }\n public void ini (out T[,] a, int h, int w) {\n a = new T[h, w];\n for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) a[i, j] = i ();\n }\n public void ini (out Tuple [] t, int n) {\n t = new Tuple [n];\n for(int j = 0; j < n; ++j) {\n T i1;\n TU i2;\n i(out i1, out i2);\n t[j] = Tuple.Create(i1, i2);\n }\n }\n public void ini (out Tuple [] t, int n) {\n t = new Tuple [n];\n for(int j = 0; j < n; ++j) {\n T i1;\n TU i2;\n TV i3;\n i(out i1, out i2, out i3);\n t[j] = Tuple.Create(i1, i2, i3);\n }\n }\n #endregion\n #region OUTPUT\n private void Out (T v) => Console.Write(v);\n private void OutLine (T v) => Console.WriteLine(v);\n public void o (T v) => OutLine(v);\n public void o (params T[] a) => Array.ForEach(a, OutLine);\n public void o (T[,] a) {\n int a0 = a.GetLength(0), a1 = a.GetLength(1);\n for(int i = 0; i < a0; ++i) {\n for(int j = 0; j < a1 - 1; ++j) Out(a[i, j] + \" \");\n OutLine(a[i, a1 - 1]);\n }\n }\n public void ol (params T[] a) => OutLine(string.Join(\" \", a));\n public void YN(bool f) => OutLine(f ? \"YES\" : \"NO\");\n public void Yn(bool f) => OutLine(f ? \"Yes\" : \"No\");\n public void yn(bool f) => OutLine(f ? \"yes\" : \"no\");\n #endregion\n }\n class Mat {\n public long mod = 1000000007; //10^9+7\n public long Pow(long a, long b) {\n if(b == 0) return 1;\n if(b % 2 == 1) return (a % mod * Pow(a % mod, b - 1) % mod) % mod;\n else return Pow(a * a % mod, b / 2) % mod;\n }\n public long Fact(long n) {\n long ret = 1;\n for(long i = 1; i <= n; i++) ret = (ret * i) % mod;\n return ret;\n }\n public long[,] C(int N) {\n long[,] Co = new long[N + 1, N + 1];\n (N + 1).REP(i => (i + 1).REP(j => Co[i, j] = (j == 0 || j == i) ? 1L : Co[i - 1, j - 1] + Co[i - 1, j]));\n return Co;\n }\n public long C(long n, long r) {\n if(r == 0 || n == r) return 1;\n if(n == 0) return 0;\n if(n < 0 || r < 0 || n < r) throw new ArgumentException(\"n or r invalid\");\n else return (Fact(n) % mod * Pow((Fact(n - r) % mod * Fact(r) % mod) % mod, mod - 2) % mod) % mod;\n }\n public long NoModC(long n, long r) {\n var c = new long[r + 1];\n c[0] = 1;\n for(var i = 1; i <= n; ++i) for(var j = Math.Min(i, r); j > 0; j--) c[j] = c[j] + c[j - 1];\n return c[r];\n }\n public long H(long n, long r) => C(n + r - 1, r);\n public long P(long n, long r) => Fact(n) / Fact(n - r);\n public long Lcm(long a, long b) => a * (b / Gcd(a, b));\n public long Lcm(params long[] a) => a.Aggregate((v, n) => Lcm(v, n));\n public long Gcd(long a, long b) {\n if(a < b) Swap(ref a, ref b);\n return b == 0 ? a : Gcd(b, a % b);\n }\n public long Gcd(params long[] array) => array.Aggregate((v, n) => Gcd(v, n));\n public T Max (params T[] a) => a.Max();\n public T Min (params T[] a) => a.Min();\n public void Swap (ref T a, ref T b) {\n T tmp = a;\n a = b;\n b = tmp;\n }\n public double Dis(int x1, int y1, int x2, int y2) => Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));\n public int ManhattanDis(int x1, int y1, int x2, int y2) => Math.Abs(x1 - x2) + Math.Abs(y1 - y2);\n public int[] DigArr(int n) {\n int[] ret = new int[Digit(n)];\n ret.Length.REP(i => ret[i] = DigVal(n, i + 1));\n return ret;\n }\n public long DigArr2Num(IEnumerable enu) { return enu.Aggregate((v, n) => v * 10 + n); }\n public int Digit(long n) { return (n == 0) ? 1 : (int)Math.Log10(n) + 1; }\n public int DigVal(int n, int dig) { return (n % (int)Pow(10, dig)) / (int)Pow(10, dig - 1); }\n public long Tousa(long a, long d, long n) { return a + (n - 1) * d; }\n public long TousaSum(long a, long d, long n) { return n * (2 * a + (n - 1) * d) / 2; }\n public long[] EnuDivsor(long N) {\n var ret = new SortedSet ();\n for(long i = 1; i * i <= N; i++)\n if(N % i == 0) {\n ret.Add(i);\n ret.Add(N / i);\n }\n return ret.ToArray();\n }\n public Dictionary PrimeFactor(long n) {\n var ret = new Dictionary ();\n for(int i = 2; i * i <= n; ++i) {\n if(!ret.ContainsKey(i)) ret[i] = 0;\n while(n % i == 0) {\n ++ret[i];\n n /= i;\n }\n }\n return ret.Where(kp => kp.Value != 0).ToDictionary(kp => kp.Key, kp => kp.Value);\n }\n }\n public struct Edge : IComparable {\n public int To;\n public long Cost;\n public Edge(int to, long cost) {\n To = to;\n Cost = cost;\n }\n public int CompareTo(Edge e) => Cost.CompareTo(e.Cost);\n }\n #endregion\n #region MyEx\n static class StringEX {\n public static string Reversed(this string s) => string.Join(\"\", s.Reverse());\n public static string Repeated(this string s, int n) => string.Concat(Enumerable.Repeat(s, n).ToArray());\n public static string toString(this char[] a) => new string(a);\n public static int toInt(this string s) {\n int n;\n return (int.TryParse(s.TrimStart('0'), out n)) ? n : 0;\n }\n public static int toInt(this char c) => toInt(c.ToString());\n public static int toInt(this char[] c) => toInt(c.toString());\n public static long toLong(this string s) {\n long n;\n return (long.TryParse(s.TrimStart('0'), out n)) ? n : 0L;\n }\n public static long toLong(this char c) => toLong(c.ToString());\n public static long toLong(this char[] c) => toLong(c.toString());\n }\n static class NumericEX {\n public static string toString(this double d) => d.ToString(\"R\", CultureInfo.InvariantCulture);\n public static string Pad0 (this T s, int n) => s.ToString().PadLeft(n, '0');\n public static string RoundOff(this double v, int n)\n => Math.Round(v, n - 1, MidpointRounding.AwayFromZero).toString();\n public static string RoundUp(this double v) => Math.Ceiling(v).toString();\n public static string RoundDown(this double v) => Math.Floor(v).toString();\n public static bool Odd(this int v) => (v & 1) != 0;\n public static bool Odd(this long v) => (v & 1) != 0;\n public static void REP(this int v, Action act) {\n for(int i = 0; i < v; ++i) act(i);\n }\n public static void REPR(this int v, Action act) {\n for(int i = v - 1; i >= 0; --i) act(i);\n }\n public static void EREP(this int v, Action act) => (v + 1).REP(act);\n }\n static class ArrayEX {\n public static T[] Sort (this T[] a) {\n Array.Sort(a);\n return a;\n }\n public static T[] SortR (this T[] a) {\n Array.Reverse(a.Sort());\n return a;\n }\n public static void Set (this T[] a, T v) => a.Length.REP(i => a[i] = v);\n public static void Set (this T[,] a, T v) => a.GetLength(0).REP(i => a.GetLength(1).REP(j => a[i, j] = v));\n public static void Set (this T[,,] a, T v)\n => a.GetLength(0).REP(i => a.GetLength(1).REP(j => a.GetLength(2).REP(k => a[i, j, k] = v)));\n public static int LowerBound (this T[] a, T x) where T : IComparable {\n int lb = -1, ub = a.Length;\n while(ub - lb > 1) {\n int mid = (ub + lb) >> 1;\n if(a[mid].CompareTo(x) >= 0) ub = mid;\n else lb = mid;\n }\n return ub;\n }\n public static int UpperBound (this T[] a, T x) where T : IComparable {\n int lb = -1, ub = a.Length;\n while(ub - lb > 1) {\n int mid = (ub + lb) >> 1;\n if(a[mid].CompareTo(x) > 0) ub = mid;\n else lb = mid;\n }\n return ub;\n }\n public static int Range (this T[] a, T from, T to) where T : IComparable\n => a.UpperBound(to) - a.LowerBound(from);\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace TypA\n{\n class Program\n {\n public static int[] Recieve()\n {\n string s = Console.ReadLine();\n string[] S = s.Split(' ');\n int[] A = new int[S.Length];\n for(int i = 0;ik/2)\n {\n int u = mis(a, b) / (k - i);\n int o = mx(a, b) / i;\n if (ulm < mis(u, o)) ulm = mis(u, o);\n }\n else\n {\n int u = mx(a, b) / (k - i);\n int o = mis(a, b) / i;\n if (ulm < mis(u, o)) ulm = mis(u, o);\n }\n \n }\n Console.WriteLine(ulm);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF911 {\n class Program {\n static void Main(string[] args) {\n string line = Console.ReadLine();\n string[] tokens = line.Split(' ');\n\n var plateNumber = int.Parse(tokens[0]);\n var pieceFirst = int.Parse(tokens[1]);\n var pieceSecond = int.Parse(tokens[2]);\n\n var maxPiece = 0;\n\n for (int i = 1; i < plateNumber; i++) {\n var compareMin = Math.Min(pieceFirst / i, pieceSecond / (plateNumber - i));\n maxPiece = Math.Max(maxPiece, compareMin);\n }\n\n Console.WriteLine(maxPiece);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace aaamasodik\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), a = int.Parse(s[1]), b = int.Parse(s[2]);\n int max = 0;\n for (int i = 1; i < n; i++)\n {\n if (Math.Min(a/i, b/(n-i)) > max)\n {\n max = Math.Min(a / i, b / (n - i));\n }\n }\n Console.WriteLine(max);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class CodeForces\n {\n static void Main(string[] args)\n {\n var arr = GetArray();\n var n = arr[0];\n var a = arr[1];\n var b = arr[2];\n Console.WriteLine(Solve(n,a,b));\n }\n\n public static void Tests()\n {\n //\\\n }\n\n public static long Solve(int n, int a, int b)\n {\n\n var i = 1;\n var k = n - i;\n var max = 0;\n while ( i <= k)\n {\n var m = Math.Min(a / i, b / k);\n var t = Math.Min(a / k, b / i);\n max = Math.Max(max, m);\n max = Math.Max(max, t);\n i++;\n k = n - i;\n\n }\n return max;\n\n }\n\n\n static int[] GetArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n }\n\n\n public static void SieveOfErathostenes(int upperLimit)\n {\n //BitArray works just like a bool[] but takes up a lot less space.\n BitArray composite = new BitArray(upperLimit);\n\n //Only need to cross off numbers up to sqrt.\n int sqrt = (int)Math.Sqrt(upperLimit);\n for (int p = 2; p <= sqrt; ++p)\n {\n if (composite[p]) \n continue; //The number is crossed off; skip it\n\n //Cross off each multiple of this prime\n //Start at the prime squared, because lower numbers will\n //have been crossed off already. No need to check them.\n for (int i = p * p; i < upperLimit; i += p)\n composite[i] = true;\n }\n long cn = 0;\n for (var i = 2; i < upperLimit; i++)\n {\n if (!composite[i])\n cn++;\n }\n Console.WriteLine(upperLimit + \" \" + cn);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n int answer = 0;\n while (i <= Math.Min(a, b))\n {\n if (Can(n, a, b, i))\n answer = i;\n i++;\n }\n sw.WriteLine(answer);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n int k = 0;\n while (a >= x)\n {\n a -= x;\n k++;\n }\n while (b >= x)\n {\n b -= x;\n k++;\n }\n return k >= n;\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0414\u0432\u0430_\u0442\u043e\u0440\u0442\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var S = Console.ReadLine().Split();\n int n = Convert.ToInt32(S[0]);\n int a = Convert.ToInt32(S[1]);\n int b = Convert.ToInt32(S[2]);\n int DLA, DLB;\n int CA, CB;\n int C;\n int T = 0;\n\n for(int i=1;i0 && y>0)\n ans = Math.Max(ans, Math.Min(x, y));\n }\n\n Console.Write(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Two_Cakes\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int a = Next();\n int b = Next();\n\n for (int i = (a + b)/n; i > 0; i--)\n {\n if (a < i || b < i)\n continue;\n if (a/i + b/i >= n)\n return i;\n }\n\n return 1;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int n = arr[0];\n int a = arr[1];\n int b = arr[2];\n\n int cakeA, cakeB, cakeC, cakeCB, cakeCC;\n\n int answer = 0;\n\n for (int i = 1; i < n; i++)\n {\n cakeA = i;\n cakeB = n - i;\n\n cakeC = a / cakeA;\n cakeCB = b / cakeB;\n\n cakeCC = Math.Min(cakeC, cakeCB);\n answer = Math.Max(answer, cakeCC);\n\n }\n Console.WriteLine(answer);\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem911B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var pars = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();\n int n = pars[0], a = pars[1], b = pars[2];\n for (int i = 400; i >= 0; i--)\n {\n if (a / i > 0 && b / i > 0 && a / i + b / i >= n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp12\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = (Console.ReadLine().Split().Select(x => int.Parse(x))).ToList();\n for (int i = Math.Min(inputs[1],inputs[2]); i > 0; --i)\n {\n if (inputs[1] / i + inputs[2] / i >= inputs[0])\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.NET\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] parts = line.Split(' ').ToArray();\n int n = int.Parse(parts[0]);\n int a = int.Parse(parts[1]);\n int b = int.Parse(parts[2]);\n int minim = Math.Min(a, b);\n for (int i = minim; i>=1; i--)\n {\n if (a/i + b/i >=n)\n {\n Console.WriteLine(i);\n Console.ReadLine();\n return;\n }\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static List IndexesOf(this IEnumerable source, T value)\n {\n var indexes = new List();\n\n int index = 0;\n var comparer = EqualityComparer.Default; // or pass in as a parameter\n foreach (T item in source)\n {\n if (comparer.Equals(item, value))\n {\n indexes.Add(index);\n };\n index++;\n }\n return indexes;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n#if __debug\n var nab = \"4 7 10\";\n#else\n var nab = Console.ReadLine();\n#endif\n var n = Convert.ToInt32(nab.Split(' ')[0]);\n var a = Convert.ToInt32(nab.Split(' ')[1]);\n var b = Convert.ToInt32(nab.Split(' ')[2]);\n Console.WriteLine(Check(n,a,b));\n }\n\n\n static int[] get_Plates(int n1, int n2, int a, int b)\n {\n var plates = new int[n1 + n2];\n int a_portion = a / n1;//\u043f\u043e\u0444\u0438\u0433 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0442.\u043a. \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442, \u043f\u0443\u0441\u0442\u044c 10 \u0434\u043b\u044f 3 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 3 3 4 \u0430 3 3 3\n int b_portion = b / n2;\n\n if (a_portion != 0 && b_portion != 0)\n {\n //\u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0430\u0440\u0435\u043b\u043a\u0438\n for (int i = 0; i < n1; i++)\n {\n plates[i] = a_portion;\n }\n for (int i = n1; i < (n1 + n2); i++)\n {\n plates[i] = b_portion;\n }\n }\n return plates;\n }\n static string Check(int n, int a, int b)\n {\n if (a > b)\n {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n int max = 0;\n for (int i = 1; i < n; i++)\n {\n var plates = get_Plates(i, n - i, a, b);\n\n var pMin = plates.Min();\n\n#if __debug\n Console.WriteLine($\"\u043f\u043e \u0442\u0430\u0440\u0435\u043b\u043a\u0430\u043c i={i} plates={plates.ToStr()} pMin={pMin}\");\n#endif\n\n if (pMin < max) break;\n if (pMin > max) max = pMin;\n }\n\n return max.ToString();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine());\n var data = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n var n = data[0];\n var a = data[1];\n var b = data[2];\n\n var max = 0;\n for(var i = 1; i < n; i++)\n {\n var first = i;\n var second = n - i;\n\n var minPos = int.MaxValue;\n\n if(first > a || second > b)\n {\n continue;\n }\n minPos = Math.Min(minPos, a / first);\n \n minPos = Math.Min(minPos, b / second);\n \n max = Math.Max(max, minPos);\n }\n Console.WriteLine(max);\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"5 2 3\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"4 7 10\\n\"));\n Console.WriteLine();\n\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n internal class ProblemSolver\n {\n private long _n, _a, _b;\n\n public void Initialize(long n, long a, long b)\n {\n _n = n;\n _a = a;\n _b = b;\n }\n\n public long CalculateAndGetAnswer()\n {\n var low = Math.Min(_a, _b);\n var high = Math.Max(_a, _b);\n\n double x = (double)_n / (low + high);\n low = (long) Math.Floor(x * low);\n if (low < 1)\n {\n low = 1;\n }\n high = _n - low;\n\n var min = Math.Max(Math.Min(_a / high, _b / low), Math.Min(_a / low, _b / high));\n\n return min;\n }\n }\n\n internal class ConsoleHelper\n {\n private readonly ProblemSolver _solver = new ProblemSolver();\n public string CaseOutput { get; private set; }\n\n public T LineToValue(string line) where T : struct\n {\n return (T)Convert.ChangeType(line.Split()[0], typeof(T));\n }\n\n public List LineToList(string line) where T : struct\n {\n return line.Split(' ').Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n public void ReadCaseInput(string caseInput)\n {\n using (var stringReader = new StringReader(caseInput))\n {\n var list = LineToList(stringReader.ReadLine());\n _solver.Initialize(list[0], list[1], list[2]);\n }\n }\n\n public void CalculateAnswer()\n {\n CaseOutput = _solver.CalculateAndGetAnswer().ToString();\n }\n }\n\n internal class Program\n {\n private static void Main(string[] args)\n {\n var consoleHelper = new ConsoleHelper();\n long t = 1;\n for (var i = 0; i < t; i++)\n {\n var stringBuilder = new StringBuilder();\n stringBuilder.AppendLine(Console.ReadLine());\n stringBuilder.AppendLine(Console.ReadLine());\n\n consoleHelper.ReadCaseInput(stringBuilder.ToString());\n consoleHelper.CalculateAnswer();\n\n Console.WriteLine(consoleHelper.CaseOutput);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n internal class ProblemSolver\n {\n private long _n, _a, _b;\n\n public void Initialize(long n, long a, long b)\n {\n _n = n;\n _a = a;\n _b = b;\n }\n\n public long CalculateAndGetAnswer()\n {\n var low = Math.Min(_a, _b);\n var high = Math.Max(_a, _b);\n\n double x = (double)_n / (low + high);\n low = (long) Math.Round(x * low);\n if (low < 1)\n {\n low = 1;\n }\n high = _n - low;\n\n var min = Math.Max(Math.Min(_a / high, _b / low), Math.Min(_a / low, _b / high));\n\n return min;\n }\n }\n\n internal class ConsoleHelper\n {\n private readonly ProblemSolver _solver = new ProblemSolver();\n public string CaseOutput { get; private set; }\n\n public T LineToValue(string line) where T : struct\n {\n return (T)Convert.ChangeType(line.Split()[0], typeof(T));\n }\n\n public List LineToList(string line) where T : struct\n {\n return line.Split(' ').Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n public void ReadCaseInput(string caseInput)\n {\n using (var stringReader = new StringReader(caseInput))\n {\n var list = LineToList(stringReader.ReadLine());\n _solver.Initialize(list[0], list[1], list[2]);\n }\n }\n\n public void CalculateAnswer()\n {\n CaseOutput = _solver.CalculateAndGetAnswer().ToString();\n }\n }\n\n internal class Program\n {\n private static void Main(string[] args)\n {\n var consoleHelper = new ConsoleHelper();\n long t = 1;\n for (var i = 0; i < t; i++)\n {\n var stringBuilder = new StringBuilder();\n stringBuilder.AppendLine(Console.ReadLine());\n stringBuilder.AppendLine(Console.ReadLine());\n\n consoleHelper.ReadCaseInput(stringBuilder.ToString());\n consoleHelper.CalculateAnswer();\n\n Console.WriteLine(consoleHelper.CaseOutput);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n internal class ProblemSolver\n {\n private long _n, _a, _b;\n\n public void Initialize(long n, long a, long b)\n {\n _n = n;\n _a = a;\n _b = b;\n }\n\n public long CalculateAndGetAnswer()\n {\n var nA = _n / 2;\n var nB = _n - nA;\n\n var min = Math.Max(Math.Min(_a / nA, _b / nB), Math.Min(_a / nB, _b / nA));\n\n return min;\n }\n }\n\n internal class ConsoleHelper\n {\n private readonly ProblemSolver _solver = new ProblemSolver();\n public string CaseOutput { get; private set; }\n\n public T LineToValue(string line) where T : struct\n {\n return (T)Convert.ChangeType(line.Split()[0], typeof(T));\n }\n\n public List LineToList(string line) where T : struct\n {\n return line.Split(' ').Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n public void ReadCaseInput(string caseInput)\n {\n using (var stringReader = new StringReader(caseInput))\n {\n var list = LineToList(stringReader.ReadLine());\n _solver.Initialize(list[0], list[1], list[2]);\n }\n }\n\n public void CalculateAnswer()\n {\n CaseOutput = _solver.CalculateAndGetAnswer().ToString();\n }\n }\n\n internal class Program\n {\n private static void Main(string[] args)\n {\n var consoleHelper = new ConsoleHelper();\n long t = 1;\n for (var i = 0; i < t; i++)\n {\n var stringBuilder = new StringBuilder();\n stringBuilder.AppendLine(Console.ReadLine());\n stringBuilder.AppendLine(Console.ReadLine());\n\n consoleHelper.ReadCaseInput(stringBuilder.ToString());\n consoleHelper.CalculateAnswer();\n\n Console.WriteLine(consoleHelper.CaseOutput);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF911 {\n class Program {\n static void Main(string[] args) {\n string line = Console.ReadLine();\n string[] tokens = line.Split(' ');\n int[] numbers = Array.ConvertAll(tokens, int.Parse);\n\n var plateNumber = numbers[0];\n var pieceFirst = numbers[1];\n var pieceSecond = numbers[2];\n\n int averagePlate = plateNumber / 2;\n int minFirst = pieceFirst / averagePlate;\n int minSecond = pieceSecond / averagePlate;\n\n Console.WriteLine(minFirst < minSecond ? minFirst : minSecond);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n int answer = 1;\n while (i < 10000)\n {\n if (Can(n, a, b, i))\n answer = i;\n i++;\n }\n sw.WriteLine(answer);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n int k = 0;\n while (a >= x)\n {\n a -= x;\n k++;\n }\n while (b >= x)\n {\n b -= x;\n k++;\n }\n return k >= n;\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n int answer = 1;\n while (i < 10000)\n {\n if (Can(n, a, b, i))\n answer = i;\n i++;\n }\n sw.WriteLine(answer);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n return n <= (a / x) + (b / x);\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n int answer = 0;\n while (i < Math.Min(a, b))\n {\n if (Can(n, a, b, i))\n answer = i;\n i++;\n }\n sw.WriteLine(answer);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n int k = 0;\n while (a >= x)\n {\n a -= x;\n k++;\n }\n while (b >= x)\n {\n b -= x;\n k++;\n }\n return k >= n;\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n while (Can(n, a, b, i))\n i++;\n sw.WriteLine(i - 1);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n return n <= (a / x) + (b / x);\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n static Random rnd = new Random();\n\n enum Direction { Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n\n static void Solve()\n {\n int n = ReadInt(), a = ReadInt(), b = ReadInt();\n int i = 1;\n int answer = 1;\n while (i < 10000)\n {\n if (Can(n, a, b, i))\n answer = i;\n i++;\n }\n sw.WriteLine(i - 1);\n }\n\n static bool Can(int n, int a, int b, int x)\n {\n return n <= (a / x) + (b / x);\n }\n \n\n static int[][] GetReverseMatrix(int[][] a)\n {\n int[][] answer = new int[a[0].Length][];\n for (int i = 0; i < a[0].Length; i++)\n {\n answer[i] = new int[a.Length];\n for (int j = 0; j < a.Length; j++)\n answer[i][j] = a[j][i];\n }\n return answer;\n }\n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static double getArithmeticProgressionSum(int n)\n {\n return (n * (n + 1)) / 2;\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n return ReadGraph(ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(int n, int m)\n {\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T : IComparable\n {\n return ReadGraph(parser, ReadInt(), ReadInt());\n }\n\n static Graph ReadGraph(Parser parser, int n, int m)\n where T : IComparable\n {\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static int[] ReadArrayInt(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static char[][] ReadMatrixChar(int n, int m)\n {\n char[][] answer = new char[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = ReadString().ToCharArray();\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public int GetLength()\n {\n return Edges.Length;\n }\n\n public int GetLength(int n)\n {\n return Edges[n].Length;\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j + 1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T : IComparable\n {\n public T[][] Cost;\n\n public T GetCost(int x, int y) => Cost[x][y];\n\n public void SetCost(T a, int x, int y) => Cost[x][y] = a;\n\n public Graph(int n, int[] a, int[] b, T[] c) : base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class SimplePair\n {\n public U first;\n public V second;\n public SimplePair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n }\n\n struct Pair : IComparable>\n where U : IComparable\n where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n\n class SuperList\n {\n protected LinkedList linkedListMain;\n protected LinkedList>> linkedListAdditional;\n int step = 0;\n public int resize = 0;\n\n public SuperList(IEnumerable input)\n {\n Init(input);\n }\n\n public int Count { get { return linkedListMain.Count; } }\n\n public T this[int index]\n {\n get\n {\n return GetNode(index).Value;\n }\n set\n {\n GetNode(index).Value = value;\n }\n }\n\n public void AddValueToIndex(int index, T value)\n {\n if (index > linkedListMain.Count || index < 0)\n {\n throw new IndexOutOfRangeException();\n }\n if (index == linkedListMain.Count)\n {\n linkedListMain.AddLast(value);\n linkedListAdditional.Last.Value.second = linkedListMain.Last;\n linkedListAdditional.Last.Value.first = linkedListMain.Count - 1;\n IncreaseReferenceIndexes(index + 1);\n return;\n }\n if (index == 0)\n {\n linkedListMain.AddFirst(value);\n linkedListAdditional.First.Value.second = linkedListMain.First;\n IncreaseReferenceIndexes(1);\n return;\n }\n linkedListMain.AddBefore(GetNode(index), value);\n IncreaseReferenceIndexes(index);\n }\n\n private LinkedListNode GetNode(int index)\n {\n var NowNode = linkedListAdditional.First;\n while (NowNode != linkedListAdditional.Last\n && NowNode.Value.first < index)\n {\n NowNode = NowNode.Next;\n }\n var NodeAnswer = NowNode.Value.second;\n int i = NowNode.Value.first;\n while (i > index)\n {\n i--;\n NodeAnswer = NodeAnswer.Previous;\n }\n while (i < index)\n {\n i++;\n NodeAnswer = NodeAnswer.Next;\n }\n return NodeAnswer;\n }\n\n\n private void Init(IEnumerable input)\n {\n linkedListMain = new LinkedList();\n foreach (T iter in input)\n {\n linkedListMain.AddLast(iter);\n }\n InitReferences();\n }\n\n\n private void InitReferences()\n {\n resize++;\n linkedListAdditional = new LinkedList>>();\n step = Math.Max(1, (int)Math.Sqrt(linkedListMain.Count));\n int now = step;\n LinkedListNode NowNode = null;\n for (int i = 0; i < linkedListMain.Count; i++)\n {\n if (NowNode == null)\n NowNode = linkedListMain.First;\n else\n NowNode = NowNode.Next;\n if (now == step)\n {\n now = 0;\n linkedListAdditional.AddLast(new SimplePair>(i, NowNode));\n }\n else\n {\n now++;\n }\n }\n if (linkedListMain.Last != linkedListAdditional.Last.Value.second)\n {\n linkedListAdditional.AddLast(new SimplePair>\n (linkedListMain.Count - 1, linkedListMain.Last));\n }\n }\n\n private void IncreaseReferenceIndexes(int BeginIndex)\n {\n if (linkedListMain.Count == 2)\n {\n InitReferences();\n return;\n }\n LinkedListNode>> NowNode = null;\n int maxstep = 0;\n for (int i = 0; i < linkedListAdditional.Count; i++)\n {\n if (NowNode == null)\n {\n NowNode = linkedListAdditional.First;\n }\n else\n {\n NowNode = NowNode.Next;\n }\n if (NowNode.Value.first >= BeginIndex)\n {\n NowNode.Value.first++;\n }\n if (NowNode.Previous != null)\n {\n maxstep = Math.Max(maxstep, NowNode.Value.first - NowNode.Previous.Value.first);\n }\n }\n if (maxstep > step * 2)\n {\n InitReferences();\n }\n }\n\n public override string ToString()\n {\n return String.Join(\" \", linkedListMain);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Two_Cakes\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int a = Next();\n int b = Next();\n\n for (int i = (a + b)/n; i > 0; i--)\n {\n if (a/i + b/i >= n)\n return i;\n }\n\n return 1;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem911B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var pars = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();\n int n = pars[0], a = pars[1], b = pars[2];\n for (int i = 200; i >= 0; i--)\n {\n if (a / i + b / i >= n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n;\n var inputs = (Console.ReadLine().Split().Select(x => int.Parse(x))).ToList();\n for (int i = 400; i > 0; --i)\n {\n if (inputs[1] / i + inputs[2] / i >= inputs[0])\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n;\n var inputs = (Console.ReadLine().Split().Select(x => int.Parse(x))).ToList();\n for (int i = 200; i > 0; --i)\n {\n if (inputs[1] / i + inputs[2] / i >= inputs[0])\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n double platesCount = inputData[0];\n double firstCakePieces = inputData[1];\n double secondCakePieces = inputData[2];\n\n double piecesOnFirstPlate;\n double piecesOnSecondPlate;\n\n double biggestPart;\n\n int findedValue;\n\n if (firstCakePieces + secondCakePieces == platesCount)\n {\n findedValue = 1;\n }\n else\n {\n if (firstCakePieces > secondCakePieces)\n {\n biggestPart = Math.Ceiling(platesCount * secondCakePieces / firstCakePieces);\n piecesOnFirstPlate = firstCakePieces / biggestPart;\n piecesOnSecondPlate = secondCakePieces / (platesCount - biggestPart);\n }\n else\n {\n biggestPart = Math.Ceiling(platesCount * firstCakePieces / secondCakePieces);\n piecesOnFirstPlate = firstCakePieces / (platesCount - biggestPart);\n piecesOnSecondPlate = secondCakePieces / biggestPart;\n }\n\n findedValue = (int) (piecesOnFirstPlate < piecesOnSecondPlate ? piecesOnFirstPlate : piecesOnSecondPlate);\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n\tint[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n\t\tdouble platesCount = inputData[0];\n\t\tdouble firstCakePieces = inputData[1];\n\t\tdouble secondCakePieces = inputData[2];\n\t\t\n\t\tint findedValue;\n\n\t\tif (firstCakePieces + secondCakePieces == platesCount || firstCakePieces == secondCakePieces)\n\t\t{\n\t\t\tfindedValue = (int)((firstCakePieces + secondCakePieces) / platesCount);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdouble piecesOnFirstPlate;\n\t\t\tdouble piecesOnSecondPlate;\n\t\t\tdouble lessPart = firstCakePieces > secondCakePieces\n\t\t\t\t? Math.Ceiling(platesCount * secondCakePieces / firstCakePieces)\n\t\t\t\t: Math.Ceiling(platesCount * firstCakePieces / secondCakePieces);\n\n\t\t\tif (firstCakePieces > secondCakePieces)\n\t\t\t{\n\t\t\t\tpiecesOnFirstPlate = firstCakePieces / (platesCount - lessPart);\n\t\t\t\tpiecesOnSecondPlate = secondCakePieces / lessPart;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpiecesOnFirstPlate = firstCakePieces / lessPart;\n\t\t\t\tpiecesOnSecondPlate = secondCakePieces / (platesCount - lessPart);\n\t\t\t}\n\n\t\t\tfindedValue = (int) (piecesOnFirstPlate < piecesOnSecondPlate ? Math.Ceiling(piecesOnFirstPlate) : Math.Ceiling(piecesOnSecondPlate));\n\t\t}\n\n\t\tConsole.WriteLine(findedValue);\n\t\t\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n int platesCount = inputData[0];\n int firstCakePieces = inputData[1];\n int secondCakePieces = inputData[2];\n\n int commonPieces = firstCakePieces + secondCakePieces;\n int minPiecesOnPlate = commonPieces / platesCount;\n\n int findedValue;\n\n if (commonPieces == platesCount || firstCakePieces == secondCakePieces)\n {\n findedValue = minPiecesOnPlate;\n }\n else if (firstCakePieces < minPiecesOnPlate)\n {\n findedValue = firstCakePieces;\n }\n else if (secondCakePieces < minPiecesOnPlate)\n {\n findedValue = secondCakePieces;\n }\n else\n {\n while (true)\n {\n int minPiecesFromFirstCake = firstCakePieces / minPiecesOnPlate;\n int minPiecesFromSecondCake = secondCakePieces / minPiecesOnPlate;\n\n if (minPiecesFromFirstCake + minPiecesFromSecondCake >= platesCount)\n {\n break;\n }\n minPiecesOnPlate--;\n }\n findedValue = minPiecesOnPlate;\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n double platesCount = inputData[0];\n double firstCakePieces = inputData[1];\n double secondCakePieces = inputData[2];\n\n double piecesOnFirstPlate;\n double piecesOnSecondPlate;\n\n double biggestPart;\n\n int findedValue;\n\n if (firstCakePieces + secondCakePieces == platesCount || firstCakePieces == secondCakePieces)\n {\n findedValue = (int)((firstCakePieces + secondCakePieces) / platesCount);\n }\n else\n {\n if (firstCakePieces > secondCakePieces)\n {\n biggestPart = Math.Ceiling(platesCount * secondCakePieces / firstCakePieces);\n piecesOnFirstPlate = firstCakePieces / biggestPart;\n piecesOnSecondPlate = secondCakePieces / (platesCount - biggestPart);\n }\n else\n {\n biggestPart = Math.Ceiling(platesCount * firstCakePieces / secondCakePieces);\n piecesOnFirstPlate = firstCakePieces / (platesCount - biggestPart);\n piecesOnSecondPlate = secondCakePieces / biggestPart;\n }\n\n findedValue = (int) (piecesOnFirstPlate < piecesOnSecondPlate ? piecesOnFirstPlate : piecesOnSecondPlate);\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int[] inputData = Console.ReadLine().Split(' ').Select(item => Int32.Parse(item)).ToArray();\n\n int platesCount = inputData[0];\n int firstCakePieces = inputData[1];\n int secondCakePieces = inputData[2];\n\n int commonPieces = firstCakePieces + secondCakePieces;\n int minPiecesOnPlate = commonPieces / platesCount;\n\n int findedValue;\n\n if (commonPieces == platesCount || firstCakePieces == secondCakePieces)\n {\n findedValue = minPiecesOnPlate;\n }\n else if(firstCakePieces < minPiecesOnPlate)\n {\n findedValue = firstCakePieces;\n }\n else if(secondCakePieces < minPiecesOnPlate)\n {\n findedValue = secondCakePieces;\n }\n else\n {\n int minPiecesFromFirstCake = firstCakePieces / minPiecesOnPlate;\n int minPiecesFromSecondCake = secondCakePieces / minPiecesOnPlate;\n findedValue = minPiecesFromFirstCake + minPiecesFromSecondCake == platesCount\n ? minPiecesOnPlate\n : minPiecesOnPlate - 1;\n }\n\n Console.WriteLine(findedValue);\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int a = sc.NextInt();\n int b = sc.NextInt();\n\n /*\n * n\u4eba\u3000n\u679a\u76bf\n * \n * a\u500b\u3001b\u500b\n */\n\n int ans = int.MaxValue;\n for (int i = 1; i < n; i++)\n {\n int aa = (a + i - 1) / i;\n int bb = (b + (n - i) - 1) / (n - i);\n\n ans = Math.Min(ans, Math.Min(aa,bb));\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "\ufeffusing System; \nusing System.Linq;\nusing System.Collections.Generic;\n\nclass P\n{\n static void Main()\n {\n int[] NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int N = NAB[0];\n int A = NAB[1];\n int B = NAB[2];\n for (int i = (A + B) / N; i >= 1; i--)\n {\n if (A / i + B / i >= N)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n}"}], "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _105b\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public double nextDouble()\n {\n return (double)nextInt();\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n double vp = sc.nextDouble();\n double vd = sc.nextDouble();\n double t = sc.nextDouble();\n double f = sc.nextDouble();\n double c = sc.nextDouble();\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n int count = 0;\n double H;\n double t0;\n H = vp * t;\n while (true)\n {\n t0 = H / (vd - vp);\n\n H += vp * t0;\n\n if (H >= (double)c)\n {\n Console.WriteLine(count);\n return;\n }\n else\n {\n count++;\n t0 = (H / vd) + f;\n H += vp * t0;\n }\n }\n\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine().Trim());\n int vd = int.Parse(Console.ReadLine().Trim());\n int late = int.Parse(Console.ReadLine().Trim());\n int wait = int.Parse(Console.ReadLine().Trim());\n int distance = int.Parse(Console.ReadLine().Trim());\n\n double p = vp * late;\n int drag = 0;\n\n if (vp > vd)\n {\n Console.WriteLine(0);\n return;\n }\n\n while (p < distance)\n {\n double time1 = p;\n time1 /= (vd - vp);\n\n double delta = time1 * vp;\n\n p += delta;\n\n if (p >= distance)\n {\n break;\n }\n\n ++drag;\n\n double time2 = p;\n time2 /= vd;\n\n time2 += wait;\n\n double delta2 = time2 * vp;\n p += delta2;\n }\n\n Console.WriteLine(drag);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n \n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n\n readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n \n\n void Solve()\n {\n var vp = (double)io.NextInt();\n var vd = (double)io.NextInt();\n var t = (double)io.NextInt();\n var f = (double)io.NextInt();\n var c = (double)io.NextInt();\n\n int res = 0;\n\n var x = 0.0;\n if (vp < vd)\n {\n \n\n while (c - x> 0)\n {\n x += (vp / (vd - vp) + 1.0) * t * vp;\n t = 2.0 * x / vd + f;\n\n\n\n if (c - x > 0)\n res++;\n }\n }\n\n io.Print(res);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication121\n{\n class Program\n {\n static void Main(string[] args)\n {\n var vp = int.Parse(Console.ReadLine());\n var vd = int.Parse(Console.ReadLine());\n var latency = double.Parse(Console.ReadLine());\n var f = int.Parse(Console.ReadLine());\n var c = int.Parse(Console.ReadLine());\n\n if (vp >= vd) \n { Console.Write(0);\n Environment.Exit(0);\n }\n var dv = 1.0 * vd - vp;\n\n var advantage = 0.0000000001 + latency * vp;\n var drugs = 0;\n while (advantage < c)\n {\n var t = advantage / dv;\n if (advantage + t * vp >= c) break;\n\n t = 2 * t + f;\n drugs++;\n advantage += t * vp;\n }\n Console.Write(drugs);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Escape\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int vp = Next(), vd = Next(), t = Next(), f = Next(), c = Next();\n\n t *= vp*vd;\n f *= vp * vd;\n c *= vp * vd;\n\n int count = 0;\n int p = 0;\n int d = 0;\n int ds = 0;\n int towait = t;\n while (true)\n {\n p += vp;\n\n if (ds == 0)\n {\n towait--;\n if (towait < 0)\n {\n ds = 1;\n d += vd;\n }\n }\n else if (ds == 1)\n {\n d += vd;\n }\n else\n {\n d -= vd;\n }\n\n if (d >= p)\n {\n if (d==p &&p==c)\n break;\n count++;\n ds = 2;\n d = p - (d - p);\n }\n\n if (ds == 2 && d <= 0)\n {\n d = -d;\n ds = 0;\n towait = f;\n }\n\n if (p >= c)\n {\n break;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\ndelegate double F(double x);\ndelegate decimal Fdec(decimal x);\n\nclass Edge\n{\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n}\n\nclass Program\n{//\n static void Main(string[] args)\n {\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if FileIO\n StreamReader sr = new StreamReader(\"forest.in\");\n StreamWriter sw = new StreamWriter(\"forest.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n double vp, vd, t, f, c;\n vp = double.Parse(Console.ReadLine());\n vd = double.Parse(Console.ReadLine());\n t = double.Parse(Console.ReadLine());\n f = double.Parse(Console.ReadLine());\n c = double.Parse(Console.ReadLine());\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n int ans = 0;\n double s = vp * t;\n double tt;\n double back_dist;\n while (s < c)\n {\n tt = s / (vd - vp);\n s += tt * vp;\n if (s < c) ans++;\n back_dist = tt * vd;\n s += vp * (back_dist / vd);\n s += f * vp;\n }\n Console.WriteLine(ans);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static decimal Sqrt(decimal x)\n {\n decimal mid;\n decimal right = (x <= 1 ? 1 : x);\n decimal left = 0;\n decimal eps = 0.00000000000000000001m;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2m);\n if (Math.Sign(mid * mid - x) != Math.Sign(left * left - x))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2m;\n }\n\n public static int[] FordBellman(int n, int v, Edge[] e)\n {\n int[] d = new int[n + 1];\n for (int i = 1; i <= n; i++)\n d[i] = int.MaxValue;\n d[v] = 0;\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < e.Length; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].b] > d[e[j].a] + e[j].w)\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n }\n }\n }\n }\n return d;\n }\n\n}\n\nstatic class ArrayUtils\n{\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(int[] A, int p, int q, int r, int[] L, int[] R)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i] <= R[j])\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(int[] A, int p, int r, int[] L, int[] R)\n {\n if (!(p < r)) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF105\n{\n // B\n class Escape\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n\n int bijous = 0;\n float xp = t * vp;\n float xd = 0;\n bool chasing = true;\n while (xp < c)\n {\n //Console.WriteLine(String.Format(\"xp={0}, xd={1}\", xp, xd));\n // If they meet this step\n if (chasing && (xp - xd) < (vd - vp))\n {\n float timeToMeet = (xd - xp) / (vp - vd);\n xd += timeToMeet * vd;\n xp += timeToMeet * vp;\n bijous++;\n chasing = false;\n }\n // If dragon gets back this step\n else if (!chasing && xd <= vd)\n {\n float timeToGetBack = xd / vd;\n xd = 0;\n xp += (timeToGetBack + f) * vp;\n chasing = true;\n }\n // Normal move turn\n else\n {\n xp += vp;\n\n if (chasing)\n xd += vd;\n else\n xd -= vd;\n }\n }\n\n Console.WriteLine(bijous);\n //Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace _105d2a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var vp = readInt();\n var vd = readInt();\n var t = readInt();\n var f = readInt();\n var c = readInt();\n\n if (vp >= vd)\n {\n Console.WriteLine(0); \n return;\n }\n\n var l = 0;\n var r = c;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var m = l + (r - l) / 2;\n var count = m;\n double start = vp * t;\n var can = false;\n while (true)\n {\n if (start >= c)\n {\n can = true;\n break;\n }\n\n var nmt = start / (double)(vd - vp);\n var pos = nmt * vd;\n\n if (pos >= c)\n {\n can = true;\n break;\n }\n\n if (count == 0)\n {\n can = false;\n break;\n }\n\n count--;\n start = pos + f * vp + nmt * vp;\n }\n\n if (can)\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n\n Console.WriteLine(l);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class B\n {\n private static object Go()\n {\n int vp = GetInt();\n int vd = GetInt();\n int t = GetInt();\n int f = GetInt();\n int c = GetInt();\n\n if (vd <= vp) return 0;\n\n double curr = vp * t;\n int ret = 0;\n while (curr < c)\n {\n double time = curr / (vd - vp);\n curr += time * vp;\n if (curr >= c) return ret;\n ret++;\n curr += (time + f) * vp;\n }\n\n return ret;\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n object output = Go();\n if (output != null)\n Wl(output.ToString());\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static void Wl(T o)\n {\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n public struct Tuple\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, double tf, int td, int c)\n\t\t{\n\t\t\tif (vs > vp)\n\t\t\t\treturn 0;\n\t\t\tint count = 0;\n\t\t\tint time = c/vs;\n\t\t\tdouble time1 = 0;\n\t\t\twhile (time1 < time){\n\t\t\t\ttime1 = (vp*tf) / ((vp - vs));\n\t\t\t\ttf = time1 - tf + td+ time1;\n\t\t\t\tif (time1 < time)\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeforcesSolution\n{\n public class Escape\n {\n public static void Main(string[] args)\n {\n int vp, vd, t, f, c;\n vp = int.Parse(Console.ReadLine());\n vd = int.Parse(Console.ReadLine());\n t = int.Parse(Console.ReadLine());\n f = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n int count = 0;\n if (vp < vd)\n {\n float pp = t * vp;\n while (pp < c)\n {\n float hour = (float)pp/(vd - vp);\n if (pp + (hour * vp) >= c)\n {\n break;\n }\n count++;\n pp += hour*vp;\n float hourd = (pp/vd) + f;\n pp += hourd*vp;\n\n }\n }\n Console.WriteLine(count);\n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n const double eps = 0.0000001;\n int vp, vd, t, f, c, res = 0;\n double tt, td;\n vp = int.Parse(Console.ReadLine());\n vd = int.Parse(Console.ReadLine());\n t = int.Parse(Console.ReadLine());\n f = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n if (vp >= vd)\n {\n Console.WriteLine(res);\n return;\n }\n tt = (vd * t) / (vd - vp);\n while (!(vp * tt > c - eps))\n {\n res++;\n td = tt + (vp * tt) / vd + f;\n tt = (vd * td) / (vd - vp);\n }\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF105D2B\n{\n class CF105D2B\n {\n public static void Main(string[] args)\n {\n EasyScanner sc = new EasyScanner(Console.In);\n double vp = sc.NextInt();\n double vd = sc.NextInt();\n double t = sc.NextInt();\n double f = sc.NextInt();\n double c = sc.NextInt();\n\n if (vp >= vd)\n {\n Console.Out.WriteLine(0);\n return;\n }\n\n double x = vp * t;\n x += vp * (x / (vd - vp));\n\n int count = 0;\n while (x < c)\n {\n count++;\n x += vp * (x / vd);\n x += vp * f;\n x += vp * (x / (vd - vp));\n }\n Console.Out.WriteLine(count);\n }\n }\n\n class EasyScanner\n {\n private TextReader reader;\n private Queue tokens;\n\n public EasyScanner(TextReader reader)\n {\n this.reader = reader;\n this.tokens = new Queue();\n }\n\n private void MaybeReadLine()\n {\n if (tokens.Count > 0)\n {\n return;\n }\n string line = reader.ReadLine();\n foreach (string token in line.Split())\n {\n tokens.Enqueue(token);\n }\n }\n\n public int NextInt()\n {\n MaybeReadLine();\n string token = tokens.Dequeue();\n return int.Parse(token);\n }\n\n public long NextLong()\n {\n MaybeReadLine();\n string token = tokens.Dequeue();\n return long.Parse(token);\n }\n\n public double NextDouble()\n {\n MaybeReadLine();\n string token = tokens.Dequeue();\n return double.Parse(token);\n }\n\n public string NextString()\n {\n MaybeReadLine();\n string token = tokens.Dequeue();\n return token;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass B105\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tint p = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\tint t = int.Parse(Console.ReadLine());\n\t\t\tint f = int.Parse(Console.ReadLine());\n\t\t\tint c = int.Parse(Console.ReadLine());\n\n\t\t\tif (p >= d)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdouble r = 0;\n\t\t\tdouble r1 = p * t; // \u043e\u0442\u043e\u0448\u043b\u0430\n\n\t\t\tdouble t1 = (r + r1) / (d - p); // \u0434\u043e\u0433\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437\n\t\t\tdouble t2 = 0;\n\t\t\tdouble r2 = t1 * p;\t// \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0448\u043b\u0430\n\t\t\tr = r + r1 + r2; // \u0443\u0448\u043b\u0430 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\n\n\t\t\twhile ( Math.Abs(c - r) > 1e-12 && c > r)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\tt2 = r / d + f; // \u0434 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\n\t\t\t\tr1 = p * t2;\t// \u043f \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0448\u043b\u0430 \u0435\u0449\u0435 \u043d\u0430\n\t\t\t\tt1 = (r + r1) / (d - p); // \u0434\u043e\u0433\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437\n\t\t\t\tr2 = t1 * p;\t// \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0448\u043b\u0430\n\t\t\t\tr = r + r1 + r2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\n//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\n\n\nclass c105_p2\n{\n static void Main()\n {\n //Console.SetIn(new StreamReader(new FileStream(\"../../in.txt\", FileMode.Open)));\n //StreamWriter out_sw = new StreamWriter(new FileStream(\"../../out.txt\", FileMode.Create));\n //Console.SetOut(out_sw);\n\n int vp = int.Parse(Console.In.ReadLine());\n int vd = int.Parse(Console.In.ReadLine());\n int t = int.Parse(Console.In.ReadLine());\n int f = int.Parse(Console.In.ReadLine());\n int c = int.Parse(Console.In.ReadLine());\n\n if (vp > vd)\n {\n Console.Out.WriteLine(0);\n return;\n }\n\n if (vp == vd)\n {\n if (t == 0) Console.Out.WriteLine(1);\n else Console.Out.WriteLine(0);\n return;\n }\n\n double d = t*vp;\n int counter = 0;\n while (true)\n {\n double go_t = d / (vd - vp);\n d += go_t * vp;\n if (d >= c) break;\n counter ++;\n d += ((d / vd) + f) * vp;\n }\n\n Console.Out.WriteLine(counter);\n\n //out_sw.Close();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int coins = 0;\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n double t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n \n while (true)\n {\n double m = t * vp;\n double n = m / (vd - vp);\n double di = n * vd;\n if(di vd) return 0;\n int number = 0;\n double s = 0;\n while (s < c)\n {\n s += vd * t / (vd - vp)* vp; \n t = s/ vd * 2 + Double.Parse(f1);\n if (s < c)\n number++;\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var vp = ReadInt();\n var vd = ReadInt();\n var t = ReadInt();\n var f = ReadInt();\n var c = ReadInt();\n var res = 0;\n var curT = (float)t;\n if(vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n while (true)\n {\n var time = (float) curT*vp/(vd - vp);\n\n var dist = (curT + time)*vp;\n if(dist >=c)\n break;\n\n res++;\n curT += time + dist/vd + f;\n }\n Console.WriteLine(res);\n }\n\n }\n}"}, {"source_code": "using System;\n\nnamespace testOlymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n double w = int.Parse(Console.ReadLine());\n double v = int.Parse(Console.ReadLine());\n double t = int.Parse(Console.ReadLine());\n double f = int.Parse(Console.ReadLine());\n double c = int.Parse(Console.ReadLine());\n\n int count = 0;\n if (v > w)\n {\n for (double s = t * w * (1.0 + v / (v - w)); s < c; s += t * w)\n {\n count++;\n t = s / v + f + s / (v - w);\n }\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n\n if (vp >= vd) \n { \n Console.WriteLine(0);\n return;\n }\n\n float posp = vp * t;\n float posd = 0;\n\n int res = 0;\n\n while (posp < c)\n {\n posp = posp + vp * (posp / (vd - vp));\n if (posp < c) res++;\n posp += vp * (f + posp / vd);\n }\n\n Console.WriteLine(res);\n\n }\n }\n}\n "}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n double vp = Convert.ToDouble(Console.ReadLine());\n double vd = Convert.ToDouble(Console.ReadLine());\n double t = Convert.ToDouble(Console.ReadLine());\n double f = Convert.ToDouble(Console.ReadLine());\n double c = Convert.ToDouble(Console.ReadLine());\n double put = t * vp;\n if(vp>=vd)\n {\n Console.WriteLine(0);\n return;\n }\n double otr = put;\n double prom;\n int dr = 0;\n //int dput = 0;\n while (put < c)\n {\n prom = vd - vp;\n prom = put / prom;\n prom = prom * vp;\n put += prom;\n if (put >= c)\n {\n Console.WriteLine(dr);\n //Console.ReadKey();\n return;\n }\n else\n {\n dr++;\n prom = put / vd;\n prom = vp * prom;\n put += prom;\n prom = vp * f;\n put += prom;\n otr = put;\n }\n }\n Console.WriteLine(dr);\n //Console.ReadKey();\n return;\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n string g = f();\n Console.WriteLine(g);\n Console.ReadLine();\n\n }\n\n public static string f()\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n float t1 = t;\n float t2 = 0;\n int tp = 0;\n if (vd < vp)\n {\n return \"0\";\n }\n for (int i = 1; i < 1000; i++)\n {\n t2 = Math.Abs((vp*t1) / (vd - vp));\n if ((vp * t2+vp*t1) >= c)\n {\n return tp.ToString();\n }\n tp=tp+1;\n t1 = t1 + t2 + f + t2; \n }\n return \"\";\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace J\n{\n class Program\n {\n static void Main(string[] args)\n {\n int vp = Convert.ToInt32(Console.ReadLine());\n int vd = Convert.ToInt32(Console.ReadLine());\n int t = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n double l = c - t * vp;\n double ft = ((double)c / vp) - t;\n int s = 0;\n double tempt;\n if (vp > vd)\n {\n Console.WriteLine(0);\n }\n else\n {\n while (true)\n {\n tempt = (double)(c - l) / (vd - vp);\n ft -= tempt;\n if (ft > 0)\n {\n s++;\n }\n l = l - (2 * tempt + f) * vp;\n ft -= tempt;\n ft -= f;\n if (ft <= 0)\n {\n break;\n }\n\n }\n Console.WriteLine(s);\n }\n\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() { \n var vp = int.Parse(Console.ReadLine()); \n var vd = int.Parse(Console.ReadLine()); \n var latency = double.Parse(Console.ReadLine()); \n var f = int.Parse(Console.ReadLine()); \n var c = int.Parse(Console.ReadLine()); \n\n if (vp >= vd) { Console.Write(0); return; }\n var dv = 1.0*vd - vp;\n\n var advantage = 0.0000000001 + latency*vp;\n var drugs = 0;\n while (advantage < c) {\n var t = advantage / dv;\n if (advantage + t*vp >= c) break;\n\n t = 2*t + f;\n drugs++;\n advantage += t * vp;\n }\n Console.Write(drugs);\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _105b\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public double nextDouble()\n {\n return (double)nextInt();\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n double vp = 1;// sc.nextDouble();\n double vd = 2;// sc.nextDouble();\n double t = 1;// sc.nextDouble();\n double f = 1;// sc.nextDouble();\n double c = 10;// sc.nextDouble();\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n int count = 0;\n double H;\n double t0;\n H = vp * t;\n while (true)\n {\n t0 = H / (vd - vp);\n\n H += vp * t0;\n\n if (H >= (double)c)\n {\n Console.WriteLine(count);\n return;\n }\n else\n {\n count++;\n t0 = (H / vd) + f;\n H += vp * t0;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n double vp = Convert.ToDouble(Console.ReadLine());\n double vd = Convert.ToDouble(Console.ReadLine());\n double t = Convert.ToDouble(Console.ReadLine());\n double f = Convert.ToDouble(Console.ReadLine());\n double c = Convert.ToDouble(Console.ReadLine());\n double put = t * vp;\n if(vp==vd)\n {\n Console.WriteLine(0);\n return;\n }\n double otr = put;\n double prom;\n int dr = 0;\n //int dput = 0;\n while (put < c)\n {\n prom = vd - vp;\n prom = put / prom;\n prom = prom * vp;\n put += prom;\n if (put >= c)\n {\n Console.WriteLine(dr);\n //Console.ReadKey();\n return;\n }\n else\n {\n dr++;\n prom = put / vd;\n prom = vp * prom;\n put += prom;\n prom = vp * f;\n put += prom;\n otr = put;\n }\n }\n Console.WriteLine(dr);\n //Console.ReadKey();\n return;\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n string g = f();\n Console.WriteLine(g);\n Console.ReadLine();\n\n }\n\n public static string f()\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int t1 = t;\n int t2 = 0;\n int tp = 0;\n for (int i = 1; i < 1000; i++)\n {\n t2 = Math.Abs((vp*t1 - vd*t1) / (vd - vp));\n if ((vp * t2+vp*t1) >= c)\n {\n return tp.ToString();\n }\n tp++;\n t1 = t1 + t2 + f + (t1 + t2) / vd; \n }\n return \"\";\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n string g = f();\n Console.WriteLine(g);\n Console.ReadLine();\n\n }\n\n public static string f()\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n float t1 = t;\n float t2 = 0;\n int tp = 0;\n for (int i = 1; i < 1000; i++)\n {\n t2 = Math.Abs((vp*t1) / (vd - vp));\n if ((vp * t2+vp*t1) >= c)\n {\n return tp.ToString();\n }\n tp=tp+1;\n t1 = t1 + t2 + f + t2; \n }\n return \"\";\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n string g = f();\n Console.WriteLine(g);\n Console.ReadLine();\n\n }\n\n public static string f()\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int t1 = t;\n int t2 = 0;\n int tp = 0;\n for (int i = 1; i < 1000; i++)\n {\n t2 = Math.Abs((vp*t1 - vd*t1) / (vd - vp));\n if ((vp * t2+vp*t1) >= c)\n {\n return tp.ToString();\n }\n tp++;\n t1 = t1 + t2 + i + (t1 + t2) / vd; \n }\n return \"\";\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace J\n{\n class Program\n {\n static void Main(string[] args)\n {\n int vp = Convert.ToInt32(Console.ReadLine());\n int vd = Convert.ToInt32(Console.ReadLine());\n int t = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n double l = c - t * vp;\n double ft = ((double)c / vp) - t;\n int s = 0;\n double tempt;\n while (true)\n {\n tempt = (double)(c - l) / (vd - vp);\n ft -= tempt;\n if (ft > 0)\n {\n s++;\n }\n l = l - (2*tempt+f) * vp;\n ft -= tempt;\n ft -= f;\n if (ft <= 0)\n {\n break;\n }\n\n }\n Console.WriteLine(s);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine().Trim());\n int vd = int.Parse(Console.ReadLine().Trim());\n int late = int.Parse(Console.ReadLine().Trim());\n int wait = int.Parse(Console.ReadLine().Trim());\n int distance = int.Parse(Console.ReadLine().Trim());\n\n double p = vp * late;\n int drag = 0;\n\n while (p < distance)\n {\n double time1 = p;\n time1 /= (vd - vp);\n\n double delta = time1 * vp;\n\n p += delta;\n\n if (p >= distance)\n {\n break;\n }\n\n ++drag;\n\n double time2 = p;\n time2 /= vd;\n\n time2 += wait;\n\n double delta2 = time2 * vp;\n p += delta2;\n }\n\n Console.WriteLine(drag);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n \n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n\n readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n \n\n void Solve()\n {\n var vp = (double)io.NextInt();\n var vd = (double)io.NextInt();\n var t = (double)io.NextInt();\n var f = (double)io.NextInt();\n var c = (double)io.NextInt();\n\n int res = 0;\n\n if (vp < vd)\n {\n var fm = (vp * vp/ (vd - vp) + vp) * t;\n\n var coef = vd * vd / (vp * vp) - vd / vp;\n\n var coef1 = f * vd / coef;\n\n while (fm < c)\n {\n res++;\n\n fm = CalcNext(fm, coef, coef1);\n }\n }\n\n io.Print(res);\n }\n\n public double CalcNext(double prev, double coef, double coef1)\n {\n return (2*prev / coef + coef1) * 2.0 + prev;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n \n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n\n readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n \n\n void Solve()\n {\n var vp = (double)io.NextInt();\n var vd = (double)io.NextInt();\n var t = (double)io.NextInt();\n var f = (double)io.NextInt();\n var c = (double)io.NextInt();\n\n int res = 0;\n\n if (vp < vd)\n {\n \n\n while (c > 0)\n {\n var x = (vp / (vd - vp) + 1) * t * vp;\n t = 2 * x / vd + f;\n\n c -= x;\n\n if (c > 0)\n res++;\n }\n }\n\n io.Print(res);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF105\n{\n // B\n class Escape\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n\n int bijous = 0;\n float xp = t * vp;\n float xd = 0;\n bool chasing = true;\n while (xp < c + 1E-6)\n {\n Console.WriteLine(String.Format(\"xp={0}, xd={1}\", xp, xd));\n // If they meet this step\n if (chasing && xp - xd < vd - vp + 1E-6)\n {\n float timeToMeet = (xd - xp) / (vp - vd);\n xd += timeToMeet * vd;\n xp += timeToMeet * vp;\n bijous++;\n chasing = false;\n }\n // If dragon gets back this step\n else if (!chasing && xd <= vd + 1E-6)\n {\n float timeToGetBack = xd / vd;\n xd = 0;\n xp += (timeToGetBack + f) * vp;\n chasing = true;\n }\n // Normal move turn\n else\n {\n xp += vp;\n\n if (chasing)\n xd += vd;\n else\n xd -= vd;\n }\n }\n\n Console.WriteLine(bijous);\n //Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF105\n{\n // B\n class Escape\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n\n if (vp >= vd)\n {\n Console.WriteLine(0);\n return;\n }\n\n int bijous = 0;\n float xp = t * vp;\n float xd = 0;\n bool chasing = true;\n while (xp < c)\n {\n Console.WriteLine(String.Format(\"xp={0}, xd={1}\", xp, xd));\n // If they meet this step\n if (chasing && xp - xd < vd - vp)\n {\n float timeToMeet = (xd - xp) / (vp - vd);\n xd += timeToMeet * vd;\n xp += timeToMeet * vp;\n bijous++;\n chasing = false;\n }\n // If dragon gets back this step\n else if (!chasing && xd <= vd)\n {\n float timeToGetBack = xd / vd;\n xd = 0;\n xp += (timeToGetBack + f) * vp;\n chasing = true;\n }\n // Normal move turn\n else\n {\n xp += vp;\n\n if (chasing)\n xd += vd;\n else\n xd -= vd;\n }\n }\n\n Console.WriteLine(bijous);\n //Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint sum = vs * tf;\n\t\t\tint sum2 = 0;\n\t\t\tstring align = \"race\";\n\t\t\tint time = (c - sum) / vs;\n\t\t\tint time1 = tf;\n\t\t\tint temp = 0;\n\t\t\twhile (time1 < time) {\n\t\t\t\tif (sum2 <= 0 && temp>0) {\n\t\t\t\t\tsum += vs;\n\t\t\t\t\talign = \"race\";\n\t\t\t\t\ttemp--;\n\t\t\t\t} \n\t\t\t\telse {\n\t\t\t\t\tif (align == \"race\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 += vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (align == \"home\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 -= vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (sum <= sum2) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\talign = \"home\";\n\t\t\t\t\t\ttemp = td;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttime1++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint S = 0;\n\t\t\twhile (S < c)\n\t\t\t{\n\t\t\t\tS += (-vs) * vp * tf / (vp - vs); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n\t\t\t\tif (S < c) \n\t\t\t\t\tcount++;\n\t\t\t\t// S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n\t\t\t\ttf = S / vs * 2 + td;\n\t\t\t}\n\t\t\treturn count-1;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint S = 0;\n\t\t\twhile (S < c)\n\t\t\t{\n\t\t\t\tS += (-vp) * vs * tf / (vs - vp); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n\t\t\t\tif (S < c) \n\t\t\t\t\tcount++;\n\t\t\t\t// S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n\t\t\t\ttf = S / vp * 2 + td;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint time = c/vs;\n\t\t\tint time1 = 0;\n\t\t\tint temp = tf;\n\t\t\twhile (time1< time){\n\t\t\t\ttime1 = (vp*temp) / ((vp - vs));\n\t\t\t\ttemp = 2*time1 - temp + tf;\n\t\t\t\tif (time1 < time)\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint S = 0;\n\t\t\twhile (S < c)\n\t\t\t{\n\t\t\t\tS += (-vp) * vs * tf / (vs - vp); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n\t\t\t\tif (S < c) \n\t\t\t\t\tcount++;\n\t\t\t\t// S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n\t\t\t\ttf = S / vp * 2 + td;\n\t\t\t}\n\t\t\treturn count-1;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint sum = vs * tf;\n\t\t\tint sum2 = 0;\n\t\t\tstring align = \"race\";\n\t\t\tint time = (c - sum) / vs;\n\t\t\tint time1 = tf;\n\t\t\tint temp = 0;\n\t\t\twhile (time1 < time) {\n\t\t\t\tif (sum2 <= 0 && temp>0) {\n\t\t\t\t\tsum += vs;\n\t\t\t\t\talign = \"race\";\n\t\t\t\t\ttemp--;\n\t\t\t\t} \n\t\t\t\telse {\n\t\t\t\t\tif (align == \"race\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 += vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (align == \"home\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 -= vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (sum == sum2) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\talign = \"home\";\n\t\t\t\t\t\ttemp = td;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttime1++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint sum = vs * tf;\n\t\t\tint sum2 = 0;\n\t\t\tstring align = \"race\";\n\t\t\tint time = (c) / vs;\n\t\t\tint time1 = tf;\n\t\t\tint temp = 0;\n\t\t\twhile (time1 < time) {\n\t\t\t\tif (sum2 <= 0 && temp>0) {\n\t\t\t\t\tsum += vs;\n\t\t\t\t\talign = \"race\";\n\t\t\t\t\ttemp--;\n\t\t\t\t} \n\t\t\t\telse {\n\t\t\t\t\tif (align == \"race\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 += vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (align == \"home\") {\n\t\t\t\t\t\tsum += vs;\n\t\t\t\t\t\tsum2 -= vp;\n\t\t\t\t\t}\n\t\t\t\t\tif (sum <= sum2) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\talign = \"home\";\n\t\t\t\t\t\ttemp = td;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttime1++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, double tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint time = c/vs;\n\t\t\tdouble time1 = 0;\n\t\t\twhile (time1 < time){\n\t\t\t\ttime1 = (vp*tf) / ((vp - vs));\n\t\t\t\ttf = time1 - tf + td+ time1;\n\t\t\t\tif (time1 < time)\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint sum = vs * tf;\n\t\t\tint sum2 = 0;\n\t\t\tstring align = \"race\";\n\t\t\tint time = c / vs;\n\t\t\tint time1 = tf;\n\t\t\tint temp = 0;\n\t\t\twhile (time1 < time) {\n\t\t\t\tsum += vs;\n\t\t\t\tif (align == \"race\")\n\t\t\t\t\tsum2 += vp;\n\t\t\t\tif (sum == sum2) {\n\t\t\t\t\talign = \"house\";\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif (align == \"house\")\n\t\t\t\t\tsum2 -= vp;\n\t\t\t\tif (sum <= 0) temp = time1 + td;\n\t\t\t\tif (temp==time1) align = \"race\";\n\t\t\t\ttime1++;\n\n\t\t\t}\n\n\n\n\t\t\treturn count;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olimpP\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint b = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint c = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint d = Convert.ToInt32 (Console.ReadLine());\n\t\t\tint e = Convert.ToInt32 (Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Func4 (a,b,c,d,e));\n\n\t\t}\n\n\t\tpublic static int Func4(int vs, int vp, int tf, int td, int c)\n\t\t{\n\t\t\tint count = 0;\n\t\t\tint sum = vs * tf;\n\t\t\tint sum2 = 0;\n\t\t\tstring align = \"race\";\n\t\t\tint time = c / vs;\n\t\t\tint time1 = tf;\n\t\t\tint temp = 0;\n\t\t\twhile (time1 <= time) {\n\t\t\t\tsum += vs;\n\t\t\t\tif (temp==time1) align = \"race\";\n\n\t\t\t\tif (align == \"race\")\n\t\t\t\t\tsum2 += vp;\n\t\t\t\tif (sum <= sum2) {\n\t\t\t\t\talign = \"house\";\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif (align == \"house\")\n\t\t\t\t\tsum2 -= vp;\n\t\t\t\tif (sum2<= 0) temp = time1 + td;\n\t\t\t\tif (temp==time1) align = \"race\";\n\t\t\t\ttime1++;\n\n\t\t\t}\n\n\n\n\t\t\treturn count-1;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass B105\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tint p = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\tint t = int.Parse(Console.ReadLine());\n\t\t\tint f = int.Parse(Console.ReadLine());\n\t\t\tint c = int.Parse(Console.ReadLine());\n\n\t\t\tdouble r = 0;\n\t\t\tdouble r1 = p * t; // \u043e\u0442\u043e\u0448\u043b\u0430\n\n\t\t\tdouble t1 = (r + r1) / (d - p); // \u0434\u043e\u0433\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437\n\t\t\tdouble t2 = 0;\n\t\t\tdouble r2 = t1 * p;\t// \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0448\u043b\u0430\n\t\t\tr = r + r1 + r2; // \u0443\u0448\u043b\u0430 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\n\n\t\t\twhile ( Math.Abs(c - r) > 1e-12 && c > r)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\tt2 = r / d + f; // \u0434 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\n\t\t\t\tr1 = p * t2;\t// \u043f \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0448\u043b\u0430 \u0435\u0449\u0435 \u043d\u0430\n\t\t\t\tt1 = (r + r1) / (d - p); // \u0434\u043e\u0433\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437\n\t\t\t\tr2 = t1 * p;\t// \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0448\u043b\u0430\n\t\t\t\tr = r + r1 + r2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\n//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\n\n\nclass c105_p2\n{\n static void Main()\n {\n //Console.SetIn(new StreamReader(new FileStream(\"../../in.txt\", FileMode.Open)));\n //StreamWriter out_sw = new StreamWriter(new FileStream(\"../../out.txt\", FileMode.Create));\n //Console.SetOut(out_sw);\n\n int vp = int.Parse(Console.In.ReadLine());\n int vd = int.Parse(Console.In.ReadLine());\n int t = int.Parse(Console.In.ReadLine());\n int f = int.Parse(Console.In.ReadLine());\n int c = int.Parse(Console.In.ReadLine());\n\n double d = t*vp;\n int counter = 0;\n while (true)\n {\n double go_t = d / (vd - vp);\n d += go_t * vp;\n if (d >= c) break;\n counter ++;\n d += ((d / vd) + f) * vp;\n }\n\n Console.Out.WriteLine(counter);\n\n //out_sw.Close();\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() { \n var vp = int.Parse(Console.ReadLine()); \n var vd = int.Parse(Console.ReadLine()); \n var latency = double.Parse(Console.ReadLine()); \n var f = int.Parse(Console.ReadLine()); \n var c = int.Parse(Console.ReadLine()); \n\n if (vp >= vd) { Console.Write(0); return; }\n var dv = 1.0*vd - vp;\n\n var advantage = 0.0000000001;\n var drugs = 0;\n while (advantage < c) {\n var t = advantage / dv;\n if (advantage + t*vp >= c) break;\n\n t = 2*t + f;\n drugs++;\n advantage += t * vp;\n }\n Console.Write(drugs);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication121\n{\n class Program\n {\n static void Main(string[] args)\n {\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int vd1=vd;\n int vp1=vp;\n int n = vp * t;\n n = n + vp;\n int p;\n int k = 0;\n for (int i = 2; i <=c/vp;)\n {\n if (n <= vd1)\n {\n k++;\n p = vd1 / vd;\n n = n +(p* vp)+(f*vp);\n i =i+p+f+1;\n vd1 = 0;\n }\n else\n {\n n = n + vp;\n vd1 = vd1 + vd;\n i++;\n }\n }\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Escape\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int vp = Next(), vd = Next(), t = Next(), f = Next(), c = Next();\n\n int count = 0;\n int p = 0;\n int d = 0;\n int ds = 0;\n int towait = t;\n while (true)\n {\n p += vp;\n if (p >= c)\n break;\n\n if (ds == 0)\n {\n towait--;\n if (towait < 0)\n {\n ds = 1;\n d = vd;\n }\n }\n else if (ds == 1)\n {\n d += vd;\n }\n else\n {\n d -= vd;\n }\n\n if (d >= p)\n {\n count++;\n ds = 2;\n d = p - (d - p);\n }\n\n if (ds == 2 && d <= 0)\n {\n d = 0;\n ds = 0;\n towait = f;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace _105d2a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var vp = readInt();\n var vd = readInt();\n var t = readInt();\n var f = readInt();\n var c = readInt();\n\n if (vp >= vd )\n {\n Console.WriteLine(0); \n return;\n }\n\n var l = 0;\n var r = c;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var m = l + (r - l) / 2;\n var count = m;\n var start = vp * t;\n var can = false;\n while (true)\n {\n if (start >= c)\n {\n can = true;\n break;\n }\n\n var nmt = start / (vd - vp);\n var pos = nmt * vd;\n\n if (pos >= c)\n {\n can = true;\n break;\n }\n\n if (count == 0)\n {\n can = false;\n break;\n }\n\n count--;\n start = pos + f * vp + nmt * vp;\n }\n\n if (can)\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n\n Console.WriteLine(l);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace _105d2a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var vp = readInt();\n var vd = readInt();\n var t = readInt();\n var f = readInt();\n var c = readInt();\n\n var l = 0;\n var r = c;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var m = l + (r - l) / 2;\n var count = m;\n var start = vp * t;\n var can = false;\n while (true)\n {\n if (start >= c)\n {\n can = true;\n break;\n }\n\n var nmt = start / (vd - vp);\n var pos = nmt * vd;\n\n if (pos >= c)\n {\n can = true;\n break;\n }\n\n if (count == 0)\n {\n can = false;\n break;\n }\n\n count--;\n start = pos + f * vp + nmt * vp;\n }\n\n if (can)\n {\n r = m;\n }\n else\n {\n l = m + 1;\n }\n }\n\n Console.WriteLine(l);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n double p = double.Parse(Console.ReadLine());\n double d = double.Parse(Console.ReadLine());\n double c = double.Parse(Console.ReadLine());\n double f = double.Parse(Console.ReadLine());\n double dic = double.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)<(i*p))\n {\n }\n else\n {\n op++;\n double iop = i * p;\n double iopd = iop / d;\n \n c = i + iopd+f;\n\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int coins = 0;\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n \n while (true)\n {\n double m = t * vp;\n double n = m / (vd - vp);\n double di = n * vd;\n if(di=1)\n {\n if(i+c>=dic)\n {\n break;\n }\n }\n else\n {\n op++;\n c = (((i/ d) + f) + (i));\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n\n\n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p) || (d - f) > p)\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n if (iopd == 0)\n { iopd = 1; }\n c = i + iopd + f;\n i = c;\n\n }\n else\n {\n\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n double c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)<(i*p))\n {\n }\n else\n {\n op++;\n\n double yy = (i * p) / (double)d;\n c = i + yy+f;\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n double p = double.Parse(Console.ReadLine());\n double d = double.Parse(Console.ReadLine());\n double c = double.Parse(Console.ReadLine());\n double f = double.Parse(Console.ReadLine());\n double dic = double.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)<(i*p))\n {\n }\n else\n {\n op++;\n\n double yy = ((i * p) / d) + f;\n c = i + yy;\n\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n\n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if ((p * (c + 1)) < (d))\n {\n opp++;\n c++;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)<(i*p))\n {\n }\n else\n {\n op++;\n int iop = i * p;\n int iopd = iop / d;\n \n c = i + iopd+f;\n\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)>=(i*p)|| (((i+1) - c) * d) > ((i+1) * p))\n {\n op++;\n int iop = i * p;\n int iopd = iop / d;\n\n c = i + iopd + f;\n\n }\n else\n {\n \n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int coins = 0;\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n \n if ((vp * (t + 1)) < (vd))\n {\n int y = (vd - (vp + t)) / vp;\n coins++;\n t = t + f;\n }\n for (int i = 1; i * vp < d; i++)\n {\n if (((i - t) * vd) >= (i * vp))\n {\n coins++;\n int iop = i * vp;\n int iopd = iop / vd;\n t = i + iopd + f;\n }\n }\n Console.WriteLine(coins);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n int y = c;\n for (int i = y; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d))\n {\n opp++;\n \n c += f;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n int y = c;\n for (int i = y+1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n if ((p * (c + 1)) < (d))\n {\n opp++;\n\n }\n else\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n \n }\n else\n {\n \n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n int y = c;\n for (int i = y+1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d))\n {\n opp++;\n \n c += f;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int coins = 0;\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n\n if ((vp * (t + 1)) < (vd))\n {\n int y = (vd - (vp + t)) / vp;\n coins++;\n t = t + f;\n }\n for (int i = 1; i * vp < d; i++)\n {\n if (((i - t) * vd) >= (i * vp))\n {\n coins++;\n int iop = i * vp;\n int iopd = iop / vd;\n t = i + iopd + f;\n }\n else\n {\n if(coins==0&&(i*vp)>(d*(i-t))&&i>1)\n {\n coins++;\n int iop = i * vp;\n int iopd = iop / vd;\n t = i + iopd + f;\n }\n }\n }\n Console.WriteLine(coins);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = 3;\n int d = 7;\n int c = 1;\n int f = 1;\n int dic = 12;\n\n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p) || (d - f) > p)\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n //if(iopd==0)\n //{ iopd = 1; }\n c = i + iopd + f;\n i = c;\n\n }\n else\n {\n\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n \n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n \n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n\n int rp = (dic - c) / p;\n int rd = dic / d;\n double rpd = (double)(rp - rd) / (2 * f);\n int re = (int)rpd;\n int ree = (rp - rd) % (2 * f);\n if(ree >(.5*(2*f)))\n {\n re = re + 1;\n }\n Console.WriteLine(re);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)>=(i*p)||(d-c)>p)\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n\n c = i + iopd + f;\n\n }\n else\n {\n \n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int coins = 0;\n int vp = int.Parse(Console.ReadLine());\n int vd = int.Parse(Console.ReadLine());\n int t = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n \n while (true)\n {\n double m = t * vp;\n double n = m / (vd - vp);\n double di = n * vd;\n if(di= (i * p) || (d - f) > p)\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n if (iopd == 0)\n { iopd = 1; }\n c = i + iopd + f;\n \n\n }\n else\n {\n\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)>=(i*p))\n {\n op++;\n int iop = i * p;\n int iopd = iop / d;\n\n c = i + iopd + f;\n\n }\n else\n {\n \n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n \n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d)&&i==1)\n {\n opp++;\n c++;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n \n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n \n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int pp = 5;\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n\n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d))\n {\n opp++;\n if (pp == 5)\n pp = 3;\n else\n c += f;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 22;\n\n\n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d))\n {\n opp++;\n c += f;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n //int p = 2;\n //int d = 7;\n //int c = 1;\n //int f = 1;\n //int dic = 26;\n\n \n for (int i = 1; i * p < dic; i++)\n {\n if (((i - c) * d) >= (i * p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n c = i + iopd + f;\n }\n else\n {\n if( (p*(c+1))<(d))\n {\n opp++;\n c=c+f;\n }\n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int opp = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n \n for (int i = 1; i*p < dic; i++)\n {\n if(((i-c)*d)>=(i*p))\n {\n opp++;\n int iop = i * p;\n int iopd = iop / d;\n\n c = i + iopd + f;\n\n }\n else\n {\n \n }\n }\n Console.WriteLine(opp);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dragon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int op = 0;\n int p = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n int dic = int.Parse(Console.ReadLine());\n double n = (double)d / p;\n for (int i = 1; i < 1000; i++)\n {\n if (((c*p) + i) / (n * i) >= 1)\n {\n if (i + c >= dic)\n {\n break;\n }\n }\n else\n {\n op++;\n c = (((i / d) + f) + (i));\n }\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();\n string vp = \"1\", vd = \"2\", t = \"1\", f = \"1\", c = \"8\";\n sw.Reset();\n int res;\n sw.Start();\n res = Money(vp, vd, t, f, c);\n sw.Stop();\n Console.WriteLine(\"{0}, {1}\", res, sw.Elapsed);\n Console.ReadLine();\n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n int t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n int S = 0;\n while (S < c)\n {\n S += (-vd) * vp * t / (vp - vd); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n if (S < c)\n number++;\n // S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n t = S / vd * 2 + Int32.Parse(f1);\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string vp = Console.ReadLine();\n string vd = Console.ReadLine();\n string t = Console.ReadLine();\n string f = Console.ReadLine();\n string c = Console.ReadLine();\n\n Console.WriteLine(Money(vp, vd, t, f, c));\n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n int t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n int time = 0, allTime = c / vp, s = 0;\n while (time < allTime)\n {\n time += vd * t / (vd - vp); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u0447\u0435\u0440\u0435\u0437 \u0432\u0440\u0435\u043c\u044f..\n if (time < allTime)\n number++;\n // S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n s = time * vp;\n t = s/ vd * 2 + Int32.Parse(f1);\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string vp = Console.ReadLine();\n string vd = Console.ReadLine();\n string t = Console.ReadLine();\n string f = Console.ReadLine();\n string c = Console.ReadLine();\n\n Console.WriteLine(Money(vp, vd, t, f, c));\n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n double t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n double time = 0, allTime = c / vp, s = 0;\n while (s < c)\n {\n s += vd * t / (vd - vp)* vp; \n t = s/ vd * 2 + Double.Parse(f1);\n if (s < c)\n number++;\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string vp = Console.ReadLine();\n string vd = Console.ReadLine();\n string t = Console.ReadLine();\n string f = Console.ReadLine();\n string c = Console.ReadLine();\n\n Console.WriteLine(Money(vp, vd, t, f, c));\n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n int t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n int time = 0, allTime = c / vp;\n while (time < allTime)\n {\n time += vp * t / (vd - vp); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u0447\u0435\u0440\u0435\u0437 \u0432\u0440\u0435\u043c\u044f..\n if (time < allTime)\n number++;\n // S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n t = time * 2 + Int32.Parse(f1);\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string vp = Console.ReadLine();\n string vd = Console.ReadLine();\n string t = Console.ReadLine();\n string f = Console.ReadLine();\n string c = Console.ReadLine();\n int res;\n res = Money(vp, vd, t, f, c);\n Console.WriteLine(res);\n \n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n int t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n int S = 0;\n while (S < c)\n {\n S += (-vd) * vp * t / (vp - vd); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n if (S < c)\n number++;\n // S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n t = S / vd * 2 + Int32.Parse(f1);\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string vp = Console.ReadLine();\n string vd = Console.ReadLine();\n string t = Console.ReadLine();\n string f = Console.ReadLine();\n string c = Console.ReadLine();\n\n Console.WriteLine(Money(vp, vd, t, f, c));\n }\n\n\n static public int Money(string vp1, string vd1, string t1, string f1, string c1)\n {\n int vp = Int32.Parse(vp1);\n int vd = Int32.Parse(vd1);\n int t = Int32.Parse(t1);\n int c = Int32.Parse(c1);\n int number = 0;\n int S = 0;\n while (S < c)\n {\n S += (-vd) * vp * t / (vp - vd); // \u0413\u0410\u0418 \u0434\u043e\u0433\u043e\u043d\u044f\u0442 \u0412\u0430\u0441\u044e \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 S\n if (S < c)\n number++;\n // S/vd + f \u043f\u043e\u0442\u0440\u0430\u0442\u044f\u0442 \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\n t = S / vd * 2 + Int32.Parse(f1);\n }\n return number;\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string n = Console.ReadLine();\n \n Console.WriteLine(Type(n));\n\n }\n static public string Type(string number)\n {\n string res = \"\";\n try\n {\n Int64 c = Convert.ToInt64(number);\n if (c >= -128 && c <= 127) res = \"byte\";\n else if (c >= -32768 && c <= 32767) res = \"short\";\n else if (c >= -2147483648 && c <= 2147483647) res = \"int\";\n else if (c >= -9223372036854775808 && c <= 9223372036854775807) res = \"long\";\n return res;\n }\n catch (OverflowException)\n {\n return \"BigInteger\";\n }\n \n\n }\n }\n}\n"}], "src_uid": "c9c03666278acec35f0e273691fe0fff"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class _689A\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n var seq = Console.ReadLine().Select(x => (x-'0')).ToList();\n int[] left = new int[] {-1, -1, 1, 2, -1, 4, 5, -1, 7, 8 };\n int[] right = new int[] {-1, 2, 3, -1, 5, 6, -1, 8, 9, -1};\n int[] up = new int[] {8, -1, -1, -1, 1, 2, 3, 4, 5, 6 };\n int[] down = new int[] {-1, 4, 5, 6, 7, 8, 9, -1, 0, -1 };\n if (isCorrect(seq, left) || isCorrect(seq, right) || isCorrect(seq, up) || isCorrect(seq, down))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n static bool isCorrect(List source, int[] mode)\n {\n foreach(var x in source)\n {\n int to = mode[x];\n if (to == -1)\n return false;\n }\n return true;\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.IO;\nusing System.Net;\n\nnamespace ConsoleApplication6\n{\n class Program\n { static int[] ceni;\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int[] nabor = new int[n];\n int[] vertik = new int[n];\n int[] gorizont = new int[n];\n for (int i = 0; i < n; i++) {\n nabor[i] = Convert.ToInt32(str[i].ToString());\n \n \n }\n for (int i = 0; i < n; i++) {\n if (nabor[i] % 3 > 0) {\n vertik[i] = nabor[i] % 3;\n gorizont[i] = (nabor[i] / 3) + 1;\n \n }\n else {\n \n if (nabor[i] > 0)\n { gorizont[i] = (nabor[i] / 3);\n vertik[i] = 3;\n \n }\n else {\n vertik[i] = 2;\n gorizont[i] = 4; }\n }\n }\n int maxvertik = vertik.Max();\n int minvertik = vertik.Min();\n int maxgorizont = gorizont.Max();\n int mingorizont = gorizont.Min();\n bool sdvigg=true;\n bool sdvigv=true;\n \n if((mingorizont==1)&&(maxgorizont==4)){\n sdvigv = false;\n sdvigg = false;\n }\n if ((mingorizont == 1) && (maxgorizont == 3)) {\n for(int i=0;i>()\n {\n {'1', new Tuple(0,0)},\n {'2', new Tuple(1,0)},\n {'3', new Tuple(2,0)},\n {'4', new Tuple(0,1)},\n {'5', new Tuple(1,1)},\n {'6', new Tuple(2,1)},\n {'7', new Tuple(0,2)},\n {'8', new Tuple(1,2)},\n {'9', new Tuple(2,2)},\n {'0', new Tuple(1,3)},\n };\n \n var coords = dict[number[0]]; \n var xBeg = coords.Item1;\n var yBeg = coords.Item2;\n coords = dict[number[1]];\n var xEnd = coords.Item1;\n var yEnd = coords.Item2;\n var xPath = xEnd - xBeg;\n var yPath = yEnd - yBeg;\n var paths = FindInitialPaths(xBeg, yBeg, xPath, yPath);\n if(paths.Count == 0)\n Console.WriteLine(\"YES\");\n else\n {\n bool print = true;\n bool success = true;\n foreach (var tuple in paths)\n {\n var nextCoord = new Tuple(tuple.Item1, tuple.Item2);\n success = true;\n for (int i = 1; i < number.Length - 1; i++)\n {\n coords = dict[number[i]]; \n xBeg = coords.Item1;\n yBeg = coords.Item2;\n coords = dict[number[i+1]];\n xEnd = coords.Item1;\n yEnd = coords.Item2;\n xPath = xEnd - xBeg;\n yPath = yEnd - yBeg;\n nextCoord = NextCoord(nextCoord.Item1, nextCoord.Item2, xPath, yPath);\n if (nextCoord.Item1 == -1 && nextCoord.Item2 == -1)\n {\n success = false;\n break;\n }\n }\n if (success)\n {\n Console.WriteLine(\"NO\");\n print = false;\n break;\n }\n }\n if(print)\n Console.WriteLine(\"YES\");\n \n }\n }\n }\n\n static List> FindInitialPaths(int x, int y, int xPath, int yPath)\n {\n var list = new List>();\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (!(i == x && j == y) && !(i==0 && j==3) && !(i==2 && j==3))\n {\n var nX = i + xPath;\n var nY = j + yPath;\n\n if((nX>=0 && nX<=2&&nY>=0 && nY<=2) || (nX == 1 && nY == 3))\n list.Add(new Tuple(nX, nY));\n }\n }\n }\n return list;\n }\n\n static Tuple NextCoord(int x, int y, int xPath, int yPath)\n {\n var nX = x + xPath;\n var nY = y + yPath;\n if ((nX >= 0 && nX <= 2 && nY >= 0 && nY <= 2) || (nX == 1 && nY == 3))\n return new Tuple(nX, nY);\n return new Tuple(-1,-1);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public string[] ReadStringArray()\n {\n return this.ReadLine().Split(' ').ToArray();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(\"input.txt\");\n //_writer = new StreamWriter(\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private bool result = false;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/problemset/problem/688/A\n\n var n = _reader.ReadInt();\n var s = _reader.ReadString();\n\n result = ShiftLeft(s) || ShiftRight(s) || ShiftUp(s) || ShiftDown(s);\n result = !result;\n\n return this;\n }\n\n private bool ShiftDown(string s)\n {\n return !s.Replace('0', '-').Replace('7', '-').Replace('9', '-').Contains(\"-\");\n }\n\n private bool ShiftUp(string s)\n {\n return !s.Replace('1', '-').Replace('2', '-').Replace('3', '-').Contains(\"-\");\n }\n\n private bool ShiftRight(string s)\n {\n return !s.Replace('0', '-').Replace('3', '-').Replace('6', '-').Replace('9', '-').Contains(\"-\");\n }\n\n private bool ShiftLeft(string s)\n {\n return !s.Replace('0', '-').Replace('1', '-').Replace('4', '-').Replace('7', '-').Contains(\"-\");\n }\n\n public override void OutputResult()\n {\n string answer = result ? \"YES\" : \"NO\";\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string buf = Console.ReadLine();\n string st = Console.ReadLine();\n bool left, right, down, up;\n left = right = down = up = true;\n if (st.Contains(\"1\") || st.Contains(\"4\") || st.Contains(\"7\") || st.Contains(\"0\"))\n {\n left = false;\n }\n if (st.Contains(\"3\") || st.Contains(\"6\") || st.Contains(\"9\") || st.Contains(\"0\"))\n {\n right = false;\n }\n if (st.Contains(\"1\") || st.Contains(\"2\") || st.Contains(\"3\"))\n {\n up = false;\n }\n if (st.Contains(\"7\") || st.Contains(\"0\") || st.Contains(\"9\"))\n {\n down = false;\n }\n if (left || right || down || up)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n private int n;\n private string s;\n private static int[,] pos = { { 3, 1 }, { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, 1 }, { 1, 2 }, { 2, 0 }, { 2, 1 }, { 2, 2 } };\n\n public void ReadInput()\n {\n n = Convert.ToInt32(Console.ReadLine());\n s = Console.ReadLine();\n }\n\n public bool MatchRecursively(int curNum, int curStrPos)\n {\n if (curStrPos == s.Length - 1) return true;\n\n int num1 = (int)Char.GetNumericValue(s[curStrPos]);\n int num2 = (int)Char.GetNumericValue(s[curStrPos + 1]);\n int diff1 = pos[num2, 0] - pos[num1, 0];\n int diff2 = pos[num2, 1] - pos[num1, 1];\n int newCurPos1 = pos[curNum, 0] + diff1;\n int newCurPos2 = pos[curNum, 1] + diff2;\n int newCurNum;\n if (newCurPos1 >= 0 && newCurPos1 <= 3 && newCurPos2 >= 0 && newCurPos2 <= 2) newCurNum = newCurPos1 * 3 + newCurPos2 + 1;\n else return false;\n if (newCurNum >= 1 && newCurNum <= 9) return MatchRecursively(newCurNum, curStrPos + 1);\n else if (newCurNum == 11) return MatchRecursively(0, curStrPos + 1);\n else return false;\n \n }\n\n static void Main(string[] args)\n {\n\n bool fl = true;\n\n Program p = new Program();\n p.ReadInput();\n\n for (int i = 0; i <= 9; i++)\n {\n if (i == (int)Char.GetNumericValue(p.s[0])) continue;\n if (p.MatchRecursively(i, 0)) { Console.WriteLine(\"NO\"); fl = false; break; }\n }\n\n if (fl) Console.WriteLine(\"YES\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _689A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n List digits = new List();\n\n int[] rows = { 3, 0, 0, 0, 1, 1, 1, 2, 2, 2 };\n int[] cols = { 1, 0, 1, 2, 0, 1, 2, 0, 1, 2 };\n\n for (int i = 0; i < n;i++)\n {\n if (!digits.Contains((int)(s[i] - '0'))) digits.Add((int)(s[i] - '0'));\n }\n\n int minrow = digits.Select(d => rows[d]).Min();\n int maxrow = digits.Select(d => rows[d]).Max();\n int mincol = digits.Select(d => cols[d]).Min();\n int maxcol = digits.Select(d => cols[d]).Max();\n\n if (minrow > 0 || maxrow < 2 || (mincol > 0 && maxrow < 3) || (maxcol < 2 && maxrow < 3) || (maxrow == 2 && !digits.Contains(7) && !digits.Contains(9)))\n {\n Console.WriteLine(\"NO\");\n }\n else \n {\n Console.WriteLine(\"YES\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n string s = input.NextToken();\n var r = new int[] { 4, 1, 1, 1, 2, 2, 2, 3, 3, 3 };\n var c = new int[] { 2, 1, 2, 3, 1, 2, 3, 1, 2, 3 };\n string[] m = new string[]\n {\n \".....\",\n \".123.\",\n \".456.\",\n \".789.\",\n \"..0..\",\n \".....\"\n };\n for (int dx = -1; dx <= 1; dx++)\n {\n for (int dy = -1; dy <= 1; dy++)\n {\n if (dx == 0 && dy == 0)\n continue;\n bool canShift = true;\n for (int i = 0; i < n; i++)\n {\n int d = s[i] - '0';\n if (m[r[d] + dx][c[d] + dy] == '.')\n {\n canShift = false;\n break;\n }\n }\n if (canShift)\n {\n Console.Write(\"NO\");\n return;\n }\n }\n }\n Console.Write(\"YES\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\t//DON'T FORGET TO SET IT TO FALSE BEFORE SUBMIT!!!!\n\t\tpublic const bool useFiles = false;\n\n\t\tprivate static StreamReader GetStandardInputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamReader(@\"in.txt\")\n\t\t\t\t: new StreamReader(Console.OpenStandardInput());\n\t\t}\n\n\t\tprivate static StreamWriter GetStandardOutputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamWriter(@\"out.txt\")\n\t\t\t\t: new StreamWriter(Console.OpenStandardOutput());\n\t\t}\n\n\n\t\tpublic class MyComparer : IComparer>\n\t\t{\n\t\t\tpublic int Compare(Tuple x, Tuple y)\n\t\t\t{\n\t\t\t\tif (x.Item2 > y.Item2)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse if (x.Item2 == y.Item2)\n\t\t\t\t{\n\t\t\t\t\tif (x.Item1 > y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (x.Item1 == y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Graph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic Graph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tadj[i] = new List();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int v, int w)\n\t\t\t{\n\t\t\t\tadj[v].Add(w);\n\t\t\t\tadj[w].Add(v);\n\t\t\t}\n\n\t\t\tpublic int[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNode\n\t\t{\n\t\t\tpublic int Weight { get; set; }\n\n\t\t\tpublic int A { get; set; }\n\t\t\tpublic int B { get; set; }\n\n\t\t\tpublic int GetOther(int s)\n\t\t\t{\n\t\t\t\treturn A == s\n\t\t\t\t\t? B\n\t\t\t\t\t: A;\n\t\t\t}\n\n\t\t\tpublic override string ToString()\n\t\t\t{\n\t\t\t\treturn string.Format(\"{0} -> {1} (W: {2})\", this.A, this.B, this.Weight);\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedGraph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic WeightedGraph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t\tadj[i] = new List();\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int x, int y, int w)\n\t\t\t{\n\t\t\t\tvar node = new WeightedNode()\n\t\t\t\t{\n\t\t\t\t\tA = x,\n\t\t\t\t\tB = y,\n\t\t\t\t\tWeight = w\n\t\t\t\t};\n\n\t\t\t\tadj[x].Add(node);\n\t\t\t\tadj[y].Add(node);\n\t\t\t}\n\n\t\t\tpublic WeightedNode[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class DFS\n\t\t{\n\t\t\tprivate Queue q;\n\t\t\tprivate bool[] marked;\n\t\t\tprivate int[] distTo;\n\n\t\t\tpublic DFS(Graph g, int s)\n\t\t\t{\n\t\t\t\tq = new Queue();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tdistTo = new int[g.V()];\n\n\t\t\t\tq.Enqueue(s);\n\t\t\t\tmarked[s] = true;\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\twhile (q.Any())\n\t\t\t\t{\n\t\t\t\t\tvar cur = q.Dequeue();\n\t\t\t\t\tvar adj = g.GetAdj(cur);\n\n\t\t\t\t\tforeach (var v in adj)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tq.Enqueue(v);\n\t\t\t\t\t\t\tmarked[v] = true;\n\t\t\t\t\t\t\tdistTo[v] = distTo[cur] + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic int GetDistance(int v)\n\t\t\t{\n\t\t\t\treturn marked[v] ? distTo[v] : -1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNodeComparor : IComparer\n\t\t{\n\t\t\tpublic int Compare(WeightedNode x, WeightedNode y)\n\t\t\t{\n\t\t\t\tvar res = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (res != 0)\n\t\t\t\t\treturn res;\n\n\t\t\t\tvar r1 = x.A.CompareTo(y.A);\n\t\t\t\tvar r2 = x.B.CompareTo(y.B);\n\n\t\t\t\tif (r1 == 0 && r2 == 0)\n\t\t\t\t\treturn 0;\n\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class PrimsMST\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate List res;\n\t\t\tprivate SortedList sl;\n\n\t\t\tpublic PrimsMST(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tres = new List();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tsl = new SortedList(new WeightedNodeComparor());\n\n\t\t\t\tmarked[s] = true;\n\t\t\t\tVisit(g, s);\n\n\t\t\t\twhile (sl.Any() && res.Count() < g.V() - 1)\n\t\t\t\t{\n\t\t\t\t\tvar next = sl.First();\n\t\t\t\t\tsl.Remove(next.Key);\n\n\t\t\t\t\tvar val = next.Value;\n\n\t\t\t\t\tif (marked[val.A] && marked[val.B])\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tres.Add(val);\n\n\t\t\t\t\tif (!marked[val.A])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.A] = true;\n\t\t\t\t\t\tVisit(g, val.A);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!marked[val.B])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.B] = true;\n\t\t\t\t\t\tVisit(g, val.B);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tpublic void Visit(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tforeach (var v in g.GetAdj(s))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v.GetOther(s)])\n\t\t\t\t\t\tsl.Add(v, v);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic List GetMST()\n\t\t\t{\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t}\n\n\t\tpublic class DoubleComaprer : IComparer\n\t\t{\n\t\t\tpublic int Compare(double x, double y)\n\t\t\t{\n\t\t\t\treturn x.CompareTo(y);\n\t\t\t}\n\t\t}\n\n\t\tpublic struct TempItem\n\t\t{\n\t\t\tpublic long Weight { get; set; }\n\t\t\tpublic int Vertex { get; set; }\n\t\t}\n\n\t\tpublic class TempItemComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(TempItem x, TempItem y)\n\t\t\t{\n\t\t\t\tvar r = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (r != 0)\n\t\t\t\t\treturn r;\n\n\t\t\t\tvar r2 = x.Vertex.CompareTo(y.Vertex);\n\t\t\t\treturn r2;\n\t\t\t}\n\t\t}\n\n\t\tpublic class DejkstraSP\n\t\t{\n\t\t\tpublic long?[] distTo;\n\t\t\tprivate int[] edgeTo;\n\t\t\tprivate SortedList pq;\n\n\t\t\tpublic DejkstraSP(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tdistTo = new long?[g.V()];\n\t\t\t\tedgeTo = new int[g.V()];\n\t\t\t\tpq = new SortedList(new TempItemComparer());\n\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\tpq.Add(new TempItem() { Vertex = s, Weight = 0 }, s);\n\t\t\t\twhile (pq.Any())\n\t\t\t\t{\n\t\t\t\t\tvar v = pq.First();\n\t\t\t\t\tpq.Remove(v.Key);\n\n\t\t\t\t\tforeach (var edge in g.GetAdj(v.Value))\n\t\t\t\t\t{\n\t\t\t\t\t\trelax(edge, v.Value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tprivate void relax(WeightedNode v, int cur)\n\t\t\t{\n\t\t\t\tint a = cur;\n\t\t\t\tint b = v.GetOther(cur);\n\n\t\t\t\tif (distTo[b] == null || distTo[b] > distTo[a] + v.Weight)\n\t\t\t\t{\n\t\t\t\t\tdistTo[b] = distTo[a] + v.Weight;\n\t\t\t\t\tedgeTo[b] = a;\n\n\t\t\t\t\tif (pq.ContainsValue(b))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar val = pq.First(x => x.Value == b);\n\t\t\t\t\t\tpq.Remove(val.Key);\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var input = GetStandardInputStream())\n\t\t\tusing (var output = GetStandardOutputStream())\n\t\t\t{\n\t\t\t\tvar n = ParseInt(input);\n\t\t\t\tvar otherNums = input.ReadLine().ToCharArray().Select(x => int.Parse(x.ToString())).ToArray();\n\n\t\t\t\tvar arr = new bool[10];\n\n\t\t\t\tforeach (var otherNum in otherNums)\n\t\t\t\t{\n\t\t\t\t\tarr[otherNum] = true;\n\t\t\t\t}\n\n\t\t\t\tvar flag1 = false;\n\t\t\t\tvar flag2 = false;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && (arr[7] || arr[9]))\n\t\t\t\t\tflag1 = true;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && arr[0])\n\t\t\t\t{\n\t\t\t\t\toutput.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\tif ((arr[1] || arr[4] || arr[7]) && (arr[3] || arr[6] || arr[9]))\n\t\t\t\t\tflag2 = true;\n\n\t\t\t\tif (flag1 && flag2)\n\t\t\t\t\toutput.WriteLine(\"YES\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\toutput.WriteLine(\"NO\");\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tprivate static double getDist(Tuple c1, Tuple c2)\n\t\t{\n\t\t\treturn Math.Sqrt(Math.Pow(c1.Item1 - c2.Item1, 2.0) + Math.Pow(c1.Item2 - c2.Item2, 2.0));\n\t\t}\n\n\t\tprivate static Tuple GetCoord(int number)\n\t\t{\n\t\t\tif (number == 0)\n\t\t\t\treturn new Tuple(1,3);\n\n\t\t\tvar y = (number - 1) / 3;\n\t\t\tvar x = number - (y*3) - 1;\n\n\t\t\treturn new Tuple(x,y);\n\t\t}\n\n\t\tprivate static long Factorial(int numb)\n\t\t{\n\t\t\tif (numb == 0)\n\t\t\t\treturn 1;\n\n\t\t\tlong res = 1;\n\t\t\tfor (int i = numb; i > 1; i--)\n\t\t\t\tres *= i;\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static double partialSum(double p, double q)\n\t\t{\n\t\t\tif (Math.Abs(p - 1) < double.Epsilon)\n\t\t\t\treturn 1;\n\n\t\t\tdouble a = p,\n\t\t\t\td = p, \n\t\t\t\tr = q;\n\n\t\t\tvar res = (a/(1 - r)) + ((r*d)/((1 - r)*(1 - r)));\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic class Clusters\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate Stack st;\n\t\t\tpublic int count;\n\n\n\t\t\tprivate int[,] fromStr(string[] zombies)\n\t\t\t{\n\t\t\t\tvar n = zombies.Length;\n\t\t\t\tvar matrix = new int[n, n];\n\t\t\t\tint i = 0;\n\n\t\t\t\tforeach (var str in zombies)\n\t\t\t\t{\n\t\t\t\t\tvar inStr = str;\n\t\t\t\t\tvar ar = new List();\n\n\t\t\t\t\tforeach (var c in inStr)\n\t\t\t\t\t{\n\t\t\t\t\t\tar.Add(int.Parse(c.ToString()));\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var j = 0; j < n; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tmatrix[i, j] = ar[j];\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\n\t\t\t\treturn matrix;\n\t\t\t}\n\t\t\tpublic Clusters(string[] zmb_str)\n\t\t\t{\n\t\t\t\tvar n = zmb_str.Count();\n\t\t\t\tvar zombies = fromStr(zmb_str);\n\t\t\t\tst = new Stack();\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tcount = 0;\n\n\t\t\t\tfor (int v = 0; v < n; v++)\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\tdfs(ref zombies, v, n);\n\t\t\t\t}\n\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tforeach (var e in reverserPostOrder())\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e])\n\t\t\t\t\t{\n\t\t\t\t\t\tdfs(ref zombies, e, n);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\tprivate void dfs(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tmarked[v] = true;\n\t\t\t\tforeach (var e in getAdj(ref g, v, n))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e]) dfs(ref g, e, n);\n\t\t\t\t}\n\t\t\t\tst.Push(v);\n\t\t\t}\t\t\t\n\n\t\t\tprivate int[] getAdj(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tvar res = new List();\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tif (i == v)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (g[v, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.Add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn res.ToArray();\n\t\t\t}\n\n\t\t\tpublic int[] reverserPostOrder()\n\t\t\t{\n\t\t\t\treturn st.ToArray();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\tprivate static int binarySearch(ref long[] ar, int l, int h, long key)\n\t\t{\n\t\t\tif (l >= h)\n\t\t\t\treturn -1;\n\n\t\t\tvar mid = (l + h) / 2;\n\n\t\t\tif (ar[mid] == key)\n\t\t\t\treturn mid;\n\n\t\t\tif (key > ar[mid])\n\t\t\t\treturn binarySearch(ref ar, mid+1, h, key);\n\n\t\t\treturn binarySearch(ref ar, 0, mid, key);\n\t\t}\n\n\t\tprivate static int[] ParseIntString(StreamReader input)\n\t\t{\n\t\t\treturn input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\t\t}\n\n\t\tprivate static int ParseInt(StreamReader input)\n\t\t{\n\t\t\treturn int.Parse(input.ReadLine());\n\t\t}\n\n\t\tprivate static long primaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][i];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long secondaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][n - i - 1];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static int GetIdx(int n, int lastAns, int x)\n\t\t{\n\t\t\treturn (x ^ lastAns) % n;\n\t\t}\n\n\t\tprivate static int getHourGlassSum(ref int[][] ar, int x, int y)\n\t\t{\n\t\t\tvar sum = 0;\n\n\t\t\tsum += ar[x][y];\n\t\t\tsum += ar[x][y + 1];\n\t\t\tsum += ar[x][y + 2];\n\n\t\t\tsum += ar[x + 1][y + 1];\n\n\t\t\tsum += ar[x + 2][y];\n\t\t\tsum += ar[x + 2][y + 1];\n\t\t\tsum += ar[x + 2][y + 2];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long sumFrom(int start, ref long[] sums, long totalSum)\n\t\t{\n\t\t\tif (start >= sums.Length)\n\t\t\t\treturn 0;\n\n\t\t\treturn totalSum - sums[start - 1];\n\t\t}\n\n\n\t\tpublic int ReadSingleInt(StreamReader input)\n\t\t{\n\t\t\tvar line = input.ReadLine();\n\t\t\treturn int.Parse(line);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic int[] ReadInts(char sep = ' ')\n\t\t{\n\t\t\tvar line = Console.ReadLine();\n\t\t\tvar arr = line.Split(sep).Select(x => int.Parse(x)).ToArray();\n\n\t\t\treturn arr;\n\t\t}\n\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSLearning\n{\n internal class cf361\n {\n public static bool CanDown(string str)\n {\n if (str.Contains(\"7\") || str.Contains(\"0\") || str.Contains(\"9\"))\n return false;\n else\n return true;\n }\n\n public static bool CanUp(string str)\n {\n if (str.Contains(\"1\") || str.Contains(\"2\") || str.Contains(\"3\"))\n return false;\n else\n return true;\n }\n\n public static bool CanLeft(string str)\n {\n if (str.Contains(\"1\") || str.Contains(\"4\") || str.Contains(\"7\") || str.Contains(\"0\"))\n return false;\n else\n return true;\n }\n\n public static bool CanRight(string str)\n {\n if (str.Contains(\"3\") || str.Contains(\"6\") || str.Contains(\"9\") || str.Contains(\"0\"))\n return false;\n else\n return true;\n }\n\n private static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var str = Console.ReadLine();\n if (CanUp(str) || CanDown(str) || CanLeft(str) || CanRight(str))\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n bool[] ls = new bool[10];\n for (int i = 0; i < s.Length; i++)\n {\n ls[s[i] - '0'] = true;\n }\n bool[] yoko = new bool[3];\n bool[] tate = new bool[4];\n \n if(ls[0])\n {\n yoko[1] = true;\n tate[3] = true;\n }\n\n for (int i = 1; i < 10; i++)\n {\n if(ls[i])\n {\n yoko[(i - 1) % 3] = true;\n tate[(i - 1) / 3] = true;\n }\n }\n if (tate[3])//0\n {\n if (tate[0])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if((tate[0]&&tate[2]) && yoko[0]&&yoko[2])\n {\n if (ls[7] || ls[9])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Mike_and_Cellphone\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n s = reader.ReadLine();\n\n var keyboard = new char[10][];\n keyboard[0] = \".......\".ToCharArray();\n keyboard[1] = \".......\".ToCharArray();\n keyboard[2] = \".......\".ToCharArray();\n keyboard[3] = \"..123..\".ToCharArray();\n keyboard[4] = \"..456..\".ToCharArray();\n keyboard[5] = \"..789..\".ToCharArray();\n keyboard[6] = \"...0...\".ToCharArray();\n keyboard[7] = \".......\".ToCharArray();\n keyboard[8] = \".......\".ToCharArray();\n keyboard[9] = \".......\".ToCharArray();\n\n var x = new int[s.Length];\n var y = new int[s.Length];\n\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = 3; j <= 6; j++)\n {\n for (int k = 2; k < 5; k++)\n {\n if (s[i] == keyboard[j][k])\n {\n x[i] = j;\n y[i] = k;\n goto mbox;\n }\n }\n }\n mbox:\n ;\n }\n\n for (int j = 3; j <= 6; j++)\n {\n for (int k = 2; k < 5; k++)\n {\n if (keyboard[j][k] != '.' && keyboard[j][k] != s[0])\n {\n int xx = j, yy = k;\n bool ok = true;\n for (int i = 1; i < x.Length; i++)\n {\n xx += x[i] - x[i - 1];\n yy += y[i] - y[i - 1];\n\n if (keyboard[xx][yy] == '.')\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n }\n }\n\n writer.WriteLine(\"YES\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _689A\n{\n class Program\n {\n struct Vector { public int X, Y; }\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string number = Console.ReadLine();\n var numberVectors = new Vector[n];\n numberVectors[0] = new Vector() { X = 0, Y = 0 };\n Tuple startCoords = NumberToCoords(int.Parse(number.Substring(0, 1)));\n for (int i = 1; i < n; i++)\n {\n int previous = int.Parse(number.Substring(i - 1, 1));\n int current = int.Parse(number.Substring(i, 1));\n Tuple prevCoords = NumberToCoords(previous), currCoords = NumberToCoords(current);\n Vector currVector = new Vector()\n {\n X = currCoords.Item1 - prevCoords.Item1,\n Y = currCoords.Item2 - prevCoords.Item2\n };\n numberVectors[i] = currVector;\n }\n\n bool result = true;\n for (int startX = 0; startX < 3; startX++)\n {\n for (int startY = 0; startY < 4; startY++)\n {\n if ((startY == 3 && (startX == 0 || startX == 2)) ||\n (startX == startCoords.Item1 && startY == startCoords.Item2))\n continue;\n\n bool correct = true;\n int x = startX, y = startY;\n foreach (var vector in numberVectors)\n {\n x += vector.X; y += vector.Y;\n if (x < 0 || x > 2 || y < 0 || y > 3 || (y == 3 && (x == 0 || x == 2)))\n {\n correct = false;\n break;\n }\n }\n\n if (correct)\n {\n result = false;\n break;\n }\n }\n }\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n //Console.ReadLine();\n }\n\n static Tuple NumberToCoords(int number)\n {\n switch (number)\n {\n case 0: return new Tuple(1, 3);\n case 1: return new Tuple(0, 0);\n case 2: return new Tuple(1, 0);\n case 3: return new Tuple(2, 0);\n case 4: return new Tuple(0, 1);\n case 5: return new Tuple(1, 1);\n case 6: return new Tuple(2, 1);\n case 7: return new Tuple(0, 2);\n case 8: return new Tuple(1, 2);\n case 9: return new Tuple(2, 2);\n default: return null;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n var n = ReadIntToken();\n var num = Read();\n if (!num.Contains(\"7\") && !num.Contains(\"0\") && !num.Contains(\"9\"))\n return \"NO\";\n if (!num.Contains(\"1\") && !num.Contains(\"2\") && !num.Contains(\"3\"))\n return \"NO\";\n if (!num.Contains(\"1\") && !num.Contains(\"4\") && !num.Contains(\"7\") && !num.Contains(\"0\"))\n return \"NO\";\n\n if (!num.Contains(\"3\") && !num.Contains(\"6\") && !num.Contains(\"9\") && !num.Contains(\"0\"))\n return \"NO\";\n return \"YES\";\n }\n }\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n protected int ReadInt() { return int.Parse(Read()); }\n\n protected int ReadIntToken() { return int.Parse(ReadToken()); }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n protected long ReadLongToken() { return long.Parse(ReadToken()); }\n\n protected long ReadLong() { return long.Parse(Read()); }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar number = sr.NextString();\n\t\t\tvar matrix = new[,] {\n\t\t\t\t{ '1', '2', '3' },\n\t\t\t\t{ '4', '5', '6' },\n\t\t\t\t{ '7', '8', '9' },\n\t\t\t\t{ '?', '0', '?' }\n\t\t\t};\n\t\t\tvar operations = new List>();\n\t\t\tvar sourceI = 0;\n\t\t\tvar sourceJ = 0;\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tvar digit = number[i];\n\t\t\t\tvar currI = 0;\n\t\t\t\tvar currJ = 0;\n\t\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\t\tif (matrix[k, l] == digit) {\n\t\t\t\t\t\t\tcurrI = k;\n\t\t\t\t\t\t\tcurrJ = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (operations.Count == 0) {\n\t\t\t\t\toperations.Add(new Tuple(currI, currJ));\n\t\t\t\t\tsourceI = currI;\n\t\t\t\t\tsourceJ = currJ;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toperations.Add(new Tuple(currI - sourceI, currJ - sourceJ));\n\t\t\t\t\tsourceI = currI;\n\t\t\t\t\tsourceJ = currJ;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar canCount = 0;\n\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\tif (k == 3 && l != 1) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar currI = k;\n\t\t\t\t\tvar currJ = l;\n\t\t\t\t\tvar can = true;\n\t\t\t\t\tfor (var i = 1; i < operations.Count; i++) {\n\t\t\t\t\t\tvar next = operations[i];\n\t\t\t\t\t\tif (!Can(currI, next.Item1, currJ, next.Item2)) {\n\t\t\t\t\t\t\tcan = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tcurrI += next.Item1;\n\t\t\t\t\t\t\tcurrJ += next.Item2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (can) {\n\t\t\t\t\t\tcanCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (canCount > 1) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\n\t\tprivate bool Can(int i,int dI, int j, int dJ)\n\t\t{\n\t\t\tif (i + dI == 3) {\n\t\t\t\tif (j + dJ == 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i + dI >= 0 && i + dI < 3 && j + dJ >= 0 && j + dJ < 3)\n\t\t\t\treturn true;\n\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n bool b1 = false, b2 = false, b3 = false, b4 = false, b5 = false;\n for (int i = 0; i < n; i++)\n {\n int c = s[i] - '0';\n if (c == 1 || c == 4 || c == 7)\n {\n b1 = true;\n }\n if (c == 3 || c == 6 || c == 9)\n {\n b2 = true;\n }\n if (c == 1 || c == 2 || c == 3)\n {\n b3 = true;\n }\n if (c == 7 || c == 0 || c == 9)\n {\n b4 = true;\n }\n if (c == 0)\n {\n b5 = true;\n }\n }\n bool r = b1 && b2 && b3 && b4 || (b5 && b3);\n Console.WriteLine(r ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _689A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Solution sol = new Solution();\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n Console.WriteLine(sol.GetOtherNumber(str) ? \"YES\" : \"NO\");\n }\n }\n\n public class Solution\n {\n IDictionary mp = new Dictionary()\n {\n { '0', new [] { 0, 1 } },\n { '1', new [] { 3, 0 } },\n { '2', new [] { 3, 1 } },\n { '3', new [] { 3, 2 } },\n { '4', new [] { 2, 0 } },\n { '5', new [] { 2, 1 } },\n { '6', new [] { 2, 2 } },\n { '7', new [] { 1, 0 } },\n { '8', new [] { 1, 1 } },\n { '9', new [] { 1, 2 } }\n };\n\n public bool GetOtherNumber(string n)\n {\n List steps = new List();\n\n for (int i = 1; i < n.Length; ++i)\n steps.Add(new[] { mp[n[i]][0] - mp[n[i - 1]][0], mp[n[i]][1] - mp[n[i - 1]][1] });\n\n bool fl = true;\n for(int i = 0; i < 10; ++i, fl = true)\n {\n if (i == n[0] - '0')\n continue;\n\n int x = mp[i + '0'][0];\n int y = mp[i + '0'][1];\n int j = 0;\n for (; j < steps.Count; j++)\n {\n x += steps[j][0];\n y += steps[j][1];\n if (OutOfTheBox(x, y))\n {\n fl = false;\n break;\n }\n }\n if (fl)\n return false;\n }\n return true;\n }\n\n\n public bool OutOfTheBox(int x, int y)\n {\n if (x == 0 && y == 1)\n return false;\n return x <= 0 || x > 3 || y < 0 || y > 2;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _689A\n {\n public static void Main()\n {\n var moveToChar = new Dictionary>()\n {\n {\n \"00\",\n new Dictionary\n {\n { '0', '0' },\n { '1', '1' },\n { '2', '2' },\n { '3', '3' },\n { '4', '4' },\n { '5', '5' },\n { '6', '6' },\n { '7', '7' },\n { '8', '8' },\n { '9', '9' },\n }\n },\n {\n \"01\",\n new Dictionary\n {\n { '0', '1' },\n }\n },\n {\n \"02\",\n new Dictionary\n {\n { '0', '2' },\n }\n },\n {\n \"03\",\n new Dictionary\n {\n { '0', '3' },\n }\n },\n {\n \"04\",\n new Dictionary\n {\n { '0', '4' },\n { '8', '1' },\n { '9', '2' },\n }\n },\n {\n \"05\",\n new Dictionary\n {\n { '0', '5' },\n { '7', '1' },\n { '8', '2' },\n { '9', '3' },\n }\n },\n {\n \"06\",\n new Dictionary\n {\n { '0', '6' },\n { '7', '2' },\n { '8', '3' },\n }\n },\n {\n \"07\",\n new Dictionary\n {\n { '0', '7' },\n { '5', '1' },\n { '6', '2' },\n { '8', '4' },\n { '9', '5' },\n }\n },\n {\n \"08\",\n new Dictionary\n {\n { '0', '8' },\n { '4', '1' },\n { '5', '2' },\n { '6', '3' },\n { '7', '4' },\n { '8', '5' },\n { '9', '6' },\n }\n },\n {\n \"09\",\n new Dictionary\n {\n { '0', '9' },\n { '4', '2' },\n { '5', '3' },\n { '7', '5' },\n { '8', '6' },\n }\n },\n {\n \"10\",\n new Dictionary\n {\n { '1', '0' },\n }\n },\n {\n \"12\",\n new Dictionary\n {\n { '1', '2' },\n { '2', '3' },\n { '4', '5' },\n { '5', '6' },\n { '7', '8' },\n { '8', '9' },\n }\n },\n {\n \"13\",\n new Dictionary\n {\n { '1', '3' },\n { '4', '6' },\n { '7', '9' },\n }\n },\n {\n \"14\",\n new Dictionary\n {\n { '1', '4' },\n { '2', '5' },\n { '3', '6' },\n { '4', '7' },\n { '5', '8' },\n { '6', '9' },\n { '8', '0' },\n }\n },\n {\n \"15\",\n new Dictionary\n {\n { '1', '5' },\n { '2', '6' },\n { '7', '0' },\n { '4', '8' },\n { '5', '9' },\n }\n },\n {\n \"16\",\n new Dictionary\n {\n { '1', '6' },\n { '4', '9' },\n }\n },\n {\n \"17\",\n new Dictionary\n {\n { '1', '7' },\n { '2', '8' },\n { '3', '9' },\n { '5', '0' },\n }\n },\n {\n \"18\",\n new Dictionary\n {\n { '1', '8' },\n { '2', '9' },\n { '4', '0' },\n }\n },\n {\n \"19\",\n new Dictionary\n {\n { '1', '9' },\n }\n },\n {\n \"20\",\n new Dictionary\n {\n { '2', '0' },\n }\n },\n {\n \"21\",\n new Dictionary\n {\n { '2', '1' },\n { '3', '2' },\n { '5', '4' },\n { '6', '5' },\n { '8', '7' },\n { '9', '8' },\n }\n },\n {\n \"24\",\n new Dictionary\n {\n { '2', '4' },\n { '3', '5' },\n { '5', '7' },\n { '6', '8' },\n { '9', '0' },\n }\n },\n {\n \"27\",\n new Dictionary\n {\n { '2', '7' },\n { '3', '8' },\n { '6', '0' },\n }\n },\n {\n \"30\",\n new Dictionary\n {\n { '3', '0' },\n }\n },\n {\n \"31\",\n new Dictionary\n {\n { '3', '1' },\n { '6', '4' },\n { '9', '7' },\n }\n },\n {\n \"34\",\n new Dictionary\n {\n { '3', '4' },\n { '6', '7' },\n }\n },\n {\n \"37\",\n new Dictionary\n {\n { '3', '7' },\n }\n },\n {\n \"43\",\n new Dictionary\n {\n { '4', '3' },\n { '7', '6' },\n }\n },\n {\n \"61\",\n new Dictionary\n {\n { '6', '1' },\n { '9', '4' },\n }\n },\n {\n \"73\",\n new Dictionary\n {\n { '7', '3' },\n }\n },\n {\n \"91\",\n new Dictionary\n {\n { '9', '1' },\n }\n },\n };\n\n var charToMove = moveToChar\n .SelectMany(x => x.Value.Select(y => new { Move = x.Key, From = y.Key, To = y.Value }))\n .GroupBy(x => x.From)\n .ToDictionary(x => x.Key, x => x.ToDictionary(y => y.To, y => y.Move));\n\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n var moves = Enumerable.Range(0, n - 1).Select(i => charToMove[s[i]][s[i + 1]]).ToArray();\n\n int count = 10;\n\n for (char start = '0'; start <= '9'; start++)\n {\n char x = start;\n\n for (int i = 0; i < n - 1; i++)\n {\n if (!moveToChar[moves[i]].ContainsKey(x))\n {\n count--;\n break;\n }\n else\n {\n x = moveToChar[moves[i]][x];\n }\n }\n }\n\n Console.WriteLine(count == 1 ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "/* Date: 29.01.2019 * Time: 21:45 */\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\000\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\000\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n# endif\n\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (s);\n# endif\n\n\t\tbool ok = true;\n\t\tint [] a = new int [n];\n\t\tfor ( int i=0; i < s.Length; i++ )\n\t\t{\n\t\t\ta [i] = (s [i].GetHashCode ()) % 256;\n# if ( ! ONLINE_JUDGE )\n\t\t\tsw.Write (a [i] + \" \");\n# endif\n\t\t}\n\n\t\tbool up=true, left=true, right=true, down=true;\n\t\tfor ( int i=0; i < s.Length; i++ )\n\t\t{\n\t\t\tif ( s [i] == '7' || s [i] == '0' || s [i] == '9' )\n\t\t\t\tdown = false;\n\t\t\tif ( s [i] == '1' || s [i] == '2' || s [i] == '3' )\n\t\t\t\tup = false;\n\t\t\tif ( s [i] == '1' || s [i] == '4' || s [i] == '7' || s [i] == '0' )\n\t\t\t\tleft = false;\n\t\t\tif ( s [i] == '3' || s [i] == '6' || s [i] == '9' || s [i] == '0' )\n\t\t\t\tright = false;\n\t\t}\n\n\t\tok = (down || up || left || right);\n\n# if ( ONLINE_JUDGE )\n\t\tif ( ok )\n\t\t\tConsole.WriteLine (\"NO\");\n\t\telse\n\t\t\tConsole.WriteLine (\"YES\");\n# else\n\t\tsw.WriteLine ();\n\t\tif ( ok )\n\t\t\tsw.WriteLine (\"NO\");\n\t\telse\n\t\t\tsw.WriteLine (\"YES\");\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n int int_digits = int.Parse(Console.ReadLine());\n string str_number = Console.ReadLine();\n string str_result = \"NO\";\n\n int digit2;\n bool b_half1 = false;\n bool b_half2 = false;\n\n foreach (char digit in str_number)\n {\n digit2 = int.Parse(digit.ToString());\n switch (digit2)\n {\n case 1:\n if (str_number.Contains(\"9\") || str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"3\")||str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n if (str_number.Contains(\"7\"))\n {\n b_half2 = true;\n }\n break;\n case 2:\n if (str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 3:\n if (str_number.Contains(\"0\") || str_number.Contains(\"7\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 4:\n if (str_number.Contains(\"6\")||str_number.Contains(\"3\")||str_number.Contains(\"9\"))\n {\n b_half1 = true;\n }\n break;\n case 7:\n if (str_number.Contains(\"9\")||str_number.Contains(\"3\")||str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n break;\n }\n }\n if (b_half1==true & b_half2 == true)\n {\n str_result = \"YES\";\n }\n Console.WriteLine(str_result);\n }\n}\n\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.A_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class MikeAndPhone361\n {\n private static int[,] digits = new int[4, 3] \n {\n {1, 2, 3},\n {4, 5, 6},\n {7, 8, 9},\n {-1, 0, -1},\n };\n\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt();\n int[] a = new int[n];\n List d = new List();\n string s = fs.ReadLine();\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(\"\" + s[i]);\n if (i > 0) d.Add(GetDiff(a[i - 1], a[i]));\n }\n\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (digits[i, j] == a[0]) continue;\n if (digits[i, j] != -1 && IsValid(i, j, d))\n {\n writer.WriteLine(\"NO\");\n return;\n }\n }\n }\n writer.WriteLine(\"YES\");\n }\n }\n private static bool IsValid(int i, int j, List d)\n {\n try\n {\n foreach (int[] v in d)\n {\n i += v[0];\n j += v[1];\n if (digits[i, j] == -1) return false;\n }\n return true;\n }\n catch (Exception)\n {\n return false;\n }\n }\n\n private static int[] GetDiff(int d1, int d2)\n {\n int i1 = 0, i2 = 0, j1 = 0, j2 = 0;\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (digits[i, j] == d1)\n {\n i1 = i;\n j1 = j;\n }\n if (digits[i, j] == d2)\n {\n i2 = i;\n j2 = j;\n }\n }\n }\n return new int[] { i2 - i1, j2 - j1 };\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nclass Solution\n{\n\n static void Main(String[] args)\n {\n string[] valid = new string[8] {\n \"0000000\",\n \"0000000\",\n \"0011100\",\n \"0011100\",\n \"0011100\",\n \"0001000\",\n \"0000000\",\n \"0000000\"\n };\n int[] row = new int[] {5,2,2,2,3,3,3,4,4,4};\n int[] col = new int[] {3,2,3,4,2,3,4,2,3,4};\n\n int count = int.Parse(Console.ReadLine());\n string digits = Console.ReadLine();\n bool found = false;\n for (int i = 0; i < 10; ++i)\n {\n bool v = true;\n int idx = (int)digits[0]-(int)'0';\n int or = row[idx]-row[i];\n int oc = col[idx]-col[i];\n if (or == 0 && oc == 0)\n {\n continue;\n }\n for (int j = 0; j < count; ++j)\n {\n idx = (int)digits[j]-(int)'0';\n int ir = row[idx] - or;\n int ic = col[idx] - oc;\n if (ir<0 || ir>7 || ic < 0 || ic > 6 || valid[ir][ic] == '0')\n {\n v = false;\n break;\n }\n }\n if (v)\n {\n found = true;\n break;\n }\n }\n if (found)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n public class TupleList : List>\n {\n public void Add(int item1, int item2, string s)\n {\n Add(new Tuple(item1, item2, s));\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int most_left = 2;\n int most_right = 0;\n int most_up = 4;\n int most_down = 1;\n bool is_8_only_most_down = false;\n\n for(int i = 0; i< n; i++)\n {\n int input_number = 0;\n if (input[i] - '0' == 0) input_number = 11;\n else input_number = input[i] - '0';\n if (most_right != 2 && (input_number-1) % 3 > most_right) most_right = (input_number-1)%3;\n if (most_left != 0 && (input_number-1) % 3 < most_left) most_left= (input_number-1) % 3;\n if (most_up != 1 && (input_number+2) / 3 < most_up) most_up = (input_number+2)/3;\n if (most_down != 4 && (input_number+2) / 3 > most_down) most_down = (input_number+2)/3;\n if (!is_8_only_most_down && input_number == 8 && most_down <= 3) is_8_only_most_down = true;\n if (input_number == 7 || input_number == 9) is_8_only_most_down = false;\n if (input_number == 11) is_8_only_most_down = false;\n }\n\n if (most_right - most_left == 2 && most_down - most_up == 2)\n {\n if (most_up == 2) Console.WriteLine(\"NO\");\n else if (is_8_only_most_down) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n else if (most_down - most_up == 3) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int[] x = {2, 1, 2, 3, 1, 2, 3, 1, 2, 3};\n int[] y = {4, 1, 1, 1, 2, 2, 2, 3, 3, 3};\n int n = Next();\n reader.ReadLine();\n string s = reader.ReadLine();\n int[] dx = new int[n - 1];\n int[] dy = new int[n - 1];\n for (int i = 1; i < n; i++) {\n int cur = s[i] - '0';\n int prev = s[i - 1] - '0';\n dx[i - 1] = x[cur] - x[prev];\n dy[i - 1] = y[cur] - y[prev];\n }\n int ans = 0;\n for (int i = 0; i <= 9; i++) {\n bool good = true;\n int cx = x[i];\n int cy = y[i];\n for (int j = 0; j < n - 1 && good; j++) {\n cx += dx[j];\n cy += dy[j];\n if (cx < 1 || cx > 3)\n good = false;\n if (cy < 1 || cy > 4)\n good = false;\n if (cy == 4 && cx != 2)\n good = false;\n }\n if (good)\n ans++;\n }\n\n writer.Write(ans == 1 ? \"YES\" : \"NO\");\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] xr = { 3, 0, 0, 0, 1, 1, 1, 2, 2, 2 };\n int[] xc = { 1, 0, 1, 2, 0, 1, 2, 0, 1, 2 }; \n\n public void Solve()\n {\n int n = ReadInt();\n if (n == 1)\n {\n Write(\"NO\");\n return;\n }\n string s = ReadToken();\n\n bool ans = true;\n for (int i = 0; i < 10; i++)\n if (s[0] - '0' != i)\n {\n int r = xr[i];\n int c = xc[i];\n bool ok = true;\n for (int j = 1; j < n; j++)\n {\n int dr = xr[s[j] - '0'] - xr[s[j - 1] - '0'];\n int dc = xc[s[j] - '0'] - xc[s[j - 1] - '0'];\n r += dr;\n c += dc;\n if (r < 0 || r > 3 || (r == 3 && c != 1) || c < 0 || c > 2)\n ok = false;\n }\n if (ok)\n ans = false;\n }\n\n Write(ans ? \"YES\" : \"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII);\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public int c;\n public PairVariable()\n {\n a = b = 0;\n c = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n c = 0;\n\n }\n\n public PairVariable(int a, int b, int c)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.b.CompareTo(other.b);\n }\n}\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n\n\n static bool isPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n static long factorial(int a)\n {\n long s = 1;\n for (long i = 1; i <= a; i++)\n {\n s *= i;\n }\n return s;\n }\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n string s = Console.ReadLine();\n int[] a = new int[n];\n for (int i = 0; i < s.Length; i++)\n {\n a[i] = int.Parse(s[i].ToString());\n }\n bool f = false;\n for (int i = 0; i < n; i++)\n {\n if (a[i] == 1 || a[i] == 2 || a[i] == 3)\n {\n f = true;\n }\n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n f = false;\n for (int i = 0; i < n; i++)\n {\n if (a[i] == 3 || a[i] == 6 || a[i] == 9 || a[i] == 0)\n {\n f = true;\n }\n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n f = false;\n for (int i = 0; i < n; i++)\n {\n if (a[i] == 1 || a[i] == 4 || a[i] == 7 || a[i] == 0)\n {\n f = true;\n }\n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n f = false;\n for (int i = 0; i < n; i++)\n {\n if (a[i] == 7 || a[i] == 0 || a[i] == 9)\n {\n f = true;\n }\n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n int n = int.Parse(Console.ReadLine());\n string s = (Console.ReadLine());\n\n bool only = true;\n\n var memoA = new int[n];\n var memoB = new int[n];\n for(int i =0; i< n; i++)\n {\n \n int tmp = s[i]-'0';\n\n if (tmp == 0)\n {\n memoA[i] = 8;\n }\n else if (tmp == 3) memoA[i] = -1;\n else memoA[i] = tmp - 3;\n\n if(tmp ==0)\n {\n memoB[i] = 11;\n }\n else if(tmp ==8) memoB[i] = 0;\n else memoB[i] = tmp + 3;\n \n \n }\n\n if (!memoA.Any(c => c < 0 || c >= 10) || !memoB.Any(c => c < 0 || c >= 10)) only = false;\n\n memoA = new int[n];\n memoB = new int[n];\n for (int i = 0; i < n; i++)\n {\n\n int tmp = s[i] - '0';\n\n if (tmp == 1)\n {\n memoA[i] = -1;\n }\n else if (tmp == 4 || tmp ==7) memoA[i] = -1;\n else memoA[i] = tmp - 1;\n\n if (tmp == 0)\n {\n memoB[i] = 11;\n }\n else if (tmp == 3 || tmp==6) memoB[i] = 11;\n else memoB[i] = tmp + 1;\n\n\n }\n if (!memoA.Any(c => c < 0 || c >= 10) || !memoB.Any(c => c < 0 || c >= 10)) only = false;\n\n if (only) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n\n\n\n \n\n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = Convert.ToInt32(Console.ReadLine());\n string digits = Console.ReadLine();\n int[,] jaggedArray = new int[4,3];\n int[] array = new int[number];\n int[] firstArray = new int[number];\n int[] secondArray = new int[number];\n int[] difOne = new int[number];\n int[] difTwo = new int[number];\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if((j + 1) + (i * 3) == 10)\n {\n jaggedArray[i,j] = -1;\n }\n else if((j + 1) + (i * 3) == 11)\n {\n jaggedArray[i,j] = 0;\n }\n else if((j + 1) + (i * 3) == 12)\n {\n jaggedArray[i,j] = -1;\n }\n else\n {\n jaggedArray[i,j] = (j + 1) + (i*3);\n }\n }\n }\n for (int i = 0; i < number; i++)\n {\n array[i] = (int)Char.GetNumericValue(digits[i]);\n for (int j = 0; j < 4; j++)\n {\n for (int k = 0; k < 3; k++)\n {\n if(jaggedArray[j,k] == array[i])\n {\n firstArray[i] = j;\n secondArray[i] = k;\n if(i == 0)\n {\n difOne[i] = 0;\n difTwo[i] = 0;\n }\n else\n {\n difOne[i] = firstArray[i - 1] - firstArray[i];\n difTwo[i] = secondArray[i - 1] - secondArray[i];\n }\n break;\n }\n }\n }\n }\n bool error = false;\n\n for (int i = 0; i <= 9; i++)\n {\n if (i != array[0])\n {\n error = true;\n try\n {\n for (int j = 0; j < 4; j++)\n {\n for (int k = 0; k < 3; k++)\n {\n if (i == jaggedArray[j, k])\n {\n int n = 0;\n int m = 0;\n for (int l = 0; l < number; l++)\n {\n if (jaggedArray[n - difOne[l] + j, m - difTwo[l] +k] != -1)\n {\n n = n - difOne[l];\n m = m - difTwo[l];\n }\n else\n {\n error = false;\n }\n }\n }\n }\n }\n if (error)\n {\n break;\n }\n\n }\n catch (Exception)\n {\n error = false;\n } \n }\n\n }\n\n \n \n \n if(error == false)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nclass Program\n{\n private static int[,] mat = new int[10, 4];\n\n static void solve(StreamReader reader, StreamWriter writer)\n {\n for (int i = 0; i <= 9; ++i)\n for (int j = 0; j <= 3; ++j)\n mat[i, j] = -1;\n mat[1, 1] = 2;\n mat[1, 2] = 4;\n mat[3, 2] = 6;\n mat[3, 3] = 2;\n mat[9, 3] = 8;\n mat[9, 0] = 6;\n mat[7, 0] = 4;\n mat[7, 1] = 8; \n mat[2, 1] = 3;\n mat[2, 2] = 5;\n mat[2, 3] = 1;\n mat[4, 0] = 1;\n mat[4, 1] = 5;\n mat[4, 2] = 7;\n mat[6, 2] = 9;\n mat[6, 3] = 5;\n mat[6, 0] = 3;\n mat[8, 0] = 5;\n mat[8, 1] = 9;\n mat[8, 2] = 0;\n mat[8, 3] = 7;\n mat[0, 0] = 8;\n mat[5, 0] = 2;\n mat[5, 1] = 6;\n mat[5, 2] = 8;\n mat[5, 3] = 4; \n int n = reader.ReadInt();\n var s = reader.ReadLine();\n bool can = false;\n for (int i = 0; i <= 3; ++i)\n {\n var could = true;\n for (int h = 0; h < n; ++h)\n {\n if (mat[s[h] - '0', i] == -1)\n could = false;\n }\n can |= could;\n }\n writer.WriteLine(can? \"NO\": \"YES\");\n }\n\n #region launch\n static void Main(string[] args)\n {\n using (var writer = new FormattedStreamWriter(Console.OpenStandardOutput()))\n {\n using (var reader = new StreamReader(\n#if CODECHIEF_LOCAL\n \"input.txt\"\n#else\nConsole.OpenStandardInput()\n#endif\n))\n {\n solve(reader, writer);\n }\n }\n }\n #endregion\n}\n\n#region helpers\nclass FormattedStreamWriter : StreamWriter\n{\n public FormattedStreamWriter(Stream stream)\n : base(stream)\n {\n }\n\n public override IFormatProvider FormatProvider\n {\n get\n {\n return CultureInfo.InvariantCulture;\n }\n }\n}\n\nstatic class IOExtensions\n{\n public static string ReadString(this StreamReader reader)\n {\n return reader.ReadToken();\n }\n\n public static int ReadInt(this StreamReader reader)\n {\n return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static long ReadLong(this StreamReader reader)\n {\n return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static double ReadDouble(this StreamReader reader)\n {\n return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n static Queue buffer = new Queue(100);\n\n static string ReadToken(this StreamReader reader)\n {\n while (buffer.Count == 0)\n {\n reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) =>\n {\n buffer.Enqueue(t);\n });\n }\n return buffer.Dequeue();\n }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar s = ReadString();\n\t\t\tvar phone = new Dictionary();\n\t\t\tphone.Add('1', new Pair { First = 0, Second = 0 });\n\t\t\tphone.Add('2', new Pair { First = 0, Second = 1 });\n\t\t\tphone.Add('3', new Pair { First = 0, Second = 2 });\n\t\t\tphone.Add('4', new Pair { First = 1, Second = 0 });\n\t\t\tphone.Add('5', new Pair { First = 1, Second = 1 });\n\t\t\tphone.Add('6', new Pair { First = 1, Second = 2 });\n\t\t\tphone.Add('7', new Pair { First = 2, Second = 0 });\n\t\t\tphone.Add('8', new Pair { First = 2, Second = 1 });\n\t\t\tphone.Add('9', new Pair { First = 2, Second = 2 });\n\t\t\tphone.Add('0', new Pair { First = 3, Second = 1 });\n\t\t\tvar ct = 0;\n\t\t\tvar diffs = new List { new Pair { First = 0, Second = 0 } };\n\t\t\tfor (var i = 1; i < s.Length; ++i)\n\t\t\t\tdiffs.Add(new Pair { First = phone[s[i]].First - phone[s[i - 1]].First, Second = phone[s[i]].Second - phone[s[i - 1]].Second });\n\t\t\tfor (var i = '0'; i <= '9'; ++i)\n\t\t\t{\n\t\t\t\tvar curx = phone[i].First;\n\t\t\t\tvar cury = phone[i].Second;\n\t\t\t\tvar good = true;\n\t\t\t\tfor (var j = 0; j < n; ++j)\n\t\t\t\t{\n\t\t\t\t\tcurx += diffs[j].First;\n\t\t\t\t\tcury += diffs[j].Second;\n\t\t\t\t\tif (curx < 0 || curx > 3 || cury < 0 || cury > 2 || (curx == 3 && cury != 1))\n\t\t\t\t\t\tgood = false;\n\t\t\t\t}\n\n\t\t\t\tif (good)\n\t\t\t\t\tct++;\n\t\t\t}\n\t\t\tWriteYesNo(ct == 1);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}], "negative_code": [{"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.IO;\nusing System.Net;\n\nnamespace ConsoleApplication6\n{\n class Program\n { static int[] ceni;\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int[] nabor = new int[n];\n int[] vertik = new int[n];\n int[] gorizont = new int[n];\n for (int i = 0; i < n; i++) {\n nabor[i] = Convert.ToInt32(str[i].ToString());\n \n \n }\n for (int i = 0; i < n; i++) {\n if (nabor[i] % 3 > 0) {\n vertik[i] = nabor[i] % 3;\n gorizont[i] = (nabor[i] / 3) + 1;\n \n }\n else {\n \n if (nabor[i] > 0)\n { gorizont[i] = (nabor[i] / 3);\n vertik[i] = 3;\n \n }\n else {\n vertik[i] = 2;\n gorizont[i] = 4; }\n }\n }\n int maxvertik = vertik.Max();\n int minvertik = vertik.Min();\n int maxgorizont = gorizont.Max();\n int mingorizont = gorizont.Min();\n bool sdvigg=true;\n bool sdvigv=true;\n \n if((mingorizont==1)&&(maxgorizont==4)){\n sdvigv = false;\n }\n if ((mingorizont == 1) && (maxgorizont == 3)) {\n for(int i=0;i 0) {\n vertik[i] = nabor[i] % 3;\n gorizont[i] = (nabor[i] / 3) + 1;\n \n }\n else {\n \n if (nabor[i] > 0)\n { gorizont[i] = (nabor[i] / 3);\n vertik[i] = 3;\n \n }\n else {\n vertik[i] = 2;\n gorizont[i] = 4; }\n }\n }\n int maxvertik = vertik.Max();\n int minvertik = vertik.Min();\n int maxgorizont = gorizont.Max();\n int mingorizont = gorizont.Min();\n bool sdvigg=true;\n bool sdvigv=true;\n \n if((mingorizont==1)&&(maxgorizont==4)){\n sdvigv = false;\n }\n if ((mingorizont == 1) && (maxgorizont == 3)) {\n for(int i=0;i= 0 && newCurPos1 <= 3 && newCurPos2 >= 0 && newCurPos2 <= 2) newCurNum = (newCurPos1 - 1) * 3 + newCurPos2;\n else return false;\n if (newCurNum >= 1 && newCurNum <= 9) return MatchRecursively(newCurNum, curStrPos + 1);\n else if (newCurNum == 11) return MatchRecursively(0, curStrPos + 1);\n else return false;\n \n }\n\n static void Main(string[] args)\n {\n\n bool fl = true;\n\n Program p = new Program();\n p.ReadInput();\n\n for (int i = 0; i <= 9; i++)\n {\n if (i == (int)Char.GetNumericValue(p.s[0])) continue;\n if (p.MatchRecursively(i, 0)) { Console.WriteLine(\"NO\"); fl = false; break; }\n }\n\n if (fl) Console.WriteLine(\"YES\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n string s = input.NextToken();\n var r = new int[] { 4, 1, 1, 1, 2, 2, 2, 3, 3, 3 };\n var c = new int[] { 2, 1, 2, 3, 1, 2, 3, 1, 2, 3 };\n string[] m = new string[6]\n {\n \".....\",\n \".***.\",\n \".***.\",\n \".***.\",\n \"..*..\",\n \".....\"\n };\n for (int dx = -1; dx <= 1; dx += 2)\n {\n for (int dy = -1; dy <= 1; dy += 2)\n {\n bool canShift = true;\n for (int i = 0; i < n; i++)\n {\n int d = s[i] - '0';\n if (m[r[d] + dx][c[d] + dy] == '.')\n {\n canShift = false;\n break;\n }\n }\n if (canShift)\n {\n Console.Write(\"NO\");\n return;\n }\n }\n }\n Console.Write(\"YES\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\t//DON'T FORGET TO SET IT TO FALSE BEFORE SUBMIT!!!!\n\t\tpublic const bool useFiles = false;\n\n\t\tprivate static StreamReader GetStandardInputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamReader(@\"in.txt\")\n\t\t\t\t: new StreamReader(Console.OpenStandardInput());\n\t\t}\n\n\t\tprivate static StreamWriter GetStandardOutputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamWriter(@\"out.txt\")\n\t\t\t\t: new StreamWriter(Console.OpenStandardOutput());\n\t\t}\n\n\n\t\tpublic class MyComparer : IComparer>\n\t\t{\n\t\t\tpublic int Compare(Tuple x, Tuple y)\n\t\t\t{\n\t\t\t\tif (x.Item2 > y.Item2)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse if (x.Item2 == y.Item2)\n\t\t\t\t{\n\t\t\t\t\tif (x.Item1 > y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (x.Item1 == y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Graph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic Graph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tadj[i] = new List();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int v, int w)\n\t\t\t{\n\t\t\t\tadj[v].Add(w);\n\t\t\t\tadj[w].Add(v);\n\t\t\t}\n\n\t\t\tpublic int[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNode\n\t\t{\n\t\t\tpublic int Weight { get; set; }\n\n\t\t\tpublic int A { get; set; }\n\t\t\tpublic int B { get; set; }\n\n\t\t\tpublic int GetOther(int s)\n\t\t\t{\n\t\t\t\treturn A == s\n\t\t\t\t\t? B\n\t\t\t\t\t: A;\n\t\t\t}\n\n\t\t\tpublic override string ToString()\n\t\t\t{\n\t\t\t\treturn string.Format(\"{0} -> {1} (W: {2})\", this.A, this.B, this.Weight);\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedGraph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic WeightedGraph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t\tadj[i] = new List();\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int x, int y, int w)\n\t\t\t{\n\t\t\t\tvar node = new WeightedNode()\n\t\t\t\t{\n\t\t\t\t\tA = x,\n\t\t\t\t\tB = y,\n\t\t\t\t\tWeight = w\n\t\t\t\t};\n\n\t\t\t\tadj[x].Add(node);\n\t\t\t\tadj[y].Add(node);\n\t\t\t}\n\n\t\t\tpublic WeightedNode[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class DFS\n\t\t{\n\t\t\tprivate Queue q;\n\t\t\tprivate bool[] marked;\n\t\t\tprivate int[] distTo;\n\n\t\t\tpublic DFS(Graph g, int s)\n\t\t\t{\n\t\t\t\tq = new Queue();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tdistTo = new int[g.V()];\n\n\t\t\t\tq.Enqueue(s);\n\t\t\t\tmarked[s] = true;\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\twhile (q.Any())\n\t\t\t\t{\n\t\t\t\t\tvar cur = q.Dequeue();\n\t\t\t\t\tvar adj = g.GetAdj(cur);\n\n\t\t\t\t\tforeach (var v in adj)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tq.Enqueue(v);\n\t\t\t\t\t\t\tmarked[v] = true;\n\t\t\t\t\t\t\tdistTo[v] = distTo[cur] + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic int GetDistance(int v)\n\t\t\t{\n\t\t\t\treturn marked[v] ? distTo[v] : -1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNodeComparor : IComparer\n\t\t{\n\t\t\tpublic int Compare(WeightedNode x, WeightedNode y)\n\t\t\t{\n\t\t\t\tvar res = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (res != 0)\n\t\t\t\t\treturn res;\n\n\t\t\t\tvar r1 = x.A.CompareTo(y.A);\n\t\t\t\tvar r2 = x.B.CompareTo(y.B);\n\n\t\t\t\tif (r1 == 0 && r2 == 0)\n\t\t\t\t\treturn 0;\n\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class PrimsMST\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate List res;\n\t\t\tprivate SortedList sl;\n\n\t\t\tpublic PrimsMST(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tres = new List();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tsl = new SortedList(new WeightedNodeComparor());\n\n\t\t\t\tmarked[s] = true;\n\t\t\t\tVisit(g, s);\n\n\t\t\t\twhile (sl.Any() && res.Count() < g.V() - 1)\n\t\t\t\t{\n\t\t\t\t\tvar next = sl.First();\n\t\t\t\t\tsl.Remove(next.Key);\n\n\t\t\t\t\tvar val = next.Value;\n\n\t\t\t\t\tif (marked[val.A] && marked[val.B])\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tres.Add(val);\n\n\t\t\t\t\tif (!marked[val.A])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.A] = true;\n\t\t\t\t\t\tVisit(g, val.A);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!marked[val.B])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.B] = true;\n\t\t\t\t\t\tVisit(g, val.B);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tpublic void Visit(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tforeach (var v in g.GetAdj(s))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v.GetOther(s)])\n\t\t\t\t\t\tsl.Add(v, v);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic List GetMST()\n\t\t\t{\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t}\n\n\t\tpublic class DoubleComaprer : IComparer\n\t\t{\n\t\t\tpublic int Compare(double x, double y)\n\t\t\t{\n\t\t\t\treturn x.CompareTo(y);\n\t\t\t}\n\t\t}\n\n\t\tpublic struct TempItem\n\t\t{\n\t\t\tpublic long Weight { get; set; }\n\t\t\tpublic int Vertex { get; set; }\n\t\t}\n\n\t\tpublic class TempItemComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(TempItem x, TempItem y)\n\t\t\t{\n\t\t\t\tvar r = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (r != 0)\n\t\t\t\t\treturn r;\n\n\t\t\t\tvar r2 = x.Vertex.CompareTo(y.Vertex);\n\t\t\t\treturn r2;\n\t\t\t}\n\t\t}\n\n\t\tpublic class DejkstraSP\n\t\t{\n\t\t\tpublic long?[] distTo;\n\t\t\tprivate int[] edgeTo;\n\t\t\tprivate SortedList pq;\n\n\t\t\tpublic DejkstraSP(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tdistTo = new long?[g.V()];\n\t\t\t\tedgeTo = new int[g.V()];\n\t\t\t\tpq = new SortedList(new TempItemComparer());\n\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\tpq.Add(new TempItem() { Vertex = s, Weight = 0 }, s);\n\t\t\t\twhile (pq.Any())\n\t\t\t\t{\n\t\t\t\t\tvar v = pq.First();\n\t\t\t\t\tpq.Remove(v.Key);\n\n\t\t\t\t\tforeach (var edge in g.GetAdj(v.Value))\n\t\t\t\t\t{\n\t\t\t\t\t\trelax(edge, v.Value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tprivate void relax(WeightedNode v, int cur)\n\t\t\t{\n\t\t\t\tint a = cur;\n\t\t\t\tint b = v.GetOther(cur);\n\n\t\t\t\tif (distTo[b] == null || distTo[b] > distTo[a] + v.Weight)\n\t\t\t\t{\n\t\t\t\t\tdistTo[b] = distTo[a] + v.Weight;\n\t\t\t\t\tedgeTo[b] = a;\n\n\t\t\t\t\tif (pq.ContainsValue(b))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar val = pq.First(x => x.Value == b);\n\t\t\t\t\t\tpq.Remove(val.Key);\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var input = GetStandardInputStream())\n\t\t\tusing (var output = GetStandardOutputStream())\n\t\t\t{\n\t\t\t\tvar n = ParseInt(input);\n\t\t\t\tvar otherNums = input.ReadLine().ToCharArray().Select(x => int.Parse(x.ToString())).ToArray();\n\n\t\t\t\tvar arr = new bool[10];\n\n\t\t\t\tforeach (var otherNum in otherNums)\n\t\t\t\t{\n\t\t\t\t\tarr[otherNum] = true;\n\t\t\t\t}\n\n\t\t\t\tvar flag1 = false;\n\t\t\t\tvar flag2 = false;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && (arr[7] || arr[9]))\n\t\t\t\t\tflag1 = true;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && arr[0])\n\t\t\t\t{\n\t\t\t\t\toutput.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\tif ((arr[1] || arr[4] || arr[7]) && (arr[3] || arr[6] || arr[9]))\n\t\t\t\t\tflag2 = true;\n\n\t\t\t\tif (flag1 || flag2)\n\t\t\t\t\toutput.WriteLine(\"YES\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\toutput.WriteLine(\"NO\");\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tprivate static double getDist(Tuple c1, Tuple c2)\n\t\t{\n\t\t\treturn Math.Sqrt(Math.Pow(c1.Item1 - c2.Item1, 2.0) + Math.Pow(c1.Item2 - c2.Item2, 2.0));\n\t\t}\n\n\t\tprivate static Tuple GetCoord(int number)\n\t\t{\n\t\t\tif (number == 0)\n\t\t\t\treturn new Tuple(1,3);\n\n\t\t\tvar y = (number - 1) / 3;\n\t\t\tvar x = number - (y*3) - 1;\n\n\t\t\treturn new Tuple(x,y);\n\t\t}\n\n\t\tprivate static long Factorial(int numb)\n\t\t{\n\t\t\tif (numb == 0)\n\t\t\t\treturn 1;\n\n\t\t\tlong res = 1;\n\t\t\tfor (int i = numb; i > 1; i--)\n\t\t\t\tres *= i;\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static double partialSum(double p, double q)\n\t\t{\n\t\t\tif (Math.Abs(p - 1) < double.Epsilon)\n\t\t\t\treturn 1;\n\n\t\t\tdouble a = p,\n\t\t\t\td = p, \n\t\t\t\tr = q;\n\n\t\t\tvar res = (a/(1 - r)) + ((r*d)/((1 - r)*(1 - r)));\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic class Clusters\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate Stack st;\n\t\t\tpublic int count;\n\n\n\t\t\tprivate int[,] fromStr(string[] zombies)\n\t\t\t{\n\t\t\t\tvar n = zombies.Length;\n\t\t\t\tvar matrix = new int[n, n];\n\t\t\t\tint i = 0;\n\n\t\t\t\tforeach (var str in zombies)\n\t\t\t\t{\n\t\t\t\t\tvar inStr = str;\n\t\t\t\t\tvar ar = new List();\n\n\t\t\t\t\tforeach (var c in inStr)\n\t\t\t\t\t{\n\t\t\t\t\t\tar.Add(int.Parse(c.ToString()));\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var j = 0; j < n; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tmatrix[i, j] = ar[j];\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\n\t\t\t\treturn matrix;\n\t\t\t}\n\t\t\tpublic Clusters(string[] zmb_str)\n\t\t\t{\n\t\t\t\tvar n = zmb_str.Count();\n\t\t\t\tvar zombies = fromStr(zmb_str);\n\t\t\t\tst = new Stack();\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tcount = 0;\n\n\t\t\t\tfor (int v = 0; v < n; v++)\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\tdfs(ref zombies, v, n);\n\t\t\t\t}\n\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tforeach (var e in reverserPostOrder())\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e])\n\t\t\t\t\t{\n\t\t\t\t\t\tdfs(ref zombies, e, n);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\tprivate void dfs(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tmarked[v] = true;\n\t\t\t\tforeach (var e in getAdj(ref g, v, n))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e]) dfs(ref g, e, n);\n\t\t\t\t}\n\t\t\t\tst.Push(v);\n\t\t\t}\t\t\t\n\n\t\t\tprivate int[] getAdj(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tvar res = new List();\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tif (i == v)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (g[v, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.Add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn res.ToArray();\n\t\t\t}\n\n\t\t\tpublic int[] reverserPostOrder()\n\t\t\t{\n\t\t\t\treturn st.ToArray();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\tprivate static int binarySearch(ref long[] ar, int l, int h, long key)\n\t\t{\n\t\t\tif (l >= h)\n\t\t\t\treturn -1;\n\n\t\t\tvar mid = (l + h) / 2;\n\n\t\t\tif (ar[mid] == key)\n\t\t\t\treturn mid;\n\n\t\t\tif (key > ar[mid])\n\t\t\t\treturn binarySearch(ref ar, mid+1, h, key);\n\n\t\t\treturn binarySearch(ref ar, 0, mid, key);\n\t\t}\n\n\t\tprivate static int[] ParseIntString(StreamReader input)\n\t\t{\n\t\t\treturn input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\t\t}\n\n\t\tprivate static int ParseInt(StreamReader input)\n\t\t{\n\t\t\treturn int.Parse(input.ReadLine());\n\t\t}\n\n\t\tprivate static long primaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][i];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long secondaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][n - i - 1];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static int GetIdx(int n, int lastAns, int x)\n\t\t{\n\t\t\treturn (x ^ lastAns) % n;\n\t\t}\n\n\t\tprivate static int getHourGlassSum(ref int[][] ar, int x, int y)\n\t\t{\n\t\t\tvar sum = 0;\n\n\t\t\tsum += ar[x][y];\n\t\t\tsum += ar[x][y + 1];\n\t\t\tsum += ar[x][y + 2];\n\n\t\t\tsum += ar[x + 1][y + 1];\n\n\t\t\tsum += ar[x + 2][y];\n\t\t\tsum += ar[x + 2][y + 1];\n\t\t\tsum += ar[x + 2][y + 2];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long sumFrom(int start, ref long[] sums, long totalSum)\n\t\t{\n\t\t\tif (start >= sums.Length)\n\t\t\t\treturn 0;\n\n\t\t\treturn totalSum - sums[start - 1];\n\t\t}\n\n\n\t\tpublic int ReadSingleInt(StreamReader input)\n\t\t{\n\t\t\tvar line = input.ReadLine();\n\t\t\treturn int.Parse(line);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic int[] ReadInts(char sep = ' ')\n\t\t{\n\t\t\tvar line = Console.ReadLine();\n\t\t\tvar arr = line.Split(sep).Select(x => int.Parse(x)).ToArray();\n\n\t\t\treturn arr;\n\t\t}\n\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\t//DON'T FORGET TO SET IT TO FALSE BEFORE SUBMIT!!!!\n\t\tpublic const bool useFiles = false;\n\n\t\tprivate static StreamReader GetStandardInputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamReader(@\"in.txt\")\n\t\t\t\t: new StreamReader(Console.OpenStandardInput());\n\t\t}\n\n\t\tprivate static StreamWriter GetStandardOutputStream()\n\t\t{\n\t\t\treturn useFiles\n\t\t\t\t? new StreamWriter(@\"out.txt\")\n\t\t\t\t: new StreamWriter(Console.OpenStandardOutput());\n\t\t}\n\n\n\t\tpublic class MyComparer : IComparer>\n\t\t{\n\t\t\tpublic int Compare(Tuple x, Tuple y)\n\t\t\t{\n\t\t\t\tif (x.Item2 > y.Item2)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse if (x.Item2 == y.Item2)\n\t\t\t\t{\n\t\t\t\t\tif (x.Item1 > y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (x.Item1 == y.Item1)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic class Graph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic Graph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tadj[i] = new List();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int v, int w)\n\t\t\t{\n\t\t\t\tadj[v].Add(w);\n\t\t\t\tadj[w].Add(v);\n\t\t\t}\n\n\t\t\tpublic int[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNode\n\t\t{\n\t\t\tpublic int Weight { get; set; }\n\n\t\t\tpublic int A { get; set; }\n\t\t\tpublic int B { get; set; }\n\n\t\t\tpublic int GetOther(int s)\n\t\t\t{\n\t\t\t\treturn A == s\n\t\t\t\t\t? B\n\t\t\t\t\t: A;\n\t\t\t}\n\n\t\t\tpublic override string ToString()\n\t\t\t{\n\t\t\t\treturn string.Format(\"{0} -> {1} (W: {2})\", this.A, this.B, this.Weight);\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedGraph\n\t\t{\n\t\t\tprivate List[] adj;\n\n\t\t\tpublic WeightedGraph(int n)\n\t\t\t{\n\t\t\t\tadj = new List[n];\n\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t\tadj[i] = new List();\n\t\t\t}\n\n\t\t\tpublic void AddEdge(int x, int y, int w)\n\t\t\t{\n\t\t\t\tvar node = new WeightedNode()\n\t\t\t\t{\n\t\t\t\t\tA = x,\n\t\t\t\t\tB = y,\n\t\t\t\t\tWeight = w\n\t\t\t\t};\n\n\t\t\t\tadj[x].Add(node);\n\t\t\t\tadj[y].Add(node);\n\t\t\t}\n\n\t\t\tpublic WeightedNode[] GetAdj(int v)\n\t\t\t{\n\t\t\t\treturn adj[v].ToArray();\n\t\t\t}\n\n\t\t\tpublic int V()\n\t\t\t{\n\t\t\t\treturn adj.Count();\n\t\t\t}\n\t\t}\n\n\t\tpublic class DFS\n\t\t{\n\t\t\tprivate Queue q;\n\t\t\tprivate bool[] marked;\n\t\t\tprivate int[] distTo;\n\n\t\t\tpublic DFS(Graph g, int s)\n\t\t\t{\n\t\t\t\tq = new Queue();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tdistTo = new int[g.V()];\n\n\t\t\t\tq.Enqueue(s);\n\t\t\t\tmarked[s] = true;\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\twhile (q.Any())\n\t\t\t\t{\n\t\t\t\t\tvar cur = q.Dequeue();\n\t\t\t\t\tvar adj = g.GetAdj(cur);\n\n\t\t\t\t\tforeach (var v in adj)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tq.Enqueue(v);\n\t\t\t\t\t\t\tmarked[v] = true;\n\t\t\t\t\t\t\tdistTo[v] = distTo[cur] + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic int GetDistance(int v)\n\t\t\t{\n\t\t\t\treturn marked[v] ? distTo[v] : -1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class WeightedNodeComparor : IComparer\n\t\t{\n\t\t\tpublic int Compare(WeightedNode x, WeightedNode y)\n\t\t\t{\n\t\t\t\tvar res = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (res != 0)\n\t\t\t\t\treturn res;\n\n\t\t\t\tvar r1 = x.A.CompareTo(y.A);\n\t\t\t\tvar r2 = x.B.CompareTo(y.B);\n\n\t\t\t\tif (r1 == 0 && r2 == 0)\n\t\t\t\t\treturn 0;\n\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class PrimsMST\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate List res;\n\t\t\tprivate SortedList sl;\n\n\t\t\tpublic PrimsMST(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tres = new List();\n\t\t\t\tmarked = new bool[g.V()];\n\t\t\t\tsl = new SortedList(new WeightedNodeComparor());\n\n\t\t\t\tmarked[s] = true;\n\t\t\t\tVisit(g, s);\n\n\t\t\t\twhile (sl.Any() && res.Count() < g.V() - 1)\n\t\t\t\t{\n\t\t\t\t\tvar next = sl.First();\n\t\t\t\t\tsl.Remove(next.Key);\n\n\t\t\t\t\tvar val = next.Value;\n\n\t\t\t\t\tif (marked[val.A] && marked[val.B])\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tres.Add(val);\n\n\t\t\t\t\tif (!marked[val.A])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.A] = true;\n\t\t\t\t\t\tVisit(g, val.A);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!marked[val.B])\n\t\t\t\t\t{\n\t\t\t\t\t\tmarked[val.B] = true;\n\t\t\t\t\t\tVisit(g, val.B);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tpublic void Visit(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tforeach (var v in g.GetAdj(s))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v.GetOther(s)])\n\t\t\t\t\t\tsl.Add(v, v);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic List GetMST()\n\t\t\t{\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t}\n\n\t\tpublic class DoubleComaprer : IComparer\n\t\t{\n\t\t\tpublic int Compare(double x, double y)\n\t\t\t{\n\t\t\t\treturn x.CompareTo(y);\n\t\t\t}\n\t\t}\n\n\t\tpublic struct TempItem\n\t\t{\n\t\t\tpublic long Weight { get; set; }\n\t\t\tpublic int Vertex { get; set; }\n\t\t}\n\n\t\tpublic class TempItemComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(TempItem x, TempItem y)\n\t\t\t{\n\t\t\t\tvar r = x.Weight.CompareTo(y.Weight);\n\n\t\t\t\tif (r != 0)\n\t\t\t\t\treturn r;\n\n\t\t\t\tvar r2 = x.Vertex.CompareTo(y.Vertex);\n\t\t\t\treturn r2;\n\t\t\t}\n\t\t}\n\n\t\tpublic class DejkstraSP\n\t\t{\n\t\t\tpublic long?[] distTo;\n\t\t\tprivate int[] edgeTo;\n\t\t\tprivate SortedList pq;\n\n\t\t\tpublic DejkstraSP(WeightedGraph g, int s)\n\t\t\t{\n\t\t\t\tdistTo = new long?[g.V()];\n\t\t\t\tedgeTo = new int[g.V()];\n\t\t\t\tpq = new SortedList(new TempItemComparer());\n\n\t\t\t\tdistTo[s] = 0;\n\n\t\t\t\tpq.Add(new TempItem() { Vertex = s, Weight = 0 }, s);\n\t\t\t\twhile (pq.Any())\n\t\t\t\t{\n\t\t\t\t\tvar v = pq.First();\n\t\t\t\t\tpq.Remove(v.Key);\n\n\t\t\t\t\tforeach (var edge in g.GetAdj(v.Value))\n\t\t\t\t\t{\n\t\t\t\t\t\trelax(edge, v.Value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tprivate void relax(WeightedNode v, int cur)\n\t\t\t{\n\t\t\t\tint a = cur;\n\t\t\t\tint b = v.GetOther(cur);\n\n\t\t\t\tif (distTo[b] == null || distTo[b] > distTo[a] + v.Weight)\n\t\t\t\t{\n\t\t\t\t\tdistTo[b] = distTo[a] + v.Weight;\n\t\t\t\t\tedgeTo[b] = a;\n\n\t\t\t\t\tif (pq.ContainsValue(b))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar val = pq.First(x => x.Value == b);\n\t\t\t\t\t\tpq.Remove(val.Key);\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpq.Add(new TempItem() { Vertex = b, Weight = distTo[b].Value }, b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var input = GetStandardInputStream())\n\t\t\tusing (var output = GetStandardOutputStream())\n\t\t\t{\n\t\t\t\tvar n = ParseInt(input);\n\t\t\t\tvar otherNums = input.ReadLine().ToCharArray().Select(x => int.Parse(x.ToString())).ToArray();\n\n\t\t\t\tvar arr = new bool[10];\n\n\t\t\t\tforeach (var otherNum in otherNums)\n\t\t\t\t{\n\t\t\t\t\tarr[otherNum] = true;\n\t\t\t\t}\n\n\t\t\t\tvar flag1 = false;\n\t\t\t\tvar flag2 = false;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && (arr[7] || arr[9]))\n\t\t\t\t\tflag1 = true;\n\n\t\t\t\tif ((arr[1] || arr[2] || arr[3]) && arr[0])\n\t\t\t\t\tflag2 = true;\n\n\t\t\t\tif (flag1 || flag2)\n\t\t\t\t\toutput.WriteLine(\"YES\");\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\toutput.WriteLine(\"NO\");\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tprivate static double getDist(Tuple c1, Tuple c2)\n\t\t{\n\t\t\treturn Math.Sqrt(Math.Pow(c1.Item1 - c2.Item1, 2.0) + Math.Pow(c1.Item2 - c2.Item2, 2.0));\n\t\t}\n\n\t\tprivate static Tuple GetCoord(int number)\n\t\t{\n\t\t\tif (number == 0)\n\t\t\t\treturn new Tuple(1,3);\n\n\t\t\tvar y = (number - 1) / 3;\n\t\t\tvar x = number - (y*3) - 1;\n\n\t\t\treturn new Tuple(x,y);\n\t\t}\n\n\t\tprivate static long Factorial(int numb)\n\t\t{\n\t\t\tif (numb == 0)\n\t\t\t\treturn 1;\n\n\t\t\tlong res = 1;\n\t\t\tfor (int i = numb; i > 1; i--)\n\t\t\t\tres *= i;\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static double partialSum(double p, double q)\n\t\t{\n\t\t\tif (Math.Abs(p - 1) < double.Epsilon)\n\t\t\t\treturn 1;\n\n\t\t\tdouble a = p,\n\t\t\t\td = p, \n\t\t\t\tr = q;\n\n\t\t\tvar res = (a/(1 - r)) + ((r*d)/((1 - r)*(1 - r)));\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic class Clusters\n\t\t{\n\t\t\tprivate bool[] marked;\n\t\t\tprivate Stack st;\n\t\t\tpublic int count;\n\n\n\t\t\tprivate int[,] fromStr(string[] zombies)\n\t\t\t{\n\t\t\t\tvar n = zombies.Length;\n\t\t\t\tvar matrix = new int[n, n];\n\t\t\t\tint i = 0;\n\n\t\t\t\tforeach (var str in zombies)\n\t\t\t\t{\n\t\t\t\t\tvar inStr = str;\n\t\t\t\t\tvar ar = new List();\n\n\t\t\t\t\tforeach (var c in inStr)\n\t\t\t\t\t{\n\t\t\t\t\t\tar.Add(int.Parse(c.ToString()));\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var j = 0; j < n; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tmatrix[i, j] = ar[j];\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t}\n\n\t\t\t\treturn matrix;\n\t\t\t}\n\t\t\tpublic Clusters(string[] zmb_str)\n\t\t\t{\n\t\t\t\tvar n = zmb_str.Count();\n\t\t\t\tvar zombies = fromStr(zmb_str);\n\t\t\t\tst = new Stack();\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tcount = 0;\n\n\t\t\t\tfor (int v = 0; v < n; v++)\n\t\t\t\t{\n\t\t\t\t\tif (!marked[v])\n\t\t\t\t\t\tdfs(ref zombies, v, n);\n\t\t\t\t}\n\n\t\t\t\tmarked = new bool[n];\n\t\t\t\tforeach (var e in reverserPostOrder())\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e])\n\t\t\t\t\t{\n\t\t\t\t\t\tdfs(ref zombies, e, n);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\tprivate void dfs(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tmarked[v] = true;\n\t\t\t\tforeach (var e in getAdj(ref g, v, n))\n\t\t\t\t{\n\t\t\t\t\tif (!marked[e]) dfs(ref g, e, n);\n\t\t\t\t}\n\t\t\t\tst.Push(v);\n\t\t\t}\t\t\t\n\n\t\t\tprivate int[] getAdj(ref int[,] g, int v, int n)\n\t\t\t{\n\t\t\t\tvar res = new List();\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tif (i == v)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (g[v, i] == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.Add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn res.ToArray();\n\t\t\t}\n\n\t\t\tpublic int[] reverserPostOrder()\n\t\t\t{\n\t\t\t\treturn st.ToArray();\n\t\t\t}\n\t\t}\n\t\t\n\n\t\tprivate static int binarySearch(ref long[] ar, int l, int h, long key)\n\t\t{\n\t\t\tif (l >= h)\n\t\t\t\treturn -1;\n\n\t\t\tvar mid = (l + h) / 2;\n\n\t\t\tif (ar[mid] == key)\n\t\t\t\treturn mid;\n\n\t\t\tif (key > ar[mid])\n\t\t\t\treturn binarySearch(ref ar, mid+1, h, key);\n\n\t\t\treturn binarySearch(ref ar, 0, mid, key);\n\t\t}\n\n\t\tprivate static int[] ParseIntString(StreamReader input)\n\t\t{\n\t\t\treturn input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\t\t}\n\n\t\tprivate static int ParseInt(StreamReader input)\n\t\t{\n\t\t\treturn int.Parse(input.ReadLine());\n\t\t}\n\n\t\tprivate static long primaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][i];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long secondaryDiagSum(ref int[][] a, int n)\n\t\t{\n\t\t\tlong sum = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\tsum += a[i][n - i - 1];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static int GetIdx(int n, int lastAns, int x)\n\t\t{\n\t\t\treturn (x ^ lastAns) % n;\n\t\t}\n\n\t\tprivate static int getHourGlassSum(ref int[][] ar, int x, int y)\n\t\t{\n\t\t\tvar sum = 0;\n\n\t\t\tsum += ar[x][y];\n\t\t\tsum += ar[x][y + 1];\n\t\t\tsum += ar[x][y + 2];\n\n\t\t\tsum += ar[x + 1][y + 1];\n\n\t\t\tsum += ar[x + 2][y];\n\t\t\tsum += ar[x + 2][y + 1];\n\t\t\tsum += ar[x + 2][y + 2];\n\n\t\t\treturn sum;\n\t\t}\n\n\t\tprivate static long sumFrom(int start, ref long[] sums, long totalSum)\n\t\t{\n\t\t\tif (start >= sums.Length)\n\t\t\t\treturn 0;\n\n\t\t\treturn totalSum - sums[start - 1];\n\t\t}\n\n\n\t\tpublic int ReadSingleInt(StreamReader input)\n\t\t{\n\t\t\tvar line = input.ReadLine();\n\t\t\treturn int.Parse(line);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic int[] ReadInts(char sep = ' ')\n\t\t{\n\t\t\tvar line = Console.ReadLine();\n\t\t\tvar arr = line.Split(sep).Select(x => int.Parse(x)).ToArray();\n\n\t\t\treturn arr;\n\t\t}\n\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n bool[] ls = new bool[10];\n for (int i = 0; i < s.Length; i++)\n {\n ls[s[i] - '0'] = true;\n }\n bool[] yoko = new bool[3];\n bool[] tate = new bool[4];\n \n if(ls[0])\n {\n yoko[1] = true;\n tate[3] = true;\n }\n\n for (int i = 1; i < 10; i++)\n {\n if(ls[i])\n {\n yoko[(i - 1) % 3] = true;\n tate[(i - 1) / 3] = true;\n }\n }\n if (tate[3])//0\n {\n if (tate[0])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if((tate[0]&&tate[2]) && yoko[0]&&yoko[2])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Mike_and_Cellphone\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n s = reader.ReadLine();\n\n var keyboard = new char[10][];\n keyboard[0] = \".......\".ToCharArray();\n keyboard[1] = \".......\".ToCharArray();\n keyboard[2] = \".......\".ToCharArray();\n keyboard[3] = \"..123..\".ToCharArray();\n keyboard[4] = \"..456..\".ToCharArray();\n keyboard[5] = \"..789..\".ToCharArray();\n keyboard[6] = \"...0...\".ToCharArray();\n keyboard[7] = \".......\".ToCharArray();\n keyboard[8] = \".......\".ToCharArray();\n keyboard[9] = \".......\".ToCharArray();\n\n var x = new int[s.Length];\n var y = new int[s.Length];\n\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = 3; j <= 6; j++)\n {\n for (int k = 2; k < 5; k++)\n {\n if (s[i] == keyboard[j][k])\n {\n x[i] = j;\n y[i] = k;\n goto mbox;\n }\n }\n }\n mbox:\n ;\n }\n\n for (int j = 3; j < 6; j++)\n {\n for (int k = 2; k < 5; k++)\n {\n if (keyboard[j][k] != '.' && keyboard[j][k] != s[0])\n {\n int xx = j, yy = k;\n bool ok = true;\n for (int i = 1; i < x.Length; i++)\n {\n xx += x[i] - x[i - 1];\n yy += y[i] - y[i - 1];\n\n if (keyboard[xx][yy] == '.')\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n }\n }\n\n writer.WriteLine(\"YES\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar number = sr.NextString();\n\t\t\tvar matrix = new[,] {\n\t\t\t\t{ '1', '2', '3' },\n\t\t\t\t{ '4', '5', '6' },\n\t\t\t\t{ '7', '8', '9' },\n\t\t\t\t{ '?', '0', '?' }\n\t\t\t};\n\t\t\tvar operations = new List>();\n\t\t\tvar sourceI = 0;\n\t\t\tvar sourceJ = 0;\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tvar digit = number[i];\n\t\t\t\tvar currI = 0;\n\t\t\t\tvar currJ = 0;\n\t\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\t\tif (matrix[k, l] == digit) {\n\t\t\t\t\t\t\tcurrI = k;\n\t\t\t\t\t\t\tcurrJ = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (operations.Count == 0) {\n\t\t\t\t\toperations.Add(new Tuple(currI, currJ));\n\t\t\t\t\tsourceI = currI;\n\t\t\t\t\tsourceJ = currJ;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toperations.Add(new Tuple(currI - sourceI, currJ - sourceJ));\n\t\t\t\t\tsourceI = currI;\n\t\t\t\t\tsourceJ = currJ;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar canCount = 0;\n\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\tif (k == 3 && l != 1) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar currI = k;\n\t\t\t\t\tvar currJ = l;\n\t\t\t\t\tvar can = true;\n\t\t\t\t\tfor (var i = 1; i < operations.Count; i++) {\n\t\t\t\t\t\tvar next = operations[i];\n\t\t\t\t\t\tif (!Can(currI, next.Item1, currJ, next.Item2)) {\n\t\t\t\t\t\t\tcan = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tcurrI += next.Item1;\n\t\t\t\t\t\t\tcurrJ += next.Item2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (can) {\n\t\t\t\t\t\tcanCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (canCount > 1) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\n\t\tprivate bool Can(int i,int dI, int j, int dJ)\n\t\t{\n\t\t\tif (i + dI == 3) {\n\t\t\t\tif (i + dJ == 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i + dI >= 0 && i + dI < 3 && j + dJ >= 0 && j + dJ < 3)\n\t\t\t\treturn true;\n\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar number = sr.NextString();\n\t\t\tvar matrix = new[,] {\n\t\t\t\t{ '1', '2', '3' },\n\t\t\t\t{ '4', '5', '6' },\n\t\t\t\t{ '7', '8', '9' },\n\t\t\t\t{ '?', '0', '?' }\n\t\t\t};\n\t\t\tvar operations = new List>();\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tvar digit = number[i];\n\t\t\t\tvar currI = 0;\n\t\t\t\tvar currJ = 0;\n\t\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\t\tif (matrix[k, l] == digit) {\n\t\t\t\t\t\t\tcurrI = k;\n\t\t\t\t\t\t\tcurrJ = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (operations.Count == 0) {\n\t\t\t\t\toperations.Add(new Tuple(currI, currJ));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toperations.Add(new Tuple(currI - operations[operations.Count - 1].Item1, currJ - operations[operations.Count - 1].Item2));\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar canCount = 0;\n\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\tif (k == 3 && l != 1) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar currI = k;\n\t\t\t\t\tvar currJ = l;\n\t\t\t\t\tvar can = true;\n\t\t\t\t\tfor (var i = 1; i < operations.Count; i++) {\n\t\t\t\t\t\tvar next = operations[i];\n\t\t\t\t\t\tif (!Can(currI, next.Item1, currJ, next.Item2)) {\n\t\t\t\t\t\t\tcan = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tcurrI += next.Item1;\n\t\t\t\t\t\t\tcurrJ += next.Item2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (can) {\n\t\t\t\t\t\tcanCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (canCount > 1) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\n\t\tprivate bool Can(int i,int dI, int j, int dJ)\n\t\t{\n\t\t\tif (i + dI == 3) {\n\t\t\t\tif (i + dJ == 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i + dI >= 0 && i + dI < 3 && j + dJ >= 0 && j + dJ < 3)\n\t\t\t\treturn true;\n\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar number = sr.NextString();\n\t\t\tvar matrix = new[,] {\n\t\t\t\t{ '1', '2', '3' },\n\t\t\t\t{ '4', '5', '6' },\n\t\t\t\t{ '7', '8', '9' },\n\t\t\t\t{ '?', '0', '?' }\n\t\t\t};\n\t\t\tvar operations = new List>();\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tvar digit = number[i];\n\t\t\t\tvar currI = 0;\n\t\t\t\tvar currJ = 0;\n\t\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\t\tif (matrix[k, l] == digit) {\n\t\t\t\t\t\t\tcurrI = k;\n\t\t\t\t\t\t\tcurrJ = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (operations.Count == 0) {\n\t\t\t\t\toperations.Add(new Tuple(currI, currJ));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\toperations.Add(new Tuple(currI - operations[operations.Count - 1].Item1, currJ - operations[operations.Count - 1].Item2));\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar canCount = 0;\n\t\t\tfor (var k = 0; k < 4; k++) {\n\t\t\t\tfor (var l = 0; l < 3; l++) {\n\t\t\t\t\tif (k == 3 && l != 1) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar currI = k;\n\t\t\t\t\tvar currJ = l;\n\t\t\t\t\tvar can = true;\n\t\t\t\t\tfor (var i = 1; i < operations.Count; i++) {\n\t\t\t\t\t\tvar next = operations[i];\n\t\t\t\t\t\tif (!Can(currI, next.Item1, currJ, next.Item2)) {\n\t\t\t\t\t\t\tcan = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (can) {\n\t\t\t\t\t\tcanCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (canCount > 1) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\n\t\tprivate bool Can(int i,int dI, int j, int dJ)\n\t\t{\n\t\t\tif (i + dI == 3) {\n\t\t\t\tif (i + dJ == 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i + dI >= 0 && i + dI < 3 && j + dJ >= 0 && j + dJ < 3)\n\t\t\t\treturn true;\n\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n int int_digits = int.Parse(Console.ReadLine());\n string str_number = Console.ReadLine();\n string str_result = \"NO\";\n\n int digit2;\n bool b_half1 = false;\n bool b_half2 = false;\n\n foreach (char digit in str_number)\n {\n digit2 = int.Parse(digit.ToString());\n switch (digit2)\n {\n case 1:\n if (str_number.Contains(\"9\") || str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"3\")||str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n if (str_number.Contains(\"7\"))\n {\n b_half2 = true;\n }\n break;\n case 2:\n if (str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"8\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 3:\n if (str_number.Contains(\"0\") || str_number.Contains(\"7\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"8\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 4:\n if (str_number.Contains(\"6\")||str_number.Contains(\"3\")||str_number.Contains(\"9\"))\n {\n b_half1 = true;\n }\n break;\n case 7:\n if (str_number.Contains(\"9\")||str_number.Contains(\"3\")||str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n break;\n }\n }\n if (b_half1==true & b_half2 == true)\n {\n str_result = \"YES\";\n }\n Console.WriteLine(str_result);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n int int_digits = int.Parse(Console.ReadLine());\n string str_number = Console.ReadLine();\n string str_result = \"NO\";\n\n int digit2;\n\n foreach (char digit in str_number)\n {\n digit2 = int.Parse(digit.ToString());\n switch (digit2)\n {\n case 1:\n if (str_number.Contains(\"9\") || str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n break;\n case 2:\n if (str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n break;\n case 3:\n if (str_number.Contains(\"0\") || str_number.Contains(\"7\"))\n {\n str_result = \"YES\";\n }\n break;\n }\n }\n Console.WriteLine(str_result);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n int int_digits = int.Parse(Console.ReadLine());\n string str_number = Console.ReadLine();\n string str_result = \"NO\";\n\n int digit2;\n bool b_half1 = false;\n bool b_half2 = false;\n\n foreach (char digit in str_number)\n {\n digit2 = int.Parse(digit.ToString());\n switch (digit2)\n {\n case 1:\n if (str_number.Contains(\"9\") || str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"3\"))\n {\n b_half1 = true;\n }\n if (str_number.Contains(\"7\"))\n {\n b_half2 = true;\n }\n break;\n case 2:\n if (str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n break;\n case 3:\n if (str_number.Contains(\"0\") || str_number.Contains(\"7\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 4:\n if (str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n break;\n case 7:\n if (str_number.Contains(\"9\"))\n {\n b_half1 = true;\n }\n break;\n }\n }\n if (b_half1==true & b_half2 == true)\n {\n str_result = \"YES\";\n }\n Console.WriteLine(str_result);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n int int_digits = int.Parse(Console.ReadLine());\n string str_number = Console.ReadLine();\n string str_result = \"NO\";\n\n int digit2;\n bool b_half1 = false;\n bool b_half2 = false;\n\n foreach (char digit in str_number)\n {\n digit2 = int.Parse(digit.ToString());\n switch (digit2)\n {\n case 1:\n if (str_number.Contains(\"9\") || str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"3\")||str_number.Contains(\"6\")||str_number.Contains(\"9\"))\n {\n b_half1 = true;\n }\n if (str_number.Contains(\"7\")||str_number.Contains(\"8\")||str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 2:\n if (str_number.Contains(\"0\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"8\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 3:\n if (str_number.Contains(\"0\") || str_number.Contains(\"7\"))\n {\n str_result = \"YES\";\n }\n if (str_number.Contains(\"7\") || str_number.Contains(\"8\") || str_number.Contains(\"9\"))\n {\n b_half2 = true;\n }\n break;\n case 4:\n if (str_number.Contains(\"6\")||str_number.Contains(\"3\")||str_number.Contains(\"9\"))\n {\n b_half1 = true;\n }\n break;\n case 7:\n if (str_number.Contains(\"9\")||str_number.Contains(\"3\")||str_number.Contains(\"6\"))\n {\n b_half1 = true;\n }\n break;\n }\n }\n if (b_half1==true & b_half2 == true)\n {\n str_result = \"YES\";\n }\n Console.WriteLine(str_result);\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n public class TupleList : List>\n {\n public void Add(int item1, int item2, string s)\n {\n Add(new Tuple(item1, item2, s));\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int most_left = 2;\n int most_right = 0;\n int most_up = 4;\n int most_down = 1;\n\n for(int i = 0; i< n; i++)\n {\n int input_number = 0;\n if (input[i] - '0' == 0) input_number = 10;\n else input_number = input[i] - '0';\n if (most_right != 2 && (input_number-1) % 3 > most_right) most_right = (input_number-1)%3;\n if (most_left != 0 && (input_number-1) % 3 < most_left) most_left= (input_number-1) % 3;\n if (most_up != 1 && (input_number+2) / 3 < most_up) most_up = (input_number+2)/3;\n if (most_down != 4 && (input_number+2) / 3 > most_down) most_down = (input_number+2)/3;\n }\n\n if (most_right - most_left == 2 && most_down - most_up == 2) Console.WriteLine(\"YES\");\n else if (most_down - most_up == 3) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n public class TupleList : List>\n {\n public void Add(int item1, int item2, string s)\n {\n Add(new Tuple(item1, item2, s));\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int most_left = 2;\n int most_right = 0;\n int most_up = 4;\n int most_down = 1;\n bool is_8_only_most_down = false;\n\n for(int i = 0; i< n; i++)\n {\n int input_number = 0;\n if (input[i] - '0' == 0) input_number = 11;\n else input_number = input[i] - '0';\n if (most_right != 2 && (input_number-1) % 3 > most_right) most_right = (input_number-1)%3;\n if (most_left != 0 && (input_number-1) % 3 < most_left) most_left= (input_number-1) % 3;\n if (most_up != 1 && (input_number+2) / 3 < most_up) most_up = (input_number+2)/3;\n if (most_down != 4 && (input_number+2) / 3 > most_down) most_down = (input_number+2)/3;\n if (!is_8_only_most_down && input_number == 8) is_8_only_most_down = true;\n if (is_8_only_most_down && (input_number == 7 || input_number == 9)) is_8_only_most_down = false;\n }\n\n if (most_right - most_left == 2 && most_down - most_up == 2)\n {\n if (!is_8_only_most_down) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n else if (most_down - most_up == 3) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n public class TupleList : List>\n {\n public void Add(int item1, int item2, string s)\n {\n Add(new Tuple(item1, item2, s));\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int most_left = 2;\n int most_right = 0;\n int most_up = 4;\n int most_down = 1;\n\n for(int i = 0; i< n; i++)\n {\n int input_number = 0;\n if (input[i] - '0' == 0) input_number = 11;\n else input_number = input[i] - '0';\n if (most_right != 2 && (input_number-1) % 3 > most_right) most_right = (input_number-1)%3;\n if (most_left != 0 && (input_number-1) % 3 < most_left) most_left= (input_number-1) % 3;\n if (most_up != 1 && (input_number+2) / 3 < most_up) most_up = (input_number+2)/3;\n if (most_down != 4 && (input_number+2) / 3 > most_down) most_down = (input_number+2)/3;\n }\n\n if (most_right - most_left == 2 && most_down - most_up == 2) Console.WriteLine(\"YES\");\n else if (most_down - most_up == 3) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] xr = { 3, 0, 0, 0, 1, 1, 1, 2, 2, 2 };\n int[] xc = { 1, 0, 1, 2, 0, 1, 2, 0, 1, 2 }; \n\n public void Solve()\n {\n int n = ReadInt();\n if (n == 1)\n {\n Write(\"NO\");\n return;\n }\n string s = ReadToken();\n\n bool ans = true;\n for (int i = 0; i < 10; i++)\n if (s[0] - '0' != i)\n {\n int r = xr[i];\n int c = xc[i];\n bool ok = true;\n for (int j = 1; j < n; j++)\n {\n int dr = xr[s[j] - '0'] - xr[s[j - 1] - '0'];\n int dc = xc[s[j] - '0'] - xc[s[j - 1] - '0'];\n r += dr;\n c += dc;\n if (r < 0 || r > 3 || (r == 2 && c != 1) || c < 0 || c > 2)\n ok = false;\n }\n if (ok)\n ans = false;\n }\n\n Write(ans ? \"YES\" : \"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII);\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] xr = { 3, 0, 0, 0, 1, 1, 1, 2, 2, 2 };\n int[] xc = { 1, 0, 1, 2, 0, 1, 2, 0, 1, 2 }; \n\n public void Solve()\n {\n int n = ReadInt();\n string s = ReadToken();\n\n bool ans = true;\n for (int i = 0; i < 10; i++)\n if (s[0] - '0' != i)\n {\n int r = xr[i];\n int c = xc[i];\n bool ok = true;\n for (int j = 1; j < n; j++)\n {\n int dr = xr[s[j] - '0'] - xr[s[j - 1] - '0'];\n int dc = xc[s[j] - '0'] - xc[s[j - 1] - '0'];\n r += dr;\n c += dc;\n if (r < 0 || r > 3 || (r == 2 && c != 1) || c < 0 || c > 2)\n ok = false;\n }\n if (ok)\n ans = false;\n }\n\n Write(ans ? \"YES\" : \"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII);\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class _689A\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n var seq = Console.ReadLine().Select(x => (x-'0')).ToList();\n int[] left = new int[] {-1, -1, 1, 2, -1, 4, 5, -1, 7, 8 };\n int[] right = new int[] {-1, 2, 3, -1, 5, 6, -1, 8, 9, -1};\n int[] up = new int[] {8, -1, -1, -1, 1, 2, 3, 4, 5, 6 };\n int[] down = new int[] {-1, 4, 5, 6, 7, 8, 9, -1, -1, -1 };\n if (isCorrect(seq, left) || isCorrect(seq, right) || isCorrect(seq, up) || isCorrect(seq, down))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n static bool isCorrect(List source, int[] mode)\n {\n foreach(var x in source)\n {\n int to = mode[x];\n if (to == -1)\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _689A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Solution sol = new Solution();\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n Console.WriteLine(sol.GetOtherNumber(str) ? \"YES\" : \"NO\");\n }\n }\n\n public class Solution\n {\n IDictionary mp = new Dictionary()\n {\n { '0', new [] { 0, 1 } },\n { '1', new [] { 3, 0 } },\n { '2', new [] { 3, 1 } },\n { '3', new [] { 3, 2 } },\n { '4', new [] { 2, 0 } },\n { '5', new [] { 2, 1 } },\n { '6', new [] { 2, 2 } },\n { '7', new [] { 1, 0 } },\n { '8', new [] { 1, 1 } },\n { '9', new [] { 1, 2 } }\n };\n\n public bool GetOtherNumber(string n)\n {\n List steps = new List();\n\n for (int i = 1; i < n.Length; ++i)\n steps.Add(new[] { mp[n[i]][0] - mp[n[i - 1]][0], mp[n[i]][1] - mp[n[i - 1]][1] });\n\n for(int i = 0; i < 10; ++i)\n {\n if (i == n[0] - '0')\n continue;\n\n int x = mp[i + '0'][0];\n int y = mp[i + '0'][1];\n int j = 0;\n for (; j < steps.Count; j++)\n {\n x += steps[j][0];\n y += steps[j][1];\n if (OutOfTheBox(x, y))\n break;\n }\n if (j == steps.Count)\n return false;\n }\n return true;\n }\n\n\n public bool OutOfTheBox(int x, int y)\n {\n return x == 0 && y != 1 || x > 3 || y < 0 || y > 2;\n }\n }\n}\n"}], "src_uid": "d0f5174bb0bcca5a486db327b492bf33"} {"source_code": "using System;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder st = new StringBuilder();\n int pos = 0;\n while (pos(Func convertor)\n {\n return convertor(Console.ReadLine());\n }\n\n private static IEnumerable GetInputs(Func convertor, params char[] splitter)\n {\n return Console.ReadLine().Split(splitter).Select(x => convertor(x));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace BorzeDecode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n Method(ref input);\n }\n\n static void Method(ref string input)\n {\n var code = new List();\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == '-')\n {\n if (input[i + 1] == '-') code.Add('2');\n else code.Add('1');\n i += 1;\n continue;\n }\n else code.Add('0');\n }\n \n Console.WriteLine(new string(code.ToArray()));\n }\n }\n}"}, {"source_code": "using System;\nnamespace Codeforces\n{\n\t\n public class Program \n {\n public static void Main()\n {\n string s = Console.ReadLine();\n string res=\"\";\n for(int i=0; i 0)\n {\n if (str[0] == '.')\n {\n rez += 0;\n str = str.Remove(0, 1);\n }\n else\n {\n if (str[1] == '.')\n rez += 1;\n else rez += 2;\n str = str.Remove(0, 2);\n }\n }\n Console.WriteLine(rez);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces {\n\tclass MyClass {\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tSystem.Threading.Thread.CurrentThread.CurrentUICulture \n\t\t\t\t= new System.Globalization.CultureInfo(\"ja-JP\");\n\t\t\tstring code = Console.ReadLine();\n\t\t\tstring ans = \"\";\n\t\t\tint i=0;\n\t\t\twhile (i();\n var result = string.Empty;\n for (var i = 0; i < line.Length; i++)\n {\n if (line[i] == '.')\n {\n result += '0';\n }\n else\n {\n if (line[i + 1] == '.')\n {\n result += '1';\n }\n else\n {\n result += '2';\n }\n i++;\n }\n }\n Console.WriteLine(result);\n }\n\n // Here goes misc\n\n public static T Read()\n {\n var line = Console.ReadLine();\n var item = Convert.ChangeType(line, typeof (T));\n return (T) item;\n }\n\n public static List ReadList(char[] delimiters = null)\n {\n var line = Read();\n var split = line.Split(delimiters ?? new[] {' '});\n var list = split.Select(item => (T) Convert.ChangeType(item, typeof (T))).ToList();\n return list;\n }\n\n public static List ReadListNlines(int n, char[] delimiters = null)\n {\n var list = new List();\n for (var i = 0; i < n; i++)\n {\n list.Add(Read());\n }\n return list;\n }\n\n public static void ReadFromFile()\n {\n Console.SetIn(new StreamReader(@\"..\\..\\input.txt\"));\n }\n\n public static bool NextPermutation(T[] items) where T : IComparable\n {\n var i = -1;\n for (var x = items.Length - 2; x >= 0; x--)\n {\n if (items[x].CompareTo(items[x + 1]) < 0)\n {\n i = x;\n break;\n }\n }\n\n if (i == -1)\n {\n return false;\n }\n var j = 0;\n for (var x = items.Length - 1; x > i; x--)\n {\n if (items[x].CompareTo(items[i]) > 0)\n {\n j = x;\n break;\n }\n }\n var temp = items[i];\n items[i] = items[j];\n items[j] = temp;\n Array.Reverse(items, i + 1, items.Length - (i + 1));\n return true;\n }\n\n public static string ReplaceChar(string str, char c, int idx)\n {\n return str.Substring(0, idx) + c + str.Substring(idx + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n public class _32B\n {\n public static void Main()\n {\n string code = Console.ReadLine();\n var digits = new List();\n\n for (int i = 0; i < code.Length;)\n {\n if (code[i] == '.')\n {\n digits.Add('0');\n i++;\n }\n else if (code[i + 1] == '.')\n {\n digits.Add('1');\n i += 2;\n }\n else\n {\n digits.Add('2');\n i += 2;\n }\n }\n\n Console.WriteLine(string.Concat(digits));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var output = string.Empty;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '.')\n {\n output += \"0\";\n }\n else\n {\n if (str[i+1] == '-')\n output += \"2\";\n else\n output += \"1\";\n i++;\n }\n }\n Console.WriteLine(output);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n {\nstatic void Main()\n{\n char[] BorzeCode = Console.ReadLine().ToCharArray();\n string Number = \"\";\n\n for (int i = 0; i < BorzeCode.Length; i++)\n {\n if (BorzeCode[i] == '.')\n {\n Number += \"0\";\n }\n else if (BorzeCode[i] == '-' && BorzeCode[i + 1] == '.')\n {\n Number += \"1\";\n i++;\n }\n else if (BorzeCode[i] == '-' && BorzeCode[i + 1] == '-')\n {\n Number += \"2\";\n i++;\n }\n }\n\n Console.WriteLine(Number);\n \n} \n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nnamespace CP\n{\n class Program\n {\n static void Main(string [] main)\n {\n string s = Console.ReadLine();\n StringBuilder result = new StringBuilder();\n for(int i = 0 ; i 0)\n {\n // t--;\n // var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n // var n = input1[0];\n // var d = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n\n var str = Console.ReadLine();\n List dic = new List();\n List ansss = new List();\n dic.Add(\".\");\n dic.Add(\"-.\");\n dic.Add(\"--\");\n Decode(str, dic, ansss, \"\");\n Console.WriteLine(ansss[0]);\n }\n }\n\n public static void Decode(string str, List dic, List ansF, string ans)\n {\n if (str == string.Empty)\n {\n ansF.Add(ans);\n }\n var ss = dic.Where(x => str.StartsWith(x)).Select(xx => new { s = str.Substring(xx.Length), t = xx });\n\n if (ss.Any())\n {\n foreach (var p in ss)\n {\n ans = ans + dic.IndexOf(p.t);\n Decode(p.s, dic, ansF, ans);\n }\n }\n\n }\n\n\n\n public static long BinarySearch(long[] arr, long start, long key)\n\n {\n long left = start;\n long right = arr.Length;\n\n long mid = 0;\n while (left < right)\n {\n mid = (right + left) / 2;\n\n // Check if key is \n // present in array \n if (arr[mid] == key)\n {\n\n // If duplicates are present \n // it returns the position \n // of last element \n while (mid + 1 < arr.Length && arr[mid + 1] == key)\n mid++;\n break;\n }\n\n // If key is smaller, \n // ignore right half \n else if (arr[mid] > key)\n right = mid;\n\n // If key is greater, \n // ignore left half \n else\n left = mid + 1;\n }\n\n // If key is not found in array \n // then it will be before mid \n while (mid > -1 && arr[mid] > key)\n mid--;\n\n // Return mid + 1 because of \n // 0-based indexing of array \n return mid + 1;\n }\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\n\nnamespace ContestsConsoleLab\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Code= Console.ReadLine();\n\n var codeArr = Code.ToCharArray();\n\n string res = \"\";\n\n for (int i = 0; i < Code.Length; i++)\n {\n if (codeArr[i] == '.')\n res += '0';\n else if (codeArr[i] == '-' && codeArr[i + 1] == '.')\n {\n res += '1';\n i++;\n }\n else if (codeArr[i] == '-' && codeArr[i + 1] == '-')\n {\n res += '2';\n i++;\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "#region Usings\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n#endregion\npublic class B\n{\n private static void Solve()\n {\n string a = Read();\n a = a.Replace(\"--\", \"2\");\n a = a.Replace(\"-.\", \"1\");\n a = a.Replace(\".\", \"0\");\n Write(a);\n }\n #region Main\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n \n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n #endregion Main\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] {' ', '\\t',}, StringSplitOptions.RemoveEmptyEntries);\n }\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion Read / Write\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace CodeForcesApp\n{\n class B\n {\n #region Shortcuts\n static string RL() { return Console.ReadLine(); }\n static string[] RSA() { return RL().Split(' '); }\n static int[] RIA() { return Array.ConvertAll(RSA(), int.Parse); }\n static int RInt() { return int.Parse(RL()); }\n static long RLong() { return long.Parse(RL()); }\n static double RDouble() { return double.Parse(RL()); }\n static void RInts2(out int p1, out int p2) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; }\n static void RInts3(out int p1, out int p2, out int p3) { int[] a = RIA(); p1 = a[0]; p2 = a[1]; p3 = a[2]; }\n\n static void Swap(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }\n static void Fill(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }\n static void Fill(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }\n #endregion\n\n static void Main(string[] args)\n {\n System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n\n //SolutionTester tester = new SolutionTester(CodeForcesTask.B);\n //tester.Test();\n\n Task task = new Task();\n task.Solve();\n }\n\n public class Task\n {\n public void Solve()\n {\n string s = RL();\n\n string res = \"\";\n\n while (s.Length > 0)\n {\n if (s.StartsWith(\"--\"))\n {\n res += \"2\";\n s = s.Substring(2);\n } else \n if (s.StartsWith(\"-.\"))\n {\n res += \"1\";\n s = s.Substring(2);\n } else \n if (s.StartsWith(\".\"))\n {\n res += \"0\";\n s = s.Substring(1);\n }\n }\n Console.WriteLine(res);\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass a\n{\n static void Main(string[] args)\n {\n var a = Console.ReadLine();\n string r = \"\";\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == '.') r += 0;\n if(a[i] == '-')\n {\n if (a[i + 1] == '.') r += 1;\n if (a[i + 1] == '-') r += 2;\n i++;\n }\n }\n Console.WriteLine(r);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace CodeForces_32_b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int pos = 0;\n StringBuilder builder = new StringBuilder(1000);\n int state = -1;\n while (pos '9') && c != '+') return 0;\n int res = 0;\n if (!char.IsDigit((char)c)) c = Console.Read();\n while (char.IsDigit((char)c))\n {\n res = res * 10 + (int)c - (int)'0';\n c = Console.Read();\n }\n if (flag) res = -res;\n return res;\n }\n\n void Solve()\n {\n string str = Console.ReadLine();\n int state = 0;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '.')\n {\n if (state == 0) Console.Write('0');\n else\n if (state == 1)\n {\n Console.Write('1');\n state = 0;\n }\n }\n else\n {\n if (state == 0) state = 1;\n else\n if (state == 1)\n {\n Console.Write('2');\n state = 0;\n }\n }\n }\n }\n\n static void Main(string[] args)\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n#endif\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}\n"}, {"source_code": "//http://codeforces.com/problemset/problem/32/B\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces___32b_Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string re=\"\";\n string s = Console.ReadLine();\n for (int i = 1; i <= s.Length; )\n {\n if (s[i - 1].Equals('-') && s[i].Equals('-'))\n {\n re += \"2\";\n i += 2;\n }\n else if (s[i - 1].Equals('-') && s[i].Equals('.'))\n {\n re += \"1\";\n i += 2;\n }\n else\n {\n re += \"0\";\n i++;\n }\n }\n Console.WriteLine(re);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == '.')\n output += \"0\";\n\n if (i + 1 < input.Length)\n {\n if (input[i] == '-' && input[i + 1] == '.')\n {\n output += \"1\";\n i += 1;\n }\n else if (input[i] == '-' && input[i + 1] == '-')\n {\n output += \"2\";\n i += 1;\n }\n \n }\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Borze\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n int j,i;\n int[] array = new int[1000];\n var l = input.Length;\n string[] s = new string[3];\n s[0] = '.'.ToString();\n s[1] = \"-.\".ToString();\n s[2] = \"--\".ToString();\n for ( i = 0,j=0; i < l;)\n {\n var x = input.Substring(i, 1);\n if (s[0]== x)\n {\n i++;\n array[j++] = 0;\n }\n if (i>=l)\n {\n continue;\n }\n if (l-i>=2)\n {\n var x1 = input.Substring(i, 2);\n if (s[1] == x1)\n {\n i += 2;\n array[j++] = 1;\n }\n if (i >= l)\n {\n continue;\n }\n if (l-i>=2)\n {\n var x2 = input.Substring(i, 2);\n if (s[2] == x2)\n {\n i += 2;\n array[j++] = 2;\n }\n if (i >= l)\n {\n continue;\n }\n }\n\n }\n }\n\n for ( i = 0; i < j; i++)\n {\n Console.Write(array[i]);\n }\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n int i = 0;\n while (i < text.Length)\n {\n if (text[i] == '.')\n {\n Console.Write(0);\n i = i + 1;\n }\n if (i < text.Length - 1)\n {\n if (text[i] == '-' && text[i + 1] == '.')\n {\n Console.Write(1);\n i = i + 2;\n }\n\n if (i < text.Length - 1 && text[i] == '-' && text[i + 1] == '-')\n {\n Console.Write(2);\n i = i + 2;\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CP_CS\n{\n\n class Task\n {\n\n static void Solve()\n {\n string str = ReadToken();\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '.')\n {\n sb.Append('0');\n }\n else\n {\n sb.Append(str[i+1] == '.' ? '1' : '2');\n i++;\n }\n }\n Write(sb.ToString());\n }\n\n static string[] Split(string str, int chunkSize)\n {\n return Enumerable.Range(0, str.Length / chunkSize)\n .Select(i => str.Substring(i * chunkSize, chunkSize)).ToArray();\n }\n\n #region -- Main -- \n\n private static TextReader reader;\n private static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"pluses.in\");\n //writer = new StreamWriter(\"pluses.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n #region -- Read / Write --\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadAndSplitLine(char divisor)\n {\n return reader.ReadLine().Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static BigInteger ReadBigInteger()\n {\n return BigInteger.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static bool[] ReadBoolArray()\n {\n return ReadAndSplitLine().Select(chr => chr == \"1\").ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static bool[][] ReadBoolMatrix(int numberOfRows)\n {\n bool[][] matrix = new bool[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadBoolArray();\n return matrix;\n }\n\n public static bool[][] TransposeBoolMatrix(bool[][] array, int numberOfRows)\n {\n bool[][] matrix = array;\n bool[][] ret = new bool[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new bool[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n x = x.Replace(\"--\", \"2\");\n x = x.Replace(\"-.\", \"1\");\n x = x.Replace(\".\", \"0\");\n Console.WriteLine(x);\n } \n }\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Borze\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n bool f = false;\n foreach (char c in s)\n {\n if (c == '.')\n {\n writer.Write(f ? '1' : '0');\n f = false;\n }\n else\n {\n if (f)\n {\n writer.Write('2');\n f = false;\n }\n else\n {\n f = true;\n }\n }\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n var input = Console.ReadLine();\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n output += input[i] == '.' ? 0 : input[i + 1] == '.' ? 1 : 2;\n i += input[i] != '.' ? 1 : 0;\n }\n Console.WriteLine(output);\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\ufeffusing System.Text;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar str = sr.NextString();\n\t\t\tvar result = new List();\n\t\t\tSol(str, 0, result);\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var i = 0; i < result.Count; i++) {\n\t\t\t\tsb.Append(result[i]);\n\t\t\t}\n\t\t\tsw.Write(sb);\n\t\t}\n\n\t\tprivate bool Sol(string s, int indx, List list)\n\t\t{\n\t\t\tif (indx == s.Length)\n\t\t\t\treturn true;\n\t\t\tvar curr = s[indx];\n\t\t\tif (curr == '.') {\n\t\t\t\tlist.Add(0);\n\t\t\t\treturn Sol(s, indx + 1, list);\n\t\t\t}\n\t\t\tif (curr == '-') {\n\t\t\t\tif (indx + 1 == s.Length)\n\t\t\t\t\treturn false;\n\t\t\t\tvar next = s[indx + 1];\n\t\t\t\tif (next == '.') {\n\t\t\t\t\tlist.Add(1);\n\t\t\t\t\treturn Sol(s, indx + 2, list);\n\t\t\t\t}\n\t\t\t\tif (next == '-') {\n\t\t\t\t\tlist.Add(2);\n\t\t\t\t\treturn Sol(s, indx + 2, list);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Borze\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n int j,i;\n int[] array = new int[1000];\n var l = input.Length;\n string[] s = new string[3];\n s[0] = '.'.ToString();\n s[1] = \"-.\".ToString();\n s[2] = \"--\".ToString();\n for ( i = 0,j=0; i < l;)\n {\n var x = input.Substring(i, 1);\n if (s[0]== x)\n {\n i++;\n array[j++] = 0;\n }\n if (l-i>=2)\n {\n var x1 = input.Substring(i, 2);\n if (s[1] == x1)\n {\n i += 2;\n array[j++] = 1;\n }\n if (l-i>=2)\n {\n var x2 = input.Substring(i, 2);\n if (s[2] == x2)\n {\n i += 2;\n array[j++] = 2;\n }\n }\n\n }\n }\n\n for ( i = 0; i < j; i++)\n {\n Console.Write(array[i]);\n }\n Console.ReadLine();\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication41\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string ans = null;\n for (int i = 0; i < s.Length; i++)\n {\n \n if (s[i] == '-' && s[i+1] =='-' ) \n {\n ans += 2;i++;\n }\n else if (s[i] == '-' && s[i+1]=='.')\n {\n ans += 1;i++;\n }\n else if (s[i] == '.')\n {\n ans += 0;\n\n }\n }\n Console.WriteLine(ans);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n \n class Program\n {\n \n static void Main(string[] args)\n {\n string a = Console.ReadLine(),b=\"\";\n for (int i = 0; i <= a.Length-1; i++)\n {\n if (a[i]=='.')\n {\n b += \"0\";\n }\n else if (a[i] == '-' && a[i+1] == '.')\n {\n b += \"1\";\n i++;\n }\n else if (a[i] == '-' && a[i+1] == '-')\n {\n b += \"2\";\n i++;\n }\n \n \n }\n Console.WriteLine(b);\n \n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace _32\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n //s(input);\n int p = 0;\n if (!Regex.IsMatch(input, @\"^[\\.-]+$\"))\n return;\n while (p < input.Length)\n {\n if (input[p] == '-' && p + 1 < input.Length && input[p + 1] == '-')\n {\n Console.Write(2);\n p += 2;\n }\n else if (input[p] == '-' && p + 1 < input.Length && input[p + 1] == '.')\n {\n Console.Write(1);\n p += 2;\n }\n else if (input[p] == '.')\n {\n Console.Write(0);\n p++;\n }\n }\n }\n\n static string s(string input)\n {\n int p = 0;\n string output = \"\";\n if(!Regex.IsMatch(input,@\"^[\\.-]+$\"))\n return null;\n while (p < input.Length)\n {\n if (input[p] == '-' && p +1 < input.Length && input[p + 1] == '-')\n {\n Console.Write(2);\n output += 2;\n p += 2;\n }\n else if (input[p] == '-' && p + 1 < input.Length && input[p + 1] == '.')\n {\n Console.Write(1);\n output+=1;\n p += 2;\n }\n else if (input[p] == '.')\n {\n Console.Write(0);\n output += 0;\n p++;\n }\n }\n\n return output;\n }\n\n \n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program \n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"--\", \"2\").Replace(\"-.\", \"1\").Replace(\".\", \"0\"));\n }\n }\n}\n/* Sat Oct 10 2020 16:26:13 GMT+0300 (\u041c\u043e\u0441\u043a\u0432\u0430, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f) */\n"}, {"source_code": "using System;\n\npublic static class Program\n{\n public static void Main()\n {\n string broze;\n string finalNumeber = \"\";\n broze = Console.ReadLine();\n finalNumeber = broze.Replace(\"--\", \"2\");\n finalNumeber = finalNumeber.Replace(\"-.\", \"1\");\n finalNumeber = finalNumeber.Replace(\".\", \"0\");\n Console.Write(finalNumeber);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n input = input.Replace(\"--\", \"2\");\n input = input.Replace(\"-.\", \"1\");\n input = input.Replace('.', '0');\n\n Console.WriteLine(input);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\n//32B. \u0410\u0437\u0431\u0443\u043a\u0430 \u0411\u043e\u0440\u0437\u0435\n\nnamespace CodeForces\n{\n\n class Program\n {\n\n private void solve()\n {\n string s = Console.ReadLine();\n\n int i = 0;\n while (i < s.Length)\n {\n if (s[i] == '.')\n {\n Console.Write('0');\n }\n else\n {\n i += 1;\n if (s[i] == '.')\n {\n Console.Write('1');\n }\n else\n {\n Console.Write('2');\n }\n }\n i += 1;\n }\n Console.WriteLine();\n }\n\n static void Main()\n {\n Program app = new Program();\n app.solve();\n#if DEBUG\n Console.ReadKey(true);\n#endif\n }\n }\n}"}, {"source_code": "//http://codeforces.com/problemset/problem/32/B\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces___32b_Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string re=\"\";\n string s = Console.ReadLine();\n for (int i = 1; i <= s.Length; )\n {\n if (s[i - 1].Equals('-') && s[i].Equals('-'))\n {\n re += \"2\";\n i += 2;\n }\n else if (s[i - 1].Equals('-') && s[i].Equals('.'))\n {\n re += \"1\";\n i += 2;\n }\n else\n {\n re += \"0\";\n i++;\n }\n }\n Console.WriteLine(re);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string s=Console.ReadLine();\n for(int i=0;i a>b?-1:a==b?0:1);\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(p(Console.ReadLine()));\n }\n\n static string p(string s)\n {\n var sb = new StringBuilder();\n\n var i = 0;\n\n string b;\n\n while ((b = n(s, ref i)) != null)\n {\n sb.Append(b);\n }\n\n return sb.ToString();\n }\n\n static string n(string s, ref int cur)\n {\n if (cur >= s.Length)\n return null;\n\n if (s[cur++] == '.')\n {\n return \"0\";\n }\n \n if (cur >= s.Length)\n return null;\n\n if (s[cur++] == '.')\n {\n return \"1\";\n }\n\n return \"2\";\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tclass B\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t char[] arr = Console.ReadLine().ToCharArray();\n\t\t string ans = \"\";\n\t\t int c=0;\n\t\t while(c= _stringToRead.Length) {\n return string.Empty;\n }\n string result = _stringToRead.Substring(_currentIndex, 1);\n if (result == ZeroDigit) {\n _currentIndex++;\n }\n else {\n result = _stringToRead.Substring(_currentIndex, 2);\n _currentIndex += 2;\n }\n return result;\n }\n\n }\n\n private static string GetTernaryDigit(string borzeDigit) {\n return borzeDigit == ZeroDigit ? \"0\" : (borzeDigit == OneDigit ? \"1\" : \"2\");\n }\n\n private static string ConvertToTernaryNotation(string borzeNotation) {\n var borzeReader = new BorzeReader(borzeNotation);\n string result = string.Empty;\n while (true) {\n string borzeDigit = borzeReader.GetNextDigit();\n if (borzeDigit == string.Empty) {\n return result;\n }\n result += GetTernaryDigit(borzeDigit);\n }\n }\n\n static void Main()\n {\n string inputString = Console.In.ReadLine();\n string result = ConvertToTernaryNotation(inputString);\n Console.Out.WriteLine(result);\n Console.In.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n StringBuilder s=new StringBuilder( Console.ReadLine());\n string kq = \"\";\n while (s.Length > 0)\n {\n if (s.Length>=2&&\"\" + s[0] + s[1] == \"-.\") { s.Replace(\"-.\", \"\", 0, 2);\n kq += \"1\"; }\n else if (s.Length>=2&&\"\" + s[0] + s[1] == \"..\")\n {\n s.Replace(\".\", \"\", 0, 1);\n kq += \"0\";\n }\n else if (s.Length>=2&&\"\" + s[0] + s[1] == \"--\")\n {\n s.Replace(\"--\", \"\", 0, 2);\n kq += \"2\";\n }\n else if (\"\" + s[0] == \".\")\n {\n s.Replace(\".\", \"\", 0, 1);\n kq += \"0\";\n }\n }\n Console.WriteLine(kq);\n }\n }\n}\n"}, {"source_code": "// Problem: 32B - Borze\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass Borze\n {\n static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n string code = words[0];\n if (code.Length > 200)\n return -1;\n bool inDigit = false;\n foreach (char c in code)\n {\n if (c == '.')\n {\n if (inDigit)\n {\n Console.Write (1);\n inDigit = false;\n }\n else\n Console.Write (0);\n }\n else if (c == '-')\n {\n if (inDigit)\n {\n Console.Write (2);\n inDigit = false;\n }\n else\n inDigit = true;\n }\n }\n if (inDigit)\n return -1;\n Console.WriteLine ();\n return 0;\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = s.Replace(\"--\", \"2\");\n s = s.Replace(\"-.\", \"1\");\n s = s.Replace(\".\", \"0\");\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace B32\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"--\", \"2\").Replace(\"-.\", \"1\").Replace(\".\", \"0\")); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n \n\n int zero = 0;\n int one = 1;\n int two = 2; \n\n\n string input = Console.ReadLine();\n\n char[] chars = input.ToCharArray();\n\n int index =0;\n while(index < chars.Length)\n {\n\n\n if(chars[index]=='-' && chars[index+1]=='.')\n {\n Console.Write(one);\n ++index;\n \n }\n\n else if(chars[index]=='-'&& chars[index+1]=='-')\n {\n Console.Write(two);\n ++index; \n \n }\n\n\n else if (chars[index] == '.')\n {\n Console.Write(zero); \n }\n\n ++index;\n\n }\n\n \n\n Console.WriteLine();\n }\n \n\n }\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Activities\n{\n class Program\n {\n static void Main(string[] args)\n {\n string borzeCode = Console.ReadLine();\n\n for (int x = 0; x < borzeCode.Length;)\n {\n if (borzeCode[x] == '.')\n {\n Console.Write(\"0\");\n x++;\n }\n\n else if ((borzeCode[x] == '-') && (borzeCode[x + 1] == '.'))\n {\n Console.Write(\"1\");\n x += 2;\n }\n\n else if ((borzeCode[x] == '-') && (borzeCode[x + 1] == '-'))\n {\n Console.Write(\"2\");\n x += 2;\n }\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\nusing StringBuilder = System.Text.StringBuilder;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tvar builder = new StringBuilder();\n\n\t\t\tchar? previous = input1.ElementAt(0);\n\t\t\tfor (int i = 1; i < input1.Length; i++) \n\t\t\t{\n\t\t\t\tif (previous == null) \n\t\t\t\t{\n\t\t\t\t\tprevious = input1.ElementAt(i);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar current = input1.ElementAt(i);\n\t\t\t\tif (current == '.') \n\t\t\t\t{\n\t\t\t\t\tif (previous == '.') \n\t\t\t\t\t{\n\t\t\t\t\t\tbuilder.Append(\"0\");\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tbuilder.Append(\"1\");\n\t\t\t\t\t\tprevious = null;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tif (previous == '.')\n\t\t\t\t\t{\n\t\t\t\t\t\tbuilder.Append(\"0\");\n\t\t\t\t\t\tprevious = current;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tbuilder.Append(\"2\");\n\t\t\t\t\t\tprevious = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous != null)\n\t\t\t{\n\t\t\t\tbuilder.Append(\"0\");\n\t\t\t}\n\n\t\t\tConsole.WriteLine(builder.ToString());\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n StringBuilder z = new StringBuilder();\n char[] a = Console.ReadLine().ToCharArray();\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i]=='.')\n {\n z.Append(0);\n }\n if (a[i]=='-')\n {\n if (a[i + 1] == '-')\n {\n z.Append(2);\n a[i + 1] = 'p';\n }\n else if (a[i + 1] == '.')\n {\n z.Append(1);\n a[i + 1] = 'p';\n }\n }\n }\n Console.WriteLine(z);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string v=\"\",s=Console.ReadLine();\n for(int i=0;i0 && line[0] == '.') solve(line.Substring(1), ans+\"0\");\n if (line.Length>1 && line[0] == '-' && line[1] == '.') solve(line.Substring(2), ans+\"1\");\n if (line.Length>1 && line[0] == '-' && line[1]=='-') solve(line.Substring(2), ans+\"2\");\n }\n }\n \n struct quat { public T1 fst; public T2 snd; public T3 thr; public T4 frt; }\n struct trip { public T1 fst; public T2 snd; public T3 thr; }\n struct pair { public T1 fst; public T2 snd; }\n static long LCM(long a, long b) { return a / GCD(a, b) * b; }\n static long GCD(long a, long b) { if (b == 0) return a; else return GCD(b, a % b); }\n static void swap(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }\n static double dist(double x1, double y1, double x2, double y2) { return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)); }\n static long factorial(int n) { long ans = 1; for (int i = 2; i <= n; i++) ans *= i; return ans; }\n static void fill(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }\n static void fill(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }\n\n static void print(double v) { Console.Write(v); }\n static void print(long v) { Console.Write(v); }\n static void print(int v) { Console.Write(v); }\n static void print(string v) { Console.Write(v); }\n static void print(char v) { Console.Write(v); }\n //static void print(BigInteger v) { Console.Write(v); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n\n static void println(double v) { Console.WriteLine(v); }\n static void println(long v) { Console.WriteLine(v); }\n static void println(int v) { Console.WriteLine(v); }\n static void println(string v) { Console.WriteLine(v); }\n static void println(char v) { Console.WriteLine(v); }\n //static void println(BigInteger v) { Console.WriteLine(v); }\n static void println() { Console.WriteLine(); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n static void wait() { Console.ReadKey(true); }\n static int[] readArrayI(int n) { int[] t = new int[n]; for (int i = 0; i < n; i++) t[i] = readInt(); return t; }\n static double[] readArrayD(int n) { double[] t = new double[n]; for (int i = 0; i < n; i++) t[i] = readDouble(); return t; }\n\n /*static BigInteger readBigInt()\n {\n BigInteger val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }*/\n\n static double readDouble()\n {\n bool m = false;\n double val = 0;\n int c = 0, r = 1;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read()) >= '0' && c <= '9') val = val * 10 + (m ? -(c - 48) : (c - 48));\n if (c == '.') while ((c = Console.Read()) >= '0' && c <= '9') { val += ((double)(c - 48)) / (r *= 10); }\n\n return val;\n }\n\n static long readLong()\n {\n long val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val * 10 + (m ? -c : c);\n return val;\n }\n\n static int readInt()\n {\n bool m = false;\n int val = 0, c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m = true : m = false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val * 10 + (m ? -c : c);\n return val;\n }\n}"}, {"source_code": "using System;\n\nnamespace B.Borze\n{\n public class Program\n {\n\n public static void Main(string[] args)\n {\n\n var num = Console.ReadLine();\n var res = \"\";\n for(int i = 0; i < num.Length; i++)\n {\n if(num[i]=='-' && num[i + 1] == '-')\n {\n res += '2';\n i++;\n }\n else if(num[i]=='-' && num[i + 1] == '.')\n {\n res += '1';\n i++;\n }\n else if (num[i] == '.')\n {\n res += '0';\n }\n }\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _32_B_Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n \n\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i] == '.')\n {\n Console.Write('0');\n }\n else if (s[i] == '-' && s[i+1] == '.')\n {\n Console.Write('1');\n i += 1;\n }\n else if (s[i] == '-' && s[i + 1] == '-')\n {\n Console.Write('2');\n i += 1;\n }\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _32_B_Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string output = \"\";\n\n string z = \".\";\n string o = \"-.\";\n string t = \"--\";\n string z0 = \"0\";\n string o1 = \"1\";\n string t2= \"2\";\n\n for (int i = 0; i <= s.Length-1; i++)\n {\n if(s[i].ToString() != z)\n {\n if ((s[i].ToString()+s[i+1]) == o && (s[i].ToString() + s[i + 1]) != t )\n {\n output = output+o1;\n i = i + 1;\n }\n else\n {\n output = output + t2;\n i = i + 1;\n }\n }\n else\n {\n output = output + z0;\n }\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceProblemSolve\n{\n class Borze32B\n {\n public static void Main()\n {\n String s = Console.ReadLine();\n string r = \"\";\n\n for (int i = 0; i < s.Length;i++)\n {\n if(s[i].Equals('.'))\n {\n r = r + \"0\";\n }\n else if ((s[i] + \"\" + s[i+1]).Equals( \"-.\"))\n {\n r = r + \"1\";\n i++;\n }\n else if ((s[i] + \"\" + s[i + 1]).Equals(\"--\"))\n {\n r = r + \"2\";\n i++;\n }\n }\n\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace _32B._Borze\n{\n class Program\n {\n static void Main(string[] args)\n {\n string code = Console.ReadLine();\n int symbolIndex = 0;\n StringBuilder decryptedCode = new StringBuilder();\n\n while (symbolIndex != code.Length)\n {\n if (code[symbolIndex] == '.')\n {\n symbolIndex++;\n decryptedCode.Append('0');\n }\n else if (code[symbolIndex] == '-')\n {\n symbolIndex++;\n if (code[symbolIndex] == '.')\n {\n symbolIndex++;\n decryptedCode.Append('1');\n }\n else\n {\n symbolIndex++;\n decryptedCode.Append('2');\n }\n }\n }\n\n Console.WriteLine(decryptedCode.ToString());\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication41\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string ans = null;\n for (int i = 0; i < s.Length-1; i++)\n {\n \n if (s[i] == '-' && s[i+1] =='-' ) \n {\n ans += 2;i++;\n }\n else if (s[i] == '-' && s[i+1]=='.')\n {\n ans += 1;i++;\n }\n else if (s[i] == '.')\n {\n ans += 0;\n\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n for (int i = 0; i < a.Length-1; i++)\n {\n if (a[i] == '-' && a[i + 1] == '.')\n {\n Console.Write(\"1\");\n i++;\n }\n if (a[i] == '-' && a[i + 1] == '-')\n {\n Console.Write(\"2\");\n i++;\n }\n if (a[i] == '.' && a[i + 1] == '.')\n {\n Console.Write(\"0\");\n }\n }\n if (a[a.Length - 1] == '.')\n {\n Console.Write(\"0\");\n }\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication16\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n char[] charArray = str.ToCharArray();\n\n string str1 = \"\";\n char f = ' ';\n\n if (charArray[0] == '-' && charArray[1] == '-')\n {\n str1 += '2';\n\n for (int i = 2; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n f = ' ';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n else if (charArray[0] == '-' && charArray[1] == '.')\n {\n str1 += '1';\n\n for (int i = 2; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n f = ' ';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n else\n {\n for (int i = 0; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n \n Console.WriteLine(str1);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication16\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n char[] charArray = str.ToCharArray();\n\n string str1 = \"\";\n char f = ' ';\n\n if (charArray[0] == '-' && charArray[1] == '-')\n {\n str1 += '2';\n\n for (int i = 2; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n else if (charArray[0] == '-' && charArray[1] == '.')\n {\n str1 += '1';\n\n for (int i = 2; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n else\n {\n for (int i = 0; i < charArray.Length; i++)\n {\n if (charArray[i] == '.' && f == ' ')\n {\n str1 += '0';\n }\n else if (f == '-' && charArray[i] == '.')\n {\n str1 += '1';\n }\n else if (f == '-' && charArray[i] == '-')\n {\n str1 += '2';\n f = ' ';\n }\n else if (charArray[i] == '-')\n {\n f = '-';\n }\n }\n }\n \n Console.WriteLine(str1);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http.Headers;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace BorzeDecode\n{\n class Program\n {\n static void Main(string[] args)\n {\n var res = Method(Console.ReadLine());\n Console.WriteLine(res);\n }\n\n public static string Method(string input)\n {\n var code = new List();\n for (int i = 0; i < input.Length - 1; i++)\n {\n if (input[i] == '-')\n {\n if (input[i + 1] == '-') code.Add('2');\n else code.Add('1');\n i += 1;\n continue;\n }\n else code.Add('0');\n }\n return new string(code.ToArray());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Snail\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int c = 0;\n for(int i=0; i visited_here = new List();\n Queue q = new Queue();\n q.Enqueue(from);\n visited_here.Add(from);\n\n while (q.Count > 0)\n {\n int cur = q.Dequeue();\n for (int i = 0; i < visited.Length; i++)\n {\n if (visited[i]) continue;\n if (like[cur, i] > 0)\n {\n q.Enqueue(i);\n visited_here.Add(i);\n visited[i] = true;\n }\n }\n }\n\n foreach (int a in visited_here)\n foreach (int b in visited_here)\n if (a != b && like[a, b] < 0) fail = true;\n\n if (fail) return 0;\n return visited_here.Count;\n }\n\n}\n\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Party\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int[] p;\n private static int[] size;\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n p = new int[n];\n\n size = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n size[i] = 1;\n }\n\n int k = Next();\n for (int i = 0; i < k; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu != pv)\n {\n p[pu] = pv;\n size[pv] += size[pu];\n }\n }\n\n var f = new bool[n];\n int m = Next();\n for (int i = 0; i < m; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu == pv)\n {\n f[pu] = true;\n }\n }\n\n int max = 0;\n for (int i = 0; i < n; i++)\n {\n if (p[i] == i && !f[i] && size[i] > max)\n max = size[i];\n }\n\n return max;\n }\n\n private static int GP(int i)\n {\n if (i == p[i])\n return i;\n return p[i] = GP(p[i]);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\npublic class AbbyC1\n{\n public static void Main(String[] args)\n {\n string inp = Console.ReadLine();\n int n = int.Parse(inp);\n inp = Console.ReadLine();\n int k = int.Parse(inp);\n\n int[,] like = new int[n, n];\n \n for (int i = 0; i < k; i++)\n {\n inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n int a = int.Parse(spl[0]) - 1;\n int b = int.Parse(spl[1]) - 1;\n like[a, b] = 1;\n like[b, a] = 1;\n }\n inp = Console.ReadLine();\n int m = int.Parse(inp);\n \n for (int i = 0; i < m; i++)\n {\n inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n int a = int.Parse(spl[0]) - 1;\n int b = int.Parse(spl[1]) - 1;\n like[a, b] = -1;\n like[b, a] = -1;\n }\n bool[] visited = new bool[n];\n int res = 0;\n for (int i = 0; i < n; i++)\n {\n if (visited[i]) continue;\n\n res = Math.Max(res, markConnected(i, like, visited));\n }\n Console.WriteLine(res);\n }\n\n private static int markConnected(int from, int[,] like, bool[] visited)\n {\n visited[from] = true;\n int res = 0;\n bool fail = false;\n\n List visited_here = new List();\n Queue q = new Queue();\n q.Enqueue(from);\n visited_here.Add(from);\n\n while (q.Count > 0)\n {\n int cur = q.Dequeue();\n for (int i = 0; i < visited.Length; i++)\n {\n if (visited[i]) continue;\n if (like[cur, i] > 0)\n {\n q.Enqueue(i);\n visited_here.Add(i);\n visited[i] = true;\n }\n }\n }\n\n foreach (int a in visited_here)\n foreach (int b in visited_here)\n if (a != b && like[a, b] < 0) fail = true;\n\n if (fail) return 0;\n return visited_here.Count;\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces._20120421\n{\n public class C\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n List> friends = new List>();\n for (int i = 0; i < n; ++i)\n friends.Add(new List());\n\n int k = int.Parse(Console.ReadLine());\n for (int i = 0; i < k; ++i)\n {\n List ab = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToList();\n int a = ab[0] - 1;\n int b = ab[1] - 1;\n\n friends[a].Add(b);\n friends[b].Add(a);\n }\n\n List> enemies = new List>();\n for (int i = 0; i < n; ++i)\n enemies.Add(new List());\n\n int m = int.Parse(Console.ReadLine());\n for (int i = 0; i < m; ++i)\n {\n List ab = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToList();\n int a = ab[0] - 1;\n int b = ab[1] - 1;\n\n enemies[a].Add(b);\n enemies[b].Add(a);\n }\n\n int maxGroupSize = 0;\n\n for (int i = 0; i < n; ++i)\n {\n List cg = new List();\n cg.Add(i);\n\n List q = new List();\n q.AddRange(friends[i]);\n\n while (q.Count > 0)\n {\n int cf = q[0];\n\n foreach (var enemy in enemies[cf])\n {\n if (cg.Contains(enemy))\n {\n cg.Clear();\n q.Clear();\n break;\n }\n }\n\n if (q.Count > 0)\n {\n if (cg.Contains(cf) == false)\n cg.Add(cf);\n\n foreach (var f in friends[cf])\n {\n if (cg.Contains(f) == false)\n q.Add(f);\n }\n\n q.RemoveAt(0);\n }\n\n }\n\n maxGroupSize = Math.Max(maxGroupSize, cg.Count);\n }\n\n Console.WriteLine(maxGroupSize);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c1\n{\n struct couple\n {\n public int a, b;\n }\n\n class Program\n {\n static int Comparer(couple a, couple b)\n {\n int result = a.a - b.a;\n if (result == 0)\n {\n result = a.b - b.b;\n }\n return result;\n }\n\n static void Main(string[] args)\n {\n \n\n int n = Convert.ToInt32(Console.ReadLine());\n int[] used = new int[n];\n int k = Convert.ToInt32(Console.ReadLine());\n List friends = new List();\n for (int i = 0; i < k; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n friends.Add(newCouple);\n }\n int m = Convert.ToInt32(Console.ReadLine());\n List enemies = new List();\n for (int i = 0; i < m; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n enemies.Add(newCouple);\n }\n\n friends.Sort(Comparer);\n enemies.Sort(Comparer);\n\n int record = 0;\n\n bool onceAgain = true;\n while (onceAgain)\n {\n onceAgain = false;\n for (int i = 0; i < n; i++)\n {\n if (used[i] == 0)\n {\n used[i] = 1;\n onceAgain = true;\n break;\n }\n }\n bool goodGroup = true;\n foreach (couple c in friends)\n {\n if (used[c.a] == 1) used[c.b] = 1;\n else if (used[c.b] == 1) used[c.a] = 1;\n }\n foreach (couple c in enemies)\n {\n if (used[c.a] == 1 && used[c.b] == 1)\n {\n goodGroup = false;\n }\n }\n int cnt = 0;\n for (int j = 0; j < n; j++)\n {\n if (used[j] == 1)\n {\n cnt++;\n used[j] = -1;\n }\n }\n if (goodGroup)\n {\n if (record < cnt)\n {\n record = cnt;\n }\n }\n\n\n }\n Console.Write(record);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second, Val;\n public Pair(int f, int s, int v) {\n First = f;\n Second = s;\n Val = v;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return Val.CompareTo(other.Val);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static int c;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = 1; \n f[second, first] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = -1; \n f[second, first] = -1; \n }\n for (int i = 0; i < n; ++i) { \n List members = new List();\n members.Add(i);\n AddFriends(i, members);\n int cnt = Count(members);\n ans = Math.Max(ans, cnt);\n }\n Console.WriteLine(ans); \n }\n\n static int Count(List fr) {\n foreach (int i in fr) {\n for (int j = 0; j < n; ++j) {\n if (f[i, j] == -1 && fr.Contains(j)) return 0;\n }\n }\n return fr.Count;\n }\n\n static void AddFriends(int i, List fr){\n for (int j = 0; j < n; ++j) {\n if (f[i, j] == 1 && !fr.Contains(j)) {\n fr.Add(j);\n AddFriends(j, fr);\n }\n }\n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] g = new int[n+1, n+1];\n int number = int.Parse(Console.ReadLine());\n int[] data;\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = 1;\n g[data[1], data[0]] = 1;\n }\n\n number = int.Parse(Console.ReadLine());\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = -1;\n g[data[1], data[0]] = -1;\n }\n\n /*for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n Console.Write(\"{0}\\t\", g[i, j]);\n }\n Console.WriteLine();\n }*/\n\n HashSet already = new HashSet();\n List current;\n HashSet currentSet;\n int max = 0;\n\n for (int i = 1; i <= n; i++)\n {\n if (!already.Contains(i))\n {\n currentSet = new HashSet();\n current = new List();\n\n currentSet.Add(i);\n current.Add(i);\n already.Add(i);\n int index = 0;\n bool fall = false;\n while (index < current.Count)\n {\n\n for (int j = 1; j <= n; j++)\n {\n if ((current[index] != j) && (g[current[index], j] == 1) && !currentSet.Contains(j))\n {\n current.Add(j);\n currentSet.Add(j);\n already.Add(j);\n }\n else if ((g[current[index],j]==-1) && currentSet.Contains(j))\n {\n fall = true;\n }\n }\n if (fall) break;\n index++;\n }\n if (!fall)\n {\n max = Math.Max(max, currentSet.Count);\n } \n }\n \n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n \n int n = nextInt();\n List[] likes = new List[n];\n List[] disLikes = new List[n];\n\n for (int i = 0; i < n; i++)\n {\n likes[i] = new List();\n disLikes[i] = new List();\n\n }\n int k = nextInt();\n for (int i = 0; i < k; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n likes[a].Add(b);\n likes[b].Add(a);\n }\n int m = nextInt();\n for (int i = 0; i < m; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n disLikes[a].Add(b);\n disLikes[b].Add(a);\n }\n bool[] vis = new bool[n];\n bool[] curVis = new bool[n];\n int res = 0;\n for (int i = 0; i < n; i++)\n if (!vis[i])\n {\n \n List lVis = new List();\n dfs(i, vis, likes, disLikes,lVis,curVis,n);\n int num = lVis.Count;\n if (num <= res)\n continue;\n foreach (int x in lVis)\n curVis[x] = true;\n bool ok = true;\n foreach (int x in lVis)\n {\n foreach (int y in disLikes[x])\n if (curVis[y])\n ok = false;\n }\n foreach (int x in lVis)\n curVis[x] = false;\n if (ok)\n res = num;\n }\n println(res);\n\n\n\n }\n\n private void dfs(int at, bool[] vis, List[] likes, List[] disLikes, List lVis, bool[] curVis, int n)\n {\n if (vis[at])\n return ;\n vis[at] = true;\n lVis.Add(at);\n foreach (int x in likes[at])\n dfs(x, vis, likes, disLikes, lVis, curVis, n);\n }\n\n \n\n private long go(int n, Dictionary cache)\n {\n if (n == 1)\n return 1;\n if (cache.ContainsKey(n))\n return cache[n];\n long res = 0;\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n int a = i;\n int b = n / i;\n if (b > 1)\n res = Math.Max(res, go(a, cache));\n if (a > 1)\n res = Math.Max(res, go(b, cache));\n }\n }\n res += n;\n cache[n] = res;\n return res;\n }\n\n\n ////////////\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Party\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int[] p;\n private static int[] size;\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n p = new int[n];\n\n size = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n size[i] = 1;\n }\n\n int k = Next();\n for (int i = 0; i < k; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu != pv)\n {\n p[pu] = pv;\n size[pv] += size[pu];\n }\n }\n\n var f = new bool[n];\n int m = Next();\n for (int i = 0; i < m; i++)\n {\n int u = Next() - 1;\n int v = Next() - 1;\n int pu = GP(u);\n int pv = GP(v);\n if (pu == pv)\n {\n f[pu] = true;\n }\n }\n\n int max = 0;\n for (int i = 0; i < n; i++)\n {\n if (p[i] == i && !f[i] && size[i] > max)\n max = size[i];\n }\n\n return max;\n }\n\n private static int GP(int i)\n {\n if (i == p[i])\n return i;\n return p[i] = GP(p[i]);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskC\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] g = new int[n+1, n+1];\n int number = int.Parse(Console.ReadLine());\n int[] data;\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = 1;\n g[data[1], data[0]] = 1;\n }\n\n number = int.Parse(Console.ReadLine());\n for (int i = 0; i < number; i++)\n {\n data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n g[data[0], data[1]] = -1;\n g[data[1], data[0]] = -1;\n }\n\n /*for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n Console.Write(\"{0}\\t\", g[i, j]);\n }\n Console.WriteLine();\n }*/\n\n HashSet already = new HashSet();\n List current;\n HashSet currentSet;\n int max = 0;\n\n for (int i = 1; i <= n; i++)\n {\n if (!already.Contains(i))\n {\n currentSet = new HashSet();\n current = new List();\n\n currentSet.Add(i);\n current.Add(i);\n already.Add(i);\n int index = 0;\n bool fall = false;\n while (index < current.Count)\n {\n\n for (int j = 1; j <= n; j++)\n {\n if ((current[index] != j) && (g[current[index], j] == 1) && !currentSet.Contains(j))\n {\n current.Add(j);\n currentSet.Add(j);\n already.Add(j);\n }\n else if ((g[current[index],j]==-1) && currentSet.Contains(j))\n {\n fall = true;\n }\n }\n if (fall) break;\n index++;\n }\n if (!fall)\n {\n max = Math.Max(max, currentSet.Count);\n } \n }\n \n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n \n int n = nextInt();\n List[] likes = new List[n];\n List[] disLikes = new List[n];\n\n for (int i = 0; i < n; i++)\n {\n likes[i] = new List();\n disLikes[i] = new List();\n\n }\n int k = nextInt();\n for (int i = 0; i < k; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n likes[a].Add(b);\n likes[b].Add(a);\n }\n int m = nextInt();\n for (int i = 0; i < m; i++)\n {\n int a = nextInt() - 1;\n int b = nextInt() - 1;\n disLikes[a].Add(b);\n disLikes[b].Add(a);\n }\n bool[] vis = new bool[n];\n bool[] curVis = new bool[n];\n int res = 0;\n for (int i = 0; i < n; i++)\n if (!vis[i])\n {\n \n List lVis = new List();\n dfs(i, vis, likes, disLikes,lVis,curVis,n);\n int num = lVis.Count;\n if (num <= res)\n continue;\n foreach (int x in lVis)\n curVis[x] = true;\n bool ok = true;\n foreach (int x in lVis)\n {\n foreach (int y in disLikes[x])\n if (curVis[y])\n ok = false;\n }\n foreach (int x in lVis)\n curVis[x] = false;\n if (ok)\n res = num;\n }\n println(res);\n\n\n\n }\n\n private void dfs(int at, bool[] vis, List[] likes, List[] disLikes, List lVis, bool[] curVis, int n)\n {\n if (vis[at])\n return ;\n vis[at] = true;\n lVis.Add(at);\n foreach (int x in likes[at])\n dfs(x, vis, likes, disLikes, lVis, curVis, n);\n }\n\n \n\n private long go(int n, Dictionary cache)\n {\n if (n == 1)\n return 1;\n if (cache.ContainsKey(n))\n return cache[n];\n long res = 0;\n for (int i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n int a = i;\n int b = n / i;\n if (b > 1)\n res = Math.Max(res, go(a, cache));\n if (a > 1)\n res = Math.Max(res, go(b, cache));\n }\n }\n res += n;\n cache[n] = res;\n return res;\n }\n\n\n ////////////\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces._20120421\n{\n public class C\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n List> friends = new List>();\n for (int i = 0; i < n; ++i)\n friends.Add(new List());\n\n int k = int.Parse(Console.ReadLine());\n for (int i = 0; i < k; ++i)\n {\n List ab = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToList();\n int a = ab[0] - 1;\n int b = ab[1] - 1;\n\n friends[a].Add(b);\n friends[b].Add(a);\n }\n\n List> enemies = new List>();\n for (int i = 0; i < n; ++i)\n enemies.Add(new List());\n\n int m = int.Parse(Console.ReadLine());\n for (int i = 0; i < m; ++i)\n {\n List ab = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToList();\n int a = ab[0] - 1;\n int b = ab[1] - 1;\n\n enemies[a].Add(b);\n enemies[b].Add(a);\n }\n\n int maxGroupSize = 0;\n\n for (int i = 0; i < n; ++i)\n {\n List cg = new List();\n cg.Add(i);\n\n List q = new List();\n q.AddRange(friends[i]);\n\n while (q.Count > 0)\n {\n int cf = q[0];\n\n foreach (var enemy in enemies[cf])\n {\n if (cg.Contains(enemy))\n {\n cg.Clear();\n q.Clear();\n break;\n }\n }\n\n if (q.Count > 0)\n {\n cg.Add(cf);\n q.RemoveAt(0);\n }\n\n }\n\n maxGroupSize = Math.Max(maxGroupSize, cg.Count);\n }\n\n Console.WriteLine(maxGroupSize);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c1\n{\n struct couple\n {\n public int a, b;\n }\n\n class Program\n {\n static int Comparer(couple a, couple b)\n {\n int result = a.a - b.a;\n if (result == 0)\n {\n result = a.b - b.b;\n }\n return result;\n }\n\n static void Main(string[] args)\n {\n \n\n int n = Convert.ToInt32(Console.ReadLine());\n int[] used = new int[n];\n int k = Convert.ToInt32(Console.ReadLine());\n List friends = new List();\n for (int i = 0; i < k; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n friends.Add(newCouple);\n }\n int m = Convert.ToInt32(Console.ReadLine());\n List enemies = new List();\n for (int i = 0; i < m; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n enemies.Add(newCouple);\n }\n\n friends.Sort(Comparer);\n enemies.Sort(Comparer);\n\n int record = 0;\n\n bool onceAgain = true;\n while (onceAgain)\n {\n onceAgain = false;\n for (int i = 0; i < n; i++)\n {\n if (used[i] == 0)\n {\n used[i] = 1;\n onceAgain=true;\n }\n bool goodGroup = true;\n foreach (couple c in friends)\n {\n if (used[c.a] == 1) used[c.b] = 1;\n }\n foreach (couple c in enemies)\n {\n if (used[c.a]==1 && used[c.b]==1)\n {\n goodGroup = false;\n }\n }\n int cnt = 0;\n for (int j = 0; j < n; j++)\n {\n if (used[j] == 1)\n {\n cnt++;\n used[j] = -1;\n }\n }\n if (goodGroup)\n {\n if (record < cnt)\n {\n record = cnt;\n }\n }\n \n }\n }\n Console.Write(record);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c1\n{\n struct couple\n {\n public int a, b;\n }\n\n class Program\n {\n static int Comparer(couple a, couple b)\n {\n int result = a.a - b.a;\n if (result == 0)\n {\n result = a.b - b.b;\n }\n return result;\n }\n\n static void Main(string[] args)\n {\n \n\n int n = Convert.ToInt32(Console.ReadLine());\n int[] used = new int[n];\n int k = Convert.ToInt32(Console.ReadLine());\n List friends = new List();\n for (int i = 0; i < k; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n friends.Add(newCouple);\n }\n int m = Convert.ToInt32(Console.ReadLine());\n List enemies = new List();\n for (int i = 0; i < m; i++)\n {\n string[] curCouple = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(curCouple[0]);\n int b = Convert.ToInt32(curCouple[1]);\n if (a > b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n couple newCouple = new couple();\n newCouple.a = a-1;\n newCouple.b = b-1;\n enemies.Add(newCouple);\n }\n\n friends.Sort(Comparer);\n enemies.Sort(Comparer);\n\n int record = 0;\n\n bool onceAgain = true;\n while (onceAgain)\n {\n onceAgain = false;\n for (int i = 0; i < n; i++)\n {\n if (used[i] == 0)\n {\n used[i] = 1;\n onceAgain = true;\n }\n }\n bool goodGroup = true;\n foreach (couple c in friends)\n {\n if (used[c.a] == 1) used[c.b] = 1;\n else if (used[c.b] == 1) used[c.a] = 1;\n }\n foreach (couple c in enemies)\n {\n if (used[c.a] == 1 && used[c.b] == 1)\n {\n goodGroup = false;\n }\n }\n int cnt = 0;\n for (int j = 0; j < n; j++)\n {\n if (used[j] == 1)\n {\n cnt++;\n used[j] = -1;\n }\n }\n if (goodGroup)\n {\n if (record < cnt)\n {\n record = cnt;\n }\n }\n\n\n }\n Console.Write(record);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second;\n public Pair(int f, int s) {\n First = f;\n Second = s; \n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return First.CompareTo(other.First);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = 1; \n f[second, first] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = -1; \n f[second, first] = -1; \n }\n for (int i = 0; i < n; ++i) {\n int cnt = 1;\n List members = new List();\n members.Add(i);\n for (int j = 0; j < n; ++j) { \n if(i==j) continue;\n if (f[i, j] == 1 & !members.Contains(j)) {\n members.Add(j);\n ++cnt;\n for (int z = 0; z < n; ++z) {\n if (f[j, z] == -1 && members.Contains(z)) {\n members.Clear();\n break;\n }\n }\n if (members.Count == 0) {\n cnt = 0;\n break;\n } \n } \n if (members.Count == 0) {\n cnt = 0;\n break;\n } \n }\n ans = Math.Max(ans, cnt);\n }\n Console.WriteLine(ans); \n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second, Val;\n public Pair(int f, int s, int v) {\n First = f;\n Second = s;\n Val = v;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return Val.CompareTo(other.Val);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static int c;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = 1; \n f[second, first] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = -1; \n f[second, first] = -1; \n }\n for (int i = 0; i < n; ++i) { \n List members = new List();\n AddFriends(i, members);\n int cnt = Count(members);\n ans = Math.Max(ans, cnt);\n }\n Console.WriteLine(ans); \n }\n\n static int Count(List fr) {\n foreach (int i in fr) {\n for (int j = 0; j < n; ++j) {\n if (f[i, j] == -1 && fr.Contains(j)) return 0;\n }\n }\n return fr.Count;\n }\n\n static void AddFriends(int i, List fr){\n for (int j = 0; j < n; ++j) {\n if (f[i, j] == 1 && !fr.Contains(j)) {\n fr.Add(j);\n AddFriends(j, fr);\n }\n }\n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second;\n public Pair(int f, int s) {\n First = f;\n Second = s; \n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return First.CompareTo(other.First);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n f[--a[0], --a[1]] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n f[--a[0], --a[1]] = -1; \n } \n for (int i = 0; i < n; ++i) {\n used = new bool[n];\n t = 0;\n dfs(i);\n ans = Math.Max(ans, t);\n }\n Console.WriteLine(ans);\n }\n \n static void dfs(int v) {\n used[v] = true;\n for (int i = 0; i < n; ++i) {\n if (f[v, i] == -1) {\n used[i] = true;\n }\n if (f[v,i]==1 && !used[i]) {\n ++t;\n dfs(i);\n }\n }\n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\n\nnamespace CodeForces {\n struct Pair : IComparable {\n public int First, Second, Val;\n public Pair(int f, int s, int v) {\n First = f;\n Second = s;\n Val = v;\n }\n public override string ToString() {\n return string.Format(\"{0} {1}\", First, Second);\n }\n\n public int CompareTo(Pair other) {\n return Val.CompareTo(other.Val);\n }\n }\n\n class Cf {\n static int n, m, k, t ,ans;\n static bool[] used;\n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.ReadLine();\n#endif\n }\n\n static int[,] f;\n static int c;\n static void Solve() {\n n = ReadInt();\n used = new bool[n];\n k = ReadInt();\n f = new int[n, n]; \n for (int i = 0; i < k; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = 1; \n f[second, first] = 1; \n }\n m = ReadInt(); \n for (int i = 0; i < m; ++i) {\n int[] a = ReadIntArray();\n int first = --a[0];\n int second = --a[1];\n f[first, second] = -1; \n f[second, first] = -1; \n }\n for (int i = 0; i < n; ++i) { \n List members = new List();\n members.Add(i);\n for (int j = 0; j < n; ++j) { \n if(i==j) continue;\n if (f[i, j] == 1 & !members.Contains(j)) {\n members.Add(j); \n for (int z = 0; z < n; ++z) {\n if (f[j, z] == -1 && members.Contains(z)) {\n members.Clear();\n break;\n }\n }\n if (members.Count == 0) { \n break;\n } \n } \n if (members.Count == 0) { \n break;\n } \n }\n ans = Math.Max(ans, members.Count);\n }\n Console.WriteLine(ans); \n }\n \n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n }\n\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}], "src_uid": "e1ebaf64b129edb8089f9e2f89a0e1e1"} {"source_code": "namespace Temp\n{\n using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Text;\n\n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool Contains(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1); \n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)),GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n class Program\n { \n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n const int Mod = 1000000000 + 7;\n\n string a = Console.ReadLine();\n int n = a.Length;\n string b = Console.ReadLine();\n int m = b.Length;\n int[,] p = new int[n + 1, m + 1];\n\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (a[i] == b[j])\n {\n p[i + 1, j + 1] = (p[i, j] + p[i + 1, j] + 1) % Mod;\n ans = (ans + p[i + 1, j + 1]) % Mod;\n }\n else\n {\n p[i + 1, j + 1] = p[i + 1, j];\n } \n }\n }\n\n ans = 0;\n for (int i = 0; i < n; i++)\n {\n ans = (ans + p[i + 1, m]) % Mod;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"C2\";\n\n\n private static void Solve()\n {\n var s = Read();\n var t = Read();\n var n = s.Length;\n var m = t.Length;\n long res = 0L;\n int MOD = 1000000007;\n var dp = new int[n + 1, m + 1];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n dp[i + 1, j + 1] = dp[i + 1, j];\n if (s[i] == t[j])\n dp[i + 1, j + 1] += dp[i, j] + 1;\n dp[i + 1, j + 1] %= MOD;\n }\n }\n for (int i = 0; i < n + 1; i++)\n {\n res += dp[i, m];\n res %= MOD;\n }\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\n\tclass A\n\t{\n\t\tconst int MOD = 1000000007;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar s1 = NextLine();\n\t\t\tvar s2 = NextLine();\n\t\t\tint l1 = s1.Length, l2 = s2.Length;\n\t\t\tint[,] dp = new int[l1, l2];\n\t\t\tif ( s1[l1 - 1] == s2[l2 - 1] ) dp[l1 - 1, l2 - 1] = 1;\n\t\t\tfor ( int i = l2 - 2; i >= 0; --i ) dp[l1 - 1, i] = dp[l1 - 1, i + 1] + ( s1[l1 - 1] == s2[i] ? 1 : 0 );\n\t\t\tfor ( int i = l1 - 2; i >= 0; --i ) dp[i, l2 - 1] = dp[i + 1, l2 - 1] + ( s1[i] == s2[l2 - 1] ? 1 : 0 );\n\n\t\t\tfor ( int i = l1 - 2; i >= 0; --i )\n\t\t\t\tfor ( int j = l2 - 2; j >= 0; --j )\n\t\t\t\t{\n\t\t\t\t\tdp[i, j] = dp[i + 1, j] + dp[i, j + 1];\n\t\t\t\t\tif ( dp[i, j] >= MOD ) dp[i, j] -= MOD;\n\t\t\t\t\tdp[i, j] -= dp[i + 1, j + 1];\n\t\t\t\t\tif ( dp[i, j] < 0 ) dp[i, j] += MOD;\n\t\t\t\t\tif ( s1[i] == s2[j] )\n\t\t\t\t\t{\n\t\t\t\t\t\tdp[i, j] += dp[i + 1, j + 1] + 1;\n\t\t\t\t\t\tif ( dp[i, j] >= MOD ) dp[i, j] -= MOD;\n\t\t\t\t\t\tif ( i + 2 < l1 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdp[i, j] -= dp[i + 2, j + 1];\n\t\t\t\t\t\t\tif ( dp[i, j] < 0 ) dp[i, j] += MOD;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tOut.WriteLine( dp[0, 0] );\n\t\t}\n\n\n\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n struct pos\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string t = Console.ReadLine();\n \n long[][] arr = new long[s.Length+1][];\n for (long i = 0; i < s.Length+1; i++)\n {\n arr[i] = new long[t.Length + 1];\n }\n for (int i = 1; i < s.Length+1; i++)\n {\n for (int j = 1; j < t.Length+1; j++)\n {\n if (s[i - 1] == t[j - 1])\n {\n arr[i][j] += 1 + arr[i - 1][j - 1];\n }\n arr[i][j] += arr[i][j-1];\n arr[i][j] %= 1000000007;\n }\n }\n long q = 0;\n long ii = t.Length;\n for (long j = 0; j < s.Length + 1; j++)\n {\n q += arr[j][ii];\n }\n Console.WriteLine(q % 1000000007);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKCupRound2\n{\n class SubstringAndSubsequence\n {\n static string s;\n static string t;\n static int?[,] dp;\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n t = Console.ReadLine();\n \n dp = new int?[s.Length + 1,t.Length + 1];\n\n long count = 0;\n for (int i = 1; i <= s.Length; i++)\n count += GetDP(i, t.Length);\n\n Console.WriteLine(count % 1000000007);\n }\n static int GetDP(int i, int j)\n {\n if (dp[i, j] != null)\n return (int)dp[i, j];\n long count = 0;\n if (i > 0 && j > 0)\n {\n count += GetDP(i, j - 1);\n if (s[i - 1] == t[j - 1])\n count += 1 + GetDP(i - 1, j - 1);\n }\n int intCount = (int)(count % 1000000007);\n dp[i, j] = intCount;\n return intCount;\n }\n }\n}\n"}, {"source_code": "namespace Temp\n{\n using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Text;\n\n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool Contains(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1); \n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)),GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n class Program\n { \n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n const int Mod = 1000000000 + 7;\n\n string a = Console.ReadLine();\n int n = a.Length;\n string b = Console.ReadLine();\n int m = b.Length;\n int[,] p = new int[n + 1, m + 1];\n \n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (a[i] == b[j])\n {\n p[i + 1, j + 1] = (p[i, j] + p[i + 1, j] + 1) % Mod; \n }\n else\n {\n p[i + 1, j + 1] = p[i + 1, j];\n } \n }\n }\n\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n ans = (ans + p[i + 1, m]) % Mod;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Substring_and_Subsequence\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n string t = reader.ReadLine();\n\n long sum = 0;\n const int mod = 1000000007;\n var prev = new long[t.Length];\n\n foreach (char c in s)\n {\n var next = new long[t.Length];\n\n long ss = 0;\n for (int i = 0; i < t.Length; i++)\n {\n if (t[i] == c)\n {\n next[i] = (1 + ss)%mod;\n sum = (sum + next[i])%mod;\n }\n\n ss = (ss + prev[i])%mod;\n }\n\n prev = next;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n struct pos\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string t = Console.ReadLine();\n \n int[][] arr = new int[s.Length+1][];\n for (int i = 0; i < s.Length+1; i++)\n {\n arr[i] = new int[t.Length + 1];\n }\n for (int i = 1; i < s.Length+1; i++)\n {\n for (int j = 1; j < t.Length+1; j++)\n {\n if (s[i - 1] == t[j - 1])\n {\n arr[i][j] += 1 + arr[i - 1][j - 1];\n }\n arr[i][j] += arr[i][j-1];\n }\n }\n int q = 0;\n int ii = t.Length;\n for (int j = 0; j < s.Length + 1; j++)\n {\n q += arr[j][ii];\n }\n Console.WriteLine(q);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKCupRound2\n{\n class SubstringAndSubsequence\n {\n static string s;\n static string t;\n static int?[,] dp;\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n t = Console.ReadLine();\n \n dp = new int?[s.Length + 1,t.Length + 1];\n\n int count = 0;\n for (int i = 1; i <= s.Length; i++)\n count += GetDP(i, t.Length);\n\n Console.WriteLine(count);\n }\n static int GetDP(int i, int j)\n {\n if (dp[i, j] != null)\n return (int)dp[i, j];\n int count = 0;\n if (i > 0 && j > 0)\n {\n count += GetDP(i, j - 1);\n if (s[i - 1] == t[j - 1])\n count += 1 + GetDP(i - 1, j - 1);\n }\n dp[i, j] = count;\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKCupRound2\n{\n class SubstringAndSubsequence\n {\n static string s;\n static string t;\n static int?[,] dp;\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n t = Console.ReadLine();\n \n dp = new int?[s.Length + 1,t.Length + 1];\n\n int count = 0;\n for (int i = 1; i <= s.Length; i++)\n count += GetDP(i, t.Length);\n\n Console.WriteLine(count % 1000000007);\n }\n static int GetDP(int i, int j)\n {\n if (dp[i, j] != null)\n return (int)dp[i, j];\n int count = 0;\n if (i > 0 && j > 0)\n {\n count += GetDP(i, j - 1);\n if (s[i - 1] == t[j - 1])\n count += 1 + GetDP(i - 1, j - 1);\n }\n dp[i, j] = count;\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKCupRound2\n{\n class SubstringAndSubsequence\n {\n static string s;\n static string t;\n static int?[,] dp;\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n t = Console.ReadLine();\n \n dp = new int?[s.Length + 1,t.Length + 1];\n\n int count = 0;\n for (int i = 1; i <= s.Length; i++)\n {\n count += (GetDP(i, t.Length) % 1000000007);\n count = count % 1000000007;\n }\n\n Console.WriteLine(count);\n }\n static int GetDP(int i, int j)\n {\n if (dp[i, j] != null)\n return (int)dp[i, j];\n int count = 0;\n if (i > 0 && j > 0)\n {\n count += GetDP(i, j - 1);\n if (s[i - 1] == t[j - 1])\n count += 1 + GetDP(i - 1, j - 1);\n }\n dp[i, j] = count;\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKCupRound2\n{\n class SubstringAndSubsequence\n {\n static string s;\n static string t;\n static int?[,] dp;\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n t = Console.ReadLine();\n \n dp = new int?[s.Length + 1,t.Length + 1];\n\n int count = 0;\n for (int i = 1; i <= s.Length; i++)\n {\n count += GetDP(i, t.Length);\n count = count % 1000000007;\n }\n\n Console.WriteLine(count);\n }\n static int GetDP(int i, int j)\n {\n if (dp[i, j] != null)\n return (int)dp[i, j];\n int count = 0;\n if (i > 0 && j > 0)\n {\n count += GetDP(i, j - 1);\n if (s[i - 1] == t[j - 1])\n count += 1 + GetDP(i - 1, j - 1);\n }\n dp[i, j] = count;\n return count;\n }\n }\n}\n"}], "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f"} {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n using System.Linq;\n using System.Linq.Expressions;\n using System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 32 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n \n private readonly TextWriter sw;\n \n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var k = sr.NextInt64();\n var answ = Int64.MaxValue;\n for (var i = 1; i < k; i++) {\n var x = n * k / i;\n for (var j = 0; j < k; j++) {\n var t = x + j;\n if (t % k == i && (t / k) * i == n) {\n answ = Math.Min(answ, t);\n }\n }\n }\n\n sw.WriteLine(answ);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var str1 = str.Split(' ');\n int n = Int32.Parse(str1[0]);\n int k = Int32.Parse(str1[1]);\n var min_x = n * k + 1;\n for (int i = 2; i < k; i++)\n {\n if (n % i == 0)\n {\n int res = (n * k) / i + i;\n if (res < min_x) min_x = res;\n }\n }\n Console.WriteLine(min_x);\n //TODO: comment before sending\n //Console.WriteLine(\"Done...\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"6 3\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var sc = new Scanner();\n var n = sc.NextLong();\n var k = sc.NextLong();\n\n var best = long.MaxValue;\n\n for (var div = 1L; div * div <= n; div++) {\n if (n % div == 0) {\n\n foreach (var divs in new[] { new[] { div, n / div }, new[] { n / div, div } }) {\n var d1 = divs[0];\n var d2 = divs[1];\n if (d2 >= k) continue;\n var x = d1 * k + d2;\n // System.Console.WriteLine(new { d1, d2, x, k, n });\n best = Math.Min(best, x);\n }\n\n }\n }\n\n System.Console.WriteLine(best);\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray() {\n var array = Array();\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class DivTimesMod\n {\n public static void Main()\n {\n new DivTimesMod().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n var tokens = tr.ReadLine().Split();\n tw.WriteLine(Solve(int.Parse(tokens[0]), int.Parse(tokens[1])));\n }\n\n public int Solve(int n, int k)\n {\n var candidates = new List();\n for (int y1 = 1; y1 * y1 <= n; y1++)\n {\n if (n % y1 == 0)\n {\n int y2 = n / y1;\n int maxX = (y1 + 1) * k;\n for (int x = y1 * k; x < maxX; x++)\n {\n if (x % k == y2)\n {\n candidates.Add(x);\n }\n }\n\n int maxX2 = (y2 + 1) * k;\n for (int x = y2 * k; x < maxX2; x++)\n {\n if (x % k == y1)\n {\n candidates.Add(x);\n }\n }\n }\n }\n\n return candidates.Min();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] Inp = Console.ReadLine().Split();\n int N = Convert.ToInt32(Inp[0]), K = Convert.ToInt32(Inp[1]);\n\n int Min = Int32.MaxValue;\n for (int i = 1; i < K; i++)\n {\n if (N % i == 0)\n {\n int X = (N / i) * K + i;\n if ((X / K) * (X % K) == N)\n Min = Math.Min(Min, X);\n }\n }\n\n Console.WriteLine(Min);\n }\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _1085B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n int mod = Enumerable.Range(1, k - 1).Last(i => n % i == 0);\n int div = n / mod;\n\n int x = k * div + mod;\n Console.WriteLine(x);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Div_Times_Mod\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve());\n writer.Flush();\n }\n\n private static int Solve()\n {\n int n = Next();\n int k = Next();\n\n var ans = new List();\n\n for (int i = 1; i < k; i++)\n {\n if (n%i == 0)\n {\n int div = n/i;\n int p = div*k + i;\n ans.Add(p);\n }\n }\n\n return ans.Min();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n int first, second = 0;\n int minimum_x = int.MaxValue;\n for(int i =1;i<(int)Math.Sqrt(n)+1;i++)\n {\n if(n%i==0)\n {\n first = i;\n second = n / i;\n }\n int first_x = k * i + n / i;\n int second_x = n * k / i + i ;\n if((first_x / k) * (first_x % k) == n)\n {\n if(first_x tmp = new List();\n for (int i = 1; i <= n; i++)\n {\n if (n%i == 0 && n/i < k)\n {\n b = n / i;\n a = n / b;\n tmp.Add(a * k + b);\n }\n \n }\n Console.WriteLine(tmp.Min()); \n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Numerics;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nums[0];\n int k = nums[1];\n int x = 0;\n int b = n / GCD(n, k);\n int a = n / b;\n int min = a * k + b;\n for (int i = 1; i <= n; i++)\n {\n if (n%i == 0)\n {\n b = n / i;\n a = n / b;\n int tmp = a * k + b;\n if (tmp%k != 0)\n {\n x = tmp;\n }\n else\n {\n x = min;\n }\n }\n if (min > x)\n {\n min = x;\n }\n }\n Console.WriteLine(min);\n }\n\n private static void Sort1(T[][] data, int col)\n {\n Comparer comparer = Comparer.Default;\n Array.Sort(data, (x, y) => comparer.Compare(x[col], y[col]));\n }\n // Number of digits of a number\n public static double Digits(double n)\n {\n \n if (n < 10) return 1;\n if (n < 100) return 2;\n if (n < 1000) return 3;\n if (n < 10000) return 4;\n if (n < 100000) return 5;\n if (n < 1000000) return 6;\n if (n < 10000000) return 7;\n if (n < 100000000) return 8;\n if (n < 1000000000) return 9;\n return 10;\n }\n // FOR GCD OF TWO INTS\n public static int GCD(int a, int b)\n {\n int GCD=0;\n while (b != 0)\n {\n GCD = b;\n b = a % b;\n a = GCD;\n }\n return GCD;\n }\n // For PRIME Numbers\n static bool isprime(double number)\n {\n if (number < 2) return false;\n if (number % 2 == 0) return (number == 2);\n int root = (int)Math.Sqrt((double)number);\n for (int i = 3; i <= root; i += 2)\n {\n if (number % i == 0) return false;\n }\n return true;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Numerics;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nums[0];\n int k = nums[1];\n \n int b = n / GCD(n, k);\n int a = n / b;\n\n int min = a * k + b;\n int x = min; \n for (int i = 1; i <= n; i++)\n {\n if (n%i == 0 && (n/i)%k != 0)\n {\n b = n / i;\n a = n / b;\n x = a * k + b;\n }\n if (min > x)\n {\n min = x;\n }\n }\n Console.WriteLine(min);\n }\n\n private static void Sort1(T[][] data, int col)\n {\n Comparer comparer = Comparer.Default;\n Array.Sort(data, (x, y) => comparer.Compare(x[col], y[col]));\n }\n // Number of digits of a number\n public static double Digits(double n)\n {\n \n if (n < 10) return 1;\n if (n < 100) return 2;\n if (n < 1000) return 3;\n if (n < 10000) return 4;\n if (n < 100000) return 5;\n if (n < 1000000) return 6;\n if (n < 10000000) return 7;\n if (n < 100000000) return 8;\n if (n < 1000000000) return 9;\n return 10;\n }\n // FOR GCD OF TWO INTS\n public static int GCD(int a, int b)\n {\n int GCD=0;\n while (b != 0)\n {\n GCD = b;\n b = a % b;\n a = GCD;\n }\n return GCD;\n }\n // For PRIME Numbers\n static bool isprime(double number)\n {\n if (number < 2) return false;\n if (number % 2 == 0) return (number == 2);\n int root = (int)Math.Sqrt((double)number);\n for (int i = 3; i <= root; i += 2)\n {\n if (number % i == 0) return false;\n }\n return true;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n for(int i =1;i<10*10*10*10*10;i++)\n {\n if((i/k)*(i%k) ==n)\n {\n Console.WriteLine(i);\n break;\n }\n } \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n for(int i =1;i<100000000;i++)\n {\n if((i/k)*(i%k) ==n)\n {\n Console.WriteLine(i);\n break;\n }\n } \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n for(int i =1;i<1000000;i++)\n {\n if((i/k)*(i%k) ==n)\n {\n Console.WriteLine(i);\n break;\n }\n } \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodilityToptal\n{\n public class ToptalCodility\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine().Split(' ');\n var n = int.Parse(line[0]);\n var k = int.Parse(line[1]);\n Solve(n, k);\n //Solve(6, 3);\n //Solve(1, 2);\n //Solve(4, 6);\n //Solve(1000000,1000);\n }\n\n\n public static void Solve(int n, int k)\n {\n for (var i = 1; i < 10000000; i++)\n { \n if ((i / k) * (i % k) == n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodilityToptal\n{\n public class ToptalCodility\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine().Split(' ');\n var n = int.Parse(line[0]);\n var k = int.Parse(line[1]);\n Solve(n, k);\n //Solve(6, 3);\n //Solve(1, 2);\n //Solve(4, 6);\n }\n\n\n public static void Solve(int n, int k)\n {\n for (var i = 1; i < 1000000; i++)\n { \n if ((i / k) * (i % k) == n)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n\n }\n}"}], "src_uid": "ed0ebc1e484fcaea875355b5b7944c57"} {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace TestProject\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n //read input\r\n var hw = Console.ReadLine().Split(' ');\r\n var h = int.Parse(hw[0]);\r\n var w = int.Parse(hw[1]);\r\n\r\n var field = new List();\r\n for (var i = 0; i < h; i++)\r\n {\r\n var row = Console.ReadLine().ToCharArray();\r\n for (var j = 0; j < w; j++)\r\n {\r\n if (row[j] == '*')\r\n {\r\n field.Add(new B { X = j, Y = i });\r\n }\r\n }\r\n }\r\n\r\n var mouse = new B { Y = 0, X = 0 };\r\n var count = 0;\r\n //move mouse\r\n while (field.Any())\r\n {\r\n field = field.Where(b => b.X >= mouse.X && b.Y >= mouse.Y).ToList();\r\n if(!field.Any())\r\n {\r\n break;\r\n }\r\n field = field.OrderBy(b => b.X - mouse.X + b.Y - mouse.Y).ToList();\r\n if (!field.Any())\r\n {\r\n break;\r\n }\r\n mouse = field.First();\r\n field.RemoveAt(0);\r\n count++;\r\n }\r\n Console.WriteLine(count);\r\n Console.ReadLine();\r\n }\r\n\r\n class B\r\n {\r\n public int X { get; set; }\r\n public int Y { get; set; }\r\n }\r\n }\r\n}\r\n", "positive_code": [{"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApp1\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tstatic void Main(string[] args)\r\n\t\t{\r\n\t\t\tvar st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\r\n\t\t\tvar height = st[0];\r\n\t\t\tvar width = st[1];\r\n\t\t\tvar field = new List(height);\r\n\t\t\tfor(var i =0; i < height; i++)\r\n\t\t\t{\r\n\t\t\t\tfield.Add(Console.ReadLine());\r\n\t\t\t}\r\n\t\t\tvar r = 0;\r\n\t\t\tvar c = 0;\r\n\t\t\tvar sum = field[r][c] == '*' ? 1:0;\r\n\t\t\twhile(r!= height -1 || c != width - 1)\r\n\t\t\t{\r\n\t\t\t\tvar rightWithStrawberry = c + 1 < width && field[r][c+1] == '*';\r\n\t\t\t\tvar downWithStrawberry = r + 1 < height && field[r+1][c] == '*';\r\n\t\t\t\tif (rightWithStrawberry)\r\n\t\t\t\t{\r\n\t\t\t\t\tc++;\r\n\t\t\t\t\tsum++;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (downWithStrawberry)\r\n\t\t\t\t{\r\n\t\t\t\t\tr++;\r\n\t\t\t\t\tsum++;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (c + 1 < width) c++;\r\n\t\t\t\telse r++;\r\n\t\t\t}\r\n\t\t\tConsole.WriteLine(sum);\r\n\t\t}\r\n\t}\r\n}\r\n"}], "negative_code": [], "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic partial class codeforces80A\n{\n public static void BlackJack()\n {\n int[] c = new int[10] { 4, 4, 4, 4, 4, 4, 4, 4, 4, 15 };\n int now = 10;\n int want = int.Parse(Console.ReadLine()) - now;\n for (int i = 1; i <= 11; i++)\n if (want == i) { Console.WriteLine(c[(i - 1) % 10]); return; }\n Console.WriteLine(0);\n }\n\n public static void Main()\n {BlackJack();}\n}", "positive_code": [{"source_code": "using System;\n\nclass P {\n static void Main() {\n var n = int.Parse(Console.ReadLine()) - 10;\n var res = n <= 0 ? 0 :\n n <= 9 ? 4 :\n n == 10 ? 15 : \n n == 11 ? 4 : \n 0;\n Console.Write(res);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Blackjack\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n if (n <= 10 || n > 21)\n writer.WriteLine(\"0\");\n else if (n != 20)\n {\n writer.WriteLine(\"4\");\n }\n else\n {\n writer.WriteLine(\"15\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var a = new int[] {0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4};\n\n if (n > 21 || n <= 10)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(a[n - 10]);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar start = 10;\n\t\t\tvar r = n - start;\n\t\t\tif (r <= 0) {\n\t\t\t\tsw.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (r == 10) {\n\t\t\t\tif (start == 10) {\n\t\t\t\t\tsw.WriteLine(15);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsw.WriteLine(16);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (r > 11) {\n\t\t\t\tsw.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (r == start) {\n\t\t\t\tsw.WriteLine(3);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(4);\n\t\t\t}\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nnamespace blackjack\n{\n class Program\n {\n static void Main(string[] args)\n {\n try {\n int sayac = 0;\n int puan = 0;\n int[] puanlar = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };\n int toppuan = int.Parse(Console.ReadLine());\n toppuan -= 10;\n if (toppuan >= 0)\n {\n for (int i = 0; i < puanlar.Length; i++)\n {\n puan += puanlar[i];\n if (puan == toppuan)\n {\n if (puan == 10)\n {\n sayac += 15;\n\n }\n else\n {\n sayac += 4;\n\n }\n }\n puan = 0;\n }\n }\n else\n sayac = 0;\n Console.Write(sayac);\n Console.ReadKey();\n }\n catch { }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var n = ReadInt();\n var a = 0;\n var c = new[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11 };\n foreach (var card in c)\n {\n if (10 + card == n) { a++; }\n }\n Write(a);\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _104A_BlackJack.Run();\n }\n\n }\n\n class _104A_BlackJack\n {\n public static void Run()\n {\n var arr = new byte[] {4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4};\n var n = byte.Parse(Console.ReadLine().Trim());\n Console.WriteLine(n > 21 || n < 11? 0: arr[n - 11]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace a2oj\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n int n =int.Parse( Console.ReadLine());\n\n n -= 10;\n\n if(n==0)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (n >= 1 && n <= 9)\n {\n Console.WriteLine(4);\n return;\n }\n\n if (n==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (n==11)\n {\n Console.WriteLine(4);\n return;\n }\n\n Console.WriteLine(0);\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic int First;\n\n\t\t\tpublic int Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar cur = 10;\n\t\t\tif (n <= 10 || n - cur > 11)\n\t\t\t\tConsole.WriteLine(0);\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar left = n - cur;\n\t\t\t\tif (left != 10)\n\t\t\t\t\tConsole.WriteLine(4);\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(15);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \",col));\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a>=lb) && (a<=ub);\n }\n\n//----------------------------------------------------------------------------\n\n\n static void Main(string[] args)\n {\n int n = ReadIntLine();\n\n n = n - 10;\n if (n.IsInRange(1, 9))\n PrintLn(4);\n else if (n == 10)\n PrintLn(15);\n else if (n == 11)\n PrintLn(4);\n else\n PrintLn(0);\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce80A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,output=0;\n \n n = Convert.ToInt32(Console.ReadLine());\n if(n<=10)\n {\n output = 0;\n Console.WriteLine(output);\n }\n if ((n > 10)&&(n<20))\n {\n output = 4;\n Console.WriteLine(output);\n }\n if (n == 20)\n {\n output = 15;\n Console.WriteLine(output);\n }\n if (n == 21)\n {\n output = 4;\n Console.WriteLine(output);\n }\n if (n > 21)\n {\n output = 0;\n Console.WriteLine(output);\n }\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n > 1 && n < 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 15);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace aaaa\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int r = 0;\n\n if (n == 11) { r = 4; }\n if (n == 12) { r = 4; }\n if (n == 13) { r = 4; }\n if (n == 14) { r = 4; }\n if (n == 15) { r = 4; }\n if (n == 16) { r = 4; }\n if (n == 17) { r = 4; }\n if (n == 18) { r = 4; }\n if (n == 19) { r = 4; }\n if (n == 20) { r = 15; }\n if (n == 21) { r = 4; }\n\n Console.WriteLine(r);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine())-10;\n if (a <= 0 || a > 11)\n Console.WriteLine(0);\n else if (a < 10 || a == 11)\n Console.WriteLine(4);\n else if (a == 10)\n Console.WriteLine(15);\n\n\n\n\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n int d = int.Parse(Console.ReadLine()) - 10;\n if(d<0||d>11){\n Console.WriteLine(0);\n }else{\n int [] n = new int[12]{0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4};\n Console.WriteLine(n[d]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine())-10;\n\n if (N <= 0)\n {\n Console.WriteLine(0);\n \n } else\n if (N==10)\n {\n Console.WriteLine(15);\n return;\n }else\n\n if (N > 11)\n {\n Console.WriteLine(0);\n return;\n }\n else\n Console.WriteLine(4);\n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace blackjack\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte i,n;\n n = Convert.ToByte(Console.ReadLine());\n n -= 10;\n i = 0;\n if ((n <= 0) || (n >= 12))\n i = 0;\n if ((n >= 1) && (n <= 9))\n i = 4;\n if (n == 10)\n i =15;\n if (n == 11)\n i = 4;\n Console.WriteLine(\"{0}\", i);\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _104A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n <= 10 || n > 21 ? 0 : n == 20 ? 15 : 4);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _104A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] cards = new int[] { 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 1, 1, 1, 1 };\n int n = int.Parse(Console.ReadLine());\n int hand = 10;\n int count = 0;\n\n foreach (int card in cards)\n {\n if (hand + card == n)\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Task\n {\n private const int MOD = 1000000007;\n static void Main()\n {\n int[] count = new int[] { 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4 };\n var n = Int32.Parse(System.Console.ReadLine());\n var index = n - 10;\n if (index < 0 || index > 11)\n index = 0;\n System.Console.WriteLine(count[index]);\n System.Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace keramer\n{\n class program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n if(num <= 10 )\n Console.WriteLine(0);\n else if ( num<=19)\n Console.WriteLine(4);\n else if (num == 20)\n Console.WriteLine(15);\n else if (num == 21)\n Console.WriteLine(4);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Text;\n\nnamespace AcmSolution4\n{\n class Program\n {\n internal class D\n { \n public long Value;\n public int Index;\n public long Max;\n public D(long v, int i)\n {\n Value = v;\n Index = i;\n Max = -1;\n }\n\n public override string ToString()\n {\n return Value + \" \" + Max + \" \" + Index;\n }\n }\n \n private static void Do()\n {\n int n = GetInt();\n int[] a = new int[30];\n \n for (int i = 1; i <= 9; ++i)\n a[i] = 4;\n a[11] = 4;\n a[10] = 4 * 4 - 1;\n\n WL(n >= 10 ? a[n - 10] : 0);\n\n //int n = GetInt();\n //var all = new D[n];\n //int lastP = 2;\n //var d = new List();\n \n //for (int i = 2; i <= n; ++i)\n //{\n // var s = GetStr().Split(' ');\n // long v = long.Parse(s[1]);\n // if (s[0] == \"d\")\n // d.Add(new D(v, i));\n // else\n // { \n // long max = i == n ? 99999999 : v - 1;\n\n // for (int j = d.Count - 1; j >= 0 && d[j].Index >= lastP; --j)\n // d[j].Max = max;\n\n // lastP = i + 1;\n // }\n //}\n\n //d.Add(new D(10, ));\n\n //d.Sort((x,y) => \n //{\n // if (x.Value == y.Value)\n // return x.Max.CompareTo(y.Max);\n \n // return -x.Value.CompareTo(y.Value);\n //});\n\n //int ans = 0;\n //WL(ans);\n }\n \n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ACM_HOME\n //Console.SetIn(new StreamReader(\"input.txt\"));\n //Console.SetOut(new StreamWriter(\"output.txt\"));\n Do();\n //Console.Out.Close();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(\"Answer: \" + GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadLine();\n#endif\n }\n\n #region Utils\n const double Epsilon = 0.00000000000001;\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static long[] GetLongs()\n {\n return GetStrs().Select(long.Parse).ToArray();\n }\n\n static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n\n static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Program().solve();\n }\n\n \n void solve()\n {\n int[] ways = new int[] {0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4, 0, 0, 0, 0, 0, 0};\n int n = nextInt();\n System.Console.WriteLine(n <= 10 ? 0 : ways[n - 10]);\n }\n\n\n\n\n /// \n /// \n /// \n String[] tokens;\n int pointer;\n public long nextLong()\n {\n return long.Parse(nextToken());\n }\n public int nextInt()\n {\n return int.Parse(nextToken());\n }\n public string nextToken()\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = System.Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces80A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int yes = 10;\n if (n <= yes)\n Console.Write(0);\n else\n if (n > yes + 11)\n Console.Write(0);\n else\n if (n - yes == 10)\n Console.Write(15);\n else if (n - yes == 1 && n - yes == 11)\n Console.Write(4);\n else Console.Write(4);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int winNum = Convert.ToInt32(Console.ReadLine());\n int rem = winNum - 10;\n int result=0;\n\n if (winNum <= 10) Console.WriteLine(result);\n if (winNum > 21) Console.WriteLine(result);\n\n switch (rem)\n {\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n case 8:\n case 9:\n Console.WriteLine(\"4\");\n break;\n case 1:\n case 11:\n Console.WriteLine(\"4\");\n break;\n case 10:\n Console.WriteLine(\"15\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n List cards = new List();\n int sum = int.Parse(Console.ReadLine());\n int vars = 0;\n\n for (int i = 1; i <= 52; i++)\n if (i != 10)\n if (i % 13 == 0)\n cards.Add(11);\n else\n cards.Add(Math.Min(i % 13 + 1,10));\n\n for (int i = 0; i < cards.Count; i++)\n {\n if ((10 + cards[i] == sum) | (cards[i] == 11) & (1+10 == sum))\n vars++;\n }\n\n Console.WriteLine(vars);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[] { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11 };\n Console.WriteLine(arr.Count(num => num == n - 10));\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n\tpublic void Solve()\n\t{\n\t\tint n = int.Parse(CF.ReadLine());\n\t\tint r = n - 10;\n\n\t\tint res = 0;\n\t\tif (r == 10)\n\t\t\tres = 15;\n\t\telse if (r == 11)\n\t\t\tres = 4;\n\t\telse if (r >= 1 && r <= 9)\n\t\t\tres = 4;\n\n\t\tCF.WriteLine(res);\n\n\t}\n\n\n\t// test\n\tstatic Utils CF = new Utils(new[]{\n@\"\n12\n\"\n,\n@\"\n20\n\"\n,\n@\"\n10\n\"\n\t});\n\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main()\n {\n int scoreNeeds = int.Parse(Console.ReadLine());\n int cards = 0;\n\n for (int i = 1; i <= 11; i++)\n {\n if (i + 10 == scoreNeeds)\n {\n if (i == 10)\n {\n cards += 15;\n }\n else\n {\n cards += 4;\n }\n }\n }\n Console.WriteLine(cards);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Task\n{\n class Program\n {\n static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n if (number - 10 < 1 || number - 10 > 11)\n {\n Console.WriteLine(\"0\");\n }\n else if (number == 20)\n {\n Console.WriteLine(\"15\");\n }\n else\n {\n Console.WriteLine(\"4\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces80\n{\n class proba\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int n = Int32.Parse(s);\n n = n - 10;\n if (n >= 1 && n < 10)\n {\n Console.WriteLine(\"4\");\n }\n else if (n == 10)\n {\n Console.WriteLine(\"15\");\n }\n else if (n == 11)\n {\n Console.WriteLine(\"4\");\n }\n else Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int right = Convert.ToInt32(Console.ReadLine());\n int wanted = right - 10;\n switch (wanted) {\n\n case 1:\n Console.WriteLine(4);\n break;\n case 2:\n Console.WriteLine(4);\n break;\n case 3:\n Console.WriteLine(4);\n break;\n case 4:\n Console.WriteLine(4);\n break;\n case 5:\n Console.WriteLine(4);\n break;\n case 6:\n Console.WriteLine(4);\n break;\n case 7:\n Console.WriteLine(4);\n break;\n case 8:\n Console.WriteLine(4);\n break;\n case 9:\n Console.WriteLine(4);\n break;\n case 10:\n Console.WriteLine(15);\n break;\n case 11:\n Console.WriteLine(4);\n break;\n default:\n Console.WriteLine(0);\n break;\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace BlackJack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if(n <= 10 || n > 21)\n Console.WriteLine(0);\n else if (n < 20 || n == 21)\n Console.WriteLine(4);\n else\n Console.WriteLine(15);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace _104A{\n class Program{\n static void Main(string[] args){\n Int64 n=Convert.ToInt64(Console.ReadLine());\n if (n <= 10 || n > 21) Console.WriteLine(0);\n else if (n == 20) Console.WriteLine(15);\n else Console.WriteLine(4);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace capp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0;\n int n = int.Parse(Console.ReadLine()) - 10;\n if (n == 10)\n Console.WriteLine(15);\n else\n if ((n > 0 && n < 10) || n == 11)\n Console.WriteLine(4);\n else\n Console.WriteLine(0);\n\n \n \n }\n }\n\n\n}\n"}, {"source_code": "using System;\n\nnamespace task104A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n <= 10 || n > 21)\n {\n Console.WriteLine(0);\n }\n\n else if (n == 20)\n {\n Console.WriteLine(15);\n }\n else\n {\n Console.WriteLine(4);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a1cs\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine()) - 10;\n if (n < 1) Console.WriteLine(0);\n else\n if (n < 10) Console.WriteLine(4);\n else\n if (n == 10) Console.WriteLine(15);\n else\n if (n == 11) Console.WriteLine(4);\n else\n if (n > 11) Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Text;\nnamespace p2\n{\n class Program\n {\n public static int Main(string[] args)\n { string[] line =Console.ReadLine().Split();\n int n,m,a;\n n=int.Parse(line[0]);\n if(n<=10){Console.WriteLine(\"0\");return 0;}\n if(n-10<10){Console.WriteLine(\"4\");return 0;}\n if(n-10==10){Console.WriteLine(\"15\");return 0;}\n if(n-10==11){Console.WriteLine(\"4\");return 0;}\n Console.WriteLine(\"0\");\n //Console.ReadKey();\n return 0;\n }\n\n \n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProblemA\n{\n class ProblemA\n {\n static int GetCount(int diff)\n {\n switch (diff)\n {\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n case 8:\n case 9:\n case 11:\n return 4;\n case 10:\n return 15;\n default:\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int diff = n - 10;\n Console.WriteLine(GetCount(diff));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0417\u0430\u04344\n{\n class \u0417\u0430\u04344\n {\n static void Main(string[] args)\n {\n int[] cards = new int[] { 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 1, 1, 1, 1 };\n int n = int.Parse(Console.ReadLine());\n int queen = 10;\n int count = 0;\n foreach (int card in cards)\n {\n if (queen + card == n)\n count++;\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n List cards = new List();\n\n for (int i = 1; i <= 11; i++)\n for (int j = 0; j < 4; j++)\n cards.Add(i);\n\n for (int i = 0; i < 11; i++)\n cards.Add(10);\n\n var a = cards.FindAll(x => x + 10 == n);\n\n Console.WriteLine(a.Count);\n\n }\n\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Intro\n{\n class Program\n {\n static void Main()\n\n {\n int FirstCard = 10;\n int result = Convert.ToInt32(Console.ReadLine());\n if (result - FirstCard < 1 || result - FirstCard > 11)\n {\n Console.WriteLine(\"0\");\n }\n else if (result == 20)\n {\n Console.WriteLine(\"15\");\n }\n else\n {\n Console.WriteLine(\"4\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Crypt\n{\n class CutTheNumbers\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int sum = n - 10;\n int op=0;\n\n if ((sum>0 && sum < 10) || sum == 11)\n op = 4;\n else if (sum == 10)\n op = 15;\n Console.WriteLine(op);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, sum = 0, i,rez=10;\n int [] a = new int [14] {2,3,4,5,6,7,8,9,10,10,10,10,1,11};\n n = Int32.Parse(Console.ReadLine());\n for (i = 0; i < 14; i++)\n {\n if (i == 10 && n == rez + a[10])\n {\n sum = sum + 3;\n }\n else\n if (n == rez + a[i])\n {\n sum= sum + 4;\n }\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A.Blackjack\n{\n\tclass Program\n\t{\n\t\tstatic int[] cards = new int[]{2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,\n\t\t10,10,10,10, 10,10,10, 10,10,10,10, 11,11,11,11 ,1,1,1,1};\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint N = int.Parse(Console.ReadLine());\n\n\t\t\tint c = 10;\n\t\t\tint count = cards.Count(card => c + card == N);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = 0;\n int res = 0;\n /*using (StreamReader sr = new StreamReader(\"standard input\"))\n {\n n = int.Parse(sr.ReadLine());\n };*/\n n=int.Parse(Console.ReadLine());\n if (n < 20 && n > 10 || n==21) res = 4;\n else\n if (n == 10) res = 0;\n else\n if (n > 21) res = 0;\n else \n if (n==20) res = 15;\n\n /*if (File.Exists(\"standard output\")) File.Delete(\"standard output\");\n using (StreamWriter sw = new StreamWriter(\"standard output\"))\n {\n sw.WriteLine(res);\n sw.Flush();\n };*/\n Console.WriteLine(res);\n\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n if (n <= 10 || n > 21)\n Console.WriteLine(\"0\");\n else if (n != 20)\n Console.WriteLine(\"4\");\n else\n Console.WriteLine(\"15\");\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int o = n - 10;\n if (o >= 1 && o <= 9)\n Console.WriteLine(4);\n else if (o == 10)\n Console.WriteLine(15);\n else if (o == 11)\n Console.WriteLine(4);\n else\n Console.WriteLine(0);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace divver\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str);\n if ((n-10>0 && n-10<10) || (n-10 == 11)) Console.Write(\"4\");\n else if (n-10 == 10) Console.Write(\"15\");\n else Console.Write(\"0\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Fffuuuu {\n\n IEnumerable Eval(Int32 num) {\n num %= 13;\n if (num < 9) {\n yield return num + 2;\n } else if (num == 12) {\n yield return 1;\n yield return 11;\n } else {\n yield return 10;\n }\n yield break;\n }\n\n public Fffuuuu() {\n Int32 bank = Int32.Parse(Console.ReadLine()) - 10, res = 0;\n for (Int32 i = 0; i < 13 * 4; ++i) {\n if (i != 10) {\n foreach (Int32 ev in Eval(i)) {\n if (ev == bank) {\n ++res;\n }\n }\n }\n }\n Console.WriteLine(res);\n }\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"in.txt\", System.Text.Encoding.Default));\n#endif\n new Fffuuuu();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForse80\n{\n \n \n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int dim = n - 10;\n if (dim <= 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n if (dim == 10)\n {\n Console.WriteLine(15);\n }\n else if (dim > 11)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(4);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Blackjack_Mark_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = Int32.Parse(Console.ReadLine());\n switch (number-10)\n {\n case 1:\n Console.WriteLine(\"4\");\n break;\n case 2:\n Console.WriteLine(\"4\");\n break;\n case 3:\n Console.WriteLine(\"4\");\n break;\n case 4:\n Console.WriteLine(\"4\");\n break;\n case 5:\n Console.WriteLine(\"4\");\n break;\n case 6:\n Console.WriteLine(\"4\");\n break;\n case 7:\n Console.WriteLine(\"4\");\n break;\n case 8:\n Console.WriteLine(\"4\");\n break;\n case 9:\n Console.WriteLine(\"4\");\n break;\n case 10:\n Console.WriteLine(\"15\");\n break;\n case 11:\n Console.WriteLine(\"4\");\n break;\n default:\n Console.WriteLine(\"0\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Blackjack_Mark_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = int.Parse(Console.ReadLine());\n switch (number-10)\n {\n case 1:\n Console.WriteLine(\"4\");\n break;\n case 2:\n Console.WriteLine(\"4\");\n break;\n case 3:\n Console.WriteLine(\"4\");\n break;\n case 4:\n Console.WriteLine(\"4\");\n break;\n case 5:\n Console.WriteLine(\"4\");\n break;\n case 6:\n Console.WriteLine(\"4\");\n break;\n case 7:\n Console.WriteLine(\"4\");\n break;\n case 8:\n Console.WriteLine(\"4\");\n break;\n case 9:\n Console.WriteLine(\"4\");\n break;\n case 10:\n Console.WriteLine(\"15\");\n break;\n case 11:\n Console.WriteLine(\"4\");\n break;\n default:\n Console.WriteLine(\"0\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace task1 {\n internal class Program {\n private static void Main(string[] args) {\n int n = int.Parse(Console.ReadLine());\n int t = n - 10;\n if (t < 1) {\n Console.WriteLine(0);\n return;\n }\n if (t < 10) {\n Console.WriteLine(4);\n return;\n }\n if (t == 10) {\n Console.WriteLine(15);\n return;\n }\n if (t == 11) {\n Console.WriteLine(4);\n return;\n }\n if (t > 11) Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "// Problem: 104A - Blackjack\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass Blackjack\n {\n static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 25)\n return -1;\n byte ans = 0;\n if ((n >= 11 && n <= 19) || n == 21)\n ans = 4;\n else if (n == 20)\n ans = 15;\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Ultra\n{\n public static void Main(string[] Args)\n {\n int sum = Convert.ToInt32(Console.ReadLine()) - 10;\n int count = 0;\n\n if (sum == 1 || sum == 11)\n {\n count = count + 4;\n }\n\n if (sum == 2|| sum == 3 || sum == 4|| sum == 5 || sum == 6 || sum == 7 || sum == 8 || sum == 9)\n {\n count += 4;\n }\n\n\n if(sum==10)\n {\n count += 15;\n }\n\n Console.WriteLine(count);\n\n\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int x = n - 10;\n if (n <= 10 || n>21)\n {\n Console.WriteLine(\"0\"); \n }\n if ((n >= 11 && n <= 19)||n==21)\n {\n Console.WriteLine(\"4\");\n }\n if (n == 20)\n {\n Console.WriteLine(\"15\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nnamespace LessonC\n{\n\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine())-10;\n int sum =0;\n if (n>=2&&n <= 9)\n {\n for (int i = 2; i <= 9; i++)\n {\n if (n - i == 0)\n sum += 4;\n }\n }\n else\n if (n == 10)\n sum += 15;\n else\n if (n == 1 || n == 11)\n sum += 4;\n\n Console.WriteLine(sum); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nnamespace LessonC\n{\n\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine())-10;\n int sum = 0;\n for (int i = 2; i <= 9; i++)\n {\n if (n - i == 0)\n sum+=4;\n }\n if (n == 10)\n sum += 15;\n if (n == 1 || n == 11)\n sum += 4;\n\n Console.WriteLine(sum); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nnamespace LessonC\n{\n\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine())-10;\n int sum = 0;\n if (n>=2&&n <= 9)\n {\n for (int i = 2; i <= 9; i++)\n {\n if (n - i == 0)\n sum += 4;\n }\n }\n else\n if (n == 10)\n sum += 15;\n else\n if (n == 1 || n == 11)\n sum += 4;\n\n Console.WriteLine(sum); \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Zadachka4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = Convert.ToInt32(Console.ReadLine());\n if(number - 10 < 1 || number -10 > 11)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n if (number - 10 == 10)\n {\n Console.WriteLine(\"15\");\n }\n else\n {\n Console.WriteLine(\"4\");\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace _5\n{\n class Program\n {\n struct MyStr\n {\n public int iX;\n public int iY;\n }\n static void Main(string[] args)\n {\n int iD = 10;\n int iData = Convert.ToInt32(Console.ReadLine());\n int iCount = 0;\n\n for (int i = 1; i <= 11; i++)\n {\n if (iD + i == iData)\n {\n if (i == 10)\n iCount += 15;\n else\n iCount += 4;\n }\n }\n Console.WriteLine(iCount);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NEwTechTEst\n{\n class Program\n {\n static void Main(string[] args)\n {\n var maps = new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n foreach (var x in maps)\n {\n if (x + 10 == n) count++;\n }\n count *= 4;\n if (n == 20) count--;\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n\n if (n > 10 && n < 20 || n == 21)\n {\n Console.WriteLine(4);\n }\n else if (n == 20)\n {\n Console.WriteLine(15);\n }\n else\n {\n Console.WriteLine(0);\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _80D2A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Dictionary a = new Dictionary();\n a.Add(1, 4);\n a.Add(2, 4);\n a.Add(3, 4);\n a.Add(4, 4);\n a.Add(5, 4);\n a.Add(6, 4);\n a.Add(7, 4);\n a.Add(8, 4);\n a.Add(9, 4);\n a.Add(10, 15);\n a.Add(11, 4);\n try\n {\n Console.WriteLine(a[n - 10]);\n }\n catch\n {\n Console.WriteLine(0);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n //int k = int.Parse(Console.ReadLine());\n //string[] tmp = Console.ReadLine().Split(' '); \n int n = int.Parse(Console.ReadLine());\n int find = n - 10 , ans = 0 ;\n if (find != 10)\n ans = 4;\n else\n ans = 15;\n if (find <= 0 || find > 11 )\n ans = 0;\n Console.WriteLine(ans);\n \n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if ((n -= 10) < 1 || n>11) Console.WriteLine(\"0\");\n else if (n == 10)\n Console.WriteLine(\"15\");\n else Console.WriteLine(\"4\");\n }\n \n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n=int.Parse(Console.ReadLine());\n n -= 10;\n if ((n>=1 && n <= 9) || n == 11)\n Console.Write(4);\n else\n {\n if (n == 10)\n Console.Write(15);\n else\n Console.Write(0);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_Blackjack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt16(Console.ReadLine());\n n = n - 10;\n if (n > 11 || n <= 0)\n Console.WriteLine(\"0\");\n else if (n < 10 || n == 11)\n Console.WriteLine(\"4\");\n else if (n == 10)\n Console.WriteLine(\"15\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n=int.Parse(Console.ReadLine());\n n -= 10;\n if (n>=2 && n <= 9 || n == 11)\n Console.Write(4);\n else\n {\n if (n == 10)\n Console.Write(15);\n else\n Console.Write(0);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_Blackjack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt16(Console.ReadLine());\n n = n - 10;\n if (n > 10 || n <= 0)\n Console.WriteLine(\"0\");\n else if (n < 10)\n Console.WriteLine(\"4\");\n else if (n == 10)\n Console.WriteLine(\"15\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_Blackjack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt16(Console.ReadLine());\n n = n - 10;\n if (n > 10 || n <= 0)\n Console.WriteLine(\"0\");\n else if (n < 10 || n == 11)\n Console.WriteLine(\"4\");\n else if (n == 10)\n Console.WriteLine(\"15\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar start = 10;\n\t\t\tvar r = n - start;\n\t\t\tif (r <= 0) {\n\t\t\t\tsw.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (r == 10) {\n\t\t\t\tif (start == 10) {\n\t\t\t\t\tsw.WriteLine(15);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsw.WriteLine(16);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (r == start) {\n\t\t\t\tsw.WriteLine(3);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(4);\n\t\t\t}\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace a2oj\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n int n =int.Parse( Console.ReadLine());\n\n n -= 10;\n\n if(n==0)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (n >= 1 && n < 9)\n {\n Console.WriteLine(4);\n return;\n }\n\n if (n==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (n==11)\n {\n Console.WriteLine(4);\n return;\n }\n\n Console.WriteLine(0);\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * n);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * 4 - 1);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * 4 - 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * n);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * 4 - 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4 * n);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4 * 4 - 1);\n\t\t\t}\n\t\t\telse if (n > 15)\n\t\t\t{\n\t\t\t\tConsole.Write(\"0\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4 * n);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.Write(\"{0}\", 4 * 4 - 1);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine()) - 10;\n\n\t\t\t// ACE\n\t\t\tif (n == 1 || n == 11)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\t// 2 - 10\n\t\t\telse if (n < 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4);\n\t\t\t}\n\t\t\telse if (n == 10)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0}\", 4 * 4);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine())-10;\n\n if (N>=0)\n Console.WriteLine(0);\n\n if (N==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (N > 11)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(4);\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine())-10;\n if (N==0)\n Console.WriteLine(0);\n\n if (N==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (N>11)\n {\n Console.Write(0);\n return;\n }\n \n Console.Write(4);\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine())-10;\n if (N==0)\n Console.WriteLine(0);\n\n if (N==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (N>=1||N==11) Console.Write(4);\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine())-10;\n\n if (N<=0)\n Console.WriteLine(0);\n\n if (N==10)\n {\n Console.WriteLine(15);\n return;\n }\n\n if (N > 11)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(4);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _104A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] cards = new int[] { 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11 };\n int n = int.Parse(Console.ReadLine());\n int hand = 10;\n int count = 0;\n\n foreach (int card in cards)\n {\n if (hand + card == n)\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _104A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] cards = new int[] { 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1 };\n int n = int.Parse(Console.ReadLine());\n int hand = 10;\n int count = 0;\n\n foreach (int card in cards)\n {\n if (hand + card == n)\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace keramer\n{\n class program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n if(num <= 10 )\n Console.WriteLine(0);\n else if ( num<=19)\n Console.WriteLine(4);\n else if (num == 20)\n Console.WriteLine(15);\n else if (num == 21)\n Console.WriteLine(11);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int winNum = Convert.ToInt32(Console.ReadLine());\n int rem = winNum - 10;\n int result=0;\n\n if (winNum <= 10) Console.WriteLine(result);\n if (winNum <= 21) Console.WriteLine(result);\n\n switch (rem)\n {\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n case 8:\n case 9:\n Console.WriteLine(\"4\");\n break;\n case 1:\n case 11:\n Console.WriteLine(\"4\");\n break;\n case 10:\n Console.WriteLine(\"15\");\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int winNum = Convert.ToInt32(Console.ReadLine());\n int rem = winNum - 10;\n int result=0;\n\n if (winNum <= 10) Console.WriteLine(result);\n\n switch (rem)\n {\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n case 8:\n case 9:\n Console.WriteLine(\"4\");\n break;\n case 1:\n case 11:\n Console.WriteLine(\"4\");\n break;\n case 10:\n Console.WriteLine(\"15\");\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n List cards = new List();\n int sum = int.Parse(Console.ReadLine());\n int vars = 0;\n\n for (int i = 1; i <= 52; i++)\n if (i != 10)\n if (i % 13 == 0)\n cards.Add(11); \n else\n cards.Add(Math.Min(i % 13 + 1,10));\n\n for (int i = 0; i < cards.Count; i++)\n {\n if ((10 + cards[i] == sum) | (cards[i] == 1) & (1+10 == sum))\n vars++;\n }\n\n Console.WriteLine(vars);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main()\n {\n int scoreNeeds = int.Parse(Console.ReadLine());\n int cards = 0;\n\n for (int i = 2; i <= 11; i++)\n {\n if (i + 10 == scoreNeeds)\n {\n if (i <= 9)\n {\n cards += 4;\n }\n else if (i == 10)\n {\n cards += 15;\n }\n else\n {\n cards++;\n }\n }\n }\n Console.WriteLine(cards);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main()\n {\n int scoreNeeds = int.Parse(Console.ReadLine());\n int cards = 0;\n\n for (int i = 2; i <= 11; i++)\n {\n if (i + 10 == scoreNeeds)\n {\n if (i <= 9 && i >= 2)\n {\n cards += 4;\n }\n else if (i == 10)\n {\n cards += 15;\n }\n else\n {\n cards += i;\n }\n }\n }\n Console.WriteLine(cards);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main()\n {\n int scoreNeeds = int.Parse(Console.ReadLine());\n int cards = 0;\n\n for (int i = 1; i <= 11; i++)\n {\n if (i + 10 == scoreNeeds)\n {\n if (i <= 9 && i >= 2)\n {\n cards += 4;\n }\n else if (i == 10)\n {\n cards += 15;\n }\n else\n {\n cards += i;\n }\n }\n }\n Console.WriteLine(cards);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace BlackJack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result = 0;\n int n = int.Parse(Console.ReadLine());\n if(n <= 10)\n Console.WriteLine(result);\n else if (n < 20)\n Console.WriteLine((result + 1) * 4);\n else if (n == 20)\n Console.WriteLine(15);\n else \n Console.WriteLine(19);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace BlackJack\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if(n <= 10 || n > 21)\n Console.WriteLine(0);\n else if (n < 20)\n Console.WriteLine(4);\n else if (n == 20)\n Console.WriteLine(15);\n else\n Console.WriteLine(19);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a1cs\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine()) - 10;\n if (n < 1) Console.WriteLine(0);\n else\n if (n < 10) Console.WriteLine(4);\n else\n if (n == 10) Console.WriteLine(15);\n else\n if (n == 11) Console.WriteLine(4);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a1cs\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine()) - 10;\n if (n < 1) Console.WriteLine(0);\n if (n < 10) Console.WriteLine(4);\n if (n == 10) Console.WriteLine(15);\n if (n == 11) Console.WriteLine(4);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a1cs\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n if (n < 1) Console.WriteLine(0);\n else\n if (n < 10) Console.WriteLine(4);\n else\n if (n == 10) Console.WriteLine(15);\n else\n if (n == 11) Console.WriteLine(4);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Text;\nnamespace p2\n{\n class Program\n {\n public static int Main(string[] args)\n { string[] line =Console.ReadLine().Split();\n int n,m,a;\n n=int.Parse(line[0]);\n if(n<10){Console.WriteLine(\"-1\");return 0;}\n if(n==10){Console.WriteLine(\"0\");return 0;}\n if(n-10<10){Console.WriteLine(\"4\");return 0;}\n if(n-10==10){Console.WriteLine(\"15\");return 0;}\n Console.WriteLine(\"4\");\n //Console.ReadKey();\n return 0;\n }\n\n \n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A.Blackjack\n{\n\tclass Program\n\t{\n\t\tstatic int[] cards = new int[]{2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,\n\t\t10,10,10,10, 10,10,10, 10,10,10,10, 11,11,11,11};\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint N = int.Parse(Console.ReadLine());\n\n\t\t\tint c = 10;\n\t\t\tint count = cards.Count(card => c + card == N);\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace divver\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str);\n if ((25-n>0 && 25-n<10) || (25-n == 11)) Console.Write(\"4\");\n else if (25-n == 10) Console.Write(\"15\");\n else Console.Write(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Ultra\n{\n public static void Main(string[] Args)\n {\n int sum = Convert.ToInt32(Console.ReadLine()) - 10;\n int count = 0;\n\n if (sum == 1 || sum == 11)\n {\n count = count + 1;\n }\n\n if (sum == 2|| sum == 3 || sum == 4|| sum == 5 || sum == 6 || sum == 7 || sum == 8 || sum == 9)\n {\n count += 4;\n }\n\n\n if(sum==10)\n {\n count += 15;\n }\n\n Console.WriteLine(count);\n\n\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nnamespace LessonC\n{\n\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine())-10;\n int sum = 0;\n if (n <= 9)\n {\n for (int i = 2; i <= 9; i++)\n {\n if (n - i == 0)\n sum += 4;\n }\n }\n else\n if (n == 10)\n sum += 15;\n else\n if (n == 1 || n == 11)\n sum += 4;\n\n Console.WriteLine(sum); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n //int k = int.Parse(Console.ReadLine());\n //string[] tmp = Console.ReadLine().Split(' '); \n int n = int.Parse(Console.ReadLine());\n int find = n - 10 , ans = 0 ;\n if (find != 10)\n ans = 4;\n else\n ans = 15;\n if (find == 0)\n ans = 0;\n Console.WriteLine(ans);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n //int k = int.Parse(Console.ReadLine());\n //string[] tmp = Console.ReadLine().Split(' '); \n int n = int.Parse(Console.ReadLine());\n int find = n - 10 , ans = 0 ;\n if (find != 10)\n ans = 4;\n else\n ans = 15;\n if (find == 0 || find > 11)\n ans = 0;\n Console.WriteLine(ans);\n \n }\n }\n}"}], "src_uid": "5802f52caff6015f21b80872274ab16c"} {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.In.ReadLine().Split(new char[] { '\\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] rgs = { int.Parse(input[0]), int.Parse(input[1]), int.Parse(input[2]) };\n if(rgs[0]>rgs[1]) { int temp = rgs[0]; rgs[0] = rgs[1]; rgs[1] = temp; }\n rgs[1] -= rgs[0];\n Console.WriteLine(rgs[1]>rgs[2]?(rgs[0]+rgs[2])*2:(rgs[1]+rgs[0]+(rgs[2]-rgs[1])/2)*2);\n }\n }", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int [] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = 0;\n\n a[2] -= Math.Abs(a[0] - a[1]);\n if (a[2] > 0)\n rez = (Math.Max(a[0], a[1]) + a[2] / 2) * 2;\n else\n rez =( Math.Max(a[0], a[1]) + a[2])*2;\n \n \n\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _950A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int l = int.Parse(tokens[0]);\n int r = int.Parse(tokens[1]);\n int a = int.Parse(tokens[2]);\n\n int pairs = Math.Abs(l - r) > a ? Math.Min(l, r) + a : (l + r + a) / 2;\n Console.WriteLine(2 * pairs);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var (l, r, a) = input.Read3Int();\n if (l > r)\n {\n var t = l;\n l = r;\n r = t;\n }\n if (l + a <= r)\n Write(2 * (l + a));\n else\n Write(2 * r + (a - r + l) / 2 * 2);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n\n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces2\n{\n class Program\n {\n //950A\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(new char[] { ' ' });\n var l = int.Parse(input[0]);\n var r = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n\n var result = 0;\n var diffrence = Math.Abs(r - l);\n var biggerTeam = Math.Max(r, l);\n if (diffrence < a)\n result = (biggerTeam + (a - diffrence) / 2 ) * 2;\n else\n result = (Math.Min(r, l) + a) * 2;\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n int min = Math.Min(a[0], a[1]);\n while (a[2]>0)\n {\n a[2]--;\n if (a[1] > a[0])\n a[0]++;\n else\n {\n a[1]++;\n }\n }\n WriteLine(Math.Min(a[0],a[1])*2);\n\n }\n}"}, {"source_code": "\ufeff// https://codeforces.com/problemset/problem/950/a\n\n// 34 CodeForces Buy A Shovel https://codeforces.com/problemset/problem/732/a\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algos_YakshTefla7\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), el => Convert.ToInt32(el));\n int output = MakeATeam(input[0], input[1], input[2]);\n\n Console.WriteLine(output);\n }\n\n static int MakeATeam(int l, int r, int a)\n {\n int x = Math.Min(l, r);\n int diff = Math.Abs(l - r);\n\n if (diff > a)\n return 2 * (x + a);\n\n //else\n\n return 2 * (x + diff + ((a - diff) / 2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] lra = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int min = Math.Min(lra[0], lra[1]);\n int max = Math.Max(lra[0], lra[1]);\n Console.WriteLine(2 * ((min + lra[2]) <= max ? min + lra[2] : max + ((min + lra[2]) - max) / 2));\n }\n }\n} \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[]y=Console.ReadLine().Split(' ');\n int a=int.Parse(y[0]);\n int b=int.Parse(y[1]);\n int c=int.Parse(y[2]);\n while(true)\n {\n if(c==0)\n break;\n if(a>b)\n {\n c--;\n b++;\n }\n else if(ab&&c>0)\n {\n if(a>b)\n {\n b++;\n c--;\n }\n\n }\n while(b > a && c > 0)\n {\n if (b > a)\n {\n a++;\n c--;\n }\n }\n if(a>b)\n {\n Console.Write(b*2);\n }\n if(b>a)\n {\n Console.Write(a*2);\n }\n if (a == b)\n if (c % 2 != 0)\n {\n Console.Write(a + b + c - 1);\n }\n else\n Console.Write(a + b + c);\n \n }\n }\n\n #region Reader Class\n internal class Reader\n {\n int s_index = 0;\n List s_tokens;\n\n public string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n public int NextInt()\n {\n String s = Next();\n\n return int.Parse(s);\n }\n\n public long NextLong()\n {\n String s = Next();\n\n return long.Parse(s);\n }\n\n public bool HasNext()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = null;\n s_index = 0;\n var nextLine = Console.ReadLine();\n if (nextLine != null)\n {\n s_tokens = nextLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n if (s_tokens.Count == 0)\n {\n continue;\n }\n }\n return false;\n }\n return false;\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplateClean\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n int l = arr[0];\n int r = arr[1];\n int a = arr[2];\n\n while (true)\n {\n if (a > 0)\n {\n if (l > r)\n {\n a--;\n r++;\n }\n else\n {\n a--;\n l++;\n }\n }\n else\n {\n if (l > r)\n {\n Console.WriteLine(r * 2);\n return;\n }\n else\n {\n Console.WriteLine(l * 2);\n return;\n }\n }\n\n }\n\n //Console.ReadKey();\n\n }\n\n\n }\n\n}\n\n\n\n"}, {"source_code": "using System.Linq;\nusing System;\n\nclass Solution\n{\n static void Main()\n {\n var lra = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var l = lra[0];\n var r = lra[1];\n var a = lra[2];\n if (l < r)\n {\n var tmpL = l;\n l += Math.Min(a, r - l);\n a -= Math.Min(a, r - tmpL);\n }\n else if (l > r)\n {\n var tmpR = r;\n r += Math.Min(a, l - r);\n a -= Math.Min(a, l - tmpR);\n }\n r += a / 2;\n l += a / 2;\n Console.WriteLine(2 * Math.Min(l, r));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Olympiad\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] split = Console.ReadLine().Split();\n int l = int.Parse(split[0]);\n int r = int.Parse(split[1]);\n int a = int.Parse(split[2]);\n int big = 0;\n int small = 0;\n if(l>=r)\n {\n big = l;\n small = r;\n }\n else\n {\n big = r;\n small = l;\n }\n int people=0;\n if(big>=small+a)\n {\n people += (small + a) * 2;\n }\n else\n {\n a -= (big - small);\n people += big * 2;\n people += (a / 2) * 2;\n }\n Console.WriteLine(people);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplateClean\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n int l = arr[0];\n int r = arr[1];\n int a = arr[2];\n int s;\n\n if (l + a <= r)\n {\n s = 2 * (l + a);\n }\n\n else if (r + a <= l)\n {\n s = 2 * (r + a);\n }\n\n else\n {\n s = l + r + a;\n s -= s & 1;\n }\n\n Console.WriteLine(s);\n\n //Console.ReadKey();\n\n }\n\n\n }\n\n}\n\n\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Left_handers__Right_handers_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int l = int.Parse(input.Split(' ')[0]);\n int r = int.Parse(input.Split(' ')[1]);\n int a = int.Parse(input.Split(' ')[2]);\n\n if (l < r)\n {\n int temp = r - l;\n if (temp > a)\n {\n l += a;\n temp = r - l;\n Console.WriteLine((l+r)-temp);\n }\n else\n {\n l += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n else if (l > r)\n {\n int temp = l - r;\n if (temp > a)\n {\n r += a;\n temp = l - r;\n Console.WriteLine((l + r) - temp);\n }\n else\n {\n r += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l + r);\n }\n }\n else\n {\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n }\n}\n"}, {"source_code": "//ReSharper disable All\nusing System;\n\nnamespace ConsoleApp1\n{\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] k = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int l = k[0], r = k[1], a = k[2];\n int help = 0;\n\n for (int i = 0; 0 <= a; i++)\n {\n if (a == 0)\n {\n break;\n }\n if (l > r)\n {\n a--;\n r++;\n }\n else if (l < r)\n {\n a--;\n l++;\n }\n else if (l == r)\n {\n a--;\n if (help != 1)\n {\n r++;\n help = 1;\n }\n else\n {\n l++;\n help = 0;\n }\n }\n }\n\n \n Console.WriteLine((r+l+a)-Math.Abs(r-l));\n }\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace Task_950A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] mess = Console.ReadLine().Split(new char [] {' '});\n int l = Convert.ToInt32(mess[0]);\n int r = Convert.ToInt32(mess[1]);\n int a = Convert.ToInt32(mess[2]);\n int diff;\n bool rthemost=false;\n if (r>l)\n {\n diff= r-l;\n rthemost=true;\n }\n else if (ra)\n answer=(less+a)*2;\n else if (diff '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LefthandersRighthanders_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int l = n[0];\n int r = n[1];\n int a = n[2];\n //int diff = Math.Abs(l - r);\n int people = 0;\n if (l >= r)\n {\n if (l >= r + a)\n people = 2 * (r + a);\n else\n {\n people += Math.Abs(l - r);\n a -= Math.Abs(l - r);\n people += l + r + 2 * (a / 2);\n }\n }\n else\n {\n if (r >= l + a)\n people = 2 * (l + a);\n else\n {\n people += Math.Abs(l - r);\n a -= Math.Abs(l - r);\n people += l + r + 2 * (a / 2);\n }\n\n }\n Console.WriteLine(people);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LefthandersRighthanders_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int l = n[0];\n int r = n[1];\n int a = n[2];\n int diff = Math.Abs(l - r);\n //int diff = Math.Abs(l - r);\n //int people = 0;\n //if (l >= r)\n //{\n // if (l >= r + a)\n // people = 2 * (r + a);\n // else\n // {\n // people += Math.Abs(l - r);\n // a -= Math.Abs(l - r);\n // people += l + r + 2 * (a / 2);\n // }\n //}\n //else\n //{\n // if (r >= l + a)\n // people = 2 * (l + a);\n // else\n // {\n // people += Math.Abs(l - r);\n // a -= Math.Abs(l - r);\n // people += l + r + 2 * (a / 2);\n // }\n\n //}//this is my solution \n //Console.WriteLine(people);\n if (diff >= a)\n {\n Console.WriteLine(Math.Min(l + a, r + a) * 2);\n }\n else\n {\n a -= diff;\n Console.WriteLine(diff + l + r + 2 * (a / 2));//here diff+l+r==Math.Max(l,r)\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l, r, a;\n var split = Console.ReadLine().Split();\n\n l = int.Parse(split[0]);\n r = int.Parse(split[1]);\n a = int.Parse(split[2]);\n\n int max = Math.Max(l, r);\n int min = Math.Min(l, r);\n\n int raz = max - min;\n\n if (raz >= a)\n Console.WriteLine((min + a) * 2);\n else if (raz < a)\n {\n var d = a - raz;\n d = d % 2 == 0 ? d : d - 1;\n Console.WriteLine(max * 2 + d);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace bowling\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int leftHand = int.Parse(tokens[0]);\n int rightHand = int.Parse(tokens[1]);\n int ambidexters = int.Parse(tokens[2]);\n\n Console.WriteLine(maxGroupCount(leftHand, rightHand, ambidexters));\n \n }\n\n\n\n public static int maxGroupCount(int leftHand, int rightHand, int ambidexters)\n {\n if (rightHand < leftHand)\n {\n int temp = rightHand;\n rightHand = leftHand;\n leftHand = temp;\n }\n\n if (leftHand == 0 && ambidexters == 0) return 0;\n else\n {\n int difference = rightHand - leftHand;\n if (difference == 0) return 2 * leftHand + 2 * (ambidexters / 2);\n else\n {\n if ((leftHand + ambidexters) <= rightHand) return 2 * (leftHand + ambidexters);\n else\n {\n leftHand += difference; ambidexters -= difference;\n return 2 * leftHand + 2 * (ambidexters / 2);\n }\n\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace bowling\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int leftHand = int.Parse(tokens[0]);\n int rightHand = int.Parse(tokens[1]);\n int ambidexters = int.Parse(tokens[2]);\n\n Console.WriteLine(maxGroupCount(leftHand, rightHand, ambidexters));\n //Console.ReadKey();\n }\n\n\n\n\n public static int maxGroupCount(int leftHand, int rightHand,int ambidexters) {\n \n \n if (rightHand < leftHand) {\n int temp = rightHand;\n rightHand = leftHand;\n leftHand = temp;\n }\n \n if (leftHand == 0 && ambidexters == 0) return 0;\n else {\n int difference = rightHand - leftHand;\n if (difference == 0) return 2 * leftHand + 2 * (ambidexters / 2);\n else {\n \n if ((leftHand + ambidexters) <= rightHand) return 2 * (leftHand + ambidexters);\n else {\n leftHand += difference; ambidexters -= difference;\n return 2 * leftHand + 2 * (ambidexters / 2);\n }\n \n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nclass P\n{\n static void Main()\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int diff = Math.Abs(a[0] - a[1]);\n int res = 0;\n if (a[2] < diff)\n {\n res = 2 * (Math.Min(a[0], a[1]) + a[2]);\n }\n else\n {\n res = (a.Sum() / 2) * 2;\n }\n Console.WriteLine(res);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var l = sr.NextInt32();\n var r = sr.NextInt32();\n var a = sr.NextInt32();\n var min = Math.Min(l, r);\n var max = Math.Max(l, r);\n if (max >= min + a) {\n sw.WriteLine((min + a)*2);\n }\n else {\n var o = min + a - max;\n sw.WriteLine((o/2 + max)*2);\n }\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] mas = Console.ReadLine().Split(' ');\n int[] a = new int[3];\n\n for (int i = 0; i < 3; i++)\n a[i] = Convert.ToInt32(mas[i]);\n\n while (a[2] > 0){\n if (a[0] <= a[1]){\n a[0]++;\n a[2]--;\n } else{\n a[1]++;\n a[2]--;\n }\n }\n int max = Math.Min(a[0], a[1])*2;\n Console.WriteLine(max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n { \n static void Main(string[] args)\n { \n string[] token = Console.ReadLine().Split();\n \n int l = int.Parse(token[0]);\n int r = int.Parse(token[1]);\n int a = int.Parse(token[2]);\n \n int lA = 0;\n \n int min = Math.Min(r,l);\n int max = Math.Max(r,l);\n \n int sL = max - min;\n min += Math.Min(sL,a);\n lA = a - sL;\n \n if(lA>1){\n lA = (lA%2==0)?lA/2:(lA-1)/2;\n min += lA;\n }\n min = min * 2;\n \n Console.WriteLine(min);\n \n \n } \n \n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n int l = arr[0];\n int r = arr[1];\n int a = arr[2];\n int s;\n\n if (l + a <= r)\n {\n s = 2 * (l + a);\n }\n\n else if (r + a <= l)\n {\n s = 2 * (r + a);\n }\n\n else\n {\n s = l + r + a;\n s -= s & 1;\n }\n\n Console.WriteLine(s);\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Math;\n\nnamespace ProblemA\n{\n\tpublic class Problem\n\t{\n\t\tint a;\n\t\tint r;\n\t\tint l;\n\n\t\tpublic int[] Read()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\tvar v = Read();\n\t\t\tl = v[0];\n\t\t\tr = v[1];\n\t\t\ta = v[2];\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar min = Min(l, r);\n\t\t\tvar max = Max(l, r);\n\t\t\tvar min2 = Min(a, max - min);\n\t\t\ta = Max(0, a - min2);\n\t\t\tConsole.WriteLine((min + min2 + a / 2) * 2);\n\t\t}\n\t}\n\n\tclass ProblemA\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n static void program(TextReader input)\n {\n // var n = int.Parse(input.ReadLine());\n var data = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var a = data[2];\n var i = 400;\n for (; i > 0; i-=2)\n {\n var left = i / 2;\n var right = left;\n left -= l;\n right -= r;\n var need = 0;\n need = Math.Max(0, left) + Math.Max(0, right);\n if(need <= a)\n {\n break;\n }\n }\n\n Console.WriteLine(i);\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"6\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 4 2\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"14\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"5 5 5\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"0\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"0 2 0\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n bool check = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n check = false;\n break;\n\n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (check)\n {\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(Math.Min(l, r) * 2);\n }\n else\n {\n Console.WriteLine(Math.Min(l,r)*2);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n\n Console.WriteLine(Math.Min(l, r) * 2);\n }\n else\n {\n int ans = Math.Min(l, r) * 2;\n\n Console.WriteLine(ans--);\n }\n }\n // Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Left_handers__Right_handers_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] inputs = Console.ReadLine().Split(' ');\n int left = Convert.ToInt32(inputs[0]);\n int right = Convert.ToInt32(inputs[1]);\n int ambi = Convert.ToInt32(inputs[2]);\n int difference = Math.Abs(left - right);\n\n if (difference > ambi)\n {\n // The difference is greater than can be covered by stacking all ambi on one side\n // Stack all ambi on lower side\n Console.WriteLine(Math.Min(left + ambi, right + ambi) * 2);\n }\n else if (difference <= ambi)\n {\n ambi -= difference;\n \n Console.WriteLine((Math.Max(left, right) + (ambi / 2)) * 2);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R469A.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R469A();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R469A : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var ints = this.ReadIntArray();\n var l = ints[0];\n var r = ints[1];\n var a = ints[2];\n\n var b = Math.Min(l, r);\n var over = Math.Max(l - b, r - b);\n if (a >= over)\n {\n b += over;\n a -= over;\n b += a / 2;\n }\n else\n {\n b += a;\n }\n\n yield return (b*2).ToString();\n }\n }\n\n internal class R469B : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n internal class R469C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n internal class R469D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] tokens = input.Split();\n int l = Convert.ToInt32(tokens[0]);\n int r = Convert.ToInt32(tokens[1]);\n int a = Convert.ToInt32(tokens[2]);\n int res = 0;\n if (l == r) {\n res = 2 * l + (a / 2) * 2;\n } else if (l < r) {\n if (a >= r-l) {\n res = 2 * r + ((a - (r - l)) / 2) * 2; \n } else {\n res = 2 * (l + a);\n }\n } else {\n if (a >= l - r) {\n res = 2 * l + ((a - (l - r)) / 2) * 2; \n } else {\n res = 2 * (r + a);\n }\n\n }\n Console.WriteLine(res);\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n string[] temp_d = Console.ReadLine().Split(' ');\n int l, r, a,max,min,res;\n l = int.Parse(temp_d[0]);\n r = int.Parse(temp_d[1]);\n a = int.Parse(temp_d[2]);\n if (l > r)\n {\n max = l; min = r;\n }\n else\n {\n max = r; min = l;\n }\n res = (max -(max-min))*2;\n max -= min;\n if (max > a)\n {\n res += (max -( max- a))*2;\n a = 0;\n }\n else if (max!=0)\n {\n res += (a-(a-max))*2;\n a -= max;\n }\n res += (a / 2)*2;\n Console.WriteLine(res);\n Console.ReadLine();\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int [] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = 0;\n if (a[1] == 0)\n rez = Math.Min(a[1], a[0]) * 2;\n else\n {\n a[2] -= Math.Abs(a[0] - a[1]);\n if (a[2] > 0)\n rez = (Math.Max(a[0], a[1]) + a[2] / 2) * 2;\n else\n rez =( Math.Max(a[0], a[1]) + a[2])*2;\n }\n \n\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "\ufeff// https://codeforces.com/problemset/problem/950/a\n\n// 34 CodeForces Buy A Shovel https://codeforces.com/problemset/problem/732/a\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algos_YakshTefla7\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), el => Convert.ToInt32(el));\n int output = MakeATeam(input[0], input[1], input[2]);\n\n Console.WriteLine(output);\n }\n\n static int MakeATeam(int l, int r, int a)\n {\n int x = Math.Min(l, r);\n int diff = Math.Abs(l - r);\n\n if (diff > a)\n return x + a;\n\n //else\n\n return x + diff + ((a - diff) / 2);\n }\n }\n}"}, {"source_code": "using System.Linq;\nusing System;\n\nclass Solution\n{\n static void Main()\n {\n var lra = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var l = lra[0];\n var r = lra[1];\n var a = lra[2];\n if (l < r)\n {\n l += Math.Min(a, r - l);\n a -= Math.Min(a, r - l);\n }\n else if (l > r)\n {\n r += Math.Min(a, l - r);\n a -= Math.Min(a, l - r);\n }\n r += a / 2;\n l += a / 2;\n Console.WriteLine(2 * Math.Min(l, r));\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Left_handers__Right_handers_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int l = int.Parse(input.Split(' ')[0]);\n int r = int.Parse(input.Split(' ')[1]);\n int a = int.Parse(input.Split(' ')[2]);\n\n if (l < r)\n {\n int temp = r - 1;\n if (temp > a)\n {\n l += a;\n temp = r - l;\n Console.WriteLine((l+r)-temp);\n }\n else\n {\n l += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n else if (l > r)\n {\n int temp = l - r;\n if (temp > a)\n {\n r += a;\n temp = l - r;\n Console.WriteLine((l + r) - temp);\n }\n else\n {\n r += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l + r);\n }\n }\n else\n {\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Left_handers__Right_handers_and_Ambidexters\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int l = int.Parse(input.Split(' ')[0]);\n int r = int.Parse(input.Split(' ')[1]);\n int a = int.Parse(input.Split(' ')[2]);\n\n if (l < r)\n {\n int temp = r - 1;\n if (temp > a)\n {\n l += a;\n temp = r - l;\n Console.WriteLine((l+r)-temp);\n }\n else\n {\n l += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n else if (l > r)\n {\n int temp = l - 1;\n if (temp > a)\n {\n r += a;\n temp = l - r;\n Console.WriteLine((l + r) - temp);\n }\n else\n {\n r += temp;\n a -= temp;\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l + r);\n }\n }\n else\n {\n l += a / 2;\n r += a / 2;\n Console.WriteLine(l+r);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l, r, a;\n var split = Console.ReadLine().Split();\n\n l = int.Parse(split[0]);\n r = int.Parse(split[1]);\n a = int.Parse(split[2]);\n\n int max = Math.Max(l, r);\n int min = Math.Min(l, r);\n\n int raz = max - min;\n\n if (raz >= a)\n Console.WriteLine((min + a) * 2);\n else if (raz < a)\n {\n a = a % 2 == 0 ? a : a - 1;\n Console.WriteLine(max * 2 + a - raz);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l, r, a;\n var split = Console.ReadLine().Split();\n l = int.Parse(split[0]);\n r = int.Parse(split[1]);\n a = int.Parse(split[2]);\n int sum;\n\n sum = l + r + a;\n\n if (sum < 3)\n Console.WriteLine(0);\n if (sum >= 3)\n Console.WriteLine(sum - 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace bowling\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int leftHand = int.Parse(tokens[0]);\n int rightHand = int.Parse(tokens[1]);\n int ambidexters = int.Parse(tokens[2]);\n\n Console.WriteLine(maxGroupCount(leftHand, rightHand, ambidexters));\n //Console.ReadKey();\n }\n\n\n\n\n public static int maxGroupCount(int leftHand, int rightHand,int ambidexters) {\n \n // leftHand += ambidexters;\n if (rightHand < leftHand) {\n int temp = rightHand;\n rightHand = leftHand;\n leftHand = temp;\n }\n \n if (leftHand == 0) return 0;\n else {\n int difference = rightHand - leftHand;\n if (difference == 0) return 2 * leftHand + 2 * (ambidexters / 2);\n else {\n \n if ((leftHand + ambidexters) <= rightHand) return 2 * (leftHand + ambidexters);\n else {\n leftHand += difference; ambidexters -= difference;\n return 2 * leftHand + 2 * (ambidexters / 2);\n }\n \n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace bowling\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int leftHand = int.Parse(tokens[0]);\n int rightHand = int.Parse(tokens[1]);\n int ambidexters = int.Parse(tokens[2]);\n\n Console.WriteLine(maxGroupCount(leftHand, rightHand, ambidexters));\n \n }\n\n\n\n\n public static int maxGroupCount(int leftHand, int rightHand,int ambidexters) {\n \n leftHand += ambidexters;\n if (rightHand < leftHand) {\n int temp = rightHand;\n rightHand = leftHand;\n leftHand = temp;\n }\n \n if (leftHand == 0) return 0;\n else {\n int difference = rightHand - leftHand;\n if (difference == 0) return rightHand + leftHand;\n else {\n rightHand -= difference;\n return rightHand + leftHand + 2 * (difference / 2);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n bool check = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n check = false;\n break;\n\n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (check)\n {\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(0);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n }\n //Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n bool check = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n check = false;\n break;\n\n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (check)\n {\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Math.Min(l,r)*2);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n\n Console.WriteLine(Math.Min(l, r) * 2);\n }\n else\n {\n int ans = Math.Min(l, r) * 2;\n\n Console.WriteLine(ans--);\n }\n }\n //Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n bool check = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n check = false;\n break;\n\n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (check)\n {\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(l-r);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n\n Console.WriteLine(Math.Min(l, r) * 2);\n }\n else\n {\n int ans = Math.Min(l, r) * 2;\n\n Console.WriteLine(ans--);\n }\n }\n // Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n break;\n \n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(0);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n }\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n int both = arr[2];\n\n bool flag = true;\n bool check = true;\n while (both > 0)\n {\n flag = false;\n if (l == r && both == 1)\n {\n if ((l + r) % 2 == 0)\n {\n Console.WriteLine(l + r);\n }\n else\n {\n Console.WriteLine((l + r) - 1);\n }\n check = false;\n break;\n\n }\n else\n {\n if (l == r && both > 0)\n {\n l++;\n both--;\n }\n else if (l > r && both > 0)\n {\n r++;\n both--;\n }\n else if (r > l && both > 0)\n {\n l++;\n both--;\n }\n }\n }\n if (check)\n {\n if (flag)\n {\n if (l != r)\n {\n Console.WriteLine(0);\n }\n }\n else\n {\n if ((l + r) % 2 == 0)\n {\n\n Console.WriteLine(Math.Min(l, r) * 2);\n }\n else\n {\n int ans = Math.Min(l, r) * 2;\n\n Console.WriteLine(ans--);\n }\n }\n //Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "//ReSharper disable All\nusing System;\n\nnamespace ConsoleApp1\n{\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] k = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int l = k[0], r = k[1], a = k[2];\n int res = 0;\n\n for (int i = 0; i <= a; i++)\n {\n if (a == 0)\n {\n break;\n }\n if (l > r)\n {\n a--;\n r++;\n }\n else if (l < r)\n {\n a--;\n l++;\n }\n else if (l == r)\n {\n a--;\n if (i % 2 == 0)\n {\n r++;\n }\n else\n {\n l++;\n }\n }\n }\n\n \n Console.WriteLine((r+l+a)-Math.Abs(r-l));\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n static void program(TextReader input)\n {\n // var n = int.Parse(input.ReadLine());\n var data = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var a = data[2];\n var i = 200;\n for (; i > 0; i-=2)\n {\n var left = i / 2;\n var right = left;\n left -= l;\n right -= r;\n var need = 0;\n need = Math.Max(0, left) + Math.Max(0, right);\n if(need <= a)\n {\n break;\n }\n }\n\n Console.WriteLine(i);\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"6\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 4 2\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"14\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"5 5 5\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"0\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"0 2 0\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n string[] temp_d = Console.ReadLine().Split(' ');\n int l, r, a,max,min,res;\n l = int.Parse(temp_d[0]);\n r = int.Parse(temp_d[1]);\n a = int.Parse(temp_d[2]);\n if (l > r)\n {\n max = l; min = r;\n }\n else\n {\n max = r; min = l;\n }\n res = (max -(max-min))*2;\n max -= min;\n if (max > a)\n {\n res += (max -( max- a))*2;\n a = 0;\n }\n else if (max!=0)\n {\n res += ((a-max) - max)*2;\n a -= max;\n }\n res += (a / 2)*2;\n Console.WriteLine(res);\n Console.ReadLine();\n }\n}"}], "src_uid": "e8148140e61baffd0878376ac5f3857c"} {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Server\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n var temp = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int m = temp[0];\n int amountDays;\n if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n amountDays = 31;\n else if (m == 2)\n amountDays = 28;\n else \n amountDays = 30;\n \n Console.WriteLine(Math.Ceiling((double)(amountDays + temp[1] - 1) / 7));\n \n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A {\n\tclass Program {\n\t\tstatic void Main() {\n\t\t\tint[] arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\tint m = arr[0];\n\t\t\tint d = arr[1];\n\t\t\tint[] m31 = {1,3,5,7,8,10,12};\n\t\t\tint[] m30 = {4,6,9,11};\n\t\t\tint spaces = d - 1;\n\t\t\tint ret = 0;\n\t\t\t\n\t\t\tif (m31.Contains(m)) {\n\t\t\t\tspaces += 31;\n\t\t\t}\n\t\t\telse if (m30.Contains(m)) {\n\t\t\t\tspaces += 30;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tspaces += 28;\n\t\t\t}\n\t\t\t\n\t\t\tif (spaces % 7 == 0) ret = spaces / 7;\n\t\t\telse ret = spaces / 7 + 1;\n\t\t\t\n\t\t\tConsole.WriteLine(ret);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = NextInt(), d = NextInt();\n Dictionary months = new Dictionary();\n months[1] = 31;\n months[2] = 28;\n months[3] = 31;\n months[4] = 30;\n months[5] = 31;\n months[6] = 30;\n months[7] = 31;\n months[8] = 31;\n months[9] = 30;\n months[10] = 31;\n months[11] = 30;\n months[12] = 31;\n double x = Math.Ceiling(((double)months[m] + d - 1) / 7);\n Console.Write(x);\n //Console.ReadLine();\n }\n static int s_index = 0;\n static List s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar m = cin.NextInt();\n\t\t\tvar d = cin.NextInt();\n\t\t\tvar days = DateTime.DaysInMonth(2017, m);\n\t\t\tvar first = 7 - d + 1;\n\t\t\tvar left = days - first;\n\t\t\tvar count = left/7;\n\t\t\tif (left%7 > 0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tConsole.WriteLine(count + 1);\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int m = input.NextInt();\n int d = input.NextInt();\n int c = new[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }[m - 1];\n Console.Write((c + d - 2) / 7 + 1);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var m = arr[0];\n var d = arr[1];\n\n int days;\n\n if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n days = 31;\n else\n days = 30;\n\n if (m == 2)\n days = 28;\n\n \n\n\n var cols = days - (8 - d);\n int res = 0;\n\n if (cols % 7 == 0)\n {\n res = cols / 7 + 1;\n }\n else\n {\n res = cols / 7 + 2;\n }\n\n Console.Write(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static int Number(int dataWeek, int dataMonth)\n {\n int res = 0;\n if ((dataMonth % 2 != 0 && dataMonth <= 7) || (dataMonth % 2 == 0 && dataMonth >= 8))\n {\n if(dataWeek <= 5)\n {\n res = 5;\n }\n else\n {\n res = 6;\n }\n }\n else if(dataMonth == 2)\n {\n if(dataWeek == 1)\n {\n res = 4;\n }\n else\n {\n res = 5;\n }\n }\n else\n {\n if(dataWeek <= 6)\n {\n res = 5;\n }\n else\n {\n res = 6;\n }\n }\n return res;\n } \n private static void Main(string[] args)\n {\n int[] data = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int dataMonth = data[0];\n int dataWeek = data[1];\n\n int result = Number(dataWeek, dataMonth);\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] num = Console.ReadLine().Split(' ');\n int m = int.Parse(num[0]);\n int d = int.Parse(num[1]);\n if (m==4 || m==6 || m==9 || m==11)\n {\n if(d == 7)\n {\n Console.WriteLine(\"6\");\n }\n else\n Console.WriteLine(\"5\");\n }\n else if(m==2)\n {\n if(d==1) Console.WriteLine(\"4\");\n else\n Console.WriteLine(\"5\");\n }\n else\n {\n if (d==6 || d==7)\n {\n Console.WriteLine(\"6\");\n }\n else\n Console.WriteLine(\"5\");\n }\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int m, d;\n\n public void Solve()\n {\n m = ioHelper.ReadNextInt();\n d = ioHelper.ReadNextInt();\n\n int noDays = 30;\n\n if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n noDays = 31;\n\n if (m == 2)\n noDays = 28;\n\n int result = 1;\n\n for (int curDay = d; curDay <= 7; curDay++)\n noDays--;\n\n result += noDays / 7;\n\n if ((noDays % 7) > 0)\n result++;\n\n ioHelper.WriteLine(result.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Petr_and_a_calendar\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int m = Next();\n int d = Next();\n\n int days = DateTime.DaysInMonth(2017, m);\n days -= 8 - d;\n int count = 1 + (days+6)/7;\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] months = new[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n string[] input = Console.ReadLine().Split(' ');\n int m = int.Parse(input[0]) - 1, d = int.Parse(input[1]);\n int result = 1;\n for (int i = 1, j = d; i <= months[m]; i++, j++)\n if (j > 7)\n {\n result++;\n j = 1;\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces17\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\t\t\tint m = data[0];\n\t\t\tint d = data[1];\n\t\t\tint days = 0;\n\t\t\tswitch (m)\n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\tcase 3:\n\t\t\t\tcase 5:\n\t\t\t\tcase 7:\n\t\t\t\tcase 8:\n\t\t\t\tcase 10:\n\t\t\t\tcase 12:\n\t\t\t\t\tdays = 31 + d - 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2: days = 28 + d - 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\tcase 6:\n\t\t\t\tcase 9:\n\t\t\t\tcase 11:\n\t\t\t\t\tdays = 30 + d - 1;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tConsole.WriteLine(days / 7 + (days % 7 > 0 ? 1 : 0));\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace Number760A {\n class Program {\n static void Main(string[] args) {\n var mas = Console.ReadLine().Split(' ');\n Int32 numberMonth = Int32.Parse(mas[0]);\n Int32 numberWeekDays = Int32.Parse(mas[1]);\n Int32 days = GetCountDays(numberMonth) - 8 + numberWeekDays;\n Int32 mod = days % 7 == 0 ? 0 : 1;\n Console.WriteLine((Int32)(days / 7.0) + mod + 1);\n }\n\n static Int32 GetCountDays(Int32 m) {\n if(m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n return 31;\n if(m == 4 || m == 6 || m == 9 || m == 11)\n return 30;\n return 28;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n\n object Solve()\n {\n var m = ReadLong();\n var d = ReadLong();\n if (m == 2)\n return d == 1 ? 4 : 5;\n \n var ms = new long[] { 1, 3, 5, 7, 8, 10, 12 };\n if (ms.Contains(m))\n return d == 6 || d == 7 ? 6 : 5;\n return d == 7 ? 6 : 5; \n\n }\n //object Solve()\n //{\n // checked\n // {\n // var n = ReadLong();\n // var s = Read().Select(x => long.Parse(x.ToString())).ToArray();\n // var dp = new Tuple[60];\n // dp[0] = Tuple.Create(0, s[0]);\n // for (int i = 1; i < s.Length; i++)\n // {\n // if (s[i] == 1 && s[i - 1] < 6)\n // {\n // var r = i == 1 ? -1 : dp[i - 2].Item1;\n // var prevRes = i == 1 ? 0 : dp[i - 2].Item2;\n // dp[i] = Tuple.Create(r + 1, FastPow(16, r + 1) * (10 + s[i - 1]) + prevRes);\n // }\n // else\n // {\n // var r = dp[i - 1].Item1;\n // var prevRes = dp[i - 1].Item2;\n // dp[i] = Tuple.Create(r + 1, FastPow(16, r + 1) * s[i] + prevRes);\n // }\n // }\n // return dp[s.Length - 1].Item2;\n // }\n //}\n //Tuple Check(long bas, int[] s, int i)\n //{\n // var strB = bas.ToString().Select(x => int.Parse(x.ToString())).ToArray();\n // if (i < strB.Length - 1)\n // return Tuple.Create(-1, 0L);\n // for (int j = 0; j < strB.Length; j++)\n // {\n // if (strB[j] < s[i - j])\n // {\n // for (int i = 0; i < strB.Le; i++)\n // {\n\n // }\n\n // }\n // }\n //}\n\n long FastPow(long b, long pow)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow(b * b, pow / 2);\n return b * FastPow(b, pow - 1);\n }\n\n bool IsPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n }\n\n class DSU\n {\n private int[] arr;\n private Random r = new Random();\n public DSU(int n)\n {\n arr = new int[n];\n for (int i = 0; i < n; i++)\n {\n arr[i] = i;\n }\n }\n\n public int Find(int x)\n {\n if (arr[arr[x]] == arr[x])\n return arr[x];\n var y = Find(arr[x]);\n arr[x] = y;\n return y;\n }\n\n public void Union(int x, int y)\n {\n var p1 = Find(x);\n var p2 = Find(y);\n if (p1 == p2)\n return;\n if (r.NextDouble() < 0.5)\n arr[p1] = p2;\n else\n arr[p2] = p1;\n }\n\n public int[][] Enumerate()\n {\n return arr.Select((x, i) => new { g = Find(x), i }).GroupBy(x => x.g, (k, e) => e.Select(y => y.i).ToArray()).ToArray();\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\n\ufeff\ufeffusing System.IO;\n\ufeff\ufeffusing System.Linq;\nusing System.Threading;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar m = input[0];\n\t\t\tvar d = input[1];\n\t\t\tvar daysInMonth = new int[] { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\t\t\tvar totalDays = daysInMonth[m];\n\t\t\tvar cols = 1;\n\t\t\tvar dayOfWeek = d;\n\t\t\twhile (totalDays > 0) {\n\t\t\t\tif (dayOfWeek > 7) {\n\t\t\t\t\tdayOfWeek = 1;\n\t\t\t\t\tcols++;\n\t\t\t\t}\n\t\t\t\tdayOfWeek++;\n\t\t\t\ttotalDays--;\n\t\t\t}\n\n\t\t\tsw.WriteLine(cols);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Chloe_and_the_Sequence\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m, d;\n string[] input = Console.ReadLine().Split(' ');\n m = int.Parse(input[0]);\n switch(m)\n {\n case 1:\n m = 31;\n break;\n case 2:\n m = 28;\n break;\n case 3:\n m = 31;\n break;\n case 4:\n m = 30;\n break;\n case 5:\n m = 31;\n break;\n case 6:\n m = 30;\n break;\n case 7:\n m = 31;\n break;\n case 8:\n m = 31;\n break;\n case 9:\n m = 30;\n break;\n case 10:\n m = 31;\n break;\n case 11:\n m = 30;\n break;\n case 12:\n m = 31;\n break;\n }\n d = int.Parse(input[1]);\n if ((m + (d - 1)) % 7 == 0)\n Console.WriteLine((m + (d - 1)) / 7);\n else\n Console.WriteLine((m + (d - 1)) / 7 + 1);\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf001\n{\n static void Main()\n {\n string input = Console.ReadLine();\n int month = int.Parse(input.Split()[0]);\n int weekday = int.Parse(input.Split()[1]);\n int result;\n List months = new List() { 1, 3, 5, 7, 8, 10, 12 };\n\n if (month == 2 && weekday == 1)\n {\n result = 4;\n }\n else if (month == 2)\n {\n result = 5;\n }\n else if ((months.Contains(month)&& weekday > 5) ||(weekday>6))\n {\n result = 6;\n }else\n {\n result = 5;\n }\n\n Console.WriteLine(result);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task1\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n\n var month = input[0];\n var firstDayInMoth = input[1];\n\n var daysInMonth = DateTime.DaysInMonth(2001, month);\n var daysInFirstWeek = 7 - firstDayInMoth + 1;\n\n var weeks = (daysInMonth - daysInFirstWeek) / 7;\n\n var rest = daysInMonth - weeks * 7;\n\n if (rest == daysInFirstWeek) weeks += 1;\n else weeks += 2;\n\n Console.WriteLine(weeks);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] menesiuIlgumai = new int[13] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n string[] duomenys = Console.ReadLine().Split(' ');\n int m = int.Parse(duomenys[0]);\n int d = int.Parse(duomenys[1]);\n int columns = 1;\n int menesioIlgumas = menesiuIlgumai[m];\n menesioIlgumas -= (8 - d);\n columns += menesioIlgumas % 7 == 0 ? menesioIlgumas / 7 : (menesioIlgumas / 7) + 1;\n Console.WriteLine(columns);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace tmp6\n{\n class Program\n {\n static void Main()\n {\n int m = 0, columns = 0;\n string[] s = Console.ReadLine().Split(' ');\n m = int.Parse(s[0]);\n columns += int.Parse(s[1]) - 1;\n columns += System.DateTime.DaysInMonth(2017, m);\n if(columns % 7 == 0)\n columns /= 7;\n else\n {\n columns /= 7;\n columns++;\n }\n Console.WriteLine(columns);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Petr_and_a_calendar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int January = 31;\n int February = 28;\n int March = 31;\n int April = 30;\n int May = 31;\n int June = 30;\n int July = 31;\n int August = 31;\n int September = 30;\n int October = 31;\n int November = 30;\n int December = 31;\n\n string[] text = Console.ReadLine().Split(' ');\n int m = int.Parse(text[0]);\n int d = int.Parse(text[1]);\n int month=0;\n switch (m)\n {\n case 1:\n month = January;\n break;\n case 2:\n month = February;\n break;\n case 3:\n month = March;\n break;\n case 4:\n month = April;\n break;\n case 5:\n month = May;\n break;\n case 6:\n month = June;\n break;\n case 7:\n month = July;\n break;\n case 8:\n month = August;\n break;\n case 9:\n month = September;\n break;\n case 10:\n month = October;\n break;\n case 11:\n month = November;\n break;\n case 12:\n month = December;\n break;\n }\n \n int columns = 1;\n int days = month-(7-(d-1));\n while(days>0)\n {\n days = days - 7;\n columns = columns + 1;\n\n }\n Console.WriteLine(columns);\n \n \n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n\n private void Go()\n {\n int m = GetInt();\n int d = GetInt();\n\n int days = 0;\n switch (m)\n {\n case 1:\n case 3:\n case 5:\n case 7:\n case 8:\n case 10:\n case 12:\n days = 31; break;\n case 2:\n days = 28; break;\n default:\n days = 30; break;\n }\n\n if (d == 1)\n {\n Wl((days + 6) / 7);\n return;\n }\n\n int ans = 1;\n days -= (7 - d + 1);\n ans += (days + 6) / 7;\n\n Wl(ans);\n }\n\n #region Template\n\n private static StringBuilder output = new StringBuilder();\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n output.Length = 0;\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n Console.Write(output);\n timer.Stop();\n Console.Error.WriteLine(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n do\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n } while (string.IsNullOrEmpty(ioEnum.Current));\n\n return ioEnum.Current;\n }\n\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n W(o);\n output.Append(Console.Out.NewLine);\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n W(enumerable);\n output.Append(Console.Out.NewLine);\n }\n\n private static void W(T o)\n {\n if (o is double)\n {\n Wd((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wd((o as float?).Value, \"\");\n }\n else\n output.Append(o.ToString());\n }\n\n private static void W(IEnumerable enumerable)\n {\n W(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wd(double d, string format)\n {\n W(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace mo\n{\n class Program\n {\n static Dictionary visited = new Dictionary();\n public static bool Bfs(Dictionary> graph, int from)\n {\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n int front = queue.Peek();\n\n\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n\n private static bool IsPrime(int num)\n {\n if (num <= 1)\n {\n return false;\n }\n\n double num_sqrt = Math.Sqrt(num);\n int num_fl = Convert.ToInt32(Math.Floor(num_sqrt));\n\n for (int i = 2; i <= num_fl; i++)\n {\n if (num % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n\n public class helper\n {\n public int order;\n public char character;\n }\n\n\n static void Main(string[] args)\n {\n\n var node = GetIntegerInputsFromLine();\n\n var month = node[0];\n var dayofweek = node[1];\n\n var result = dayofweek - 1;\n\n var day = days(month)+ result;\n\n var results = Math.Ceiling((double)day / 7);\n\n Console.WriteLine(results);\n\n }\n\n public static int days(int m)\n {\n if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n {\n return 31;\n }\n if (m == 2)\n {\n return 28;\n }\n return 30;\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] days = {31,28,31,30,31,30,31,31,30,31,30,31};\n int[] k = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine((days[k[0]-1]-(8-k[1]))/7+((days[k[0] - 1] - (8 - k[1]))%7==0?0:1)+1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int GetAns(int x, int pow)\n\t\t{\n\t\t\tif (pow == 0)\n\t\t\t\treturn 1;\n\t\t\tif (pow % 2 == 1)\n\t\t\t\treturn (GetAns(x, pow - 1) * 8) % 10;\n\t\t\tvar t = GetAns(x, pow / 2);\n\t\t\treturn (t * t) % 10;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");*/\n/*\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = ReadListOfInts();\n\t\t\tvar m = l[0];\n\t\t\tvar d = l[1];\n\t\t\tvar days = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\t\t\tvar ct = days[m - 1] + d - 1;\n\t\t\tConsole.WriteLine(ct / 7 + (ct % 7 != 0 ? 1 : 0));\n\t\t\tConsole.ReadLine();\n/*\t\tinput.Close();*/\n/*\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n if ( s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n else\n {\n Console.WriteLine(5);\n }\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static Func NextBuf = () => { return Console.ReadLine().Split(' '); };\n static T[] ConvertTo(string[] buf)\n {\n return (buf.Select(x => (T)Convert.ChangeType(x, typeof(T)))).ToArray();\n }\n static void Main(string[] args)\n {\n int[] key = new int[12] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n int[] buf = ConvertTo(NextBuf());\n int[,] tabl = new int[7, 6];\n for (int i = 1; i <= key[buf[0] - 1]; ++i)\n {\n tabl[(buf[1] - 2 + i) % 7, (buf[1] - 2 + i) / 7] = i;\n }\n int max = 0;\n for(int i = 0; i < 6; ++i)\n {\n for (int j = 0; j < 7; ++j)\n {\n if (tabl[j, i] != 0)\n {\n ++max;\n break;\n }\n }\n }\n Console.WriteLine(max);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n private static int[] days = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n static void Main(string[] args)\n {\n int m = RI();\n int d = RI();\n\n int offset = d - 1;\n\n int dd = days[m - 1] + offset;\n\n int count = (dd + 6) / 7;\n Console.WriteLine(count);\n\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] month30 = { 4, 6, 9, 11 };\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int days;\n if (a[0] == 2)\n {\n days = 28;\n }\n else if (month30.Contains(a[0]))\n {\n days = 30;\n }\n else\n {\n days = 31;\n }\n days -= 8 - a[1];\n int c = days / 7;\n int rez = days - c * 7 > 0 ? 1 : 0;\n Console.WriteLine((c + 1 + rez));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] md = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] m = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n int weeks = 1;\n int days = m[md[0] - 1] - (8 - md[1]);\n weeks += days / 7 + (days % 7 > 0 ? 1 : 0);\n Console.WriteLine(weeks);\n }\n }\n}"}, {"source_code": "using System;\n\nclass A\n{\n public static void Main()\n {\n int[] mouth = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\n int total = 1;\n\n string line = Console.ReadLine();\n \n int m = int.Parse(line.Split(' ')[0]), \n d = int.Parse(line.Split(' ')[1]);\n \n d = mouth[m] - (8-d);\n\n //Console.WriteLine(\"{0} {1}\", d, (decimal)d/7);\n total += (int)Math.Ceiling((decimal)d / 7);\n \n Console.WriteLine(total);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Numerics;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int M, D;\n sc.Make(out M, out D);\n var d = new[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n WriteLine((d[M - 1]-(8-D)+6) / 7+1);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _760\n {\n public static void Main()\n {\n int[] monthLength = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n var tokens = Console.ReadLine().Split();\n\n int m = int.Parse(tokens[0]) - 1;\n int d = int.Parse(tokens[1]) - 1;\n\n Console.WriteLine((monthLength[m] + d) / 7 + Math.Sign((monthLength[m] + d) % 7));\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Program\n{\n public static void Main(string[] args)\n {\n int[] months = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n if (months.Length != 12) {\n Console.WriteLine(\"Months not correct\");\n return;\n }\n string[] input = Console.ReadLine().Split(' ');\n int m = int.Parse(input[0]);\n int d = int.Parse(input[1]);\n int[, ] c = new int[7, 10];\n int x = d - 2;\n for (int i = 1; i <= months[m - 1]; i++)\n {\n x++;\n c[x % 7, x / 7] = i;\n }\n Console.WriteLine(x / 7 + 1);\n }\n}\n"}, {"source_code": "using System;\n\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n int days = DateTime.DaysInMonth(2021, a[0]);\n int weeks = days > 28 ? 5 : 4;\n if (a[1] > 1 && a[0] == 2) weeks++;\n else if (a[1] > 5 && days > 30) weeks++;\n else if (a[1] > 6) weeks++;\n WriteLine(weeks);\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mouth = new int[] { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n int total = 1;\n\n string line = Console.ReadLine();\n\n int m = int.Parse(line.Split(' ')[0]),\n d = int.Parse(line.Split(' ')[1]);\n\n d = mouth[m] - (8 - d);\n\n //Console.WriteLine(\"{0} {1}\", d, (decimal)d/7);\n total += (int)Math.Ceiling((decimal)d / 7);\n\n Console.WriteLine(total);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gabriel_and_Worm\n{\n class Program\n {\n string RowNum = \"\";\n string ColNum = \"\";\n static void Main(string[] args)\n {\n\n string[] token = Console.ReadLine().Split();\n int m = int.Parse(token[0]);\n int d = int.Parse(token[1]);\n int[] months = new int[12]{31,28,31,30,31,30,31,31,30,31,30,31};\n int ans = 1;\n int day = d;\n ans = ((d-1)+months[m-1]-1)/7+1;\n \n Console.WriteLine(ans);\n \n }\n \n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tint m = inputs1[0];\n\t\t\tint d = inputs1[1];\n\n\t\t\tif (m == 2) \n\t\t\t{\n\t\t\t\tif (d == 1) \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(4);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (d < 6) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(6);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tif (d == 7)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(6);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}], "negative_code": [{"source_code": "using System;\n\nclass A\n{\n public static void Main()\n {\n int[] mouth = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\n int total = 0;\n\n string line = Console.ReadLine();\n \n int m = int.Parse(line.Split(' ')[0]), \n d = int.Parse(line.Split(' ')[1]);\n \n d = mouth[d] - (8-d);\n total = (int)Math.Ceiling((decimal)d / 7) + 1;\n \n Console.WriteLine(total);\n }\n}\n"}, {"source_code": "using System;\n\nclass A\n{\n public static void Main()\n {\n int[] mouth = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\n int total = 0;\n\n string line = Console.ReadLine();\n \n int m = int.Parse(line.Split(' ')[0]), \n d = int.Parse(line.Split(' ')[1]);\n \n d = mouth[d] - (7-d);\n total = Math.Abs(d / 7) + 1;\n \n Console.WriteLine(total);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var m = arr[0];\n var d = arr[1];\n\n int days;\n\n if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)\n days = 31;\n else\n days = 30;\n\n if (m == 2)\n days = 29;\n\n\n var cols = days - (8 - d);\n int res = 0;\n\n if (cols % 7 == 0)\n {\n res = cols / 7 + 1;\n }\n else\n {\n res = cols / 7 + 2;\n }\n\n Console.Write(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\n\ufeff\ufeffusing System.IO;\n\ufeff\ufeffusing System.Linq;\nusing System.Threading;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar m = input[0];\n\t\t\tvar d = input[1];\n\t\t\tvar totalDays = m % 2 == 1 ? 31 : 30;\n\t\t\tif (m == 2) {\n\t\t\t\ttotalDays = 28;\n\t\t\t}\n\t\t\tvar cols = 1;\n\t\t\tvar dayOfWeek = d;\n\t\t\twhile (totalDays > 0) {\n\t\t\t\tdayOfWeek++;\n\t\t\t\tif (dayOfWeek > 7) {\n\t\t\t\t\tdayOfWeek = 1;\n\t\t\t\t\tcols++;\n\t\t\t\t}\n\t\t\t\ttotalDays--;\n\t\t\t}\n\n\t\t\tsw.WriteLine(cols);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf001\n{\n static void Main()\n {\n string input = Console.ReadLine();\n int month = int.Parse(input.Split()[0]);\n int weekday = int.Parse(input.Split()[1]);\n int result;\n List months = new List() { 1, 3, 5, 7, 8, 10, 12 };\n\n if (month == 2 && weekday == 1)\n {\n result = 4;\n }\n else if ((months.Contains(month)&& weekday > 5) ||(weekday>6))\n {\n result = 6;\n }else\n {\n result = 5;\n }\n\n Console.WriteLine(result);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task1\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n\n var month = input[0];\n var firstDayInMoth = input[1];\n\n var daysInMonth = DateTime.DaysInMonth(2001, month);\n var daysInFirstWeek = 7 - firstDayInMoth + 1;\n\n var weeks = (daysInMonth - daysInFirstWeek) / 7;\n\n var rest = daysInMonth % 7;\n if (rest == daysInFirstWeek) weeks += 1;\n else weeks += 2;\n\n Console.WriteLine(weeks);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12 )\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else\n {\n Console.WriteLine(5);\n }\n \n }\n //29--->2\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n \n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n if (s[0] == 4 && s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12&&s[1]==6||s[1]==7)\n {\n Console.WriteLine(6);\n }\n //29--->2\n if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12&&s[1]==6||s[1]==7)\n {\n Console.WriteLine(6);\n \n }\n //29--->2\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n if (s[0] == s[1])\n {\n Console.WriteLine(5);\n }\n else if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n if (s[0] == 4 && s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n else\n {\n Console.WriteLine(5);\n }\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12 )\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else\n {\n Console.WriteLine(5);\n }\n \n }\n //29--->2\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] >= 1 && s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1||s[0]==3||s[0]==5||s[0]==7||s[0]==8||s[0]==10||s[0]==12||s[0]==2||s[0]==4||s[0]==6||s[0]==11||s[0]==9)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else\n {\n Console.WriteLine(5);\n }\n \n }\n //29--->2\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n \n //30\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n //31---->1,3,5,7,8,10,12\n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n else\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petr_calendar760A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] x = Console.ReadLine().Split(' ');\n\n int[] s = new int[2];\n\n for (int i = 0; i < 2; i++)\n {\n s[i] = int.Parse(x[i]);\n }\n\n \n \n if (s[0] == 1 || s[0] == 3 || s[0] == 5 || s[0] == 7 || s[0] == 8 || s[0] == 10 || s[0] == 12)\n {\n if (s[1] == 6 || s[1] == 7)\n {\n Console.WriteLine(6);\n }\n else if (s[1] == 1 || s[1] == 2 || s[1] == 3 || s[1] == 4 ||s[1]==5)\n {\n Console.WriteLine(5);\n\n }\n }\n else if (s[0] == 2 && s[1] == 1)\n {\n Console.WriteLine(4);\n }\n else if (s[0] == 2 && s[1] != 1)\n {\n Console.WriteLine(5);\n }\n \n\n else if(s[0] == 4 || s[0] == 6 || s[0] == 9|| s[0] == 11 )\n {\n if (s[0] == 4 || s[1] == 7)\n {\n Console.WriteLine(6);\n\n }\n else\n Console.WriteLine(5);\n\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n int days = DateTime.DaysInMonth(2021, a[0]);\n int weeks = days > 28 ? 5 : 4;\n weeks += 8-a[1] >= days - 28 ? 0 : 1;\n WriteLine(weeks);\n }\n\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] md = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] m = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n int days = m[md[0] - 1];\n int weeks = 0;\n int c = md[1];\n int cc = 1;\n while(days >= cc)\n {\n if (c == 7)\n {\n weeks++;\n c = 1;\n \n }\n\n cc++;\n c++;\n }\n\n Console.WriteLine(weeks);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] md = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int[] m = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n int days = m[md[0] - 1];\n int weeks = 0;\n int c = md[1];\n int cc = 1;\n while(days >= cc)\n {\n cc++;\n c++;\n if (c >= 7)\n {\n weeks++;\n c = 1;\n }\n }\n\n Console.WriteLine(weeks);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tint m = inputs1[0];\n\t\t\tint d = inputs1[1];\n\n\t\t\tif (m == 2) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(4);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (d < 6) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(6);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tif (d == 7)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(6);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tint m = inputs1[0];\n\t\t\tint d = inputs1[1];\n\n\t\t\tif (m == 2) \n\t\t\t{\n\t\t\t\tif (d == 1) \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(5);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(4);\n\t\t\t}\n\n\t\t\tif (d < 6) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(6);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tif (d == 7)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(6);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(5);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}], "src_uid": "5b969b6f564df6f71e23d4adfb2ded74"} {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c333_194_1\n{\n\tpublic class Program1\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\n\t\t\t\tvar n = long.Parse(Console.ReadLine());\n\t\t\t\tvar div = 1L;\n\t\t\t\twhile (n % div == 0) div *= 3;\n\n\t\t\t\tConsole.WriteLine((n + div - 1)/div);\n\t\t\t}\n\t\t}\n\n\t}\n}", "positive_code": [{"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var n = long.Parse(Console.ReadLine());\n while (n % 3 == 0) n /= 3;\n Console.WriteLine(n / 3 + 1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X) * (p.X - X) + (p.Y - Y) * (p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get { return m_Matrix.GetLength(0); }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get { return m_Matrix[i, j]; }\n\n set { m_Matrix[i, j] = value; }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n\n public static int[] Next(int[] p)\n {\n int n = p.Length;\n var next = new int[n];\n Array.Copy(p, next, n);\n\n int k = -1;\n for (int i = n - 1; i > 0; i--)\n {\n if (next[i - 1] < next[i])\n {\n k = i - 1;\n break;\n }\n }\n if (k == -1)\n {\n return null;\n }\n for (int i = n - 1; i >= 0; i--)\n {\n if (next[i] > next[k])\n {\n var tmp = next[i];\n next[i] = next[k];\n next[k] = tmp;\n break;\n }\n }\n for (int i = 1; i <= (n - k - 1) / 2; i++)\n {\n var tmp = next[k + i];\n next[k + i] = next[n - i];\n next[n - i] = tmp;\n }\n\n return next;\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n public static class OrderStatistic\n {\n public static T GetKthElement(this IList list, int k) where T : IComparable\n {\n return Select(list, 0, list.Count - 1, k);\n }\n\n private static T Select(IList list, int l, int r, int k) where T : IComparable\n {\n if (l == r)\n return list[l];\n\n T x = list[(l + r) / 2];\n var i = l;\n var j = r;\n do\n {\n while (list[i].CompareTo(x) < 0)\n i++;\n while (list[j].CompareTo(x) > 0)\n j--;\n if (i <= j)\n {\n T tmp = list[i];\n list[i] = list[j];\n list[j] = tmp;\n\n i++;\n j--;\n }\n }\n while (i <= j);\n\n if (j < l)\n j++;\n if (k <= j - l + 1)\n return Select(list, l, j, k);\n return Select(list, j + 1, r, k - (j - l + 1));\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get { return this.m_Edges[i]; }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n }\n\n public static class GraphAlgorithms\n {\n private static bool[] v;\n\n private static int[] a;\n\n private static int c;\n\n public static int[] Bfs(this IGraph graph, int start)\n {\n int[] d = new int[graph.Vertices];\n for (int i = 0; i < graph.Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in graph[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n\n public static int[] TopSort(this IGraph graph)\n {\n v = new bool[graph.Vertices];\n a = new int[graph.Vertices];\n c = graph.Vertices;\n\n for (int i = 0; i < graph.Vertices; i++)\n {\n if (!v[i])\n {\n TopSortDfs(graph, i);\n }\n }\n\n return a;\n }\n\n private static void TopSortDfs(IGraph graph, int t)\n {\n v[t] = true;\n foreach (var next in graph[t])\n {\n if (!v[next])\n {\n TopSortDfs(graph, next);\n }\n }\n c--;\n a[c] = t;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n private bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First)\n && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397)\n ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get { return this.ContainsKey(key) ? base[key] : 0; }\n set { this.Add(key, value); }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack\n where T : class\n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n\n public static void Swap(ref T x, ref T y)\n {\n T tmp = x;\n x = y;\n y = tmp;\n }\n }\n\n public static class FFTMultiply\n {\n public static int[] Multiply(int[] a, int[] b)\n {\n var result = Multiply(\n a.Select(x => new Complex(x, 0)).ToArray(), b.Select(x => new Complex(x, 0)).ToArray());\n return result.Select(x => (int)Math.Round(x.Real)).ToArray();\n }\n\n public static Complex[] Multiply(Complex[] a, Complex[] b)\n {\n var n = 1;\n while (n < Math.Max(a.Length, b.Length))\n {\n n <<= 1;\n }\n n <<= 1;\n\n var fa = new Complex[n];\n Array.Copy(a, fa, a.Length);\n var fb = new Complex[n];\n Array.Copy(b, fb, b.Length);\n\n FFT(fa, false);\n FFT(fb, false);\n\n for (int i = 0; i < n; i++)\n {\n fa[i] *= fb[i];\n }\n\n FFT(fa, true);\n for (int i = 0; i < n; i++)\n {\n fa[i] /= n;\n }\n return fa;\n }\n\n private static void FFT(IList a, bool invert)\n {\n var n = a.Count;\n if (n == 1)\n {\n return;\n }\n\n var a0 = new Complex[n / 2];\n var a1 = new Complex[n / 2];\n for (int i = 0; i < n / 2; i++)\n {\n a0[i] = a[2 * i];\n a1[i] = a[2 * i + 1];\n }\n FFT(a0, invert);\n FFT(a1, invert);\n\n Complex w = 1;\n var ang = 2 * Math.PI / n * (invert ? -1 : 1);\n Complex wn = new Complex(Math.Cos(ang), Math.Sin(ang));\n\n for (int i = 0; i < n / 2; i++)\n {\n a[i] = a0[i] + w * a1[i];\n a[i + n / 2] = a0[i] - w * a1[i];\n w *= wn;\n }\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n // OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n long n;\n Reader.Read(out n);\n while (n % 3 == 0)\n {\n n /= 3;\n }\n Console.WriteLine(n / 3 + 1);\n }\n }\n}\n"}, {"source_code": "\ufeff#define ONLINE_JUDGE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\n static int tests = 1;\n\n#if (ONLINE_JUDGE)\n static TextReader r = Console.In;\n static TextWriter w = Console.Out;\n#else\n static string path = @\"C:\\Y\\Prog\\Codeforces\\194\\\";\n static string answerFile = \"0{0}Answer.txt\";\n static string resultFile = \"0{0}Result.txt\";\n static string sourceFile = \"0{0}Source.txt\";\n \n static TextReader r;\n static TextWriter w;\n#endif\n\n static void Main(string[] args)\n {\n for (int i = 1; i <= tests; i++)\n {\n#if (!ONLINE_JUDGE)\n r = new StreamReader(string.Format(path + sourceFile, i));\n w = new StreamWriter(string.Format(path + resultFile, i), false);\n#endif\n \n solve(Convert.ToInt64(r.ReadLine()));\n \n#if (!ONLINE_JUDGE)\n w.Flush(); w.Close();\n Console.WriteLine(\"CASE: {0}\", i);\n string answer = File.ReadAllText(string.Format(path + answerFile, i));\n string result = File.ReadAllText(string.Format(path + resultFile, i));\n if (answer != result)\n {\n Console.WriteLine(\"FAIL:\");\n Console.WriteLine(\"Result\" + Environment.NewLine + result);\n Console.WriteLine(\"Answer\" + Environment.NewLine + answer);\n }\n else\n Console.WriteLine(\"OK\");\n#endif\n }\n }\n\n public static void solve(long x)\n {\n long cur = x;\n int idx = 0;\n int[] res = new int[1000];\n while (cur != 0)\n {\n long rest = cur % 3;\n cur = cur / 3;\n res[idx] = (int) rest;\n idx++; \n }\n\n //for (int i = 0; i < idx; i++) \n // Console.Write(res[i] + \" \"); \n \n int cnt = 0;\n for (int i = 0; i < idx; i++)\n if (res[i] != 0) \n cnt++;\n\n if (cnt == 1)\n {\n w.WriteLine(1);\n return;\n }\n int begin = 0;\n for (int i = 0; i < idx; i++)\n if (res[i] != 0)\n {\n begin = i;\n break;\n }\n long coins = 1;\n long power = 1;\n for (int i = begin + 1; i < idx; i++)\n {\n coins += res[i] * power;\n power *= 3;\n }\n w.WriteLine(coins); \n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceCondole\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = Convert.ToUInt64(Console.ReadLine()); //\u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 n - \u043c\u0430\u0440\u043e\u043a\n while (n % 3 == 0)\n n /= 3;\n Console.WriteLine(n / 3 + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n long n = long.Parse(Console.ReadLine());\n long div=3;\n while (n % div == 0)\n {\n div = div * 3;\n }\n Console.WriteLine(n / div + 1);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c333_194_1\n{\n\tpublic class Program1\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\n\t\t\t\tvar n = long.Parse(Console.ReadLine());\n\t\t\t\tvar div = 1L;\n\t\t\t\twhile (n % div == 0) div *= 3;\n\n\t\t\t\tConsole.WriteLine((n + div - 1)/div);\n\t\t\t}\n\t\t}\n\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R194_Div2_C\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n long pow3 = 3;\n while (n % pow3 == 0) \n pow3 *= 3;\n\n Console.WriteLine(n / pow3 + 1);\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n \n }\n\n static void C()\n {\n long n = ReadLong();\n for (long i = 3; ; i *= 3)\n {\n if (n % i != 0)\n {\n Console.WriteLine((n / i) + 1);\n return;\n }\n }\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c194p3\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Program();\n }\n Program()\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64 N = n;\n Int64 p = 3;\n while (n % 3 == 0)\n {\n n /= 3;\n p *= 3;\n }\n Int64 c = (N + p - 1) / p;\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"A4\";\n\n private static void Solve()\n {\n var n = ReadLong();\n var bytes = new List();\n while (n>=1)\n {\n var last = (int)(n%3);\n bytes.Add(last);\n n /= 3;\n }\n \n int first;\n for (first = 0; first < bytes.Count; first++)\n {\n if (bytes[first] != 0)\n break;\n }\n long res = 1;\n long pow = 1;\n for (int i = first + 1; i < bytes.Count; i++)\n {\n res += bytes[i]*pow;\n pow *= 3;\n }\n WriteLine(res);\n }\n\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static int[] SortIndexs(this IEnumerable source) where T : IComparable\n {\n var array = source == null ? new List() : source.ToList();\n var n = array.Count;\n var res = Enumerable.Range(0, n).ToArray();\n Array.Sort(res, (a, b) => array[a].CompareTo(array[b]));\n return res;\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5, out T a6)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n a6 = (T)Convert.ChangeType(input[5], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nclass Demo{\n static void Main(){\n long n = long.Parse(Console.ReadLine()), div = 3;\n while (n % div == 0)\n div = div * 3;\n Console.WriteLine(n / div + 1);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Secrets\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = long.Parse(reader.ReadLine());\n\n long count = 0;\n if (n == 1)\n count = 1;\n else\n {\n long m = 1;\n while (m < n)\n {\n m *= 3;\n }\n if (m == n)\n {\n count = 1;\n }\n else\n {\n m /= 3;\n long delta = n - m;\n if (delta%m == 0)\n count = 1;\n else\n {\n for (int i = 1; i <= 3; i++)\n {\n if (n < i*m)\n {\n break;\n }\n count = i;\n }\n while (m > 1)\n {\n m /= 3;\n if (delta%m != 0)\n {\n count *= 3;\n }\n else\n {\n break;\n }\n }\n m *= 3;\n\n long cnt = (n - m*count + m - 1)/m;\n count += cnt;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R194_Div2_C\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n long pow3 = 3;\n while (n % pow3 == 0) \n pow3 *= 3;\n\n long cnt = n / pow3 + 1;\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskA\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n long n = instream.ReadLong();\n\n if (n % 3 == 0)\n {\n long res = 1;\n long m3 = 1;\n for (long m = 1; m < 40; m++)\n {\n m3 *= 3;\n if (n % m3 == 0) continue;\n\n res = n / m3 + 1;\n break;\n }\n outstream.WriteLine(res);\n }\n else\n {\n n = n / 3 + 1;\n outstream.WriteLine(n);\n }\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceCondole\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = Convert.ToUInt64(Console.ReadLine()); \n while (n % 3 == 0)\n n /= 3;\n Console.WriteLine(n / 3 + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n=long.Parse(Console.ReadLine());\n long div = 3;\n while (n % div == 0) div *= 3;\n Console.WriteLine(n/div+1);\n \n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Scanner\n{\n private char[] delimiters = new char[] { ' ' };\n private string[] s;\n private int idx;\n \n public Scanner()\n {\n s = new string[0];\n idx = 0;\n }\n \n public string Next()\n {\n if (idx < s.Length)\n return s[idx++];\n idx = 0;\n s = Console.ReadLine().Split(delimiters, StringSplitOptions.RemoveEmptyEntries);\n return s[idx++];\n }\n \n public int NextInt()\n {\n return int.Parse(Next());\n }\n \n public long NextLong()\n {\n return long.Parse(Next());\n }\n}\n\nclass Solution\n{\n Scanner cin;\n int n, m, a, b;\n \n public void Go()\n {\n cin = new Scanner();\n long n = cin.NextLong();\n for (long i = 3L;; i *= 3L)\n if (n % i != 0L) {\n Console.WriteLine((n + i - 1L) / i);\n break;\n }\n }\n \n static void Main(string[] args)\n {\n new Solution().Go();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Int64.Parse(Console.ReadLine());\n long d = 3;\n while (n % d == 0)\n d *= 3;\n Console.WriteLine(n / d + 1);\n // Console.Read();\n\n\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c333_194_1\n{\n\tpublic class Program3\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\n\t\t\t}\n\t\t}\n\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R194_Div2_C\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n long den = 1;\n List d = new List();\n while (den <= n)\n {\n d.Add(den);\n den *= 3;\n }\n d.Add(den);\n //for (int i = 0; i < d.Count; i++) \n // Console.WriteLine(d[i]);\n\n long cnt = 0;\n int j = 0;\n for (j = d.Count - 1; j >= 0; j--)\n {\n if (d[j] <= n) break;\n }\n\n if (n % d[j] > 0)\n cnt = n / d[j];\n cnt++;\n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n long n = ReadLong();\n long ans = 0;\n if (n == 1)\n ans = 1;\n if (n == 2)\n ans = 1;\n if (n == 3)\n ans = 1;\n if (n > 3)\n ans = n - 2;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c194p3\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Program();\n }\n Program()\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64 p = 3;\n while (n % 3 == 0)\n {\n n /= 3;\n p *= 3;\n }\n Int64 c = (n + p - 1) / p;\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"A2\";\n\n private static void Solve()\n {\n var n = ReadLong();\n var bytes = new List();\n while (n>=1)\n {\n var last = (int)(n%3);\n bytes.Add(last);\n n /= 3;\n }\n \n int first = 0;\n for (first = 0; first < bytes.Count; first++)\n {\n if (bytes[first] != 0)\n break;\n }\n long res = 1;\n for (int i = first + 1; i < bytes.Count; i++)\n {\n res += bytes[i]*(i - first);\n }\n WriteLine(res);\n }\n\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static int[] SortIndexs(this IEnumerable source) where T : IComparable\n {\n var array = source == null ? new List() : source.ToList();\n var n = array.Count;\n var res = Enumerable.Range(0, n).ToArray();\n Array.Sort(res, (a, b) => array[a].CompareTo(array[b]));\n return res;\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5, out T a6)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n a6 = (T)Convert.ChangeType(input[5], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Secrets\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = long.Parse(reader.ReadLine());\n\n long count = 0;\n if (n == 1)\n count = 1;\n else\n {\n long m = 1;\n while (m < n)\n {\n m *= 3;\n }\n if (m == n)\n {\n count = 1;\n }\n else\n {\n m /= 3;\n long delta = n - m;\n if (delta%m == 0)\n count = 1;\n else\n {\n for (int i = 1; i <= 3; i++)\n {\n if (n < i*m)\n {\n count = i;\n break;\n }\n }\n while (m > 1)\n {\n m /= 3;\n if (delta%m != 0)\n {\n count *= 3;\n }\n }\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Secrets\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = long.Parse(reader.ReadLine());\n\n long count = 0;\n if (n == 1)\n count = 1;\n else\n {\n long m = 1;\n while (m < n)\n {\n m *= 3;\n }\n if (m == n)\n {\n count = 1;\n }\n else\n {\n m /= 3;\n long delta = n - m;\n if (delta%m == 0)\n count = 1;\n else\n {\n for (int i = 1; i <= 3; i++)\n {\n if (n < i*m)\n {\n break;\n }\n count = i;\n }\n while (m > 1)\n {\n m /= 3;\n if (delta%m != 0)\n {\n count *= 3;\n }\n else\n {\n break;\n }\n }\n m *= 3;\n for (int i = 1; i <= 3; i++)\n {\n if (n c)\n break;\n for(int j = 0; j <= 10000; j++)\n {\n answer = a * i + b * j;\n if (answer == c)\n {\n s = \"YES\";\n }\n if (answer > c)\n {\n bb = true;\n break;\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForCodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] array = s.Split(' ');\n int[] numbers = new int[3];\n for (int i = 0; i < array.Length; i++)\n numbers[i] = int.Parse(array[i]);\n bool flag = false;\n\n for (int i = 0; i <= (int) (numbers[2]/numbers[0]); i++)\n {\n for (int j = 0; j <= (int) (numbers[2]/numbers[1]); j++)\n {\n if (numbers[0]*i + numbers[1]*j == numbers[2])\n {\n flag = true;\n break;\n }\n }\n }\n Console.WriteLine(flag ? \"Yes\" : \"No\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n private static string readString() => Console.ReadLine();\n private static T readValue() => (T)Convert.ChangeType(readString(), typeof(T));\n private static string[] readStrings(char delimiter = ' ') => readString().Split(delimiter);\n private static T[] readValues(char delimiter = ' ') => readStrings(delimiter: delimiter).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();\n private static void write(T s) => Console.WriteLine(s);\n\n private static int binarySearch(List list, T target) where T : IComparable\n {\n int l = 0, r = list.Count - 1;\n while (l <= r)\n {\n var m = (int)Math.Floor((double)(l + r) / 2);\n if (list[m].CompareTo(target) <= 0)\n if (m == r || list[m + 1].CompareTo(target) > 0)\n return m;\n else\n l = m + 1;\n else\n r = m - 1;\n }\n return -1;\n }\n\n private static int quickSortPartition(List arr, int left, int right, Comparer comparer)\n {\n T pivot = arr[left];\n while (true)\n {\n while (comparer.Compare(arr[left], pivot) < 0)\n left++;\n while (comparer.Compare(arr[right], pivot) > 0)\n right--;\n if (left < right)\n {\n if (comparer.Compare(arr[left], arr[right]) == 0)\n return right;\n\n T temp = arr[left];\n arr[left] = arr[right];\n arr[right] = temp;\n }\n else\n return right;\n }\n }\n private static void quickSort(List arr, int left, int right, Comparer comparer)\n {\n if (left < right)\n {\n int pivot = quickSortPartition(arr, left, right, comparer);\n if (pivot > 1)\n quickSort(arr, left, pivot - 1, comparer);\n if (pivot + 1 < right)\n quickSort(arr, pivot + 1, right, comparer);\n }\n }\n\n private static void watermelon()\n {\n var w = readValue();\n write(w >= 4 && w % 2 == 0 ? \"YES\" : \"NO\");\n }\n private static void wayTooLongWords()\n {\n var words = new List();\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n words.Add(readString());\n\n foreach (var word in words)\n write(word.Length <= 10 ? word : $\"{word.First()}{word.Length - 2}{word.Last()}\");\n }\n private static void team()\n {\n int solve = 0;\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n if (readValues().Where(x => x == 1).Count() > 1)\n ++solve;\n\n write(solve);\n }\n private static void football()\n {\n var positions = readString();\n for (int i = 6; i < positions.Length; ++i)\n if (positions.Substring(i - 6, 6) == (positions[i] == '0' ? \"000000\" : \"111111\"))\n {\n write(\"YES\");\n return;\n }\n write(\"NO\");\n }\n private static void theatreSquare()\n {\n var sizes = readValues();\n write((long)Math.Ceiling((double)sizes[0] / (double)sizes[2]) * (long)Math.Ceiling((double)sizes[1] / (double)sizes[2]));\n }\n private static void stringTask()\n {\n var Vowels = new HashSet { 'a', 'o', 'y', 'e', 'u', 'i' };\n var sb = new StringBuilder();\n var s = readString().ToLower();\n foreach (var c in s)\n if (!Vowels.Contains(c))\n {\n sb.Append('.');\n sb.Append(c);\n }\n\n write(sb.ToString());\n }\n private static void taxi()\n {\n int taxis = 0;\n var groups = new Dictionary { { 1, 0 }, { 2, 0 }, { 3, 0 } };\n\n readValue();\n var groupSizes = readValues();\n foreach (var size in groupSizes)\n if (size == 4)\n ++taxis;\n else\n groups[size] = groups[size] + 1;\n\n taxis += groups[3];\n groups[1] = groups[1] - Math.Min(groups[1], groups[3]);\n\n taxis += groups[2] / 2;\n if (groups[2] % 2 == 1)\n {\n ++taxis;\n groups[1] = groups[1] - 2;\n }\n\n if (groups[1] > 0)\n taxis += (int)Math.Ceiling((double)groups[1] / 4.0);\n\n write(taxis);\n }\n private static void fancyFence()\n {\n var a = readValue();\n for (double i = 3.0; ; i += 1.0)\n {\n var x = (double)(i - 2.0) * 180.0 / i;\n if (a <= x)\n {\n write(a < x ? \"NO\" : \"YES\");\n break;\n }\n }\n }\n private static void interestingDrink()\n {\n readString();\n var prices = readValues().OrderBy(x => x).ToList();\n var days = readValue();\n for (int i = 0; i < days; ++i)\n write(binarySearch(prices, readValue()) + 1);\n }\n private static void compilationErrors()\n {\n readString();\n Dictionary errors = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count()), errors1 = new Dictionary();\n foreach (var error in readValues())\n {\n if (errors[error] > 1)\n errors[error] = errors[error] - 1;\n else\n errors.Remove(error);\n\n if (errors1.TryGetValue(error, out var count))\n errors1[error] = count + 1;\n else\n errors1.Add(error, 1);\n }\n write(errors.First().Key);\n\n foreach (var error in readValues())\n if (errors1[error] > 1)\n errors1[error] = errors1[error] - 1;\n else\n errors1.Remove(error);\n write(errors1.First().Key);\n }\n private static void doubleCola()\n {\n var idToName = new Dictionary { { 0, \"Sheldon\" }, { 1, \"Leonard\" }, { 2, \"Penny\" }, { 3, \"Rajesh\" }, { 4, \"Howard\" } };\n int n = readValue(), i = 1;\n for (; n > i * 5; i *= 2)\n n -= i * 5;\n write(idToName[(n - 1) / i]);\n }\n private static void ilyaAndQueries()\n {\n var dic = new Dictionary();\n var list = new List>();\n\n var s = readString();\n int start = 0, dicStart = 0;\n for (int j = 0; j < s.Length - 1; ++j)\n if (s[j] != s[j + 1])\n {\n if (start < j)\n {\n list.Add(new Tuple(start + 1, j + 1));\n for (; dicStart < j + 1; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n start = j + 1;\n }\n if (start < s.Length - 1)\n {\n list.Add(new Tuple(start + 1, s.Length));\n for (; dicStart < s.Length; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n\n var m = readValue();\n for (int j = 0; j < m; ++j)\n {\n var q = readValues();\n int l = q[0], r = q[1], result = 0;\n if (dic.TryGetValue(l, out var i))\n for (; i < list.Count && r >= list[i].Item1; ++i)\n if (l < list[i].Item2)\n result += Math.Min(r, list[i].Item2) - Math.Max(l, list[i].Item1);\n write(result);\n }\n }\n private static void twoTeamsComposing()\n {\n var n = readValue();\n var skills = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n }\n #region Laptop\n private class Laptop\n {\n internal int Price { get; private set; }\n internal int Quality { get; private set; }\n internal Laptop(int[] values)\n {\n Price = values[0];\n Quality = values[1];\n }\n }\n private class Laptop_Comparer_Price : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Price - y.Price;\n }\n private class Laptop_Comparer_Quality : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Quality - y.Quality;\n }\n private static void laptops()\n {\n List prices = new List(), qualities = new List();\n var n = readValue();\n for (int i = 0; i < n; ++i)\n {\n var laptop = new Laptop(readValues());\n prices.Add(laptop);\n qualities.Add(laptop);\n }\n\n for (int i = 0; i < n; ++i)\n if (prices[i] != qualities[i])\n {\n write(\"Happy Alex\");\n return;\n }\n write(\"Poor Alex\");\n }\n #endregion\n private static void fence()\n {\n int k = readValues()[1], minI = 0, currentH = 0;\n int[] h = readValues();\n\n for (int i = 0; i < k; ++i)\n currentH += h[i];\n var minH = currentH;\n\n for (int i = 1; i < h.Length - k + 1; ++i)\n {\n currentH = currentH - h[i - 1] + h[i + k - 1];\n if (minH > currentH)\n {\n minH = currentH;\n minI = i;\n }\n }\n\n write(minI + 1);\n }\n #region serejaAndSuffixes\n private class SerejaL\n {\n internal int L { get; private set; }\n internal int Result;\n internal SerejaL(int l)\n {\n L = l;\n }\n }\n private class SerejaLComparerL : Comparer\n {\n public override int Compare([AllowNull] SerejaL x, [AllowNull] SerejaL y) => x.L - y.L;\n }\n private static void serejaGetLs(int m, out List listDistinct, out List listOrdered)\n {\n listDistinct = new List();\n listOrdered = new List();\n var dic = new Dictionary();\n for (int i = 0; i < m; ++i)\n {\n var l = readValue() - 1;\n if (!dic.TryGetValue(l, out var item))\n {\n item = new SerejaL(l);\n dic.Add(l, item);\n listDistinct.Add(item);\n }\n listOrdered.Add(item);\n }\n quickSort(listDistinct, 0, listDistinct.Count - 1, new SerejaLComparerL());\n }\n private static void serejaAndSuffixes()\n {\n var m = readValues()[1];\n var a = readValues();\n serejaGetLs(m, out var listDistinct, out var listOrdered);\n\n var distinct = new HashSet();\n for (int i = listDistinct.Count - 1, j = a.Length - 1; i >= 0; --i)\n {\n for (; j >= listDistinct[i].L; --j)\n if (!distinct.Contains(a[j]))\n distinct.Add(a[j]);\n\n listDistinct[i].Result = distinct.Count;\n }\n\n foreach (var item in listOrdered)\n write(item.Result);\n }\n #endregion\n private static void bowWowTimetable()\n {\n string s = readString(), r = \"1\";\n int i = 1;\n for (; r.Length < s.Length; ++i, r = r + \"00\") ;\n if (r.Length > s.Length || !s.Substring(1).Contains('1'))\n write(i - 1);\n else\n write(i);\n }\n private static void digits()\n {\n readString();\n var numbers = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n if (!numbers.ContainsKey(0))\n {\n write(-1);\n return;\n }\n }\n private static void lifeWithoutZeros()\n {\n long a = readValue(), b = readValue(), c = a + b;\n write(Convert.ToInt64(a.ToString().Replace(\"0\", \"\")) + Convert.ToInt64(b.ToString().Replace(\"0\", \"\")) == Convert.ToInt64(c.ToString().Replace(\"0\", \"\")) ? \"YES\" : \"NO\");\n }\n private static void permutation()\n {\n var n = readValue();\n var a = readValues();\n write(n - a.Where(x => x <= n).Distinct().Count());\n }\n private static void hamsterFarm()\n {\n var n = readValues()[0];\n var k = readValues();\n int bestI = 0;\n for (int i = 1; i < k.Length; ++i)\n if (n % k[i] < n % k[bestI])\n bestI = i;\n write($\"{bestI + 1} {n / k[bestI]}\");\n }\n private static void shellGame()\n {\n int n = readValue(), x = readValue();\n if (x == 1)\n {\n if (n % 2 == 1)\n x = 0;\n else\n x = 2;\n --n;\n }\n for (int i = n % 6; i > 0; --i)\n if (i % 2 == 1)\n {\n if (x == 0)\n x = 1;\n else if (x == 1)\n x = 0;\n }\n else if (x == 1)\n x = 2;\n else if (x == 2)\n x = 1;\n write(x);\n }\n private static void ACM_ICPC()\n {\n int[] a = readValues(), score = new int[2], members = new int[2];\n for (int i1 = 0; i1 < 2; ++i1)\n {\n score[i1] = a[0];\n members[i1] = 1;\n for (int i2 = 0; i2 < 2; ++i2)\n {\n score[i2] += a[1];\n members[i2] += 1;\n for (int i3 = 0; i3 < 2; ++i3)\n {\n score[i3] += a[2];\n members[i3] += 1;\n for (int i4 = 0; i4 < 2; ++i4)\n if (members[i4] < 3)\n {\n score[i4] += a[3];\n members[i4] += 1;\n for (int i5 = 0; i5 < 2; ++i5)\n if (members[i5] < 3)\n {\n score[i5] += a[4];\n members[i5] += 1;\n for (int i6 = 0; i6 < 2; ++i6)\n if (members[i6] < 3)\n {\n score[i6] += a[5];\n members[i6] += 1;\n if (score[0] == score[1])\n {\n write(\"YES\");\n return;\n }\n score[i6] -= a[5];\n members[i6] -= 1;\n }\n score[i5] -= a[4];\n members[i5] -= 1;\n }\n score[i4] -= a[3];\n members[i4] -= 1;\n }\n score[i3] -= a[2];\n members[i3] -= 1;\n }\n score[i2] -= a[1];\n members[i2] -= 1;\n }\n score[i1] = 0;\n members[i1] = 0;\n }\n write(\"NO\");\n }\n private static void mex()\n {\n var x = readValues()[1];\n var n = readValues();\n write(x - n.Count(y => y < x) + (n.Contains(x) ? 1 : 0));\n }\n private static void minimumProduct()\n {\n var input = readValues();\n int a = input[0], b = input[1], x = input[2], y = input[3], n = input[4], minA = Math.Min(a - x, n), minB = Math.Min(b - y, n);\n if (a - minA <= b - minB)\n {\n a -= minA;\n n -= minA;\n }\n else\n {\n b -= minB;\n n -= minB;\n }\n\n if (n > 0)\n if (a > x)\n a -= Math.Min(a - x, n);\n else if (b > y)\n b -= Math.Min(b - y, n);\n\n write((long)a * (long)b);\n }\n private static void shovelsAndSwords()\n {\n var input = readValues();\n int a = input[0], b = input[1], result = 0;\n if (a > b)\n {\n var min = Math.Min(a - b, b);\n a -= min * 2;\n b -= min;\n result += min;\n }\n else if (b > a)\n {\n var min = Math.Min(b - a, a);\n a -= min;\n b -= min * 2;\n result += min;\n }\n int d = Math.Min(a / 3, b / 3);\n a -= d * 3;\n b -= d * 3;\n result += d * 2;\n if (a > 0 && b > 0 && (a > 1 || b > 1))\n ++result;\n write(result);\n }\n private static void matrixGame()\n {\n var input = readValues();\n int n = input[0], m = input[1];\n HashSet claimedRows = new HashSet(), claimedColumns = new HashSet();\n for (int i = 0; i < n; ++i)\n {\n input = readValues();\n for (int j = 0; j < m; ++j)\n if (input[j] == 1)\n {\n if (!claimedRows.Contains(i))\n claimedRows.Add(i);\n if (!claimedColumns.Contains(j))\n claimedColumns.Add(j);\n }\n }\n write(Math.Min(n - claimedRows.Count, m - claimedColumns.Count) % 2 == 0 ? \"Vivek\" : \"Ashish\");\n }\n private static void cinemaLine()\n {\n readString();\n var clerk = new Dictionary { { 25, 0 }, { 50, 0 } };\n foreach (var a in readValues())\n switch (a)\n {\n case 25:\n clerk[25] += 1;\n break;\n case 50:\n if (clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] += 1;\n }\n else\n {\n write(\"NO\");\n return;\n }\n break;\n default: // 100\n if (clerk[50] > 0 && clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] -= 1;\n }\n else if (clerk[25] > 2)\n clerk[25] -= 3;\n else\n {\n write(\"NO\");\n return;\n }\n break;\n }\n write(\"YES\");\n }\n private static void kindAnton()\n {\n readString();\n int[] a = readValues(), b = readValues();\n bool positive1 = false, negative1 = false;\n HashSet positive = new HashSet(), negative = new HashSet();\n for (int i = 0; i < a.Length; ++i)\n {\n int diff = b[i] - a[i];\n if (((diff > 0 && !positive1) || (diff < 0 && !negative1)) && !(diff > 0 ? positive : negative).Any(x => diff % x == 0))\n {\n write(\"NO\");\n return;\n }\n if (a[i] > 0)\n {\n if (!positive1)\n if (a[i] == 1)\n {\n positive1 = true;\n if (negative1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!positive.Contains(a[i]))\n positive.Add(a[i]);\n }\n else if (a[i] < 0 && !negative1)\n if (a[i] == -1)\n {\n negative1 = true;\n if (positive1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!negative.Contains(a[i]))\n negative.Add(a[i]);\n }\n write(\"YES\");\n }\n private static void staircases()\n {\n var input = readValues();\n int n = input[0], mn = input[1];\n if (mn == 0)\n {\n write(\"YES\");\n return;\n }\n var m = readValues().OrderBy(x => x).ToList();\n if (m[0] == 1 || m[m.Count - 1] == n)\n {\n write(\"NO\");\n return;\n }\n for (int i = 0; i < m.Count - 2; ++i)\n if (m[i] == m[i + 1] - 1 && m[i] == m[i + 2] - 2)\n {\n write(\"NO\");\n return;\n }\n write(\"YES\");\n }\n private static void blownGarland()\n {\n var colors = new Dictionary { { 'R', 0 }, { 'Y', 0 }, { 'B', 0 }, { 'G', 0 } };\n var s = readString();\n\n var colorPerPosition = new char[4];\n foreach (var color in colors)\n colorPerPosition[s.IndexOf(color.Key) % 4] = color.Key;\n\n for (int i = 0; i < s.Length; ++i)\n if (s[i] == '!')\n colors[colorPerPosition[i % 4]] += 1;\n\n write($\"{colors['R']} {colors['B']} {colors['Y']} {colors['G']}\");\n }\n private static void mikeAndFax()\n {\n var s = readString();\n int k = readValue();\n\n if (s.Length % k != 0)\n {\n write(\"NO\");\n return;\n }\n\n int size = s.Length / k;\n for (int i = 0; i < s.Length; i += size)\n for (int j1 = i + size / 2 - 1, j2 = i + size / 2 + size % 2; j1 >= i; --j1, ++j2)\n if (s[j1] != s[j2])\n {\n write(\"NO\");\n return;\n }\n\n write(\"YES\");\n }\n #region weirdRounding\n private static bool weirdRounding_Recursion(string ns, int kp, int d)\n {\n if (d > 0)\n for (int i = ns[1] == '0' && ns.Length > 2 ? 1 : 0; i < ns.Length; ++i)\n {\n string nsNew = ns.Remove(i, 1);\n int n = Convert.ToInt32(nsNew);\n if (n % kp == 0 || weirdRounding_Recursion(nsNew, kp, d - 1))\n return true;\n }\n return false;\n }\n private static void weirdRounding()\n {\n var input = readStrings();\n string ns = input[0];\n int n = Convert.ToInt32(ns), k = Convert.ToInt32(input[1]), kp = (int)Math.Pow(10, k);\n\n if (n < kp)\n write(ns.Length - 1);\n else if (n % kp == 0)\n write(0);\n else\n for (int d = 1; d < ns.Length; ++d)\n if (weirdRounding_Recursion(ns, kp, d))\n {\n write(d);\n return;\n }\n }\n #endregion\n private static void wilburArray()\n {\n readString();\n int[] b = readValues();\n long result = Math.Abs(b[0]);\n for (int i = 1; i < b.Length; ++i)\n result += Math.Abs(b[i] - b[i - 1]);\n write(result);\n }\n private static void zuhairStrings()\n {\n int k = readValues()[1];\n var s = readString();\n var result = new Dictionary();\n\n for (int i = 0; i < s.Length - k + 1;)\n {\n int j = i + 1;\n for (; j < i + k && s[i] == s[j]; ++j) ;\n if (j == i + k)\n if (!result.ContainsKey(s[i]))\n result.Add(s[i], 1);\n else\n result[s[i]] += 1;\n i = j;\n }\n\n write(result.Count > 0 ? result.Max(x => x.Value) : 0);\n }\n private static void artfulExpedient()\n {\n var n = readValue();\n int[] x = readValues(), y = readValues();\n var numbers = x.Union(y).ToHashSet();\n var resultEven = true;\n\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < n; ++j)\n if (numbers.Contains(x[i] ^ y[j]))\n resultEven = !resultEven;\n\n write(resultEven ? \"Karen\" : \"Koyomi\");\n }\n private static void ebonyIvory()\n {\n var input = readValues();\n int a = input[0], b = input[1], c = input[2];\n for (int i = 0; i <= c; i += a)\n if ((c - i) % b == 0)\n {\n write(\"Yes\");\n return;\n }\n write(\"No\");\n }\n\n static void Main(string[] args)\n {\n //var t = readValue();\n //for (int i = 0; i < t; ++i)\n ebonyIvory();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n private static string readString() => Console.ReadLine();\n private static T readValue() => (T)Convert.ChangeType(readString(), typeof(T));\n private static string[] readStrings(char delimiter = ' ') => readString().Split(delimiter);\n private static T[] readValues(char delimiter = ' ') => readStrings(delimiter: delimiter).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();\n private static void write(T s) => Console.WriteLine(s);\n\n private static int binarySearch(List list, T target) where T : IComparable\n {\n int l = 0, r = list.Count - 1;\n while (l <= r)\n {\n var m = (int)Math.Floor((double)(l + r) / 2);\n if (list[m].CompareTo(target) <= 0)\n if (m == r || list[m + 1].CompareTo(target) > 0)\n return m;\n else\n l = m + 1;\n else\n r = m - 1;\n }\n return -1;\n }\n\n private static int quickSortPartition(List arr, int left, int right, Comparer comparer)\n {\n T pivot = arr[left];\n while (true)\n {\n while (comparer.Compare(arr[left], pivot) < 0)\n left++;\n while (comparer.Compare(arr[right], pivot) > 0)\n right--;\n if (left < right)\n {\n if (comparer.Compare(arr[left], arr[right]) == 0)\n return right;\n\n T temp = arr[left];\n arr[left] = arr[right];\n arr[right] = temp;\n }\n else\n return right;\n }\n }\n private static void quickSort(List arr, int left, int right, Comparer comparer)\n {\n if (left < right)\n {\n int pivot = quickSortPartition(arr, left, right, comparer);\n if (pivot > 1)\n quickSort(arr, left, pivot - 1, comparer);\n if (pivot + 1 < right)\n quickSort(arr, pivot + 1, right, comparer);\n }\n }\n\n private static void watermelon()\n {\n var w = readValue();\n write(w >= 4 && w % 2 == 0 ? \"YES\" : \"NO\");\n }\n private static void wayTooLongWords()\n {\n var words = new List();\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n words.Add(readString());\n\n foreach (var word in words)\n write(word.Length <= 10 ? word : $\"{word.First()}{word.Length - 2}{word.Last()}\");\n }\n private static void team()\n {\n int solve = 0;\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n if (readValues().Where(x => x == 1).Count() > 1)\n ++solve;\n\n write(solve);\n }\n private static void football()\n {\n var positions = readString();\n for (int i = 6; i < positions.Length; ++i)\n if (positions.Substring(i - 6, 6) == (positions[i] == '0' ? \"000000\" : \"111111\"))\n {\n write(\"YES\");\n return;\n }\n write(\"NO\");\n }\n private static void theatreSquare()\n {\n var sizes = readValues();\n write((long)Math.Ceiling((double)sizes[0] / (double)sizes[2]) * (long)Math.Ceiling((double)sizes[1] / (double)sizes[2]));\n }\n private static void stringTask()\n {\n var Vowels = new HashSet { 'a', 'o', 'y', 'e', 'u', 'i' };\n var sb = new StringBuilder();\n var s = readString().ToLower();\n foreach (var c in s)\n if (!Vowels.Contains(c))\n {\n sb.Append('.');\n sb.Append(c);\n }\n\n write(sb.ToString());\n }\n private static void taxi()\n {\n int taxis = 0;\n var groups = new Dictionary { { 1, 0 }, { 2, 0 }, { 3, 0 } };\n\n readValue();\n var groupSizes = readValues();\n foreach (var size in groupSizes)\n if (size == 4)\n ++taxis;\n else\n groups[size] = groups[size] + 1;\n\n taxis += groups[3];\n groups[1] = groups[1] - Math.Min(groups[1], groups[3]);\n\n taxis += groups[2] / 2;\n if (groups[2] % 2 == 1)\n {\n ++taxis;\n groups[1] = groups[1] - 2;\n }\n\n if (groups[1] > 0)\n taxis += (int)Math.Ceiling((double)groups[1] / 4.0);\n\n write(taxis);\n }\n private static void fancyFence()\n {\n var a = readValue();\n for (double i = 3.0; ; i += 1.0)\n {\n var x = (double)(i - 2.0) * 180.0 / i;\n if (a <= x)\n {\n write(a < x ? \"NO\" : \"YES\");\n break;\n }\n }\n }\n private static void interestingDrink()\n {\n readString();\n var prices = readValues().OrderBy(x => x).ToList();\n var days = readValue();\n for (int i = 0; i < days; ++i)\n write(binarySearch(prices, readValue()) + 1);\n }\n private static void compilationErrors()\n {\n readString();\n Dictionary errors = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count()), errors1 = new Dictionary();\n foreach (var error in readValues())\n {\n if (errors[error] > 1)\n errors[error] = errors[error] - 1;\n else\n errors.Remove(error);\n\n if (errors1.TryGetValue(error, out var count))\n errors1[error] = count + 1;\n else\n errors1.Add(error, 1);\n }\n write(errors.First().Key);\n\n foreach (var error in readValues())\n if (errors1[error] > 1)\n errors1[error] = errors1[error] - 1;\n else\n errors1.Remove(error);\n write(errors1.First().Key);\n }\n private static void doubleCola()\n {\n var idToName = new Dictionary { { 0, \"Sheldon\" }, { 1, \"Leonard\" }, { 2, \"Penny\" }, { 3, \"Rajesh\" }, { 4, \"Howard\" } };\n int n = readValue(), i = 1;\n for (; n > i * 5; i *= 2)\n n -= i * 5;\n write(idToName[(n - 1) / i]);\n }\n private static void ilyaAndQueries()\n {\n var dic = new Dictionary();\n var list = new List>();\n\n var s = readString();\n int start = 0, dicStart = 0;\n for (int j = 0; j < s.Length - 1; ++j)\n if (s[j] != s[j + 1])\n {\n if (start < j)\n {\n list.Add(new Tuple(start + 1, j + 1));\n for (; dicStart < j + 1; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n start = j + 1;\n }\n if (start < s.Length - 1)\n {\n list.Add(new Tuple(start + 1, s.Length));\n for (; dicStart < s.Length; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n\n var m = readValue();\n for (int j = 0; j < m; ++j)\n {\n var q = readValues();\n int l = q[0], r = q[1], result = 0;\n if (dic.TryGetValue(l, out var i))\n for (; i < list.Count && r >= list[i].Item1; ++i)\n if (l < list[i].Item2)\n result += Math.Min(r, list[i].Item2) - Math.Max(l, list[i].Item1);\n write(result);\n }\n }\n private static void twoTeamsComposing()\n {\n var n = readValue();\n var skills = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n }\n #region Laptop\n private class Laptop\n {\n internal int Price { get; private set; }\n internal int Quality { get; private set; }\n internal Laptop(int[] values)\n {\n Price = values[0];\n Quality = values[1];\n }\n }\n private class Laptop_Comparer_Price : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Price - y.Price;\n }\n private class Laptop_Comparer_Quality : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Quality - y.Quality;\n }\n private static void laptops()\n {\n List prices = new List(), qualities = new List();\n var n = readValue();\n for (int i = 0; i < n; ++i)\n {\n var laptop = new Laptop(readValues());\n prices.Add(laptop);\n qualities.Add(laptop);\n }\n\n for (int i = 0; i < n; ++i)\n if (prices[i] != qualities[i])\n {\n write(\"Happy Alex\");\n return;\n }\n write(\"Poor Alex\");\n }\n #endregion\n private static void fence()\n {\n int k = readValues()[1], minI = 0, currentH = 0;\n int[] h = readValues();\n\n for (int i = 0; i < k; ++i)\n currentH += h[i];\n var minH = currentH;\n\n for (int i = 1; i < h.Length - k + 1; ++i)\n {\n currentH = currentH - h[i - 1] + h[i + k - 1];\n if (minH > currentH)\n {\n minH = currentH;\n minI = i;\n }\n }\n\n write(minI + 1);\n }\n #region serejaAndSuffixes\n private class SerejaL\n {\n internal int L { get; private set; }\n internal int Result;\n internal SerejaL(int l)\n {\n L = l;\n }\n }\n private class SerejaLComparerL : Comparer\n {\n public override int Compare([AllowNull] SerejaL x, [AllowNull] SerejaL y) => x.L - y.L;\n }\n private static void serejaGetLs(int m, out List listDistinct, out List listOrdered)\n {\n listDistinct = new List();\n listOrdered = new List();\n var dic = new Dictionary();\n for (int i = 0; i < m; ++i)\n {\n var l = readValue() - 1;\n if (!dic.TryGetValue(l, out var item))\n {\n item = new SerejaL(l);\n dic.Add(l, item);\n listDistinct.Add(item);\n }\n listOrdered.Add(item);\n }\n quickSort(listDistinct, 0, listDistinct.Count - 1, new SerejaLComparerL());\n }\n private static void serejaAndSuffixes()\n {\n var m = readValues()[1];\n var a = readValues();\n serejaGetLs(m, out var listDistinct, out var listOrdered);\n\n var distinct = new HashSet();\n for (int i = listDistinct.Count - 1, j = a.Length - 1; i >= 0; --i)\n {\n for (; j >= listDistinct[i].L; --j)\n if (!distinct.Contains(a[j]))\n distinct.Add(a[j]);\n\n listDistinct[i].Result = distinct.Count;\n }\n\n foreach (var item in listOrdered)\n write(item.Result);\n }\n #endregion\n private static void bowWowTimetable()\n {\n string s = readString(), r = \"1\";\n int i = 1;\n for (; r.Length < s.Length; ++i, r = r + \"00\") ;\n if (r.Length > s.Length || !s.Substring(1).Contains('1'))\n write(i - 1);\n else\n write(i);\n }\n private static void digits()\n {\n readString();\n var numbers = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n if (!numbers.ContainsKey(0))\n {\n write(-1);\n return;\n }\n }\n private static void lifeWithoutZeros()\n {\n long a = readValue(), b = readValue(), c = a + b;\n write(Convert.ToInt64(a.ToString().Replace(\"0\", \"\")) + Convert.ToInt64(b.ToString().Replace(\"0\", \"\")) == Convert.ToInt64(c.ToString().Replace(\"0\", \"\")) ? \"YES\" : \"NO\");\n }\n private static void permutation()\n {\n var n = readValue();\n var a = readValues();\n write(n - a.Where(x => x <= n).Distinct().Count());\n }\n private static void hamsterFarm()\n {\n var n = readValues()[0];\n var k = readValues();\n int bestI = 0;\n for (int i = 1; i < k.Length; ++i)\n if (n % k[i] < n % k[bestI])\n bestI = i;\n write($\"{bestI + 1} {n / k[bestI]}\");\n }\n private static void shellGame()\n {\n int n = readValue(), x = readValue();\n if (x == 1)\n {\n if (n % 2 == 1)\n x = 0;\n else\n x = 2;\n --n;\n }\n for (int i = n % 6; i > 0; --i)\n if (i % 2 == 1)\n {\n if (x == 0)\n x = 1;\n else if (x == 1)\n x = 0;\n }\n else if (x == 1)\n x = 2;\n else if (x == 2)\n x = 1;\n write(x);\n }\n private static void ACM_ICPC()\n {\n int[] a = readValues(), score = new int[2], members = new int[2];\n for (int i1 = 0; i1 < 2; ++i1)\n {\n score[i1] = a[0];\n members[i1] = 1;\n for (int i2 = 0; i2 < 2; ++i2)\n {\n score[i2] += a[1];\n members[i2] += 1;\n for (int i3 = 0; i3 < 2; ++i3)\n {\n score[i3] += a[2];\n members[i3] += 1;\n for (int i4 = 0; i4 < 2; ++i4)\n if (members[i4] < 3)\n {\n score[i4] += a[3];\n members[i4] += 1;\n for (int i5 = 0; i5 < 2; ++i5)\n if (members[i5] < 3)\n {\n score[i5] += a[4];\n members[i5] += 1;\n for (int i6 = 0; i6 < 2; ++i6)\n if (members[i6] < 3)\n {\n score[i6] += a[5];\n members[i6] += 1;\n if (score[0] == score[1])\n {\n write(\"YES\");\n return;\n }\n score[i6] -= a[5];\n members[i6] -= 1;\n }\n score[i5] -= a[4];\n members[i5] -= 1;\n }\n score[i4] -= a[3];\n members[i4] -= 1;\n }\n score[i3] -= a[2];\n members[i3] -= 1;\n }\n score[i2] -= a[1];\n members[i2] -= 1;\n }\n score[i1] = 0;\n members[i1] = 0;\n }\n write(\"NO\");\n }\n private static void mex()\n {\n var x = readValues()[1];\n var n = readValues();\n write(x - n.Count(y => y < x) + (n.Contains(x) ? 1 : 0));\n }\n private static void minimumProduct()\n {\n var input = readValues();\n int a = input[0], b = input[1], x = input[2], y = input[3], n = input[4], minA = Math.Min(a - x, n), minB = Math.Min(b - y, n);\n if (a - minA <= b - minB)\n {\n a -= minA;\n n -= minA;\n }\n else\n {\n b -= minB;\n n -= minB;\n }\n\n if (n > 0)\n if (a > x)\n a -= Math.Min(a - x, n);\n else if (b > y)\n b -= Math.Min(b - y, n);\n\n write((long)a * (long)b);\n }\n private static void shovelsAndSwords()\n {\n var input = readValues();\n int a = input[0], b = input[1], result = 0;\n if (a > b)\n {\n var min = Math.Min(a - b, b);\n a -= min * 2;\n b -= min;\n result += min;\n }\n else if (b > a)\n {\n var min = Math.Min(b - a, a);\n a -= min;\n b -= min * 2;\n result += min;\n }\n int d = Math.Min(a / 3, b / 3);\n a -= d * 3;\n b -= d * 3;\n result += d * 2;\n if (a > 0 && b > 0 && (a > 1 || b > 1))\n ++result;\n write(result);\n }\n private static void matrixGame()\n {\n var input = readValues();\n int n = input[0], m = input[1];\n HashSet claimedRows = new HashSet(), claimedColumns = new HashSet();\n for (int i = 0; i < n; ++i)\n {\n input = readValues();\n for (int j = 0; j < m; ++j)\n if (input[j] == 1)\n {\n if (!claimedRows.Contains(i))\n claimedRows.Add(i);\n if (!claimedColumns.Contains(j))\n claimedColumns.Add(j);\n }\n }\n write(Math.Min(n - claimedRows.Count, m - claimedColumns.Count) % 2 == 0 ? \"Vivek\" : \"Ashish\");\n }\n private static void cinemaLine()\n {\n readString();\n var clerk = new Dictionary { { 25, 0 }, { 50, 0 } };\n foreach (var a in readValues())\n switch (a)\n {\n case 25:\n clerk[25] += 1;\n break;\n case 50:\n if (clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] += 1;\n }\n else\n {\n write(\"NO\");\n return;\n }\n break;\n default: // 100\n if (clerk[50] > 0 && clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] -= 1;\n }\n else if (clerk[25] > 2)\n clerk[25] -= 3;\n else\n {\n write(\"NO\");\n return;\n }\n break;\n }\n write(\"YES\");\n }\n private static void kindAnton()\n {\n readString();\n int[] a = readValues(), b = readValues();\n bool positive1 = false, negative1 = false;\n HashSet positive = new HashSet(), negative = new HashSet();\n for (int i = 0; i < a.Length; ++i)\n {\n int diff = b[i] - a[i];\n if (((diff > 0 && !positive1) || (diff < 0 && !negative1)) && !(diff > 0 ? positive : negative).Any(x => diff % x == 0))\n {\n write(\"NO\");\n return;\n }\n if (a[i] > 0)\n {\n if (!positive1)\n if (a[i] == 1)\n {\n positive1 = true;\n if (negative1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!positive.Contains(a[i]))\n positive.Add(a[i]);\n }\n else if (a[i] < 0 && !negative1)\n if (a[i] == -1)\n {\n negative1 = true;\n if (positive1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!negative.Contains(a[i]))\n negative.Add(a[i]);\n }\n write(\"YES\");\n }\n private static void staircases()\n {\n var input = readValues();\n int n = input[0], mn = input[1];\n if (mn == 0)\n {\n write(\"YES\");\n return;\n }\n var m = readValues().OrderBy(x => x).ToList();\n if (m[0] == 1 || m[m.Count - 1] == n)\n {\n write(\"NO\");\n return;\n }\n for (int i = 0; i < m.Count - 2; ++i)\n if (m[i] == m[i + 1] - 1 && m[i] == m[i + 2] - 2)\n {\n write(\"NO\");\n return;\n }\n write(\"YES\");\n }\n private static void blownGarland()\n {\n var colors = new Dictionary { { 'R', 0 }, { 'Y', 0 }, { 'B', 0 }, { 'G', 0 } };\n var s = readString();\n\n var colorPerPosition = new char[4];\n foreach (var color in colors)\n colorPerPosition[s.IndexOf(color.Key) % 4] = color.Key;\n\n for (int i = 0; i < s.Length; ++i)\n if (s[i] == '!')\n colors[colorPerPosition[i % 4]] += 1;\n\n write($\"{colors['R']} {colors['B']} {colors['Y']} {colors['G']}\");\n }\n private static void mikeAndFax()\n {\n var s = readString();\n int k = readValue();\n\n if (s.Length % k != 0)\n {\n write(\"NO\");\n return;\n }\n\n int size = s.Length / k;\n for (int i = 0; i < s.Length; i += size)\n for (int j1 = i + size / 2 - 1, j2 = i + size / 2 + size % 2; j1 >= i; --j1, ++j2)\n if (s[j1] != s[j2])\n {\n write(\"NO\");\n return;\n }\n\n write(\"YES\");\n }\n #region weirdRounding\n private static bool weirdRounding_Recursion(string ns, int kp, int d)\n {\n if (d > 0)\n for (int i = ns[1] == '0' && ns.Length > 2 ? 1 : 0; i < ns.Length; ++i)\n {\n string nsNew = ns.Remove(i, 1);\n int n = Convert.ToInt32(nsNew);\n if (n % kp == 0 || weirdRounding_Recursion(nsNew, kp, d - 1))\n return true;\n }\n return false;\n }\n private static void weirdRounding()\n {\n var input = readStrings();\n string ns = input[0];\n int n = Convert.ToInt32(ns), k = Convert.ToInt32(input[1]), kp = (int)Math.Pow(10, k);\n\n if (n < kp)\n write(ns.Length - 1);\n else if (n % kp == 0)\n write(0);\n else\n for (int d = 1; d < ns.Length; ++d)\n if (weirdRounding_Recursion(ns, kp, d))\n {\n write(d);\n return;\n }\n }\n #endregion\n private static void wilburArray()\n {\n readString();\n int[] b = readValues();\n long result = Math.Abs(b[0]);\n for (int i = 1; i < b.Length; ++i)\n result += Math.Abs(b[i] - b[i - 1]);\n write(result);\n }\n private static void zuhairStrings()\n {\n int k = readValues()[1];\n var s = readString();\n var result = new Dictionary();\n\n for (int i = 0; i < s.Length - k + 1;)\n {\n int j = i + 1;\n for (; j < i + k && s[i] == s[j]; ++j) ;\n if (j == i + k)\n if (!result.ContainsKey(s[i]))\n result.Add(s[i], 1);\n else\n result[s[i]] += 1;\n i = j;\n }\n\n write(result.Count > 0 ? result.Max(x => x.Value) : 0);\n }\n private static void artfulExpedient()\n {\n var n = readValue();\n int[] x = readValues(), y = readValues();\n var numbers = x.Union(y).ToHashSet();\n var resultEven = true;\n\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < n; ++j)\n if (numbers.Contains(x[i] ^ y[j]))\n resultEven = !resultEven;\n\n write(resultEven ? \"Karen\" : \"Koyomi\");\n }\n private static void ebonyIvory()\n {\n var input = readValues();\n int a = input[0], b = input[1], c = input[2];\n if (a < b)\n {\n var t = a;\n a = b;\n b = t;\n }\n for (; c >= 0; c -= a)\n if (c % b == 0)\n {\n write(\"Yes\");\n return;\n }\n write(\"No\");\n }\n\n static void Main(string[] args)\n {\n //var t = readValue();\n //for (int i = 0; i < t; ++i)\n ebonyIvory();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tstring[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tint a = Int32.Parse(split[0]);\n\t\t\tint b = Int32.Parse(split[1]);\n\t\t\tint c = Int32.Parse(split[2]);\n\t\t\tint gun1 = c;\n\t\t\tbool solved = false;\n\t\t\twhile (gun1 > 0)\n\t\t\t{\n\t\t\t\tgun1 -= a;\n\t\t\t\tif (gun1 % b == 0 && gun1 >= 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint gun2 = c;\n\t\t\twhile (gun2 > 0)\n\t\t\t{\n\t\t\t\tgun2 -= b;\n\t\t\t\tif (gun2 % a == 0 && gun2 >= 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (solved)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n string input = Console.ReadLine();\n string[] args = input.Split();\n\n //Console.WriteLine($\"Num args = {args.Length}\");\n\n var a = int.Parse(args[0]);\n var b = int.Parse(args[1]);\n var c = int.Parse(args[2]);\n\n //Console.WriteLine($\"a = {a}\");\n //Console.WriteLine($\"b = {b}\");\n //Console.WriteLine($\"c = {c}\");\n\n int asum = 0;\n bool foundCombination = false;\n\n while (asum <= c)\n {\n if ((c - asum) % b == 0)\n {\n foundCombination = true;\n break;\n }\n\n asum += a;\n }\n\n Console.WriteLine(foundCombination ? \"Yes\" : \"No\");\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _633A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n\n bool[] possible = new bool[c + 1];\n possible[0] = true;\n\n for (int i = 1; i <= c; i++)\n {\n possible[i] = (i >= a && possible[i - a]) || (i >= b && possible[i - b]);\n }\n\n Console.WriteLine(possible[c] ? \"Yes\" : \"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Contest\n{\n class Program\n {\n static void SetInput()\n {\n var textReader = new StreamReader(\"input.txt\");\n Console.SetIn(textReader);\n }\n\n static IEnumerable Parse(string line, Func converter)\n {\n return line.Split(' ').Select(converter);\n }\n\n static IEnumerable ReadInts()\n {\n return ReadLine(x => int.Parse(x));\n }\n\n static IEnumerable ReadLongs()\n {\n return ReadLine(x => long.Parse(x));\n }\n\n static IEnumerable ReadDoubles()\n {\n return ReadLine(x => double.Parse(x));\n }\n\n static IEnumerable ReadLine(Func converter)\n {\n var line = Console.ReadLine();\n\n return Parse(line, converter);\n }\n\n static void Print(IEnumerable values)\n {\n Console.WriteLine(string.Join(\" \", values));\n }\n\n static int[] Copy(int[] array)\n {\n if (array == null) return null;\n\n var newArray = new int[array.Length];\n Array.Copy(array, newArray, array.Length);\n return newArray;\n }\n\n\n\n static void Main(string[] args)\n {\n //SetInput();\n\n var input = ReadInts().ToArray();\n var a = input[0];\n var b = input[1];\n\n var c = input[2];\n\n var dp = new bool[c + 1];\n\n dp[0] = true;\n\n for (int i = Math.Min(a, b); i <= c; i++)\n {\n if (i - a >= 0 && dp[i - a]) dp[i] = true;\n if (i - b >= 0 && dp[i - b]) dp[i] = true;\n }\n\n Console.WriteLine(dp[c] ? \"Yes\" : \"No\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n public void Solve()\n {\n string[] input = Console.ReadLine().Split();\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n int c = int.Parse(input[2]);\n int n = c / a;\n for (int i = 0; i <= n; i++)\n {\n int x = c - i * a;\n int j = x / b;\n if(a * i + b * j == c)\n {\n Console.Write(\"Yes\");\n return;\n }\n }\n Console.Write(\"No\");\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver();\n solver.Solve();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace EbonyAndIvory {\n\n class Program {\n\n static void Main(string[] args) {\n\n string[] s = Console.ReadLine().Split(' ');\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int c = int.Parse(s[2]);\n\n for(int ax = 0; ax * a <= c; ax++) {\n for(int bx = 0; bx * b <= c; bx++) {\n if(c == (ax * a) + (bx * b)) { Console.WriteLine(\"Yes\"); return; }\n }\n }\n Console.WriteLine(\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var s = Console.ReadLine();\n var arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n\n var a = arr[0]; //Console.Read();\n var b = arr[1]; // Console.Read();\n var c = arr[2]; // Console.Read();\n\n int aSteps = c / a + 1;\n int bSteps = c / b + 1;\n\n for(int i = 0; i <= aSteps; i++)\n for (int j = 0; j <= bSteps; j++)\n {\n if (a * i + b * j == c)\n {\n Console.Write(\"Yes\");\n return;\n }\n }\n\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint[] Data = new int[3]; \n\n\n\t\t\tstring[] Temp;\n\t\t\tTemp = (Console.ReadLine ()).Split (' ');\n\t\t\tfor (int i = 0; i < 3; i++){\n\n\t\t\t\tint x;\n\t\t\t\tint.TryParse(Temp[i], out x);\n\t\t\t\tData[i] = x;\n\t\t\t\n\t\t\t}\n\n\n\t\t\tint T1 = Data[2];\n\t\t\twhile (T1 > 0 && Data[2] > 0) {\n\n\t\t\t\tT1 = Data [2];\n\t\t\t\tT1 = T1 % Data [1];\n\t\t\t\tif (T1 > 0)\n\t\t\t\t\tData[2] -= Data [0];\n\n\n\t\t\t}\n\n\n\t\t\tif (T1 == 0 || Data[2] == 0)\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n string temp;\n string [] data;\n int[] digitData = new int [3];\n int a, b, c, val = 1;\n bool ready = false;\n\n temp = Console.ReadLine();\n data = temp.Split(' ');\n for(int i = 0; i < 3; i++)\n digitData[i] = int.Parse(data[i]);\n\n a = digitData[0];\n b = digitData[1];\n c = digitData[2];\n\n for (int i = 0; i <= c / a; i++)\n {\n for (int j = 0; j <= c / b; j++)\n {\n val = i * a + j * b;\n if (val == c)\n {\n ready = true;\n break;\n }\n }\n if (ready)\n break;\n }\n\n if (!ready)\n Console.WriteLine(\"No\");\n else\n Console.WriteLine(\"Yes\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tpublic class Program\n\t{\n\t\tint max = 0;\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring num = Console.ReadLine();\n\t\t\tstring[] numArray = num.Split(null);\n\n\t\t\tint a = int.Parse(numArray[0]);\n\t\t\tint b = int.Parse(numArray[1]);\n\t\t\tint c = int.Parse(numArray[2]);\n\n\t\t\tif (c % a == 0 || c % b == 0)\n\t\t\t{\n\t\t\t\tConsole.Write(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint i = 0;\n\t\t\twhile (i <= c)\n\t\t\t{\n\t\t\t\tif ((i == c) || (c-i)%b ==0)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"Yes\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ti = i + a;\n\t\t\t}\n\n\t\t\tConsole.Write(\"No\");\n\t\t}\n\t\t\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[]y=Console.ReadLine().Split(' ');\n int a=int.Parse(y[0]);\n int b=int.Parse(y[1]);\n int n=int.Parse(y[2]);\n bool f=false;\n for(int i=0;i<5001;i++)\n {\n for(int j=0;j<5001;j++)\n if(a*i+b*j==n)\n {\n f=true;\n break;\n \n }\n }\n if(f)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LightDark\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int c = int.Parse(s[2]);\n int lim=c/a;\n bool ok = false;\n for (int i=0;i<=lim;i++)\n {\n int m = (c - i * a) / b;\n if (i*a+m*b==c)\n {\n ok = true;\n break;\n }\n }\n if (ok) Console.Write(\"Yes\"); else Console.Write(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tfor(;C>=0;C-=A){\n\t\t\tif(C%B==0){\n\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(\"No\");\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tint A,B,C;\n\tpublic Sol(){\n\t\tvar d=ria();\n\t\tA=d[0];B=d[1];C=d[2];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ebony_and_Ivory\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int a = Next();\n int b = Next();\n int c = Next();\n\n for (int i = 0; i <= c; i += a)\n {\n if ((c - i)%b == 0)\n return true;\n }\n return false;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n long first = MyConsoleInputStreamParser.GetLong, second = MyConsoleInputStreamParser.GetLong, all = MyConsoleInputStreamParser.GetLong;\n var answerFind = false;\n long i = 0;\n while (i * first <= all)\n {\n long g = 0;\n while (i * first + g * second < all)\n g++;\n if (i * first + g * second == all)\n {\n answerFind = true;\n break;\n }\n i++;\n }\n if (answerFind)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n\n public static class MyConsoleInputStreamParser\n {\n private static TextReader reader = new StreamReader(Console.OpenStandardInput());\n private static Queue currentLineStrings = new Queue();\n\n public static string GetLine { get { return reader.ReadLine(); } }\n\n public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue(GetStringArray); return currentLineStrings.Dequeue(); } }\n\n public static int GetInt { get { return int.Parse(GetString); } }\n\n public static long GetLong { get { return long.Parse(GetString); } }\n\n public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }\n\n public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }\n\n public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }\n\n public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }\n\n public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }\n\n public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }\n\n public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }\n\n public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }\n\n public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }\n\n public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }\n\n public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n\n object Get()\n {\n checked\n {\n var inp = ReadLongs();\n var a = inp[0];\n var b = inp[1];\n var c = inp[2];\n for (int i = 0; i <= c; i++)\n if (i % a == 0 && (c - i) % b == 0)\n return \"Yes\";\n return \"No\";\n }\n }\n\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class CodeForces\n {\n static void Main(string[] args)\n {\n //var n = int.Parse(Console.ReadLine());\n var arr = GetArray();\n var a = arr[0];\n var b = arr[1];\n var c = arr[2];\n Console.WriteLine(Solve(a,b,c) ? \"Yes\" : \"No\");\n }\n\n public static void Tests()\n {\n //\\\n }\n\n public static bool Solve(int a, int b, int c)\n {\n \n if (c >= a)\n {\n var m = c / a;\n\n for (var i = 1; i <= m; i++)\n {\n if ((c - (a * i)) % b == 0)\n return true;\n }\n }\n if (c >= b)\n {\n var m = c / b;\n for (var i = 1; i <= m; i++)\n {\n if ((c - (b * i)) % a == 0)\n return true;\n }\n }\n return false;\n }\n\n\n static int[] GetArray()\n {\n\n return Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n }\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(input[0]);\n int b = Convert.ToInt32(input[1]);\n int c = Convert.ToInt32(input[2]);\n for (int i = 0; a * i <= c; i++)\n {\n int a1 = a * i;\n int b1 = c - a1;\n if (b1 % b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Resources;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong a = inputs1[0];\n\t\t\tlong b = inputs1[1];\n\t\t\tlong c = inputs1[2];\n\n\t\t\tfor (long i = 0; i <= c / a; i++) \n\t\t\t{\n\t\t\t\tif ((c - i * a) % b == 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(\"No\");\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int a = int.Parse(inp[0]);\n int b = int.Parse(inp[1]);\n int c = int.Parse(inp[2]);\n\n if (c % a == 0 || c % b == 0)\n Console.WriteLine(\"Yes\");\n else\n {\n for (; c >= 0; c -= a)\n {\n if (c % b == 0)\n {\n Console.WriteLine(\"Yes\");\n Console.ReadLine();\n return;\n }\n }\n Console.WriteLine(\"No\");\n }\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n for (int i = 0; i <= c; i++)\n {\n for (int j = 0; j <= c; j++)\n {\n if (a*i + b*j == c)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n Console.WriteLine(\"No\");\n }\n\n static int Gcd(int a, int b)\n {\n if (b == 0)\n return a;\n return Gcd(b, a%b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine ().Split (' ');\n\t\t\tint a = int.Parse (s [0]);\n\t\t\tint b = int.Parse (s [1]);\n\t\t\tint c = int.Parse (s [2]);\n\t\t\tbool bb = false;\n\t\t\tfor (int n = 0; n <= c/a; n++) \n\t\t\t\tfor (int m = 0; m <= c/b; m++) \n\t\t\t\t\tif (n * a + m * b == c) {\n\t\t\t\t\t\tbb = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\tif(bb)\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace CompetitiveProgramming\n{\n class Program\n {\n static bool s_IsMultipleTestCases = false;\n static void Main(string[] args)\n {\n#if DEBUG\n var streamReader = new StreamReader(\"../../input.txt\", Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(\"../../output.txt\", false, Encoding.ASCII, 32768);\n var timer = new Stopwatch();\n timer.Start();\n#else\n var streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n#endif\n var reader = new InputReader(streamReader);\n\n var numberOfTest = 1;\n if (s_IsMultipleTestCases)\n {\n numberOfTest = reader.NextInt();\n }\n for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)\n {\n Task solver = new Task();\n solver.Solve(testNumber, reader, streamWriter);\n }\n#if DEBUG\n streamWriter.WriteLine(\"\\nEslapsed Time: \" + timer.ElapsedMilliseconds + \" ms\");\n#endif\n streamReader.Close();\n streamWriter.Close();\n }\n }\n\n class Task\n {\n const int MAXN = 100;\n long ans = 0;\n string res = string.Empty;\n public void Solve(int testNumber, InputReader reader, StreamWriter writer)\n {\n var a = reader.NextInt();\n var b = reader.NextInt();\n var c = reader.NextInt();\n\n\n res = \"No\";\n for (int i = 0; i * a <= c; i++)\n {\n for (int j = 0; j * b + i * a <= c; j++)\n {\n if (j * b + i * a == c)\n {\n res = \"Yes\";\n break;\n }\n }\n if (res == \"Yes\") break;\n }\n writer.WriteLine(res);\n }\n\n #region Utilities\n private string ConvertArrayToString(int[] arrs)\n {\n var sb = new StringBuilder();\n foreach (var item in arrs)\n {\n sb.Append(item);\n sb.Append(\"\\n\");\n }\n return sb.ToString();\n }\n\n private string ConvertArrayToString(long[] arrs)\n {\n var sb = new StringBuilder();\n foreach (var item in arrs)\n {\n sb.Append(item);\n sb.Append(\"\\n\");\n }\n return sb.ToString();\n }\n\n private string ConvertDoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private int Max(int a, int b)\n {\n return Math.Max(a, b);\n }\n\n private int Min(int a, int b)\n {\n return Math.Min(a, b);\n }\n\n private long Max(long a, long b)\n {\n return Math.Max(a, b);\n }\n\n private long Min(long a, long b)\n {\n return Math.Min(a, b);\n }\n\n private long GCD(long a, long b)\n {\n return a > 0 ? b : GCD(b, a % b);\n }\n\n private int GCD(int a, int b)\n {\n return a > 0 ? b : GCD(b, a % b);\n }\n\n #endregion\n }\n\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n int num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public long NextLong()\n {\n long num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n public int[] NIS(int n)\n {\n var arrs = new int[n];\n for (int i = 0; i < n; i++)\n {\n arrs[i] = NextInt();\n }\n return arrs;\n }\n\n public long[] NLS(int n)\n {\n var arrs = new long[n];\n for (int i = 0; i < n; i++)\n {\n arrs[i] = NextLong();\n }\n return arrs;\n }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int a = int.Parse(s[0]), b = int.Parse(s[1]), c = int.Parse(s[2]);\n bool sol = false;\n for (int i = 0; i * a <= c; i++) {\n int r = c - i * a;\n if (r % b == 0) {\n sol = true;\n break;\n }\n }\n if (sol) {\n Console.Write(\"YES\");\n } else {\n Console.Write(\"NO\");\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out) {\n\t\t\t\ttask.Solve(1, sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(int testNumber, InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar a = input[0];\n\t\t\tvar b = input[1];\n\t\t\tvar c = input[2];\n\t\t\tif (c % a == 0) {\n\t\t\t\tsw.WriteLine(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (c % b == 0) {\n\t\t\t\tsw.WriteLine(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (c % (a + b) == 0) {\n\t\t\t\tsw.WriteLine(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (c < a && c < b) {\n\t\t\t\tsw.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar max = 10001;\n\t\t\tvar dp = new bool[3, max];\n\t\t\tdp[0, 0] = true;\n\t\t\tfor (var i = a; i < max; i += a)\n\t\t\t\tdp[0, i] = true;\n\t\t\tfor (var i = 0; i < max; i++) {\n\t\t\t\tif (i % b == 0)\n\t\t\t\t\tdp[1, i] = true;\n\t\t\t\telse\n\t\t\t\t\tdp[1, i] = dp[0, i];\n\t\t\t}\n\t\t\tfor (var k = 0; k < max; k++) {\n\t\t\t\tif (k >= b || k >= a) {\n\t\t\t\t\tdp[2, k] = dp[1, k];\n\t\t\t\t\tif (k >= b)\n\t\t\t\t\t\tdp[2, k] = dp[2, k] || dp[1, k - b] || dp[2, k - b];\n\t\t\t\t\tif (k >= a)\n\t\t\t\t\t\tdp[2, k] = dp[2, k] || dp[1, k - a] || dp[2, k - a];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tdp[2, k] = dp[1, k];\n\t\t\t}\n\t\t\tsw.WriteLine(dp[2, c] ? \"Yes\" : \"No\");\n\t\t}\n\t}\n\n\tinternal class InputReader : IDisposable\n\t{\n\t\tprivate bool isDispose;\n\t\tprivate readonly TextReader sr;\n\n\t\tpublic InputReader(TextReader stream)\n\t\t{\n\t\t\tsr = stream;\n\t\t}\n\n\t\tpublic void Dispose()\n\t\t{\n\t\t\tDispose(true);\n\t\t\tGC.SuppressFinalize(this);\n\t\t}\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tvar result = sr.ReadLine();\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int NextInt32()\n\t\t{\n\t\t\treturn Int32.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextInt64()\n\t\t{\n\t\t\treturn Int64.Parse(NextString());\n\t\t}\n\n\t\tpublic string[] NextSplitStrings()\n\t\t{\n\t\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t}\n\n\t\tpublic T[] ReadArray(Func func)\n\t\t{\n\t\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t\t}\n\n\t\tprotected void Dispose(bool dispose)\n\t\t{\n\t\t\tif (!isDispose) {\n\t\t\t\tif (dispose)\n\t\t\t\t\tsr.Close();\n\t\t\t\tisDispose = true;\n\t\t\t}\n\t\t}\n\n\t\t~InputReader()\n\t\t{\n\t\t\tDispose(false);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace OlimpA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] words = s.Split(' ');\n\n int a = Convert.ToInt32(words[0]);\n int b = Convert.ToInt32(words[1]);\n int c = Convert.ToInt32(words[2]);\n int countX = 0,countY = 0;\n int check = 0;\n bool pos = false;\n\n while (check < c)\n {\n countX++;\n check = countX * a;\n }\n if (check == c)\n pos = true;\n check = 0;\n while (check < c)\n {\n countY++;\n check = countY * b;\n }\n if (check == c)\n pos = true;\n\n for (int i = 0; i <= countX; i++)\n for (int j = 0; j <= countY;j++ )\n {\n if ((a * i + j * b) == c)\n { \n pos = true;\n goto Final;\n }\n\n }\n\n Final:\n if (pos)\n Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class Manthan1\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string strT = Console.ReadLine();\n string[] strParams;\n strParams = strT.Split(new char[] { ' ' });\n int a = int.Parse(strParams[0]);\n int b = int.Parse(strParams[1]);\n int c = int.Parse(strParams[2]);\n\n\n if (c % a == 0 || c % b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n int a1 = c / a;\n int b1 = c / b;\n int r = 1;\n\n int ca = a1 * a;\n int cb = b;\n //for (int i = a1, j = 1; i > 0 && j <= b1; i--, j ++)\n while (ca > 0)\n {\n if ((c - ca) % b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n ca -= a;\n }\n\n \n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] numbersString = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(numbersString[0]);\n int b = Convert.ToInt32(numbersString[1]);\n int c = Convert.ToInt32(numbersString[2]);\n \n bool temp = false;\n for (int i = 0; i <= c; i++)\n {\n for (int j = 0; j <= c; j++)\n {\n if (temp == false)\n {\n int max = (i * a) + (j * b);\n if (max == c)\n {\n temp = true;\n break;\n }\n else if (max > c)\n {\n break;\n }\n }\n }\n if (temp == true) \n break;\n }\n if (temp == true)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] x = new string[3];\n int a, b, c;\n int j = 0;\n bool f=false;\n for (int i = 0; i < s.Length; i++)\n {if(s.ElementAt(i)==' ')\n {\n j++;\n }\n x[j] += s.ElementAt(i);\n }\n a = int.Parse(x[0]);\n b = int.Parse(x[1]);\n c = int.Parse(x[2]);\n for(int i = 0; i <= c / a; i++)\n {\n for(int k = 0; k <= c / b; k++)\n {\n if (i * a + k * b == c) { f = true; break; }\n \n }\n }\n if (f) Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n\n var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = num[0];\n int b = num[1];\n int c = num[2];\n\n int tmp = c;\n bool pos = false;\n if (c % a==0 || c % b==0) pos = true;\n while(tmp>=b)\n {\n if (divisible(tmp, a))\n {\n pos = true;\n break;\n }\n else tmp -= b;\n }\n if (!pos)\n {\n tmp = c;\n while (tmp >= a)\n {\n if (divisible(tmp, b))\n {\n pos = true;\n break;\n }\n else tmp -= a;\n }\n }\n Console.WriteLine((pos) ?\"Yes\" : \"No\");\n\n\n\n\n\n\n //Console.WriteLine();\n\n\n\n\n\n //Console.Read();\n\n\n }\n\n public static bool divisible(int c, int d)\n {\n return c % d == 0 ? true : false;\n }\n\n\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF633A {\n class Program {\n static void Main(string[] args) {\n //a + b a linear combination of c?\n string[] input = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(input[0]);\n int b = Convert.ToInt32(input[1]);\n int c = Convert.ToInt32(input[2]);\n bool canDo = false;\n\n for(int x = 0; x * a <= c ; x++) {\n for(int y = 0; y * b <= c; y++) {\n if(a*x + b*y == c) {\n canDo = true;\n }\n }\n }\n\n if(canDo) {\n Console.WriteLine(\"Yes\");\n } else {\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n private void Go()\n {\n int a = GetInt();\n int b = GetInt();\n int c = GetInt();\n\n int x = 0;\n while (x <= c)\n {\n if ((c - x) % b == 0)\n {\n Wl(\"YES\");\n return;\n }\n x += a;\n }\n\n Wl(\"NO\");\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class Program\n {\n\n #region input\n\n static long readLong() {\n long num;\n long.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static ulong readULong() {\n ulong num;\n ulong.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static int readInt() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static bool readBool() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num != 0;\n }\n\n static long[] readLongs() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n long[] parsed = new long[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n long.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static int[] readInts() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n int.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static void readInts(out int a,out int b) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n int.TryParse(nums[0],out a);\n int.TryParse(nums[1],out b);\n }\n\n static BitArray readBools() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != \"0\") {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static BitArray readBools(string off) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != off) {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static void waist() {\n Console.ReadLine();\n }\n\n #endregion\n\n #region utility\n\n\n static int minIndex(List l) where T : IComparable {\n if(l == null || l.Count == 0) {\n return -1;\n }\n int min = 0;\n for(int i = 0; i < l.Count; i++) {\n if(l[i].CompareTo(l[min]) < 0) {\n min = i;\n }\n }\n return min;\n }\n\n static int maxIndex(List l) where T : IComparable {\n if(l == null || l.Count == 0) {\n return -1;\n }\n int min = 0;\n for(int i = 0; i < l.Count; i++) {\n if(l[i].CompareTo(l[min]) > 0) {\n min = i;\n }\n }\n return min;\n }\n\n static void print(List l) {\n for(int i = 0; i < l.Count; i++) {\n if(i != 0) {\n Console.Write(\" \");\n }\n Console.Write((l[i]));\n }\n Console.WriteLine();\n }\n\n static long largeModolu(long a,long b,long m) {\n long prev = a;\n long sum = (b & 1) > 0 ? a : 1;\n int digits = (int)(Math.Ceiling(Math.Log(b,2)));\n for(int i = 1; i < digits; i++) {\n prev = (prev * prev) % (m);\n if((b & (1L << i)) > 0) {\n sum = (sum * prev) % (m);\n }\n }\n return sum;\n }\n\n static long GCD(long a,long b) {\n long temp;\n if(a > b) {\n temp = b;\n b = a;\n a = temp;\n }\n while(b != 0) {\n temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n }\n\n class SortableKVP where T : IComparable\n {\n List> data { set; get; }\n\n public int count\n {\n get\n {\n return data.Count;\n }\n }\n\n public T this[int index]\n {\n get\n {\n return data[index].Item2;\n }\n }\n\n public int originalIndex(int sortedIndex) {\n return data[sortedIndex].Item1;\n }\n\n public void sort() {\n data.Sort((a,b) => a.Item2.CompareTo(b.Item2));\n }\n\n public void add(T item) {\n data.Add(new Tuple(data.Count,item));\n }\n\n public void removeAt(int sortedIndex) {\n data.RemoveAt(sortedIndex);\n }\n\n public SortableKVP() {\n data = new List>();\n }\n\n public SortableKVP(T[] data) {\n this.data = new List>(data.Length);\n for(int i = 0; i < data.Length; i++) {\n this.data.Add(new Tuple(i,data[i]));\n }\n }\n }\n\n #endregion\n\n static void Main(string[] args) {\n int[] inp = readInts();\n for(int i = 0; inp[0] * i <= inp[2]; i++) {\n if((inp[2] - i * inp[0]) % inp[1] == 0) {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n }\n\n static void seven() {\n int x = readInt();\n int y = readInt();\n if(y == 0) {\n Console.Write(1);\n return;\n }\n long[] dp = new long[(int)(Math.Log(y,2) + 1)];\n long mult = 1;\n dp[0] = x;\n if((y & 1) == 1) {\n mult = dp[0];\n }\n for(int i = 1; i < dp.Length; i++) {\n dp[i] = dp[i-1] * dp[i - 1];\n if((y & (1 << i)) != 0) {\n mult *= dp[i];\n }\n }\n Console.WriteLine(mult);\n\n }\n\n static void twelve() {\n int[] a = readInts();\n int[] b = readInts();\n int x = readInt();\n Dictionary h = new Dictionary();\n for(int i = 0; i < b.Length; i++) {\n h.Add(b[i],i);\n }\n for(int i = 0; i < a.Length; i++) {\n if(h.ContainsKey(x - a[i])) {\n Console.Write(i + \" \" + h[x - a[i]]);\n break;\n }\n }\n }\n\n static void ten() {\n int[] a = readInts();\n int[] b = readInts();\n int k = readInt();\n int i = 0, j = 0;\n for(int c = 0; c < k; c++) {\n if(i == a.Length || (j != b.Length && a[i] < b[j])) {\n if(c == k - 1) {\n Console.WriteLine(a[i]);\n }\n ++i;\n } else {\n if(c == k - 1) {\n Console.WriteLine(b[j]);\n }\n ++j;\n }\n }\n }\n } \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class StringInt\n\t\t{\n\t\t\tpublic string x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class SIComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(StringInt x, StringInt y)\n\t\t\t{\n\t\t\t\treturn x.x.CompareTo(y.x);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List getLongList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long getLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Edge\n\t\t{\n\t\t\tpublic int v;\n\n\t\t\tpublic int w;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic bool was;\n\t\t}\n\n\t\tpublic static bool isPrime(int x)\n\t\t{\n\t\t\tfor (var i = 2; i * i <= x; ++i)\n\t\t\t\tif (x % i == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getList();\n\t\t\tfor (var i = 0; i * l[0] <= l[2]; ++i)\n\t\t\t{\n\t\t\t\tif ((l[2] - i * l[0]) % l[1] == 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"No\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nclass Program\n{\n //////////////////////////////////////////////////\n\n void Solution()\n {\n var a = ri;\n var b = ri;\n var c = ri;\n for (int i = 0; i <= 10000; i++)\n {\n for (int j = 0; j <= 10000; j++)\n {\n if (a * i + b * j == c)\n {\n wln(\"Yes\");\n return;\n }\n }\n }\n wln(\"No\");\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o+\" \"); }\n static void wrt(object o) { Console.Write(o); } \n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b!=0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _633A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = s[0]; var b = s[1]; var c = s[2];\n int i = 0;\n bool exists = false;\n while (!exists && a * i <= c)\n {\n if ((c - a*i) % b == 0)\n {\n exists = true;\n break;\n }\n i++;\n }\n\n Console.WriteLine(exists? \"Yes\": \"No\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n int[] d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n decimal a = d[0], b = d[1], c = d[2];\n\n\n decimal x = c / a, y = c / b;\n bool flag = false;\n\n for (int i = 0; i <= x; i++)\n {\n for (int ii = 0; ii <= y; ii++)\n {\n if (a * i + b * ii == c)\n {\n flag = true;\n break;\n }\n }\n if (flag)\n {\n break;\n }\n }\n Console.WriteLine(flag ? \"Yes\" : \"No\");\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ebonyAndIvory\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int a = Convert.ToInt32(input.Split()[0]);\n int b = Convert.ToInt32(input.Split()[1]);\n int c = Convert.ToInt32(input.Split()[2]);\n int aranan = 0;\n\n \n \n for (int i = 0; i <= 5000 ; i++)\n {\n for (int j = 0; j <= 5000 ; j++)\n {\n aranan = i * a + j * b;\n if (aranan == c)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else if (aranan >= 10000)\n {\n break;\n }\n }\n }\n Console.WriteLine(\"No\");\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n\n for (int i = 0; a * i <= c; i++)\n if ((c - i * a) % b == 0)\n {\n Write(\"Yes\");\n return;\n }\n\n Write(\"No\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar z = Console.ReadLine();\n\t\t\tList x = new List();\n\t\t\tforeach (String s in z.Split(' ') ){\n\t\t\t\tx.Add(int.Parse(s));\n\t\t\t}\n\t\t\tint a = x[0];\n\t\t\tint b = x[1];\n\t\t\tint c = x[2];\n\t\t\tint i = 0;\n\t\t\tint j = 0;\n\t\t\t\n\t\t\tfor (i = 0; a*i <= c; i++){\n\t\t\t\tfor (j = 0; b*j <= c; j++){\n\t\t\t\t\tif (a*i + b*j == c){\n\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(\"No\");\n\t\t\treturn;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace A633{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int[] abc = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n // a * x + b * y = c\n int ebonyShots = 0;\n int ivoryShots = 0;\n if(abc[2] % abc[0] == 0 || abc[2] % abc[1] == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n ebonyShots++;\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n ivoryShots++;\n }\n if (ebonyShots * abc[0] + ivoryShots * abc[1] == abc[2])\n {\n Console.WriteLine(\"Yes\");\n return;\n } else\n {\n ivoryShots = 0;\n }\n }\n Console.WriteLine(\"No\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n \n class Program\n {\n \n static void Main(string[] args)\n {\n args = Console.ReadLine().Split();\n int a = int.Parse(args[0]);\n int b = int.Parse(args[1]);\n int c = int.Parse(args[2]);\n while (c > 0 && c % a != 0)\n c -= b;\n Console.WriteLine(c>=0? \"Yes\":\"No\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var xs = Console.ReadLine().Split().Select(long.Parse).ToList();\n var a = xs[0];\n var b = xs[1];\n var c = xs[2];\n\n var maxI = c / a;\n var maxJ = c / b;\n\n for (var i = 0; i <= maxI; i++)\n {\n for (var j = 0; j <= maxJ; j++)\n {\n if (a * i + b * j == c)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var str = Console.ReadLine().Split(' ');\n var a = int.Parse(str[0]);\n var b = int.Parse(str[1]);\n var c = int.Parse(str[2]);\n for (int i = 0; c-i*b>=0; ++i)\n {\n if ((c - i * b) % a == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n //Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint[] Data = new int[3]; \n\n\n\t\t\tstring[] Temp;\n\t\t\tTemp = (Console.ReadLine ()).Split (' ');\n\t\t\tfor (int i = 0; i < 3; i++){\n\n\t\t\t\tint x;\n\t\t\t\tint.TryParse(Temp[i], out x);\n\t\t\t\tData[i] = x;\n\t\t\t\n\t\t\t}\n\n\n\t\t\tint T1 = Data[2];\n\t\t\twhile (T1 > 0) {\n\n\t\t\t\tT1 = Data [2];\n\t\t\t\tT1 = T1 % Data [1];\n\t\t\t\tif (T1 > 0)\n\t\t\t\t\tData[2] -= Data [0];\n\n\n\t\t\t}\n\n\n\t\t\tif (T1 == 0)\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint[] Data = new int[3]; \n\n\n\t\t\tstring[] Temp;\n\t\t\tTemp = (Console.ReadLine ()).Split (' ');\n\t\t\tfor (int i = 0; i < 3; i++){\n\n\t\t\t\tint x;\n\t\t\t\tint.TryParse(Temp[i], out x);\n\t\t\t\tData[i] = x;\n\t\t\t\n\t\t\t}\n\n\n\t\t\tint T1 = Data[0];\n\t\t\twhile (T1 > 0) {\n\n\t\t\t\tT1 = Data [0];\n\t\t\t\tT1 = T1 % Data [1];\n\t\t\t\tif (T1 > 0)\n\t\t\t\t\tData[0] -= Data [2];\n\n\n\t\t\t}\n\n\n\t\t\tif (T1 == 0)\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint[] Data = new int[3]; \n\n\n\t\t\tstring[] Temp;\n\t\t\tTemp = (Console.ReadLine ()).Split (' ');\n\t\t\tfor (int i = 0; i < 3; i++){\n\n\t\t\t\tint x;\n\t\t\t\tint.TryParse(Temp[i], out x);\n\t\t\t\tData[i] = x;\n\t\t\t\n\t\t\t}\n\n\n\t\t\tint T1 = Data[2];\n\t\t\twhile (T1 > 0 && Data[2] > 0) {\n\n\t\t\t\tT1 = Data [2];\n\t\t\t\tT1 = T1 % Data [1];\n\t\t\t\tif (T1 > 0)\n\t\t\t\t\tData[2] -= Data [0];\n\n\n\t\t\t}\n\n\n\t\t\tif (T1 == 0)\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tint[] Data = new int[4]; \n\n\n\t\t\tstring[] Temp;\n\t\t\tTemp = (Console.ReadLine ()).Split (' ');\n\t\t\tfor (int i = 2; i >= 0; i--){\n\n\t\t\t\tint x;\n\t\t\t\tint.TryParse(Temp[2 - i], out x);\n\t\t\t\tData[i] = x;\n\t\t\t\n\t\t\t}\n\n\n\t\t\tint T1 = Data[0]; Data [3] = Data [1] + Data [2];\n\t\t\tfor (int i = 3; i >= 1 && T1 != 0; i--) {\n\n\t\t\t\tT1 = Data[0] % Data [i];\n\n\t\t\t}\n\n\n\t\t\tif (T1 == 0)\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[]y=Console.ReadLine().Split(' ');\n int a=int.Parse(y[0]);\n int b=int.Parse(y[1]);\n int n=int.Parse(y[2]);\n bool f=false;\n for(int i=0;i<1000;i++)\n {\n for(int j=0;j<1000;j++)\n if(a*i+b*j==n)\n {\n f=true;\n break;\n \n }\n }\n if(f)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[]y=Console.ReadLine().Split(' ');\n int a=int.Parse(y[0]);\n int b=int.Parse(y[1]);\n int n=int.Parse(y[2]);\n bool f=false;\n for(int i=0;i<100;i++)\n {\n for(int j=0;j<100;j++)\n if(a*i+b*j==n)\n {\n f=true;\n break;\n \n }\n }\n if(f)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[]y=Console.ReadLine().Split(' ');\n int a=int.Parse(y[0]);\n int b=int.Parse(y[1]);\n int n=int.Parse(y[2]);\n bool f=false;\n for(int i=0;i<5000;i++)\n {\n for(int j=0;j<5000;j++)\n if(a*i+b*j==n)\n {\n f=true;\n break;\n \n }\n }\n if(f)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "/*\n * User: \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n * Date: 27.02.2016\n * Time: 15:49\n\nA. \u04b8\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 2 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 256 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd.\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \u04b8\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd a \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \u04b8\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd c \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd a, b \ufffd c (1 <= a, b <= 100, 1 <= c <= 10 000) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd,\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \u04b8\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd c \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffdYes\ufffd (\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd), \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffdNo\ufffd (\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n4 6 15\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nNo\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n3 2 7\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nYes\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n6 11 6\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nYes\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 1 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \u04b8\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd 2 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 1\ufffd3 + 2\ufffd2 = 7 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd.\n\n */\n\nusing System;\n\nnamespace Edu003A\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring ss = Console.ReadLine ();\n\t\t\tstring [] s = ss.Split (' ');\n\t\t\tint a = int.Parse (s [0]);\n\t\t\tint b = int.Parse (s [1]);\n\t\t\tint c = int.Parse (s [2]);\n\n\t\t\tbool ok = false;\n\t\t\tfor ( int i=0; i < c; i++ )\n\t\t\t\tif ( a*i <= c && (c - a*i) % b == 0 )\n\t\t\t\t{\n\t\t\t\t\tok = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tif ( ok )\n\t\t\t\tConsole.WriteLine (\"Yes\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\n//\t\t\tConsole.ReadKey(true);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class CodeForces\n {\n static void Main(string[] args)\n {\n //var n = int.Parse(Console.ReadLine());\n var arr = GetArray();\n var a = arr[0];\n var b = arr[1];\n var c = arr[2];\n Console.WriteLine(Solve(a,b,c) ? \"Yes\" : \"No\");\n }\n\n public static void Tests()\n {\n //\\\n }\n\n public static bool Solve(int a, int b, int c)\n {\n if ((c - a) % b == 0)\n return true;\n if ((c - b) % a == 0)\n return true;\n\n var m = c / a;\n for (var i = 1; i <= m; i++)\n {\n if ((c - (a * i)) % b == 0)\n return true;\n }\n m = c / b;\n for (var i = 1; i <= m; i++)\n {\n if ((c - (b * i)) % a == 0)\n return true;\n }\n\n return false;\n }\n\n\n static int[] GetArray()\n {\n\n return Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n }\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class CodeForces\n {\n static void Main(string[] args)\n {\n //var n = int.Parse(Console.ReadLine());\n var arr = GetArray();\n var a = arr[0];\n var b = arr[1];\n var c = arr[2];\n Console.WriteLine(Solve(a,b,c) ? \"Yes\" : \"No\");\n }\n\n public static void Tests()\n {\n //\\\n }\n\n public static bool Solve(int a, int b, int c)\n {\n \n if (c > a)\n {\n var m = c / a;\n\n for (var i = 1; i <= m; i++)\n {\n if ((c - (a * i)) % b == 0)\n return true;\n }\n }\n if (c > b)\n {\n var m = c / b;\n for (var i = 1; i <= m; i++)\n {\n if ((c - (b * i)) % a == 0)\n return true;\n }\n }\n return false;\n }\n\n\n static int[] GetArray()\n {\n\n return Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = data[0];\n var b = data[1];\n var c = data[2];\n Console.WriteLine(c% Gcd(a,b) == 0? \"Yes\": \"No\");\n }\n\n static int Gcd(int a, int b)\n {\n if (b == 0)\n return a;\n return Gcd(b, a%b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var str = Console.ReadLine().Split(' ');\n var a = int.Parse(str[0]);\n var b = int.Parse(str[1]);\n var c = int.Parse(str[2]);\n for (int i = 1; i*b<=10000; ++i)\n {\n if ((c - i*b)%a == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n //Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var str = Console.ReadLine().Split(' ');\n var a = int.Parse(str[0]);\n var b = int.Parse(str[1]);\n var c = int.Parse(str[2]);\n for (int i = 1; i<=1000000; ++i)\n {\n if ((c - i*b)%a == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n //Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var str = Console.ReadLine().Split(' ');\n var a = int.Parse(str[0]);\n var b = int.Parse(str[1]);\n var c = int.Parse(str[2]);\n for (int i = 1; i*b<=10000; ++i)\n {\n if ((c - i * b) % a == 0 && (c - i * b) / a > 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n //Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var str = Console.ReadLine().Split(' ');\n var a = int.Parse(str[0]);\n var b = int.Parse(str[1]);\n var c = int.Parse(str[2]);\n for (int i = 0; i*b<=10000; ++i)\n {\n if ((c - i * b) % a == 0 && (c - i * b) / a > 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n Console.WriteLine(\"No\");\n //Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForCodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] array = s.Split(' ');\n int[] numbers = new int[3];\n for (int i = 0; i < array.Length; i++)\n numbers[i] = int.Parse(array[i]);\n bool flag = false;\n\n for (int i = 0; i < (int) (numbers[2]/numbers[0]); i++)\n {\n for (int j = 0; j < (int) (numbers[2]/numbers[0]); j++)\n {\n if (numbers[0]*i + numbers[1]*j == numbers[2])\n {\n flag = true;\n break;\n }\n }\n }\n Console.WriteLine(flag ? \"Yes\" : \"No\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForCodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] array = s.Split(' ');\n int[] numbers = new int[3];\n for (int i = 0; i < array.Length; i++)\n numbers[i] = int.Parse(array[i]);\n bool flag = false;\n\n for (int i = 0; i <= (int) (numbers[2]/numbers[0]); i++)\n {\n for (int j = 0; j <= (int) (numbers[2]/numbers[0]); j++)\n {\n if (numbers[0]*i + numbers[1]*j == numbers[2])\n {\n flag = true;\n break;\n }\n }\n }\n Console.WriteLine(flag ? \"Yes\" : \"No\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n long first = MyConsoleInputStreamParser.GetLong, second = MyConsoleInputStreamParser.GetLong, all = MyConsoleInputStreamParser.GetLong;\n var answerFind = false;\n long i = 0;\n while (i * first <= all)\n {\n long g = 0;\n while (i * first + g * second < all)\n g++;\n if (i * first + g * first == all)\n {\n answerFind = true;\n break;\n }\n i++;\n }\n //for (int i = 1; i < all / first; i++)\n // for (int g = 1; g < all / second; g++)\n // {\n // var temp = i * first + g * second;\n // if (temp == all)\n // {\n // answerFind = true;\n // break;\n // }\n // if (temp > all)\n // break;\n // }\n if (answerFind)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n\n public static class MyConsoleInputStreamParser\n {\n private static TextReader reader = new StreamReader(Console.OpenStandardInput());\n private static Queue currentLineStrings = new Queue();\n\n public static string GetLine { get { return reader.ReadLine(); } }\n\n public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue(GetStringArray); return currentLineStrings.Dequeue(); } }\n\n public static int GetInt { get { return int.Parse(GetString); } }\n\n public static long GetLong { get { return long.Parse(GetString); } }\n\n public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }\n\n public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }\n\n public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }\n\n public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }\n\n public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }\n\n public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }\n\n public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }\n\n public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }\n\n public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }\n\n public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }\n\n public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var c = input[2];\n if (c%a == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%b == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%(a + b) == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c < a && c < b)\n {\n sw.WriteLine(\"No\");\n return;\n }\n var max = 10001;\n var dp = new bool[3, max];\n dp[0, 0] = true;\n for (var i = a; i < max; i+=a)\n {\n dp[0, i] = true;\n }\n for (var i = 0; i < max; i++)\n {\n if (i%b == 0)\n {\n dp[1, i] = true;\n }\n else\n {\n dp[1, i] = dp[0, i];\n }\n }\n for (var k = 0; k < max; k++)\n {\n if (k >= b || k >= a)\n {\n dp[2, k] = dp[1, k];\n if (k >= b)\n {\n dp[2, k] = dp[2, k] || dp[1, k - b];\n }\n if (k >= a)\n {\n dp[2, k] = dp[2, k] || dp[1, k - a];\n }\n }\n else\n {\n dp[2, k] = dp[1, k];\n }\n }\n sw.WriteLine(dp[2, c] ? \"Yes\" : \"No\");\n }\n }\n\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var c = input[2];\n if (c%a == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%b == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%(a + b) == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c < a && c < b)\n {\n sw.WriteLine(\"No\");\n return;\n }\n var max = 10001;\n var dp = new bool[3, 10001];\n for (var i = a; i < max; i++)\n {\n dp[0, a] = true;\n }\n for (var i = 0; i < max; i++)\n {\n if (i%b == 0)\n {\n dp[1, i] = true;\n }\n else\n {\n dp[1, i] = dp[0, i];\n }\n }\n for (var k = 0; k < max; k++)\n {\n if (k >= b || k >= a)\n {\n dp[2, k] = dp[1, k];\n if (k >= b)\n {\n dp[2, k] = dp[2, k] || dp[1, k - b];\n }\n if (k >= a)\n {\n dp[2, k] = dp[2, k] || dp[1, k - a];\n }\n }\n else\n {\n dp[2, k] = dp[1, k];\n }\n }\n sw.WriteLine(dp[2, c] ? \"Yes\" : \"No\");\n }\n }\n\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var c = input[2];\n if (c%a == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%b == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c%(a + b) == 0)\n {\n sw.WriteLine(\"Yes\");\n return;\n }\n if (c < a && c < b)\n {\n sw.WriteLine(\"No\");\n return;\n }\n var max = 10001;\n var dp = new bool[3, max];\n dp[0, 0] = true;\n for (var i = a; i < max; i+=a)\n {\n dp[0, a] = true;\n }\n for (var i = 0; i < max; i++)\n {\n if (i%b == 0)\n {\n dp[1, i] = true;\n }\n else\n {\n dp[1, i] = dp[0, i];\n }\n }\n for (var k = 0; k < max; k++)\n {\n if (k >= b || k >= a)\n {\n dp[2, k] = dp[1, k];\n if (k >= b)\n {\n dp[2, k] = dp[2, k] || dp[1, k - b];\n }\n if (k >= a)\n {\n dp[2, k] = dp[2, k] || dp[1, k - a];\n }\n }\n else\n {\n dp[2, k] = dp[1, k];\n }\n }\n sw.WriteLine(dp[2, c] ? \"Yes\" : \"No\");\n }\n }\n\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] numbersString = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(numbersString[0]);\n int b = Convert.ToInt32(numbersString[1]);\n int c = Convert.ToInt32(numbersString[2]);\n bool temp = false;\n for (int i = 1; i <= a; i++)\n {\n for (int j = 1; j <= b; j++)\n {\n if (temp == false)\n {\n if ((i * a + j * b) == c)\n {\n temp = true;\n }\n }\n }\n }\n if (temp == true)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] numbersString = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(numbersString[0]);\n int b = Convert.ToInt32(numbersString[1]);\n int c = Convert.ToInt32(numbersString[2]);\n bool temp = false;\n for (int i = 0; i <= a; i++)\n {\n for (int j = 0; j <= b; j++)\n {\n if (temp == false)\n {\n if ((i * a + j * b) == c)\n {\n temp = true;\n }\n }\n }\n }\n if (temp == true)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n \n class Program\n {\n \n static void Main(string[] args)\n {\n args = Console.ReadLine().Split();\n int a = int.Parse(args[0]);\n int b = int.Parse(args[1]);\n int c = int.Parse(args[2]);\n bool sta = false;\n if (c%a==0 || c%b==0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n int min = Math.Min(a,b);\n c -= (a + b);\n for (; c>=0;)\n {\n\n if (min==a)\n {\n c -= a;\n if (c==0)\n {\n sta = true;\n break;\n }\n \n }\n else\n {\n c -= b;\n if (c == 0)\n {\n sta = true;\n break;\n }\n }\n }\n if (sta)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tstring[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tint a = Int32.Parse(split[0]);\n\t\t\tint b = Int32.Parse(split[1]);\n\t\t\tint c = Int32.Parse(split[2]);\n\t\t\tint gun1 = c % a;\n\t\t\tgun1 = gun1 % b;\n\t\t\tint gun2 = c % b;\n\t\t\tgun2 = gun2 % a;\n\t\t\tif (gun1 == 0 || gun2 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tstring[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tint a = Int32.Parse(split[0]);\n\t\t\tint b = Int32.Parse(split[1]);\n\t\t\tint c = Int32.Parse(split[2]);\n\t\t\tint gun1 = c;\n\t\t\tbool solved = false;\n\t\t\twhile (gun1 > 0)\n\t\t\t{\n\t\t\t\tgun1 -= a;\n\t\t\t\tif (gun1 % b == 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint gun2 = c;\n\t\t\twhile (gun2 > 0)\n\t\t\t{\n\t\t\t\tgun2 -= b;\n\t\t\t\tif (gun2 % a == 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (solved)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tstring[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\\t' });\n\t\t\tint a = Int32.Parse(split[0]);\n\t\t\tint b = Int32.Parse(split[1]);\n\t\t\tint c = Int32.Parse(split[2]);\n\t\t\tint gun1 = c;\n\t\t\tbool solved = false;\n\t\t\twhile (gun1 > 0)\n\t\t\t{\n\t\t\t\tgun1 -= a;\n\t\t\t\tif (gun1 % b == 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint gun2 = c;\n\t\t\twhile (gun2 > 0)\n\t\t\t{\n\t\t\t\tgun2 -= b;\n\t\t\t\tif (gun2 % a == 0)\n\t\t\t\t{\n\t\t\t\t\tsolved = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (solved)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "using System;\n\nnamespace A633{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int[] abc = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n // a * x + b * y = c\n int ebonyShots = 0;\n int ivoryShots = 0;\n if(abc[2] % abc[0] == 0 || abc[2] % abc[1] == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n ivoryShots++;\n }\n ebonyShots++;\n if(ebonyShots * abc[0] + ivoryShots * abc[1] == abc[2])\n {\n Console.WriteLine(\"Yes\");\n return;\n } else\n {\n ivoryShots = 0;\n }\n }\n Console.WriteLine(\"No\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace A633{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int[] abc = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n // a * x + b * y = c\n int ebonyShots = 0;\n int ivoryShots = 0;\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n ebonyShots++;\n while (ebonyShots * abc[0] + ivoryShots * abc[1] < abc[2])\n {\n ivoryShots++;\n }\n if(ebonyShots * abc[0] + ivoryShots * abc[1] == abc[2])\n {\n Console.WriteLine(\"Yes\");\n return;\n } else\n {\n ivoryShots = 0;\n }\n }\n Console.WriteLine(\"No\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n\n var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = num[0];\n int b = num[1];\n int c = num[2];\n\n int tmp = c;\n bool pos = false;\n if (c == a || c == b) pos = true;\n while(tmp>=b)\n {\n if (divisible(tmp, a))\n {\n pos = true;\n break;\n }\n else tmp -= b;\n }\n if (!pos)\n {\n tmp = c;\n while (tmp >= a)\n {\n if (divisible(tmp, b))\n {\n pos = true;\n break;\n }\n else tmp -= a;\n }\n }\n Console.WriteLine((pos) ?\"Yes\" : \"No\");\n\n\n\n\n\n\n //Console.WriteLine();\n\n\n\n\n\n //Console.Read();\n\n\n }\n\n public static bool divisible(int c, int d)\n {\n return c % d == 0 ? true : false;\n }\n\n\n }\n\n\n}\n"}], "src_uid": "e66ecb0021a34042885442b336f3d911"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\n\t\t\tList Num = new List ();\n\t\t\tint m = int.Parse(Console.ReadLine ());\n\n\t\t\tfor (int i = 1; i < 1000000; i++) {\n\n\t\t\t\tint t = zero_Fact (i);\n\t\t\t\tif (t == m)\n\t\t\t\t\tNum.Add (i);\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Num.Count);\n\t\t\tstring Temp = \"\";\n\t\t\tfor (int i = 0; i < Num.Count; i++) {\n\n\t\t\t\tTemp += Num [i] + \" \";\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Temp);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\n\n\t\tpublic static int zero_Fact (int N) {\n\n\t\t\tint Count = 0;\n\t\t\twhile (N > 0) {\n\n\t\t\t\tN /= 5;\n\t\t\t\tCount += N;\n\n\t\t\t}\n\n\t\t\treturn Count;\n\n\t\t}\n\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n var count = 0L;\n\n for (var i = 1; count <= m; i++)\n {\n count = GetCount(i);\n\n if (count == m)\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i, 5)));\n return;\n }\n }\n\n Print(0);\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\tprivate static int count(int a)\n\t\t{\n\t\t\tint result = 0;\n\t\t\twhile (a > 0)\n\t\t\t{\n\t\t\t\ta /= 5;\n\t\t\t\tresult += a;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString input = null;\n\t\t\tString output = null;\n#if LOCALTEST\n\t\t\tinput = \"../../in.txt\";\n\t\t\toutput = \"../../out.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(input);\n\t\t\tFastWriter writer = new FastWriter(output);\n\n\t\t\tint m = reader.nextInt();\n\n\t\t\tint left = m, right = m * 5 + 5;\n\t\t\tint mid = -1, t = -1;\n\t\t\twhile (left < right)\n\t\t\t{\n\t\t\t\tmid = (left + right) / 2;\n\t\t\t\tt = count(mid);\n\t\t\t\tif (t < m) left = mid + 1;\n\t\t\t\telse if (t > m) right = mid;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tleft = mid;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (t == m)\n\t\t\t{\n\t\t\t\tleft = left / 5 * 5;\n\t\t\t\twriter.WriteLine(5);\n\t\t\t\tfor (int i = 0; i < 5; ++i)\n\t\t\t\t{\n\t\t\t\t\twriter.Write(string.Format(\"{0} \", left + i));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse writer.Write(0);\n\t\t\t//flush \n\t\t\twriter.Close();\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n\tclass FastWriter\n\t{\n\t\tprivate TextWriter writer = null;\n\n\t\tpublic FastWriter (String fileName ) \n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\twriter = new StreamWriter(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twriter = System.Console.Out;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastWriter()\n\t\t{\n\t\t\twriter = System.Console.Out;\n\t\t}\n\n\t\tpublic void Write(params object[] parameters)\n\t\t{\n\t\t\tforeach (object o in parameters)\n\t\t\t{\n\t\t\t\twriter.Write(o.ToString());\n\t\t\t}\n\t\t}\n\n\t\tpublic void WriteLine(params object[] parameters)\n\t\t{\n\t\t\tforeach (object o in parameters)\n\t\t\t{\n\t\t\t\twriter.Write(o.ToString());\n\t\t\t}\n\t\t\twriter.WriteLine();\n\t\t}\n\n\t\tpublic void Close()\n\t\t{\n\t\t\twriter.Close();\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TrivialProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = Convert.ToInt32(Console.ReadLine());\n int output = 0;\n int sayac = 0;\n\n \n for (int i = 5; ; i+=5)\n {\n if (i % Math.Pow(5, 1) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 2) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 3) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 4) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 5) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 6) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 7) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 8) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 9) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 10) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 11) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 12) == 0)\n {\n sayac++;\n if (i % Math.Pow(5, 13) == 0)\n {\n sayac++;\n\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n if (sayac == m)\n {\n Console.WriteLine(\"5\");\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", i, i + 1, i + 2, i + 3, i + 4);\n return;\n }\n else if (sayac > m)\n {\n Console.WriteLine(\"0\");\n return;\n }\n\n }\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int Fun(int x)\n {\n int p = 2;\n int r2 = 0;\n while (p <= x)\n {\n r2 += x / p;\n p *= 2;\n }\n p = 5;\n int r5 = 0;\n while (p <= x)\n {\n r5 += x / p;\n p *= 5;\n }\n return Math.Min(r2, r5);\n }\n\n public void Solve()\n {\n var ans = new List();\n int n = ReadInt();\n for (int i = 1; ; i++)\n {\n int x = Fun(i);\n if (x > n)\n break;\n if (x == n)\n ans.Add(i);\n }\n\n Write(ans.Count);\n WriteArray(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n ArrayList ans = new ArrayList();\n for (int i = 0; ; i++)\n {\n int zer = zeroes(i);\n if (zer == k)\n {\n ans.Add(i);\n }\n else if (zer > k)\n {\n break;\n }\n }\n Console.WriteLine(ans.Count);\n if (ans.Count > 0)\n {\n foreach (int item in ans)\n {\n Console.Write(item.ToString() + \" \");\n }\n }\n\n }\n\n static int zeroes(int f)\n {\n double mul = 1;\n int ans = 0;\n while (true)\n {\n int temp = (int)(f / Math.Truncate(Math.Pow(5, mul++)));\n if (temp == 0) break;\n else\n ans += temp;\n }\n return ans;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF633B {\n class Program {\n static void Main(string[] args) {\n int trailing = Convert.ToInt32(Console.ReadLine());\n\n int factorial = 0;\n int zeros = 0;\n while(zeros < trailing) {\n factorial += 5;\n\n if(factorial % 5 == 0) {\n zeros++;\n }\n int pow = 2;\n while(factorial % (int)Math.Pow(5, pow) == 0) {\n zeros++;\n pow++;\n }\n }\n\n if(zeros == trailing) {\n Console.WriteLine(5);\n for(int i = 0; i < 5; i++) {\n Console.Write(factorial + i + \" \");\n }\n Console.WriteLine();\n } else {\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class B\n {\n private static ThreadStart s_threadStart = new B().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n private void Go()\n {\n int m = GetInt();\n\n int current = 5;\n int tmp;\n int count = 1;\n\n while (count < m)\n {\n current += 5;\n tmp = current;\n while (tmp % 5 == 0)\n {\n count++;\n tmp /= 5;\n }\n }\n\n if (count == m)\n {\n Wl(5);\n Console.Write(current);\n for (int i = 1; i < 5; i++)\n {\n Console.Write(\" \" + (current + i));\n }\n Wl(\"\");\n }\n else\n {\n Wl(\"0\");\n }\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar fives = 0;\n\t\t\tvar ans = new List();\n\t\t\tvar i = 1;\n\t\t\twhile (fives <= n)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tvar j = i;\n\t\t\t\twhile (j % 5 == 0)\n\t\t\t\t{\n\t\t\t\t\tfives++;\n\t\t\t\t\tj /= 5;\n\t\t\t\t}\n\t\t\t\tif (fives == n)\n\t\t\t\t\tans.Add(i);\n\t\t\t}\n\t\t\tConsole.WriteLine(ans.Count);\n\t\t\tfor (var ii = 0; ii < ans.Count; ++ii)\n\t\t\t\tConsole.Write(\"{0} \", ans[ii]);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\n\n\n\nclass Program\n{\n \n //////////////////////////////////////////////////\n void Solution()\n {\n var m = rl;\n var a = new List();\n int zeros = 0;\n for (int j = 1; j <= 500000; j++)\n {\n var i = j;\n\n while (i % 5 == 0)\n {\n zeros++;\n i /= 5;\n }\n if (zeros == m)\n a.Add(j);\n else if (zeros > m)\n break;\n }\n\n if (a.Count == 0)\n wln(0);\n else\n {\n wln(a.Count);\n foreach (var o in a)\n wsp(o);\n }\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o+\" \"); }\n static void wrt(object o) { Console.Write(o); } \n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b!=0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _633B\n{\n class Program\n {\n static void Main()\n {\n var m = long.Parse(Console.ReadLine()); \n int counter = 0; \n for (int i = 5; ; i+=5)\n { \n if (i % 5 == 0)\n {\n var temp = i;\n while (temp%5 == 0)\n {\n counter++;\n temp /= 5;\n }\n }\n if (counter == m)\n {\n Console.WriteLine(\"5\");\n for (int j=0; j < 5; j++)\n {\n Console.Write(i++ + \" \");\n }\n break;\n }\n else if (counter > m)\n {\n Console.WriteLine(\"0\");\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint NN=1000000;\n\t\tint[] A=new int[NN];\n\t\tint[] F=new int[]{5,25,125,625,3125,15625,78125,390625};\n\t\t\n\t\tfor(int i=0;i L=new List();\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n * Date: 28.02.2016\n * Time: 14:49\n * \n\n\nB. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 2 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 256 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd m \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n,\n\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd m \ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd?\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd m (1 <= m <= 100?000) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd k \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n, \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd m \ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd k \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n5\n5 6 7 8 9 \n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n5\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n0\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd n! = 1\ufffd2\ufffd3\ufffd...\ufffdn.\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 5! = 120, 6! = 720, 7! = 5040, 8! = 40320 \ufffd 9! = 362880.\n\n*/\n\nusing System;\n\nclass Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = 0, k = 0;\n\t\tint m = int.Parse (Console.ReadLine ());\n\n\t\tfor ( n = 5; k < m; n += 5 )\n\t\t{\n\t\t\tk++;\n\t\t\tfor ( int l = 25; n % l == 0; l *= 5 )\n\t\t\t\tk++;\n\t\t}\n\n\t\tif ( k > m )\n\t\t\tConsole.WriteLine (\"0\");\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine (\"5\");\n\t\t\tn -= 5;\n\t\t\tfor ( int l=0; l < 5; l++, n++ )\n\t\t\t\tConsole.Write (n + \" \");\n\t\t}\n\n//\t\tConsole.ReadKey (true);\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n\n int fives = 0;\n for (int i = 5; ; i += 5)\n {\n int temp = i;\n while (temp % 5 == 0)\n {\n fives++; temp /= 5;\n }\n if (fives > a)\n {\n Console.WriteLine(0);\n return;\n }\n if (fives == a)\n {\n Console.WriteLine(5);\n Console.WriteLine(i + \" \" + (i + 1) + \" \" + (i + 2) + \" \" + (i + 3) + \" \" + (i + 4));\n return;\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static int HowManyFives(int x)\n {\n int n = 0;\n int y = x;\n\n while (y % 5 == 0)\n {\n n += 1;\n y /= 5;\n }\n\n return n;\n }\n\n\n static void Main()\n {\n string input = Console.ReadLine();\n string[] args = input.Split();\n\n var m = int.Parse(args[0]);\n\n int z = 0;\n int n = 0;\n\n while (z < m)\n {\n n += 5;\n z += HowManyFives(n);\n }\n\n if (z == m)\n {\n Console.WriteLine(\"5\");\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", n, n + 1, n + 2, n + 3, n + 4);\n }\n else\n Console.WriteLine(\"0\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CSharp\n{\n class _633B\n {\n public static void Main()\n {\n int m = int.Parse(Console.ReadLine());\n\n var result = new List();\n\n for (int n = 1, zeroes = 0; zeroes <= m; n++)\n {\n int x = n;\n\n while (x % 5 == 0)\n {\n x /= 5;\n zeroes++;\n\n if (zeroes > m)\n {\n break;\n }\n }\n\n if (zeroes == m)\n {\n result.Add(n);\n }\n }\n\n Console.WriteLine(result.Count);\n Console.WriteLine(string.Join(\" \", result));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var m = int.Parse(Console.ReadLine());\n \n var list = new List();\n\n for (int i = 1; i <= 1000000; i++)\n {\n int res = Res(i);\n if (res == m)\n list.Add(i);\n }\n \n Console.WriteLine(list.Count);\n foreach (var i in list)\n {\n Console.Write(\"{0} \",i); \n }\n //Console.ReadLine();\n }\n\n int Res(int n)\n {\n \n int ans = 0;\n int power = 1;\n while (true)\n {\n var lcl = (int) (n/(Math.Pow(5, power)));\n if(lcl==0)\n break;\n ans += lcl;\n power++;\n }\n return ans;\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace EbonyAndIvory {\n\n class Program {\n\n static void Main() {\n\n int m = int.Parse(Console.ReadLine());\n\n int n = 0;\n for(int x = 5; n < m; x += 5) {\n int i = 0;\n for(int y = x; y % 5 == 0; y /= 5) {\n i++;\n }\n n = n + i;\n if(n == m) { Console.WriteLine(\"5\\n{0} {1} {2} {3} {4}\", x, x + 1, x + 2, x + 3, x + 4); return; }\n }\n Console.WriteLine(\"0\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var m = Convert.ToInt32(Console.ReadLine());\n int zeroCount = 0;\n \n var listPow5 = new List {5};\n int pow5 = 1;\n int i = 5;\n \n while (zeroCount < m)\n {\n for(int j = 1; j <= pow5; j++)\n {\n if (i % listPow5[j-1] == 0)\n {\n zeroCount += 1;\n }\n }\n \n if (i % (listPow5[pow5 - 1] * 5) == 0)\n {\n listPow5.Add(listPow5[pow5 - 1] * 5);\n pow5++;\n zeroCount++;\n }\n i += 5;\n }\n\n if (zeroCount == m)\n {\n Console.WriteLine(5);\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", i - 5 , i - 4, i - 3, i - 2, i - 1);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\npublic class Program\n{\n\tint max = 0;\n\tpublic static void Main(string[] args)\n\t{\n\t\tint m = int.Parse(Console.ReadLine());\n\t\tList num = new List();\n\n\t\tint i = 1;\n\t\tint zeros = 0;\n\n\t\twhile (i <= 5 * m + 5)\n\t\t{\n\t\t\tzeros = CountZeros(i, 5);\n\n\t\t\tif (zeros == m)\n\t\t\t{\n\t\t\t\tnum.Add(i);\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tConsole.WriteLine(num.Count);\n\t\tfor (int j = 0; j < num.Count; j++)\n\t\t{\n\t\t\tConsole.WriteLine(num[j]);\n\t\t}\n\t}\n\n\tprivate static int CountZeros(int i, int divide)\n\t{\n\t\tif (i < divide)\n\t\t\treturn 0;\n\t\telse\n\t\t\treturn (i / divide) + CountZeros(i, divide * 5);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Trivialproblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = int.Parse(Console.ReadLine());\n int zeros = 0;\n int a = 0;\n while (zeros m)\n {\n writer.WriteLine(\"0\");\n break;\n }\n else if (count == m)\n {\n writer.WriteLine(\"5\");\n for (int j = 0; j < 5; j++)\n {\n writer.Write(i + j);\n writer.Write(' ');\n }\n break;\n }\n }\n\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = MyConsoleInputStreamParser.GetLong;\n long zeroCount = 0, i = 5;\n while (zeroCount <= 100000)\n {\n var temp = i;\n while (temp % 5 == 0)\n {\n zeroCount++;\n temp /= 5;\n }\n if (zeroCount == n)\n {\n Console.WriteLine(5);\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", i, i + 1, i + 2, i + 3, i + 4);\n break;\n }\n if (zeroCount > n)\n {\n Console.WriteLine(0);\n break;\n }\n i += 5;\n }\n }\n\n public static string Reverse(string str)\n {\n var newStr = new StringBuilder(str,str.Length);\n for (int i = 0; i < str.Length / 2; i++)\n {\n var temp = newStr[str.Length - 1 - i];\n newStr[str.Length - 1 - i] = newStr[i];\n newStr[i] = temp; \n }\n return newStr.ToString();\n }\n\n public static class MyConsoleInputStreamParser\n {\n private static TextReader reader = new StreamReader(Console.OpenStandardInput());\n private static Queue currentLineStrings = new Queue();\n\n public static string GetLine { get { return reader.ReadLine(); } }\n\n public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue(GetStringArray); return currentLineStrings.Dequeue(); } }\n\n public static int GetInt { get { return int.Parse(GetString); } }\n\n public static long GetLong { get { return long.Parse(GetString); } }\n\n public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }\n\n public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }\n\n public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }\n\n public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }\n\n public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }\n\n public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }\n\n public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }\n\n public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }\n\n public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }\n\n public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }\n\n public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n\n object Get()\n {\n checked\n {\n var inp = ReadLong();\n int i = 5;\n while (true)\n {\n var c = Count(i);\n if (c == inp)\n return \"5\\n\" + new[] { i, i + 1, i + 2, i + 3, i + 4 }.Select(x => x.ToString()).JoinStrings(\" \");\n if (c > inp)\n return \"0\";\n i += 5;\n }\n throw new Exception(\"HUj\");\n }\n }\n\n public int Count(int number)\n {\n var zeros = 0;\n var d = 5;\n while (number >= d)\n {\n zeros += number / d;\n d *= 5;\n }\n return zeros;\n }\n\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int t = 5, q = 0;\n int num = 0;\n while (true)\n {\n int zeros = t / 5 + t / (5 * 5) + t / (5 * 5 * 5) + t / (5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5 * 5 * 5);\n //Console.WriteLine(t + \" \" + zeros);\n if (zeros == n)\n {\n num = t;\n q = 5;\n }\n else if (zeros > n)\n break;\n t += 5;\n }\n\n Console.WriteLine(q);\n if (q == 5)\n {\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", num, num + 1, num + 2, num + 3, num + 4);\n }\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace CompetitiveProgramming\n{\n class Program\n {\n static bool s_IsMultipleTestCases = false;\n static void Main(string[] args)\n {\n#if DEBUG\n var streamReader = new StreamReader(\"../../input.txt\", Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(\"../../output.txt\", false, Encoding.ASCII, 32768);\n var timer = new Stopwatch();\n timer.Start();\n#else\n var streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n#endif\n var reader = new InputReader(streamReader);\n\n var numberOfTest = 1;\n if (s_IsMultipleTestCases)\n {\n numberOfTest = reader.NextInt();\n }\n for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)\n {\n Task solver = new Task();\n solver.Solve(testNumber, reader, streamWriter);\n }\n#if DEBUG\n streamWriter.WriteLine(\"\\nEslapsed Time: \" + timer.ElapsedMilliseconds + \" ms\");\n#endif\n streamReader.Close();\n streamWriter.Close();\n }\n }\n\n class Task\n {\n const int MAXN = 100;\n long ans = 0;\n string res = string.Empty;\n public void Solve(int testNumber, InputReader reader, StreamWriter writer)\n {\n var m = reader.NextLong();\n var lst = new List();\n\n var two = 0;\n var five = 0;\n for (int i = 2; ; i++)\n {\n var x = i;\n while (x % 2 == 0)\n {\n two++;\n x >>= 1;\n }\n\n x = i;\n while (x % 5 == 0)\n {\n five++;\n x /= 5;\n }\n if (Min(two, five) > m) break;\n if (Min(two, five) == m)\n {\n lst.Add(i);\n }\n\n }\n\n writer.WriteLine(lst.Count);\n writer.WriteLine(string.Join(\" \", lst));\n }\n\n #region Utilities\n private string ConvertArrayToString(int[] arrs)\n {\n var sb = new StringBuilder();\n foreach (var item in arrs)\n {\n sb.Append(item);\n sb.Append(\"\\n\");\n }\n return sb.ToString();\n }\n\n private string ConvertArrayToString(long[] arrs)\n {\n var sb = new StringBuilder();\n foreach (var item in arrs)\n {\n sb.Append(item);\n sb.Append(\"\\n\");\n }\n return sb.ToString();\n }\n\n private string ConvertDoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private int Max(int a, int b)\n {\n return Math.Max(a, b);\n }\n\n private int Min(int a, int b)\n {\n return Math.Min(a, b);\n }\n\n private long Max(long a, long b)\n {\n return Math.Max(a, b);\n }\n\n private long Min(long a, long b)\n {\n return Math.Min(a, b);\n }\n\n private long GCD(long a, long b)\n {\n return a > 0 ? b : GCD(b, a % b);\n }\n\n private int GCD(int a, int b)\n {\n return a > 0 ? b : GCD(b, a % b);\n }\n\n #endregion\n }\n\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n int num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public long NextLong()\n {\n long num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n public int[] NIS(int n)\n {\n var arrs = new int[n];\n for (int i = 0; i < n; i++)\n {\n arrs[i] = NextInt();\n }\n return arrs;\n }\n\n public long[] NLS(int n)\n {\n var arrs = new long[n];\n for (int i = 0; i < n; i++)\n {\n arrs[i] = NextLong();\n }\n return arrs;\n }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var max = 1000001;\n var m = sr.NextInt32();\n var answ = new List[100001];\n for (var i = 1; i < max; i++)\n {\n var count = Count(i);\n if (count < answ.Length)\n {\n if (answ[count] == null)\n {\n answ[count] = new List();\n }\n answ[count].Add(i);\n }\n }\n if (answ[m] == null)\n {\n sw.WriteLine(0);\n }\n else\n {\n sw.WriteLine(answ[m].Count);\n for (var i = 0; i < answ[m].Count; i++)\n {\n sw.WriteLine(answ[m][i] + \" \");\n }\n }\n }\n\n private int Count(int n)\n {\n int count = 0;\n\n for (int i = 5; n / i >= 1; i *= 5)\n count += n / i;\n\n return count;\n }\n\n private BigInteger Fact(BigInteger i)\n {\n if (i == 0)\n return 1;\n return i*Fact(i - 1);\n }\n }\n\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var i = (int)BinarySearch(1, long.MaxValue, m, GetCount);\n\n if (i == -1)\n {\n Print(0);\n }\n else\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i / 5 * 5, 5)));\n }\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n\n if (goal < f(mid))\n {\n high = mid - 1;\n }\n else if (f(mid) < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return -1;\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n var result = new List();\n var count = 0L;\n\n for (var i = 1; count <= m; i++)\n {\n count = GetCount(i);\n\n if (count == m)\n {\n result.Add(i);\n }\n }\n\n Print(result.Count);\n\n if (result.Count > 0) { Print(string.Join(\" \", result)); }\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n\n for (var t = 5L; t <= n; t *= 5)\n {\n count += n / t;\n }\n\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n var count = 0L;\n\n for (var i = 1; count <= m; i++)\n {\n count = GetCount(i);\n\n if (count == m)\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i, 5)));\n return;\n }\n }\n\n Print(0);\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var i = (int)BinarySearch(1, long.MaxValue, m, GetCount);\n\n if (i == -1)\n {\n Print(0);\n }\n else\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i / 5 * 5, 5)));\n }\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return -1;\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var i = (int)BinarySearch(1, int.MaxValue, m, GetCount);\n\n if (i == -1)\n {\n Print(0);\n }\n else\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i / 5 * 5, 5)));\n }\n }\n\n private static long BinarySearch(long low, long high, long goal, Func f)\n {\n while (low <= high)\n {\n var mid = (low + high) / 2;\n var x = f(mid);\n\n if (goal < x)\n {\n high = mid - 1;\n }\n else if (x < goal)\n {\n low = mid + 1;\n }\n else\n {\n return mid;\n }\n }\n\n return -1;\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n //var str = Console.ReadLine().Split(' ');\n //var a = int.Parse(str[0]);\n //var b = int.Parse(str[1]);\n //var c = int.Parse(str[2]);\n \n //for (int i = 0; i <= 10000; i++)\n //{\n // for (int j = 0; j <= 10000; j++)\n // {\n // var lclRes = i*a + j*b;\n // if (lclRes == c)\n // {\n // Console.WriteLine(\"Yes\");\n // return;\n // }\n // }\n //}\n //Console.WriteLine(\"No\");\n // Console.ReadLine();\n\n //B\n var m = int.Parse(Console.ReadLine());\n int ans = 0;\n \n var list = new List();\n if (m<6)\n {\n var first = m*5;\n list.Add(first);\n for(int i=1;i<=4;i++)\n list.Add(first+i);\n }\n Console.WriteLine(list.Count);\n foreach (var i in list)\n {\n Console.Write(\"{0} \",i); \n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n var m = int.Parse(Console.ReadLine());\n \n var list = new List();\n\n for (int i = 1; i <= 1000000; i+=5)\n {\n int res = Res(i);\n if (res == m)\n list.Add(i);\n }\n \n Console.WriteLine(list.Count);\n foreach (var i in list)\n {\n Console.Write(\"{0} \",i); \n }\n //Console.ReadLine();\n }\n\n int Res(int n)\n {\n int ans = 0;\n int power = 1;\n while (true)\n {\n var lcl = (int) (n/(Math.Pow(5, power)));\n if(lcl==0)\n break;\n ans += lcl;\n power++;\n }\n return ans;\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n //var str = Console.ReadLine().Split(' ');\n //var a = int.Parse(str[0]);\n //var b = int.Parse(str[1]);\n //var c = int.Parse(str[2]);\n \n //for (int i = 0; i <= 10000; i++)\n //{\n // for (int j = 0; j <= 10000; j++)\n // {\n // var lclRes = i*a + j*b;\n // if (lclRes == c)\n // {\n // Console.WriteLine(\"Yes\");\n // return;\n // }\n // }\n //}\n //Console.WriteLine(\"No\");\n // Console.ReadLine();\n\n //B\n var m = int.Parse(Console.ReadLine());\n int ans = 0;\n \n var list = new List();\n if (m == 1)\n {\n list = new List(){5,6,7,8,9};\n }\n else if(m==2)\n {\n list = new List() { 10,11,12,13,14 };\n }\n else if (m == 3)\n {\n list = new List() { 15,16,17,18,19 };\n }\n else if (m == 4)\n {\n list = new List() { 20,21,22,23,24 };\n }\n else if (m == 6)\n {\n list = new List() {25,26,27,28,29 };\n }\n Console.WriteLine(list.Count);\n foreach (var i in list)\n {\n Console.Write(\"{0} \",i); \n }\n // Console.ReadLine();\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\n\t\t\tList Num = new List ();\n\t\t\tint m = int.Parse(Console.ReadLine ());\n\n\t\t\tfor (int i = 5 * m; i < 5 * (m + 1); i++) {\n\n\t\t\t\tint t = zero_Fact (i);\n\t\t\t\tif (t == m)\n\t\t\t\t\tNum.Add (i);\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Num.Count);\n\t\t\tstring Temp = \"\";\n\t\t\tfor (int i = 0; i < Num.Count; i++) {\n\n\t\t\t\tTemp += Num [i] + \" \";\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Temp);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\n\n\t\tpublic static int zero_Fact (int N) {\n\n\t\t\tint Count = 0;\n\t\t\twhile (N > 0) {\n\n\t\t\t\tN /= 5;\n\t\t\t\tCount += N;\n\n\t\t\t}\n\n\t\t\treturn Count;\n\n\t\t}\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\n\t\t\tList Num = new List ();\n\t\t\tint m = int.Parse(Console.ReadLine ());\n\n\t\t\tfor (int i = 1; i < 100000; i++) {\n\n\t\t\t\tint t = zero_Fact (i);\n\t\t\t\tif (t == m)\n\t\t\t\t\tNum.Add (i);\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Num.Count);\n\t\t\tstring Temp = \"\";\n\t\t\tfor (int i = 0; i < Num.Count; i++) {\n\n\t\t\t\tTemp += Num [i] + \" \";\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Temp);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\n\n\t\tpublic static int zero_Fact (int N) {\n\n\t\t\tint Count = 0;\n\t\t\twhile (N > 0) {\n\n\t\t\t\tN /= 5;\n\t\t\t\tCount += N;\n\n\t\t\t}\n\n\t\t\treturn Count;\n\n\t\t}\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ()\n\t\t{\n\n\t\t\tList Num = new List ();\n\t\t\tint m = int.Parse(Console.ReadLine ());\n\n\t\t\t/*for (int i = 1; i < 100000; i++) {\n\n\t\t\t\tint t = zero_Fact (i);\n\t\t\t\tif (t == m)\n\t\t\t\t\tNum.Add (i);\n\n\t\t\t}*/\n\n\t\t\tfor (int i = m * 5; i < (m + 1) * 5; i++) {\n\n\t\t\t\tif (i > 6)\n\t\t\t\t\tNum.Add (i - 5);\n\t\t\t\telse if (i < 6)\n\t\t\t\t\tNum.Add (i);\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Num.Count);\n\t\t\tstring Temp = \"\";\n\t\t\tfor (int i = 0; i < Num.Count; i++) {\n\n\t\t\t\tTemp += Num [i] + \" \";\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Temp);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\n\n\t\tpublic static int zero_Fact (int N) {\n\n\t\t\tint Count = 0;\n\t\t\twhile (N > 0) {\n\n\t\t\t\tN /= 5;\n\t\t\t\tCount += N;\n\n\t\t\t}\n\n\t\t\treturn Count;\n\n\t\t}\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n void Solve()\n {\n //var str = Console.ReadLine().Split(' ');\n //var a = int.Parse(str[0]);\n //var b = int.Parse(str[1]);\n //var c = int.Parse(str[2]);\n \n //for (int i = 0; i <= 10000; i++)\n //{\n // for (int j = 0; j <= 10000; j++)\n // {\n // var lclRes = i*a + j*b;\n // if (lclRes == c)\n // {\n // Console.WriteLine(\"Yes\");\n // return;\n // }\n // }\n //}\n //Console.WriteLine(\"No\");\n // Console.ReadLine();\n\n //B\n var m = int.Parse(Console.ReadLine());\n int ans = 0;\n \n var list = new List();\n\n //for (int i = 1; i <= 100000; i++)\n //{\n // int res = Res(i);\n // if(res == m)\n // list.Add(i);\n //}\n if (m == 5 || m%6 == 5)\n ans = 0;\n else\n {\n var r = m/6;\n m -= r;\n var first = m*5;\n list.Add(first);\n for (int i = 1; i <=4; i++)\n {\n list.Add(first+i);\n }\n }\n Console.WriteLine(list.Count);\n foreach (var i in list)\n {\n Console.Write(\"{0} \",i); \n }\n // Console.ReadLine();\n }\n\n int Res(int n)\n {\n \n int ans = 0;\n int power = 1;\n while ((n/(Math.Pow(5, power))) >= 1)\n {\n var lcl = (int) (n/(Math.Pow(5, power)));\n ans += lcl;\n power++;\n }\n return ans;\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var m = Convert.ToInt32(Console.ReadLine());\n int zeroCount = 0;\n \n var listPow5 = new List {5};\n int pow5 = 1;\n int i = 5;\n \n while (zeroCount < m)\n {\n for(int j = 1; j <= pow5; j++)\n {\n if (i % listPow5[j-1] == 0)\n {\n zeroCount += j;\n }\n }\n \n if (i % (listPow5[pow5 - 1] * 5) == 0)\n {\n listPow5.Add(listPow5[pow5 - 1] * 5);\n pow5++;\n zeroCount++;\n }\n i += 5;\n }\n\n if (zeroCount == m)\n {\n Console.WriteLine(5);\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", i - 5 , i - 4, i - 3, i - 2, i - 1);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Trivialproblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = int.Parse(Console.ReadLine());\n int zeros = 0;\n int a = 0;\n while (zeros n)\n {\n Console.WriteLine(0);\n break;\n }\n i += 5;\n }\n }\n\n public static string Reverse(string str)\n {\n var newStr = new StringBuilder(str,str.Length);\n for (int i = 0; i < str.Length / 2; i++)\n {\n var temp = newStr[str.Length - 1 - i];\n newStr[str.Length - 1 - i] = newStr[i];\n newStr[i] = temp; \n }\n return newStr.ToString();\n }\n\n public static class MyConsoleInputStreamParser\n {\n private static TextReader reader = new StreamReader(Console.OpenStandardInput());\n private static Queue currentLineStrings = new Queue();\n\n public static string GetLine { get { return reader.ReadLine(); } }\n\n public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue(GetStringArray); return currentLineStrings.Dequeue(); } }\n\n public static int GetInt { get { return int.Parse(GetString); } }\n\n public static long GetLong { get { return long.Parse(GetString); } }\n\n public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }\n\n public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }\n\n public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }\n\n public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }\n\n public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }\n\n public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }\n\n public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }\n\n public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }\n\n public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }\n\n public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }\n\n public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = MyConsoleInputStreamParser.GetLong;\n long zeroCount = 0, i = 5;\n while (zeroCount <= 100000)\n {\n var sevencount = i / 78125;\n var sixcount = i / 15625 - sevencount;\n var fivecount = i / 3125 - sixcount - sevencount;\n var fourcount = i / 625 - fivecount - sixcount - sevencount;\n var threecount = i / 125 - fourcount - fivecount - sixcount - sevencount;\n var twocount = i / 25 - fourcount - fivecount - sixcount - sevencount - threecount;\n var firstcount = i / 5 - fourcount - fivecount - sixcount - sevencount - threecount - twocount;\n zeroCount = firstcount + twocount * 2 + threecount * 3 + fourcount * 4 + fivecount * 5 + sixcount * 6 + 7 * sevencount;\n if (zeroCount == n)\n {\n Console.WriteLine(5);\n Console.WriteLine(\"{0} {1} {2} {3} {4}\", i, i + 1, i + 2, i + 3, i + 4);\n break;\n }\n if (zeroCount > n)\n {\n Console.WriteLine(0);\n break;\n }\n i += 5;\n }\n }\n\n public static string Reverse(string str)\n {\n var newStr = new StringBuilder(str,str.Length);\n for (int i = 0; i < str.Length / 2; i++)\n {\n var temp = newStr[str.Length - 1 - i];\n newStr[str.Length - 1 - i] = newStr[i];\n newStr[i] = temp; \n }\n return newStr.ToString();\n }\n\n public static class MyConsoleInputStreamParser\n {\n private static TextReader reader = new StreamReader(Console.OpenStandardInput());\n private static Queue currentLineStrings = new Queue();\n\n public static string GetLine { get { return reader.ReadLine(); } }\n\n public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue(GetStringArray); return currentLineStrings.Dequeue(); } }\n\n public static int GetInt { get { return int.Parse(GetString); } }\n\n public static long GetLong { get { return long.Parse(GetString); } }\n\n public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }\n\n public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }\n\n public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }\n\n public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }\n\n public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }\n\n public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }\n\n public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }\n\n public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }\n\n public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }\n\n public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }\n\n public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n\n object Get()\n {\n checked\n {\n var inp = ReadLong();\n int i = 5;\n while (true)\n {\n var c = Count(i);\n if (c == inp)\n return new[] { i, i + 1, i + 2, i + 3, i + 4 }.Select(x => x.ToString()).JoinStrings(\" \");\n if (c > inp)\n return \"0\";\n i += 5;\n }\n throw new Exception(\"HUj\");\n }\n }\n\n public int Count(int number)\n {\n var zeros = 0;\n var d = 5;\n while (number >= d)\n {\n zeros += number / d;\n d *= 5;\n }\n return zeros;\n }\n\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int t = 5, q = 0;\n int[] nums = new int[2000000];\n while (true)\n {\n int zeros = t / 5 + t / (5 * 5) + t / (5 * 5 * 5) + t / (5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5);\n if (zeros == n)\n {\n nums[q] = t;\n q++;\n }\n else if (zeros > n)\n break;\n t++;\n }\n\n Console.WriteLine(q);\n for (int i = 0; i < q; i++)\n {\n Console.Write(nums[i] + ((i == q - 1) ? \"\" : \" \"));\n }\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int t = 5, q = 0;\n int[] nums = new int[2000000];\n while (true)\n {\n int zeros = t / 5 + t / (5 * 5) + t / (5 * 5 * 5) + t / (5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5) + t / (5 * 5 * 5 * 5 * 5 * 5 * 5);\n //Console.WriteLine(t + \" \" + zeros);\n if (zeros == n)\n {\n nums[q] = t;\n q++;\n }\n else if (zeros > n)\n break;\n t++;\n }\n\n Console.WriteLine(q);\n for (int i = 0; i < q; i++)\n {\n Console.Write(nums[i] + ((i == q - 1) ? \"\" : \" \"));\n }\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var max = 1000001;\n var m = sr.NextInt32();\n var answ = new List[100001];\n for (var i = 1; i < max; i++)\n {\n var count = Count(i);\n if (count < answ.Length)\n {\n if (answ[count] == null)\n {\n answ[count] = new List();\n }\n answ[count].Add(i);\n }\n }\n if (answ[m] == null)\n {\n sw.WriteLine(0);\n }\n else\n {\n for (var i = 0; i < answ[m].Count; i++)\n {\n sw.WriteLine(answ[m][i] + \" \");\n }\n }\n }\n\n private int Count(int n)\n {\n int count = 0;\n\n for (int i = 5; n / i >= 1; i *= 5)\n count += n / i;\n\n return count;\n }\n\n private BigInteger Fact(BigInteger i)\n {\n if (i == 0)\n return 1;\n return i*Fact(i - 1);\n }\n }\n\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var result = new List();\n\n for (var i = 0; i < 100000; i++)\n {\n var x = (i / 5) * 5;\n var n = x / 5;\n\n if (n == m)\n {\n result.Add(i);\n }\n else if (m < n)\n {\n break;\n }\n }\n\n Print(result.Count);\n\n if (result.Count > 0)\n {\n Print(string.Join(\" \", result));\n }\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n var count = 0L;\n\n for (var i = 1; count <= m; i++)\n {\n count = GetCount(i);\n\n if (count == m)\n {\n Print(5);\n Print(string.Join(\" \", Enumerable.Range(i, 5)));\n }\n }\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n for (var t = 5L; t <= n; t *= 5) { count += n / t; }\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var result = new List();\n\n for (var i = 1; i < 100000; i++)\n {\n var count = GetCount(i);\n\n if (count == m)\n {\n result.Add(i);\n }\n else if (m < count)\n {\n break;\n }\n }\n\n Print(result.Count);\n\n if (result.Count > 0) { Print(string.Join(\" \", result)); }\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n\n for (var t = 5L; t <= n; t *= 5)\n {\n count += n / t;\n }\n\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var result = new List();\n\n var count = 0L;\n\n for (var i = 1; m < count; i++)\n {\n count = GetCount(i);\n\n if (count == m)\n {\n result.Add(i);\n }\n }\n\n Print(result.Count);\n\n if (result.Count > 0) { Print(string.Join(\" \", result)); }\n }\n\n private static long GetCount(long n)\n {\n var count = 0L;\n\n for (var t = 5L; t <= n; t *= 5)\n {\n count += n / t;\n }\n\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var m = long.Parse(Console.ReadLine());\n\n var result = new List();\n\n for (var i = 0; i < 100000; i++)\n {\n var x = (i / 5) * 5;\n var count = GetDivisorCount(x, 5) + GetDivisorCount(x, 10);\n\n if (count == m)\n {\n result.Add(i);\n }\n else if (m < count)\n {\n break;\n }\n }\n\n Print(result.Count);\n\n if (result.Count > 0)\n {\n Print(string.Join(\" \", result));\n }\n }\n\n private static long GetDivisorCount(long n, long divisor)\n {\n var count = 0;\n\n while (0 < n && n % divisor == 0)\n {\n count++;\n n /= divisor;\n }\n\n return count;\n }\n\n private static void Print(string s) { Console.WriteLine(s); }\n private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n private static void Print(double x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }\n\n private static string S(long x) { return x.ToString(CultureInfo.InvariantCulture); }\n private static string S(double x) { return x.ToString(CultureInfo.InvariantCulture); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n ArrayList ans = new ArrayList();\n for (int i = 0;; i++)\n {\n int zer = zeroes(i);\n if (zer == k)\n {\n ans.Add(i);\n }\n else if (zer > k)\n {\n break;\n }\n }\n \n }\n\n static int zeroes(int f)\n {\n double mul = 1;\n int ans = 0;\n while(true)\n {\n int temp = (int)(f / Math.Truncate(Math.Pow(5, mul++)));\n if (temp == 0) break;\n else\n ans += temp;\n }\n return ans;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF633B {\n class Program {\n static void Main(string[] args) {\n int trailing = Convert.ToInt32(Console.ReadLine());\n\n int factorial = 0;\n int zeros = 0;\n while(zeros < trailing) {\n factorial += 5;\n\n if(factorial % 5 == 0) {\n zeros++;\n }\n int pow = 2;\n while(factorial == (int)Math.Pow(5, pow)) {\n zeros++;\n pow++;\n }\n }\n\n if(zeros == trailing) {\n Console.WriteLine(5);\n for(int i = 0; i < 5; i++) {\n Console.Write(factorial + i + \" \");\n }\n Console.WriteLine();\n } else {\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF633B {\n class Program {\n static void Main(string[] args) {\n int trailing = Convert.ToInt32(Console.ReadLine());\n\n int factorial = 0;\n int zeros = 0;\n while(zeros < trailing) {\n factorial += 5;\n\n if(factorial % 5 == 0) {\n zeros++;\n }\n int pow = 2;\n while(factorial == Math.Pow(5, pow)) {\n zeros++;\n }\n }\n\n if(zeros == trailing) {\n for(int i = 0; i < 5; i++) {\n Console.Write(factorial + i + \" \");\n }\n Console.WriteLine();\n } else {\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nclass Program\n{\n //////////////////////////////////////////////////\n void Solution()\n {\n var m = rl;\n var a = new List();\n int count2 = 0;\n int zeros = 0;\n for (int j = 1; j <= 100000; j++)\n {\n var i = j;\n while ((i & 1) == 0)\n {\n count2++;\n i >>= 1;\n }\n\n while (i % 5 == 0)\n {\n count2--;\n zeros++;\n i /= 5;\n }\n if (zeros == m)\n a.Add(j);\n else if (zeros > m)\n break;\n }\n\n if (a.Count == 0)\n wln(0);\n else\n {\n wln(a.Count);\n foreach (var o in a)\n wsp(o);\n }\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o+\" \"); }\n static void wrt(object o) { Console.Write(o); } \n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b!=0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; } long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n; )\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _633B\n{\n class Program\n {\n static void Main()\n {\n var m = long.Parse(Console.ReadLine()); \n int counter = 0; \n for (int i = 5; i < 100000; i+=5)\n {\n if (i % 5 == 0)\n {\n counter+= (int)Math.Log((double)i, 5.0);\n }\n if (counter == m)\n {\n Console.WriteLine(\"5\");\n for (int j=0; j < 5; j++)\n {\n Console.Write(i++ + \" \");\n }\n break;\n }\n else if (counter > m)\n {\n Console.WriteLine(\"0\");\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _633B\n{\n class Program\n {\n static void Main()\n {\n var m = long.Parse(Console.ReadLine()); \n int counter = 0; \n for (int i = 5; i < 100000; i+=5)\n {\n if (i % 5 == 0)\n {\n counter+= (int)Math.Log((double)i, 5.0);\n }\n if (counter == m)\n {\n Console.WriteLine(\"Yes\");\n for (int j=0; j < 5; j++)\n {\n Console.Write(i++ + \" \");\n }\n break;\n }\n else if (counter > m)\n {\n Console.WriteLine(\"No\");\n break;\n }\n }\n }\n }\n}\n"}], "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744"} {"source_code": "using System;\n\nnamespace test\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n Console.ReadLine();\n var x = Console.ReadLine().Split(' ');\n int ans = 0;\n foreach(var i in x){\n ans += Math.Abs(int.Parse(i));\n }\n Console.WriteLine(ans.ToString());\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = int.Parse(Console.ReadLine());\n int[] count = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int a = count.Where(x => x <= 0).ToArray().Sum();\n int b = count.Where(x => x > 0).ToArray().Sum();\n Console.WriteLine(b-a);\n\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\t', ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n long result = 0L;\n for (int i = 1; i < input.Length; ++i)\n result += input[i][0] == '-' ? -long.Parse(input[i]) : long.Parse(input[i]);\n Console.WriteLine(result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = int.Parse(Console.ReadLine());\n int[] input = Console.ReadLine().Split().Select(int.Parse).Select(Math.Abs).ToArray();\n Console.WriteLine(input.Sum());\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _946A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Console.ReadLine().Split().Select(token => Math.Abs(int.Parse(token))).Sum());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int[] a = sc.IntArray();\n\n /*\n * \u914d\u5217 a\n * \n * \n */\n\n long p = 0;\n long m = 0;\n foreach (var i in a)\n {\n if (i >= 0) p += i;\n else m += i;\n }\n\n Console.WriteLine(p - m);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = int.Parse(Console.ReadLine());\n string numbersLine = Console.ReadLine();\n string[] numbers = numbersLine.Split(' ');\n int bSum = 0, cSum = 0;\n foreach (string number in numbers)\n {\n int temp = int.Parse(number);\n if (temp >= 0)\n bSum += temp;\n else\n cSum += temp;\n }\n Console.WriteLine(bSum - cSum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace G4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Steps = new int[10];\n Steps[0] = 1;\n for (int i = 1; i < 10; i++)\n {\n Steps[i] = Steps[i - 1] * 10;\n }\n\n int n = int.Parse(Console.ReadLine());\n string sin = Console.ReadLine();\n sin = sin.Trim(' ');\n int[] a = new int[n];\n int summ = 0;\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(sin.Split(' ')[i]);\n if (a[i] < 0)\n {\n a[i] *= -1;\n }\n summ += a[i];\n }\n Console.Write(summ);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass A946 {\n public static void Main() {\n Console.ReadLine();\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n Console.WriteLine(a.Sum(Math.Abs));\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n Console.WriteLine(a.Sum(Math.Abs));\n\n //int length = int.Parse(Console.ReadLine());\n //string[] input = Console.ReadLine().Split(' ');\n\n //int partPositive = 0;\n //int partNegative = 0;\n\n //foreach (var item in input)\n //{\n\n // if (int.Parse(item) >=0)\n // {\n // partPositive += int.Parse(item);\n // }\n // else\n // {\n // partNegative += int.Parse(item);\n // }\n //}\n //Console.WriteLine(partPositive - partNegative);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = int.Parse(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n \n int partPositive = 0;\n int partNegative = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (int.Parse(input[i])>=0)\n {\n partPositive += int.Parse(input[i]);\n }\n else\n {\n partNegative += int.Parse(input[i]);\n }\n }\n Console.WriteLine(partPositive - partNegative);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = int.Parse(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n \n int partPositive = 0;\n int partNegative = 0;\n\n foreach (var item in input)\n {\n\n if (int.Parse(item) >=0)\n {\n partPositive += int.Parse(item);\n }\n else\n {\n partNegative += int.Parse(item);\n }\n }\n Console.WriteLine(partPositive - partNegative);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //10 5\n //2 | 7 | 3 | 9 | 8 | 7 | 9 | 7 | 1 | 9\n //buy|sell|buy|sell| |buy|sell| |buy|sell\n //\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u043f\u0440\u0438\u0431\u044b\u043b\u044c(9 - 2) + (9 - 1) = 15.\n //int[] nk = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int[] nk = new int[] { 10, 5 };\n\n //long[] p = new long[nk[0]];\n //long[] p = new long[] { 2 , 7 , 3 , 9 , 8 , 7 , 9 , 7 , 1 , 9 };\n /*for (int i = 0; i < nk[0]; i++)\n {\n p[i] = long.Parse(Console.ReadLine());\n }*/\n\n //long[] arrIdx1 = Array.ConvertAll(Enumerable.Range(0, nk[0]).ToArray(), a => (long)a);\n //long[] arrIdx2 = (long[])arrIdx1.Clone();\n\n //long[] arrAsc = (long[])p.Clone();\n //long[] arrDesc = (long[])p.Clone();\n\n //Array.Sort(arrAsc, arrIdx1);\n //Array.Sort(arrDesc, arrIdx2);\n //arrDesc = arrDesc.Reverse().ToArray();\n //arrIdx2 = arrIdx2.Reverse().ToArray();\n\n /*for (int i = 0; i < nk[0]; i++)\n {\n Console.Write(arrAsc[i] + \" \");\n }\n\n Console.WriteLine();\n for (int i = 0; i < nk[0]; i++)\n {\n Console.Write(arrIdx1[i] + \" \");\n }*/\n\n int n = int.Parse(Console.ReadLine());\n\n int[] a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n\n Array.Sort(a, (x, y) => y.CompareTo(x));\n\n Console.WriteLine(a.Where(i => i > 0).Sum() - a.Where(i => i < 0).Sum());\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace trololololol\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] y = Console.ReadLine().Split(' ');\n int max = 0, min = 0;\n for (int i = 0; i < y.Length; i++)\n {\n if (int.Parse(y[i]) > 0)\n {\n max = max + int.Parse(y[i]);\n }\n else if (int.Parse(y[i]) < 0)\n {\n min = min + int.Parse(y[i]);\n }\n }\n Console.WriteLine(max - min);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace CodeForces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int number = int.Parse(Console.ReadLine());\n string [] numbers = Console.ReadLine().Split(' ');\n int B_group=0;\n int C_group=0;\n \n for (int i = 0; i < numbers.Length; i++)\n {\n if (int.Parse(numbers[i]) >= 0)\n B_group+=int.Parse(numbers[i]);\n else\n C_group+=int.Parse(numbers[i]);\n }\n int result = B_group - C_group;\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public Scanner sc;\n public void Solve()\n {\n var N = sc.Int;\n var A = sc.ArrInt;\n Array.Sort(A);\n var res = 0;\n for(int k = 0; k <= N; k++)\n {\n chmax(ref res, A.Skip(k).Sum() - A.Take(k).Sum());\n }\n Console.WriteLine(res);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver() { sc = new Scanner() };\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n sol.Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Introduction\n{\n\n class Program\n {\n static Reader reader = new Reader();\n static void Main(string[] args)\n {\n int number1 = reader.NextInt();\n int sum1 = 0, sum2 = 0;\n for (int i = 0; i < number1;i++)\n {\n int a = reader.NextInt();\n if (a > 0)\n sum1 += a;\n else\n sum2 += a;\n }\n Console.Write(sum1-sum2); \n }\n }\n\n #region Reader Class\n internal class Reader\n {\n int s_index = 0;\n List s_tokens;\n\n public string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n public int NextInt()\n {\n String s = Next();\n\n return int.Parse(s);\n }\n\n public long NextLong()\n {\n String s = Next();\n\n return long.Parse(s);\n }\n\n public bool HasNext()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = null;\n s_index = 0;\n var nextLine = Console.ReadLine();\n if (nextLine != null)\n {\n s_tokens = nextLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n if (s_tokens.Count == 0)\n {\n continue;\n }\n }\n return false;\n }\n return false;\n }\n }\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code\n{\n public class Program\n {\n\n static string Read()\n {\n var a = Convert.ToChar(Console.Read());\n var t = new StringBuilder();\n\n while (a != ' ' && a != '\\r' && a != '\\n')\n {\n t.Append(a);\n a = Convert.ToChar(Console.Read());\n }\n return t.ToString();\n }\n\n static int ReadNum()\n {\n return int.Parse(Read());\n }\n\n static ulong ReadUNum()\n {\n return ulong.Parse(Read());\n }\n\n\n public static void Main()\n {\n var n = ReadNum(); Console.ReadLine();\n var sum = 0;\n \n for (int i = 0; i '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int n = int.Parse(Console.ReadLine());\n\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int ans = 0;\n\n for (int i = 0; i < n; i++)\n {\n ans += Math.Abs(a[i]);\n }\n\n Console.WriteLine(ans);\n\n\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Collections;\n\nnamespace ConsoleApplication34\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c = 0, h = 1, f = 2, u = 0,k=0;\n int x = int.Parse(Console.ReadLine());\n\n string[] s = Console.ReadLine().Split();\n int[] a = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n if (int.Parse(s[i])<0)\n {\n c += Math.Abs(int.Parse(s[i]) * -1);\n }\n else\n {\n c += Math.Abs(int.Parse(s[i]) * -1);\n }\n \n }\n Console.WriteLine(c);\n\n\n //string s = Console.ReadLine() ;\n //char[] b = new char [s.Length];\n\n //for (int i = 0; i < s.Length; i++)\n //{\n // if (s[i]=='_')\n // {\n // b[i] =' ';\n // }\n // else\n // {\n // b[i] = s[i];\n // }\n //}\n //string[] a =s.Split();\n //for (int i = 0; i < a.Length; i++)\n //{\n // if (a[i]==\"[Beiju]\")\n // {\n // a[i] = \"*\";\n // }\n //}\n \n\n \n\n\n\n\n\n\n\n\n\n\n\n //Stack s = new Stack(); \n //while (true)\n //{\n // int x = int.Parse(Console.ReadLine());\n // int[] a = new int[100];\n // int[] b = new int[100];\n // if (x == 0) break;\n // while (true)\n // {\n // string[] arr = Console.ReadLine().Split();\n // if (arr[0] == \"0\") break;\n // for (int i = 0; i < arr.Length; i++)\n // {\n // a[i] = i + 1;\n // b[i] = Convert.ToInt16(arr[i]);\n // }\n // for (int i = 0; i < arr.Length; i++)\n // {\n // s.Push(a[i]);\n // c++;\n // u = i;\n // if (b[h] == a[i])\n // {\n // while (u != 0)\n // {\n // if (b[h] == a[u])\n // {\n // s.Pop();\n // u--;\n // c--;\n // h++;\n // }\n // else\n // {\n // Console.WriteLine(\"NO\");\n // f = 5;\n // break;\n // }\n // }\n // } \n // }\n // if (f != 5)\n // {\n // Console.WriteLine(\"YES\");\n // }\n // c = 0;\n // h = 0;\n // u = 0;\n // f = 0;\n // }\n\n\n //}\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n { \n static void Main(string[] args)\n { \n int n = int.Parse(Console.ReadLine());\n \n int[] a = new int[n];\n \n string[] token = Console.ReadLine().Split();\n \n for(int i=0;i=0;i--){\n if(a[i]>=0){\n pos += a[i];\n }else{\n neg += a[i];\n }\n }\n \n Console.WriteLine(pos-neg);\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace PartiotionCF\n{\n class Program\n {\n static void Main(string[] args)\n {\n int elementsCountInPartition = GetElementsCountInPartition();\n int[] elementsInPartition = GetElementsInPartition();\n\n int firstPartitionSum = elementsInPartition.Where(s => s > 0).Sum();\n int secondPartitionSum = elementsInPartition.Where(s => s < 0).Sum();\n\n Console.WriteLine(firstPartitionSum - secondPartitionSum);\n }\n\n static int GetElementsCountInPartition()\n {\n var firstLine = Console.ReadLine();\n return int.Parse(firstLine);\n }\n\n static int[] GetElementsInPartition()\n {\n var secondLine = Console.ReadLine();\n return secondLine?.Split(' ').Select(int.Parse).ToArray();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Xml.Serialization;\n\nclass Program\n{\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n\n var ans = a.Where(x => x > 0).Sum() - a.Where(x => x < 0).Sum();\n\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n if (input[i] >= 0)\n count += input[i];\n else\n count -= input[i];\n }\n\n Console.WriteLine($\"{count}\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n List b = new List();\n List c = new List();\n for (int i = 0; i < n; i++)\n if (a[i] >= 0) b.Add(a[i]);\n else c.Add(a[i]);\n Console.WriteLine(b.Sum() - c.Sum());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HelloWorld\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int s = 0;\n int n = Convert.ToInt32(Console.ReadLine());\n string line1 = Console.ReadLine();\n string[] arr1 = line1.Split(' ');\n\n int[] f1 = arr1.Select(ch => int.Parse(ch.ToString())).ToArray();\n\n \n foreach (int el in f1)\n {\n s += Math.Abs(el);\n }\n\n \n Console.WriteLine(s);\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] arg = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int sum = 0;\n foreach (int i in arg)\n sum += Math.Abs(i);\n Console.WriteLine(sum);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _14._03._2018\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int B = 0;\n int C = 0;\n int MaxIntersection = 0;\n string[] temp = Console.ReadLine().Split();\n int tmp = 0;\n for (int i = 0; i 0)\n B += tmp;\n else\n C += tmp;\n }\n MaxIntersection = B-C;\n\n Console.WriteLine(MaxIntersection);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n Console.ReadLine();\n var a = Console.ReadLine().Split().Select(s => int.Parse(s));\n int b = 0;\n int c = 0;\n\n foreach (var i in a)\n {\n if (i > 0)\n b += i;\n else\n c += i;\n }\n\n Console.WriteLine(b - c);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static int n;\n static int[] a;\n static void Main(string[] args)\n {\n GetData();\n int sum = 0;\n foreach (var cand in a)\n {\n sum += Math.Abs(cand);\n }\n Console.WriteLine(sum);\n }\n static void GetData()\n {\n var str = Console.ReadLine().Split();\n n = int.Parse(str[0]);\n a = new int[n];\n str = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(str[i]);\n }\n }\n }\n}\n"}, {"source_code": "//ReSharper disable All\nusing System;\n\nnamespace ConsoleApp1\n{\n using System.Collections.Generic;\n using System.Linq;\n\n class Program\n {\n public static void Main(string[] args)\n {\n int n= int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var l = new List();\n var l1 = new List();\n for (int i = 0; i < a.Length; i++)\n {\n if(a[i] < 0)\n l.Add(a[i]);\n else\n {\n l1.Add(a[i]);\n }\n }\n\n int max = l1.Sum() - l.Sum();\n Console.WriteLine(max);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] arr = Console.ReadLine().Split();\n List pos = new List();\n List neg = new List();\n for (int i = 0; i < n; i++)\n {\n if (arr[i][0] == '-')\n {\n neg.Add(int.Parse(arr[i]));\n }\n else\n {\n pos.Add(int.Parse(arr[i]));\n }\n }\n Console.WriteLine(pos.Sum() - neg.Sum());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Partition\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int[] a = new int[n];\n List A = new List();\n List B = new List();\n for (int i = 0; i < n; i++)\n {\n a[i] = Int32.Parse(s[i]);\n if (a[i] >= 0)\n A.Add(a[i]);\n else\n B.Add(a[i]);\n }\n A.Add(0);\n B.Add(0);\n Console.WriteLine(A.Sum() - B.Sum());\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var items = sr.ReadArrayOfInt32();\n var minus = items.Where(i => i < 0).ToArray();\n var plus = items.Where(i => i > 0);\n var sumMinus = minus.Sum();\n var sumPlus = plus.Sum();\n sw.WriteLine(sumPlus - sumMinus);\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum1, sum2;\n string[] mas=Console.ReadLine().Split(' ');\n sum1 = 0; sum2 = 0;\n int ad=0;\n for(int i=0;i0)\n {\n sum1 = sum1 + ad;\n }\n }\n Console.WriteLine((sum1 - sum2).ToString());\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n var split = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(split[i]);\n }\n int sum = 0;\n \n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] >= 0)\n {\n sum = sum + a[i];\n }\n else\n {\n sum = sum - a[i];\n }\n\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem946A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n int[] vals = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();\n int zero = vals.Where(_ => _ == 0).Count();\n int pos = vals.Where(_ => _ > 0).Count();\n int neg = vals.Where(_ => _ < 0).Count();\n\n Console.WriteLine(vals.Where(_ => _ > 0).Sum() - vals.Where(_ => _ < 0).Sum());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemA\n{\n\tpublic class Problem\n\t{\n\t\tint a;\n\t\tint[] s;\n\n\t\tpublic int[] ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\ta = ReadLine()[0];\n\t\t\ts = ReadLine();\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tvar b = s.Where(x => x >= 0).Sum();\n\t\t\tvar c = s.Where(x => x < 0).Sum();\n\t\t\tConsole.WriteLine(b - c);\n\t\t}\n\t}\n\n\tclass ProblemA\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace Compete.CFE39 {\n public class TaskA {\n public static void Main(string[] args) {\n new TaskA().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader input, TextWriter output) {\n // INPUT\n var n = int.Parse(input.ReadLine());\n var a = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n // SOLUTION\n var positive = a.Where(x => x > 0);\n var negative = a.Where(x => x < 0);\n var rv = positive.Sum() - negative.Sum();\n\n // OUTPUT\n output.WriteLine(rv);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(Console.ReadLine().Split().Select(x => Math.Abs(int.Parse(x))).Sum());\n }\n }\n}\n"}, {"source_code": "using System;\nclass MaxDiffSeq{\n static int findMaxDiff(int[] ar, int n){\n Array.Sort(ar);\n int[] sum = new int[n];\n sum[0] = ar[0];\n for(int i=1;i=0;i--){\n maxdiff = Math.Max(sum[n-1] - 2*sum[i], maxdiff);\n }\n return maxdiff;\n }\n static void Main(string[] args){\n int n = Convert.ToInt32(Console.ReadLine().Trim());\n string[] str = Console.ReadLine().Trim().Split(' ');\n int[] ar = Array.ConvertAll(str, Int32.Parse);\n Console.WriteLine(findMaxDiff(ar, n));\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = Console.ReadLine();\n var numbers = Console.ReadLine();\n int result = 0;\n numbers.Split(' ').ToList().ForEach(num =>\n {\n var toNum = Convert.ToInt32(num);\n if (toNum < 0) toNum = -toNum;\n result += toNum;\n });\n Console.Write(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n int sum = Console.ReadLine().Split(' ').Sum(x => Math.Abs(Convert.ToInt32(x)));\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ');\n int sum = a.Sum(x => Math.Abs(Convert.ToInt32(x)));\n Console.WriteLine(sum);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Solve());\n }\n\n static int Solve()\n {\n int n = int.Parse(Console.ReadLine());\n var nab = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int Bseq = 0, Cseq = 0;\n for (int i = 0; i < n; i++)\n {\n if (nab[i] >= 0) Bseq += nab[i];\n else Cseq += nab[i];\n }\n\n return Math.Abs(Bseq - Cseq);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CFSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int p = 0, o = 0;\n int n = int.Parse(Console.ReadLine());\n string[] astr = Console.ReadLine().Split(' ');\n for(int i = 0; i < n; i++)\n {\n int t = int.Parse(astr[i]);\n if (t > 0) p += t; else o += t;\n }\n Console.Write(p - o);\n } \n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = int.Parse(Console.ReadLine());\n int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (input.All(x => x >= 0)) Console.WriteLine(input.Sum());\n else\n {\n int C = input.Min();\n List vals = input.ToList();\n vals.Remove(C);\n int val = vals.Sum() + Math.Abs(C);\n Console.WriteLine(val);\n }\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace trololololol\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] y = Console.ReadLine().Split(' ');\n int max = 0, min = 0;\n for (int i = 0; i < y.Length; i++)\n {\n if (int.Parse(y[i]) > 0)\n {\n max = max + int.Parse(y[i]);\n }\n else if (int.Parse(y[i]) < 0)\n {\n min = min + int.Parse(y[i]);\n }\n }\n Console.WriteLine(max - min);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _14._03._2018\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n short[] mas = new short[n];\n int B = 0;\n int C = 0;\n int MaxIntersection = 0;\n string[] temp = Console.ReadLine().Split();\n\n for (int i = 0; i=0; i--)\n {\n B -= mas[i];\n C += mas[i];\n if (B - C > MaxIntersection)\n MaxIntersection = B - C;\n }\n Console.WriteLine(MaxIntersection);\n }\n }\n}\n"}], "src_uid": "4b5d14833f9b51bfd336cc0e661243a5"} {"source_code": "using System;\n\nnamespace Skyscraper\n{\n class Program\n {\n static void Main()\n {\n int t1 = Convert.ToInt32(Console.ReadLine());\n int t2 = Convert.ToInt32(Console.ReadLine());\n int t3 = Convert.ToInt32(Console.ReadLine());\n int t4 = Convert.ToInt32(Console.ReadLine());\n if (t3 > 0)\n if (t1 == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n if (t1 != t4)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine(\"1\");\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nnamespace BasicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n\t\tint B = int.Parse(Console.ReadLine());\n\t\tint C = int.Parse(Console.ReadLine());\n\t\tint D = int.Parse(Console.ReadLine());\n\t\tint ans = 1;\n\t\tif(A*2+B+C != B+C+D*2){\n\t\t\tans = 0;\n\t\t}\n\t\tif(C>0 && A==0){\n\t\t\tans = 0;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp56\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n \n long First = long.Parse(Console.ReadLine());\n long Second = long.Parse(Console.ReadLine()); \n long Three = long.Parse(Console.ReadLine()); \n long Four = long.Parse(Console.ReadLine()); \n\n if (First == 0 && Four == 0 && Three != 0) Console.WriteLine(\"0\"); \n else if (First != Four) Console.WriteLine(\"0\");\n else Console.WriteLine(\"1\");\n\n }\n\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing static System.Linq.Enumerable;\nusing static CompetitiveCSharp.IO;\n\nnamespace CompetitiveCSharp\n{\n static class IO\n {\n static Dummy dummy = new Dummy();\n static System.Text.StringBuilder builder = new System.Text.StringBuilder();\n class Dummy\n {\n ~Dummy()\n {\n Flush();\n }\n }\n static public void WriteLine(object str)\n {\n Write(str);\n builder.AppendLine();\n }\n static public void WriteLine()\n {\n builder.AppendLine();\n }\n static public void Write(object str)\n {\n builder.Append(str);\n }\n static public void Flush()\n {\n Console.Write(builder);\n builder.Clear();\n }\n static public string ReadLine()\n {\n return Console.ReadLine();\n }\n static public int ReadInt()\n {\n return int.Parse(ReadLine());\n }\n }\n static class Program\n {\n static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n static (T, T) ReadTuple2(Func parser)\n {\n var a = ReadArray(parser);\n return (a[0], a[1]);\n }\n static bool Run(long[] data)\n {\n if (data[0] != data[3])\n {\n return false;\n }\n return data[0] != 0 || data[2] == 0;\n }\n static void Main(string[] args)\n {\n var data = new long[4];\n foreach(var i in Range(0, 4))\n {\n data[i] = long.Parse(ReadLine());\n }\n WriteLine(Run(data) ? 1 : 0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a ,b, c, d,m,n;\n a =int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n d = int.Parse(Console.ReadLine());\n m = (a * 2) + (b) + (c);\n n = (d * 2) + (b) + (c);\n if ((a == 0 && d == 0 && c != 0) || m!= n)\n {\n Console.WriteLine(0); \n }\n else\n {\n Console.WriteLine(1);\n }\n \n\n\n }\n }\n}\n"}, {"source_code": "//using MetadataExtractor;\n//using MetadataExtractor.Formats.Exif;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n /*public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }*/\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n class Coord\n {\n public int x;\n public int y;\n public double d;\n }\n\n\n public static double dist(int x1,int y1,int x2,int y2)\n {\n int dx = x2 - x1;\n int dy = y2 - y1;\n\n return Math.Sqrt(dx * dx + dy * dy);\n\n }\n static void Main(string[] args)\n {\n int n1 = ReadIntLine();\n int n2 = ReadIntLine();\n int n3 = ReadIntLine();\n int n4 = ReadIntLine();\n \n if (n1 != n4){PrintLn(0);return;}\n if (n3>0 && n1==0) {PrintLn(0);return;}\n PrintLn(1);\n\t\t\t\n }\n\n\n\n }\n\n\n\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1132A\n {\n public static void Main()\n {\n int cnt1 = int.Parse(Console.ReadLine());\n int cnt2 = int.Parse(Console.ReadLine());\n int cnt3 = int.Parse(Console.ReadLine());\n int cnt4 = int.Parse(Console.ReadLine());\n\n Console.WriteLine(cnt1 == cnt4 && (cnt1 > 0 || cnt3 == 0) ? 1 : 0);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Contest\n{\n class Scanner\n {\n public Scanner()\n {\n _stream = new StreamReader(Console.OpenStandardInput());\n _pos = 0;\n _line = new string[0];\n _separator = ' ';\n }\n\n private char _separator;\n private StreamReader _stream;\n private int _pos;\n private string[] _line;\n\n #region get a element\n\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = _stream.ReadLine().Split(_separator);\n _pos = 0;\n }\n\n return _line[_pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n\n #endregion\n\n #region convert array\n\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n\n #endregion\n\n #region get row elements\n\n #region get array\n\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = _stream.ReadLine().Split(_separator);\n\n _pos = _line.Length;\n return _line;\n }\n\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n\n #endregion\n\n #region get 2~4 elements\n\n public void GetRow(out string a, out string b)\n {\n a = Next();\n b = Next();\n }\n\n public void GetRow(out string a, out string b, out string c)\n {\n a = Next();\n b = Next();\n c = Next();\n }\n\n public void GetRow(out string a, out string b, out string c, out string d)\n {\n a = Next();\n b = Next();\n c = Next();\n d = Next();\n }\n\n public void GetIntRow(out int a, out int b)\n {\n a = NextInt();\n b = NextInt();\n }\n\n public void GetIntRow(out int a, out int b, out int c)\n {\n a = NextInt();\n b = NextInt();\n c = NextInt();\n }\n\n public void GetIntRow(out int a, out int b, out int c, out int d)\n {\n a = NextInt();\n b = NextInt();\n c = NextInt();\n d = NextInt();\n }\n\n public void GetLongRow(out long a, out long b)\n {\n a = NextLong();\n b = NextLong();\n }\n\n public void GetLongRow(out long a, out long b, out long c)\n {\n a = NextLong();\n b = NextLong();\n c = NextLong();\n }\n\n public void GetLongRow(out long a, out long b, out long c, out long d)\n {\n a = NextLong();\n b = NextLong();\n c = NextLong();\n d = NextLong();\n }\n\n public void GetDoubleRow(out double a, out double b)\n {\n a = NextDouble();\n b = NextDouble();\n }\n\n public void GetDoubleRow(out double a, out double b, out double c)\n {\n a = NextDouble();\n b = NextDouble();\n c = NextDouble();\n }\n\n public void GetDoubleRow(out double a, out double b, out double c, out double d)\n {\n a = NextDouble();\n b = NextDouble();\n c = NextDouble();\n d = NextDouble();\n }\n\n #endregion\n\n #endregion\n\n #region get 2~4 column elements\n\n public void GetColumn(int n, out string[] a)\n {\n a = new string[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b)\n {\n a = new string[n];\n b = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i]);\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b, out string[] c)\n {\n a = new string[n];\n b = new string[n];\n c = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i], out c[i]);\n }\n }\n\n public void GetColumn(int n, out string[] a, out string[] b, out string[] c, out string[] d)\n {\n a = new string[n];\n b = new string[n];\n c = new string[n];\n d = new string[n];\n for (int i = 0; i < n; i++)\n {\n GetRow(out a[i], out b[i], out c[i], out d[i]);\n }\n }\n\n public void GetIntColumn(int n, out int[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToIntArray(sa);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b, out int[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n c = ToIntArray(sc);\n }\n\n public void GetIntColumn(int n, out int[] a, out int[] b, out int[] c, out int[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToIntArray(sa);\n b = ToIntArray(sb);\n c = ToIntArray(sc);\n d = ToIntArray(sd);\n }\n\n public void GetLongColumn(int n, out long[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToLongArray(sa);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b, out long[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n c = ToLongArray(sc);\n }\n\n public void GetLongColumn(int n, out long[] a, out long[] b, out long[] c, out long[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToLongArray(sa);\n b = ToLongArray(sb);\n c = ToLongArray(sc);\n d = ToLongArray(sd);\n }\n\n public void GetDoubleColumn(int n, out double[] a)\n {\n string[] sa;\n GetColumn(n, out sa);\n a = ToDoubleArray(sa);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b)\n {\n string[] sa, sb;\n GetColumn(n, out sa, out sb);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b, out double[] c)\n {\n string[] sa, sb, sc;\n GetColumn(n, out sa, out sb, out sc);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n c = ToDoubleArray(sc);\n }\n\n public void GetDoubleColumn(int n, out double[] a, out double[] b, out double[] c, out double[] d)\n {\n string[] sa, sb, sc, sd;\n GetColumn(n, out sa, out sb, out sc, out sd);\n a = ToDoubleArray(sa);\n b = ToDoubleArray(sb);\n c = ToDoubleArray(sc);\n d = ToDoubleArray(sd);\n }\n\n #endregion\n\n #region get matrix\n\n public string[][] GetMatrix(int h)\n {\n string[][] result = new string[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = Array();\n }\n\n return result;\n\n }\n\n public int[][] GetIntMatrix(int h)\n {\n int[][] result = new int[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = IntArray();\n }\n\n return result;\n }\n\n public long[][] GetLongMatrix(int h)\n {\n long[][] result = new long[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = LongArray();\n }\n\n return result;\n }\n\n public double[][] GetDoubleMatrix(int h)\n {\n double[][] result = new double[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = DoubleArray();\n }\n\n return result;\n }\n\n public char[][] GetCharMatrix(int h)\n {\n char[][] result = new char[h][];\n for (int i = 0; i < h; i++)\n {\n result[i] = Next().ToCharArray();\n }\n\n return result;\n }\n\n #endregion\n }\n\n class Program\n {\n\n public void Solve()\n {\n var sc = new Scanner();\n int c1, c2, c3, c4;\n sc.GetIntRow(out c1, out c2, out c3, out c4);\n\n // ((, (), )(, ))\n\n if (c3 > 0)\n {\n if (c1 <= 0)\n {\n Console.WriteLine(0);\n return;\n }\n }\n\n if (c1 != c4)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(1);\n\n }\n\n static void Main(string[] args) => new Program().Solve();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());\n int c2 = Convert.ToInt32(Console.ReadLine());\n int c3 = Convert.ToInt32(Console.ReadLine());\n int c4 = Convert.ToInt32(Console.ReadLine());\n if(c1 == 0)\n {\n if (c3 == 0 && c4 == 0)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n else if(c4 == c1)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n\t\t\twriter.WriteLine(valueToWrite.ToString(\"F8\"));\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n long cnt1, cnt2, cnt3, cnt4;\n\n public void Solve()\n {\n cnt1 = long.Parse(ioHelper.ReadNextToken());\n cnt2 = long.Parse(ioHelper.ReadNextToken());\n cnt3 = long.Parse(ioHelper.ReadNextToken());\n cnt4 = long.Parse(ioHelper.ReadNextToken());\n\n bool bPosib = true;\n long delta = cnt1 * 2;\n if (delta <= 0 && cnt3 > 0)\n bPosib = false;\n delta -= cnt4 * 2;\n if (delta != 0)\n bPosib = false;\n\n if (bPosib)\n ioHelper.WriteLine(\"1\");\n else\n ioHelper.WriteLine(\"0\");\n\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint A = int.Parse(Console.ReadLine());\n\t\tint B = int.Parse(Console.ReadLine());\n\t\tint C = int.Parse(Console.ReadLine());\n\t\tint D = int.Parse(Console.ReadLine());\n\t\tint ans = 1;\n\t\tif(A*2+B+C != B+C+D*2){\n\t\t\tans = 0;\n\t\t}\n\t\tif(C>0 && A==0){\n\t\t\tans = 0;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Regular_Bracket_Sequence\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"1\" : \"0\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int n1 = Next();\n int n2 = Next();\n int n3 = Next();\n int n4 = Next();\n\n return n1 == n4 && (n3 > 0 && n1 != 0 || n3 == 0);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(Console.ReadLine());\n long b = long.Parse(Console.ReadLine());\n long c = long.Parse(Console.ReadLine());\n long d = long.Parse(Console.ReadLine());\n\n if (a == d)\n {\n if (a > 0) \n {\n Console.WriteLine(1);\n return;\n }\n if (c == 0) \n {\n Console.WriteLine(1);\n return;\n }\n }\n Console.WriteLine(0);\n return;\n }\n }\n}"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"3\n1\n4\n3\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var A = cin.NextInt();\n var B = cin.NextInt();\n var C = cin.NextInt();\n var D = cin.NextInt();\n\n if (A + C + D == 0) {\n System.Console.WriteLine(1);\n return;\n }\n\n if (A == 0) {\n System.Console.WriteLine(0);\n return;\n }\n\n if (D != A) {\n System.Console.WriteLine(0);\n return;\n }\n\n System.Console.WriteLine(1);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // System.Console.Write(cout.ToString());\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static IEnumerable IndicesWhere(this IEnumerable seq, Func cond) {\n var i = 0;\n foreach (var item in seq) {\n if (cond(item)) yield return i;\n i++;\n }\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n \n\n int sumo1 = c1 * 2;\n int sumo3 = c3;\n int sumo4 = c4 * 2;\n \n\n\n \n if (sumo1==sumo4&&sumo3==0) { \n \n Console.WriteLine(\"1\");\n \n }\n else if(sumo1 == sumo4 && sumo3> 0&&sumo1>0)\n Console.WriteLine(\"1\");\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n\n"}, {"source_code": "/* Date: 05.03.2019 * Time: 21:45 */\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Swap (ref int a, ref int b)\n\t{\n\t\tint c = a; a = b; b = c;\n\t}\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n1, n2, n3, n4;\n\n# if ( ONLINE_JUDGE )\n\t\tn1 = int.Parse (Console.ReadLine ());\n\t\tn2 = int.Parse (Console.ReadLine ());\n\t\tn3 = int.Parse (Console.ReadLine ());\n\t\tn4 = int.Parse (Console.ReadLine ());\n# else\n\t\tn1 = int.Parse (sr.ReadLine ());\n\t\tn2 = int.Parse (sr.ReadLine ());\n\t\tn3 = int.Parse (sr.ReadLine ());\n\t\tn4 = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** n1 = \" + n1);\n\t\tsw.WriteLine (\"*** n2 = \" + n2);\n\t\tsw.WriteLine (\"*** n3 = \" + n3);\n\t\tsw.WriteLine (\"*** n4 = \" + n4);\n# endif\n\n\t\tint k = 0;\n\t\tif ( n1 == n4 && (n3 == 0 || n3 > 0 && n1 > 0) )\n\t\t\tk = 1;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, d;\n a = int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n d = int.Parse(Console.ReadLine());\n if ((c>0)&&(a==0))\n {\n Console.Write(0);\n return;\n }\n if(d!=a)\n {\n Console.Write(0);\n return;\n }\n Console.Write(1);\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count1 = int.Parse(Console.ReadLine());\n int count2 = int.Parse(Console.ReadLine());\n int count3 = int.Parse(Console.ReadLine());\n int count4 = int.Parse(Console.ReadLine());\n int result = 1;\n\n if (count1 != count4 || (count3 > 0 && count1 == 0))\n result = 0;\n\n Console.WriteLine($\"{result}\");\n Console.ReadLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n \n\n int sumo1 = c1 * 2;\n int sumo3 = c3;\n int sumo4 = c4 * 2;\n \n\n\n \n if (sumo1==sumo4&&sumo3<=sumo1+1) { \n Console.WriteLine(\"1\");\n \n }\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n \n\n int sumo1 = c1 * 2;\n int sumo3 = c3;\n int sumo4 = c4 * 2;\n \n\n\n \n if (sumo1==sumo4&&sumo3 0)\n {\n sum = sum + 1;\n sumo = sumo - 1;\n }\n }\n\n if (strcom.Length == sum * 2) { \n Console.WriteLine(\"1\");\n \n }\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing static System.Linq.Enumerable;\nusing static CompetitiveCSharp.IO;\n\nnamespace CompetitiveCSharp\n{\n static class IO\n {\n static Dummy dummy = new Dummy();\n static System.Text.StringBuilder builder = new System.Text.StringBuilder();\n class Dummy\n {\n ~Dummy()\n {\n Flush();\n }\n }\n static public void WriteLine(object str)\n {\n Write(str);\n builder.AppendLine();\n }\n static public void WriteLine()\n {\n builder.AppendLine();\n }\n static public void Write(object str)\n {\n builder.Append(str);\n }\n static public void Flush()\n {\n Console.Write(builder);\n builder.Clear();\n }\n static public string ReadLine()\n {\n return Console.ReadLine();\n }\n static public int ReadInt()\n {\n return int.Parse(ReadLine());\n }\n }\n static class Program\n {\n static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n static (T, T) ReadTuple2(Func parser)\n {\n var a = ReadArray(parser);\n return (a[0], a[1]);\n }\n static bool Run(long[] data)\n {\n if(data[0]!=data[3])\n {\n return false;\n }\n return data[2] == 0;\n }\n static void Main(string[] args)\n {\n var data = new long[4];\n foreach(var i in Range(0, 4))\n {\n data[i] = long.Parse(ReadLine());\n }\n WriteLine(Run(data) ? 1 : 0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing static System.Linq.Enumerable;\nusing static CompetitiveCSharp.IO;\n\nnamespace CompetitiveCSharp\n{\n static class IO\n {\n static Dummy dummy = new Dummy();\n static System.Text.StringBuilder builder = new System.Text.StringBuilder();\n class Dummy\n {\n ~Dummy()\n {\n Flush();\n }\n }\n static public void WriteLine(object str)\n {\n Write(str);\n builder.AppendLine();\n }\n static public void WriteLine()\n {\n builder.AppendLine();\n }\n static public void Write(object str)\n {\n builder.Append(str);\n }\n static public void Flush()\n {\n Console.Write(builder);\n builder.Clear();\n }\n static public string ReadLine()\n {\n return Console.ReadLine();\n }\n static public int ReadInt()\n {\n return int.Parse(ReadLine());\n }\n }\n static class Program\n {\n static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n static (T, T) ReadTuple2(Func parser)\n {\n var a = ReadArray(parser);\n return (a[0], a[1]);\n }\n static bool Run(long[] data)\n {\n return data[0] == data[3];\n }\n static void Main(string[] args)\n {\n var data = new long[4];\n foreach(var i in Range(0, 4))\n {\n data[i] = long.Parse(ReadLine());\n }\n WriteLine(Run(data) ? 1 : 0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing static System.Linq.Enumerable;\nusing static CompetitiveCSharp.IO;\n\nnamespace CompetitiveCSharp\n{\n static class IO\n {\n static Dummy dummy = new Dummy();\n static System.Text.StringBuilder builder = new System.Text.StringBuilder();\n class Dummy\n {\n ~Dummy()\n {\n Flush();\n }\n }\n static public void WriteLine(object str)\n {\n Write(str);\n builder.AppendLine();\n }\n static public void WriteLine()\n {\n builder.AppendLine();\n }\n static public void Write(object str)\n {\n builder.Append(str);\n }\n static public void Flush()\n {\n Console.Write(builder);\n builder.Clear();\n }\n static public string ReadLine()\n {\n return Console.ReadLine();\n }\n static public int ReadInt()\n {\n return int.Parse(ReadLine());\n }\n }\n static class Program\n {\n static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n static (T, T) ReadTuple2(Func parser)\n {\n var a = ReadArray(parser);\n return (a[0], a[1]);\n }\n static bool Run(long[] data)\n {\n if (data[0] != data[3])\n {\n return false;\n }\n return data[2] != 0;\n }\n static void Main(string[] args)\n {\n var data = new long[4];\n foreach(var i in Range(0, 4))\n {\n data[i] = long.Parse(ReadLine());\n }\n WriteLine(Run(data) ? 1 : 0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n if (a == d)\n {\n Console.WriteLine(1);\n return;\n }\n Console.WriteLine(0);\n return;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n if (a == d && a > 0)\n {\n Console.WriteLine(1);\n return;\n }\n Console.WriteLine(0);\n return;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1=Convert.ToInt32(Console.ReadLine());//((\n int c2=Convert.ToInt32(Console.ReadLine());//()\n int c3=Convert.ToInt32(Console.ReadLine());//)(\n int c4=Convert.ToInt32(Console.ReadLine());//))\n\n int sumo = 0;\n int sumc = 0;\n sumo = c1 * 2 + c2 + c3;\n sumc = c4 * 2 + c2 + c3;\n if (sumo == sumc)\n Console.WriteLine(\"1\");\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n \n\n int sumo1 = c1 * 2;\n int sumo3 = c3;\n int sumo4 = c4 * 2;\n \n\n\n \n if (sumo1==sumo4&&sumo3<=sumo1) { \n Console.WriteLine(\"1\");\n \n }\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n \n\n int sumo1 = c1 * 2;\n int sumo3 = c3;\n int sumo4 = c4 * 2;\n \n\n\n \n if (sumo1==sumo4&&sumo3<=sumo1|| sumo1 == sumo4 && sumo3 >=1) { \n Console.WriteLine(\"1\");\n \n }\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int c1 = Convert.ToInt32(Console.ReadLine());//((\n int c2 = Convert.ToInt32(Console.ReadLine());//()\n int c3 = Convert.ToInt32(Console.ReadLine());//)(\n int c4 = Convert.ToInt32(Console.ReadLine());//))\n\n string str1 = new string ('(', c1*2);\n string str2 = \"\";// new string (\"()\", c2);\n string str3 = \"\"; //new string (\")(\", c3);\n string str4 = new string (')', c4);\n\n for (int i = 0; i < c2; i++)\n {\n str2 += \"()\";\n\n\n }\n \n for (int i = 0; i < c3; i++)\n {\n str3 += \")(\";\n\n }\n \n int sumo = 0;\n \n int sum = 0;\n\n\n string strcom = str1 + str2 + str3 + str4;\n foreach (char n in strcom) {\n if (n == '(')\n {\n sumo = sumo + 1;\n }\n else if (n == ')' && sumo > 0)\n {\n sum = sum + 1;\n sumo = sumo - 1;\n }\n }\n\n if (strcom.Length == sum * 2) { \n Console.WriteLine(\"1\");\n \n }\n else\n Console.WriteLine(\"0\");\n }\n }\n}\n"}], "src_uid": "b99578086043537297d374dc01eeb6f8"} {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.Threading;\n\npublic static class ProblemC\n{\n #region Common routines\n\n private static int _currentTokenNumber;\n\n private static string[] _tokens;\n\n private static void StartReading()\n {\n _currentTokenNumber = 0;\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n _tokens = Console.In.ReadToEnd().Split(new[] { ' ', '\\t', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string NextString()\n {\n return _tokens[_currentTokenNumber++];\n }\n\n private static int NextInt()\n {\n return int.Parse(NextString());\n }\n\n private static long NextLong()\n {\n return long.Parse(NextString());\n }\n\n #endregion\n\n private const long Mod = 1000000007;\n\n private static void Main(string[] args)\n {\n StartReading();\n\n long x = NextLong();\n long k = NextLong();\n\n var result = Solve(x, k);\n\n Console.WriteLine(result);\n }\n\n private static long Solve(long x, long k)\n {\n if (x == 0) return 0;\n x = (x * 2)%Mod;\n\n long d = Deg2(k);\n\n long result = (x * d) % Mod - d + 1;\n while (result < 0) result += Mod;\n return result;\n\n }\n\n private static long Deg2(long n)\n {\n if (n == 0) return 1;\n var mid = Deg2(n / 2);\n\n long result = (mid * mid) % Mod;\n if (n % 2 == 1) result = (result * 2) % Mod;\n return result;\n }\n}", "positive_code": [{"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace _489\u0441\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n static long mod = 1000 * 1000 * 1000 + 7;\n\n static void Solution(int testNumber)\n {\n checked\n {\n #region SOLUTION\n var d = ReadLongArray();\n var x = d[0];\n var k = d[1];\n\n if (x == 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n x %= mod;\n k++;\n var kp = Pow(2, k);\n kp *= x;\n kp %= mod;\n\n var next = 1L;\n if (k == 2)\n {\n next = -1;\n }\n else if (k == 1)\n {\n next = 0;\n }\n else if (k > 2)\n {\n //var gp = (1 - Pow(2, k - 2)) / (1 - 2);\n next = -Pow(2, k - 1) + 1;\n next %= mod;\n }\n\n var res = kp + next;\n if (res < 0)\n {\n res += mod;\n }\n res %= mod;\n\n Console.WriteLine(res);\n }\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static long Pow(long a, long pp)\n {\n checked\n {\n var res = 1L;\n while (true)\n {\n if (pp % 2 == 1)\n {\n res *= a;\n res %= mod;\n pp--;\n }\n else\n {\n pp /= 2;\n a *= a;\n\n a %= mod;\n }\n\n if (pp == 0)\n {\n break;\n }\n }\n\n return res;\n }\n \n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.StartsWith(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace bla\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long k = long.Parse(s[1]) + 1;\n if (x == 0)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine((((((x % mod) * pow(k)) % mod) - pow(k - 1) + 1) % mod + mod) % mod);\n }\n }\n\n static long mod = 1000000007;\n\n static long pow(long n) //2^n\n {\n if (n == 0)\n return 1;\n if(n % 2 == 0)\n {\n long a = pow(n / 2);\n return (a * a) % mod;\n }\n return (2 * pow(n - 1)) % mod;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nnamespace Z5\n{\n\tclass Program\n\t{\n\t\tstatic BigInteger MOD = 1000 * 1000 * 1000 + 7;\n\t\tstatic BigInteger BinPow(BigInteger p)\n\t\t{\n\t\t\tBigInteger res = 1;\n\t\t\tBigInteger num = 2;\n\n\t\t\twhile (p > 0)\n\t\t\t{\n\t\t\t\tif(p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= num;\n\t\t\t\t\tres %= MOD;\n\t\t\t\t\t--p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tnum *= num;\n\t\t\t\t\tnum %= MOD;\n\t\t\t\t\tp /= 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] req = Console.ReadLine().Split(' ');\n\n\t\t\tBigInteger n, k;\n\n\t\t\tlong t;\n\t\t\tt = long.Parse(req[0]);\n\t\t\tn = t;\n\n\t\t\tt = long.Parse(req[1]);\n\t\t\tk = t;\n\n\t\t\tif(n==0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tBigInteger p = BinPow(k);\n\n\t\t\tBigInteger res = 2 * p * n - p + 1;\n\t\t\tConsole.WriteLine(res % MOD);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n Scanner sc = new Scanner();\n //\n\n public void Solve()\n {\n var a = sc.Next();\n ModInt x = a; long k = sc.Next();\n if (a == 0) Fail(0);\n if (k == 0) Fail((x << 1) % ModInt.MOD);\n WriteLine(ModInt.Pow(2, k) * (2 * x - 1) + 1);\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac;//\u968e\u4e57\n private static ModInt[] inv;//\u9006\u6570\n private static ModInt[] facinv;//1/(i!)\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = 1;\n fac[0] = fac[1] = 1;\n facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(ModInt n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(ModInt n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(ModInt n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(ModInt n, ModInt r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n var calc = fac[n];\n calc = calc * facinv[r];\n calc = calc * facinv[n - r];\n return calc;\n }\n}\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Nastya_and_a_Wardrobe\n{\n internal class Program\n {\n private const int mod = 1000000007;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Pow(long a, long k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n private static long Solve(string[] args)\n {\n long x = Next();\n long k = Next();\n\n if (x == 0)\n return 0;\n\n long p = Pow(2, k);\n long ans = ((p * 2 + 2) / 2 + 2 * ((x - 1) % mod) * (p % mod)) % mod;\n return ans;\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nnamespace Z5\n{\n\tclass Program\n\t{\n\t\tstatic BigInteger MOD = 1000 * 1000 * 1000 + 7;\n\t\tstatic BigInteger BinPow(BigInteger p)\n\t\t{\n\t\t\tBigInteger res = 1;\n\t\t\tBigInteger num = 2;\n\n\t\t\twhile (p > 0)\n\t\t\t{\n\t\t\t\tif(p % 2 == 1)\n\t\t\t\t{\n\t\t\t\t\tres *= num;\n\t\t\t\t\tres %= MOD;\n\t\t\t\t\t--p;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tnum *= num;\n\t\t\t\t\tnum %= MOD;\n\t\t\t\t\tp /= 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] req = Console.ReadLine().Split(' ');\n\n\t\t\tBigInteger n, k;\n\n\t\t\tlong t;\n\t\t\tt = long.Parse(req[0]);\n\t\t\tn = t;\n\n\t\t\tt = long.Parse(req[1]);\n\t\t\tk = t;\n\n\t\t\tBigInteger p = BinPow(k);\n\n\t\t\tBigInteger res = 2 * p * n - p + 1;\n\t\t\tConsole.WriteLine(res % MOD);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n Scanner sc = new Scanner();\n //\n\n public void Solve()\n {\n long x, k;\n sc.Make(out x, out k);\n x %= ModInt.MOD;\n if (x == 0) Fail(0);\n if (k == 0) Fail((x << 1) % ModInt.MOD);\n WriteLine(ModInt.Pow(2, k ) * (2*x - 1) + 1);\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac;//\u968e\u4e57\n private static ModInt[] inv;//\u9006\u6570\n private static ModInt[] facinv;//1/(i!)\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = 1;\n fac[0] = fac[1] = 1;\n facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(ModInt n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(ModInt n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(ModInt n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(ModInt n, ModInt r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n var calc = fac[n];\n calc = calc * facinv[r];\n calc = calc * facinv[n - r];\n return calc;\n }\n}\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Nastya_and_a_Wardrobe\n{\n internal class Program\n {\n private const int mod = 1000000007;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Pow(long a, long k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n private static long Solve(string[] args)\n {\n long x = Next();\n long k = Next();\n\n if (x == 0)\n return 0;\n\n long p = Pow(2, k);\n long ans = ((p*2 + 2)/2 + 2*(x - 1)*p)%mod;\n return ans;\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace _489\u0441\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n static long mod = 1000 * 1000 * 1000 + 7;\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadLongArray();\n var x = d[0];\n var k = d[1];\n\n if (x == 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n k++;\n var kp = Pow(2, k);\n kp *= x;\n kp %= mod;\n\n var next = 1L;\n if (k == 2)\n {\n next = -1;\n }\n else if (k == 1)\n {\n next = 0;\n }\n else if (k > 2)\n {\n next = -Pow(2, k - 2) - 1;\n }\n\n var res = kp + next;\n res %= mod;\n\n Console.WriteLine(res);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static long Pow(long a, long pp)\n {\n var res = 1L;\n while (true)\n {\n if (pp % 2 == 1)\n {\n res *= a;\n res %= mod;\n pp--;\n }\n else\n {\n pp /= 2;\n a *= a;\n\n a %= mod;\n }\n\n if (pp == 0)\n {\n break;\n }\n }\n\n return res;\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace _489\u0441\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n static long mod = 1000 * 1000 * 1000 + 7;\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadLongArray();\n var x = d[0];\n var k = d[1];\n\n if (x == 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n k++;\n var kp = Pow(2, k);\n kp *= x;\n kp %= mod;\n\n var next = 1L;\n if (k == 2)\n {\n next = -1;\n }\n else if (k == 1)\n {\n next = 0;\n }\n else if (k > 2)\n {\n //var gp = (1 - Pow(2, k - 2)) / (1 - 2);\n next = -Pow(2, k - 1) + 1;\n }\n\n var res = kp + next;\n res %= mod;\n\n Console.WriteLine(res);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static long Pow(long a, long pp)\n {\n var res = 1L;\n while (true)\n {\n if (pp % 2 == 1)\n {\n res *= a;\n res %= mod;\n pp--;\n }\n else\n {\n pp /= 2;\n a *= a;\n\n a %= mod;\n }\n\n if (pp == 0)\n {\n break;\n }\n }\n\n return res;\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.StartsWith(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.Threading;\n\npublic static class ProblemC\n{\n #region Common routines\n\n private static int _currentTokenNumber;\n\n private static string[] _tokens;\n\n private static void StartReading()\n {\n _currentTokenNumber = 0;\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n _tokens = Console.In.ReadToEnd().Split(new[] { ' ', '\\t', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string NextString()\n {\n return _tokens[_currentTokenNumber++];\n }\n\n private static int NextInt()\n {\n return int.Parse(NextString());\n }\n\n private static long NextLong()\n {\n return long.Parse(NextString());\n }\n\n #endregion\n\n private const long Mod = 1000000007;\n\n private static void Main(string[] args)\n {\n StartReading();\n\n long x = NextLong();\n long k = NextLong();\n\n var result = Solve(x, k);\n\n Console.WriteLine(result);\n }\n\n private static long Solve(long x, long k)\n {\n if (x == 0) return 0;\n x = x * 2;\n\n long d = Deg2(k);\n\n long result = (x * d) % Mod - d + 1;\n while (result < 0) result += Mod;\n return result;\n\n }\n\n private static long Deg2(long n)\n {\n if (n == 0) return 1;\n var mid = Deg2(n / 2);\n\n long result = (mid * mid) % Mod;\n if (n % 2 == 1) result = (result * 2) % Mod;\n return result;\n }\n}"}], "src_uid": "e0e017e8c8872fc1957242ace739464d"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nusing E = System.Linq.Enumerable;\nusing System.Threading;\nusing System.Numerics;\n\ninternal partial class Solver {\n public void Run() {\n var m = nl();\n var x = nl();\n\n cout.WriteLine(Solve(m, x));\n }\n\n /*\n Sample 1\n 0 -> 0\n 1 -> 3 -> 1 -> 3\n 2 -> 2 -> 2 -> 2 (2*3^x%4 --> 3^x%2 \u3068\u7b49\u5316)\n 3 -> 1 -> 3 -> 1\n\n g = gcd(start, M) \u3054\u3068\u306b\u5834\u5408\u5206\u3051\u3059\u308c\u3070\u3088\u3044\n start' = start / g\n M' = M / g\n start, start * x, ... start * x^k % M ->\n (start/g), start, ... start * x^k % M')\n start', start' * x, ... start' * x^k % M'\n\n * */\n\n public List Factorize(long x) {\n var res = new List();\n for (long i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n res.Add(i);\n while (x % i == 0) x /= i;\n }\n }\n if (x != 1) res.Add(x);\n return res;\n }\n\n /// \n /// return min d where a^d = 1 (mod m)\n /// \n private long MultiplicativeOrder(IEnumerable primes, long a, long m) {\n var phi = Phi(m);\n var res = phi;\n foreach (var p in primes) {\n if (p > phi) break;\n while (res % p == 0 && BigInteger.ModPow(a, res / p, m) == 1) {\n res /= p;\n phi /= p;\n }\n while (phi % p == 0) phi /= p;\n }\n if (phi > 1 && BigInteger.ModPow(a, res / phi, m) == 1) {\n res /= phi;\n }\n return res;\n }\n\n private long Solve(long m, long x) {\n // from i to (i*x)%m\n long ans = 0;\n // x^phi(m) = 1 (mod m) \n var primes = Factorize(m);\n var len = primes.Count;\n for (int i = 0; i < len; i++) {\n primes.AddRange(Factorize(primes[i] - 1));\n }\n primes.Sort();\n primes = primes.Distinct().ToList();\n\n foreach (var g in Divisors(m)) {\n var m2 = m / g;\n var phi = Phi(m2);\n ans += phi / MultiplicativeOrder(primes, x, m2);\n }\n return ans;\n }\n\n public static long ModPow(long x, long n, long mod) {\n long t = x, ret = 1;\n while (n > 0) {\n if ((n & 1) != 0) {\n ret = (long)(((decimal)t * ret) % mod);\n }\n t = (long)((decimal)t * t % mod);\n n >>= 1;\n }\n return ret;\n }\n\n public static long Phi(long n) {\n long phi = n;\n\n for (long i = 2; i * i <= n && i < n; i++) {\n if (n % i == 0) {\n while (n % i == 0) {\n n /= i;\n }\n\n phi = phi / i * (i - 1);\n }\n }\n if (n > 1) {\n phi = phi / n * (n - 1);\n }\n\n return phi;\n }\n\n Dictionary> cache = new Dictionary>();\n\n public List Divisors(PrimeSet primes, long x) {\n //if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List { 1 };\n foreach (var p in primes) {\n if (p * p > x) break;\n int last = 0;\n while (x % p == 0) {\n int count = ret.Count;\n for (int i = last; i < count; i++) {\n ret.Add(ret[i] * p);\n }\n last = count;\n x /= p;\n }\n }\n if (x != 1) {\n int count = ret.Count;\n for (int i = 0; i < count; i++) {\n ret.Add(ret[i] * x);\n }\n }\n cache[x] = ret;\n return ret;\n }\n\n public List Divisors(long x) {\n if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List();\n for (long i = 1; i * i <= x; i++) {\n if (x % i == 0) {\n ret.Add(i);\n if (i != x / i) {\n ret.Add(x / i);\n }\n }\n }\n ret.Sort();\n cache[x] = ret;\n return ret;\n }\n\n}\n\n\npublic class PrimeSet : List {\n private readonly bool[] isPrime;\n\n public PrimeSet(int size)\n : base() {\n isPrime = Enumerable.Repeat(true, size).ToArray();\n Add(2);\n for (int i = 3; i <= size; i += 2) {\n if (!isPrime[i >> 1]) {\n continue;\n }\n\n Add(i);\n for (long j = (long)i * i; j <= size; j += i + i) {\n isPrime[j >> 1] = false;\n }\n }\n }\n\n public bool IsPrime(long x) {\n if (x == 2) {\n return true;\n }\n\n if (x <= 1 || x % 2 == 0) {\n return false;\n }\n\n return isPrime[x >> 1];\n }\n}\n\n// PREWRITEN CODE BEGINS FROM HERE\n\nstatic public class StringExtensions {\n static public string JoinToString(this IEnumerable source, string separator = \" \") {\n return string.Join(separator, source);\n }\n}\n\ninternal partial class Solver : Scanner {\n static readonly int? StackSizeInMebiByte = null; //50;\n public static void StartAndJoin(Action action, int maxStackSize) {\n var thread = new Thread(new ThreadStart(action), maxStackSize);\n thread.Start();\n thread.Join();\n }\n\n public static void Main() {\n#if LOCAL\n byte[] inputBuffer = new byte[1000000];\n var inputStream = Console.OpenStandardInput(inputBuffer.Length);\n using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {\n Console.SetIn(reader);\n new Solver(Console.In, Console.Out).Run();\n }\n#else\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n if (StackSizeInMebiByte.HasValue) {\n StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);\n } else {\n new Solver(Console.In, Console.Out).Run();\n }\n Console.Out.Flush();\n#endif\n }\n\n#pragma warning disable IDE0052\n private readonly TextReader cin;\n private readonly TextWriter cout;\n private readonly TextWriter cerr;\n#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\n cerr = Console.Error;\n }\n\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer) {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n}\n\n#if DEBUG\ninternal static class LinqPadExtension {\n public static string TextDump(this T obj) {\n if (obj is IEnumerable) return (obj as IEnumerable).Cast().JoinToString().Dump();\n else return obj.ToString().Dump();\n }\n public static T Dump(this T obj) {\n return LINQPad.Extensions.Dump(obj);\n }\n}\n#endif\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n private readonly char[] buffer = new char[2 * 1024];\n private int cursor = 0, length = 0;\n private string Token;\n private readonly StringBuilder sb = new StringBuilder(1024);\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return checked((int)NextLong()); }\n public long NextLong() {\n var s = Next();\n long r = 0;\n int i = 0;\n bool negative = false;\n if (s[i] == '-') {\n negative = true;\n i++;\n }\n for (; i < s.Length; i++) {\n r = r * 10 + (s[i] - '0');\n#if DEBUG\n if (!char.IsDigit(s[i])) throw new FormatException();\n#endif\n }\n return negative ? -r : r;\n }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n string[] array = new string[size];\n for (int i = 0; i < size; i++) {\n array[i] = Next();\n }\n\n return array;\n }\n public int[] NextIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextInt();\n }\n\n return array;\n }\n\n public long[] NextLongArray(int size) {\n long[] array = new long[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextLong();\n }\n\n return array;\n }\n\n public double[] NextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextDouble();\n }\n\n return array;\n }\n\n public string Next() {\n if (Token == null) {\n if (!StockToken()) {\n throw new Exception();\n }\n }\n var token = Token;\n Token = null;\n return token;\n }\n\n public bool HasNext() {\n if (Token != null) {\n return true;\n }\n\n return StockToken();\n }\n\n private bool StockToken() {\n while (true) {\n sb.Clear();\n while (true) {\n if (cursor >= length) {\n cursor = 0;\n if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {\n break;\n }\n }\n var c = buffer[cursor++];\n if (33 <= c && c <= 126) {\n sb.Append(c);\n } else {\n if (sb.Length > 0) break;\n }\n }\n\n if (sb.Length > 0) {\n Token = sb.ToString();\n return true;\n }\n\n return false;\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nusing E = System.Linq.Enumerable;\nusing System.Threading;\nusing System.Numerics;\n\ninternal partial class Solver {\n public void Run() {\n var m = nl();\n var x = nl();\n\n cout.WriteLine(Solve(m, x));\n }\n\n /*\n Sample 1\n 0 -> 0\n 1 -> 3 -> 1 -> 3\n 2 -> 2 -> 2 -> 2 (2*3^x%4 --> 3^x%2 \u3068\u7b49\u5316)\n 3 -> 1 -> 3 -> 1\n\n g = gcd(start, M) \u3054\u3068\u306b\u5834\u5408\u5206\u3051\u3059\u308c\u3070\u3088\u3044\n start' = start / g\n M' = M / g\n start, start * x, ... start * x^k % M ->\n (start/g), start, ... start * x^k % M')\n start', start' * x, ... start' * x^k % M'\n\n * */\n\n public List Factorize(long x) {\n var res = new List();\n for (long i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n res.Add(i);\n while (x % i == 0) x /= i;\n }\n }\n if (x != 1) res.Add(x);\n return res;\n }\n\n private long Solve(long m, long x) {\n // from i to (i*x)%m\n long ans = 0;\n // x^phi(m) = 1 (mod m) \n var primes = Factorize(m);\n var len = primes.Count;\n for (int i = 0; i < len; i++) {\n primes.AddRange(Factorize(primes[i] - 1));\n }\n primes.Sort();\n primes = primes.Distinct().ToList();\n\n foreach (var g in Divisors(m)) {\n var m2 = m / g;\n var phi = Phi(m2);\n long minPower = phi;\n foreach (var p in primes) {\n if (p > minPower) break;\n if (minPower % p == 0) {\n int cnt = 0;\n while (minPower % p == 0) {\n minPower /= p;\n cnt++;\n }\n for (int i = 0; i < cnt; i++) {\n if (BigInteger.ModPow(x, minPower, m2) == 1) break;\n minPower *= p;\n }\n }\n }\n\n ans += phi / minPower;\n }\n return ans;\n }\n\n public static long ModPow(long x, long n, long mod) {\n long t = x, ret = 1;\n while (n > 0) {\n if ((n & 1) != 0) {\n ret = (long)(((decimal)t * ret) % mod);\n }\n t = (long)((decimal)t * t % mod);\n n >>= 1;\n }\n return ret;\n }\n\n public static long Phi(long n) {\n long phi = n;\n\n for (long i = 2; i * i <= n && i < n; i++) {\n if (n % i == 0) {\n while (n % i == 0) {\n n /= i;\n }\n\n phi = phi / i * (i - 1);\n }\n }\n if (n > 1) {\n phi = phi / n * (n - 1);\n }\n\n return phi;\n }\n\n Dictionary> cache = new Dictionary>();\n\n public List Divisors(PrimeSet primes, long x) {\n //if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List { 1 };\n foreach (var p in primes) {\n if (p * p > x) break;\n int last = 0;\n while (x % p == 0) {\n int count = ret.Count;\n for (int i = last; i < count; i++) {\n ret.Add(ret[i] * p);\n }\n last = count;\n x /= p;\n }\n }\n if (x != 1) {\n int count = ret.Count;\n for (int i = 0; i < count; i++) {\n ret.Add(ret[i] * x);\n }\n }\n cache[x] = ret;\n return ret;\n }\n\n public List Divisors(long x) {\n if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List();\n for (long i = 1; i * i <= x; i++) {\n if (x % i == 0) {\n ret.Add(i);\n if (i != x / i) {\n ret.Add(x / i);\n }\n }\n }\n ret.Sort();\n cache[x] = ret;\n return ret;\n }\n\n}\n\n\npublic class PrimeSet : List {\n private readonly bool[] isPrime;\n\n public PrimeSet(int size)\n : base() {\n isPrime = Enumerable.Repeat(true, size).ToArray();\n Add(2);\n for (int i = 3; i <= size; i += 2) {\n if (!isPrime[i >> 1]) {\n continue;\n }\n\n Add(i);\n for (long j = (long)i * i; j <= size; j += i + i) {\n isPrime[j >> 1] = false;\n }\n }\n }\n\n public bool IsPrime(long x) {\n if (x == 2) {\n return true;\n }\n\n if (x <= 1 || x % 2 == 0) {\n return false;\n }\n\n return isPrime[x >> 1];\n }\n}\n\n// PREWRITEN CODE BEGINS FROM HERE\n\nstatic public class StringExtensions {\n static public string JoinToString(this IEnumerable source, string separator = \" \") {\n return string.Join(separator, source);\n }\n}\n\ninternal partial class Solver : Scanner {\n static readonly int? StackSizeInMebiByte = null; //50;\n public static void StartAndJoin(Action action, int maxStackSize) {\n var thread = new Thread(new ThreadStart(action), maxStackSize);\n thread.Start();\n thread.Join();\n }\n\n public static void Main() {\n#if LOCAL\n byte[] inputBuffer = new byte[1000000];\n var inputStream = Console.OpenStandardInput(inputBuffer.Length);\n using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {\n Console.SetIn(reader);\n new Solver(Console.In, Console.Out).Run();\n }\n#else\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n if (StackSizeInMebiByte.HasValue) {\n StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);\n } else {\n new Solver(Console.In, Console.Out).Run();\n }\n Console.Out.Flush();\n#endif\n }\n\n#pragma warning disable IDE0052\n private readonly TextReader cin;\n private readonly TextWriter cout;\n private readonly TextWriter cerr;\n#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\n cerr = Console.Error;\n }\n\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer) {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n}\n\n#if DEBUG\ninternal static class LinqPadExtension {\n public static string TextDump(this T obj) {\n if (obj is IEnumerable) return (obj as IEnumerable).Cast().JoinToString().Dump();\n else return obj.ToString().Dump();\n }\n public static T Dump(this T obj) {\n return LINQPad.Extensions.Dump(obj);\n }\n}\n#endif\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n private readonly char[] buffer = new char[2 * 1024];\n private int cursor = 0, length = 0;\n private string Token;\n private readonly StringBuilder sb = new StringBuilder(1024);\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return checked((int)NextLong()); }\n public long NextLong() {\n var s = Next();\n long r = 0;\n int i = 0;\n bool negative = false;\n if (s[i] == '-') {\n negative = true;\n i++;\n }\n for (; i < s.Length; i++) {\n r = r * 10 + (s[i] - '0');\n#if DEBUG\n if (!char.IsDigit(s[i])) throw new FormatException();\n#endif\n }\n return negative ? -r : r;\n }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n string[] array = new string[size];\n for (int i = 0; i < size; i++) {\n array[i] = Next();\n }\n\n return array;\n }\n public int[] NextIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextInt();\n }\n\n return array;\n }\n\n public long[] NextLongArray(int size) {\n long[] array = new long[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextLong();\n }\n\n return array;\n }\n\n public double[] NextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextDouble();\n }\n\n return array;\n }\n\n public string Next() {\n if (Token == null) {\n if (!StockToken()) {\n throw new Exception();\n }\n }\n var token = Token;\n Token = null;\n return token;\n }\n\n public bool HasNext() {\n if (Token != null) {\n return true;\n }\n\n return StockToken();\n }\n\n private bool StockToken() {\n while (true) {\n sb.Clear();\n while (true) {\n if (cursor >= length) {\n cursor = 0;\n if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {\n break;\n }\n }\n var c = buffer[cursor++];\n if (33 <= c && c <= 126) {\n sb.Append(c);\n } else {\n if (sb.Length > 0) break;\n }\n }\n\n if (sb.Length > 0) {\n Token = sb.ToString();\n return true;\n }\n\n return false;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nusing E = System.Linq.Enumerable;\nusing System.Threading;\nusing System.Numerics;\n\ninternal partial class Solver {\n public void Run() {\n var m = nl();\n var x = nl();\n\n cout.WriteLine(Solve(m, x));\n }\n\n /*\n Sample 1\n 0 -> 0\n 1 -> 3 -> 1 -> 3\n 2 -> 2 -> 2 -> 2 (2*3^x%4 --> 3^x%2 \u3068\u7b49\u5316)\n 3 -> 1 -> 3 -> 1\n\n g = gcd(start, M) \u3054\u3068\u306b\u5834\u5408\u5206\u3051\u3059\u308c\u3070\u3088\u3044\n start' = start / g\n M' = M / g\n start, start * x, ... start * x^k % M ->\n (start/g), start, ... start * x^k % M')\n start', start' * x, ... start' * x^k % M'\n\n * */\n\n public List Factorize(long x) {\n var res = new List();\n for (long i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n res.Add(i);\n while (x % i == 0) x /= i;\n }\n }\n if (x != 1) res.Add(x);\n return res;\n }\n\n /// \n /// return min d where a^d = 1 (mod m)\n /// \n private long MultiplicativeOrder(IEnumerable primes, long a, long m) {\n var phi = Phi(primes, m);\n var res = phi;\n foreach (var p in primes) {\n if (p > phi) break;\n while (res % p == 0 && BigInteger.ModPow(a, res / p, m) == 1) {\n res /= p;\n phi /= p;\n }\n while (phi % p == 0) phi /= p;\n }\n if (phi > 1 && BigInteger.ModPow(a, res / phi, m) == 1) {\n res /= phi;\n }\n return res;\n }\n\n private long Solve(long m, long x) {\n // from i to (i*x)%m\n long ans = 0;\n // x^phi(m) = 1 (mod m) \n var primes = Factorize(m);\n var len = primes.Count;\n for (int i = 0; i < len; i++) {\n primes.AddRange(Factorize(primes[i] - 1));\n }\n primes.Sort();\n primes = primes.Distinct().ToList();\n\n foreach (var g in Divisors(m)) {\n var m2 = m / g;\n var phi = Phi(m2);\n ans += phi / MultiplicativeOrder(primes, x, m2);\n }\n return ans;\n }\n\n public static long ModPow(long x, long n, long mod) {\n long t = x, ret = 1;\n while (n > 0) {\n if ((n & 1) != 0) {\n ret = (long)(((decimal)t * ret) % mod);\n }\n t = (long)((decimal)t * t % mod);\n n >>= 1;\n }\n return ret;\n }\n\n public static long Phi(IEnumerable primes, long n) {\n long phi = n;\n\n foreach (var p in primes) {\n if (p * p > n) break;\n if (n % p == 0) {\n while (n % p == 0) {\n n /= p;\n }\n phi = phi / p * (p - 1);\n }\n }\n\n if (n > 1) {\n phi = phi / n * (n - 1);\n }\n\n return phi;\n }\n public static long Phi(long n) {\n long phi = n;\n\n for (long i = 2; i * i <= n && i < n; i++) {\n if (n % i == 0) {\n while (n % i == 0) {\n n /= i;\n }\n\n phi = phi / i * (i - 1);\n }\n }\n if (n > 1) {\n phi = phi / n * (n - 1);\n }\n\n return phi;\n }\n\n Dictionary> cache = new Dictionary>();\n\n public List Divisors(PrimeSet primes, long x) {\n //if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List { 1 };\n foreach (var p in primes) {\n if (p * p > x) break;\n int last = 0;\n while (x % p == 0) {\n int count = ret.Count;\n for (int i = last; i < count; i++) {\n ret.Add(ret[i] * p);\n }\n last = count;\n x /= p;\n }\n }\n if (x != 1) {\n int count = ret.Count;\n for (int i = 0; i < count; i++) {\n ret.Add(ret[i] * x);\n }\n }\n cache[x] = ret;\n return ret;\n }\n\n public List Divisors(long x) {\n if (cache.TryGetValue(x, out var res)) return res;\n var ret = new List();\n for (long i = 1; i * i <= x; i++) {\n if (x % i == 0) {\n ret.Add(i);\n if (i != x / i) {\n ret.Add(x / i);\n }\n }\n }\n ret.Sort();\n cache[x] = ret;\n return ret;\n }\n\n}\n\n\npublic class PrimeSet : List {\n private readonly bool[] isPrime;\n\n public PrimeSet(int size)\n : base() {\n isPrime = Enumerable.Repeat(true, size).ToArray();\n Add(2);\n for (int i = 3; i <= size; i += 2) {\n if (!isPrime[i >> 1]) {\n continue;\n }\n\n Add(i);\n for (long j = (long)i * i; j <= size; j += i + i) {\n isPrime[j >> 1] = false;\n }\n }\n }\n\n public bool IsPrime(long x) {\n if (x == 2) {\n return true;\n }\n\n if (x <= 1 || x % 2 == 0) {\n return false;\n }\n\n return isPrime[x >> 1];\n }\n}\n\n// PREWRITEN CODE BEGINS FROM HERE\n\nstatic public class StringExtensions {\n static public string JoinToString(this IEnumerable source, string separator = \" \") {\n return string.Join(separator, source);\n }\n}\n\ninternal partial class Solver : Scanner {\n static readonly int? StackSizeInMebiByte = null; //50;\n public static void StartAndJoin(Action action, int maxStackSize) {\n var thread = new Thread(new ThreadStart(action), maxStackSize);\n thread.Start();\n thread.Join();\n }\n\n public static void Main() {\n#if LOCAL\n byte[] inputBuffer = new byte[1000000];\n var inputStream = Console.OpenStandardInput(inputBuffer.Length);\n using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {\n Console.SetIn(reader);\n new Solver(Console.In, Console.Out).Run();\n }\n#else\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n if (StackSizeInMebiByte.HasValue) {\n StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);\n } else {\n new Solver(Console.In, Console.Out).Run();\n }\n Console.Out.Flush();\n#endif\n }\n\n#pragma warning disable IDE0052\n private readonly TextReader cin;\n private readonly TextWriter cout;\n private readonly TextWriter cerr;\n#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\n cerr = Console.Error;\n }\n\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer) {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n}\n\n#if DEBUG\ninternal static class LinqPadExtension {\n public static string TextDump(this T obj) {\n if (obj is IEnumerable) return (obj as IEnumerable).Cast().JoinToString().Dump();\n else return obj.ToString().Dump();\n }\n public static T Dump(this T obj) {\n return LINQPad.Extensions.Dump(obj);\n }\n}\n#endif\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n private readonly char[] buffer = new char[2 * 1024];\n private int cursor = 0, length = 0;\n private string Token;\n private readonly StringBuilder sb = new StringBuilder(1024);\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return checked((int)NextLong()); }\n public long NextLong() {\n var s = Next();\n long r = 0;\n int i = 0;\n bool negative = false;\n if (s[i] == '-') {\n negative = true;\n i++;\n }\n for (; i < s.Length; i++) {\n r = r * 10 + (s[i] - '0');\n#if DEBUG\n if (!char.IsDigit(s[i])) throw new FormatException();\n#endif\n }\n return negative ? -r : r;\n }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n string[] array = new string[size];\n for (int i = 0; i < size; i++) {\n array[i] = Next();\n }\n\n return array;\n }\n public int[] NextIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextInt();\n }\n\n return array;\n }\n\n public long[] NextLongArray(int size) {\n long[] array = new long[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextLong();\n }\n\n return array;\n }\n\n public double[] NextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextDouble();\n }\n\n return array;\n }\n\n public string Next() {\n if (Token == null) {\n if (!StockToken()) {\n throw new Exception();\n }\n }\n var token = Token;\n Token = null;\n return token;\n }\n\n public bool HasNext() {\n if (Token != null) {\n return true;\n }\n\n return StockToken();\n }\n\n private bool StockToken() {\n while (true) {\n sb.Clear();\n while (true) {\n if (cursor >= length) {\n cursor = 0;\n if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {\n break;\n }\n }\n var c = buffer[cursor++];\n if (33 <= c && c <= 126) {\n sb.Append(c);\n } else {\n if (sb.Length > 0) break;\n }\n }\n\n if (sb.Length > 0) {\n Token = sb.ToString();\n return true;\n }\n\n return false;\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nusing E = System.Linq.Enumerable;\nusing System.Threading;\n\ninternal partial class Solver {\n public void Run() {\n var m = nl();\n var x = nl();\n\n cout.WriteLine(Solve(m, x));\n }\n\n /*\n Sample 1\n 0 -> 0\n 1 -> 3 -> 1 -> 3\n 2 -> 2 -> 2 -> 2 (2*3^x%4 --> 3^x%2 \u3068\u7b49\u5316)\n 3 -> 1 -> 3 -> 1\n\n g = gcd(start, M) \u3054\u3068\u306b\u5834\u5408\u5206\u3051\u3059\u308c\u3070\u3088\u3044\n start' = start / g\n M' = M / g\n start, start * x, ... start * x^k % M ->\n (start/g), start, ... start * x^k % M')\n start', start' * x, ... start' * x^k % M'\n\n * */\n\n private long Solve(long m, long x) {\n // from i to (i*x)%m\n long ans = 1; // for 0-room\n\n // x^phi(m) = 1 (mod m) \n foreach (var g in Divisors(m)) {\n var m2 = m / g;\n long minPower = long.MaxValue;\n foreach (var p in Divisors(Phi(m2))) {\n if (ModPow(x, p, m2) == 1) {\n minPower = p;\n break;\n }\n }\n var startNum = (m - 1) / g;\n ans += startNum / minPower;\n }\n return ans;\n }\n\n public static long ModMultiple(long x, long n, long mod) {\n long t = x, ret = 0;\n while (n > 0) {\n if ((n & 1) != 0) {\n ret += t;\n if (ret >= mod) ret -= mod;\n }\n t <<= 1;\n if (t >= mod) t -= mod;\n n >>= 1;\n }\n return ret;\n }\n\n public static long ModPow(long x, long n, long mod) {\n long t = x, ret = 1;\n t %= mod;\n while (n > 0) {\n if ((n & 1) != 0) {\n //ret = (t * ret) % mod;\n ret = ModMultiple(t, ret, mod);\n }\n //t = t * t % mod;\n t = ModMultiple(t, t, mod);\n n >>= 1;\n }\n return ret;\n }\n\n public static long Phi(long n) {\n long phi = n;\n\n for (long i = 2; i * i <= n && i < n; i++) {\n if (n % i == 0) {\n while (n % i == 0) {\n n /= i;\n }\n\n phi = phi / i * (i - 1);\n }\n }\n if (n > 1) {\n phi = phi / n * (n - 1);\n }\n\n return phi;\n }\n\n public static List Divisors(long x) {\n var ret = new List();\n for (long i = 1; i * i <= x; i++) {\n if (x % i == 0) {\n ret.Add(i);\n if (i != x / i) {\n ret.Add(x / i);\n }\n }\n }\n ret.Sort();\n return ret;\n }\n\n}\n\n\n// PREWRITEN CODE BEGINS FROM HERE\n\nstatic public class StringExtensions {\n static public string JoinToString(this IEnumerable source, string separator = \" \") {\n return string.Join(separator, source);\n }\n}\n\ninternal partial class Solver : Scanner {\n static readonly int? StackSizeInMebiByte = null; //50;\n public static void StartAndJoin(Action action, int maxStackSize) {\n var thread = new Thread(new ThreadStart(action), maxStackSize);\n thread.Start();\n thread.Join();\n }\n\n public static void Main() {\n#if LOCAL\n byte[] inputBuffer = new byte[1000000];\n var inputStream = Console.OpenStandardInput(inputBuffer.Length);\n using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {\n Console.SetIn(reader);\n new Solver(Console.In, Console.Out).Run();\n }\n#else\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n if (StackSizeInMebiByte.HasValue) {\n StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);\n } else {\n new Solver(Console.In, Console.Out).Run();\n }\n Console.Out.Flush();\n#endif\n }\n\n#pragma warning disable IDE0052\n private readonly TextReader cin;\n private readonly TextWriter cout;\n private readonly TextWriter cerr;\n#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\n cerr = Console.Error;\n }\n\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer) {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n}\n\n#if DEBUG\ninternal static class LinqPadExtension {\n public static string TextDump(this T obj) {\n if (obj is IEnumerable) return (obj as IEnumerable).Cast().JoinToString().Dump();\n else return obj.ToString().Dump();\n }\n public static T Dump(this T obj) {\n return LINQPad.Extensions.Dump(obj);\n }\n}\n#endif\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n private readonly char[] buffer = new char[2 * 1024];\n private int cursor = 0, length = 0;\n private string Token;\n private readonly StringBuilder sb = new StringBuilder(1024);\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return checked((int)NextLong()); }\n public long NextLong() {\n var s = Next();\n long r = 0;\n int i = 0;\n bool negative = false;\n if (s[i] == '-') {\n negative = true;\n i++;\n }\n for (; i < s.Length; i++) {\n r = r * 10 + (s[i] - '0');\n#if DEBUG\n if (!char.IsDigit(s[i])) throw new FormatException();\n#endif\n }\n return negative ? -r : r;\n }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n string[] array = new string[size];\n for (int i = 0; i < size; i++) {\n array[i] = Next();\n }\n\n return array;\n }\n public int[] NextIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextInt();\n }\n\n return array;\n }\n\n public long[] NextLongArray(int size) {\n long[] array = new long[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextLong();\n }\n\n return array;\n }\n\n public double[] NextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextDouble();\n }\n\n return array;\n }\n\n public string Next() {\n if (Token == null) {\n if (!StockToken()) {\n throw new Exception();\n }\n }\n var token = Token;\n Token = null;\n return token;\n }\n\n public bool HasNext() {\n if (Token != null) {\n return true;\n }\n\n return StockToken();\n }\n\n private bool StockToken() {\n while (true) {\n sb.Clear();\n while (true) {\n if (cursor >= length) {\n cursor = 0;\n if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {\n break;\n }\n }\n var c = buffer[cursor++];\n if (33 <= c && c <= 126) {\n sb.Append(c);\n } else {\n if (sb.Length > 0) break;\n }\n }\n\n if (sb.Length > 0) {\n Token = sb.ToString();\n return true;\n }\n\n return false;\n }\n }\n}"}], "src_uid": "c2dd6de750812d6213c770b3587d8fcb"} {"source_code": " using System;\nnamespace ConsoleApplication2\n{\n class word\n {\n public string s;\n public word () {\n s = Console.ReadLine();\n }\n public string sol(string value) {\n int countup=0, countlow=0;\n for (int i = 0; i < s.Length; i++) {\n if (s[i] >= 48 && s[i] <= 96)\n countup++;\n \n if (s[i] >= 97 && s[i] <= 122) \n countlow++; \n }\n if (countup == countlow || countlow > countup)\n return s = s.ToLower();\n else return s = s.ToUpper();\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n String x;\n word obj = new word();\n x = Console.ReadLine();\n Console.WriteLine(obj.sol(x));\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var w = Console.ReadLine();\n int u = 0, l = 0;\n for (int i = 0; i < w.Length; i++)\n {\n var z = char.IsUpper(w[i]) ? u++ : l++;\n }\n Console.WriteLine(u > l ? new string(w.ToUpper().ToCharArray()) : new string(w.ToLower().ToCharArray()));\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace R55.Div2.A.Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int upperChars = 0;\n foreach (char item in str)\n {\n if (char.IsUpper(item))\n {\n upperChars++;\n }\n }\n int legnth = str.Length;\n if (upperChars > legnth/2)\n {\n Console.WriteLine(str.ToUpper());\n }\n else\n {\n Console.WriteLine(str.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar s = GetString();\n\t\t\tvar ct = s.ToList().Count(x => x >= 'A' && x <= 'Z');\n\t\t\tif (ct> (s.Length - s.Length % 2) / 2)\n\t\t\t{\n\t\t\t\ts = s.ToUpper();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ts = s.ToLower();\n\t\t\t}\n\t\t\tConsole.WriteLine(s);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n public static bool IsMostlyUppercase(string word)\n {\n int countUpper = 0;\n int countLower = 0;\n\n for (int i = 0; i < word.Length; i++)\n {\n if (char.IsUpper(word[i]))\n {\n countUpper++;\n }\n else\n {\n countLower++;\n }\n }\n\n if (countUpper > countLower)\n {\n return true;\n }\n\n return false;\n }\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n if (IsMostlyUppercase(word))\n {\n Console.WriteLine(word.ToUpper());\n }\n else\n {\n Console.WriteLine(word.ToLower());\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.Specialized;\nusing System.Collections;\n\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n\n string x = Console.ReadLine();\n int NoUpp = 0;\n int NoLow = 0;\n \n foreach(char c in x )\n {\n if (char.IsUpper(c))\n NoUpp++;\n else NoLow++;\n\n }\n Console.WriteLine(NoLow>= NoUpp ? x.ToLower(): x.ToUpper());\n }\n \n \n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _59A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine();\n var n = s.Where(x => Char.IsUpper(x)).Count();\n if (s.Length - n < n) Console.WriteLine(s.ToUpper());\n else Console.WriteLine(s.ToLower());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace kompet\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string text;\n int a = 0;\n int b = 0;\n char[] arr = s.ToCharArray();\n foreach (char ch in arr)\n {\n if (char.IsUpper(ch))\n a++;\n if (char.IsLower(ch))\n b++;\n }\n if (a > b)\n {\n text = s.ToUpper();\n Console.WriteLine(text);\n }\n else\n {\n text = s.ToLower();\n Console.WriteLine(text);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Convert.ToString(Console.ReadLine());\n string resultWord = \"\";\n\n int countLower = 0;\n int countUpper = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if ((int)word[i] > 64 && (int)word[i] < 91)\n countUpper++;\n else\n countLower++;\n }\n\n if (countUpper > countLower)\n resultWord = word.ToUpper();\n else\n resultWord = word.ToLower();\n\n Console.WriteLine(resultWord);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\t\n\tpublic static int maxStep = 5;\n\t\n\tpublic static void Main()\n\t{\t\t\n\t\tstring word = Console.ReadLine();\n\t\t\n\t\tint big_count = 0;\n\t\t\n\t\tfor(int i = 0; i < word.Length; i++){\n\t\t\tif(Char.IsUpper(word[i]))\n\t\t\t\tbig_count++;\n\t\t}\n\t\t\n\t\tif(big_count > word.Length/2){\n\t\t\tword = word.ToUpper();\n\t\t}else{\n\t\t\tword = word.ToLower();\n\t\t}\n\t\t\n\t\tConsole.WriteLine($\"{word}\");\n\t}\n}"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n char[] input = Console.ReadLine().ToCharArray();\n int u=0, l=0;\n for (int i = 0; i < input.Length; ++i)\n if (input[i] > 96)\n l++;\n else u++;\n Func fnc;\n if(l>=u)\n fnc = (x) => { if (x < 97) return (char)(x + 32); else return x; };\n else fnc = (x) => { if (x > 96) return (char)(x - 32); else return x; };\n for (int i = 0; i < input.Length; ++i)\n input[i]=fnc(input[i]);\n Console.WriteLine(new string(input));\n }\n }"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n string letters = Console.ReadLine();\n int countLower = 0;\n\n for(int i = 0; i < letters.Length; i++)\n {\n if (char.IsLower(letters[i]))\n {\n countLower++;\n }\n }\n\n if(letters.Length - countLower <= letters.Length / 2)\n {\n Console.WriteLine(letters.ToLower());\n }\n else\n {\n Console.WriteLine(letters.ToUpper());\n }\n\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int u = 0;\n int l = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (char.IsLower(input[i])) l++;\n else if (char.IsUpper(input[i])) u++;\n }\n\n Console.WriteLine(u > l ? input.ToUpper() : input.ToLower());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n// Codeforces problem 59A \"\u0421\u043b\u043e\u0432\u043e\"\n// http://codeforces.com/problemset/problem/59/A\nnamespace _59_A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t#region Read data\n\t\t\tstring source = Console.ReadLine();\n\t\t\t#endregion\n\t\t\t#region Process data\n\t\t\tint lower = 0;\n\t\t\tint upper = 0;\n\t\t\tforeach (var c in source)\n\t\t\t{\n\t\t\t\tif (char.IsLower(c))\n\t\t\t\t{\n\t\t\t\t\tlower++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tupper++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t#endregion\n\t\t\t#region Write results\n\t\t\tif (lower >= upper)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(source.ToLower());\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(source.ToUpper());\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\t#endregion\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApplication2\n{\n class getUser\n {\n protected string s;\n public void get() {\n s = Console.ReadLine();\n }\n }\n class getSolution : getUser {\n\n protected int countup = 0, countlow = 0;\n public void sol()\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 48 && s[i] <= 96)\n countup++;\n\n if (s[i] >= 97 && s[i] <= 122)\n countlow++;\n }\n } \n }\n\n class display:getSolution\n {\n public void dis()\n {\n if (countup == countlow || countlow > countup)\n Console.WriteLine( s = s.ToLower());\n else Console.WriteLine( s = s.ToUpper());\n }\n }\n class access {\n static void Main(string[] args)\n {\n display opj = new display();\n opj.get();\n opj.sol();\n opj.dis();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n reader = Console.In;\n writer = Console.Out;\n\n var word = ReadToken();\n\n if (word.Count(x => char.IsLower(x)) == word.Count(x => char.IsUpper(x)))\n\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.Count(x => char.IsLower(x)) > word.Count(x => char.IsUpper(x)) ? word.ToLower() : word.ToUpper());\n\n Console.ReadLine();\n }\n\n private static Queue currentLineTokens = new Queue();\n protected static TextReader reader;\n protected static TextWriter writer;\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static List ReadIntList()\n {\n return ReadAndSplitLine().Select(int.Parse).ToList();\n }\n\n public static string[] ReadLines(int count)\n {\n string[] lines = new string[count];\n for (int i = 0; i < count; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _28__A._Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n \n int Ucounter = 0;\n int Lcounter = 0;\n\n\n for (int i = 0; i < input.Length; i++)\n {\n\n if ((int)input[i]>=97 && (int)input[i]<=122)\n {\n \n Lcounter++;\n }\n else\n {\n Ucounter++;\n }\n\n }\n\n\n if (Ucounter==Lcounter || Ucounter char.IsUpper(x));\n\n if(upperCharsCount > allCharsCount - upperCharsCount)\n Console.WriteLine(line.ToUpper());\n else\n Console.WriteLine(line.ToLower());\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass P\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Count(f => Char.IsUpper(f)) > s.Count(f => Char.IsLower(f))) Console.WriteLine(s.ToUpper());\n else Console.WriteLine(s.ToLower());\n }\n}\n\n"}, {"source_code": "using System;\n\npublic class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\nint lower = 0; int upper = 0;\n foreach(var ch in s)\n{\nif (ch >= 'A' && ch <= 'Z')\nupper++;\nelse if (ch >= 'a' && ch <= 'z')\nlower++;\n}\nif (lower >= upper)\nConsole.WriteLine(s.ToLower());\nelse\nConsole.WriteLine(s.ToUpper());\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace \u0421\u043b\u043e\u0432\u043e_Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int counter = 0;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == char.ToUpper(str[i]))\n\n {\n counter++;\n }\n }\n \n if (str.Length - counter >= counter)\n {\n str = str.ToLower();\n }\n else\n {\n str = str.ToUpper();\n }\n Console.WriteLine(str);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Problem___59A___A._Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n var countLow = 0;\n var countUpp = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n var temp = Convert.ToString(s[i]);\n var temp2 = temp.ToUpper();\n\n if (string.Compare(temp,temp2)==0)\n {\n countUpp++;\n }\n else\n {\n countLow++;\n }\n }\n\n if (countLow (s.Length) / 2)\n {\n return s.ToLower();\n }\n }\n return lowerCount == higherCount ? s.ToLower() :s.ToUpper();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int l = 0, u = 0, i;\n var z = Console.ReadLine();\n char[] s = new char[z.Length];\n s = z.ToCharArray();\n\n for (i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90)\n u++;\n else if (s[i] >= 97 && s[i] <= 122)\n {\n l++;\n }\n }\n if (u > l)\n {\n for (i = 0; i < s.Length; i++)\n {\n if (s[i] >= 97 && s[i] <= 122)\n {\n s[i] = (char)( 65 + s[i] - 97);\n }\n }\n }\n else\n {\n for (i = 0; i < s.Length; i++)\n {\n if (s[i] >= 65 && s[i] <= 90)\n {\n s[i] =(char) (97 + s[i] - 65);\n }\n }\n }\n Console.WriteLine(s);\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int cu = s.Count(char.IsUpper);\n int cl = s.Count(char.IsLower);\n if (cu > cl)\n {\n Console.WriteLine(s.ToUpper());\n }\n else\n {\n Console.WriteLine(s.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n int upperCounter = 0;\n int lowerCounter = 0;\n\n foreach(char item in line)\n {\n if (Char.IsUpper(item))\n upperCounter++;\n else\n lowerCounter++;\n }\n\n if(upperCounterlowerCounter)\n Console.WriteLine(line.ToUpper());\n else\n Console.WriteLine(line.ToLower());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n int lower = Regex.Matches(word, \"[a-z]\").Count;\n int upper = Regex.Matches(word, \"[A-Z]\").Count;\n\n Console.Write(upper > lower ? word.ToUpper() : word.ToLower());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _59A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int cl = 0, cu = 0;\n int n = s.Length;\n for (int i = 0; i < n; i++)\n {\n if (Char.IsLower(s[i]))\n {\n cl++;\n }\n else \n {\n cu++;\n }\n }\n string ss = string.Empty;\n if (cl >= cu)\n {\n for (int i = 0; i < n; i++)\n ss+=Char.ToLower(s[i]);\n }\n else\n {\n for (int i = 0; i < n; i++)\n {\n if (Char.IsLower(s[i]))\n ss += Char.ToUpper(s[i]);\n else\n ss += s[i];\n }\n }\n Console.WriteLine(ss);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int upper = 0;\n int lower = 0;\n foreach (var c in s)\n if (char.ToLower(c) == c)\n lower++;\n else\n upper++;\n Console.WriteLine(lower >= upper ? s.ToLower() : s.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n String word = Console.ReadLine();\n int upCount = 0;\n int downCount = 0;\n\n for (int i=0; i=65 && n <=90)\n {\n upCount++;\n }\n else if (n>=97 && n<=122)\n {\n downCount++;\n }\n }\n\n if (upCount > downCount)\n {\n Console.WriteLine(word.ToUpper());\n }\n else if (upCount < downCount)\n {\n Console.WriteLine(word.ToLower());\n }\n else if (upCount == downCount)\n {\n Console.WriteLine(word.ToLower());\n }\n\n //Console.WriteLine(upCount+\" \"+downCount);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char[] arr = str.ToCharArray();\n str = \"\";\n int upperCase = 0;\n int lowerCase = 0;\n for (int i=0;i lowerCase)\n {\n arr[i] = Char.ToUpper(arr[i]);\n str += arr[i];\n } else\n {\n arr[i] = Char.ToLower(arr[i]);\n str += arr[i];\n }\n }\n Console.WriteLine(str);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string v = Console.ReadLine();\n int Upp = 0;\n for (int i = 0; i < v.Length; i++)\n if (v[i] >= 'A' && v[i] <= 'Z')\n Upp++;\n if (Upp > v.Length - Upp)\n {\n v = v.ToUpper();\n }\n else\n {\n v = v.ToLower();\n }\n Console.WriteLine(v);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n char[] v = Console.ReadLine().ToCharArray();\n int Upp = 0;\n foreach(char c in v)\n {\n if (c >= 'A' && c <= 'Z')\n Upp++;\n }\n if (Upp > v.Length - Upp)\n {\n for (int i = 0; i < v.Length; i++)\n {\n if (v[i] >= 'a' && v[i] <= 'z')\n v[i] = Convert.ToChar(v[i] - 32);\n }\n }\n else\n {\n for (int i = 0; i < v.Length; i++)\n {\n if (v[i] >= 'A' && v[i] <= 'Z')\n v[i] = Convert.ToChar(v[i] + 32);\n }\n }\n Console.WriteLine(v);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n List alphabet = new List();\n int upperCount = 0, lowerCount = 0;\n\n for (int i = 97; i < 123; ++i)\n alphabet.Add(i);\n\n List input = Console.ReadLine().ToList();\n\n for (int i = 0; i < input.Count; ++i)\n {\n if (alphabet.Contains(input[i]))\n lowerCount++;\n else\n upperCount++;\n }\n\n if (lowerCount >= upperCount)\n Console.WriteLine(string.Join(string.Empty, input).ToLower());\n else\n Console.WriteLine(string.Join(string.Empty, input).ToUpper());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace \u0624\u062e\u064a\u062b\u0628\u062e\u0642\u0624\u062b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int low = 0 , upper = 0 ;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 97) low++;\n else upper++;\n }\n if (low >= upper) Console.WriteLine(s.ToLower());\n else Console.WriteLine(s.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\n\n namespace Dcoder\n {\n public class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine(); int letter = 0;\n for(int i = 0; i < s.Length; i++) {if(char.IsUpper(s[i])) letter++; else letter--;}\n Console.WriteLine(letter>0 ? s.ToUpper() : s.ToLower());\n }\n }\n }\n "}, {"source_code": "\ufeffusing System;\n\nnamespace CaseCorrector\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n int upperCase = 0, lowercase = 0;\n\n foreach (char character in word)\n {\n if ((int)character < 93)\n upperCase++;\n else\n lowercase++;\n }\n\n if (upperCase > lowercase)\n Console.WriteLine(word.ToUpper());\n else if (lowercase > upperCase)\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.ToLower());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n \n string input = Console.ReadLine();\n int lower = 0;\n foreach (var item in input)\n {\n if (char.IsLower(item))\n {\n lower++; \n }\n }\n int upper = input.Length - lower;\n if (lower > upper)\n {\n Console.WriteLine(input.ToLower());\n }\n else if (lower < upper)\n {\n Console.WriteLine(input.ToUpper());\n }\n else\n {\n Console.WriteLine(input.ToLower());\n }\n //Console.WriteLine(new[] { 4, 7 }.Contains(Console.ReadLine().Count(x => x == '4' || x == '7')) ? \"YES\" : \"NO\");\n Console.ReadLine();\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] s = Console.ReadLine().ToCharArray();\n int b = 0;\n int l = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 'A' && s[i] <= 'Z')\n {\n b++;\n }\n else\n {\n l++;\n }\n\n }\n if (b > l)\n {\n Console.WriteLine(new string(s).ToUpper());\n }\n else\n {\n Console.WriteLine(new string(s).ToLower());\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Word_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Count(f => Char.IsUpper(f)) > s.Length / 2 ? s.ToUpper() : s.ToLower());\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _59a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n int n = t.Length;\n char[] s = new Char[105];\n int p = 0, q = 0;\n for (int i = 0; i < n; ++i)\n {\n s[i] = t[i];\n if (Char.IsLower(s[i])) ++p;\n else ++q;\n }\n if (p < q)\n {\n for (int i = 0; i < n; ++i)\n if (Char.IsLower(s[i])) s[i] = Char.ToUpper(s[i]);\n }\n else for (int i = 0; i < n; ++i)\n if (Char.IsUpper(s[i])) s[i] = Char.ToLower(s[i]);\n for (int i = 0; i < n; ++i) Console.Write(s[i]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n char[] letters = word.ToCharArray();\n int bigLetters = 0;\n int smallLetters = 0;\n foreach (char i in letters)\n {\n if (65 <= i && i <= 90)\n {\n bigLetters++;\n }\n else if (97 <= i && i <= 122)\n {\n smallLetters++;\n }\n }\n if (bigLetters <= smallLetters) Console.WriteLine(word.ToLower());\n else Console.WriteLine(word.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int small = 0, cap = 0;\n\n foreach (var i in input)\n {\n if (i >= 'a' && i <= 'z') small++;\n else cap++;\n }\n\n if (small >= cap)\n {\n Console.WriteLine(input.ToLower());\n }\n else\n {\n Console.WriteLine(input.ToUpper());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nnamespace CodeForces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n //var T = Convert.ToInt32(Console.ReadLine());\n //for (int i = 1; i <= T; i++)\n //{\n // var inputStr = Console.ReadLine();\n // var result = StringManipulationTask(inputStr);\n // Console.WriteLine(result);\n //}\n var input = Console.ReadLine();\n var output = UpperCaseLowerCase(input);\n Console.WriteLine(output);\n }\n\n public static string UpperCaseLowerCase(string str)\n {\n int upperCaseCount = 0, lowerCaseCount = 0;\n var upperCaseStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var lowerCaseStr = upperCaseStr.ToLower();\n foreach (var ch in str)\n {\n if (upperCaseStr.Contains(ch.ToString()))\n ++upperCaseCount;\n if (lowerCaseStr.Contains(ch.ToString()))\n ++lowerCaseCount;\n }\n return upperCaseCount > lowerCaseCount ? str.ToUpper() : str.ToLower();\n }\n\n\n public static string StringManipulationTask(string s)\n {\n var vowels = new List { 'a', 'e', 'i', 'o', 'u' };\n char[] input = s.ToLower().ToCharArray();\n var result = \"\";\n foreach (char c in input)\n {\n if (!vowels.Contains(c))\n {\n\n result += '.';\n result += c;\n }\n }\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace Competitive\n{\n class Solution\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int cntB = 0;\n int cntS = 0;\n\n foreach (char c in s)\n {\n if (Convert.ToInt32(c) > 96)\n ++cntS;\n else\n ++cntB;\n }\n\n if (cntS >= cntB)\n Console.WriteLine(s.ToLower());\n else\n Console.WriteLine(s.ToUpper());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n reader = Console.In;\n writer = Console.Out;\n\n var word = ReadToken();\n\n if (word.Count(x => char.IsLower(x)) == word.Count(x => char.IsUpper(x)))\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.Count( char.IsLower) > word.Count(char.IsUpper) ? word.ToLower() : word.ToUpper());\n\n Console.ReadLine();\n }\n\n private static Queue currentLineTokens = new Queue();\n protected static TextReader reader;\n protected static TextWriter writer;\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static List ReadIntList()\n {\n return ReadAndSplitLine().Select(int.Parse).ToList();\n }\n\n public static string[] ReadLines(int count)\n {\n string[] lines = new string[count];\n for (int i = 0; i < count; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n reader = Console.In;\n var word = ReadToken();\n\n if (word.Count(char.IsLower) >= word.Count(char.IsUpper))\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.ToUpper());\n\n reader.Close();\n }\n\n private static Queue currentLineTokens = new Queue();\n protected static TextReader reader;\n protected static TextWriter writer;\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static List ReadIntList()\n {\n return ReadAndSplitLine().Select(int.Parse).ToList();\n }\n\n public static string[] ReadLines(int count)\n {\n string[] lines = new string[count];\n for (int i = 0; i < count; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace App\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n Char[] array = input.ToCharArray();\n int capitalCounter = 0;\n int smallCounter = 0;\n foreach (char c in array)\n {\n int value = c;\n if (c <= 90)\n capitalCounter++;\n else\n smallCounter++;\n }\n if (capitalCounter > smallCounter)\n {\n\n foreach (char c in array)\n {\n int value = c;\n if (value > 90)\n value -= 32;\n Console.Write((char)value);\n\n }\n Console.WriteLine();\n\n }\n else\n {\n\n\n foreach (char c in array)\n {\n int value = c;\n if (value < 97)\n value += 32;\n Console.Write((char)value);\n }\n Console.WriteLine();\n }\n }\n\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass A59 {\n public static void Main() {\n var s = Console.ReadLine();\n Console.WriteLine(s.Count(char.IsUpper) > s.Length >> 1\n ? s.ToUpper()\n : s.ToLower()\n );\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n string word = Console.ReadLine();\n byte upperCount = (byte)word.ToCharArray().Count(x => char.IsUpper(x));\n byte lowerCount = (byte)(word.Length - upperCount);\n\n if (lowerCount >= upperCount)\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _59a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var numUpper = str.Count(p => char.IsUpper(p));\n var numLower = str.Length - numUpper;\n if (numUpper <= numLower)\n str = str.ToLower();\n else\n str = str.ToUpper();\n Console.WriteLine(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Count(c => Char.ToUpper(c) == c) \n >\n s.Count(c => Char.ToLower(c) == c)\n ? \n s.ToUpper() : s.ToLower());\n \n Console.ReadLine();\n }\n }\n}\n//5\n// 100 50 200 150 200\n// 100 50\n// 100 50 200\n// 100 50 200 150\n// 100 50 200 150 200"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int i = 0;\n int smcount = 0;\n int uppcount = 0;\n while (i < s.Length)\n {\n if (char.IsUpper(s.ElementAt(i)))\n {\n uppcount++;\n }\n else\n {\n smcount++;\n }\n i++;\n }\n if (uppcount == smcount)\n {\n Console.WriteLine(s.ToLower());\n }\n else if (uppcount > smcount)\n {\n Console.WriteLine(s.ToUpper());\n }\n else if (uppcount < smcount)\n {\n Console.WriteLine(s.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n here: string s = Console.ReadLine();\n if(s.Length<1||s.Length>100)\n {\n goto here;\n }\n char[] Schar = s.ToCharArray();\n char[] lowerchar = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };\n char[] upperchar = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };\n int lowsum = 0;\n int uppersum = 0;\n for(int i=0;i=uppersum)\n {\n for (int i = 0; i < Schar.Length; i++)\n {\n for (int j = 0; j < 26; j++)\n {\n if (Schar[i] == upperchar[j])\n {\n Schar[i] = lowerchar[j];\n }\n \n }\n }\n }\n if (uppersum > lowsum)\n {\n for (int i = 0; i < Schar.Length; i++)\n {\n for (int j = 0; j < 26; j++)\n {\n if (Schar[i] == lowerchar[j])\n {\n Schar[i] = upperchar[j];\n }\n\n }\n }\n }\n Console.Write(Schar);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int Upper = 0; int Lower = 0;\n foreach (char n in s)\n {\n if (n >= 'A' && n <= 'Z')\n ++Upper;\n else if (n >= 'a' && n <= 'z')\n ++Lower;\n }\n if (Upper > Lower)\n Console.Write(s.ToUpper());\n else\n Console.Write(s.ToLower());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var word = Console.ReadLine();\n if (word.Count(x => char.IsUpper(x)) > word.Count(x => char.IsLower(x)))\n {\n Console.WriteLine(word.ToUpper());\n }\n else\n {\n Console.WriteLine(word.ToLower());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string answer = \"\";\n int upperCase = 0;\n int lowerCase = 0;\n\n\n for (int i = 0; i < input.Length; i++)\n {\n if (Char.IsLower(input[i]))\n {\n lowerCase++;\n }\n }\n\n upperCase = input.Length - lowerCase;\n\n if (upperCase > lowerCase)\n {\n answer = input.ToUpper();\n }\n else\n {\n answer = input.ToLower();\n }\n\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF_Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line1 = Console.ReadLine();\n var word = line1.ToCharArray();\n var count = 0;\n\n for (int i = 0; i < word.Length; i++)\n {\n if (Char.IsUpper(word[i]))\n {\n count++;\n }\n }\n \n if (count > word.Length / 2)\n {\n Console.WriteLine(line1.ToUpper());\n } else\n {\n Console.WriteLine(line1.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int upper = s.Count(c => !(c >= 'a'));\n int lower = s.Length - upper;\n\n if(upper > lower)\n {\n Console.WriteLine(s.ToUpper());\n return;\n }\n\n if (upper < lower)\n {\n Console.WriteLine(s.ToLower());\n return;\n }\n\n if (upper == lower)\n {\n Console.WriteLine(s.ToLower());\n return;\n }\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_59A_Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string former = Console.ReadLine();\n if (former.Count(c => c >91) < former.Count(c => c < 91))\n Console.WriteLine(former.ToUpper());\n else\n Console.WriteLine(former.ToLower());\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace AWord\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n\n int nrLower = 0;\n int nrUpper = 0;\n\n for(int i = 0; i < input.Length; i++)\n {\n if (char.IsLower(input[i]))\n {\n nrLower++;\n }\n\n if (char.IsUpper(input[i]))\n {\n nrUpper++;\n }\n }\n\n if(nrLower == nrUpper)\n {\n Console.WriteLine(input.ToLower());\n }\n else if(nrLower > nrUpper)\n {\n Console.WriteLine(input.ToLower());\n }\n else\n {\n Console.WriteLine(input.ToUpper());\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication18\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0, r = 0;\n string m = Console.ReadLine();\n foreach (char c in m)\n { if (char.IsLower(c))k++; else r++; }\n foreach (char c in m)\n {\n if (k >= r) m = m.Replace(c, char.ToLower(c));\n else m = m.Replace(c, char.ToUpper(c));\n\n }\n Console.WriteLine(m);\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int upper = 0, lower = 0;\n\n for (int i=0;i= upperCase)\n {\n Console.WriteLine(word.ToLower()); \n }\n else\n {\n \n Console.WriteLine(word.ToUpper());\n }\n \n\n }\n }\n} \n"}, {"source_code": "using System;\nusing System.Linq;\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring word = Console.ReadLine();\n\t\tint lengthOfWord = word.Count();\n\t\tint upperCount = 0;\n\t\tforeach(char c in word){\n\t\t\tif(Char.IsUpper(c)){\n\t\t\t\tupperCount+=1;\n\t\t\t}\n\t\t}\n\t\tif((upperCount > lengthOfWord-upperCount)){\n\t\t\tConsole.WriteLine(word.ToUpper());\n\t\t}else{\n\t\t\tConsole.WriteLine(word.ToLower());\n\t\t}\n\t\t\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace words\n{\n class Program\n {\n static void Main()\n {\n String WorD = Console.ReadLine();\n String WORD = WorD.ToUpper();\n Int32 n = 0;\n Int32 N = 0;\n for(int i=0;in)\n {\n Console.WriteLine(\"{0}\", WORD);\n }\n else\n {\n Console.WriteLine(\"{0}\",WorD.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class17\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n string ss1 = s.ToLower();\n string ss2 = s.ToUpper();\n int cnt1 = 0;\n int cnt2 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss1[i])\n cnt1++;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss2[i])\n cnt2++;\n }\n if (cnt1 <= cnt2)\n Console.WriteLine(ss1);\n if (cnt1 > cnt2)\n Console.WriteLine(ss2);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0421\u043b\u043e\u0432\u043e__55_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n=s.Length;\n char [] ch =s.ToCharArray(0,n);\n int k=0;\n for(int i=0;i= k)\n for (int i = 0; i < n; i++)\n Console.Write(char.ToLower(ch[i]));\n else\n for (int i = 0; i < n; i++)\n Console.Write(char.ToUpper(ch[i]));\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string make(string s)\n {\n string w = \"\";\n int[] dp = new int[2];\n dp[0] = 0;\n dp[1] = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (char.IsLower(s[i]))\n {\n dp[0]++;\n }\n if (char.IsUpper(s[i]))\n {\n dp[1]++;\n }\n }\n if (dp[0] == dp[1] || dp[0]>dp[1])\n {\n w += s.ToLower();\n }\n else {\n w += s.ToUpper();\n }\n return w;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(make(s));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // input word\n string sWord = Console.ReadLine();\n\n // count lower and upper cases\n int nLowers = 0;\n int nUppers = 0;\n for (int i = 0; i < sWord.Length; ++i)\n {\n if (char.IsLower(sWord[i]))\n {\n ++nLowers;\n }\n else\n {\n ++nUppers;\n }\n }\n\n // change characters\n if (nLowers < nUppers)\n {\n StringBuilder sbNewWord = new StringBuilder();\n for (int i = 0; i < sWord.Length; ++i)\n {\n sbNewWord.Append(char.ToUpper(sWord[i]));\n }\n\n sWord = sbNewWord.ToString();\n }\n else\n {\n StringBuilder sbNewWord = new StringBuilder();\n for (int i = 0; i < sWord.Length; ++i)\n {\n sbNewWord.Append(char.ToLower(sWord[i]));\n }\n\n sWord = sbNewWord.ToString();\n }\n\n // display results\n Console.WriteLine(\"{0}\", sWord);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n byte small_symb = 0;\n byte big_symb = 0;\n string str = Console.ReadLine();\n foreach(char symb in str)\n {\n if((symb>='A')&&(symb<='Z'))\n {\n big_symb++;\n }\n else\n {\n small_symb++;\n }\n }\n if(small_symb sumUpper){\n \tstr = str.ToLower();\n }else{\n \tstr = str.ToUpper();\n }\n Console.WriteLine(str);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string root;\n\n root = Console.ReadLine();\n\n char[] arr = root.ToCharArray();\n int upper = 0;\n int lower = 0;\n for(int i=0;i lower)\n Console.WriteLine(root.ToUpper());\n else if (upper < lower)\n Console.WriteLine(root.ToLower());\n else\n Console.WriteLine(root.ToLower());\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace csTest1\n{\n class Program\n {\n static int Main(string[] args)\n {\n string s = Console.ReadLine();\n int upperCount = s.Count(c => char.IsUpper(c));\n if (upperCount > (s.Length - upperCount))\n Console.WriteLine(s.ToUpper());\n else\n Console.WriteLine(s.ToLower());\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class Test\n {\n public static void Main()\n {\n string word = Console.ReadLine();\n int upperCount = 0;\n int lowerCount = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] >= 65 && word[i] < 97)\n {\n upperCount++;\n }\n else\n {\n lowerCount++;\n }\n }\n if (upperCount > lowerCount)\n {\n Console.WriteLine(word.ToUpper());\n }\n else\n {\n Console.WriteLine(word.ToLower());\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SPOJ_Problems\n{\n class Class1\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int lc = 0;\n int uc = 0;\n\n for (int i = 0; i < str.Length; i++)\n {\n if (Char.ToLower(str[i]) == str[i])\n {\n // lowercase\n lc++;\n }\n else\n {\n uc++;\n }\n }\n\n string res = lc >= uc ? str.ToLower() : str.ToUpper();\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "namespace o\n{\n using System;\n using System.Collections.Generic;\n using System.Text;\n\n class Program\n {\n static void Main(string[] args)\n {\n string message = Console.ReadLine();\n int upperCounter = 0;\n for (int i = 0; i < message.Length; i++)\n {\n if (char.IsUpper(message[i]))\n {\n upperCounter++;\n }\n }\n if (upperCounter > message.Length - upperCounter)\n {\n Console.WriteLine(message.ToUpper());\n }\n else\n {\n Console.WriteLine(message.ToLower());\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace EO\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int up = 0, down = 0;\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i]>='a' && a[i]<='z')\n {\n down++;\n }\n else\n {\n up++;\n }\n }\n if (down>=up)\n {\n Console.WriteLine(a.ToLower());\n }\n else\n {\n Console.WriteLine(a.ToUpper());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Boy_or_Girl\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l = 0;\n int u = 0;\n string s = Console.ReadLine();\n string s1 = s.ToLower();\n string s2 = s.ToUpper();\n for (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t if (s1[i].Equals(s[i]))\n {\n l++;\n }\n else\n {\n u++;\n }\n\t\t\t}\n if (l>=u)\n {\n Console.Write(s1);\n }\n else \n {\n Console.Write(s2);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n string s = reader.ReadLine();\n long u = 0;\n long l = 0;\n foreach(char c in s) {\n if(Char.IsUpper(c))\n u++;\n if(Char.IsLower(c))\n l++;\n }\n if(u < l) {\n s = s.ToLower();\n } else if(u > l) {\n s = s.ToUpper();\n }\n else\n s = s.ToLower();\n writer.WriteLine(s);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf59a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n int low=0;\n int up=0;\n \n for(int i=0; i=65&&(int)x[i]<=90){\n up++;\n }\n else if((int)x[i]>=97&&(int)x[i]<=122){\n low++;\n }\n }\n if(low>=up){\n Console.Write(x.ToLower());\n }\n else if(up>low){\n Console.Write(x.ToUpper());\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n char[] input = Console.ReadLine().ToCharArray();\n int u=0, l=0;\n for (int i = 0; i < input.Length; ++i)\n if (input[i] > 96)\n l++;\n else u++;\n Func fnc;\n if(l>u)\n fnc = (x) => { if (x > 96) return (char)(x - 32); else return x; };\n else fnc = (x) => { if (x < 97) return (char)(x + 32); else return x; };\n for (int i = 0; i < input.Length; ++i)\n input[i]=fnc(input[i]);\n Console.WriteLine(new string(input));\n }\n }"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n char[] input = Console.ReadLine().ToCharArray();\n int u=0, l=0;\n for (int i = 0; i < input.Length; ++i)\n if (input[i] > 96)\n l++;\n else u++;\n Func fnc;\n if(l>u)\n fnc = (x) => { if (x < 97) return (char)(x + 32); else return x; };\n else fnc = (x) => { if (x > 96) return (char)(x - 32); else return x; };\n for (int i = 0; i < input.Length; ++i)\n input[i]=fnc(input[i]);\n Console.WriteLine(new string(input));\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int Upper = 0; int Lower = 0;\n foreach (char n in s)\n {\n if (n > 'A' && n < 'Z')\n ++Upper ;\n else if (n > 'a' && n < 'z')\n ++Lower ;\n }\n if (Upper > Lower)\n Console.Write(s.ToUpper());\n else\n Console.Write(s.ToLower());\n } \n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string cap = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n string sma = \"abcdefghijklmnopqrstuvwxyz\";\n int sumcap = 0;\n int sumsma = 0;\n for (int i = 0; i < input.Length; i++)\n {\n for (int j = 0; j < cap.Length; j++)\n {\n if ( input[i]== cap[j])\n {\n sumcap++;\n }\n else if ( input[i] == sma[j])\n {\n sumsma++;\n }\n } \n }\n if (sumsma > sumcap)\n {\n input = input.ToLower();\n Console.WriteLine(input);\n }\n else\n {\n input = input.ToUpper();\n Console.WriteLine(input);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace words\n{\n class Program\n {\n static void Main()\n {\n String WorD = Console.ReadLine();\n String WORD = WorD.ToUpper();\n Int32 n = 0;\n Int32 N = 0;\n for(int i=0;in)\n {\n Console.WriteLine(\"{0}\", WORD);\n }\n else\n {\n Console.WriteLine(\"{0}\",WorD.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Learning\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int len = s.Length;\n int cnt = 0;\n for (var i = 0; i < len; ++i) { \n if(char.IsLower(s[i])){\n cnt++;\n }\n }\n if(cnt > len/2)\n Console.Out.WriteLine(s.ToLower());\n else\n Console.Out.WriteLine(s.ToUpper());\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Learning\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int len = s.Length;\n int lower = 0;\n int upper = 0;\n for (var i = 0; i < len; ++i) {\n if (char.IsLower(s[i]))\n {\n lower++;\n }\n else {\n upper++;\n }\n }\n if(lower <= upper)\n Console.Out.WriteLine(s.ToLower());\n else\n Console.Out.WriteLine(s.ToUpper());\n //Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Learning\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int len = s.Length;\n int cnt = 0;\n for (var i = 0; i < len; ++i) { \n if(char.IsLower(s[i])){\n cnt++;\n }\n }\n if(cnt >= len/2)\n Console.Out.WriteLine(s.ToLower());\n else\n Console.Out.WriteLine(s.ToUpper());\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf59a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n int low=0;\n int up=0;\n \n for(int i=0; i=65&&(int)x[i]<=90){\n up++;\n }\n else if((int)x[i]>=97&&(int)x[i]<=122){\n low++;\n }\n }\n if(low<=up){\n Console.Write(x.ToLower());\n }\n else{\n Console.Write(x.ToUpper());\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var w = Console.ReadLine().ToCharArray();\n int u = 0, l = 0;\n for (int i = 0; i < w.Length; i++)\n {\n var z = char.IsUpper(w[i]) ? u++ : l++;\n }\n Console.WriteLine(u > l ? w.ToString().ToUpper() : w.ToString().ToLower());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olymp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int c = 0;\n for (int i=0; i='a' && s[i] <= 'z')\n {\n c++;\n }\n }\n if (c >= c - s.Length)\n {\n s=s.ToLower();\n }\n else\n {\n s=s.ToUpper();\n }\n Console.WriteLine(s);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication13\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] s1 = s.ToCharArray();\n char[] alphapeat = \"qwertyuiopasdfghjklzxcvbnm\".ToCharArray();\n char[] alphapeatupp = \"QWERTYUIOPASDFGHJKLZXCVBNM\".ToCharArray();\n int up = 0;\n int down = 0;\n string result = \" \";\n\n for (int i = 0; i < s.Length; i++)\n {\n for (int x = 0; x < alphapeat.Length; x++)\n {\n if (s1[i]==alphapeat[x])\n {\n down++;\n break;\n }\n else if (s1[i]==alphapeatupp[x])\n {\n up++;\n break;\n }\n\n }\n\n }\n if (up>down)\n {\n result = s.ToUpper();\n }\n else if(down>up)\n {\n result = s.ToLower();\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\n class Program\n {\n public static bool IsMostlyUppercase(string word)\n {\n int countUpper = 0;\n int countLower = 0;\n\n for (int i = 0; i < word.Length; i++)\n {\n if (char.IsUpper(word[i]))\n {\n countUpper++;\n }\n else\n {\n countLower++;\n }\n }\n\n if (countUpper > countLower)\n {\n return true;\n }\n\n return false;\n }\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n if (IsMostlyUppercase(word))\n {\n Console.WriteLine(word.ToUpper());\n }\n else\n {\n Console.WriteLine(word.ToUpper());\n }\n\n }\n }\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Convert.ToString(Console.ReadLine());\n string resultWord = \"\";\n\n int countLower = 0;\n int countUpper = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if ((int)word[i] > 65 && (int)word[i] < 91)\n countUpper++;\n else\n countLower++;\n }\n\n if (countUpper > countLower)\n resultWord = word.ToUpper();\n else\n resultWord = word.ToLower();\n\n Console.WriteLine(resultWord);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string S = Console.ReadLine();\n int C1=0 , C2=0;\n foreach (var item in S) if (item > 96) C1++; else C2++;\n bool Case = C2 > C1;\n string New_S = \"\";\n if (Case) foreach (var item in S) New_S += item > 96 ? (char)(item -32 ): (char)item;\n else foreach (var item in S) New_S += item <= 97 ? (char)(item +32 ): (char)item;\n Console.WriteLine(New_S);\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\t\n\tpublic static int maxStep = 5;\n\t\n\tpublic static void Main()\n\t{\t\t\n\t\tstring word = Console.ReadLine();\n\t\t\n\t\tint big_count = 0;\n\t\t\n\t\tfor(int i = 0; i < word.Length; i++){\n\t\t\tif(Char.IsUpper(word[i]))\n\t\t\t\tbig_count++;\n\t\t}\n\t\t\n\t\tif(word.Length >= big_count){\n\t\t\tword = word.ToLower();\n\t\t}else{\n\t\t\tword = word.ToUpper();\n\t\t}\n\t\t\n\t\tConsole.WriteLine($\"{word}\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.word_code_forces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n int l = 0;\n for(int i=0;i < word.Length; i++)\n {\n if(char.IsUpper(word[1]))\n {\n l++;\n }\n }\n if (l>(word.Length/2))\n {\n Console.WriteLine(word.ToUpper()); \n }\n else\n {\n Console.WriteLine(word.ToLower()); \n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int u = 0;\n int l = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (char.IsLower(input[i])) l++;\n else if (char.IsUpper(input[i])) u++;\n }\n\n if (u == l)\n {\n Console.WriteLine(input);\n }\n else Console.WriteLine(l > u ? input.ToLower() : input.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Zada4ki\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Up = 0, Down = 0; \n string Str = Console.ReadLine();\n char[] ar = Str.ToCharArray();\n for (int i = 0; i < Str.Length; i++)\n {\n if (char.IsUpper(ar[i])) Up++;\n else Down++;\n }\n if (Up > Down) Str.ToUpper();\n else Str.ToLower();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine();\n\n var allCharsCount = line.Length;\n var upperCharsCount = line.Count(x => char.IsUpper(x));\n\n if(upperCharsCount > allCharsCount)\n Console.WriteLine(line.ToUpper());\n else\n Console.WriteLine(line.ToLower());\n }\n \n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\nint lower = 0; int upper = 0;\n foreach(var ch in s)\n{\nif (ch > 'A' && ch < 'Z')\nupper++;\nelse if (ch > 'a' && ch < 'z')\nlower++;\n}\nif (lower >= upper)\nConsole.WriteLine(s.ToLower());\nelse\nConsole.WriteLine(s.ToUpper());\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace p_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a;\n int l;\n int u = 0;\n int low = 0;\n a = Console.ReadLine();\n l = a.Length; \n for(int i=0;i u)\n a = a.ToLower();\n else\n a = a.ToUpper();\n Console.WriteLine(a);\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program{\n static void Main(string[] args){\n string s = Console.ReadLine();\n int q = 0;\n for(int i = 0; i < s.Length; i++)\n {\n if (char.IsUpper(s[i])) q++;\n else q--;\n }\n if (q > 0) s.ToUpper();\n else s.ToLower();\n Console.WriteLine(s);\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace lol\n{\n class lolClass\n {\n private static void Main()\n {\n string s = Console.ReadLine();\n int up = 0, low = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] < 'Z' && s[i] > 'A')\n up++;\n else\n low++;\n }\n if (up > low) Console.WriteLine(s.ToUpper());\n else Console.WriteLine(s.ToLower());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace word\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.Write(\" the word : \");\n string word = Console.ReadLine();\n Console.WriteLine(\"===================\");\n char[] cword;\n cword = word.ToCharArray();\n int z = 0;\n for(int i=0;i91)\n {\n z++;\n }\n }\n if(z>=((cword.Length+1)/2))\n {\n for(int i=0;i 91)\n {\n\n Console.Write((char)cword[i]);\n\n }\n if(cword[i]<91)\n {\n cword[i] += (char)32;\n Console.Write((char)cword[i]);\n \n }\n \n }\n }\n\n else{\n for (int i = 0; i < cword.Length; i++)\n {\n if (cword[i] < 91)\n {\n\n Console.Write((char)cword[i]);\n\n }\n if (cword[i] > 91)\n {\n cword[i] -= (char)32;\n Console.Write((char)cword[i]);\n\n }\n\n }\n }\n Console.WriteLine(\" \");\n\n Console.WriteLine(\"===================\");\n\n\n\n\n\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _59A\n{\n class Program\n {\n static void Main()\n {\n var word = Console.ReadLine();\n var lower = 0;\n var upper = 0;\n for (var i = 0; i < word.Length; i++)\n {\n if (char.IsLower(word[i]))\n lower++;\n else\n upper++;\n }\n\n for (var i = 0; i < word.Length; i++)\n Console.Write(lower > upper ? char.ToLower(word[i]) : char.ToUpper(word[i]));\n\n Console.Write(Environment.NewLine);\n }\n }\n}"}, {"source_code": "using System;\n\n\nnamespace _59_A_Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int u=0,l=0;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (Char.IsUpper(s[i]))\n {\n u += 1;\n }\n\n l += 1;\n }\n\n if(u > l)\n {\n s.ToUpper();\n }\n s.ToLower();\n\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace _59_A_Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int u=0,l=0;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (Char.IsUpper(s[i]))\n {\n u += 1;\n }\n\n l += 1;\n }\n\n if(u > l)\n {\n s.ToUpper();\n }\n s.ToLower();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace plagin\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n //if (s[0] >= 'A' &&s[0]<='Z' && s[s.Length - 1] <= 'z' && s[s.Length - 1] >= 'a' || s[0] >= 'a' && s[s.Length - 1] <= 'z') { Console.Write(s.ToLower()); }\n //else \n int kol=0;\n foreach (char c in s) {\n if (c <= 'Z') kol++;\n }\n if (s[0] >= 'A' && s[s.Length - 1] <= 'Z' || kol> s.Length) { Console.WriteLine(s.ToUpper()); } else { Console.WriteLine(s.ToLower()); }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace plagin\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n if (s[0] >= 'A' && s[s.Length - 1] <= 'z' && s[s.Length - 1] >= 'a' || s[0] >= 'a' && s[s.Length - 1] <= 'z') { Console.Write(s.ToLower()); }\n else if (s[0] >= 'A' && s[s.Length - 1] <= 'Z') { Console.WriteLine(s.ToUpper()); }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace plagin\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n //if (s[0] >= 'A' &&s[0]<='Z' && s[s.Length - 1] <= 'z' && s[s.Length - 1] >= 'a' || s[0] >= 'a' && s[s.Length - 1] <= 'z') { Console.Write(s.ToLower()); }\n //else \n if (s[0] >= 'A' && s[s.Length - 1] <= 'Z') { Console.WriteLine(s.ToUpper()); } else { Console.WriteLine(s.ToLower()); }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CaseCorrector\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n int upperCase = 0, lowercase = 0;\n\n foreach (char character in word)\n {\n if ((int)character < 90)\n upperCase++;\n else\n lowercase++;\n }\n\n if (upperCase > lowercase)\n Console.WriteLine(word.ToUpper());\n else if (lowercase > upperCase)\n Console.WriteLine(word.ToLower());\n else\n Console.WriteLine(word.ToLower());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForcesTasks\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar str = Console.ReadLine().ToCharArray();\n\t\t\tint upperCount = 0;\n\t\t\tint lowerCount = 0;\n\t\t\tvar res = string.Empty;\n\n\t\t\tif (str.Length < 100)\n\t\t\t{\n\t\t\t\tforeach (var item in str)\n\t\t\t\t{\n\t\t\t\t\tif (char.IsUpper(item))\n\t\t\t\t\t{\n\t\t\t\t\t\tupperCount++;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlowerCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (lowerCount >= upperCount)\n\t\t\t\t{\n\t\t\t\t\tforeach (var item in str)\n\t\t\t\t\t{\n\t\t\t\t\t\tres += item;\n\t\t\t\t\t}\n\t\t\t\t\tConsole.WriteLine(res.ToLower());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tforeach (var item in str)\n\t\t\t\t\t{\n\t\t\t\t\t\tres += item;\n\t\t\t\t\t}\n\t\t\t\t\tConsole.WriteLine(res.ToUpper());\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int upper = str.ToCharArray().Where(x => x >= 'A' || x <= 'Z').Count();\n Console.WriteLine(upper > str.Length / 2 ? str.ToUpper() : str.ToLower());\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine();\n var n = s.Length;\n if (n == 1)\n {\n Console.WriteLine(s);\n }\n else\n {\n var list = new List();\n for (byte i = 0; i < n; i++)\n {\n list.Add(s[i]);\n }\n var c = list.Where(x => char.IsLower(x)).Count();\n if ((c == 0) || (c == n))\n {\n Console.WriteLine(s);\n }\n else\n {\n if (c >= s.Length/2)\n {\n foreach (var c1 in list)\n {\n Console.Write(char.ToLower(c1));\n }\n }\n else\n {\n foreach (var c1 in list)\n {\n Console.Write(char.ToUpper(c1));\n }\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n \npublic static class XXX\n{\n private static void Main()\n {\n int counter =0;\n string str = Console.ReadLine().ToLower();\n foreach(var x in str){\n if(x>='A' && x<='Z'){\n counter++;\n }\n }\n if(counter>=str.Length/2){\n Console.WriteLine(str.ToUpper());\n }\n else Console.WriteLine(str.ToLower());\n return;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n \npublic static class XXX\n{\n private static void Main()\n {\n int counter =0;\n string str = Console.ReadLine().ToLower();\n foreach(char x in str){\n if(char.IsUpper(x)){\n counter++;\n }\n }\n if(counter>str.Length/2){\n Console.WriteLine(str.ToUpper());\n }\n else Console.WriteLine(str.ToLower());\n return;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n \npublic static class XXX\n{\n private static void Main()\n {\n int counter =0;\n string str = Console.ReadLine().ToLower();\n foreach(var x in str){\n if(x>='A' && x<='Z'){\n counter++;\n }\n }\n if(counter>str.Length/2){\n Console.WriteLine(str.ToUpper());\n }\n else Console.WriteLine(str.ToLower());\n return;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\n \npublic static class XXX\n{\n private static void Main()\n {\n int counter =0;\n string str = Console.ReadLine().ToLower();\n foreach(char x in str){\n if(char.IsUpper(x)){\n counter++;\n }\n }\n Console.Write(counter);\n if(counter>str.Length/2){\n Console.WriteLine(str.ToUpper());\n }\n else Console.WriteLine(str.ToLower());\n return;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var s1 = s.ToLower();\n\n var diff = 0;\n\n for (var i = 0; i < s.Length; i++)\n {\n if (s[i] != s1[i])\n diff++;\n }\n\n if (diff <= s.Length)\n Console.WriteLine(s1);\n else\n Console.WriteLine(s.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int small = 0, cap = 0;\n\n foreach (var i in input)\n {\n if (i <= 'z') small++;\n else cap++;\n }\n\n if (small >= cap)\n {\n Console.WriteLine(input.ToLower());\n }\n else\n {\n Console.WriteLine(input.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n s = s.ToLower();\n Console.WriteLine(s);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n var input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine($\"{output}\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces.Task59A\n{\n class Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar task = new Task();\n\t\t}\n\t}\n \n public interface IGeneralInterface\n\t{\n\t\tvoid Input();\n\n\t\tvoid Output();\n\t}\n \n public class Task : IGeneralInterface\n\t{\n\t\tprivate const int MIN = 1;\n\t\tprivate const int MAX = 100;\n\t\tprivate List _listUp = new List();\n\t\tprivate List _listLow = new List();\n\t\tprivate string _str;\n\n\t\tpublic Task()\n\t\t{\n\t\t\tInput();\n\t\t\tOutput();\n\t\t}\n\n\t\tpublic void Input()\n\t\t{\n\t\t\t_str = Console.ReadLine();\n\t\t\tif(InRange())\n\t\t\t\tDistribute();\n\t\t}\n\n\t\tprivate bool InRange()\n\t\t{\n\t\t\tif (MIN < _str.Length && _str.Length < MAX)\n\t\t\t\treturn true;\n\n\t\t\treturn default;\n\t\t}\n\n\t\tprivate void Distribute()\n\t\t{\n\t\t\tforeach (var item in _str)\n\t\t\t{\n\t\t\t\tif(Char.IsUpper(item))\n\t\t\t\t\t_listUp.Add(item);\n\t\t\t\telse\n\t\t\t\t\t_listLow.Add(item);\n\t\t\t}\n\t\t}\n\n\t\tpublic void Output()\n\t\t{\n\t\t\tif(_listUp.Count > _listLow.Count && _listUp.Count != _listLow.Count)\n\t\t\t\tConsole.WriteLine(_str.ToUpper());\n\t\t\telse\n\t\t\t\tConsole.WriteLine(_str.ToLower());\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring word = Console.ReadLine();\n\t\tint lengthOfWord = word.Count();\n\t\tint upperCount = 0;\n\t\tforeach(char c in word){\n\t\t\tif(Char.IsUpper(c)){\n\t\t\t\tupperCount+=1;\n\t\t\t}\n\t\t}\n\t\tif((lengthOfWord-upperCount) == upperCount){\n\t\t\tConsole.WriteLine(word.ToLower());\n\t\t}else{\n\t\t\tConsole.WriteLine(word.ToUpper());\n\t\t}\n\t\t\n\t}\n}"}, {"source_code": "\nusing System;\n\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int u=0, l=0;\n string w = Console.ReadLine();\n char[] x = w.ToCharArray();\n for (int i = 0; i < x.Length; i++)\n {\n if (char.IsUpper(x[i]))\n u++;\n else\n i++;\n }\n if (u > l)\n Console.WriteLine(w.ToUpper());\n else\n Console.WriteLine(w.ToLower());\n\n }\n\n\n\n }\n\n}\n\n\n\n \n \n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class17\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n string ss1 = s.ToLower();\n string ss2 = s.ToUpper();\n int cnt1 = 0;\n int cnt2 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss1[i])\n cnt1++;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss2[i])\n cnt2++;\n }\n if (cnt1 < cnt2)\n Console.WriteLine(ss1);\n else\n Console.WriteLine(ss2);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class17\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n string ss1 = s.ToLower();\n string ss2 = s.ToUpper();\n int cnt1 = 0;\n int cnt2 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss1[i])\n cnt1++;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ss2[i])\n cnt2++;\n }\n if (cnt1 < cnt2)\n Console.WriteLine(ss1);\n if (cnt1 >= cnt2)\n Console.WriteLine(ss2);\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n string str = Console.ReadLine();\n bool p = char.IsUpper(str[0]);\n bool q = char.IsUpper(str[str.Length-1]);\n if(p && q){\n Console.WriteLine(str.ToUpper()); \n }else{\n Console.WriteLine(str.ToLower());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int lowerCount = 0;\n foreach (char letter in line)\n {\n if (letter >= 'a' && letter <= 'z')\n {\n lowerCount++;\n }\n }\n if (line.Length / 2 > lowerCount)\n {\n Console.WriteLine(line.ToUpper());\n }\n else\n {\n Console.WriteLine(line.ToLower());\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int up = 0;\n for (int i = 0; i < s.Length; i++) {\n if (Char.IsUpper(s[i])) up++;\n }\n if (up >= s.Length * 0.5)\n {\n Console.WriteLine(s.ToUpper());\n }\n else {\n Console.WriteLine(s.ToLower());\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class Test\n {\n public static void Main()\n {\n string word = Console.ReadLine();\n int upperCount = 0;\n int lowerCount = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] > 65 && word[i] < 97)\n {\n upperCount++;\n }\n else\n {\n lowerCount++;\n }\n }\n if (upperCount > lowerCount)\n {\n Console.WriteLine(word.ToUpper());\n }\n else\n {\n Console.WriteLine(word.ToLower());\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n var input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine(output);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n s = s.ToLower();\n Console.WriteLine(s);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n string input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n string output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine(output);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine(output);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n String d = s.ToUpper();\n\n if (String.Compare(s,d)==0)\n {\n Console.WriteLine(s);\n }\n else\n {\n s = s.ToLower();\n Console.WriteLine(s);\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n var input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine($\"{output}\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n var input = Console.ReadLine();\n if (input == null || !(input.Length <= Math.Pow(10, 3))) return;\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine($\"{output}\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n Console.WriteLine(s.ToLower());\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._Word___Problem___59A___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n //----------------------------------------------------------------//\n //// Annotation: A. Word (Problem - 59A - Codeforces) ////\n //--------------------------------------------------------------//\n \n var input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n var output = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n output += input[i].ToString().ToUpper();\n }\n else\n {\n output += input[i];\n }\n }\n Console.WriteLine(output);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._Game_23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n if (input.Length<=Math.Pow(10,3))\n {\n string x = \"\";\n for (int i = 0; i < input.Length; i++)\n {\n if (i==0)\n {\n x += input[i].ToString().ToUpper();\n }\n else\n {\n x += input[i];\n }\n }\n\n Console.WriteLine(x);\n }\n\n \n\n }\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Length>=1 && s.Length<=100)\n {\n s = s.ToLower();\n Console.WriteLine(s);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = (Console.ReadLine());\n Console.WriteLine(SolveProblem(s));\n Console.ReadLine();\n }\n\n static string SolveProblem (string s)\n {\n int lowerCount = 0;\n int higherCount = 0;\n for (int i = 0; i < s.Length ;i++)\n {\n if (char.IsLower( s [i]))\n {\n lowerCount++;\n } else\n {\n higherCount++;\n }\n\n if (lowerCount > (s.Length) / 2)\n {\n return s.ToLower();\n }\n }\n return s.ToUpper();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \nnamespace MY_Sheet\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n int n = 0;\n\n for (int i = 0; i < str.Length; i ++)\n {\n if (char.IsLower(str[i]))\n n++;\n }\n if (n >1)\n Console.WriteLine(str.ToLower());\n else\n Console.WriteLine(str.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n int lower = Regex.Matches(\"a-z\", word).Count;\n int upper = Regex.Matches(\"A-Z\", word).Count;\n\n Console.Write(lower > upper ? word.ToLower() : word.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n int lower = Regex.Matches(\"[a-z]\", word).Count;\n int upper = Regex.Matches(\"[A-Z]\", word).Count;\n\n Console.Write(lower > upper ? word.ToLower() : word.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp19\n{\n class Program\n {\n static void Main(string[] args)\n {\n int upper = 0;\n int lower = 0;\n string word = Console.ReadLine();\n for(int i =0; i=61 && word[i]<=122)\n {\n lower++;\n }\n else\n {\n upper++;\n }\n }\n if(lower>=upper)\n {\n Console.WriteLine(word.ToLower());\n }\n else\n {\n Console.WriteLine(word.ToUpper());\n }\n \n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CODING_C_SHARP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.ToLower();\n Console.Write(str);\n }\n }\n}\n"}, {"source_code": "using System;\n \nnamespace Word_problem\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string word = Console.ReadLine();\n int lowerCaseLetterCount = 0;\n int upperCaseLetterCount = 0;\n\n foreach (var letter in word)\n {\n if (letter > 97 && letter < 122)\n {\n lowerCaseLetterCount++;\n }\n else\n {\n upperCaseLetterCount++;\n }\n }\n\n if (upperCaseLetterCount > lowerCaseLetterCount)\n Console.WriteLine(word.ToUpper());\n else\n Console.WriteLine(word.ToLower());\n }\n }\n}"}, {"source_code": "using System;\nnamespace Code\n{\n class WordCapitalizationProblem\n {\n public static void Main(string[] args)\n {\n var word=Console.ReadLine().ToCharArray();\n word[0]=Char.ToUpper(word[0]);\n foreach (var c in word)\n {\n Console.Write(c);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input = Console.ReadLine();\n if (Input.Length <= 0)\n return;\n int upercase = 0, lowercase = 0;\n foreach (var item in Input)\n {\n if (Char.IsUpper(item))\n upercase++;\n else\n lowercase++;\n }\n if (upercase > lowercase)\n Input = Input.ToUpper();\n else\n Input = Input.ToLower();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Input = Console.ReadLine();\n int upercase = 0, lowercase = 0;\n foreach (var item in Input)\n {\n if (Char.IsUpper(item))\n upercase++;\n else\n lowercase++;\n }\n if (upercase > lowercase)\n Input = Input.ToUpper();\n else\n Input = Input.ToLower();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace \u0624\u062e\u064a\u062b\u0628\u062e\u0642\u0624\u062b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int low = 0 , upper = 0 ;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] > 97) low++;\n else upper++;\n }\n if (low > upper) Console.WriteLine(s.ToLower());\n else Console.WriteLine(s.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace \u0624\u062e\u064a\u062b\u0628\u062e\u0642\u0624\u062b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int low = 0 , upper = 0 ;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] > 97) low++;\n else upper++;\n }\n if (low >= upper) Console.WriteLine(s.ToLower());\n else Console.WriteLine(s.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n byte cnt = 0;\n string s = Console.ReadLine();\n for (byte i = 0; i < s.Length; i++)\n if (char.IsUpper(s[i]))\n cnt++;\n else cnt--;\n Console.WriteLine(cnt>=0?s.ToUpper():s.ToLower());\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n int cnt = 0;\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n if (char.IsUpper(s[i]))\n cnt++;\n else cnt--;\n Console.WriteLine(cnt >= 0 ? s.ToUpper() : s.ToLower());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Word\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Input = Console.ReadLine();\n var Lower = 0;\n var Upper = 0;\n\n foreach (var item in Input)\n {\n if (char.IsLower(item))\n Lower++;\n else\n Upper++; \n }\n\n Console.WriteLine(Lower>Upper ? Input.ToLower() : Input.ToUpper());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n //int k = int.Parse(Console.ReadLine());\n //string[] tmp = Console.ReadLine().Split(' '); \n char[] str = Console.ReadLine().ToArray();\n char[] it = new char[100];\n int k = 0 , countM = 0 , countB = 0;\n for (int i = 0; i < str.Length; i++)\n {\n if (char.IsUpper(str[i]))\n countB++;\n else\n countM++;\n }\n if (countB > countM)\n for (int i = 0; i < str.Length; i++)\n it[k++] = char.ToUpper(str[i]);\n else\n for (int i = 0; i < str.Length; i++)\n it[k++] = char.ToLower(str[i]);\n for (int i = 0; i < it.Length; i++)\n Console.Write(it[i]);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Numerics;\nnamespace sharp_learning\n{\n class Class1\n {\n static void Main()\n {\n string s = Console.ReadLine();\n BigInteger big = 0, small = 0;\n foreach(var i in s)\n {\n if (i >= 'a')\n small++;\n else\n big++;\n }\n if (small <= big)\n Console.WriteLine(s.ToLower());\n else\n Console.WriteLine(s.ToUpper());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Numerics;\nnamespace sharp_learning\n{\n class Class1\n {\n static void Main()\n {\n string s = Console.ReadLine();\n BigInteger big = 0, small = 0;\n foreach(var i in s)\n {\n if (i >= 'a')\n small++;\n else\n big++;\n }\n Console.WriteLine(small);\n if (small >= big)\n Console.WriteLine(s.ToLower());\n else\n Console.WriteLine(s.ToUpper());\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _59a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n int n = t.Length;\n char[] s = new Char[105];\n int p = 0, q = 0;\n for (int i = 0; i < n; ++i)\n {\n s[i] = t[i];\n if (Char.IsLower(s[i])) ++p;\n else ++q;\n }\n if (p < q)\n {\n for (int i = 0; i < n; ++i)\n if (Char.IsLower(s[i])) s[i] = Char.ToUpper(s[i]);\n }\n else for (int i = 0; i < n; ++i)\n if (Char.IsUpper(s[i])) s[i] = Char.ToLower(s[i]);\n Console.WriteLine(s);\n }\n }\n}\n"}], "src_uid": "b432dfa66bae2b542342f0b42c0a2598"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TimusCSharpSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = (from item in Console.ReadLine().Split() select Convert.ToInt32(item)).Sum();\n if (a % 5 == 0 && a / 5 != 0)\n {\n Console.WriteLine(a / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int s;\n \n string str1 = Console.ReadLine();\n int[] massiv = new int[5];\n string[] str2 = str1.Split(' ');\n for (int i = 0; i < 5; i++) {\n massiv[i] = int.Parse(str2[i]);\n }\n s = massiv[0] + massiv[1] + massiv[2] + massiv[3] + massiv[4];\n if ((s % 5 == 0)&&(s>=5))\n {\n Console.WriteLine(s / 5);\n }\n else { Console.WriteLine(\"-1\"); }\n Console.ReadLine();\n \n }\n\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int answer = 0;\n for(int i=0; i0)?(answer/5):-1));\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nnamespace Solver\n{\n\n public class Solver\n {\n public void Solve()\n {\n var sum = sc.Integer(5).Sum();\n if (sum % 5 == 0 && sum / 5 > 0)\n {\n IO.Printer.Out.PrintLine(sum / 5);\n return;\n }\n IO.Printer.Out.PrintLine(-1);\n\n }\n internal IO.StreamScanner sc;\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n System.Diagnostics.Debug.AutoFlush = false;\n var sw = new Watch();\n sw.Start();\n try\n {\n#endif\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n System.Diagnostics.Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer\n {\n static Printer()\n {\n Out = new Printer(Console.Out);\n }\n public static Printer Out { get; set; }\n private readonly System.IO.TextWriter writer;\n private readonly System.Globalization.CultureInfo info;\n public string Separator { get; set; }\n public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? \"\\n\"; } }\n public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)\n {\n writer = tw ?? System.IO.TextWriter.Null;\n info = ci ?? System.Globalization.CultureInfo.InvariantCulture;\n NewLine = newLine;\n Separator = separator ?? \" \";\n }\n public void Print(int num) { writer.Write(num.ToString(info)); }\n public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(long num) { writer.Write(num.ToString(info)); }\n public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(double num) { writer.Write(num.ToString(\"F12\", info)); }\n public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(string str) { writer.Write(str); }\n public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }\n public void Print(string format, IEnumerable sources) { writer.Write(format, sources.OfType().ToArray()); }\n public void Print(IEnumerable sources) { writer.Write(sources.AsString()); }\n public void Print(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n public void PrintLine() { writer.WriteLine(); }\n public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(double num) { writer.WriteLine(num.ToString(\"F12\", info)); }\n public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(string str) { writer.WriteLine(str); }\n public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }\n public void PrintLine(string format, IEnumerable sources) { writer.WriteLine(format, sources.OfType().ToArray()); }\n public void PrintLine(IEnumerable sources)\n {\n var res = new StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n public void Flush() { writer.Flush(); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream)\n {\n iStream = stream;\n }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool EndOfStream { get { return eof; } }\n private byte readByte()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n private bool inSpan(byte c)\n {\n const byte lb = 33, ub = 126;\n return !(c >= lb && c <= ub);\n }\n private byte skip()\n {\n byte b = 0;\n do b = readByte();\n while (!eof && inSpan(b));\n return b;\n }\n public char Char()\n {\n return (char)skip();\n }\n public char[] Char(int n)\n {\n var a = new char[n];\n for (int i = 0; i < n; i++)\n a[i] = (char)skip();\n return a;\n }\n public char[][] Char(int n, int m)\n {\n var a = new char[n][];\n for (int i = 0; i < n; i++)\n a[i] = Char(m);\n return a;\n }\n public string Scan()\n {\n\n const byte lb = 33, ub = 126;\n if (eof) throw new System.IO.EndOfStreamException();\n\n do\n {\n while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))\n {\n ptr++;\n }\n if (ptr < len)\n break;\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return null;\n }\n continue;\n } while (true);\n\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] < lb || ub < buf[i])\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n ptr = i + 1;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public string[] Scan(int n)\n {\n var a = new string[n];\n for (int i = 0; i < n; i++)\n a[i] = Scan();\n return a;\n }\n public string ScanLine()\n {\n const byte el = 10, cr = 13;\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] == cr || buf[i] == el)\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n if (buf[i] == cr) i++;\n if (buf[i] == el) i++;\n ptr = i;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public double Double()\n {\n return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);\n }\n public double[] Double(int n)\n {\n var a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = Double();\n return a;\n }\n public int Integer()\n {\n var ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n\n if (b == mynus)\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n {\n ret = ret * 10 + b - zero;\n }\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public int[] Integer(int n)\n {\n var a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = Integer();\n return a;\n }\n public long Long()\n {\n long ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n if (b == '-')\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n ret = ret * 10 + (b - zero);\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public long[] Long(int n)\n {\n var a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = Long();\n return a;\n }\n public void Flush()\n {\n iStream.Flush();\n }\n\n }\n\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public string AsJoinedString(this IEnumerable source, string separator = \" \")\n {\n return string.Join(separator, source);\n }\n static public T[] Enumerate(this int n, Func selector)\n {\n var res = new T[n];\n for (int i = 0; i < n; i++)\n res[i] = selector(i);\n return res;\n }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n#endif\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar sum = 0;\n\t\t\tfor (var i = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tsum += cin.NextInt();\n\t\t\t}\n\t\t\tif (sum%5 == 0 && sum > 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(sum/5);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass A478 {\n public static void Main() {\n var sum = Console.ReadLine().Split().Sum(int.Parse);\n Console.WriteLine(sum != 0 && sum % 5 == 0 ? sum / 5 : -1);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace R_A_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int[] c = new int[5];\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n c[i] = int.Parse(s[i]);\n sum += c[i];\n }\n if ((sum % 5 == 0) && (sum >= 5)) Console.WriteLine(sum / 5);\n else Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n int[] A = new int[5];\n for (int i = 0; i < 5; i++)\n {\n A[i] = Convert.ToInt32(arr[i]);\n }\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n sum += A[i];\n }\n if (sum < 5 ) Console.WriteLine(-1);\n else if (sum % 5 == 0) Console.WriteLine(sum/5);\n else Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar input = Console.ReadLine();\n\n\t\t\tvar numbers = input.Split(' ');\n\n\t\t\tvar gamble = numbers.Select(number => int.Parse(number)).ToList();\n\n\t\t\tvar sum = gamble.Sum();\n\n\n\t\t\tif (sum == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t} else\n\t\t\tif (sum%5 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(sum/5);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Globalization;\nusing System.Numerics;\n\nnamespace Saba\n{\n public class Test\n {\n public static void Main()\n {\n ProblemA.MainFunc();\n }\n }\n\n public static class ProblemA \n {\n public static void MainFunc()\n {\n int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < coins.Length; i++)\n {\n sum += coins[i];\n }\n int dif = 0;\n int coin = sum / 5;\n if (sum == 0) { Console.WriteLine(\"-1\"); goto end; }\n if (sum % 5 != 0) { Console.WriteLine(\"-1\"); }\n else\n {\n for (int i = 0; i < coins.Length; i++)\n {\n if (coins[i] < coin) { dif = dif - (coin - coins[i]); }\n else if (coins[i] > coin) { dif = dif + (coins[i] - coin); }\n }\n if (dif == 0) { Console.WriteLine(coin); }\n else { Console.WriteLine(\"-1\"); }\n }\n end: { }\n }\n }\n\n public static class ProblemB\n {\n public static BigInteger pairs(BigInteger max, BigInteger min)\n {\n return (max - 1 + min) * (max - 1 - min + 1) / 2;\n }\n public static void MainFunc()\n {\n Int64[] person = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n BigInteger n = person[0], m = person[1];\n BigInteger max = pairs(n - (m - 1), 1);\n BigInteger min = 0;\n BigInteger k = n;\n while (k % m != 0)\n {\n k--;\n }\n int ad = 0;\n if (k != n) ad = 1;\n BigInteger minFirst = pairs(k / m, 1);\n BigInteger minSecond = pairs(k / m + ad, 1);\n for (int i = 0; i < m - (n - k); i++)\n {\n min += minFirst;\n }\n for (int i = 0; i < n - k; i++)\n {\n min += minSecond;\n }\n //max = (first >= second) ? max + first + pairs(n - (m - 1), k / m) : max + second + pairs(n - (m - 1), k / m + ad);\n //if (first >= second) { max += first; max += pairs(n - (m - 1), k / m + 1); }\n //else { max += second; max += pairs(n - (m - 1), k / m + ad + 1); }\n Console.WriteLine(\"{0} {1}\", min, max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int sum = 0;\n\n foreach(var a in data)\n {\n sum += Convert.ToInt32(a);\n }\n\n if (sum == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n }\n }\n}"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var str = Console.ReadLine().Split();\n var c0 = int.Parse(str[0]);\n var c1 = int.Parse(str[1]);\n var c2 = int.Parse(str[2]);\n var c3 = int.Parse(str[3]);\n var c4 = int.Parse(str[4]);\n if (c0 + c1 + c2 + c3 + c4 == 0)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n if ((c0 + c1 + c2 + c3 + c4) % 5 == 0)\n {\n Console.WriteLine((c0 + c1 + c2 + c3 + c4) / 5);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n\n\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nclass Program{\n static void Main(){\n int s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).Sum();\n Console.WriteLine(s % 5 == 0 & s != 0 ? s / 5 : -1);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Na4alnayaStavka\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n int[] arr = Console.ReadLine().Split(' ').Select(e => {\n sum += Int32.Parse(e);\n return Int32.Parse(e);\n }).ToArray();\n if (sum == 0) {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(sum % arr.Length == 0 ? sum / arr.Length : -1);\n\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codefcsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var spl = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).Sum();\n Console.WriteLine( ( (spl % 5 == 0) && (spl > 0)) ? spl/5 : -1 );\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n\n int c1 = Int32.Parse(lines[0]);\n int c2 = Int32.Parse(lines[1]);\n int c3 = Int32.Parse(lines[2]);\n int c4 = Int32.Parse(lines[3]);\n int c5 = Int32.Parse(lines[4]);\n\n Console.WriteLine(getResult(c1, c2, c3, c4, c5));\n\n Console.ReadLine();\n }\n\n static int getResult(int c1, int c2, int c3, int c4, int c5)\n {\n int sum = c1 + c2 + c3 + c4 + c5;\n if (sum % 5 != 0 || sum == 0)\n return -1;\n\n return sum / 5;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n sum += int.Parse(str[i]);\n }\n if (sum % 5 == 0 && sum / 5 > 0)\n {\n Console.WriteLine(sum / 5);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InitialBet\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s)).Sum();\n Console.WriteLine(input > 0 ? (input % 5 == 0 ? input / 5 : -1) : -1);\n \n\n \n \n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0;\n string s = Console.ReadLine();\n string [] numbers = s.Split(new char[]{' '});\n int[] a = new int[numbers.Length];\n for (int i = 0; i < numbers.Length; ++i)\n {\n a[i] = Int32.Parse(numbers[i]);\n k = k + a[i];\n }\n \n \n if ((k % 5 == 0) &&(k !=0)) Console.WriteLine(k / 5);\n else Console.WriteLine(\"-1\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int sum = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n sum += int.Parse(input[i]);\n }\n if (sum < 5)\n {\n Console.WriteLine(-1);\n Environment.Exit(0);\n }\n if (sum % 5 == 0)\n {\n Console.WriteLine(sum / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_478A_Initial_Bet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] player = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if ((player.Sum() % 5 != 0)||(player.Sum()==0))\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(player.Sum() / 5);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar arr=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tint sum=arr.Select(x=>x).Sum();\n\t\tif(sum>=5 && sum%5==0)\n\t\t Console.WriteLine(sum/5);\n\t\telse if(sum<5)\n\t\t\tConsole.WriteLine(-1);\n\t\telse\n\t\t\tConsole.WriteLine(-1);\n\t\t\n\t}\n}\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tvar c = Console.ReadLine().Split().Select(int.Parse);\n\t\tConsole.WriteLine(c.Sum() % 5 == 0 && c.Sum() > 0 ? c.Average() : -1);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int k = Next() + Next() + Next() + Next() + Next();\n writer.WriteLine(k % 5 == 0 && k != 0 ? k / 5 : -1);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n int[] coins = RInts();\n int sum = coins.Sum();\n if (sum % 5 == 0)\n {\n WLine(sum/5 !=0?sum/5:-1);\n return;\n }\n WLine(-1);\n }\n\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n var cs = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();\n int sum = cs.Sum();\n if (sum % 5 == 0 && sum>0)\n Console.WriteLine(sum / 5);\n else\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int b;\n var num = Console.ReadLine().Split().Select(e=>Convert.ToInt32(e)).ToList();\n b = num[0] + num[1] + num[2] + num[3] + num[4];\n if (b % 5 == 0 && b!=0)\n {\n Console.WriteLine(b / 5);\n }\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();\n a = num[0] + num[1] + num[2] + num[3] + num[4];\n if (a % 5 == 0 && a != 0)\n {\n Console.WriteLine(a / 5);\n }\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass dr:IComparable\n{\n public long a, b;\n public dr(string s)\n {\n string[] f = s.Split();\n a = long.Parse(f[0]);\n b = long.Parse(f[1]);\n }\n public int CompareTo(dr d)\n {\n return this.a.CompareTo(d.a);\n }\n\n}\nnamespace ConsoleApplication235\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n sum += int.Parse(s[i]);\n }\n if (sum%5!=0||sum==0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(sum/5);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Initial_Bet\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n sum += Next();\n }\n if (sum>0 && sum % 5 == 0)\n writer.WriteLine(sum/5);\n else\n {\n writer.WriteLine(\"-1\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n.Count(x => x == 0) == 5)\n {\n Console.Write(-1);\n return;\n }\n Console.Write(n.Sum() % n.Count() == 0? n.Sum() / n.Count() : -1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class InitialBet\n{\n private static void Main()\n {\n \tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\t\tvar sum = input.Sum();\n \tConsole.WriteLine(sum > 0 && sum % input.Length == 0 ? sum / input.Length : -1); \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string[] dd = a.Split(new char[] { ' ' });\n int s=0;\n for (int i = 0; i < dd.Length; i++)\n s += Int32.Parse(dd[i].ToString());\n if (s!=0 && s % 5 == 0)\n Console.WriteLine(s / 5);\n else\n Console.WriteLine(-1);\n \n\n //Console.WriteLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_478A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n if (a.Sum() == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n Array.Sort(a);\n int n = a.Length;\n\n while (true)\n {\n bool hasChange = false;\n for (int i = 0; i < n - 1; i++)\n {\n if (a[i] < a[i + 1])\n {\n hasChange = true;\n a[i]++;\n a[i + 1]--;\n }\n }\n if (!hasChange) break;\n }\n\n Console.WriteLine(a.All(x => x == a[0]) ? a[0] : -1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n\n string[] masStr = Console.ReadLine().Split(new string[] { \" \" },\n StringSplitOptions.RemoveEmptyEntries);\n int res = 0;\n int count = 0;\n \n int[] masInt = new int[masStr.Length];\n \n foreach (string str in masStr)\n {\n masInt[count] = int.Parse(str);\n res += masInt[count];\n count++;\n }\n\n int average = res / masStr.Length;\n if (average > 0 && average * masStr.Length == res)\n Console.WriteLine(average);\n else Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var data = Console.ReadLine().Split().Select(d => int.Parse(d)).ToArray();\n var sum = data.Sum();\n var rem = sum % data.Length;\n if (rem != 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n var r = sum / data.Length;\n if (r == 0)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n Console.WriteLine(r);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();\n int sum = num.Sum();\n if(sum % 5 != 0 || sum == 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(sum / 5);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var r = c.Sum() / 5;\n Console.WriteLine(r * 5 == c.Sum() && c.Sum() != 0 ? r : -1);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // Initial Bet (implementation)\n class _478A\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int sum = 0;\n for (int i = 0; i < 5; i++)\n sum += int.Parse(ss[i]);\n if (sum % 5 == 0 && sum > 0) Console.WriteLine(sum / 5); else Console.WriteLine(-1);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] kubiki = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (kubiki.Sum() != 0 && kubiki.Sum() % 5 == 0)\n {\n Console.WriteLine(kubiki.Sum() / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int[] input = ReadInt(5);\n int sum = 0;\n for (int i = 0; i < 5; i++) sum += input[i];\n if (sum % 5 == 0 && sum > 0) WL(sum / 5); else WL(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();\n int b;\n b = num[0] + num[1] + num[2] + num[3] + num[4];\n\n \n if (b%5==0 && b!=0)\n {\n Console.WriteLine(b / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Issue_478A\n{\n class Program\n {\n public static void Main(string[] args) {\n const int CoinsCount = 5;\n \n var coins = new int[CoinsCount];\n \n for (int i = 0; i < CoinsCount; ++i) {\n coins[i] = ReadInt();\n }\n\n var balanced = IsBalanced(coins);\n\n while (!balanced) {\n var max = coins.MaxIndex();\n var min = coins.MinIndex();\n\n if (coins[max] - coins[min] == 1) {\n break;\n }\n\n coins[max]--;\n coins[min]++;\n\n balanced = IsBalanced(coins);\n }\n\n Console.WriteLine((balanced && (coins[0] > 0)) ? coins[0] : -1);\n }\n\n public static bool IsBalanced(int[] array) {\n if (array.Length == 0) \n return true;\n\n var value = array[0];\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] != value) {\n return false;\n }\n }\n\n return true;\n }\n \n private static bool IsInputError = false;\n private static bool IsEndOfLine = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n IsEndOfLine = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n // if symbol == \\n\n if (symbol == 13) {\n // skip next \\r symbol\n Console.Read();\n IsEndOfLine = true;\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n } \n }\n\n public static class Extensions \n {\n public static int MaxIndex(this int[] array) {\n if (array.Length == 0)\n return -1;\n\n var value = array[0];\n var index = 0;\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > value) {\n value = array[i];\n index = i;\n }\n }\n\n return index;\n }\n\n public static int MinIndex(this int[] array) {\n if (array.Length == 0)\n return -1;\n\n var value = array[0];\n var index = 0;\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] < value) {\n value = array[i];\n index = i;\n }\n }\n\n return index;\n }\n\n public static void Print(this int[] array) {\n for (int i = 0; i < array.Length; ++i) {\n Console.Write(\"{0} \", array[i]);\n }\n\n Console.Write(Environment.NewLine);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Olimp\n{\n class Program\n {\n public static void Main(string[] arg)\n {\n var str = Console.ReadLine().Split();\n long k = 0;\n foreach (var s in str) k += long.Parse(s);\n if (k % 5 == 0 && k>0) Console.WriteLine(k / 5);\n else Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int s=0;\n for (int i=0; i < c.Length; i++)\n s += c[i];\n if (s == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n if (s % 5 == 0) Console.WriteLine(s / 5); else Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _478A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Sum(x => int.Parse(x));\n Console.WriteLine(s>=5&&s%5==0?s/5:-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tvar d=ria();\n\t\tint cnt=0;\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n {\n static void Main()\n {\n\n string[] arr = Console.ReadLine().Split();\n\n List bets_list = arr.Select(int.Parse).ToList();\n int intial_bet_sum = 0;\n for(int i=0; i < bets_list.Count; i++)\n {\n intial_bet_sum += bets_list[i];\n }\n\n if(intial_bet_sum == 0){\n Console.WriteLine(-1);\n }else{\n if ((intial_bet_sum % bets_list.Count) == 0)\n {\n Console.WriteLine(intial_bet_sum / bets_list.Count);\n }\n else\n {\n Console.WriteLine(-1);\n } \n }\n \n }\n \n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Initial_Bet\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int suma = 0;\n for (int i = 0; i < 5; i++)\n {\n suma += int.Parse(r[i]);\n }\n if (suma % 5 == 0 && suma != 0) Console.WriteLine(suma / 5);\n else Console.WriteLine(\"-1\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication34\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int s = 0;\n string[] q = Console.ReadLine().Split(); ;\n \n int a = int.Parse(q[0]);\n int b = int.Parse(q[1]);\n int c = int.Parse(q[2]);\n int d = int.Parse(q[3]);\n int e = int.Parse(q[4]);\n s = a + b + c + e + d ;\n\n if (s%5==0&&s!=0)\n Console.WriteLine(s/5);\n else\n Console.WriteLine(-1);\n\n\n\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Program\n{\n static public void Main()\n {\n string[] s = Console.ReadLine().Split();\n int q = int.Parse(s[0]);\n int w = int.Parse(s[1]);\n int e = int.Parse(s[2]);\n int r = int.Parse(s[3]);\n int t = int.Parse(s[4]);\n if ((q + w + e + r + t) > 0 && (q + w + e + r + t) % 5 == 0) Console.WriteLine((q + w + e + r + t) / 5);\n else Console.WriteLine(\"-1\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class35\n {\n public static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int a1 = int.Parse(s[0]);\n int a2 = int.Parse(s[1]);\n int a3 = int.Parse(s[2]);\n int a4 = int.Parse(s[3]);\n int a5 = int.Parse(s[4]);\n int cnt = a1 + a2 + a3 + a4 + a5;\n if (cnt % 5 != 0 || cnt / 5 == 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt / 5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce16\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(arr.Sum() % 5 == 0 && arr.Sum() != 0? arr.Sum() / 5: -1);\n \n \n \n }\n }\n}\n \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Initial_Bet\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] ar1 = Console.ReadLine().Split();\n int s = int.Parse(ar1[0]);\n int x = int.Parse(ar1[1]);\n int a = int.Parse(ar1[2]);\n int w = int.Parse(ar1[3]);\n int q = int.Parse(ar1[4]);\n int count = a+s+x+w+q;\n if (count%5==0&&count>0)\n {\n int v = count / 5;\n Console.WriteLine(v);\n\n }\n else\n Console.WriteLine(-1);\n \n\n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n int rs = 0;\n for (int i = 0; i < input.Length;)\n rs += int.Parse(input[i++]);\n Console.WriteLine(rs % 5 == 0 && rs>0 ? (rs / 5).ToString() : \"-1\");\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ').Select(Int32.Parse).Sum();\n \n Console.WriteLine(s > 0 && s % 5 == 0 ? s / 5 : -1); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace mainnm\n{\n class main\n {\n static void Main()\n {\n int[] ta = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n \n int sum = ta.Sum();\n\n if (sum % 5 == 0 && sum != 0) Console.WriteLine(sum / 5);\n else Console.WriteLine(-1); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _478A\n {\n public static void Main(string[] args)\n {\n int[] coins = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int sum = coins.Sum();\n\n Console.WriteLine(sum > 0 && sum % coins.Length == 0 ? sum / coins.Length : -1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n\tpublic class Program\n\t{\n\t\tstatic void Z1A ()\n\t\t{\n\t\t\tuint n, m, a;\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstring [] strs = str.Split (' ');\n\t\t\tn = UInt32.Parse (strs [0]);\n\t\t\tm = UInt32.Parse (strs [1]);\n\t\t\ta = UInt32.Parse (strs [2]);\n\n\n\t\t\tuint nn = n / a;\n\t\t\tif (n % a > 0)\n\t\t\t\tnn++;\n\t\t\tuint nm = m / a;\n\t\t\tif (m % a > 0)\n\t\t\t\tnm++;\n\t\t\tulong result = (ulong)nn * (ulong)nm;\n\t\t\tConsole.WriteLine (result);\n\t\t}\n\n\t\tstatic void Z4A ()\n\t\t{\n\t\t\tint w = Int32.Parse (Console.ReadLine ());\n\t\t\tif (w % 2 == 0 && w > 2)\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t}\n\n\t\tstatic void Z158A ()\n\t\t{\n\t\t\tint n, k;\n\t\t\tstring [] strs = Console.ReadLine ().Split (' ');\n\t\t\tn = Int32.Parse (strs [0]);\n\t\t\tk = Int32.Parse (strs [1]);\n\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\tint max = 0;\n\t\t\tint i;\n\t\t\tfor (i = 0; i < k; i++) {\n\t\t\t\tmax = Int32.Parse (strs [i]);\n\t\t\t\tif (max == 0) {\n\t\t\t\t\tConsole.WriteLine (i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint sum = k;\n\t\t\tfor (; i < n; i++) {\n\t\t\t\tif (Int32.Parse (strs [i]) < max)\n\t\t\t\t\tbreak;\n\t\t\t\tsum++;\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z71A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tstring str;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstr = Console.ReadLine ();\n\t\t\t\tif (str.Length > 10) {\n\t\t\t\t\tConsole.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n\t\t\t\t} else {\n\t\t\t\t\tConsole.WriteLine (str);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z118A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstr = str.ToLower ();\n\t\t\tstr = str.Replace (\"a\", \"\");\n\t\t\tstr = str.Replace (\"o\", \"\");\n\t\t\tstr = str.Replace (\"y\", \"\");\n\t\t\tstr = str.Replace (\"e\", \"\");\n\t\t\tstr = str.Replace (\"u\", \"\");\n\t\t\tstr = str.Replace (\"i\", \"\");\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tConsole.Write (\".\" + str [i]);\n\t\t\t}\n\n\n\t\t}\n\n\t\tstatic void Z50A ()\n\t\t{\n\t\t\n\t\t\tstring [] strs = Console.ReadLine ().Split (' ');\n\t\t\tint N = Int32.Parse (strs [0]);\n\t\t\tint M = Int32.Parse (strs [1]);\n\t\t\tint result = 0;\n\t\t\tresult = (N / 2) * M;\n\t\t\tN %= 2;\n\t\t\tM /= 2;\n\t\t\tresult += M * N;\n\t\t\tConsole.WriteLine (result);\n\t\t\n\t\t}\n\n\t\tstatic void Z158B ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tint[] com = new int[4];\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tcom [i] = 0;\t\n\t\t\t}\n\t\t\tint temp = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ttemp = Int32.Parse (strs [i]);\n\t\t\t\tcom [temp - 1]++;\n\t\t\t}\n\t\t\tint sum = com [3];\n\t\t\ttemp = Math.Min (com [2], com [0]);\n\t\t\tcom [2] -= temp;\n\t\t\tcom [0] -= temp;\n\t\t\tsum += temp;\n\t\t\tsum += com [2];\n\t\t\tsum += com [1] / 2;\n\t\t\tcom [1] %= 2;\n\t\t\tsum += com [1];\n\t\t\tcom [0] -= com [1] * 2;\n\t\t\tif (com [0] > 0) {\n\t\t\t\n\t\t\t\tsum += com [0] / 4;\n\t\t\t\tcom [0] %= 4;\n\t\t\t\tif (com [0] > 0)\n\t\t\t\t\tsum++;\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\n\t\t}\n\n\t\tstatic void Z231A ()\n\t\t{\n\t\t\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tstring[] strs;\n\t\t\tint sum = 0;\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\t\tif (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n\t\t\t\t\tsum++;\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z282A ()\n\t\t{\n\t\t\t\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint x = 0;\n\t\t\tstring str;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstr = Console.ReadLine ();\n\t\t\t\tstr = str.Replace (\"X\", \"\");\n\t\t\t\tif (str == \"++\") {\n\t\t\t\t\tx++;\n\t\t\t\t} else {\n\t\t\t\t\tx--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (x);\n\t\t}\n\n\t\tstatic void Z116A ()\n\t\t{\n\t\t\t\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint a = 0, b = 0;\n\t\t\tint sum = 0;\n\t\t\tint max = 0;\n\t\t\tstring [] strs;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\t\ta = Int32.Parse (strs [0]);\n\t\t\t\tb = Int32.Parse (strs [1]);\n\t\t\t\tsum -= a;\n\t\t\t\tsum += b;\n\t\t\t\tif (sum > max) {\n\t\t\t\t\tmax = sum;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (max);\n\t\t}\n\n\t\tstatic void Z131A ()\n\t\t{\n\t\t\tbool caps = true;\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tchar first = str [0];\n\t\t\tfor (int i = 1; i < str.Length; i++) {\n\t\t\t\tif (str [i] < 'A' || str [i] > 'Z')\n\t\t\t\t\tcaps = false;\n\t\t\t}\n\t\t\tif (caps) {\n\t\t\t\tstr = str.ToLower ();\n\t\t\t\tif (first >= 'a' && first <= 'z')\n\t\t\t\t\tfirst = first.ToString ().ToUpper () [0];\n\t\t\t\telse\n\t\t\t\t\tfirst = first.ToString ().ToLower () [0];\n\t\t\t\tstr = first + str.Substring (1);\n\n\t\t\t}\n\t\t\tConsole.WriteLine (str);\n\t\t}\n\n\t\tstatic void Z96A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tint n = 0;\n\t\t\tchar ch = 'w';\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (ch == str [i])\n\t\t\t\t\tn++;\n\t\t\t\telse {\n\t\t\t\t\tif (n >= 7) {\n\t\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tch = str [i];\n\t\t\t\t\tn = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n < 7)\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t}\n\n\t\tstatic void Z266A ()\n\t\t{\n\t\t\t\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstr = Console.ReadLine ();\n\t\t\tint n = 0;\n\t\t\tint m = 0;\n\t\t\tchar ch = ' ';\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (ch == str [i])\n\t\t\t\t\tn++;\n\t\t\t\telse {\n\t\t\t\t\tm += n;\n\t\t\t\t\tch = str [i];\n\t\t\t\t\tn = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tm += n;\n\t\t\tConsole.WriteLine (m);\n\t\t}\n\n\t\tstatic void Z133A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tConsole.WriteLine (\"NO\");\n\t\t\n\t\t\n\t\t}\n\n\t\tstatic void Z112A ()\n\t\t{\n\t\t\tstring str1 = Console.ReadLine ();\n\t\t\tstr1 = str1.ToLower ();\n\t\t\tstring str2 = Console.ReadLine ();\n\t\t\tstr2 = str2.ToLower ();\n\t\t\tint n = String.Compare (str1, str2);\n\t\t\tif (n != 0)\n\t\t\t\tConsole.WriteLine (n / Math.Abs (n));\n\t\t\telse\n\t\t\t\tConsole.WriteLine (0);\n\t\t}\n\n\t\tstatic void Z339A ()\n\t\t{\n\t\t\tint [] ch = new int[3];\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tch [i] = 0;\n\t\t\t}\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tbool flag = false;\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (flag)\n\t\t\t\t\ti++;\n\t\t\t\telse\n\t\t\t\t\tflag = true;\n\t\t\t\tch [Int32.Parse (str [i].ToString ()) - 1]++;\n\t\t\t}\n\t\t\tint j = 0;\n\t\t\tflag = false;\n\t\t\twhile (j<3) {\n\t\t\t\tch [j]--;\n\t\t\t\t\n\t\t\t\tif (ch [j] >= 0) {\n\t\t\t\t\tif (flag) {\n\t\t\t\t\t\tConsole.Write (\"+\");\n\t\t\t\t\t} else\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\tConsole.Write (j + 1);\n\t\t\t\t} else\n\t\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z281A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstring f = str [0].ToString ();\n\t\t\tf = f.ToUpper ();\n\t\t\tstr = f [0] + str.Substring (1);\n\t\t\tConsole.Write (str);\n\t\t}\n\n\t\tstatic void Z82A ()\n\t\t{\n\t\t\tstring[] names = new\tstring[5];\n\t\t\tnames [0] = \"Sheldon\";\n\t\t\tnames [1] = \"Leonard\";\n\t\t\tnames [2] = \"Penny\";\n\t\t\tnames [3] = \"Rajesh\";\n\t\t\tnames [4] = \"Howard\";\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint m = 5;\n\t\t\twhile (m moneys = new List ();\n\t\t\tint sum = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tmoneys.Add (Int32.Parse (str [i]));\n\t\t\t\tsum += moneys [i];\n\t\t\t}\n\n\t\t\tint[] armon = moneys.ToArray ();\n\t\t\tArray.Sort (armon);\n\t\t\tint blz = 0;\n\t\t\tint j = armon.Length - 1;\n\t\t\tint ni = 0;\n\t\t\twhile (blz<=sum&&j>=0) {\n\t\t\t\tblz += armon [j];\n\t\t\t\tsum -= armon [j];\n\t\t\t\tj--;\n\t\t\t\tni++;\n\t\t\t}\n\t\t\tConsole.WriteLine (ni);\n\t\t}\n\n\t\tstatic void Z148A ()\n\t\t{\n\t\t\tint k = Int32.Parse (Console.ReadLine ());\n\t\t\tint l = Int32.Parse (Console.ReadLine ());\n\t\t\tint m = Int32.Parse (Console.ReadLine ());\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint d = Int32.Parse (Console.ReadLine ());\n\t\t\tint sum = 0;\n\t\t\t\n\t\t\tfor (int i = 1; i <= d; i++) {\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tsum++;\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z236A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tint n = 0;\n\t\t\tstring ne = \"\";\n\t\t\tbool k;\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tk = false;\n\t\t\t\tfor (int j = 0; j < ne.Length; j++) {\n\t\t\t\t\tif (str [i] == ne [j]) {\n\t\t\t\t\t\tk = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!k) {\n\t\t\t\t\tne += str [i];\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tConsole.WriteLine (\"CHAT WITH HER!\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"IGNORE HIM!\");\n\t\t\t}\n\t\t}\n\n\t\tstatic int gdc (int left, int right)\n\t\t{\n\t\t\twhile (left>0&&right>0) {\n\t\t\t\tif (left > right) {\n\t\t\t\t\tleft %= right;\n\t\t\t\t} else\n\t\t\t\t\tright %= left;\n\t\t\t}\n\t\t\treturn left + right;\n\t\t}\n\n\t\tstatic void Z119A ()\n\t\t{\n\t\t\tstring[] str = Console.ReadLine ().Split (' ');\n\t\t\tint[] ab = new int[2];\n\n\t\t\tab [0] = Int32.Parse (str [0]);\n\t\t\tab [1] = Int32.Parse (str [1]);\n\t\t\tint n = Int32.Parse (str [2]);\n\t\t\tint i = 0;\n\t\t\tint m;\n\t\t\twhile (true) {\n\t\t\t\tif (n == 0) {\n\t\t\t\t\tConsole.WriteLine ((i + 1) % 2);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tm = gdc (ab [i], n);\n\t\t\t\tn -= m;\n\t\t\t\ti = (i + 1) % 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void Z110A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tint n = 0;\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (str [i] == '4' || str [i] == '7') {\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n == 4 || n == 7) {\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z467A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint res = 0;\n\t\t\tstring [] strs;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\t\tif (Int32.Parse (strs [1]) - Int32.Parse (strs [0]) >= 2) {\n\t\t\t\t\tres++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\t\t}\n\n\t\tstatic void Z271A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint [] ye = new int[4];\n\t\t\tn++;\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tye [i] = n / 1000;\n\t\t\t\tn %= 1000;\n\t\t\t\tn *= 10;\n\t\t\t}\n\t\t\tbool flag = true;\n\t\t\twhile (flag) {\n\t\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\t\t\tif (ye [i] == ye [j]) {\n\t\t\t\t\t\t\tye [i]++;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (int k = i+1; k < 4; k++) {\n\t\t\t\t\t\t\t\tye [k] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ti--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tflag = false;\n\t\t\t\tfor (int i = 1; i < 4; i++) {\n\t\t\t\t\tif (ye [i] == 10) {\n\t\t\t\t\t\tye [i] %= 10;\n\t\t\t\t\t\tye [i - 1]++;\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tConsole.Write (ye [i]);\n\t\t\t}\n\t\t\n\t\t}\n\n\t\tstatic void Z58A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstr.ToLower ();\n\t\t\tstring sstr = \"hello\";\n\t\t\tint j = 0;\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tif (sstr [j] == str [i])\n\t\t\t\t\tj++;\n\t\t\t\tif (j == sstr.Length) {\n\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (\"NO\");\n\t\t}\n\n\t\tstatic void Z472A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tConsole.Write (\"4 \");\n\t\t\t\tConsole.Write (n - 4);\n\t\t\t} else {\n\t\t\t\tConsole.Write (\"9 \");\n\t\t\t\tConsole.Write (n - 9);\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z460A ()\n\t\t{\n\t\t\tint res = 0;\n\t\t\tint days = 0;\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tint nosk = Int32.Parse (strs [0]);\n\t\t\tint nd = Int32.Parse (strs [1]);\n\t\t\twhile (nosk!=0) {\n\t\t\t\tdays += nosk;\n\t\t\t\tres += nosk;\n\t\t\t\tnosk = 0;\n\t\t\t\tnosk = days / nd;\n\t\t\t\tdays %= nd;\n\t\t\t}\n\t\t\tConsole.Write (res);\n\t\t}\n\n\t\tstatic void Z379A ()\n\t\t{\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tint a = Int32.Parse (strs [0]);\n\t\t\tint b = Int32.Parse (strs [1]);\n\t\t\tint ogaroks = 0;\n\t\t\tint h = 0;\n\t\t\twhile (a!=0) {\n\t\t\t\th += a;\n\t\t\t\togaroks += a;\n\t\t\t\ta = ogaroks / b;\n\t\t\t\togaroks %= b;\n\t\t\t}\n\t\t\tConsole.WriteLine (h);\n\t\t}\n\n\t\tstatic bool IsLucky (int n)\n\t\t{\n\t\t\twhile (n>0) {\n\t\t\t\tint m = n % 10;\n\t\t\t\tif (m != 4 && m != 7) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tn /= 10;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic void Z122A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tfor (int i = 2; i <= n; i++) {\n\t\t\t\tif (n % i == 0 && IsLucky (i)) {\n\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (\"NO\");\n\t\t}\n\n\t\tstatic void Z136A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint[] pod = new int[n];\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tpod [Int32.Parse (strs [i]) - 1] = i + 1;\n\t\t\t}\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tConsole.Write (pod [i].ToString () + \" \");\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z228A ()\n\t\t{\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tList n = new List ();\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tbool flag = true;\n\t\t\t\tfor (int j = 0; j < n.Count; j++) {\n\t\t\t\t\tif (Int32.Parse (strs [i]) == n [j]) {\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (flag) {\n\t\t\t\t\tn.Add (Int32.Parse (strs [i]));\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (4 - n.Count);\n\t\t}\n\n\t\tstatic void Z263A ()\n\t\t{\n\t\t\tstring[] strs;\n\t\t\tint x = 0, y = 0;\n\t\t\tfor (int i = 0; i < 5; i++) {\n\t\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\t\tfor (int j = 0; j < 5; j++) {\n\t\t\t\t\tif (strs [j] == \"1\") {\n\t\t\t\t\t\tx = j + 1;\n\t\t\t\t\t\ty = i + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tConsole.WriteLine ((Math.Abs (3 - x) + Math.Abs (3 - y)));\n\t\t}\n\n\t\tstatic void Z266B ()\n\t\t{\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tint n = Int32.Parse (strs [0]);\n\t\t\tint t = Int32.Parse (strs [1]);\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tchar[] chs = new char[str.Length];\n\t\t\tfor (int i = 0; i < str.Length; i++) {\n\t\t\t\tchs [i] = str [i];\n\t\t\t}\n\t\t\tfor (int i = 0; i < t; i++) {\n\t\t\t\tint j = 0;\n\t\t\t\twhile (j+1 rost [max])\n\t\t\t\t\tmax = i;\n\t\t\t}\n\t\t\tint sum = 0;\n\t\t\twhile (max!=0) {\n\t\t\t\tint temp = rost [max];\n\t\t\t\trost [max] = rost [max - 1];\n\t\t\t\trost [max - 1] = temp;\n\t\t\t\tsum++;\n\t\t\t\tmax--;\n\t\t\t}\n\n\n\t\t\tfor (int i = n-1; i >=0; i--) {\n\n\t\t\t\tif (rost [i] < rost [min]) {\n\t\t\t\t\tmin = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (min!=rost.Length-1) {\n\t\t\t\tint temp = rost [min];\n\t\t\t\trost [min] = rost [min + 1];\n\t\t\t\trost [min + 1] = temp;\n\t\t\t\tsum++;\n\t\t\t\tmin++;\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z451A ()\n\t\t{\n\t\t\tstring[] names = new string[2];\n\t\t\tnames [0] = \"Akshat\";\n\t\t\tnames [1] = \"Malvika\";\n\t\t\tstring[] strs = Console.ReadLine ().Split (' ');\n\t\t\tint n = Int32.Parse (strs [0]);\n\t\t\tint m = Int32.Parse (strs [1]);\n\t\t\tn = Math.Min (n, m) - 1;\n\t\t\tn %= 2;\n\t\t\tConsole.WriteLine (names [n]);\n\n\t\t}\n\n\t\tstatic void Z344A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint ostr = 1;\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tchar ch = str [1];\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tstr = Console.ReadLine ();\n\t\t\t\tif (ch == str [0]) {\n\t\t\t\t\tostr++;\n\t\t\t\t}\n\t\t\t\tch = str [1];\n\t\t\t}\n\t\t\tConsole.WriteLine (ostr);\n\t\t}\n\n\t\tstatic void Z486A ()\n\t\t{\n\t\t\tlong n = Int64.Parse (Console.ReadLine ());\n\t\t\tlong sum = n / 2;\n\t\t\tsum -= (n % 2) * n;\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z500A ()\n\t\t{\n\t\t\tstring[] str = Console.ReadLine ().Split (' ');\n\t\t\tint n = Int32.Parse (str [0]);\n\t\t\tint t = Int32.Parse (str [1]);\n\t\t\tint[] a = new int[n - 1];\n\t\t\tstr = Console.ReadLine ().Split (' ');\n\t\t\tint j = 0;\n\t\t\tt--;\n\t\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\t\ta [i] = Int32.Parse (str [i]);\n\t\t\t\tif (i == j)\n\t\t\t\t\tj += a [i];\n\t\t\t\tif (j >= t)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (j == t)\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t}\n\n\t\tstatic void Z61A ()\n\t\t{\n\t\t\tstring str1 = Console.ReadLine ();\n\t\t\tstring str2 = Console.ReadLine ();\n\t\t\tstring str3 = \"\";\n\t\t\tfor (int i = 0; i < str1.Length; i++) {\n\t\t\t\tif (str1 [i] == str2 [i])\n\t\t\t\t\tstr3 += \"0\";\n\t\t\t\telse\n\t\t\t\t\tstr3 += \"1\";\n\t\t\t}\n\t\t\tConsole.WriteLine (str3);\n\t\t}\n\n\t\tstatic void Z268A ()\n\t\t{\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\t\t\tint[] h = new int[n];\n\t\t\tint[] a = new int[n];\n\t\t\tstring[] strs;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tstrs = Console.ReadLine ().Split (' ');\n\t\t\t\th [i] = Int32.Parse (strs [0]);\n\t\t\t\ta [i] = Int32.Parse (strs [1]);\n\t\t\t}\n\t\t\tint sum = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\tif (i != j && h [i] == a [j])\n\t\t\t\t\t\tsum++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (sum);\n\t\t}\n\n\t\tstatic void Z208A ()\n\t\t{\n\t\t\tstring str = Console.ReadLine ();\n\t\t\tstring[] separ = new string[1];\n\t\t\tsepar [0] = \"WUB\";\n\t\t\tstring[] strs = str.Split (separ, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tfor (int i = 0; i < strs.Length; i++) {\n\t\t\t\tConsole.Write (strs [i] + \" \");\n\t\t\t}\n\t\t}\n\n\t\tstatic void Z478A ()\n\t\t{\n\t\t\tstring []strs=Console.ReadLine().Split(' ');\n\t\t\tint n=0;\n\t\t\tfor (int i = 0; i < 5; i++) {\n\t\t\t\tn+=Int32.Parse(strs[i]);\n\t\t\t}\n\t\t\tif (n%5==0&&n!=0) {\n\t\t\t\tConsole.WriteLine(n/5);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\t\tpublic static void Main ()\n\t\t{\n\t\t\tZ478A ();\n\t\t}\n\n\t}\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] tok = Console.ReadLine().Split(' ');\n int sum = 0;\n for(int i = 0; i < 5; i++)\n sum += Int32.Parse(tok[i]);\n if(sum % 5 != 0 || sum == 0)\n {\n Console.WriteLine(-1);\n }else{\n Console.WriteLine(sum / 5);\n }\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int sum = 0;\n foreach (int i in l)\n {\n sum += i;\n }\n if (sum > 0 && sum % 5 == 0)\n {\n Console.WriteLine(sum / 5);\n }\n else\n Console.WriteLine(\"-1\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var n = int.Parse(Console.ReadLine());\n var list = Console.ReadLine().Split().Select(int.Parse).ToList();\n if (list.Sum() % list.Count() == 0 &&list.Sum()!=0)\n Console.WriteLine(list.Sum() / list.Count());\n else\n Console.WriteLine(-1);\n\n // var are =Console.ReadLine().ToList();\n // var word = Console.ReadLine().Select(s=>s).ToArray();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeCsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int n = 5;\n int[] arr = new int[n]; int sum = 0, c;\n string[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(s[i]);\n sum += arr[i];\n }\n if (sum % n == 0 && sum != 0)\n c = sum / 5;\n else\n c = -1;\n Console.Write(c);\n }\n }\n}\n"}, {"source_code": "using System;\n\nusing System.Linq;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] v = s.Split(' ');\n int[] n = Array.ConvertAll(v, int.Parse);\n int sum = n.Sum();\n\n if (sum > 0 && sum % 5 == 0)\n {\n Console.WriteLine(sum/5);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;i0) Console.WriteLine(temp/s.Length);\n else Console.WriteLine(\"-1\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _478A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] str2 = str.Split();\n int a = Convert.ToInt32(str2[0]);\n int b = Convert.ToInt32(str2[1]);\n int c = Convert.ToInt32(str2[2]);\n int d = Convert.ToInt32(str2[3]);\n int e = Convert.ToInt32(str2[4]);\n int sum = a + b + c + d + e;\n if ((sum % 5 == 0)&&(sum>=5)) { Console.WriteLine(sum/5); } else\n {\n Console.WriteLine(-1);\n }\n\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass dr:IComparable\n{\n public long a, b;\n public dr(string s)\n {\n string[] f = s.Split();\n a = long.Parse(f[0]);\n b = long.Parse(f[1]);\n }\n public int CompareTo(dr d)\n {\n return this.a.CompareTo(d.a);\n }\n\n}\nnamespace ConsoleApplication235\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int sum = 0;\n for (int i = 0; i < 5; i++)\n {\n sum += int.Parse(s[i]);\n }\n if (sum%5!=0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(sum/5);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class35\n {\n public static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int a1 = int.Parse(s[0]);\n int a2 = int.Parse(s[1]);\n int a3 = int.Parse(s[2]);\n int a4 = int.Parse(s[3]);\n int a5 = int.Parse(s[4]);\n int cnt = a1 + a2 + a3 + a4 + a5;\n if (cnt % 5 != 0 && cnt / 5 != 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt / 5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] vvod = Console.ReadLine().Split(' ');\n int sum = 0;\n bool qwe = true;\n for (int i = 0; i < 5; i++)\n {\n if (Int32.Parse(vvod[i]) < 0) { qwe = false; break; }\n sum = sum + Int32.Parse(vvod[i]);\n\n }\n if ((sum % 5 == 0)&(qwe == true)) Console.WriteLine(sum / 5);\n else\n Console.WriteLine(\"-1\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int[] input = ReadInt(5);\n int sum = 0;\n for (int i = 0; i < 5; i++) sum += input[i];\n if (sum % 5 == 0) WL(sum / 5); else WL(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n {\n static void Main()\n {\n\n string[] arr = Console.ReadLine().Split();\n\n List bets_list = arr.Select(int.Parse).ToList();\n int intial_bet_sum = 0;\n for(int i=0; i < bets_list.Count; i++)\n {\n intial_bet_sum += bets_list[i];\n }\n //decimal bet = intial_bet_sum / bets_list.Count;\n //double b = intial_bet_sum / bets_list.Count;\n\n if ((intial_bet_sum % bets_list.Count) == 0)\n {\n Console.WriteLine(intial_bet_sum / bets_list.Count);\n }\n else\n {\n Console.WriteLine(-1);\n }\n \n }\n \n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n \n class Program\n {\n static void Main(string[] args)\n {\n int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int symma=mas[0]+mas[1]+mas[2]+mas[3]+mas[4];\n if (mas[0] == 0 && mas[1] == 0 && mas[2] == 0 && mas[3] == 0 && mas[4] == 0) { Console.WriteLine(\"0\"); }\n else \n {\n if (symma % 5 == 0) { Console.WriteLine(symma / 5); }\n else { Console.WriteLine(\"-1\"); }\n }\n Console.ReadLine ();\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace Data_Structure_Train_XX20\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] arr = str.Split(' ');\n int sum = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +\n int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());\n double sumll = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +\n int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());\n if (((sum / 5) - (sumll / 5)) <=0)\n Console.Write(\"-1\");\n else\n Console.Write(sum / 5);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int sum = 0;\n\n foreach(var a in data)\n {\n sum += Convert.ToInt32(a);\n }\n\n Console.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n\n static void Main( string[] args )\n {\n StartingBid startingBid = new StartingBid( Console.ReadLine().Split( ' ' ) );\n startingBid.PrintStartingBid();\n Console.ReadLine();\n\n } \n }\n\n class StartingBid\n {\n private const int person = 5;\n private int[] bids = new int[person];\n public StartingBid( string[] s )\n {\n for ( int i = 0; i < 5; ++i )\n {\n bids[i] = int.Parse( s[i] );\n }\n }\n private int Average( int[] a )\n {\n int average = 0;\n for ( int i = 0; i < person; ++i )\n {\n average += a[i];\n }\n if ( average % person != 0 )\n {\n return -1;\n }\n else\n {\n return average / person;\n }\n }\n public void PrintStartingBid(){\n Console.WriteLine(Average(bids));\n }\n \n }\n\n\n}"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class InitialBet\n{\n private static void Main()\n {\n \tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\t\tvar sum = input.Sum();\n \tConsole.WriteLine(sum % input.Length == 0 ? sum / input.Length : -1); \n }\n}"}, {"source_code": "using System;\n\npublic class Class1\n{\n public static void Main()\n {\n bool flag = true;\n string[] bet = Console.ReadLine().Split();\n int count = 0;\n for (int i = 0; i < 5; i++)\n {\n count += Convert.ToInt32(bet[i]);\n if (Convert.ToInt32(bet[i]) == 0)\n flag = false;\n }\n if (count % 5 != 0 || flag == false)\n Console.WriteLine(\"-1\");\n else Console.WriteLine(count/5);\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;i int.Parse(x)).ToArray();\n int sum = 0;\n foreach (int i in l)\n {\n sum += i;\n }\n if (sum >= 0 && sum % 5 == 0)\n {\n Console.WriteLine(sum / 5);\n }\n else\n Console.WriteLine(\"-1\");\n \n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Class1\n{\n\tpublic static void Main()\n\t{\n string[] bet = Console.ReadLine().Split();\n int count = 0;\n for (int i = 0; i < 5; i++)\n count += Convert.ToInt32(bet[i]);\n if (count % 5 != 0)\n Console.WriteLine(\"-1\");\n else Console.WriteLine(count/5);\n\t}\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int[] input = ReadInt(5);\n int sum = 0;\n for (int i = 0; i < 5; i++) sum += input[i];\n if (sum % 5 == 0 || sum == 0) WL(sum / 5); else WL(-1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] splitStp = str.Split(' ');\n int result = 0;\n for (int i = 0; i < 5; i++)\n {\n result += int.Parse(splitStp[i]);\n }\n if (result % 5 == 0)\n {\n result /= 5;\n Console.WriteLine(result);\n }\n else\n Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n Console.WriteLine((Arr.Sum() % 5 != 0) ? -1 : (Arr.Sum() / 5));\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();\n int b;\n b = num[0] + num[1] + num[2] + num[3] + num[4];\n\n \n if (b%5==0)\n {\n Console.WriteLine(b / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InitialBet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n float sum = (float)(a.Sum()); \n float check = ((float)sum / 5.0f);\n if (5 * (int)check == (float)sum)\n Console.WriteLine((int)check);\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int answer = 0;\n for(int i=0; i 0 || (q + w + e + r + t) % 5 == 0) Console.WriteLine((q + w + e + r + t) / 5);\n else Console.WriteLine(\"-1\");\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int answer = 0;\n for(int i=0; i Convert.ToInt32(e)).ToList();\n int sum = cs.Sum();\n if (sum % 5 == 0)\n Console.WriteLine(sum / 5);\n else\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class InitialBet\n{\n private static void Main()\n {\n \tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\t\tvar sum = input.Sum();\n \tConsole.WriteLine(sum > 0 && sum % sum % input.Length == 0 ? sum / input.Length : -1); \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n {\n static void Main()\n {\n\n string[] arr = Console.ReadLine().Split();\n\n List bets_list = arr.Select(int.Parse).ToList();\n int intial_bet_sum = 0;\n for(int i=0; i < bets_list.Count; i++)\n {\n intial_bet_sum += bets_list[i];\n }\n //decimal bet = intial_bet_sum / bets_list.Count;\n //double b = intial_bet_sum / bets_list.Count;\n\n if ((intial_bet_sum % bets_list.Count) == 0)\n {\n Console.WriteLine(intial_bet_sum / bets_list.Count);\n }\n else\n {\n Console.WriteLine(-1);\n }\n \n }\n \n }"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Na4alnayaStavka\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n int[] arr = Console.ReadLine().Split(' ').Select(e => {\n sum += Int32.Parse(e);\n return Int32.Parse(e);\n }).ToArray();\n\n Console.WriteLine(sum % arr.Length == 0 ? sum / arr.Length : -1);\n\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace p1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] inp = input.Split(' ');\n int sum=0;\n for (int i = 0; i < inp.Length; i++)\n sum += int.Parse(inp[i]);\n if (sum % 5 != 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(sum / 5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\n\npublic static class solver\n{\n public static void Main()\n {\n var coins = Console.ReadLine().Split(null).Select(int.Parse).ToArray();\n Console.WriteLine(coins.Sum() % 5 == 0 ? coins.Sum() / 5 : -1);\n\n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] kubiki = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (kubiki.Sum() % 5 == 0)\n {\n Console.WriteLine(kubiki.Sum() / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _478A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\tint sum = 0;\n\t\t\tfor (int i = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tsum += a[i];\n\t\t\t}\n\t\t\tConsole.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Initial_Bet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] omar = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if ( omar.Sum() % 5 == 0)\n {\n Console.WriteLine(omar.Sum()/5);\n }\n else\n Console.WriteLine(\"-1\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar input = Console.ReadLine();\n\n\t\t\tvar numbers = input.Split(' ');\n\n\t\t\tvar gamble = numbers.Select(number => int.Parse(number)).ToList();\n\n\t\t\tvar sum = gamble.Sum();\n\n\n\n\t\t\tif (sum%5 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(sum/5);\n\t\t\t}\n\t\t\telse if (sum == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t} else\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n {\n static void Main()\n {\n\n string[] arr = Console.ReadLine().Split();\n\n List bets_list = arr.Select(int.Parse).ToList();\n int intial_bet_sum = 0;\n for(int i=0; i < bets_list.Count; i++)\n {\n intial_bet_sum += bets_list[i];\n }\n //decimal bet = intial_bet_sum / bets_list.Count;\n //double b = intial_bet_sum / bets_list.Count;\n\n if ((intial_bet_sum % bets_list.Count) == 0)\n {\n Console.WriteLine(intial_bet_sum / bets_list.Count);\n }\n else\n {\n Console.WriteLine(-1);\n }\n \n }\n \n }"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;i CoinsNum = new List();\n string[] Coins = Console.ReadLine().Split(' ');\n for (int i = 0; i < Coins.Length; i++)\n {\n CoinsNum.Add(Convert.ToInt32(Coins[i]));\n }\n\n foreach (int coin in CoinsNum)\n {\n if (coin >= 0 && coin <= 100)\n {\n Counter += coin;\n }\n }\n if (Counter % 5 == 0)\n {\n Result = Counter / 5;\n Console.WriteLine(Result);\n }\n else\n {\n Result = -1;\n Console.WriteLine(Result);\n }\n \n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tvar d=ria();\n\t\tint cnt=0;\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TimusCSharpSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = (from item in Console.ReadLine().Split() select Convert.ToInt32(item)).Sum();\n if (a % 5 == 0)\n {\n Console.WriteLine(a / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();\n int sum = num.Sum();\n if(sum % num.Length != 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(sum / num.Length);\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n int rs = 0;\n for (int i = 0; i < input.Length;)\n rs += int.Parse(input[i++]);\n Console.WriteLine(rs % 5 == 0 ? (rs / 5).ToString() : \"-1\");\n }\n }"}, {"source_code": "using System;\n\nnamespace Issue_478A\n{\n class Program\n {\n public static void Main(string[] args) {\n const int CoinsCount = 5;\n \n var coins = new int[CoinsCount];\n \n for (int i = 0; i < CoinsCount; ++i) {\n coins[i] = ReadInt();\n }\n\n var balanced = IsBalanced(coins);\n\n while (!balanced) {\n var max = coins.MaxIndex();\n var min = coins.MinIndex();\n\n if (coins[max] - coins[min] == 1) {\n break;\n }\n\n coins[max]--;\n coins[min]++;\n\n balanced = IsBalanced(coins);\n }\n\n Console.WriteLine(balanced ? coins[0] : -1);\n }\n\n public static bool IsBalanced(int[] array) {\n if (array.Length == 0) \n return true;\n\n var value = array[0];\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] != value) {\n return false;\n }\n }\n\n return true;\n }\n \n private static bool IsInputError = false;\n private static bool IsEndOfLine = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n IsEndOfLine = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n // if symbol == \\n\n if (symbol == 13) {\n // skip next \\r symbol\n Console.Read();\n IsEndOfLine = true;\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n } \n }\n\n public static class Extensions \n {\n public static int MaxIndex(this int[] array) {\n if (array.Length == 0)\n return -1;\n\n var value = array[0];\n var index = 0;\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > value) {\n value = array[i];\n index = i;\n }\n }\n\n return index;\n }\n\n public static int MinIndex(this int[] array) {\n if (array.Length == 0)\n return -1;\n\n var value = array[0];\n var index = 0;\n\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] < value) {\n value = array[i];\n index = i;\n }\n }\n\n return index;\n }\n\n public static void Print(this int[] array) {\n for (int i = 0; i < array.Length; ++i) {\n Console.Write(\"{0} \", array[i]);\n }\n\n Console.Write(Environment.NewLine);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n \n class Program\n {\n static void Main(string[] args)\n {\n int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int symma=mas[0]+mas[1]+mas[2]+mas[3]+mas[4];\n if (mas[0] == 0 && mas[1] == 0 && mas[2] == 0 && mas[3] == 0 && mas[4] == 0) { Console.WriteLine(\"0\"); }\n else \n {\n if (symma % 5 == 0) { Console.WriteLine(symma / 5); }\n else { Console.WriteLine(\"-1\"); }\n }\n Console.ReadLine ();\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n int[] coins = RInts();\n int sum = coins.Sum();\n if (sum % 5 == 0)\n {\n WLine(sum/5);\n return;\n }\n WLine(-1);\n }\n\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar input = Console.ReadLine();\n\n\t\t\tvar numbers = input.Split(' ');\n\n\t\t\tvar gamble = numbers.Select(number => int.Parse(number)).ToList();\n\n\t\t\tvar sum = gamble.Sum();\n\n\n\n\t\t\tif (sum%5 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(sum/5);\n\t\t\t}\n\t\t\telse if (sum == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t} else\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int s=0;\n for (int i=0; i < c.Length; i++)\n s += c[i];\n if (s == 0)\n {\n Console.WriteLine(0);\n return;\n }\n if (s % 5 == 0) Console.WriteLine(s / 5); else Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n \n class Program\n {\n static void Main(string[] args)\n {\n int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int symma=mas[0]+mas[1]+mas[2]+mas[3]+mas[4];\n if (symma % 5 == 0) { Console.WriteLine(symma / 5); }\n else { Console.WriteLine(\"-1\"); }\n Console.ReadLine ();\n }\n }"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var sum = _.Cin.ReadLine().Split(\" \".ToCharArray(), 5).Select(int.Parse).Sum();\n _.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Globalization;\n\nnamespace Saba\n{\n public class Test \n {\n public static void Main()\n {\n int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < coins.Length; i++) \n {\n sum += coins[i];\n }\n int diff = 0;\n for (int i = 0; i < coins.Length; i++)\n {\n if (coins[i] > sum / 5) { diff += coins[i] - sum / 5; }\n else if (coins[i] < sum / 5) { diff -= sum / 5 - coins[i]; }\n else { }\n }\n if (diff == 0) { Console.WriteLine(sum / 5); }\n else { Console.WriteLine(\"-1\"); }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace Data_Structure_Train_XX20\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] arr = str.Split(' ');\n int sum = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +\n int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());\n double sumll = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +\n int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());\n if (((sum / 5) - (sumll / 5)) <=0)\n Console.Write(\"-1\");\n else\n Console.Write(sum / 5);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Globalization;\n\nnamespace Saba\n{\n public class Test \n {\n public static void Main()\n {\n int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < coins.Length; i++) \n {\n sum += coins[i];\n }\n int diff = 0;\n int coin = sum / 5;\n for (int i = 0; i < coins.Length; i++)\n {\n if (coins[i] > coin) { diff += (coins[i] - coin); }\n else if (coins[i] < coin) { diff -= (coin - coins[i]); }\n else { }\n }\n if (sum % 5 == 0)\n {\n if (diff == 0) { Console.WriteLine(coin); }\n else { Console.WriteLine(\"-1\"); }\n }\n else Console.WriteLine(\"-1\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int sum = 0;\n foreach (int i in l)\n {\n sum += i;\n }\n if (sum >= 0 && sum % 5 == 0)\n {\n Console.WriteLine(sum / 5);\n }\n else\n Console.WriteLine(\"-1\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Globalization;\n\nnamespace Saba\n{\n public class Test \n {\n public static void Main()\n {\n int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < coins.Length; i++) \n {\n sum += coins[i];\n }\n int diff = 0;\n int coin = sum / 5;\n for (int i = 0; i < coins.Length; i++)\n {\n if (coins[i] > coin) { diff += (coins[i] - coin); }\n else if (coins[i] < coin) { diff -= (coin - coins[i]); }\n else { }\n }\n if (sum % 5 == 0)\n {\n if (diff == 0) { Console.WriteLine(coin); }\n else { Console.WriteLine(\"-1\"); }\n }\n else Console.WriteLine(\"-1\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_478A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n Array.Sort(a);\n int n = a.Length;\n\n while (true)\n {\n bool hasChange = false;\n for (int i = 0; i < n - 1; i++)\n {\n if (a[i] < a[i + 1])\n {\n hasChange = true;\n a[i]++;\n a[i + 1]--;\n }\n }\n if (!hasChange) break;\n }\n\n Console.WriteLine(a.All(x => x == a[0]) ? a[0] : -1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_478A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n Array.Sort(a);\n int n = a.Length;\n\n while (true)\n {\n bool hasChange = false;\n for (int i = 0; i < n - 1; i++)\n {\n if (a[i] < a[i + 1])\n {\n hasChange = true;\n a[i]++;\n a[i + 1]--;\n }\n }\n if (!hasChange) break;\n }\n\n Console.WriteLine(a.All(x => x == a[0]) ? a[0] : -1);\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int[] input = ReadInt(5);\n int sum = 0;\n for (int i = 0; i < 5; i++) sum += input[i];\n if (sum % 5 == 0) WL(sum / 5); else WL(-1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace p1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] inp = input.Split(' ');\n int sum=0;\n for (int i = 0; i < inp.Length; i++)\n sum += int.Parse(inp[i]);\n if (sum % 5 != 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(sum / 5);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;iConvert.ToInt32(e)).ToList();\n b = num[0] + num[1] + num[2] + num[3] + num[4];\n if (b % 5 == 0)\n {\n Console.WriteLine(b / 5);\n }\n else\n Console.WriteLine(-1);\n if (b == 0)\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nnamespace Solver\n{\n\n public class Solver\n {\n public void Solve()\n {\n var sum = sc.Integer(5).Sum();\n if (sum % 5 == 0)\n {\n IO.Printer.Out.PrintLine(sum/5);\n return;\n }\n IO.Printer.Out.PrintLine(-1);\n\n }\n internal IO.StreamScanner sc;\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n System.Diagnostics.Debug.AutoFlush = false;\n var sw = new Watch();\n sw.Start();\n try\n {\n#endif\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n System.Diagnostics.Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer\n {\n static Printer()\n {\n Out = new Printer(Console.Out);\n }\n public static Printer Out { get; set; }\n private readonly System.IO.TextWriter writer;\n private readonly System.Globalization.CultureInfo info;\n public string Separator { get; set; }\n public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? \"\\n\"; } }\n public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)\n {\n writer = tw ?? System.IO.TextWriter.Null;\n info = ci ?? System.Globalization.CultureInfo.InvariantCulture;\n NewLine = newLine;\n Separator = separator ?? \" \";\n }\n public void Print(int num) { writer.Write(num.ToString(info)); }\n public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(long num) { writer.Write(num.ToString(info)); }\n public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(double num) { writer.Write(num.ToString(\"F12\", info)); }\n public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(string str) { writer.Write(str); }\n public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }\n public void Print(string format, IEnumerable sources) { writer.Write(format, sources.OfType().ToArray()); }\n public void Print(IEnumerable sources) { writer.Write(sources.AsString()); }\n public void Print(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n public void PrintLine() { writer.WriteLine(); }\n public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(double num) { writer.WriteLine(num.ToString(\"F12\", info)); }\n public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(string str) { writer.WriteLine(str); }\n public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }\n public void PrintLine(string format, IEnumerable sources) { writer.WriteLine(format, sources.OfType().ToArray()); }\n public void PrintLine(IEnumerable sources)\n {\n var res = new StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n public void Flush() { writer.Flush(); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream)\n {\n iStream = stream;\n }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool EndOfStream { get { return eof; } }\n private byte readByte()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n private bool inSpan(byte c)\n {\n const byte lb = 33, ub = 126;\n return !(c >= lb && c <= ub);\n }\n private byte skip()\n {\n byte b = 0;\n do b = readByte();\n while (!eof && inSpan(b));\n return b;\n }\n public char Char()\n {\n return (char)skip();\n }\n public char[] Char(int n)\n {\n var a = new char[n];\n for (int i = 0; i < n; i++)\n a[i] = (char)skip();\n return a;\n }\n public char[][] Char(int n, int m)\n {\n var a = new char[n][];\n for (int i = 0; i < n; i++)\n a[i] = Char(m);\n return a;\n }\n public string Scan()\n {\n\n const byte lb = 33, ub = 126;\n if (eof) throw new System.IO.EndOfStreamException();\n\n do\n {\n while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))\n {\n ptr++;\n }\n if (ptr < len)\n break;\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return null;\n }\n continue;\n } while (true);\n\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] < lb || ub < buf[i])\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n ptr = i + 1;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public string[] Scan(int n)\n {\n var a = new string[n];\n for (int i = 0; i < n; i++)\n a[i] = Scan();\n return a;\n }\n public string ScanLine()\n {\n const byte el = 10, cr = 13;\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] == cr || buf[i] == el)\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n if (buf[i] == cr) i++;\n if (buf[i] == el) i++;\n ptr = i;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public double Double()\n {\n return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);\n }\n public double[] Double(int n)\n {\n var a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = Double();\n return a;\n }\n public int Integer()\n {\n var ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n\n if (b == mynus)\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n {\n ret = ret * 10 + b - zero;\n }\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public int[] Integer(int n)\n {\n var a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = Integer();\n return a;\n }\n public long Long()\n {\n long ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n if (b == '-')\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n ret = ret * 10 + (b - zero);\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public long[] Long(int n)\n {\n var a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = Long();\n return a;\n }\n public void Flush()\n {\n iStream.Flush();\n }\n\n }\n\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public string AsJoinedString(this IEnumerable source, string separator = \" \")\n {\n return string.Join(separator, source);\n }\n static public T[] Enumerate(this int n, Func selector)\n {\n var res = new T[n];\n for (int i = 0; i < n; i++)\n res[i] = selector(i);\n return res;\n }\n }\n}\n#endregion\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] tok = Console.ReadLine().Split(' ');\n int sum = 0;\n for(int i = 0; i < 5; i++)\n sum += Int32.Parse(tok[i]);\n if(sum % 5 != 0)\n {\n Console.WriteLine(-1);\n }else{\n Console.WriteLine(sum / 5);\n }\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f_\u0441\u0442\u0430\u0432\u043a\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(PR(mas));\n Console.ReadLine();\n\n }\n\n static int PR(int[] mas)\n {\n if (mas.Sum() % mas.Length == 0)\n return mas.Sum() / mas.Length;\n else\n return -1;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int s = v.Sum();\n if (s % 5 == 0)\n Console.WriteLine(s / 5);\n else\n Console.WriteLine(-1);\n \n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nclass x\n{\n\tstatic void Main()\n\t{\n\t\tList boys = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToList();\n\t\tConsole.Write(boys.Sum()%5==0?boys.Sum()/5:-1);\n\t}\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: user419\n * Date: 21.10.2014\n * Time: 15:52\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] abcde = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(abcde[0]);\n int b = Convert.ToInt32(abcde[1]);\n int c = Convert.ToInt32(abcde[2]);\n int d = Convert.ToInt32(abcde[3]);\n int e = Convert.ToInt32(abcde[4]);\n int sum = a+b+c+d+e;\n if(sum%5!=0)\n Console.WriteLine(\"-1\");\n else Console.WriteLine(sum/5);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TimusCSharpSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = (from item in Console.ReadLine().Split() select Convert.ToInt32(item)).Sum();\n if (a % 5 == 0)\n {\n Console.WriteLine(a / 5);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToByte(num)).ToArray();\n\n int total = 0;\n foreach ( byte value in input)\n {\n total += value;\n }\n\n Console.WriteLine(total % input.Length == 0 ? total / input.Length : -1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int b;\n var num = Console.ReadLine().Split().Select(e=>Convert.ToInt32(e)).ToList();\n b = num[0] + num[1] + num[2] + num[3] + num[4];\n if (b % 5 == 0)\n {\n Console.WriteLine(b / 5);\n }\n else\n Console.WriteLine(-1);\n if (b == 0)\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;i int.Parse(token)).ToArray();\n\n int sum = coins.Sum();\n\n Console.WriteLine(sum % coins.Length == 0 ? sum / coins.Length : -1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadTemplate\n{\n public class Solver\n {\n public static void Solve()\n {\n var sum = ReadIntArray().Sum();\n Writer.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n }\n\n public static void Main()\n {\n Reader = Console.In; Writer = Console.Out;\n //Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace mainnm\n{\n class main\n {\n static void Main()\n {\n int[] ta = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n \n int sum = ta.Sum();\n\n if (sum % 5 == 0) Console.WriteLine(sum / 5);\n else Console.WriteLine(-1); \n }\n }\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: user419\n * Date: 21.10.2014\n * Time: 15:52\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] abcde = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(abcde[0]);\n int b = Convert.ToInt32(abcde[1]);\n int c = Convert.ToInt32(abcde[2]);\n int d = Convert.ToInt32(abcde[3]);\n int e = Convert.ToInt32(abcde[4]);\n int sum = a+b+c+d+e;\n if(sum%5!=0)\n Console.WriteLine(\"-1\");\n else Console.WriteLine(sum/5);\n }\n }\n}"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int temp=0;\n for (int i=0;iint.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sum = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n if (sum.Sum() % sum.Count() == 0)\n Console.WriteLine(sum.Sum() / sum.Count());\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int answer = 0;\n for(int i=0; i 0)\n return -1;\n return sum / 5;\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n// reader = new StreamReader(\"army.in\");\n// writer = new StreamWriter(\"army.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n {\n static void Main()\n {\n\n string[] arr = Console.ReadLine().Split();\n\n List bets_list = arr.Select(int.Parse).ToList();\n int intial_bet_sum = 0;\n for(int i=0; i < bets_list.Count; i++)\n {\n intial_bet_sum += bets_list[i];\n }\n //decimal bet = intial_bet_sum / bets_list.Count;\n //double b = intial_bet_sum / bets_list.Count;\n\n if ((intial_bet_sum % bets_list.Count) == 0)\n {\n Console.WriteLine(intial_bet_sum / bets_list.Count);\n }\n else\n {\n Console.WriteLine(-1);\n }\n \n }\n \n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n Console.WriteLine((Arr.Sum() % 5 != 0) ? -1 : (Arr.Sum() / 5));\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n\n int c1 = Int32.Parse(lines[0]);\n int c2 = Int32.Parse(lines[1]);\n int c3 = Int32.Parse(lines[2]);\n int c4 = Int32.Parse(lines[3]);\n int c5 = Int32.Parse(lines[4]);\n\n Console.WriteLine(getResult(c1, c2, c3, c4, c5));\n\n Console.ReadLine();\n }\n\n static int getResult(int c1, int c2, int c3, int c4, int c5)\n {\n int sum = c1 + c2 + c3 + c4 + c5;\n if (sum % 5 == 0)\n return -1;\n\n\n return sum / 5;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication34\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int s = 0;\n string[] q = Console.ReadLine().Split(); ;\n \n int a = int.Parse(q[0]);\n int b = int.Parse(q[1]);\n int c = int.Parse(q[2]);\n int d = int.Parse(q[3]);\n int e = int.Parse(q[4]);\n s = a + b + c + e + d ;\n\n if (s%5==0)\n Console.WriteLine(s/5);\n else\n Console.WriteLine(-1);\n\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _478A\n {\n public static void Main(string[] args)\n {\n int[] coins = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int sum = coins.Sum();\n\n Console.WriteLine(sum % coins.Length == 0 ? sum / coins.Length : -1);\n }\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var sum = _.Cin.ReadLine().Split(\" \".ToCharArray(), 5).Select(int.Parse).Sum();\n _.WriteLine(sum % 5 == 0 ? sum / 5 : -1);\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Globalization;\n\nnamespace Saba\n{\n public class Test \n {\n public static void Main()\n {\n int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < coins.Length; i++) \n {\n sum += coins[i];\n }\n int diff = 0;\n int coin = sum / 5;\n bool correct = true;\n bool minFound = false;\n for (int i = 0; i < coins.Length; i++)\n {\n if (coins[i] > coin) { diff += (coins[i] - coin); }\n else if (coins[i] < coin) { if (!minFound) { minFound = true; } else { correct = false; break; } diff -= (coin - coins[i]); }\n else { }\n }\n if (sum % 5 != 0 || !correct)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n if (diff == 0) { Console.WriteLine(coin); }\n else { Console.WriteLine(\"-1\"); }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f_\u0441\u0442\u0430\u0432\u043a\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(PR(mas));\n Console.ReadLine();\n\n }\n\n static int PR(int[] mas)\n {\n if (mas.Sum() % mas.Length == 0)\n return mas.Sum() / mas.Length;\n else\n return -1;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n\n int c1 = Int32.Parse(lines[0]);\n int c2 = Int32.Parse(lines[1]);\n int c3 = Int32.Parse(lines[2]);\n int c4 = Int32.Parse(lines[3]);\n int c5 = Int32.Parse(lines[4]);\n\n Console.WriteLine(getResult(c1, c2, c3, c4, c5));\n\n Console.ReadLine();\n }\n\n static int getResult(int c1, int c2, int c3, int c4, int c5)\n {\n int sum = c1 + c2 + c3 + c4 + c5;\n if (sum % 5 == 0)\n return -1;\n\n\n return sum / 5;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace GameCoins\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int sum = 0;\n for (int i=0;i<5;i++)\n {\n int c = int.Parse(s[i]);\n sum += c;\n }\n\n if (sum%5==0)\n {\n Console.Write(sum / 5);\n }\n else\n {\n Console.Write(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n decimal[] n = Console.ReadLine().Split().Select(Convert.ToDecimal).ToArray();\n\n decimal ave = n.Sum() / n.Length;\n\n if (ave == Convert.ToInt32(ave))\n {\n Console.WriteLine(ave);\n }\n else\n {\n Console.WriteLine(-1);\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_478A_Initial_Bet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] player = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (player.Sum() % 5 != 0)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(player.Sum() / 5);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n decimal[] n = Console.ReadLine().Split().Select(Convert.ToDecimal).ToArray();\n\n decimal ave = n.Sum() / n.Length;\n\n if (ave == Convert.ToInt32(ave))\n {\n Console.WriteLine(ave);\n }\n else\n {\n Console.WriteLine(-1);\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class35\n {\n public static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int a1 = int.Parse(s[0]);\n int a2 = int.Parse(s[1]);\n int a3 = int.Parse(s[2]);\n int a4 = int.Parse(s[3]);\n int a5 = int.Parse(s[4]);\n int cnt = a1 + a2 + a3 + a4 + a5;\n if (cnt % 5 != 0 && cnt / 5 != 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt / 5);\n }\n }\n}\n"}], "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20"} {"source_code": "using System;\nnamespace ConsoleApp2\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n String[] input1 = Console.ReadLine().Split();\n long K = Int32.Parse(input1[0]);\n long P = Int32.Parse(input1[1]);\n long result = 0;\n for (int k = 1; k <= K; ++k) {\n long temp = k;\n long N = k;\n while (temp > 0) {\n long mod = temp % 10;\n temp = temp / 10;\n N = N * 10 + mod;\n }\n result += N % P;\n }\n result = result % P;\n Console.WriteLine(result);\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ktolli\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int k = Convert.ToInt32(s[0]);\n int p = Convert.ToInt32(s[1]);\n \n long sum = 0;\n for (int i = 1; i <= k;i++)\n {\n string palindrNum = i.ToString() + String.Join(\"\",i.ToString().Reverse().ToArray());\n sum += Convert.ToInt64(palindrNum);\n }\n\n Console.Write(sum % p);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int k = input[0], p = input[1];\n int sum = 0;\n for (var i = 1; i <= k; ++i)\n {\n var zcyi = ZcyAt(i);\n sum = (sum + (int)(zcyi % p)) % p;\n }\n Console.WriteLine(sum);\n }\n\n static long ZcyAt(int i)\n {\n long zcyLeft = i;\n int zcyRight = 0;\n while (i > 0)\n {\n zcyRight *= 10;\n zcyRight += i % 10;\n i /= 10;\n zcyLeft *= 10;\n }\n return zcyLeft + zcyRight;\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int k = input[0], p = input[1];\n int sum = 0;\n for (var i = 1; i <= k; ++i)\n {\n var zcyi = ZcyAt(i);\n sum = (sum + (int)(zcyi % p)) % p;\n }\n\n Console.WriteLine(sum);\n }\n\n static long ZcyAt(int i)\n {\n long zcyLeft = i;\n int zcyRight = 0;\n while (i > 0)\n {\n zcyRight *= 10;\n zcyRight += i % 10;\n i /= 10;\n zcyLeft *= 10;\n }\n return zcyLeft + zcyRight;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _897B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] InputStirng = Console.ReadLine().Split();\n long k = Convert.ToInt32(InputStirng[0]);\n long p = Convert.ToInt32(InputStirng[1]);\n\n long Sum = 0;\n for (int i = 1; i < k + 1; i++)\n {\n string Reverse = \"\";\n for (int j = 0; j < i.ToString().Length; j++) Reverse = i.ToString()[j] + Reverse;\n Sum += Convert.ToInt64(i.ToString() + Reverse);\n }\n\n Console.WriteLine(Sum % p);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _897B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int k = int.Parse(tokens[0]);\n int p = int.Parse(tokens[1]);\n\n Console.WriteLine(Enumerable.Range(1, k).Select(i => long.Parse(new string(i.ToString().ToArray().Concat(i.ToString().Reverse()).ToArray())) % p).Sum() % p);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public string[] StringArray()\n {\n Line = Console.ReadLine().Split(Separator);\n Index = Line.Length;\n return Line;\n }\n\n public int[] IntArray()\n {\n var l = StringArray();\n var res = new int[l.Length];\n for (int i = 0; i < l.Length; i++)\n {\n res[i] = int.Parse(l[i]);\n }\n return res;\n }\n\n public long[] LongArray()\n {\n var l = StringArray();\n var res = new long[l.Length];\n for (int i = 0; i < l.Length; i++)\n {\n res[i] = long.Parse(l[i]);\n }\n return res;\n }\n}\n\nclass Program\n{\n private int K, P;\n private void Scan()\n {\n var sc = new Scanner();\n K = sc.NextInt();\n P = sc.NextInt();\n }\n\n public void Solve()\n {\n Scan();\n long ans = 0;\n for(int i=1;i<=K;i++)\n {\n ans += Num(i);\n ans %= P;\n }\n Console.WriteLine(ans);\n }\n\n private long Num(int i)\n {\n long ret = i;\n while (i > 0)\n {\n ret *= 10;\n ret += i % 10;\n i /= 10;\n ret %= P;\n }\n return ret;\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFCSH\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] StrArr = Console.ReadLine().Split(' ');\n long k = long.Parse(StrArr[0]);\n long p = long.Parse(StrArr[1]);\n List l = new List { \"00\", \"11\", \"22\", \"33\", \"44\", \"55\", \"66\", \"77\", \"88\", \"99\" };\n ICollection num = new HashSet { 11, 22, 33, 44, 55, 66, 77, 88, 99 };\n\n int sz = 0;\n string sub;\n long temp;\n while (num.Count < 100010)\n {\n sz = l.Count;\n for (int j = 0; j <= 9; ++j)\n {\n for (int i = 0; i < sz; ++i)\n {\n sub = j.ToString() + l[i] + j.ToString();\n l.Add(sub);\n if (j != 0)\n {\n temp = long.Parse(sub);\n num.Add(temp);\n }\n\n }\n }\n }\n long sum = 0;\n int q = 0;\n foreach (long par in num)\n {\n if (q < k)\n sum += par % p;\n else\n break;\n ++q;\n }\n Console.WriteLine(sum % p);\n\n\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace \u044f\u0440\u043c\u043e\u0440\u043a\u0430\n{\n class Program\n {\n static string Reverse(string s)\n {\n string res = \"\";\n for (int i = 0; i < s.Length; i++)\n {\n res = s[i] + res;\n }\n\n return res;\n }\n static void Main(string[] args)\n {\n\n string[] input = Console.ReadLine().Split();\n int k = Convert.ToInt32(input[0]);\n UInt64 p = Convert.ToUInt64(input[1]);\n\n UInt64 sum = 0;\n\n for (int i = k; i >= 1; i--)\n {\n string s = Convert.ToString(i) + Reverse(Convert.ToString(i));\n \n sum += Convert.ToUInt64(s);\n }\n\n Console.WriteLine(sum % p);\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Chtholly\n{\n public static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int k = int.Parse(input[0]);\n long p = int.Parse(input[1]);\n\n long sum = 0;\n\n for (int i = 1; i <= k; i++)\n {\n string x = i.ToString();\n string zcy = x + Reverse(x);\n long zcy_number = long.Parse(zcy);\n sum += zcy_number;\n }\n\n Console.WriteLine(sum % p);\n }\n\n static string Reverse(string s)\n {\n char[] chars = s.ToCharArray();\n Array.Reverse(chars);\n return new string(chars);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n { static int nxt()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n return n;\n\n }\n static string rev(ulong a)\n {\n string h = Convert.ToString(a);\n string itog = \"\";\n for (int i = h.Length - 1; i >= 0; i--)\n {\n itog += h[i];\n\n }\n return itog;\n \n }\n static void Main(string[] args)\n {\n string[] k = Console.ReadLine().Split();\n ulong n = Convert.ToUInt64(k[0]), m = Convert.ToUInt64(k[1]) , itog = 0;\n for(ulong i = 1; i <= n; i++)\n {\n ulong tp = i;\n string s = Convert.ToString(tp);\n s =s + rev(tp);\n itog += Convert.ToUInt64(s);\n itog %= m;\n\n }\n Console.WriteLine(itog%m);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int k = int.Parse(token[0]);\n int p = int.Parse(token[1]);\n long sum = 0;\n \n for(int i=1;i<=k;i++){\n string ss = i.ToString();\n string sss = ss + Reverse(ss);\n long num = long.Parse(sss);\n sum+=num;\n }\n \n Console.WriteLine(sum%p);\n \n }\n \n public static string Reverse( string s )\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse( charArray );\n return new string( charArray );\n }\n\n \n }\n \n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace dd\n{\n\tclass MainClass\n\t{\n\t\tpublic static long foo(long x)\n\t\t{\n\t\t\tList digits = new List();\n\t\t\twhile (x > 0)\n\t\t\t{\n\t\t\t\tdigits.Add(x % 10);\n\t\t\t\tx /= 10;\n\t\t\t}\n\t\t\tlong sum = 0, pw = 1;\n\t\t\tdigits.Reverse();\n\t\t\tforeach (long j in digits)\n\t\t\t{\n\t\t\t\tsum += j * pw;\n\t\t\t\tpw *= 10;\n\t\t\t}\n\t\t\tdigits.Reverse();\n\t\t\tforeach (long j in digits)\n\t\t\t{\n\t\t\t\tsum += j* pw;\n\t\t\t\tpw *= 10;\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring [] values = Console.ReadLine().Split(' ');\n\t\t\tlong N = long.Parse(values[0]);\n\t\t\tlong MOD = long.Parse(values[1]);\n\t\t\tlong ans = 0;\n\t\t\tfor (int i = 1; i <= N; ++i)\n\t\t\t{\n\t\t\t\tans += foo(i);\n\t\t\t\tans %= MOD; \n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Chtholly_s_request\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n int k = Next();\n int p = Next();\n\n long ans = 0;\n for (int i = 1; i <= k; i++)\n {\n long n = i;\n long ii = i;\n while (n > 0)\n {\n ii = ii*10 + n%10;\n n /= 10;\n }\n ans += ii;\n }\n\n return ans%p;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n\n \n object Solve()\n {\n var k = ReadLong();\n var p = ReadLong();\n var sum = 0L;\n \n for (int i = 1; i <= k; i++)\n {\n sum += long.Parse(i.ToString() + new string(i.ToString().Reverse().ToArray()));\n sum %= p;\n }\n return sum;\n }\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n }\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n private long k;\n private long p;\n private long answ;\n private int count;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n k = sr.NextInt64();\n p = sr.NextInt64();\n answ = 0L;\n count = 0;\n for (var i = 1; i <= k; i++) {\n Generate(i, 0, new char[i]);\n if (count == k)\n break;\n }\n\n sw.WriteLine(answ);\n }\n\n private void Generate(int total, int curr, char[] val)\n {\n if (count == k)\n return;\n \n if (curr == total) {\n count++;\n var arg2 = Int64.Parse(new string(val) + new string(val.Reverse().ToArray()));\n answ = (answ % p + arg2 % p) % p;\n return;\n }\n\n for (var i = 0; i <= 9; i++) {\n if(i == 0 && curr == 0)\n continue;\n val[curr] = (char) ('0' + i);\n Generate(total, curr + 1, val);\n if (count == k) {\n break;\n }\n }\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\nclass Graph\n{\n private readonly List[] edges;\n\n public Graph(int n)\n {\n edges = new List[n];\n }\n\n public void Insert(int x, int y)\n {\n if (edges[x] == null) {\n edges[x] = new List();\n }\n edges[x].Add(y);\n }\n\n public void Solution()\n {\n \n }\n\n private void DfsVisit(int v, bool[] visited)\n {\n visited[v] = true;\n if (edges[v] != null) {\n for (var i = 0; i < edges[v].Count; i++) {\n if (!visited[edges[v][i]]) {\n DfsVisit(edges[v][i], visited);\n }\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public static bool IsPalindrome(BigInteger n)\n {\n BigInteger flip = 0;\n for (BigInteger i = n; i > 0; i /= 10)\n {\n flip = flip * 10 + (i % 10);\n }\n\n return n == flip;\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int k = input[0];\n int p = input[1];\n\n int sum = 0;\n\n for (int i = 1; i <= k; ++i)\n {\n long zcy = Palindrom(i);\n sum = (sum + (int)(zcy % p)) % p;\n }\n\n Console.WriteLine(sum);\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n static long Palindrom(int i)\n {\n long zcyLeft = i;\n int zcyRight = 0;\n while (i > 0)\n {\n zcyRight *= 10;\n zcyRight += i % 10;\n i /= 10;\n zcyLeft *= 10;\n }\n return zcyLeft + zcyRight;\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadInt();\n var p = input.ReadLong();\n Console.Write(Zcy().Take(k).Sum() % p);\n }\n\n private static IEnumerable Zcy()\n {\n for (int i = 1; ; i++)\n {\n var s = i.ToString();\n yield return long.Parse(s + string.Join(\"\", s.Reverse()));\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input1 = Console.ReadLine().Split(' ');\n\t\tInt64 k = int.Parse(input1[0]);\n\t\tInt64 p = int.Parse(input1[1]);\n\t\t\n\t\tInt64 sum = 0;\n\t\t\n\t\tfor(Int64 x=1;x<=k;x++){\n\t\t\tstring xx = x+\"\"+Reverse(x+\"\");\n\t\t\tif((double)xx.Length/2 == (Int64)xx.Length/2 ){\n\t\t\t\tstring r = Reverse(xx);\n\t\t\t\tif(r == xx){\n\t\t\t\t\tsum+=Int64.Parse(xx);\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tdouble output = sum % p;\n\t\t\n\t\tConsole.WriteLine(output);\n\t}\n\t\n\tpublic static string Reverse(string s)\n\t{\n\t\tchar[] charArray = s.ToCharArray();\n\t\tArray.Reverse( charArray );\n\t\treturn new string( charArray );\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace MindCrack \n{\n\t\n\tclass MindCrack \n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t //input\n\t\t string inputStr = Console.ReadLine();\n\t\t string[] input = inputStr.Split(' ');\n\t\t int k, p;\n\t\t k = int.Parse(input[0]);\n\t\t\tp = int.Parse(input[1]);\n\t\t\t\n\t\t\t//calculations\n\t\t\tlong result;\n\t\t\tlong summ = 0;\n\t\t\tfor(int i = 1; i <= k; i++)\n\t\t\t{\n\t\t\t string temp = i.ToString();\n\t\t\t string revtemp = \"\";\n\t\t\t for(int j = 0; j < temp.Length; j++)\n\t\t\t {\n\t\t\t revtemp += temp[temp.Length-1-j];\n\t\t\t }\n\t\t\t summ += long.Parse(temp + revtemp);\n\t\t\t}\n\t\t\tresult = summ%p;\n\t\t\t\n\t\t\t//output\n\t\t\tConsole.Write(result);\n\t\t}\t\t\n\t}\n\t\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n long ans = 0;\n long p;\n int k;\n\n long MakePali(int i)\n {\n int numDigits = 0;\n long powTen = 1;\n\n long rez = i;\n long pali = 0;\n\n while(i>0)\n {\n numDigits++;\n powTen *= 10;\n var lastDig = i % 10;\n pali *= 10;\n pali += lastDig;\n i /= 10;\n }\n\n rez *= powTen;\n rez += pali;\n\n return rez;\n }\n\n public void Solve()\n {\n k = ioHelper.ReadNextInt();\n p = ioHelper.ReadNextInt();\n \n for(int i=1;i<=k;i++)\n {\n var val = MakePali(i);\n val %= p;\n ans += val;\n ans %= p;\n }\n\n ioHelper.WriteLine(ans.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.NET\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] parts = line.Split(' ').ToArray();\n long k = int.Parse(parts[0]);\n long p = int.Parse(parts[1]);\n long nr = 1;\n long sol = 0;\n for (int i = 1; i<=k; i++)\n {\n long nrAux = nr;\n long aux = nr;\n while (aux != 0)\n {\n nrAux = nrAux * 10 + aux % 10;\n aux = aux / 10;\n }\n\n sol = (sol + nrAux) % p;\n nr++;\n }\n\n Console.WriteLine(sol);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication36\n{\n class Program\n {\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n static void Main(string[] args)\n {\n long n, m , ans=0 , val=0;\n string s, rev; \n string[] values = Console.ReadLine().Split(' ');\n n = int.Parse(values[0]);\n m = int.Parse(values[1]);\n for (int i = 1 ; i <= n; i++)\n {\n s = i.ToString();\n s += Reverse(s);\n if (long.TryParse(s, out val))\n ans += val;\n }\n Console.WriteLine(ans%m);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nclass Startup\n{\n static void Main()\n {\n List inputList = ReadLineAndParseToList();\n BigInteger k = inputList[0];\n BigInteger p = inputList[1];\n BigInteger sumOfK = 0;\n\n for (BigInteger i = 1; i <= k; i++)\n {\n sumOfK += ReverseAndMake(i);\n }\n\n Console.WriteLine(sumOfK%p);\n }\n\n public static BigInteger ReverseAndMake(BigInteger intS)\n {\n string s = intS.ToString();\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return BigInteger.Parse(s + new string(charArray));\n }\n\n public static List ReadLineAndParseToList()\n {\n return Console.ReadLine().Split().Select(BigInteger.Parse).ToList();\n }\n\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.NET\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] parts = line.Split(' ').ToArray();\n int k = int.Parse(parts[0]);\n int p = int.Parse(parts[1]);\n int nr = 1;\n int sol = 0;\n for (int i = 1; i<=k; i++)\n {\n int nrAux = nr;\n int aux = nr;\n while (aux != 0)\n {\n nrAux = nrAux * 10 + aux % 10;\n aux = aux / 10;\n }\n\n sol = (sol + nrAux) % p;\n nr++;\n }\n\n Console.WriteLine(sol);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication36\n{\n class Program\n {\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n static void Main(string[] args)\n {\n int n, m , ans=0 , val=0;\n string s, rev; \n string[] values = Console.ReadLine().Split(' ');\n n = int.Parse(values[0]);\n m = int.Parse(values[1]);\n for (int i = 1 ; i <= n; i++)\n {\n s = i.ToString();\n s += Reverse(s);\n if (int.TryParse(s, out val))\n ans += val;\n }\n Console.WriteLine(ans%m);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace ConsoleApp2\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n String[] input1 = Console.ReadLine().Split();\n int K = Int32.Parse(input1[0]);\n int P = Int32.Parse(input1[1]);\n long result = 0;\n for (int k = 1; k <= K; ++k) {\n int temp = k;\n int N = k;\n while (temp > 0) {\n int mod = temp % 10;\n temp = temp / 10;\n N = N * 10 + mod;\n }\n result += N % P;\n }\n result = result % P;\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static int _mod;\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int k = input[0], p = input[1];\n _mod = p;\n\n var q = new Queue();\n Array.ForEach(new[] { 0, 11, 22, 33, 44, 55, 66, 77, 88, 99 }, q.Enqueue);\n int sum = 0;\n int shiftPow = 3;\n while (k-- > 0)\n {\n int el = q.Dequeue();\n if (el == 0)\n ++k;\n sum = Add(sum, el);\n if (el % 10 == 9)\n shiftPow += 2;\n q.Enqueue(Add(el, Add(Pow(10, shiftPow), 1)));\n\n }\n\n Console.WriteLine(sum);\n }\n\n static int Add(int n1, int n2)\n {\n long ln1 = n1;\n return (int)((ln1 + n2) % _mod);\n }\n\n static int Pow(int n, int pow)\n {\n long res = 1;\n long ln = n % _mod;\n while (pow > 0)\n {\n if ((pow & 1) == 1)\n res = (res * ln) % _mod;\n pow >>= 1;\n ln = (ln * ln) % _mod;\n }\n return (int)res;\n }\n}\n\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] input1 = Console.ReadLine().Split(' ');\n\t\tInt64 k = int.Parse(input1[0]);\n\t\tInt64 p = int.Parse(input1[1]);\n\t\t\n\t\tInt64 sum = 0;\n\t\t\n\t\tfor(Int64 x=1;x<=k;x++){\n\t\t\tstring xx = x+\"\"+x;\n\t\t\tif((float)xx.Length/2 == (Int64)xx.Length/2){\n\t\t\t\tif(Reverse(xx) == xx){\n\t\t\t\t\tsum+=Int64.Parse(xx);\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tdouble output = sum % p;\n\t\t\n\t\tConsole.WriteLine(output);\n\t}\n\t\n\tpublic static string Reverse(string s)\n\t{\n\t\tchar[] charArray = s.ToCharArray();\n\t\tArray.Reverse( charArray );\n\t\treturn new string( charArray );\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFCSH\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] StrArr = Console.ReadLine().Split(' ');\n long k = long.Parse(StrArr[0]);\n long p = long.Parse(StrArr[1]);\n List l = new List { \"00\", \"11\", \"22\", \"33\", \"44\", \"55\", \"66\", \"77\", \"88\", \"99\" };\n List num = new List { 11, 22, 33, 44, 55, 66, 77, 88, 99 };\n int sz = 0;\n string sub;\n long temp;\n while (num.Count < 100010)\n {\n sz = l.Count;\n for (int j = 0; j <= 9; ++j)\n {\n for (int i = 0; i < sz; ++i)\n {\n sub = j.ToString() + l[i] + j.ToString();\n l.Add(sub);\n if (j != 0)\n {\n temp = long.Parse(sub);\n num.Add(temp);\n }\n\n }\n }\n }\n num.Sort();\n long sum = 0;\n for (int i = 0; i < k; ++i)\n {\n sum += num[i] % p;\n }\n Console.WriteLine(sum % p);\n\n\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFCSH\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] StrArr = Console.ReadLine().Split(' ');\n long k = long.Parse(StrArr[0]);\n long p = long.Parse(StrArr[1]);\n List l = new List { \"00\", \"11\", \"22\", \"33\", \"44\", \"55\", \"66\", \"77\", \"88\", \"99\" };\n List num = new List { 11, 22, 33, 44, 55, 66, 77, 88, 99 };\n int sz = 0;\n string sub;\n long temp;\n while (num.Count < k)\n {\n sz = l.Count;\n for (int j = 0; j <= 9; ++j)\n {\n for (int i = 0; i < sz; ++i)\n {\n sub = j.ToString() + l[i] + j.ToString();\n l.Add(sub);\n if (j != 0)\n {\n temp = long.Parse(sub);\n num.Add(temp);\n }\n\n }\n }\n }\n num.Sort();\n long sum = 0;\n for (int i = 0; i < k; ++i)\n {\n sum += num[i] % p;\n }\n Console.WriteLine(sum % p);\n\n\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFCSH\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] StrArr = Console.ReadLine().Split(' ');\n long k = long.Parse(StrArr[0]);\n long p = long.Parse(StrArr[1]);\n List l = new List { \"00\" , \"11\" , \"22\" , \"33\" , \"44\" , \"55\" , \"66\" , \"77\" , \"88\" , \"99\"};\n List num = new List { 11 , 22 , 33 , 44 , 55 , 66 , 77 , 88 , 99 };\n int sz = 0;\n int rem = 1;\n string sub;\n long temp;\n while (num.Count < k)\n {\n sz = l.Count;\n for (int i = 0; i < sz; ++i)\n {\n for (int j = 0; j <= 9; ++j)\n {\n sub = j.ToString() + l[i] + j.ToString();\n l.Add(sub);\n if (j != 0)\n {\n temp = long.Parse(sub);\n num.Add(temp);\n }\n\n }\n }\n }\n num.Sort();\n long sum = 0;\n for (int i = 0; i < k ; ++i)\n {\n sum += num[i] % p;\n }\n Console.WriteLine(sum % p);\n \n \n }\n\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int k = int.Parse(token[0]);\n int p = int.Parse(token[1]);\n long sum = 0;\n \n int[] a = new int[4]{0,1,1,0};\n \n for(int i=0;i= tokens.Length)\n {\n tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n var t = typeof(T);\n\n if (t == typeof(char))\n return (T)(object)NextChar();\n\n object s = NextString();\n\n if (t == typeof(string))\n return (T)s;\n\n return (T)Convert.ChangeType(s, typeof(T));\n }\n\n\n public IEnumerable NextWhile(Predicate pred)\n {\n if (pred == null)\n yield break;\n\n T res = Next();\n\n while (pred(res))\n {\n yield return res;\n\n res = Next();\n }\n }\n\n public IEnumerable NextSeq(long n)\n {\n for (var i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));\n }\n\n\n public void PrintLine(T o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n for (var i = 0; i < self.Count; i++)\n self[i] = fval();\n\n\n return self;\n }\n\n\n public static IList Fill(this IList self, T val)\n {\n return self.Fill(() => val);\n }\n\n public static long Hash(this IList self, Func val = null)\n {\n return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);\n }\n\n public static long Hash(this IList self, Func val)\n {\n return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));\n }\n\n\n public static long HashOne(this T self, long current)\n {\n return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));\n }\n\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override bool Equals(object obj)\n {\n var co = obj as P;\n\n return co != null && co.GetHashCode() == GetHashCode();\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());\n hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode());\n return hash;\n\n }\n }\n\n #endregion\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n private void Solve()\n {\n var n = io.NextInt();\n var m = io.NextInt();\n\n var x = io.NextInt();\n var y = io.NextInt();\n x = Math.Abs(x - io.NextInt());\n y = Math.Abs(y - io.NextInt());\n\n\n var res = (x > 4 || y > 4) || (x + y > 6);\n\n io.PrintLine(res ? \"Second\" : \"First\");\n }\n }\n\n}\n\n", "positive_code": [{"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.C_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public string NextToken()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return _line[_iterator++];\n }\n public int NextInt()\n {\n return Convert.ToInt32(NextToken());\n }\n public long NextLong()\n {\n return Convert.ToInt64(NextToken());\n }\n public float NextFloat()\n {\n return float.Parse(NextToken());\n }\n public double NextDouble()\n {\n return Convert.ToDouble(NextToken());\n }\n }\n class PlayingWithSuperglueCroc\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), m = fs.NextInt();\n int x1 = fs.NextInt(), y1 = fs.NextInt();\n int x2 = fs.NextInt(), y2 = fs.NextInt();\n int w = Math.Abs(x1 - x2) + 1, h = Math.Abs(y1 - y2) + 1;\n if ((w == 5 && h == 5) || (w >= 6 || h >= 6) || (w == 4 && h == 5) || (w == 5 && h == 4)) writer.WriteLine(\"Second\");\n else writer.WriteLine(\"First\");\n }\n }\n }\n}\n"}], "negative_code": [], "src_uid": "41f6f90b7307d2383495441114fa8ea2"} {"source_code": "using System;\r\nusing static System.Console;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nclass Program\r\n{\r\n static int NN => int.Parse(ReadLine());\r\n static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();\r\n static void Main()\r\n {\r\n var c = ReadLine().Split();\r\n var n = int.Parse(c[0]);\r\n var x = decimal.Parse(c[1]);\r\n var list = new List();\r\n list.Add(x);\r\n var res = 0;\r\n while (true)\r\n {\r\n var next = new List();\r\n foreach (var li in list)\r\n {\r\n var str = li.ToString();\r\n if (str.Length == n)\r\n {\r\n WriteLine(res);\r\n return;\r\n }\r\n for (var i = '2'; i <= '9'; ++i) if (str.Contains(i))\r\n {\r\n next.Add(li * (i - '0'));\r\n }\r\n }\r\n if (next.Count == 0)\r\n {\r\n WriteLine(-1);\r\n return;\r\n }\r\n var max = next.Max();\r\n if (next.Count > 10000)\r\n {\r\n next.Sort();\r\n next = next.Skip(next.Count - 10000).ToList();\r\n }\r\n list = next;\r\n ++res;\r\n }\r\n }\r\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace Compete2\n{\n partial class MainClass\n {\n public static void Main(string[] args)\n {\n int count = 1; //int.Parse(Console.ReadLine());\n List output = new List();\n\n for (int z = 0; z < count; z++)\n {\n //Console.ReadLine();\n //var s = Console.ReadLine();\n //var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(qw => ulong.Parse(qw)).ToList();\n //var b = Console.ReadLine().Split(' ').Select(qw => long.Parse(qw)).ToList();\n //var c = Console.ReadLine().Split(' ').Select(qw => long.Parse(qw)).ToList();\n //var b = long.Parse(Console.ReadLin e());\n\n ulong o = ulong.MaxValue;\n //bool can = true;\n\n SortedSet visited = new SortedSet();\n\n Queue q = new Queue();\n\n if ((ulong)a[1].ToString().Length >= a[0])\n o = 0;\n else\n q.Enqueue(new ulong[] { a[1], 0 });\n\n while (q.Count>0)\n {\n var x = q.Dequeue();\n\n if (x[1] + 1 >= o)\n continue;\n\n var ds = x[0].ToString().Distinct().Select(i=>int.Parse(i.ToString())).OrderByDescending(i=>i).ToList();\n\n if (ds.Contains(1))\n ds.Remove(1);\n\n if (ds.Contains(0))\n ds.Remove(0);\n\n BigInteger bi = x[0];\n\n for (int i = 0; i < ds.Count; i++)\n {\n BigInteger bi2 = bi * ds[i];\n\n if ((ulong)bi2.ToString().Length >= a[0])\n {\n if (x[1] + 1 < o)\n o = x[1] + 1;\n }\n else\n {\n var u = (ulong)bi2;\n if (!visited.Contains(u))\n {\n q.Enqueue(new ulong[] { u, x[1] + 1 });\n visited.Add(u);\n }\n }\n }\n }\n\n if (o == ulong.MaxValue)\n output.Add(\"-1\");\n else\n output.Add(o.ToString());\n //output.Add(string.Join(\" \", o));\n /*if (can)\n output.Add(\"Yes\");\n else\n output.Add(\"No\");*/\n }\n\n output.ForEach(d => Console.WriteLine(d));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing BI = System.Numerics.BigInteger;\r\n\r\nnamespace ProblemD {\r\n\tinternal class TEST {\r\n\t\tpublic static void Main() {\r\n\t\t\tSol mySol = new Sol();\r\n\t\t\tmySol.Solve();\r\n\t\t}\r\n\t}\r\n\r\n\tinternal class Sol {\r\n\t\tpublic void Solve() {\r\n\r\n\r\n\r\n\t\t\tvar hs = new HashSet();\r\n\t\t\ths.Add(X);\r\n\t\t\tfor(int t=0; ; t++) {\r\n\t\t\t\tif(hs.Count == 0) {\r\n\t\t\t\t\tConsole.WriteLine(-1);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar nhs = new HashSet();\r\n\t\t\t\tforeach(var n in hs) {\r\n\r\n\t\t\t\t\tvar x = n;\r\n\t\t\t\t\tint len = 0;\r\n\t\t\t\t\tint[] cnt = new int[10];\r\n\t\t\t\t\twhile (x > 0) {\r\n\t\t\t\t\t\tcnt[(int)(x % 10)]++;\r\n\t\t\t\t\t\tlen++;\r\n\t\t\t\t\t\tx /= 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor(int i = 2; i <= 9; i++) {\r\n\t\t\t\t\t\tif (cnt[i] == 0) continue;\r\n\t\t\t\t\t\tBI nn = n * i;\r\n\t\t\t\t\t\tif(nn.ToString().Length == N) {\r\n\t\t\t\t\t\t\tConsole.WriteLine(t + 1);\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnhs.Add(nn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ths = nhs;\r\n\t\t\t}\r\n\r\n\r\n\r\n\r\n\r\n\t\t}\r\n\t\tint N;\r\n\t\tlong X;\r\n\t\tpublic Sol() {\r\n\t\t\tvar d = rla();\r\n\t\t\tN = (int)d[0]; X = d[1];\r\n\t\t}\r\n\r\n\t\tstatic String rs() { return Console.ReadLine(); }\r\n\t\tstatic int ri() { return int.Parse(Console.ReadLine()); }\r\n\t\tstatic long rl() { return long.Parse(Console.ReadLine()); }\r\n\t\tstatic double rd() { return double.Parse(Console.ReadLine()); }\r\n\t\tstatic String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }\r\n\t\tstatic int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }\r\n\t\tstatic long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }\r\n\t\tstatic double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }\r\n\t\tstatic T[] mka(int n, T ini) { T[] ret = new T[n]; for (int i = 0; i < n; i++) ret[i] = ini; return ret; }\r\n\t\tstatic T[][] mka2(int n, int m, T ini) { T[][] ret = new T[n][]; for (int i = 0; i < n; i++) ret[i] = mka(m, ini); return ret; }\r\n\t\tstatic T[][][] mka3(int n, int m, int l, T ini) { T[][][] ret = new T[n][][]; for (int i = 0; i < n; i++) ret[i] = mka2(m, l, ini); return ret; }\r\n\t\tstatic T[][][][] mka4(int n, int m, int l, int k, T ini) { T[][][][] ret = new T[n][][][]; for (int i = 0; i < n; i++) ret[i] = mka3(m, l, k, ini); return ret; }\r\n\t}\r\n\r\n}\r\n"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace olymp_codeforces\r\n{\r\n class Program\r\n {\r\n void dashla(long x, out HashSet digits, out int cnt)\r\n {\r\n digits = new HashSet();\r\n cnt = 0;\r\n while(x > 0)\r\n {\r\n digits.Add(x % 10);\r\n cnt++;\r\n x = x/10;\r\n }\r\n }\r\n int res = int.MaxValue;\r\n Dictionary svlebi = new Dictionary();\r\n void rec(long x, int n, int svla)\r\n {\r\n if (svlebi.ContainsKey(x) && svlebi[x] <= svla)\r\n return;\r\n svlebi[x] = svla;\r\n HashSet digits;\r\n int cnt;\r\n dashla(x, out digits, out cnt);\r\n if(cnt == n)\r\n {\r\n res = Math.Min(res, svla);\r\n return;\r\n }\r\n if (svla >= res || svla > n+ 2)\r\n return;\r\n\r\n var dSorted = digits.ToList().OrderByDescending(i => i).ToList(); // digits.OrderBy(_ => rand.Next()).ToList();\r\n //dSorted.Sort();\r\n for (int i = 0; i < dSorted.Count; i++)\r\n {\r\n long digit = dSorted[i];\r\n if (digit < 2)\r\n break;\r\n rec(x * digit, n, svla + 1);\r\n }\r\n }\r\n\r\n\r\n public void Solve()\r\n {\r\n // var t = int.Parse(Console.ReadLine());\r\n var input = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\r\n long n = input[0], x = input[1];\r\n rec(x, (int)n, 0);\r\n if (res < int.MaxValue)\r\n Console.WriteLine(res);\r\n else\r\n Console.WriteLine(-1);\r\n }\r\n\r\n\r\n\r\n\r\n static void Main(string[] args)\r\n {\r\n var A = new Program();\r\n A.Solve();\r\n }\r\n }\r\n}\r\n"}], "negative_code": [{"source_code": "\ufeffusing System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing BI = System.Numerics.BigInteger;\r\n\r\nnamespace ProblemD {\r\n\tinternal class TEST {\r\n\t\tpublic static void Main() {\r\n\t\t\tSol mySol = new Sol();\r\n\t\t\tmySol.Solve();\r\n\t\t}\r\n\t}\r\n\r\n\tinternal class Sol {\r\n\t\tpublic void Solve() {\r\n\r\n\r\n\r\n\t\t\tvar hs = new HashSet();\r\n\t\t\ths.Add(X);\r\n\t\t\tfor(int t=0; ; t++) {\r\n\t\t\t\tif(hs.Count == 0) {\r\n\t\t\t\t\tConsole.WriteLine(-1);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar nhs = new HashSet();\r\n\t\t\t\tforeach(var n in hs) {\r\n\r\n\t\t\t\t\tvar x = n;\r\n\t\t\t\t\tint len = 0;\r\n\t\t\t\t\tint[] cnt = new int[10];\r\n\t\t\t\t\twhile (x > 0) {\r\n\t\t\t\t\t\tcnt[(int)(x % 10)]++;\r\n\t\t\t\t\t\tlen++;\r\n\t\t\t\t\t\tx /= 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor(int i = 2; i <= 9; i++) {\r\n\t\t\t\t\t\tif (cnt[i] != 1) continue;\r\n\t\t\t\t\t\tBI nn = n * i;\r\n\t\t\t\t\t\tif(nn.ToString().Length == N) {\r\n\t\t\t\t\t\t\tConsole.WriteLine(t + 1);\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnhs.Add(nn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ths = nhs;\r\n\t\t\t}\r\n\r\n\r\n\r\n\r\n\r\n\t\t}\r\n\t\tint N;\r\n\t\tlong X;\r\n\t\tpublic Sol() {\r\n\t\t\tvar d = rla();\r\n\t\t\tN = (int)d[0]; X = d[1];\r\n\t\t}\r\n\r\n\t\tstatic String rs() { return Console.ReadLine(); }\r\n\t\tstatic int ri() { return int.Parse(Console.ReadLine()); }\r\n\t\tstatic long rl() { return long.Parse(Console.ReadLine()); }\r\n\t\tstatic double rd() { return double.Parse(Console.ReadLine()); }\r\n\t\tstatic String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }\r\n\t\tstatic int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }\r\n\t\tstatic long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }\r\n\t\tstatic double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }\r\n\t\tstatic T[] mka(int n, T ini) { T[] ret = new T[n]; for (int i = 0; i < n; i++) ret[i] = ini; return ret; }\r\n\t\tstatic T[][] mka2(int n, int m, T ini) { T[][] ret = new T[n][]; for (int i = 0; i < n; i++) ret[i] = mka(m, ini); return ret; }\r\n\t\tstatic T[][][] mka3(int n, int m, int l, T ini) { T[][][] ret = new T[n][][]; for (int i = 0; i < n; i++) ret[i] = mka2(m, l, ini); return ret; }\r\n\t\tstatic T[][][][] mka4(int n, int m, int l, int k, T ini) { T[][][][] ret = new T[n][][][]; for (int i = 0; i < n; i++) ret[i] = mka3(m, l, k, ini); return ret; }\r\n\t}\r\n\r\n}\r\n"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace ProblemD {\r\n\tinternal class TEST {\r\n\t\tpublic static void Main() {\r\n\t\t\tSol mySol = new Sol();\r\n\t\t\tmySol.Solve();\r\n\t\t}\r\n\t}\r\n\r\n\tinternal class Sol {\r\n\t\tpublic void Solve() {\r\n\r\n\r\n\r\n\t\t\tvar hs = new HashSet();\r\n\t\t\ths.Add(X);\r\n\t\t\tfor(int t=0; ; t++) {\r\n\t\t\t\tif(hs.Count == 0) {\r\n\t\t\t\t\tConsole.WriteLine(-1);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar nhs = new HashSet();\r\n\t\t\t\tforeach(var n in hs) {\r\n\r\n\t\t\t\t\tvar x = n;\r\n\t\t\t\t\tint len = 0;\r\n\t\t\t\t\tint[] cnt = new int[10];\r\n\t\t\t\t\twhile (x > 0) {\r\n\t\t\t\t\t\tcnt[x % 10]++;\r\n\t\t\t\t\t\tlen++;\r\n\t\t\t\t\t\tx /= 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor(int i = 2; i <= 9; i++) {\r\n\t\t\t\t\t\tif (cnt[i] != 1) continue;\r\n\t\t\t\t\t\tlong nn = n * i;\r\n\t\t\t\t\t\tif(nn.ToString().Length == N) {\r\n\t\t\t\t\t\t\tConsole.WriteLine(t + 1);\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnhs.Add(nn);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ths = nhs;\r\n\t\t\t}\r\n\r\n\r\n\r\n\r\n\r\n\t\t}\r\n\t\tint N;\r\n\t\tlong X;\r\n\t\tpublic Sol() {\r\n\t\t\tvar d = rla();\r\n\t\t\tN = (int)d[0]; X = d[1];\r\n\t\t}\r\n\r\n\t\tstatic String rs() { return Console.ReadLine(); }\r\n\t\tstatic int ri() { return int.Parse(Console.ReadLine()); }\r\n\t\tstatic long rl() { return long.Parse(Console.ReadLine()); }\r\n\t\tstatic double rd() { return double.Parse(Console.ReadLine()); }\r\n\t\tstatic String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }\r\n\t\tstatic int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }\r\n\t\tstatic long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }\r\n\t\tstatic double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }\r\n\t\tstatic T[] mka(int n, T ini) { T[] ret = new T[n]; for (int i = 0; i < n; i++) ret[i] = ini; return ret; }\r\n\t\tstatic T[][] mka2(int n, int m, T ini) { T[][] ret = new T[n][]; for (int i = 0; i < n; i++) ret[i] = mka(m, ini); return ret; }\r\n\t\tstatic T[][][] mka3(int n, int m, int l, T ini) { T[][][] ret = new T[n][][]; for (int i = 0; i < n; i++) ret[i] = mka2(m, l, ini); return ret; }\r\n\t\tstatic T[][][][] mka4(int n, int m, int l, int k, T ini) { T[][][][] ret = new T[n][][][]; for (int i = 0; i < n; i++) ret[i] = mka3(m, l, k, ini); return ret; }\r\n\t}\r\n\r\n}\r\n"}, {"source_code": "using System;\r\nusing static System.Console;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nclass Program\r\n{\r\n static int NN => int.Parse(ReadLine());\r\n static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();\r\n static void Main()\r\n {\r\n var c = ReadLine().Split();\r\n var n = int.Parse(c[0]);\r\n var x = decimal.Parse(c[1]);\r\n var list = new List();\r\n list.Add(x);\r\n var res = 0;\r\n while (true)\r\n {\r\n var maxes = new decimal[10];\r\n foreach (var li in list)\r\n {\r\n var str = li.ToString();\r\n if (str.Length == n)\r\n {\r\n WriteLine(res);\r\n return;\r\n }\r\n for (var i = '2'; i <= '9'; ++i) if (str.Contains(i))\r\n {\r\n var next = li * (i - '0');\r\n var nstr = next.ToString();\r\n for (var j = '2'; j <= '9'; ++j)\r\n {\r\n if (nstr.Contains(j))\r\n {\r\n maxes[j - '0'] = Math.Max(maxes[j - '0'], next);\r\n }\r\n }\r\n }\r\n }\r\n list = maxes.Where(m => m > 0).ToList();\r\n if (list.Count == 0)\r\n {\r\n WriteLine(-1);\r\n return;\r\n }\r\n ++res;\r\n }\r\n }\r\n}"}], "src_uid": "cedcc3cee864bf8684148df93804d029"} {"source_code": "\ufeffusing System;\n\nnamespace D {\n internal class Program {\n private static void Main() {\n int x, y, z, x1, y1, z1, a1, a2, a3, a4, a5, a6;\n var line1 = Console.ReadLine().Split(' ');\n x = Convert.ToInt32(line1[0]);\n y = Convert.ToInt32(line1[1]);\n z = Convert.ToInt32(line1[2]);\n var line2 = Console.ReadLine().Split(' ');\n x1 = Convert.ToInt32(line2[0]);\n y1 = Convert.ToInt32(line2[1]);\n z1 = Convert.ToInt32(line2[2]);\n var line3 = Console.ReadLine().Split(' ');\n a1 = Convert.ToInt32(line3[0]);\n a2 = Convert.ToInt32(line3[1]);\n a3 = Convert.ToInt32(line3[2]);\n a4 = Convert.ToInt32(line3[3]);\n a5 = Convert.ToInt32(line3[4]);\n a6 = Convert.ToInt32(line3[5]);\n\n var res = 0;\n\n if (x > x1) {\n res += a6;\n }\n\n if (x < 0) {\n res += a5;\n }\n\n if (y > y1) {\n res += a2;\n }\n\n if (y < 0) {\n res += a1;\n }\n\n if (z > z1) {\n res += a4;\n }\n\n if (z < 0) {\n res += a3;\n }\n\n Console.WriteLine(res);\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce143\n{\n class C\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split();\n int pX = Convert.ToInt32(data[0]);\n int pY = Convert.ToInt32(data[1]);\n int pZ = Convert.ToInt32(data[2]);\n\n data = Console.ReadLine().Split();\n int x = Convert.ToInt32(data[0]);\n int y = Convert.ToInt32(data[1]);\n int z = Convert.ToInt32(data[2]);\n\n data = Console.ReadLine().Split();\n int a1 = Convert.ToInt32(data[0]);\n int a2 = Convert.ToInt32(data[1]);\n int a3 = Convert.ToInt32(data[2]);\n int a4 = Convert.ToInt32(data[3]);\n int a5 = Convert.ToInt32(data[4]);\n int a6 = Convert.ToInt32(data[5]);\n\n int sum = 0;\n if (pY > y)\n sum += a2;\n else if (pY < 0)\n sum += a1;\n if (pX > x)\n sum += a6;\n else if (pX < 0)\n sum += a5;\n if (pZ > z)\n sum += a4;\n else if (pZ < 0)\n sum += a3;\n\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace D07_10_12\n{\n class Program\n {\n static void Main()\n {\n string[] s = Regex.Split(Console.ReadLine(), \" \");\n int vx = int.Parse(s[0]);\n int vy = int.Parse(s[1]);\n int vz = int.Parse(s[2]);\n s = Regex.Split(Console.ReadLine(), \" \");\n int px = int.Parse(s[0]);\n int py = int.Parse(s[1]);\n int pz = int.Parse(s[2]);\n s = Regex.Split(Console.ReadLine(), \" \");\n int n = int.Parse(s[0]);\n int v = int.Parse(s[1]);\n int d = int.Parse(s[2]);\n int b = int.Parse(s[3]);\n int l = int.Parse(s[4]);\n int p = int.Parse(s[5]);\n int sum = 0;\n if (vx > px) sum += p;\n if (vx < 0) sum += l;\n if (vy > py) sum += v;\n if (vy < 0) sum += n;\n if (vz > pz) sum += b;\n if (vz < 0) sum += d;\n Console.WriteLine(\"{0}\", sum);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"C1\";\n\n private static void Solve()\n {\n var input = ReadIntArray();\n var x = input[0];\n var y = input[1];\n var z = input[2];\n input = ReadIntArray();\n var x1 = input[0];\n var y1 = input[1];\n var z1 = input[2];\n var a = ReadIntArray();\n var zV = -1;\n var xV = -1;\n var yV = -1;\n if(z > z1)\n {\n zV = a[4-1];\n }\n else if (z < 0)\n {\n zV = a[3-1];\n }\n else\n zV = 0;\n\n if(x > x1)\n {\n xV = a[6 - 1];\n }\n else if(x<0)\n {\n xV = a[5 - 1];\n }\n else\n {\n xV = 0;\n }\n\n if(y >y1)\n {\n yV = a[2 - 1];\n }\n else if(y <0)\n {\n yV = a[1 - 1];\n }\n else\n {\n yV = 0;\n }\n var res = xV + yV + zV;\n WriteLine(res);\n }\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n\n private static void Read(out int n1, out int n2, out int n3)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static List ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n\n private static List ReadDoubleArray()\n {\n return Console.ReadLine().Split(' ').Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static void WriteLine(object value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(object value)\n {\n Console.Write(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class A\n\t{\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint x = NextInt(), y = NextInt(), z = NextInt(), x1 = NextInt(), y1 = NextInt(), z1 = NextInt();\n\t\t\tint[] a = new int[6];\n\t\t\tfor ( int i = 0; i < 6; ++i ) a[i] = NextInt();\n\t\t\tint sum = 0;\n\t\t\tif ( y < 0 ) sum += a[0];\n\t\t\tif ( y > y1 ) sum += a[1];\n\t\t\tif ( z < 0 ) sum += a[2];\n\t\t\tif ( z > z1 ) sum += a[3];\n\t\t\tif ( x < 0 ) sum += a[4];\n\t\t\tif ( x > x1 ) sum += a[5];\n\n\t\t\tOut.WriteLine( sum );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R143_Div2_D\n {\n static void Main(string[] args)\n {\n string[] s = (Console.ReadLine().Split());\n int x = Convert.ToInt32(s[0]);\n int y = Convert.ToInt32(s[1]);\n int z = Convert.ToInt32(s[2]);\n\n s = (Console.ReadLine().Split());\n int x1 = Convert.ToInt32(s[0]);\n int y1 = Convert.ToInt32(s[1]);\n int z1 = Convert.ToInt32(s[2]);\n\n s = (Console.ReadLine().Split());\n int[] a = new int[7];\n for (int i = 1; i <= 6; i++)\n {\n a[i] = Convert.ToInt32(s[i-1]);\n }\n \n int cnt = 0;\n if (y < 0)\n cnt += a[1];\n if (y > y1)\n cnt += a[2];\n\n if (z < 0)\n cnt += a[3];\n if (z > z1)\n cnt += a[4];\n\n if (x < 0)\n cnt += a[5]; \n if (x > x1)\n cnt += a[6];\n\n \n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x, y, z;\n string[] input = Console.ReadLine().Split(' ');\n x = int.Parse(input[0]);\n y = int.Parse(input[1]);\n z = int.Parse(input[2]);\n int X, Y, Z;\n input = Console.ReadLine().Split(' ');\n X = int.Parse(input[0]);\n Y = int.Parse(input[1]);\n Z = int.Parse(input[2]);\n input = Console.ReadLine().Split(' ');\n int[] a = new int[6];\n for (int i = 0; i < 6; i++)\n a[i] = int.Parse(input[i]);\n int ans = 0;\n for (int i = 0; i < 6; i++)\n {\n switch (i)\n {\n case 0:\n if (y < 0)\n ans += a[i];\n break;\n case 1:\n if (y > Y)\n ans += a[i];\n break;\n case 2:\n if (z < 0)\n ans += a[i];\n break;\n case 3:\n if (z > Z)\n ans += a[i];\n break;\n case 4:\n if (x < 0)\n ans += a[i];\n break;\n case 5:\n if (x > X)\n ans += a[i];\n break;\n }\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Temp\n{\n struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n X = x;\n Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static bool operator ==(PointInt a, PointInt b)\n {\n return (a.X == b.X) && (a.Y == b.Y);\n }\n\n public static bool operator !=(PointInt a, PointInt b)\n {\n return !(a == b);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n return other.X == X && other.Y == Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj)) return false;\n if (obj.GetType() != typeof (PointInt)) return false;\n return Equals((PointInt) obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (X.GetHashCode() * 397) ^ Y.GetHashCode();\n }\n }\n }\n\n struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool Contains(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size + 1, size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size + 1, size + 1];\n\n for (int i = 1; i <= size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n static class Extensions\n {\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n { \n// ReSharper disable AssignNullToNotNullAttribute\n// ReSharper disable SpecifyACultureInStringConversionExplicitly\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray(); \n// ReSharper restore SpecifyACultureInStringConversionExplicitly\n// ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n }\n\n public class Graph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n }\n\n class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal static class Geometry\n {\n public static long Vect(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n\n public static long Area(PointInt a, PointInt b, PointInt c)\n {\n return Math.Abs(Vect(a, b, c));\n }\n }\n\n struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n m_List[0] = m_List[this.Count - 1];\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n private readonly List m_List = new List();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0 ||\n 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n }\n }\n\n class Program\n {\n private static StreamReader InputStream;\n\n private static StreamWriter OutStream;\n\n private static void OpenFiles(string inputName, string outputName)\n {\n InputStream = File.OpenText(inputName);\n Console.SetIn(InputStream);\n\n OutStream = File.CreateText(outputName);\n Console.SetOut(OutStream);\n }\n\n private static void CloseFiles()\n {\n OutStream.Flush();\n\n InputStream.Dispose();\n OutStream.Dispose();\n }\n\n static void Main()\n {\n // OpenFiles(\"input.txt\", \"output.txt\");\n\n new Solution().Solve();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int x, y, z, x1, y1, z1;\n Reader.ReadInt(out x, out y, out z);\n Reader.ReadInt(out x1, out y1, out z1);\n int[] a = new int[6];\n Reader.ReadInt(a);\n\n int ans = 0;\n\n if (y < 0)\n {\n ans += a[0];\n }\n if (y > y1)\n {\n ans += a[1];\n }\n if (z < 0)\n {\n ans += a[2];\n }\n if (z > z1)\n {\n ans += a[3];\n }\n if (x < 0)\n {\n ans += a[4];\n }\n if (x > x1)\n {\n ans += a[5];\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Magic_Box\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int x = Next(), y = Next(), z = Next();\n int x1 = Next(), y1 = Next(), z1 = Next();\n\n var nn = new int[6];\n for (int i = 0; i < 6; i++)\n {\n nn[i] = Next();\n }\n\n int sum = 0;\n\n if (y < 0)\n sum += nn[0];\n if (y > y1)\n sum += nn[1];\n if (z < 0)\n sum += nn[2];\n if (z > z1)\n sum += nn[3];\n if (x < 0)\n sum += nn[4];\n if (x > x1)\n sum += nn[5];\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "negative_code": [], "src_uid": "c7889a8f64c57cf7be4df870f68f749e"} {"source_code": "using System;\n\nnamespace codeforces978B\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n char[] s1 = s.ToCharArray();\n long cnt = 0;\n for (int i = 0; i < n- 2; i++)\n {\n if (s1[i] == 'x' && s1[i + 1] == 'x' && s1[i + 2] == 'x')\n cnt++;\n\n }\n Console.Write(cnt);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\n\n\nclass Program\n{\n\n static void Main(string[] args)\n {\n\n Console.ReadLine();\n\n string s = Console.ReadLine();\n\n bool isX = false;\n\n int temp = 0;\n\n int answer = 0;\n\n char[] str = s.ToCharArray();\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'x')\n {\n temp++;\n }\n\n else\n {\n temp = 0;\n }\n\n if (temp > 2)\n {\n answer++;\n }\n }\n\n Console.WriteLine(answer);\n\n //Console.ReadKey();\n\n }\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint count = int.Parse(Console.ReadLine());\n\t\t\tstring str = Console.ReadLine()+\"0\";\n\t\t\tint a = 0, num = 0;\n\t\t\tforeach(char x in str)\n\t\t\t{\n\t\t\t\tif (x != 'x')\n\t\t\t\t{\n\t\t\t\t\tnum += a > 2 ? a - 2 : 0;\n\t\t\t\t\ta = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\ta++;\n\t\t\t}\n\t\t\tConsole.WriteLine(num);\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.In.ReadToEnd().Split(new char[] { '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries)[1];\n int result = 0;\n for(int i = 0, cntr=0; i 2) result += cntr - 2;\n }\n Console.WriteLine(result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n int n = Convert.ToInt32(sr.ReadLine());\n string s = sr.ReadLine();\n int lxc = 0;\n int l_ud = 0;\n for (int i = 0; i <= s.Length; i++)\n {\n if (i == s.Length || s[i] != 'x')\n {\n if (lxc > 2)\n {\n l_ud = l_ud + (lxc - 2);\n }\n lxc = 0;\n }\n else lxc++;\n }\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n Console.WriteLine(l_ud.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int nameLength = Convert.ToInt32(Console.ReadLine());\n string fileName = Console.ReadLine();\n\n amountToRemove(nameLength, fileName);\n }\n public static void amountToRemove(int nameLength, string fileName)\n {\n //\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0445\n int x = 0;\n //\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0432\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f\n int count = 0;\n\n for (int i = 0; i < nameLength; i++)\n {\n if (fileName[i] == 'x')\n {\n x++;\n }\n else\n {\n x = 0;\n }\n\n if(x > 2)\n {\n count++;\n }\n }\n\n Console.WriteLine(count);\n //Console.ReadKey();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int nameLength = Convert.ToInt32(Console.ReadLine());\n string fileName = Console.ReadLine();\n amountToRemove((fileName));\n }\n public static void amountToRemove(string fileName)\n {\n //\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0445\n int x = 0;\n //\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0432\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f\n int count = 0;\n\n for (int i = 0; i < fileName.Length; i++)\n {\n if (fileName[i] == 'x')\n {\n x++;\n }\n else\n {\n x = 0;\n }\n\n if(x > 2)\n {\n count++;\n }\n }\n\n Console.WriteLine(count);\n //Console.ReadKey();\n }\n\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.In.ReadToEnd().Split(new char[] { '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries)[1];\n int result = 0;\n for(int i = 0, xes=0; i 1) result++;\n else xes++;\n }\n else xes = 0;\n }\n Console.WriteLine(result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Strings\n{\n class Program\n {\n // https://codeforces.com/problemset/problem/236/A\n static void _236A()\n {\n Dictionary dict = new Dictionary();\n\n foreach (char letter in Console.ReadLine())\n {\n if (dict.ContainsKey(letter)) dict[letter]++;\n else dict.Add(letter, 1);\n }\n\n Console.WriteLine(dict.Count % 2 == 1 ? \"IGNORE HIM!\" : \"CHAT WITH HER!\");\n }\n\n // https://codeforces.com/problemset/problem/1397/A\n static void _1397A()\n {\n for (int t = int.Parse(Console.ReadLine()); t > 0; --t)\n {\n Dictionary dict = new Dictionary();\n\n int n = int.Parse(Console.ReadLine());\n\n for (int j = 0; j < n; ++j)\n {\n foreach (char letter in Console.ReadLine())\n {\n if (dict.ContainsKey(letter)) dict[letter]++;\n else dict.Add(letter, 1);\n }\n }\n\n bool no = false;\n\n foreach (var pair in dict)\n {\n if (pair.Value % n != 0)\n {\n Console.WriteLine(\"NO\");\n no = true;\n break;\n }\n }\n\n if (!no)\n Console.WriteLine(\"YES\");\n }\n }\n\n // https://codeforces.com/problemset/problem/978/B\n static void _978B()\n {\n int n = int.Parse(Console.ReadLine());\n\n int minToRemove = 0;\n List<(int, int)> substrIndexes = new List<(int, int)>();\n string s = Console.ReadLine();\n int curSubsrtStart = 0;\n\n for (int i = 0; i < n; ++i)\n {\n if (s[i] == 'x')\n {\n curSubsrtStart = i;\n\n while (i + 1 < n && s[++i] == 'x') ;\n\n substrIndexes.Add((curSubsrtStart, i == n - 1 && s[i] == 'x' ? i : i - 1));\n }\n }\n\n foreach (var indexes in substrIndexes)\n {\n //Console.WriteLine($\"({indexes.Item1},{indexes.Item2})\");\n if (indexes.Item2 - indexes.Item1 > 1)\n {\n minToRemove += indexes.Item2 - indexes.Item1 - 1;\n }\n }\n\n Console.WriteLine(minToRemove);\n }\n\n static void Main(string[] args)\n {\n _978B();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces978B\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n char[] s1 = s.ToCharArray();\n long cnt = 0;\n for (int i = 0; i < n- 2; i++)\n {\n if (s1[i] == 'x' && s1[i + 1] == 'x' && s1[i + 2] == 'x')\n cnt++;\n\n }\n Console.Write(cnt);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n long output = 0;\n int _xxx = 0;\n for (int i = 0; i < s.Length; i++)\n {\n char c = s[i];\n if (c == 'x') _xxx++;\n else _xxx = 0;\n if (_xxx >= 3) output++;\n }\n Console.WriteLine(output);\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace mainnm\n{\n class main\n {\n static void Main()\n {\n Console.ReadLine();\n string s = Console.ReadLine();\n //int[] ta = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n \n Regex regex = new Regex(\"xx([x]+)\");\n MatchCollection matches = regex.Matches(s);\n \n int result = 0;\n foreach (Match match in matches) {\n result += match.Groups[0].Value.Length - 2;\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _978B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n int count = 0;\n int result = 0;\n\n foreach (var c in Console.ReadLine())\n {\n if (c == 'x')\n {\n count++;\n }\n else\n {\n result += Math.Max(0, count - 2);\n count = 0;\n }\n }\n\n result += Math.Max(0, count - 2);\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Net.Mail;\n\nnamespace Contest\n{\n class Scanner\n {\n private string[] line = new string[0];\n private int index = 0;\n public string Next()\n {\n if (line.Length <= index)\n {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public string[] Array()\n {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n public int[] IntArray()\n {\n var array = Array();\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n public long[] LongArray()\n {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n }\n\n class Program\n {\n private int N;\n private string s;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n s = sc.Next();\n }\n\n public void Solve()\n {\n Scan();\n int ans = 0;\n int cnt = 0;\n foreach (char c in s)\n {\n if (c == 'x')\n {\n cnt++;\n }\n else\n {\n ans += Math.Max(0, cnt - 2);\n cnt = 0;\n }\n }\n ans += Math.Max(0, cnt - 2);\n Console.WriteLine(ans);\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var str = Console.ReadLine();\n var count = 0; var newStr = str.ToString();\n while (newStr.Contains(\"xxx\"))\n {\n newStr = newStr.Replace(\"xxx\", \"xx\");\n }\n Console.WriteLine(str.Length - newStr.Length);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Solve();\n }\n\n static void Solve()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n int result = 0;\n for(int i = 0; i < n; i++)\n {\n if (s[i] == 'x') count++;\n else count = 0;\n if (count == 3)\n {\n count--;\n result++;\n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing static System.Console;\nusing static System.Convert;\n\n//\nclass ProblemSolver\n{\n const string STRINGTOREMOVE = \"xxx\";\n static void Main(string[] args)\n {\n int inputLen = ToInt32(ReadLine());\n\n string input = ReadLine();\n\n if(!string.IsNullOrWhiteSpace(input) && input.Length == inputLen)\n {\n int numberOfCharsToRemove = 0;\n int index = -1;\n while((index = input.IndexOf(STRINGTOREMOVE)) > -1)\n {\n input = input.Remove(index,1);\n numberOfCharsToRemove++;\n }\n\n Write(numberOfCharsToRemove);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace dhsmfeh_zhelddmf_gkqslek\n{\n public class Priority_Queue\n {\n static List priority_queue;\n\n public Priority_Queue()\n {\n priority_queue = new List();\n }\n\n public void Push(int node, int weight)\n {\n int count = priority_queue.Count();\n int index = -1;\n\n if(count == 0)\n {\n priority_queue.Add(new int[] { node, weight });\n return;\n }\n for(int i = count; --i > -1;)\n {\n if(priority_queue[i][1] < weight)\n {\n index = i + 1;\n break;\n }\n }\n if (index.Equals(-1)) { index = 0; }\n priority_queue.Insert(index, new int[] { node, weight });\n }\n\n public int Pop()\n {\n int[] arr = priority_queue[0];\n priority_queue.RemoveAt(0);\n return arr[0];\n }\n\n public int count\n {\n get { return priority_queue.Count(); }\n }\n \n\n }\n class Program\n {\n static StringBuilder sb = new StringBuilder();\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n string str = Console.ReadLine();\n int count = 0;\n int answer = 0;\n foreach (var item in str)\n {\n if(item != 'x')\n {\n answer += (count > 2) ? count - 2 : 0;\n count = 0;\n }\n else\n {\n count++;\n }\n }\n answer += (count > 2) ? count - 2 : 0;\n Console.WriteLine(answer);\n \n }\n }\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string a = Console.ReadLine();\n int k = 0;\n int x = 0;\n bool ist = true;\n\n k = a.IndexOf(\"xxx\");\n while (k >= 0) \n {\n int i = 1;\n while ((k + 2 + i < a.Length) && a[k + 2 + i] == 'x')\n {\n i++;\n\n }\n a = a.Remove(k + 2, i);\n k = a.IndexOf(\"xxx\");\n x += i;\n }\n Console.WriteLine(x);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound481Div3.Questions;\n\nnamespace CodeforcesRound481Div3.Questions\n{\n public class QuestionB : AtCoderQuestionBase\n {\n public override void Solve(IOManager io)\n {\n var n = io.ReadInt();\n var s = io.ReadString();\n\n var streak = 0;\n var removed = 0;\n\n foreach (var c in s)\n {\n if (c == 'x')\n {\n streak++;\n\n if (streak >= 3)\n {\n removed++;\n }\n }\n else\n {\n streak = 0;\n }\n }\n\n io.WriteLine(removed);\n }\n }\n}\n\nnamespace CodeforcesRound481Div3\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionB();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound481Div3.Questions\n{\n\n public interface IAtCoderQuestion\n {\n string Solve(string input);\n void Solve(IOManager io);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public string Solve(string input)\n {\n var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));\n var outputStream = new MemoryStream();\n using var manager = new IOManager(inputStream, outputStream);\n\n Solve(manager);\n manager.Flush();\n\n outputStream.Seek(0, SeekOrigin.Begin);\n var reader = new StreamReader(outputStream);\n return reader.ReadToEnd();\n }\n\n public abstract void Solve(IOManager io);\n }\n\n public class IOManager : IDisposable\n {\n private readonly StreamReader _reader;\n private readonly StreamWriter _writer;\n private bool _disposedValue;\n private Queue> _stringQueue;\n\n const char ValidFirstChar = '!';\n const char ValidLastChar = '~';\n\n public IOManager(Stream input, Stream output)\n {\n _reader = new StreamReader(input);\n _writer = new StreamWriter(output) { AutoFlush = false };\n _stringQueue = new Queue>();\n }\n\n public ReadOnlySpan ReadCharSpan()\n {\n while (_stringQueue.Count == 0)\n {\n var line = _reader.ReadLine().AsMemory().Trim();\n var s = line.Span;\n\n if (s.Length > 0)\n {\n var begin = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (begin < 0 && IsValidChar(s[i]))\n {\n begin = i;\n }\n else if (!IsValidChar(s[i]))\n {\n _stringQueue.Enqueue(line[begin..i]);\n begin = -1;\n }\n }\n _stringQueue.Enqueue(line[begin..line.Length]);\n }\n }\n\n return _stringQueue.Dequeue().Span;\n }\n\n public string ReadString() => ReadCharSpan().ToString();\n\n public int ReadInt() => (int)ReadLong();\n\n public long ReadLong()\n {\n long result = 0;\n bool isPositive = true;\n\n int i = 0;\n var s = ReadCharSpan();\n if (s[i] == '-')\n {\n isPositive = false;\n i++;\n }\n\n while (i < s.Length)\n {\n result = result * 10 + (s[i++] - '0');\n }\n\n return isPositive ? result : -result;\n }\n\n public double ReadDouble() => double.Parse(ReadCharSpan());\n public decimal ReadDecimal() => decimal.Parse(ReadCharSpan());\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadLong();\n }\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDouble();\n }\n return a;\n }\n\n public decimal[] ReadDecimalArray(int n)\n {\n var a = new decimal[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDecimal();\n }\n return a;\n }\n\n public void WriteLine(T value) => _writer.WriteLine(value.ToString());\n\n public void WriteLine(IEnumerable values, char separator)\n {\n var e = values.GetEnumerator();\n if (e.MoveNext())\n {\n _writer.Write(e.Current.ToString());\n\n while (e.MoveNext())\n {\n _writer.Write(separator);\n _writer.Write(e.Current.ToString());\n }\n }\n\n _writer.WriteLine();\n }\n\n public void Flush() => _writer.Flush();\n\n private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;\n\n protected virtual void Dispose(bool disposing)\n {\n if (!_disposedValue)\n {\n if (disposing)\n {\n _reader.Dispose();\n _writer.Flush();\n _writer.Dispose();\n }\n\n _disposedValue = true;\n }\n }\n\n public void Dispose()\n {\n Dispose(disposing: true);\n GC.SuppressFinalize(this);\n }\n }\n}\n\n#endregion\n"}, {"source_code": "using System;\n\nnamespace B_\u0418\u043c\u044f_\u0444\u0430\u0439\u043b\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var str = Console.ReadLine();\n int answ = 0;\n while (str.Contains(\"xxx\"))\n {\n var pos = str.IndexOf(\"xxx\");\n str=str.Remove(pos, 1);\n answ++;\n }\n Console.WriteLine(answ);\n // Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n private static string s;\n private static int n;\n private static List a = new List();\n\n static void Main(string[] args)\n {\n n = int.Parse(Console.ReadLine());\n s = Console.ReadLine();\n int ans = 0;\n for (int i = 0; i < n; ++i)\n {\n if (a.Count >= 2 && a[a.Count - 1] == 'x' && a[a.Count - 2] == 'x' && s[i] == 'x')\n ans++;\n else\n a.Add(s[i]);\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var s = input.ReadToken();\n var c = 0;\n var k = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'x')\n k++;\n else\n {\n if (k > 2)\n c += k - 2;\n k = 0;\n }\n }\n if (k > 2)\n c += k - 2;\n Console.Write(c);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace B978\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var s = Console.ReadLine();\n var x = 1;\n var c = 0;\n for (int i = 0; i < n-1; i++)\n {\n var j = i;\n\n if (s[i]=='x')\n {\n for (j = i; j < n - 1; j++)\n {\n if (s[j] == s[j + 1] && s[j] == 'x')\n {\n x++; \n }\n else\n {\n break;\n }\n }\n }\n\n if (x >= 3)\n {\n c += x - 2; \n }\n\n x = 1;\n\n i = j;\n }\n\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace FirstProgram\n{\n class FirstProgram\n {\n static void Main(String[] args)\n {\n string s;\n int i, k, t, n, l;\n k = 0;\n t = 0;\n n = Convert.ToInt32(Console.ReadLine());\n s = Console.ReadLine();\n l = s.Length;\n for (i = 0; i < l; i++)\n {\n if (s[i] == 'x')\n k++;\n else\n k = 0;\n if (k > 2)\n t++;\n }\n Console.Write(t);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Anton_and_Polyhedrons\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n int cont = 0;\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n if(s[i] == 'x')\n {\n cont++;\n }\n else\n {\n if (cont <= 2)\n {\n cont = 0;\n continue;\n }\n cont -= 2;\n sum +=cont;\n cont = 0;\n }\n\n }\n if(cont > 2)\n {\n cont -= 2;\n sum += cont;\n cont = 0;\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u0418\u043c\u044f_\u0444\u0430\u0439\u043b\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n\n int xMetr = 0, delete = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (str[i] != 'x')\n {\n if (xMetr > 2)\n delete += xMetr - 2;\n xMetr = 0;\n }\n else\n xMetr++;\n }\n\n if (str[n - 1] == 'x' && xMetr > 2)\n delete += xMetr - 2;\n\n Console.WriteLine(delete); \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test123\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberOfChars = Convert.ToInt32(Console.ReadLine());\n string inputString = Console.ReadLine();\n int toRemove = 0;\n \n for(int i = 0; i < inputString.Length-2; i++)\n {\n string currentString = inputString.Substring(i, 3);\n if(currentString.Contains(\"xxx\"))\n {\n toRemove++;\n }\n }\n Console.WriteLine(toRemove);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace NewConsoleApp1\n{\n class Program\n {\n static int Check_it(string str)\n {\n int k = 0;\n string temp = \"\";\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'x')\n temp += \"x\";\n else\n temp = \"\";\n if (temp == \"xxx\")\n {\n k++;\n str = str.Remove(i, 1);\n temp = \"\";\n i = 0;\n }\n }\n return k;\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), kol = 0;\n string s = Console.ReadLine(), temp = \"\";\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'x')\n temp += \"x\";\n else\n temp = \"\";\n if (temp == \"xxx\")\n {\n kol++;\n s = s.Remove(i, 1);\n n--;\n temp = \"\";\n i = 0;\n }\n }\n kol += Check_it(s);\n Console.WriteLine(kol);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n ReadLine();\n string s = ReadLine();\n int sum = 0;\n for (int i = 0; i < s.Length - 2; i++)\n {\n if (s[i].Equals('x'))\n if (s[i].Equals(s[i + 1]))\n if ((s[i + 1].Equals(s[i + 2])))\n sum++;\n }\n WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n String s = Console.ReadLine();\n int cnt = 0;\n List l = new List();\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'x')\n {\n cnt++;\n }\n else\n {\n if (cnt != 0)\n {\n l.Add(cnt);\n cnt = 0;\n }\n }\n }\n if (cnt != 0)\n {\n l.Add(cnt);\n cnt = 0;\n }\n int ans = 0;\n for (int i = 0; i < l.Count; i++)\n {\n if (l[i] <= 2) \n {\n continue;\n }\n ans += l[i] - 2;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0422\u0430\u043c\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n while(s.Contains(\"xxx\"))\n {\n s=s.Replace(\"xxx\",\"xx\");\n }\n Console.WriteLine(n-s.Count());\n }\n }\n}"}, {"source_code": "namespace ConsoleApp3\n{\n using System;\n using System.Collections.Generic;\n using System.Text;\n using System.Text.RegularExpressions;\n using System.Collections;\n using System.Linq;\n\n namespace VectorSpaceModel\n {\n class Program\n {\n static void Main(string[] args)\n {\n //6\n // xxxiii\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine();\n\n var temp = 0;\n var res = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (a[i] == 'x')\n {\n temp++;\n if(temp > 2)\n {\n res++;\n }\n }\n else\n {\n temp = 0;\n }\n }\n\n Console.WriteLine(res);\n\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TASK_978B\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string temp = Console.ReadLine();\n int count = 0, result = 0;\n for (int i = 0; i < temp.Length; i++)\n {\n if (temp[i] != 'x')\n count = 0;\n else\n count++;\n if (count == 3)\n {\n result++;\n count--;\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using static System.Console;\nclass a\n{\n static void Main()\n {\n ReadLine();\n var a = ReadLine();\n int r = 0;\n for (int i = 0; i < a.Length-2; i++) if (a[i] == 'x' && a[i + 1] == 'x' && a[i + 2] == 'x') r++;\n WriteLine(r);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces1305B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string code;\n code = Console.ReadLine();\n var codeArray = code.ToCharArray();\n int countx = 0;\n List count = new List();\n\n\n foreach(var c in codeArray)\n {\n if (c == 'x')\n countx++;\n else\n {\n if (countx != 0)\n count.Add(countx);\n countx = 0;\n } \n }\n\n if (countx != 0)\n count.Add(countx);\n\n int output = 0;\n\n foreach(var c in count)\n {\n if (c >= 3)\n output = output + c - 2;\n }\n\n Console.WriteLine(output);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n var n = Reader.ReadIntArgs();\n var s = Console.ReadLine();\n\n int cnt = 0;\n int ans = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'x')\n {\n cnt++;\n }\n else\n {\n ans += cnt > 2 ? cnt - 2 : 0;\n cnt = 0;\n }\n }\n\n ans += cnt > 2 ? cnt - 2 : 0;\n\n Console.WriteLine(ans);\n }\n\n static bool IsPol(string s)\n {\n int l = 0;\n int r = s.Length - 1;\n\n while (l < r)\n {\n if (s[l] != s[r])\n return false;\n\n l++;\n r--;\n }\n\n return true;\n }\n }\n\n static class Reader\n {\n public static List ReadIntArgs()\n {\n return ReadArgs(int.Parse);\n }\n\n public static List ReadLongArgs()\n {\n return ReadArgs(long.Parse);\n }\n\n private static List ReadArgs(Func parser)\n {\n return Console.ReadLine().Split().Select(parser).ToList();\n }\n\n public static int ReadIntValue()\n {\n return ReadValue(int.Parse);\n }\n\n public static long ReadLongValue()\n {\n return ReadValue(long.Parse);\n }\n\n private static T ReadValue(Func parser)\n {\n return parser(Console.ReadLine());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //---------------------------------------------------------------------\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n int c = 0;\n int toDelete = 0;\n for (int i = 0; i < n; i++)\n {\n if (str[i] == 'x')\n c++;\n else\n {\n if (c >= 3)\n {\n toDelete += c - 2;\n }\n\n c = 0;\n }\n }\n if (c >= 3)\n {\n toDelete += c - 2;\n }\n Console.WriteLine(toDelete);\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n //5\n //1 2 4 5 10\n //2 2 4 5 10\n\n //1 1 3 5 9\n int i = 1;\n while (i <= a.Max())\n {\n for (int j = 0; j < n; j++)\n {\n if (i == a[j] && i % 2 == 1)\n a[j] = i + 1;\n else if (i == a[j] && i % 2 == 0)\n a[j] = i - 1;\n }\n\n int min = a[0];\n for (int k = 1; k < n; k++)\n {\n if (min < a[k] && a[k] > i)\n min = a[k];\n }\n i = min;\n }\n\n foreach (var item in a)\n {\n Console.Write(item + \" \");\n }*/\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n //5\n //3 10 8 6 11\n //4\n //1\n //10\n //3\n //11\n\n //0\n //4\n //1\n //5\n\n x = new SortedSet(x).ToArray();\n int maxPrice = x[n - 1];\n n = x.Length;\n int[] dp = new int[maxPrice + 1];\n int c = 1;\n for (int i = 0; i < n; i++)\n dp[x[i]] = c++;\n\n for (int i = 1; i <= maxPrice; i++)\n dp[i] = Math.Max(dp[i], dp[i - 1]);\n\n int q = int.Parse(Console.ReadLine());\n for (int i = 0; i < q; i++)\n {\n long m = long.Parse(Console.ReadLine());\n if (m >= maxPrice)\n Console.WriteLine(dp[maxPrice]);\n else\n Console.WriteLine(dp[m]);\n }*/\n //---------------------------------------------------------------------\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string a = Console.ReadLine();\n int sum = 0;\n for (int h = 0; h < 1000; h++)\n {\n for (int i = 0; i < a.Length - 2; i++) \n {\n if ((a[i] == 'x') && (a[i + 1] == 'x') && (a[i + 2] == 'x'))\n {\n sum++;\n a = a.Remove(i, 1);\n }\n }\n }\n Console.WriteLine(sum);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var N = sc.Int;\n var s = ReadLine();\n var st = 0;var res = 0;\n for(var i=0;i(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static T[] Copy(this T[] A)\n => Create(A.Length, i => A[i]);\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string x = Console.ReadLine();\n int counter = 0;\n there:\n for (int i = 0; i < x.Length-2; i++)\n {\n if (x[i] == 'x' && x[i + 1] == 'x' && x[i + 2] == 'x')\n {\n x = x.Remove(i, 1);\n counter++;\n goto there;\n }\n }\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _978B\n{\n public static class Program\n {\n public static void Main(string[] args)\n {\n var len = rl();\n var str = rl();\n\n var res = 0;\n var row = 0;\n\n foreach (var ch in str)\n {\n if (ch == 'x')\n {\n row++;\n }\n else\n {\n row = 0;\n }\n\n if (row >= 3)\n {\n res++;\n }\n }\n\n wl(res);\n }\n\n private static T rl() { return (T)Convert.ChangeType(Console.ReadLine(), typeof(T)); }\n private static T[] rla(char sep = ' ') { return Console.ReadLine().Split(sep).Select(s => (T)Convert.ChangeType(s, typeof(T))).ToArray(); }\n private static int[] rlai(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), int.Parse); }\n private static long[] rlal(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), long.Parse); }\n private static string[] rlas(char sep = ' ') { return Console.ReadLine().Split(sep); }\n private static List rll(char sep = ' ') { return Console.ReadLine().Split(sep).Select(s => (T)Convert.ChangeType(s, typeof(T))).ToList(); }\n private static T rn(char sep = ' ') { var b = new StringBuilder(); while (true) { var c = (char)Console.In.Read(); if (c == sep || c == '\\n') break; b.Append(c); } return (T)Convert.ChangeType(b.ToString(), typeof(T)); }\n private static void wl(object o) { Console.WriteLine(o); }\n private static void wla(int[] arr, string sep = \" \") { Console.WriteLine(string.Join(sep, arr)); }\n private static void wla(long[] arr, string sep = \" \") { Console.WriteLine(string.Join(sep, arr)); }\n private static void wla(string[] arr, string sep = \" \") { Console.WriteLine(string.Join(sep, arr)); }\n private static void w(object o) { Console.Write(o); }\n private static void wn(object o, string sep = \" \") { Console.Write(o + sep); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace xxx\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n char[] str = new char[n];\n string stroqa;\n\n stroqa = Console.ReadLine();\n str = stroqa.ToCharArray();\n int result = 0;\n for (int i = 1; i < n-1 ; i++)\n {\n if (str[i - 1] == 'x' && str[i] == str[i - 1] && str[i] == str[i + 1]) result++;\n }\n Console.WriteLine(result);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Xml.Serialization;\nusing System.Linq;\n\nnamespace Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int result = 0;\n int counter = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'x')\n counter++;\n else\n counter = 0;\n\n if (counter >= 3)\n result++;\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n static class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var str = Console.ReadLine();\n var count = 0;\n for(var i = str.IndexOf(\"xxx\"); i!=-1; i = str.IndexOf(\"xxx\"), count++)\n {\n str = str.Remove(i, 1);\n }\n Console.Write(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var input = Console.ReadLine();\n var startLength = input.Length;\n while (input.Contains(\"xxx\"))\n {\n input = input.Replace(\"xxx\", \"xx\");\n }\n Console.WriteLine(startLength-input.Length);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine()), a = 0, t = 0;\n string s = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'x')\n {\n t++;\n if (t > 2)\n a++;\n }\n else t = 0;\n }\n Console.WriteLine(a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int cnt = 0;\n int[] arr = new int[str.Length];\n for(int i = 0; i < str.Length; i++)\n {\n if (str[i].ToString() == \"x\")\n {\n cnt += 1;\n \n }\n else\n {\n arr[i] = cnt;\n cnt = 0; \n }\n }\n arr[0] = cnt;\n Array.Sort(arr);\n Array.Reverse(arr);\n int res = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] >= 3)\n {\n res += arr[i] - 2;\n \n\n }\n }\n Console.WriteLine(res);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace File_Name\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n string s = reader.ReadLine();\n s = reader.ReadLine();\n\n int ans = 0;\n int cnt = 0;\n foreach (char c in s)\n {\n if (c == 'x')\n {\n cnt++;\n if (cnt > 2)\n ans++;\n }\n else\n {\n cnt = 0;\n }\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Filenamexxx\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n int answer = 0;\n for (int i = 2; i < n; i++)\n {\n if(line[i] == 'x')\n {\n if(line[i-1] == 'x' && line[i-2]== 'x')\n {\n answer += 1;\n }\n }\n }\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = -2, sum = 0;\n if (s.IndexOf(\"xxx\") == -1)\n Console.WriteLine(0);\n else\n {\n for (int i = 0; i < n;)\n {\n while (s[i] == 'x')\n {\n count++;\n i++;\n if (i == n)\n break;\n }\n if (count > 0)\n {\n sum += count;\n count = -2;\n }\n else if (count == -2)\n {\n i++;\n }\n else\n {\n count = -2;\n }\n\n }\n Console.WriteLine(sum);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolving.CodeForces\n{\n class File_Name_978_problem_B\n {\n public static void Main(string[] args)\n {\n string st = Console.ReadLine();\n string str = Console.ReadLine();\n string s = \"xxx\";\n int cnt = 0;\n for(int i = 0; i < str.Length-2; i++)\n {\n if(str.Substring(i, 3).Equals(s))\n {\n cnt++;\n }\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string filename = Console.ReadLine();\n int count = 0;\n while (filename.Contains(\"xxx\"))\n {\n int index = filename.IndexOf(\"xxx\");\n filename = filename.Remove(index, 1);\n count++;\n }\n Console.WriteLine(count);\n }\n\n\n static int[] StringToIntArray(string input)\n {\n string[] splitInput = input.Split();\n int length = splitInput.Length;\n int[] result = new int[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = int.Parse(splitInput[i]);\n }\n return result;\n }\n\n static long[] StringToLongArray(string input)\n {\n string[] splitInput = input.Split();\n int length = splitInput.Length;\n long[] result = new long[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = long.Parse(splitInput[i]);\n }\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\npublic class Test\n{\n\n\tpublic static void Main()\n\t{\n\t\tint length = Convert.ToInt32(Console.ReadLine());\n\t\tstring str = Console.ReadLine();\n\t\tint sayac = 0;\n\t\tfor (int i = 0; i < length; i++)\n\t\t{\n\t\t\tif (!str.Contains(\"xxx\"))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (i <= (length - 3) && str[i] == 'x' && str[i + 1] == 'x' && str[i + 2] == 'x')\n\t\t\t{\n\t\t\t\tsayac++;\n\t\t\t}\n\t\t}\n\t\tif(sayac!=0)Console.WriteLine(sayac);\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace file_name\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n =int.Parse(Console.ReadLine());\n int b;\n \n string x = Console.ReadLine();\n b = 0;\n for (int i = 0; i = 3)\n {\n delCount++;\n }\n }\n else\n {\n xCount = 0;\n }\n }\n Console.WriteLine(delCount);\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace FilenameChecker\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = Convert.ToInt32(Console.ReadLine());\n string filename = Console.ReadLine();\n\n int xCount = 0, removeCharCount = 0;\n for (int i = 0; i < length; i++)\n {\n if (filename[i] == 'x')\n xCount++;\n else\n xCount = 0;\n\n if (xCount > 2)\n removeCharCount++;\n }\n\n Console.WriteLine(removeCharCount.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s=Console.ReadLine();\n string str = Console.ReadLine();\n string sub_str = \"xxx\";\n int count = 0;\n while(true)\n {\n int i = str.IndexOf(sub_str);\n if (i<0)\n {\n break;\n }\n str=str.Remove(i, 1);\n count++;\n }\n Console.WriteLine(count);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s1 = Console.ReadLine();\n string s2 = \"xxx\";\n int i = 0; \n int x = -1; \n int count = -1; \n while (i != -1)\n {\n i = s1.IndexOf(s2, x + 1); \n x = i; \n count++;\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace TasksCodeForce\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint number = int.Parse(Console.ReadLine());\n\t\t\tchar[] str = Console.ReadLine().ToCharArray();\n\n\t\t\tif (number < 3 || number > 100 || str.Length != number)\n\t\t\t\treturn;\n\n\t\t\tint counter = 0;\n\t\t\tint res = 0;\n\n\t\t\tfor (int i = 0; i < str.Length; i++)\n\t\t\t{\n\t\t\t\tif (str[i] == 'x')\n\t\t\t\t{\n\t\t\t\t\tcounter++;\n\n\t\t\t\t\tif (counter == 3)\n\t\t\t\t\t{\n\t\t\t\t\t\tcounter -= 1;\n\t\t\t\t\t\tres++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t\tcounter = 0;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing static CF.ReadNext;\n\nnamespace CF\n{\n public static class Program\n {\n\n private static void Main()\n {\n var n = NextInt();\n var s = NextWord();\n var consecutiveXs = 0;\n var result = 0;\n foreach (var ch in s)\n {\n if (ch == 'x')\n {\n consecutiveXs++;\n if (consecutiveXs >= 3)\n result++;\n }\n else\n {\n consecutiveXs = 0;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n\n public static class ReadNext\n {\n public static int NextInt()\n {\n var next = ReadUntilSpace();\n return int.Parse(next);\n }\n\n public static double NextDouble()\n {\n var next = ReadUntilSpace();\n return double.Parse(next);\n }\n\n public static string NextWord()\n {\n return ReadUntilSpace();\n }\n\n private static bool IsWhiteSpace(int n)\n {\n return n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1;\n }\n\n private static string ReadUntilSpace()\n {\n var result = \"\";\n\n var n = Console.Read();\n // read whitespace \n while (IsWhiteSpace(n))\n {\n n = Console.Read();\n }\n\n // read characters\n while (!IsWhiteSpace(n))\n {\n result += (char)n;\n n = Console.Read();\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n\n int k = 0;\n int value = 0;\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'x')\n {\n value++;\n if (i == str.Length - 1 && value > 2)\n {\n k += value - 2;\n value = 0;\n }\n }\n else\n {\n if (value > 2)\n {\n k += value - 2;\n }\n value = 0;\n }\n \n }\n\n Console.WriteLine(k);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\n\nnamespace Practice\n{\n public class Program\n {\n public static void Main()\n {\n B978();\n //Console.ReadKey();\n }\n\n public static void B978()\n {\n int n = int.Parse(Console.ReadLine());\n string line = Console.ReadLine();\n\n int removed = 0;\n int xLen = 0;\n for(int i = 0; i< n; i++)\n {\n if (line[i] == 'x')\n xLen++;\n else\n xLen = 0;\n\n if (xLen >= 3)\n {\n removed++;\n xLen--;\n }\n }\n Console.WriteLine(removed);\n }\n public static void A978()\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n Boolean[] seen = new Boolean[1001];\n Stack stack = new Stack();\n\n String[] num = Console.ReadLine().Split();\n for(int i = n-1; i>=0 ; i--)\n {\n int x = int.Parse(num[i]);\n if(!seen[x])\n {\n stack.Push(x);\n seen[x] = true;\n }\n }\n\n StringBuilder output = new StringBuilder();\n output.Append(stack.Count + \"\\n\");\n\n while (stack.Count != 0)\n {\n output.Append(stack.Pop() + \" \");\n }\n\n Console.WriteLine(output.ToString());\n\n }\n }\n\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main(string[] args)\n {\n var occurrenceLength = 0;\n var deletedCount = 0;\n var fileLength = int.Parse(Console.ReadLine());\n for (int i = 0; i < fileLength; i++)\n {\n var letter = (char)Console.Read();\n if (letter != 'x')\n occurrenceLength = 0;\n else\n if (occurrenceLength == 2)\n deletedCount++;\n else\n occurrenceLength++;\n }\n Console.WriteLine(deletedCount);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string name = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < name.Length; i++)\n {\n if (name[i] == 'x')\n {\n int index = i;\n int xCount = 0;\n while (index < name.Length && name[index] == 'x')\n {\n xCount++;\n index++;\n }\n if (xCount >= 3)\n {\n count += xCount - 2;\n }\n i = index;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace FileName\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = Convert.ToInt32(Console.ReadLine().Trim());\n\t\t\tstring str = Console.ReadLine().Trim();\n\t\t\tint len =str.Length;\n\t\t\tint cnt = 0;\n\t\t\t\n\t\t\twhile(str.IndexOf(\"xxx\") >= 0) {\n\t\t\t\tint pos = str.IndexOf(\"xxx\");\n\t\t\t\tstr = str.Remove(pos, 1);\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForcesTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int q = Convert.ToInt32(Console.ReadLine()), c = 0;\n\n string x = Console.ReadLine();\n\n while(x.IndexOf(\"xxx\") > -1)\n {\n int pos = x.IndexOf(\"xxx\");\n x = x.Remove(pos, 3).Insert(pos, \"xx\");\n c++;\n }\n\n Console.WriteLine(c);\n\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforces_978_B\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n char [] a = new char [n];\n int cnt = 1; int cntt = 0;\n a[0] = Convert.ToChar(Console.Read());\n for(int i=1; i=3)\n cntt++;\n } \n else cnt = 1;\n }\n Console.WriteLine();\n Console.WriteLine(cntt);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n //int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n string s = Console.ReadLine();\n int count1 = 0;\n int temp = 0;\n for(int i = 0; i < count; i++)\n {\n if (s[i] == 'x')\n {\n temp++;\n if (temp == 3)\n {\n count1++;\n temp--;\n }\n }\n else\n temp = 0;\n }\n Console.WriteLine(count1);\n Console.ReadLine();\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace CodeFroces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Len = int.Parse(Console.ReadLine()), count=0,Removed_Char=0;\n string File_Name = Console.ReadLine();\n for(int i = 0; i < Len; ++i)\n {\n if (File_Name[i] == 'x')\n {\n ++count;\n }\n else if (count > 2)\n {\n Removed_Char += count - 2;\n count = 0;\n }\n else count = 0;\n }\n if(count>2)\n Removed_Char += count - 2;\n Console.WriteLine(Removed_Char);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n string mas = Console.ReadLine();\n List array = mas.ToCharArray().ToList();\n int x = 0;\n for (int i = 0; i < array.Count-2; i++)\n {\n if ((array[i] == array[i+1])&(array[i] == array[i+2])&(array[i]=='x'))\n {\n x += 1;\n }\n }\n Console.Write(x);\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < input.Length-2; i++)\n {\n if (input[i] == 'x' && input[i + 1] == 'x' && input[i + 2] == 'x')\n count++;\n }\n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int lenght = int.Parse(Console.ReadLine());\n\n string input = Console.ReadLine();\n StringBuilder str = new StringBuilder(input);\n int counter = 0;\n while (str.ToString().Contains(\"xxx\"))\n {\n str.Remove(str.ToString().IndexOf(\"xxx\"),1);\n counter++;\n }\n Console.WriteLine(counter);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n //var v = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\n string str = Console.ReadLine();\n\n int c = 0;\n\n for (int i = 2; i < n; i++)\n {\n if (str[i - 1] == 'x' && str[i - 2] == 'x' && str[i] == 'x') { c++; }\n }\n Console.WriteLine(c);\n return;\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int result = 0;\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if(input[i]=='x')\n {\n count++;\n }\n else\n {\n if (count>2)\n result += (count - 2);\n count = 0; \n }\n\n }\n if(count>2)\n result += (count - 2);\n Console.WriteLine(result);\n return 0;\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n //count how many consequtive\n\n var n = Console.ReadLine();\n\n var s = Console.ReadLine();\n\n //get length of all consequtive pieces of x above 2\n var consequtives = new List();\n int part = 0;\n bool recording = false;\n foreach (char c in s)\n {\n if (c == 'x')\n {\n if (!recording)\n recording = true;\n\n part++;\n }\n else\n {\n recording = false;\n if (part > 2)\n consequtives.Add(part);\n part = 0;\n }\n }\n\n\n if (part > 2)\n consequtives.Add(part);\n\n\n int deletes = 0;\n foreach (int nn in consequtives)\n deletes += (nn - 2);\n\n Console.WriteLine(deletes);\n }\n\n\n\n }\n}"}, {"source_code": "using System;\n\nnamespace FlightTask\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), k =0;\n string messeage = Console.ReadLine();\n for (int i = 0; i < messeage.Length - 2; i++)\n {\n if ((messeage[i] == 'x') && (messeage[i + 1] == 'x') && (messeage[i + 2] == 'x'))\n {\n k++;\n }\n }\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n while (s.Contains(\"xxx\"))\n {\n s = s.Replace(\"xxx\", \"xx\");\n }\n Console.WriteLine(n-s.Length);\n }\n }\n}\n/*\n100\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n*/"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar s = Console.ReadLine();\n\t\t\tif (!s.Contains(\"xxx\"))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar ss = s.ToCharArray();\n\t\t\t\tvar c = 0;\n\t\t\t\tfor (int i = 2; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\tif(s[i] == 'x' && s[i - 1] == 'x' && s[i - 2] == 'x')\n\t\t\t\t\t{\n\t\t\t\t\t\tc++;\n\t\t\t\t\t\tss[i] = 'y';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(c);\n\t\t\t}\n\t\t\t\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tprivate static List ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\tprivate static List ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\tprivate static int[] ReadIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tprivate static long[] ReadLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();\n\t\tprivate static int ReadInt() => int.Parse(Console.ReadLine());\n\t\tprivate static long ReadLong() => long.Parse(Console.ReadLine());\n\n\t}\n};"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n int n = Convert.ToInt32( Console.ReadLine() );\n string str = Console.ReadLine();\n\n //--------------------------------solve--------------------------------//\n\n int kq = 0;\n while(str.Contains( \"xxx\" ))\n {\n int first=str.Length;\n str = str.Replace(\"xxx\",\"xx\");\n kq += ( first - str.Length );\n }\n Console.WriteLine( kq );\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeFirstSimple\n{\n class Program\n {\n static void Main()\n {\n Console.ReadLine();\n var str = Console.ReadLine();\n var count = 0;\n var totalCount = 0;\n foreach (var s in str)\n {\n if (s == 'x')\n {\n count++;\n if (count >= 3)\n totalCount++;\n }\n else\n count = 0;\n }\n Console.WriteLine(totalCount);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n static void Main()\n {\n Console.ReadLine();\n var str = Console.ReadLine();\n Console.WriteLine(str.Length - Regex.Replace(str, \"(?<=xx)x\", \"\").Length);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int rmvdX = 0, xCnt = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'x')\n {\n xCnt++;\n if (xCnt>2) rmvdX++;\n }\n else xCnt = 0;\n }\n Console.WriteLine(rmvdX);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string trash = Console.ReadLine();\n string s = Console.ReadLine();\n int K = 0; int temp = 0;\n for (int i=0; i=3) K+= temp-2; temp = 0; }\n }\n if (temp>=3) K += temp - 2; temp = 0;\n if (K <= 0) Console.WriteLine(0);\n else\n Console.WriteLine(K);\n }\n }\n}"}, {"source_code": "\ufeff//#define FILE_INPUT\nusing System;\nusing System.Text;\nusing System.Linq;\n//using System.Numerics;\n//using System.Collections;\nusing System.Collections.Generic;\n//using System.Collections.Specialized;\n//using System.Text.RegularExpressions;\n\n//978A. \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432\n\nnamespace CodeForces\n{\n class Solution\n {\n\n private void solve()\n {\n int n = gi(), x = 0, ans = 0;\n cin.NewLine();\n string s = cin.Line();\n\n foreach (var c in s)\n {\n switch (c)\n {\n case 'x':\n x++;\n break;\n\n default:\n if (x > 2) ans += x - 2;\n x = 0;\n break;\n }\n }\n\n if (x > 2) ans += x - 2;\n Console.WriteLine(ans);\n }\n\n\n #region Tools\n\n static void Main()\n {\n new Solution().solve();\n Pause();\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugOut(string format, T arg)\n {\n Console.WriteLine(format, arg);\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugOut(string format, params object[] arg)\n {\n Console.WriteLine(format, arg);\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugStop()\n {\n Console.ReadKey(true);\n }\n\n private static T[] ga(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n\n private static T[] ga(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n private static int gi()\n { return cin.gi(); }\n\n private static List gl(int n, Func f)\n {\n var a = new List(n + 1);\n for (int i = 0; i < n; ++i) a.Add(f(i));\n return a;\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void Pause()\n {\n Console.WriteLine(\"[debug]\");\n Console.ReadKey(true);\n }\n private static void swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n\n #endregion Tools\n }\n\n class cin\n {\n public static int error { get; set; }\n\n static cin()\n {\n#if (ONLINE_JUDGE || !FILE_INPUT)\n reader = new System.IO.BufferedStream(Console.OpenStandardInput(1024 * 10), 1024 * 10);\n#else\n reader = new System.IO.BufferedStream((new System.IO.StreamReader(\"input.txt\")).BaseStream, 1024 * 16);\n#endif\n }\n\n public static System.IO.BufferedStream reader { get; private set; }\n public static char Char() { return (char)reader.ReadByte(); }\n\n public static int gi()\n {\n for (int c = read(); c != -1; c = read())\n {\n switch ((char)c)\n {\n case '-':\n return -(int)gu(read());\n\n default:\n if (char.IsDigit((char)c)) return (int)gu(c);\n break;\n }\n }\n\n throw new System.IO.IOException();\n }\n\n public static uint gu()\n {\n return gu(read());\n }\n\n public static string Line()\n {\n int c;\n StringBuilder sb = new StringBuilder();\n\n for (c = read(); c != 10 && c != -1; c = read()) sb.Append((char)c);\n\n if (sb.Length > 0 && sb[sb.Length - 1] == 13) sb.Length -= 1;\n return sb.ToString();\n }\n\n public static int rawLine(byte[] a, int offset = 0)\n {\n int c, i = offset;\n for (c = reader.ReadByte(); c != 10; c = reader.ReadByte()) a[i++] = (byte)c;\n if (i > 0 && a[i - 1] == 13) i--;\n return i;\n }\n\n public static int rawLine(char[] a, int offset = 0)\n {\n Array.ConvertAll(a, Convert.ToInt16);\n\n int c, i = offset;\n for (c = read(); c != 10 && c != -1; c = read()) a[i++] = (char)c;\n if (i > 0 && a[i - 1] == 13) i--;\n return i;\n }\n\n public static int rawLine(T[] a, Func converter) where T : IComparable\n {\n int c, i = 0;\n for (c = read(); c != 10; c = read()) a[i++] = converter(c);\n if (i > 0 && a[i - 1].CompareTo(13) == 0) i--;\n return i;\n }\n\n public static string Scan()\n {\n int c;\n StringBuilder sb = new StringBuilder();\n\n do\n {\n c = read();\n if (c == -1) return string.Empty;\n }\n while (c < 33 || c > 126);\n\n for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);\n return sb.ToString();\n }\n\n public static bool Scan(ref StringBuilder sb)\n {\n int c;\n\n do\n {\n c = read();\n if (c == -1) return false;\n }\n while (c < 33 || c > 126);\n\n for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);\n return true;\n }\n\n private static uint gu(int first)\n {\n int c;\n uint u = (uint)first - '0';\n for (c = read(); c != -1 && char.IsDigit((char)c); c = read())\n {\n u = 10 * u + (uint)c - '0';\n }\n\n error = c;\n return u;\n }\n\n private static int read() { return reader.ReadByte(); }\n\n public static bool NewLine()\n {\n int c = error;\n if (c != 10) do c = reader.ReadByte(); while (c != -1 && c != 10);\n return c != -1;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Round\n{\n static void Main()\n {\n Console.ReadLine();\n char x = 'x';\n string str = Console.ReadLine();\n int n = str.Length, count = 0, ind = str.IndexOf(x);\n while (ind >= 0)\n {\n int kol=-2;\n while (ind < n && str[ind++] == x) kol++;\n count += (kol > 0) ? kol : 0;\n ind = str.IndexOf(x, ind);\n }\n Console.WriteLine(count);\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforce\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int p = 0;\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length - 2;i++){\n if(s[i]=='x' && s[i+1]=='x' && s[i+2]=='x'){\n s = s.Remove(i, 1);\n p++;\n i--;\n }\n }\n Console.WriteLine(p);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _2\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte n = byte.Parse(Console.ReadLine());\n\n string s = Console.ReadLine();\n\n while (s.Contains(\"xxx\"))\n {\n s = s.Remove(s.IndexOf(\"xxx\"), 1);\n }\n\n Console.WriteLine(n - s.Length);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int cnt = 0, cnt1 = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'x')\n {\n cnt++;\n if (cnt >= 3)\n cnt1++;\n }\n if (s[i] != 'x' && cnt != 0)\n cnt = 0;\n }\n Console.WriteLine(cnt1);\n }\n }\n}\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace HackerEarthProject\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n int ch = 0;\n for(int i = 0; i < s.Length; i++)\n {\n if (s[i] != 'x')\n count = 0;\n if (s[i] == 'x')\n ++count;\n if (count == 2)\n continue;\n if (count > 2 && s[i] == 'x')\n ch++;\n \n\n }\n Console.WriteLine(ch);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string name = Console.ReadLine();\n int cnt = 0;\n int i = 0;\n do\n {\n if (name.Substring(i, 3) == \"xxx\")\n {\n //name = name.Remove(i, 1);\n cnt++;\n } \n\n i++;\n }\n while (i + 3 <= n);\n\n Console.WriteLine(cnt);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n string title = Console.ReadLine();\n int countX = 0;\n\n if (title.Contains(\"xxx\"))\n {\n char[] letters = title.ToCharArray();\n\n for (int n = 2; n < letters.Length; n++)\n {\n if ((letters[n] == 'x') && (letters[n - 1] == 'x') && (letters[n - 2] == 'x'))\n countX++;\n }\n\n Console.WriteLine(countX);\n } \n \n else\n Console.WriteLine(0); \n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\tstring input2 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();\n\n\t\t\tint result = 0, count = 0;\n\t\t\tforeach (var i in input2) \n\t\t\t{\n\t\t\t\tif (i == 'x') \n\t\t\t\t{\n\t\t\t\t\tif (count == 2) \n\t\t\t\t\t{\n\t\t\t\t\t\tresult++;\n\t\t\t\t\t} \n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tcount = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace div481\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n =Convert.ToInt32( Console.ReadLine());\n string s = Console.ReadLine();\n List l = new List();\n for (int x=0,i = 0; i < n; i++)\n {\n if (s[i] == 'x')\n { if (x != 2) { l.Add(s[i]); x++; } }\n else { l.Add(s[i]); x=0; }\n }\n Console.WriteLine(n-l.Count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var line = Console.ReadLine();\n var cnt = 0;\n var res = 0;\n for (int i = 0; i < n; i++)\n {\n if (line[i] == 'x')\n cnt++;\n else\n cnt = 0;\n\n if (cnt > 2)\n res++;\n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = Int();\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar xs = 0;\n\t\t\tvar ans = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'x')\n\t\t\t\t\txs++;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (xs > 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tans += xs - 2;\n\t\t\t\t\t}\n\t\t\t\t\txs = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (xs > 2)\n\t\t\t{\n\t\t\t\tans += xs - 2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic (int, int, int, int) Int4()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2], arr[3]);\n\t\t}\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t}\n\n\t\tstatic long Long()\n\t\t{\n\t\t\treturn Int64.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (long, long) Long2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (long, long, long) Long3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic (long, long, long, long) Long4()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2], arr[3]);\n\t\t}\n\n\n\t\tstatic long[] Longs()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);\n\t\t}\n\t}\n\n\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Solve();\n }\n\n static void Solve()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n int result = 0;\n for(int i = 0; i < n; i++)\n {\n if (s[i] == 'x') count++;\n else if(count >= 3)\n {\n result += count - 2;\n count = 0;\n }\n }\n if (count >= 3) result += count - 2;\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string a = Console.ReadLine();\n int k = 0;\n int x = 0;\n bool ist = true;\n\n k = a.IndexOf(\"xxx\");\n while (k >= 0) \n {\n int i = 1;\n while ((k + 3 + i < a.Length) && a[k + 3 + i] == 'x')\n {\n i++;\n\n }\n a = a.Remove(k + 2, i);\n k = a.IndexOf(\"xxx\");\n x += i;\n }\n Console.WriteLine(x);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace B978\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var s = Console.ReadLine();\n var x = 1;\n var c = 0;\n for (int i = 0; i < n-1; i++)\n {\n var j = i;\n\n if (s[i]=='x')\n {\n for (j = i; j < n - 1; j++)\n {\n if (s[j] == s[j + 1] && s[j] == 'x')\n {\n x++; \n }\n else\n {\n break;\n }\n }\n }\n\n if (x >= 3)\n {\n c += x - 2; \n }\n\n x = 1;\n\n if (j==n-1)\n {\n break;\n }\n }\n\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace B978\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var s = Console.ReadLine();\n var x = 0;\n var c = 0;\n for (int i = 0; i < n-1; i++)\n {\n var j = i;\n while (s[j]==s[j+1] && s[j] == 'x' )\n {\n x++;\n if (j == n - 2 && s[n - 1] == 'x' && x >= 3)\n x++;\n if (j == n - 2)\n break;\n j++;\n }\n \n if (x >= 3)\n {\n c += x-2;\n x = 0;\n }\n if (j == n - 2)\n break;\n }\n\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp125\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), kolvo = 0;\n bool End = true;\n string s = Console.ReadLine(), temp = \"\" ;\n for(int i = 0; i < n; i++)\n {\n if (temp == \"xxx\")\n {\n End = false;\n break;\n }\n if (s[i] == 'x')\n temp += s[i];\n else\n temp = \"\";\n }\n if (End == false)\n {\n temp = \"\";\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'x')\n temp += s[i];\n else\n temp = \"\";\n if (temp == \"xxx\")\n {\n s = s.Remove(i, 1);\n i = -1;\n temp = \"\";\n kolvo++;\n }\n }\n Console.WriteLine(kolvo);\n }\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces1305B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string code;\n code = Console.ReadLine();\n var codeArray = code.ToCharArray();\n int countx = 0;\n int max = 0;\n foreach(var c in codeArray)\n {\n if (c == 'x')\n countx++;\n else\n countx = 0;\n\n if(max max) max = c;\n }\n else\n {\n c = 0;\n }\n }\n if (max >= 3)\n Console.WriteLine(max - 2);\n else\n Console.WriteLine(0);\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n //5\n //1 2 4 5 10\n //2 2 4 5 10\n\n //1 1 3 5 9\n int i = 1;\n while (i <= a.Max())\n {\n for (int j = 0; j < n; j++)\n {\n if (i == a[j] && i % 2 == 1)\n a[j] = i + 1;\n else if (i == a[j] && i % 2 == 0)\n a[j] = i - 1;\n }\n\n int min = a[0];\n for (int k = 1; k < n; k++)\n {\n if (min < a[k] && a[k] > i)\n min = a[k];\n }\n i = min;\n }\n\n foreach (var item in a)\n {\n Console.Write(item + \" \");\n }*/\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n //5\n //3 10 8 6 11\n //4\n //1\n //10\n //3\n //11\n\n //0\n //4\n //1\n //5\n\n x = new SortedSet(x).ToArray();\n int maxPrice = x[n - 1];\n n = x.Length;\n int[] dp = new int[maxPrice + 1];\n int c = 1;\n for (int i = 0; i < n; i++)\n dp[x[i]] = c++;\n\n for (int i = 1; i <= maxPrice; i++)\n dp[i] = Math.Max(dp[i], dp[i - 1]);\n\n int q = int.Parse(Console.ReadLine());\n for (int i = 0; i < q; i++)\n {\n long m = long.Parse(Console.ReadLine());\n if (m >= maxPrice)\n Console.WriteLine(dp[maxPrice]);\n else\n Console.WriteLine(dp[m]);\n }*/\n //---------------------------------------------------------------------\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //---------------------------------------------------------------------\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n int c = 0;\n int toDelete = 0;\n for (int i = 0; i < n; i++)\n {\n if (str[i] == 'x')\n c++;\n else\n {\n if (c >= 3)\n {\n toDelete += c - 2;\n }\n\n c = 0;\n }\n }\n Console.WriteLine(toDelete);\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n //5\n //1 2 4 5 10\n //2 2 4 5 10\n\n //1 1 3 5 9\n int i = 1;\n while (i <= a.Max())\n {\n for (int j = 0; j < n; j++)\n {\n if (i == a[j] && i % 2 == 1)\n a[j] = i + 1;\n else if (i == a[j] && i % 2 == 0)\n a[j] = i - 1;\n }\n\n int min = a[0];\n for (int k = 1; k < n; k++)\n {\n if (min < a[k] && a[k] > i)\n min = a[k];\n }\n i = min;\n }\n\n foreach (var item in a)\n {\n Console.Write(item + \" \");\n }*/\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n //5\n //3 10 8 6 11\n //4\n //1\n //10\n //3\n //11\n\n //0\n //4\n //1\n //5\n\n x = new SortedSet(x).ToArray();\n int maxPrice = x[n - 1];\n n = x.Length;\n int[] dp = new int[maxPrice + 1];\n int c = 1;\n for (int i = 0; i < n; i++)\n dp[x[i]] = c++;\n\n for (int i = 1; i <= maxPrice; i++)\n dp[i] = Math.Max(dp[i], dp[i - 1]);\n\n int q = int.Parse(Console.ReadLine());\n for (int i = 0; i < q; i++)\n {\n long m = long.Parse(Console.ReadLine());\n if (m >= maxPrice)\n Console.WriteLine(dp[maxPrice]);\n else\n Console.WriteLine(dp[m]);\n }*/\n //---------------------------------------------------------------------\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int cnt = 0;\n int[] arr = new int[str.Length];\n for(int i = 0; i < str.Length; i++)\n {\n if (str[i].ToString() == \"x\")\n {\n cnt += 1;\n arr[i] = cnt;\n }\n else\n {\n arr[i] = cnt;\n cnt = 0; \n }\n }\n Array.Sort(arr);\n Array.Reverse(arr);\n if (arr[0] >= 3)\n {\n Console.WriteLine(arr[0]-2);\n\n }\n else\n {\n Console.WriteLine(0);\n }\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\npublic class Test\n{\n\n\tpublic static void Main()\n\t{\n\t\tint length = Convert.ToInt32(Console.ReadLine());\n\t\tstring str = Console.ReadLine();\n\t\tint sayac = 0;\n\t\tfor (int i = 0; i < length; i++)\n\t\t{\n\t\t\tif (!str.Contains(\"xxx\"))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (i <= (length - 3) && str[i] == 'x' && str[i + 1] == 'x' && str[i + 2] == 'x')\n\t\t\t{\n\t\t\t\tsayac++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(sayac);\n\t}\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace FileName\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = Convert.ToInt32(Console.ReadLine().Trim());\n\t\t\tstring str = Console.ReadLine().Trim();\n\t\t\tint len =str.Length;\n\t\t\tint cnt = 0;\n\t\t\t\n\t\t\twhile(str.IndexOf(\"xxx\") >= 0) {\n\t\t\t\tstr = str.Replace(\"xxx\", \"xx\");\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < input.Length-2; i++)\n {\n if (input[i] == 'x' && input[i + 1] == 'x' && input[i + 2] == 'x')\n count++;\n }\n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace File_Name\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'x' && input[i + 1] == 'x' && input[i + 2] == 'x')\n count++;\n }\n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int result = 0;\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if(input[i]=='x')\n {\n count++;\n }\n else if(count>0)\n {\n result += (count - 2);\n count = 0;\n }\n }\n if(count>2)\n result += (count - 2);\n Console.WriteLine(result);\n return 0;\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int result = 0;\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if(input[i]=='x')\n {\n count++;\n }\n else if(count>2)\n {\n result += (count - 2);\n count = 0;\n }\n }\n if(count>2)\n result += (count - 2);\n Console.WriteLine(result);\n return 0;\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int result = 0;\n int count = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if(input[i]=='x')\n {\n count++;\n }\n else if(count>0)\n {\n result += (count - 2);\n count = 0;\n }\n }\n if(count>0)\n result += (count - 2);\n Console.WriteLine(result);\n return 0;\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string trash = Console.ReadLine();\n string s = Console.ReadLine();\n int K = 0; int temp = 0;\n for (int i=0; i=3) K+= temp-2; temp = 0; }\n }\n if (temp>=3) K = temp - 2; temp = 0;\n if (K <= 0) Console.WriteLine(0);\n else\n Console.WriteLine(K);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Strings\n{\n class Program\n {\n // https://codeforces.com/problemset/problem/236/A\n static void _236A()\n {\n Dictionary dict = new Dictionary();\n\n foreach (char letter in Console.ReadLine())\n {\n if (dict.ContainsKey(letter)) dict[letter]++;\n else dict.Add(letter, 1);\n }\n\n Console.WriteLine(dict.Count % 2 == 1 ? \"IGNORE HIM!\" : \"CHAT WITH HER!\");\n }\n\n // https://codeforces.com/problemset/problem/1397/A\n static void _1397A()\n {\n for (int t = int.Parse(Console.ReadLine()); t > 0; --t)\n {\n Dictionary dict = new Dictionary();\n\n int n = int.Parse(Console.ReadLine());\n\n for (int j = 0; j < n; ++j)\n {\n foreach (char letter in Console.ReadLine())\n {\n if (dict.ContainsKey(letter)) dict[letter]++;\n else dict.Add(letter, 1);\n }\n }\n\n bool no = false;\n\n foreach (var pair in dict)\n {\n if (pair.Value % n != 0)\n {\n Console.WriteLine(\"NO\");\n no = true;\n break;\n }\n }\n\n if (!no)\n Console.WriteLine(\"YES\");\n }\n }\n\n // https://codeforces.com/problemset/problem/978/B\n static void _978B()\n {\n int n = int.Parse(Console.ReadLine());\n\n int minToRemove = 0;\n List<(int, int)> substrIndexes = new List<(int, int)>();\n bool inXSubstr = false;\n string s = Console.ReadLine();\n int curSubsrtStart = 0;\n\n for (int i = 0; i < n; ++i)\n {\n if (s[i] == 'x')\n {\n if (!inXSubstr)\n {\n inXSubstr = true;\n curSubsrtStart = i;\n }\n\n while (i + 1 < n && s[++i] == 'x') ;\n\n inXSubstr = false;\n\n substrIndexes.Add((curSubsrtStart, i == n - 1 ? i : i - 1));\n }\n }\n\n foreach (var indexes in substrIndexes)\n {\n if (indexes.Item2 - indexes.Item1 > 1)\n {\n minToRemove += indexes.Item2 - indexes.Item1 - 1;\n }\n }\n\n Console.WriteLine(minToRemove);\n }\n\n static void Main(string[] args)\n {\n _978B();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test123\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberOfChars = Convert.ToInt32(Console.ReadLine());\n string inputString = Console.ReadLine();\n int toRemove = 0;\n \n Console.WriteLine(inputString);\n for(int i = 0; i < inputString.Length-2; i++)\n {\n string currentString = inputString.Substring(i, 3);\n Console.WriteLine(currentString);\n if(currentString.Contains(\"xxx\"))\n {\n toRemove++;\n }\n }\n Console.WriteLine(toRemove);\n }\n }\n}\n"}], "src_uid": "8de14db41d0acee116bd5d8079cb2b02"} {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int a = input[0];\n int b = input[1];\n int c = input[2];\n int n = input[3];\n if ((a < c) || (b < c) || (a + b - c < 0) || (c > n - 1) || (a + b - c > n - 1))\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n int result = n - (a + b - c);\n if (result >= 1)\n {\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(A < C || B < C){\n\t\t\tConsole.WriteLine(-1);\n\t\t\treturn;\n\t\t}\n\t\tif(A + B < C){\n\t\t\tConsole.WriteLine(-1);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tint n = A + B - C;\n\t\tif(N > n){\n\t\t\t\n\t\t\tConsole.WriteLine(N - n);\n\t\t} else {\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\t\n\t\t\n\t}\n\tint A, B, C, N;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tA = d[0]; B = d[1]; C = d[2]; N = d[3];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\n\nnamespace CF_991_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int A = int.Parse(s[0]);\n int B = int.Parse(s[1]);\n int C = int.Parse(s[2]);\n int N = int.Parse(s[3]);\n\n // if(A>N || B>N || C>N) \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430 5 \u0442\u0435\u0441\u0442\u0435\n\n if (A > N || B > N || C > N ||\n C > A || C > B)\n {\n Console.WriteLine(-1);\n return;\n }\n\n int k = N - (A + B - C);\n if (k <= 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1 {\n\tclass program {\n\t\tstatic void Main(string[] args) {\n\t\t\tstring str = Console.ReadLine();//\u4ece\u63a7\u5236\u53f0\u8bfb\u5165\u8f93\u5165\n\t\t\tstring[] nums = str.Split(new string[]{ \" \" }, StringSplitOptions.None);//\u8fd9\u91cc\u662f\u4ee5\u7a7a\u683c\u9694\u5f00\n\t\t\tint a = Convert.ToInt32(nums[0]);\n\t\t\tint b = Convert.ToInt32(nums[1]);\n\t\t\tint c = Convert.ToInt32(nums[2]);\n\t\t\tint d = Convert.ToInt32(nums[3]);\n\t\t\tint cnt = a-c+b;\n\t\t\tif (d-cnt<=0||a+b 100)\n return -1;\n byte b;\n if (!Byte.TryParse (words[1], out b))\n return -1;\n if (b > 100)\n return -1;\n byte c;\n if (!Byte.TryParse (words[2], out c))\n return -1;\n if (c > 100)\n return -1;\n byte n;\n if (!Byte.TryParse (words[3], out n))\n return -1;\n if (n > 100)\n return -1;\n short ans = Convert.ToInt16 (a >= c && b >= c ? a+b-c : -1);\n ans = Convert.ToInt16 (ans > -1 && n > ans ? n-ans : -1);\n Console.WriteLine (ans);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n int n = ReadInt();\n\n int d = n - a - b + c;\n\n if (d <= 0 || c > a || c > b)\n {\n Writer.WriteLine(-1);\n return;\n }\n\n Writer.WriteLine(d);\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace C_\n{\n class Program\n { \n private static TextReader Reader;\n private static TextWriter Writer;\n static void Main(string[] args)\n {\n\n\n new A().func();\n \n }\n }\n\npublic class A{\n public int min(int a, int b){\n if(aa || c>b || b>n || a>n || c>n){\n Console.WriteLine(\"-1\");\n return;\n }\n a-=c ; b-=c ;\n int total = a+b+c;\n if((n-total)<1) Console.WriteLine(\"-1\");\n else Console.WriteLine(n-total);\n } \n}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n #region Read / Write\n protected static TextReader reader;\n protected static TextWriter writer;\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n public struct Threesome\n {\n public Threesome(int item1, int item2, int item3)\n {\n Item1 = item1;\n Item2 = item2;\n Item3 = item3;\n }\n\n public int Item1;\n public int Item2;\n public int Item3;\n }\n\n public static bool NextPermutation(List perm)\n {\n for (int i = perm.Count - 2; i >= 0; i--)\n {\n if (perm[i] < perm[i + 1])\n {\n int min = i + 1;\n for (int j = min; j < perm.Count; j++)\n if (perm[j] > perm[i] && perm[j] < perm[min])\n min = j;\n\n int tmp = perm[i];\n perm[i] = perm[min];\n perm[min] = tmp;\n perm.Reverse(i + 1, perm.Count - i - 1);\n return true;\n }\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n int i;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //int n = ReadInt();\n //var inpMas = ReadIntArray();\n //int fiveCount = inpMas.Count(it => it == 5);\n //int need5 = n / 2 + (n & 1);\n //if (fiveCount >= need5)\n //{\n // Write(0);\n //}\n //else\n //{\n // Write(need5 - fiveCount);\n //}\n\n int A = ReadInt();\n int B = ReadInt();\n int C = ReadInt();\n int N = ReadInt();\n //var inpMas2 = ReadIntArray();\n\n if (A >= N || B >= N || C >= N || C > A || C > B)\n {\n Write(-1);\n }\n else\n {\n int ans = N - A - B + C;\n if (ans <= 0)\n ans = -1;\n\n Write(ans);\n //WriteArray(mas.Select(item => item[0]));\n }\n\n reader.Close();\n writer.Close();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _991A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n int n = int.Parse(tokens[3]);\n\n if (a + b - c > n | c > a || c > b)\n {\n Console.WriteLine(-1);\n }\n else\n {\n int failed = n - a - b + c;\n Console.WriteLine(failed <= 0 ? -1 : failed);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n string[] student = Console.ReadLine().Split(' ');\n int a = int.Parse(student[0]);\n int b = int.Parse(student[1]);\n int c = int.Parse(student[2]);\n int n = int.Parse(student[3]);\n if (a > n || b > n || c > a || c > b || ((a - c) + (b - c) + c >= n) || a == n || b == n)\n {\n Console.WriteLine(-1);\n }\n else \n {\n Console.WriteLine(n - ((a - c) + (b - c) + c));\n }\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] y = Console.ReadLine().Split(' ');\n int a = int.Parse(y[0]);\n int b = int.Parse(y[1]);\n int c = int.Parse(y[2]);\n int d = int.Parse(y[3]);\n int q = 0;\n int w = 0;\n int sum = 0;\n if ((a > d) || (b > d) || (c > d))\n Console.WriteLine(-1);\n else\n {\n q = a - c;\n w = b - c;\n if ((q < 0) || (w < 0))\n Console.WriteLine(-1);\n else\n {\n sum = q + w + c;\n if (sum > d)\n Console.WriteLine(-1);\n else\n {\n if (d - sum > 0)\n\n Console.WriteLine(d - sum);\n else\n Console.WriteLine(-1);\n }\n }\n\n }\n\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace comar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n int c = arr[2];\n int n = arr[3];\n if (c > a || c > b)\n {\n Console.WriteLine(-1);\n return;\n }\n int calc = n - ((a-c) + (b-c)+c);\n if (calc >=1)\n {\n Console.WriteLine(calc);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string []ast = s.Split(new char[]{' '});\n int a = int.Parse(ast[0]);\n int b = int.Parse(ast[1]);\n int c = int.Parse(ast[2]);\n int n = int.Parse(ast[3]);\n \n int otv = n - ((a - c) + (b - c) + c);\n if((otv > 0) && (n > c) && (a >= c) && (b >= c))\n Console.WriteLine(otv);\n else\n Console.WriteLine(\"-1\");\n } \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace If_at_first_you_dont_succeed\n{\n class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int A = Next(), B = Next(), C = Next(), N = Next();\n\n if (A > N || B > N || C > A || C > B)\n return -1;\n\n int ans = N - A - B + C;\n if (ans > 0)\n return ans;\n return -1;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Timers;\n\npublic class MainClass\n{\n private static object lockFile = new object();\n\n public static void Main(string[] args)\n {\n int[] abcn = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n int a = abcn[0];\n int b = abcn[1];\n int c = abcn[2];\n int n = abcn[3];\n\n int ans = n - (a + b - c);\n\n if (ans <= 0 || c > a || c>b) Console.WriteLine(-1);\n else Console.WriteLine(ans);\n\n\n // Console.ReadKey();\n }\n static decimal average (int [] ar)\n {\n decimal sum = 0;\n\n for (int i = 0; i < ar.Length; i++)\n {\n sum += ar[i];\n }\n\n decimal avg = sum / ar.Length;\n\n decimal fraction = avg - Math.Truncate(avg);\n if (fraction < 0.5m) return Math.Truncate(avg);\n\n return Math.Truncate(avg) + 1;\n }\n static void changeTheMark (int [] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (ar[i] != 5)\n {\n ar[i] = 5;\n break;\n }\n }\n }\n\n static long sum (long [] [] ar, int n)\n {\n long sum = 0;\n\n for (int i = 0; i < ar[n - 1].Length; i++)\n {\n sum += ar[n-1][i];\n }\n\n return sum;\n }\n\n static long [] [] solve (int n)\n {\n long[][] ar = new long[n][];\n\n for (int i = 0; i < n; i++)\n {\n ar[i] = new long[10];\n }\n\n for (int i = 0; i < 10; i++)\n {\n ar[0][i] = 1;\n }\n\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n if(j == 0)\n {\n ar[i][j] = ar[i - 1][j] + ar[i - 1][j + 1];\n }\n else if(j==9)\n {\n ar[i][j] = ar[i - 1][j] + ar[i - 1][j - 1];\n }\n else\n {\n ar[i][j] = ar[i - 1][j - 1] + ar[i - 1][j] + ar[i - 1][j + 1];\n } \n }\n }\n\n return ar;\n }\n private static long lowerBound(long w, long h, long n)\n {\n long lo = 1;\n long hi = Math.Max(w * n, h * n);\n long med = lo + (hi - lo) / 2;\n\n while (lo <= hi)\n {\n med = lo + (hi - lo) / 2;\n long ans = (med / w) * (med / h);\n Console.WriteLine(med + \" \" +ans);\n if (ans > n) hi = med - 1;\n else if (ans < n) lo = med + 1;\n else return med;\n }\n \n long ans2 = (med / w) * (med / h);\n return ans2 >=n ? med : med +1;\n }\n\n\n private static long sumOfNumbers(long n)\n {\n long sum = 0;\n\n while (n > 0)\n {\n sum += n % 10;\n n /= 10;\n }\n\n return sum;\n }\n private static long gcd (long a, long b)\n {\n return b== 0 ? a : gcd(b, a % b);\n }\n private static long[] getPowersOfTwoAnotherMethod()\n {\n long[] array = new long[63];\n\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = (long)Math.Pow(2, i);\n }\n\n return array;\n }\n\n private static void testOut(out int n)\n {\n n = 10;\n throw new InvalidOperationException(\"Inner exception\");\n }\n\n private static string toBinary(BigInteger n)\n {\n string res = \"\";\n\n while (n > 0)\n {\n res = n % 2 + res;\n n /= 2;\n }\n\n return res;\n }\n\n private static bool checkTheNumber(int n)\n {\n string binary = toBinary(n);\n\n return binary.Any(c => c == '0');\n }\n\n private static int findPosition(string[] array, int currentPosition)\n {\n for (int i = currentPosition; i < array.Length; i++)\n {\n if (array[i] == null) return i;\n }\n\n return -1;\n }\n\n private static int findPosition(int currentPosition, string[] array) => 0;\n\n private static void Foo(StringBuilder fooSb)\n {\n fooSb.Append(\"In method\");\n fooSb = null;\n }\n\n\n\n protected static void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)\n {\n int i = 0;\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(i++);\n }\n\n\n static void wrintInFile(char letter, int times, int sleepTime)\n {\n for (int i = 0; i < times; i++)\n {\n lock (lockFile)\n {\n using (StreamWriter writer = new StreamWriter(\"output.txt\", true))\n {\n writer.WriteLine($\"{letter}\\t{Thread.CurrentThread.ManagedThreadId}\\t{DateTime.Now}\");\n }\n\n Thread.Sleep(sleepTime);\n }\n }\n }\n\n private static async Task Test(int n)\n {\n Console.WriteLine(\"Inside await\");\n\n int res = 0;\n\n await Task.Run(() =>\n {\n for (int i = 0; i < n; i++)\n {\n res += i * i;\n Thread.Sleep(i);\n }\n });\n\n return res;\n }\n\n public static void getDirectories(string path)\n {\n DirectoryInfo directoryInfo = new DirectoryInfo(path);\n\n Console.WriteLine(directoryInfo.FullName);\n PrintAllFileNamesInDirectory(0, directoryInfo.GetFiles());\n\n DirectoryInfo[] directories = null;\n\n try\n {\n directories = directoryInfo.GetDirectories();\n\n foreach (var d in directories)\n {\n getDirectories(d.FullName);\n }\n }\n catch (Exception e)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(\"COULD NOT HAVE ACCESS TO FOLDER\");\n }\n\n }\n\n public static void PrintAllFileNamesInDirectory(int numberOfSpaces, FileInfo[] files)\n {\n foreach (FileInfo dir in files)\n {\n Console.WriteLine($\"{new string('\\t', numberOfSpaces)} {dir.FullName}\");\n }\n\n }\n\n\n\n}\n\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace C_\n{\n class Program\n { \n private static TextReader Reader;\n private static TextWriter Writer;\n static void Main(string[] args)\n {\n\n\n new A().func();\n \n }\n }\n\npublic class A{\n public int min(int a, int b){\n if(aa || c>b || b>n || a>n || c>n){\n Console.WriteLine(\"-1\");\n return;\n }\n a-=c ; b-=c ;\n int total = a+b;\n if((n-total)<1) Console.WriteLine(\"-1\");\n else Console.WriteLine(n-total);\n } \n}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _991A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n int n = int.Parse(tokens[3]);\n\n if (a + b > n | c > a || c > b)\n {\n Console.WriteLine(-1);\n }\n else\n {\n int failed = n - a - b + c;\n Console.WriteLine(failed <= 0 ? -1 : failed);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n string[] student = Console.ReadLine().Split(' ');\n int a = int.Parse(student[0]);\n int b = int.Parse(student[1]);\n int c = int.Parse(student[2]);\n int n = int.Parse(student[3]);\n if (a > n || b > n || c > a || c > b || ((a - c) + (b - c) + c == n))\n {\n Console.WriteLine(-1);\n }\n else \n {\n Console.WriteLine(n - ((a - c) + (b - c) + c));\n }\n }\n } \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n string[] student = Console.ReadLine().Split(' ');\n int a = int.Parse(student[0]);\n int b = int.Parse(student[1]);\n int c = int.Parse(student[2]);\n int n = int.Parse(student[3]);\n if (a > n || b > n || c > a || c > b || ((a - c) + (b - c) + c == n) || a == n || b == n)\n {\n Console.WriteLine(-1);\n }\n else \n {\n Console.WriteLine(n - ((a - c) + (b - c) + c));\n }\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n string[] student = Console.ReadLine().Split(' ');\n int a = int.Parse(student[0]);\n int b = int.Parse(student[1]);\n int c = int.Parse(student[2]);\n int n = int.Parse(student[3]);\n if (a > n || b > n || ((a - c) + (b - c) + c == n))\n {\n Console.WriteLine(-1); Console.ReadLine();\n }\n else \n {\n Console.WriteLine(n - ((a - c) + (b - c) + c));\n }\n }\n } \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace comar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n int c = arr[2];\n int n = arr[3];\n if (c > a && c > b)\n {\n Console.WriteLine(-1);\n return;\n }\n int calc = n - ((a+b) -c);\n if (calc >=1)\n {\n Console.WriteLine(calc);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace comar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n int c = arr[2];\n int n = arr[3];\n int calc = n - ((a+b) -c);\n if (calc >=1)\n {\n Console.WriteLine(calc);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace comar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n int c = arr[2];\n int n = arr[3];\n if (c > a && c > b)\n {\n Console.WriteLine(-1);\n return;\n }\n int calc = n - ((a-c) + (b-c)+c);\n if (calc >=1)\n {\n Console.WriteLine(calc);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int a = input[0];\n int b = input[1];\n int c = input[2];\n int n = input[3];\n if ((a < c) || (b < c) || (a + b - c < 0) || (c > n - 1) || (a + b - c > n -1)) {\n Console.WriteLine(\"-1\");\n }\n else {\n int result = n - (a + b - c);\n if (result > 1)\n {\n Console.WriteLine(result);\n }\n else {\n Console.WriteLine(\"-1\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int a = input[0];\n int b = input[1];\n int c = input[2];\n int n = input[3];\n if ((a + b - c < 0) || (c > n - 1)) {\n Console.WriteLine(\"-1\");\n }\n else {\n int result = n - (a + b - c);\n if (result > 1)\n {\n Console.WriteLine(result);\n }\n else {\n Console.WriteLine(\"-1\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string []ast = s.Split(new char[]{' '});\n int a = int.Parse(ast[0]);\n int b = int.Parse(ast[1]);\n int c = int.Parse(ast[2]);\n int n = int.Parse(ast[3]);\n \n int otv = n - ((a - c) + (b - c) + c);\n if((otv > 0) && (n > c) && (a > c) && (b > c))\n Console.WriteLine(otv);\n else\n Console.WriteLine(\"-1\");\n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string []ast = s.Split(new char[]{' '});\n int a = int.Parse(ast[0]);\n int b = int.Parse(ast[1]);\n int c = int.Parse(ast[2]);\n int n = int.Parse(ast[3]);\n \n int otv = n - ((a - c) + (b - c) + c);\n if((otv > 0) && (n > c))\n Console.WriteLine(otv);\n else\n Console.WriteLine(\"-1\");\n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string []ast = s.Split(new char[]{' '});\n int a = int.Parse(ast[0]);\n int b = int.Parse(ast[1]);\n int c = int.Parse(ast[2]);\n int n = int.Parse(ast[3]);\n \n int otv = n - ((a - c) + (b - c) + c);\n if(otv > 0)\n Console.WriteLine(otv);\n else\n Console.WriteLine(\"-1\");\n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Timers;\n\npublic class MainClass\n{\n private static object lockFile = new object();\n\n public static void Main(string[] args)\n {\n int[] abcn = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n int a = abcn[0];\n int b = abcn[1];\n int c = abcn[2];\n int n = abcn[3];\n\n int ans = n - (a + b - c);\n\n if (ans <= 0) Console.WriteLine(-1);\n else Console.WriteLine(ans);\n\n\n // Console.ReadKey();\n }\n static decimal average (int [] ar)\n {\n decimal sum = 0;\n\n for (int i = 0; i < ar.Length; i++)\n {\n sum += ar[i];\n }\n\n decimal avg = sum / ar.Length;\n\n decimal fraction = avg - Math.Truncate(avg);\n if (fraction < 0.5m) return Math.Truncate(avg);\n\n return Math.Truncate(avg) + 1;\n }\n static void changeTheMark (int [] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (ar[i] != 5)\n {\n ar[i] = 5;\n break;\n }\n }\n }\n\n static long sum (long [] [] ar, int n)\n {\n long sum = 0;\n\n for (int i = 0; i < ar[n - 1].Length; i++)\n {\n sum += ar[n-1][i];\n }\n\n return sum;\n }\n\n static long [] [] solve (int n)\n {\n long[][] ar = new long[n][];\n\n for (int i = 0; i < n; i++)\n {\n ar[i] = new long[10];\n }\n\n for (int i = 0; i < 10; i++)\n {\n ar[0][i] = 1;\n }\n\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n if(j == 0)\n {\n ar[i][j] = ar[i - 1][j] + ar[i - 1][j + 1];\n }\n else if(j==9)\n {\n ar[i][j] = ar[i - 1][j] + ar[i - 1][j - 1];\n }\n else\n {\n ar[i][j] = ar[i - 1][j - 1] + ar[i - 1][j] + ar[i - 1][j + 1];\n } \n }\n }\n\n return ar;\n }\n private static long lowerBound(long w, long h, long n)\n {\n long lo = 1;\n long hi = Math.Max(w * n, h * n);\n long med = lo + (hi - lo) / 2;\n\n while (lo <= hi)\n {\n med = lo + (hi - lo) / 2;\n long ans = (med / w) * (med / h);\n Console.WriteLine(med + \" \" +ans);\n if (ans > n) hi = med - 1;\n else if (ans < n) lo = med + 1;\n else return med;\n }\n \n long ans2 = (med / w) * (med / h);\n return ans2 >=n ? med : med +1;\n }\n\n\n private static long sumOfNumbers(long n)\n {\n long sum = 0;\n\n while (n > 0)\n {\n sum += n % 10;\n n /= 10;\n }\n\n return sum;\n }\n private static long gcd (long a, long b)\n {\n return b== 0 ? a : gcd(b, a % b);\n }\n private static long[] getPowersOfTwoAnotherMethod()\n {\n long[] array = new long[63];\n\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = (long)Math.Pow(2, i);\n }\n\n return array;\n }\n\n private static void testOut(out int n)\n {\n n = 10;\n throw new InvalidOperationException(\"Inner exception\");\n }\n\n private static string toBinary(BigInteger n)\n {\n string res = \"\";\n\n while (n > 0)\n {\n res = n % 2 + res;\n n /= 2;\n }\n\n return res;\n }\n\n private static bool checkTheNumber(int n)\n {\n string binary = toBinary(n);\n\n return binary.Any(c => c == '0');\n }\n\n private static int findPosition(string[] array, int currentPosition)\n {\n for (int i = currentPosition; i < array.Length; i++)\n {\n if (array[i] == null) return i;\n }\n\n return -1;\n }\n\n private static int findPosition(int currentPosition, string[] array) => 0;\n\n private static void Foo(StringBuilder fooSb)\n {\n fooSb.Append(\"In method\");\n fooSb = null;\n }\n\n\n\n protected static void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)\n {\n int i = 0;\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(i++);\n }\n\n\n static void wrintInFile(char letter, int times, int sleepTime)\n {\n for (int i = 0; i < times; i++)\n {\n lock (lockFile)\n {\n using (StreamWriter writer = new StreamWriter(\"output.txt\", true))\n {\n writer.WriteLine($\"{letter}\\t{Thread.CurrentThread.ManagedThreadId}\\t{DateTime.Now}\");\n }\n\n Thread.Sleep(sleepTime);\n }\n }\n }\n\n private static async Task Test(int n)\n {\n Console.WriteLine(\"Inside await\");\n\n int res = 0;\n\n await Task.Run(() =>\n {\n for (int i = 0; i < n; i++)\n {\n res += i * i;\n Thread.Sleep(i);\n }\n });\n\n return res;\n }\n\n public static void getDirectories(string path)\n {\n DirectoryInfo directoryInfo = new DirectoryInfo(path);\n\n Console.WriteLine(directoryInfo.FullName);\n PrintAllFileNamesInDirectory(0, directoryInfo.GetFiles());\n\n DirectoryInfo[] directories = null;\n\n try\n {\n directories = directoryInfo.GetDirectories();\n\n foreach (var d in directories)\n {\n getDirectories(d.FullName);\n }\n }\n catch (Exception e)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(\"COULD NOT HAVE ACCESS TO FOLDER\");\n }\n\n }\n\n public static void PrintAllFileNamesInDirectory(int numberOfSpaces, FileInfo[] files)\n {\n foreach (FileInfo dir in files)\n {\n Console.WriteLine($\"{new string('\\t', numberOfSpaces)} {dir.FullName}\");\n }\n\n }\n\n\n\n}\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint n = A + B - C;\n\t\tif(N > n){\n\t\t\t\n\t\t\tConsole.WriteLine(N - n);\n\t\t} else {\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\t\n\t\t\n\t}\n\tint A, B, C, N;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tA = d[0]; B = d[1]; C = d[2]; N = d[3];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\n\nnamespace CF_991_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int A = int.Parse(s[0]);\n int B = int.Parse(s[1]);\n int C = int.Parse(s[2]);\n int N = int.Parse(s[3]);\n\n if(A>N || B>N || C>N)\n {\n Console.WriteLine(-1);\n return;\n }\n\n int k = N - (A + B - C);\n if (k <= 0)\n Console.WriteLine(-1);\n else\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n #region Read / Write\n protected static TextReader reader;\n protected static TextWriter writer;\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n public struct Threesome\n {\n public Threesome(int item1, int item2, int item3)\n {\n Item1 = item1;\n Item2 = item2;\n Item3 = item3;\n }\n\n public int Item1;\n public int Item2;\n public int Item3;\n }\n\n public static bool NextPermutation(List perm)\n {\n for (int i = perm.Count - 2; i >= 0; i--)\n {\n if (perm[i] < perm[i + 1])\n {\n int min = i + 1;\n for (int j = min; j < perm.Count; j++)\n if (perm[j] > perm[i] && perm[j] < perm[min])\n min = j;\n\n int tmp = perm[i];\n perm[i] = perm[min];\n perm[min] = tmp;\n perm.Reverse(i + 1, perm.Count - i - 1);\n return true;\n }\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n int i;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n int A = ReadInt();\n int B = ReadInt();\n int C = ReadInt();\n int N = ReadInt();\n //var inpMas2 = ReadIntArray();\n\n if (A >= N || B >= N || C >= N)\n {\n Write(-1);\n return;\n }\n\n int ans = N - A - B + C;\n if (ans <= 0)\n ans = -1;\n\n Write(ans);\n //WriteArray(mas.Select(item => item[0]));\n\n reader.Close();\n writer.Close();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n #region Read / Write\n protected static TextReader reader;\n protected static TextWriter writer;\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n public struct Threesome\n {\n public Threesome(int item1, int item2, int item3)\n {\n Item1 = item1;\n Item2 = item2;\n Item3 = item3;\n }\n\n public int Item1;\n public int Item2;\n public int Item3;\n }\n\n public static bool NextPermutation(List perm)\n {\n for (int i = perm.Count - 2; i >= 0; i--)\n {\n if (perm[i] < perm[i + 1])\n {\n int min = i + 1;\n for (int j = min; j < perm.Count; j++)\n if (perm[j] > perm[i] && perm[j] < perm[min])\n min = j;\n\n int tmp = perm[i];\n perm[i] = perm[min];\n perm[min] = tmp;\n perm.Reverse(i + 1, perm.Count - i - 1);\n return true;\n }\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n int i;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n int A = ReadInt();\n int B = ReadInt();\n int C = ReadInt();\n int N = ReadInt();\n //var inpMas2 = ReadIntArray();\n\n int ans = N - A - B + C;\n if (ans <= 0)\n ans = -1;\n\n Write(ans);\n //WriteArray(mas.Select(item => item[0]));\n\n reader.Close();\n writer.Close();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task\n{\n class Program\n {\n #region Read / Write\n protected static TextReader reader;\n protected static TextWriter writer;\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n public struct Threesome\n {\n public Threesome(int item1, int item2, int item3)\n {\n Item1 = item1;\n Item2 = item2;\n Item3 = item3;\n }\n\n public int Item1;\n public int Item2;\n public int Item3;\n }\n\n public static bool NextPermutation(List perm)\n {\n for (int i = perm.Count - 2; i >= 0; i--)\n {\n if (perm[i] < perm[i + 1])\n {\n int min = i + 1;\n for (int j = min; j < perm.Count; j++)\n if (perm[j] > perm[i] && perm[j] < perm[min])\n min = j;\n\n int tmp = perm[i];\n perm[i] = perm[min];\n perm[min] = tmp;\n perm.Reverse(i + 1, perm.Count - i - 1);\n return true;\n }\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n int i;\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //int n = ReadInt();\n //var inpMas = ReadIntArray();\n //int fiveCount = inpMas.Count(it => it == 5);\n //if (fiveCount * 2 >= n)\n //{\n // Write(0);\n //}\n //else\n //{\n // Write();\n //}\n\n int A = ReadInt();\n int B = ReadInt();\n int C = ReadInt();\n int N = ReadInt();\n //var inpMas2 = ReadIntArray();\n\n if (A >= N || B >= N || C >= N)\n {\n Write(-1);\n }\n else\n {\n\n int ans = N - A - B + C;\n if (ans <= 0)\n ans = -1;\n\n Write(ans);\n //WriteArray(mas.Select(item => item[0]));\n }\n\n reader.Close();\n writer.Close();\n }\n }\n}"}], "src_uid": "959d56affbe2ff5dd999a7e8729f60ce"} {"source_code": "\nusing System;\n\nnamespace CodeForces.Archieve\n{\n public static class Program\n {\n public static void Main(string[] args)\n {\n int n = 0, k = 0;\n string[] input = Console.ReadLine().Split(' ');\n \n n = int.Parse(input[0]);\n k = int.Parse(input[1]);\n\n string str = Console.ReadLine();\n\n int[] first = new int[26];\n int[] last = new int[26];\n for (int i = 0; i < 26; ++i)\n {\n first[i] = int.MaxValue;\n last[i] = -1;\n }\n for (int i = 0; i < str.Length; ++i)\n {\n int crt = str[i] - 'A';\n if (i < first[crt])\n {\n first[crt] = i;\n }\n if (i > last[crt])\n {\n last[crt] = i;\n }\n }\n\n bool ans = true;\n int cnt = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n int crt = str[i] - 'A';\n if (i == first[crt])\n {\n ++cnt;\n }\n\n if (cnt > k)\n {\n ans = false;\n break;\n }\n\n if (i == last[crt])\n {\n --cnt;\n }\n }\n\n if (ans)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Coding\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = x[0];\n var k = x[1];\n\n var s = Console.ReadLine();\n\n var cnt = 0;\n var fst = new int[26];\n var lst = new int[26];\n\n for (int i = 0; i < 26; i++)\n {\n fst[i] = -1;\n lst[i] = -1;\n }\n \n for (int i = 0; i < s.Length; i++)\n {\n var c = (int)(s[i] - 'A');\n\n if (fst[c] == -1)\n {\n fst[c] = i;\n }\n\n lst[c] = i;\n }\n\n for (int i = 0; i < s.Length; i++)\n {\n var c = (int)(s[i] - 'A');\n if (fst[c] == i)\n {\n cnt++;\n }\n\n if (cnt > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (lst[c] == i)\n {\n cnt--;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R426B.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R426B();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R426B : ProblemBase\n {\n private class Info\n {\n public int Start { get; set; }\n public int Finish { get; set; }\n }\n\n public override IEnumerable GetResults()\n {\n var usage = new Dictionary();\n var ints = this.ReadIntArray();\n var n = ints[0];\n var k = ints[1];\n\n var line = Console.ReadLine();\n for (int i = 0; i < line.Length; i++)\n {\n var current = line[i];\n if (!usage.ContainsKey(current))\n {\n usage.Add(current, new Info { Start = i });\n }\n usage[current].Finish = i;\n }\n\n var problemFound = false;\n foreach (var candidate in usage.Keys)\n {\n var t = usage[candidate].Start;\n var total = 0;\n foreach (var key in usage.Keys)\n {\n if (usage[key].Start <= t && usage[key].Finish >= t)\n {\n total++;\n }\n }\n\n if (total > k)\n {\n problemFound = true;\n break;\n }\n }\n\n yield return problemFound ? \"YES\" : \"NO\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in this.GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _834\n{\n class Program\n {\n static void Main(string[] args)\n {\n B();\n Console.WriteLine();\n }\n\n private static void B()\n {\n var s = Console.ReadLine();\n var sp = s.Split(' ');\n var n = sp[0];\n var k = int.Parse(sp[1]);\n var s1 = Console.ReadLine();\n var m = new Dictionary>();\n\n for (char i = 'A'; i < 91; i++)\n {\n var f = s1.IndexOf(i);\n var l = s1.LastIndexOf(i);\n if (f > -1)\n {\n m.Add(i, new Tuple(f, l));\n }\n }\n\n int g = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n var nn = m.Count(u => u.Value.Item1 <= i && u.Value.Item2 >= i);\n if (nn > k)\n {\n Console.Write(\"YES\");\n return;\n }\n }\n Console.Write(\"NO\");\n }\n\n private static void A()\n {\n var s = Console.ReadLine();\n var sp = s.Split(' ');\n var first = sp[0];\n var second = sp[1];\n var f1 = 0;\n var f2 = 0;\n switch (first)\n {\n case \"^\": f1 = 0; break;\n case \">\": f1 = 1; break;\n case \"v\": f1 = 2; break;\n case \"<\": f1 = 3; break;\n }\n switch (second)\n {\n case \"^\": f2 = 0; break;\n case \">\": f2 = 1; break;\n case \"v\": f2 = 2; break;\n case \"<\": f2 = 3; break;\n }\n var he = int.Parse(Console.ReadLine());\n he = he % 4;\n if ((f1 - f2) % 2 == 0)\n {\n Console.Write(\"undefined\");\n return;\n }\n if ((f1 + he) % 4 == f2)\n {\n Console.Write(\"cw\");\n }\n else\n {\n Console.Write(\"ccw\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TorzestevennijVe4er\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n\n string guests = Console.ReadLine();\n\n Dictionary last = new Dictionary();\n Dictionary first = new Dictionary();\n\n for (int i=0;ik)\n {\n ans = true;\n break;\n }\n\n if (last[guests[i]] == i) open--;\n }\n\n if (ans)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int n = input[0];\n int k = input[1];\n string str = Console.ReadLine();\n\n if (k == 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n var lastPositions = new Dictionary();\n int openGatesCount = 0;\n for (int i = 0; i < n; i++)\n {\n int lastPosition;\n char gate = str[i];\n if (!lastPositions.ContainsKey(gate))\n {\n openGatesCount++;\n if (openGatesCount > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n lastPosition = str.LastIndexOf(gate);\n lastPositions.Add(gate, lastPosition);\n }\n else\n {\n lastPosition = lastPositions[gate];\n }\n if (lastPosition == i)\n {\n openGatesCount--;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Festive_Evening\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n var close = new int['Z' - 'A' + 1];\n for (int i = 0; i < n; i++)\n {\n close[nn[i]] = i;\n }\n\n int opened = 0;\n int maxopened = 0;\n var f = new bool[close.Length];\n for (int i = 0; i < n; i++)\n {\n if (!f[nn[i]])\n {\n opened++;\n f[nn[i]] = true;\n }\n\n maxopened = Math.Max(maxopened, opened);\n\n if (close[nn[i]] == i)\n {\n opened--;\n }\n }\n\n writer.WriteLine(maxopened > k ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c >= 'A' && c <= 'Z')\n return c - 'A';\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace WithConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = input[0];\n var k = input[1];\n var s = Console.ReadLine();\n\n var guestsByDoor = new int[26];\n var doorWasOpened = new bool[26];\n\n for (var i = 0; i < s.Length; ++i)\n {\n int door = s[i] - 'A';\n ++guestsByDoor[door];\n }\n\n bool @unsafe = false;\n for (var i = 0; i < s.Length; ++i)\n {\n int door = s[i] - 'A';\n if (!doorWasOpened[door])\n {\n if (k == 0)\n {\n @unsafe = true;\n break;\n }\n else\n {\n --k;\n doorWasOpened[door] = true;\n }\n }\n --guestsByDoor[door];\n if (guestsByDoor[door] == 0)\n {\n ++k;\n }\n }\n Console.WriteLine(@unsafe ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp54\n{\n class Program\n {\n static void Main(string[] args)\n {\n //64\n int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = inp0[0];\n int k = inp0[1];\n char[] a = Console.ReadLine().ToCharArray();\n int[] alph = new int[27];\n for (int i = 0; i < n; i++)\n {\n alph[a[i] - 64]++;\n }\n int open = 0;\n bool check = true;\n int[] doors = new int[27];\n for (int i = 0; i < n; i++)\n {\n if (doors[a[i]-64]==0)\n {\n open++;\n }\n doors[a[i] - 64]++;\n alph[a[i] - 64]--;\n if (open>k)\n {\n check = false;\n break;\n }\n if (alph[a[i]-64]==0)\n {\n open--;\n }\n }\n if (check)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nnamespace _834B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]), k = int.Parse(input[1]);\n string s = Console.ReadLine();\n int[] last = new int[26];\n for (int i = 0; i < 26; i++)\n last[i] = -1;\n for (int i = n - 1; i >= 0; i--)\n if (last[s[i] - 'A'] == -1)\n last[s[i] - 'A'] = i;\n bool result = false;\n bool[] used = new bool[26];\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n int j = s[i] - 'A';\n if (!used[j])\n {\n used[j] = true;\n cnt++;\n }\n if (cnt > k)\n {\n result = true;\n break;\n }\n if (last[j] == i)\n {\n used[j] = false;\n cnt--;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FestiveEvening\n{\n class Program\n {\n public class Guard\n {\n public int id { get; set; }\n public Door door { get; set; }\n }\n\n public class Door\n {\n public bool closed { get; set; } = false;\n \n public bool guarded { get; set; }\n }\n\n static void Main(string[] args)\n {\n int[] line1 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int gt = line1[0];\n int gd = line1[1];\n\n string guests = Console.ReadLine();\n Dictionary doors = new Dictionary();\n Dictionary remaining = new Dictionary();\n foreach(char c in guests)\n {\n if(!remaining.ContainsKey(c))\n {\n remaining.Add(c, 0);\n }\n remaining[c]++;\n }\n String result = \"NO\";\n for(int i=0; i(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose) {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n //'A' - 65\n public static int CharToInt(char c) {\n return ((int) c - 65);\n }\n\n public static int AlphabetSize = 26;\n\n public static void Main(string[] args) {\n int[] firsts = new int[AlphabetSize];\n int[] lasts = new int[AlphabetSize];\n\n for (int i = 0; i < AlphabetSize; i++) {\n firsts[i] = (int)1.0e7;\n lasts[i] = (int)1.0e7;\n }\n\n long n, k;\n GetTwoInts(out n, out k);\n string guests = Rw();\n\n for (int i = 0; i < n; i++) {\n int index = CharToInt(guests[i]);\n if (firsts[index] == (int)1.0e7)\n firsts[index] = i;\n lasts[index] = i;\n }\n\n Array.Sort(firsts);\n Array.Sort(lasts);\n {\n int i = 0;\n int j = 0;\n int count = 0;\n while (i < AlphabetSize && firsts[i] != (int) 1.0e7 && j < AlphabetSize && lasts[j] != (int) 1.0e7) {\n if (firsts[i] == lasts[j]) {\n i++;\n count++;\n if (count > k) {\n Console.WriteLine(\"YES\");\n return;\n }\n j++;\n count--;\n }\n else if (firsts[i] < lasts[j]) {\n i++;\n count++;\n }\n else {\n j++;\n count--;\n }\n if (count > k) {\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n\n }\n Console.WriteLine(\"NO\");\n\n\n return;\n\n ans:\n Console.WriteLine(-1);\n return;\n\n }\n\n public static string Rw() { return Console.ReadLine(); }\n\n public static long GetInt() { return Int64.Parse(Rw()); }\n public static long[] GetIntArr() { return Array.ConvertAll(Rw().Split(' '), Int64.Parse); }\n\n public static double GetDouble() { return Double.Parse(Rw()); }\n public static double[] GetDoubleArr() { return Array.ConvertAll(Rw().Split(' '), DoubleParse); }\n public static double DoubleParse(string s) { return Double.Parse(s, NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo(\"en-US\")); }\n\n public static void GetTwoInts(out long n, out long m)\n {\n long[] input = GetIntArr();\n n = input[0];\n m = input[1];\n }\n\n public const long Module = 1000000000 + 7;\n public const long Max = (long)1.0e18;\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algoritms\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, k, open = 0;\n string s;\n string ans = \"NO\";\n long[] mass = new long[100];\n bool[] stat = new bool[100];\n string[] con = Console.ReadLine().Split(' ');\n n = long.Parse(con[0]);\n k = long.Parse(con[1]);\n s = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n mass[s[i]] += 1;\n }\n for (int i = 0; i < n; i++)\n {\n if (stat[s[i]] == false)\n {\n stat[s[i]] = true;\n open += 1;\n mass[s[i]] -= 1;\n }\n else mass[s[i]] -= 1;\n\n if (open > k) ans = \"YES\";\n\n if (mass[s[i]] <= 0)\n {\n stat[s[i]] = false;\n open -= 1;\n }\n }\n\n Console.WriteLine(ans);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] toks = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int n = toks[0];\n int k = toks[1];\n int[][] mass = new int[26][];\n for(int i = 0; i < mass.Length; i++)\n {\n int[] temp = { -1, -1 };\n mass[i] = temp;\n }\n string s = Console.ReadLine();\n for(int i = 0; i < n; i++)\n {\n int cur = s[i] - 65;\n if (mass[cur][0] == -1 )\n {\n mass[cur][0] = i;\n mass[cur][1] = i;\n }\n mass[cur][1] = i;\n }\n\n int count = 0;\n for(int i = 0; i < n; i++)\n {\n int temp = 0;\n for(int j = 0; j < 26; j++)\n {\n if(i >= mass[j][0] && i <= mass[j][1])\n {\n temp++;\n }\n }\n if (temp > count)\n count = temp;\n }\n if(count > k)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n \n\tclass B\n\t{\n\t static char[] alphabets = new char[26]{'A','B','C','D','E','F','G','H','I','J'\n\t ,'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\t \n\t \n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t string[] token = Console.ReadLine().Split();\n\t\t int n = int.Parse(token[0]);\n\t\t int k = int.Parse(token[1]);\n\t\t bool[] state = new bool[26];\n\t\t int[] lastOcc = new int[26];\n\t\t \n\t\t string s = Console.ReadLine();\n\t\t for(int i=0;ik)\n\t\t {\n\t\t Console.WriteLine(\"YES\");\n\t\t return;\n\t\t }\n\t\t \n\t\t if(i==lastOcc[Index(s[i])])\n\t\t {\n\t\t state[Index(s[i])] = false;\n\t\t tOdds--;\n\t\t }\n\t\t }\n\t\t \n\t\t Console.WriteLine(\"NO\");\n\t\t}\n\t\t\n\t\tstatic int Index(char alpha)\n\t\t{\n\t\t int val = 0;\n\t\t for(int i=0;i= 0)\n {\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Festive.Evening\n{\n class Program\n {\n static void Main(string[] args)\n {\n var message = \"NO\";\n var input1 = Console.ReadLine();\n var array = input1.Split(' ');\n StringBuilder s = new StringBuilder();\n s.Append(Console.ReadLine());\n HashSet openDoors = new HashSet();\n SortedList peoplePerDoor = new SortedList();\n\n s.ToString().Distinct().ToList().ForEach(d => peoplePerDoor.Add(d, 0));\n var invites = int.Parse(array[0]);\n var guards = int.Parse(array[1]);\n if (s.ToString().Count(c => c == s[0]) == invites && guards >= 1)\n {\n Console.WriteLine(message);\n }\n else\n {\n s.ToString().ToCharArray().ToList().ForEach(d => peoplePerDoor[d]++);\n \n for (int i = 0; i < invites; i++)\n {\n var door = s[i];\n if (!openDoors.Contains(door))\n {\n openDoors.Add(door);\n guards--;\n }\n\n if (guards < 0)\n {\n message = \"YES\";\n break;\n }\n\n peoplePerDoor[door]--;\n if (peoplePerDoor[door]==0)\n {\n openDoors.Remove(door);\n guards++;\n }\n\n \n }\n Console.WriteLine(message);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int guardians;\n {\n int[] a;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n guardians = int.Parse(input[1]);\n int[] first = new int[26], last = new int[26];\n a = new int[input[2].Length];\n for (int i = 1; i < input[2].Length;)\n {\n a[i]=input[2][i] - 65;\n if (first[a[i]] == 0) first[a[i]] = i;\n last[a[i]] = i++;\n }\n first[a[0]=input[2][0] - 65] = 0;\n input = null;\n for (int i = 0; i < a.Length;)\n {\n if (first[a[i]] == i) if (--guardians < 0) break;\n if (last[a[i]] == i++) guardians++;\n }\n } }\n Console.WriteLine(guardians < 0 ? \"YES\" : \"NO\");\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _834B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n string s = Console.ReadLine();\n\n int[] open = new int[n];\n foreach (var group in Enumerable.Range(0, n).GroupBy(i => s[i], i => i))\n {\n int min = int.MaxValue;\n int max = int.MinValue;\n\n foreach (int index in group)\n {\n min = Math.Min(min, index);\n max = Math.Max(max, index);\n }\n\n for (int i = min; i <= max; i++)\n {\n if (++open[i] > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n \npublic class Program\n{\n public static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n Console.WriteLine(Solve(input1, input2));\n }\n \n public static string Solve(string input1, string guests)\n {\n var input1Args = input1.Split(' ');\n var numberOfGuests = int.Parse(input1Args[0]);\n var numberOfGuards = int.Parse(input1Args[1]);\n\n return WasADoorUnwarded(numberOfGuards, guests);\n }\n\n private static string WasADoorUnwarded(int numberOfGuards, string guests)\n {\n var lastPositionMap = GetLastPositionsMap(guests);\n var guardsPositions = new HashSet();\n var nextAvailableGuard = numberOfGuards;\n for (var i = 0; i < guests.Length; i++)\n {\n var currentGuest = guests[i];\n if (guardsPositions.Contains(currentGuest))\n {\n if (lastPositionMap[currentGuest] == i)\n {\n nextAvailableGuard++;\n guardsPositions.Remove(currentGuest);\n }\n continue;\n }\n if (nextAvailableGuard == 0) return \"YES\";\n if (!(lastPositionMap[currentGuest] == i))\n {\n nextAvailableGuard--;\n guardsPositions.Add(currentGuest);\n }\n }\n\n return \"NO\";\n }\n\n private static Dictionary GetLastPositionsMap(string guests)\n {\n var lastPositionMap = new Dictionary();\n for (var i = 0; i < guests.Length; i++)\n {\n if (lastPositionMap.ContainsKey(guests[i]))\n {\n lastPositionMap[guests[i]] = i;\n }\n else\n {\n lastPositionMap.Add(guests[i], i);\n }\n }\n\n return lastPositionMap;\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tbool[] used = new bool[26];\n\t\tint[] L = new int[26];\n\t\tint[] R = new int[26];\n\t\tfor(int i=0;i=0;i--){\n\t\t\tL[S[i] - 'A'] = i;\n\t\t\tused[S[i] - 'A'] = true;\n\t\t}\n\t\t\n\t\tint[] imos = new int[N+1];\n\t\tfor(int i=0;i<26;i++){\n\t\t\tif(used[i]){\n\t\t\t\timos[L[i]]++;\n\t\t\t\timos[R[i]+1]--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[] sum = new int[N+1];\n\t\tfor(int i=0;i K) chk = true;\n\t\t}\n\t\tConsole.WriteLine(chk ? \"YES\":\"NO\");\n\t\t\n\t}\n\tint N,K;\n\tString S;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tN = d[0]; K = d[1];\n\t\tS = rs();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string[] str = Console.ReadLine().Split();\n static int guest = int.Parse(str[0]);\n static int def = int.Parse(str[1]);\n static string all = \"\";\n static int[] count = new int[26];\n static bool[] free = new bool[26];\n static bool fill = true;\n\n static int Check(string a) \n {\n if (a == \"A\") { if (fill == true) { count[0]++; free[0] = false; } else { if (free[0] == false) { free[0] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[0]--; if (count[0] == 0) def++; } }\n if (a == \"B\") { if (fill == true) { count[1]++; free[1] = false; } else { if (free[1] == false) { free[1] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[1]--; if (count[1] == 0) def++; } }\n if (a == \"C\") { if (fill == true) { count[2]++; free[2] = false; } else { if (free[2] == false) { free[2] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[2]--; if (count[2] == 0) def++; } }\n if (a == \"D\") { if (fill == true) { count[3]++; free[3] = false; } else { if (free[3] == false) { free[3] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[3]--; if (count[3] == 0) def++; } }\n if (a == \"E\") { if (fill == true) { count[4]++; free[4] = false; } else { if (free[4] == false) { free[4] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[4]--; if (count[4] == 0) def++; } }\n if (a == \"F\") { if (fill == true) { count[5]++; free[5] = false; } else { if (free[5] == false) { free[5] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[5]--; if (count[5] == 0) def++; } }\n if (a == \"G\") { if (fill == true) { count[6]++; free[6] = false; } else { if (free[6] == false) { free[6] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[6]--; if (count[6] == 0) def++; } }\n if (a == \"H\") { if (fill == true) { count[7]++; free[7] = false; } else { if (free[7] == false) { free[7] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[7]--; if (count[7] == 0) def++; } }\n if (a == \"I\") { if (fill == true) { count[8]++; free[8] = false; } else { if (free[8] == false) { free[8] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[8]--; if (count[8] == 0) def++; } }\n if (a == \"J\") { if (fill == true) { count[9]++; free[9] = false; } else { if (free[9] == false) { free[9] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[9]--; if (count[9] == 0) def++; } }\n if (a == \"K\") { if (fill == true) { count[10]++; free[10] = false; } else { if (free[10] == false) { free[10] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[10]--; if (count[10] == 0) def++; } }\n if (a == \"L\") { if (fill == true) { count[11]++; free[11] = false; } else { if (free[11] == false) { free[11] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[11]--; if (count[11] == 0) def++; } }\n if (a == \"M\") { if (fill == true) { count[12]++; free[12] = false; } else { if (free[12] == false) { free[12] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[12]--; if (count[12] == 0) def++; } }\n if (a == \"N\") { if (fill == true) { count[13]++; free[13] = false; } else { if (free[13] == false) { free[13] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[13]--; if (count[13] == 0) def++; } }\n if (a == \"O\") { if (fill == true) { count[14]++; free[14] = false; } else { if (free[14] == false) { free[14] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[14]--; if (count[14] == 0) def++; } }\n if (a == \"P\") { if (fill == true) { count[15]++; free[15] = false; } else { if (free[15] == false) { free[15] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[15]--; if (count[15] == 0) def++; } }\n if (a == \"Q\") { if (fill == true) { count[16]++; free[16] = false; } else { if (free[16] == false) { free[16] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[16]--; if (count[16] == 0) def++; } }\n if (a == \"R\") { if (fill == true) { count[17]++; free[17] = false; } else { if (free[17] == false) { free[17] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[17]--; if (count[17] == 0) def++; } }\n if (a == \"S\") { if (fill == true) { count[18]++; free[18] = false; } else { if (free[18] == false) { free[18] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[18]--; if (count[18] == 0) def++; } }\n if (a == \"T\") { if (fill == true) { count[19]++; free[19] = false; } else { if (free[19] == false) { free[19] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[19]--; if (count[19] == 0) def++; } }\n if (a == \"U\") { if (fill == true) { count[20]++; free[20] = false; } else { if (free[20] == false) { free[20] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[20]--; if (count[20] == 0) def++; } }\n if (a == \"V\") { if (fill == true) { count[21]++; free[21] = false; } else { if (free[21] == false) { free[21] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[21]--; if (count[21] == 0) def++; } }\n if (a == \"W\") { if (fill == true) { count[22]++; free[22] = false; } else { if (free[22] == false) { free[22] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[22]--; if (count[22] == 0) def++; } }\n if (a == \"X\") { if (fill == true) { count[23]++; free[23] = false; } else { if (free[23] == false) { free[23] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[23]--; if (count[23] == 0) def++; } }\n if (a == \"Y\") { if (fill == true) { count[24]++; free[24] = false; } else { if (free[24] == false) { free[24] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[24]--; if (count[24] == 0) def++; } }\n if (a == \"Z\") { if (fill == true) { count[25]++; free[25] = false; } else { if (free[25] == false) { free[25] = true; def--; if (def < 0) { Console.WriteLine(\"YES\"); Environment.Exit(0); } } count[25]--; if (count[25] == 0) def++; } }\n\n return 0;\n }\n\n static void Main(string[] args)\n {\n for (int i = 0; i < 26; i++)\n free[i] = true;\n\n all = Console.ReadLine();\n\n for (int i = 0; i < guest; i++)\n {\n Check(all[i].ToString());\n }\n \n fill = false;\n\n for (int i = 0; i < guest; i++)\n {\n Check(all[i].ToString());\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ca834B\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var security = Convert.ToInt32(input[1]);\n var qu = Console.ReadLine();\n var result = \"NO\";\n var lastPos = new int[26];\n var dictDoor = new Dictionary();\n for (int i = 0; i < qu.Length; i++)\n {\n lastPos[qu[i] - 65] = i;\n }\n for (int i = 0; i < qu.Length; i++)\n {\n if (!dictDoor.ContainsKey(qu[i] - 65))\n dictDoor[qu[i] - 65] = true;\n if (dictDoor.Keys.Count > security)\n result = \"YES\";\n if (lastPos[qu[i] - 65] == i)\n dictDoor.Remove(qu[i] - 65);\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var n = int.Parse(s[0]);\n var k = int.Parse(s[1]);\n\n var s1 = Console.ReadLine();\n var dict = new Dictionary>();\n for (int i = 0; i < n; i++)\n {\n if(dict.ContainsKey(s1[i]))\n dict[s1[i]].Add(i);\n else\n {\n dict.Add(s1[i], new List() {i});\n }\n }\n\n int opened = 0;\n for (int i = 0; i < n; i++)\n {\n if (dict[s1[i]].First() == i)\n {\n opened++;\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n \n if (dict[s1[i]].Last() == i)\n {\n opened--;\n }\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n \n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n\n\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n\n public class ListNode\n {\n public string val;\n public ListNode next;\n public ListNode(string x) { val = x; }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces_Round_num426__Div._2_\n{\n class Program\n {\n static void Main(string[] args)\n {\n func2();\n }\n \n\n static void func2()\n {\n var aa = Console.ReadLine();\n var a = aa.Split(' ');\n var guestCount = Int32.Parse(a[0]);\n var secCount = Int32.Parse(a[1]);\n var str = Console.ReadLine();\n Dictionary d = new Dictionary();\n for (int i = 0; i < str.Length; i++)\n {\n var c = str[i];\n if (!d.ContainsKey(c))\n {\n d.Add(c, new[] { i, i });\n }\n else\n {\n d[c][1] = i;\n }\n }\n var arr = new int[str.Length];\n var carr = new int[arr.Length];\n foreach (var t in d)\n {\n arr[t.Value[0]]++;\n carr[t.Value[1]]++;\n }\n var maxOpenDoors = 0;\n var openDoors = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n openDoors += arr[i];\n if (openDoors > maxOpenDoors)\n maxOpenDoors = openDoors;\n openDoors -= carr[i];\n }\n if (maxOpenDoors > secCount)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.ReadInt();\n int k = input.ReadInt();\n var s = input.ReadToken();\n var l = new int[26];\n for (int i = 0; i < n; i++)\n l[s[i] - 'A'] = i;\n var u = new bool[26];\n for (int i = 0; i < n; i++)\n {\n var j = s[i] - 'A';\n if (!u[j])\n {\n if (k == 0)\n {\n Console.Write(\"YES\");\n return;\n }\n u[j] = true;\n k--;\n }\n if (l[j] == i)\n k++;\n }\n Console.Write(\"NO\");\n }\n\n private bool OnOneLine(int xa, int ya, int xb, int yb, int xc, int yc)\n {\n return (yb - yc) * xa + (xc - xb) * ya + (xb * yc - xc * yb) == 0;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n,k;\n\n string entrances;\n\n int[] last = new int[30];\n bool[] opened = new bool[30];\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n k = ioHelper.ReadNextInt();\n\n entrances = ioHelper.ReadNextToken();\n\n int i;\n for (i = 0; i < n; i++)\n last[entrances[i] - 'A'] = i;\n\n int curGuards = 0;\n bool bYes = false;\n\n for(i=0;ik)\n {\n bYes = true;\n break;\n }\n\n if (i == last[entrances[i] -'A'])\n {\n curGuards--;\n opened[entrances[i] - 'A'] = false;\n }\n }\n\n if (bYes)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace ACM\n{\n class Program\n {\n static void Swap(ref T x, ref T y)\n {\n T t = y;\n y = x;\n x = t;\n }\n\n public static bool NextPermutation(T[] elements) where T : IComparable\n {\n var count = elements.Length;\n var done = true;\n\n for (var i = count - 1; i > 0; i--)\n {\n var curr = elements[i];\n if (curr.CompareTo(elements[i - 1]) < 0) continue;\n done = false;\n var prev = elements[i - 1];\n var currIndex = i;\n for (var j = i + 1; j < count; j++)\n {\n var tmp = elements[j];\n\n if (tmp.CompareTo(curr) < 0 && tmp.CompareTo(prev) > 0)\n {\n curr = tmp;\n currIndex = j;\n }\n }\n\n elements[currIndex] = prev;\n elements[i - 1] = curr;\n\n for (var j = count - 1; j > i; j--, i++)\n {\n var tmp = elements[j];\n elements[j] = elements[i];\n elements[i] = tmp;\n }\n break;\n }\n return done;\n }\n\n public static int[] GetArr()\n {\n return Console.ReadLine().Split(' ').ToList().Select(r => int.Parse(r)).ToArray();\n }\n\n public static long[] GetLongArr()\n {\n return Console.ReadLine().Split(' ').ToList().Select(r => long.Parse(r)).ToArray();\n }\n\n public static int GetInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static long GetLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n public static int[,] GetMatrix(int n, int m)\n {\n int[,] a = new int[n, m];\n for (int i = 0; i < n; i++)\n {\n int[] x = GetArr();\n for (int j = 0; j < m; j++)\n a[i, j] = x[j];\n }\n return a;\n }\n\n public static void PrintArr(int[] a)\n {\n for (int i = 0; i < a.Count(); i++)\n Console.Write(a[i] + \" \");\n Console.WriteLine();\n }\n \n static void Main()\n {\n int[] f = GetArr();\n int n = f[0];\n int k = f[1];\n string s = Console.ReadLine();\n\n int[] open = new int[256];\n int[] closed = new int[256];\n \n for(int i = 0; i < n; i++)\n {\n if (open[s[i]] == 0) open[s[i]] = i + 1;\n }\n\n for (int i = n-1; i >= 0; i--)\n {\n if (closed[s[i]] == 0) closed[s[i]] = i + 1;\n }\n\n int[] a = new int[n+1];\n for (int i = 'A'; i <= 'Z'; i++)\n {\n if ( open[i] > 0 ) a[open[i] - 1]++;\n if ( closed[i] > 0 ) a[closed[i] ]--;\n }\n int res = 0;\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += a[i];\n if (sum > k) res = 1;\n }\n Console.WriteLine(res > 0 ? \"YES\" : \"NO\");\n }\n }\n} "}, {"source_code": "using System;\nnamespace CodeForces {\n class Solve834B {\n const int MAX_GUESTS = 1000000 + 5;\n int n, k;\n string gates;\n int[] openTimes;\n int[] closeTimes;\n int maxOpenGatesCount = 0;\n\n public void readInput() {\n var parts = Console.ReadLine().Split(' ');\n this.n = int.Parse(parts[0]);\n this.k = int.Parse(parts[1]);\n this.gates = Console.ReadLine();\n }\n\n public void printAnswer() {\n string unguarded = this.k < this.maxOpenGatesCount ? \"YES\" : \"NO\";\n Console.WriteLine(unguarded);\n }\n\n public void solve() {\n getOpenCloseTimes();\n getMaxOpenGates();\n }\n\n private void getOpenCloseTimes() {\n this.openTimes = new int[26];\n this.closeTimes = new int[26];\n\n for (int i = 0; i < 26; i++) {\n this.openTimes[i] = -1;\n this.closeTimes[i] = -1;\n }\n\n for (int i = 0; i < this.gates.Length; i++) {\n int gateNum = convertGateToNum(this.gates[i]);\n if (this.openTimes[gateNum] == -1) {\n this.openTimes[gateNum] = i;\n }\n\n this.closeTimes[gateNum] = i;\n }\n }\n\n private int convertGateToNum(char gate) {\n return (int)gate - (int)'A';\n }\n\n private void getMaxOpenGates() {\n for (int i = 0; i < this.n; i++) {\n int openGatesCount = 0;\n for (int gateNum = 0; gateNum < 26; gateNum++) {\n if (this.isGateOpen(gateNum, i)) {\n openGatesCount++;\n }\n }\n\n if (openGatesCount > maxOpenGatesCount) {\n this.maxOpenGatesCount = openGatesCount;\n }\n }\n }\n\n private bool isGateOpen(int gateNum, int time) {\n return this.openTimes[gateNum] <= time && time <= this.closeTimes[gateNum];\n }\n }\n\n class Runner {\n public static void Main() {\n Solve834B solver = new Solve834B();\n\n solver.readInput();\n solver.solve();\n solver.printAnswer();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace task2\n{\n class Program\n {\n static void Main()\n {\n var doors = new bool[26];\n var count = new int[26];\n var input = Console.ReadLine().Split(' ');\n var order = Console.ReadLine().ToCharArray();\n var guards = int.Parse(input[1]);\n\n foreach (var guest in order)\n {\n count[Index(guest)]++;\n }\n\n foreach (var guest in order)\n {\n if (!doors[Index(guest)])\n {\n if (guards-- == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n doors[Index(guest)] = true;\n }\n if (--count[Index(guest)] != 0) continue;\n doors[Index(guest)] = true;\n guards++;\n }\n\n Console.WriteLine(\"NO\");\n }\n\n private static int Index(char a)\n {\n return a - 65;\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string[] achar = a.Split(new Char[] { ' ' });\n int n =Convert.ToInt32(achar[0]);\n int k = Convert.ToInt32(achar[1]);\n char[] bchar = b.ToCharArray();\n int s = 0; \n for (int i = 0; i < n-1; i++)\n {\n if (bchar[i] != bchar[i + 1])\n {\n for (int j = i + 1; j < n; j++)\n {\n if (bchar[i] == bchar[j])\n {\n k--;\n }\n }\n }\n }\n if(k <= 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string[] achar = a.Split(new Char[] { ' ' });\n int n =Convert.ToInt32(achar[0]);\n int k = Convert.ToInt32(achar[1]);\n char[] bchar = b.ToCharArray();\n int s = 0; \n for (int i = 0; i < n-1; i++)\n {\n if (bchar[i] != bchar[i + 1])\n {\n for (int j = i + 1; j < n; j++)\n {\n if (bchar[i] == bchar[j])\n {\n k--;\n }\n }\n }\n }\n if(k < 0)\n {\n Console.WriteLine(\"Spizdili\");\n }\n else\n {\n Console.WriteLine(\"Ne spizdili\");\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string[] achar = a.Split(new Char[] { ' ' });\n int n =Convert.ToInt32(achar[0]);\n int k = Convert.ToInt32(achar[1]);\n char[] bchar = b.ToCharArray();\n char ch = '.';\n for (int i = 0; i < bchar.Length - 1; i++)\n {\n if(bchar[i] != bchar[i+1] && bchar[i+1] != ch)\n {\n ch = bchar[i];\n k--;\n }\n }\n if(k < 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n string[] achar = a.Split(new Char[] { ' ' });\n int n =Convert.ToInt32(achar[0]);\n int k = Convert.ToInt32(achar[1]);\n char[] bchar = b.ToCharArray();\n int s = 0; \n for (int i = 0; i < n-1; i++)\n {\n if (bchar[i] != bchar[i + 1])\n {\n for (int j = i + 1; j < n; j++)\n {\n if (bchar[i] == bchar[j])\n {\n k--;\n }\n }\n }\n }\n if(k < 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace WithConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = input[0];\n var k = input[1];\n var s = Console.ReadLine();\n\n var guestsByDoor = new int[26];\n var doorWasOpened = new bool[26];\n\n for (var i = 0; i < s.Length; ++i)\n {\n int door = s[i] - 'A';\n ++guestsByDoor[door];\n }\n\n bool result = true;\n for (var i = 0; i < s.Length; ++i)\n {\n int door = s[i] - 'A';\n if (!doorWasOpened[door])\n {\n if (k == 0)\n {\n result = false;\n break;\n }\n else\n {\n --k;\n doorWasOpened[door] = true;\n }\n }\n --guestsByDoor[door];\n if (guestsByDoor[door] == 0)\n {\n ++k;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n //'A' - 65\n public static int CharToInt(char c) {\n return ((int) c - 65);\n }\n\n public static int AlphabetSize = 26;\n\n public static void Main(string[] args) {\n int[] firsts = new int[AlphabetSize];\n int[] lasts = new int[AlphabetSize];\n\n for (int i = 0; i < AlphabetSize; i++) {\n firsts[i] = (int)1.0e7;\n lasts[i] = (int)1.0e7;\n }\n\n long n, k;\n GetTwoInts(out n, out k);\n string guests = Rw();\n\n for (int i = 0; i < n; i++) {\n int index = CharToInt(guests[i]);\n if (firsts[index] == (int)1.0e7)\n firsts[index] = i;\n lasts[index] = i;\n }\n\n Array.Sort(firsts);\n Array.Sort(lasts);\n {\n int i = 0;\n int j = 0;\n int count = 0;\n while (i < AlphabetSize && firsts[i] != (int) 1.0e7 && j < AlphabetSize && lasts[j] != (int) 1.0e7) {\n if (firsts[i] == lasts[j]) {\n i++;\n j++;\n }\n else if (firsts[i] < lasts[j]) {\n i++;\n count++;\n }\n else {\n j++;\n count--;\n }\n if (count > k) {\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n\n }\n Console.WriteLine(\"NO\");\n\n\n return;\n\n ans:\n Console.WriteLine(-1);\n return;\n\n }\n\n public static string Rw() { return Console.ReadLine(); }\n\n public static long GetInt() { return Int64.Parse(Rw()); }\n public static long[] GetIntArr() { return Array.ConvertAll(Rw().Split(' '), Int64.Parse); }\n\n public static double GetDouble() { return Double.Parse(Rw()); }\n public static double[] GetDoubleArr() { return Array.ConvertAll(Rw().Split(' '), DoubleParse); }\n public static double DoubleParse(string s) { return Double.Parse(s, NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo(\"en-US\")); }\n\n public static void GetTwoInts(out long n, out long m)\n {\n long[] input = GetIntArr();\n n = input[0];\n m = input[1];\n }\n\n public const long Module = 1000000000 + 7;\n public const long Max = (long)1.0e18;\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var n = int.Parse(s[0]);\n var k = int.Parse(s[1]);\n\n var s1 = Console.ReadLine();\n var dict = new Dictionary>();\n for (int i = 0; i < n; i++)\n {\n if(dict.ContainsKey(s1[i]))\n dict[s1[i]].Add(i);\n else\n {\n dict.Add(s1[i], new List() {i});\n }\n }\n\n int opened = 0;\n for (int i = 0; i < n; i++)\n {\n if (dict[s1[i]].First() == i && dict[s1[i]].Last() != i)\n opened++;\n else if (dict[s1[i]].Last() == i && dict[s1[i]].First() != i)\n opened--;\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n \n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n\n\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n\n public class ListNode\n {\n public string val;\n public ListNode next;\n public ListNode(string x) { val = x; }\n }\n}\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var n = int.Parse(s[0]);\n var k = int.Parse(s[1]);\n\n var s1 = Console.ReadLine();\n var dict = new Dictionary>();\n for (int i = 0; i < n; i++)\n {\n if(dict.ContainsKey(s1[i]))\n dict[s1[i]].Add(i);\n else\n {\n dict.Add(s1[i], new List() {i});\n }\n }\n\n int opened = 0;\n for (int i = 0; i < n; i++)\n {\n if (dict[s1[i]].First() == i)\n {\n opened++;\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n \n else if (dict[s1[i]].Last() == i)\n {\n opened--;\n }\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n \n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n\n\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n\n public class ListNode\n {\n public string val;\n public ListNode next;\n public ListNode(string x) { val = x; }\n }\n}\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var n = int.Parse(s[0]);\n var k = int.Parse(s[1]);\n\n var s1 = Console.ReadLine();\n var dict = new Dictionary>();\n for (int i = 0; i < s1.Length; i++)\n {\n if(dict.ContainsKey(s1[i]))\n dict[s1[i]].Add(i);\n else\n {\n dict.Add(s1[i], new List() {i});\n }\n }\n\n int opened = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (dict[s1[i]][0] == i)\n opened++;\n else if (dict[s1[i]].Last() == i)\n opened--;\n if (opened > k)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n \n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n\n\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n\n public class ListNode\n {\n public string val;\n public ListNode next;\n public ListNode(string x) { val = x; }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces_Round_num426__Div._2_\n{\n class Program\n {\n static void Main(string[] args)\n {\n func2();\n }\n \n\n static void func2()\n {\n var aa = Console.ReadLine();\n var a = aa.Split(' ');\n var guestCount = Int32.Parse(a[0]);\n var secCount = Int32.Parse(a[1]);\n var str = Console.ReadLine();\n Dictionary d = new Dictionary();\n for (int i = 0; i < str.Length; i++)\n {\n var c = str[i];\n if (!d.ContainsKey(c))\n {\n d.Add(c, new[] { i, i });\n }\n else\n {\n d[c][1] = i;\n }\n }\n var arr = new int[str.Length];\n var carr = new int[arr.Length];\n foreach (var t in d)\n {\n arr[t.Value[0]]++;\n carr[t.Value[1]]++;\n }\n var maxOpenDoors = 0;\n var openDoors = 0;\n for (int i = 0; i < arr.Length; i++)\n {\n openDoors += arr[i];\n openDoors -= carr[i];\n if (openDoors > maxOpenDoors)\n maxOpenDoors = openDoors;\n }\n if (maxOpenDoors > secCount)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TorzestevennijVe4er\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int k = int.Parse(s[1]);\n\n string guests = Console.ReadLine();\n\n Dictionary last = new Dictionary();\n Dictionary first = new Dictionary();\n\n for (int i=0;ik)\n {\n ans = true;\n break;\n }\n }\n\n if (ans)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Festive_Evening\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n var close = new int['Z' - 'A' + 1];\n for (int i = 0; i < n; i++)\n {\n close[nn[i]] = i;\n }\n\n int opened = 0;\n int maxopened = 0;\n var f = new bool[close.Length];\n for (int i = 0; i < n; i++)\n {\n if (!f[nn[i]])\n {\n opened++;\n f[nn[i]] = true;\n }\n\n if (close[nn[i]] == i)\n {\n opened--;\n }\n\n maxopened = Math.Max(maxopened, opened);\n }\n\n writer.WriteLine(maxopened > k ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c >= 'A' && c <= 'Z')\n return c - 'A';\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algoritms\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, k, open = 0;\n string s;\n string ans = \"NO\";\n long[] mass = new long[100];\n bool[] stat = new bool[100];\n string[] con = Console.ReadLine().Split(' ');\n n = long.Parse(con[0]);\n k = long.Parse(con[1]);\n s = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n mass[s[i]] += 1;\n }\n for (int i = 0; i < n; i++)\n {\n if (stat[s[i]] == false)\n {\n stat[s[i]] = true;\n open += 1;\n mass[s[i]] -= 1;\n }\n else mass[s[i]] -= 1;\n\n if (mass[s[i]] <= 0)\n {\n stat[s[i]] = false;\n open -= 1;\n }\n\n if (open > k) ans = \"YES\";\n }\n\n Console.WriteLine(ans);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] toks = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int n = toks[0];\n int k = toks[1];\n int[][] mass = new int[26][];\n for(int i = 0; i < mass.Length; i++)\n {\n int[] temp = { -1, -1 };\n mass[i] = temp;\n }\n string s = Console.ReadLine();\n for(int i = 0; i < n; i++)\n {\n int cur = s[i] - 65;\n if (mass[cur][0] == -1 )\n {\n mass[cur][0] = i;\n mass[cur][1] = i;\n }\n mass[cur][1] = i;\n }\n\n int count = 0;\n for(int i = 0; i < n; i++)\n {\n int temp = 0;\n for(int j = 0; j < 26; j++)\n {\n if(i >= mass[j][0] && i <= mass[j][1])\n {\n temp++;\n }\n if (mass[j][0] == -1)\n break;\n }\n if (temp > count)\n count = temp;\n }\n if(count > k)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n \npublic class Program\n{\n public static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n Console.WriteLine(Solve(input1, input2));\n }\n \n public static string Solve(string input1, string guests)\n {\n var input1Args = input1.Split(' ');\n var numberOfGuests = int.Parse(input1Args[0]);\n var numberOfGuards = int.Parse(input1Args[1]);\n\n return WasADoorUnwarded(numberOfGuards, guests);\n }\n\n private static string WasADoorUnwarded(int numberOfGuards, string guests)\n {\n var lastPositionMap = GetLastPositionsMap(guests);\n var guardsPositions = new HashSet();\n var nextAvailableGuard = numberOfGuards;\n for (var i = 0; i < guests.Length; i++)\n {\n var currentGuest = guests[i];\n if (lastPositionMap[currentGuest] == i) nextAvailableGuard++;\n if (guardsPositions.Contains(currentGuest)) continue;\n if (nextAvailableGuard == 0) return \"YES\";\n nextAvailableGuard--;\n guardsPositions.Add(currentGuest);\n }\n\n return \"NO\";\n }\n\n private static Dictionary GetLastPositionsMap(string guests)\n {\n var lastPositionMap = new Dictionary();\n for (var i = 0; i < guests.Length; i++)\n {\n if (lastPositionMap.ContainsKey(guests[i]))\n {\n lastPositionMap[guests[i]] = i;\n }\n else\n {\n lastPositionMap.Add(guests[i], i);\n }\n }\n\n return lastPositionMap;\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n \npublic class Program\n{\n public static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n Console.WriteLine(Solve(input1, input2));\n }\n \n public static string Solve(string input1, string guests)\n {\n var input1Args = input1.Split(' ');\n var numberOfGuests = int.Parse(input1Args[0]);\n var numberOfGuards = int.Parse(input1Args[1]);\n\n return WasADoorUnwarded(numberOfGuards, guests);\n }\n\n private static string WasADoorUnwarded(int numberOfGuards, string guests)\n {\n var lastPositionMap = GetLastPositionsMap(guests);\n var guardsPositions = new HashSet();\n var nextAvailableGuard = numberOfGuards;\n for (var i = 0; i < guests.Length; i++)\n {\n var currentGuest = guests[i];\n if (guardsPositions.Contains(currentGuest))\n {\n if (lastPositionMap[currentGuest] == i) nextAvailableGuard++;\n continue;\n }\n if (nextAvailableGuard == 0) return \"YES\";\n nextAvailableGuard--;\n guardsPositions.Add(currentGuest);\n }\n\n return \"NO\";\n }\n\n private static Dictionary GetLastPositionsMap(string guests)\n {\n var lastPositionMap = new Dictionary();\n for (var i = 0; i < guests.Length; i++)\n {\n if (lastPositionMap.ContainsKey(guests[i]))\n {\n lastPositionMap[guests[i]] = i;\n }\n else\n {\n lastPositionMap.Add(guests[i], i);\n }\n }\n\n return lastPositionMap;\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tbool[] used = new bool[26];\n\t\tint[] L = new int[26];\n\t\tint[] R = new int[26];\n\t\tfor(int i=0;i=0;i--){\n\t\t\tL[S[i] - 'A'] = i;\n\t\t\tused[S[i] - 'A'] = true;\n\t\t}\n\t\t\n\t\tint[] imos = new int[N+1];\n\t\tfor(int i=0;i<26;i++){\n\t\t\tif(used[i]){\n\t\t\t\timos[L[i]]++;\n\t\t\t\timos[R[i]+1]--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[] sum = new int[N+1];\n\t\tfor(int i=0;i K) chk = true;\n\t\t}\n\t\tConsole.WriteLine(chk ? \"YES\" : \"NO\");\n\t\t\n\t}\n\tint N,K;\n\tString S;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tN = d[0]; K = d[1];\n\t\tS = rs();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ca834B\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var security = Convert.ToInt32(input[1]);\n var qu = Console.ReadLine();\n var arr = new int[26];\n Array.Clear(arr, 0, arr.Length);\n var result = \"NO\";\n for (int i = 0; i < qu.Length; i++)\n {\n arr[qu[i] - 65]++;\n var open = (from p in arr\n where p == 1\n select 1).Count();\n if (open > security)\n result = \"YES\";\n }\n if ((from p in arr\n where p == 1\n select 1).Count() == arr.Length)\n {\n result = \"NO\";\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ca834B\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var security = Convert.ToInt32(input[1]);\n var qu = Console.ReadLine();\n var arr = new int[26];\n Array.Clear(arr, 0, arr.Length);\n var result = \"NO\";\n for (int i = 0; i < qu.Length; i++)\n {\n arr[qu[i] - 65]++;\n var open = (from p in arr\n where p == 1\n select 1).Count();\n if (open > security)\n result = \"YES\";\n }\n Console.WriteLine(result);\n }\n }\n}\n"}], "src_uid": "216323563f5b2dd63edc30cb9b4849a5"} {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Linq;\n\nnamespace CSharp_Contests\n{\n internal class Program\n {\n private static bool IsB(int number)\n {\n \n var bits = (new BitArray(new int[] {number})).OfType().Reverse().SkipWhile(a => a == false).ToArray();\n var ones = bits.TakeWhile(a => a).Count();\n var zeros = bits.Skip(ones).TakeWhile(a => a == false).Count();\n return ones + zeros == bits.Length && ones - 1 == zeros;\n }\n\n public static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n for (int i = number; i > 0; i--)\n {\n if (number %i == 0 && IsB(i))\n {\n Console.WriteLine(i);\n break;\n }\n }\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var InputNumber = a;\n var number = a;\n\n for (var q = 1; q < InputNumber; q++)\n {\n if (InputNumber % number != 0)\n {\n number--;\n continue;\n\n }\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = 0;\n if (intArray.Length % 2 == 0)\n {\n middle = (intArray.Length / 2) + 1;\n }\n else\n {\n middle = intArray.Length / 2 + intArray.Length % 2;\n }\n\n if (middle == intArray.Length)\n {\n number--;\n continue;\n }\n if (intArray.Length == 4)\n {\n number--;\n continue;\n }\n bool Ones = true;\n for (var i = 0; i < middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n if (intArray.Length % 2 == 0)\n {\n number--;\n continue;\n }\n\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] deliters = { 32640, 8128, 2016, 496, 120, 28, 6, 1 };\n foreach (int deliter in deliters)\n if (n%deliter==0)\n {\n Console.WriteLine(deliter);\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var n= int.Parse(Console.ReadLine());\n var list = new List() {1,6,28,120,496,2016,8128,32640};\n for (int i = list.Count - 1; i >= 0; i--)\n {\n if (n >= list[i] && n%list[i] == 0)\n {\n Console.WriteLine(list[i]);\n return;\n }\n }\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n //////////////////////////////\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n for (int i = n; i > 0; i--)\n {\n if (n % i == 0 && isBeauty(i))\n {\n Console.Write(i);\n break;\n }\n }\n }\n\n private static bool isBeauty(int n)\n {\n var s = Convert.ToString(n, 2);\n var c1 = s.TakeWhile(c => c == '1').Count();\n var c0 = s.Skip(c1).TakeWhile(c => c == '0').Count();\n return c1 + c0 == s.Length && c1 == c0 + 1;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp = Console.ReadLine().Split().Select(item => Int32.Parse(item)).ToArray();\n String tmp = Convert.ToString(inp[0], 2), res = \"\", response =\"\";\n bool flag = false;\n res += \"1\";\n for (int i = 0; i < tmp.Length; ++i)\n {\n if (inp[0] >= FromBinary(res))\n {\n if(inp[0] % FromBinary(res) == 0)\n {\n response = res;\n }\n res = \"1\" + res;\n res += \"0\";\n }\n else\n {\n break;\n }\n }\n Console.WriteLine(FromBinary(response));\n //Console.ReadKey();\n }\n\n static int FromBinary(string input)\n {\n int big = new int();\n foreach (var c in input)\n {\n big <<= 1;\n big += c - '0';\n }\n\n return big;\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint l = int.Parse(Console.ReadLine());\n\t\tint k = 0;\n\t\tfor(int x = 1;x=2){\n\t\t\tint d=(int)(a/2);\n\t\t\tost = a-(2*d);\n\t\t\ta=d;\n\t\t\to+=\"\"+ost;\n\t\t}\n\t\to+=\"\"+a;\n\t\t\n\t\t\n\t\tfor(int x = o.Length-1;x>=0;x--){\n\t\t\to2+=o[x];\n\t\t}\n\t\t\n\t\treturn o2;\n\t}\n\t\n\tpublic static bool CheckPerfecto(string g){\n\t\tint zero = 0;\n\t\tint numb = 0;\n\t\t\n\t\tint len = g.Length;\n\t\t\n\t\tfloat numbcount = ((float)len-1)/2;\n\t\t\n\t\tif (numbcount-(int)numbcount==0) {\n\t\t\tif(Sum(g.Substring((int)numbcount+1,(int)numbcount))==0 && Sum(g.Substring(0,(int)numbcount+1))==(int)numbcount+1){\n\t\t\t\treturn true;\t\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\n\tpublic static int Sum(string g){\n\t\tint sum = 0;\n\t\tforeach(char a in g){\n\t\t\tsum+=int.Parse(a+\"\");\n\t\t}\n\t\treturn sum;\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = (int)Math.Ceiling(Math.Log(n, 2));\n if (count % 2 == 0)\n count--;\n int rez = 0;\n do\n {\n string str = new string('1', count / 2 + 1) + new string('0', count / 2);\n count -= 2;\n rez = Convert.ToInt32(str, 2);\n }\n while (n % rez != 0);\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] prekr = new int[8] {1,6,28,120,496,2016,8128,32640};\n int ch = int.Parse(Console.ReadLine().Trim());\n int rez = 0;\n for (int i = 7; i >= 0; i--) {\n if (ch % prekr[i] == 0) {\n rez = prekr[i];\n break;\n }\n }\n Console.WriteLine(rez);\n// Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _893B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Enumerable.Range(1, n).Where(d => n % d == 0 && IsBeautiful(d)).Max());\n }\n\n private static bool IsBeautiful(int n)\n {\n string binary = Convert.ToString(n, 2);\n int k = binary.Length / 2;\n return binary.Take(k + 1).All(c => c == '1') && binary.Reverse().Take(k).All(c => c == '0');\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n\n /*\n * \u4e8c\u9032\u8868\u73fe\u304c\u9023\u7d9ak+1\u500b1,k\u500b0\u306a\u3089\u7f8e\u3057\u3044\n * \n * n\u306e\u7d04\u6570\u6700\u5927\n */\n\n int ans = 1;\n for (int k = 1; ; k++)\n {\n var tmp = ((1 << k) - 1) * (1 << (k - 1));\n if(tmp <= n)\n {\n if (n % tmp == 0) ans = tmp;\n }\n else\n {\n break;\n }\n }\n\n Console.WriteLine(ans);\n\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var N = sc.Int;\n for (int i = N; i >= 1; i--)\n if (N % i == 0)\n {\n var n = i;\n int b = 30;\n for (; b >= 0; b--)\n if (n % (1<>= b;\n int c = 30;\n for (; c >= 0; c--)\n if (n == (1 << c) - 1) break;\n if (c == b + 1) Fail(i);\n }\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Linq;\n\nnamespace CSharp_Contests\n{\n internal class Program\n {\n private static int zeros, ones, number, mask = 0;\n private const int stop = 1 << 25;\n\n public static void Main()\n {\n number = int.Parse(Console.ReadLine());\n\n for (int i = number; i > 0; i--)\n {\n if (number % i == 0)\n {\n zeros = ones = 0;\n mask = 1;\n while ((i & mask) == 0)\n {\n zeros++;\n mask <<= 1;\n }\n while ((i & mask) == mask)\n {\n ones++;\n mask <<= 1;\n }\n while (mask < stop)\n {\n if ((i & mask) != 0)\n {\n ones = zeros = 0;\n break;\n }\n mask <<= 1;\n }\n if (ones == zeros + 1)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Beautiful_Divisors\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n int n = Next();\n\n var s = new Stack();\n for (int i = 0;; i++)\n {\n int p = (1 << i)*((2 << i) - 1);\n if (p > n)\n break;\n s.Push(p);\n }\n return s.FirstOrDefault(l => n%l == 0);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Beautiful_Divisors\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n int n = Next();\n\n var s = new Stack();\n for (int i = 0;; i++)\n {\n int p = ((2 << i) - 1) << i;\n if (p > n)\n break;\n s.Push(p);\n }\n return s.FirstOrDefault(l => n%l == 0);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace _893B\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long result = 0;\n for (int j = 1; j < 25; j++)\n {\n long num = ((1L << j) - 1L) * (1L << (j - 1));\n if (num <= n && n % num == 0 && num > result)\n result = num;\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceProblemSolve\n{\n class B\n {\n\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = 0;\n\n int i = 1;\n while (i <= n)\n {\n if (n % i == 0)\n {\n\n for (int j = 0; j <= i; j++)\n {\n if((Math.Pow(2, j) - 1) * Math.Pow(2, j - 1) == i)\n {\n if (i > m)\n {\n m = i;\n }\n }\n }\n /*string s = Convert.ToString(i, 2);\n\n int zero = 0, one = 0;\n for (int j = 0; j < s.Length; j++)\n {\n if (s[j] == '0')\n {\n zero++;\n }\n else\n {\n one++;\n }\n }\n if ((one == zero + 1) && ( (Math.Pow(2,i)-1)*Math.Pow(2,i-1) == i))\n {\n if (i > m)\n {\n m = i;\n }\n }*/\n\n }\n i++;\n }\n\n Console.WriteLine(m);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n {\n var k = 0;\n var curr = n;\n while (curr % 2 == 0)\n {\n curr >>= 1;\n k++;\n }\n if (curr == (1 << (k + 1)) - 1)\n return n;\n }\n if (n == 1)\n return 1;\n for (var i = n / 2; i >= 1; i--)\n {\n if (n % i == 0)\n {\n var k = 0;\n var curr = i;\n while (curr % 2 == 0)\n {\n curr >>= 1;\n k++;\n }\n if (curr == (1 << (k + 1)) - 1)\n return i;\n }\n }\n throw new Exception(\"huj\");\n }\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n }\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var pows = new long[20];\n var val = 1;\n pows[0] = 1;\n for (var i = 1; i < pows.Length; i++) {\n val *= 2;\n pows[i] = val;\n }\n var divisors = new List();\n for (var k = 1; k < pows.Length; k++) {\n var next = (pows[k] - 1) * (pows[k - 1]);\n divisors.Add(next);\n }\n for (var i = divisors.Count - 1; i >= 0; i--) {\n if (n % divisors[i] == 0) {\n sw.WriteLine(divisors[i]);\n return;\n }\n }\n throw new InvalidOperationException();\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class B\n { \n static void Main(string[] args)\n { \n int n = int.Parse(Console.ReadLine());\n \n int k = 2;\n \n for(int i=10;i>=1;i--)\n {\n double num = (Math.Pow(2,i) - 1) * Math.Pow(2,i-1);\n if(n%num==0){\n k = (int)num;\n break;\n }\n } \n Console.WriteLine(k);\n\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int[] niceDigits = new int[8] { 1, 6, 28, 120, 496, 2016, 8128, 32640 };\n\n int a = int.Parse(Console.ReadLine().Trim());\n\n int rez = 0;\n\n for (int i = 7; i >= 0; i--)\n {\n if (a % niceDigits[i] == 0)\n {\n rez = niceDigits[i];\n break;\n }\n }\n\n Console.WriteLine(rez);\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "// Problem: 893B - Beautiful Divisors\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass BeautifulDivisors\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n uint n;\n if (!UInt32.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 100000)\n return -1;\n uint ans = 0;\n for (uint i = 1; i <= n && ans == 0; i++)\n {\n if (n%i > 0)\n continue;\n uint divisor = n/i;\n uint tmpConvBin = divisor;\n byte countZero = 0;\n byte countOne = 0;\n bool solved = true;\n bool procZero = true;\n while (tmpConvBin > 0 && solved)\n {\n byte digitBin = Convert.ToByte (tmpConvBin%2);\n tmpConvBin /= 2;\n if (digitBin == 0)\n {\n if (procZero)\n countZero++;\n else\n solved = false;\n }\n else\n {\n if (procZero)\n {\n procZero = false;\n countOne = 1;\n }\n else\n {\n countOne++;\n if (countOne > countZero+1)\n solved = false;\n }\n }\n }\n if (solved && countOne == countZero+1)\n ans = divisor;\n }\n Console.WriteLine (ans > 0 ? ans : 1);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace b\n{\n class Program\n {\n static IEnumerable GetButifulNumbers(uint n) {\n for (int i = 1;i<15;i++) {\n yield return (uint)(Math.Pow(2, i) - 1) * (uint)(Math.Pow(2, i- 1));\n }\n }\n static void Main(string[] args)\n {\n var butiful = GetButifulNumbers(10000).ToList();\n var input = uint.Parse(Console.ReadLine());\n var gcdButiful = butiful.Last(i => input%i == 0);\n Console.WriteLine(gcdButiful);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Cs\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ans = 0, n = Convert.ToInt32(Console.ReadLine());\n for(int k = 1; k <= 10; ++k)\n {\n if (n % (((1 << k) - 1) * (1 << k - 1)) == 0)\n {\n ans = ((1 << k) - 1) * (1 << k - 1);\n }\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tfor(int i = n; i >= 1; i--)\n\t\t{\n\t\t\tstring binary = Convert.ToString(i, 2);\n\t\t\tint q1 = 0;\n\t\t\tbool w1 = true;\n\t\t\tint q2 = 0;\n\t\t\tbool w2 = true;\n\t\t\tfor(int j = 0; j < binary.Length; j++)\n\t\t\t{\n\t\t\t\tif(binary[j] == '1' && w1)\n\t\t\t\t{\n\t\t\t\t\tq1++;\n\t\t\t\t}\n\t\t\t\telse if(binary[j] == '0')\n\t\t\t\t{\n\t\t\t\t\tw1 = false;\n\t\t\t\t\tq2++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tw2 = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(w2)\n\t\t\t{\n\t\t\t\tif(n % i != 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\tif(q1 == q2+1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\t\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Beautiful_Divisors\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n for(int i=n;i>0;i--)\n {\n if (n % i != 0)\n continue;\n string binary = Convert.ToString(i, 2);\n int ones = 0;\n int zeroes = 0;\n bool flag = false;\n bool correct = true;\n int count = 0;\n while(count!=binary.Length)\n {\n if (!flag)\n {\n if(binary[count]=='1')\n {\n ones++;\n count++;\n }\n else\n {\n zeroes++;\n flag = true;\n count++;\n }\n }\n else\n {\n if(binary[count]=='0')\n {\n zeroes++;\n count++;\n }\n else\n {\n correct = false;\n break;\n }\n }\n }\n if(correct&&ones-1==zeroes)\n {\n Console.WriteLine(i);\n break;\n }\n \n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var inputNumber = a;\n var divider = a;\n\n for (var q = 1; q < inputNumber; q++)\n {\n if (inputNumber % divider != 0)//\u0438\u0449\u0435\u043c \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c\n {\n divider--;\n continue;\n }\n string binaryCode = Convert.ToString(divider, 2);\n char[] charArray = binaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)char.GetNumericValue(c));\n int middle = 0;\n //if (intArray.Length % 2 == 0)\n //{\n // middle = intArray.Length / 2 +1;\n //}\n //else\n //{\n // middle = intArray.Length / 2 + 1;\n //}\n if (intArray.Length % 2 == 0)\n {\n divider--;\n continue;\n }\n middle = intArray.Length / 2 + 1;\n if (middle == intArray.Length)\n {\n divider--;\n continue;\n }\n\n\n //if (intArray.Length == 4)\n //{\n // divider--;\n // continue;\n //}\n bool Ones = true;\n for (var i = 0; i < middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n divider--;\n continue;\n }\n\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n divider--;\n continue;\n }\n\n return divider;\n\n }\n return divider;\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n for (int i = n; i > 0; i--)\n {\n if (isBeauty(i))\n {\n Console.Write(i);\n break;\n }\n }\n }\n\n private static bool isBeauty(int n)\n {\n var s = Convert.ToString(n, 2);\n var c1 = s.TakeWhile(c => c == '1').Count();\n var c0 = s.Skip(c1).TakeWhile(c => c == '0').Count();\n return c1 + c0 == s.Length && c1 == c0 + 1;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint l = int.Parse(Console.ReadLine());\n\t\tint k = 0;\n\t\tfor(int x = 1;x=2){\n\t\t\tint d=(int)(a/2);\n\t\t\tost = a-(2*d);\n\t\t\ta=d;\n\t\t\to+=\"\"+ost;\n\t\t}\n\t\to+=\"\"+a;\n\t\t\n\t\t\n\t\tfor(int x = o.Length-1;x>=0;x--){\n\t\t\to2+=o[x];\n\t\t}\n\t\t\n\t\treturn o2;\n\t}\n\t\n\tpublic static bool CheckPerfecto(string g){\n\t\tint zero = 0;\n\t\tint numb = 0;\n\t\t\n\t\tint len = g.Length;\n\t\t\n\t\tfloat numbcount = ((float)len-1)/2;\n\t\t\n\t\tif (numbcount-(int)numbcount==0) {\n\t\t\tif(Sum(g.Substring((int)numbcount+1,(int)numbcount))==0 && Sum(g.Substring(0,(int)numbcount+1))==(int)numbcount+1){\n\t\t\t\treturn true;\t\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\t\n\tpublic static int Sum(string g){\n\t\tint sum = 0;\n\t\tforeach(char a in g){\n\t\t\tsum+=int.Parse(a+\"\");\n\t\t}\n\t\treturn sum;\n\t}\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint l = int.Parse(Console.ReadLine());\n\t\tint k = 0;\n\t\tfor(int x = 1;x=2){\n\t\t\tint d=(int)(a/2);\n\t\t\tost = a-(2*d);\n\t\t\ta=d;\n\t\t\to+=\"\"+ost;\n\t\t}\n\t\to+=\"\"+a;\n\t\t\n\t\t\n\t\tfor(int x = o.Length-1;x>=0;x--){\n\t\t\to2+=o[x];\n\t\t}\n\t\t\n\t\treturn o2;\n\t}\n\t\n\tpublic static bool CheckPerfecto(string g){\n\t\tint zero = 0;\n\t\tint numb = 0;\n\t\t\n\t\tforeach(char a in g){\n\t\t\tif(a=='1'){ numb++; }\n\t\t\tif(a=='0'){ zero++; }\n\t\t}\n\t\treturn (numb-1==zero);\t\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Linq;\n\nnamespace CSharp_Contests\n{\n internal class Program\n {\n private static bool IsB(int number)\n {\n var bits = (new BitArray(new int[] {number})).OfType().Reverse().SkipWhile(a => a == false).ToArray();\n var ones = bits.TakeWhile(a => a).Count();\n var zeros = bits.Skip(ones).TakeWhile(a => a == false).Count();\n return ones + zeros == bits.Length && ones - 1 == zeros;\n }\n\n public static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n int divisor = number;\n while (divisor > 1)\n {\n divisor = (int) Math.Ceiling(divisor / 2.0);\n if (IsB(divisor))\n {\n Console.WriteLine(divisor);\n#if DEBUG\n Console.ReadLine();\n#endif\n return;\n }\n }\n Console.WriteLine('1');\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Linq;\n\nnamespace CSharp_Contests\n{\n internal class Program\n {\n private static bool IsB(int number)\n {\n \n var bits = (new BitArray(new int[] {number})).OfType().Reverse().SkipWhile(a => a == false).ToArray();\n var ones = bits.TakeWhile(a => a).Count();\n var zeros = bits.Skip(ones).TakeWhile(a => a == false).Count();\n return ones + zeros == bits.Length && ones - 1 == zeros;\n }\n\n public static void Main()\n {\n int number = int.Parse(Console.ReadLine());\n for (int i = number -1; i > 0; i--)\n {\n if (number %i == 0 && IsB(i))\n {\n Console.WriteLine(i);\n break;\n }\n }\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Linq;\n\nnamespace CSharp_Contests\n{\n internal class Program\n {\n private static int zeros, ones, number, mask = 0;\n\n public static void Main()\n {\n number = int.Parse(Console.ReadLine());\n\n for (int i = number; i > 0; i--)\n {\n if (number % i == 0)\n {\n zeros = ones = 0;\n mask = 1;\n while ((i & mask) == 0)\n {\n zeros++;\n mask <<= 1;\n }\n while ((i & mask) == mask)\n {\n ones++;\n mask <<= 1;\n }\n if (ones == zeros + 1)\n {\n Console.WriteLine(i);\n break;\n }\n }\n }\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n for (var i = n / 2; i >= 1; i--)\n {\n if (n % i == 0)\n {\n var k = 0;\n var curr = i;\n while (curr % 2 == 0)\n {\n curr >>= 1;\n k++;\n }\n if (curr == (1 << (k + 1)) - 1)\n return i;\n }\n }\n throw new Exception(\"huj\");\n }\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n }\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n int n = int.Parse(Console.ReadLine());\n\n List del = new List();\n\n for (int i = 1; i <= n; i++)\n {\n if (n % i == 0)\n {\n del.Add(i);\n }\n }\n\n del.Reverse();\n\n foreach (int dig in del)\n {\n string binaryCode = Convert.ToString(dig, 2);\n\n int one = 0;\n\n int zero = 0;\n\n for (int i = 0; i < binaryCode.Length; i++)\n {\n if(binaryCode[i] == '0')\n {\n zero++;\n }\n\n if(binaryCode[i] == '1')\n {\n one++;\n }\n }\n\n if((one - 1) == zero)\n {\n Console.WriteLine(dig);\n\n return;\n }\n }\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace b\n{\n class Program\n {\n static bool IsButifull(uint a) {\n bool checkingZeros = true;\n bool checkingOnes = false;\n int zeros = 0;\n int ones = 0;\n while(a > 0){\n if (checkingZeros) {\n if ((a & 1) == 0){\n zeros++;\n }else {\n checkingZeros = false;\n checkingOnes = true;\n }\n }\n if (checkingOnes) {\n if ((a & 1) == 1) {\n ones++;\n }else {\n return false;\n }\n if (ones - 1 > zeros) {\n return false;\n }\n }\n a = a >> 1;\n }\n return ones - 1 == zeros;\n }\n static IEnumerable GetButifulNumbers(uint n) {\n for (uint i=0;i input%i == 0);\n \n Console.WriteLine(gcdButiful);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tfor(int i = n; i >= 1; i--)\n\t\t{\n\t\t\tstring binary = Convert.ToString(i, 2);\n\t\t\tint q1 = 0;\n\t\t\tbool w1 = true;\n\t\t\tint q2 = 0;\n\t\t\tbool w2 = true;\n\t\t\tfor(int j = 0; j < binary.Length; j++)\n\t\t\t{\n\t\t\t\tif(binary[j] == '1' && w1)\n\t\t\t\t{\n\t\t\t\t\tq1++;\n\t\t\t\t}\n\t\t\t\telse if(binary[j] == '0')\n\t\t\t\t{\n\t\t\t\t\tw1 = false;\n\t\t\t\t\tq2++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tw2 = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(w2)\n\t\t\t\t{\n\t\t\t\t\tif(q1 == q2+1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t}\t\t\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var InputNumber = a;\n var number = a;\n\n for (var q = 1; q < InputNumber; q++)\n {\n if (InputNumber % number != 0)\n {\n number--;\n continue;\n\n }\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = 0;\n if (intArray.Length % 2 == 0)\n {\n middle = (intArray.Length / 2) + 1;\n }\n else\n {\n middle = intArray.Length / 2 + intArray.Length % 2;\n }\n\n if (middle == intArray.Length)\n {\n number--;\n continue;\n }\n\n bool Ones = true;\n for (var i = 0; i < middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var InputNumber = a;\n var number = a;\n\n\n\n\n for (var q = 1; q <= InputNumber - 1; q++)\n {\n if (InputNumber % number != 0)\n {\n number--;\n continue;\n\n }\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = intArray.Length / 2 + intArray.Length % 2;\n\n bool Ones = true;\n for (var i = 0; i <= middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var number = a;\n\n\n\n for (var q = 1; q <= number; q++)\n {\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = intArray.Length / 2 + intArray.Length % 2;\n\n bool Ones = true;\n for (var i = 0; i <= middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var InputNumber = a;\n var number = a;\n\n for (var q = 1; q < InputNumber; q++)\n {\n if (InputNumber % number != 0)\n {\n number--;\n continue;\n\n }\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = 0;\n if (intArray.Length % 2 == 0)\n {\n middle = (intArray.Length / 2) + 1;\n }\n else\n {\n middle = intArray.Length / 2 + intArray.Length % 2;\n }\n\n bool Ones = true;\n for (var i = 0; i < middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TMP\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Int32.Parse(Console.ReadLine());\n Console.WriteLine(Run(input));\n }\n public static int Run(int a)\n {\n var InputNumber = a;\n var number = a;\n\n for (var q = 1; q < InputNumber; q++)\n {\n if (InputNumber % number != 0)\n {\n number--;\n continue;\n\n }\n string BinaryCode = Convert.ToString(number, 2);\n char[] charArray = BinaryCode.ToArray();\n int[] intArray = Array.ConvertAll(charArray, c => (int)Char.GetNumericValue(c));\n\n int middle = 0;\n if (intArray.Length % 2 == 0)\n {\n middle = (intArray.Length / 2) + 1;\n }\n else\n {\n middle = intArray.Length / 2 + intArray.Length % 2;\n }\n\n if (middle == intArray.Length)\n {\n number--;\n continue;\n }\n if (intArray.Length == 4)\n {\n number--;\n continue;\n }\n bool Ones = true;\n for (var i = 0; i < middle; i++)\n {\n if (intArray[i] != 1)\n {\n Ones = false;\n break;\n }\n }\n if (!Ones)\n {\n number--;\n continue;\n }\n\n bool Zeros = true;\n for (var j = intArray.Length - 1; j >= middle; j--)\n {\n if (intArray[j] != 0)\n {\n Zeros = false;\n break;\n }\n }\n if (!Zeros)\n {\n number--;\n continue;\n }\n\n return number;\n\n }\n return number;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp = Console.ReadLine().Split().Select(item => Int32.Parse(item)).ToArray();\n String tmp = Convert.ToString(inp[0], 2), res = \"\", response =\"\";\n bool flag = false;\n res += \"1\";\n for (int i = 0; i < tmp.Length; ++i)\n {\n if (inp[0] > FromBinary(res))\n {\n if(inp[0] % FromBinary(res) == 0)\n {\n response = res;\n }\n res = \"1\" + res;\n res += \"0\";\n }\n else\n {\n break;\n }\n }\n Console.WriteLine(FromBinary(response));\n //Console.ReadKey();\n }\n\n static int FromBinary(string input)\n {\n int big = new int();\n foreach (var c in input)\n {\n big <<= 1;\n big += c - '0';\n }\n\n return big;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceProblemSolve\n{\n class B\n {\n\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine()); \n int m = 0;\n\n int i = 1;\n while (i <= n)\n {\n if(n % i == 0)\n {\n string s = Convert.ToString(i, 2);\n \n int zero = 0,one = 0;\n for (int j = 0; j < s.Length; j++)\n {\n if(s[j] == '0')\n {\n zero++;\n }\n else\n {\n one++;\n }\n }\n if ((one == zero + 1)) {\n if (i > m)\n {\n m = i;\n }\n }\n\n }\n i++;\n }\n\n Console.WriteLine(m);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceProblemSolve\n{\n class B\n {\n\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = 0;\n\n int i = 1;\n while (i <= n)\n {\n if (n % i == 0)\n {\n string s = Convert.ToString(i, 2);\n\n int zero = 0, one = 0;\n for (int j = 0; j < s.Length; j++)\n {\n if (s[j] == '0')\n {\n zero++;\n }\n else\n {\n one++;\n }\n }\n if ((one == zero + 1) && ( (Math.Pow(2,i)-1)*Math.Pow(2,i-1) == i))\n {\n if (i > m)\n {\n m = i;\n }\n }\n\n }\n i++;\n }\n\n Console.WriteLine(m);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceProblemSolve\n{\n class B\n {\n\n public static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = 0;\n\n int i = 1;\n while (i <= n)\n {\n if (n % i == 0)\n {\n string s = Convert.ToString(i, 2);\n\n int zero = 0, one = 0;\n for (int j = 0; j < s.Length; j++)\n {\n if (s[j] == '0')\n {\n zero++;\n }\n else\n {\n one++;\n }\n }\n if ((one == zero + 1)|| ( (Math.Pow(2,i)-1)*Math.Pow(2,i-1) == n))\n {\n if (i > m)\n {\n m = i;\n }\n }\n\n }\n i++;\n }\n\n Console.WriteLine(m);\n }\n }\n}"}, {"source_code": "// Problem: 893B - Beautiful Divisors\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass BeautifulDivisors\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n uint n;\n if (!UInt32.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 100000)\n return -1;\n uint ans = 0;\n for (ushort i = 1; i*i <= n && ans == 0; i++)\n {\n if (n%i > 0)\n continue;\n uint divisor = n/i;\n uint tmpConvBin = divisor;\n byte countZero = 0;\n byte countOne = 0;\n bool solved = true;\n bool procZero = true;\n while (tmpConvBin > 0 && solved)\n {\n byte digitBin = Convert.ToByte (tmpConvBin%2);\n tmpConvBin /= 2;\n if (digitBin == 0)\n {\n if (procZero)\n countZero++;\n else\n solved = false;\n }\n else\n {\n if (procZero)\n {\n procZero = false;\n countOne = 1;\n }\n else\n {\n countOne++;\n if (countOne > countZero+1)\n solved = false;\n }\n }\n }\n if (solved && countOne == countZero+1)\n ans = divisor;\n }\n Console.WriteLine (ans > 0 ? ans : 1);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Beautiful_Divisors\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n for(int i=n;i>0;i--)\n {\n string binary = Convert.ToString(i, 2);\n int ones = 0;\n int zeroes = 0;\n bool flag = false;\n bool correct = true;\n int count = 0;\n while(count!=binary.Length)\n {\n if (!flag)\n {\n if(binary[count]=='1')\n {\n ones++;\n count++;\n }\n else\n {\n zeroes++;\n flag = true;\n count++;\n }\n }\n else\n {\n if(binary[count]=='0')\n {\n zeroes++;\n count++;\n }\n else\n {\n correct = false;\n break;\n }\n }\n }\n if(correct&&ones-1==zeroes)\n {\n Console.WriteLine(i);\n break;\n }\n \n }\n //Console.ReadKey();\n }\n }\n}\n"}], "src_uid": "339246a1be81aefe19290de0d1aead84"} {"source_code": "\ufeffusing System;\n\nnamespace Task_811A\n{\n class Program\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split(' ');\n int a = int.Parse(str[0]);\n int b = int.Parse(str[1]);\n //int c = (int)Math.Sqrt(a);\n //if (c < b)\n // Console.WriteLine(\"Vladik\");\n //else\n // Console.WriteLine(\"Valera\");\n\n for (int i = 1; true; i += 2)\n {\n a -= i;\n b -= i + 1;\n if (a < 0 || b < 0)\n break;\n }\n if (a < 0)\n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\n#region sln\nnamespace Runhr.Test.CodeForces.ProblemSets.R416D2.A\n{\n class Solution\n {\n static void Main(String[] args)\n {\n string[] parts = Console.ReadLine().Split(' ');\n double a = double.Parse(parts[0]);\n double b = double.Parse(parts[1]);\n\n int steps_vladik = Convert.ToInt32(Math.Floor(Math.Sqrt(a)));\n\n double n_non = (-1 + Math.Sqrt(1d - 4d * (b * -1d))) / 2d;\n int steps_valere = Convert.ToInt32(Math.Floor(n_non));\n\n\n if (steps_vladik <= steps_valere) \n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n\n }\n }\n}\n#endregion"}, {"source_code": "using System;\nusing System.Linq;\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint[] arr=Console.ReadLine().Split(' ').Take(3).Select(int.Parse).ToArray();\n var i=1;\n while(true)\n {\n \tif(i%2==0)\n \tarr[1]-=i;\n \telse \n \tarr[0]-=i;\n \tif(arr[0]<0 || arr[1]<0) break;\n \ti++;\n }\n if(arr[1]<0)\n Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n\t}\n}// 2nd solve "}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\n//using System.Drawing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n//using System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n long a = ReadLong();\n long b = ReadLong();\n long i = 0;\n while (true)\n {\n i++;\n if (a < i)\n {\n Writer.WriteLine(\"Vladik\");\n return;\n }\n a -= i;\n i++;\n if (b < i)\n {\n Writer.WriteLine(\"Valera\");\n return;\n }\n b -= i;\n }\n }\n\n public static class Standard\n {\n public static long Power(long x, long p, long mod)\n {\n long result = 1;\n while (p > 0)\n {\n if ((p & 1) == 0)\n {\n x = (x * x) % mod;\n p >>= 1;\n }\n else\n {\n result = (result * x) % mod;\n p--;\n }\n }\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static List GetPrimes(int n)\n {\n bool[] isPrime = Enumerable.Repeat(true, n).ToArray();\n isPrime[0] = false;\n isPrime[1] = false;\n for (int i = 2; i < n; i++)\n {\n if (isPrime[i])\n {\n for (int j = i + i; j < n; j += i)\n {\n isPrime[j] = false;\n }\n }\n }\n List primes = new List();\n for (int i = 0; i < n; i++)\n {\n if (isPrime[i])\n {\n primes.Add(i);\n }\n }\n return primes;\n }\n }\n\n public static void Solve()\n {\n //int T = ReadInt();\n //for (int i = 0; i < T; i++)\n {\n //Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }\n }\n\n public static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (long i = 1; i <= 1000000000 || i <= 1000000000; i++)\n {\n a = a - (i * 2-1);\n if (a < 0) { Console.WriteLine(\"Vladik\"); return; }\n b = b - (i * 2);\n if (b < 0) { Console.WriteLine(\"Valera\"); return; }\n }\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int a = input.ReadInt();\n int b = input.ReadInt();\n int k = 1;\n int ca = 0;\n while (k <= a)\n {\n ca++;\n a -= k;\n k += 2;\n }\n k = 2;\n int cb = 0;\n while (k <= b)\n {\n cb++;\n b -= k;\n k += 2;\n }\n Console.Write(ca <= cb ? \"Vladik\" : \"Valera\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n var vlad = arr[0];\n var val = arr[1];\n\n long i = 0;\n while (true)\n {\n vlad -= 2 * i + 1;\n\n if (vlad < 0)\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n\n val -= 2 * i + 2;\n if (val < 0)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n\n i++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int a,b;\n\n public void Solve()\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n\n int curCandy = 1;\n int curTurn = 0;\n\n while(true)\n {\n if (curTurn == 0)\n a -= curCandy;\n else\n b -= curCandy;\n\n if (a < 0 || b < 0)\n {\n break;\n }\n\n curCandy++;\n curTurn = 1 - curTurn;\n }\n\n if (a < 0)\n ioHelper.WriteLine(\"Vladik\");\n else\n ioHelper.WriteLine(\"Valera\");\n\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeff//#define ONLINE_JUDGE\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\npublic class Sum\n{\n\n private static void Main()\n {\n#if !ONLINE_JUDGE\n StreamReader inp = new StreamReader(\"input.txt\");\n StreamWriter outp = new StreamWriter(\"output.txt\");\n Console.SetIn(inp);\n Console.SetOut(outp);\n#endif\n\n string[] p = Console.ReadLine().Split(' ');\n long a = long.Parse(p[0]);\n long b = long.Parse(p[1]);\n\n string res = \"\";\n\n bool val = true;\n int cur = 1;\n while (true)\n {\n if (val)\n {\n a -= cur;\n if (a < 0)\n {\n res = \"Vladik\";\n break;\n }\n } else\n {\n b -= cur;\n if (b < 0)\n {\n res = \"Valera\";\n break;\n }\n\n }\n val = !val;\n ++cur;\n }\n\n Console.WriteLine(\"{0}\", res);\n\n#if !ONLINE_JUDGE\n inp.Close();\n outp.Close();\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n \n\n static void Main(string[] args)\n {\n /*if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else*/\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n sr.Close();\n //sw.Close();\n }\n\n static void Solve()\n {\n long n = ReadLong();\n long k = ReadLong();\n long i = 1;\n for (; i < 1000000000; i++)\n {\n if (i % 2 == 0)\n {\n k -= i;\n if (k < 0)\n {\n sw.WriteLine(\"Valera\");\n return;\n }\n }\n else\n {\n n -= i;\n if (n < 0)\n {\n sw.WriteLine(\"Vladik\");\n return;\n }\n }\n }\n }\n\n static bool check()\n {\n return true;\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static int comparator(Pair a, Pair b)\n {\n long temp = getManhattan(a, new Pair(0, 0)) - getManhattan(b, new Pair(0, 0));\n return (temp > 0 ? 1 : (temp<0?-1:0));\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T: IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j+1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T: IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class Pair : IComparable>\n where U : IComparable where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CD2\n{\n class Program\n {\n #region Reusable\n\n class DescComparer : IComparer\n {\n public int Compare(T x, T y)\n {\n return Comparer.Default.Compare(y, x);\n }\n }\n public class DuplicateKeyComparer : IComparer where TKey : IComparable\n {\n #region IComparer Members\n\n public int Compare(TKey x, TKey y)\n {\n int result = x.CompareTo(y);\n\n if (result == 0)\n return 1; // Handle equality as beeing greater\n else\n return result;\n }\n\n #endregion\n }\n static int[] GetIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);\n }\n static double[] GetDoubleArray()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(' '), Convert.ToDouble);\n }\n static string[] GetStringArray()\n {\n return Console.ReadLine().Trim().Split(' ');\n }\n static int GetN()\n {\n return Convert.ToInt32(Console.ReadLine().Trim());\n }\n static bool[] GetSieve(int max)\n {\n long sum = 0;\n long n = 2000000;\n bool[] e = new bool[n];//by default they're all false\n for (int i = 2; i < n; i++)\n {\n e[i] = true;//set all numbers to true\n }\n //weed out the non primes by finding mutiples \n for (int j = 2; j < n; j++)\n {\n if (e[j])//is true\n {\n for (long p = 2; (p * j) < n; p++)\n {\n e[p * j] = false;\n }\n }\n }\n return e;\n }\n static bool IsPrime(int n)\n {\n if (n > 1)\n {\n return Enumerable.Range(2, n / 2).Where(x => n % x == 0).Count() == 0;\n }\n\n return false;\n }\n static List GetListFromInt(int n)\n {\n List arr = new List();\n while (n > 0)\n {\n arr.Add(n % 10);\n n /= 10;\n }\n arr.Reverse();\n return arr;\n }\n static int GetIntFromArray(int[] arr)\n {\n int op = 0;\n foreach (int i in arr)\n {\n op = (op * 10) + i;\n }\n return op;\n }\n private static int GetMost(List vals, int m)\n {\n int ct = vals.Count;\n int l = vals.Max();\n int h = vals.Sum();\n\n while (l < h)\n {\n int mp = 1;\n int cl = 0;\n int mid = l + (h - l) / 2;\n for (int i = 0; i < ct; ++i)\n {\n if (cl + vals[i] <= mid) cl += vals[i];\n else { ++mp; cl = vals[i]; }\n }\n if (mp <= m) h = mid;\n else l = mid + 1;\n }\n return l;\n }\n private static int GetLeast(List vals, int m)\n {\n int max = -1;\n int ct = vals.Count;\n int h = vals[ct - 1];\n int l = 0;\n //int l = h;\n //for (int i = 1; i < ct; i++)\n //{\n // int df = vals[i] - vals[i - 1];\n // if (df < l) l = df;\n //}\n while (l < h)\n {\n int mp = 1;\n int prCwPos = vals[0];\n int mid = l + (h - l) / 2;\n for (int i = 1; i < ct; ++i)\n {\n int d = vals[i] - prCwPos;\n if (d >= mid)\n {\n mp++;\n prCwPos = vals[i];\n }\n }\n if (mp >= m) { l = mid + 1; if (mid > max) max = mid; }\n else h = mid;\n }\n return max;\n }\n static void Print(List op, bool newLine)\n {\n if (newLine)\n {\n foreach (string s in op)\n {\n Console.WriteLine(s);\n }\n }\n else\n {\n Console.WriteLine(string.Join(\" \", op));\n }\n }\n static void Print2DArray(int[,] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = ar[i, j].ToString();\n else op += \" \" + ar[i, j].ToString();\n }\n Console.WriteLine(op);\n\n }\n }\n static void Print2DArray(int[][] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = ar[i][j].ToString();\n else op += \" \" + ar[i][j].ToString();\n }\n Console.WriteLine(op);\n\n }\n }\n static void Print2DArray(bool[,] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = (ar[i, j] ? \"1\" : \"0\");\n else op += \" \" + (ar[i, j] ? \"1\" : \"0\");\n }\n Console.WriteLine(op);\n\n }\n }\n static int MinDistanceForDijkstra(int[] dist, bool[] sptSet)\n {\n int V = dist.Length;\n // Initialize min value\n int min = Int32.MaxValue, min_index = 0;\n\n for (int v = 0; v < V; v++)\n if (sptSet[v] == false && dist[v] <= min)\n {\n min = dist[v];\n min_index = v;\n }\n\n return min_index;\n }\n static int[] Dijkstra(int[][] graph, int src)\n {\n int V = graph.Length;\n int[] dist = new int[V]; // The output array. dist[i] will hold the shortest\n // distance from src to i\n\n bool[] sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest\n // path tree or shortest distance from src to i is finalized\n\n // Initialize all distances as INFINITE and stpSet[] as false\n for (int i = 0; i < V; i++)\n {\n dist[i] = Int32.MaxValue;\n sptSet[i] = false;\n }\n\n // Distance of source vertex from itself is always 0\n dist[src] = 0;\n\n // Find shortest path for all vertices\n for (int count = 0; count < V - 1; count++)\n {\n // Pick the minimum distance vertex from the set of vertices not\n // yet processed. u is always equal to src in first iteration.\n int u = MinDistanceForDijkstra(dist, sptSet);\n\n // Mark the picked vertex as processed\n sptSet[u] = true;\n\n // Update dist value of the adjacent vertices of the picked vertex.\n for (int v = 0; v < V; v++)\n\n // Update dist[v] only if is not in sptSet, there is an edge from \n // u to v, and total weight of path from src to v through u is \n // smaller than current value of dist[v]\n if (!sptSet[v] && (graph[u][v] != 0) && dist[u] != Int32.MaxValue\n && dist[u] + graph[u][v] < dist[v])\n dist[v] = dist[u] + graph[u][v];\n }\n return dist;\n\n\n }\n static int[] Dijkstra2(int[][] graph, int src)\n {\n int V = graph.Length;\n int[] dist = new int[V]; // The output array. dist[i] will hold the shortest\n // distance from src to i\n\n bool[] sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest\n // path tree or shortest distance from src to i is finalized\n\n // Initialize all distances as INFINITE and stpSet[] as false\n for (int i = 0; i < V; i++)\n {\n dist[i] = Int32.MaxValue;\n sptSet[i] = false;\n }\n\n // Distance of source vertex from itself is always 0\n dist[src] = 0;\n\n // Find shortest path for all vertices\n for (int count = 0; count < V - 1; count++)\n {\n // Pick the minimum distance vertex from the set of vertices not\n // yet processed. u is always equal to src in first iteration.\n int u = MinDistanceForDijkstra(dist, sptSet);\n\n // Mark the picked vertex as processed\n sptSet[u] = true;\n\n // Update dist value of the adjacent vertices of the picked vertex.\n for (int v = 0; v < V; v++)\n\n // Update dist[v] only if is not in sptSet, there is an edge from \n // u to v, and total weight of path from src to v through u is \n // smaller than current value of dist[v]\n if (!sptSet[v] && (graph[u][v] != -1) && dist[u] != Int32.MaxValue\n && dist[u] + graph[u][v] < dist[v])\n dist[v] = dist[u] + graph[u][v];\n }\n return dist;\n\n\n }\n static int LCM(int[] numbers)\n {\n return numbers.Aggregate(LCM);\n }\n static int LCM(int a, int b)\n {\n return a * b / GCD(a, b);\n }\n static int GCD(int[] numbers)\n {\n return numbers.Aggregate(GCD);\n }\n static int GCD(int a, int b)\n {\n return b == 0 ? a : GCD(b, a % b);\n }\n\n static int[] or = new int[] { 1, 0, -1, 0 };\n static int[] oc = new int[] { 0, 1, 0, -1 };\n #endregion\n static void Main(string[] args)\n {\n a1();\n return;\n }\n\n private static void a1()\n {\n Int64[] ips = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), Int64.Parse);\n Int64 a = ips[0];\n Int64 b = ips[1];\n Int64 i = 0;\n while (true)\n {\n i++;\n a -= i;\n if (a < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n i++;\n b -= i;\n if (b < 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n }\n }\n\n \n\n\n\n\n\n\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static ulong _step;\n static void Main(string[] args)\n {\n var input = Console.ReadLine()?.Split(' ');\n var a = Convert.ToUInt64(input[0]);\n var b = Convert.ToUInt64(input[1]);\n var flagLose = 0;\n\n _step = 1;\n while (flagLose == 0)\n {\n if (!Check(ref a))\n {\n flagLose = 1;\n break;\n }\n if (!Check(ref b)) flagLose = 2;\n }\n var output = flagLose == 1 ? \"Vladik\" : \"Valera\";\n Console.WriteLine(output);\n }\n\n private static bool Check(ref ulong n)\n {\n if (n < _step) return false;\n n -= _step++;\n return true;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n \n int aN = a,bN = b;\n \n int i = 1,j=2;\n \n if(b<2)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n \n while(true)\n {\n aN = aN - i;\n bN = bN - j;\n i += 2;\n j += 2;\n if(aN '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _811A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]), b = long.Parse(input[1]);\n bool turn = true;\n for (int i = 1;; i++)\n {\n if (turn)\n {\n if (a < i)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n a -= i;\n }\n else\n {\n if (b < i)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n b -= i;\n }\n turn = !turn;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace asdsa\n{\n class MainClass\n {\n public static void Main()\n {\n string[] arr = (Console.ReadLine()).Split(' ');\n int vladik = int.Parse(arr[0]);\n int valera = int.Parse(arr[1]);\n for (int i = 1; vladik>=0 && valera>=0 ; i++)\n {\n if (i % 2 == 1) vladik -= i;\n else valera -= i;\n }\n if (valera < 0) Console.WriteLine(\"Valera\");\n else Console.WriteLine(\"Vladik\");\n }\n }\n\t\n}\n"}, {"source_code": "using System;\n\nnamespace Codewars\n{\n class Program\n {\n static void Main()\n {\n var guys = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int vladik = guys[0];\n int valera = guys[1];\n\n for (int i = 1;; i++)\n {\n if (i % 2 == 1)\n {\n if (vladik < i)\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n \n vladik -= i;\n }\n else\n {\n if (valera < i)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n\n valera -= i;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _416A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] splitInput = Console.ReadLine().Split(' ');\n int aInput = int.Parse(splitInput[0]);\n long bInput = int.Parse(splitInput[1]);\n int aCount = (int)Math.Sqrt(aInput);\n int bCount = (int)((-1 + Math.Sqrt(1 + 4 * bInput)) / 2);\n if (aCount > bCount)\n {\n Console.WriteLine(\"Valera\");\n }\n else\n {\n Console.WriteLine(\"Vladik\");\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = 0;\n int i = 1;\n while (count[1] >= 0 && count[0] >= 0)\n {\n count[0] -= i;\n count[1] -= i + 1;\n i += 2;\n }\n Console.WriteLine(count[0]<0? \"Vladik\": \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\nusing System.Linq;\n\nnamespace CF416A\n{\n using System.Numerics;\n\n public class SolverBase\n {\n #region Helper\n public static int[] SAToIA(string[] strSplit)\n {\n int[] nums = new int[strSplit.Length];\n for (int iTemp = 0; iTemp < strSplit.Length; ++iTemp)\n {\n nums[iTemp] = int.Parse(strSplit[iTemp]);\n }\n\n return nums;\n }\n\n public static long[] SAToLongA(string[] strSplit)\n {\n long[] nums = new long[strSplit.Length];\n for (int iTemp = 0; iTemp < strSplit.Length; ++iTemp)\n {\n nums[iTemp] = long.Parse(strSplit[iTemp]);\n }\n\n return nums;\n }\n\n public static int[] StringToIA(string s, char[] delim)\n {\n string[] strSplit = s.Split(\n delim,\n StringSplitOptions.RemoveEmptyEntries);\n return SAToIA(strSplit);\n }\n\n public static int[] StringToIA(string s, char c)\n {\n return StringToIA(s, new char[] { c });\n }\n\n public static int[] StringToIA(string s)\n {\n return StringToIA(s, new char[] { ' ' });\n }\n\n public static long[] StringToLongA(string s, char[] delim)\n {\n string[] strSplit = s.Split(\n delim,\n StringSplitOptions.RemoveEmptyEntries);\n return SAToLongA(strSplit);\n }\n\n public static long[] StringToLongA(string s, char c)\n {\n return StringToLongA(s, new char[] { c });\n }\n\n public static long[] StringToLongA(string s)\n {\n return StringToLongA(s, new char[] { ' ' });\n }\n\n public static string[] StringToSA(string s, char[] delim)\n {\n string[] strSplit = s.Split(\n delim,\n StringSplitOptions.RemoveEmptyEntries);\n return strSplit;\n }\n\n public static string[] StringToSA(string s, char c)\n {\n return StringToSA(s, new char[] { c });\n }\n\n public static string[] StringToSA(string s)\n {\n return StringToSA(s, new char[] { ' ' });\n }\n #endregion Helper\n }\n\n public class A : SolverBase\n {\n private void Solve()\n {\n var ab = StringToLongA(Console.ReadLine());\n long a = ab[0];\n long b = ab[1];\n long cur = 0;\n while (true)\n {\n ++cur;\n if (a >= cur)\n {\n a -= cur;\n }\n else\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n\n ++cur;\n if (b >= cur)\n {\n b -= cur;\n }\n else\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n }\n }\n\n static void Main(string[] args)\n {\n new A().Solve();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _811A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n\n int na = (int)Math.Sqrt(a);\n int nb = (int)Math.Sqrt(b) - 1;\n\n while ((nb + 1) * (nb + 2) <= b)\n {\n nb++;\n }\n\n Console.WriteLine(na <= nb ? \"Vladik\" : \"Valera\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Collections;\nusing System.Linq.Expressions;\n\nstatic class Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\nclass Magatro\n{\n private int A, B;\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n A = int.Parse(line[0]);\n B = int.Parse(line[1]);\n }\n\n public void Solve()\n {\n Scan();\n int sum = 0;\n int i = 1;\n int aj;\n for (aj = 0; ; aj++)\n {\n sum += i;\n if (A < sum)\n {\n break;\n }\n i += 2;\n }\n sum = 0;\n i = 2;\n int bj;\n for(bj = 0; ; bj++)\n {\n sum += i;\n if (B < sum)\n {\n break;\n }\n i += 2;\n }\n if (bj < aj)\n {\n Console.WriteLine(\"Valera\");\n }\n else\n {\n Console.WriteLine(\"Vladik\");\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var vladik = true;\n var cnt = 1;\n while (arr[vladik ? 0 : 1] >= cnt)\n {\n arr[vladik ? 0 : 1] -= cnt;\n cnt++;\n vladik = !vladik;\n }\n\n Console.WriteLine(vladik ? \"Vladik\" : \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n while (0 <= x && 0 <= y)\n {\n if (step % 2 == 0)\n {\n y -= step;\n }\n else\n {\n x -= step;\n }\n step++;\n }\n \n Console.WriteLine(ans[x < 0 ? 0 : 1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A811\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split();\n int a = int.Parse(arr[0]);\n int b = int.Parse(arr[1]);\n int m = 1;\n while (true) {\n if (a < m) {\n Console.WriteLine(\"Vladik\");\n return;\n }\n a -= m;\n m++;\n if (b < m) {\n Console.WriteLine(\"Valera\");\n return;\n }\n b -= m;\n m++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")) {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int64.Parse);\n var a = input[0];\n var b = input[1];\n var curr = 1L;\n var isA = true;\n while (true) {\n if (isA) {\n if (a < curr) {\n sw.WriteLine(\"Vladik\");\n return;\n }\n a -= curr;\n curr++;\n isA = false;\n }\n else {\n if (b < curr) {\n sw.WriteLine(\"Valera\");\n return;\n }\n b -= curr;\n curr++;\n isA = true;\n }\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace _100853_Codeforce\n{\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n const bool online = true;\n const string inputPath = \"position.in\";\n const string outputPath = \"position.out\";\n\n static StreamReader reader = null;\n static StreamWriter writer = null;\n\n private static void Main(string[] args)\n {\n\n int[] res = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int vladik = res[0];\n\n int valera = res[1];\n\n bool isFirst = true;\n int counter = 1;\n\n while (vladik >= 0 && valera >= 0)\n {\n if (isFirst)\n {\n vladik -= counter;\n counter++;\n isFirst = false;\n }\n else\n {\n valera -= counter;\n counter++;\n isFirst = true;\n }\n }\n\n if (vladik < 0)\n {\n Console.WriteLine(\"Vladik\");\n }\n else\n {\n Console.WriteLine(\"Valera\");\n }\n\n }\n\n static void Run()\n {\n int n = int.Parse(Console.ReadLine());\n int[,] array = new int[2, n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split();\n array[0, i] = int.Parse(s[0]);\n array[1, i] = int.Parse(s[1]);\n }\n for (int i = 0; i < n; i++)\n {\n if (array[0, i] != array[1, i])\n {\n Console.WriteLine(\"rated\");\n return;\n }\n }\n bool flag = false;\n for (int i = 1; i < n; i++)\n {\n if (array[0, i] > array[0, i - 1])\n {\n flag = true;\n break;\n }\n }\n Console.WriteLine(flag ? \"unrated\" : \"maybe\");\n }\n\n static string StreamReader()\n {\n if (online)\n {\n if (reader == null)\n reader = new StreamReader(inputPath);\n string response = reader.ReadLine();\n if (reader.EndOfStream)\n reader.Close();\n return response;\n }\n \n }\n\n static void StreamWriter(string text)\n {\n if (online)\n {\n if (writer == null)\n writer = new StreamWriter(outputPath);\n writer.WriteLine(text);\n }\n\n }\n\n\n\n\n\n /* public static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }*/\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(Int32.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n\n }\n\n\n public class Vector\n {\n public double x { get; set; }\n public double y { get; set; }\n\n public static Vector zero = new Vector(0, 0);\n\n public Vector(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n\n public double Length(Vector zero)\n {\n return Math.Sqrt((this.x - zero.x) * (this.x - zero.x) + (this.y - zero.y) * (this.y - zero.y));\n }\n\n public override string ToString()\n {\n return string.Format(\"{0} {1}\", x, y).Replace(',', '.');\n }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] ab = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int i = 1;\n while (true)\n {\n if (i % 2 > 0)\n {\n ab[0] -= i;\n if (ab[0] < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n } \n else\n {\n ab[1] -= i;\n if (ab[1] < 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n }\n \n i++;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n \nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string[]y=Console.ReadLine().Split(' ');\n int vlad=int.Parse(y[0]);\n int valer=int.Parse(y[1]);\n int i=0;\n int t=0;\n while(true)\n {\n if(i%2==1)\n vlad-=i;\n else\n valer-=i;\n i++;\n //Console.WriteLine(\"{0} {1}\",vlad,valer);\n \n if(vlad<0)\n {\n t=1;\n //Console.Write(3);\n break;\n }\n else if(valer<0)\n {\n t=2;//Console.Write(3);\n break;\n }\n \n }\n if(t==1)\n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n try {\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int vl = ar[0];\n int vo = ar[1];\n int offer = 1;\n while (vl>=0 && vo>=0)\n {\n if (vl - offer >= 0)\n {\n vl -= offer;\n offer++;\n }\n else\n {\n vl -= offer;\n break;\n }\n if (vo - offer >= 0)\n {\n vo -= offer;\n offer++;\n }\n else\n {\n vo -= offer;\n break;\n }\n // Console.WriteLine(vl+\" \"+vo);\n }\n if(vo<0)\n Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n Console.ReadKey();\n\n\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Round416A\n{\n class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n {\n // using (var sr = new InputReader(new StreamReader(\"input.txt\"))) {\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")){\n\n task.Solve(sr, sw);\n //Console.ReadKey();\n\n }\n }\n }\n }\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n int[] input = sr.ReadArrayOfInt32();\n int a = input[0];\n int b = input[1];\n for (int i = 1; i < int.MaxValue; i++)\n {\n if (i % 2 != 0)\n {\n a -= i;\n if (a < 0) { sw.WriteLine(\"Vladik\"); return; }\n }\n else\n {\n b -= i;\n if (b < 0) { sw.WriteLine(\"Valera\"); return; }\n\n }\n }\n\n\n\n\n }\n\n }\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var d = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Console.WriteLine(GetAnswer(d[0], d[1]));\n }\n\n private static string GetAnswer(int a, int b)\n {\n int k = 1;\n int r = 0;\n\n int i = 2;\n\n do\n {\n r += i++;\n\n if (r > b)\n return \"Valera\";\n\n k += i++;\n } while (k <= a);\n\n return \"Vladik\";\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication34\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] n = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n long vlad = (long)Math.Sqrt(n[0]);\n long valera = (long)((Math.Sqrt(n[1]*4+1)-1)/2);\n if (vlad > valera)\n Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Solution {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n string ret = \"Vladik\";\n\n int i = 1;\n while(n>-1 && m>-1) {\n if(i%2==1)n-=i;\n else m-=i;\n i++;\n }\n\n if(i%2==1) ret = \"Valera\";\n Console.WriteLine(ret);\n }\n\n private static int Next() {\n int c;\n int m = 1;\n do {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true) {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n}"}, {"source_code": "using System;\npublic class Program\n {\n public static void Main(string[] args)\n {\n int vlr;\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int vld = (int)(Math.Sqrt(double.Parse(input[0])));\n vlr = int.Parse(input[1]) - vld * vld - vld;\n }\n Console.WriteLine(vlr < 0 ? \"Valera\" : \"Vladik\");\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar a = cin.NextLong();\n\t\t\tvar b = cin.NextLong();\n\t\t\tvar give = 1;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (give%2 == 1)\n\t\t\t\t{\n\t\t\t\t\tif (a >= give)\n\t\t\t\t\t{\n\t\t\t\t\t\ta -= give;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (b >= give)\n\t\t\t\t\t{\n\t\t\t\t\t\tb -= give;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tgive++;\n\t\t\t}\n\t\t\tConsole.WriteLine((give % 2 == 1) ? \"Vladik\" : \"Valera\");\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nclass A811 {\n public static void Main() {\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int step = 1;\n int d = 0;\n while (true) {\n a[d] -= step;\n if (a[d] < 0) break;\n ++step;\n d = 1 - d;\n }\n Console.WriteLine(new string[] { \"Vladik\", \"Valera\" } [d]);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n int i = 1;\n while (true)\n {\n if (i % 2 == 1)\n {\n if (a < i)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n a -= i;\n }\n else\n {\n if (b < i)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n b -= i;\n }\n ++i;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace cf_round_416_div_2_A\n{\n\tclass cf_round_416_div_2_A\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tlong valera, vladik;\n\t\t\tstring[] temp =Console.ReadLine().Split();\n\t\t\tvladik = readlong(temp[0]);\n\t\t\tvalera = readlong(temp[1]);\n\t\t\tint step = 1;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (step % 2 != 0)\n\t\t\t\t\tvladik -= step;\n\t\t\t\telse\n\t\t\t\t\tvalera -= step;\n\t\t\t\tif (vladik < 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Vladik\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (valera < 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Valera\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t++step;\n\t\t\t}\n\t\t\t//Console.ReadKey();\n\t\t}\n\n\t\tpublic static long readlong(string s)\n\t\t{\n\t\t\tint len = s.Length,pow=1;\n\t\t\tlong sum = 0;\n\t\t\tfor (int i = len - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tsum += pow * (s[i] - '0');\n\t\t\t\tpow *= 10;\n\t\t\t}\n\t\t\t//Console.WriteLine(sum+\" \");\n\t\t\treturn sum;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n public static int getCountOfDifferent(int a)\n {\n var all = new int[10];\n a.ToString().ToCharArray().ToList().ForEach(b => all[int.Parse(b.ToString())]++);\n var count = 0;\n for(var i = 0; i < 10; i++)\n {\n if(all[i] > 0)\n {\n count++;\n }\n }\n return count;\n }\n\n //CultureInfo.InvariantCulture\n static void Main(String[] args)\n {\n //var data = Console.ReadLine().TrimEnd().Split(' ').Select(int.Parse).ToList();\n var data1 = Console.ReadLine().TrimEnd().Split(' ').Select(int.Parse).ToList();\n var a = data1[0];\n var b = data1[1];\n\n var first = true;\n var c = 1;\n while(a>=0 && b >= 0)\n {\n if (first)\n {\n a -= c;\n } else\n {\n b -= c;\n }\n c++;\n first = !first;\n }\n if (a < 0)\n {\n Console.WriteLine(\"Vladik\");\n } else\n {\n Console.WriteLine(\"Valera\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _811A_Vladik_And_Courtesy\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n int person = 1,i=1;\n int nVL = 0,nVA=0;\n \n string x = Console.ReadLine();\n int[] y = x.Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n int totalCount = y.Length;\n\n nVL = y[0];\n nVA = y[1];\n \n while (true) \n {\n if (person == 1) \n { \n nVL-=i;\n ++i;\n person=2;\n if (person == 2 && nVA < i)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n \n }\n else if(person==2)\n {\n nVA-=i;\n ++i;\n person=1;\n if (person == 1 && nVL < i)\n {\n Console.WriteLine(\"Vladik\");\n break;\n\n }\n }\n \n \n \n \n }\n\n \n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nclass PairVariable : IComparable\n{\n public int a, b, index;\n public long c;\n public PairVariable()\n {\n a = b = 0;\n c = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n c = 0;\n \n }\n \n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n c = 0;\n\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n if (this.a < (other.a))\n {\n return 1;\n }\n if (this.a > (other.a))\n {\n return -1;\n }\n if (this.a == (other.a))\n {\n if (this.b < (other.b))\n {\n return 1;\n }\n else\n {\n return -1;\n }\n\n }\n return 0;\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n int i = 1;\n while (true)\n {\n if (i % 2 == 1)\n {\n if (a < i)\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n a -= i;\n }\n else\n {\n if (b < i)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n b -= i;\n }\n i++;\n }\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _811A_Vladik_And_Courtesy\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n int person = 1,i=1;\n int nVL = 0,nVA=0;\n \n string x = Console.ReadLine();\n int[] y = x.Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n int totalCount = y.Length;\n\n nVL = y[0];\n nVA = y[1];\n \n while (true) \n {\n if (person == 1) \n { \n nVL-=i;\n ++i;\n person=2;\n if (person == 2 && nVA < i)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n \n }\n else if(person==2)\n {\n nVA-=i;\n ++i;\n person=1;\n if (person == 1 && nVL < i)\n {\n Console.WriteLine(\"Vladik\");\n break;\n\n }\n }\n \n \n \n \n }\n\n \n\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Competitive\n{\n class Program\n {\n static void Main(string[] args)\n {\n var l = Console.ReadLine().Split(' ').Select(int.Parse).Reverse().ToArray();\n\n for (int i = 1; ;i++)\n {\n l[i % 2] -= i;\n \n if (l[0] < 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n\n if (l[1] < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "// Problem: 811A - Vladik and Courtesy\n// Author: Gusztav Szmolik\n\nusing System;\n\nnamespace Vladik_and_Courtesy\n {\n class Program\n {\n static int Main ()\n {\n string[] field = Console.ReadLine().Split();\n if (field.Length != 2)\n return -1;\n uint a;\n if (!UInt32.TryParse(field[0], out a))\n return -1;\n if (a < 1 || a > 1000000000)\n return -1;\n uint b;\n if (!UInt32.TryParse(field[1], out b))\n return -1;\n if (b < 1 || b > 1000000000)\n return -1;\n ushort k = Convert.ToUInt16 (Math.Floor(Math.Sqrt(a)));\n ushort l = Convert.ToUInt16 (Math.Floor((Math.Sqrt(4*b+1)-1)/2));\n Console.WriteLine (k > l ? \"Valera\" : \"Vladik\");\n return 0;\n }\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\n\nnamespace mo\n{\n class Program\n {\n public class Helper\n {\n public long a { get; set; }\n public long b { get; set; }\n\n public long c\n {\n get\n {\n var ab = a * 2;\n\n if (ab >= b)\n {\n return b;\n }\n\n return ab;\n\n }\n }\n\n }\n\n\n\n static void Main(string[] args)\n {\n var input = GetLongInputsFromLine();\n\n long a = input[0];\n long b = input[1];\n\n bool starta = true;\n\n int step = 1;\n\n while (!(a<0 || b<0))\n {\n if(starta)\n {\n a = a - step;\n starta = false;\n }\n else\n {\n b = b - step;\n starta = true;\n }\n\n step = step + 1;\n }\n\n if (a<0)\n {\n Console.WriteLine(\"Vladik\");\n \n }\n else\n {\n Console.WriteLine(\"Valera\");\n }\n \n\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static List GetIntegerInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToList();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n\n return input;\n }\n\n static Int64[] GetLongInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n\n\n public class CustomMath\n {\n public bool IsPrime(int num)\n {\n if (num <= 1)\n {\n return false;\n }\n\n double num_sqrt = Math.Sqrt(num);\n int num_fl = Convert.ToInt32(Math.Floor(num_sqrt));\n\n for (int i = 2; i <= num_fl; i++)\n {\n if (num % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n public Int64 gcd(Int64 a, Int64 b)\n {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n\n\n public Int64 lcm(Int64 a, Int64 b)\n {\n return (a * b) / gcd(a, b);\n }\n\n }\n\n public class Graph\n {\n\n public List[] graph = new List[10001];\n public long[] visited = new long[10001];\n\n\n public List Bfs(int from)\n {\n\n List ls = new List();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n visited[from] = 1;\n\n\n while (queue.Count() > 0)\n {\n long front = queue.Peek();\n\n List values = graph[front];\n\n if (values != null)\n {\n\n foreach (var item in values)\n {\n if (visited[item] == 0)\n {\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n else\n {\n ls.Add(front);\n }\n\n\n queue.Dequeue();\n\n }\n\n return ls;\n }\n\n\n public IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n }\n}"}, {"source_code": "\ufeffnamespace ZT.Contests.Codeforces\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var solver = new VladikAndCourtesy();\n var input = new TextInputHelper(Console.In);\n solver.DoWork(input);\n }\n }\n\n internal class VladikAndCourtesy : CFSolver\n {\n public override void Solve(InputHelper input)\n {\n var vladik = input.Read();\n var valera = input.Read();\n var cnt = 1;\n for (;; ++cnt)\n {\n var d = cnt % 2 == 0 ? valera -= cnt : vladik -= cnt;\n if (d < 0) break;\n //Console.WriteLine($\"{cnt}: {vladik} {valera}\");\n }\n Console.WriteLine(cnt % 2 == 0 ? \"Valera\" : \"Vladik\");\n }\n }\n\n internal abstract class CFSolver\n {\n public const long Mod = 1000000007;\n\n public CFSolver(RunType runType = RunType.ReadUntilNoInput)\n {\n RunType = runType;\n }\n\n public RunType RunType { get; private set; }\n\n public void DoWork(InputHelper input)\n {\n Func shouldRun;\n\n switch (RunType)\n {\n case RunType.ReadRunTimeFromInput:\n shouldRun = GetShouldRun(input.Read());\n break;\n case RunType.ReadUntilNoInput:\n shouldRun = () => input.HasNext();\n break;\n default:\n shouldRun = GetShouldRun(1);\n break;\n }\n\n while (shouldRun())\n {\n Solve(input);\n }\n }\n\n public abstract void Solve(InputHelper input);\n\n private static Func GetShouldRun(int n) { return () => n-- > 0; }\n }\n\n public enum RunType\n {\n Single,\n ReadRunTimeFromInput,\n ReadUntilNoInput,\n }\n\n public abstract class InputHelper\n {\n private bool any;\n private IEnumerator cur;\n\n public T Read()\n {\n if (!HasNext()) { throw new InvalidOperationException(\"no more data\"); }\n var r = (T)Convert.ChangeType(cur.Current, typeof(T));\n any = false;\n return r;\n }\n\n public bool HasNext()\n {\n while (!any)\n {\n if (cur != null && cur.MoveNext()) break;\n var next = GetNextGroup();\n if (next == null) { return false; }\n cur = next.GetEnumerator();\n any = cur.MoveNext();\n }\n\n return any = true;\n }\n\n protected abstract IEnumerable GetNextGroup();\n }\n\n public class TextInputHelper : InputHelper\n {\n private TextReader reader;\n\n public TextInputHelper(TextReader reader) { this.reader = reader; }\n\n protected override IEnumerable GetNextGroup()\n {\n if (reader == null) { return null; }\n var cur = reader;\n reader = null;\n return ReadWordsToEnd(cur);\n }\n\n public static IEnumerable ReadWordsToEnd(TextReader reader)\n {\n while (true)\n {\n var lines = ReadWords(reader);\n if (lines == null) yield break;\n foreach (string word in lines) yield return word;\n }\n }\n\n public static IEnumerable ReadWords(TextReader reader)\n {\n string line = reader.ReadLine();\n return line == null ? null : line.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n }\n\n public static class CFUtil\n {\n // a > 0\n public static int DivUpperBound(int a, int b) { return (a - 1) / b + 1; }\n public static long DivUpperBound(long a, long b) { return (a - 1) / b + 1; }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n public static void Main()\n {\n var a = GetInt();\n var b = GetInt();\n\n var n_a = GetCount(1, a);\n var n_b = GetCount(2, b);\n \n Console.Write((n_a <= n_b) ? \"Vladik\" : \"Valera\");\n }\n\n private static int GetCount(int first, int sum)\n {\n var b = 2d * (first - 1);\n var d = b * b + 16d * sum;\n return (int)((Math.Sqrt(d) - b) / 4);\n }\n\n private static int GetInt()\n {\n int ch = Console.Read();\n\n while (ch < '0' || ch > '9')\n {\n ch = Console.Read();\n }\n\n int current = 0;\n while (ch >= '0' && ch <= '9')\n {\n current = (current * 10) + (ch - '0');\n ch = Console.Read();\n }\n\n return current;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication16\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int a = Int32.Parse(str.Split(' ')[0]);\n int b = Int32.Parse(str.Split(' ')[1]);\n\n int i = 1;\n while (a >= 0 || b >= 0)\n {\n a = a - i;\n if (a < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n\n i++;\n\n b = b - i;\n if (b < 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n i++;\n }\n \n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n string [] separados = Doces.Split(' ');\n int vladik = int.Parse(separados[0]);\n int valera = int.Parse(separados[1]);\n char entrega = '1';\n\n //Instanciando um contador que define quantos doces cada um deve dar\n int cont = 1;\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (entrega == '1' && vladik >= cont) { //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n entrega = '2';\n }\n else if (entrega == '2' && valera >= cont) { //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n entrega = '1';\n }\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont, entrega); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(int vladik, int valera, int cont, char entrega)\n {\n if (entrega == '1') //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n string [] separados = Doces.Split(' '); //Separa os valores de entrada da string\n int vladik = int.Parse(separados[0]); //Atribui os valores respectivos pra cada variavel\n int valera = int.Parse(separados[1]);\n char entrega = '1'; //Define quem deve entregar os doces, 1 - Quem entrega \u00e9 o Vladik, 2 - Quem entrega \u00e9 a valera\n\n //Instanciando um contador que define quantos doces cada um deve dar\n int cont = 1;\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (entrega == '1' && vladik >= cont) { //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n entrega = '2'; //Passa o indicador para a Valera\n }\n else if (entrega == '2' && valera >= cont) { //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n entrega = '1'; //Passa o indicador para Vladik\n }\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont, entrega); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(int vladik, int valera, int cont, char entrega)\n {\n if (entrega == '1') //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n\n long a = Int64.Parse(input[0]); \n long b = Int64.Parse(input[1]);\n\n long i = 1;\n long turn = 2;\n while(true)\n {\n if(turn%2 == 0)\n {\n if (a - i < 0)\n {\n a = 0;\n break;\n }\n a-=i;\n }\n else\n {\n if(b-i < 0)\n {\n b = 0;\n break;\n }\n b -= i;\n }\n i++;\n turn++;\n }\n if(a == 0 && turn % 2 == 0) { Console.WriteLine(\"Vladik\"); }\n else { Console.WriteLine(\"Valera\"); }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\n\nnamespace mo\n{\n class Program\n {\n public class Helper\n {\n public long a { get; set; }\n public long b { get; set; }\n\n public long c\n {\n get\n {\n var ab = a * 2;\n\n if (ab >= b)\n {\n return b;\n }\n\n return ab;\n\n }\n }\n\n }\n\n\n\n static void Main(string[] args)\n {\n var input = GetLongInputsFromLine();\n\n long a = input[0];\n long b = input[1];\n\n bool starta = true;\n\n int step = 1;\n\n while (!(a<0 || b<0))\n {\n if(starta)\n {\n a = a - step;\n starta = false;\n }\n else\n {\n b = b - step;\n starta = true;\n }\n\n step = step + 1;\n }\n\n if (a<0)\n {\n Console.WriteLine(\"Vladik\");\n \n }\n else\n {\n Console.WriteLine(\"Valera\");\n }\n \n\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static List GetIntegerInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToList();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n\n return input;\n }\n\n static Int64[] GetLongInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n\n\n public class CustomMath\n {\n public bool IsPrime(int num)\n {\n if (num <= 1)\n {\n return false;\n }\n\n double num_sqrt = Math.Sqrt(num);\n int num_fl = Convert.ToInt32(Math.Floor(num_sqrt));\n\n for (int i = 2; i <= num_fl; i++)\n {\n if (num % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n public Int64 gcd(Int64 a, Int64 b)\n {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n\n\n public Int64 lcm(Int64 a, Int64 b)\n {\n return (a * b) / gcd(a, b);\n }\n\n }\n\n public class Graph\n {\n\n public List[] graph = new List[10001];\n public long[] visited = new long[10001];\n\n\n public List Bfs(int from)\n {\n\n List ls = new List();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n visited[from] = 1;\n\n\n while (queue.Count() > 0)\n {\n long front = queue.Peek();\n\n List values = graph[front];\n\n if (values != null)\n {\n\n foreach (var item in values)\n {\n if (visited[item] == 0)\n {\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n else\n {\n ls.Add(front);\n }\n\n\n queue.Dequeue();\n\n }\n\n return ls;\n }\n\n\n public IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n }\n}"}], "negative_code": [{"source_code": "using System;\n\nnamespace cf_round_416_div_2_A\n{\n\tclass cf_round_416_div_2_A\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tlong valera, vladik;\n\t\t\tstring[] temp =Console.ReadLine().Split();\n\t\t\tvladik = readlong(temp[0]);\n\t\t\tvalera = readlong(temp[1]);\n\t\t\tint step = 1;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (step % 2 != 0)\n\t\t\t\t\tvladik -= step;\n\t\t\t\telse\n\t\t\t\t\tvalera -= step;\n\t\t\t\tif (vladik <= 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Valera\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (valera <= 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Vladik\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t++step;\n\t\t\t}\n\t\t\t//Console.ReadKey();\n\t\t}\n\n\t\tpublic static long readlong(string s)\n\t\t{\n\t\t\tint len = s.Length,pow=1;\n\t\t\tlong sum = 0;\n\t\t\tfor (int i = len - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tsum += pow * (s[i] - '0');\n\t\t\t\tpow *= 10;\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n long j=0;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (long i = 1; i <= a || i <= b; i++)\n {\n a = a - i +j ;\n if (a <= 0) {Console.WriteLine(\"Valera\"); return; }\n j = i+1;\n b = b + i - j;\n if (b <= 0) { Console.WriteLine(\"Vladik\"); return; }\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a,b;\n int p=0;\n int p1 = 0;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (long i=1;i<=a;i=i+2)\n {\n a=a-i;\n if (a <= 0 && p==p1 )\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n \n p = p + 1;\n }\n for (long j=2;j<=b;j=j+2)\n {\n b=b-j;\n if (b <= 0 && p==p1 )\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n p1=p1+1;\n }\n if (p >= p1 && p!=0) Console.WriteLine(\"Vladik\");\n else Console.WriteLine(\"Valera\");\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (long i = 1; i <= a || i <= b; i++)\n {\n a = a - (i * 2-1);\n if (a < 0) { Console.WriteLine(\"Vladik\"); return; }\n b = b - (i * 2);\n if (b < 0) { Console.WriteLine(\"Valera\"); return; }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (int i = 1; i <= a || i <= b; i++)\n {\n a = a - (i * 2-1);\n if (a < 0) { Console.WriteLine(\"Vladik\"); return; }\n b = b - (i * 2);\n if (b < 0) { Console.WriteLine(\"Valera\"); return; }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (int i = 1; i <= a || i <= b; i++)\n {\n a = a - (i * 2-1);\n if (a < 0) { Console.WriteLine(\"Valera\"); return; }\n b = b - (i * 2);\n if (b < 0) { Console.WriteLine(\"Vladik\"); return; }\n }\n\n\n /* for(long i=1;i<10000000000;i=i+2){\n a = a-i ;\n if(a<0){\n Console.WriteLine(\"Vladik\"); \n break ;\n }\n b =b-i-1 ;\n if(b<0){\n Console.WriteLine(\"Valera\"); \n break ;\n }*/\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a,b;\n int p=0;\n int p1 = 0;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (long i=1;i<=a;i=i+2)\n {\n a=a-i;\n if (a <= 0 && p==p1 )\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n \n p = p + 1;\n }\n for (long j=2;j<=b;j=j+2)\n {\n b=b-j;\n if (b <= 0 && p==p1 )\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n p1=p1+1;\n }\n if (p >= p1) Console.WriteLine(\"Vladik\");\n else Console.WriteLine(\"Valera\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Windows_\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string s = Console.ReadLine();\n string[] number = s.Split();\n long.TryParse(number[0], out a);\n long.TryParse(number[1], out b);\n for (int i = 1; i <= a || i <= b; i++)\n {\n a = a - (i * 2-1);\n if (a <= 0) { Console.WriteLine(\"Valera\"); return; }\n b = b - (i * 2);\n if (b <= 0) { Console.WriteLine(\"Vladik\"); return; }\n }\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n var vlad = arr[0];\n var val = arr[1];\n\n long i = 0;\n while (true)\n {\n vlad -= 2 * i - 1;\n\n if (vlad < 0)\n {\n Console.WriteLine(\"Vladik\");\n return;\n }\n\n val -= 2 * i;\n if (val < 0)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n\n i++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int a,b;\n\n public void Solve()\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n\n int curCandy = 1;\n int curTurn = 0;\n\n while(true)\n {\n if (curTurn == 0)\n a -= curCandy;\n else\n b -= curCandy;\n\n curCandy++;\n\n if(a<0 || b<0)\n {\n break;\n }\n }\n\n if (a < 0)\n ioHelper.WriteLine(\"Vladik\");\n else\n ioHelper.WriteLine(\"Valera\");\n\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static ulong _step;\n static void Main(string[] args)\n {\n var input = Console.ReadLine()?.Split(' ');\n var a = Convert.ToUInt64(input[0]);\n var b = Convert.ToUInt64(input[1]);\n var flagLose = 0;\n\n _step = 1;\n while (flagLose == 0)\n {\n if (!Check(ref a))\n {\n flagLose = 1;\n break;\n }\n if (!Check(ref b)) flagLose = 1;\n }\n var output = flagLose == 1? \"Vladik\" : \"Valera\";\n Console.WriteLine(output);\n }\n\n private static bool Check(ref ulong n)\n {\n if (n < _step) return false;\n n -= _step++;\n return true;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _811A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]), b = long.Parse(input[1]);\n bool turn = true;\n for (int i = 1;; i++)\n {\n if (turn)\n {\n a -= i;\n if (a <= 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n }\n else\n {\n b -= i;\n if (b <= 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n }\n turn = !turn;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _811A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]), b = long.Parse(input[1]);\n long l = 1, r = 100000;\n while (l < r)\n {\n long mid = (l + r) / 2;\n long x = (mid + 1) / 2, y = mid / 2;\n long c = a - x * x;\n long d = b - (y + 1) * y;\n if (c > 0 && d > 0)\n l = mid;\n else if (c <= 0 && d <= 0)\n r = mid - 1;\n else\n {\n l = mid;\n r = mid;\n \n }\n }\n long x_ = (l + 1) / 2;\n if (a - x_ * x_ > 0)\n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _416A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] splitInput = Console.ReadLine().Split(' ');\n int aInput = int.Parse(splitInput[0]);\n int bInput = int.Parse(splitInput[1]);\n int aCount = (int)Math.Sqrt(aInput);\n int bCount = (int)((-1 + Math.Sqrt(1 + 4 * bInput)) / 2);\n if (aCount > bCount)\n {\n Console.WriteLine(\"Valera\");\n }\n else\n {\n Console.WriteLine(\"Vladik\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n while (0 < x && 0 < y)\n {\n if (step % 2 == 0)\n {\n y -= step;\n }\n else\n {\n x -= step;\n }\n step++;\n }\n \n Console.WriteLine(ans[x <= 0 ? 1 : 0]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n while (0 < x && 0 < y)\n {\n if (step % 2 == 0)\n {\n y -= step;\n }\n else\n {\n x -= step;\n }\n step++;\n }\n \n Console.Write(ans[x <= 0 ? 1 : 0]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n int dx = 1;\n int dy = 2;\n while (0 < x && 0 < y)\n {\n if (step % 2 == 0)\n {\n y -= dy;\n dy += 2;\n }\n else\n {\n x -= dx;\n dx += 3;\n }\n step++;\n }\n\n Console.WriteLine(ans[x < y ? 0 : 1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n while (0 < x && 0 < y)\n {\n if (step % 2 == 0)\n {\n y -= step;\n }\n else\n {\n x -= step;\n }\n step++;\n }\n\n Console.WriteLine(ans[x < y ? 1 : 0]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n long x = long.Parse(lines[0]);\n long y = long.Parse(lines[1]);\n string[] ans = { \"Vladik\", \"Valera\" };\n\n int step = 1;\n while (0 < x && 0 < y)\n {\n if (step % 2 == 0)\n {\n y -= step;\n }\n else\n {\n x -= step;\n }\n step++;\n }\n\n Console.WriteLine(ans[x < y ? 0 : 1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n try {\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int vl = ar[0];\n int vo = ar[1];\n int offer = 1;\n while (vl>=0 && vo>=0)\n {\n if (vl - offer >= 0)\n {\n vl -= offer;\n offer++;\n }\n else\n {\n vl -= offer;\n break;\n }\n if (vo - offer >= 0)\n {\n vo -= offer;\n offer++;\n }\n else\n {\n vo -= offer;\n break;\n }\n Console.WriteLine(vl+\" \"+vo);\n }\n if(vo<0)\n Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n Console.ReadKey();\n\n\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n try {\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int vl = ar[0];\n int vo = ar[1];\n int offer = 1;\n while (vl>0 && vo>0)\n {\n vl -= offer;\n offer++;\n vo -= offer;\n offer++;\n // Console.WriteLine(vl+\" \"+vo);\n }\n if(vo<0)\n Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n Console.ReadKey();\n\n\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication34\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n var vlad = (int)Math.Sqrt(n[0]);\n var valera = (int)((Math.Sqrt(n[1]*4+1)-1)/2);\n if (vlad > valera) Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication34\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n var vlad = (int)Math.Sqrt(n[0]);\n var valera = (int)(Math.Sqrt(n[1]*4+1)-1)/2;\n if (vlad > valera) Console.WriteLine(\"Valera\");\n else\n Console.WriteLine(\"Vladik\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Competitive\n{\n class Program\n {\n static void Main(string[] args)\n {\n var l = Console.ReadLine().Split(' ').Select(int.Parse).Reverse().ToArray();\n\n for (int i = 1; ;i++)\n {\n l[i % 2] -= i;\n \n if (l[0] < 0)\n {\n Console.WriteLine(\"Valeria\");\n break;\n }\n\n if (l[1] < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\n\nnamespace mo\n{\n class Program\n {\n public class Helper\n {\n public long a { get; set; }\n public long b { get; set; }\n\n public long c\n {\n get\n {\n var ab = a * 2;\n\n if (ab >= b)\n {\n return b;\n }\n\n return ab;\n\n }\n }\n\n }\n\n\n\n static void Main(string[] args)\n {\n var input = GetLongInputsFromLine();\n\n long a = input[0];\n long b = input[1];\n\n bool starta = true;\n\n int step = 1;\n\n while (!(a<=0 || b<=0))\n {\n if(starta)\n {\n a = a - step;\n starta = false;\n }\n else\n {\n b = b - step;\n starta = true;\n }\n\n step = step + 1;\n }\n\n if (a<=0)\n {\n Console.WriteLine(\"Valera\");\n }\n else\n {\n Console.WriteLine(\"Vladik\");\n }\n \n\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static List GetIntegerInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToList();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n\n return input;\n }\n\n static Int64[] GetLongInputsFromLine()\n {\n var inputs = (Console.ReadLine()).Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n\n\n public class CustomMath\n {\n public bool IsPrime(int num)\n {\n if (num <= 1)\n {\n return false;\n }\n\n double num_sqrt = Math.Sqrt(num);\n int num_fl = Convert.ToInt32(Math.Floor(num_sqrt));\n\n for (int i = 2; i <= num_fl; i++)\n {\n if (num % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n public Int64 gcd(Int64 a, Int64 b)\n {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n\n\n public Int64 lcm(Int64 a, Int64 b)\n {\n return (a * b) / gcd(a, b);\n }\n\n }\n\n public class Graph\n {\n\n public List[] graph = new List[10001];\n public long[] visited = new long[10001];\n\n\n public List Bfs(int from)\n {\n\n List ls = new List();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n visited[from] = 1;\n\n\n while (queue.Count() > 0)\n {\n long front = queue.Peek();\n\n List values = graph[front];\n\n if (values != null)\n {\n\n foreach (var item in values)\n {\n if (visited[item] == 0)\n {\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n else\n {\n ls.Add(front);\n }\n\n\n queue.Dequeue();\n\n }\n\n return ls;\n }\n\n\n public IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n public static void Main()\n {\n var a = GetInt();\n var b = GetInt();\n\n var n_a = GetCount(1, a);\n var n_b = GetCount(2, b);\n \n Console.Write((n_a <= n_b) ? \"Vladik\" : \"Valera\");\n }\n\n private static double GetCount(int first, int sum)\n {\n var b = 2 * (first - 1);\n var d = b * b + 16 * sum;\n var n1 = (Math.Sqrt(d) - b) / 4;\n var n2 = (- Math.Sqrt(d) - b) / 4;\n\n return (int)(n1 < 0 ? n2 : n1);\n }\n\n private static int GetInt()\n {\n int ch = Console.Read();\n\n while (ch < '0' || ch > '9')\n {\n ch = Console.Read();\n }\n\n int current = 0;\n while (ch >= '0' && ch <= '9')\n {\n current = (current * 10) + (ch - '0');\n ch = Console.Read();\n }\n\n return current;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n public static void Main()\n {\n var a = GetInt();\n var b = GetInt();\n\n var n_a = GetCount(1, a);\n var n_b = GetCount(2, b);\n\n var result = (n_a > n_b) ? \"Vladik\" : \"Valera\";\n Console.Write(result);\n }\n\n private static int GetCount(int first, int sum)\n {\n var b = 2 * first - 1;\n var d = b * b + 16 * sum;\n var n1 = (Math.Sqrt(d) - b) / 4;\n var n2 = (- Math.Sqrt(d) - b) / 4;\n\n return (int)(n1 < 0 ? n2 : n1);\n }\n\n private static int GetInt()\n {\n int ch = Console.Read();\n\n while (ch < '0' || ch > '9')\n {\n ch = Console.Read();\n }\n\n int current = 0;\n while (ch >= '0' && ch <= '9')\n {\n current = (current * 10) + (ch - '0');\n ch = Console.Read();\n }\n\n return current;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication16\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int a = Int32.Parse(str.Split(' ')[0]);\n int b = Int32.Parse(str.Split(' ')[1]);\n\n int i = 1;\n while (a > 0 || b > 0)\n {\n a = a - i;\n if (a < 0)\n {\n Console.WriteLine(\"Vladik\");\n break;\n }\n\n i++;\n\n b = b - i;\n if (b < 0)\n {\n Console.WriteLine(\"Valera\");\n break;\n }\n i++;\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = 0;\n int i = 1;\n while (count[1] >= 0 && count[0] >= 0)\n {\n count[0] -= i;\n count[1] -= 1 + 1;\n i += 2;\n }\n Console.WriteLine(count[0]<0? \"Vladik\": \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _811A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n\n Console.WriteLine(a > b ? \"Vladik\" : \"Valera\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var vladik = true;\n var cnt = 1;\n while (arr[vladik ? 0 : 1] > cnt)\n {\n arr[vladik ? 0 : 1] -= cnt;\n cnt++;\n vladik = !vladik;\n }\n\n Console.WriteLine(vladik ? \"Vladik\" : \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var valera = true;\n var cnt = 1;\n while (arr[valera ? 0 : 1] > cnt)\n {\n arr[valera ? 0 : 1] -= cnt;\n cnt++;\n valera = !valera;\n }\n\n Console.WriteLine(!valera ? \"Vladik\" : \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var valera = true;\n var cnt = 1;\n while (arr[valera ? 0 : 1] >= cnt)\n {\n arr[valera ? 0 : 1] -= cnt;\n cnt++;\n valera = !valera;\n }\n\n Console.WriteLine(!valera ? \"Vladik\" : \"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Task_811A\n{\n class Program\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split(' ');\n int a = int.Parse(str[0]);\n int b = int.Parse(str[1]);\n int c = (int)Math.Sqrt(a);\n if (c < b)\n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n#region sln\nnamespace Runhr.Test.CodeForces.ProblemSets.R416D2.A\n{\n class Solution\n {\n static void Main(String[] args)\n {\n string[] parts = Console.ReadLine().Split(' ');\n double a = double.Parse(parts[0]);\n double b = double.Parse(parts[1]);\n\n int steps_vladik = Convert.ToInt32(Math.Floor(Math.Sqrt(b)));\n\n double n_non = (-1 + Math.Sqrt(1d - 4d * (a * -1d))) / 2d;\n int steps_valere = Convert.ToInt32(Math.Floor(n_non));\n\n\n if (steps_vladik <= steps_valere) \n Console.WriteLine(\"Vladik\");\n else\n Console.WriteLine(\"Valera\");\n\n }\n }\n}\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n \n int nVld = (int)Math.Sqrt(a);\n int nVal = (int)(Math.Sqrt(1 + (b * 4) ) - 1 ) / 2;\n \n if(nVld<=nVal)\n Console.WriteLine(\"Vladik\");\n else \n Console.WriteLine(\"Valera\");\n \n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n \n int nVld = 0;\n int nVal = 0;\n \n for(int i = 1;i<=a;i+=2)\n {\n nVld++;\n }\n for(int i = 2;i<=b;i+=2)\n {\n nVal++;\n }\n \n if(nVld<=nVal)\n Console.WriteLine(\"Vladik\");\n else \n Console.WriteLine(\"Valera\");\n \n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n \n int vladikSum = a/2 *(2*1+(a-1)*2);\n int valeraSum = b/2 *(2*2+(b-1)*2);\n \n if(b<2)\n {\n Console.WriteLine(\"Valera\");\n return;\n }\n \n if (vladikSum <= valeraSum)\n Console.WriteLine(\"Vladik\");\n else Console.WriteLine(\"Valera\");\n \n \n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n //Separando a quantidade de doces pra cada um\n string[] separados = Doces.Split(' ');\n double vladik = double.Parse(separados[0]);\n double valera = double.Parse(separados[1]);\n char entrega = '1';\n\n //Instanciando um contador que define quantos doces cada um deve dar\n int cont = 1;\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (entrega == '1' && vladik >= cont) { //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n entrega = '2';\n }\n else if (entrega == 2 && valera >= cont) { //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n entrega = '1';\n }\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont, entrega); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(double vladik, double valera, int cont, char entrega)\n {\n if (entrega == '1') //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n //Separando a quantidade de doces pra cada um\n string[] separed = Doces.Split(' ');\n double vladik = double.Parse(separed[0]);\n double valera = double.Parse(separed[1]);\n\n //Instanciando um contador que define quantos doces cada um deve dar\n double cont = 1;\n\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (cont % 2 != 0) //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n else //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(double vladik, double valera, double cont)\n {\n if (vladik < cont) //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Menu(); //Chamando o m\u00e9todo para exibir a entrada\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n\n static void Menu()\n {\n //Solicitando uma entrada\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n //Separando a quantidade de doces pra cada um\n string[] separados = Doces.Split(' ');\n double vladik = int.Parse(separados[0]);\n double valera = int.Parse(separados[1]);\n int entrega = 1;\n\n //Instanciando um contador que define quantos doces cada um deve dar\n int cont = 1;\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (entrega == 1)\n { //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n entrega = 2;\n }\n else\n { //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n entrega = 1;\n }\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(double vladik, double valera, int cont)\n {\n if (vladik > valera) //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Menu(); //Chamando o m\u00e9todo para exibir a entrada\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n\n static void Menu()\n {\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Vladik_and_Courtesy\n{\n public static class Opera\u00e7\u00f5es\n {\n static public string Doces; //Recebe o valor solicitado no come\u00e7o da quantidade de doces que cada um tem\n\n\n static public void EntregaDoces()\n {\n //Separando a quantidade de doces pra cada um\n string[] separados = Doces.Split(' ');\n double vladik = double.Parse(separados[0]);\n double valera = double.Parse(separados[1]);\n string entrega = \"vladik\";\n\n //Instanciando um contador que define quantos doces cada um deve dar\n int cont = 1;\n\n while (vladik >= cont || valera >= cont) //Condi\u00e7\u00e3o de que enquanto a quantidade de doces que um tem seja menor que a quantidade que ele deve dar\n {\n if (entrega == \"vladik\" && vladik >= cont)\n { //Se o contador for \u00edmpar, o vladik deve dar o doce\n vladik -= cont; //Vladik entrega a quantidade de doces definida no contador\n entrega = \"valera\";\n }\n else if (entrega == \"valera\" && valera >= cont)\n { //Sen\u00e3o, a Valera deve dar o doce\n valera -= cont; //Valera entrega a quantidade de doces definida no contador\n entrega = \"vladik\";\n }\n cont++; //Soma um valor no contador\n }\n\n Exibe(vladik, valera, cont); //Fun\u00e7\u00e3o pra exibir o nome de quem n\u00e3o pode dar a quantidade de doces definida\n }\n\n static private void Exibe(double vladik, double valera, int cont)\n {\n if (vladik > valera ) //Se Vladik n\u00e3o tiver a quantidade, exibe o nome dele\n Console.WriteLine(\"Vladik\");\n else //Sen\u00e3o, O nome da Valera \u00e9 exibida\n Console.WriteLine(\"Valera\");\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Menu(); //Chamando o m\u00e9todo para exibir a entrada\n Opera\u00e7\u00f5es.EntregaDoces(); //M\u00e9todo para realizar a distribui\u00e7\u00e3o entre eles\n }\n\n static void Menu()\n {\n Opera\u00e7\u00f5es.Doces = Console.ReadLine(); //Colocando o valor dentro do objeto\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Divisivel_por_8\n{\n static public class Operacoes\n {\n static public string Num; //Guarda o n\u00famero definido pelo usu\u00e1rio\n static public string Divisivel = \"NO\"; //J\u00e1 inicia a vari\u00e1vel com o valor de que n\u00e3o \u00e9 divis\u00edvel\n //static public List Lista = new List(); //Cria uma lista para armazenar os valores\n static public string Lista;\n\n static public void RemovePos() //Fun\u00e7\u00e3o para remover o d\u00edgito na string\n {\n string temp = Num; //Vari\u00e1vel tempor\u00e1ria recebe o valro de Num, onde o valor do mesmo n\u00e3o ser\u00e1 afetado, somente o da \"temp\"\n int pos = 0, quantidade = 1; //Um contador para indicar qual d\u00edgito da substring remover \n\n while (quantidade - 1 < Num.Length - 1)\n {\n while (pos < Num.Length)\n {\n if (decimal.Parse((temp)) % 8 == 0) //Ele vai testar todo o n\u00famero pra ver se \u00e9 divis\u00edvel\n {\n Divisivel = \"YES\"; //Se for divis\u00edvel, ele altera pra YES\n //Lista.Add(temp); //E tamb\u00e9m adiciona o n\u00famero na lista criada\n Lista = temp;\n }\n\n temp = Num; //Ele vai receber o valor original da string para poder ser retirado o d\u00edgito do valor original\n try\n {\n temp = Num.Remove(pos, quantidade); //Ser\u00e1 removido um d\u00edgito qualquer do n\u00famero (ex: 3454 -> 344)\n }\n catch (System.Exception)\n {\n break;\n }\n\n pos++; //Soma um no contador pra definir qual o pr\u00f3ximo a ser removido do n\u00famero original\n }\n pos = 0;\n quantidade++;\n }\n\n Exibe();\n }\n\n static private void Exibe()\n {\n Console.WriteLine(Divisivel);\n\n if (Divisivel == \"YES\")\n {\n Console.WriteLine(Lista);\n }\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Operacoes.Num = Console.ReadLine(); //Solicita uma entrada e salva dentro da classe\n Operacoes.RemovePos(); //Chama a fun\u00e7\u00e3o para calcular\n }\n }\n}\n"}], "src_uid": "87e37a82be7e39e433060fd8cdb03270"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Lazy_Security_Guard\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n int min = int.MaxValue;\n for (int i = 1; i <= n; i++)\n {\n int k = (n + i - 1)/i;\n int p = 2*(i + k);\n min = Math.Min(min, p);\n }\n\n writer.WriteLine(min);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int N = int.Parse(Console.ReadLine()), sqr = (int)Math.Sqrt(N);\n Console.WriteLine(2 * Math.Ceiling(2 * Math.Sqrt(N)));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int N = int.Parse(Console.ReadLine());\n Console.WriteLine(2 * Math.Ceiling(2 * Math.Sqrt(N)));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int N = int.Parse(Console.ReadLine()), sqr = (int)Math.Sqrt(N);\n Console.WriteLine(4 * sqr + (N - (sqr * sqr) == 0 ? 0 : N - (sqr * sqr) <= sqr ? 2 : 4));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string r=Console .ReadLine() ;\n int t=int.Parse (r);\n //a=4\n double a=Math.Ceiling( Math.Sqrt(t));\n\n double f = a * a - t;\n double d = a - Math.Floor(f / a);\n Console.WriteLine(2*(a+d));\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result;\n int n = int.Parse(Console.ReadLine());\n int newNumber = (int)Math.Ceiling(Math.Sqrt(n));\n int fullLineNumber = n / newNumber;\n int leftBlocksInLine = n % newNumber;\n if (newNumber * newNumber == n)\n result = newNumber * 4;\n else if (leftBlocksInLine == 0) result = newNumber * 2 + fullLineNumber * 2;\n else result = newNumber * 2 + fullLineNumber * 2 + 2;\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sqrt = (int)Math.Sqrt(n);\n n -= sqrt * sqrt;\n int rez = sqrt*4+(n==0?0:n<=sqrt?2:4); \n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var k = (int)Sqrt(n);\n var m = n - k * k;\n var ans = 4 * k;\n if (m != 0)\n {\n if (m <= k)\n ans += 2;\n else\n ans += 4;\n }\n Write(ans);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd()\n {\n return reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() =>\n (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() =>\n (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() =>\n (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\n\nnamespace Lazy_guard859B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N, helper, ans;\n double d;\n N = int.Parse(Console.ReadLine());\n //double doubleVal = System.Convert.ToDouble(input);\n d = Math.Sqrt(N);\n // helper = (int) Math.Round(d);\n helper = Convert.ToInt32(Math.Round(d));\n\n if (helper > d || helper == d) ans = 4 * helper;\n else ans = (4 * helper) + 2;\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(2*Math.Ceiling(2*Math.Sqrt(n))) ;\n }\n }\n}"}, {"source_code": "\tusing System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int prev = 8;\n\n\t\t\tif (n <= 0) { Console.WriteLine(0); return; }\n if (n == 1) { Console.WriteLine(4); return;}\n\t\t\tif (n == 2) { Console.WriteLine(6); return; }\n\t\t\tif (n == 3) { Console.WriteLine(8); return; }\n\t\t\tif (n == 4) { Console.WriteLine(8); return; }\n\n for (int i = 5; i <= n; i ++) \n {\n int c = (int)Math.Sqrt(i);\n\n if (i == c * c + 1)\n {\n prev += 2;\n continue;\n }\n\n if (i == c * (c + 1) + 1)\n {\n prev += 2;\n continue;\n }\n\n\n }\n\n Console.WriteLine(prev);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int t = (int)Math.Sqrt(n);\n if (Math.Sqrt(n) % 1 == 0) Console.WriteLine(4 * t);\n else if (n <= t * (t + 1)) Console.WriteLine(4 * t + 2);\n else Console.WriteLine(4 * (t + 1));\n }\n }\n}\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n \npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\n\t\t//var ceiling = Math.Ceiling(Math.Sqrt(n));\n\t\tvar floor = Math.Floor(Math.Sqrt(n));\n\n\t\tvar i = 1;\n\t\twhile (i * floor < n)\n\t\t{\n\t\t\ti++;\n\t\t}\n\n\t\tConsole.WriteLine(i*2 + floor * 2);\n\t}\n\n\n}\n"}, {"source_code": "// Problem: 859B - Lazy Security Guard\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass LazySecurityGuard\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n uint n;\n if (!UInt32.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 1000000)\n return -1;\n ushort a = 1;\n ushort aNext = 2;\n while (aNext*aNext <= n)\n {\n a = aNext;\n aNext++;\n }\n ushort r = Convert.ToUInt16 (n-a*a);\n ushort ans = Convert.ToUInt16 (r == 0 ? 4*a : (r > a ? 4*a+4 : 4*a+2));\n Console.WriteLine (ans);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Lazy_Security_Guard\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int x1 = Convert.ToInt32(Math.Sqrt(x));\n int e = x - (x1 * x1);\n if ((((x1 + 1) * (x1 + 1) - (x1 * x1)) / 2) + 1 > e) Console.WriteLine((x1 * 4) + (2*(e>0?1:0)));\n else\n {\n Console.WriteLine((x1 * 4) + 4);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problem2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double num = double.Parse(Console.ReadLine());\n double ans = Math.Sqrt(num);\n double round = Math.Ceiling(ans);\n int length = 0;\n double output = 0;\n if (num == 1)\n {\n output = 4;\n }\n else\n { \n for (int i = 1; i < num; i++)\n { \n if (round* i >= num)\n {\n length = i;\n break;\n }\n }\n output = (length * 2) + (round * 2);\n }\n \n Console.WriteLine(output);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MemSQL3R1P2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n int Limit = (int)Math.Ceiling(Math.Sqrt(N));\n var XY = Get(Limit, N);\n Console.WriteLine(2 * (XY.Item1 + XY.Item2));\n }\n\n static Tuple Get(int Limit, int N)\n {\n for (int i = 1; i <= Limit; i++)\n for (int j = 1; j <= Limit; j++)\n if (i * j >= N)\n return Tuple.Create(i, j);\n\n return null;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int i = 0;\n for (i = 1; i <= 1000; i++)\n {\n if (i * i == n) break;\n if (i * i > n)\n {\n i--;\n break;\n }\n }\n if (i * i == n)\n {\n Console.WriteLine(i*4);\n }\n else\n {\n int x = n - i * i;\n int p = i * 4;\n if (x > i) p += 4;\n else p += 2;\n Console.WriteLine(p);\n }\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace qwerty\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 n = Int32.Parse(Console.ReadLine());\n\n int a = (int)(Math.Sqrt(n));\n int b = n / a;\n int ost = n - a * b;\n if (ost == 0)\n Console.WriteLine(2 * (a + b));\n else\n Console.WriteLine(2 * (a + b+1));\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n ReadData re;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n re = new ReadData();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n int N = re.i();\n for(int i=0;i<1000000;i++){\n if(i*i >= N){\n sb.Append(4*i+\"\\n\");\n return;\n }\n if(i*(i+1) >= N){\n sb.Append((4*i+2)+\"\\n\");\n return;\n }\n }\n }\n}\nclass ReadData{\n string[] str;\n int counter;\n public ReadData(){\n counter = 0;\n }\n public string s(){\n if(counter == 0){\n str = Console.ReadLine().Split(' ');\n counter = str.Length;\n }\n counter--;\n return str[str.Length-counter-1];\n }\n public int i(){\n return int.Parse(s());\n }\n public long l(){\n return long.Parse(s());\n }\n public double d(){\n return double.Parse(s());\n }\n public int[] ia(int N){\n int[] ans = new int[N];\n for(int j=0;j[] g(int N,int[] f,int[] t){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(int N,int M){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(){\n int N = i();\n int M = i();\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j 0 ? longSqrt + 1 : longSqrt;\n\n\t\t\tif (start * (start - 1) >= n) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(2 * start + 2 * (start - 1));\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(4 * start);\n\t\t\t}\n\t\t}\n\n\t\tstatic int ParseSize(string size) \n\t\t{\n\t\t\tswitch (size) \n\t\t\t{\n\t\t\t\tcase \"S\":\n\t\t\t\t\treturn 0;\n\t\t\t\tcase \"M\":\n\t\t\t\t\treturn 1;\n\t\t\t\tcase \"L\":\n\t\t\t\t\treturn 2;\n\t\t\t\tcase \"XL\":\n\t\t\t\t\treturn 3;\n\t\t\t\tcase \"XXL\":\n\t\t\t\t\treturn 4;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NotImplementedException();\n\t\t\t}\n\t\t}\n\n\t\tstatic string IntToSize(int size)\n\t\t{\n\t\t\tswitch (size)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\treturn \"S\";\n\t\t\t\tcase 1:\n\t\t\t\t\treturn \"M\";\n\t\t\t\tcase 2:\n\t\t\t\t\treturn \"L\";\n\t\t\t\tcase 3:\n\t\t\t\t\treturn \"XL\";\n\t\t\t\tcase 4:\n\t\t\t\t\treturn \"XXL\";\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new NotImplementedException();\n\t\t\t}\n\t\t}\n\n\t\tstatic IList GetListForSize(int size)\n\t\t{\n\t\t\tvar list = new List();\n\t\t\tswitch (size)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tlist.AddRange(new[] { 1, 2, 3, 4 });\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tlist.AddRange(new[] { 2, 0, 3, 4 });\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tlist.AddRange(new[] { 3, 1, 4, 0 });\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tlist.AddRange(new[] { 4, 2, 1, 0 });\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tlist.AddRange(new[] { 3, 2, 1, 0 });\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var m = (long) Math.Sqrt(n);\n var total = m * m;\n var d = n - total;\n var result = 3L * m;\n \n if (d != 0) {\n while (d / m > 0) {\n result += 2L;\n d -= m;\n }\n if (d > 0) {\n result += 2L + d + (m - d);\n }\n else {\n result += m;\n }\n }\n else {\n result += m;\n }\n\n sw.WriteLine(result);\n }\n \n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int a = int.Parse(Console.ReadLine());\n //b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int g = (int)Math.Floor(Math.Sqrt(a));\n double s = (double)g * 4;\n double d = a - (g*g);\n double x = d/g;\n d = (Math.Ceiling(x))*2;\n s += d;\n Console.WriteLine(s);\n \n }\n \n\n\n\n }\n\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n\n\n double n = double.Parse(Console.ReadLine());\n\n double k = Math.Ceiling(Math.Sqrt(n));\n\n double s = Math.Floor(n / k);\n\n double res = 0;\n\n \n \n\n if ( n-k*s!=0 )\n {\n res = (k * 2 + s * 2) + 2;\n }\n else\n {\n res = (k * 2 + s * 2);\n }\n \n \n\n Console.WriteLine(res);\n\n\n \n\n // while (Console.ReadKey().Key != ConsoleKey.Enter) ;\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int D { get; set; }\n public int F { get; set; }\n public int T { get; set; }\n public long C { get; set; }\n }\n static void Main(String[] args)\n {\n var n = int.Parse(Console.ReadLine().TrimEnd());\n long pMin = long.MaxValue;\n if (n == 1)\n {\n pMin = 4;\n }\n for(var i = 1; i < n; i++)\n {\n double x = i;\n long y = (long)Math.Ceiling(n / x);\n long tr = 2 * (long)x + 2 * y;\n pMin = Math.Min(pMin, tr);\n }\n writer.WriteLine(pMin);\n writer.Flush();\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n \n int m = 1;\n while (m * m <= n)\n m++;\n m--;\n\n int ans = 4 * m;\n if (n - m * m > 0)\n ans += 2;\n if (n - m * m > m)\n ans += 2;\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace MemSQL_09_17_2017_Q2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n int sqrt = (int)Math.Round(Math.Sqrt(Convert.ToDouble(input)), 0);\n int result = 0;\n \n if(input <= sqrt * sqrt)\n {\n result = sqrt * 4;\n }\n else if (input > sqrt * sqrt)\n {\n result = (sqrt + (sqrt + 1)) * 2;\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class B\n {\n private static ThreadStart s_threadStart = new B().Go;\n\n private void Go()\n {\n int N = GetInt();\n int s = (int)Math.Ceiling(Math.Sqrt(N));\n int ans = s;\n while (ans * s >= N)\n {\n ans--;\n }\n\n Wl(2 * (s + ans + 1));\n }\n\n #region Template\n\n private static StringBuilder output = new StringBuilder();\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n output.Length = 0;\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n Console.Write(output);\n timer.Stop();\n Console.Error.WriteLine(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n do\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n } while (string.IsNullOrEmpty(ioEnum.Current));\n\n return ioEnum.Current;\n }\n\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n W(o);\n output.Append(Console.Out.NewLine);\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n W(enumerable);\n output.Append(Console.Out.NewLine);\n }\n\n private static void W(T o)\n {\n if (o is double)\n {\n Wd((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wd((o as float?).Value, \"\");\n }\n else\n output.Append(o.ToString());\n }\n\n private static void W(IEnumerable enumerable)\n {\n W(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wd(double d, string format)\n {\n W(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}], "negative_code": [{"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace qwerty\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 n = Int32.Parse(Console.ReadLine());\n\n int k = (int)(Math.Sqrt(n));\n\n int ost = n % k;\n\n int res = 0;\n res += 4 * k;\n if (ost == 0)\n Console.WriteLine(res);\n else\n {\n res += 2;\n Console.WriteLine(res);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int N = int.Parse(Console.ReadLine()), sqr = (int)Math.Sqrt(N);\n Console.WriteLine(4 * sqr + (N % (sqr * sqr) == 0 ? 0 : N % (sqr * sqr) <= sqr ? 2 : 4));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result;\n int n = int.Parse(Console.ReadLine());\n int newNumber = (int)Math.Ceiling(Math.Sqrt(n));\n int fullLineNumber = n / newNumber;\n //int leftBlocksInLine = n % newNumber;\n if (newNumber*newNumber == n)\n result = newNumber * 4;\n else result = newNumber * 2 + fullLineNumber * 2 + 2;\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result;\n int n = int.Parse(Console.ReadLine());\n int newNumber = (int)Math.Ceiling(Math.Sqrt(n));\n int fullLineNumber = n / newNumber;\n int leftBlocksInLine = n % newNumber;\n //int leftBlocksInLine = n % newNumber;\n if (newNumber * newNumber == n)\n result = newNumber * 4;\n else if (leftBlocksInLine == 0) result = newNumber * fullLineNumber;\n else result = newNumber * 2 + fullLineNumber * 2 + 2;\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sqrt = (int)Math.Sqrt(n);\n n -= sqrt * sqrt;\n int rez = sqrt*4+(n==0?0:n c * c + 1 && i < c * (c + 1)) \n {\n continue;\n }\n\n if (i == c * (c + 1))\n {\n prev += 2;\n continue;\n }\n\n\n }\n\n Console.WriteLine(prev);\n }\n }"}, {"source_code": "\tusing System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int prev = 8;\n\n\t\t\tif (n <= 0) { Console.WriteLine(0); return; }\n if (n == 1) { Console.WriteLine(4); return;}\n\t\t\tif (n == 2) { Console.WriteLine(6); return; }\n\t\t\tif (n == 3) { Console.WriteLine(8); return; }\n\t\t\tif (n == 4) { Console.WriteLine(8); return; }\n\n for (int i = 5; i <= n; i ++) \n {\n int c = (int)Math.Sqrt(i);\n\n if (i == c * c + 1)\n {\n prev += 2;\n continue;\n }\n\n if (i == c * (c + 1))\n {\n prev += 2;\n continue;\n }\n\n\n }\n\n Console.WriteLine(prev);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int t = Convert.ToInt32(Math.Sqrt(n));\n if (n <= t * (t + 1)) Console.WriteLine(4 * t + 2);\n else Console.WriteLine(4 * (t + 1));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int t = Convert.ToInt32(Math.Sqrt(n));\n if (Math.Sqrt(n) % 1 == 0) Console.WriteLine(4 * t);\n else if (n <= t * (t + 1)) Console.WriteLine(4 * t + 2);\n else Console.WriteLine(4 * (t + 1));\n }\n }\n}\n"}], "src_uid": "414cc57550e31d98c1a6a56be6722a12"} {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n string str = Console.ReadLine();\n string[] newstr = str.Split( new char[] { 'H', 'Q', '9'} );\n if(newstr[0].Equals( str ))\n Console.WriteLine( \"NO\" );\n else\n Console.WriteLine( \"YES\" );\n \n }\n}", "positive_code": [{"source_code": "using System;\n\nnamespace Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var output = \"NO\";\n\n foreach(var s in str)\n {\n if (s == 'H' || s == 'Q' || s == '9')\n {\n output = \"YES\";\n break;\n }\n\n }\n Console.WriteLine(output);\n Console.ReadLine();\n }\n\n \n\n }\n\n}\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Runtime.InteropServices.ComTypes;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var sb = new StringBuilder(str);\n var symb = new List()\n {\n 'H',\n 'Q',\n '9',\n };\n for(int i=0;i 0 ? \"YES\" : \"NO\");\n // Console.ReadKey();\n }\n \n\n }\n}"}, {"source_code": "\n//FelisDJ =*w*=\n\nusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n bool ck = false;\n for(int i =0 ;i encodeSecondString[i])\n // {\n // answer = 1;\n // break;\n // }\n // else if (encodeFirstString[i] < encodeSecondString[i])\n // {\n // answer = -1;\n // break;\n // }\n //}\n //Console.WriteLine(answer);\n ////Console.ReadKey();\n ///\n\n //int spaciousness = 0;\n //int passengers = 0;\n //int timesToCount = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < timesToCount; i++)\n //{\n // string temp = Console.ReadLine();\n // string[] IOnumbers = temp.Split(' ');\n // passengers-= Convert.ToInt32(IOnumbers[0]);\n // passengers+= Convert.ToInt32(IOnumbers[1]);\n\n // if (passengers > spaciousness) spaciousness = passengers;\n //}\n\n //Console.WriteLine(spaciousness);\n ////Console.ReadKey(); \n\n string inputText = Console.ReadLine();\n\n if (inputText.Contains(\"H\") || inputText.Contains(\"Q\") || inputText.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n internal class Program\n {\n private static void Main()\n {\n var code = ReadHelper.ReadString();\n if (code.Contains(\"H\") || code.Contains(\"Q\") || code.Contains(\"9\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n\n\n internal static class ReadHelper\n {\n\n public static string ReadString()\n {\n return Console.ReadLine();\n }\n\n public static List ReadLongList(char separator = ' ')\n {\n return Console.ReadLine().Trim().Split(separator).Select(long.Parse).ToList();\n }\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n }\n\n}\n"}, {"source_code": "using System;\n\nnamespace Problem___122A___A._HQ9Plus\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine();\n if (p.Length>=1 && p.Length<=100)\n {\n bool temp = true;\n\n for (int i = 0; i < p.Length; i++)\n {\n var x = Convert.ToInt32(p[i]);\n if (x>=33 && x<=126)\n {\n temp = true;\n }\n else\n {\n temp = false;\n break;\n }\n }\n if (temp==true)\n {\n bool b = false;\n for (int i = 0; i < p.Length; i++)\n {\n if (p[i]=='H' || p[i]=='Q' || p[i]=='9')\n {\n b = true;\n }\n }\n\n if (b!=true)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring input = Console.ReadLine();\n\t\t\n\t\tConsole.WriteLine(GetHQ9p(input));\n\t}\n\t\n\tpublic static string GetHQ9p(string input)\n\t{\n\t\tchar[] alphabet = new char[]{'H','Q','9'};\n\t\t\n\t\tforeach(char a in input){\n\t\t\tforeach(char a2 in alphabet){\t\n\t\t\t\tif(a==a2){\n\t\t\t\t\treturn \"YES\";\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn \"NO\";\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var output = \"NO\";\n\n foreach(var s in str)\n {\n if (s == 'H' || s == 'Q' || s == '9')\n {\n output = \"YES\";\n break;\n }\n\n }\n Console.WriteLine(output);\n Console.ReadLine();\n }\n\n \n\n }\n\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n static void Main(string[] args)\n {\n string frase = Console.ReadLine();\n int contador = 0;\n for (int i = 0; i < frase.Length; i++)\n {\n if ((frase[i] == 'H') || (frase[i] == 'Q') || (frase[i] == '9'))\n {\n contador++;\n }\n \n \n\n }\n if (contador >= 1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* int k = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int w = int.Parse(Console.ReadLine());\n\n\n\n int sum = 0;\n int ans = 0;\n for(int i=1;i<=w;i++)\n {\n sum += (i * k);\n\n }\n ans = sum - n;\n Console.WriteLine(ans);*/\n\n string s;\n\n s = Console.ReadLine();\n\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ans=\"NO\";\n string linea = Console.ReadLine();\n foreach (char c in linea)\n {\n if (c=='H' || c=='Q' || c=='9')\n {\n ans = \"YES\";\n break;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp7\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string word = Console.ReadLine();\n\n Console.WriteLine(word.Contains(\"Q\") || word.Contains(\"H\") || word.Contains(\"9\") ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n bool x = false;\n\n for (int i = 0 ; i<= line.Length-1; i++)\n {\n \n\n if (line[i] == 'H' || line[i] == 'Q' || line[i] == '9')\n {\n x = true;\n\n }\n \n \n }\n if (x == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n \n }\n }\n }\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace _133A_HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var p = @\"(H)|(Q)|(9)\";\n Regex regex = new Regex(p);\n MatchCollection matches = regex.Matches(str);\n var t = new List>();\n if (matches.Count > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces {\n class Program {\n static void Main (string[] args) {\n string n = Console.ReadLine ();\n if (n.Contains ('H') || n.Contains ('Q') || n.Contains ('9')) {\n System.Console.WriteLine (\"YES\");\n } else {\n System.Console.WriteLine (\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest\n{\n class Program\n {\n public static void Main(string[] args)\n {\n var p = Console.ReadLine();\n\n if (p.Contains('H') || p.Contains('Q') || p.Contains('9') )\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace hello\n{\n\n class FDay\n {\n\n\n static void Main()\n {\n\n string[] chars = new string[] { \"H\", \"Q\", \"9\"};\n string x = Console.ReadLine();\n var xx = chars.Any(x.Contains); \n Console.WriteLine(xx?\"YES\":\"NO\");\n //int[,] arr = new int[,] { { -3, -2, -1, 0 }, { -2, -1, 0, 1 }, { 4, 3, 2, 3 } };\n\n\n //int count = 0;\n\n //Console.WriteLine($\"UpperBound(0) = {arr.GetUpperBound(0)}\");\n //Console.WriteLine($\"UpperBound(1) = {arr.GetUpperBound(1)}\");\n\n //for (int i = 0; i <= arr.GetUpperBound(0); i++)\n //{\n // //Console.WriteLine();\n // for (int j = 0; j <= arr.GetUpperBound(1); j++)\n // {\n // if (arr[i, j] >= 0)\n // break;\n // else if (arr[i, j] < 0)\n // {\n // count++;\n // }\n // //Console.Write(arr[i,j]+\" \");\n // }\n //}\n //Console.WriteLine(count);\n //Console.ReadLine();\n //Console.WriteLine();\n //int a=0, b=0;\n //string[] x = { \"00000\", \"00000\", \"00000\", \"00000\", \"0000x\" };\n //for (int i = 0; i < x.Length; i++)\n //{\n // for (int j = 0; j < x.Length; j++)\n // {\n // string cc = x[i];\n // char v = cc[j];\n // if (v == 'x')\n // {\n // a = i;\n // b = j;\n // }\n // }\n //}\n\n //string t1 = \"10:00PM\";\n //string tv2 = \"11:00PM\";\n\n //DateTime tt1 = Convert.ToDateTime(t1);\n //DateTime tt2 = Convert.ToDateTime(tv2);\n\n\n //char v = t1[5];\n //Console.WriteLine(tt1.Hour-12);\n\n\n\n //Console.WriteLine(\"Hello\");\n //int[] c = { 10, 20, 20, 10, 80, 30, 50, 10, 20 };\n\n //int[] b = { 10, 34, 18, 50, 10, 80, 20 };\n\n //var x = c.Intersect(b);\n\n //var v = (int [])c.Clone();\n //int[] y=new int [b.Length];\n //Array.Copy(b, y, b.Length);\n //Console.WriteLine(b.GetHashCode());\n //Console.WriteLine(y.GetHashCode());\n //Console.WriteLine(v.Length);\n ////Array.Sort(c);\n //foreach (var item in v)\n //{\n // Console.WriteLine(item);\n //}\n\n //int sum=0;\n //for (int i = 1; i < c.Length; i++)\n //{\n // if (c[i]==c[i-1])\n // {\n // sum++;\n // i++;\n // }\n //}\n //Console.WriteLine(sum);\n //Console.ReadLine();\n }\n\n }\n\n}"}, {"source_code": "using System;\n class Program\n {\n static void Main()\n {\n string a = Console.ReadLine();\n Console.WriteLine((a.Contains(\"H\") || a.Contains(\"Q\") || a.Contains(\"9\") ) ? \"YES\" : \"NO\") ;\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine(); \n char[] pro = \"HQ9\".ToCharArray();\n int sum=0;\n for(int j=0;j=1)\n {\n Console.WriteLine(\"YES\");\n }\n else{Console.WriteLine(\"NO\");}\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _133A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n char[] chars = line.ToCharArray();\n\n bool found = false;\n foreach (char item in chars)\n {\n if (item == 'H' || item == 'Q' || item == '9')\n {\n Console.WriteLine(\"YES\");\n found = true;\n break;\n }\n }\n\n if (found == false)\n Console.WriteLine(\"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tram\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n HQ9Plus(input);\n\n\n }\n static void HQ9Plus(string input)\n {\n string instructions = \"HQ9\";\n for (int i = 0; i < instructions.Length; i++)\n {\n if (input.Contains(instructions[i]))\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n if (i==instructions.Length-1)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n }\n \n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string q = Console.ReadLine();\n if (q.Contains(\"H\")|| q.Contains(\"Q\") || q.Contains(\"9\") )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication166\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n Console.WriteLine(p.Contains('H') | p.Contains('Q') | p.Contains('9') ? \"YES\" : \"NO\"); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring str=Console.ReadLine();\n\t\tif(str.Contains(\"H\") || str.Contains(\"Q\") || str.Contains(\"9\"))\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}"}, {"source_code": "using System;\n\nnamespace HQ9Plus\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool evaluator = false;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'H' || str[i] == 'Q' || str[i] == '9')\n {\n evaluator = true;\n break;\n }\n }\n if (evaluator)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool b = false;\n string s;\n s = Console.ReadLine();\n //s = s.ToUpper();\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9' || s[i] == 'Q')\n {\n Console.WriteLine(\"YES\");\n b = true;\n break;\n \n }\n }\n if(!b)\n Console.WriteLine(\"NO\");\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace vvv\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9')\n {\n Console.WriteLine(\"YES\");\n Environment.Exit(0);\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\nnamespace ConsoleApplication30\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'H' || str[i] == 'Q' || str[i] == '9')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n if (i == str.Length-1)\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input;\n bool flage = false; \n input= Console.ReadLine();\n for (int i = 0; i < input.Length; i++)\n {\n if ((input[i] == 'H') | (input[i] == 'Q') | (input[i] == '9'))\n {\n flage = true;\n Console.WriteLine(\"YES\");\n break;\n }\n\n }\n\n if (flage == false)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HQ9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (line.Contains('H')||line.Contains('Q')||line.Contains('9')) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n if (p.Contains(\"H\") || p.Contains(\"Q\") || p.Contains(\"9\")) \n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n \n \n }\n\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Console.WriteLine(Console.ReadLine().IndexOfAny(new char[] { 'H', 'Q', '9' }) != -1 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n static void Main()\n {\n string c = Console.ReadLine();\n RunCode( c);\n Console.ReadLine();\n }\n static void RunCode(string code)\n {\n int c = 0;\n if(code[code.Length-1] !='+'){\n for (int i = 0; i < code.Length; i++)\n {\n \n char l = code[i];\n //l = char.ToUpperInvariant(l);\n if (l == 'H')\n {\n c ++;\n }\n else if (l == 'Q')\n {\n c++;\n }\n else if (l == '9')\n {\n c++;\n }\n }\n }\n if (code.Length>1 &&code[code.Length-1] == '+')\n {\n string sub=code.Substring(0,code.Length-1);\n try\n {\n int cc = Convert.ToInt32(sub);\n\n }\n catch\n {\n if(sub.Length>0)\n c++;\n }\n \n }\n \n if(c>0 && plus(code)) \n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n static bool plus(string code)\n {\n for (int i = 0; i < code.Length; i++)\n {\n if (code[i] != '+')\n {\n return true;\n }\n }\n return false;\n \n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _133A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n if (str.Contains(\"H\") || str.Contains(\"Q\") || str.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n\n // int num = Convert.ToInt32(Console.ReadLine()); \n\n string input = Console.ReadLine();\n\n char[] chars = input.ToCharArray();\n\n int count = 0; \n\n for( int i=0; i 0)\n {\n Console.WriteLine(\"YES\");\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n}\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n string InputWord = Console.ReadLine();\n\n for (int i = 0; i < InputWord.Length; i++)\n {\n if (InputWord[i] == 'H' || InputWord[i] == 'Q' || InputWord[i] == '9')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n\n if (i == (InputWord.Length - 1))\n Console.WriteLine(\"NO\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n if(str.Contains('H')|| str.Contains('Q')|| str.Contains('9') )\n {\n Console.WriteLine(\"YES\");\n \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A._HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (line.Contains(\"H\") ||\n line.Contains(\"Q\") ||\n line.Contains(\"9\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace example_1_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n char[] ch = str.ToArray();\n\n for (int i = 0; i < ch.Length; i++)\n {\n if (ch[i] == 'H' || ch[i] == 'Q' || ch[i] == '9')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem122A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n if(s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = input.IndexOfAny(new char[] { 'H', 'Q', '9' });\n if (n == -1)\n {\n Console.Write(\"NO\");\n }\n else Console.Write(\"YES\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\t\tif(str.Contains(\"H\") || str.Contains(\"Q\")|| str.Contains(\"9\"))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse { Console.WriteLine(\"NO\"); }\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.HQ9\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string sa = Console.ReadLine();\n if (sa.Contains(\"H\")||sa.Contains(\"Q\")||sa.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System; \nusing System.Collections.Generic; \nusing System.Linq; \nusing System.Text; \nusing System.Threading.Tasks;\n\nnamespace add \n{ \n class Program \n { \n static void Main(string[] args) \n {\n string a=Console.ReadLine();\n if(a.Contains(\"H\")|a.Contains(\"Q\")|a.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace HqPlus\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[HQ9]\") ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] HQ9 = { 'H', 'Q', '9' };\n\n if (Console.ReadLine().IndexOfAny(HQ9) >= 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n internal class Program\n {\n private static void Main(string[] args)\n {\n var s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"Q\") || s.Contains(\"9\") || s.Contains(\"H\") ? \"YES\" : \"NO\");\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nnamespace ConsoleApp2Framework\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n if (p.Contains(\"H\") || p.Contains(\"Q\") || p.Contains(\"9\"))\n Console.WriteLine(\"YES\");\n\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n\n \n \n \n\n"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApp2Framework\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().IndexOfAny(\"HQ9\".ToCharArray()) >= 0 ? \"YES\" : \"NO\"); \n }\n }\n}\n\n \n \n \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code7.Tamrin\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n \n\n\n if(input.Contains(\"H\")|| input.Contains(\"9\") || input.Contains(\"Q\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\")) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\") ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n } \n\n static void Main(string[] args)\n {\n String input = ReadString();\n char[] charArray = { 'H', 'Q', '9' };\n if (input.IndexOfAny(charArray) > -1)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_HQ9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n if(input.Any(c => (c == 'H' || c == 'Q' || c == '9')))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\"); \n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Sockets;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\nusing System.Collections;\nclass Source\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n for ( int i = 0 ; i < s.Length ; ++ i )\n if (s[i] == 'H' | s[i] == 'Q' | s[i] == '9' )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n\n\n return;\n }\n\n}"}, {"source_code": "\ufeffusing System;\n\nclass HQ9Puls\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"Q\") || s.Contains(\"H\") || s.Contains(\"9\")) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class14\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n char[] a = s.ToCharArray();\n for (int i = 0; i < s.Length; i++)\n {\n if (a[i] == 'H' || a[i] == 'Q' || a[i] == '9')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass TheProgrammingContestDivTwo\n{\n public static void Main()\n {\n var command = Console.ReadLine();\n char[] ch = new char[] { 'H', 'Q', '9'};\n if (res(command, ch))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n private static bool res(string command, char[] ch)\n {\n for (int i = 0; i < command.Length; i++)\n for (int j = 0; j < ch.Length; j++)\n if (command[i] == ch[j]) return true;\n return false;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Lv1Phase1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int counter = 0;\n string input = Console.ReadLine();\n foreach (char c in input)\n {\n if (c == 'Q' || c == 'H' || c == '9') counter++;\n }\n if (counter > 0) { Console.WriteLine(\"YES\"); }\n else { Console.WriteLine(\"NO\"); }\n // Console.ReadKey();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _41a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if(s.Contains(\"H\")==true || s.Contains(\"Q\") || s.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Contest\n{\nclass MainClass{\n public static void Main (string[] args){\n int n,s=0;\n string num = Console.ReadLine();\n if((num.Contains(\"H\"))||(num.Contains(\"Q\"))||(num.Contains(\"9\")))\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n \n \n \n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace prA {\n class Program {\n static void Main(string[] args) {\n#if ONLINE_JUDGE\n#else\n\n StreamWriter sw = new StreamWriter(\"output\");\n Console.SetOut(sw);\n Console.SetIn(new StreamReader(\"input\"));\n#endif\n\n string s = Console.ReadLine();\n Console.WriteLine(s.IndexOfAny(\"HQ9\".ToCharArray()) != -1 ? \"YES\" : \"NO\");\n\n#if ONLINE_JUDGE\n#else\n sw.Close();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Functions x = new Functions();\n string row = Console.ReadLine();\n Console.WriteLine(x.SomeMethod(row));\n }\n class Functions\n {\n public string SomeMethod(string str)\n {\n return ((str.Contains(\"H\")) || (str.Contains(\"9\")) || (str.Contains(\"Q\")))? \"YES\" : \"NO\" ;\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n char[] dt = {'H', 'Q','9' };\n for (int i = 0; i < 3; ++i)\n if (input.IndexOf(dt[i]) >= 0) { dt[0] = 's'; break; }\n Console.WriteLine(dt[0] == 's' ?\"YES\":\"NO\");\n }\n }"}, {"source_code": "using System;\npublic class HQ{\n\tstatic void Main(){\n\t\tString s = Console.ReadLine();\n\t\tfor(int i=0; i mp=new Dictionary();\n String s = Console.ReadLine();\n foreach (char i in s)\n {\n int v;\n if(mp.TryGetValue(i, out v));\n \n mp[i]=v;\n mp[i]++;\n }\n if(mp.ContainsKey('H') && mp['H']>=1)\n Console.WriteLine(\"YES\");\n else if (mp.ContainsKey('Q') && mp['Q'] >= 1)\n Console.WriteLine(\"YES\");\n else if (mp.ContainsKey('9') && mp['9'] >= 1)\n Console.WriteLine(\"YES\");\n //else if (mp.ContainsKey('+') && mp['+'] >= 1)\n // Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var set=new HashSet();\n String s = Console.ReadLine();\n foreach (var i in s)\n {\n set.Add(i);\n }\n if(set.Contains('H')|| set.Contains('Q') || set.Contains('9') )\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n \n if ((p.Contains('H') == true) || (p.Contains('Q') == true) || (p.Contains('9') == true))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class Program\n{\n static void Main(string[] args)\n {\n HQ9 h = new HQ9();\n //Console.ReadLine();\n }\n}\npublic class HQ9\n{\n public HQ9()\n {\n int i = 0;\n bool output = false;\n string x = Console.ReadLine().Trim();\n for (i = 0; i < x.Length; i++)\n {\n if (x[i] == 'H' || x[i] == 'Q' || x[i] == '9')\n {\n output = true;\n break;\n }\n }\n Console.WriteLine(output ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication234\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9' )\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InfoProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n bool ok = false;\n for (int i = 0; i < s.Length; i ++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9')\n ok = true;\n }\n if (ok == true) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n \n //Console.ReadKey();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tests\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool No = true;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'H' || input[i] == 'Q' || input[i] == '+' || input[i] == '9')\n {\n Console.WriteLine(\"YES\");\n No = false;\n break;\n }\n }\n if (No == true)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nclass Program\n{\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int i;\n bool test = false;\n for (i = 0; i < str.Length; i++)\n {\n if (char.ToUpper(str[i]) == 'H' || char.ToUpper(str[i]) == 'Q' || str[i] == '9' || str[i] == '+')\n {\n test = true;\n break;\n }\n }\n if (test) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n //Console.ReadKey();\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CP14HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if(a.Contains(\"H\") || a.Contains(\"Q\") || a.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n if(a.Contains(\"+\"))\n {\n int ind = a.IndexOf('+');\n if(char.IsDigit(a[ind-1]) || char.IsLetter(a[ind-1]))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n class _133A_HQ9_\n {\n static void Main()\n {\n string input = Console.ReadLine();\n\n if(input.Contains('H') \n || input.Contains('Q')\n || input.Contains('9')\n || input.Contains('+'))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string x = Console.ReadLine();\n char c = x.FirstOrDefault();\n\n if (c.ToString() == \"H\" || c.ToString() == \"Q\" || c.ToString() == \"9\")\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass HQ9Puls\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"Q\") || s.Contains(\"H\") || s.Contains(\"9\") || s.Contains(\"+\")) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace prA {\n class Program {\n static void Main(string[] args) {\n#if ONLINE_JUDGE\n#else\n\n StreamWriter sw = new StreamWriter(\"output\");\n Console.SetOut(sw);\n Console.SetIn(new StreamReader(\"input\"));\n#endif\n\n string s = Console.ReadLine();\n Console.WriteLine(s.IndexOfAny(\"HQ9+\".ToCharArray()) != -1 ? \"YES\" : \"NO\");\n\n#if ONLINE_JUDGE\n#else\n sw.Close();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input;\n bool flage = false; \n input= Console.ReadLine();\n for (int i = 0; i < input.Length; i++)\n {\n if ((input[i] == '+') | (input[i] == 'H') | (input[i] == 'Q') | (input[i] == '9'))\n {\n flage = true;\n Console.WriteLine(\"YES\");\n break;\n }\n\n }\n\n if (flage == false)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _133A\n {\n static void Main() {\n string temp = Console.ReadLine();\n\n string ty = \"\";\n foreach (var item in temp)\n {\n if (item == 'H' || item == 'Q' || item == '9' || item == '+' )\n {\n ty = \"YES\";break; \n }\n }\n\n if (ty != \"YES\")\n {\n\n Console.WriteLine(\"NO\");\n\n\n }\n else {\n\n Console.WriteLine(ty);\n }\n //Console.ReadKey();\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace HqPlus\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Regex.IsMatch(Console.ReadLine().ToLower(), @\"[hq9]\") ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace WorkerConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (line.Contains(\"H\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (line.Contains(\"Q\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (line.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (line.Contains(\"+\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\n//FelisDJ =*w*=\n\nusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n bool ck = false;\n for(int i =0 ;i>();\n if (matches.Count > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n if (p.Contains(\"H\") || p.Contains(\"Q\") || p.Contains(\"+\") || p.Contains(\"9\")) \n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n \n }\n\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n foreach (var i in input)\n {\n if (i == 'H' || i == 'Q' || i == '9' || i == '+')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n for(int i=0; i < p.Length; i++)\n {\n if(p[i] == 'H' || p[i] == 'Q' || p[i] == '9' || p[i] == '+')\n {\n Console.Write(\"YES\");\n break;\n }\n if(i == p.Length - 1)\n {\n Console.Write(\"NO\");\n }\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace YOLO\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x;\n x = Console.ReadLine();\n bool z = false;\n for(int i=0; i row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n \n for(int i = 0; i < ar.Length; i++)\n {\n for(int k = 0; k < ar[i].Length; k++)\n {\n \n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n \n List words = input.Split(' ').ToList();\n \n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n \n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach(char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString()+\" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n //string text = Console.ReadLine();\n //string res=Chat_Room(text);\n //Console.WriteLine(res.Contains(\"hello\") ? \"YES\" : \"NO\");\n\n //Console.WriteLine(CAPS_LOCK(Console.ReadLine()));\n\n //string input=\"\";\n //for (int i = 0; i < 5; i++)\n //{\n // input += Console.ReadLine();\n // if (i != 4)\n // input += \"\\n\";\n //}\n\n //int NumberOfMoves= Beautiful_Matrix(input);\n //Console.WriteLine(input);\n\n\n Console.WriteLine(HQ9Plus(Console.ReadLine()));\n \n }\n\n static string HQ9Plus(string input)\n {\n if (!Regex.IsMatch(input, @\"^[^ \\s]{1,100}$\")) return \"NO\";\n if (input.Contains('H') ||\n input.Contains(\"Q\") ||\n input.Contains('9') ||\n input.Contains('+'))\n return \"YES\";\n return \"NO\";\n }\n\n //Not Solved yet\n static void Beautiful_Matrix(string TwoDimensionalArray)\n {\n //if (TwoDimensionalArray.Contains('1')) return 0;\n\n int[,] TwoDimensionalOfInts = new int[5,5];\n int [][] ar = TwoDimensionalArray.Split('\\n')\n .Select(row => row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n \n for(int i = 0; i < ar.Length; i++)\n {\n for(int k = 0; k < ar[i].Length; k++)\n {\n \n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n \n List words = input.Split(' ').ToList();\n \n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n \n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach(char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString()+\" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Theatre_Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var output = \"No\";\n\n foreach(var s in str)\n {\n if (s == 'H' || s == 'Q' || s == '9' || s == '+')\n {\n output = \"Yes\";\n break;\n }\n\n }\n Console.WriteLine(output);\n Console.ReadLine();\n }\n\n \n\n }\n\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace PracticeForDummies\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'H' || str[i] == 'Q' || str[i] == '9' || str[i] == '+')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n \n }\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace PracticeForDummies\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'H' || str[i] == 'Q' || str[i] == '9' || str[i] == '+')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n\n else\n {\n Console.WriteLine(\"NO\");\n \n }\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n //string text = Console.ReadLine();\n //string res=Chat_Room(text);\n //Console.WriteLine(res.Contains(\"hello\") ? \"YES\" : \"NO\");\n\n //Console.WriteLine(CAPS_LOCK(Console.ReadLine()));\n\n //string input=\"\";\n //for (int i = 0; i < 5; i++)\n //{\n // input += Console.ReadLine();\n // if (i != 4)\n // input += \"\\n\";\n //}\n\n //int NumberOfMoves= Beautiful_Matrix(input);\n //Console.WriteLine(input);\n\n\n Console.WriteLine(HQ9Plus(Console.ReadLine()));\n \n }\n\n static string HQ9Plus(string input)\n {\n if (!Regex.IsMatch(input, @\"^[^\\s]{1,100}$\")) return \"NO\";\n return string.Join(\" \", input.Select(c => c).Where(c => c.Equals('H') || c.Equals('Q') || c.Equals('9') || c.Equals('+')).Distinct().ToArray());\n }\n\n //Not Solved yet\n static void Beautiful_Matrix(string TwoDimensionalArray)\n {\n //if (TwoDimensionalArray.Contains('1')) return 0;\n\n int[,] TwoDimensionalOfInts = new int[5,5];\n int [][] ar = TwoDimensionalArray.Split('\\n')\n .Select(row => row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n \n for(int i = 0; i < ar.Length; i++)\n {\n for(int k = 0; k < ar[i].Length; k++)\n {\n \n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n \n List words = input.Split(' ').ToList();\n \n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n \n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach(char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString()+\" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace _133A_HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var p = @\"[H|Q|9]\";\n Regex regex = new Regex(p);\n MatchCollection matches = regex.Matches(str);\n var t = new List>();\n if (matches.Count > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace MainProgram \n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var d = Console.ReadLine();\n var found = false;\n foreach(var a in d)\n {\n if(a == 'H' || a == 'Q' || a == '9')\n found = true;\n break;\n }\n Console.WriteLine(found ? \"YES\" : \"NO\");\n } \n \n static long[] ParseStringIntoArrayOfInts(string input)\n {\n var list = new List();\n var splittedOut = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n foreach(var s in splittedOut)\n {\n list.Add(long.Parse(s));\n }\n return list.ToArray();\n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hulk\n{\n class Program\n {\n static void Main(string[] args)\n {\n here: string p = Console.ReadLine();\n if(p.Length<1||p.Length>100)\n {\n goto here;\n }\n char[] arr = p.ToCharArray();\n bool check = false;\n for(int i=0;i= tokens.Length)\n {\n tokens = System.Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p= Console.ReadLine();\n if (p.Contains(\"H\") || p.Contains(\"Q\")||p.Contains(\"9\")||p.Contains(\"+\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CP14HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if(a.Contains(\"H\") || a.Contains(\"Q\") || a.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else if(a.Contains(\"+\"))\n {\n int ind = a.IndexOf('+');\n if(a.IndexOf('+') ==0)\n {\n Console.WriteLine(\"NO\"); \n }\n else if(char.IsDigit(a[ind-1]) || char.IsLetter(a[ind-1]))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine();\n if (p != \"\")\n {\n if ((p.Contains(\"H\") == true) || (p.Contains(\"Q\") == true) || (p.Contains(\"9\") == true) ||\n (p.Contains(\"+\") == true))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _133A\n {\n static void Main() {\n string temp = Console.ReadLine();\n\n string ty = \"\";\n foreach (var item in temp)\n {\n if (item == 'H' || item == 'Q' || item == '9' || item == '+' )\n {\n ty = \"YES\";break; \n }\n }\n\n if (ty != \"YES\")\n {\n\n Console.WriteLine(\"NO\");\n\n\n }\n else {\n\n Console.WriteLine(ty);\n }\n //Console.ReadKey();\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hulk\n{\n class Program\n {\n static void Main(string[] args)\n {\n here: string p = Console.ReadLine();\n if(p.Length<1||p.Length>100)\n {\n goto here;\n }\n char[] arr = p.ToCharArray();\n bool check = false;\n for(int i=0;i=1 && n<=150));\n\n while (n!=0) {\n str = Console.ReadLine();\n if (str == \"++x\" || str == \"++X\" || str == \"x++\" || str == \"X++\")\n {\n ++x;\n --n;\n }\n else if (str == \"--x\" || str == \"--X\" || str == \"x--\" || str == \"X--\") {\n --x;\n --n;\n }\n }\n\n Console.WriteLine($\"{x}\");\n */\n #endregion\n\n #region CodeForce: 112A\n /*\n string str1, str2;\n Console.WriteLine(String.Compare(str1=(Console.ReadLine()).ToLower(),str2=(Console.ReadLine()).ToLower()));\n */\n #endregion\n\n #region CodeForce: 116A\n /*\n int n = 0;\n\n do\n {\n n = int.Parse(Console.ReadLine());\n } while (!(n >= 2 && n <= 1000));\n\n int length = n;\n\n int[] a = new int[length];\n int[] b = new int[length];\n\n int temp = 0;\n string[] str;\n\n while (n != 0)\n {\n if (n == length)\n {\n do\n {\n str = Console.ReadLine().Split();\n a[0] = int.Parse(str[0]);\n b[0] = int.Parse(str[1]);\n } while (a[0] != 0);\n }\n else if (n == 1)\n {\n temp = 0;\n do\n {\n for (int i = 0; i <= length - 2; i++)\n {\n temp += (b[i] - a[i]);\n }\n str = Console.ReadLine().Split();\n a[length - 1] = int.Parse(str[0]);\n b[length - 1] = int.Parse(str[1]);\n } while (!(b[length - 1] == 0 && a[length - 1] == temp));\n }\n else\n {\n temp = 0;\n do\n {\n for (int i = 0; i <= length - n - 1; i++)\n {\n temp += (b[i] - a[i]);\n }\n str = Console.ReadLine().Split();\n a[length - n] = int.Parse(str[0]);\n b[length - n] = int.Parse(str[1]);\n } while (!(a[length - n] <= temp));\n }\n --n;\n }\n\n int max = 0;\n temp = 0;\n for (int i = 0; i < length; i++)\n {\n temp += b[i] - a[i];\n if (temp > max) max = temp;\n }\n Console.WriteLine($\"{max}\");\n */\n #endregion\n\n #region CodeForce: 133A\n string p = Console.ReadLine();\n for (int i = 0; i < p.Length; i++) {\n if (p[i] == 'H' || p[i] == 'Q' || p[i] == '9') {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n #endregion\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool w = false;\n for (int p = 0; p < str.Length; p++) {\n char c = str[p];\n if (c > 33 & c <= 126) c = '!';\n if (c == 'H' | c == 'Q' | c == '9' | c == '+')\n {\n w = true;\n break;\n }\n }\n if (w) {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n\t\n \tConsole.WriteLine\n \t\t(\n \t\t\tinp.Contains('H') \n \t\t\t|| inp.Contains('Q') \n \t\t\t|| inp.Contains('9') \n \t\t\t&& inp.Contains('+') ?\n \t\t\t\"YES\" : \"NO\"\n \t\t);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace _133A_HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var p = @\"[H|Q|9|+]\";\n Regex regex = new Regex(p);\n MatchCollection matches = regex.Matches(str);\n var t = new List>();\n if (matches.Count > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HQ_Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n if (p.Contains('H') || p.Contains('Q') || p.Contains('9') || p.Contains('+'))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n if ((str.Contains(\"H\") == true) || (str.Contains(\"H\") == true) || (str.Contains(\"9\") == true) || (str.Contains(\"+\") == true))\n {\n Console.WriteLine(\"YES\");\n }\n else { Console.WriteLine(\"NO\"); };\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string [] symbols = new string[] {\"H\",\"Q\",\"+\",\"9\"};\n \n {\n if (line.Contains(symbols[0]))\n {\n \n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[1]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[2]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[3]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else\n \n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n }\n\n"}, {"source_code": "using System;\n\nnamespace Problem___122A___A._HQ9Plus\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine().ToUpper();\n if (p.Length>=1 && p.Length<=100)\n {\n bool b = false;\n for (int i = 0; i < p.Length; i++)\n {\n if (p[i]=='H' || p[i]=='Q' || p[i]=='9')\n {\n b = true;\n }\n }\n\n if (b!=false)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n static void Main()\n {\n string c = Console.ReadLine();\n RunCode( c);\n Console.ReadLine();\n }\n static void RunCode(string code)\n {\n int c = 0;\n for (int i = 0; i < code.Length; i++)\n {\n char l = code[i];\n l = char.ToUpperInvariant(l);\n if (l == 'H')\n {\n c = 1;\n }\n else if (l == 'Q')\n {\n c = 1;\n }\n else if (l == '9')\n {\n c = 1;\n }\n else if (l == '+')\n {\n c = 1;\n }\n }\n if (c == 1)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest\n{\n class Program\n {\n public static void Main(string[] args)\n {\n var p = Console.ReadLine();\n\n if (p[0] == 'H' || p[0] == 'Q' || p[0] == '9')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\") || s.Contains(\"+\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication166\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n Console.WriteLine(p.Contains('H') | p.Contains('Q') | p.Contains('9') ? \"Yes\" : \"No\"); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string x = Console.ReadLine();\n char c = x.FirstOrDefault();\n\n if (c.ToString() == \"H\" || c.ToString() == \"Q\" || c.ToString() == \"9\" || c.ToString() == \"+\")\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass TheProgrammingContestDivTwo\n{\n public static void Main()\n {\n var command = Console.ReadLine();\n char[] ch = new char[] { 'H', 'Q', '9', '+' };\n if (res(command, ch))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n private static bool res(string command, char[] ch)\n {\n for (int i = 0; i < command.Length; i++)\n for (int j = 0; j < ch.Length; j++)\n if (command[i] == ch[j]) return true;\n return false;\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string lines = Console.ReadLine();\n\n string result = \"NO\";\n\n for (int i = 0; i < lines.Length; i++)\n {\n if (lines[i] == 'H' || lines[i] == 'Q' || lines[i] == '9' || lines[i] == '+' || lines.Contains(\"72\") || lines.Contains(\"81\") || lines.Contains(\"57\") || lines.Contains(\"43\"))\n {\n result = \"YES\";\n break;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static void Main()\n {\n var command = Console.ReadLine();\n var result = \"NO\";\n for(var i = 0; i < command.Length; i++)\n {\n if (command[i] == 'H' || command[i] == 'Q' || command[i] == '+' || command[i] == '9')\n result = \"YES\";\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"+\") || s.Contains(\"9\")) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n //string text = Console.ReadLine();\n //string res=Chat_Room(text);\n //Console.WriteLine(res.Contains(\"hello\") ? \"YES\" : \"NO\");\n\n //Console.WriteLine(CAPS_LOCK(Console.ReadLine()));\n\n //string input=\"\";\n //for (int i = 0; i < 5; i++)\n //{\n // input += Console.ReadLine();\n // if (i != 4)\n // input += \"\\n\";\n //}\n\n //int NumberOfMoves= Beautiful_Matrix(input);\n //Console.WriteLine(input);\n\n\n Console.WriteLine(HQ9Plus(Console.ReadLine()));\n \n }\n\n static string HQ9Plus(string input)\n {\n if (!Regex.IsMatch(input, @\"^[^\\s]{1,100}$\")) return \"NO\";\n if (input.Contains('H') ||\n input.Contains(\"Q\") ||\n input.Contains('9') ||\n input.Contains('+') ||\n input.IndexOf(\"HQ\") != -1 ||\n input.IndexOf(\"HQ9+\") != -1)\n return \"YES\";\n return \"NO\";\n }\n\n //Not Solved yet\n static void Beautiful_Matrix(string TwoDimensionalArray)\n {\n //if (TwoDimensionalArray.Contains('1')) return 0;\n\n int[,] TwoDimensionalOfInts = new int[5,5];\n int [][] ar = TwoDimensionalArray.Split('\\n')\n .Select(row => row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n \n for(int i = 0; i < ar.Length; i++)\n {\n for(int k = 0; k < ar[i].Length; k++)\n {\n \n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n \n List words = input.Split(' ').ToList();\n \n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n \n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach(char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString()+\" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace HQ9____Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Contains(\"H\"))\n {\n Console.WriteLine(\"YES\");\n }\n else if (s.Contains(\"Q\"))\n {\n Console.WriteLine(\"YES\");\n }\n else if (s.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n else if (s.Contains(\"+\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine(); ;\n string[] arr = { \"H\", \"Q\" , \"+\", \"9\"};\n var answer = \"\";\n foreach (var c in arr)\n {\n if (input.Contains(c))\n answer += \"YES\";\n else\n answer += \"NO\";\n }\n if (answer.Contains(\"YES\"))\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_HQ9\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] find = { 'H', 'Q', '9', };\n string temp = s.Trim(find);\n s = s.Trim(temp.ToCharArray());\n if (s.Length == 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c96a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n bool ans=false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9' || s[i] == '+')\n {\n ans = true;\n }\n }\n if (ans)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "namespace o\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"H\") || s.Contains(\"Q\") || s.Contains(\"9\") || s.Contains(\"+\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest\n{\n class Program\n {\n public static void Main(string[] args)\n {\n var p = Console.ReadLine();\n\n if ((p[0] == 'H' || p[0] == 'Q' || p[0] == '9' || p[0] == '+')&& p.Length>1) \n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _133a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = s.Length;\n bool ok = true;\n for (int i = 0; i < n; ++i)\n if (s[i] == 'H' || s[i] == 'Q' || s[i] == '9' || s[i] == '+')\n { ok = false; break; }\n Console.WriteLine(ok ? \"NO\" : \"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text; \n\nnamespace Timus\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var str = GetStr();\n string res = str.Contains('H') || str.Contains('Q') || str.Contains('9') || str.Contains('+') ? \"YES\" : \"NO\";\n Console.WriteLine(res);\n Console.ReadLine();\n }\n\n\n #region Utils\n private const double Epsilon = double.Epsilon;\n\n private static string GetStr()\n {\n \n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n public class Money\n {\n public int Position { get; set; }\n public int MinCountForChange { get; set; }\n public int HigherValue { get; set; }\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n bool x = false;\n\n for (int i = 0 ; i<= line.Length-1; i++)\n {\n if (line[0] == '+')\n {\n x = false;\n \n }\n\n if (line[i] == 'H' || line[i] == 'Q' || line[i] == '9')\n {\n x = true;\n\n }\n \n \n }\n if (x == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n \n }\n }\n }\n\n"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n if (word.Contains(\"H\") || word.Contains(\"Q\") || word.Contains(\"9\") || word.Contains(\"+\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nclass Program\n{\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int i;\n bool test = false;\n for (i = 0; i < str.Length; i++)\n {\n if (str[i] == 'H' || str[i] == 'Q' || str[i] == '9' || str[i] == '+')\n {\n test = true;\n break;\n }\n }\n if (test) Console.Write(\"Yes\");\n else Console.Write(\"No\");\n //Console.ReadKey();\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Word = Console.ReadLine();\n var Code = \"HQ9\";\n\n foreach (var c in Word)\n {\n if (!Code.Contains(c.ToString()))\n Console.WriteLine(\"YES\");\n else \n Console.WriteLine(\"NO\");\n \n }\n\n\n\n\n //if (Word.Contains(\"H\") || Word.Contains(\"Q\") || Word.Contains(\"9\")) \n //Console.WriteLine(\"YES\");\n // else \n // Console.WriteLine(\"NO\"); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nnamespace CodeForces\n{\n public class Test\n {\n public static void Main()\n {\n string num = Console.ReadLine();\n int count = 0;\n for (int t = 0; t < num.Length; t++)\n {\n if (num[t] == 'H' || num[t] == 'Q' || num[t] == '9')\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n count++;\n }\n }\n if(count==num.Length)\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace PracticeForDummies\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for ( int i=0; i=1 && p.Length<=100)\n {\n bool b = false;\n for (int i = 0; i < p.Length; i++)\n {\n if (p[i]=='H' || p[i]=='Q' || p[i]=='9')\n {\n b = true;\n }\n }\n\n if (b!=false)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n if(input.ToUpper()[0]=='H' || input.ToUpper()[0]=='Q')\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CP14HQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if(a.Contains(\"H\") || a.Contains(\"Q\") || a.Contains(\"9\"))\n {\n Console.WriteLine(\"YES\");\n }\n if(a.Contains(\"+\"))\n {\n int ind = a.IndexOf('+');\n if(char.IsDigit(a[ind-1]) || char.IsLetter(a[ind-1]))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring str=Console.ReadLine();\n\t\tif(str.Contains(\"H\") || str.Contains(\"h\") || str.Contains(\"Q\") || str.Contains(\"q\") || str.Contains(\"9\") || str.Contains(\"+\"))\n\t\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string [] symbols = new string[] {\"H\",\"Q\",\"+\",\"9\"};\n \n {\n if (line.Contains(symbols[0]))\n {\n \n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[1]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[2]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else if (line.Contains(symbols[3]))\n {\n\n Console.WriteLine(\"YES\");\n }\n\n else\n \n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n }\n\n"}, {"source_code": "using System;\n\npublic class Program\n{\n static void Main()\n {\n string input = Console.ReadLine();\n if (input.Contains(\"H\") ||\n input.Contains(\"Q\") ||\n input.Contains(\"9\") ||\n input.Contains(\"+\"))\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string p = Console.ReadLine();\n if ((p.Contains(\"H\") || (p.Contains(\"Q\")) || (p.Contains(\"+\")) || (p.Contains(\"9\"))))\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n\n bool x = false;\n\n for (int i = 0 ; i<= line.Length-1; i++)\n {\n if (line[0] == '+')\n {\n x = false;\n break;\n }\n\n if (line[i] == 'H' || line[i] == 'Q' || line[i] == '9')\n {\n x = true;\n\n }\n \n \n }\n if (x == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n \n }\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n static void Main()\n {\n string c = Console.ReadLine();\n RunCode( c);\n Console.ReadLine();\n }\n static void RunCode(string code)\n {\n int c = 0;\n if(code[code.Length-1] !='+'){\n for (int i = 0; i < code.Length; i++)\n {\n \n char l = code[i];\n //l = char.ToUpperInvariant(l);\n if (l == 'H')\n {\n c ++;\n }\n else if (l == 'Q')\n {\n c++;\n }\n else if (l == '9')\n {\n c++;\n }\n }\n }\n if (code.Length>1 &&code[code.Length-1] == '+')\n {\n string sub=code.Substring(0,code.Length-2);\n try\n {\n int cc = Convert.ToInt32(sub);\n\n }\n catch\n {\n if(sub.Length>0)\n c++;\n }\n \n }\n \n if(c>0)\n {\n Console.WriteLine(\"YES\");\n }\n if (c == 0)\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n}"}, {"source_code": "using System;\n\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\tstring res = \"NO\";\n\t\tfor(int i=0; i c)\n // //.Where(c => c.Equals('H') || c.Equals('Q') || c.Equals('9') || c.Equals('+'))\n // .Where(c=> c > 33 && c <= 126)\n // .Distinct()\n // .ToArray());\n string temp = \"\";\n foreach (char c in input)\n {\n if (c < 33 || c > 126)\n temp += c;\n }\n return temp.IndexOfAny(new char[] { 'Q', 'H', '9', '+' }) >= 0 ? \"YES\" : \"NO\";\n //if (Filterd.IndexOfAny(new char[] { 'Q','H','+','9'}) != -1)\n // return \"YES\\t\" + Filterd;\n //return \"NO\\t\" +Filterd;\n\n }\n\n //Not Solved yet\n static void Beautiful_Matrix(string TwoDimensionalArray)\n {\n //if (TwoDimensionalArray.Contains('1')) return 0;\n\n int[,] TwoDimensionalOfInts = new int[5, 5];\n int[][] ar = TwoDimensionalArray.Split('\\n')\n .Select(row => row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n\n for (int i = 0; i < ar.Length; i++)\n {\n for (int k = 0; k < ar[i].Length; k++)\n {\n\n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n\n List words = input.Split(' ').ToList();\n\n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n\n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach (char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString() + \" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n class Program\n {\n static void Main()\n {\n\n\nstring input = Console.ReadLine();\n char[] input_to_char = input.ToCharArray();\n int char_count_ = 0;\n foreach(char s in input_to_char)\n {\n if(s.ToString().ToUpper() == \"H\")\n {\n char_count_++;\n }else if(s.ToString().ToUpper() == \"Q\")\n {\n char_count_++;\n }\n else if(s.ToString().ToUpper() == \"9\")\n {\n char_count_++;\n }\n else if(s.ToString().ToUpper() == \"+\")\n {\n char_count_++;\n }\n }\n\n if(char_count_ != 0 && char_count_ > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n \n \n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n //string text = Console.ReadLine();\n //string res=Chat_Room(text);\n //Console.WriteLine(res.Contains(\"hello\") ? \"YES\" : \"NO\");\n\n //Console.WriteLine(CAPS_LOCK(Console.ReadLine()));\n\n //string input=\"\";\n //for (int i = 0; i < 5; i++)\n //{\n // input += Console.ReadLine();\n // if (i != 4)\n // input += \"\\n\";\n //}\n\n //int NumberOfMoves= Beautiful_Matrix(input);\n //Console.WriteLine(input);\n\n\n Console.WriteLine(HQ9Plus(Console.ReadLine()));\n \n }\n\n static string HQ9Plus(string input)\n {\n if (!Regex.IsMatch(input, @\"^[^\\s]{1,100}$\")) return \"NO\";\n string Filterd=string.Join(\" \", input.Select(c => c).Where(c => c.Equals('H') || c.Equals('Q') || c.Equals('9') || c.Equals('+')).Distinct().ToArray());\n if (Filterd.Equals(\"HQ9+\")) return \"YES\";\n return \"NO\";\n\n }\n\n //Not Solved yet\n static void Beautiful_Matrix(string TwoDimensionalArray)\n {\n //if (TwoDimensionalArray.Contains('1')) return 0;\n\n int[,] TwoDimensionalOfInts = new int[5,5];\n int [][] ar = TwoDimensionalArray.Split('\\n')\n .Select(row => row.Split(' ').Select(ite => int.Parse(ite)).ToArray())\n .ToArray();\n \n for(int i = 0; i < ar.Length; i++)\n {\n for(int k = 0; k < ar[i].Length; k++)\n {\n \n }\n }\n\n //Recersion();\n }\n\n static int Recersion(string[] rows)\n {\n return 0;\n }\n\n static string CAPS_LOCK(string input)\n {\n\n if (!Regex.IsMatch(input, @\"^[a-zA-Z ]{1,100}$\")) return input;\n \n List words = input.Split(' ').ToList();\n \n StringBuilder Result = new StringBuilder();\n foreach (string word in words)\n {\n \n if (word == word.ToUpper() ||\n (word.Substring(0, 1) == word.Substring(0, 1).ToLower()\n && word.Substring(1, word.Length - 1) == word.Substring(1, word.Length - 1).ToUpper()\n ))\n {\n StringBuilder temp = new StringBuilder();\n foreach(char c in word)\n {\n if (char.IsLower(c))\n temp.Append(char.ToUpper(c));\n else\n temp.Append(char.ToLower(c));\n }\n Result.Append(temp.ToString()+\" \");\n }\n else\n {\n Result.Append(word + \" \");\n }\n\n }\n return Result.ToString();\n }\n static string Chat_Room(string text)\n {\n\n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine();\n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums = strnumbers.Split(' ').Select(num => int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n\n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class _133_A___HQ9_\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Contains('H') || s.Contains('Q') || s.Contains('9') || s.Contains('+'))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n static void Main(string[] args)\n {\n string frase = Console.ReadLine();\n int contador = 0;\n for (int i = 0; i < frase.Length; i++)\n {\n if ((frase[i] == 'H') || (frase[i] == 'Q') || (frase[i] == '9') || (frase[i] == '+'))\n {\n contador++;\n }\n else\n {\n contador++;\n\n }\n \n\n }\n if (contador >= 1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n \n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _20180625\n{\n\n class Program\n {\n static bool checkCode(string code)\n {\n char[] symbols = { 'H', 'Q', '9', '+' };\n foreach (var item in symbols)\n {\n if (code.Contains(item))\n return true;\n }\n return false;\n }\n static void Main(string[] args)\n {\n string hello = \"Allo retard!\";\n Console.WriteLine(checkCode(hello));\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Problem___122A___A._HQ9Plus\n{\n class Program\n {\n static void Main(string[] args)\n {\n var p = Console.ReadLine().ToUpper();\n if (p.Length>=1 && p.Length<=100)\n {\n bool b = false;\n for (int i = 0; i < p.Length; i++)\n {\n if (p[i]=='H' || p[i]=='Q' || p[i]=='9')\n {\n Console.WriteLine(\"YES\");\n b = true;\n }\n }\n\n if (b!=true)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace Zadachi\n{\n class Program\n {\n static void Main(){\n string input = Console.ReadLine();\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'H' || input[i] == 'Q') {\n Console.WriteLine(\"YES\");\n return ;\n }\n\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n \n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Sockets;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\nusing System.Collections;\nclass Source\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n for ( int i = 0 ; i < s.Length ; ++ i )\n if (s[i] == 'H' | s[i] == 'Q' | s[i] == '9' | s[i] == '+')\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n\n\n return;\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Squares\n{\n class joke\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n if (line.Contains(\"H\") || line.Contains(\"Q\") || line.Contains(\"9\") || line.Contains(\"+\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace A.HQ9_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n \n if (text.Contains('H') || text.Contains('Q') || text.Contains('9') || text.Contains('+'))\n {\n Console.WriteLine(\"YES\");\n }\n else\n { \n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n int kaka=0;\n string palo=Console.ReadLine();\n for(int k=0 ; k=1)\n {\n Console.WriteLine(\"YES\");\n }\n else{Console.WriteLine(\"NO\");}\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _20180625\n{\n\n class Program\n {\n static bool checkCode(string code)\n {\n char[] symbols = { 'H', 'Q', '9', '+' };\n foreach (var item in symbols)\n {\n if (code.Contains(item))\n return true;\n }\n return false;\n }\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Console.WriteLine(checkCode(input));\n }\n }\n}\n"}], "src_uid": "1baf894c1c7d5aeea01129c7900d3c12"} {"source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextLong();\n\n var a = (long)Math.Floor(Math.Sqrt((double)n));\n\n if ((a+1) * (a+1) == n) a = a+1;\n\n var rem = n - a*a;\n var b = rem / a;\n if (b * a < rem) b++;\n\n // System.Console.WriteLine(new {n, a, b, rem});\n\n System.Console.WriteLine(a + a + b);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // System.Console.Write(cout.ToString());\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static IEnumerable IndicesWhere(this IEnumerable seq, Func cond) {\n var i = 0;\n foreach (var item in seq) {\n if (cond(item)) yield return i;\n i++;\n }\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\n /*\n\nstring[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n string tt = Console.ReadLine();\n int[] a = tt.Split(' ').Select(q => Convert.ToInt32(q)).ToArray();\n int[] k = Enumerable.Repeat(0, n).ToArray();\n Array.Sort(a,\n new Comparison(\n (i1, i2) => i2.CompareTo(i1)\n ));\n */\n\n /*\n \n string r = Console.ReadLine();\n int n = int.Parse(r);\n \n string t = Console.ReadLine();\n int[] a = t.Split(' ').Select(q => Convert.ToInt32(q)).ToArray();\n */\n class B\n {\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input);\n int res = 0;\n int k = (int)Math.Sqrt(n);\n int t = k * k;\n if (n - t > k)\n res = (k + 1) * 2;\n else if (t == n)\n res = k * 2;\n else\n res = k * 2 + 1;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1099B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n int x = (int)Math.Ceiling(Math.Sqrt(n));\n int y = (int)Math.Ceiling((double)n / x);\n\n Console.WriteLine(x + y);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\n\t\t\tint min = Int32.MaxValue;\n\n\t\t\tfor (int i = 1; i <= (int) Math.Sqrt(n) + 1; i++)\n\t\t\t{\n\t\t\t\tint root2 = (int)Math.Ceiling(n / (double) i);\n\n\t\t\t\t//Console.WriteLine(i + \" * \" + root2);\n\t\t\t\tmin = Math.Min(min, i + root2);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString(\"F8\");\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n int sqrn = (int)Math.Sqrt(n);\n\n int a = 1;\n int b = 1;\n while(a*b < n)\n {\n if (a < b)\n a++;\n else\n b++;\n }\n\n int res = a + b;\n ioHelper.WriteLine(res.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tlong N = long.Parse(Console.ReadLine());\n\t\tlong ans = -1;\n\t\tfor(long i=1;i<=1000000;i++){\n\t\t\tif(i*i>=N){\n\t\t\t\tans = i*2;\n\t\t\t\tbreak;\n\t\t\t} else if(i*(i+1)>=N){\n\t\t\t\tans = i*2+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n if (n == 1)\n {\n Console.WriteLine(2);\n return;\n }\n \n if (n == 2)\n {\n Console.WriteLine(3);\n return;\n }\n \n var i = 1;\n for (; i*i < n; i += 1) ;\n\n var power = i * i;\n\n if (power - i >= n)\n {\n Console.WriteLine(i*2 - 1);\n return;\n }\n else\n {\n Console.WriteLine(i*2);\n return;\n }\n }\n }\n}"}, {"source_code": "using System;\n\nclass _1099B\n{\n\tstatic void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\n\t\tdouble sqrt = Math.Sqrt(n);\n\t\tint sqrtInt = (int)sqrt;\n\t\tConsole.WriteLine((sqrtInt << 1) + (sqrt == sqrtInt ? 0 : sqrt - sqrtInt < 0.5 ? 1 : 2));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Squares_and_Segments\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n int n = Next();\n\n for (long i = (long) Math.Sqrt(n) - 1;; i++)\n {\n if (i*(i - 1) >= n)\n {\n return i + i - 1;\n }\n if (i*i >= n)\n {\n return 2*i;\n }\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Globalization;\nusing System.Diagnostics;\n\nnamespace ReadString\n{\n class Program\n {\n\n static bool[] Erastofen(long count)\n {\n long counter = 2;\n bool[] EN = new bool[count];\n\n for (counter = 2; counter < count; counter++)\n {\n EN[counter] = true;\n }\n\n long z = 2;\n long e = 0;\n while (e == 0)\n {\n for (counter = z + z; counter < count; counter = count + z)\n {\n EN[counter] = false;\n }\n\n for (counter = z + 1; counter < count; counter++)\n {\n if (counter == (count - 1))\n {\n e = 1;\n break;\n }\n if (EN[counter] == true)\n {\n z = counter;\n break;\n }\n\n }\n }\n return EN;\n }\n static long? BinarySearch(long[] a, int x)\n {\n if ((a.Length == 0) || (x < a[0]) || (x > a[a.Length - 1]))\n return null;\n\n int first = 0;\n\n int last = a.Length;\n\n while (first < last)\n {\n int mid = first + (last - first) / 2;//\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u043b\u0430\u0445\n\n if (x <= a[mid])\n last = mid;\n else\n first = mid + 1;\n }\n if (a[last] == x)\n return last;\n else\n return null;\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static long FindNok(long first, long second)\n {\n return first * second / FindNod(first, second);\n }\n\n static long FindNod(long first, long second)\n {\n while (true)\n {\n if (first == 0) return second;\n var temp = first;\n first = second % first;\n second = temp;\n }\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(Math.Ceiling(Math.Sqrt(n) * 2));\n\n // long? number = BinarySearch(numbers, 5);// ? \u0442\u0438\u043f Nullable, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430 1, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0430\u0440\u0443\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f\n\n // bool[] primeNumber = Erastofen(50);//\u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0440\u0435\u0448\u0435\u0442\u043e\u043c \u044d\u0440\u0430\u0441\u0442\u043e\u0444\u0435\u043d\u0430\n\n // string s = Reverse(\"123456789\");//\u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u0442\u0440\u043e\u043a\u0438\n // string s1 = s1.Replace(\" \", string.Empty));//\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043e\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Yuhao\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sqr = (int)Math.Sqrt(n);\n if (sqr * sqr < n) sqr++;\n int X;\n X = 2 * sqr;\n if (sqr * (sqr - 1) >= n)\n X--;\n \n Console.WriteLine(X);\n\n // Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = ReadInt();\n var side = Math.Sqrt(n);\n var ans = 0;\n if (side % 1 == 0) ans = (int)side * 2;\n else\n {\n var rem = n - (int)side * (int)side;\n if (rem <= (int)side) ans = (int)side * 2 + 1;\n else ans = (int)side * 2 + 2;\n }\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n static string Read() { return Console.ReadLine(); }\n static int ReadInt() { return int.Parse(Read()); }\n static long ReadLong() { return long.Parse(Read()); }\n static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }\n static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }\n }\n}"}, {"source_code": "/* Date: 31.01.2019 * Time: 21:45 */\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** n = \" + n);\n# endif\n\n\t\tint m = 1;\n\t\tfor ( int i=0; ; i++ )\n\t\t\tif ( n <= i*(i+1) )\n\t\t\t{\n\t\t\t\tm = i + i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if ( (i+1)*(i+1) >= n )\n\t\t\t{\n\t\t\t\tm = i + i + 2;\n\t\t\t\tbreak;\n\t\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (m);\n# else\n\t\tsw.WriteLine (m);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int n = NextInt();\n int a = (int) Math.Ceiling(Math.Sqrt(n));\n int b = (n + a - 1) / a;\n writer.Write(a + b);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int NextInt() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n private static long NextLong() {\n int c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n int n = Convert.ToInt32(temp);\n int x = (int)Math.Floor(Math.Sqrt((double)n));\n int y = x;\n int i = 0;\n while (y * x < n)\n {\n if (i % 2 == 0)\n {\n x++;\n }\n else\n {\n y++;\n }\n i = 1 - i;\n }\n Console.WriteLine(x + y);\n }\n }\n}"}, {"source_code": "using System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass SolutionCF\n{\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n var sqrt = (long)Math.Sqrt(n);\n\n var r = sqrt;\n var c = sqrt;\n\n if (r * c < n)\n r++;\n if (r * c < n)\n c++;\n\n Console.WriteLine(r + c);\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Int64.Parse(Console.ReadLine());\n //var a = Array.ConvertAll(Console.ReadLine().Split(' '), Int64.Parse);\n var a = (long) Math.Floor(Math.Sqrt(n));\n var diff = n - a * a;\n if (diff == 0)\n {\n Console.WriteLine(a*2);\n }\n else if (diff <= a)\n {\n Console.WriteLine(a*2 + 1);\n }\n else\n {\n Console.WriteLine(a*2 + 2);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n if (n == 1)\n {\n Console.WriteLine(2);\n return;\n }\n \n if (n == 2)\n {\n Console.WriteLine(3);\n return;\n }\n \n var i = 1;\n for (; Math.Pow(2, i) < n; i += 1) ;\n\n var power = Math.Pow(2, i);\n\n if (power - i >= n)\n {\n Console.WriteLine(i*2 - 1);\n return;\n }\n else\n {\n Console.WriteLine(i*2);\n return;\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n if (n == 1)\n {\n Console.WriteLine(2);\n return;\n }\n \n var i = 1;\n for (; Math.Pow(2, i) < n; i += 1) ;\n\n var power = Math.Pow(2, i);\n\n if (power - i >= n)\n {\n Console.WriteLine(i*2 - 1);\n return;\n }\n else\n {\n Console.WriteLine(i*2);\n return;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int n = NextInt();\n int a = (int) Math.Ceiling(Math.Sqrt(n));\n int b = (int) Math.Ceiling(n / (float) a);\n writer.Write(a + b);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int NextInt() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n private static long NextLong() {\n int c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}], "src_uid": "eb8212aec951f8f69b084446da73eaf7"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R181_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int n = int.Parse(s[2]);\n \n List ind = new List();\n for (int i = 0; i <= n; i++)\n {\n int sum = a * i + b * (n - i);\n string sumS = sum.ToString();\n bool good = true;\n for (int j = 0; j < sumS.Length; j++)\n {\n int d = sumS[j] - '0';\n if (d != a && d != b)\n {\n good = false;\n break;\n }\n }\n if (good)\n ind.Add(i);\n }\n\n GenerateFactorials();\n\n long ans = 0;\n for (int i = 0; i < ind.Count; i++)\n {\n ans += nCk(n, ind[i]);\n ans = ans % MOD;\n }\n\n Console.WriteLine(ans);\n }\n\n static long MOD = 1000000007;\n\n static long AddMod(long x, long y)\n {\n return (x + y) % MOD;\n }\n static long MulMod(long x, long y)\n {\n return (x * y) % MOD;\n }\n static long GCDex(long a, long b, ref long nx, ref long ny)\n {\n if (b == 0)\n {\n nx = 1;\n ny = 0;\n return a;\n }\n long x = 0, y = 0;\n long d = GCDex(b, a % b, ref x, ref y);\n nx = y;\n ny = x - (a / b) * y;\n return d;\n }\n static long ModInv(long a)\n {\n long f = 0, g = 0;\n if (GCDex(a, MOD, ref f, ref g) != 1) //MOD must be prime\n throw new System.ArgumentException(\"No Inverse\");\n f %= MOD;\n f += MOD;\n f %= MOD;\n if (MulMod(a, f) != 1)\n throw new System.ArgumentException(\"No Inverse\");\n return f;\n }\n static long DivMod(long a, long b)\n {\n return MulMod(a, ModInv(b));\n }\n\n static long[] facts = new long[1000001];\n static void GenerateFactorials()\n {\n facts[0] = 1;\n for (int i = 1; i < 1000001; i++)\n facts[i] = MulMod(facts[i - 1], i);\n }\n\n static long nCk(long n, long k)\n {\n if (n - k < 0)\n throw new System.ArgumentException(\"Invalid parms\");\n long nCOMBk = DivMod(DivMod(facts[n], facts[k]), facts[n - k]);\n return nCOMBk;\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string test = \"C2\";\n \n private static void Solve()\n {\n int a, b, n;\n Read(out a, out b, out n);\n var mod = 1000000007;\n var fact = new long[n+1];\n fact[0] = 1;\n for (int i = 1; i <= n; i++)\n {\n fact[i] = fact[i-1]*i;\n fact[i] %= mod;\n }\n var res = 0L;\n for (int aCount= 0; aCount <= n; aCount++)\n {\n var bCount = n - aCount;\n if (IsGood(aCount*a + bCount*b, a, b))\n {\n var denominator = fact[aCount]*fact[bCount];\n denominator %= mod;\n var temp = fact[n]* BinPow(denominator, mod-2,mod);\n var tempint = (int)(temp%mod);\n res += tempint;\n res %= mod;\n }\n }\n WriteLine(res);\n }\n\n private static long BinPow(long a, int pow, int mod)\n {\n if (pow == 0)\n return 1;\n\n if (pow%2 == 1)\n return (BinPow(a, pow - 1, mod)*a) %mod;\n \n var b = BinPow(a, pow/2, mod);\n b %= mod;\n var res = b*b;\n res %= mod;\n return res;\n }\n\n private static bool IsGood(int n, int a, int b)\n {\n var res = (n!=0);\n while (n > 0)\n {\n var end = n%10;\n n /= 10;\n res &= (end == a || end == b);\n }\n return res;\n }\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n \n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null) \n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n \n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n internal class Program\n {\n private const long Divisor = 1000000007;\n\n public static void Main()\n {\n Solve3();\n }\n\n public static void Solve3()\n {\n var ns = Console.ReadLine().Split(new[] {' '}).Select(int.Parse).ToArray();\n var a = ns[0];\n var b = ns[1];\n var n = ns[2];\n\n var divs = new int[n + 1];\n for (var i = 0; i <= n; i++) divs[i] = -1;\n for (var i = 2; i < n; i++)\n {\n for (var k = i*2; k <= n; k += i)\n divs[k] = i;\n }\n\n var result = 0L;\n for (var na = 0; na <= n; na++)\n {\n var nb = n - na;\n var acc = nb*b + na*a;\n\n var isWonderful = true;\n while (acc > 0)\n {\n var d = acc%10;\n if (d != a && d != b)\n {\n isWonderful = false;\n break;\n }\n acc = acc/10;\n }\n if (!isWonderful) continue;\n\n var muls = new int[n + 1];\n for (var i = n; i > na; i--) muls[i]++;\n for (var i = 2; i <= nb; i++) muls[i]--;\n\n var combs = 1L;\n for (var i = n; i > 1 ; i--)\n {\n if (divs[i] == -1)\n {\n for (var j = 0; j < muls[i]; j++) combs = (combs * i) % Divisor;\n }\n else\n {\n var d = divs[i];\n muls[d] += muls[i];\n muls[i/d] += muls[i];\n }\n }\n result = (result + combs)%Divisor;\n }\n Console.WriteLine(result);\n }\n\n public static void Solve1()\n {\n int.Parse(Console.ReadLine());\n\n var arr1 = new List();\n var arr2 = new List();\n var arr3 = new List();\n\n var numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var negatives = new List();\n foreach (var n in numbers)\n {\n if (n == 0)\n arr3.Add(n);\n else if (n > 0)\n arr2.Add(n);\n else negatives.Add(n);\n }\n\n arr1.Add(negatives[0]);\n if (arr2.Count == 0)\n {\n arr2.Add(negatives[1]);\n arr2.Add(negatives[2]);\n for (var i = 3; i < negatives.Count; i++)\n arr3.Add(negatives[i]);\n }\n else\n {\n for (var i = 1; i < negatives.Count; i++)\n arr3.Add(negatives[i]);\n\n }\n\n Console.Write(\"{0} \", arr1.Count);\n Console.WriteLine(string.Join(\" \", arr1.Select(l => l.ToString()).ToArray()));\n Console.Write(\"{0} \", arr2.Count);\n Console.WriteLine(string.Join(\" \", arr2.Select(l => l.ToString()).ToArray()));\n Console.Write(\"{0} \", arr3.Count);\n Console.WriteLine(string.Join(\" \", arr3.Select(l => l.ToString()).ToArray()));\n }\n }\n}\n\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\ndelegate double F(double x);\ndelegate decimal Fdec(decimal x);\nnamespace CF\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int a, b, n;\n string[] input = ReadArray();\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n n = int.Parse(input[2]);\n const int t = 10;\n const int mod = 1000 * 1000 * 1000 + 7;\n long ans = 0;\n long[] fact = new long[n + 1];\n for (int i = 0; i <= n; i++)\n {\n fact[i] = 1;\n }\n for (long i = 1; i <= n; i++)\n {\n fact[i] = (fact[i - 1] * i) % mod;\n }\n\n for (int i = 0; i <= n; i++)\n {\n int cur = i * a + b * (n - i);\n do\n {\n int rem = cur % t;\n if (rem != a && rem != b)\n break;\n cur /= 10;\n }\n while (cur != 0);\n if (cur == 0)\n {\n long inv = MyMath.BinPow((fact[n - i] * fact[i]) % mod, mod - 2, mod);\n ans = (ans + (inv * fact[n]) % mod) % mod;\n }\n }\n Console.WriteLine(ans);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n\n\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public List> temp;\n public int n;\n\n public Graph(int n)\n {\n temp = new List>();\n for (int i = 0; i <= n; i++)\n {\n g.Add(new List());\n }\n\n u = new List();\n\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n temp.Add(new List());\n s.Push(v);\n u[v] = false;\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n u[g[cur][i]] = false;\n s.Push(g[cur][i]);\n }\n }\n if (all)\n {\n temp[temp.Count - 1].Add(s.Pop());\n }\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(int[] A, int p, int q, int r, int[] L, int[] R)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i] <= R[j])\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(int[] A, int p, int r, int[] L, int[] R)\n {\n if (!(p < r)) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(int[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n int temp, b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R300\n{\n public static class C\n {\n const int MOD = 1000000007;\n\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n Contract.Requires(tr != null);\n Contract.Requires(tw != null);\n\n var info = CultureInfo.CurrentCulture;\n var abn = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n\n var res = Calc(abn[0], abn[1], abn[2]);\n\n tw.WriteLine(res);\n }\n\n private static int Calc(int a, int b, int n)\n {\n var res = 0L;\n\n var combination = new long[n + 1];\n combination[0] = 1;\n for (int i = 1; i <= n; ++i)\n {\n combination[i] = combination[i - 1] * ModDiv(n - i + 1, i, MOD) % MOD;\n }\n\n for (int i = 0; i <= n; ++i)\n {\n var sum = a * (n - i) + b * i;\n if (IsGood(a, b, sum))\n {\n res = (res + combination[i]) % MOD;\n }\n }\n\n return (int)res;\n }\n\n public static int Combination(int n, int r)\n {\n var res = 1L;\n for (int i = 0; i < r; ++i)\n {\n res = res * (n - i) % MOD;\n }\n for (int i = 0; i < r; ++i)\n {\n res = ModDiv(res, r - i, MOD);\n }\n return (int)res % MOD;\n }\n\n public static long ModDiv(long res, int v, int mod)\n {\n return res * ModPow(v, mod - 2, mod) % mod;\n }\n\n public static long ModPow(long x, int n, int mod)\n {\n var res = 1L;\n for (; n > 0; n >>= 1)\n {\n if ((n & 1) == 1)\n {\n res = res * x % mod;\n }\n x = x * x % mod;\n }\n return res;\n }\n\n public static bool IsGood(int a, int b, int n)\n {\n for (; n > 0; n /= 10)\n {\n var lastDigit = n % 10;\n\n if (lastDigit != a && lastDigit != b)\n {\n return false;\n }\n }\n return true;\n }\n\n public static int SumDigits(int n)\n {\n var res = 0;\n\n for (; n > 0; n /= 10)\n {\n res += n % 10;\n }\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Beautiful_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int mod = 1000000007;\n\n private static int[] fact;\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n int n = Next();\n\n InitFact(n);\n\n long sum = 0;\n for (int i = 0; i <= n; i++)\n {\n int d = a*i + b*(n - i);\n bool ok = true;\n while (d > 0)\n {\n int dd = d%10;\n if (dd != a && dd != b)\n {\n ok = false;\n break;\n }\n d /= 10;\n }\n if (!ok)\n continue;\n\n sum = (sum + GetCFact(n, i))%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static void InitFact(int n)\n {\n fact = new int[n + 1];\n fact[0] = 1;\n\n for (long i = 1; i < fact.Length; i++)\n {\n fact[i] = (int) ((fact[i - 1]*i)%mod);\n }\n }\n\n private static long GetCFact(int n, int k)\n {\n return (((fact[n]*Pow(fact[k], mod - 2))%mod)*Pow(fact[n - k], mod - 2))%mod;\n }\n\n private static long Pow(long a, int k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Beautiful_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int mod = 1000000007;\n\n private static long[] fact;\n private static long[] fact1;\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n int n = Next();\n\n InitFact(n);\n\n long sum = 0;\n for (int i = 0; i <= n; i++)\n {\n int d = a*i + b*(n - i);\n bool ok = true;\n while (d > 0)\n {\n int dd = d%10;\n if (dd != a && dd != b)\n {\n ok = false;\n break;\n }\n d /= 10;\n }\n if (!ok)\n continue;\n\n sum = (sum + GetCFact(n, i))%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static void InitFact(int n)\n {\n fact = new long[n + 1];\n fact1 = new long[n + 1];\n\n fact[0] = 1;\n fact1[0] = 1;\n\n for (int i = 1; i < fact.Length; i++)\n {\n fact[i] = (fact[i - 1]*i)%mod;\n fact1[i] = Pow(fact[i], mod - 2);\n }\n }\n\n private static long GetCFact(int n, int k)\n {\n return (((fact[n]*fact1[k])%mod)*fact1[n - k])%mod;\n }\n\n private static long Pow(long a, int k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Beautiful_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int mod = 1000000007;\n\n private static long[] fact;\n private static long[] fact1;\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n int n = Next();\n\n InitFact(n);\n\n long sum = 0;\n for (int i = 0; i <= n; i++)\n {\n int d = a*i + b*(n - i);\n bool ok = true;\n while (d > 0)\n {\n int dd = d%10;\n if (dd != a && dd != b)\n {\n ok = false;\n break;\n }\n d /= 10;\n }\n if (!ok)\n continue;\n\n sum = (sum + GetCFact(n, i))%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static void InitFact(int n)\n {\n fact = new long[n + 1];\n //fact1 = new long[n + 1];\n\n fact[0] = 1;\n //fact1[0] = 1;\n\n for (int i = 1; i < fact.Length; i++)\n {\n fact[i] = (fact[i - 1]*i)%mod;\n //fact1[i] = Pow(fact[i], mod - 2);\n }\n }\n\n private static long GetCFact(int n, int k)\n {\n return (((fact[n]*Pow(fact[k], mod - 2))%mod)*Pow(fact[n - k], mod - 2))%mod;\n }\n\n private static long Pow(long a, int k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n if (a < b)\n {\n long t = a;\n a = b;\n b = t;\n }\n return (b > 0) ? gcd(b, a % b) : a;\n }\n /*static BigInteger C(int k, int n)\n {\n BigInteger c = 1;\n if (k < n / 2)\n k = n - k;\n for (int i = k + 1; i <= n; ++i)\n c *= i;\n for (int i = 2; i <= n - k; ++i)\n c /= i;\n return c;\n }*/\n static void _235A()\n {\n long n = long.Parse(reader.ReadLine()), ans = n * (n - 1);\n if (n < 3)\n ans = n;\n else if (n % 2 == 1)\n ans *= n - 2;\n else\n {\n long t = (n - 2) / 2;\n for (long i = n - 3; i > (n - 2) / 2; --i)\n {\n long g = gcd(n, i);\n if (g == 1)\n t = Math.Max(t, i);\n }\n ans *= t;\n }\n writer.Write(Math.Max(ans,(n-1)*(n-2)*(n-3)));\n }\n static void _106C()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), c0 = int.Parse(s[2]), d0 = int.Parse(s[3]);\n int[] a = new int[m + 1], b = new int[m + 1], c = new int[m + 1], d = new int[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n s = reader.ReadLine().Split();\n a[i] = int.Parse(s[0]);\n b[i] = int.Parse(s[1]);\n c[i] = int.Parse(s[2]);\n d[i] = int.Parse(s[3]);\n }\n int[] dp_d = new int[n + 1], dp_c = new int[n + 1];\n dp_d[0] = dp_c[0] = 0;\n int[,] dp_b = new int[n + 1, m + 1];\n for (int i = 1; i <= n; ++i)\n {\n if (c0 == i)\n {\n dp_d[i] = d0;\n dp_c[i] = i;\n }\n for (int j = 1; j <= m; ++j)\n {\n if (c[j] == i)\n {\n if (dp_d[i] < d[j] && b[j] <= a[j])\n {\n dp_d[i] = d[j];\n dp_c[i] = i;\n dp_b[i, j] = b[j];\n }\n else if (dp_d[i] == d[j])\n {\n // ???\n }\n }\n }\n // what about leftovers???\n for (int j = 1; j <= i / 2; ++j)\n {\n if (dp_d[j] + dp_d[i - j] > dp_d[i])\n {\n bool ok = true;\n for (int k = 1; k <= m && ok; ++k)\n {\n if (dp_b[j, k] + dp_b[i - j, k] > a[k])\n ok = false;\n }\n if (ok)\n {\n dp_d[i] = dp_d[j] + dp_d[i - j];\n dp_c[i] = dp_c[j] + dp_c[i - j];\n for (int k = 1; k <= m; ++k)\n dp_b[i,k] = dp_b[j, k] + dp_b[i - j, k];\n }\n }\n }\n if (c0 <= i)\n if (d0 + dp_d[i - c0] > dp_d[i])\n {\n dp_d[i] = d0 + dp_d[i - c0];\n dp_c[i] = c0 + dp_c[i - c0];\n }\n if (dp_d[i] < dp_d[i - 1])\n {\n dp_d[i] = dp_d[i - 1];\n dp_c[i] = dp_c[i - 1];\n for (int j = 1; j <= m; ++j)\n dp_b[i, j] = dp_b[i - 1, j];\n }\n }\n writer.Write(dp_d[n]);\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) != 0)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _300C()\n {\n string[] s = reader.ReadLine().Split();\n long a = long.Parse(s[0]), b = long.Parse(s[1]), n = long.Parse(s[2]);\n if (a > b)\n {\n long t = a;\n a = b;\n b = t;\n }\n long[] fact = new long[n + 1];\n fact[0] = fact[1] = 1;\n long mod = 1000000007;\n for (long i = 2; i <= n; ++i)\n fact[i] = fact[i - 1] * i % mod;\n long an = n, bn = 0;\n long ans = 0;\n while (an >= 0)\n {\n long num = an * a + bn * b;\n bool ok = true;\n for (long p = 10; ok && p <= 10000000; p *= 10)\n {\n long t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n long c = (((fact[n] * pow(fact[an], mod - 2, mod)) % mod) * pow(fact[bn], mod - 2, mod)) % mod;\n ans += c;\n ans %= mod;\n }\n --an;\n ++bn;\n }\n writer.Write(ans);\n }\n static void Main(string[] args)\n {\n //_235A();\n //_106C();\n _300C();\n reader.Close();\n writer.Close();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n const int MOD = 1000000007;\n static long[] fac = new long[1000010];\n static long mod_pow(long num, long pow, long mod)\n {\n long ret = 1;\n while (pow>0)\n { \n if (pow%2>0)\n {\n ret = (ret*num)%mod;\n }\n pow>>=1;\n num = (num*num)%mod;\n }\n return ret;\n }\n static void precalc()\n {\n fac[0] = 1;\n for (int i = 1; i <= 1000000; i++)\n {\n fac[i] = i * fac[i - 1];\n fac[i] %= MOD;\n }\n }\n static long mod_inv(long num, long mod)\n {\n return mod_pow(num, mod-2, mod);\n }\n // (A/B) mod M = (A mod M) * mod_inv(B mod M, M)\n static long C(int n, int k)\n {\n long up = fac[n];\n long down = fac[k] * fac[n - k] % MOD;\n return up * mod_inv(down, MOD);\n }\n static long solve(int a, int b, int i, int n)\n {\n if ((i - a * n) % (b-a) > 0) return 0;\n int y = (i - a * n) / (b-a);\n if (y < 0) return 0;\n if (y > n) return 0;\n return C(n, y);\n }\n static void Main(string[] args)\n {\n precalc();\n int a, b, n;\n string[] s = Console.ReadLine().Split();\n a = int.Parse(s[0]);\n b = int.Parse(s[1]);\n n = int.Parse(s[2]);\n long ans=0;\n for (int i = 1; i <= 9*n; i++)\n {\n bool good = true;\n int j = i;\n int numofc = 0;\n while (j > 0)\n {\n numofc++;\n int last = j % 10;\n j /= 10;\n if (last != a && last != b) {good = false; break;}\n }\n if (!good) continue;\n //Console.WriteLine(i.ToString());\n ans += solve(a, b, i,n);\n ans %= MOD;\n }\n Console.WriteLine(ans.ToString());\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n const int MOD = 1000000007;\n static long[] fac = new long[1000010];\n static long mod_pow(long num, long pow, long mod)\n {\n long ret = 1;\n while (pow>0)\n { \n if (pow%2>0)\n {\n ret = (ret*num)%mod;\n }\n pow>>=1;\n num = (num*num)%mod;\n }\n return ret;\n }\n static void precalc()\n {\n fac[0] = 1;\n for (int i = 1; i <= 1000000; i++)\n {\n fac[i] = i * fac[i - 1];\n fac[i] %= MOD;\n }\n }\n static long mod_inv(long num, long mod)\n {\n return mod_pow(num, mod-2, mod);\n }\n // (A/B) mod M = (A mod M) * mod_inv(B mod M, M)\n static long C(int n, int k)\n {\n long up = fac[n];\n long down = fac[k] * fac[n - k] % MOD;\n return up * mod_inv(down, MOD);\n }\n static long solve(int a, int b, int i, int n)\n {\n if ((i - a * n) % (b-a) > 0) return 0;\n int y = (i - a * n) / (b-a);\n if (y < 0) return 0;\n if (y > n) return 0;\n return C(n, y);\n }\n static void Main(string[] args)\n {\n precalc();\n int a, b, n;\n string[] s = Console.ReadLine().Split();\n a = int.Parse(s[0]);\n b = int.Parse(s[1]);\n n = int.Parse(s[2]);\n long ans=0;\n for (int i = 1; i <= 9*n; i++)\n {\n bool good = true;\n int j = i;\n int numofc = 0;\n while (j > 0)\n {\n numofc++;\n int last = j % 10;\n j /= 10;\n if (last != a && last != b) {good = false; break;}\n }\n if (!good) continue;\n //Console.WriteLine(i.ToString());\n ans += solve(a, b, i,n);\n ans %= MOD;\n }\n Console.WriteLine(ans.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Codeforces_CS\n{\n class Class1\n {\n static void Main(string[] args)\n {\n new Class1().run();\n }\n\n\n void run()\n {\n InputReader cin = new InputReader(Console.OpenStandardInput());\n int a = cin.int32();\n int b = cin.int32();\n int n = cin.int32();\n\n long MOD = ((long)1e9) + 7;\n __modFact = new long[n + 1];\n for (int i = 0; i <= n; i++) __modFact[i] = -1;\n for (int i = 0; i <= n; i += 1000) __modFact[i] = modFact(i, MOD);\n\n long ways = 0;\n for (int i = 0; i <= n; i++)\n {\n long sum = (i * 1L * a) + ((n - i) * 1L * b);\n if (isGood(sum, a, b))\n ways += modComb(n, i, MOD);\n ways %= MOD;\n }\n\n Console.WriteLine(ways);\n }\n\n\n bool isGood(long x, int a, int b)\n {\n if (x == 0) return false;\n while (x > 0)\n {\n int r = (int)(x % 10L);\n if (r != a && r != b)\n return false;\n x /= 10;\n }\n return true;\n }\n\n long modPow(long b, long e, long MOD)\n {\n if (e == 0) return 1;\n if (e == 1) return b % MOD;\n long temp = modPow(b, e / 2, MOD);\n temp = (temp * temp) % MOD;\n if (e % 2 == 1)\n temp = (temp * (b % MOD)) % MOD;\n return temp;\n }\n\n long modInv(long b, long MOD)\n {\n return modPow(b, MOD - 2, MOD);\n }\n\n long modComb(long n, long r, long MOD)\n {\n return (modFact(n, MOD) * modInv(modFact(n - r, MOD) * modFact(r, MOD), MOD)) % MOD;\n }\n\n long[] __modFact;\n\n long modFact(long n, long MOD)\n {\n if (n == 0) return 1;\n if (__modFact[n] != -1) return __modFact[n];\n return __modFact[n] = ((n % MOD) * (modFact(n - 1, MOD) % MOD)) % MOD;\n }\n }\n\n class InputReader\n {\n Stream inputStream;\n const int bufferSize = 1 << 16;\n int bytesRead;\n int currentBufferTop;\n byte[] buffer;\n\n public InputReader(Stream _inputStream)\n {\n this.inputStream = _inputStream;\n bytesRead = 0;\n currentBufferTop = 0;\n buffer = new byte[bufferSize];\n }\n\n public byte peekChar()\n {\n if (currentBufferTop < bytesRead)\n {\n return this.buffer[this.currentBufferTop];\n }\n else\n {\n if (!this.refill())\n {\n throw new Exception(\"Error in reading input or reached EOF\");\n }\n else\n {\n return peekChar();\n }\n }\n }\n\n public byte readChar()\n {\n if (currentBufferTop < bytesRead)\n {\n return this.buffer[this.currentBufferTop++];\n }\n else\n {\n if (!this.refill())\n {\n throw new Exception(\"Error in reading input or reached EOF\");\n }\n else\n {\n return readChar();\n }\n }\n }\n\n public bool refill()\n {\n currentBufferTop = 0;\n bytesRead = inputStream.Read(buffer, 0, bufferSize);\n return bytesRead > 0;\n }\n\n public int int32()\n {\n return (int) int64();\n }\n\n public long int64()\n {\n byte temp = peekChar();\n while (temp != '-' && (temp < '0' || temp > '9'))\n {\n readChar();\n temp = peekChar();\n }\n int sign = 1;\n if (temp == '-') sign = -1;\n if (temp == '-') readChar();\n long readValue = 0;\n temp = peekChar();\n while (temp >= '0' && temp <= '9')\n {\n readValue *= 10;\n readValue += (int)(temp - '0');\n readChar();\n try\n {\n temp = peekChar();\n }\n catch (Exception e)\n {\n break;\n }\n }\n return readValue * sign;\n }\n\n public string token()\n {\n byte temp = peekChar();\n while (isSpace(temp))\n {\n readChar();\n temp = peekChar();\n }\n\n StringBuilder sb = new StringBuilder();\n try\n {\n temp = peekChar();\n while (!isSpace(temp))\n {\n readChar();\n sb.Append((char)temp);\n temp = peekChar();\n\n }\n }\n catch (Exception e) { }\n return sb.ToString();\n }\n\n public string line()\n {\n StringBuilder sb = new StringBuilder();\n try\n {\n byte temp;\n do\n {\n temp = peekChar();\n sb.Append(temp);\n readChar();\n } while (temp != '\\n');\n }\n catch (Exception e) { }\n return sb.ToString();\n }\n\n private bool isSpace(byte t)\n {\n if (t == ' ') return true;\n if (t == '\\t') return true;\n if (t == '\\r') return true;\n if (t == '\\n') return true;\n if (t == '\\f') return true;\n return false;\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n if (a < b)\n {\n long t = a;\n a = b;\n b = t;\n }\n return (b > 0) ? gcd(b, a % b) : a;\n }\n /*static BigInteger C(int k, int n)\n {\n BigInteger c = 1;\n if (k < n / 2)\n k = n - k;\n for (int i = k + 1; i <= n; ++i)\n c *= i;\n for (int i = 2; i <= n - k; ++i)\n c /= i;\n return c;\n }*/\n static void _235A()\n {\n long n = long.Parse(reader.ReadLine()), ans = n * (n - 1);\n if (n < 3)\n ans = n;\n else if (n % 2 == 1)\n ans *= n - 2;\n else\n {\n long t = (n - 2) / 2;\n for (long i = n - 3; i > (n - 2) / 2; --i)\n {\n long g = gcd(n, i);\n if (g == 1)\n t = Math.Max(t, i);\n }\n ans *= t;\n }\n writer.Write(Math.Max(ans,(n-1)*(n-2)*(n-3)));\n }\n static void _106C()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), c0 = int.Parse(s[2]), d0 = int.Parse(s[3]);\n int[] a = new int[m + 1], b = new int[m + 1], c = new int[m + 1], d = new int[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n s = reader.ReadLine().Split();\n a[i] = int.Parse(s[0]);\n b[i] = int.Parse(s[1]);\n c[i] = int.Parse(s[2]);\n d[i] = int.Parse(s[3]);\n }\n int[] dp_d = new int[n + 1], dp_c = new int[n + 1];\n dp_d[0] = dp_c[0] = 0;\n int[,] dp_b = new int[n + 1, m + 1];\n for (int i = 1; i <= n; ++i)\n {\n if (c0 == i)\n {\n dp_d[i] = d0;\n dp_c[i] = i;\n }\n for (int j = 1; j <= m; ++j)\n {\n if (c[j] == i)\n {\n if (dp_d[i] < d[j] && b[j] <= a[j])\n {\n dp_d[i] = d[j];\n dp_c[i] = i;\n dp_b[i, j] = b[j];\n }\n else if (dp_d[i] == d[j])\n {\n // ???\n }\n }\n }\n // what about leftovers???\n for (int j = 1; j <= i / 2; ++j)\n {\n if (dp_d[j] + dp_d[i - j] > dp_d[i])\n {\n bool ok = true;\n for (int k = 1; k <= m && ok; ++k)\n {\n if (dp_b[j, k] + dp_b[i - j, k] > a[k])\n ok = false;\n }\n if (ok)\n {\n dp_d[i] = dp_d[j] + dp_d[i - j];\n dp_c[i] = dp_c[j] + dp_c[i - j];\n for (int k = 1; k <= m; ++k)\n dp_b[i,k] = dp_b[j, k] + dp_b[i - j, k];\n }\n }\n }\n if (c0 <= i)\n if (d0 + dp_d[i - c0] > dp_d[i])\n {\n dp_d[i] = d0 + dp_d[i - c0];\n dp_c[i] = c0 + dp_c[i - c0];\n }\n if (dp_d[i] < dp_d[i - 1])\n {\n dp_d[i] = dp_d[i - 1];\n dp_c[i] = dp_c[i - 1];\n for (int j = 1; j <= m; ++j)\n dp_b[i, j] = dp_b[i - 1, j];\n }\n }\n writer.Write(dp_d[n]);\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) != 0)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _300C()\n {\n string[] s = reader.ReadLine().Split();\n long a = long.Parse(s[0]), b = long.Parse(s[1]), n = long.Parse(s[2]);\n if (a > b)\n {\n long t = a;\n a = b;\n b = t;\n }\n long[] fact = new long[n + 1];\n fact[0] = fact[1] = 1;\n long mod = 1000000007;\n for (long i = 2; i <= n; ++i)\n fact[i] = fact[i - 1] * i % mod;\n long an = n, bn = 0;\n long ans = 0;\n while (an > 0)\n {\n long num = an * a + bn * b;\n bool ok = true;\n for (long p = 10; ok && p <= 10000000; p *= 10)\n {\n long t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n long c = (((fact[n] * pow(fact[an], mod - 2, mod)) % mod) * pow(fact[bn], mod - 2, mod)) % mod;\n ans += c;\n ans %= mod;\n }\n --an;\n ++bn;\n }\n writer.Write(ans);\n }\n static void Main(string[] args)\n {\n //_235A();\n //_106C();\n _300C();\n reader.Close();\n writer.Close();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Codeforces_CS\n{\n class Class1\n {\n static void Main(string[] args)\n {\n new Class1().run();\n }\n\n\n void run()\n {\n InputReader cin = new InputReader(Console.OpenStandardInput());\n int a = cin.int32();\n int b = cin.int32();\n int n = cin.int32();\n\n long MOD = ((long)1e9) + 7;\n __modFact = new long[n + 1];\n for (int i = 0; i <= n; i++) __modFact[i] = -1;\n for (int i = 0; i <= n; i += 1000) __modFact[i] = modFact(i, MOD);\n\n long ways = 0;\n for (int i = 0; i <= n; i++)\n {\n long sum = (i * 1L * a) + ((n - i) * 1L * b);\n if (isGood(sum, a, b))\n ways += modComb(n, i, MOD);\n }\n\n Console.WriteLine(ways);\n }\n\n\n bool isGood(long x, int a, int b)\n {\n if (x == 0) return false;\n while (x > 0)\n {\n int r = (int)(x % 10L);\n if (r != a && r != b)\n return false;\n x /= 10;\n }\n return true;\n }\n\n long modPow(long b, long e, long MOD)\n {\n if (e == 0) return 1;\n if (e == 1) return b % MOD;\n long temp = modPow(b, e / 2, MOD);\n temp = (temp * temp) % MOD;\n if (e % 2 == 1)\n temp = (temp * (b % MOD)) % MOD;\n return temp;\n }\n\n long modInv(long b, long MOD)\n {\n return modPow(b, MOD - 2, MOD);\n }\n\n long modComb(long n, long r, long MOD)\n {\n return (modFact(n, MOD) * modInv(modFact(n - r, MOD) * modFact(r, MOD), MOD)) % MOD;\n }\n\n long[] __modFact;\n\n long modFact(long n, long MOD)\n {\n if (n == 0) return 1;\n if (__modFact[n] != -1) return __modFact[n];\n return __modFact[n] = ((n % MOD) * (modFact(n - 1, MOD) % MOD)) % MOD;\n }\n }\n\n class InputReader\n {\n Stream inputStream;\n const int bufferSize = 1 << 16;\n int bytesRead;\n int currentBufferTop;\n byte[] buffer;\n\n public InputReader(Stream _inputStream)\n {\n this.inputStream = _inputStream;\n bytesRead = 0;\n currentBufferTop = 0;\n buffer = new byte[bufferSize];\n }\n\n public byte peekChar()\n {\n if (currentBufferTop < bytesRead)\n {\n return this.buffer[this.currentBufferTop];\n }\n else\n {\n if (!this.refill())\n {\n throw new Exception(\"Error in reading input or reached EOF\");\n }\n else\n {\n return peekChar();\n }\n }\n }\n\n public byte readChar()\n {\n if (currentBufferTop < bytesRead)\n {\n return this.buffer[this.currentBufferTop++];\n }\n else\n {\n if (!this.refill())\n {\n throw new Exception(\"Error in reading input or reached EOF\");\n }\n else\n {\n return readChar();\n }\n }\n }\n\n public bool refill()\n {\n currentBufferTop = 0;\n bytesRead = inputStream.Read(buffer, 0, bufferSize);\n return bytesRead > 0;\n }\n\n public int int32()\n {\n return (int) int64();\n }\n\n public long int64()\n {\n byte temp = peekChar();\n while (temp != '-' && (temp < '0' || temp > '9'))\n {\n readChar();\n temp = peekChar();\n }\n int sign = 1;\n if (temp == '-') sign = -1;\n if (temp == '-') readChar();\n long readValue = 0;\n temp = peekChar();\n while (temp >= '0' && temp <= '9')\n {\n readValue *= 10;\n readValue += (int)(temp - '0');\n readChar();\n try\n {\n temp = peekChar();\n }\n catch (Exception e)\n {\n break;\n }\n }\n return readValue * sign;\n }\n\n public string token()\n {\n byte temp = peekChar();\n while (isSpace(temp))\n {\n readChar();\n temp = peekChar();\n }\n\n StringBuilder sb = new StringBuilder();\n try\n {\n temp = peekChar();\n while (!isSpace(temp))\n {\n readChar();\n sb.Append((char)temp);\n temp = peekChar();\n\n }\n }\n catch (Exception e) { }\n return sb.ToString();\n }\n\n public string line()\n {\n StringBuilder sb = new StringBuilder();\n try\n {\n byte temp;\n do\n {\n temp = peekChar();\n sb.Append(temp);\n readChar();\n } while (temp != '\\n');\n }\n catch (Exception e) { }\n return sb.ToString();\n }\n\n private bool isSpace(byte t)\n {\n if (t == ' ') return true;\n if (t == '\\t') return true;\n if (t == '\\r') return true;\n if (t == '\\n') return true;\n if (t == '\\f') return true;\n return false;\n }\n }\n}\n"}], "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81"} {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nstatic class SolutionTemplate\n{\n static long modPow(long v, long p, long mod)\n {\n if (p == 0)\n return 1;\n if (p == 1)\n return v;\n\n long add = 1;\n while (p > 1)\n {\n if (p % 2 == 1)\n {\n add *= v;\n add %= mod;\n }\n v = (v * v) % mod;\n p = p / 2;\n }\n return (v * add) % mod;\n }\n\n\n public static List GetOrAddNew(this Dictionary> dic, K key)\n {\n if (dic == null) throw new ArgumentNullException();\n\n return (dic[key] = dic.ContainsKey(key) ? dic[key] : new List());\n }\n\n public static V GetValueOrDefault(this Dictionary dic, K key)\n {\n if (dic == null) throw new ArgumentNullException();\n if (dic.ContainsKey(key))\n return dic[key];\n return default(V);\n\n }\n\n public static void AddOrSet(this Dictionary dic, K key, long add)\n {\n if (dic == null) throw new ArgumentNullException();\n\n dic[key] = dic.GetValueOrDefault(key) + add;\n }\n\n\n public static void AddOrSet(this Dictionary dic, K key, int add)\n {\n if (dic == null) throw new ArgumentNullException();\n\n dic[key] = dic.GetValueOrDefault(key) + add;\n }\n\n\n public static void AddOrSetRemove(this Dictionary dic, K key, long add)\n {\n if (dic == null) throw new ArgumentNullException();\n\n dic[key] = dic.GetValueOrDefault(key) + add;\n\n if (dic[key] == 0)\n {\n dic.Remove(key);\n }\n }\n\n\n public static void AddOrSetRemove(this Dictionary dic, K key, int add)\n {\n if (dic == null) throw new ArgumentNullException();\n\n dic[key] = dic.GetValueOrDefault(key) + add;\n\n\n if (dic[key] == 0)\n {\n dic.Remove(key);\n }\n }\n\n public static void RemoveKeyWhen(this Dictionary dic, K key, V val)\n {\n if (dic == null) throw new ArgumentNullException();\n\n if (dic.ContainsKey(key) && object.Equals(dic[key], val))\n {\n dic.Remove(key);\n }\n }\n\n public static void RemoveAllWhen(this Dictionary dic, V val)\n {\n if (dic == null) throw new ArgumentNullException();\n\n var keys = dic.Keys.ToList();\n foreach (var item in keys)\n {\n if (object.Equals(dic[item], val))\n {\n dic.Remove(item);\n }\n }\n }\n\n public static Dictionary ToCountDictionary(this IEnumerable enm)\n {\n return enm.GroupBy(el => el).ToDictionary(k => k.Key, val => val.Count());\n }\n\n public static Dictionary ToIndexDictionary(this IEnumerable enm)\n {\n return enm.Select((el, i) => new { val = el, index = i }).ToDictionary(key => key.val, val => val.index);\n }\n\n public static Dictionary> ToIndiciesDictionary(this IEnumerable enm)\n {\n return enm.Select((el, i) => new { val = el, index = i }).GroupBy(el => el.val).\n ToDictionary(key => key.Key, val => val.Select(v => v.index).ToList());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine().Trim());\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine().Trim());\n }\n\n static double readDouble()\n {\n return double.Parse(Console.ReadLine().Trim());\n }\n\n static long[] readLongs()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(), long.Parse);\n }\n\n static int[] readInts(int add = 0)\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(), el => int.Parse(el) + add);\n }\n\n static string[] readStrings()\n {\n return Console.ReadLine().Trim().Split();\n }\n\n static string readString()\n {\n return Console.ReadLine().Trim();\n }\n\n public static int readInt(this StreamReader str)\n {\n if (str == null) throw new ArgumentNullException();\n return int.Parse(str.ReadLine().Trim());\n }\n\n\n public static int[] readInts(this StreamReader str)\n {\n if (str == null) throw new ArgumentNullException();\n return Array.ConvertAll(str.ReadLine().Trim().Split(), int.Parse);\n }\n\n static StringBuilder WriteArray(StringBuilder sb, IEnumerable lst, string delimeter)\n {\n if (lst == null)\n throw new ArgumentNullException(nameof(lst));\n if (sb == null)\n throw new ArgumentNullException(nameof(sb));\n\n foreach (var el in lst)\n {\n sb.Append(el);\n if (delimeter != null)\n sb.Append(delimeter);\n }\n return sb;\n }\n\n static StringBuilder WriteObject(StringBuilder sb, object obj, string delimeter)\n {\n if (obj == null)\n throw new ArgumentNullException(nameof(obj));\n if (sb == null)\n throw new ArgumentNullException(nameof(sb));\n\n sb.Append(obj);\n if (delimeter != null)\n sb.Append(delimeter);\n return sb;\n }\n\n static void Write2DimArr(this T[,] arr, string delimeter = \" \", string delimeter2 = \"\\n\")\n {\n if (arr == null)\n throw new ArgumentNullException(nameof(arr));\n\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n WriteObject(sb, arr[i, j], delimeter);\n }\n sb.Append(delimeter2);\n }\n Console.Write(sb.ToString());\n }\n\n\n static void Write(this object obj, string delimeter = \" \")\n {\n if (obj == null)\n throw new ArgumentNullException(nameof(obj));\n\n var enm = obj as IEnumerable;\n StringBuilder sb = new StringBuilder();\n if (enm != null)\n WriteArray(sb, enm, delimeter);\n else\n {\n WriteObject(sb, obj, delimeter);\n }\n Console.Write(sb.ToString());\n }\n static void WriteLine(this object obj, string delimeter = \" \")\n {\n obj.Write(delimeter);\n Console.WriteLine();\n }\n static void WriteS(params object[] obj)\n {\n obj.Write(\" \");\n }\n static void WriteLineS(params object[] obj)\n {\n obj.WriteLine(\" \");\n }\n\n static bool isLess(string cur, string str)\n {\n if (cur.Length > str.Length)\n return false;\n\n if (cur.Length < str.Length)\n return true;\n\n for (int i = 0; i < cur.Length; i++)\n {\n var curd = (int)char.GetNumericValue(cur[i]);\n var strd = (int)char.GetNumericValue(str[i]);\n if (curd < strd)\n return true;\n if (curd > strd)\n return false;\n }\n return false;\n }\n\n static List factorial(long n, long m)\n {\n var ret = new long[n + 1];\n ret[0] = 1;\n for (long i = 1; i < n + 1; i++)\n {\n ret[i] = (ret[i - 1] * i) % m;\n }\n return ret.ToList();\n\n }\n\n private static int GetAfter(int c, List lst)\n {\n var l = -1;\n var r = lst.Count;\n\n while (r - l > 1)\n {\n var cur = (r + l) / 2;\n\n if (lst[cur] <= c)\n {\n l = cur;\n }\n else\n {\n r = cur;\n }\n }\n return r;\n\n }\n\n\n\n\n private static string GoogleString(int t, string add)\n {\n return string.Format(\"Case #{0}: {1}\", t, add);\n }\n\n private static int getPow(long v)\n {\n var cnt = 0;\n while (v > 0)\n {\n cnt++;\n v = v >> 1;\n }\n return cnt;\n }\n\n private static int getSteps(long v, long target)\n {\n if (target > v)\n throw new Exception();\n var cnt = 0;\n while (v > target)\n {\n cnt++;\n v = v >> 1;\n }\n return cnt;\n }\n\n static int findLcaLen(int[,] sparse, int[] levels, int v1, int v2, int m)\n {\n if (levels[v1] < levels[v2])\n {\n var tmp = v1;\n v1 = v2;\n v2 = tmp;\n }\n int len = 0;\n for (int i = m; i >= 0; i--)\n {\n if (levels[sparse[v1, i]] >= levels[v2])\n {\n len += (1 << i);\n v1 = sparse[v1, i];\n }\n }\n if (v1 == v2) return len;\n\n for (int i = m; i >= 0; i--)\n {\n if (sparse[v1, i] != sparse[v2, i])\n {\n v1 = sparse[v1, i];\n v2 = sparse[v2, i];\n len += (1 << (i + 1));\n }\n }\n return len + 2;\n\n }\n\n private static int greater(List lst, int vl)\n {\n int l = -1;\n int r = lst.Count;\n while (r - l > 1)\n {\n var cur = (r + l) / 2;\n if (lst[cur] <= vl)\n {\n l = cur;\n }\n else\n {\n r = cur;\n }\n }\n return r;\n }\n\n public class Heap where T : IComparable\n {\n List arr;\n bool isMax;\n\n public Heap(int n, bool isMax = true)\n {\n this.isMax = isMax;\n arr = new List(n);\n }\n\n public Heap(bool isMax = true)\n {\n this.isMax = isMax;\n arr = new List();\n }\n\n private void Heapify(int i)\n {\n var ch1 = 2 * i + 1;\n var ch2 = 2 * i + 2;\n\n if (isMax)\n {\n if (ch2 < arr.Count)\n {\n if (arr[ch2].CompareTo(arr[ch1]) < 0)\n {\n if (arr[i].CompareTo(arr[ch1]) < 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else // arr[ch2] <= arr[ch1]\n {\n if (arr[i].CompareTo(arr[ch2]) < 0)\n {\n Swap(i, ch2);\n Heapify(ch2);\n }\n }\n }\n else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) > 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else\n {\n if (ch2 < arr.Count)\n {\n if (arr[ch2].CompareTo(arr[ch1]) > 0)\n {\n if (arr[i].CompareTo(arr[ch1]) > 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else // arr[ch2] <= arr[ch1]\n {\n if (arr[i].CompareTo(arr[ch2]) > 0)\n {\n Swap(i, ch2);\n Heapify(ch2);\n }\n }\n }\n else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) < 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n }\n\n public T Pop()\n {\n if (arr.Count < 1)\n throw new Exception(\"Extracting min from empty heap\");\n var min = arr[0];\n arr[0] = arr[arr.Count - 1];\n arr.RemoveAt(arr.Count - 1);\n Heapify(0);\n return min;\n }\n\n public T Peek()\n {\n if (arr.Count < 1)\n throw new Exception(\"Extracting min from empty heap\");\n var min = arr[0];\n return min;\n }\n\n public int Count()\n {\n return arr.Count;\n }\n\n public void Add(T val)\n {\n if (val == null)\n throw new ArgumentNullException();\n arr.Add(val);\n Up(arr.Count - 1);\n }\n\n\n private void Up(int i)\n {\n while (i > 0)\n {\n var next = (i - 1) / 2;\n if (isMax)\n {\n if (arr[next].CompareTo(arr[i]) < 0)\n {\n Swap(i, next);\n i = next;\n }\n else\n {\n break;\n }\n }\n else\n {\n if (arr[next].CompareTo(arr[i]) > 0)\n {\n Swap(i, next);\n i = next;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n\n private void Swap(int i, int j)\n {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n }\n\n class Item : IComparable\n {\n public int Id;\n public int Value;\n public long Cnt;\n\n public int CompareTo(Item other)\n {\n return this.Value - other.Value;\n }\n\n public int CompareTo(object other)\n {\n return CompareTo((int)other);\n }\n\n }\n\n\n private static void Main(string[] args)\n {\n var n = readInt();\n var str = readString();\n\n\n int cnt = 0;\n var lst = str.Distinct().OrderByDescending(el => el).ToList();\n for (int i = 0; i < lst.Count; i++)\n {\n var el = lst[i];\n var dic = str.ToIndiciesDictionary();\n HashSet toDelete = new HashSet();\n foreach (var ind in dic[el])\n {\n if (ind > 0 && str[ind] - str[ind - 1] == 1)\n {\n toDelete.Add(ind);\n }\n else if (ind < str.Length - 1 && str[ind] - str[ind + 1] == 1)\n {\n toDelete.Add(ind);\n\n }\n\n }\n if (toDelete.Count > 0)\n {\n if (dic[el].Count > toDelete.Count)\n i --;\n cnt += toDelete.Count;\n str = string.Join(\"\", str.Where((el2, index) => !toDelete.Contains(index)));\n }\n }\n cnt.WriteLine();\n }\n\n}\n\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n string s = sc.Next();\n\n // n\u6587\u5b57 s\u304c\u3042\u308b\n\n // s_i\u306b\u96a3\u63a5\u3059\u308b\u6587\u5b57\u304cs_i\u3088\u308a1\u3064\u5c0f\u3055\u3044\u306a\u3089s_i\u3092\u6d88\u305b\u308b\n\n // \u6d88\u305b\u308b \u6700\u5927\n\n var ar = s.ToCharArray();\n\n for (char c = 'z'; c >= 'b'; c--)\n {\n var stack = new Stack();\n foreach (char ch in ar)\n {\n if (ch == c && stack.Count > 0 && stack.Peek() == c - 1)\n {\n continue;\n }\n else if (ch == c - 1)\n {\n while (stack.Count > 0 && stack.Peek() == c)\n {\n stack.Pop();\n }\n stack.Push(ch);\n }\n else\n {\n stack.Push(ch);\n }\n }\n\n ar = new char[stack.Count];\n for (int i = ar.Length - 1; i >= 0; i--)\n {\n ar[i] = stack.Pop();\n }\n }\n\n Console.WriteLine(n - ar.Length);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n while (_index >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n _line = Console.ReadLine().Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nclass Test\n{\n class a\n {\n public char key;\n public int value;\n }\n // Driver code \n public static void Main()\n {\n\n //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var t = input[0];\n //while (t > 0)\n {\n\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n\n var x = Console.ReadLine().ToCharArray();\n\t\t\tif (x.Length <= 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint s = 0;\n\t\t\tfor (int i = 25; i > 0; i--)\n\t\t\t{\n\t\t\t\tchar y = (char)(i + 'a'), z = (char)(i - 1 + 'a');\n\t\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tif (x[j] == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tint l = j - 1, r = j + 1;\n\t\t\t\t\t\twhile (l>=0&&(x[l] == '?' || x[l] == y))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (l >= 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (x[l] == z)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t\t\tx[j] = '?';\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile ((r list = new List(s.ToCharArray());\n\t\tint cnt = 0;\n\t\tconst int LetterLen = 26;\n\t\tfor (int i = LetterLen - 1; i >= 1; --i)\n\t\t{\n\t\t\tchar cur = (char)('a' + i);\n\t\t\tchar prev = (char)(cur - 1);\n\t\t\tfor (int j = 0; j < list.Count; ++j)\n\t\t\t{\n\t\t\t\tif (j >= 1)\n\t\t\t\t{\n\t\t\t\t\tif (list[j] == cur && list[j - 1] == prev)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist.RemoveAt(j);\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t++cnt;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (list[j] == prev && list[j - 1] == cur)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist.RemoveAt(j - 1);\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t++cnt;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(cnt);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nclass Program\n{\n static void test123()\n {\n\n string str = Console.ReadLine();\n var str1 = str.Split(' ');\n\n UInt64 n = Convert.ToUInt64(str1[0]);\n UInt64 m = Convert.ToUInt64(str1[1]);\n UInt64 a = Convert.ToUInt64(str1[2]);\n\n UInt64 a1 = n / a + (UInt64) (n % a > 0 ? 1 : 0);\n UInt64 a2 = m / a + (UInt64) (m % a > 0 ? 1 : 0);\n\n Console.WriteLine(a1 * a2);\n\n }\n\n\n static (char, List) MaxSymbolLowerThan(string str, int maxValue)\n {\n int maxFindedValue = 0;\n int indexOfMax = 0;\n List indexes = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] > maxFindedValue && (int) str[i] < maxValue) // \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u043d \u043a\u0430\u0441\u0442\u0443\u0435\u0442\u0441\u044f \u043a \u0438\u043d\u0442\u0443\n {\n indexes.Clear();\n indexes.Add(i);\n maxFindedValue = (int) (str[i]); //Char.GetNumericValue\n }\n else if (maxFindedValue == str[i])\n {\n indexes.Add(i);\n }\n }\n\n return ((char)maxFindedValue, indexes);\n }\n\n static void test3234234()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int steps = 0;\n\n string str = Console.ReadLine();\n\n //int count = 0;\n\n\n int indexOfMax = 0; // \u043d\u0443\u0436\u0435\u043d \u043b\u0438 ?\n\n List indexesOfMax;\n\n char maxSymbol = ' ';\n (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, 9999);\n\n //var indexesOfMaxBuffer = indexesOfMax.GetRange(0, n);\n //int[] indexEsOfMaxValue = str.Where(s=>s==maxSymbol).Select()\n\n int minValue = str.Min();\n\n bool ValueWasFinded = false;\n bool LastSymbol = false;\n int countOfIndexes = 123;\n //while (true)\n //{\n //if (n == 1) // \u043b\u0443\u0447\u0448\u0435 \u0447\u0435\u0440\u0435\u0437 n \n //{\n // Console.WriteLine(steps);\n // return;\n //}\n\n //if (LastSymbol && minValue == (int) maxSymbol) // \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0444\u043b\u0430\u0433 ? \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0435\u0434\u043e\u0434\u0435\u043b\u0430\u043d\u0430 !!!\n //{\n // Console.WriteLine(steps);\n // return;\n //}\n\n\n int j = 0; // \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 IndexesOfMax\n while (true)\n {\n if (countOfIndexes == 0)\n {\n Console.WriteLine(steps);\n return;\n }\n\n\n\n\n if (j < indexesOfMax.Count && indexesOfMax[j] != 0 && str[indexesOfMax[j] - 1] == (int) str[indexesOfMax[j]] - 1 )\n {\n ValueWasFinded = true;\n str = str.Remove(indexesOfMax[j], 1);\n steps++;\n n--;\n indexesOfMax.RemoveAt(j);\n for (var z = j ; z < indexesOfMax.Count; z++)\n indexesOfMax[z]--;\n \n }\n\n else if (j < indexesOfMax.Count && indexesOfMax[j] != n - 1 && str[indexesOfMax[j] + 1] == (int) (str[indexesOfMax[j]]) - 1)\n {\n ValueWasFinded = true;\n str = str.Remove(indexesOfMax[j], 1);\n \n steps++;\n n--;\n indexesOfMax.RemoveAt(j);\n for (var z = j ; z= indexesOfMax.Count - 1)\n {\n if (!ValueWasFinded)\n {\n (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, (int) maxSymbol);\n countOfIndexes = indexesOfMax.Count;\n }\n else\n ValueWasFinded = false;\n j = 0;\n }\n else\n j++;\n }\n }\n }\n\n\n static void Main(string[] args)\n {\n\n test3234234();\n }\n}\n\n\n \n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader sr = Console.In;\n //StreamReader sr = new StreamReader(\"3.txt\");\n int n = Convert.ToInt32(sr.ReadLine());\n string ss = sr.ReadLine();\n List str = new List();\n for (int ii = 0; ii < n; ii++)\n {\n str.Add(ss[ii]);\n }\n int i = 0;\n int res = 0;\n char b = 'z';\n while (true)\n {\n if (i == str.Count())\n {\n i = 0;\n b--;\n if (b < 'a') break;\n else continue;\n }\n if (str[i] == b)\n {\n if ((i > 0) && (str[i - 1] == (b - 1)))\n {\n str.RemoveAt(i);\n res++;\n }\n else if ((i < str.Count - 1) && (str[i + 1] == (b - 1)))\n {\n str.RemoveAt(i);\n res++;\n if (i > 0) i--;\n }\n else\n {\n i++;\n }\n }\n else\n {\n i++;\n }\n }\n Console.WriteLine(res.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void PrintAnswer(int s, List text)\n {\n bool Finished = false; bool errorFound = false;\n int c = 0;\n while (!Finished)\n {\n errorFound = false;\n int biggerIndex = 0;\n\n // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());\n\n for (int i = biggerIndex; i < text.Count; i++)\n {\n if (i == 0)\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n else if (i == text.Count - 1)\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1)\n if (((int)text[i]) - ((int)text[i - 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n else\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1 && i > 0)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n if (text.Count > 2 && i < text.Count-2)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n }\n if (!errorFound)\n Finished = true;\n }\n Console.WriteLine(c);\n }\n static void Main(string[] args)\n {\n int s = Int32.Parse(Console.ReadLine());\n List text = Console.ReadLine().Select(x => x).ToList();\n\n // PrintAnswer(s,text);\n FindMaxChars(s, text);\n }\n\n static void FindMaxChars(int s, List text)\n {\n if (s == 1) { Console.WriteLine(0); return; }\n int c = 0;\n\n bool Finished = false;\n\n\n while (!Finished)\n {\n ResetLoop:\n if (text.Count == 1) goto EndLoop;\n List bigChars = text.Distinct().OrderByDescending(x => (int)x).ToList();\n for (int j = 0; j < bigChars.Count; j++)\n {\n if (bigChars[j] == 'a') continue;\n for (int i = 0; i < text.Count; i++)\n {\n if (text[i] == bigChars[j])\n {\n // check for previous\n if (i > 0)\n {\n if ((int)text[i] - (int)text[i - 1] == 1)\n {\n text.RemoveAt(i); c++; goto ResetLoop; \n }\n }\n // check for next\n if (i < text.Count-1)\n {\n if ((int)text[i] - (int)text[i + 1] == 1)\n {\n text.RemoveAt(i); c++; goto ResetLoop; \n }\n }\n }\n }\n }\n \n EndLoop:\n Finished = true;\n }\n\n Console.WriteLine(c);\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void PrintAnswer(int s, List text)\n {\n bool Finished = false; bool errorFound = false;\n int c = 0;\n while (!Finished)\n {\n errorFound = false;\n int biggerIndex = 0;\n\n // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());\n\n for (int i = biggerIndex; i < text.Count; i++)\n {\n if (i == 0)\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n else if (i == text.Count - 1)\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1)\n if (((int)text[i]) - ((int)text[i - 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n else\n {\n if (text[i] == 'a')\n {\n continue;\n }\n else\n {\n if (text.Count > 1 && i > 0)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n if (text.Count > 2 && i < text.Count-2)\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n }\n if (!errorFound)\n Finished = true;\n }\n Console.WriteLine(c);\n }\n static void Main(string[] args)\n {\n int s = Int32.Parse(Console.ReadLine());\n List text = Console.ReadLine().Select(x => x).ToList();\n\n // PrintAnswer(s,text);\n FindMaxChars(s, text);\n }\n\n static void FindMaxChars(int s, List text)\n {\n if (s == 1) { Console.WriteLine(0); return; }\n bool Finished = false; bool errorFound = false;\n int c = 0;\n while (!Finished)\n {\n errorFound = false;\n List bigChars = text.OrderByDescending(x => (int)x).Distinct().Where(x => x != 'a').ToList();\n\n while (bigChars.Count > 0)\n {\n int bigCharIndex = text.IndexOf(bigChars.First());\n for (int i = 0; i < text.Count; i++)\n {\n if (text[i] == bigChars.First())\n {\n if (text.Count == 1) { Finished = true; bigChars = new List(); break; }\n if (i == 0)\n {\n if (((int)text[i]) - ((int)text[i + 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n else if (i == text.Count - 1)\n {\n if (((int)text[i]) - ((int)text[i - 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n else\n {\n if (((int)text[i]) - ((int)text[i + 1]) == 1 || ((int)text[i]) - ((int)text[i - 1]) == 1)\n {\n c++; text.RemoveAt(i); errorFound = true; break;\n }\n }\n }\n }\n if (bigChars.Count > 0)\n bigChars.RemoveAt(0);\n }\n\n if (!errorFound) Finished = true;\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nclass Test\n{\n class a\n {\n public char key;\n public int value;\n }\n // Driver code \n public static void Main()\n {\n\n //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var t = input[0];\n //while (t > 0)\n {\n\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n\n var x = Console.ReadLine().ToCharArray();\n\t\t\tif (x.Length <= 1)\n\t\t\t\treturn ;\n\t\t\tint s = 0;\n\t\t\tfor (int i = 25; i > 0; i--)\n\t\t\t{\n\t\t\t\tchar y = (char)(i + 'a'), z = (char)(i - 1 + 'a');\n\t\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tif (x[j] == y)\n\t\t\t\t\t{\n\t\t\t\t\t\tint l = j - 1, r = j + 1;\n\t\t\t\t\t\twhile (l>=0&&(x[l] == '?' || x[l] == y))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (l >= 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (x[l] == z)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t\t\tx[j] = '?';\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile (x[r] == '?' || x[r] == y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tr++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (r < n)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (x[r] == z)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t\t\tx[j] = '?';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(s);\n\n }\n\n }\n }\n\n\n\n"}, {"source_code": "using System.Collections.Generic;\nusing System;\n\nclass _1321C\n{\n\tstatic void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tstring s = Console.ReadLine();\n\t\tList list = new List(s.ToCharArray());\n\t\tint cnt = 0;\n\t\tconst int LetterLen = 26;\n\t\tfor (int i = LetterLen - 1; i >= 1; --i)\n\t\t{\n\t\t\tchar cur = (char)('a' + i);\n\t\t\tchar prev = (char)(cur - 1);\n\t\t\tfor (int j = 0; j < list.Count; ++j)\n\t\t\t{\n\t\t\t\tif (j >= 1)\n\t\t\t\t{\n\t\t\t\t\tif (list[j] == cur && list[j - 1] == prev)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist.RemoveAt(j);\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t++cnt;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (j <= list.Count - 2)\n\t\t\t\t{\n\t\t\t\t\tif (list[j] == cur && list[j + 1] == prev)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist.RemoveAt(j);\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\t++cnt;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(cnt);\n\t}\n}"}], "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool IT;\n int TUX = 0;\n int FOO = 0;\n int BAR = 0;\n int BAZ = 0;\n int QUZ = 1;\n\n try\n {\n TUX = int.Parse(Console.ReadLine());\n }\n catch (Exception)\n {\n TUX = 0;\n }\n\n for (; TUX != 0; TUX--)\n {\n try\n {\n int PUR = int.Parse(Console.ReadLine());\n FOO += PUR;\n BAR++;\n IT = Math.Max((FOO*QUZ), (BAR*BAZ)) == (FOO*QUZ);\n if (IT)\n {\n BAZ = FOO;//obshaya summa balov igroka\n QUZ = BAR;//popitka\n }\n }\n catch (Exception)\n {\n TUX = 0;\n }\n }\n \n Console.WriteLine((double)BAZ/(double)QUZ);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tSolve();\n\t\t}\n\n\t\tprivate static void Solve()\n\t\t{\n\t\t\tvar TUX = cin.NextInt();\n\t\t\tvar foo = 0;\n\t\t\tvar bar = 0;\n\t\t\tvar baz = 0;\n\t\t\tvar quz = 1;\n\t\t\twhile (TUX-- != 0)\n\t\t\t{\n\t\t\t\tvar PUR = cin.NextInt();\n\t\t\t\tfoo = foo + PUR;\n\t\t\t\tbar = bar + 1;\n\t\t\t\tif (foo * quz > bar * baz)\n\t\t\t\t{\n\t\t\t\t\tbaz = foo;\n\t\t\t\t\tquz = bar;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(1.0 * baz / quz);\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Csh\n{\n class Program\n {\n static void Main(string[] args)\n {\n int tux = int.Parse(Console.ReadLine());\n int foo = 0, bar = 0, baz = 0, quz = 1;\n while (tux != 0)\n {\n int pur = int.Parse(Console.ReadLine());\n foo += pur;\n bar++;\n if (Math.Max(foo * quz, bar * baz) == foo * quz)\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n {\n baz = foo;\n quz = bar;\n }\n tux--;\n }\n Console.WriteLine((double) baz / (double)quz);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool IT;\n int TUX = 0;\n int FOO = 0;\n int BAR = 0;\n int BAZ = 0;\n int QUZ = 1;\n\n try\n {\n TUX = int.Parse(Console.ReadLine());\n }\n catch (Exception)\n {\n TUX = 0;\n }\n\n for (; TUX != 0; TUX--)\n {\n try\n {\n int PUR = int.Parse(Console.ReadLine());\n FOO += PUR;\n BAR++;\n //IT = Math.Max((FOO*QUZ), (BAR*BAZ)) == (FOO*QUZ);\n if ((FOO * QUZ) > (BAR * BAZ))\n {\n BAZ = FOO;//obshaya summa balov igroka\n QUZ = BAR;//popitka\n }\n }\n catch (Exception)\n {\n TUX = 0;\n }\n }\n \n Console.WriteLine((double)BAZ/(double)QUZ);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AprilFools2013C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Tux;\n Tux = int.Parse(Console.ReadLine());\n\n var Foo = 0;\n var Bar = 0;\n var Baz = 0;\n var Quz = 1;\n\n for (; Tux > 0; Tux--)\n {\n int Pur;\n Pur = int.Parse(Console.ReadLine());\n\n Foo = Foo + Pur;\n Bar = Bar + 1;\n\n if (Math.Max(Foo * Quz, Bar * Baz) == Foo * Quz)\n {\n Baz = Foo;\n Quz = Bar;\n }\n }\n\n Console.WriteLine((double)Baz / (double)Quz);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R176_AprilFool_C\n {\n static void Main(string[] args)\n {\n int tux = int.Parse(Console.ReadLine());\n int foo = 0, bar = 0, baz = 0, quz = 1;\n while (tux != 0)\n {\n int pur = int.Parse(Console.ReadLine());\n foo += pur;\n bar++;\n if (foo * quz > bar * baz)\n {\n baz = foo;\n quz = bar;\n }\n tux--;\n }\n Console.WriteLine((double) baz / (double)quz);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace AprilFools\n{\n internal class Program\n {\n private const string TestIn = @\"..\\..\\In\\Text.in\";\n private const string TestOut = @\"..\\..\\In\\Text.out\";\n\n\n private static void Solve()\n {\n double res = 0;\n\n int tux;\n tux = ReadInt();\n int foo = 0;\n int bar = 0;\n int baz = 0;\n int quz = 1;\n\n for(;tux > 0;tux--)\n {\n int pur = ReadInt();\n foo = foo + pur;\n bar= bar + 1;\n if (Math.Max(foo * quz, bar * baz) == (foo * quz))\n {\n baz = foo;\n quz = bar;\n }\n\n }\n\n Console.WriteLine((double)baz/(double)quz);\n }\n\n \n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(TestIn));\n Console.SetOut(new StreamWriter(TestOut));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.Out.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n //Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static List ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\ndelegate double F(double x);\ndelegate decimal Fdec(decimal x);\n\nclass Program\n{//\n\n static void Main(string[] args)\n {\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if FileIO\n StreamReader sr = new StreamReader(\"forest.in\");\n StreamWriter sw = new StreamWriter(\"forest.out\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n int tux = ReadInt();\n int foo = 0;\n int bar = 0;\n int baz = 0;\n int quz = 0;\n\n for (; tux > 0; tux--)\n {\n int pur;\n pur = ReadInt();\n foo = foo + pur;\n bar = bar + 1;\n if (Math.Max(foo * quz, bar * baz) == (foo * quz))\n {\n baz = foo;\n quz = bar;\n }\n }\n double ans = (double)baz / (double)quz;\n Console.WriteLine(ans);\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n}\n\nstatic class ArrayUtils\n{\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(int[] A, int p, int q, int r, int[] L, int[] R)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i] <= R[j])\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(int[] A, int p, int r, int[] L, int[] R)\n {\n if (!(p < r)) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob290C\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n //TUX IS NOW A NUMBR\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n //FOO R SUM OF FOO AN PUR\n //BAR R SUM OF BAR AN 1\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n //O RLY?\n //YA RLY\n //BAZ R FOO\n //QUZ R BAR\n //OIC\n //IM OUTTA YR LOOP\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n\n int totalNums; //total number of input numbers\n int[] numbers; //an array of numbers of length totalNums\n\n public Prob290C(int tot, int[] nums)\n {\n totalNums = tot;\n numbers = new int[totalNums];\n Array.Copy(nums, 0, numbers, 0, totalNums);\n }\n\n public double solve()\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n long foo = 0, bar = 0, baz = 0, quz = 1;\n\n //TUX IS NOW A NUMBR\n\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (int i = 0; i < totalNums; ++i)\n {\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n\n //FOO R SUM OF FOO AN PUR\n foo += numbers[i];\n //BAR R SUM OF BAR AN 1\n ++bar;\n\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n if (Math.Max(foo * quz, bar * baz) == foo * quz)\n {\n //O RLY?\n //YA RLY\n\n //BAZ R FOO\n baz = foo;\n //QUZ R BAR\n quz = bar;\n }\n //OIC\n //IM OUTTA YR LOOP\n }\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n return (double)baz / quz;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int totalNums = Convert.ToInt32(Console.ReadLine());\n int[] numbers = new int[totalNums];\n for (int i = 0; i < totalNums; ++i)\n {\n numbers[i] = Convert.ToInt32(Console.ReadLine());\n }\n Prob290C prob = new Prob290C(totalNums, numbers);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\n\npublic class Class4\n{\n public static void Main()\n {\n Solve(new ConsoleInput());\n }\n\n private static void Solve(IInput input)\n {\n // HAI\n // I HAS A TUX\n // GIMMEH TUX\n // I HAS A FOO ITS 0\n // I HAS A BAR ITS 0\n // I HAS A BAZ ITS 0\n // I HAS A QUZ ITS 1\n // TUX IS NOW A NUMBR\n var tux = int.Parse(input.ReadLine());\n var foo = 0;\n var bar = 0;\n var baz = 0;\n var quz = 0;\n\n // IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (; tux > 0; tux--)\n {\n // I HAS A PUR\n // GIMMEH PUR\n // PUR IS NOW A NUMBR\n var pur = int.Parse(input.ReadLine());\n\n // FOO R SUM OF FOO AN PUR\n foo += pur;\n\n // BAR R SUM OF BAR AN 1\n bar += 1;\n\n // BOTH SAEM ( BIGGR OF ( (PRODUKT OF FOO AN QUZ) AN (PRODUKT OF BAR BAZ)) AN PRODUKT OF FOO AN QUZ) )\n // O RLY?\n if (Math.Max(foo * quz, bar * baz) == (foo * quz))\n {\n // YA RLY\n // BAZ R FOO\n // QUZ R BAR\n baz = foo;\n quz = bar;\n\n // OIC\n }\n\n // IM OUTTA YR LOOP\n }\n\n // BAZ IS NOW A NUMBAR\n // VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n Console.WriteLine(((float)baz / quz).ToString(\"F6\", CultureInfo.InvariantCulture));\n\n // KTHXBYE\n }\n}\n\n#region input\npublic interface IInput\n{\n string ReadLine();\n}\n\npublic class ConsoleInput : IInput\n{\n public string ReadLine()\n {\n return Console.ReadLine();\n }\n}\n\npublic abstract class AbstractMockInput : IInput\n{\n protected virtual string[] lines { get; }\n\n private int currentLine = 0;\n\n public string ReadLine()\n {\n if (this.currentLine >= this.lines.Length)\n {\n return string.Empty;\n }\n\n var res = this.lines[this.currentLine];\n this.currentLine++;\n return res;\n }\n}\n\npublic class MockInput1 : AbstractMockInput\n{\n protected override string[] lines => new[] { \"3\", \"0\", \"1\", \"1\" };\n}\n\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int TUX = ReadInt();\n int FOO=0;\n int BAR=0;\n int BAZ=0;\n int QUZ=1;\n for (int i = 0; i < TUX; i++)\n {\n int PUR = ReadInt();\n FOO = (FOO + PUR);\n BAR = (BAR + 1);\n if (FOO * QUZ >= BAR * BAZ)\n {\n BAZ = FOO;\n QUZ = BAR;\n }\n }\n return (1.0 * BAZ / QUZ).ToString(CultureInfo.InvariantCulture);\n\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tSolve();\n\t\t}\n\n\t\tprivate static void Solve()\n\t\t{\n\t\t\tvar TUX = cin.NextInt();\n\t\t\tvar foo = 0;\n\t\t\tvar bar = 0;\n\t\t\tvar baz = 0;\n\t\t\tvar quz = 1;\n\t\t\twhile (TUX-- != 0)\n\t\t\t{\n\t\t\t\tvar PUR = cin.NextInt();\n\t\t\t\tfoo = foo + PUR;\n\t\t\t\tbar = bar + 1;\n\t\t\t\tvar prod1 = foo*quz;\n\t\t\t\tvar prod2 = bar*baz;\n\t\t\t\tvar prod3 = foo*quz;\n\t\t\t\t//if (foo > prod1 && foo > prod2 && bar > prod1 && bar > prod2)\n\t\t\t\t{\n\t\t\t\t\tbaz = foo;\n\t\t\t\t\tquz = bar;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(1.0 * baz / quz);\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AprilFools2013C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Tux;\n Tux = int.Parse(Console.ReadLine());\n\n var Foo = 0;\n var Bar = 0;\n var Baz = 0;\n var Quz = 1;\n\n for(;Tux > 0; Tux--)\n {\n int Pur;\n Pur = int.Parse(Console.ReadLine());\n\n Foo = Foo + Pur;\n Bar = Bar + 1;\n\n if (Math.Max(Foo * Quz, Bar) >= Math.Max(Baz, Foo * Quz))\n {\n Baz = Foo;\n Quz = Bar;\n }\n }\n\n Console.WriteLine((double)Baz / (double)Quz);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob290C\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n //TUX IS NOW A NUMBR\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n //FOO R SUM OF FOO AN PUR\n //BAR R SUM OF BAR AN 1\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n //O RLY?\n //YA RLY\n //BAZ R FOO\n //QUZ R BAR\n //OIC\n //IM OUTTA YR LOOP\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n\n int totalNums; //total number of input numbers\n int[] numbers; //an array of numbers of length totalNums\n\n public Prob290C(int tot, int[] nums)\n {\n totalNums = tot;\n numbers = new int[totalNums];\n Array.Copy(nums, 0, numbers, 0, totalNums);\n }\n\n public double solve()\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n int foo = 0, bar = 0, baz = 0, quz = 1;\n\n //TUX IS NOW A NUMBR\n\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (int i = 0; i < totalNums; ++i)\n {\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n\n //FOO R SUM OF FOO AN PUR\n foo += numbers[i];\n //BAR R SUM OF BAR AN 1\n ++bar;\n\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n if (foo * quz * bar > baz * foo * quz)\n {\n //O RLY?\n //YA RLY\n\n //BAZ R FOO\n baz = foo;\n //QUZ R BAR\n quz = bar;\n }\n //OIC\n //IM OUTTA YR LOOP\n }\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n return (double)baz / quz;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int totalNums = Convert.ToInt32(Console.ReadLine());\n int[] numbers = new int[totalNums];\n for (int i = 0; i < totalNums; ++i)\n {\n numbers[i] = Convert.ToInt32(Console.ReadLine());\n }\n Prob290C prob = new Prob290C(totalNums, numbers);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob290C\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n //TUX IS NOW A NUMBR\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n //FOO R SUM OF FOO AN PUR\n //BAR R SUM OF BAR AN 1\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n //O RLY?\n //YA RLY\n //BAZ R FOO\n //QUZ R BAR\n //OIC\n //IM OUTTA YR LOOP\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n\n int totalNums; //total number of input numbers\n int[] numbers; //an array of numbers of length totalNums\n\n public Prob290C(int tot, int[] nums)\n {\n totalNums = tot;\n numbers = new int[totalNums];\n Array.Copy(nums, 0, numbers, 0, totalNums);\n }\n\n public double solve()\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n long foo = 0, bar = 0, baz = 0, quz = 1;\n\n //TUX IS NOW A NUMBR\n\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (int i = 0; i < totalNums; ++i)\n {\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n\n //FOO R SUM OF FOO AN PUR\n foo += numbers[i];\n //BAR R SUM OF BAR AN 1\n ++bar;\n\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n if (foo * quz * bar >= baz * foo * quz)\n {\n //O RLY?\n //YA RLY\n\n //BAZ R FOO\n baz = foo;\n //QUZ R BAR\n quz = bar;\n }\n //OIC\n //IM OUTTA YR LOOP\n }\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n return (double)baz / quz;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int totalNums = Convert.ToInt32(Console.ReadLine());\n int[] numbers = new int[totalNums];\n for (int i = 0; i < totalNums; ++i)\n {\n numbers[i] = Convert.ToInt32(Console.ReadLine());\n }\n Prob290C prob = new Prob290C(totalNums, numbers);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob290C\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n //TUX IS NOW A NUMBR\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n //FOO R SUM OF FOO AN PUR\n //BAR R SUM OF BAR AN 1\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n //O RLY?\n //YA RLY\n //BAZ R FOO\n //QUZ R BAR\n //OIC\n //IM OUTTA YR LOOP\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n\n int totalNums; //total number of input numbers\n int[] numbers; //an array of numbers of length totalNums\n\n public Prob290C(int tot, int[] nums)\n {\n totalNums = tot;\n numbers = new int[totalNums];\n Array.Copy(nums, 0, numbers, 0, totalNums);\n }\n\n public double solve()\n {\n //HAI\n //I HAS A TUX\n //GIMMEH TUX\n\n //I HAS A FOO ITS 0\n //I HAS A BAR ITS 0\n //I HAS A BAZ ITS 0\n //I HAS A QUZ ITS 1\n long foo = 0, bar = 0, baz = 0, quz = 1;\n\n //TUX IS NOW A NUMBR\n\n //IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (int i = 0; i < totalNums; ++i)\n {\n //I HAS A PUR\n //GIMMEH PUR\n //PUR IS NOW A NUMBR\n\n //FOO R SUM OF FOO AN PUR\n foo += numbers[i];\n //BAR R SUM OF BAR AN 1\n ++bar;\n\n //BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ\n if (foo * quz * bar > baz * foo * quz)\n {\n //O RLY?\n //YA RLY\n\n //BAZ R FOO\n baz = foo;\n //QUZ R BAR\n quz = bar;\n }\n //OIC\n //IM OUTTA YR LOOP\n }\n //BAZ IS NOW A NUMBAR\n //VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n //KTHXBYE\n return (double)baz / quz;\n }\n\n public override String ToString()\n {\n return \"\";\n }\n\n static void Main(string[] args)\n {\n int totalNums = Convert.ToInt32(Console.ReadLine());\n int[] numbers = new int[totalNums];\n for (int i = 0; i < totalNums; ++i)\n {\n numbers[i] = Convert.ToInt32(Console.ReadLine());\n }\n Prob290C prob = new Prob290C(totalNums, numbers);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Class4\n{\n public static void Main()\n {\n Solve(new ConsoleInput());\n }\n\n private static void Solve(IInput input)\n {\n // HAI\n // I HAS A TUX\n // GIMMEH TUX\n // I HAS A FOO ITS 0\n // I HAS A BAR ITS 0\n // I HAS A BAZ ITS 0\n // I HAS A QUZ ITS 1\n // TUX IS NOW A NUMBR\n var tux = int.Parse(input.ReadLine());\n var foo = 0;\n var bar = 0;\n var baz = 0;\n var quz = 0;\n\n // IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (; tux > 0; tux--)\n {\n // I HAS A PUR\n // GIMMEH PUR\n // PUR IS NOW A NUMBR\n var pur = int.Parse(input.ReadLine());\n\n // FOO R SUM OF FOO AN PUR\n foo += pur;\n\n // BAR R SUM OF BAR AN 1\n bar += 1;\n\n // BOTH SAEM ( BIGGR OF ( (PRODUKT OF FOO AN QUZ) AN (PRODUKT OF BAR BAZ)) AN PRODUKT OF FOO AN QUZ) )\n // O RLY?\n if (Math.Max(foo * quz, bar * baz) == (foo * quz))\n {\n // YA RLY\n // BAZ R FOO\n // QUZ R BAR\n baz = foo;\n quz = bar;\n\n // OIC\n }\n\n // IM OUTTA YR LOOP\n }\n\n // BAZ IS NOW A NUMBAR\n // VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n Console.WriteLine((float)baz / quz);\n\n // KTHXBYE\n }\n}\n\n#region input\npublic interface IInput\n{\n string ReadLine();\n}\n\npublic class ConsoleInput : IInput\n{\n public string ReadLine()\n {\n return Console.ReadLine();\n }\n}\n\npublic abstract class AbstractMockInput : IInput\n{\n protected virtual string[] lines { get; }\n\n private int currentLine = 0;\n\n public string ReadLine()\n {\n if (this.currentLine >= this.lines.Length)\n {\n return string.Empty;\n }\n\n var res = this.lines[this.currentLine];\n this.currentLine++;\n return res;\n }\n}\n\npublic class MockInput1 : AbstractMockInput\n{\n protected override string[] lines => new[] { \"3\", \"0\", \"1\", \"1\" };\n}\n\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\n\npublic class Class4\n{\n public static void Main()\n {\n Solve(new MockInput1());\n }\n\n private static void Solve(IInput input)\n {\n // HAI\n // I HAS A TUX\n // GIMMEH TUX\n // I HAS A FOO ITS 0\n // I HAS A BAR ITS 0\n // I HAS A BAZ ITS 0\n // I HAS A QUZ ITS 1\n // TUX IS NOW A NUMBR\n var tux = int.Parse(input.ReadLine());\n var foo = 0;\n var bar = 0;\n var baz = 0;\n var quz = 0;\n\n // IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n for (; tux > 0; tux--)\n {\n // I HAS A PUR\n // GIMMEH PUR\n // PUR IS NOW A NUMBR\n var pur = int.Parse(input.ReadLine());\n\n // FOO R SUM OF FOO AN PUR\n foo += pur;\n\n // BAR R SUM OF BAR AN 1\n bar += 1;\n\n // BOTH SAEM ( BIGGR OF ( (PRODUKT OF FOO AN QUZ) AN (PRODUKT OF BAR BAZ)) AN PRODUKT OF FOO AN QUZ) )\n // O RLY?\n if (Math.Max(foo * quz, bar * baz) == (foo * quz))\n {\n // YA RLY\n // BAZ R FOO\n // QUZ R BAR\n baz = foo;\n quz = bar;\n\n // OIC\n }\n\n // IM OUTTA YR LOOP\n }\n\n // BAZ IS NOW A NUMBAR\n // VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ\n Console.WriteLine(((float)baz / quz).ToString(\"F6\", CultureInfo.InvariantCulture));\n\n // KTHXBYE\n }\n}\n\n#region input\npublic interface IInput\n{\n string ReadLine();\n}\n\npublic class ConsoleInput : IInput\n{\n public string ReadLine()\n {\n return Console.ReadLine();\n }\n}\n\npublic abstract class AbstractMockInput : IInput\n{\n protected virtual string[] lines { get; }\n\n private int currentLine = 0;\n\n public string ReadLine()\n {\n if (this.currentLine >= this.lines.Length)\n {\n return string.Empty;\n }\n\n var res = this.lines[this.currentLine];\n this.currentLine++;\n return res;\n }\n}\n\npublic class MockInput1 : AbstractMockInput\n{\n protected override string[] lines => new[] { \"3\", \"0\", \"1\", \"1\" };\n}\n\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n int TUX = ReadInt();\n int FOO=0;\n int BAR=0;\n int BAZ=0;\n int QUZ=1;\n for (int i = 0; i < TUX; i++)\n {\n int PUR = ReadInt();\n FOO = (FOO + PUR);\n BAR = (BAR + 1);\n if (FOO * QUZ >= BAR * BAZ)\n {\n BAZ = FOO;\n QUZ = BAR;\n }\n }\n return 1.0 * BAZ / QUZ;\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n #if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n #else\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n #endif\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n\n public object Solve()\n {\n bool IT;\n int TUX = ReadInt();\n int FOO=0;\n int BAR=0;\n int BAZ=0;\n int QUZ=1;\n for (; TUX != 0; TUX--)\n {\n int PUR = ReadInt();\n FOO = (FOO + PUR);\n BAR = (BAR + 1);\n IT = (Math.Max(FOO * QUZ, BAR * BAZ)) == (FOO * QUZ);\n if(IT)\n {\n BAZ=FOO;\n QUZ=BAR;\n }\n }\n return 1.0 * BAZ / QUZ;\n\n }\n}"}], "src_uid": "32fc378a310ca15598377f7b638eaf26"} {"source_code": "\ufeffusing System;\n\nnamespace JustForFun\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n int digit = 0;\n int[] resultSet = new int[1000];\n int min;\n string line = Console.ReadLine();\n n = Convert.ToInt32(line);\n int tmp = n;\n while (tmp > 9)\n {\n tmp /= 10;\n digit++;\n }\n // Console.WriteLine(digit);\n min = Math.Max(n - 9 * digit - 9, 1);\n int itr = 0;\n for(int i = 0; i <= n; i++)\n {\n int result = n -i;\n if (result < min)\n break;\n int tmpt = n - i;\n while(tmpt > 0)\n {\n result += tmpt % 10;\n tmpt /= 10;\n }\n //Console.WriteLine(result);\n if(result == n)\n {\n resultSet[itr++] = n - i;\n }\n }\n Console.WriteLine(itr);\n while (itr > 0)\n {\n Console.WriteLine(resultSet[--itr]);\n }\n // Console.ReadKey();\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0414\u0435\u0436\u0443\u0440\u0441\u0442\u0432\u043e\n{\n class Program\n {\n static int SumOfNums(int x)\n {\n int sum = 0;\n string s = Convert.ToString(x);\n for (int i = 0; i < s.Length; i++)\n {\n sum += Convert.ToInt32(Convert.ToString(s[i]));\n }\n\n return sum;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int x = 0;\n\n if (n > 100) x = n - 100;\n else x = 0;\n List nums = new List();\n while (x < n)\n {\n if (x + SumOfNums(x) == n) nums.Add(x);\n x++;\n }\n\n Console.WriteLine(nums.Count);\n for (int i = 0; i < nums.Count; i++) Console.WriteLine(nums[i]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class A\n {\n static void Main(string[] args)\n {\n List L = new List();\n int n = int.Parse(Console.ReadLine());\n int to = (n>100)?n-100:0;\n for(int i=n-1;i>=to;i--){\n if(i + GetSum(i)==n){\n L.Add(i);\n }\n }\n L.Sort();\n Console.WriteLine(L.Count);\n for(int i=0;i nums = new List();\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i <= 9 * a.ToString().Length; i++)\n {\n\n int b = a - i;\n if (b >= 0)\n {\n string c = b.ToString();\n for (int j = 0; j < c.Length; j++)\n {\n b += Convert.ToInt32(c[j].ToString());\n\n }\n\n if (b == a)\n {\n nums.Add(Convert.ToInt32(c));\n }\n }\n }\n Console.WriteLine(nums.Count);\n nums.Sort();\n foreach (int w in nums)\n {\n Console.WriteLine(w);\n }\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Classroom_Watch\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int n = Next();\n\n var nn = new List();\n for (int i = n - 1; i >= 1; i--)\n {\n int sum = 0;\n int t = i;\n int count = 0;\n while (t > 0)\n {\n sum += t%10;\n t /= 10;\n count++;\n }\n if (i + sum == n)\n nn.Add(i);\n\n if (i + 9*count < n)\n break;\n }\n\n nn.Sort();\n writer.WriteLine(nn.Count);\n foreach (int i in nn)\n {\n writer.WriteLine(i);\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Testing\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n List values = new List();\n int quantity = 0;\n for(int currentValue = n; currentValue > n - 100 && currentValue > 0; currentValue--)\n {\n int temporaryValue = currentValue;\n int sum = currentValue;\n while(temporaryValue > 0)\n {\n sum += temporaryValue % 10;\n temporaryValue /= 10;\n }\n if(sum == n)\n {\n quantity++;\n values.Add(currentValue);\n }\n }\n Console.WriteLine(quantity);\n values.Sort();\n foreach(int value in values)\n {\n Console.WriteLine(\"{0}\", value);\n }\n }\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var max = (long) 1e3;\n var count = 0;\n var answer = new StringBuilder();\n for (var i = n; i <= n + max; i++) {\n var str = i.ToString();\n var sum = i;\n for (var j = 0; j < str.Length; j++) {\n sum += str[j] - '0';\n }\n if (sum == n) {\n answer.Append(str + \" \");\n count++;\n }\n }\n for (var i = n - max; i < n; i++) {\n var str = i.ToString();\n var sum = i;\n for (var j = 0; j < str.Length; j++) {\n sum += str[j] - '0';\n }\n if (sum == n) {\n answer.Append(str + \" \");\n count++;\n }\n }\n\n sw.WriteLine(count);\n sw.Write(answer);\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n public class RandomMath\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\t\t\tList Solutions = new List();\n\t\t\tint HowMuch = 0;\n\t\t\tint CheckThis;\n\t\t\tint[] Digits;\n\t\t\tCheckThis = n <= 81 ? 0 : n - 81;\n\t\t\tfor (int x = CheckThis; x < n; x++)\n\t\t\t{\n\t\t\t\tDigits = x.ToString().Select(t => int.Parse(t.ToString())).ToArray();\n\t\t\t\tint DigitsValue = 0;\n\t\t\t\tforeach (int dig in Digits)\n\t\t\t\t{\n\t\t\t\t\tDigitsValue += dig;\n\t\t\t\t}\n\t\t\t\tif (x + DigitsValue == n)\n\t\t\t\t{\n\t\t\t\t\tHowMuch += 1;\n\t\t\t\t\tSolutions.Add(x);\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(HowMuch);\n\t\t\tforeach(int Solution in Solutions)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Solution);\n\t\t\t}\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prog1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string a = Console.ReadLine();\n int n = int.Parse(Console.ReadLine());\n string m = n.ToString();\n int current = 0;\n int ans = 0;\n string an = \"\";\n current = n - (9*m.Length);\n if(current<0)\n {\n current = 0;\n }\n int s = 0;\n int summ = 0;\n int g = 0;\n /*string v = current.ToString();\n for(int i = 0; i9)\n {\n g=0;\n summ-=8;\n Console.WriteLine(summ);\n }\n else\n {\n summ++;\n }*/\n summ = 0;\n string v = current.ToString();\n for(int i = 0; i Read(TextReader rdr)\n {\n int ch;\n bool neg = false;\n int value = 0;\n int count = 0;\n\n while (-1 != (ch = rdr.Read()))\n {\n if (ch == 9 || ch == 10 || ch == 13 || ch == 32)\n {\n if (count > 0)\n yield return neg ? -value : value;\n count = 0;\n value = 0;\n neg = false;\n }\n else if (count == 0 && ch == '-')\n {\n neg = true;\n }\n else if (ch >= '0' && ch <= '9')\n {\n count++;\n value = value * 10 + (ch - '0');\n }\n else\n throw new InvalidDataException();\n }\n\n if (count > 0)\n yield return neg ? -value : value;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace LovNaSataniste\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int i, sum, current;\n List xes = new List();\n for (i = n < 81 ? 0 : n - 81; i < n; i++)\n {\n for (current = sum = i; current != 0; current /= 10) sum += current % 10;\n if (n == sum) xes.Add(i);\n }\n Console.WriteLine(xes.Count);\n foreach (int x in xes) Console.WriteLine(x);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var s = new List();\n\n int maxAdd = 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9;\n for (var add = maxAdd; add > 0; --add)\n {\n int cand = n - add;\n if (cand <= 0)\n continue;\n if (DigitsSum(cand) != add)\n continue;\n s.Add(cand);\n }\n Console.WriteLine(s.Count);\n if (s.Count > 0)\n Console.WriteLine(string.Join(Environment.NewLine, s));\n }\n\n static int DigitsSum(int n)\n {\n int sum = 0;\n do\n {\n sum += n % 10;\n n /= 10;\n }\n while (n > 0);\n return sum;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Z3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n List output = new List();\n int sum, current, i;\n\n for (i = num < 81 ? 0 : num - 81; i < num; i++)\n {\n for (current = sum = i; current != 0; current /= 10)\n sum += current % 10;\n\n if (num == sum)\n output.Add(i);\n }\n\n Console.WriteLine(output.Count);\n\n for (i = 0; i < output.Count; i++)\n Console.WriteLine(output[i]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int inputNumber = Int32.Parse(Console.ReadLine());\n List findedNumbers = new List();\n\n int startPosition = inputNumber < 1000000 ? inputNumber / 10 : inputNumber - 100;\n\n for (int i = startPosition; i < inputNumber; i++)\n {\n char[] parsedInputNumber = i.ToString().ToCharArray();\n int digitSum = 0;\n\n for (int j = 0; j < parsedInputNumber.Length; j++)\n {\n digitSum += Int32.Parse(parsedInputNumber[j].ToString());\n }\n \n int currentVariant = i + digitSum;\n\n if (currentVariant == inputNumber)\n {\n findedNumbers.Add(i);\n }\n }\n\n Console.WriteLine(findedNumbers.Count);\n\n if (findedNumbers.Count > 0)\n {\n foreach (var findedNumber in findedNumbers)\n {\n Console.WriteLine(findedNumber);\n }\n }\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Text;\nusing System.Diagnostics;\nnamespace contest1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_442C();\n }\n\n public static void solve_442C()\n {\n List results = new List();\n int n = Convert.ToInt32(Console.ReadLine());\n int sub = n >= 100 ? 100 : n;\n \n int start = n - sub;\n int sum = 0;\n while (start <= n)\n {\n int x = start;\n sum = 0;\n while (x > 0)\n {\n sum += x % 10;\n x /= 10;\n }\n if (n == start + sum)\n {\n results.Add(start);\n }\n start++;\n }\n\n Console.WriteLine(results.Count);\n if (results.Count > 0)\n {\n for (int k = 0; k < results.Count; k++)\n {\n Console.WriteLine(results[k]);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\nusing System.Diagnostics;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n private long NextLong()\n {\n return long.Parse(Next());\n }\n}\n\nclass Magatro\n{\n private int N;\n private void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n }\n\n private int Sum(int n)\n {\n if (n <= 9)\n {\n return n;\n }\n else\n {\n return n % 10 + Sum(n / 10);\n }\n }\n\n public void Solve()\n {\n Scan();\n var sb = new StringBuilder();\n int cnt = 0;\n for (int i = 100; i >= 0; i--)\n {\n int a = N - i;\n if(Sum(a)==i)\n {\n cnt++;\n sb.AppendLine(a.ToString());\n }\n }\n Console.WriteLine(cnt);\n if(cnt!=0)\n {\n Console.Write(sb.ToString());\n }\n }\n\n static public void Main()\n {\n new Magatro().Solve();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n,q=0;\n List l = new List();\n n=Int32.Parse(Console.ReadLine());\n string s=\"\";\n for(int i=n-100;i<=n;i++)\n {\n s = i+\"\";\n int x = 0;\n for(int j=0;j();\n\n for (int i = Math.Max(1, n - 81); i <= n; i++)\n {\n if (i + i.ToString().Sum(d => d - '0') == n)\n {\n result.Add(i);\n }\n }\n\n Console.WriteLine(result.Count);\n\n foreach (int i in result)\n {\n Console.WriteLine(i);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace nolifer\n{\n class Program\n {\n static void Main(string[] args)\n {\n List nums = new List();\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i <= 9 * a.ToString().Length; i++)\n {\n\n int b = a - i;\n if (b >= 0)\n {\n string c = b.ToString();\n for (int j = 0; j < c.Length; j++)\n {\n b += Convert.ToInt32(c[j].ToString());\n\n }\n\n if (b == a)\n {\n nums.Add(c);\n }\n }\n }\n Console.WriteLine(nums.Count);\n foreach (string w in nums)\n {\n Console.WriteLine(w);\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0414\u0435\u0436\u0443\u0440\u0441\u0442\u0432\u043e\n{\n class Program\n {\n static int SumOfNums(int x)\n {\n int sum = 0;\n string s = Convert.ToString(x);\n for (int i = 0; i < s.Length; i++)\n {\n sum += Convert.ToInt32(Convert.ToString(s[i]));\n }\n\n return sum;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int x = 0;\n\n if (n > 72) x = n - 72;\n else x = 0;\n List nums = new List();\n while (x < n)\n {\n if (x + SumOfNums(x) == n) nums.Add(x);\n x++;\n }\n\n Console.WriteLine(nums.Count);\n for (int i = 0; i < nums.Count; i++) Console.WriteLine(nums[i]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0414\u0435\u0436\u0443\u0440\u0441\u0442\u0432\u043e\n{\n class Program\n {\n static int SumOfNums(int x)\n {\n int sum = 0;\n string s = Convert.ToString(x);\n for (int i = 0; i < s.Length; i++)\n {\n sum += Convert.ToInt32(Convert.ToString(s[i]));\n }\n\n return sum;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int x = 0;\n\n if (n > 72) x = n - 72;\n else x = 0;\n while (x < n && x + SumOfNums(x) != n)\n {\n x++;\n }\n\n if (x + SumOfNums(x) == n)\n {\n Console.WriteLine(1);\n Console.WriteLine(x);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\n\nnamespace Z3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n if (num < 2)\n {\n Console.WriteLine(\"0\");\n return;\n }\n //else if (num < 10)\n //{\n // Console.WriteLine(\"1\\n\" + (num - 1));\n // return;\n //}\n\n List output = new List();\n int res = 1;\n\n for (int sum = 1, start = 0; res <= num; res++, sum++)\n {\n if (res % 10 == 0)\n {\n start++;\n sum = start;\n }\n\n if (num - res == sum)\n output.Add(res);\n }\n\n Console.WriteLine(output.Count);\n\n for (int i = 0; i < output.Count; i++)\n Console.WriteLine(output[i]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\n\nnamespace Z3\n{\n class Program\n {\n static bool Match(int n1, int n2)\n {\n if (n1 < 10)\n {\n if (n1 == n2)\n return true;\n else\n return false;\n }\n\n int res = n1;\n int i = 0;\n int k = n1 % 10;\n\n while (i <= 9)\n {\n res += k;\n i++;\n k = (int)(n1 / Math.Pow(10, i) % 10);\n }\n\n if (res == n2)\n return true;\n else\n return false;\n }\n\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n //for (num = 1; num <= 1000000000; num++)\n //{\n // Console.WriteLine(num);\n\n if (num < 2)\n {\n Console.WriteLine(\"0\");\n return;\n // Console.WriteLine(\"#########\");\n // Thread.Sleep(800);\n // continue;\n }\n\n List output = new List();\n int res = 1;\n\n while (res <= num)\n {\n if (Match(res, num))\n output.Add(res);\n\n res++;\n }\n\n Console.WriteLine(output.Count);\n\n for (int i = 0; i < output.Count; i++)\n Console.WriteLine(output[i]);\n\n // Thread.Sleep(800);\n // Console.WriteLine(\"##########\");\n //}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Z3\n{\n class Program\n {\n static bool Match(int n1, int n2)\n {\n if (n1 < 10)\n {\n if (n1 == n2)\n return true;\n else\n return false;\n }\n\n int res = n1;\n int i = 0;\n int k = n1 % 10;\n\n while (i <= 9)\n {\n res += k;\n i++;\n k = (int)(n1 / Math.Pow(10, i) % 10);\n }\n\n if (res == n2)\n return true;\n else\n return false;\n }\n\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n if (num < 10)\n {\n Console.WriteLine(\"1\\n\" + num);\n return;\n }\n\n List output = new List();\n int res = 1;\n\n while (res <= num)\n {\n if (Match(res, num))\n output.Add(res);\n\n res++; \n }\n\n Console.WriteLine(output.Count);\n\n for (int i = 0; i < output.Count; i++)\n Console.WriteLine(output[i]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\n\nnamespace Z3\n{\n class Program\n {\n static bool Match(int n1, int n2)\n {\n if (n1 < 10)\n {\n if (n1 == n2)\n return true;\n else\n return false;\n }\n\n int res = n1;\n int i = 0;\n int k = n1 % 10;\n\n while (i <= 9)\n {\n res += k;\n i++;\n k = (int)(n1 / Math.Pow(10, i) % 10);\n }\n\n if (res == n2)\n return true;\n else\n return false;\n }\n\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n //for (num = 1; num <= 1000000000; num++)\n //{\n // Console.WriteLine(num);\n\n if (num < 10)\n {\n Console.WriteLine(\"0\");\n return;\n // Console.WriteLine(\"#########\");\n // Thread.Sleep(800);\n // continue;\n }\n\n List output = new List();\n int res = 1;\n\n while (res <= num)\n {\n if (Match(res, num))\n output.Add(res);\n\n res++;\n }\n\n Console.WriteLine(output.Count);\n\n for (int i = 0; i < output.Count; i++)\n Console.WriteLine(output[i]);\n\n // Thread.Sleep(800);\n // Console.WriteLine(\"##########\");\n //}\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int inputNumber = Int32.Parse(Console.ReadLine());\n List findedNumbers = new List();\n\n for (int i = 10; i < inputNumber; i++)\n {\n char[] parsedInputNumber = i.ToString().ToCharArray();\n\n int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());\n int secondDigit = Int32.Parse(parsedInputNumber[1].ToString());\n int thirdDigit = 0;\n\n if (i > 99)\n {\n thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());\n }\n\n int currentVariant = i + firstDigit + secondDigit + thirdDigit;\n\n if (currentVariant == inputNumber)\n {\n findedNumbers.Add(i);\n }\n }\n\n Console.WriteLine(findedNumbers.Count);\n\n if (findedNumbers.Count > 0)\n {\n foreach (int findedNumber in findedNumbers)\n {\n Console.WriteLine(findedNumber);\n }\n }\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n string inputData = Console.ReadLine();\n int inputNumber = inputData.Length < 4 ? Int32.Parse(inputData) : 0;\n \n if (inputNumber > 0 && inputNumber < 110)\n {\n FindNumbers(inputNumber);\n }\n else\n {\n Console.WriteLine(0); \n }\n \n Console.ReadLine();\n }\n \n private static void FindNumbers(int inputNumber)\n {\n List findedNumbers = new List();\n\n for (int i = 1; i < inputNumber; i++)\n {\n char[] parsedInputNumber = i.ToString().ToCharArray();\n\n int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());\n int secondDigit = 0;\n int thirdDigit = 0;\n\n if (i > 9)\n {\n secondDigit = Int32.Parse(parsedInputNumber[1].ToString());\n }\n\n if (i > 99)\n {\n thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());\n }\n\n int currentVariant = i + firstDigit + secondDigit + thirdDigit;\n\n if (currentVariant == inputNumber)\n {\n findedNumbers.Add(i);\n }\n }\n\n Console.WriteLine(findedNumbers.Count);\n\n if (findedNumbers.Count > 0)\n {\n foreach (var findedNumber in findedNumbers)\n {\n Console.WriteLine(findedNumber);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n{ \n private static void Main(string[] args)\n {\n int inputNumber = Int32.Parse(Console.ReadLine());\n List findedNumbers = new List();\n\n for (int i = 10; i < inputNumber; i++)\n {\n char[] parsedInputNumber = i.ToString().ToCharArray();\n int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());\n int secondDigit = 0;\n int thirdDigit = 0;\n\n if (i > 9)\n {\n secondDigit = Int32.Parse(parsedInputNumber[1].ToString());\n }\n\n if (i > 99)\n {\n thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());\n }\n\n int currentVariant = i + firstDigit + secondDigit + thirdDigit;\n\n if (currentVariant == inputNumber)\n {\n findedNumbers.Add(i);\n }\n }\n\n Console.WriteLine(findedNumbers.Count);\n\n if (findedNumbers.Count > 0)\n {\n foreach (int findedNumber in findedNumbers)\n {\n Console.WriteLine(findedNumber);\n }\n }\n \n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Testing\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n List values = new List();\n int quantity = 0;\n for(int currentValue = n; currentValue > n - 100 && currentValue > 0; currentValue--)\n {\n int temporaryValue = currentValue;\n int sum = currentValue;\n while(temporaryValue > 0)\n {\n sum += temporaryValue % 10;\n temporaryValue /= 10;\n }\n if(sum == n)\n {\n quantity++;\n values.Add(currentValue);\n }\n }\n Console.WriteLine(quantity);\n foreach(int value in values)\n {\n Console.WriteLine(\"{0}\", value);\n }\n }\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var max = (long) 1e3;\n var count = 0;\n for (var i = n; i <= n + max; i++) {\n var str = i.ToString();\n var sum = i;\n for (var j = 0; j < str.Length; j++) {\n sum += str[j] - '0';\n }\n if (sum == n) {\n count++;\n }\n }\n for (var i = n - max; i < n; i++) {\n var str = i.ToString();\n var sum = i;\n for (var j = 0; j < str.Length; j++) {\n sum += str[j] - '0';\n }\n if (sum == n) {\n count++;\n }\n }\n\n sw.WriteLine(count);\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var n = s.I();\n int sum = 0;\n for (int i = Math.Max(0,n - 2*s.Length * 10); i < n; i++)\n {\n if (S(i) == n)\n {\n H.A(i);\n sum++;\n }\n }\n Console.WriteLine(sum);\n Console.Write(H.Str());\n }\n static int S(int n)\n {\n var t = n;\n var k = n;\n while (k != 0)\n {\n t += k % 10;\n k = k / 10;\n }\n return t;\n }\n }\n static class H\n {\n public static int I(this string str)\n {\n return int.Parse(str);\n }\n\n public static StringBuilder builder = new StringBuilder();\n\n public static void A(object a)\n {\n builder.Append(a);\n }\n\n public static string Str()\n {\n return builder.ToString();\n }\n static IEnumerable Read(TextReader rdr)\n {\n int ch;\n bool neg = false;\n int value = 0;\n int count = 0;\n\n while (-1 != (ch = rdr.Read()))\n {\n if (ch == 9 || ch == 10 || ch == 13 || ch == 32)\n {\n if (count > 0)\n yield return neg ? -value : value;\n count = 0;\n value = 0;\n neg = false;\n }\n else if (count == 0 && ch == '-')\n {\n neg = true;\n }\n else if (ch >= '0' && ch <= '9')\n {\n count++;\n value = value * 10 + (ch - '0');\n }\n else\n throw new InvalidDataException();\n }\n\n if (count > 0)\n yield return neg ? -value : value;\n }\n }\n}\n"}], "src_uid": "ae20ae2a16273a0d379932d6e973f878"} {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (red > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\t\tred = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (green > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\t\tgreen = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (blue > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\t\tblue = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || (min == 1 && red + green + blue >= 7) || (min == 0 && red + green + blue >= 6))\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1 || (red == 3 || green == 3 || blue == 3))\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int[] a = new[]{ int.Parse(s[0]), int.Parse(s[1]), int.Parse(s[2]) };\n Array.Sort(a);\n int r, g, b;\n r = a[0];\n g = a[1];\n b = a[2];\n int ans = r + (g-r)/3 + (b-r)/3;\n int ans2 = b / 3 + g / 3 + Math.Min(r, Math.Min(b % 3, g % 3)) + (r - Math.Min(r, Math.Min(b % 3, g % 3)))/3;\n ans = Math.Max(ans, ans2);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Ciel_and_Flowers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int r = Next();\n int g = Next();\n int b = Next();\n\n int count = r/3 + g/3 + b/3;\n\n var nn = new[] {r%3, g%3, b%3};\n int min = nn.Min();\n\n if (min > 0)\n {\n count += min;\n }\n else\n {\n if (nn.Sum() == 4)\n {\n if (r%3 == 0 && r > 0 || g%3 == 0 && g > 0 || b%3 == 0 && b > 0)\n {\n count++;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Flowers\n{\n class Flowers\n {\n static void Main(string[] args)\n {\n string[] rgb = Console.ReadLine().Split(' ');\n long r = long.Parse(rgb[0]);\n long g = long.Parse(rgb[1]);\n long b = long.Parse(rgb[2]);\n\n long rm = r % 3;\n long gm = g % 3;\n long bm = b % 3;\n if (rm == 0 && r > 0) rm = 3;\n if (gm == 0 && g > 0) gm = 3;\n if (bm == 0 && b > 0) bm = 3;\n\n long f = (r - rm) / 3 + (g - gm) / 3 + (b - bm) / 3;\n\n long min = Math.Min(rm, Math.Min(bm, gm));\n long thr = (rm == 3 ? 1 : 0) + (gm == 3 ? 1 : 0) + (bm == 3 ? 1 : 0);\n f += Math.Max(min, thr);\n\n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var j = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n int a = j.ElementAt(0);\n int b = j.ElementAt(1);\n int c = j.ElementAt(2);\n int ans = a / 3 + b / 3 + c / 3;\n if ((a > 0) && (b > 0) && (c > 0))\n {\n ans=Math.Max(ans,(a-1)/3+(b-1)/3+(c-1)/3+1);\n }\n if ((a > 1) && (b > 1) && (c > 1))\n {\n ans=Math.Max(ans,(a-2)/3+(b-2)/3+(c-2)/3+2);\n }\n Console.WriteLine(ans);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R190_Div2_B\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int rr = int.Parse(s[0]);\n int gg = int.Parse(s[1]);\n int bb = int.Parse(s[2]);\n\n int r, g, b;\n int cnt = 0;\n if (rr % 3 == 0 && rr > 0)\n {\n r = rr / 3 - 1;\n rr -= r * 3;\n cnt += r;\n }\n else\n {\n r = rr / 3;\n rr = rr % 3;\n cnt += r;\n }\n\n if (gg % 3 == 0 && gg > 0)\n {\n g = gg / 3 - 1;\n gg -= g * 3;\n cnt += g;\n }\n else\n {\n g = gg / 3;\n gg = gg % 3;\n cnt += g;\n }\n\n if (bb % 3 == 0 && bb > 0)\n {\n b = bb / 3 - 1;\n bb -= b * 3;\n cnt += b;\n }\n else\n {\n b = bb / 3;\n bb = bb % 3;\n cnt += b;\n }\n\n r = rr; g = gg; b = bb;\n int cnt1 = 0;\n cnt1 += Math.Min(r, Math.Min(g, b));\n r -= cnt1; g -= cnt1; b -= cnt1;\n cnt1 += r / 3 + g / 3 + b / 3;\n cnt1 += cnt;\n\n r = rr; g = gg; b = bb;\n int cnt2 = 0;\n cnt2 += r / 3; r = r % 3;\n cnt2 += g / 3; g = g % 3;\n cnt2 += b / 3; b = b % 3; \n\n cnt2 += Math.Min(r, Math.Min(g, b));\n cnt2 += cnt;\n\n Console.WriteLine(Math.Max(cnt1,cnt2));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] rgb = instream.ReadIntArray();\n\n int minMin = Math.Min(Math.Min(rgb[0], rgb[1]), rgb[2]);\n\n int res = 0;\n\n for (int min = Math.Max(0, minMin - 4); min <= minMin; min++)\n {\n int subres = min;\n\n \n for (int i = 0; i < 3; i++)\n {\n subres += ((rgb[i] - min) / 3);\n }\n\n res = Math.Max(subres, res);\n }\n\n outstream.WriteLine(res);\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string in_s = Console.ReadLine();\n string[] pra = in_s.Split(' ');\n int redNum = Convert.ToInt32(pra[0]);\n int greenNum = Convert.ToInt32(pra[1]);\n int yellowNum = Convert.ToInt32(pra[2]);\n int ans = 0;\n for (int i = 0; i <= 2; i++)\n {\n int slo = i;\n slo += (redNum - i) / 3;\n slo += (greenNum - i) / 3;\n slo += (yellowNum - i) / 3;\n\n if (slo > ans && i <= redNum && i <= greenNum && i <= yellowNum) ans = slo;\n }\n Console.WriteLine(ans);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var r = NextInt();\n var g = NextInt();\n var b = NextInt();\n int m = Math.Min(r, Math.Min(g, b));\n\n long res = m;\n r -= m;\n g -= m;\n b -= m;\n res += r / 3;\n res += g / 3;\n res += b / 3;\n int rr = r % 3;\n int rg = g % 3;\n int rb = b % 3;\n if (m > 0)\n {\n if ((rr == 2 && rg == 2) || (rr == 2 && rb == 2) || (rb == 2 && rg == 2))\n {\n res += 1;\n }\n }\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CielAndFlowers\n{\n class CielAndFlowers\n {\n static void Main(string[] args)\n {\n int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] mix = new int[3];\n\n Array.Sort(values);\n\n for (int i = 0; i < 3; i++)\n mix[0] += values[i] / 3;\n\n if (values[0] > 0)\n {\n mix[1] = 1;\n\n for (int i = 0; i < 3; i++)\n mix[1] += (values[i] - 1) / 3;\n }\n\n if (values[0] > 1)\n {\n mix[2] = 2;\n\n for (int i = 0; i < 3; i++)\n mix[2] += (values[i] - 2) / 3;\n }\n \n Console.WriteLine(mix.Max());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static double distance(int x1, int y1, int x2, int y2)\n {\n return 0.0;\n }\n\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int[] rgb = new int[3];\n\n rgb[0] = int.Parse(data[0]);\n rgb[1] = int.Parse(data[1]);\n rgb[2] = int.Parse(data[2]);\n\n int min = rgb.Min();\n int result = 0;\n\n for (int i = min; i > min - 3 && i >= 0; i--)\n {\n int buckets = i + (rgb[0] - i) / 3 + (rgb[1] - i) / 3 + (rgb[2] - i) / 3;\n\n if (result < buckets) result = buckets;\n }\n\n Console.WriteLine(\"{0}\", result);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemB\n{\n static void Main()\n {\n var s = Console.ReadLine().Split(' ');\n var r = int.Parse(s[0]);\n var g = int.Parse(s[1]);\n var b = int.Parse(s[2]);\n\n var l = r/3;\n var m = g/3;\n var n = b/3;\n\n var x = r % 3;\n var y = g % 3;\n var z = b % 3;\n int[] array = { x, y, z };\n var min = 0;\n if (x == 2 && y == 2 && z == 2)\n min += 2;\n else if (x == 2 && y == 2 && n > 0)\n {\n min += 2;\n n--;\n }\n else if (x == 2 && z == 2 && m > 0)\n {\n min += 2;\n m--;\n }\n else if (y == 2 && z == 2 && l > 0)\n {\n min += 2;\n l--;\n }\n else min += array.Min();\n var num = l + m + n + min;\n Console.WriteLine(num.ToString());\n }\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int r, g, b;\n string[] s = Console.ReadLine().Split();\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int maxx = 0;\n for (int mixed = 0; mixed <= Math.Min(Math.Min(2,r),Math.Min(b,g)); mixed++)\n {\n if (mixed + (r - mixed) / 3 + (g - mixed) / 3 + (b - mixed) / 3 > maxx)\n maxx = mixed + (r - mixed) / 3 + (g - mixed) / 3 + (b - mixed) / 3;\n }\n Console.WriteLine(maxx.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace ConsoleApplication27\n{\n class Program\n {\n static void Main0(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]);\n\n Console.WriteLine(n + m - 1);\n Console.WriteLine(\"1 1\");\n for (int i = 1; i < n; i++)\n Console.WriteLine(\"{0} 1\", i + 1);\n for (int i = 1; i < m; i++)\n Console.WriteLine(\"1 {0}\", i + 1);\n }\n\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int r = int.Parse(line[0]);\n int g = int.Parse(line[1]);\n int b = int.Parse(line[2]);\n\n int best = 0;\n for (int m = 0; m < 3; m++)\n {\n if (r < m || g < m || b < m)\n continue;\n best = Math.Max(best, m + (r - m) / 3 + (g - m) / 3 + (b - m) / 3);\n }\n\n Console.WriteLine(best);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long r = a[0], ans = 0;\n long g = a[1];\n long b = a[2];\n a[0] = r % 3; a[1] = g % 3; a[2] = b % 3;\n bool flag = (a.Count(x => x > 1) > 1) && (r != 0 && g != 00 && b != 00);\n if (flag)\n {\n ans = 2;\n r -= 2;\n g -= 2;\n b -= 2;\n }\n ans += r / 3 + g / 3 + b / 3;\n if (!flag) ans += a.Min();\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass P\n{\n static void Main()\n {\n var c = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var v = Enumerable.Range(0, 4).Select(x => c.Min() - x).Where(x => x >= 0)\n .Select(k => k + c.Select(r => (r - k) / 3).Sum()).Max();\n Console.WriteLine(v);\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var c = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var v = Enumerable.Range(0,4).Select(x => c.Min() - x).Where(x => x >= 0)\n .Select(k => k + c.Select(r => (r-k)/3).Sum()).Max();\n Console.WriteLine(v);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _322_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] values = input.Split(' ');\n int r = Int32.Parse(values[0]);\n int g = Int32.Parse(values[1]);\n int b = Int32.Parse(values[2]);\n\n int total = 0;\n\n int min = Math.Min(Math.Min(r, g), b);\n if (min > 3) { min = 3; }\n\n // \u041f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u044f\u0442\u044c \u0434\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0443\u0445 \u0442\u0438\u043f\u043e\u0432 \u0446\u0432\u0435\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0442\u043d\u043e 3\n\n for (int j = 0; j < min; j++)\n {\n if ((r % 3 == 0 && b % 3 == 0) || (r % 3 == 0 && g % 3 == 0) || (b % 3 == 0 && g % 3 == 0))\n {\n break;\n }\n r--; g--; b--; total++;\n }\n total += r / 3 + g / 3 + b / 3;\n\n Console.Write(\"{0}\", total);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar r = l[0];\n\t\t\tvar g = l[1];\n\t\t\tvar b = l[2];\n\t\t\tlong ans = 0;\n\t\t\tfor (var i = 0; i < 3; ++i)\n\t\t\t{\n\t\t\t\tif (i <= Math.Min(r, Math.Min(g, b)))\n\t\t\t\t{\n\t\t\t\t\tvar cur = i + (r - i) / 3 + (b - i) / 3 + (g - i) / 3;\n\t\t\t\t\tans = Math.Max(cur, ans);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n\n\n static void Main(string[] args)\n {\n int r = 0, g = 0, b = 0;\n\n ReadInts(ref r, ref g, ref b);\n\n int a1 = r / 3 + g / 3 + b / 3;\n \n int a2 = 0;\n if (r>=1 && g>=1 && b>=1)\n a2 = 1 + (r - 1) / 3 + (g - 1) / 3 + (b - 1) / 3;\n \n int a3 = 0;\n if (r>=2 && g>=2 && b>=2)\n a3 = 2 + (r - 2) / 3 + (g - 2) / 3 + (b - 2) / 3;\n\n PrintLn(MyMax(a1,a2,a3));\n\n \n\n }\n\n\n\n\n }\n\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _322B\n {\n public static void Main()\n {\n var flowers = Console.ReadLine().Split().Select(token => long.Parse(token)).ToArray();\n var remainders = flowers.Select(count => count % 3).OrderBy(r => r).ToArray();\n\n if (remainders.Distinct().Count() == 1)\n {\n Console.WriteLine(flowers.Sum() / 3);\n }\n else if (remainders[1] == 2)\n {\n Console.WriteLine(Math.Sign(flowers.First(count => count % 3 == 0)) + flowers.Sum(count => count / 3));\n }\n else if (remainders[0] == 0)\n {\n Console.WriteLine(flowers.Sum(count => count / 3));\n }\n else\n {\n Console.WriteLine(flowers.Sum() / 3);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\t\t\tbool hasRest = false;\n\n\t\t\tif (red % 3 > 0)\n\t\t\t{\n\t\t\t\thasRest = true;\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tif (green % 3 > 0)\n\t\t\t{\n\t\t\t\thasRest = true;\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tif (blue % 3 > 0)\n\t\t\t{\n\t\t\t\thasRest = true;\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tif (hasRest)\n\t\t\t{\n\t\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\t\tConsole.WriteLine(result + min);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(red / 3 + green / 3 + blue / 3);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\tred = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\tgreen = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\tblue = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || red + green + blue >= 7)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1 || (red == 3 || green == 3 || blue == 3))\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tif (red % 3 > 0)\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tif (green % 3 > 0)\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tif (blue % 3 > 0)\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tConsole.WriteLine(result + min);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\tred = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\tgreen = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\tblue = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tConsole.WriteLine(result + min);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (red > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\t\tred = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (green > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\t\tgreen = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (blue > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\t\tblue = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || red + green + blue >= 6)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1 || (red == 3 || green == 3 || blue == 3))\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tvar result = min + (red - min) / 3 + (green - min) / 3 + (blue - min) / 3;\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (red > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\t\tred = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (green > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\t\tgreen = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (blue > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\t\tblue = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || red + green + blue >= 7)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1 || (red == 3 || green == 3 || blue == 3))\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (red > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\t\tred = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (green > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\t\tgreen = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tif (blue > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\t\tblue = 3;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || (min < 2 && red + green + blue >= 7))\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1 || (red == 3 || green == 3 || blue == 3))\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\tred = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\tgreen = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (mod == 0)\n\t\t\t{\n\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\tblue = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || red + green + blue >= 7)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tvar red = inputs.ElementAt(0);\n\t\t\tvar green = inputs.ElementAt(1);\n\t\t\tvar blue = inputs.ElementAt(2);\n\n\t\t\tlong result = 0;\n\n\t\t\tvar mod = red % 3;\n\t\t\tif (red > 0 && mod == 0)\n\t\t\t{\n\t\t\t\tresult += (red / 3) - 1;\n\t\t\t\tred = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += red / 3;\n\t\t\t\tred = red % 3;\n\t\t\t}\n\n\t\t\tmod = green % 3;\n\t\t\tif (green > 0 && mod == 0)\n\t\t\t{\n\t\t\t\tresult += (green / 3) - 1;\n\t\t\t\tgreen = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += green / 3;\n\t\t\t\tgreen = green % 3;\n\t\t\t}\n\n\t\t\tmod = blue % 3;\n\t\t\tif (blue > 0 && mod == 0)\n\t\t\t{\n\t\t\t\tresult += (blue / 3) - 1;\n\t\t\t\tblue = 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += blue / 3;\n\t\t\t\tblue = blue % 3;\n\t\t\t}\n\n\t\t\tvar min = Math.Min(Math.Min(red, green), blue);\n\t\t\tif (min == 3)\n\t\t\t{\n\t\t\t\tresult += 3;\n\t\t\t}\n\t\t\telse if (min == 2 || red + green + blue >= 7)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t}\n\t\t\telse if(min == 1)\n\t\t\t{\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n Array.Sort(s);\n int r, g, b;\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int ans = r + (g-r)/3 + (b-r)/3;\n \n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n Array.Sort(s);\n int r, g, b;\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int ans = r + (g-r)/3 + (b-r)/3;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n Array.Sort(s);\n int r, g, b;\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int ans = r + (g-r)/3 + (b-r)/3;\n int ans2 = b / 3 + g / 3 + Math.Min(r, Math.Min(b % 3, g % 3)) + (r - Math.Min(r, Math.Min(b % 3, g % 3)))/3;\n ans = Math.Max(ans, ans2);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n Array.Sort(s);\n int r, g, b;\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int ans = r + (g-r)/3 + (b-r)/3;\n int ans2 = b / 3 + g / 3 + Math.Max(r, Math.Max(b % 3, g % 3)) + (r - Math.Max(r, Math.Max(b % 3, g % 3)))/3;\n ans = Math.Max(ans, ans2);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Net;\nnamespace olimp\n{\n\n class Node\n {\n public List Roads;\n public List ClosedRoads; \n public int Id,Mark;\n }\n\n\n static class Program\n {\n private static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n Array.Sort(s);\n int r, g, b;\n r = int.Parse(s[0]);\n g = int.Parse(s[1]);\n b = int.Parse(s[2]);\n int ans = r + (g-r)/3 + (b-r)/3;\n int ans2 = b / 3 + g / 3 + Math.Min(r, Math.Max(b % 3, g % 3)) + (r - Math.Min(r, Math.Max(b % 3, g % 3)))/3;\n ans = Math.Max(ans, ans2);\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n \n static void ReadIntPair(out int a1, out int a2)\n {\n string[] s = Console.ReadLine().Split(' ');\n a1 = int.Parse(s[0]);\n a2 = int.Parse(s[1]);\n }\n\n static long ReadNextInt()\n {\n char c;\n StringBuilder builder = new StringBuilder(4);\n while (char.IsDigit(c = (char) Console.Read()) || c == '-'||c == '\\r' || c == '\\n')\n {\n if (c == '\\r' || c == '\\n')\n continue;\n builder.Append(c);\n }\n return long.Parse(builder.ToString());\n }\n\n static int Sum1(int n)\n {\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum += (int)(Math.Pow(-1, i)*Math.Pow(n - i, 2));\n }\n return sum;\n }\n\n static int Sum2(int n)\n {\n return (n*(n+1))/2;\n }\n\n static double Log10(double x)\n {\n int n = CalnN((int) x);\n double val = n;\n double last = x;\n for (int i = 1; i <= sizeof(double) * 8; i++)\n {\n last = last*last;\n if (last >= 10)\n {\n val += 1/Math.Pow(2, i);\n last /= 10;\n }\n }\n return val;\n }\n\n static int CalnN(int x)\n {\n int i = 0;\n for (; Math.Pow(x, i + 1) < x; i++)\n {\n }\n return i;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var r = NextInt();\n var g = NextInt();\n var b = NextInt();\n int m = Math.Min(r, Math.Min(g, b));\n\n int res = m;\n r -= m;\n g -= m;\n b -= m;\n res += r / 3;\n res += g / 3;\n res += b / 3;\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var r = NextInt();\n var g = NextInt();\n var b = NextInt();\n int m = Math.Min(r, Math.Min(g, b));\n\n long res = m;\n r -= m;\n g -= m;\n b -= m;\n res += r / 3;\n res += g / 3;\n res += b / 3;\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CielAndFlowers\n{\n class CielAndFlowers\n {\n static void Main(string[] args)\n {\n int[] values = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int countIndividual = 0, countMix = 0;\n int[] tempValues = new int[3];\n\n Array.Sort(values);\n\n // Count Individual bouquets + remainder\n for (int i = 0; i < 3; i++)\n {\n tempValues[i] = values[i] % 3;\n countIndividual += values[i] / 3;\n }\n\n Array.Sort(tempValues);\n\n countIndividual += tempValues[0];\n\n // Count Mixing bouquets + remainder\n countMix += values[0];\n\n values[1] -= values[0];\n values[2] -= values[0];\n values[0] = 0;\n\n for (int i = 0; i < 3; i++)\n countMix += values[i] / 3;\n\n Console.WriteLine(Math.Max(countIndividual, countMix));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemB\n{\n static void Main()\n {\n var s = Console.ReadLine().Split(' ');\n var r = int.Parse(s[0]);\n var g = int.Parse(s[1]);\n var b = int.Parse(s[2]);\n\n var l = r/3;\n var m = g/3;\n var n = b/3;\n\n var x = r % 3;\n var y = g % 3;\n var z = b % 3;\n int[] array = { x, y, z };\n var min = array.Min();\n\n var num = l + m + n + min;\n Console.WriteLine(num.ToString());\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemB\n{\n static void Main()\n {\n var s = Console.ReadLine().Split(' ');\n var r = int.Parse(s[0]);\n var g = int.Parse(s[1]);\n var b = int.Parse(s[2]);\n\n var l = r/3;\n var m = g/3;\n var n = b/3;\n\n var x = r % 3;\n var y = g % 3;\n var z = b % 3;\n int[] array = { x, y, z };\n var min = 0;\n if (x == 2 && y == 2 && n > 0)\n {\n min += 2;\n n--;\n }\n else if (x == 2 && z == 2 && m > 0)\n {\n min += 2;\n m--;\n }\n else if (y == 2 && z == 2 && l > 0)\n {\n min += 2;\n l--;\n }\n else min += array.Min();\n var num = l + m + n + min;\n Console.WriteLine(num.ToString());\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace ConsoleApplication27\n{\n class Program\n {\n static void Main0(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]);\n\n Console.WriteLine(n + m - 1);\n Console.WriteLine(\"1 1\");\n for (int i = 1; i < n; i++)\n Console.WriteLine(\"{0} 1\", i + 1);\n for (int i = 1; i < m; i++)\n Console.WriteLine(\"1 {0}\", i + 1);\n }\n\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int r = int.Parse(line[0]);\n int g = int.Parse(line[1]);\n int b = int.Parse(line[2]);\n\n\n int mixed = Math.Min(r, Math.Min(g, b));\n Console.WriteLine(mixed + (r - mixed) / 3 + (g - mixed) / 3 + (b - mixed) / 3);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long r = a[0], ans=0;\n long g = a[1];\n long b = a[2];\n if (a.Count(x => x % 3 == 0) > 1)\n ans = r / 3 + g / 3 + b / 3;\n else\n ans = a.Min() + (r - a.Min()) / 3 + (g - a.Min()) / 3 + (b - a.Min()) / 3;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long r = a[0], ans = 0;\n long g = a[1];\n long b = a[2];\n a[0] = r % 3; a[1] = g % 3; a[2] = b % 3;\n bool flag = a.Count(x => x > 1) == 3;\n if (flag)\n {\n ans = a.Min();\n r -= a.Min();\n g -= a.Min();\n b -= a.Min();\n }\n ans += r / 3 + g / 3 + b / 3;\n if (!flag) ans += a.Min();\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long r = a[0];\n long g = a[1];\n long b = a[2];\n long ans = a.Min() + (r - a.Min()) / 3 + (g - a.Min()) / 3 + (b - a.Min()) / 3;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long r = a[0], ans = 0;\n long g = a[1];\n long b = a[2];\n a[0] = r % 3; a[1] = g % 3; a[2] = b % 3;\n bool flag = a.Count(x => x > 1) > 1;\n if (flag)\n {\n ans = 2;\n r -= 2;\n g -= 2;\n b -= 2;\n }\n ans += r / 3 + g / 3 + b / 3;\n if (!flag) ans += a.Min();\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Flowers\n{\n class Flowers\n {\n static void Main(string[] args)\n {\n string[] rgb = Console.ReadLine().Split(' ');\n int r = int.Parse(rgb[0]);\n int g = int.Parse(rgb[1]);\n int b = int.Parse(rgb[2]);\n\n int f = Math.Min(r, Math.Min(g, b));\n r -= f;\n g -= f;\n b -= f;\n\n f += r / 3;\n f += g / 3;\n f += b / 3;\n\n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Flowers\n{\n class Flowers\n {\n static void Main(string[] args)\n {\n string[] rgb = Console.ReadLine().Split(' ');\n long r = long.Parse(rgb[0]);\n long g = long.Parse(rgb[1]);\n long b = long.Parse(rgb[2]);\n\n long f = Math.Min(r, Math.Min(g, b));\n r -= f;\n g -= f;\n b -= f;\n\n f += r / 3;\n f += g / 3;\n f += b / 3;\n\n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Flowers\n{\n class Flowers\n {\n static void Main(string[] args)\n {\n string[] rgb = Console.ReadLine().Split(' ');\n long r = long.Parse(rgb[0]);\n long g = long.Parse(rgb[1]);\n long b = long.Parse(rgb[2]);\n\n long f = Math.Min(r, Math.Min(g, b));\n f -= f % 3;\n r -= f;\n g -= f;\n b -= f;\n\n f += r / 3;\n r %= 3;\n\n f += g / 3;\n g %= 3;\n\n f += b / 3;\n b %= 3;\n\n f += Math.Min(r, Math.Min(g, b));\n\n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var j = Console.ReadLine().Split(' ').Select(int.Parse);\n int a = j.ElementAt(0);\n int b = j.ElementAt(1);\n int c = j.ElementAt(2);\n int x = j.Min();\n a -= x; b -= x; c -= x;\n Console.WriteLine(a / 3 + b / 3 + c / 3 + x);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var j = Console.ReadLine().Split(' ').Select(int.Parse);\n int a = j.ElementAt(0);\n int b = j.ElementAt(1);\n int c = j.ElementAt(2);\n int x = j.Min(); \n int tres1 = (a-x) / 3 + (b-x) / 3 + (c-x) / 3 + x;\n int tres2 = a / 3 + b / 3 + c / 3 + (new int[] { a % 3, b % 3, c % 3 }).Min();\n Console.WriteLine(Math.Max(tres1,tres2));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R190_Div2_B\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int rr = int.Parse(s[0]);\n int gg = int.Parse(s[1]);\n int bb = int.Parse(s[2]);\n\n int r = rr, g = gg, b = bb;\n int cnt = Math.Min(r, Math.Min(g, b));\n r -= cnt; g -= cnt; b -= cnt;\n cnt += r / 3 + g / 3 + b / 3;\n\n r = rr; g = gg; b = bb;\n int cnt2 = r / 3; r = r % 3;\n cnt2 += g / 3; g = g % 3;\n cnt2 += b / 3; b = b % 3;\n\n cnt2 += Math.Min(r, Math.Min(g, b));\n\n Console.WriteLine(Math.Max(cnt,cnt2));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] rgb = instream.ReadIntArray();\n\n int min = Math.Min(Math.Min(rgb[0], rgb[1]), rgb[2]);\n\n for (int i = 0; i < 3; i++)\n rgb[i] -= min;\n int res = min;\n\n for (int i = 0; i < 3; i++)\n {\n res += (rgb[i] / 3);\n }\n\n outstream.WriteLine(res);\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string in_s = Console.ReadLine();\n string[] pra = in_s.Split(' ');\n int redNum = Convert.ToInt32(pra[0]);\n int greenNum = Convert.ToInt32(pra[1]);\n int yellowNum = Convert.ToInt32(pra[2]);\n int ans = 0;\n for (int i = 0; i <= 2; i++)\n {\n int slo = i;\n slo += (redNum - i) / 3;\n slo += (greenNum - i) / 3;\n slo += (yellowNum - i) / 3;\n if (slo > ans) ans = slo;\n }\n Console.WriteLine(ans);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static double distance(int x1, int y1, int x2, int y2)\n {\n return 0.0;\n }\n\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int[] rgb = new int[3];\n\n rgb[0] = int.Parse(data[0]);\n rgb[1] = int.Parse(data[1]);\n rgb[2] = int.Parse(data[2]);\n\n int min = rgb.Min();\n int result = 0;\n\n for (int i = min; i > min - 3; i--)\n {\n int buckets = i + (rgb[0] - i) / 3 + (rgb[1] - i) / 3 + (rgb[2] - i) / 3;\n\n if (result < buckets) result = buckets;\n }\n\n Console.WriteLine(\"{0}\", result);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static double distance(int x1, int y1, int x2, int y2)\n {\n return 0.0;\n }\n\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int[] rgb = new int[3];\n\n rgb[0] = int.Parse(data[0]);\n rgb[1] = int.Parse(data[1]);\n rgb[2] = int.Parse(data[2]);\n\n int count = 0;\n\n int min = rgb.Min();\n count = min;\n\n rgb[0] -= min;\n rgb[1] -= min;\n rgb[2] -= min;\n\n count += rgb[0] / 3;\n count += rgb[1] / 3;\n count += rgb[2] / 3;\n\n Console.WriteLine(\"{0}\", count);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static double distance(int x1, int y1, int x2, int y2)\n {\n return 0.0;\n }\n\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int[] rgb = new int[3];\n\n rgb[0] = int.Parse(data[0]);\n rgb[1] = int.Parse(data[1]);\n rgb[2] = int.Parse(data[2]);\n\n int count1 = 0;\n int[] rgb1 = (int[]) rgb.Clone();\n\n int min = rgb1.Min();\n count1 = min;\n\n rgb1[0] -= min;\n rgb1[1] -= min;\n rgb1[2] -= min;\n\n count1 += rgb1[0] / 3;\n count1 += rgb1[1] / 3;\n count1 += rgb1[2] / 3;\n\n int count2 = 0;\n int[] rgb2 = (int[])rgb.Clone();\n\n count2 += rgb2[0] / 3; rgb2[0] = rgb2[0] % 3;\n count2 += rgb2[1] / 3; rgb2[1] = rgb2[1] % 3;\n count2 += rgb2[2] / 3; rgb2[2] = rgb2[2] % 3;\n\n count2 = rgb2.Min();\n\n Console.WriteLine(\"{0}\", Math.Max(count1, count2));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long t = a.Sum();\n t /= 3;\n if (a.Any(d => d % 3 == 0)) t--;\n Console.WriteLine(t);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long t = a.Sum();\n if (a.Any(d => d % 3 == 0)) t--;\n Console.WriteLine(t);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long t = a.Sum();\n t /= 3;\n if (a.Any(d => d % 3 == 0) && !a.All(d => d % 3 == 0)) t--;\n Console.WriteLine(t);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var r = _[0]; var g = _[1]; var b = _[2];\n var a = r / 3 + g / 3 + b / 3 + r % 3 != 0 && g % 3 != 0 && b % 3 != 0 ? (r % 3 + g % 3 + b % 3) / 3 : 0;\n Console.WriteLine(a);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (_.All(d => d % 3 == 0))\n {\n Console.WriteLine(_.Sum() / 3);\n }\n else\n {\n Console.WriteLine(_.Sum() / 3 - (_.Count(d => d == 0) == 1 ? 1 : 0));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.IO;\nclass Program\n{\n static TextReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n static TextWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n static void Main()\n {\n var _ = reader.ReadLine().Split().Select(int.Parse).ToArray();\n var r = _[0];\n var g = _[1];\n var b = _[2];\n var a = r / 3 + g / 3 + b / 3 + (r % 3 + g % 3 + b % 3) / 3;\n writer.WriteLine(a);\n reader.Close();\n writer.Close();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long t = a.Sum();\n t /= 3;\n if (a.Any(d => d % 3 == 0) && !a.All(d => d % 3 == 0)\n && a[0] != a[1] && a[1] != a[2]) t--;\n Console.WriteLine(t);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(_.Sum() / 3 - (_.Count(d => d == 0) == 1 ? 1 : 0));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var b = 0;\n if (!(a[0] > 0 && a[1] > 0 && a[2] > 0))\n {\n Console.WriteLine(a[0] / 3 + a[1] / 3 + a[2] / 3);\n }\n else\n {\n if (a[0] % 3 != 0 && a[1] % 3 != 0 && a[2] % 3 != 0)\n {\n b = 1;\n }\n Console.WriteLine(a.Sum() / 3 - b);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var r = _[0]; var g = _[1]; var b = _[2];\n var a = r / 3 + g / 3 + b / 3 + (r % 3 != 0 && g % 3 != 0 && b % 3 != 0 ? (r % 3 + g % 3 + b % 3) / 3 : 0);\n Console.WriteLine(a);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar r = l[0];\n\t\t\tvar g = l[1];\n\t\t\tvar b = l[2];\n\t\t\tlong ans = 0;\n\t\t\tfor (var i = 0; i < 3; ++i)\n\t\t\t{\n\t\t\t\tif (i >= Math.Min(r, Math.Min(g, b)))\n\t\t\t\t{\n\t\t\t\t\tvar cur = i + (r - i) / 3 + (b - i) / 3 + (g - i) / 3;\n\t\t\t\t\tans = Math.Max(cur, ans);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar r = l[0];\n\t\t\tvar g = l[1];\n\t\t\tvar b = l[2];\n\t\t\tvar ans1 = Math.Min(r, Math.Min(g, b));\n\t\t\tans1 = ans1 + (r - ans1) / 3 + (b - ans1) / 3 + (g - ans1) / 3;\n\t\t\tvar ans = r / 3 + b / 3 + g / 3;\n\t\t\tans = ans + Math.Min(r % 3, Math.Min(b % 3, g % 3));\n\t\t\tConsole.WriteLine(Math.Max(ans, ans1));\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar r = l[0];\n\t\t\tvar g = l[1];\n\t\t\tvar b = l[2];\n\t\t\tvar ans = r / 3 + b / 3 + g / 3;\n\t\t\tans = ans + Math.Min(r % 3, Math.Min(b % 3, g % 3));\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar r = l[0];\n\t\t\tvar g = l[1];\n\t\t\tvar b = l[2];\n\t\t\tvar ans = Math.Min(r, Math.Min(g, b));\n\t\t\tans = ans + (r - ans) / 3 + (b - ans) / 3 + (g - ans) / 3;\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static Dictionary mem = new Dictionary();\n\n static int solve(int r, int g, int b)\n {\n if (r<0 || g<0 || b<0)\n return 0;\n\n if (r + g + b < 3)\n return 0;\n\n if (r + g + b == 3)\n {\n if (r == 2 || g == 2 || b == 2)\n return 0;\n else\n return 1;\n }\n\n string str = r + \",\" + g + \",\" + b;\n \n if (mem.ContainsKey(r + \",\" + g + \",\" + b))\n return mem[r + \",\" + g + \",\" + b];\n\n mem[str] = 1 + MyMax(solve(r - 3, g, b), solve(r, g-3, b), solve(r, g, b-3), solve(r - 1, g-1, b-1));\n\n return mem[str];\n }\n\n\n\n static void Main(string[] args)\n {\n int r=0, g=0, b=0 ;\n\n ReadInts(ref r, ref g, ref b);\n\n int[] a = new int[3];\n\n a[0] = r % 3;\n a[1] = g % 3;\n a[2] = b % 3;\n\n Array.Sort(a);\n\n int d = 0;\n if (a[0] == 0 && a[1] == 1 && a[2] == 2)\n d = 1;\n\n PrintLn(((long)r + (long)g + (long)b) / 3 - d);\n\n\n\n\n \n\n }\n\n\n\n\n }\n\n\n}"}], "src_uid": "acddc9b0db312b363910a84bd4f14d8e"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Iterated_Linear_Function\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int mod = 1000000007;\n\n private static void Main(string[] args)\n {\n long A = Next(), B = Next(), n = Next(), x = Next();\n\n var nn = new[,] {{A, 0}, {B, 1}};\n long[,] res = Pow(nn, n);\n\n writer.WriteLine(((res[0, 0]*x)%mod + res[1, 0])%mod);\n writer.Flush();\n }\n\n private static long[,] Pow(long[,] a, long k)\n {\n var r = new long[,] {{1, 0}, {0, 1}};\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = Mult(r, a);\n }\n a = Mult(a, a);\n k >>= 1;\n }\n return r;\n }\n\n private static long[,] Mult(long[,] a, long[,] b)\n {\n return new[,]\n {\n {\n ((a[0, 0]*b[0, 0])%mod + (a[0, 1]*b[1, 0])%mod)%mod,\n ((a[0, 0]*b[0, 1])%mod + (a[0, 1]*b[1, 1])%mod)%mod\n },\n {\n ((a[1, 0]*b[0, 0])%mod + (a[1, 1]*b[1, 0])%mod)%mod,\n ((a[1, 0]*b[0, 1])%mod + (a[1, 1]*b[1, 1])%mod)%mod\n }\n };\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace Temp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split();\n var a = int.Parse(inputs[0]);\n var b = int.Parse(inputs[1]);\n var n = long.Parse(inputs[2]);\n var x = int.Parse(inputs[3]);\n\n //res = a^n * x + (a^(n-1) + a^(n-2) + ... + a + 1) * b \n //res = a^n * x + (a^n - 1)/(a - 1) * b\n\n var mod = 1000000007;\n long an = ModPow(a, n, mod);\n\n long res;\n if (a > 1)\n {\n res = (an - 1 + mod) % mod;\n long den = (a - 1 + mod) % mod;\n long denInv = ModPow(den, mod - 2, mod); //Modular multiplicative inverse computation using Euler's theorem\n res *= denInv; res %= mod;\n }\n else res = n % mod; //Edgecase: a = 1\n res *= b; res %= mod;\n res += (an * x) % mod; res %= mod;\n\n Console.WriteLine(res);\n }\n\n static int ModPow(long b, long exp, int mod)\n {\n var res = 1L;\n while (exp > 0)\n {\n if (exp % 2 == 1) { res *= b; res %= mod; }\n exp /= 2;\n b *= b; b %= mod;\n }\n return (int)res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Numerics;\n\nnamespace Temp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split();\n var a = BigInteger.Parse(inputs[0]);\n var b = BigInteger.Parse(inputs[1]);\n var n = BigInteger.Parse(inputs[2]);\n var x = BigInteger.Parse(inputs[3]);\n\n //res = a^n * x + (a^(n-1) + a^(n-2) + ... + a + 1) * b \n //res = a^n * x + (a^n - 1)/(a - 1) * b\n\n var mod = new BigInteger(1000000007);\n var an = BigInteger.ModPow(a, n, mod);\n\n BigInteger res;\n if (a > 1)\n {\n res = (an - 1 + mod) % mod;\n var den = (a - 1 + mod) % mod;\n var denInv = BigInteger.ModPow(den, mod - 2, mod); //Modular multiplicative inverse computation using Euler's theorem\n res *= denInv; res %= mod;\n }\n else res = n % mod; //Edgecase: a = 1\n res *= b; res %= mod;\n res += (an * x) % mod; res %= mod;\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Temp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split();\n var a = int.Parse(inputs[0]);\n var b = int.Parse(inputs[1]);\n var n = long.Parse(inputs[2]);\n var x = int.Parse(inputs[3]);\n\n var mod = 1000000007;\n long an = ModPow(a, n, mod);\n long res = (an * x) % mod;\n\n long nom;\n if (a > 1)\n {\n nom = (an - 1 + mod) % mod;\n long den = (a - 1 + mod) % mod;\n long denInv = ModPow(den, mod - 2, mod);\n nom *= denInv; nom %= mod;\n }\n else nom = n % mod;\n nom *= b; nom %= mod;\n res += nom; res %= mod;\n\n Console.WriteLine(res);\n }\n\n static int ModPow(long b, long exp, int mod)\n {\n var res = 1L;\n while (exp > 0)\n {\n if (exp % 2 == 1) { res *= b; res %= mod; }\n exp /= 2;\n b *= b; b %= mod;\n }\n return (int)res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n \n object Get()\n {\n checked\n {\n var a = ReadLongToken();\n var b = ReadLongToken();\n var n = ReadLongToken();\n var x = ReadLongToken();\n if (a == 1)\n return (x + b * (n % commonMod)) % commonMod;\n var first = (FastPow(a, n, commonMod) * x) % commonMod;\n var q1 = (FastPow(a, n, commonMod) + commonMod - 1);\n var q2 = FastPow(a - 1, commonMod - 2, commonMod);\n var second = b * ((q1 * q2) % commonMod);\n return (first + second) % commonMod;\n }\n }\n\n long FastPow(long b, long pow, long mod)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow((b * b) % mod, pow / 2, mod);\n return (FastPow(b, pow - 1, mod) * b) % mod;\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n \n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _678D\n{\n class Program\n {\n static long mod = 1000000007;\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n decimal A = decimal.Parse(input[0]), B = decimal.Parse(input[1]), x = decimal.Parse(input[3]);\n long n = long.Parse(input[2]);\n decimal result = 0;\n if (A == 1)\n result = x + B * n;\n else\n {\n decimal ApowN = BinPow(A, n);\n decimal MulInv = BinPow(A - 1, mod - 2);\n result = ApowN * x + B * ((ApowN - 1) * MulInv) % mod;\n }\n result %= mod;\n Console.WriteLine(result);\n }\n\n static decimal BinPow(decimal a, long n)\n {\n decimal res = 1;\n while (n > 0)\n {\n if ((n & 1) > 0)\n res *= a;\n a *= a;\n n >>= 1;\n a %= mod;\n res %= mod;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n var a = ReadLongToken();\n var b = ReadLongToken();\n var n = ReadLongToken();\n var x = ReadLongToken();\n if (a == 1)\n return (x + b * (n % commonMod)) % commonMod;\n var first = (FastPow(a, n, commonMod) * x) % commonMod;\n var q1 = (FastPow(a, n, commonMod) + commonMod - 1);\n var q2 = FastPow(a - 1, commonMod - 2, commonMod);\n var second = b * ((q1 * q2) % commonMod);\n return (first + second) % commonMod;\n }\n }\n\n long FastPow(long b, long pow, long mod)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow((b * b) % mod, pow / 2, mod);\n return (FastPow(b, pow - 1, mod) * b) % mod;\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n\n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _13d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static int mod = 1000 * 1000 * 1000 + 7;\n static void mult(long[,] a, long[,] b, long[,] res, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n res[i, j] = 0;\n for (int k = 0; k < n; k++)\n {\n res[i, j] += a[i, k] * b[k, j] % mod;\n res[i, j] %= mod;\n }\n }\n }\n }\n\n static void copy(long[,] from, long[,] to, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int k = 0; k < n; k++)\n {\n to[i, k] = from[i, k];\n }\n }\n }\n\n static void pow(long[,] a, long p, int n)\n {\n var temp = new long[n, n];\n var res = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n res[i, i] = 1;\n }\n\n while (true)\n {\n var rem = p % 2;\n if (rem == 1)\n {\n mult(res, a, temp, n);\n copy(temp, res, n);\n }\n\n if (p == 1)\n {\n break;\n }\n\n p /= 2;\n mult(a, a, temp, n);\n copy(temp, a, n);\n }\n\n copy(res, a, n);\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readLongArray();\n var a = d[0];\n var b = d[1];\n var n = d[2];\n var x = d[3];\n\n var mm = new long[2, 2];\n mm[0, 0] = a;\n mm[0, 1] = b;\n mm[1, 0] = 0;\n mm[1, 1] = 1;\n\n pow(mm, n, 2);\n\n var res = x * mm[0, 0] % mod + mm[0, 1];\n Console.WriteLine(res % mod);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.D_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class IteratedLinearFunctionECR13\n {\n private static int _mod = (int)1e9 + 7;\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n long A = fs.NextLong(), B = fs.NextLong(), n = fs.NextLong(), x = fs.NextLong();\n if (n == 0) writer.WriteLine(x);\n else if (n == 1) writer.WriteLine((A * x + B) % _mod);\n else\n {\n long[,] initial = new long[,] { { A * x + B, 1 } };\n long[,] factor = new long[,] { { A, 0 }, { B, 1 } };\n long[,] res = MultiplyMatricesMod(initial, BinPowMatrixMod(factor, n - 1, _mod), _mod);\n writer.WriteLine(res[0, 0]);\n }\n }\n }\n public static long BinPow(long a, long p)\n {\n if (p == 0) return 1;\n if ((p & 1) == 0)\n {\n long t = BinPow(a, p / 2);\n return t * t;\n }\n else\n {\n return a * BinPow(a, p - 1);\n }\n }\n public static long BinPowMod(long a, long p, long mod)\n {\n if (p == 0) return 1;\n if ((p & 1) == 0)\n {\n long t = BinPow(a, p / 2);\n return (t * t) % mod;\n }\n else\n {\n return (a % mod * BinPow(a, p - 1)) % mod;\n }\n }\n\n public static long[,] BinPowMatrix(long[,] a, long p) // p >= 1\n {\n if (a.GetLength(0) != a.GetLength(1))\n {\n throw new Exception(\"Not a square matrix\");\n }\n\n if (p == 1) return a;\n if ((p & 1) == 0)\n {\n long[,] t = BinPowMatrix(a, p / 2);\n return MultiplyMatrices(t, t);\n }\n else\n {\n return MultiplyMatrices(a, BinPowMatrix(a, p - 1));\n }\n }\n\n public static long[,] BinPowMatrixMod(long[,] a, long p, long mod) // p >= 1\n {\n if (a.GetLength(0) != a.GetLength(1))\n {\n throw new Exception(\"Not a square matrix\");\n }\n\n if (p == 1) return a;\n if ((p & 1) == 0)\n {\n long[,] t = BinPowMatrixMod(a, p / 2, mod);\n return MultiplyMatricesMod(t, t, mod);\n }\n else\n {\n return MultiplyMatricesMod(a, BinPowMatrixMod(a, p - 1, mod), mod);\n }\n }\n\n private static long[,] MultiplyMatrices(long[,] a, long[,] b)\n {\n if (a.GetLength(1) == b.GetLength(0))\n {\n long[,] c = new long[a.GetLength(0), b.GetLength(1)];\n for (int i = 0; i < c.GetLength(0); i++)\n {\n for (int j = 0; j < c.GetLength(1); j++)\n {\n c[i, j] = 0;\n for (int k = 0; k < a.GetLength(1); k++)\n c[i, j] = c[i, j] + a[i, k] * b[k, j];\n }\n }\n return c;\n }\n else\n {\n throw new Exception(\"Can't multiply because of incompatible sizes\");\n }\n }\n\n private static long[,] MultiplyMatricesMod(long[,] a, long[,] b, long mod)\n {\n if (a.GetLength(1) == b.GetLength(0))\n {\n long[,] c = new long[a.GetLength(0), b.GetLength(1)];\n for (int i = 0; i < c.GetLength(0); i++)\n {\n for (int j = 0; j < c.GetLength(1); j++)\n {\n c[i, j] = 0;\n for (int k = 0; k < a.GetLength(1); k++)\n {\n c[i, j] = c[i, j] + a[i, k] % mod * b[k, j] % mod;\n c[i, j] %= mod;\n }\n }\n }\n return c;\n }\n else\n {\n throw new Exception(\"Can't multiply because of incompatible sizes\");\n }\n }\n\n private static long[,] MatrixMod(long[,] a, long mod)\n {\n long[,] b = new long[a.GetLength(0), a.GetLength(1)];\n for (int i = 0; i < a.GetLength(0); i++)\n {\n for (int j = 0; j < a.GetLength(1); j++)\n {\n b[i, j] = a[i, j] % mod;\n }\n }\n return b;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n private const int MOD = 1000000007;\n\n long ModPow(long x, long p)\n {\n long ret = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = ret * x % MOD;\n x = x * x % MOD;\n p >>= 1;\n }\n return ret;\n }\n\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n long n = ReadLong();\n int x = ReadInt();\n\n if (a == 1)\n {\n Write((x + n % MOD * b) % MOD);\n return;\n }\n\n long ans = x * ModPow(a, n % (MOD - 1));\n ans += (ModPow(a, n % (MOD - 1)) + MOD - 1) % MOD * ModPow(a - 1, MOD - 2) % MOD * b;\n Write(ans % MOD);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Globalization;\n\nclass Program\n{\n private static long Sqrt3(long x)\n {\n long l = 1;\n long r = Math.Min(1000000, x);\n while (r - l > 1)\n {\n long mid = (l + r) / 2;\n long m3 = mid * mid * mid;\n if (m3 <= x)\n l = mid;\n else\n r = mid;\n }\n\n return l;\n }\n\n private static long div(long a, long b)\n {\n return (a * pow(b, Mod - 2, Mod)) % Mod;\n }\n private static long pow(long a, long p, long mod)\n {\n long res = 1;\n while (p > 0)\n {\n if ((p & 1) == 1) res = (res * a) % mod;\n a = (a * a) % mod;\n p >>= 1;\n }\n return res;\n }\n\n private static long g(long a, long b, long n, long x)\n {\n if (a == 1)\n return (x + b * (n % Mod)) % Mod;\n\n return ((pow(a, n, Mod) * x) % Mod + (div((pow(a, n, Mod) - 1 + Mod) % Mod, a - 1) * b) % Mod) % Mod;\n }\n\n private const long Mod = 1000000007;\n static void Main(string[] args)\n {\n Console.Write(g(ReadLong(), ReadLong(), ReadLong(), ReadLong()));\n }\n\n\n public class RSQ\n {\n private int[] m = new int[200001];\n public void Push(int pos, int v)\n {\n m[pos] += v;\n }\n\n public int Sum(int l, int r)\n {\n int ans = 0;\n while (l <= r) ans += m[l++];\n return ans;\n }\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 12;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(System.Globalization.CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n long A, B, n, x;\n sc.Make(out A, out B, out n, out x);\n if (A == 1) Fail((x + (ModInt)B * n));\n ModInt res = ModInt.Pow(A, n)*x;\n res += B * (1 - ModInt.Pow(A, n)) / (1 - A);\n WriteLine(res);\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac;//i!\n private static ModInt[] inv;//1/i\n private static ModInt[] facinv;//1/(i!)\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = 1;\n fac[0] = fac[1] = 1;\n facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(ModInt n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(ModInt n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(ModInt n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(ModInt n, ModInt r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n var calc = fac[n];\n calc = calc * facinv[r];\n calc = calc * facinv[n - r];\n return calc;\n }\n}\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}], "negative_code": [{"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n \n object Get()\n {\n checked\n {\n var a = ReadLongToken();\n var b = ReadLongToken();\n var n = ReadLongToken();\n var x = ReadLongToken();\n if (a == 1)\n return x + b * n;\n var first = (FastPow(a, n, commonMod) * x) % commonMod;\n var q1 = (FastPow(a, n, commonMod) + commonMod - 1);\n var q2 = FastPow(a - 1, commonMod - 2, commonMod);\n var second = b * ((q1 * q2) % commonMod);\n return (first + second) % commonMod;\n }\n }\n\n long FastPow(long b, long pow, long mod)\n {\n if (pow == 0)\n return 1;\n if (pow == 1)\n return b;\n if (pow % 2 == 0)\n return FastPow((b * b) % mod, pow / 2, mod);\n return (FastPow(b, pow - 1, mod) * b) % mod;\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n \n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _13d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static int mod = 1000 * 1000 * 1000 + 7;\n static void mult(long[,] a, long[,] b, long[,] res, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n res[i, j] = 0;\n for (int k = 0; k < n; k++)\n {\n res[i, j] += a[i, k] * b[k, j];// % mod;\n //res[i, j] %= mod;\n }\n }\n }\n }\n\n static void copy(long[,] from, long[,] to, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int k = 0; k < n; k++)\n {\n to[i, k] = from[i, k];\n }\n }\n }\n\n static void pow(long[,] a, long p, int n)\n {\n var temp = new long[n, n];\n var res = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n res[i, i] = 1;\n }\n\n while (true)\n {\n var rem = p % 2;\n if (rem == 1)\n {\n mult(res, a, temp, n);\n copy(temp, res, n);\n }\n\n if (p == 1)\n {\n break;\n }\n\n p /= 2;\n mult(a, a, temp, n);\n copy(temp, a, n);\n }\n\n copy(res, a, n);\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readLongArray();\n var a = d[0];\n var b = d[1];\n var n = d[2];\n var x = d[3];\n\n var mm = new long[2, 2];\n mm[0, 0] = a;\n mm[0, 1] = b;\n mm[1, 0] = 0;\n mm[1, 1] = 1;\n\n pow(mm, n, 2);\n\n var res = x * mm[0, 0] % mod + mm[0, 1];\n Console.WriteLine(res);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _13d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static int mod = 1000 * 1000 * 1000 + 7;\n static void mult(long[,] a, long[,] b, long[,] res, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n res[i, j] = 0;\n for (int k = 0; k < n; k++)\n {\n res[i, j] += a[i, k] * b[k, j] % mod;\n res[i, j] %= mod;\n }\n }\n }\n }\n\n static void copy(long[,] from, long[,] to, int n)\n {\n for (int i = 0; i < n; i++)\n {\n for (int k = 0; k < n; k++)\n {\n to[i, k] = from[i, k];\n }\n }\n }\n\n static void pow(long[,] a, long p, int n)\n {\n var temp = new long[n, n];\n var res = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n res[i, i] = 1;\n }\n\n while (true)\n {\n var rem = p % 2;\n if (rem == 1)\n {\n mult(res, a, temp, n);\n copy(temp, res, n);\n }\n\n if (p == 1)\n {\n break;\n }\n\n p /= 2;\n mult(a, a, temp, n);\n copy(temp, a, n);\n }\n\n copy(res, a, n);\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readLongArray();\n var a = d[0];\n var b = d[1];\n var n = d[2];\n var x = d[3];\n\n var mm = new long[2, 2];\n mm[0, 0] = a;\n mm[0, 1] = b;\n mm[1, 0] = 0;\n mm[1, 1] = 1;\n\n pow(mm, n, 2);\n\n var res = x * mm[0, 0] % mod + mm[0, 1];\n Console.WriteLine(res);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.D_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class IteratedLinearFunctionECR13\n {\n private static int _mod = (int)1e9 + 7;\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n long A = fs.NextLong(), B = fs.NextLong(), n = fs.NextLong(), x = fs.NextLong();\n if (n == 0) writer.WriteLine(x);\n else if (n == 1) writer.WriteLine(A * x + B);\n else\n {\n long[,] initial = new long[,] { { A * x + B, 1 } };\n long[,] factor = new long[,] { { A, 0 }, { B, 1 } };\n long[,] res = MultiplyMatricesMod(initial, BinPowMatrixMod(factor, n - 1, _mod), _mod);\n writer.WriteLine(res[0, 0]);\n }\n }\n }\n public static long BinPow(long a, long p)\n {\n if (p == 0) return 1;\n if ((p & 1) == 0)\n {\n long t = BinPow(a, p / 2);\n return t * t;\n }\n else\n {\n return a * BinPow(a, p - 1);\n }\n }\n public static long BinPowMod(long a, long p, long mod)\n {\n if (p == 0) return 1;\n if ((p & 1) == 0)\n {\n long t = BinPow(a, p / 2);\n return (t * t) % mod;\n }\n else\n {\n return (a % mod * BinPow(a, p - 1)) % mod;\n }\n }\n\n public static long[,] BinPowMatrix(long[,] a, long p) // p >= 1\n {\n if (a.GetLength(0) != a.GetLength(1))\n {\n throw new Exception(\"Not a square matrix\");\n }\n\n if (p == 1) return a;\n if ((p & 1) == 0)\n {\n long[,] t = BinPowMatrix(a, p / 2);\n return MultiplyMatrices(t, t);\n }\n else\n {\n return MultiplyMatrices(a, BinPowMatrix(a, p - 1));\n }\n }\n\n public static long[,] BinPowMatrixMod(long[,] a, long p, long mod) // p >= 1\n {\n if (a.GetLength(0) != a.GetLength(1))\n {\n throw new Exception(\"Not a square matrix\");\n }\n\n if (p == 1) return a;\n if ((p & 1) == 0)\n {\n long[,] t = BinPowMatrixMod(a, p / 2, mod);\n return MultiplyMatricesMod(t, t, mod);\n }\n else\n {\n return MultiplyMatricesMod(a, BinPowMatrixMod(a, p - 1, mod), mod);\n }\n }\n\n private static long[,] MultiplyMatrices(long[,] a, long[,] b)\n {\n if (a.GetLength(1) == b.GetLength(0))\n {\n long[,] c = new long[a.GetLength(0), b.GetLength(1)];\n for (int i = 0; i < c.GetLength(0); i++)\n {\n for (int j = 0; j < c.GetLength(1); j++)\n {\n c[i, j] = 0;\n for (int k = 0; k < a.GetLength(1); k++)\n c[i, j] = c[i, j] + a[i, k] * b[k, j];\n }\n }\n return c;\n }\n else\n {\n throw new Exception(\"Can't multiply because of incompatible sizes\");\n }\n }\n\n private static long[,] MultiplyMatricesMod(long[,] a, long[,] b, long mod)\n {\n if (a.GetLength(1) == b.GetLength(0))\n {\n long[,] c = new long[a.GetLength(0), b.GetLength(1)];\n for (int i = 0; i < c.GetLength(0); i++)\n {\n for (int j = 0; j < c.GetLength(1); j++)\n {\n c[i, j] = 0;\n for (int k = 0; k < a.GetLength(1); k++)\n {\n c[i, j] = c[i, j] + a[i, k] % mod * b[k, j] % mod;\n c[i, j] %= mod;\n }\n }\n }\n return c;\n }\n else\n {\n throw new Exception(\"Can't multiply because of incompatible sizes\");\n }\n }\n\n private static long[,] MatrixMod(long[,] a, long mod)\n {\n long[,] b = new long[a.GetLength(0), a.GetLength(1)];\n for (int i = 0; i < a.GetLength(0); i++)\n {\n for (int j = 0; j < a.GetLength(1); j++)\n {\n b[i, j] = a[i, j] % mod;\n }\n }\n return b;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n private const int MOD = 1000000007;\n\n long ModPow(long x, long p)\n {\n long ret = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = ret * x % MOD;\n x = x * x % MOD;\n p >>= 1;\n }\n return ret;\n }\n\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n long n = ReadLong();\n int x = ReadInt();\n\n if (a == 1)\n {\n Write((x + 1L * n * b) % MOD);\n return;\n }\n\n long ans = x * ModPow(a, n % (MOD - 1));\n ans += (ModPow(a, n % (MOD - 1)) + MOD - 1) % MOD * ModPow(a - 1, MOD - 2) % MOD * b;\n Write(ans % MOD);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n long A, B, n, x;\n sc.Make(out A, out B, out n, out x);\n ModInt res = ModInt.Pow(A, n);\n res += B * (1 - ModInt.Pow(A, n)) / (1 - A);\n WriteLine(res);\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac;//i!\n private static ModInt[] inv;//1/i\n private static ModInt[] facinv;//1/(i!)\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = 1;\n fac[0] = fac[1] = 1;\n facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(ModInt n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(ModInt n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(ModInt n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(ModInt n, ModInt r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n var calc = fac[n];\n calc = calc * facinv[r];\n calc = calc * facinv[n - r];\n return calc;\n }\n}\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n long A, B, n, x;\n sc.Make(out A, out B, out n, out x);\n ModInt res = ModInt.Pow(A, n)*x;\n res += B * (1 - ModInt.Pow(A, n)) / (1 - A);\n WriteLine(res);\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac;//i!\n private static ModInt[] inv;//1/i\n private static ModInt[] facinv;//1/(i!)\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = 1;\n fac[0] = fac[1] = 1;\n facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(ModInt n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(ModInt n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(ModInt n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(ModInt n, ModInt r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n var calc = fac[n];\n calc = calc * facinv[r];\n calc = calc * facinv[n - r];\n return calc;\n }\n}\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}], "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(n / 2);\n else\n Console.WriteLine(-(n + 1) / 2);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Int64 n=Int64.Parse(input);\n if (n % 2 == 0)\n {\n Console.WriteLine(n / 2);\n }\n else\n {\n Console.WriteLine(-1*(n / 2 + 1));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code_Forces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n if (n%2==0)\n Console.WriteLine(n/2);\n else\n Console.WriteLine(-(n/2+1));\n\n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Program\n {\n // \u2605\u2606\u2605\u2606\u2605TYUPI\u2606\u2605\u2606\u2605\u2606\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output.txt\");\n private static readonly StreamReader reader = new StreamReader(\"input.txt\");\n#endif\n\n\n static void Main(string[] args)\n {\n // StreamReader objReader = new StreamReader(\"input.txt\");\n // reader = new StreamReader(\"input.txt\");\n \n //int[] raod = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n long Rao =long.Parse( reader.ReadLine());\n \n\n\n if (Rao % 2 == 0)\n {\n\n writer.WriteLine(Rao/2);\n writer.Flush();\n }\n else\n {\n writer.WriteLine((Rao /2)-Rao);\n writer.Flush();\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long ans = 0;\n long a = Convert.ToInt64(Console.ReadLine());\n ans -= a / 2;\n if (a % 2 == 0)\n {\n ans *= -1;\n }\n else {\n ans -= 1;\n }\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _486A\n{\n class Program\n {\n static void Main()\n { \n var n = long.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 : -(n + 1) / 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TestPlace\n{\n class Program\n {\n static void Main(string[] args)\n {\n var value = Convert.ToInt64(Console.ReadLine());\n if(value%2==0)\n Console.WriteLine(value/2);\n else\n Console.WriteLine((value - 1)/2-value);\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n double n = double.Parse(Console.ReadLine());\n if (n%2==0)\n {\n Console.WriteLine(Math.Truncate(n/2));\n }\n else\n {\n Console.WriteLine(Math.Truncate(n/2)-n);\n } \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Program\n{\n static void Main(string[] args)\n {\n long N = long.Parse(Console.ReadLine());\n if (N % 2 == 0)\n {\n Console.WriteLine(N / 2);\n }\n else\n {\n Console.WriteLine((N - 1) / 2 - N);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace CF_277\n{\n\tclass A_277\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//string[] ss = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t//int a = int.Parse(ss[0]);\n\t\t\t//int b = int.Parse(ss[1]);\n\t\t\t//string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tlong n = long.Parse(Console.ReadLine());\n\t\t\tlong sign = n % 2 == 0 ? 1 : -1;\n\t\t\tlong mod = (n + 1) / 2;\n\t\t\tlong ret = sign * mod;\n\t\t\tConsole.WriteLine(ret);\n\n//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nclass DELETEME\n{\n static void Main()\n {\n var n = Int64.Parse(Console.ReadLine());\n var count = n / 2 + n % 2;\n var a = (1 + (count - 1)) * count;\n var b = (2 + (n - count - 1)) * (n - count);\n Console.WriteLine(b - a);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\n\n\n\n\t\t\tlong n = Convert.ToInt64(Console.ReadLine());\n\n\t\t\tif (n % 2 == 0) Console.WriteLine(n / 2);\n\n\t\t\telse Console.WriteLine((-(n + 1) / 2));\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AA\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a;\n a = Console.ReadLine();\n Int64 b = Convert.ToInt64(a);\n if (b % 2 != 0)\n Console.Write('-');\n Console.WriteLine(b / 2 + b % 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class Test\n {\n public static void Main()\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(n/2);\n }\n else\n {\n \n Console.WriteLine(-n/2-1);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Class32\n {\n public static void Main()\n {\n long a = long.Parse(Console.ReadLine());\n long f = 0;\n if (a % 2 == 1)\n f = -((a + 1) / 2);\n else\n f = a / 2;\n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Function {\n class Program {\n static void Main(string[] args) {\n long input = Int64.Parse(Console.ReadLine());\n if(input % 2 == 0) {\n Console.WriteLine(input / 2);\n return;\n }\n Console.WriteLine(-(input + 1) /2);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n //string[] str = Console.ReadLine().Split();\n long number = long.Parse(Console.ReadLine());\n long find = 0;\n\n if (number % 2 != 0)\n find = -(number / 2 + 1);\n else find = number / 2;\n\n Console.WriteLine(find);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ACalculatingFunction\n{\n class Program\n {\n public static long Func(long number)\n {\n if (number % 2 == 1)\n {\n return -(number + 1) / 2;\n }\n else\n {\n return number / 2;\n }\n }\n\n static void Main(string[] args)\n {\n var number = long.Parse(Console.ReadLine());\n Console.WriteLine(Func(number));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine()),nE,nO;\n nE = n / 2;\n nO = (n % 2 == 0) ? n/2 : (n/2)+1;\n Console.WriteLine(( nE * (nE + 1)) - (nO*nO));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Net.NetworkInformation;\n\nnamespace ConsoleApp2\n{\n public class Solution\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n Console.WriteLine(n % 2 == 0 ? n / 2 : -(n / 2 + 1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nclass Program\n{\n public static void Main(string[] args)\n {\n long inp = Convert.ToInt64(Console.ReadLine());\n if(inp%2==0)\n Console.WriteLine(inp/2);\n else\n Console.WriteLine(-inp/2 - 1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long a = Convert.ToInt64(Console.ReadLine());\n long suma;\n if (a % 2 == 0)\n {\n long b = Convert.ToInt64(a / 2);\n suma = b * (b + 1) - (b * b);\n }\n else\n {\n long b = Convert.ToInt64((a + 1) / 2);\n suma = (b - 1) * b - (b * b);\n }\n Console.WriteLine(suma); \n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long a = Convert.ToInt64(Console.ReadLine());\n long suma;\n if (a % 2 == 0)\n {\n long b = Convert.ToInt64(a / 2);\n suma = b * (b + 1) - (b * b);\n }\n else\n {\n long b = Convert.ToInt64((a + 1) / 2);\n suma = (b - 1) * b - (b * b);\n }\n Console.WriteLine(suma); \n } \n }\n}\n"}, {"source_code": "using System;\n\nnamespace resh\n{\n\tclass Program\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tlong n=long.Parse(Console.ReadLine());\n\t\t\tlong f=0;\n if (n%2==0) f=n/2;\n else f=(n-1)/2-n;\n Console.Write(f);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace _486A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tulong n = ulong.Parse(Console.ReadLine());\n\t\t\tConsole.WriteLine(n % 2 == 0 ? (n / 2).ToString() : \"-\" + ((n + 1) / 2).ToString());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FunctionCalculation\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = double.Parse(Console.ReadLine());\n\n double result = 0;\n\n if (Func(n) > 0)\n {\n result = n / 2;\n }\n else\n {\n result = ((n - 1) / 2) - n;\n }\n\n //double result = 0.25 * (2 * Math.Pow(-1, n) * n + Math.Pow(-1, n) - 1);\n\n Console.WriteLine(result);\n }\n\n static double Func(double n)\n {\n return Math.Pow(-1, n) * n;\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Zada4ki\n{\n static void Main()\n {\n long n = Convert.ToInt64(Console.ReadLine());\n long f = 0;\n if (n % 2 == 0) f = n / 2;\n else f = (n - 1) / 2 - n;\n Console.WriteLine(f);\n }\n}"}, {"source_code": "\nusing System;\n\nnamespace CFDay11\n{\n class Program\n {\n static void Main(string[] args)\n\n {\n long n = long.Parse(Console.ReadLine());\n if(n%2==0)\n Console.WriteLine(n/2);\n else\n Console.WriteLine(-(n/2)-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace shangool\n{\n class Program\n {\n /*static int GetInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n static string[] GetArray()\n {\n return Console.ReadLine().Split(' ');\n }*/\n static void Main(string[] args)\n {\n Int64 n;\n n =Int64. Parse(Console.ReadLine());\n if (n % 2 == 0) Console.WriteLine(n / 2);\n else\n {\n n++;\n Console.WriteLine((n / 2)*-1);\n } \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _489A_Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n Int64 input = Int64.Parse(Console.ReadLine());\n\n if (input %2==0)\n {\n Console.WriteLine(input / 2);\n }\n else\n {\n Console.WriteLine((-input - 1) / 2); \n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tlong n = Convert.ToInt64 (Console.ReadLine ());\n\t\t\tlong result = 0;\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tresult = n / 2;\n\t\t\t} else {\n\t\t\t\tresult = -(n + 1) / 2;\n\t\t\t}\n\t\t\tConsole.WriteLine (result);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n long res = 0;\n if (n % 2 == 0)\n res = n / 2;\n else\n res = -(n + 1) / 2;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Collections;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tlong n=long.Parse(Console.ReadLine());\n \n\t\tConsole.WriteLine(n%2==0 ? n/2 : ((n+1)/2)*-1);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CODING_C_SHARP\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long sum = 0;\n if (n % 2 == 0)\n {\n long t = n / 2;\n long f = t - 1;\n sum = t * t + t - f * f - f - n / 2;\n }\n else\n {\n long t = n / 2;\n long f = (n - 1) / 2;\n sum = t * t + t - f * f - f - (n + 1) / 2;\n }\n Console.Write(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces {\n class Program {\n static void Main(string[] args) {\n double number=double.Parse(Console.ReadLine());\n double answer=number%2==0?number/2:(number+1)/-2;\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Calculating_Function\n{\n //Interface\n interface ICalculating_Function\n {\n long CalculateSeries();\n }\n \n \n //Functional Class\n class SeriesCalculation : ICalculating_Function\n {\n public long Num { get; set; }\n\n public long CalculateSeries()\n {\n long res = 0;\n\n if (Num % 2 == 0)\n {\n res = Num / 2;\n }\n else\n {\n res = (Num / 2) + 1;\n res *= (-1);\n }\n return res;\n }\n }\n \n \n //Driver Class\n class Program\n {\n static void Main(string[] args)\n {\n SeriesCalculation cal = new SeriesCalculation();\n \n cal.Num = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(cal.CalculateSeries());\n\n /*long n = Int64.Parse(Console.ReadLine());\n long sum = 0;\n long sum = n / 2;\n\n sum -= (n % 2) * n;\n Console.WriteLine(sum);*/\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(n/2);\n }\n else\n {\n Console.WriteLine(((n-1)/2)+(n*-1));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k=Int32.Parse(Console.ReadLine());\n int l=Int32.Parse(Console.ReadLine());\n int m=Int32.Parse(Console.ReadLine());\n int n=Int32.Parse(Console.ReadLine());\n int d=Int32.Parse(Console.ReadLine());\n int sum=0;\n \n for (int i = 1; i <= d; i++) {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n sum++;\n }\n Console.WriteLine(sum);\n }\n static void Z236A ()\n {\n string str=Console.ReadLine();\n int n=0;\n string ne=\"\";\n bool k;\n for (int i = 0; i < str.Length; i++) {\n k=false;\n for (int j = 0; j < ne.Length; j++) {\nif (str[i]==ne[j]) {\n k=true;\n }\n }\n if (!k) {\n ne+=str[i];\n n++;\n }\n }\n if (n%2==0) {\n Console.WriteLine(\"CHAT WITH HER!\");\n }\n else {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n static int gdc (int left,int right) \n {\n while (left>0&&right>0) {\n if (left>right) {\n left%=right;\n }\n else\n right%=left;\n }\n return left+right;\n }\n static void Z119A ()\n {\n string[]str=Console.ReadLine().Split(' ');\n int[] ab=new int[2];\n\n ab[0]=Int32.Parse(str[0]);\n ab[1]=Int32.Parse(str[1]);\n int n=Int32.Parse(str[2]);\n int i=0;\n int m;\n while (true) {\n if(n==0)\n {\n Console.WriteLine((i+1)%2);\n return;\n }\n m=gdc(ab[i],n);\n n-=m;\n i=(i+1)%2;\n\n }\n\n }\n static void Z110A ()\n {\n string str=Console.ReadLine();\n int n=0;\n for (int i = 0; i < str.Length; i++) {\n if (str[i]=='4'||str[i]=='7') {\n n++;\n }\n }\n if (n==4||n==7) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n static void Z467A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int res=0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs=Console.ReadLine().Split(' ');\n if (Int32.Parse(strs[1])-Int32.Parse(strs[0])>=2) {\n res++;\n }\n }\n Console.WriteLine(res);\n }\n static void Z271A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int []ye=new int[4];\n n++;\n for (int i = 0; i < 4; i++) {\n ye[i]=n/1000;\n n%=1000;\n n*=10;\n }\n bool flag=true;\n while (flag) {\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < i; j++) {\n if(ye[i]==ye[j])\n {\n ye[i]++;\n \n for (int k = i+1; k < 4; k++) {\n ye[k]=0;\n }\n i--;\n }\n }\n }\n flag=false;\n for (int i = 1; i < 4; i++) {\n if(ye[i]==10)\n {\n ye[i]%=10;\n ye[i-1]++;\n flag=true;\n }\n }\n }\n for (int i = 0; i < 4; i++) {\n Console.Write(ye[i]);\n }\n \n }\n static void Z58A ()\n {\n string str=Console.ReadLine();\n str.ToLower();\n string sstr=\"hello\";\n int j=0;\n for (int i = 0; i < str.Length; i++) {\n if(sstr[j]==str[i])\n j++;\n if (j==sstr.Length) {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n static void Z472A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n if (n%2==0) {\n Console.Write(\"4 \");\n Console.Write(n-4);\n }\n else {\n Console.Write(\"9 \");\n Console.Write(n-9);\n }\n }\n static void Z460A ()\n {\n int res=0;\n int days=0;\n string[] strs=Console.ReadLine().Split(' ');\n int nosk=Int32.Parse(strs[0]);\n int nd=Int32.Parse(strs[1]);\n while (nosk!=0) {\n days+=nosk;\n res+=nosk;\n nosk=0;\n nosk=days/nd;\n days%=nd;\n }\n Console.Write(res);\n }\n static void Z379A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n int a=Int32.Parse(strs[0]);\n int b=Int32.Parse(strs[1]);\n int ogaroks=0;\n int h=0;\n while (a!=0) {\n h+=a;\n ogaroks+=a;\n a=ogaroks/b;\n ogaroks%=b;\n }\n Console.WriteLine(h);\n }\n static bool IsLucky (int n)\n {\n while (n>0) {\n int m=n%10;\n if (m!=4&&m!=7) {\n return false;\n }\n n/=10;\n }\n return true;\n }\n static void Z122A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n for (int i = 2; i <= n; i++) {\n if (n%i==0&&IsLucky(i)) {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n static void Z136A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int[] pod=new int[n];\n string[] strs=Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++) {\n pod[Int32.Parse(strs[i])-1]=i+1;\n }\n for (int i = 0; i < n; i++) {\n Console.Write(pod[i].ToString()+\" \");\n }\n }\n static void Z228A ()\n {\n string[]strs=Console.ReadLine().Split(' ');\n List n=new List();\n for (int i = 0; i < 4; i++) {\n bool flag=true;\n for (int j = 0; j < n.Count; j++) {\n if(Int32.Parse(strs[i])==n[j])\n {\n flag=false;\n break;\n }\n }\n if (flag) {\n n.Add(Int32.Parse(strs[i]));\n }\n }\n Console.WriteLine(4-n.Count);\n }\n static void Z263A ()\n {\n string[]strs;\n int x=0,y=0;\n for (int i = 0; i < 5; i++) {\n strs=Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++) {\n if (strs[j]==\"1\") {\n x=j+1;\n y=i+1;\n }\n }\n\n }\n Console.WriteLine((Math.Abs(3-x)+Math.Abs(3-y)));\n }\n static void Z266B ()\n {\n string[]strs=Console.ReadLine().Split(' ');\n int n=Int32.Parse(strs[0]);\n int t=Int32.Parse(strs[1]);\n string str=Console.ReadLine();\n char[] chs=new char[str.Length];\n for (int i = 0; i < str.Length; i++) {\n chs[i]=str[i];\n }\n for (int i = 0; i < t; i++) {\n int j=0;\n while(j+1rost[max])\n max=i;\n }\n int sum=0;\n while (max!=0) {\n int temp=rost[max];\n rost[max]=rost[max-1];\n rost[max-1]=temp;\n sum++;\n max--;\n }\n\n\n for (int i = n-1; i >=0; i--) {\n\n if (rost[i] '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication9\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n double sum;\n sum = Math.Ceiling(Convert.ToDouble(n)/2);\n if (n % 2 != 0)\n sum *= -1; \n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n private static long n;\n\n static void Main( string[] args )\n {\n n = init();\n Console.WriteLine(calculationFunction(n));\n //Console.ReadLine();\n\n }\n \n static long init()\n {\n return long.Parse( Console.ReadLine() );\n }\n\n static long calculationFunction( long n )\n {\n if ( (n % 2) == 1 )\n {\n return -1 - (n - 1) / 2;\n }\n else return n / 2;\n }\n \n }\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace YOLO\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n;\n n = Convert.ToInt64(Console.ReadLine());\n if(n%2==0){\n Console.Write(n/2);\n }\n else{\n Console.Write(-((n/2)+1));\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine());\n\n Int64 r = (Int64)Math.Pow(-1, n) * (Int64) Math.Ceiling(n / 2.0) ;\n\n Console.WriteLine(r);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string v_vod = Console.ReadLine();\n Int64 n = Int64.Parse(v_vod);\n if (n % 2 == 0)\n {\n Console.WriteLine(n / 2);\n }\n else\n {\n Console.WriteLine((n - 1) / 2 - n);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = Convert.ToUInt64(Console.ReadLine());\n if(n%2==0)\n {\n //-1 1 -2 2 -3 3 -4 4\n Console.Write(n / 2);\n } else\n {\n Console.Write(\"-\" + (n / 2 + 1));\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem486A {\n class Program {\n static void Main(string[] args) {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n % 2 == 0) {\n long result = n / 2;\n Console.WriteLine(result);\n } else {\n long result = -(n + 1) / 2;\n Console.WriteLine(result);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\n\nnamespace Test1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\t\n\t\t\tlong n = long.Parse (Console.ReadLine());\n\t\t\tif (n % 2 == 0)\n\t\t\t\tConsole.Write (n / 2);\n\t\t\telse\n\t\t\t\tConsole.Write (n / (-2) - 1);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(n / 2);\n else\n Console.WriteLine((n - 1) / 2 - n);\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nstatic class Solution\n{\n public static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n \n if(n % 2 == 1)\n Console.Write('-');\n \n Console.WriteLine((n + 1) / 2);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication52\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine());\n Int64 summ; \n if(n%2 ==1)\n summ = ((n - 1)/ 2) * (1 + n)/2 - ((n + 1)/ 2) * (1 + n)/2 ;\n \n\n else\n summ = n * (2 + n) / 4 - n * (1 + n-1) / 4;\n\n Console.WriteLine(summ);\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _468A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n long floorHalf = (long)(n/2);\n long res = floorHalf * (floorHalf + 1) - (n - floorHalf)*(n - floorHalf);\n \n Console.WriteLine(\"{0}\", res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_486A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n Console.WriteLine(n%2 == 0 ? n/2 : -(n + 1)/2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace CF277\n{\n class Program\n {\n static void Main(string[] args)\n {\n Solution(Console.In, Console.Out);\n }\n\n static void Solution(TextReader sr, TextWriter sw)\n {\n long n = Int64.Parse(sr.ReadLine());\n if (n == 2)\n {\n sw.WriteLine(1);\n return;\n }\n var result = (long) Math.Ceiling((double)n/2);\n sw.WriteLine(n % 2 == 0 ? result : -result);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace def\n{\n public static class Program\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var a = long.Parse(line);\n long sum;\n if (a%2 == 0)\n sum = a/2;\n else\n sum = -a/2 - 1;\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nclass App\n{\n static void Main()\n {\n long num = Convert.ToInt64(Console.ReadLine()), ans;\n if(num % 2 == 0)\n ans = num / 2;\n else\n ans = -(num + 1) / 2;\n Console.WriteLine(ans);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _486A_Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n Decimal n = Convert.ToDecimal(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(n / 2);\n }\n\n else\n {\n Console.WriteLine(-((n + 1) / 2));\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A._Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = Convert.ToInt64(Console.ReadLine());\n if (number % 2 == 0)\n Console.WriteLine(number / 2);\n else\n Console.WriteLine(-(number + 1) / 2);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass program\n{\n static void Main()\n {\n long n = long.Parse(Console.ReadLine()), m=n;\n Console.WriteLine(m-((n>>1)<<1) == 0 ? n>>1 : (n>>1)-m);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041f\u043e\u0434\u0441\u0447\u0451\u0442_\u0444\u0443\u043d\u043a\u0446\u0438\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n Console.WriteLine(fun(n));\n Console.ReadLine();\n }\n\n static long fun(long n)\n {\n if (n % 2 == 0)\n return n / 2;\n else\n return -n / 2 - 1;\n }\n }\n}"}, {"source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.ComponentModel;\n\n\nusing System.Diagnostics;\n\nusing System.Linq;\n\nusing System.Text;\n\n\nusing System.IO;\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tlong n,x;\n\t\tstring a;\na=Console.ReadLine();\nn=Convert.ToInt64(a);\n\t\tif(n%2==1)\n\t\tn=-(n+1)/2;\n\t\telse\n\t\tn=n/2;\n\t\t\n\t\tConsole.Write(n);\n\t\t\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long number = long.Parse(Console.ReadLine());\n Console.WriteLine(number%2==0?number/2:Math.Floor(number/-2.0));\n }\n }\n}"}], "negative_code": [{"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long sumEven = 0;\n long sumOdd = 0;\n long sum = 0;\n sumOdd += (n * n) / 2;\n sumEven += (n * (n + 1)) / 2;\n if ((n % 2) == 0)\n {\n Console.WriteLine(sumEven - sumOdd);\n }\n else\n {\n Console.WriteLine(sumOdd - sumEven);\n }\n\n\n }\n }"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var sumEven = 0;\n var sumOdd = 0;\n var sum = 0;\n sumOdd -= (n * n) / 2;\n sumEven += (n * (n + 1)) / 2; \n \n Console.WriteLine(sumOdd + sumEven);\n\n }\n }"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long ano = 1 + ((n - 1) * 2);\n long ane = 2 + ((n - 1) * 2);\n long oddN = (n * (1 + ano)) / 2;\n long evenN = (n * (2 + ane)) / 2;\n long sum = 0;\n if ((n % 2) == 0)\n {\n sum = ((long)evenN - (long)oddN) / 2;\n }\n else\n {\n sum = ((long)oddN - (long)evenN) / 2;\n }\n\n Console.WriteLine(Math.Round((decimal)sum, MidpointRounding.AwayFromZero));\n\n }\n }"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static char[] SPACE = new[] { ' ' };\n\n static void Main(string[] args)\n {\n#if DEBUG\n using (var input = new StreamReader(\"input.txt\"))\n using (var output = new StreamWriter(\"output.txt\"))\n {\n Console.SetIn(input);\n Console.SetOut(output);\n\n int n = 0;\n do\n {\n Console.WriteLine();\n Console.WriteLine(\"Sample {0}\", ++n);\n Prog();\n } while (Console.ReadLine() == string.Empty);\n }\n#else\n Prog();\n#endif\n }\n\n static int __ptr = 0;\n static string[] __input;\n static int NextInt()\n {\n return int.Parse(__input[__ptr++]);\n }\n static long NextLong()\n {\n return long.Parse(__input[__ptr++]);\n }\n static void ReadTokens(int n)\n {\n __ptr = 0;\n __input = Console.ReadLine().Split(SPACE, n);\n }\n\n //\n\n static void Prog()\n {\n ReadTokens(1);\n long a = NextLong();\n\n long r = (a + a % 2) / 2 * ((a % 2 == 0) ? -1 : 1);\n\n Console.WriteLine(r);\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int i=n;\n int sum = 0;\n int f = 0;\n while (i >4)\n {\n i--;\n sum = sum + i;\n }\n if (n % 2 == 0)\n {\n f = (-1 + 2 - 3 + sum + n);\n }\n else\n {\n f = (-1 + 2 - 3 + sum + (-1*n));\n } \n Console.WriteLine(f);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long sum = 0;\n if (n%2 == 0 )\n {\n sum = n / 2;\n }\n else\n {\n sum = (n +1) / 2;\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication52\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Int64 summ; \n if(n%2 ==1)\n summ = (n-1)*(2 + n-1)/4 - (n+1)*(1+n)/4;\n else\n summ = n * (2 + n) / 4 - n * (1 + n-1) / 4;\n\n Console.WriteLine(summ);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication52\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine());\n Int64 summ; \n if(n%2 ==1)\n summ = (n-1)*(2 + n-1)/4 - (n+1)*(1+n)/4;\n else\n summ = n * (2 + n) / 4 - n * (1 + n-1) / 4;\n\n Console.WriteLine(summ);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_486A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n\n Console.WriteLine(n%2 == 0 ? n : -(n + 1)/2);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n int res = 0;\n if(n%2==0)\n {\n res = (int)(n / 2);\n }\n else\n {\n res =-(int)( n / 2 + 1);\n }\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double res = 0;\n if(n%2==0)\n {\n res = n / 2;\n }\n else\n {\n res =-( n / 2 + 1);\n }\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt32(Console.ReadLine());\n long s = 0;\n for (long i = 1; i < n + 1; i++) {\n s = s + i * ((-1) ^ i);\n }\n\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt32(Console.ReadLine());\n long s = 0;\n for (long i = 1; i < n + 1; i++) {\n s = s + i * (-1) ^ i;\n }\n\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt32(Console.ReadLine());\n long s = 0;\n long sum = 0;\n for (long i = 1; i < n + 1; i++) {\n if (i % 2 == 0) { s = i; }\n else { s = -i; }\n sum = sum + s; \n \n }\n\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n double a = Double.Parse(line);\n double result = 0;\n if (a % 2 == 0)\n {\n result = a / 2;\n }\n else\n {\n result = ((a / 2) + 1) * -1;\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 5;\n Console.WriteLine(n);\n Console.WriteLine(Funcion(n)); \n }\n\n public static int Funcion(int a)\n { \n if (a == 1)\n return -1;\n else\n {\n if (a % 2 == 0)\n return Funcion(a - 1) + a;\n else\n return Funcion(a - 1) - a;\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 4; \n Console.WriteLine(Funcion(n)); \n }\n\n public static int Funcion(int a)\n { \n if (a == 1)\n return -1;\n else\n {\n if (a % 2 == 0)\n return Funcion(a - 1) + a;\n else\n return Funcion(a - 1) - a;\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Funcion(4));\n Console.WriteLine(Funcion(5));\n }\n\n public static int Funcion(int a)\n { \n if (a == 1)\n return -1;\n else\n {\n if (a % 2 == 0)\n return Funcion(a - 1) + a;\n else\n return Funcion(a - 1) - a;\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 4;\n Console.WriteLine(n);\n Console.WriteLine(Funcion(n));\n }\n\n public static int Funcion(int a)\n { \n if (a == 1)\n return -1;\n else\n {\n if (a % 2 == 0)\n return Funcion(a - 1) + a;\n else\n return Funcion(a - 1) - a;\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n if(n%2==0)\n {\n Console.WriteLine(n / 2);\n }\n else\n {\n Console.WriteLine(\"-\" + (n / 2)+1);\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n if(n%2==0)\n {\n Console.WriteLine(n / 2);\n }\n else\n {\n Console.WriteLine(\"-\" + n / 2);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n long arithmSum1n(long n)\n {\n return (1 + n) * n / 2;\n }\n\n void Solve()\n {\n var n = _.NextLong();\n _.WriteLine(-arithmSum1n(n) + 4 * arithmSum1n(n / 2));\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = a[i] + 1;\n if (a[i] % 2 != 0)\n a[i] = -a[i];\n }\n \n int k = 0;\n for (int i = 0; i < n; i++)\n {\n k = k + a[i];\n }\n Console.WriteLine(k);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long ans = -2;\n long a = Convert.ToInt32(Console.ReadLine());\n for (int i = 4; i < a; i++) {\n ans += i;\n }\n if(a % 2 != 0)\n {\n a *= -1;\n }\n ans += a;\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double ans = -2;\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 4; i < a; i++) {\n ans += i;\n }\n ans += Math.Pow(Convert.ToDouble(-1), Convert.ToDouble(a)) * a;\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double ans = -2;\n int a = Convert.ToInt32(Console.ReadLine());\n for (int i = 4; i < a; i++) {\n ans += i;\n }\n ans += Math.Pow(Convert.ToDouble(-1), Convert.ToDouble(a)) * a;\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long ans = 0;\n long a = Convert.ToInt32(Console.ReadLine());\n ans -= a / 2;\n if(a % 2 != 0)\n {\n a *= -1;\n }\n ans += a;\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = 5;//Convert.ToInt32(Console.ReadLine());\n int result = 0;\n\n for (int i = 1; i <= input; i++)\n {\n if ((i & 1) == 1)\n result += (i * -1);\n else\n result += i;\n }\n \n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n int result = input / 2;\n\n if ((input & 1) == 0)\n result = (result + 1) * -1; \n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Program\n{\n static void Main(string[] args)\n {\n uint N = uint.Parse(Console.ReadLine());\n if (N % 2 == 0)\n {\n Console.WriteLine(N / 2);\n }\n else\n {\n Console.WriteLine((N - 1) / 2 - N);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CheckCable\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n CalculateFunction();\n }\n \n static void CalculateFunction()\n {\n long n = Convert.ToInt32(Console.ReadLine());\n long Fx = 0;\n\n if (n % 2 == 0)\n Fx = n / 2;\n else\n Fx = 0 - n / 2;\n Console.WriteLine(Fx);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Issue_486A\n{\n class Program\n {\n public static void Main(string[] args) {\n var num = ReadInt();\n\n var even = (num & 1) == 0;\n var fN = num / 2 + (even ? 0 : 1);\n\n fN = even ? fN : (~fN + 1);\n\n Console.WriteLine(fN);\n }\n\n private static bool IsInputError = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ; \n (symbol != -1) && (symbol != ' '); \n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n if (symbol == 13) {\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Coding\n{\n\n class Program\n {\n\n static long SumOdds(long n)\n {\n long x = (long)(-1 * (Math.Pow(n, 2)));\n return x;\n }\n\n static long SumEven(long n)\n {\n long x = n * (n+1);\n\n return x;\n }\n static void Main(string[] args)\n {\n long result;\n long n = long.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n result = SumOdds(n / 2) + SumEven(n / 2);\n else\n result = SumOdds(n / 2 + 1) + SumEven(n / 2);\n\n Console.WriteLine(result);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Coding\n{\n\n class Program\n {\n\n static long SumOdds(long n)\n {\n long x = (long)(-1 * (Math.Pow(n, 2)));\n return x;\n }\n\n static long SumEven(long n)\n {\n long x = n * (n+1);\n\n return x;\n }\n static void Main(string[] args)\n {\n long result;\n long n = long.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n result = SumOdds(n / 2) + SumEven(n / 2);\n else\n {\n decimal d = n;\n d = Math.Ceiling(d / 2);\n result = SumOdds((long)d) + SumEven(n / 2);\n }\n \n\n Console.WriteLine(result);\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Coding\n{\n\n class Program\n {\n\n static long SumOdds(long n)\n {\n long x = (long)(-1 * (Math.Pow(n, 2)));\n return x;\n }\n\n static long SumEven(long n)\n {\n long x = n * (n+1);\n\n return x;\n }\n \n static void Main(string[] args)\n {\n long result;\n long n = long.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n result = SumOdds(n / 2) + SumEven(n / 2);\n else\n {\n decimal d = n;\n d = Math.Ceiling(d / 2);\n result = SumOdds((long)d) + SumEven(n / 2);\n }\n \n\n Console.WriteLine(result);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace calculation_function\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n double a;\n if (n % 2 == 0)\n {\n a = (-1 + (2 - 3) + Math.Pow(-1, n) * n);\n Console.WriteLine(a);\n }\n\n else\n {\n a = (-1 + (2 - 3) -( Math.Pow(-1, n) * n)-(n+1));\n Console.WriteLine(a);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace calculation_function\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n double a;\n if (n % 2 == 0)\n {\n a = (-1 + (2 - 3) + Math.Pow(-1, n) * n);\n Console.WriteLine(a);\n }\n\n else\n {\n a = (-1 + (2 - 3) +(n-1)+ ( Math.Pow(-1, n) * n));\n Console.WriteLine(a);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace calculation_function\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n double a=0;\n double c=0;\n if (n % 2 == 0)\n {\n a = (-1 + (2 - 3) + Math.Pow(-1, n) * n);\n Console.WriteLine(a);\n }\n\n else if(n>4)\n {\n \n for (int i = 1; i <= n; i++)\n {\n a = 4 + (Math.Pow(-1, n) * n);\n }\n Console.WriteLine((-2+a));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] Str = Console.ReadLine().ToCharArray();\n\n string Strok = \"\";\n int n = 0;\n bool answer = false;\n\n if (Str.Length > 8)\n {\n for (int i = 0; i < 8; i++)\n {\n Strok = Strok + Str[i];\n }\n answer = true;\n n = Str.Length - 8;\n }\n else\n {\n Strok = new string(Str);\n }\n int value = Convert.ToInt32(Strok);\n\n if (value % 2 == 0)\n value = value / 2;\n else\n value = (-1) * (value + 1) / 2;\n\n \n Strok = value.ToString();\n\n for (int i = 0; i < n; i++)\n Strok = Strok + '0';\n\n Console.WriteLine(Strok);\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Pow(-1, n) * (n + 1) / 2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF486A\n{\n class Program\n {\n static void Main(string[] args)\n {\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n Console.WriteLine(int.Parse(Console.ReadLine()) / 2);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CalculatingFunction\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = Convert.ToDouble(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(n/2);\n }\n else\n {\n Console.WriteLine(-(n - n/2));\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n double n = double.Parse(Console.ReadLine());\n if (n%2==0)\n {\n Console.WriteLine(n/2);\n }\n else\n {\n Console.WriteLine((n/2)-n);\n } \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\n\n\t\t\tdouble n = Convert.ToInt32(Console.ReadLine());\n\n\t\t\tif (n % 2 == 0) Console.WriteLine(n - 2);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-n+2);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace myApp {\n class Program {\n static void Main (string[] args) {\n int a = int.Parse(Console.ReadLine());\n Console.WriteLine((a / 2 + 1) * (-1 * a%2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace hamtinhtoan\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a=long.Parse(Console.ReadLine()),b=0;\n object s;\n if (a == 1) Console.WriteLine(-1);\n else\n {\n if (a % 2 == 0)\n {\n b = a;\n a -= 1;\n }\n else if (a % 2 == 1)\n {\n b = a - 1;\n }\n s = (a + 1) * ((a - 1) / 2 + 1)/2 * (-1) + (b + 2) * ((b - 2) / 2 + 1)/2;\n Console.WriteLine(s);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace hamtinhtoan\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a=long.Parse(Console.ReadLine()),b=0, s=0;\n if (a == 1) Console.WriteLine(-1);\n else\n {\n if (a % 2 == 0)\n {\n b = a;\n a -= 1;\n }\n else if (a % 2 == 1)\n {\n b = a - 1;\n }\n s = (a + 1) * ((a - 1) / 2 + 1)/2 * (-1) + (b + 2) * ((b - 2) / 2 + 1)/2;\n Console.WriteLine(s);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code7.Tamrin\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n\n Console.WriteLine((n % 2 == 0)?n/2 : (-1) * (n / 2)+1) ;\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code7.Tamrin\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n\n Console.WriteLine((n % 2 == 0)?n/2 : (-1) * n / 2) ;\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n \npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tlong f = long.Parse(Console.ReadLine());\n \n\t\tif(f==1)\n\t\t{\n\t\t\tConsole.WriteLine(-1);\n\t\t}\n\t\tif(f % 2 == 0)\n\t\t{\n\t\t\tConsole.WriteLine(f/2);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine((f+1)/2*(-1));\t\n\t\t\t\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n \n class Program\n {\n static void Main(string[] args)\n {\n \n \n double n=Convert.ToDouble(Console.ReadLine());\n if (n % 2 == 0)\n {\n n = n / 2;\n }\n else if (n % 2 != 0)\n {\n n = (n / 2) - n;\n }\n Console.Write(n);\n \n\n\n\n }\n }\n"}, {"source_code": "using System;\n\nnamespace Calculating_Function\n{\n class Program\n {\n static void Main(string[] args)\n {\n SeriesCalculation cal = new SeriesCalculation();\n \n cal.Num = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(cal.CalculateSeries());\n }\n }\n \n \n class SeriesCalculation : ICalculating_Function\n {\n public int Num { get; set; }\n\n public double CalculateSeries()\n {\n int eNum = 0;\n int oNum = 0;\n\n if (Num % 2 == 0)\n {\n eNum = Num / 2;\n oNum = Num / 2;\n }\n else\n {\n eNum = Num / 2;\n oNum = (Num / 2) + 1;\n }\n\n double oddNum = Math.Pow(oNum,2);\n double evNum = eNum * (eNum + 1);\n\n double res = evNum - oddNum;\n\n return res;\n }\n }\n \n \n interface ICalculating_Function\n {\n double CalculateSeries();\n }\n \n}\n"}, {"source_code": "using System;\n\nnamespace Calculating_Function\n{\n //Driver Class\n class Program\n {\n static void Main(string[] args)\n {\n SeriesCalculation cal = new SeriesCalculation();\n \n cal.Num = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(cal.CalculateSeries());\n }\n }\n \n //Interface\n interface ICalculating_Function\n {\n double CalculateSeries();\n }\n \n \n //Main Functional Class\n class SeriesCalculation : ICalculating_Function\n {\n public double Num { get; set; }\n\n public double CalculateSeries()\n {\n double eNum = 0;\n double oNum = 0;\n\n if (Num % 2 == 0)\n {\n eNum = Num / 2;\n oNum = Num / 2;\n }\n else\n {\n eNum = Num / 2;\n oNum = (Num / 2) + 1;\n }\n\n double oddNum = Math.Pow(oNum,2);\n double evNum = eNum * (eNum + 1);\n\n double res = evNum - oddNum;\n\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Calculating_Function\n{\n //Driver Class\n class Program\n {\n static void Main(string[] args)\n {\n SeriesCalculation cal = new SeriesCalculation();\n \n cal.Num = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(cal.CalculateSeries());\n }\n }\n \n //Interface\n interface ICalculating_Function\n {\n int CalculateSeries();\n }\n \n \n \n //Main Functional Class\n class SeriesCalculation : ICalculating_Function\n {\n public double Num { get; set; }\n\n public int CalculateSeries()\n {\n double eNum = 0;\n double oNum = 0;\n\n if (Num % 2 == 0)\n {\n eNum = Num / 2;\n oNum = Num / 2;\n }\n else\n {\n eNum = Num / 2;\n oNum = (Num / 2) + 1;\n }\n\n double oddNum = Math.Pow(oNum,2);\n double evNum = eNum * (eNum + 1);\n\n double res = evNum - oddNum;\n\n int inRes = (int)Math.Ceiling(res);\n\n return inRes;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n\n if (n % 2 == 1) { result = (n - 1) / 2; }\n else { result = n / 2; }\n\n\n Console.WriteLine(result);\n\n Console.ReadLine();\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Function {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n input = input.Replace(\"-\", \"+\");\n input = input.Remove(0,1);\n string[] inputs = input.Split('+');\n if(inputs.Length % 2 == 0) {\n Console.WriteLine(inputs.Length / 2);\n return;\n }\n Console.WriteLine(-(inputs.Length+1) /2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass Solution\n{\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n long evencount = n/2,oddcount=n/2;\n if (n % 2 == 1) oddcount = (n + 1) / 2;\n long oddsum = (oddcount*(-2+(oddcount-1)*-2))/2;\n long evensum = (evencount * (4 + (evencount - 1) * 2))/2;\n Console.Write(oddsum + evensum);\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass Solution\n{\n static void Main(string[] args)\n {\n decimal n = Convert.ToDecimal(Console.ReadLine());\n decimal evencount = n/2,oddcount=n/2;\n if (n % 2 == 1) oddcount = (n + 1) / 2;\n decimal oddsum = (oddcount*(-2+(oddcount-1)*-2))/2;\n decimal evensum = (evencount * (4 + (evencount - 1) * 2))/2;\n Console.Write(oddsum + evensum);\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nusing static System.Math;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static int Main(string[] args)\n {\n long a=int.Parse(ReadLine());\n if (a % 2 == 0) WriteLine($\"{a/2}\");\n else WriteLine($\"{(a+1)/2*-1-1}\");\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing static System.Console;\nusing static System.Math;\n\nnamespace ConsoleApp8\n{\n class Program\n {\n static int Main(string[] args)\n {\n long a=int.Parse(ReadLine());\n if (a % 2 == 0) WriteLine($\"{a - 2}\");\n else WriteLine($\"{a * -1 + 2}\");\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Double n = Double.Parse(Console.ReadLine());\n Console.WriteLine((Math.Floor(n/2)*(Math.Floor(n/2)+1))-(Math.Pow(Math.Ceiling(n/2),2)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Int64.Parse(Console.ReadLine()),sum,sumE;\n sum=(n*(n+1))/2;\n sumE=((n%2==0)?(n/2)*((n/2)+1):((n-1)/2)*(((n-1)/2)+1));\n Console.WriteLine(sumE+(-1*(sum-sumE)));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n UInt64 n = UInt64.Parse(Console.ReadLine()),nE,nO;\n nE = n / 2;\n nO = (n % 2 == 0) ? n/2 : (n/2)+ 1;\n Console.WriteLine(((nE % 2 == 0) ? (nE * (nE + 1)) : Math.Pow(nE, 2)) - Math.Pow(nO, 2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nclass Program\n{\n public static void Main(string[] args)\n {\n long w = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine((w-2)*(w%2==0?1:-1));\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041f\u043e\u0434\u0441\u0447\u0451\u0442_\u0444\u0443\u043d\u043a\u0446\u0438\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n = Convert.ToInt64(Console.ReadLine());\n Int64 sum = 0;\n if (n % 2 != 0)\n {\n sum = ((n - 1) / 2) - n;\n }\n else\n {\n sum /= 2;\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace Smth\n{\n class Program\n {\n public static void Main()\n {\n var n = long.Parse(Console.ReadLine());\n Console.WriteLine((n / 2 + 1) * (n % 2 == 0 ? 1 : -1));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BulkaProga\n{\n class Program\n {\n static void Main(string[] args)\n {\n long count = long.Parse(Console.ReadLine());\n Console.WriteLine(count / 2 == 0 ? -(count + 1) / 2 : (count + 1) / 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BulkaProga\n{\n class Program\n {\n static void Main(string[] args)\n {\n long count = long.Parse(Console.ReadLine());\n Console.WriteLine(-(count + 1) / 2);\n }\n }\n}"}], "src_uid": "689e7876048ee4eb7479e838c981f068"} {"source_code": "using System;\nclass Program{\n static void Main(){\n var n = Int32.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? (long)Math.Pow(2, n / 2) : 0);\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing SC = Scanner;\n\npublic partial class Solver\n{\n public void Solve()\n {\n var N = sc.Int;\n if (N % 2 == 1) Fail(0);\n Console.WriteLine(1L<<(N/2));\n }\n}\n\n#region Template\npublic partial class Solver\n{\n public SC sc = new SC();\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver();\n int testcase = 1;\n //testcase = sol.sc.Int;\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n while (testcase-- > 0)\n sol.Solve();\n Console.Out.Flush();\n }\n}\npublic static class Template\n{\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Out(this IList A, out T a) => a = A[0];\n public static void Out(this IList A, out T a, out T b) { a = A[0]; b = A[1]; }\n public static void Out(this IList A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }\n public static void Out(this IList A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }\n public static string Concat(this IEnumerable A, string sp) => string.Join(sp, A);\n public static char ToChar(this int s, char begin = '0') => (char)(s + begin);\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static string ToStr(this T[][] A) => A.Select(a => a.Concat(\" \")).Concat(\"\\n\");\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\n\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n%2==1)\n {\n Console.WriteLine(0);\n return;\n }\n int k = n / 2;\n Console.WriteLine(Math.Pow(2, k));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Tr110619\n{\n class Input\n {\n private static IEnumerator getin()\n {\n while(true)\n {\n foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))\n yield return s;\n }\n }\n\n public IEnumerator s = getin();\n\n public string GetString() { s.MoveNext(); return s.Current; }\n\n public int GetInt() { return int.Parse(GetString()); }\n public long GetLong() { return long.Parse(GetString()); }\n public double GetDouble() { return double.Parse(GetString()); }\n }\n\n class Program\n {\n static Input csin = new Input();\n\n static void Main(string[] args)\n {\n int n = csin.GetInt();\n\n Console.WriteLine( (n % 2 == 0) ? (1L << (n >> 1)) : 0 );\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace DynamicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n FillingShapes();\n }\n\n static void FillingShapes()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if((n & 1) == 1)\n Console.WriteLine(0);\n else Console.WriteLine(Math.Pow(2, n/2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace AtTest.CF1182\n{\n class A\n {\n static void Main(string[] args)\n {\n Method(args);\n }\n\n static void Method(string[] args)\n {\n long n = ReadInt();\n if (n % 2 == 1)\n {\n WriteLine(0);\n return;\n }\n\n WriteLine(Pow(2, n / 2));\n }\n\n private static string Read() { return ReadLine(); }\n private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }\n private static int ReadInt() { return int.Parse(Read()); }\n private static long ReadLong() { return long.Parse(Read()); }\n private static double ReadDouble() { return double.Parse(Read()); }\n private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }\n private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }\n private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace AtTest.CF1182\n{\n class A\n {\n static void Main(string[] args)\n {\n Method(args);\n }\n\n static void Method(string[] args)\n {\n long n = ReadInt();\n if (n % 2 == 1)\n {\n WriteLine(0);\n return;\n }\n\n WriteLine(Pow(2, n / 2));\n }\n\n private static string Read() { return ReadLine(); }\n private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }\n private static int ReadInt() { return int.Parse(Read()); }\n private static long ReadLong() { return long.Parse(Read()); }\n private static double ReadDouble() { return double.Parse(Read()); }\n private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }\n private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }\n private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Threading;\n\nnamespace CodeJam\n{\n class Solution1\n {\n static void Main()\n {\n new Thread(new Solution1().run, 64 * 1024 * 1024).Start();\n }\n\n\n int n;\n int answer;\n void ReadData()\n {\n n = NextInt();\n }\n\n void Solve()\n {\n if (n % 2 == 1)\n {\n answer = 0;\n return;\n }\n answer = (int)Math.Pow(2, n / 2);\n }\n\n void WriteAnswer()\n {\n _outputStream.WriteLine(answer);\n }\n\n\n #region ...\n\n void run()\n {\n //Console.SetIn(new StreamReader(Console.OpenStandardInput(), Console.InputEncoding, false, bufferSize: 100024));\n //_inputStream = new StreamReader(File.OpenRead(@\"C:\\Users\\v.lukiantsev\\Downloads\\progresspie.in\"));\n //_outputStream = new StreamWriter(File.OpenWrite(@\"C:\\Users\\v.lukiantsev\\Downloads\\progress_pie.out\"));\n\n _inputStream = Console.In;\n _outputStream = Console.Out;\n\n int testsCount = 1;\n var solvers = new Solution1[testsCount];\n for (int i = 0; i < testsCount; ++i)\n {\n solvers[i] = new Solution1();\n solvers[i].ReadData();\n }\n\n int done = 0;\n for (int i = 0; i < testsCount; ++i)\n {\n solvers[i].Solve();\n Console.Title = (++done).ToString() + \" of \" + testsCount;\n }\n for (int i = 0; i < testsCount; ++i)\n {\n //Out.Write(string.Format(\"Case #{0}: \", i + 1));\n solvers[i].WriteAnswer();\n }\n Out.Flush();\n Out.Close();\n }\n\n static TextWriter Out { get { return _outputStream; } }\n\n private static TextReader _inputStream;\n private static TextWriter _outputStream;\n\n public double NextDouble()\n {\n var token = NextToken();\n if (string.IsNullOrEmpty(token)) throw new ApplicationException(\"Input data missing\");\n return double.Parse(token, CultureInfo.InvariantCulture);\n }\n\n public long NextLong()\n {\n var token = NextToken();\n if (string.IsNullOrEmpty(token)) throw new ApplicationException(\"Input data missing\");\n return long.Parse(token);\n }\n\n public int NextInt()\n {\n var token = NextToken();\n if (string.IsNullOrEmpty(token)) throw new ApplicationException(\"Input data missing\");\n return int.Parse(token);\n }\n\n private static readonly Queue Tokens = new Queue();\n public string NextToken()\n {\n if (Tokens.Count > 0)\n {\n return Tokens.Dequeue();\n }\n while (Tokens.Count == 0)\n {\n var line = _inputStream.ReadLine();\n if (line == null) return null;\n foreach (var token in line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries))\n {\n Tokens.Enqueue(token);\n }\n }\n return Tokens.Count == 0 ? null : Tokens.Dequeue();\n }\n\n private readonly char[] _whiteSpaces = { ' ', '\\r', '\\n', '\\t' };\n\n\n\n \n #endregion\n }\n}"}, {"source_code": "using System;\n\nnamespace st\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if(n % 2 == 1)\n Console.WriteLine(0);\n else\n Console.WriteLine((int)Math.Pow(2, n / 2));\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A.FillingShapes\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var n = uint.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 1? 0 : Pow2(n / 2));\n }\n\n private static int Pow2(uint n)\n {\n var result = 1;\n var currentPow = 2;\n \n while (n > 0)\n {\n if ((n & 1) == 1)\n result *= currentPow;\n \n currentPow *= currentPow;\n n >>= 1;\n }\n\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing Number = System.Int32;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = ri;\n\t\t\tif (n % 2 == 1) Console.WriteLine(0);\n\t\t\telse Console.WriteLine(1L << (n / 2));\n\n\t\t}\n\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\tConsole.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n\t\tvar solver = new Program.Solver();\n\t\tvar t = new System.Threading.Thread(solver.Solve, 10000000);\n\t\tt.Start();\n\t\tt.Join();\n\t\t//solver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n"}, {"source_code": "using System;\nusing CompLib.Util;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n if (n % 2 == 1)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(1L << (n / 2));\n }\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n private static string[] phrase;\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int result = 0;\n\n if (n % 2 == 0)\n {\n result = (int)Math.Pow(2, n / 2);\n }\n\n Console.WriteLine(result);\n\n Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Obrabotka_1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Pow(8);\n int temp = (n*3) % 6;\n if (temp != 0) Console.WriteLine(0);\n else\n {\n temp = (n * 3) / 6;\n long result = Pow(temp);\n Console.WriteLine(result);\n }\n }\n static long Pow(int n)\n {\n long result = 2;\n for(int counter = 2; counter <= n; counter++)\n {\n result *= 2;\n }\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Console;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n Write(n % 2 == 1 ? 0 : (int)Math.Pow(2, n / 2));\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd()\n {\n return reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() =>\n (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() =>\n (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() =>\n (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(1 << n/2);\n }\n else\n Console.WriteLine(0);\n } \n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Codeforces\n{\n\n \n\n\n class MainClass\n {\n static long [] readLongArray()\n {\n\n var stringArrayValues = Console.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n long [] array = new long [stringArrayValues.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = long.Parse(stringArrayValues[i]);\n }\n return array;\n }\n\n \n \n\n static int [] readIntArray()\n {\n\n var stringArrayValues = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] array = new int[stringArrayValues.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = int.Parse(stringArrayValues[i]);\n }\n return array;\n }\n\n static void printArray(int [] array)\n {\n for (int i = 0; i < array.Length-1; i++)\n {\n Console.Write(array[i] + \" \");\n }\n\n Console.WriteLine(array[array.Length - 1]);\n }\n\n\n\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 1)\n {\n Console.WriteLine(0);\n }\n else {\n Console.WriteLine(1<<(n/2));\n }\n \n }\n }\n}\n"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static string Split(this string str, int index = 0, char spliter=' ')\n {\n return str.Split(spliter)[index];\n }\n public static int ToInt(this string str)\n {\n return Convert.ToInt32(str);\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var n = \"4\".ToInt();\n#else\n var n = Console.ReadLine().ToInt();\n\n#endif\n if (n < 2 || n % 2 != 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine(Convert.ToInt32(Math.Pow(2, (n / 2)).ToString()));\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tlong A = long.Parse(Console.ReadLine());\n\t\tlong ans = 0;\n\t\tif(A%2==0){\n\t\t\tans = (long)Math.Pow(2,A/2);\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 2 != 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Math.Pow(2, n / 2));\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = Convert.ToInt32(Console.ReadLine());\n \n if (n==2)\n {\n Console.WriteLine(\"2\");\n }\n else if (n%2==1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(Math.Pow(2,n/2));\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n=long.Parse(Console.ReadLine());\n if(n%2==0)\n Console.WriteLine((Math.Pow(2,n/2)));\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Algorithms\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var result = FillingShapers(n);\n\n Console.WriteLine(result);\n }\n\n private static int FillingShapers(int n)\n {\n if (n < 2) return 0;\n\t\t\t\n if (n % 2 == 1) return 0;\n\n return (int)Math.Pow(2, n / 2);\n }\n\t\t\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Form_Filling\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n if (n % 2 == 1)\n Console.WriteLine(\"0\");\n else\n Console.WriteLine(Math.Pow(2, n / 2));\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(Math.Pow(2, n/2));\n }\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Testonly\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n \n n = System.Convert.ToInt32(Console.ReadLine());\n if (n > 1 && n % 2 == 0)\n Console.WriteLine(Math.Pow(2, n / 2));\n else\n Console.WriteLine(0);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": " using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n if (n%2 == 1)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Math.Pow(2, n / 2));\n }\n\n \n \n\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Filling_Shapes\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n if (n%2 == 0)\n return 1 << (n/2);\n return 0;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\n\n\nnamespace ConsoleApplication1\n{\n \n class Input\n {\n public static void ReadArray(out int[] result)\n {\n result =\n Console\n .ReadLine()\n .Split()\n .Where(s => s.Length > 0)\n .Select(s => int.Parse(s))\n .ToArray();\n }\n \n public static void ReadInt(out int n)\n {\n int[] result =\n Console\n .ReadLine()\n .Split()\n .Where(s => s.Length > 0)\n .Select(s => int.Parse(s))\n .ToArray();\n n = result[0];\n }\n }\n \n \n class Program\n {\n \n \n static void Main()\n {\n int n;\n Input.ReadInt(out n);\n if ((n & 1) != 0)\n {\n Console.WriteLine(0);\n return;\n }\n Console.WriteLine((1 << (n >> 1)));\n\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\n\nstatic class P\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n if (n % 2 == 1)\n {\n Console.WriteLine(0);\n return;\n }\n Console.WriteLine(1L << (n / 2));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(N % 2 != 0){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\tConsole.WriteLine(\"{0}\", 1L <<(N / 2));\n\t\t\n\t}\n\tint N;\n\tpublic Sol(){\n\t\tN = ri();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\n\n\nnamespace Prog\n{\n class Program\n {\n static void Main()\n {\n const int length = 3;\n const int wrongResultCode = 0;\n\n int width = int.Parse(Console.ReadLine());\n int square = width * length;\n\n if (square % 2 == 1)\n {\n Console.WriteLine(wrongResultCode);\n }\n else\n {\n Console.WriteLine(Math.Pow(2, width / 2));\n }\n }\n }\n}"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld : Helpers {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n if (n % 2 == 1) {\n System.Console.WriteLine(0);\n }\n else {\n var x = 1L;\n while (n > 0) {\n x = x * 2L;\n n -= 2;\n }\n System.Console.WriteLine(x);\n }\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic class Helpers {\n public static string Show(IList arr) {\n return string.Join(\" \", arr);\n }\n\n public static void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp38\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long answer = 0;\n if(n%2 == 0)\n {\n answer = (long)Math.Pow(2,n/2);\n }\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforceCSharp\n{\n class Program\n {\n //static Stack dat = new Stack();\n \n\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n if(n%2!=0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Math.Pow(2,n/2));\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n class task: IComparable\n {\n public long type;\n public long t;\n\n public int CompareTo(object obj)\n {\n task second = (task)obj;\n return second.t.CompareTo(this.t);\n }\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if(n % 2 == 1)\n Console.WriteLine(0);\n else\n {\n long result = 1;\n for(int i = 1; i <= n/2; i++)\n {\n result <<= 1;\n }\n Console.WriteLine(result);\n }\n\n }\n }\n}"}, {"source_code": "/* Date: 11.06.2019 * Time: 21:45 */\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\039\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** n = \" + n);\n# endif\n\n\t\tint k = 1;\n\t\tfor ( int i=0; i < n/2; i++ )\n\t\t\tk *= 2;\n\n\t\tif ( n % 2 == 1 )\n\t\t\tk = 0;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int inp = Int32.Parse(Console.ReadLine());\n int res = 0;\n if(inp % 2 == 0)\n {\n res = Int32.Parse(Math.Pow(2, inp / 2).ToString());\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 2 == 0) Console.WriteLine(Math.Pow(2,n/2));\n else Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.IO;\n\nclass MyClass\n{\n public static void Solve()\n {\n var N = int.Parse(Console.ReadLine());\n Console.WriteLine(N % 2 == 0 ? Math.Pow(2, N / 2) : 0);\n }\n\n public static void Main()\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n Solve();\n Console.Out.Flush();\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n\n public partial class Solver\n {\n public void Run()\n {\n var n = ni();\n long ans = 0;\n if (n % 2 == 0)\n {\n ans = 1L << (n / 2);\n }\n cout.WriteLine(ans);\n }\n }\n\n\n\n // PREWRITEN CODE BEGINS FROM HERE\n\n partial class Solver : Scanner\n {\n readonly TextReader cin;\n readonly TextWriter cout;\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader)\n {\n this.cin = reader;\n this.cout = writer;\n }\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer)\n {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n }\n\n public partial class CodeForces\n {\n public static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n Solve();\n Console.Out.Flush();\n#else\n // ------------\n SampleTest(\n inputString: @\"\n\n\",\n outputString: @\"\n\n\");\n while (true) Solve();\n#endif\n\n }\n\n static void Solve(bool autoFlush = true)\n {\n using (var writer = new InvariantCultureStreamWriter(Console.OpenStandardOutput()) { AutoFlush = autoFlush })\n {\n new Solver(Console.In, writer).Run();\n writer.Flush();\n }\n }\n\n public class InvariantCultureStreamWriter : StreamWriter\n {\n public InvariantCultureStreamWriter(Stream stream) : base(stream) { }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n }\n }\n\n public class Scanner\n {\n private readonly TextReader Reader;\n private readonly Queue TokenQueue = new Queue();\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n public Scanner()\n : this(Console.In)\n {\n }\n\n public Scanner(TextReader reader)\n {\n this.Reader = reader;\n }\n\n public int NextInt() { return int.Parse(Next(), ci); }\n public long NextLong() { return long.Parse(Next(), ci); }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size)\n {\n var array = new string[size];\n for (int i = 0; i < size; i++) array[i] = Next();\n return array;\n }\n public int[] NextIntArray(int size)\n {\n var array = new int[size];\n for (int i = 0; i < size; i++) array[i] = NextInt();\n return array;\n }\n\n public long[] NextLongArray(int size)\n {\n var array = new long[size];\n for (int i = 0; i < size; i++) array[i] = NextLong();\n return array;\n }\n\n public double[] NextDoubleArray(int size)\n {\n var array = new double[size];\n for (int i = 0; i < size; i++) array[i] = NextDouble();\n return array;\n }\n\n public string Next()\n {\n if (TokenQueue.Count == 0)\n {\n if (!StockTokens()) throw new InvalidOperationException();\n }\n return TokenQueue.Dequeue();\n }\n\n public bool HasNext()\n {\n if (TokenQueue.Count > 0)\n return true;\n return StockTokens();\n }\n static readonly char[] _separator = new[] { ' ' };\n private bool StockTokens()\n {\n while (true)\n {\n var line = Reader.ReadLine();\n if (line == null) return false;\n var tokens = line.Split(_separator, StringSplitOptions.RemoveEmptyEntries);\n if (tokens.Length == 0) continue;\n foreach (var token in tokens)\n TokenQueue.Enqueue(token);\n return true;\n }\n }\n }\n\n partial class CodeForces\n {\n static void SampleTest(string inputString, string outputString)\n {\n if (String.IsNullOrWhiteSpace(inputString) || String.IsNullOrWhiteSpace(outputString)) return;\n var Inputs = inputString.Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n var Outputs = outputString.Split(new[] { \"------------\" }, StringSplitOptions.None).Select(s => s.Trim()).ToArray();\n int caseNo = 1;\n int all = 0, passed = 0;\n foreach (var sample in Inputs.Zip(Outputs, (Input, Output) => new { Input, Output }))\n {\n var stopWatch = new System.Diagnostics.Stopwatch();\n var writer = new StringWriter(CultureInfo.InvariantCulture);\n stopWatch.Start();\n new Solver(new StringReader(sample.Input), writer).Run();\n stopWatch.Stop();\n string time = \"\";\n if (stopWatch.ElapsedMilliseconds >= 10)\n {\n time = String.Format(\"({0} ms)\", stopWatch.ElapsedMilliseconds);\n }\n var result = writer.ToString().Trim();\n all++;\n if (result == sample.Output)\n {\n Console.WriteLine(\"Sample {0} .... Passed {1}\", caseNo++, time);\n passed++;\n }\n else\n {\n Console.WriteLine(\"Sample {0} .... Failed {1}\", caseNo++, time);\n Console.WriteLine(\"Input : \");\n Console.WriteLine(\"{0}\", sample.Input);\n Console.WriteLine(\"Expected : \");\n Console.WriteLine(\"{0}\", sample.Output);\n Console.WriteLine(\"Received : \");\n Console.WriteLine(\"{0}\", result);\n }\n }\n\n Console.WriteLine(\" {0} / {1} Passed !!\", passed, all);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Console = System.Console;\n\nnamespace ConsoleApp3\n{\n public class problemA566\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 1)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(pow(2, n / 2));\n }\n }\n public static int pow(int a, int exp)\n {\n int res = 1;\n while (exp > 0)\n {\n if (exp % 2 == 1)\n {\n res = (res * a);\n }\n exp /= 2;\n a = (a * a);\n }\n return res;\n }\n\n }\n}\n"}, {"source_code": "// Problem: 1182A - Filling Shapes\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass FillingShapes\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 60)\n return -1;\n uint ans = 0;\n if (n%2 == 0)\n {\n byte numRect = Convert.ToByte (n/2);\n ans = 1;\n for (byte i = 0; i < numRect; i++)\n ans *= 2;\n }\n Console.WriteLine (ans);\n return 0;\n }\n\n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n if (n*3%6==0)\n Console.WriteLine(Math.Pow(2,n*3/6));\n else Console.WriteLine(\"0\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\n\nnamespace Program\n{\n public static class CODEFORCES1\n {\n static public void Solve()\n {\n var n = NextInt;\n if (n % 2 == 1) Console.WriteLine(0);\n else Console.WriteLine(Repeat(2, n / 2).Aggregate((a, x) => a * x));\n }\n\n static public void Main(string[] args)\n {\n if (args.Length == 0)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n }\n Solve();\n Console.Out.Flush();\n }\n static Random rand = new Random();\n static class Console_\n {\n private static Queue param = new Queue();\n public static string NextString()\n {\n if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);\n return param.Dequeue();\n }\n }\n static int NextInt => int.Parse(Console_.NextString());\n static long NextLong => long.Parse(Console_.NextString());\n static double NextDouble => double.Parse(Console_.NextString());\n static string NextString => Console_.NextString();\n static List NextIntList(int N) => Enumerable.Repeat(0, N).Select(_ => NextInt).ToList();\n static List NextLongList(int N) => Enumerable.Repeat(0, N).Select(_ => NextLong).ToList();\n static List NextDoubleList(int N) => Enumerable.Repeat(0, N).Select(_ => NextDouble).ToList();\n static List NextStringList(int N) => Enumerable.Repeat(0, N).Select(_ => NextString).ToList();\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => rand.Next());\n static IEnumerable Repeat(T v, int n) => Enumerable.Repeat(v, n);\n static List Sort(List l) where T : IComparable\n {\n var tmp = l.ToArray(); Array.Sort(tmp); return tmp.ToList();\n }\n static List Sort(List l, Comparison comp) where T : IComparable\n {\n var tmp = l.ToArray(); Array.Sort(tmp, comp); return tmp.ToList();\n }\n static List RevSort(List l) where T : IComparable\n {\n var tmp = l.ToArray(); Array.Sort(tmp, (x, y) => y.CompareTo(x)); return tmp.ToList();\n }\n static List RevSort(List l, Comparison comp) where T : IComparable\n {\n var tmp = l.ToArray(); Array.Sort(tmp, (x, y) => comp(y, x)); return tmp.ToList();\n }\n static IEnumerable Prime(long x)\n {\n if (x < 2) yield break;\n yield return 2;\n var halfx = x / 2;\n var table = new bool[halfx + 1];\n var max = (long)(Math.Sqrt(x) / 2);\n for (long i = 1; i <= max; ++i)\n {\n if (table[i]) continue;\n var add = 2 * i + 1;\n yield return add;\n for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true;\n }\n for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1;\n }\n static IEnumerable Divisor(long x)\n {\n if (x < 1) yield break;\n var max = (long)Math.Sqrt(x);\n for (long i = 1; i <= max; ++i)\n {\n if (x % i != 0) continue;\n yield return i;\n if (i != x / i) yield return x / i;\n }\n }\n static long GCD(long a, long b)\n {\n while (b > 0) { var tmp = b; b = a % b; a = tmp; }\n return a;\n }\n class PQ where T : IComparable\n {\n private List h;\n private Comparison c;\n public PQ(int cap, Comparison c, bool asc = true) { h = new List(cap); this.c = asc ? c : (x, y) => c(y, x); }\n public PQ(Comparison c, bool asc = true) { h = new List(); this.c = asc ? c : (x, y) => c(y, x); }\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n public void Push(T v)\n {\n var i = h.Count;\n h.Add(v);\n while (i > 0)\n {\n var ni = (i - 1) / 2;\n if (c(v, h[ni]) >= 0) break;\n h[i] = h[ni]; i = ni;\n }\n h[i] = v;\n }\n public T Peek => h[0];\n public int Count => h.Count;\n public T Pop()\n {\n var r = h[0];\n var v = h[h.Count - 1];\n h.RemoveAt(h.Count - 1);\n if (h.Count == 0) return r;\n var i = 0;\n while (i * 2 + 1 < h.Count)\n {\n var i1 = i * 2 + 1;\n var i2 = i * 2 + 2;\n if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2;\n if (c(v, h[i1]) <= 0) break;\n h[i] = h[i1]; i = i1;\n }\n h[i] = v;\n return r;\n }\n }\n class PQ where TKey : IComparable\n {\n private PQ> q;\n public PQ(int cap, Comparison c, bool asc = true) { q = new PQ>(cap, (x, y) => c(x.Item1, y.Item1), asc); }\n public PQ(Comparison c, bool asc = true) { q = new PQ>((x, y) => c(x.Item1, y.Item1), asc); }\n public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }\n public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }\n public void Push(TKey k, TValue v) => q.Push(Tuple.Create(k, v));\n public Tuple Peek => q.Peek;\n public int Count => q.Count;\n public Tuple Pop() => q.Pop();\n }\n class Mod\n {\n static public long _mod = 1000000007;\n private long _val = 0;\n public Mod(long x) { _val = x; }\n static public implicit operator Mod(long x) => new Mod(x);\n static public explicit operator long(Mod x) => x._val;\n static public Mod operator +(Mod x) => x._val;\n static public Mod operator -(Mod x) => -x._val;\n static public Mod operator ++(Mod x) => x._val + 1;\n static public Mod operator --(Mod x) => x._val - 1;\n static public Mod operator +(Mod x, Mod y) => (x._val + y._val) % _mod;\n static public Mod operator -(Mod x, Mod y) => ((((x._val - y._val) % _mod) + _mod) % _mod);\n static public Mod operator *(Mod x, Mod y) => (x._val * y._val) % _mod;\n static public Mod operator /(Mod x, Mod y) => (x._val * Inverse(y._val)) % _mod;\n static public bool operator ==(Mod x, Mod y) => x._val == y._val;\n static public bool operator !=(Mod x, Mod y) => x._val != y._val;\n static public bool operator <(Mod x, Mod y) => x._val < y._val;\n static public bool operator >(Mod x, Mod y) => x._val > y._val;\n static public bool operator <=(Mod x, Mod y) => x._val <= y._val;\n static public bool operator >=(Mod x, Mod y) => x._val >= y._val;\n static public Mod Pow(Mod x, long y)\n {\n Mod a = 1;\n while (y != 0)\n {\n if ((y & 1) == 1) a *= x;\n x *= x;\n y >>= 1;\n }\n return a;\n }\n static public long Inverse(long x)\n {\n long b = _mod, r = 1, u = 0, t = 0;\n while (b > 0)\n {\n var q = x / b;\n t = u; u = r - q * u; r = t;\n t = b; b = x - q * b; x = t;\n }\n return r < 0 ? r + _mod : r;\n }\n override public bool Equals(object obj) => obj == null ? false : _val == ((Mod)obj)._val;\n public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;\n public override int GetHashCode() => _val.GetHashCode();\n public override string ToString() => _val.ToString();\n static private List _fact = new List();\n static private List _ifact = new List();\n static private void Build(int n)\n {\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i)\n if (i == 0L) { _fact.Add(1); _ifact.Add(1); }\n else { _fact.Add(_fact[i - 1] * i); _ifact.Add(_ifact[i - 1] * Mod.Pow(i, _mod - 2)); }\n }\n static public Mod Comb(int n, int k)\n {\n Build(n);\n if (n == 0 && k == 0) return 1;\n if (n < k || n < 0) return 0;\n return _ifact[n - k] * _ifact[k] * _fact[n];\n }\n }\n static private List _fact = new List();\n static private void Build(int n)\n {\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i)\n if (i == 0L) _fact.Add(1);\n else _fact.Add(_fact[i - 1] * i);\n }\n static public long Comb(int n, int k)\n {\n Build(n);\n if (n == 0 && k == 0) return 1;\n if (n < k || n < 0) return 0;\n return _fact[n] / _fact[k] / _fact[n - k];\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = long.Parse(input1);\n\t\t\tif (n % 2 > 0) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine((long)Math.Pow(2, (double)n / 2));\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n public class BitSum\n {\n List arr;\n public BitSum(long[] lst)\n {\n if (lst == null)\n {\n throw new ArgumentNullException(nameof(lst));\n }\n arr = Enumerable.Repeat(0L, lst.Length + 1).ToList();\n for (int i = 0; i < lst.Length; i++)\n {\n Add(i, arr[i]);\n }\n }\n\n public BitSum(int n)\n {\n if (n <= 0)\n {\n throw new ArgumentOutOfRangeException(nameof(n));\n }\n arr = Enumerable.Repeat(0L, n + 1).ToList();\n }\n\n public void Add(int index, long val)\n {\n if (index < 0 || index >= arr.Count)\n throw new ArgumentOutOfRangeException(nameof(index));\n index++;\n while (index < arr.Count)\n {\n arr[index] += val;\n index = addLowestBit(index);\n }\n arr[0] += val;\n }\n\n public long GetSum(int index)\n {\n if (index < 0 || index >= arr.Count)\n {\n throw new ArgumentOutOfRangeException(nameof(index));\n }\n\n index++;\n long sum = 0;\n while (index > 0)\n {\n sum += arr[index];\n index = removeLowestBit(index);\n }\n return sum;\n }\n\n public long GetSum(int indexStart, int indexEnd)\n {\n return indexStart > 0 ? GetSum(indexEnd) - GetSum(indexStart - 1) : GetSum(indexEnd);\n }\n\n public int Length\n {\n get\n {\n return this.arr.Count - 1;\n }\n }\n\n private static int removeLowestBit(int i)\n {\n return i - (i & (-i));\n }\n\n private static int addLowestBit(int i)\n {\n return i + (i & (-i));\n }\n }\n\n public class Heap where T : IComparable\n {\n List arr;\n bool isMax;\n\n public Heap(int n, bool isMax = true)\n {\n this.isMax = isMax;\n arr = new List(n);\n }\n\n public Heap(bool isMax = true)\n {\n this.isMax = isMax;\n arr = new List();\n }\n\n private void Heapify(int i)\n {\n var ch1 = 2 * i + 1;\n var ch2 = 2 * i + 2;\n\n if (isMax)\n {\n if (ch2 < arr.Count)\n {\n if (arr[ch2].CompareTo(arr[ch1]) < 0)\n {\n if (arr[i].CompareTo(arr[ch1]) < 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else // arr[ch2] <= arr[ch1]\n {\n if (arr[i].CompareTo(arr[ch2]) < 0)\n {\n Swap(i, ch2);\n Heapify(ch2);\n }\n }\n }\n else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) > 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else\n {\n if (ch2 < arr.Count)\n {\n if (arr[ch2].CompareTo(arr[ch1]) > 0)\n {\n if (arr[i].CompareTo(arr[ch1]) > 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n else // arr[ch2] <= arr[ch1]\n {\n if (arr[i].CompareTo(arr[ch2]) > 0)\n {\n Swap(i, ch2);\n Heapify(ch2);\n }\n }\n }\n else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) < 0)\n {\n Swap(i, ch1);\n Heapify(ch1);\n }\n }\n }\n\n public T Pop()\n {\n if (arr.Count < 1)\n throw new Exception(\"Extracting min from empty heap\");\n var min = arr[0];\n arr[0] = arr[arr.Count - 1];\n arr.RemoveAt(arr.Count - 1);\n Heapify(0);\n return min;\n }\n\n public T Peek()\n {\n if (arr.Count < 1)\n throw new Exception(\"Extracting min from empty heap\");\n var min = arr[0];\n return min;\n }\n\n public int Count()\n {\n return arr.Count;\n }\n\n public void Add(T val)\n {\n if (val == null)\n throw new ArgumentNullException();\n arr.Add(val);\n Up(arr.Count - 1);\n }\n\n\n private void Up(int i)\n {\n while (i > 0)\n {\n var next = (i - 1) / 2;\n if (isMax)\n {\n if (arr[next].CompareTo(arr[i]) < 0)\n {\n Swap(i, next);\n i = next;\n }\n else\n {\n break;\n }\n }\n else\n {\n if (arr[next].CompareTo(arr[i]) > 0)\n {\n Swap(i, next);\n i = next;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n\n private void Swap(int i, int j)\n {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n }\n\n\n public static int Euclidean(int n1, int n2)\n {\n if (n1 == n2) return n1;\n else if (n1 < n2)\n {\n var tmp = n1;\n n1 = n2;\n n2 = tmp;\n }\n\n while (n1 % n2 > 0)\n {\n var tmp = n2;\n n2 = n1 % n2;\n n1 = tmp;\n }\n return n2;\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine().Trim());\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine().Trim());\n }\n\n static long[] readLongs()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(), long.Parse);\n }\n\n static string[] readStrings()\n {\n return Console.ReadLine().Trim().Split();\n }\n\n static string readString()\n {\n return Console.ReadLine().Trim();\n }\n\n static int[] readInts()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n }\n\n static void Output(IEnumerable lst, char delimeter)\n {\n StringBuilder sb = new StringBuilder();\n foreach (var el in lst)\n {\n sb.Append(el);\n sb.Append(delimeter);\n }\n Console.Write(sb);\n }\n\n static List> readEdges(int n)\n {\n List> res = new List>(n);\n for (int i = 0; i < n; i++)\n {\n var arr = readInts();\n res.Add(Tuple.Create(arr[0], arr[1]));\n }\n return res;\n }\n\n static Dictionary> readDicEdges(int n)\n {\n Dictionary> dic =\n new Dictionary>(n);\n for (int i = 0; i < n - 1; i++)\n {\n var arr = readInts();\n var tpl = Tuple.Create(arr[0], arr[1]);\n dic[tpl.Item1] = dic.ContainsKey(tpl.Item1) ? dic[tpl.Item1] : new List();\n dic[tpl.Item2] = dic.ContainsKey(tpl.Item2) ? dic[tpl.Item2] : new List();\n\n dic[tpl.Item1].Add(tpl.Item2);\n dic[tpl.Item2].Add(tpl.Item1);\n }\n return dic;\n }\n\n static void Main(string[] args)\n {\n var n = readInt();\n\n if (n % 2 == 1)\n {\n Console.WriteLine(0);\n }\n else \n {\n Console.WriteLine(1 << (n/2));\n \n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\n// OLYASHAA_FOREVER\n\nclass MainClass\n{\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tint a = int.Parse(Console.ReadLine());\n\t\tif (a % 2 == 1)\n\t\t{\n\t\t\tConsole.Write(\"0\");\n\t\t\treturn;\n\t\t}\n\t\tConsole.WriteLine(Math.Pow(2, a / 2));\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n public class Program\n {\n public static void Main()\n {\n long n = Int64.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(Math.Pow(2, n / 2));\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing SC = Scanner;\n\npublic partial class Solver\n{\n public void Solve()\n {\n var N = sc.Int;\n if (N % 2 == 1) Fail(0);\n Console.WriteLine(N);\n }\n}\n\n#region Template\npublic partial class Solver\n{\n public SC sc = new SC();\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver();\n int testcase = 1;\n //testcase = sol.sc.Int;\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n while (testcase-- > 0)\n sol.Solve();\n Console.Out.Flush();\n }\n}\npublic static class Template\n{\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Out(this IList A, out T a) => a = A[0];\n public static void Out(this IList A, out T a, out T b) { a = A[0]; b = A[1]; }\n public static void Out(this IList A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }\n public static void Out(this IList A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }\n public static string Concat(this IEnumerable A, string sp) => string.Join(sp, A);\n public static char ToChar(this int s, char begin = '0') => (char)(s + begin);\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static string ToStr(this T[][] A) => A.Select(a => a.Concat(\" \")).Concat(\"\\n\");\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\n\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n%2==1)\n {\n Console.WriteLine(0);\n return;\n }\n Console.WriteLine(n);\n }\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static string Split(this string str, int index = 0, char spliter=' ')\n {\n return str.Split(spliter)[index];\n }\n public static int ToInt(this string str)\n {\n return Convert.ToInt32(str);\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var n = \"4\".ToInt();\n#else\n var n = Console.ReadLine().ToInt();\n\n#endif\n if (n < 2 || n % 2 != 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine((n + (n - 4)));\n }\n\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static string Split(this string str, int index = 0, char spliter=' ')\n {\n return str.Split(spliter)[index];\n }\n public static int ToInt(this string str)\n {\n return Convert.ToInt32(str);\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var n = \"4\".ToInt();\n#else\n var n = Console.ReadLine().ToInt();\n\n#endif\n if (n < 2 || n % 2 != 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n Console.WriteLine(n);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint A = int.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(A/2*2);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n=long.Parse(Console.ReadLine());\n if(n%2==0)\n Console.WriteLine(n/2*2);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Algorithms\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var result = FillingShapers(n);\n\n Console.WriteLine(result);\n }\n\n private static int FillingShapers(int n)\n {\n if (n < 2) return 0;\n\n return (int)Math.Pow(2, n / 2);\n }\n\t\t\n\t\t\n }\n}"}, {"source_code": "using System;\n\nnamespace Algorithms\n{\n class Program\n {\n static int[] money = new int[] { 1, 5, 10, 20, 100 };\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n Console.WriteLine(n);\n else\n Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(n);\n }\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n % 2 == 0)\n {\n Console.WriteLine(n);\n }\n else\n Console.WriteLine(n - 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int inp = Int32.Parse(Console.ReadLine());\n int res = 0;\n if(inp*3 % 6 == 0)\n {\n res = 2 * inp*3 / 6;\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n Console.WriteLine(\"Thang ngu\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 2 == 0) Console.WriteLine(n);\n else Console.WriteLine(n - 1);\n }\n }\n}"}, {"source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n if (n*3%6==0)\n Console.WriteLine(n*3/6*2);\n else Console.WriteLine(\"0\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = long.Parse(input1);\n\t\t\tif (n % 2 > 0) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t}\n\t\t}\n\t}\n}\n"}], "src_uid": "4b7ff467ed5907e32fd529fb39b708db"} {"source_code": "using System;\n\npublic class Test\n{\n\t\n\tpublic static void Main()\n\t{\n\t\t// your code goes here\n Int64 n, c1, c2;\n string s1 = Console.ReadLine();\n string[] s2 = new string[10];\n s2 = s1.Split(' ');\n n = Convert.ToInt64(s2[0]);\n c1 = Convert.ToInt64(s2[1]);\n c2 = Convert.ToInt64(s2[2]);\n\n //Console.WriteLine(Convert.ToSingle(c2));\n string s3 = Console.ReadLine();\n\n int i = 0;\n Int64 cnt = 0;\n Int64 ans = 1000000000;\n ans *= ans;\n while (i < n) {\n if (s3[i] == '1'){\n cnt++;\n }\n ++i;\n }\n i = 1;\n while (i <= cnt)\n {\n \t\tInt64 pepC = n, \n\t\t\t\t\tg1C = pepC % i, \n\t\t\t\t\tg2C = i - g1C;\n\t\t\t\tInt64 g1p = pepC / i, \n\t\t\t\t\tg2p = pepC / i - 1;\n\t\t\t\tInt64 res = g1C * (c1 + c2*g1p*g1p) + g2C * (c1 + c2*g2p*g2p);\n\t\t\t\tif (res res)\n {\n ans = res; \n }\n //ans = min(ans, res);\n ++j;\n }\n Console.WriteLine(Convert.ToString(ans));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Numerics;\n\nclass Solution\n{\n\tstatic void Main() {\n\t\tint n,c1,c2;\n\t\tstring[] inp=Console.ReadLine().Split(' ');\n\t\tn=int.Parse(inp[0]);\n\t\tc1=int.Parse(inp[1]);\n\t\tc2=int.Parse(inp[2]);\n\t\tlong res=4611686018427387903L;\n\t\tstring s=Console.ReadLine();\n\t\tint pcnt=0;\n\t\tfor(int i=0;i _ == '1'), min = long.MaxValue;\n for (long count = 1; count <= adults; ++count)\n {\n long sum = n % count * Price(n / count + 1, c1, c2) + (count - n % count) * Price(n / count, c1, c2);\n if (min > sum) min = sum;\n }\n\n Console.WriteLine(min);\n }\n\n private static long Price(long x, long c1, long c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace ForAll\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n\n long n = keys[0];\n long c1 = keys[1];\n long c2 = keys[2];\n\n long Parents = 0;\n\n foreach (char i in Console.ReadLine())\n if (i == '1')\n Parents++;\n long minPrice = Int64.MaxValue;\n for (long i = Parents; i > 0; i--)\n {\n long ost = n % i;\n long group = i;\n long sizeOfGroup = n/i;\n if (ost != 0)\n {\n ost = n - sizeOfGroup * group;\n\n long presum = 0;\n\n presum += F(sizeOfGroup + 1, c1, c2)*ost;\n presum += F(sizeOfGroup, c1, c2)*(group-ost);\n if (minPrice > presum) minPrice = presum;\n }\n else\n {\n long sum = 0;\n sum += F(sizeOfGroup, c1, c2)*group;\n if (minPrice > sum) minPrice = sum;\n }\n\n }\n\n Console.WriteLine(minPrice);\n }\n\n public static long F(long x, long c1, long c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n\n\n\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var terms = Console.ReadLine().Split(new[] { ' ' }).Select(long.Parse).ToArray();\n var n = terms[0];\n var c1 = terms[1];\n var c2 = terms[2];\n\n long adults = Console.ReadLine().Count(_ => _ == '1');\n long children = n - adults;\n var min = long.MaxValue;\n for (long count = children > 0 ? children : 1; count <= adults; ++count)\n {\n long size = n / count;\n long sum = count * Price(size, c1, c2);\n if (n % count != 0) sum += Price(n % count, c1, c2);\n if (sum < min) min = sum;\n }\n Console.WriteLine(min);\n }\n\n private static long Price(long x, long c1, long c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces_charp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n, c1, c2;\n string s1 = Console.ReadLine();\n string[] s2 = new string[10];\n s2 = s1.Split(' ');\n n = Convert.ToInt64(s2[0]);\n c1 = Convert.ToInt64(s2[1]);\n c2 = Convert.ToInt64(s2[2]);\n\n //Console.WriteLine(Convert.ToSingle(c2));\n string s3 = Console.ReadLine();\n\n int i = 0;\n Int64 cnt = 0;\n Int64 ans = 1000000000;\n ans *= ans;\n while (i < n) {\n if (s3[i] == '1'){\n cnt++;\n }\n ++i;\n }\n i = 1;\n while (i < n)\n {\n Int64 res = i * c1;\n Int64 ost = n - i;\n Int64 exist = ost / i;\n Int64 big = ost % i;\n Int64 small = i - big;\n res += c2 * (small * exist * exist + big * (exist + 1) * (exist + 1));\n if (ans > res)\n {\n ans = res;\n }\n //ans = min(ans, res);\n ++i;\n }\n Console.WriteLine(Convert.ToSingle(ans));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces_charp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n, c1, c2;\n string s1 = Console.ReadLine();\n string[] s2 = new string[10];\n s2 = s1.Split(' ');\n n = Convert.ToInt64(s2[0]);\n c1 = Convert.ToInt64(s2[1]);\n c2 = Convert.ToInt64(s2[2]);\n\n //Console.WriteLine(Convert.ToSingle(c2));\n string s3 = Console.ReadLine();\n\n int i = 0;\n Int64 cnt = 0;\n Int64 ans = 1000000000;\n ans *= ans;\n while (i < n) {\n if (s3[i] == '1'){\n cnt++;\n }\n ++i;\n }\n i = 1;\n while (i <= cnt)\n {\n Int64 res = i * c1;\n Int64 ost = n - i;\n Int64 exist = ost / i;\n Int64 big = ost % i;\n Int64 small = i - big;\n res += c2 * (small * exist * exist + big * (exist + 1) * (exist + 1));\n if (ans > res)\n {\n ans = res;\n }\n //ans = min(ans, res);\n ++i;\n }\n Console.WriteLine(Convert.ToSingle(ans));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace ForAll\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n\n int n = keys[0];\n int c1 = keys[1];\n int c2 = keys[2];\n\n int Parents = 0;\n\n foreach (char i in Console.ReadLine())\n if (i == '1')\n Parents++;\n int minPrice = Int32.MaxValue;\n for (int i = Parents; i > 0; i--)\n {\n int ost = n % i;\n int group = i; int sizeOfGroup = (int)Math.Round((double)n / (double)i);\n if (ost != 0)\n {\n group--;\n int j = 0;\n\n ost = n - sizeOfGroup * group;\n\n int presum = 0;\n for (; j < ost; j++)\n {\n presum += F(sizeOfGroup + 1, c1, c2);\n }\n\n\n int ostsum = 0;\n ostsum += F((ost), c1, c2);\n\n for (int k = 1; k <= group; k++)\n {\n ostsum += F(sizeOfGroup, c1, c2);\n }\n\n for (int k = 1; k <= group - j; k++)\n {\n presum += F(sizeOfGroup, c1, c2);\n }\n\n if (minPrice > presum) minPrice = presum;\n else if (minPrice > ostsum) minPrice = ostsum;\n }\n else\n {\n int sum = 0;\n for (int k = 1; k <= group; k++)\n {\n sum += F(sizeOfGroup, c1, c2);\n }\n\n if (minPrice > sum) minPrice = sum;\n }\n\n }\n\n Console.WriteLine(minPrice);\n }\n\n public static int F(int x, int c1, int c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace ForAll\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n\n int n = keys[0];\n int c1 = keys[1];\n int c2 = keys[2];\n\n int Parents = 0;\n\n foreach (char i in Console.ReadLine())\n if (i == '1')\n Parents++;\n int minPrice = Int32.MaxValue;\n for (int i = Parents; i > 0; i--)\n {\n int ost = n % i;\n int group = i;\n int sizeOfGroup = n/i;\n if (ost != 0)\n {\n //group--;\n int j = 0;\n\n ost = n - sizeOfGroup * group;\n\n int presum = 0;\n for (; j < ost; j++)\n {\n presum += F(sizeOfGroup + 1, c1, c2);\n }\n\n for (int k = 1; k <= group - j; k++)\n {\n presum += F(sizeOfGroup, c1, c2);\n }\n\n if (minPrice > presum) minPrice = presum;\n }\n else\n {\n int sum = 0;\n for (int k = 1; k <= group; k++)\n {\n sum += F(sizeOfGroup, c1, c2);\n }\n\n if (minPrice > sum) minPrice = sum;\n }\n\n }\n\n Console.WriteLine(minPrice);\n }\n\n public static int F(int x, int c1, int c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace ForAll\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n\n long n = keys[0];\n long c1 = keys[1];\n long c2 = keys[2];\n\n long Parents = 0;\n\n foreach (char i in Console.ReadLine())\n if (i == '1')\n Parents++;\n long minPrice = Int64.MaxValue;\n for (long i = Parents; i > 0; i--)\n {\n long ost = n % i;\n long group = i;\n long sizeOfGroup = n/i;\n if (ost != 0)\n {\n //group--;\n long j = 0;\n\n ost = n - sizeOfGroup * group;\n\n long presum = 0;\n presum += F(sizeOfGroup + 1, c1, c2) * ost;\n presum+= F(sizeOfGroup, c1, c2)*(group-j);\n\n if (minPrice > presum) minPrice = presum;\n }\n else\n {\n long sum = 0;\n sum+= F(sizeOfGroup, c1, c2)*group;\n if (minPrice > sum) minPrice = sum;\n }\n\n }\n\n Console.WriteLine(minPrice);\n }\n\n public static long F(long x, long c1, long c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace ForAll\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt64);\n\n long n = keys[0];\n long c1 = keys[1];\n long c2 = keys[2];\n\n long Parents = 0;\n\n foreach (char i in Console.ReadLine())\n if (i == '1')\n Parents++;\n long minPrice = Int64.MaxValue;\n for (long i = Parents; i > 0; i--)\n {\n long ost = n % i;\n long group = i;\n long sizeOfGroup = n/i;\n if (ost != 0)\n {\n //group--;\n long j = 0;\n\n ost = n - sizeOfGroup * group;\n\n long presum = 0;\n presum += F(sizeOfGroup + 1, c1, c2) * ost;\n presum+= F(sizeOfGroup, c1, c2)*(group-j-1);\n\n if (minPrice > presum) minPrice = presum;\n }\n else\n {\n long sum = 0;\n sum+= F(sizeOfGroup, c1, c2)*group;\n if (minPrice > sum) minPrice = sum;\n }\n\n }\n\n Console.WriteLine(minPrice);\n }\n\n public static long F(long x, long c1, long c2)\n {\n return c1 + c2 * (x - 1) * (x - 1);\n }\n\n\n\n }\n}"}], "src_uid": "78d013b01497053b8e321fe7b6ce3760"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n public static long NOD(long a, long b)\n {\n while (b != 0)\n b = a % (a = b);\n return a;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] s1 = s.Split(' ');\n long l = long.Parse(s1[0]);\n long r = long.Parse(s1[1]);\n for (long i = l; i<=r;i++)\n for (long j = l+1;j<=r;j++)\n for (long k = l+2;k<=r;k++)\n {\n if ((NOD(i,k)!=1)&&(NOD(i,j)==1)&&(NOD(j,k)==1)&&(i2)\n {\n if(l%2==0)\n Console.WriteLine(\"{0} {1} {2}\\n\",l,l+1,l+2);\n else\n Console.WriteLine(\"{0} {1} {2}\\n\", l + 1, l + 2, l + 3);\n }\n else if(d<2)\n Console.WriteLine(\"-1\\n\");\n else\n {\n if(l%2==0)\n Console.WriteLine(\"{0} {1} {2}\\n\", l, l + 1, l + 2);\n else\n Console.WriteLine(\"-1\\n\"); \n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []In = Console.ReadLine().Split(' ');\n long l = long.Parse(In[0]);\n long r = long.Parse(In[1]);\n for (long i = l; i <= r; i++)\n {\n for (long j = i + 1; j <= r; j++)\n {\n for (long u = i; u < j & __(i, j); u++)\n {\n if (!__(i, u) & !__(u, j)) { Console.WriteLine(\"{0} {1} {2}\", i, u, j); return; }\n }\n }\n }\n Console.WriteLine(-1);\n }\n static bool __(long num1, long num2)\n {\n if (num1 % num2 == 0) return true;\n if (num1 % num2 == 1) return false;\n return __(num2, num1 % num2);\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace Counterexample\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] nums = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n if(nums[0]%2 !=0)\n {\n nums[0]++;\n }\n if(Math.Abs(nums[1]-nums[0])<2)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(\"{0} {1} {2}\",nums[0],nums[0]+1,nums[0]+2);\n }\n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input;\n input = Console.ReadLine();\n string[] inp = input.Split(' ');\n Int64 a = Convert.ToInt64(inp[0]); \n Int64 c = Convert.ToInt64(inp[1]);\n Int64 counter = c - a;\n Boolean breaking = false;\n if (counter >=2 )\n {\n for (Int64 i = 0; i < counter-1 && !breaking; i++)\n {\n for (Int64 j = 0; j < counter-1 && !breaking; j++)\n {\n for (Int64 x = i+1; x < counter-i+1 &&!breaking; x++)\n {\n Int64 o = a + i;\n Int64 u = a + x;\n Int64 q = c - j;\n if (GCD(o,u)==1 && GCD(u, q)==1 && GCD(o,q)!=1)\n { \n breaking = true;\n \n Console.WriteLine(o + \" \" + u + \" \" + q);\n }\n }\n }\n\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n breaking = true;\n }\n if (!breaking)\n {\n Console.WriteLine(\"-1\");\n }\n }\n\n private static Int64 GCD(Int64 a, Int64 b)\n {\n while (a != 0 && b != 0)\n {\n if (a > b)\n a %= b;\n else\n b %= a;\n }\n\n return a == 0 ? b : a;\n }\n }\n}"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b, c = 0;\n var s = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n a = Int64.Parse(s[0]);\n b = Int64.Parse(s[1]);\n for (var i = a; i <= b; i++)\n {\n for(var j = i;j<=b;++j)\n for (var k = j; k <= b; ++k)\n {\n if (GCD(i, j) != 1 || GCD(j, k) != 1 || GCD(i, k) == 1) continue;\n Console.WriteLine(\"{0} {1} {2}\", i, j, k);\n return;\n }\n }\n Console.WriteLine(-1);\n }\n\n public static long GCD(long a, long b)\n {\n while (true)\n {\n if (b == 0) return a;\n var a1 = a;\n a = b;\n b = a1%b;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Test\n{\n public static Dictionary Factors(ulong N)\n {\n ulong max = ((ulong)Math.Sqrt(N)) + 1;\n Dictionary facts = new Dictionary();\n \tfor(ulong n = 2; n * n < N; n++)\n {\n int power = 0;\n while(N % n == 0)\n {\n N = N / n;\n power++;\n }\n if(power > 0)\n facts.Add(n, power);\n }\n return facts;\n }\n\n public static int SmallFacts(ulong N)\n {\n int factorsMask = 0;\n ulong[] primes = {2,3,5,7,9,11,13,17,19,23,29,31,37,41,43,47};\n \tfor(int n = 0; n < primes.Length; n++)\n {\n int pwr = 0;\n while(N % primes[n] == 0)\n {\n \tpwr++; N = N / primes[n]; \n }\n if(pwr > 0) factorsMask |= (1 << n);\n if(N <= 1) break;\n }\n return factorsMask;\n }\n\n public static string PrintMask(int mask)\n {\n string r= \"\";\n for(int i = 0; i < 32; i++)\n r += ((mask & (1 << i)) != 0) ? \"1\" : \"0\";\n return r;\n }\n\n\tpublic static void Main()\n\t{\n\t\tstring[] tok = Console.ReadLine().Split(' ');\n ulong l = UInt64.Parse(tok[0]);\n ulong r = UInt64.Parse(tok[1]);\n \n int D = (int)(r - l) + 1;\n int[] factors = new int[D]; \n for(ulong i = l; i <= r; i++)\n\t\t{\n factors[(int)(i - l)] = SmallFacts(i);\n //Console.WriteLine(\"{0} -> {1}\", i, PrintMask(factors[(int)(i -l)]));\n }\n \n int found = -1;\n for(int i = 0; i < D; i++)\n {\n for(int j = i + 1; j < D; j++)\n {\n if((factors[i] & factors[j]) != 0)\n {\n //Console.WriteLine(\"found {0} and {1}\", i, j);\n \tfor(int k = 1; k < D; k++)\n \t{\n if((k != i) && (k != j) && (factors[k] & factors[i]) == 0 && (factors[k] & factors[j]) == 0)\n {\n Console.WriteLine(\"{0} {1} {2}\", (ulong)i + l, (ulong)k + l, (ulong)j + l);\n return;\n }\n \t}\n }\n }\n }\n Console.WriteLine(\"-1\");\n \n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace Counterexample\n{\n class Program\n {\n\n private static bool isPrime(long k){\n for (long i=2; i<=Math.Sqrt(k); i++){\n if (k%i == 0){\n return false;\n }\n }\n return true;\n }\n\n private static long gcd(long a, long b){\n if (b==0){\n return a;\n }\n return gcd(b, a%b);\n }\n\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.None);\n\n long l = long.Parse(input[0]);\n long r = long.Parse(input[1]);\n\n long a = l, b=0, c=0;\n bool foundB = false, foundC = false;\n\n\n long i = l;\n\n while(i<=r){\n if (foundC){\n break;\n }\n\n a = i;\n long j = a;\n while(j<= r){\n if (gcd(a, j) ==1){\n b = j;\n foundB = true;\n break;\n } \n j++;\n }\n if (foundB){\n long k = b;\n while( k<= r){\n if (gcd(b, k) == 1 && gcd(a, k) > 1){\n c = k;\n foundC = true;\n break;\n } \n k++;\n }\n }\n i++;\n }\n\n if (foundB && foundC){\n Console.WriteLine(a+\" \"+b+\" \"+c);\n }else{\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Counterexample\n{\n class Program\n {\n\n private static long gcd(long a, long b){\n if (b==0){\n return a;\n }\n return gcd(b, a%b);\n }\n\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.None);\n\n long l = long.Parse(input[0]);\n long r = long.Parse(input[1]);\n\n long a = l, b=0, c=0;\n bool foundB = false, foundC = false;\n\n\n long i = l;\n\n while(i<=r){\n if (foundC){\n break;\n }\n\n a = i;\n long j = a;\n while(j<= r){\n if (gcd(a, j) ==1){\n b = j;\n foundB = true;\n break;\n } \n j++;\n }\n if (foundB){\n long k = b;\n while( k<= r){\n if (gcd(b, k) == 1 && gcd(a, k) > 1){\n c = k;\n foundC = true;\n break;\n } \n k++;\n }\n }\n i++;\n }\n\n if (foundB && foundC){\n Console.WriteLine(a+\" \"+b+\" \"+c);\n }else{\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Xml.Xsl;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong l = inputs1[0];\n\t\t\tlong r = inputs1[1];\n\n\t\t\tif (r - l < 2) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (r - l == 2) \n\t\t\t{\n\t\t\t\tif (l % 2 > 0) \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine($\"{l} {l + 1} {l + 2}\");\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (l % 2 > 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine($\"{l + 1} {l + 2} {l + 3}\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine($\"{l} {l + 1} {l + 2}\");\n\t\t\t}\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Counterexample483A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n var line = Console.ReadLine();\n var numbers = line.Split(' ');\n long l = Convert.ToInt64(numbers[0]);\n long r = Convert.ToInt64(numbers[1]);\n if ( l % 2 != 0)\n {\n l++;\n }\n\n if (Math.Abs(r-l) < 2)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(l + \" \" + (l+1) + \" \" + (l + 2));\n }\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A {\n\tstatic void Main() {\n\t\tstring s = Console.ReadLine();\n\t\tstring[] t = s.Split(' ');\n\t\tlong a = Convert.ToInt64(t[0]);\n\t\tlong b = Convert.ToInt64(t[1]);\n\t\tif (a % 2 == 1) a++;\n\t\tif (b-a<=1) {\n\t\t\tConsole.WriteLine(-1);\n\t\t\treturn;\n\t\t}\n\t\tConsole.WriteLine(\"{0} {1} {2}\", a, a+1, a+2);\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] Plustoarray(int[] array, int plus)//changes array and sends new array\n {\n array[array.Length - 1] += plus;\n for (int i = array.Length - 1; i > 0; i--)\n {\n while (array[i] > 9)\n {\n array[i] -= 10;\n array[i - 1]++;\n }\n }\n if (array[0] > 9)\n {\n int[] newarray = new int[array.Length + 1];\n for (int i = 0; i < array.Length; i++)\n {\n newarray[1 + i] = array[i];\n }\n while (newarray[1] > 9)\n {\n newarray[1] -= 10;\n newarray[0]++;\n }\n return newarray;\n }\n else\n return array;\n }\n static void MinusTwoArrays(int[] small, int[] big)//changes big to be big-small\n {\n for (int i = 0; i < small.Length; i++)\n {\n if (small.Length != big.Length)\n big[big.Length - small.Length + i] -= small[i];\n else\n big[i] -= small[i];\n }\n for (int i = 1; i < big.Length; i++)\n {\n if (big[i] < 0)\n {\n big[i] += 10;\n big[i - 1]--;\n }\n }\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string small = \"\", big = \"\";\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n small = s.Substring(0, i);\n big = s.Substring(i + 1);\n break;\n }\n }\n int[] min = new int[small.Length];\n int[] max = new int[big.Length];\n for (int i = 0; i < min.Length; i++)\n {\n min[i] = small[i] - 48;\n }\n for (int i = 0; i < max.Length; i++)\n {\n max[i] = big[i] - 48;\n }\n MinusTwoArrays(min, max);\n int length = max[max.Length - 1];\n if(max.Length>1)\n length+=max[max.Length - 2] * 10;\n if (length < 2)\n Console.WriteLine(\"-1\");\n else\n {\n if (length == 2 && min[min.Length - 1] % 2 == 1)\n Console.WriteLine(\"-1\");\n else\n {\n if (min[min.Length - 1] % 2 == 1)\n {\n min = Plustoarray(min, 1);\n }\n for (int i = 0; i < min.Length; i++)\n {\n Console.Write(min[i]);\n }\n Console.Write(\" \");\n min = Plustoarray(min, 1);\n for (int i = 0; i < min.Length; i++)\n {\n Console.Write(min[i]);\n }\n Console.Write(\" \");\n min = Plustoarray(min, 1);\n for (int i = 0; i < min.Length; i++)\n {\n Console.Write(min[i]);\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Solution\n{\n public static void Main()\n {\n long[] minp = Console.ReadLine().Split().Select(Int64.Parse).ToArray();\n long l = minp[0], r = minp[1], j =0, i= 0;\n bool check = true;\n if (r - l > 1)\n {\n for (i = l; i <= r - 2; i++)\n {\n j = i + 2;\n if (co_prime(i, i + 1))\n {\n do\n {\n if (co_prime(i + 1, j))\n {\n if (!co_prime(i, j))\n { check = false; break; }\n }\n j++;\n } while (j <= r);\n if (!check)\n break;\n }\n }\n }\n else\n check = true;\n if (check == false) Console.WriteLine(i + \" \" + (i + 1) + \" \" + j);\n else\n Console.WriteLine(\"-1\");\n \n }\n public static bool co_prime(long a, long b)\n {\n bool primeness = true;\n long div = Math.Min(a, b);\n for(long i = 2; i <= 9; i++)\n {\n if (a % i == 0 && b % i == 0)\n { primeness = false; break; }\n }\n return primeness;\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n long l, r;\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n l = long.Parse(input[0]);\n r = long.Parse(input[1]);\n }\n if (r - l < 2L || r-l==2L && l%2L==1) Console.WriteLine(\"-1\");\n else\n {\n if (l % 2L == 0) Console.WriteLine(\"{0} {1} {2}\", l, l + 1L, l + 2L);\n else Console.WriteLine(\"{0} {1} {2}\", l + 1L, l + 2L, l + 3L);\n }\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var l = sc.Long();\n var r = sc.Long();\n for (long a = l; a <= r; a++)\n for (long b = a + 1; b <= r; b++)\n for (long c = b + 1; c <= r; c++)\n {\n var ab = MathEx.GCD(a, b);\n var bc = MathEx.GCD(b, c);\n var ac = MathEx.GCD(a, c);\n if (ab == 1 && bc == 1 && ac > 1)\n {\n IO.Printer.Out.WriteLine(\"{0} {1} {2}\", a, b, c);\n return;\n }\n }\n IO.Printer.Out.WriteLine(-1);\n }\n internal IO.StreamScanner sc;\n }\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n try\n {\n#endif\n IO.Printer.Out.AutoFlush = true;\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n //if (buf[ptr] < lb || ub < buf[ptr])\n if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public T[] Enumerate(this int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n }\n}\n#endregion\n#region gcd,lcm\nstatic public partial class MathEx\n{\n\n static public long GCD(long x, long y)\n {\n byte i = 0;\n while (x != 0 && y != 0)\n {\n if (i == 0)\n y %= x;\n else x %= y;\n i ^= 1;\n }\n return x == 0 ? y : x;\n }\n \n\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var l = init[0];\n var r = init[1];\n\n var candidates = new List();\n\n for (long i = l; i <= r; i++)\n {\n for (long j = i + 1; j <= r; j++)\n {\n for (long k = j + 1; k <= r; k++)\n {\n if (coprime(j, k) && coprime(i, j) && !coprime(i, k))\n {\n Console.WriteLine(\"{0} {1} {2}\", i, j, k);\n return;\n }\n }\n }\n }\n \n\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n\n public static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static bool coprime(long a, long b)\n {\n return GCD(a, b) == 1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication26\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long l = Int64.Parse(input[0]);\n long r = Int64.Parse(input[1]);\n if (r - l + 1 < 3) Console.WriteLine(-1);\n else\n if (l % 2 == 0) Console.WriteLine(\"{0} {1} {2}\", l, l + 1, l + 2);\n else\n if (r - l + 1 > 3) Console.WriteLine(\"{0} {1} {2}\", l + 1, l + 2, l + 3);\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nclass A483 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var l = long.Parse(line[0]);\n var r = long.Parse(line[1]);\n switch (r - l) {\n case 0L: case 1L: l = -1; break;\n case 2L: if ((l & 1) != 0) l = -1; break;\n default: if ((l & 1) != 0) ++l; break;\n }\n if (l == -1L) Console.WriteLine(-1);\n else Console.WriteLine($\"{l} {l + 1} {l + 2}\");\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Counterexample\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str_Inputs = Console.ReadLine();\n string[] arr_Inputs = str_Inputs.Split(' ');\n long num_L = Convert.ToInt64(arr_Inputs[0]);\n long num_R = Convert.ToInt64(arr_Inputs[1]);\n bool flag = false;\n\n for (long i = num_L; i <= num_R; i++)\n {\n for (long j = i + 1; j <= num_R; j++)\n {\n for (long k = j + 1; k <= num_R; k++)\n {\n if (Coprime(i, j) && Coprime(j, k) && !Coprime(i, k))\n {\n flag = true;\n Console.Write( i + \" \" + j + \" \" + k);\n return;\n }\n }\n }\n }\n if (!flag)\n {\n Console.Write(\"-1\");\n }\n\n Console.Read();\n }\n\n public static bool Coprime(long x, long y)\n {\n while(y!=0)\n {\n long temp = y;\n y = x % y;\n x = temp;\n }\n return (x == 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\n\npublic static class solver\n{\n static long GCD(long a, long b)\n {\n while (b != 0) {\n var rem = a % b;\n a = b;\n b = rem;\n }\n return a;\n }\n\n public static void Main()\n {\n var input = Console.ReadLine().Split(null);\n var l = long.Parse(input[0]);\n var r = long.Parse(input[1]);\n\n long a = 0, b = 0, c = 0;\n bool found = false;\n for (a = l; a <= r; a++) {\n for (b = a + 1; b <= r; b++) {\n for (c = b + 1; c <= r; c++) {\n if (GCD(a, b) == 1 && GCD(b, c) == 1 && GCD(a, c) > 1) {\n found = true;\n goto brk;\n }\n }\n }\n }\n brk:\n\n if (found)\n Console.WriteLine(\"{0} {1} {2}\", a, b, c);\n else {\n Console.WriteLine(-1);\n }\n\n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n ulong n = ulong.Parse(a.Split(' ')[0]);\n ulong p = ulong.Parse(a.Split(' ')[1]);\n\n for(ulong i=n;i '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n long len = num[1] - num[0] + 1;\n if( len <= 2){\n Console.WriteLine(-1);\n } else {\n if(len == 3){\n long a1 = GCD(num[0] , num[0] + 1);\n long a2 = GCD(num[0] + 1 , num[0] + 2);\n long a3 = GCD(num[0] , num[0] + 2);\n if(a1 == 1 && a2 == 1 && a3 > 1){\n Console.WriteLine(num[0] + \" \" + (num[0] + 1) + \" \" + (num[0] + 2));\n } else {\n Console.WriteLine(-1);\n }\n } else {\n if(num[0] % 2 == 0)\n Console.WriteLine((num[0]) + \" \" + (num[0] + 1) + \" \" + (num[0] + 2));\n else\n Console.WriteLine((num[0] + 1) + \" \" + (num[0] + 2) + \" \" + (num[0] + 3));\n }\n }\n }\n \n public static long GCD(long a , long b){\n if(b == 0)\n return a;\n return GCD(b , a % b );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n long l = long.Parse(s[0]), r = long.Parse(s[1]);\n long diff = r - l + 1;\n if (diff < 3) {\n Console.WriteLine(-1);\n } else {\n int[,] m = new int[55, 55];\n for (int p = 2; p < diff; p++) {\n int start = (int)(p - (l % p));\n if (start == p) {\n start = 0;\n }\n for (int i = start; i < diff; i += p) {\n for (int j = i + p; j < diff; j += p) {\n m[i, j] = 1;\n }\n }\n }\n int a = 0, b = 0, c = 0;\n for (a = 0; a < diff; a++) {\n for (b = a + 1; b < diff; b++) {\n if (m[a, b] == 0) {\n for (c = b + 1; c < diff; c++) {\n if (m[b, c] == 0 && m[a, c] == 1) {\n goto Final;\n }\n }\n }\n }\n }\n Final:\n if (a == diff) {\n Console.WriteLine(-1);\n } else {\n Console.WriteLine(\"{0} {1} {2}\", l + a, l + b, l + c);\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static long gcd(long a, long b) {\n while(b != 0) {\n long c = a % b;\n a = b;\n b = c;\n }\n return a;\n }\n\n static void Main(string[] args) {\n long l = Next();\n long r = Next();\n bool flag = false;\n for(long a = l; !flag && a <= r; a++) {\n for(long b = a + 1; !flag && b <= r; b++) {\n for(long c = b + 1; !flag && c <= r; c++) {\n if(gcd(a, b) == 1 && gcd(b, c) == 1 && gcd(a, c) != 1) {\n writer.WriteLine(\"{0} {1} {2}\", a, b, c);\n flag = true;\n }\n }\n }\n }\n if(!flag)\n writer.Write(-1);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static long Next() {\n long c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n long l = ReadLong();\n long r = ReadLong();\n if (l > r - 2 || l == r - 2 && l % 2 == 1)\n return -1;\n\n if (l % 2 == 1)\n l++;\n Write(l, l + 1, l + 2);\n\n return null;\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"exchange.in\");\n //writer = new StreamWriter(\"exchange.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n\nclass Element:IComparable\n{\n\n public int a, index;\n public Element()\n {\n a = index = 0;\n }\n public Element(int a, int i)\n {\n this.a = a;\n index = i;\n }\n\n\n public int CompareTo(Element other)\n {\n return other.a.CompareTo(this.a);\n }\n}\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\n namespace ConsoleApplication254\n {\n class Program\n {\n static Dictionary> d = new Dictionary>();\n static int[] mark;\n static Dictionary cnt;\n static int[] color;\n static int size = 0;\n static void dfs(int v)\n {\n size++;\n mark[v] = 1;\n bool w = false;\n if (cnt.ContainsKey(color[v]))\n {\n cnt[color[v]]++;\n }\n else\n {\n cnt.Add(color[v], 1);\n }\n for (int i = 0; i < d[v].Count; i++)\n {\n if (mark[d[v][i]] == 0)\n {\n\n dfs(d[v][i]);\n }\n\n }\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n long a = long.Parse(ss[0]);\n long b = long.Parse(ss[1]);\n if (a % 2 == 0)\n {\n if (b - a + 1 <= 2)\n {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(a + \" \" + (a + 1) + \" \" + (a + 2));\n\n }\n else\n {\n if (b - a + 1 <= 3)\n {\n Console.WriteLine(-1);\n return;\n }\n Console.WriteLine(a+1 + \" \" + (a + 2) + \" \" + (a + 3));\n }\n }\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] splitStr = str.Split(' ');\n long l = long.Parse(splitStr[0]);\n long r = long.Parse(splitStr[1]);\n if ((r - l + 1) < 3)\n {\n Console.WriteLine(\"-1\");\n Environment.Exit(0);\n }\n if (l % 2 == 0)\n {\n Console.WriteLine(l + \" \" + (l + 1) + \" \" + (l + 2));\n Environment.Exit(0);\n }\n if ((r - l + 1) > 3)\n {\n Console.WriteLine((l + 1) + \" \" + (l + 2) + \" \" + (l + 3));\n Environment.Exit(0);\n }\n Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] line = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n long l = line[0];\n long r = line[1];\n if (l % 2 != 0) l++;\n if (r - l < 2) Console.WriteLine(-1);\n else\n {\n long f1 = l;\n long f2 = l + 1;\n long f3 = l + 1 + 1;\n Console.WriteLine(f1 + \" \" + f2 + \" \" + f3);\n }\n\n }\n static long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a%b);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\n\nnamespace fun\n{\n class Program\n {\n private static TextReader cin = Console.In;\n private static TextWriter cout = Console.Out;\n static void Main(string[] args)\n {\n string s = cin.ReadLine() ;\n long l = long.Parse(s.Split(' ')[0]);\n long r = long.Parse(s.Split(' ')[1]);\n if (r-l<2||r - l < 3 && l % 2 == 1) cout.WriteLine(-1);\n else if (l % 2 == 1) cout.WriteLine((l + 1) + \" \" + (l + 2) + \" \" + (l + 3));\n else cout.WriteLine(l + \" \" + (l + 1) + \" \" + (l + 2));\n \n //cin.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication26\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long l = Int64.Parse(input[0]);\n long r = Int64.Parse(input[1]);\n if (r - l + 1 < 3) Console.WriteLine(-1);\n else\n if (l % 2 == 0) Console.WriteLine(\"{0} {1} {2}\", l, l + 1, l + 2);\n else\n if (r - l + 1 > 3) Console.WriteLine(\"{0} {1} {2}\", l + 1, l + 2, l + 3);\n else\n Console.WriteLine(-1);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_275\n{\n class Program \n {\n public class IO\n {\n public static void Read(string inputString, out Int32 n)\n {\n bool succeded = Int32.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Int64 n)\n {\n bool succeded = Int64.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Single n)\n {\n bool succeded = Single.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Double n)\n {\n bool succeded = Double.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Char n)\n {\n bool succeded = Char.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out string outputString)\n {\n outputString = inputString;\n }\n\n public static void Read(string inputString, out List result)\n {\n Int32 n = 0;\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n result.Add(n);\n n = 0;\n }\n\n if (n != 0)\n result.Add(n);\n }\n\n public static void Read(string inputString, out List result)\n {\n Int64 n = 0;\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n result.Add(n);\n n = 0;\n }\n\n if (n != 0)\n result.Add(n);\n }\n\n public static void Read(string inputString, out List result)\n {\n Int32 integer = 0;\n Int32 rational = 0;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == ' ')\n {\n result.Add(MergeSingle(integer, rational));\n\n integer = 0;\n rational = 0;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (integer != 0 || rational != 0)\n result.Add(MergeSingle(integer, rational));\n }\n\n public static void Read(string inputString, out List result)\n {\n Int64 integer = 0;\n Int64 rational = 0;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == ' ')\n {\n result.Add(MergeDouble(integer, rational));\n\n integer = 0;\n rational = 0;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (integer != 0 || rational != 0)\n result.Add(MergeDouble(integer, rational));\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int32 n = 0;\n Boolean plus = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n\n n = 0;\n plus = true;\n }\n }\n\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int64 n = 0;\n Boolean plus = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n\n n = 0;\n plus = true;\n }\n }\n\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int32 integer = 0;\n Int32 rational = 0;\n Boolean plus = true;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] == ' ')\n {\n if (plus == true)\n result.Add(MergeSingle(integer, rational));\n else\n result.Add(-MergeSingle(integer, rational));\n\n integer = 0;\n rational = 0;\n plus = true;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (plus == true)\n result.Add(MergeSingle(integer, rational));\n else\n result.Add(-MergeSingle(integer, rational));\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int64 integer = 0;\n Int64 rational = 0;\n Boolean plus = true;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] == ' ')\n {\n if (plus == true)\n result.Add(MergeDouble(integer, rational));\n else\n result.Add(-MergeDouble(integer, rational));\n\n integer = 0;\n rational = 0;\n plus = true;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (plus == true)\n result.Add(MergeDouble(integer, rational));\n else\n result.Add(-MergeDouble(integer, rational));\n }\n\n public static void Read(string inputString, out List result)\n {\n result = inputString.ToList();\n }\n\n public static void FormatString(T n, ref string result, bool newLine = true)\n {\n if (newLine == true)\n result += n.ToString() + Environment.NewLine;\n else\n result += n.ToString() + \" \";\n }\n\n public static void FormatString(List n, ref string result, bool newLine = false)\n {\n StringBuilder sb = new StringBuilder();\n sb.Append(result);\n\n if (newLine == false)\n foreach (var item in n)\n sb.Append(item + \" \");\n else\n foreach (var item in n)\n sb.Append(item + Environment.NewLine);\n\n result = sb.ToString();\n }\n\n private static Single MergeSingle(Int32 integer, Int32 rational)\n {\n Func nrCifre = n => { Int32 cnt = 0; while (n != 0) { n /= 10; cnt++; } return cnt; };\n Func zecePow = n => { Int32 p = 1; for (int j = 0; j < n; j++) p *= 10; return p; };\n Func parteFract = n => { Int32 cateCifre = nrCifre(n); return (Single)n / (Single)zecePow(cateCifre); };\n\n Single f = integer + parteFract(rational);\n return f;\n }\n\n private static Double MergeDouble(Int64 integer, Int64 rational)\n {\n Func nrCifre = n => { Int32 cnt = 0; while (n != 0) { n /= 10; cnt++; } return cnt; };\n Func zecePow = n => { Int64 p = 1; for (int j = 0; j < n; j++) p *= 10; return p; };\n Func parteFract = n => { int cateCifre = nrCifre(n); return (Double)n / (Double)zecePow(cateCifre); };\n\n Double d = integer + parteFract(rational);\n return d;\n }\n }\n\n public class Math\n {\n public static List PrimeNumbers(Int64 upperBound)\n {\n List listOfPrimes = new List();\n Int64 sqrtUB = (Int64)System.Math.Sqrt(upperBound) + 1;\n\n Boolean[] isNotPrime = new Boolean[upperBound + 1];\n isNotPrime[1] = true;\n isNotPrime[2] = false;\n\n for (Int64 i = 2; i < sqrtUB; i++)\n if (isNotPrime[i] == false)\n for (Int64 j = i * i; j <= upperBound; j += i)\n isNotPrime[j] = true;\n\n for (int i = 2; i <= upperBound; i++)\n if (isNotPrime[i] == false)\n listOfPrimes.Add(i);\n\n return listOfPrimes;\n }\n\n public static Boolean IsPrime(Int64 n)\n {\n if (n < 2)\n return false;\n\n for (Int64 i = 2; i * i < n; i++)\n if (n % i == 0)\n return false;\n\n return true;\n }\n\n public static Int64 GCD (Int64 a, Int64 b)\n {\n Int64 c;\n \n while ( a != 0 ) {\n c = a; a = b % a; b = c;\n }\n \n return b;\n }\n }\n\n static void Main(string[] args)\n {\n List v;\n IO.Read(Console.ReadLine(), out v);\n\n Int64 l = v[0];\n Int64 r = v[1];\n \n Boolean ok = false;\n for (Int64 i = l; i <= r; i++)\n {\n for (Int64 j = i + 1; j <= r; j++)\n {\n for (Int64 k = j + 1; k <= r; k++)\n {\n if (Math.GCD(i, j) == 1 && Math.GCD(j, k) == 1 && Math.GCD(k, i) != 1)\n {\n Console.WriteLine(i + \" \" + j + \" \" + k);\n ok = true;\n goto label;\n }\n }\n }\n }\n\n label:\n if (ok == false)\n Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n public static long Gcd(long a, long b)\n {\n if (a < 0)\n a = -a;\n if (b < 0)\n b = -b;\n if (a == 0)\n return b;\n while (b != 0)\n {\n long c = a;\n a = b;\n b = c % b;\n }\n return a;\n }\n static void Main()\n {\n var lr = Console.ReadLine().Split().Select(long.Parse).ToArray();\n if (lr[1] - lr[0] < 2)\n {\n Console.WriteLine(-1);\n return;\n }\n for (var i = lr[0]; i <= lr[1]; i++)\n {\n for (var j = i + 1; j <= lr[1]; j++)\n {\n for (var k = j + 1; k <= lr[1]; k++)\n {\n if (Gcd(i, j) == 1 && Gcd(j, k) == 1 && Gcd(i, k) != 1)\n {\n Console.WriteLine(\"{0} {1} {2}\", i, j, k);\n return;\n }\n }\n }\n }\n Console.WriteLine(-1);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] line = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n long l = line[0];\n long r = line[1];\n if (l % 2 != 0) l++;\n if (r - l < 2) Console.WriteLine(-1);\n else\n {\n long f1 = l;\n long f2 = l + 1;\n long f3 = l + 1 + 1;\n Console.WriteLine(f1 + \" \" + f2 + \" \" + f3);\n }\n\n }\n static long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a%b);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Xml;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n\t\t\tif (l[1] - l[0] < 2 || (l[1] - l[0] == 2 && l[0] % 2 == 1))\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (l[0] % 2 == 1)\n\t\t\t\t\tl[0]++;\n\t\t\t\tConsole.WriteLine(\"{0} {1} {2}\", l[0], l[0] + 1, l[0] + 2);\n\t\t\t}\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces._275\n{\n class ProblemA\n {\n public static void Main(string[] varg)\n {\n string[] tokens = System.Console.ReadLine().Split(new char[] { ' ' });\n Int64 a = Int64.Parse(tokens[0]);\n Int64 b = Int64.Parse(tokens[1]);\n \n for (Int64 i=a;i<=b;i++)\n {\n for (Int64 j=i+1;j<=b;j++)\n {\n for (Int64 k = j+1;k<=b;k++)\n {\n if (isCoprime(i,j) && isCoprime(j,k) && !isCoprime(i,k))\n {\n System.Console.WriteLine(String.Format(\"{0} {1} {2}\", i,j,k));\n return;\n }\n }\n }\n }\n System.Console.WriteLine(\"-1\");\n return;\n\n }\n private static bool isCoprime(Int64 a, Int64 b)\n {\n HashSet fact1 = new HashSet();\n for (Int64 i=2;i<50;i++)\n {\n if (a % i == 0 && b % i == 0)\n return false;\n }\n return true;\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _483A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var l = s[0];\n var r = s[1]; \n for (long a = l; a <= r; a++)\n {\n for (long b = a + 1; b <= r; b++)\n {\n for (long c = b + 1; c <= r; c++)\n {\n if (gcd(a, b) == 1 && gcd(b, c) == 1 && gcd(a, c) != 1)\n {\n Console.WriteLine(a + \" \" + b + \" \" + c);\n return;\n }\n }\n }\n }\n Console.WriteLine(-1);\n }\n\n static long gcd(long a, long b)\n {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace task\n{\n class Program\n {\n\n private static long GCD(long a, long b)\n {\n if (b == 0) return a;\n return GCD(b, a % b);\n }\n\n static void Main(string[] args)\n {\n\n string input = Console.ReadLine();\n string[] parts = input.Split(' ');\n\n long l = long.Parse(parts[0]);\n long r = long.Parse(parts[1]);\n\n if((r-l + 1) < 3)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n string result = \"-1\";\n\n for(long a=l; a<=r-2;a++)\n {\n for(long b=a+1;b<=r-1;b++)\n {\n if(GCD(a,b)==1)\n {\n for(long c=b+1;c<=r;c++)\n {\n if(GCD(b,c)==1 && GCD(a,c)!=1)\n {\n result = a + \" \" + b + \" \" + c;\n Console.WriteLine(result);\n //Console.ReadLine();\n return;\n }\n }\n\n\n }\n }\n }\n\n Console.WriteLine(result);\n //Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesTemplate\n{\n class Program\n {\n static long l, r;\n static Dictionary, long> Memory = new Dictionary, long>();\n\n static void Main(string[] args)\n {\n LoadInput();\n Solve();\n }\n\n private static void Solve()\n {\n for (long i = l; i <= r - 2; i++)\n {\n for (long j = i + 1; j <= r - 1; j++)\n {\n for (long k = j + 1; k <= r; k++)\n {\n if (Gcd(i, j) == 1 && Gcd(j, k) == 1 && Gcd(i, k) != 1)\n {\n Console.WriteLine(\"{0} {1} {2}\", i, j, k);\n return;\n }\n }\n }\n }\n Console.WriteLine(-1);\n }\n\n private static void LoadInput()\n {\n var inp = GetInputLineLong();\n l = inp[0];\n r = inp[1];\n }\n\n static long Gcd(long a, long b)\n {\n var key = Tuple.Create(a, b);\n if (Memory.ContainsKey(key))\n {\n return Memory[key];\n }\n if (b == 0)\n {\n Memory.Add(key, a);\n return a;\n }\n else\n {\n long result = Gcd(b, a % b);\n Memory.Add(key, result);\n return result;\n }\n }\n\n\n static int[] GetInputLine()\n {\n return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n static long[] GetInputLineLong()\n {\n return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n }\n }\n\n\n static class Helpers\n {\n public static void Print(this IEnumerable source)\n {\n foreach (var item in source)\n {\n Console.Write(\"{0} \", item.ToString());\n }\n Console.WriteLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input;\n input = Console.ReadLine();\n string[] inp = input.Split(' ');\n Int64 a = Convert.ToInt64(inp[0]); \n Int64 c = Convert.ToInt64(inp[1]);\n Int64 counter = c - a;\n Boolean breaking = false;\n if (counter >=2 )\n {\n for (Int64 i = 0; i < counter && !breaking; i++)\n {\n for (Int64 j = 0; j < counter-i && !breaking; j++)\n {\n for (Int64 x = i+1; x < counter-i &&!breaking; x++)\n {\n if (GCD(a + i, a+x) == 1 && GCD(a+x, c-j ) == 1 && GCD(a + i,c-j) > 1)\n {\n breaking = true;\n Int64 o= a+i;\n Int64 u= a+x;\n Int64 q= c-j;\n Console.WriteLine(o + \" \" + u + \" \" + q);\n }\n }\n }\n\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n breaking = true;\n }\n if (!breaking)\n {\n Console.WriteLine(\"-1\");\n }\n }\n\n private static Int64 GCD(Int64 a, Int64 b)\n {\n while (a != 0 && b != 0)\n {\n if (a > b)\n a %= b;\n else\n b %= a;\n }\n\n return a == 0 ? b : a;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input;\n input = Console.ReadLine();\n string[] inp = input.Split(' ');\n Int64 a = Convert.ToInt64(inp[0]); \n Int64 c = Convert.ToInt64(inp[1]);\n Int64 counter = c - a;\n Boolean breaking = false;\n if (counter >=2 )\n {\n for (Int64 i = 0; i < counter && !breaking; i++)\n {\n for (Int64 j = 0; j < counter && !breaking; j++)\n {\n for (Int64 x = 0; x < counter &&!breaking; x++)\n {\n if (GCD(a + i, c - j) == 1 && GCD(c - j, c - x) == 1 && GCD(a + i, c - x) > 1)\n {\n breaking = true;\n Int64 o= a+i;\n Int64 u= c-j;\n Int64 q= c-x;\n Console.WriteLine(o + \" \" + u + \" \" + q);\n }\n }\n }\n\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n breaking = true;\n }\n if (!breaking)\n {\n Console.WriteLine(\"-1\");\n }\n }\n\n private static Int64 GCD(Int64 a, Int64 b)\n {\n while (a != 0 && b != 0)\n {\n if (a > b)\n a %= b;\n else\n b %= a;\n }\n\n return a == 0 ? b : a;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Test\n{\n public static Dictionary Factors(ulong N)\n {\n ulong max = ((ulong)Math.Sqrt(N)) + 1;\n Dictionary facts = new Dictionary();\n \tfor(ulong n = 2; n * n < N; n++)\n {\n int power = 0;\n while(N % n == 0)\n {\n N = N / n;\n power++;\n }\n if(power > 0)\n facts.Add(n, power);\n }\n return facts;\n }\n\n public static int SmallFacts(ulong N)\n {\n int factorsMask = 0;\n ulong[] primes = {2,3,5,7,9,11,13,17,19,23,29,31,37,41,43,47};\n \tfor(int n = 0; n < primes.Length; n++)\n {\n int pwr = 0;\n while(N % primes[n] == 0)\n {\n \tpwr++; N = N / primes[n]; \n }\n if(pwr > 0) factorsMask |= (1 << n);\n if(N <= 1) break;\n }\n return factorsMask;\n }\n\n public static string PrintMask(int mask)\n {\n string r= \"\";\n for(int i = 0; i < 32; i++)\n r += ((mask & (1 << i)) != 0) ? \"1\" : \"0\";\n return r;\n }\n\n\tpublic static void Main()\n\t{\n\t\tstring[] tok = Console.ReadLine().Split(' ');\n ulong l = UInt64.Parse(tok[0]);\n ulong r = UInt64.Parse(tok[1]);\n \n int D = (int)(r - l) + 1;\n int[] factors = new int[D]; \n for(ulong i = l; i <= r; i++)\n\t\t{\n factors[(int)(i - l)] = SmallFacts(i);\n //Console.WriteLine(\"{0} -> {1}\", i, PrintMask(factors[(int)(i -l)]));\n }\n \n int found = -1;\n for(int i = 0; i < D; i++)\n {\n for(int j = i + 1; j < D; j++)\n {\n if((factors[i] & factors[j]) != 0)\n {\n //Console.WriteLine(\"found {0} and {1}\", i, j);\n \tfor(int k = 1; k < D; k++)\n \t{\n if((k != i) && (k != j) && (factors[k] & factors[i]) == 0 && (factors[k] & factors[j]) == 0)\n {\n Console.WriteLine(\"{0} {1} {2}\", (ulong)i + l, (ulong)j + l, (ulong)k + l);\n return;\n }\n \t}\n }\n }\n }\n Console.WriteLine(\"-1\");\n \n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace Counterexample\n{\n class Program\n {\n\n private static bool isPrime(long k){\n for (long i=2; i<=Math.Sqrt(k); i++){\n if (k%i == 0){\n return false;\n }\n }\n return true;\n }\n\n private static long gcd(long a, long b){\n if (b==0){\n return a;\n }\n return gcd(b, a%b);\n }\n\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.None);\n\n long l = long.Parse(input[0]);\n long r = long.Parse(input[1]);\n\n long a = l, b=0, c=0;\n bool foundB = false, foundC = false;\n\n\n long i = l;\n\n while(i<=r){\n if (foundC){\n break;\n }\n\n a = i;\n long j = a;\n while(j<= r){\n if (gcd(a, j) ==1){\n b = j;\n foundB = true;\n break;\n } \n j++;\n }\n if (foundB){\n long k = b;\n while( k<= r){\n if (gcd(b, k) == 1 && gcd(a, k) > 1){\n c = k;\n foundC = true;\n break;\n } \n k++;\n }\n }\n i++;\n }\n\n Console.WriteLine(a+\" \"+b);\n\n i = b;\n if (foundB && foundC){\n Console.WriteLine(a+\" \"+b+\" \"+c);\n }else{\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Counterexample\n{\n class Program\n {\n\n private static long gcd(long a, long b){\n if (b==0){\n return a;\n }\n return gcd(b, a%b);\n }\n\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.None);\n\n long l = long.Parse(input[0]);\n long r = long.Parse(input[1]);\n\n long a = l, b=0, c=0;\n bool foundB = false, foundC = false;\n\n long i = a;\n while( !foundB && i<= r){\n if (gcd(a, i) ==1){\n b = i;\n foundB = true;\n } \n i++;\n }\n\n i = b;\n while( !foundC && i<= r){\n if (gcd(b, i) == 1 && gcd(a, i) > 1){\n c = i;\n foundC = true;\n } \n i++;\n }\n if (foundB && foundC){\n Console.WriteLine(a+\" \"+b+\" \"+c);\n }else{\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Solution\n{\n public static void Main()\n {\n long[] minp = Console.ReadLine().Split().Select(Int64.Parse).ToArray();\n long l = minp[0], r = minp[1], j =0, i= 0;\n bool check = true;\n if (r - l > 1)\n {\n for (i = l; i <= r; i++)\n {\n j = i + 2;\n if (co_prime(i, i + 1))\n {\n do\n {\n if (co_prime(i + 1, j))\n {\n if (!co_prime(i, j))\n { check = false; break; }\n }\n j++;\n } while (j <= r);\n if (!check)\n break;\n }\n }\n }\n else\n check = true;\n if (check == false) Console.WriteLine(i + \" \" + (i + 1) + \" \" + j);\n else\n Console.WriteLine(\"-1\");\n \n }\n public static bool co_prime(long a, long b)\n {\n bool primeness = true;\n long div = Math.Min(a, b);\n for(long i = 2; i <= 9; i++)\n {\n if (a % i == 0 && b % i == 0)\n { primeness = false; break; }\n }\n return primeness;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var l = init[0];\n var r = init[1];\n\n var candidates = new List();\n\n for (long i = l; i <= r; i++)\n {\n for (long j = i; j <= r; j++)\n {\n if (coprime(i,j))\n {\n //Start searching for a second pair of comprimes\n for (long k = j; k <= r; k++)\n {\n if(coprime(j,k))\n {\n if (!coprime(i,k))\n {\n candidates.Add(i);\n candidates.Add(j);\n candidates.Add(k);\n break;\n \n }\n }\n \n }\n break;\n }\n }\n break;\n }\n \n if (candidates.Count == 3)\n {\n string ans = candidates[0] + \" \" + candidates[1] + \" \" + candidates[2];\n Console.WriteLine(ans);\n //return;\n }\n else{\n Console.WriteLine(-1);\n //return;\n }\n\n Console.ReadLine();\n }\n\n public static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static bool coprime(long a, long b)\n {\n return GCD(a, b) == 1;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var l = init[0];\n var r = init[1];\n\n var candidates = new List();\n\n for (long i = l; i <= r; i++)\n {\n for (long j = i + 1; j <= r; j++)\n {\n if (coprime(i,j))\n {\n //Start searching for a second pair of comprimes\n for (long k = j + 1; k <= r; k++)\n {\n if(coprime(j,k))\n {\n if (!coprime(i,k))\n {\n candidates.Add(i);\n candidates.Add(j);\n candidates.Add(k);\n }\n }\n }\n }\n }\n }\n \n if (candidates.Count == 3)\n {\n string ans = candidates[0] + \" \" + candidates[1] + \" \" + candidates[2];\n Console.WriteLine(ans);\n return;\n }\n else{\n Console.WriteLine(-1);\n return;\n }\n\n Console.ReadLine();\n }\n\n public static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static bool coprime(long a, long b)\n {\n return GCD(a, b) == 1;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var l = init[0];\n var r = init[1];\n\n var candidates = new List();\n\n for (long i = l; i <= r; i++)\n {\n for (long j = i; j <= r; j++)\n {\n if (coprime(i,j))\n {\n //Start searching for a second pair of comprimes\n for (long k = j; k <= r; k++)\n {\n if(coprime(j,k))\n {\n if (!coprime(i,k))\n {\n candidates.Add(i);\n candidates.Add(j);\n candidates.Add(k);\n }\n }\n }\n }\n }\n }\n \n if (candidates.Count == 3)\n {\n string ans = candidates[0] + \" \" + candidates[1] + \" \" + candidates[2];\n Console.WriteLine(ans);\n return;\n }\n else{\n Console.WriteLine(-1);\n return;\n }\n\n Console.ReadLine();\n }\n\n public static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static bool coprime(long a, long b)\n {\n return GCD(a, b) == 1;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var l = init[0];\n var r = init[1];\n\n var candidates = new List();\n\n for (long i = l; i <= r; i++)\n {\n for (long j = i + 1; j <= r; j++)\n {\n if (coprime(i,j))\n {\n //Start searching for a second pair of comprimes\n for (long k = j + 1; k <= r; k++)\n {\n if(coprime(j,k))\n {\n if (!coprime(i,k))\n {\n candidates.Add(i);\n candidates.Add(j);\n candidates.Add(k);\n break;\n \n }\n }\n \n }\n break;\n }\n }\n break;\n }\n \n if (candidates.Count == 3)\n {\n string ans = candidates[0] + \" \" + candidates[1] + \" \" + candidates[2];\n Console.WriteLine(ans);\n //return;\n }\n else{\n Console.WriteLine(-1);\n //return;\n }\n\n Console.ReadLine();\n }\n\n public static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static bool coprime(long a, long b)\n {\n return GCD(a, b) == 1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Program\n {\n\n static BigInteger GCD(BigInteger a, BigInteger b)\n {\n if (b != 0)\n {\n return GCD(b, a % b);\n }\n else\n {\n return a;\n }\n }\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' '); // comment\n BigInteger qwertt = BigInteger.Parse(input[0]);\n BigInteger asdf = BigInteger.Parse(input[1]);\n BigInteger[] result = new BigInteger[3];\n bool rezultatu = false;\n for (BigInteger i = qwertt; i <= asdf; i++)\n {\n for (BigInteger j = qwertt + 1; j < asdf; j++)\n {\n if (GCD(i, j) == 1)\n {\n if (GCD(j, j + 1) == 1)\n {\n if (GCD(i, j + 1) != 1)\n {\n result[0] = i;\n result[1] = j;\n result[2] = j + 1;\n rezultatu = true;\n break;\n }\n }\n }\n }\n if (rezultatu) break;\n\n }\n if (rezultatu)\n {\n for (int i = 0; i < 3; i++)\n {\n Console.Write(result[i]);\n Console.Write(' ');\n }\n\n }\n else\n {\n Console.Write(-1);\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Counterexample\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str_Inputs = Console.ReadLine();\n string[] arr_Inputs = str_Inputs.Split(' ');\n long num_L = Convert.ToInt64(arr_Inputs[0]);\n long num_R = Convert.ToInt64(arr_Inputs[1]);\n bool flag = false;\n\n for (long i = num_L; i <= num_R; i++)\n {\n for (long j = i + 1; j <= num_R; j++)\n {\n for (long k = j + 1; k <= num_R; k++)\n {\n if (Coprime(i, j) && Coprime(j, k) && !Coprime(i, k))\n {\n flag = true;\n Console.Write( i + \" \" + j + \" \" + k);\n break;\n }\n }\n }\n }\n if (!flag)\n {\n Console.Write(\"-1\");\n }\n\n Console.Read();\n }\n\n public static bool Coprime(long x, long y)\n {\n while(y!=0)\n {\n long temp = y;\n y = x % y;\n x = temp;\n }\n return (x == 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string ss = Console.ReadLine();\n ulong n = ulong.Parse(ss.Split(' ')[0]);\n ulong p = ulong.Parse(ss.Split(' ')[1]);\n \n ulong res = 0;\n for(ulong i=n+1;i r - 2)\n return -1;\n\n Write(l, l + 1, l + 2);\n\n return null;\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"exchange.in\");\n //writer = new StreamWriter(\"exchange.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] splitStr = str.Split(' ');\n long l = long.Parse(splitStr[0]);\n long r = long.Parse(splitStr[1]);\n if ((r - l + 1) < 3)\n {\n Console.WriteLine(\"-1\");\n }\n if (l % 2 == 0)\n {\n Console.WriteLine(l + \" \" + (l + 1) + \" \" + (l + 2));\n }\n if ((r - l + 1) > 3)\n {\n Console.WriteLine((l + 1) + \" \" + (l + 2) + \" \" + (l + 3));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] line = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n long l = line[0];\n long r = line[1];\n long f1 = l;\n long f2 = l + 1;\n long f3 = 0;\n for(long i= l+2;i<= r; i++)\n {\n if (gcd(f1, i) > 1)\n {\n f3 = i;\n break;\n }\n }\n if (f3 == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(f1 + \" \" + f2 + \" \" + f3);\n }\n \n\n }\n static long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a%b);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] line = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();\n long l = line[0];\n long r = line[1];\n long f1 = l;\n long f2 = l + 1;\n long f3 = 0;\n for(long i= l+2;i<= r; i++)\n {\n if (gcd(f1, i) > 1 && gcd(f2, i) == 1)\n {\n f3 = i;\n break;\n }\n }\n if (f3 == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(f1 + \" \" + f2 + \" \" + f3);\n }\n \n\n }\n static long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a%b);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_275\n{\n class Program \n {\n public class IO\n {\n public static void Read(string inputString, out Int32 n)\n {\n bool succeded = Int32.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Int64 n)\n {\n bool succeded = Int64.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Single n)\n {\n bool succeded = Single.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Double n)\n {\n bool succeded = Double.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out Char n)\n {\n bool succeded = Char.TryParse(inputString, out n);\n if (succeded == false)\n throw new FormatException(\"Input string was not in correct form\");\n }\n\n public static void Read(string inputString, out string outputString)\n {\n outputString = inputString;\n }\n\n public static void Read(string inputString, out List result)\n {\n Int32 n = 0;\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n result.Add(n);\n n = 0;\n }\n\n if (n != 0)\n result.Add(n);\n }\n\n public static void Read(string inputString, out List result)\n {\n Int64 n = 0;\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n result.Add(n);\n n = 0;\n }\n\n if (n != 0)\n result.Add(n);\n }\n\n public static void Read(string inputString, out List result)\n {\n Int32 integer = 0;\n Int32 rational = 0;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == ' ')\n {\n result.Add(MergeSingle(integer, rational));\n\n integer = 0;\n rational = 0;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (integer != 0 || rational != 0)\n result.Add(MergeSingle(integer, rational));\n }\n\n public static void Read(string inputString, out List result)\n {\n Int64 integer = 0;\n Int64 rational = 0;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == ' ')\n {\n result.Add(MergeDouble(integer, rational));\n\n integer = 0;\n rational = 0;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (integer != 0 || rational != 0)\n result.Add(MergeDouble(integer, rational));\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int32 n = 0;\n Boolean plus = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n\n n = 0;\n plus = true;\n }\n }\n\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int64 n = 0;\n Boolean plus = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] != ' ')\n n = n * 10 + (inputString[i] - '0');\n else\n {\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n\n n = 0;\n plus = true;\n }\n }\n\n if (plus == true)\n result.Add(n);\n else\n result.Add(-n);\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int32 integer = 0;\n Int32 rational = 0;\n Boolean plus = true;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] == ' ')\n {\n if (plus == true)\n result.Add(MergeSingle(integer, rational));\n else\n result.Add(-MergeSingle(integer, rational));\n\n integer = 0;\n rational = 0;\n plus = true;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (plus == true)\n result.Add(MergeSingle(integer, rational));\n else\n result.Add(-MergeSingle(integer, rational));\n }\n\n public static void Read(string inputString, out List result, Boolean readNegatives)\n {\n Int64 integer = 0;\n Int64 rational = 0;\n Boolean plus = true;\n\n Boolean ReadingInteger = true;\n\n result = new List();\n\n Int32 strSize = inputString.Length;\n for (Int32 i = 0; i < strSize; i++)\n {\n if (inputString[i] == '-')\n {\n plus = false;\n continue;\n }\n\n if (inputString[i] == ' ')\n {\n if (plus == true)\n result.Add(MergeDouble(integer, rational));\n else\n result.Add(-MergeDouble(integer, rational));\n\n integer = 0;\n rational = 0;\n plus = true;\n\n ReadingInteger = true;\n\n continue;\n }\n\n if (inputString[i] == '.')\n {\n ReadingInteger = false;\n continue;\n }\n\n if (ReadingInteger == true)\n checked { integer = integer * 10 + inputString[i] - '0'; }\n else\n checked { rational = rational * 10 + inputString[i] - '0'; }\n }\n\n if (plus == true)\n result.Add(MergeDouble(integer, rational));\n else\n result.Add(-MergeDouble(integer, rational));\n }\n\n public static void Read(string inputString, out List result)\n {\n result = inputString.ToList();\n }\n\n public static void FormatString(T n, ref string result, bool newLine = true)\n {\n if (newLine == true)\n result += n.ToString() + Environment.NewLine;\n else\n result += n.ToString() + \" \";\n }\n\n public static void FormatString(List n, ref string result, bool newLine = false)\n {\n StringBuilder sb = new StringBuilder();\n sb.Append(result);\n\n if (newLine == false)\n foreach (var item in n)\n sb.Append(item + \" \");\n else\n foreach (var item in n)\n sb.Append(item + Environment.NewLine);\n\n result = sb.ToString();\n }\n\n private static Single MergeSingle(Int32 integer, Int32 rational)\n {\n Func nrCifre = n => { Int32 cnt = 0; while (n != 0) { n /= 10; cnt++; } return cnt; };\n Func zecePow = n => { Int32 p = 1; for (int j = 0; j < n; j++) p *= 10; return p; };\n Func parteFract = n => { Int32 cateCifre = nrCifre(n); return (Single)n / (Single)zecePow(cateCifre); };\n\n Single f = integer + parteFract(rational);\n return f;\n }\n\n private static Double MergeDouble(Int64 integer, Int64 rational)\n {\n Func nrCifre = n => { Int32 cnt = 0; while (n != 0) { n /= 10; cnt++; } return cnt; };\n Func zecePow = n => { Int64 p = 1; for (int j = 0; j < n; j++) p *= 10; return p; };\n Func parteFract = n => { int cateCifre = nrCifre(n); return (Double)n / (Double)zecePow(cateCifre); };\n\n Double d = integer + parteFract(rational);\n return d;\n }\n }\n\n public class Math\n {\n public static List PrimeNumbers(Int64 upperBound)\n {\n List listOfPrimes = new List();\n Int64 sqrtUB = (Int64)System.Math.Sqrt(upperBound) + 1;\n\n Boolean[] isNotPrime = new Boolean[upperBound + 1];\n isNotPrime[1] = true;\n isNotPrime[2] = false;\n\n for (Int64 i = 2; i < sqrtUB; i++)\n if (isNotPrime[i] == false)\n for (Int64 j = i * i; j <= upperBound; j += i)\n isNotPrime[j] = true;\n\n for (int i = 2; i <= upperBound; i++)\n if (isNotPrime[i] == false)\n listOfPrimes.Add(i);\n\n return listOfPrimes;\n }\n\n public static Boolean IsPrime(Int64 n)\n {\n if (n < 2)\n return false;\n\n for (Int64 i = 2; i * i < n; i++)\n if (n % i == 0)\n return false;\n\n return true;\n }\n\n public static Int64 GCD (Int64 a, Int64 b)\n {\n Int64 c;\n \n while ( a != 0 ) {\n c = a; a = b % a; b = c;\n }\n \n return b;\n }\n }\n\n static void Main(string[] args)\n {\n List v;\n IO.Read(Console.ReadLine(), out v);\n\n Int64 l = v[0];\n Int64 r = v[1];\n\n Console.WriteLine(l + \" \" + r);\n\n Boolean ok = false;\n for (Int64 i = l; i <= r; i++)\n {\n for (Int64 j = i + 1; j <= r; j++)\n {\n for (Int64 k = j + 1; k <= r; k++)\n {\n if (Math.GCD(i, j) == 1 && Math.GCD(j, k) == 1 && Math.GCD(k, i) != 1)\n {\n Console.WriteLine(i + \" \" + j + \" \" + k);\n ok = true;\n goto label;\n }\n }\n }\n }\n\n label:\n if (ok == false)\n Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n public static long NOD(long a, long b)\n {\n while (b != 0)\n b = a % (a = b);\n return a;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] s1 = s.Split(' ');\n long l = long.Parse(s1[0]);\n long r = long.Parse(s1[1]);\n for (long i = l; i<=r;i++)\n for (long j = l+1;j<=r;j++)\n for (long k = l+2;k<=r;k++)\n {\n if ((NOD(i,k)!=1)&&(NOD(i,j)==1)&&(NOD(j,k)==1))\n {\n Console.WriteLine(\"{0} {1} {2}\",i,j,k);\n return;\n }\n }\n Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces275\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] s1 = s.Split(' ');\n long l = long.Parse(s1[0]);\n long r = long.Parse(s1[1]);\n long min;\n if (l>r) min = r;\n else min = l;\n for (int i = 1;i<=min; i++)\n {\n if ((l % i == 0)&&(r % i == 0))\n {\n l += 1;\n if (l+1\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = Console.ReadLine().Split(' ').Select(long.Parse).ToList();\n\t\t\tif (l[1] - l[0] < 2)\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"{0} {1} {2}\", l[0], l[0] + 1, l[0] + 2);\n\t\t\t}\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces._275\n{\n class ProblemA\n {\n public static void Main(string[] varg)\n {\n string[] tokens = System.Console.ReadLine().Split(new char[] { ' ' });\n Int64 a = Int64.Parse(tokens[0]);\n Int64 b = Int64.Parse(tokens[1]);\n \n for (Int64 i=a;i<=b;i++)\n {\n for (Int64 j=i+1;j<=b;j++)\n {\n for (Int64 k = j+1;j<=b;j++)\n {\n if (isCoprime(i,j) && isCoprime(j,k) && !isCoprime(i,k))\n {\n System.Console.WriteLine(String.Format(\"{0} {1} {2}\", i,j,k));\n return;\n }\n }\n }\n }\n System.Console.WriteLine(\"-1\");\n return;\n\n }\n private static bool isCoprime(Int64 a, Int64 b)\n {\n HashSet fact1 = new HashSet();\n for (Int64 i=2;i<50;i++)\n {\n if (a % i == 0 && b % i == 0)\n return true;\n }\n return false;\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _483A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var l = s[0];\n var r = s[1]; \n for (long a = l; a <= r; a++)\n {\n for (long b = l + 1; b <= r; b++)\n {\n for (long c = l + 2; c <= r; c++)\n {\n if (gcd(a, b) == 1 && gcd(b, c) == 1 && gcd(a, c) != 1)\n {\n Console.WriteLine(a + \" \" + b + \" \" + c);\n return;\n }\n }\n }\n }\n Console.WriteLine(-1);\n }\n\n static long gcd(long a, long b)\n {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n }\n}\n"}], "src_uid": "6c1ad1cc1fbecff69be37b1709a5236d"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Codeforces {\n static int[] F;\n static void Main(String[] args) {\n#if LOCAL\n Console.SetIn(new System.IO.StreamReader(\"input\"));\n#endif\n\n F = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n\n int[] rep1 = { 12, 13, 4, 5, 16, 17, 20, 21 };\n int[] rep2 = { 14, 15, 6, 7, 18, 19, 22, 23 };\n int[] rep3 = { 0, 2, 4, 6, 8, 10, 23, 21 };\n int[] rep4 = { 1, 3, 5, 7, 9, 11, 22, 20 };\n int[] rep5 = { 2, 3, 16, 18, 9, 8, 15, 13 };\n int[] rep6 = { 0, 1, 17, 19, 11, 10, 14, 12 };\n\n bool valid = rotate(rep1) || rotate(rep2) || rotate(rep3) || rotate(rep4) || rotate(rep5) || rotate(rep6);\n Console.WriteLine(valid ? \"YES\" : \"NO\");\n }\n\n private static bool rotate(int[] rep) {\n int[] f2 = new int[24];\n\n for (int i = 0; i < 24; i++) f2[i] = F[i];\n for (int i = 0; i < 8; i++) {\n f2[rep[i]] = F[rep[(8 + i - 2) % 8]];\n }\n\n int[] f3 = new int[24];\n\n for (int i = 0; i < 24; i++) f3[i] = F[i];\n for (int i = 0; i < 8; i++) {\n f3[rep[i]] = F[rep[(i + 2) % 8]];\n }\n\n return check(f2) || check(f3);\n }\n\n private static bool check(int[] F) {\n for (int i = 0; i < F.Length; i += 4) {\n if (!(F[i] == F[i + 1] && F[i] == F[i + 2] && F[i] == F[i + 3])) return false;\n }\n return true;\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Solution_for_Cube\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args) ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static bool Solve(string[] args)\n {\n int n = 24;\n\n var a = new int[n + 1];\n for (int i = 1; i <= n; i++)\n {\n a[i] = Next();\n }\n\n if (check(a))\n return true;\n\n var b = new int[n + 1];\n\n b[13] = a[5];\n b[14] = a[6];\n b[15] = a[7];\n b[16] = a[8];\n\n b[5] = a[17];\n b[6] = a[18];\n b[7] = a[19];\n b[8] = a[20];\n\n b[17] = a[21];\n b[18] = a[22];\n b[19] = a[23];\n b[20] = a[24];\n\n b[21] = a[13];\n b[22] = a[14];\n b[23] = a[15];\n b[24] = a[16];\n\n b[1] = a[3];\n b[2] = a[1];\n b[3] = a[4];\n b[4] = a[2];\n\n b[9] = a[10];\n b[10] = a[12];\n b[11] = a[9];\n b[12] = a[11];\n\n if (check(b))\n return true;\n\n var c = new int[n + 1];\n\n c[1] = a[18];\n c[2] = a[20];\n c[3] = a[17];\n c[4] = a[19];\n\n c[5] = a[6];\n c[6] = a[8];\n c[7] = a[5];\n c[8] = a[7];\n\n c[9] = a[14];\n c[10] = a[16];\n c[11] = a[13];\n c[12] = a[15];\n\n c[13] = a[2];\n c[14] = a[4];\n c[15] = a[1];\n c[16] = a[3];\n\n c[17] = a[10];\n c[18] = a[12];\n c[19] = a[9];\n c[20] = a[11];\n\n c[21] = a[23];\n c[22] = a[21];\n c[23] = a[24];\n c[24] = a[22];\n\n if (check(c))\n return true;\n\n return false;\n }\n\n private static bool check(int[] a)\n {\n if (a[13] == a[14] && a[15] == a[16] && a[13] == a[15]\n && a[17] == a[18] && a[17] == a[19] && a[17] == a[20])\n {\n for (int i = 3; i < a.Length; i += 3)\n {\n if (a[i] != a[i - 2])\n return false;\n i++;\n if (a[i] != a[i - 2])\n return false;\n }\n\n var b = new[] {a[1], a[5], a[9], a[22]};\n var c = new[] {a[2], a[6], a[10], a[21]};\n\n for (int i = 1; i < 4; i += 2)\n {\n bool ok = true;\n\n for (int j = 0; j < 4; j++)\n {\n if (b[(j + i)%4] != c[j])\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n return true;\n }\n }\n return false;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace _887C\n{\n internal class Program\n {\n private static int[][] rotates =\n {\n new[] {13, 14, 5, 6, 17, 18, 21, 22},\n new[] {15, 16, 7, 8, 19, 20, 23, 24},\n new[] {1, 3, 5, 7, 9, 11, 24, 22},\n new[] {2, 4, 6, 8, 10, 12, 23, 21},\n new[] {1, 2, 18, 20, 12, 11, 15, 13},\n new[] {3, 4, 17, 19, 10, 9, 16, 14}\n };\n\n static bool Check(int[] a)\n {\n bool res = true;\n for (int i = 0; i < 6; i++)\n {\n int color = a[i * 4];\n for (int j = 1; j < 4; j++)\n if (a[i * 4 + j] != color)\n res = false;\n }\n return res;\n }\n public static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n bool result = false;\n for (int i = 0; i < 6; i++)\n {\n int[] b = new int[24];\n Array.Copy(a, b, 24);\n for (int j = 0; j < 8; j++)\n {\n int next = j + 2;\n if (next >= 8) next -= 8;\n b[rotates[i][j] - 1] = a[rotates[i][next] - 1];\n }\n result |= Check(b);\n Array.Copy(a, b, 24);\n for (int j = 0; j < 8; j++)\n {\n int next = j - 2;\n if (next < 0) next += 8;\n b[rotates[i][j] - 1] = a[rotates[i][next] - 1];\n }\n result |= Check(b);\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n const int max = 25;\n var input = sr.ReadArrayOfInt32();\n var colors = new int[max];\n for (var i = 1; i < max; i++) {\n colors[i] = input[i - 1];\n }\n if (Check(Move1(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move2(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move3(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move4(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move5(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move6(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move7(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move8(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move9(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move10(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move11(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move12(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n\n sw.WriteLine(\"NO\");\n }\n\n private int[] Move1(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[6];\n result[4] = colors[8];\n \n result[6] = colors[10];\n result[8] = colors[12];\n \n result[10] = colors[23];\n result[12] = colors[21];\n \n result[21] = colors[4];\n result[23] = colors[2];\n\n result[18] = colors[17];\n result[20] = colors[18];\n result[19] = colors[20];\n result[17] = colors[19];\n\n return result;\n }\n \n private int[] Move2(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[23];\n result[4] = colors[21];\n \n result[6] = colors[2];\n result[8] = colors[4];\n \n result[10] = colors[6];\n result[12] = colors[8];\n \n result[21] = colors[12];\n result[23] = colors[10];\n \n result[18] = colors[20];\n result[20] = colors[19];\n result[19] = colors[17];\n result[17] = colors[18];\n\n return result;\n }\n \n private int[] Move3(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[5];\n result[3] = colors[7];\n \n result[6] = colors[9];\n result[7] = colors[11];\n \n result[9] = colors[24];\n result[11] = colors[22];\n \n result[22] = colors[3];\n result[24] = colors[1];\n \n result[14] = colors[16];\n result[16] = colors[15];\n result[15] = colors[13];\n result[13] = colors[14];\n\n return result;\n }\n \n private int[] Move4(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[24];\n result[3] = colors[22];\n \n result[5] = colors[1];\n result[7] = colors[3];\n \n result[9] = colors[5];\n result[11] = colors[7];\n \n result[22] = colors[11];\n result[24] = colors[9];\n \n result[14] = colors[13];\n result[16] = colors[14];\n result[15] = colors[16];\n result[13] = colors[15];\n\n return result;\n }\n \n private int[] Move5(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[13] = colors[5];\n result[14] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[21] = colors[13];\n result[22] = colors[14];\n \n result[4] = colors[3];\n result[2] = colors[4];\n result[1] = colors[2];\n result[3] = colors[1];\n\n return result;\n }\n \n private int[] Move6(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[22] = colors[14];\n result[21] = colors[13];\n \n result[14] = colors[5];\n result[13] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[3] = colors[4];\n result[4] = colors[2];\n result[2] = colors[1];\n result[1] = colors[3];\n\n return result;\n }\n \n private int[] Move7(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[7];\n result[16] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[23] = colors[15];\n result[24] = colors[16];\n \n result[10] = colors[9];\n result[12] = colors[10];\n result[11] = colors[12];\n result[9] = colors[11];\n\n return result;\n }\n \n private int[] Move8(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[24] = colors[16];\n result[23] = colors[15];\n \n result[16] = colors[7];\n result[15] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[9] = colors[10];\n result[10] = colors[12];\n result[12] = colors[11];\n result[11] = colors[9];\n\n return result;\n }\n \n private int[] Move9(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[16] = colors[3];\n result[14] = colors[4];\n \n result[10] = colors[16];\n result[9] = colors[14];\n \n result[17] = colors[10];\n result[19] = colors[9];\n \n result[3] = colors[17];\n result[4] = colors[19];\n \n result[5] = colors[6];\n result[6] = colors[8];\n result[8] = colors[7];\n result[7] = colors[5];\n\n return result;\n }\n \n private int[] Move10(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[3] = colors[16];\n result[4] = colors[14];\n \n result[16] = colors[10];\n result[14] = colors[9];\n \n result[10] = colors[17];\n result[9] = colors[19];\n \n result[17] = colors[3];\n result[4] = colors[19];\n \n result[6] = colors[5];\n result[8] = colors[6];\n result[7] = colors[8];\n result[5] = colors[7];\n\n return result;\n }\n \n private int[] Move11(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[1];\n result[13] = colors[2];\n \n result[12] = colors[15];\n result[11] = colors[13];\n \n result[18] = colors[12];\n result[20] = colors[11];\n \n result[1] = colors[18];\n result[2] = colors[20];\n \n result[21] = colors[23];\n result[22] = colors[21];\n result[24] = colors[22];\n result[23] = colors[24];\n\n return result;\n }\n \n private int[] Move12(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[15];\n result[2] = colors[13];\n \n result[15] = colors[12];\n result[13] = colors[11];\n \n result[12] = colors[18];\n result[11] = colors[20];\n \n result[18] = colors[1];\n result[20] = colors[2];\n \n result[23] = colors[21];\n result[21] = colors[22];\n result[22] = colors[24];\n result[24] = colors[23];\n\n return result;\n }\n\n private bool Check(int[] colors)\n {\n for (var i = 0; i < 6; i++) {\n var startIndx = i * 4 + 1;\n if (!(colors[startIndx] == colors[startIndx + 1] && colors[startIndx] == colors[startIndx + 2]\n && colors[startIndx] == colors[startIndx + 2] && colors[startIndx] == colors[startIndx + 3])) {\n return false;\n }\n }\n\n return true;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n public class C\n {\n static bool checkOk(int s , int [] inputs)\n {\n int c = inputs[s*4]; \n for(int i = 0;i<4; i++)\n {\n if (c != inputs[s * 4 + i])\n return false;\n }\n\n return true;\n }\n\n static bool checkRotation(int [,] arr, int [] inp ,int aindex )\n {\n\n int[] farr = new int[8];\n int[] sarr = new int[8];\n int fp=0, sp = 0;\n for(int i = 1; i < 9; i++)\n {\n farr[fp++] = inp[arr[aindex,i]];\n sarr[sp++] = inp[arr[aindex+1, i]];\n }\n\n bool checkR = false;\n for(int i = 0; i < 8; i++)\n {\n if (farr[i] != sarr[(i + 2) % 8])\n checkR=true;\n\n }\n\n if (!checkR)\n return true;\n\n for (int i = 0; i < 8; i++)\n {\n if (farr[i] != sarr[(i - 2+8) % 8])\n return false;\n\n }\n\n return true;\n }\n\n static void Main(string[] args)\n {\n int[,] arr = { { 0, 12, 13,4,5,16,17,20,21 },{ 2,14,15,6,7,18,19,22,23}, { 1,1,0,12,14,10,11,19,17 }, { 5,3,2,13,15,8,9,18,16}, { 3, 0,2,4,6,8,10,23,21} ,{ 4,1,3,5,7,9,11,22,20} };\n\n string inp = Console.ReadLine();\n int[] inputs = new int[24];\n string[] splits = inp.Split(' ');\n\n for(int i =0; i < 24; i++)\n {\n inputs[i] = int.Parse(splits[i]);\n }\n bool isPoss = false;\n for(int i =0; i<6; i+=2)\n {\n if(checkOk(arr[i,0], inputs) && checkOk(arr[i+1, 0], inputs))\n {\n\n isPoss = checkRotation(arr, inputs, i);\n break;\n }\n\n }\n if(isPoss)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n \n\n }\n }\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var staticFaces = isHasExactlyTwoFacesSameColor(getAllFaces(input));\n if (staticFaces == -1)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n var L = rotateL(input, staticFaces);\n var R = rotateR(input, staticFaces);\n Console.WriteLine((isAllFacesSameColor(L) || isAllFacesSameColor(R)) ? \"YES\" : \"NO\");\n }\n }\n\n static List getAllFaces(string[] input)\n {\n List faces = new List();\n for (int i = 0; i < 6; i++)\n {\n faces.Add(new int[]\n {\n int.Parse(input[i*4]),\n int.Parse(input[i*4+1]),\n int.Parse(input[i*4+2]),\n int.Parse(input[i*4+3])\n });\n }\n return faces;\n }\n\n static int isHasExactlyTwoFacesSameColor(List faces)\n {\n int result = -1;\n if (isFaceSameColor(faces[0]) && isFaceSameColor(faces[2])) result = 13;\n\n if (isFaceSameColor(faces[3]) && isFaceSameColor(faces[4]))\n if (result == -1) result = 45;\n else return -1;\n\n if (isFaceSameColor(faces[1]) && isFaceSameColor(faces[5]))\n if (result == -1) result = 26;\n else return -1;\n\n return result;\n }\n\n static bool isFaceSameColor(int[] face)\n {\n var j = face[0];\n foreach (int i in face)\n {\n if (i != j) return false;\n }\n return true;\n }\n\n static bool isAllFacesSameColor(List faces)\n {\n foreach (var f in faces)\n {\n if (!isFaceSameColor(f)) return false;\n }\n return true;\n }\n\n static List rotateL(string[] input, int staticFaces)\n {\n string[] ip = new string[input.Length];\n Array.Copy(input, ip, input.Length);\n if (staticFaces == 45)\n {\n string a = ip[1];\n string b = ip[3];\n ip[1] = ip[5];\n ip[3] = ip[7];\n ip[5] = ip[9];\n ip[7] = ip[11];\n ip[9] = ip[22];\n ip[11] = ip[20];\n ip[22] = a;\n ip[20] = b;\n }\n else if (staticFaces == 13)\n {\n string a = ip[21];\n string b = ip[20];\n ip[21] = ip[17];\n ip[20] = ip[16];\n ip[17] = ip[5];\n ip[16] = ip[4];\n ip[5] = ip[13];\n ip[4] = ip[12];\n ip[13] = a;\n ip[12] = b;\n }\n else if (staticFaces == 26)\n {\n string a = ip[0];\n string b = ip[1];\n ip[0] = ip[17];\n ip[1] = ip[19];\n ip[17] = ip[11];\n ip[19] = ip[10];\n ip[11] = ip[14];\n ip[10] = ip[12];\n ip[14] = a;\n ip[12] = b;\n }\n return getAllFaces(ip);\n }\n\n static List rotateR(string[] input, int staticFaces)\n {\n string[] ip = new string[input.Length];\n Array.Copy(input, ip, input.Length);\n if (staticFaces == 45)\n {\n string a = ip[11];\n string b = ip[9];\n ip[11] = ip[7];\n ip[9] = ip[5];\n ip[7] = ip[3];\n ip[5] = ip[1];\n ip[3] = ip[20];\n ip[1] = ip[22];\n ip[20] = a;\n ip[22] = b;\n }\n else if (staticFaces == 13)\n {\n string a = ip[12];\n string b = ip[13];\n ip[12] = ip[4];\n ip[13] = ip[5];\n ip[4] = ip[16];\n ip[5] = ip[17];\n ip[16] = ip[20];\n ip[17] = ip[21];\n ip[20] = a;\n ip[21] = b;\n }\n else if (staticFaces == 26)\n {\n string a = ip[10];\n string b = ip[11];\n ip[10] = ip[19];\n ip[11] = ip[17];\n ip[19] = ip[1];\n ip[17] = ip[0];\n ip[1] = ip[12];\n ip[0] = ip[14];\n ip[12] = a;\n ip[14] = b;\n }\n return getAllFaces(ip);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize * faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr, 0) && IsCompleteFace(arr, 2))\n {\n cir = toListArr(arr, faceSize * 3, faceSize * 1, faceSize * 4, faceSize * 5);\n }\n else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 3, faceSize * 2, faceSize * 4);\n\n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for (int i = 1; i < 8; i++)\n {\n if (cir[0, 0] == cir[1, i] && ((8 - i <= 2 || i <= 2)))\n {\n index = i;\n bool flag = true;\n for (int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if (flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2, 8];\n returnArr[0, 0] = arr[index1];\n returnArr[0, 1] = arr[index1 + 1];\n returnArr[0, 2] = arr[index2];\n returnArr[0, 3] = arr[index2 + 1];\n returnArr[0, 4] = arr[index3];\n returnArr[0, 5] = arr[index3 + 1];\n returnArr[0, 6] = arr[index4];\n returnArr[0, 7] = arr[index4 + 1];\n returnArr[1, 0] = arr[index1 + 2];\n returnArr[1, 1] = arr[index1 + 3];\n returnArr[1, 2] = arr[index2 + 2];\n returnArr[1, 3] = arr[index2 + 3];\n returnArr[1, 4] = arr[index3 + 2];\n returnArr[1, 5] = arr[index3 + 3];\n returnArr[1, 6] = arr[index4 + 2];\n returnArr[1, 7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex * faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n// To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\nconst bool testing = true;\n#else\n const bool testing = false;\n#endif\n\n static void program(TextReader input)\n {\n var s = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var trans = new List>() {\n new List(){1,3,5,7,9,11,24,22},\n new List(){2,4,6,8,10,12,23,21},\n new List(){13,14,5,6,17,18,21,22},\n new List(){15,16,7,8,19,20,23,24},\n new List(){15,16,7,8,19,20,23,24},\n new List(){14,3,4,17,19,10,9,16},\n new List(){13,1,2,18,20,12,11,15}\n };\n\n for(var i = 0; i < trans.Count; i++)\n {\n var newS = s.ToList();\n for(var j = 0; j < trans[i].Count; j++)\n {\n newS[trans[i][j] - 1] = s[trans[i][(j + 2) % 8] - 1];\n }\n\n var pos = true;\n for(var k = 0; k < 5; k++)\n {\n var color = newS[k * 4];\n for(var j = k * 4 + 1; j < (k + 1) * 4; j++)\n {\n if(newS[j] != color)\n {\n pos = false;\n }\n }\n }\n\n if (pos)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n newS = s.ToList();\n for (var j = 0; j < trans[i].Count; j++)\n {\n newS[trans[i][j] - 1] = s[trans[i][(j +6) % 8] - 1];\n }\n\n pos = true;\n for (var k = 0; k < 5; k++)\n {\n var color = newS[k * 4];\n for (var j = k * 4 + 1; j < (k + 1) * 4; j++)\n {\n if (newS[j] != color)\n {\n pos = false;\n }\n }\n }\n if (pos)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"NO\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"YES\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] a;\n int[] Parse(string s)\n {\n return s.Split(',').Select(ss => a[int.Parse(ss) - 1]).ToArray();\n }\n\n bool Fun(string left, string right, string c1, string c2)\n {\n var l = Parse(left);\n var r = Parse(right);\n var v1 = Parse(c1);\n var v2 = Parse(c2);\n if (l.Distinct().Count() > 1 || r.Distinct().Count() > 1)\n return false;\n\n for (int i = 0; i < 8; i += 2)\n if (v1[i] != v1[i + 1])\n return false;\n\n bool f = true;\n for (int i = 0; i < 8; i++)\n if (v1[i] != v2[(i + 2) % 8])\n f = false;\n if (f)\n return true;\n f = true;\n for (int i = 0; i < 8; i++)\n if (v1[i] != v2[(i + 6) % 8])\n f = false;\n return f;\n }\n\n public void Solve()\n {\n a = ReadIntArray();\n\n Write(Fun(\"13,14,15,16\", \"17,18,19,20\", \"1,3,5,7,9,11,24,22\", \"2,4,6,8,10,12,23,21\") ||\n Fun(\"1,2,3,4\", \"9,10,11,12\", \"13,14,5,6,17,18,21,22\", \"15,16,7,8,19,20,23,24\") ||\n Fun(\"5,6,7,8\", \"21,22,23,24\", \"3,4,17,19,10,9,16,14\", \"1,2,18,20,12,11,15,13\") ? \"YES\" : \"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n private int[] c;\n\n public void Solve()\n {\n c = input.ReadIntArray(24);\n\n var canBuild =\n e(1, 2, 3, 4) && e(9, 10, 11, 12) && (e(5, 6, 19, 20) && e(17, 18, 23, 24) && e(13, 14, 7, 8) && e(21, 22, 15, 16) || e(5, 6, 15, 16) && e(17, 18, 7, 8) && e(21, 22, 19, 20) && e(13, 14, 23, 24)) ||\n e(5, 6, 7, 8) && e(21, 22, 23, 24) && (e(3, 4, 18, 20) && e(17, 19, 11, 12) && e(9, 10, 13, 15) && e(14, 16, 1, 2) || e(3, 4, 13, 15) && e(14, 16, 11, 12) && e(9, 10, 18, 20) && e(17, 19, 1, 2)) ||\n e(13, 14, 15, 16) && e(17, 18, 19, 20) && (e(5, 7, 10, 12) && e(1, 3, 6, 8) && e(9, 11, 21, 23) && e(2, 4, 22, 24) || e(6, 8, 9, 11) && e(2, 4, 5, 7) && e(10, 12, 22, 24) && e(1, 3, 21, 23));\n Console.WriteLine(canBuild ? \"YES\" : \"NO\");\n\n // 1 1 1 1 5 5 3 3 4 4 4 4 3 3 2 2 6 6 5 5 2 2 6 6\n\n // 1 1\n // 1 1\n //3 3 5 5 6 6 2 2\n //2 2 3 3 5 5 6 6\n // 4 4\n // 4 4\n\n\n\n // 1\n // 4 2 5 6\n // 3\n\n // 1 3\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,6,18,20 17,18,23,24 13,14,7,8 21,22,15,16\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,6,15,16 17,18,7,8 21,22,19,20 13,14,23,24\n\n // 2 6\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 3,4,18,20 17,19,11,12 9,10,13,15 14,16,1,2\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 3,4,13,15 14,16,11,12 9,10,18,20 17,19,1,2\n\n // 4 5\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,7,10,12 1,3,6,8 9,11,21,23 2,4,22,24\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 6,8,9,11 2,4,5,7 10,12,22,24 1,3,21,23\n }\n\n public bool e(params int[] ids)\n {\n return ids.Select(i => c[i - 1]).Distinct().Count() == 1;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n\n\n for (int i = 1; i <= 12; i++)\n {\n string[] ss = s.Split(' ');\n if (isCubeOk(Rotate(ss, i)))\n {\n Console.Write(\"YES\");\n //Console.ReadLine();\n return;\n }\n }\n\n\n Console.Write(\"NO\");\n\n //Console.ReadLine();\n }\n\n private static string[] Rotate(string[] ss,int r)\n {\n if(r==1)\n TW(ref ss, \"2,6 4,8 6,10 8,12 10,23 12,21 21,4 23,2\");\n else if (r == 2)\n TW(ref ss, \"2,23 4,21 6,2 8,4 10,6 12,8 23,10 21,12\");\n else if (r == 3)\n TW(ref ss, \"1,5 3,7 5,9 7,11 9,24 11,22 22,3 24,1\");\n else if (r == 4)\n TW(ref ss, \"5,1 7,3 9,5 11,7 1,24 3,22 24,9 22,11\");\n\n else if (r == 5)\n TW(ref ss, \"13,5 14,6 5,17 6,18 17,21 18,22 21,13 22,14\");\n else if (r == 6)\n TW(ref ss, \"5,13 6,14 17,5 18,6 21,17 22,18 13,21 14,22\");\n\n else if (r == 7)\n TW(ref ss, \"7,15 8,16 19,7 20,8 23,19 24,20 15,23 16,24\");\n else if (r == 8)\n TW(ref ss, \"15,7 16,8 7,19 8,20 19,23 20,24 23,15 24,16\");\n\n else if (r == 9)\n TW(ref ss, \"3,17 4,19 17,10 19,9 10,16 9,14 16,3 14,4\");\n else if (r == 10)\n TW(ref ss, \"17,3 19,4 10,17 9,19 16,10 14,9 3,16 4,14\");\n\n else if (r == 11)\n TW(ref ss, \"1,18 2,20 18,12 20,11 12,15 11,13 15,1 13,2\");\n else if (r == 12)\n TW(ref ss, \"18,1 20,2 12,18 11,20 15,12 13,11 1,15 2,13\");\n\n return ss;\n }\n \n\n private static bool isCubeOk(string[] ss)\n {\n int c = 0;\n for (int i = 0; i < 24; i=i+4)\n if (ss[i] == ss[i + 1] && ss[i] == ss[i + 2] && ss[i] == ss[i + 3])\n c++;\n if (c == 6)\n return true;\n return false;\n }\n\n private static void TW(ref string[] ss,string tw)\n {\n string[] pp = new string[ss.Length];\n ss.CopyTo(pp, 0);\n string[] ff = tw.Split(' ');\n for (int i = 0; i < ff.Length; i++)\n {\n int k1 = Int32.Parse(ff[i].Split(',')[0])-1;\n int k2 = Int32.Parse(ff[i].Split(',')[1])-1;\n ss[k2] = pp[k1];\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n private int[] c;\n\n public void Solve()\n {\n c = input.ReadIntArray(24);\n\n var canBuild =\n e(1, 2, 3, 4) && e(9, 10, 11, 12) && (e(5, 6, 18, 20) && e(17, 18, 23, 24) && e(13, 14, 7, 8) && e(21, 22, 15, 16) || e(5, 6, 15, 16) && e(17, 18, 7, 8) && e(21, 22, 19, 20) && e(13, 14, 23, 24)) ||\n e(5, 6, 7, 8) && e(21, 22, 23, 24) && (e(3, 4, 18, 20) && e(17, 19, 11, 12) && e(9, 10, 13, 15) && e(14, 16, 1, 2) || e(3, 4, 13, 15) && e(14, 16, 11, 12) && e(9, 10, 18, 20) && e(17, 19, 1, 2)) ||\n e(13, 14, 15, 16) && e(17, 18, 19, 20) && (e(5, 7, 10, 12) && e(1, 3, 6, 8) && e(9, 11, 21, 23) && e(2, 4, 22, 24) || e(6, 8, 9, 11) && e(2, 4, 5, 7) && e(10, 12, 22, 24) && e(1, 3, 21, 23));\n Console.WriteLine(canBuild ? \"YES\" : \"NO\");\n\n // 1\n // 4 2 5 6\n // 3\n\n // 1 3\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,6,18,20 17,18,23,24 13,14,7,8 21,22,15,16\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,6,15,16 17,18,7,8 21,22,19,20 13,14,23,24\n\n // 2 6\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 3,4,18,20 17,19,11,12 9,10,13,15 14,16,1,2\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 3,4,13,15 14,16,11,12 9,10,18,20 17,19,1,2\n\n // 4 5\n // \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 5,7,10,12 1,3,6,8 9,11,21,23 2,4,22,24\n // \u043f\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 - 6,8,9,11 2,4,5,7 10,12,22,24 1,3,21,23\n }\n\n public bool e(params int[] ids)\n {\n return ids.Select(i => c[i - 1]).Distinct().Count() == 1;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n\n\n for (int i = 1; i <= 8; i++)\n {\n string[] ss = s.Split(' ');\n if (isCubeOk(Rotate(ss, i)))\n {\n Console.Write(\"YES\");\n //Console.ReadLine();\n return;\n }\n }\n\n\n Console.Write(\"NO\");\n\n //Console.ReadLine();\n }\n\n private static string[] Rotate(string[] ss,int r)\n {\n if(r==1)\n TW(ref ss, \"2,6 4,8 6,10 8,12 10,23 12,21 21,4 23,2\");\n else if (r == 2)\n TW(ref ss, \"2,23 4,21 6,2 8,4 10,6 12,8 23,10 21,12\");\n else if (r == 3)\n TW(ref ss, \"1,5 3,7 5,9 7,11 9,24 11,22 22,3 24,1\");\n else if (r == 4)\n TW(ref ss, \"5,1 7,3 9,5 11,7 1,24 3,22 24,9 22,11\");\n\n else if (r == 5)\n TW(ref ss, \"13,5 14,6 5,17 6,18 17,21 18,22 21,13 22,14\");\n else if (r == 6)\n TW(ref ss, \"5,13 6,14 17,5 18,6 21,17 22,18 13,21 14,22\");\n\n else if (r == 7)\n TW(ref ss, \"7,15 8,16 19,7 20,8 23,19 24,20 15,23 16,24\");\n else if (r == 8)\n TW(ref ss, \"15,7 16,8 7,19 8,20 19,23 20,24 23,15 24,16\");\n\n\n return ss;\n }\n \n\n private static bool isCubeOk(string[] ss)\n {\n int c = 0;\n for (int i = 0; i < 24; i=i+4)\n if (ss[i] == ss[i + 1] && ss[i] == ss[i + 2] && ss[i] == ss[i + 3])\n c++;\n if (c == 6)\n return true;\n return false;\n }\n\n private static void TW(ref string[] ss,string tw)\n {\n string[] pp = new string[ss.Length];\n ss.CopyTo(pp, 0);\n string[] ff = tw.Split(' ');\n for (int i = 0; i < ff.Length; i++)\n {\n int k1 = Int32.Parse(ff[i].Split(',')[0])-1;\n int k2 = Int32.Parse(ff[i].Split(',')[1])-1;\n ss[k2] = pp[k1];\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Solution_for_Cube\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args) ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static bool Solve(string[] args)\n {\n int n = 24;\n\n var a = new int[n + 1];\n for (int i = 1; i <= n; i++)\n {\n a[i] = Next();\n }\n\n if (check(a))\n return true;\n\n var b = new int[n + 1];\n\n b[13] = a[5];\n b[14] = a[6];\n b[15] = a[7];\n b[16] = a[8];\n\n b[5] = a[17];\n b[6] = a[18];\n b[7] = a[19];\n b[8] = a[20];\n\n b[17] = a[21];\n b[18] = a[22];\n b[19] = a[23];\n b[20] = a[24];\n\n b[21] = a[13];\n b[22] = a[14];\n b[23] = a[15];\n b[24] = a[16];\n\n b[1] = a[3];\n b[2] = a[1];\n b[3] = a[4];\n b[4] = a[2];\n\n b[9] = a[10];\n b[10] = a[12];\n b[11] = a[9];\n b[12] = a[11];\n\n if (check(b))\n return true;\n\n var c = new int[n + 1];\n\n c[1] = a[18];\n c[2] = a[20];\n c[3] = a[17];\n c[4] = a[19];\n\n c[5] = a[6];\n c[6] = a[8];\n c[7] = a[5];\n c[8] = a[7];\n\n c[9] = a[14];\n c[10] = a[16];\n c[11] = a[13];\n c[12] = a[15];\n\n c[13] = a[2];\n c[14] = a[4];\n c[15] = a[1];\n c[16] = a[3];\n\n c[17] = a[10];\n c[18] = a[12];\n c[19] = a[9];\n c[20] = a[11];\n\n c[21] = a[23];\n c[22] = a[21];\n c[23] = a[24];\n c[24] = a[22];\n\n if (check(c))\n return true;\n\n return false;\n }\n\n private static bool check(int[] a)\n {\n if (a[13] == a[14] && a[15] == a[16] && a[13] == a[15]\n && a[17] == a[18] && a[17] == a[19] && a[17] == a[20])\n {\n for (int i = 3; i < a.Length; i += 3)\n {\n if (a[i] != a[i - 2])\n return false;\n i++;\n if (a[i] != a[i - 2])\n return false;\n }\n\n var b = new[] {a[1], a[5], a[9], a[22]};\n var c = new[] {a[2], a[6], a[10], a[21]};\n\n for (int i = 1; i < 4; i += 3)\n {\n bool ok = true;\n\n for (int j = 0; j < 4; j++)\n {\n if (b[(j + i)%4] != c[j])\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n return true;\n }\n }\n return false;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Solution_for_Cube\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args) ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static bool Solve(string[] args)\n {\n int n = 24;\n\n var a = new int[n + 1];\n for (int i = 1; i <= n; i++)\n {\n a[i] = Next();\n }\n\n if (check(a))\n return true;\n\n var b = new int[n + 1];\n\n b[13] = a[5];\n b[14] = a[6];\n b[15] = a[7];\n b[16] = a[8];\n\n b[5] = a[17];\n b[6] = a[18];\n b[7] = a[19];\n b[8] = a[20];\n\n b[17] = a[21];\n b[18] = a[22];\n b[19] = a[23];\n b[20] = a[24];\n\n b[21] = a[13];\n b[22] = a[14];\n b[23] = a[15];\n b[24] = a[16];\n\n b[1] = a[3];\n b[2] = a[1];\n b[3] = a[4];\n b[4] = a[2];\n\n b[9] = a[10];\n b[10] = a[12];\n b[11] = a[9];\n b[12] = a[11];\n\n if (check(b))\n return true;\n\n var c = new int[n + 1];\n\n c[1] = a[5];\n c[2] = a[6];\n c[3] = a[7];\n c[4] = a[8];\n\n c[5] = a[9];\n c[6] = a[10];\n c[7] = a[11];\n c[8] = a[12];\n\n c[9] = a[24];\n c[10] = a[22];\n c[11] = a[23];\n c[12] = a[21];\n\n c[13] = a[14];\n c[14] = a[16];\n c[15] = a[13];\n c[16] = a[15];\n\n c[17] = a[19];\n c[18] = a[17];\n c[19] = a[20];\n c[20] = a[18];\n\n c[21] = a[4];\n c[22] = a[3];\n c[23] = a[2];\n c[24] = a[1];\n\n if (check(c))\n return true;\n\n return false;\n }\n\n private static bool check(int[] a)\n {\n if (a[13] == a[14] && a[15] == a[16] && a[13] == a[15]\n && a[17] == a[18] && a[17] == a[19] && a[17] == a[20])\n {\n for (int i = 3; i < a.Length; i += 3)\n {\n if (a[i] != a[i - 2])\n return false;\n i++;\n if (a[i] != a[i - 2])\n return false;\n }\n\n var b = new[] {a[1], a[5], a[9], a[22]};\n var c = new[] {a[2], a[6], a[10], a[21]};\n\n for (int i = 0; i < 4; i++)\n {\n bool ok = true;\n\n for (int j = 0; j < 4; j++)\n {\n if (b[(j + i)%4] != c[j])\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n return true;\n }\n }\n return false;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Solution_for_Cube\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args) ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static bool Solve(string[] args)\n {\n int n = 24;\n\n var a = new int[n + 1];\n for (int i = 1; i <= n; i++)\n {\n a[i] = Next();\n }\n\n if (check(a))\n return true;\n\n var b = new int[n + 1];\n\n b[13] = a[5];\n b[14] = a[6];\n b[15] = a[7];\n b[16] = a[8];\n\n b[5] = a[17];\n b[6] = a[18];\n b[7] = a[19];\n b[8] = a[20];\n\n b[17] = a[21];\n b[18] = a[22];\n b[19] = a[23];\n b[20] = a[24];\n\n b[21] = a[13];\n b[22] = a[14];\n b[23] = a[15];\n b[24] = a[16];\n\n b[1] = a[3];\n b[2] = a[1];\n b[3] = a[4];\n b[4] = a[2];\n\n b[9] = a[10];\n b[10] = a[12];\n b[11] = a[9];\n b[12] = a[11];\n\n if (check(b))\n return true;\n\n var c = new int[n + 1];\n\n c[1] = a[18];\n c[2] = a[20];\n c[3] = a[17];\n c[4] = a[19];\n\n c[5] = a[6];\n c[6] = a[8];\n c[7] = a[5];\n c[8] = a[7];\n\n c[9] = a[14];\n c[10] = a[16];\n c[11] = a[13];\n c[12] = a[15];\n\n c[13] = a[2];\n c[14] = a[4];\n c[15] = a[1];\n c[16] = a[3];\n\n c[17] = a[10];\n c[18] = a[12];\n c[19] = a[9];\n c[20] = a[11];\n\n c[21] = a[23];\n c[22] = a[21];\n c[23] = a[24];\n c[24] = a[22];\n\n if (check(c))\n return true;\n\n return false;\n }\n\n private static bool check(int[] a)\n {\n if (a[13] == a[14] && a[15] == a[16] && a[13] == a[15]\n && a[17] == a[18] && a[17] == a[19] && a[17] == a[20])\n {\n for (int i = 3; i < a.Length; i += 3)\n {\n if (a[i] != a[i - 2])\n return false;\n i++;\n if (a[i] != a[i - 2])\n return false;\n }\n\n var b = new[] {a[1], a[5], a[9], a[22]};\n var c = new[] {a[2], a[6], a[10], a[21]};\n\n for (int i = 0; i < 4; i++)\n {\n bool ok = true;\n\n for (int j = 0; j < 4; j++)\n {\n if (b[(j + i)%4] != c[j])\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n return true;\n }\n }\n return false;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Codeforces {\n static int[] F;\n static void Main(String[] args) {\n#if LOCAL\n Console.SetIn(new System.IO.StreamReader(\"input\"));\n#endif\n\n F = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n bool valid = false;\n\n int[] rep1 = { 12, 13, 4, 5, 16, 17, 20, 21 };\n int[] rep2 = { 14, 15, 6, 7, 18, 19, 22, 23 };\n int[] rep3 = { 0, 2, 4, 6, 8, 10, 23, 21 };\n int[] rep4 = { 1, 3, 5, 7, 9, 11, 22, 20 };\n\n valid = valid || rotate(rep1);\n valid = valid || rotate(rep2);\n valid = valid || rotate(rep3);\n valid = valid || rotate(rep4);\n\n Console.WriteLine(valid ? \"YES\" : \"NO\");\n }\n\n private static bool rotate(int[] rep) {\n int[] f2 = new int[24];\n\n for (int i = 0; i < 24; i++) f2[i] = F[i];\n for (int i = 0; i < 8; i++) {\n f2[rep[i]] = F[rep[(8 + i - 2) % 8]];\n }\n\n int[] f3 = new int[24];\n\n for (int i = 0; i < 24; i++) f3[i] = F[i];\n for (int i = 0; i < 8; i++) {\n f3[rep[i]] = F[rep[(i + 2) % 8]];\n }\n\n return check(f2) || check(f3);\n }\n\n private static bool check(int[] F) {\n for (int i = 0; i < F.Length; i += 4) {\n if (!(F[i] == F[i + 1] && F[i] == F[i + 2] && F[i] == F[i + 3])) return false;\n }\n return true;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n const int max = 25;\n var input = sr.ReadArrayOfInt32();\n var colors = new int[max];\n for (var i = 1; i < max; i++) {\n colors[i] = input[i - 1];\n }\n if (Check(Move1(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move2(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move3(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move4(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move5(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move6(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move7(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move8(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move9(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move10(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move11(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move12(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n\n sw.WriteLine(\"NO\");\n }\n\n private int[] Move1(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[6];\n result[4] = colors[8];\n \n result[6] = colors[10];\n result[8] = colors[12];\n \n result[10] = colors[23];\n result[12] = colors[21];\n \n result[21] = colors[4];\n result[23] = colors[2];\n\n result[18] = colors[17];\n result[20] = colors[18];\n result[19] = colors[20];\n result[17] = colors[19];\n\n return result;\n }\n \n private int[] Move2(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[23];\n result[4] = colors[21];\n \n result[6] = colors[2];\n result[8] = colors[4];\n \n result[10] = colors[6];\n result[12] = colors[8];\n \n result[21] = colors[12];\n result[23] = colors[10];\n \n result[18] = colors[20];\n result[20] = colors[19];\n result[19] = colors[17];\n result[17] = colors[18];\n\n return result;\n }\n \n private int[] Move3(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[5];\n result[3] = colors[7];\n \n result[6] = colors[9];\n result[7] = colors[11];\n \n result[9] = colors[24];\n result[11] = colors[22];\n \n result[22] = colors[3];\n result[24] = colors[1];\n \n result[14] = colors[16];\n result[16] = colors[15];\n result[15] = colors[13];\n result[13] = colors[14];\n\n return result;\n }\n \n private int[] Move4(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[24];\n result[3] = colors[22];\n \n result[5] = colors[1];\n result[7] = colors[3];\n \n result[9] = colors[5];\n result[11] = colors[7];\n \n result[22] = colors[11];\n result[24] = colors[9];\n \n result[14] = colors[13];\n result[16] = colors[14];\n result[15] = colors[16];\n result[13] = colors[15];\n\n return result;\n }\n \n private int[] Move5(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[13] = colors[5];\n result[14] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[21] = colors[13];\n result[22] = colors[14];\n \n result[4] = colors[3];\n result[2] = colors[4];\n result[1] = colors[2];\n result[3] = colors[1];\n\n return result;\n }\n \n private int[] Move6(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[22] = colors[14];\n result[21] = colors[13];\n \n result[14] = colors[5];\n result[13] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[3] = colors[4];\n result[4] = colors[2];\n result[2] = colors[1];\n result[1] = colors[3];\n\n return result;\n }\n \n private int[] Move7(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[7];\n result[16] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[23] = colors[15];\n result[24] = colors[16];\n \n result[10] = colors[9];\n result[12] = colors[10];\n result[11] = colors[12];\n result[9] = colors[11];\n\n return result;\n }\n \n private int[] Move8(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[24] = colors[16];\n result[23] = colors[15];\n \n result[16] = colors[7];\n result[15] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[9] = colors[10];\n result[10] = colors[12];\n result[12] = colors[11];\n result[11] = colors[9];\n\n return result;\n }\n \n private int[] Move9(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[16] = colors[3];\n result[14] = colors[4];\n \n result[10] = colors[16];\n result[9] = colors[14];\n \n result[17] = colors[10];\n result[19] = colors[9];\n \n result[3] = colors[17];\n result[4] = colors[19];\n \n result[5] = colors[6];\n result[6] = colors[8];\n result[8] = colors[7];\n result[7] = colors[5];\n\n return result;\n }\n \n private int[] Move10(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[3] = colors[16];\n result[4] = colors[14];\n \n result[16] = colors[10];\n result[14] = colors[9];\n \n result[10] = colors[17];\n result[9] = colors[19];\n \n result[17] = colors[3];\n result[4] = colors[19];\n \n result[6] = colors[5];\n result[8] = colors[6];\n result[7] = colors[8];\n result[5] = colors[7];\n\n return result;\n }\n \n private int[] Move11(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[1];\n result[13] = colors[2];\n \n result[12] = colors[15];\n result[11] = colors[13];\n \n result[18] = colors[12];\n result[20] = colors[11];\n \n result[1] = colors[18];\n result[2] = colors[20];\n \n result[21] = colors[23];\n result[22] = colors[21];\n result[24] = colors[22];\n result[23] = colors[24];\n\n return result;\n }\n \n private int[] Move12(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[15];\n result[2] = colors[13];\n \n result[15] = colors[12];\n result[13] = colors[11];\n \n result[12] = colors[18];\n result[11] = colors[20];\n \n result[18] = colors[1];\n result[20] = colors[2];\n \n result[23] = colors[21];\n result[21] = colors[22];\n result[22] = colors[24];\n result[24] = colors[23];\n\n return result;\n }\n\n private bool Check(int[] colors)\n {\n for (var i = 0; i < 6; i++) {\n var startIndx = i * 4 + 1;\n if (colors[startIndx] == colors[startIndx + 1] && colors[startIndx] == colors[startIndx + 2]\n && colors[startIndx] == colors[startIndx + 2] && colors[startIndx] == colors[startIndx + 3]) {\n return true;\n }\n }\n\n return false;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n const int max = 25;\n var input = sr.ReadArrayOfInt32();\n var colors = new int[max];\n for (var i = 1; i < max; i++) {\n colors[i] = input[i - 1];\n }\n if (Check(Move1(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move2(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move3(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move4(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move5(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move6(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move7(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move8(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move9(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move10(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move11(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move12(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n\n sw.WriteLine(\"NO\");\n }\n\n private int[] Move1(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[6];\n result[4] = colors[8];\n \n result[6] = colors[10];\n result[8] = colors[12];\n \n result[10] = colors[23];\n result[12] = colors[21];\n \n result[21] = colors[4];\n result[23] = colors[2];\n\n result[18] = colors[17];\n result[20] = colors[18];\n result[19] = colors[20];\n result[17] = colors[19];\n\n return result;\n }\n \n private int[] Move2(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[23];\n result[4] = colors[21];\n \n result[6] = colors[2];\n result[8] = colors[4];\n \n result[10] = colors[6];\n result[12] = colors[8];\n \n result[21] = colors[12];\n result[23] = colors[10];\n \n result[18] = colors[20];\n result[20] = colors[19];\n result[19] = colors[17];\n result[17] = colors[18];\n\n return result;\n }\n \n private int[] Move3(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[5];\n result[3] = colors[7];\n \n result[6] = colors[9];\n result[7] = colors[11];\n \n result[9] = colors[22];\n result[11] = colors[24];\n \n result[22] = colors[3];\n result[24] = colors[1];\n \n result[14] = colors[16];\n result[16] = colors[15];\n result[15] = colors[13];\n result[13] = colors[14];\n\n return result;\n }\n \n private int[] Move4(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[24];\n result[3] = colors[22];\n \n result[5] = colors[1];\n result[7] = colors[3];\n \n result[9] = colors[5];\n result[11] = colors[7];\n \n result[22] = colors[11];\n result[24] = colors[9];\n \n result[14] = colors[13];\n result[16] = colors[14];\n result[15] = colors[16];\n result[13] = colors[15];\n\n return result;\n }\n \n private int[] Move5(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[13] = colors[5];\n result[14] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[21] = colors[13];\n result[22] = colors[14];\n \n result[4] = colors[3];\n result[2] = colors[4];\n result[1] = colors[2];\n result[3] = colors[1];\n\n return result;\n }\n \n private int[] Move6(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[22] = colors[14];\n result[21] = colors[13];\n \n result[14] = colors[5];\n result[13] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[3] = colors[4];\n result[4] = colors[2];\n result[2] = colors[1];\n result[1] = colors[3];\n\n return result;\n }\n \n private int[] Move7(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[7];\n result[16] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[23] = colors[15];\n result[24] = colors[16];\n \n result[10] = colors[9];\n result[12] = colors[10];\n result[11] = colors[12];\n result[9] = colors[11];\n\n return result;\n }\n \n private int[] Move8(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[24] = colors[16];\n result[23] = colors[15];\n \n result[16] = colors[7];\n result[15] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[9] = colors[10];\n result[10] = colors[12];\n result[12] = colors[11];\n result[11] = colors[9];\n\n return result;\n }\n \n private int[] Move9(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[16] = colors[3];\n result[14] = colors[4];\n \n result[10] = colors[16];\n result[9] = colors[14];\n \n result[17] = colors[10];\n result[19] = colors[9];\n \n result[3] = colors[17];\n result[4] = colors[19];\n \n result[5] = colors[6];\n result[6] = colors[8];\n result[8] = colors[7];\n result[7] = colors[5];\n\n return result;\n }\n \n private int[] Move10(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[3] = colors[16];\n result[4] = colors[14];\n \n result[16] = colors[10];\n result[14] = colors[9];\n \n result[10] = colors[17];\n result[9] = colors[19];\n \n result[17] = colors[3];\n result[4] = colors[19];\n \n result[6] = colors[5];\n result[8] = colors[6];\n result[7] = colors[8];\n result[5] = colors[7];\n\n return result;\n }\n \n private int[] Move11(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[1];\n result[13] = colors[2];\n \n result[12] = colors[15];\n result[11] = colors[13];\n \n result[18] = colors[12];\n result[20] = colors[11];\n \n result[1] = colors[18];\n result[2] = colors[20];\n \n result[21] = colors[23];\n result[22] = colors[21];\n result[24] = colors[22];\n result[23] = colors[24];\n\n return result;\n }\n \n private int[] Move12(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[15];\n result[2] = colors[13];\n \n result[15] = colors[12];\n result[13] = colors[11];\n \n result[12] = colors[18];\n result[11] = colors[20];\n \n result[18] = colors[1];\n result[20] = colors[2];\n \n result[23] = colors[21];\n result[21] = colors[22];\n result[22] = colors[24];\n result[24] = colors[23];\n\n return result;\n }\n\n private bool Check(int[] colors)\n {\n for (var i = 0; i < 6; i++) {\n var startIndx = i * 4 + 1;\n if (colors[startIndx] == colors[startIndx + 1] && colors[startIndx] == colors[startIndx + 2]\n && colors[startIndx] == colors[startIndx + 2] && colors[startIndx] == colors[startIndx + 3]) {\n return true;\n }\n }\n\n return false;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n const int max = 25;\n var input = sr.ReadArrayOfInt32();\n var colors = new int[max];\n for (var i = 1; i < max; i++) {\n colors[i] = input[i - 1];\n }\n if (Check(Move1(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move2(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move3(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move4(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move5(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move6(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move7(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move8(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move9(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move10(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move11(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n if (Check(Move12(colors))) {\n sw.WriteLine(\"YES\");\n return;\n }\n\n sw.WriteLine(\"NO\");\n }\n\n private int[] Move1(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[6];\n result[4] = colors[8];\n \n result[6] = colors[10];\n result[8] = colors[12];\n \n result[10] = colors[23];\n result[12] = colors[21];\n \n result[21] = colors[4];\n result[23] = colors[2];\n\n result[18] = colors[17];\n result[20] = colors[18];\n result[19] = colors[20];\n result[17] = colors[19];\n\n return result;\n }\n \n private int[] Move2(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[2] = colors[23];\n result[4] = colors[21];\n \n result[6] = colors[2];\n result[8] = colors[4];\n \n result[10] = colors[6];\n result[12] = colors[8];\n \n result[21] = colors[12];\n result[23] = colors[10];\n \n result[18] = colors[20];\n result[20] = colors[19];\n result[19] = colors[17];\n result[17] = colors[18];\n\n return result;\n }\n \n private int[] Move3(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[5];\n result[3] = colors[7];\n \n result[6] = colors[9];\n result[7] = colors[11];\n \n result[9] = colors[22];\n result[11] = colors[24];\n \n result[22] = colors[3];\n result[24] = colors[1];\n \n result[14] = colors[16];\n result[16] = colors[15];\n result[15] = colors[13];\n result[13] = colors[14];\n\n return result;\n }\n \n private int[] Move4(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[24];\n result[3] = colors[22];\n \n result[5] = colors[1];\n result[7] = colors[3];\n \n result[9] = colors[5];\n result[11] = colors[7];\n \n result[22] = colors[11];\n result[24] = colors[9];\n \n result[14] = colors[13];\n result[16] = colors[14];\n result[15] = colors[16];\n result[13] = colors[15];\n\n return result;\n }\n \n private int[] Move5(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[13] = colors[5];\n result[14] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[21] = colors[13];\n result[22] = colors[14];\n \n result[3] = colors[4];\n result[1] = colors[3];\n result[2] = colors[1];\n result[4] = colors[2];\n\n return result;\n }\n \n private int[] Move6(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[22] = colors[14];\n result[21] = colors[13];\n \n result[14] = colors[5];\n result[13] = colors[6];\n \n result[5] = colors[17];\n result[6] = colors[18];\n \n result[17] = colors[21];\n result[18] = colors[22];\n \n result[2] = colors[4];\n result[1] = colors[2];\n result[3] = colors[1];\n result[4] = colors[3];\n\n return result;\n }\n \n private int[] Move7(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[7];\n result[16] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[23] = colors[15];\n result[24] = colors[16];\n \n result[9] = colors[10];\n result[10] = colors[12];\n result[12] = colors[11];\n result[11] = colors[9];\n\n return result;\n }\n \n private int[] Move8(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[24] = colors[16];\n result[23] = colors[15];\n \n result[16] = colors[7];\n result[15] = colors[8];\n \n result[7] = colors[19];\n result[8] = colors[20];\n \n result[19] = colors[23];\n result[20] = colors[24];\n \n result[9] = colors[11];\n result[10] = colors[9];\n result[12] = colors[10];\n result[11] = colors[12];\n\n return result;\n }\n \n private int[] Move9(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[16] = colors[3];\n result[14] = colors[4];\n \n result[10] = colors[16];\n result[9] = colors[14];\n \n result[17] = colors[10];\n result[19] = colors[9];\n \n result[3] = colors[17];\n result[4] = colors[19];\n \n result[5] = colors[6];\n result[6] = colors[8];\n result[8] = colors[7];\n result[7] = colors[5];\n\n return result;\n }\n \n private int[] Move10(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[3] = colors[16];\n result[4] = colors[14];\n \n result[16] = colors[10];\n result[14] = colors[9];\n \n result[10] = colors[17];\n result[9] = colors[19];\n \n result[17] = colors[3];\n result[4] = colors[19];\n \n result[6] = colors[5];\n result[8] = colors[6];\n result[7] = colors[8];\n result[5] = colors[7];\n\n return result;\n }\n \n private int[] Move11(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[15] = colors[1];\n result[13] = colors[2];\n \n result[12] = colors[15];\n result[11] = colors[13];\n \n result[18] = colors[12];\n result[20] = colors[11];\n \n result[1] = colors[18];\n result[2] = colors[20];\n \n result[21] = colors[23];\n result[22] = colors[21];\n result[24] = colors[22];\n result[23] = colors[24];\n\n return result;\n }\n \n private int[] Move12(int[] colors)\n {\n var result = (int[]) colors.Clone();\n\n result[1] = colors[15];\n result[2] = colors[13];\n \n result[15] = colors[12];\n result[13] = colors[11];\n \n result[12] = colors[18];\n result[11] = colors[20];\n \n result[18] = colors[1];\n result[20] = colors[2];\n \n result[23] = colors[21];\n result[21] = colors[22];\n result[22] = colors[24];\n result[24] = colors[23];\n\n return result;\n }\n\n private bool Check(int[] colors)\n {\n for (var i = 0; i < 6; i++) {\n var startIndx = i * 4 + 1;\n if (colors[startIndx] == colors[startIndx + 1] && colors[startIndx] == colors[startIndx + 2]\n && colors[startIndx] == colors[startIndx + 2] && colors[startIndx] == colors[startIndx + 3]) {\n return true;\n }\n }\n\n return false;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n public class C\n {\n static bool checkOk(int s , int [] inputs)\n {\n int c = inputs[s*4]; \n for(int i = 0;i<4; i++)\n {\n if (c != inputs[s * 4 + i])\n return false;\n }\n\n return true;\n }\n\n static bool checkRotation(int [,] arr, int [] inp ,int aindex )\n {\n\n int[] farr = new int[8];\n int[] sarr = new int[8];\n int fp=0, sp = 0;\n for(int i = 1; i < 9; i++)\n {\n farr[fp++] = inp[arr[aindex,i]];\n sarr[sp++] = inp[arr[aindex+1, i]];\n }\n\n bool checkR = false;\n for(int i = 0; i < 8; i++)\n {\n if (farr[i] != sarr[(i + 2) % 8])\n checkR=true;\n\n }\n\n if (!checkR)\n return true;\n\n for (int i = 0; i < 8; i++)\n {\n if (farr[i] != sarr[(i - 2+8) % 8])\n return false;\n\n }\n\n return true;\n }\n\n static void Main(string[] args)\n {\n int[,] arr = { { 0, 12, 13,4,5,16,17,20,21 },{ 2,14,15,6,7,18,19,22,23}, { 1,1,0,12,14,10,11,23,21 }, { 5,3,2,13,15,8,9,18,16}, { 3, 0,2,4,6,8,10,23,21} ,{ 4,1,3,5,7,9,11,22,20} };\n\n string inp = Console.ReadLine();\n int[] inputs = new int[24];\n string[] splits = inp.Split(' ');\n\n for(int i =0; i < 24; i++)\n {\n inputs[i] = int.Parse(splits[i]);\n }\n bool isPoss = false;\n for(int i =0; i<6; i+=2)\n {\n if(checkOk(arr[i,0], inputs) && checkOk(arr[i+1, 0], inputs))\n {\n\n isPoss = checkRotation(arr, inputs, i);\n break;\n }\n\n }\n if(isPoss)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n \n\n }\n }\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize * faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr, 0) && IsCompleteFace(arr, 2))\n {\n cir = toListArr(arr, faceSize * 3, faceSize * 1, faceSize * 4, faceSize * 5);\n }\n else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 3, faceSize * 2, faceSize * 4);\n\n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for (int i = 1; i < 8; i++)\n {\n if (cir[0, 0] == cir[1, i] && ((8 - i <= 2 && i <= 2)))\n {\n index = i;\n bool flag = true;\n for (int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if (flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2, 8];\n returnArr[0, 0] = arr[index1];\n returnArr[0, 1] = arr[index1 + 1];\n returnArr[0, 2] = arr[index2];\n returnArr[0, 3] = arr[index2 + 1];\n returnArr[0, 4] = arr[index3];\n returnArr[0, 5] = arr[index3 + 1];\n returnArr[0, 6] = arr[index4];\n returnArr[0, 7] = arr[index4 + 1];\n returnArr[1, 0] = arr[index1 + 2];\n returnArr[1, 1] = arr[index1 + 3];\n returnArr[1, 2] = arr[index2 + 2];\n returnArr[1, 3] = arr[index2 + 3];\n returnArr[1, 4] = arr[index3 + 2];\n returnArr[1, 5] = arr[index3 + 3];\n returnArr[1, 6] = arr[index4 + 2];\n returnArr[1, 7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex * faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize * faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr, 0) && IsCompleteFace(arr, 2))\n {\n cir = toListArr(arr, faceSize * 3, faceSize * 1, faceSize * 4, faceSize * 5);\n }\n else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 3, faceSize * 2, faceSize * 4);\n\n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for (int i = 0; i < 8; i++)\n {\n if (cir[0, 0] == cir[1, i])\n {\n index = i;\n bool flag = true;\n for (int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if (flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2, 8];\n returnArr[0, 0] = arr[index1];\n returnArr[0, 1] = arr[index1 + 1];\n returnArr[0, 2] = arr[index2];\n returnArr[0, 3] = arr[index2 + 1];\n returnArr[0, 4] = arr[index3];\n returnArr[0, 5] = arr[index3 + 1];\n returnArr[0, 6] = arr[index4];\n returnArr[0, 7] = arr[index4 + 1];\n returnArr[1, 0] = arr[index1 + 2];\n returnArr[1, 1] = arr[index1 + 3];\n returnArr[1, 2] = arr[index2 + 2];\n returnArr[1, 3] = arr[index2 + 3];\n returnArr[1, 4] = arr[index3 + 2];\n returnArr[1, 5] = arr[index3 + 3];\n returnArr[1, 6] = arr[index4 + 2];\n returnArr[1, 7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex * faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize * faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr, 0) && IsCompleteFace(arr, 2))\n {\n cir = toListArr(arr, faceSize * 3, faceSize * 1, faceSize * 4, faceSize * 5);\n }\n else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 3, faceSize * 2, faceSize * 4);\n\n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for (int i = 1; i < 8; i++)\n {\n if (cir[0, 0] == cir[1, i])\n {\n index = i;\n bool flag = true;\n for (int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if (flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2, 8];\n returnArr[0, 0] = arr[index1];\n returnArr[0, 1] = arr[index1 + 1];\n returnArr[0, 2] = arr[index2];\n returnArr[0, 3] = arr[index2 + 1];\n returnArr[0, 4] = arr[index3];\n returnArr[0, 5] = arr[index3 + 1];\n returnArr[0, 6] = arr[index4];\n returnArr[0, 7] = arr[index4 + 1];\n returnArr[1, 0] = arr[index1 + 2];\n returnArr[1, 1] = arr[index1 + 3];\n returnArr[1, 2] = arr[index2 + 2];\n returnArr[1, 3] = arr[index2 + 3];\n returnArr[1, 4] = arr[index3 + 2];\n returnArr[1, 5] = arr[index3 + 3];\n returnArr[1, 6] = arr[index4 + 2];\n returnArr[1, 7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex * faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize * faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr, 0) && IsCompleteFace(arr, 2))\n {\n cir = toListArr(arr, faceSize, faceSize * 3, faceSize * 4, faceSize * 5);\n }\n else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 3, faceSize * 2, faceSize * 4);\n\n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for (int i = 0; i < 8; i++)\n {\n if (cir[0, 0] == cir[1, i])\n {\n index = i;\n bool flag = true;\n for (int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if (flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2, 8];\n returnArr[0, 0] = arr[index1];\n returnArr[0, 1] = arr[index1 + 1];\n returnArr[0, 2] = arr[index2];\n returnArr[0, 3] = arr[index2 + 1];\n returnArr[0, 4] = arr[index3];\n returnArr[0, 5] = arr[index3 + 1];\n returnArr[0, 6] = arr[index4];\n returnArr[0, 7] = arr[index4 + 1];\n returnArr[1, 0] = arr[index1 + 2];\n returnArr[1, 1] = arr[index1 + 3];\n returnArr[1, 2] = arr[index2 + 2];\n returnArr[1, 3] = arr[index2 + 3];\n returnArr[1, 4] = arr[index3 + 2];\n returnArr[1, 5] = arr[index3 + 3];\n returnArr[1, 6] = arr[index4 + 2];\n returnArr[1, 7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex * faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BT887C\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int faceSize = 4;\n const int faceNum = 6;\n\n\n int[] arr = new int[faceNum * faceSize];\n\n string input = Console.ReadLine();\n\n string[] splitRes = input.Split(' ');\n for (int i = 0; i < faceSize*faceNum; i++)\n {\n var item = splitRes[i];\n arr[i] = int.Parse(item);\n }\n int[,] cir;\n if (IsCompleteFace(arr,0) && IsCompleteFace(arr,2))\n {\n cir = toListArr(arr, faceSize, faceSize * 3, faceSize * 4, faceSize * 5);\n } else if (IsCompleteFace(arr, 1) && IsCompleteFace(arr, 5))\n {\n RotateLeft(arr, faceSize * 0);\n RotateLeft(arr, faceSize * 0);\n\n RotateRight(arr, faceSize * 3);\n\n RotateLeft(arr, faceSize * 4);\n\n cir = toListArr(arr, faceSize * 0, faceSize * 2, faceSize * 3, faceSize * 4);\n \n }\n else if (IsCompleteFace(arr, 3) && IsCompleteFace(arr, 4))\n {\n RotateRight(arr, faceSize * 0);\n RotateRight(arr, faceSize * 1);\n RotateRight(arr, faceSize * 2);\n RotateByRightDiagonal(arr, faceSize * 5);\n cir = toListArr(arr, faceSize * 0, faceSize * 1, faceSize * 2, faceSize * 5);\n }\n else\n {\n Console.WriteLine(returnString(false));\n return;\n }\n\n int index = 0;\n bool result = false;\n for(int i = 0; i < 8; i++)\n {\n if(cir[0,0] == cir[1,i])\n {\n index = i;\n bool flag = true;\n for(int j = 0; j < 8; j++)\n {\n if (cir[0, j] != cir[1, ((index + j) % 8)])\n flag = false;\n }\n if(flag == true)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(returnString(result));\n return;\n\n\n }\n\n static int[,] toListArr(int[] arr, int index1, int index2, int index3, int index4)\n {\n int[,] returnArr = new int[2,8];\n returnArr[0,0] = arr[index1];\n returnArr[0,1] = arr[index1 + 1];\n returnArr[0,2] = arr[index2];\n returnArr[0,3] = arr[index2 + 1];\n returnArr[0,4] = arr[index3];\n returnArr[0,5] = arr[index3 + 1];\n returnArr[0,6] = arr[index4];\n returnArr[0,7] = arr[index4 + 1];\n returnArr[1,0] = arr[index1 + 2];\n returnArr[1,1] = arr[index1 + 3];\n returnArr[1,2] = arr[index2 + 2];\n returnArr[1,3] = arr[index2 + 3];\n returnArr[1,4] = arr[index3 + 2];\n returnArr[1,5] = arr[index3 + 3];\n returnArr[1,6] = arr[index4 + 2];\n returnArr[1,7] = arr[index4 + 3];\n\n return returnArr;\n }\n\n static void RotateLeft(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 2];\n arr[startIndex + 2] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 1];\n arr[startIndex + 1] = temp;\n\n }\n\n static void RotateRight(int[] arr, int startIndex)\n {\n int temp = arr[startIndex];\n arr[startIndex] = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 3];\n arr[startIndex + 3] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n }\n\n static void RotateByRightDiagonal(int[] arr, int startIndex)\n {\n int temp = arr[startIndex + 1];\n arr[startIndex + 1] = arr[startIndex + 2];\n arr[startIndex + 2] = temp;\n\n }\n\n\n\n //static void RotateDown(int[] arr, int startIndex)\n //{\n // int temp = arr[startIndex];\n // arr[startIndex] = arr[startIndex + 2];\n // arr[startIndex + 1] = arr[startIndex];\n // arr[startIndex + 2] = arr[startIndex + 3];\n // arr[startIndex + 3] = arr[startIndex + 1];\n //}\n\n\n\n\n static bool IsCompleteFace(int[] face, int faceIndex)\n {\n const int faceSize = 4;\n\n int pattern = face[faceIndex*faceSize];\n for (int i = 0; i < faceSize; i++)\n {\n if (face[faceIndex * faceSize + i] != pattern)\n return false;\n }\n return true;\n }\n\n static string returnString(bool res)\n {\n if (res)\n return \"YES\";\n else\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n// To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\nconst bool testing = true;\n#else\n const bool testing = true;\n#endif\n\n static void program(TextReader input)\n {\n var s = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var trans = new List>() {\n new List(){1,3,5,7,9,11,24,22},\n new List(){2,4,6,8,10,12,23,21},\n new List(){13,14,5,6,17,18,21,22},\n new List(){15,16,7,8,19,20,23,24},\n new List(){15,16,7,8,19,20,23,24},\n new List(){14,3,4,17,19,10,9,16},\n new List(){13,1,2,18,20,12,11,15}\n };\n\n for(var i = 0; i < trans.Count; i++)\n {\n var newS = s.ToList();\n for(var j = 0; j < trans[i].Count; j++)\n {\n newS[trans[i][j] - 1] = s[trans[i][(j + 2) % 8] - 1];\n }\n\n var pos = true;\n for(var k = 0; k < 5; k++)\n {\n var color = newS[k * 4];\n for(var j = k * 4 + 1; j < (k + 1) * 4; j++)\n {\n if(newS[j] != color)\n {\n pos = false;\n }\n }\n }\n\n if (pos)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"NO\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"YES\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] a;\n int[] Parse(string s)\n {\n return s.Split(',').Select(ss => a[int.Parse(ss) - 1]).ToArray();\n }\n\n bool Fun(string left, string right, string c1, string c2)\n {\n var l = Parse(left);\n var r = Parse(right);\n var v1 = Parse(c1);\n var v2 = Parse(c2);\n if (l.Distinct().Count() > 1 || r.Distinct().Count() > 1)\n return false;\n\n for (int i = 0; i < 8; i += 2)\n if (v1[i] != v1[i + 1])\n return false;\n\n bool f = true;\n for (int i = 0; i < 8; i++)\n if (v1[i] != v2[(i + 2) % 8])\n f = false;\n if (f)\n return true;\n f = true;\n for (int i = 0; i < 8; i++)\n if (v1[i] != v2[(i + 6) % 8])\n f = false;\n return f;\n }\n\n public void Solve()\n {\n a = ReadIntArray();\n\n Write(Fun(\"13,14,15,16\", \"17,18,19,20\", \"1,3,5,7,9,11,24,22\", \"2,4,6,8,10,12,23,21\") ||\n Fun(\"1,2,3,4\", \"9,10,11,12\", \"13,14,5,6,17,18,21,22\", \"15,16,7,8,19,20,23,24\") ||\n Fun(\"5,6,7,8\", \"21,22,23,24\", \"3,4,17,19,10,9,16,14\", \"1,2,18,20,12,11,16,14\") ? \"YES\" : \"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}], "src_uid": "881a820aa8184d9553278a0002a3b7c4"} {"source_code": "using System;\n\nnamespace BubbleCup\n{\n class Program\n {\n private static int modulo = 1000000007;\n\n private static int ModularAddition(int firstNumber, int secondNumber)\n {\n var result = (firstNumber % modulo + secondNumber % modulo) % modulo;\n if(result < 0)\n result += modulo;\n return result;\n }\n\n private static int ModularExponentiation(int number, int power)\n {\n int result = 1;\n while (power > 0)\n {\n if ((power & 1) == 1)\n result = ModularMultiplication(result, number);\n power >>= 1;\n number = ModularMultiplication(number, number);\n }\n return result;\n }\n\n private static int ModularMultiplication(long firstNumber, long secondNumber)\n {\n return (int)(((firstNumber % (long)modulo) * (secondNumber % (long)modulo)) % (long)modulo);\n }\n\n private static int ModularMultiplicativeInverse(int number)\n {\n return ModularExponentiation(number, modulo - 2);\n }\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n int states = 0;\n\n int binaryTreeStates = ModularExponentiation(2, n + 1) - 1;\n states = ModularAddition(states, binaryTreeStates);\n int statesThatNotProduceDuplicates = 1;\n int previousLevelStatesCount = ModularExponentiation(2, n);\n for (int treeLevel = n + 1; treeLevel <= 2 * n; treeLevel++)\n {\n int currentLevelStates =\n ModularMultiplication(2, ModularAddition(previousLevelStatesCount, -ModularMultiplication(2, statesThatNotProduceDuplicates)))\n + ModularMultiplication(2, statesThatNotProduceDuplicates);\n states = ModularAddition(states, currentLevelStates);\n\n previousLevelStatesCount = currentLevelStates;\n statesThatNotProduceDuplicates = ModularMultiplication(\n statesThatNotProduceDuplicates,\n treeLevel);\n statesThatNotProduceDuplicates = ModularMultiplication(\n statesThatNotProduceDuplicates,\n ModularMultiplicativeInverse(treeLevel - n));\n }\n\n Console.Write(states + \"\\n\");\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Bots\n{\n internal class Program\n {\n private const int mod = 1000000007;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static long Pow(long a, int k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n private static void Main(string[] args)\n {\n int n = Next()+1;\n\n long f = 1;\n for (int i = 2; i <= n; i++)\n {\n f = (f*i)%mod;\n }\n long f2 = f;\n for (int i = n + 1; i <= 2*n; i++)\n {\n f2 = (f2*i)%mod;\n }\n\n long f1 = Pow(f, mod - 2);\n\n long res = (((f2*f1)%mod)*f1)%mod;\n\n\n writer.WriteLine(res-1);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n//using System.Numerics;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int MOD = 1000000007;\n const int MAX = 2000000;\n\n long ModPow(long x, long p)\n {\n long ret = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = ret * x % MOD;\n x = x * x % MOD;\n p >>= 1;\n }\n return ret;\n }\n\n void Solve()\n {\n var fact = new long[MAX * 2];\n fact[0] = 1;\n for (int i = 1; i < 2 * MAX; i++)\n fact[i] = fact[i - 1] * i % MOD;\n\n int n = ReadInt() + 1;\n long ret = 2 * fact[2 * n - 1] * ModPow(fact[n], MOD - 2) % MOD * ModPow(fact[n - 1], MOD - 2) % MOD - 1;\n if (ret < 0)\n ret += MOD;\n Write(ret);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"transform.in\");\n //writer = new StreamWriter(\"transform.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n ModInteger ans = 0;\n var table = new ModTable(2000050);\n \n n += 1;\n ans = 2 * table[2 * n - 1];\n ans *= table.inv[n] * table.inv[n - 1];\n IO.Printer.Out.WriteLine(ans - 1);\n\n\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n\n\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public const long Mod = (long)1e9 + 7;\n public long num;\n public ModInteger(long n) : this() { num = n % Mod; if (num < 0) num += Mod; }\n public override string ToString() { return num.ToString(); }\n public static ModInteger operator +(ModInteger l, ModInteger r) { var n = l.num + r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }\n public static ModInteger operator -(ModInteger l, ModInteger r) { var n = l.num + Mod - r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }\n public static ModInteger operator *(ModInteger l, ModInteger r) { return new ModInteger(l.num * r.num); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n}\n#endregion\n#region ModPow\npublic partial struct ModInteger\n{\n static public ModInteger Pow(ModInteger v, ModInteger k)\n {\n ModInteger ret = 1;\n var n = k.num;\n for (; n > 0; n >>= 1, v *= v)\n {\n if ((n & 1) == 1)\n ret = ret * v;\n }\n return ret;\n }\n}\n#endregion\n#region Inverse\npublic partial struct ModInteger\n{\n static public ModInteger Inverse(ModInteger v)\n {\n long p, q;\n ExGCD(v.num, Mod, out p, out q);\n return new ModInteger(p % Mod + Mod);\n }\n static public long ExGCD(long a, long b, out long x, out long y)\n {\n var u = new long[] { a, 1, 0 };\n var v = new long[] { b, 0, 1 };\n while (v[0] != 0)\n {\n var t = u[0] / v[0];\n for (int i = 0; i < 3; i++)\n {\n var tmp = u[i] - t * v[i];\n u[i] = v[i];\n v[i] = tmp;\n }\n }\n x = u[1];\n y = u[2];\n if (u[0] > 0)\n return u[0];\n for (int i = 0; i < 3; i++)\n u[i] = -u[i];\n return u[0];\n\n }\n}\n#endregion\n#region Permutaion\npublic class ModTable\n{\n public ModInteger[] perm, inv;\n public ModTable(int n)\n {\n perm = new ModInteger[n + 1];\n inv = new ModInteger[n + 1];\n perm[0] = 1;\n for (int i = 1; i <= n; i++)\n perm[i] = perm[i - 1] * i;\n inv[n] = ModInteger.Inverse(perm[n]);\n for (int i = n - 1; i >= 0; i--)\n inv[i] = inv[i + 1] * (i + 1);\n inv[0] = inv[1];\n }\n public ModInteger this[int k] { get { return perm[k]; } }\n public ModInteger Inverse(int k) { return inv[k]; }\n public ModInteger Permutation(int n, int k)\n {\n if (n < 0 || n >= perm.Length)\n return 0;\n if (k < 0 || k >= n)\n return 0;\n return perm[n] * inv[n - k];\n }\n public ModInteger Combination(int n, int r)\n {\n if (n < 0 || n >= perm.Length || r < 0 || r > n) return 0;\n return perm[n] * inv[n - r] * inv[r];\n }\n public ModInteger RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return Combination(n + k - 1, k);\n }\n}\n#endregion\n#region CombinationTable\npublic class ModCombinationTable\n{\n ModInteger[][] nCr;\n public ModCombinationTable(int n)\n {\n nCr = new ModInteger[n + 1][];\n for (int i = 0; i <= n; i++)\n nCr[i] = new ModInteger[i + 2];\n nCr[0][0] = 1;\n for (int i = 0; i <= n; i++)\n {\n nCr[i][0] = 1;\n for (int j = 1; j <= i; j++)\n nCr[i][j] = nCr[i - 1][j - 1] + nCr[i - 1][j];\n }\n }\n public ModInteger this[int n, int r]\n {\n get\n {\n if (n < 0 || n > nCr.Length)\n throw new IndexOutOfRangeException(\"n<=0 || n>N \");\n if (r < 0 || r > n)\n throw new IndexOutOfRangeException(\"r<=0 ||r>n\");\n return nCr[n][r];\n }\n }\n public ModInteger RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return this[n + k - 1, k];\n }\n}\n#endregion\n"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n ModInteger ans = 0;\n var state = 1;\n var table = new ModTable(1000050);\n for (int i = 0; i < 2 * n; i++)\n {\n ans += state;\n if (i < n)\n state *= 2;\n else\n {\n var pat = table.Combination(i, n) * 2;\n ans += pat;\n\n }\n }\n IO.Printer.Out.WriteLine(ans);\n\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n\n\n\n#region ModNumber\npublic partial struct ModInteger\n{\n public const long Mod = (long)1e9 + 7;\n public long num;\n public ModInteger(long n) : this() { num = n % Mod; if (num < 0) num += Mod; }\n public override string ToString() { return num.ToString(); }\n public static ModInteger operator +(ModInteger l, ModInteger r) { var n = l.num + r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }\n public static ModInteger operator -(ModInteger l, ModInteger r) { var n = l.num + Mod - r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }\n public static ModInteger operator *(ModInteger l, ModInteger r) { return new ModInteger(l.num * r.num); }\n public static implicit operator ModInteger(long n) { return new ModInteger(n); }\n}\n#endregion\n#region ModPow\npublic partial struct ModInteger\n{\n static public ModInteger Pow(ModInteger v, ModInteger k)\n {\n ModInteger ret = 1;\n var n = k.num;\n for (; n > 0; n >>= 1, v *= v)\n {\n if ((n & 1) == 1)\n ret = ret * v;\n }\n return ret;\n }\n}\n#endregion\n#region Inverse\npublic partial struct ModInteger\n{\n static public ModInteger Inverse(ModInteger v)\n {\n long p, q;\n ExGCD(v.num, Mod, out p, out q);\n return new ModInteger(p % Mod + Mod);\n }\n static public long ExGCD(long a, long b, out long x, out long y)\n {\n var u = new long[] { a, 1, 0 };\n var v = new long[] { b, 0, 1 };\n while (v[0] != 0)\n {\n var t = u[0] / v[0];\n for (int i = 0; i < 3; i++)\n {\n var tmp = u[i] - t * v[i];\n u[i] = v[i];\n v[i] = tmp;\n }\n }\n x = u[1];\n y = u[2];\n if (u[0] > 0)\n return u[0];\n for (int i = 0; i < 3; i++)\n u[i] = -u[i];\n return u[0];\n\n }\n}\n#endregion\n#region Permutaion\npublic class ModTable\n{\n ModInteger[] perm, inv;\n public ModTable(int n)\n {\n perm = new ModInteger[n + 1];\n inv = new ModInteger[n + 1];\n perm[0] = 1;\n for (int i = 1; i <= n; i++)\n perm[i] = perm[i - 1] * i;\n inv[n] = ModInteger.Inverse(perm[n]);\n for (int i = n - 1; i >= 0; i--)\n inv[i] = inv[i + 1] * (i + 1);\n inv[0] = inv[1];\n }\n public ModInteger this[int k] { get { return perm[k]; } }\n public ModInteger Inverse(int k) { return inv[k]; }\n public ModInteger Permutation(int n, int k)\n {\n if (n < 0 || n >= perm.Length)\n return 0;\n if (k < 0 || k >= n)\n return 0;\n return perm[n] * inv[n - k];\n }\n public ModInteger Combination(int n, int r)\n {\n if (n < 0 || n >= perm.Length || r < 0 || r > n) return 0;\n return perm[n] * inv[n - r] * inv[r];\n }\n public ModInteger RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return Combination(n + k - 1, k);\n }\n}\n#endregion\n#region CombinationTable\npublic class ModCombinationTable\n{\n ModInteger[][] nCr;\n public ModCombinationTable(int n)\n {\n nCr = new ModInteger[n + 1][];\n for (int i = 0; i <= n; i++)\n nCr[i] = new ModInteger[i + 2];\n nCr[0][0] = 1;\n for (int i = 0; i <= n; i++)\n {\n nCr[i][0] = 1;\n for (int j = 1; j <= i; j++)\n nCr[i][j] = nCr[i - 1][j - 1] + nCr[i - 1][j];\n }\n }\n public ModInteger this[int n, int r]\n {\n get\n {\n if (n < 0 || n > nCr.Length)\n throw new IndexOutOfRangeException(\"n<=0 || n>N \");\n if (r < 0 || r > n)\n throw new IndexOutOfRangeException(\"r<=0 ||r>n\");\n return nCr[n][r];\n }\n }\n public ModInteger RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return this[n + k - 1, k];\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n//using System.Numerics;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int MOD = 1000000007;\n const int MAX = 1000000;\n\n long ModPow(long x, long p)\n {\n long ret = 1;\n while (p > 0)\n {\n if ((p & 1) == 1)\n ret = ret * x % MOD;\n x = x * x % MOD;\n p >>= 1;\n }\n return ret;\n }\n\n void Solve()\n {\n var fact = new long[MAX * 2];\n fact[0] = 1;\n for (int i = 1; i < MAX; i++)\n fact[i] = fact[i - 1] * i % MOD;\n\n int n = ReadInt() + 1;\n long ret = 2 * fact[2 * n - 1] * ModPow(fact[n], MOD - 2) % MOD * ModPow(fact[n - 1], MOD - 2) % MOD - 1;\n if (ret < 0)\n ret += MOD;\n Write(ret);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"transform.in\");\n //writer = new StreamWriter(\"transform.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace BubbleCup\n{\n class Program\n {\n private static int modulo = 1000000007;\n\n private static int ModularAddition(int firstNumber, int secondNumber)\n {\n return (firstNumber % modulo + secondNumber % modulo) % modulo;\n }\n\n private static int ModularExponentiation(int number, int power)\n {\n int result = 1;\n while (power > 0)\n {\n if ((power & 1) == 1)\n result = ModularMultiplication(result, number);\n power >>= 1;\n number = ModularMultiplication(number, number);\n }\n return result;\n }\n\n private static int ModularMultiplication(long firstNumber, long secondNumber)\n {\n return (int)(((firstNumber % (long)modulo) * (secondNumber % (long)modulo)) % (long)modulo);\n }\n\n private static int ModularMultiplicativeInverse(int number)\n {\n return ModularExponentiation(number, modulo - 2);\n }\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n int states = 0;\n\n int binaryTreeStates = ModularExponentiation(2, n + 1) - 1;\n states = ModularAddition(states, binaryTreeStates);\n int statesThatNotProduceDuplicates = 1;\n int previousLevelStatesCount = ModularExponentiation(2, n);\n for (int treeLevel = n + 1; treeLevel <= 2 * n; treeLevel++)\n {\n int currentLevelStates =\n ModularMultiplication(2, previousLevelStatesCount - ModularMultiplication(2, statesThatNotProduceDuplicates))\n + ModularMultiplication(2, statesThatNotProduceDuplicates);\n states = ModularAddition(states, currentLevelStates);\n\n previousLevelStatesCount = currentLevelStates;\n statesThatNotProduceDuplicates = ModularMultiplication(\n statesThatNotProduceDuplicates,\n treeLevel);\n statesThatNotProduceDuplicates = ModularMultiplication(\n statesThatNotProduceDuplicates,\n ModularMultiplicativeInverse(treeLevel - n));\n }\n\n Console.Write(states + \"\\n\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BubbleCup\n{\n class Program\n {\n private static int modulo = 1000000007;\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var states = 0;\n\n var binaryTreeStates = ((int)Math.Pow(2, n + 1) - 1) % modulo;\n states += binaryTreeStates;\n var statesThatNotProduceDuplicates = 1;\n var previousLevelStatesCount = (int)Math.Pow(2, n) % modulo;\n for(int treeLevel = n + 1; treeLevel <= 2 * n; treeLevel++)\n {\n var currentLevelStates = (2 * (previousLevelStatesCount - 2 * statesThatNotProduceDuplicates)\n + 2 * statesThatNotProduceDuplicates) % modulo;\n states += currentLevelStates;\n previousLevelStatesCount = currentLevelStates;\n statesThatNotProduceDuplicates *= treeLevel;\n statesThatNotProduceDuplicates /= treeLevel - n;\n }\n\n Console.Write(states + \"\\n\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BubbleCup\n{\n class Program\n {\n private static int modulo = 1000000007;\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var states = 0;\n\n var binaryTreeStates = ((int)Math.Pow(2, n + 1) - 1) % modulo;\n states += binaryTreeStates;\n var statesThatNotProduceDuplicates = 1;\n var previousLevelStatesCount = (int)Math.Pow(2, n) % modulo;\n for (int treeLevel = n + 1; treeLevel <= 2 * n; treeLevel++)\n {\n var currentLevelStates = (2 * (previousLevelStatesCount - 2 * statesThatNotProduceDuplicates)\n + 2 * statesThatNotProduceDuplicates) % modulo;\n states = (states + currentLevelStates) % modulo;\n previousLevelStatesCount = currentLevelStates;\n statesThatNotProduceDuplicates = (statesThatNotProduceDuplicates * treeLevel) % modulo;\n statesThatNotProduceDuplicates = (statesThatNotProduceDuplicates / (treeLevel - n)) % modulo;\n }\n\n Console.Write(states + \"\\n\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace BubbleCup\n{\n\tclass Program\n\t{\n\t\tprivate static Dictionary factorialCache = new Dictionary();\n\n\t\tprivate static int Factorial(int number)\n\t\t{\n\t\t\tif (factorialCache.ContainsKey(number))\n\t\t\t\treturn factorialCache[number];\n\n\t\t\tvar factorial = number;\n\t\t\tfor (var i = 1; i < number; i++)\n\t\t\t\tfactorial *= i;\n\n\t\t\tfactorialCache.Add(number, factorial);\n\t\t\treturn factorial;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\tvar possibleOutcomesCount = Factorial(2 * n) / (Factorial(n) * Factorial(n));\n\t\t\tvar stateWithDuplicates = possibleOutcomesCount * (2 * n + 1);\n\t\t\t\n\t\t\tvar states = stateWithDuplicates;\n\t\t\tvar level = 0;\n\t\t\tvar duplicatesOnCurrentLevel = possibleOutcomesCount - (int)Math.Pow(2, level);\n\t\t\twhile (duplicatesOnCurrentLevel > 0)\n\t\t\t{\n\t\t\t\tstates -= duplicatesOnCurrentLevel;\n\t\t\t\tlevel++;\n\t\t\t\tduplicatesOnCurrentLevel = possibleOutcomesCount - (int)Math.Pow(2, level);\n\t\t\t}\n\n\t\t\tConsole.Write(states);\n\t\t}\n\t}\n}\n"}], "src_uid": "a18833c987fd7743e8021196b5dcdd1b"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Alyona_and_copybooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long n = long.Parse(s[0]);\n long a = long.Parse(s[1]);\n long b = long.Parse(s[2]);\n long c = long.Parse(s[3]);\n long am = 0;\n long k = 4 - (n % 4);\n if (k == 1)\n {\n if (Math.Min(c * 3, c+b) > a)\n {\n am += a;\n }\n else\n am += Math.Min(c * 3, c + b);\n }\n else if (k == 2)\n {\n if (Math.Min(a * 2, 2*c) > b)\n {\n am += b;\n }\n else\n am += Math.Min(a * 2, 2 * c);\n }\n else if (k == 3)\n {\n if (Math.Min(a * 3, b + a) > c)\n {\n am += c;\n }\n else\n am += Math.Min(a * 3, b + a);\n }\n Console.WriteLine(am);\n Console.ReadLine();\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace CodeForces4\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] Data = Console.ReadLine().Split(' ');\n\t\t\tint[] data = Array.ConvertAll(Data, x => int.Parse(x));\n\t\t\tlong one = minimum(data[1], (long)data[2] + data[3], (long)3 * data[3]);\n\t\t\tlong two = minimum(data[2], (long)2 * data[1], (long)2 * data[3]);\n\t\t\tlong three = minimum((long)3 * data[1], (long)data[1] + data[2], data[3]);\n\t\t\tswitch ((4 - data[0]%4)%4)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tConsole.WriteLine('0');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tConsole.WriteLine(one);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tConsole.WriteLine(two);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tConsole.WriteLine(three);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tstatic long minimum(long x1, long x2, long x3)\n\t\t{\n\t\t\treturn x1 < x2 ? x1 < x3 ? x1 : x3 : x2 < x3 ? x2 : x3;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n\n object Solve()\n {\n checked\n {\n var n = ReadLong();\n var a = ReadLong();\n var b = ReadLong();\n var c = ReadLong();\n if (n % 4 == 0)\n return 0;\n if (n % 4 == 2)\n {\n return new[] { b, 2 * a, 2 * c }.Min();\n }\n if (n % 4 == 3)\n {\n return new[] { a, c + b, c + 2 * c }.Min();\n }\n if (n % 4 == 1)\n {\n return new[] { c, a + b, a + 2 * a }.Min();\n }\n throw new Exception();\n }\n }\n\n struct Segment\n {\n public Segment(long left, long rigth)\n {\n Left = left;\n Right = rigth;\n }\n\n public long Left;\n public long Right;\n public long Size() { return Right - Left; }\n public long Ships(long size) { return Size() / size; }\n public List GetPositions(long shipSize) {\n var result = new List();\n for (var i = Left + shipSize - 1; i < Right; i+=shipSize)\n {\n result.Add(i);\n }\n return result;\n }\n }\n\n struct Second\n {\n public Second(long count, long mana)\n {\n Mana = mana;\n Count = count;\n }\n\n public long Mana;\n public long Count;\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int64.Parse);\n var n = input[0];\n var a = input[1];\n var b = input[2];\n var c = input[3];\n if (n % 4 == 0) {\n sw.WriteLine(0);\n return;\n }\n var firstCount = 0L;\n var min = Int64.MaxValue;\n for (var i = 0; i <= 100; i++) {\n for (var j = 0; j <= 100; j++) {\n for (var k = 0; k <= 100; k++) {\n var curr = i + 2*j + 3*k;\n if ((n + curr) % 4 == 0) {\n var price = i * a + b * j + c * k;\n min = Math.Min(price, min);\n }\n }\n }\n }\n\n sw.WriteLine(min);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A_Alena_and_sketchbooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputFirst = Console.ReadLine().Split(' ');\n long n = Int64.Parse(inputFirst[0]);\n long a = Int64.Parse(inputFirst[1]);\n long b = Int64.Parse(inputFirst[2]);\n long c = Int64.Parse(inputFirst[3]);\n\n n = n % 4;\n long min = 0;\n long case1, case2, case3;\n switch (n)\n {\n case 0: break;\n case 1: case1 = a + a + a;\n case2 = a + b; min = Math.Min(case1, case2);\n case3 = c; min = Math.Min(min, case3); break;\n case 2: case1 = a + a;\n case2 = b; min = Math.Min(case1, case2);\n case3 = c + c; min = Math.Min(min, case3); break;\n case 3: case1 = a;\n case2 = b + c; min = Math.Min(case1, case2);\n case3 = c + c + c; min = Math.Min(min, case3); break;\n }\n\n Console.WriteLine(min);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n //static int poisk (int x,int y,int z)\n //{\n // int res;\n // if (x < y || x < z)\n // res = x;\n // else\n // {\n // if (y < x || y < z)\n // res = y;\n // else\n // {\n // if (z < x || z < y)\n // res = z;\n // else \n\n // }\n // }\n // return (res);\n //}\n\n\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n long r = 0;\n long n = long.Parse(s1[0]);\n long a = long.Parse(s1[1]);\n long b = long.Parse(s1[2]);\n long c = long.Parse(s1[3]);\n if (n % 4 == 0)\n r = 0;\n else\n {\n if (n % 4 == 1)\n {\n if (c < 3 * a && c < a + b)\n r = c;\n else\n {\n if (3 * a < c && 3 * a < a + b)\n r = 3 * a;\n else\n r = a + b;\n }\n }\n else\n {\n if (n % 4 == 2)\n {\n if (b < 2 * a && b < 2 * c)\n r = b;\n else\n {\n if (2 * a < b && 2 * a < 2 * c)\n r = 2 * a;\n else\n r = 2 * c;\n }\n }\n else\n {\n if (a < 3 * c && a < c + b)\n r = a;\n else\n {\n if (3 * c < a && 3 * c < c + b)\n r = 3 * c;\n else\n r = c + b;\n }\n }\n }\n }\n Console.WriteLine(r);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static long poisk(long x, long y, long z)\n { \n if (x < y && x < z)\n return x;\n else\n {\n if (y < x && y < z)\n return y;\n else \n return z;\n } \n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n long n = long.Parse(s1[0]);\n long a = long.Parse(s1[1]);\n long b = long.Parse(s1[2]);\n long c = long.Parse(s1[3]);\n if (n % 4 == 0)\n Console.WriteLine (0);\n else\n {\n if (n % 4 == 1)\n Console.WriteLine(poisk(c, 3 * a, a + b)); \n else\n {\n if (n % 4 == 2) \n Console.WriteLine(poisk(b, 2 * a, 2 * c)); \n else \n Console.WriteLine(poisk(a, 3 * c, c + b)); \n }\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n long[] nabc = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long n = nabc[0];\n long bir = nabc[1];\n long iki = nabc[2];\n long uc = nabc[3];\n if (n % 4 == 0)\n Console.WriteLine(\"0\");\n else if (n % 4 == 1)\n Console.WriteLine(Math.Min(Math.Min(3 * bir, bir + iki), uc));\n else if (n % 4 == 2)\n Console.WriteLine(Math.Min(Math.Min(2 * bir, iki), 2 * uc));\n else\n Console.WriteLine(Math.Min(Math.Min(bir, iki + uc), 3 * uc));\n \n\n Console.ReadKey();\n }\n\n catch { }\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Round381\n{\n class Program\n {\n static int[] inputs;\n static long [] qhd;\n static long maxk = long.MaxValue;\n static void Main(string[] args)\n {\n inputs = readInts();\n qhd = new long[4];\n for (int i = 0; i < 4; i++)\n qhd[i] = maxk;\n Console.WriteLine(getMinRubles(ref inputs[0], 0));\n }\n\n static int[] readInts()\n {\n return Console.ReadLine().Split(' ').Select(p => Int32.Parse(p)).ToArray();\n }\n\n static long getMinRubles(ref int left, long rubles)\n {\n if (left%4 == 0)\n return rubles;\n int d = left % 4;\n if (qhd[d] <= rubles)\n return maxk;\n else\n qhd[d] = rubles;\n left += 1;\n long min = getMinRubles(ref left, rubles + inputs[1]);\n left -= 1;\n int imin = left + 1;\n for(int i=2; i<=3; i++)\n {\n left += i;\n long value = getMinRubles(ref left, rubles + inputs[i]);\n left -= i;\n if (value < min)\n {\n min = value;\n imin = left + i;\n }\n }\n return min;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n ulong n = (ulong) Next();\n ulong a = (ulong) Next();\n ulong b = (ulong) Next();\n ulong c = (ulong) Next();\n ulong[] k = new ulong[13];\n ulong ans = int.MaxValue;\n for (ulong i = 1; i < 13; i++) {\n k[i] = k[i - 1] + a;\n if (i >= 2)\n k[i] = Math.Min(k[i - 2] + b, k[i]);\n if (i >= 3)\n k[i] = Math.Min(k[i - 3] + c, k[i]);\n if ((n + i) % 4 == 0)\n ans = Math.Min(ans, k[i]);\n }\n if (n % 4 == 0)\n writer.Write(0);\n else\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static long N, A, B, C;\n\n static long Solve(long N, long A, long B, long C)\n {\n switch (N % 4)\n {\n case 1:\n return Math.Min(Math.Min(3L * A, C), A + B);\n\n case 2:\n return Math.Min(Math.Min(2L * A, B), 2L * C);\n\n case 3:\n return Math.Min(Math.Min(A, 3L * C), 3L * B + C);\n\n default:\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = long.Parse(vals[0]);\n A = long.Parse(vals[1]);\n B = long.Parse(vals[2]);\n C = long.Parse(vals[3]);\n\n //Console.WriteLine(Solve(N, A, B, C));\n\n long minVal = long.MaxValue;\n for (int i = 0; i <= 10; i++)\n {\n for (int j = 0; j <= 10; j++)\n {\n for (int k = 0; k <= 10; k++)\n {\n if ((N + i + 2 * j + 3 * k) % 4 == 0)\n {\n minVal = Math.Min(minVal, A * i + B * j + C * k);\n }\n }\n }\n }\n\n Console.WriteLine(minVal);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //int n = int.Parse(Console.ReadLine());\n var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n long n = num[0];\n long a = num[1];\n long b = num[2];\n long c = num[3];\n\n long ruble = long.MaxValue;\n long res = 4 - (n % 4);\n\n\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n }\n else if (res == 1)\n {\n ruble = Math.Min(ruble, a);\n ruble = Math.Min(ruble, (b + c));\n ruble = Math.Min(ruble, ( c*3));\n Console.WriteLine(ruble);\n }\n else if (res == 2)\n {\n ruble = Math.Min(a * 2, b);\n ruble = Math.Min(c * 2, ruble);\n Console.WriteLine(ruble);\n }\n else\n {\n ruble = Math.Min(a * 3, c);\n ruble = Math.Min(ruble, a + b);\n Console.WriteLine(ruble);\n }\n\n\n\n\n \n\n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest1012\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var cp = Console.ReadLine().Split(' ').Select(k => long.Parse(k)).ToArray();\n\n var n = cp[0];\n var a = cp[1];\n var b = cp[2];\n var c = cp[3];\n long counta, countb,countc;\n\n var h = n% 4;\n \n if(h == 0)\n {\n Console.WriteLine(0);\n return;\n }\n else if (h == 1)\n {\n countc = c;\n countb = b + a;\n counta = 3 * a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n else if (h == 2)\n {\n countc = 2 * c;\n countb = b;\n counta = 2 * a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n else if (h == 3)\n {\n countc = 3 * c;\n countb = b + c;\n counta = a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Alyona_copybooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b, c, n = 0;\n\n String all_nums = Console.ReadLine();\n\n String[] numbers = new String[4];\n //StringBuilder[] numbers = new StringBuilder[4];\n numbers = all_nums.Split(' ');\n\n n = long.Parse(numbers[0]);\n a = long.Parse(numbers[1]);\n b = long.Parse(numbers[2]);\n c = long.Parse(numbers[3]);\n\n long copybooks,min=0,money;\n \n long to_buy = 4 - ((n) % 4);\n \n min = 4000000000;\n \n for (int i = 0; i <= 3; i++)\n {\n for (int j = 0; j <= 3; j++)\n {\n for (int k = 0; k <= 3; k++)\n {\n copybooks = n + (i) + (j*2) + (k*3);\n \n if(copybooks%4==0)\n {\n\n money = a*(i) + b*(j) + c*(k);\n if (money < min)\n min = money;\n }\n }\n }\n }\n\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _740A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n long n = int.Parse(tokens[0]);\n long a = int.Parse(tokens[1]);\n long b = int.Parse(tokens[2]);\n long c = int.Parse(tokens[3]);\n\n long min = long.MaxValue;\n\n for (int ca = 0; ca < 4; ca++)\n {\n for (int cb = 0; cb < 4; cb++)\n {\n for (int cc = 0; cc < 4; cc++)\n {\n if ((n + ca + 2 * cb + 3 * cc) % 4 == 0)\n {\n min = Math.Min(min, ca * a + cb * b + cc * c);\n }\n }\n }\n }\n\n Console.WriteLine(min);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n long a = input.NextInt();\n long b = input.NextInt();\n long c = input.NextInt();\n int k = 4 - n % 4;\n long x;\n if (k == 4)\n {\n x = 0;\n }\n else if (k == 1)\n {\n x = Min(a, 3 * c, b + c);\n }\n else if (k == 2)\n {\n x = Min(2 * a, b, 2 * c, a + b + c);\n }\n else\n {\n x = Min(3 * a, c, 2 * b + c, a + b);\n }\n Console.Write(x);\n }\n\n private T Min(params T[] a)\n {\n return a.Min();\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static Func Int = x => Convert.ToInt32(x);\n static Func Long = x => Convert.ToInt64(x);\n static void Main(string[] args)\n {\n string[] buf = Console.ReadLine().Split(' ');\n long n = Long(buf[0]);\n long a = Long(buf[1]);\n long b = Long(buf[2]);\n long c = Long(buf[3]);\n if (n % 4 == 0) Console.WriteLine(0);\n else if (n % 4 == 1) Console.WriteLine(Math.Min(Math.Min(3 * a, a + b), c));\n else if (n % 4 == 2) Console.WriteLine(Math.Min(2 * a, Math.Min(2 * c, b)));\n else if (n % 4 == 3) Console.WriteLine(Math.Min(a, Math.Min(b + c, 3 * c)));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, a, b, c;\n string[] num = Console.ReadLine().Split(' ');\n n = int.Parse(num[0]);\n a = int.Parse(num[1]);\n b = int.Parse(num[2]);\n c = int.Parse(num[3]);\n long[] mas = new long[6];\n\n if (n % 4 == 0) Console.WriteLine(0);\n\n if (n % 4 == 3)\n {\n mas[0] = a;\n mas[1] = c * 3;\n mas[2] = b + c;\n mas[3] = mas[0];\n for (int i = 0; i < 3; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n\n if (n % 4 == 2)\n {\n mas[0] = a * 2;\n mas[1] = b;\n mas[2] = c * 2;\n mas[3] = mas[0];\n for (int i = 0; i < 3; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n \n if (n % 4 == 1)\n {\n mas[0] = a * 3;\n mas[1] = a + b;\n mas[2] = c;\n if (mas[0] > mas[1]) mas[4] = mas[1];\n else mas[4] = mas[0];\n if (mas[4] > mas[2]) Console.WriteLine(mas[2]);\n else Console.WriteLine(mas[4]);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n long a, b, c;\n\n long result = 0;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n c = ioHelper.ReadNextInt();\n\n if((n%4) == 0)\n {\n result = 0;\n }\n else if((n%4)==1)\n {\n var choice1 = c;\n\n var choice2 = a + b;\n\n var choice3 = 3 * a;\n\n result = Math.Min(Math.Min(choice2, choice3), choice1);\n }\n else if((n%4)==2)\n {\n var choice3 = a + 3 * c;\n var choice1 = 2 * a;\n var choice2 = b;\n var choice4 = 2 * c;\n\n result = Math.Min(Math.Min(choice1, choice2), Math.Min(choice3, choice4));\n }\n else if((n%4)==3)\n {\n var choice1 = a;\n var choice2 = b + c;\n var choice3 = 3 * c;\n\n result = Math.Min(Math.Min(choice1, choice2), choice3);\n }\n\n ioHelper.WriteLine(result.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar n = l[0];\n\t\t\tvar a = l[1];\n\t\t\tvar b = l[2];\n\t\t\tvar c = l[3];\n\t\t\tif (n % 4 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t}\n\t\t\tif (n % 4 == 3)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(a, Math.Min(3*c, b + c)));\n\t\t\t}\n\t\t\tif (n % 4 == 2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(b, Math.Min(2*a, 2*c)));\n\t\t\t}\n\t\t\tif (n % 4 == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(c, Math.Min(3 * a, b + a)));\n\t\t\t}\n\t\t\t/*\t\t\tvar n = ReadLong();\n\t\t\tvar a = ReadLong();\n\t\t\tvar b = ReadLong();\n\t\t\tvar c = ReadLong();\n\t\t\tif (a <= b - c)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n / a);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlong ans = 0;\n\t\t\t\twhile ((n / b) > 0)\n\t\t\t\t{\n\t\t\t\t\tvar k = n / b;\n\t\t\t\t\tans += k;\n\t\t\t\t\tn = (n % b) + k * c;\n\t\t\t\t}\n\t\t\t\tans += n / a;\n\t\t\t\tConsole.WriteLine(ans);\n\t\t\t}*/\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace TmpSharpProj\n{\n class Program\n {\n static void Main()\n {\n Program app = new Program();\n app.Run();\n }\n\n public void Run()\n {\n long[] ar = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n long ans = 0;\n switch (ar[0] % 4)\n {\n case 0:\n ans = 0;\n break;\n case 1:\n ans = Math.Min(ar[3], Math.Min(ar[1] + ar[1] + ar[1], ar[2] + ar[1]));\n break;\n case 2:\n ans = Math.Min(ar[2], Math.Min(ar[3] + ar[3], ar[1] + ar[1]));\n break;\n case 3:\n ans = Math.Min(ar[1], Math.Min(ar[2] + ar[3], ar[3] + ar[3] + ar[3]));\n break;\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace acsv2\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Trim().Split();\n var n = Int64.Parse(line[0]);\n var a = Int64.Parse(line[1]);\n var b = Int64.Parse(line[2]);\n var c = Int64.Parse(line[3]);\n\n long answer = 0;\n\n if (n % 4 == 0) {\n answer = 0;\n }\n else if ((n + 1) % 4 == 0) {\n answer = Math.Min(Math.Min(a, b + c), 3 * c);\n }\n else if ((n + 2) % 4 == 0) {\n answer = Math.Min(Math.Min(a * 2, b), c * 2);\n }\n else if ((n + 3) % 4 == 0) {\n answer = Math.Min(Math.Min(a * 3, a + b), c);\n }\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int GetNumberInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n static long GetNumberLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n static int[] GetArrayInt()\n {\n string[] @string = Console.ReadLine().Split(' ');\n int[] array = new int[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt32(@string[i]);\n }\n return array;\n }\n\n static long[] GetArrayLong()\n {\n string[] @string = Console.ReadLine().Split(' ');\n long[] array = new long[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt64(@string[i]);\n }\n return array;\n }\n\n static void Main(string[] args)\n {\n long[] array = GetArrayLong();\n long n = array[0], a = array[1], b = array[2], c = array[3];\n long k = 4 - n % 4;\n long minMoney = int.MaxValue;\n if (k == 1)\n minMoney = Math.Min(Math.Min(a, c + b), Math.Min(3 * c, a + 2 * b));\n else if (k == 2)\n minMoney = Math.Min(Math.Min(2 * a, b), 2 * c);\n else if (k == 3)\n minMoney = Math.Min(Math.Min(c, b + a), 3 * a);\n else\n minMoney = 0;\n Console.WriteLine(minMoney);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n//using System.Xml.Linq;\n\nnamespace CP\n{\n class Program\n {\n #region Reusable\n\n class DescComparer : IComparer\n {\n public int Compare(T x, T y)\n {\n return Comparer.Default.Compare(y, x);\n }\n }\n public class DuplicateKeyComparer : IComparer where TKey : IComparable\n {\n #region IComparer Members\n\n public int Compare(TKey x, TKey y)\n {\n int result = x.CompareTo(y);\n\n if (result == 0)\n return 1; // Handle equality as beeing greater\n else\n return result;\n }\n\n #endregion\n }\n static int[] GetIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);\n }\n static double[] GetDoubleArray()\n {\n return Array.ConvertAll(Console.ReadLine().Trim().Split(' '), Convert.ToDouble);\n }\n static string[] GetStringArray()\n {\n return Console.ReadLine().Trim().Split(' ');\n }\n static int GetN()\n {\n return Convert.ToInt32(Console.ReadLine().Trim());\n }\n static bool[] GetSieve(int max)\n {\n long sum = 0;\n long n = 2000000;\n bool[] e = new bool[n];//by default they're all false\n for (int i = 2; i < n; i++)\n {\n e[i] = true;//set all numbers to true\n }\n //weed out the non primes by finding mutiples \n for (int j = 2; j < n; j++)\n {\n if (e[j])//is true\n {\n for (long p = 2; (p * j) < n; p++)\n {\n e[p * j] = false;\n }\n }\n }\n return e;\n }\n static bool IsPrime(int n)\n {\n if (n > 1)\n {\n return Enumerable.Range(2, n / 2).Where(x => n % x == 0).Count() == 0;\n }\n\n return false;\n }\n static List GetListFromInt(int n)\n {\n List arr = new List();\n while (n > 0)\n {\n arr.Add(n % 10);\n n /= 10;\n }\n arr.Reverse();\n return arr;\n }\n static int GetIntFromArray(int[] arr)\n {\n int op = 0;\n foreach (int i in arr)\n {\n op = (op * 10) + i;\n }\n return op;\n }\n private static int GetMost(List vals, int m)\n {\n int ct = vals.Count;\n int l = vals.Max();\n int h = vals.Sum();\n\n while (l < h)\n {\n int mp = 1;\n int cl = 0;\n int mid = l + (h - l) / 2;\n for (int i = 0; i < ct; ++i)\n {\n if (cl + vals[i] <= mid) cl += vals[i];\n else { ++mp; cl = vals[i]; }\n }\n if (mp <= m) h = mid;\n else l = mid + 1;\n }\n return l;\n }\n private static int GetLeast(List vals, int m)\n {\n int max = -1;\n int ct = vals.Count;\n int h = vals[ct - 1];\n int l = 0;\n //int l = h;\n //for (int i = 1; i < ct; i++)\n //{\n // int df = vals[i] - vals[i - 1];\n // if (df < l) l = df;\n //}\n while (l < h)\n {\n int mp = 1;\n int prCwPos = vals[0];\n int mid = l + (h - l) / 2;\n for (int i = 1; i < ct; ++i)\n {\n int d = vals[i] - prCwPos;\n if (d >= mid)\n {\n mp++;\n prCwPos = vals[i];\n }\n }\n if (mp >= m) { l = mid + 1; if (mid > max) max = mid; }\n else h = mid;\n }\n return max;\n }\n static void Print(List op, bool newLine)\n {\n if (newLine)\n {\n foreach (string s in op)\n {\n Console.WriteLine(s);\n }\n }\n else\n {\n Console.WriteLine(string.Join(\" \", op));\n }\n }\n static void Print2DArray(int[,] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = ar[i, j].ToString();\n else op += \" \" + ar[i, j].ToString();\n }\n Console.WriteLine(op);\n\n }\n }\n static void Print2DArray(int[][] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = ar[i][j].ToString();\n else op += \" \" + ar[i][j].ToString();\n }\n Console.WriteLine(op);\n\n }\n }\n static void Print2DArray(bool[,] ar)\n {\n for (int i = 0; i < ar.GetLength(0); i++)\n {\n string op = string.Empty;\n for (int j = 0; j < ar.GetLength(1); j++)\n {\n if (op == string.Empty) op = (ar[i, j] ? \"1\" : \"0\");\n else op += \" \" + (ar[i, j] ? \"1\" : \"0\");\n }\n Console.WriteLine(op);\n\n }\n }\n static int MinDistanceForDijkstra(int[] dist, bool[] sptSet)\n {\n int V = dist.Length;\n // Initialize min value\n int min = Int32.MaxValue, min_index = 0;\n\n for (int v = 0; v < V; v++)\n if (sptSet[v] == false && dist[v] <= min)\n {\n min = dist[v];\n min_index = v;\n }\n\n return min_index;\n }\n static int[] Dijkstra(int[][] graph, int src)\n {\n int V = graph.Length;\n int[] dist = new int[V]; // The output array. dist[i] will hold the shortest\n // distance from src to i\n\n bool[] sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest\n // path tree or shortest distance from src to i is finalized\n\n // Initialize all distances as INFINITE and stpSet[] as false\n for (int i = 0; i < V; i++)\n {\n dist[i] = Int32.MaxValue;\n sptSet[i] = false;\n }\n\n // Distance of source vertex from itself is always 0\n dist[src] = 0;\n\n // Find shortest path for all vertices\n for (int count = 0; count < V - 1; count++)\n {\n // Pick the minimum distance vertex from the set of vertices not\n // yet processed. u is always equal to src in first iteration.\n int u = MinDistanceForDijkstra(dist, sptSet);\n\n // Mark the picked vertex as processed\n sptSet[u] = true;\n\n // Update dist value of the adjacent vertices of the picked vertex.\n for (int v = 0; v < V; v++)\n\n // Update dist[v] only if is not in sptSet, there is an edge from \n // u to v, and total weight of path from src to v through u is \n // smaller than current value of dist[v]\n if (!sptSet[v] && (graph[u][v] != 0) && dist[u] != Int32.MaxValue\n && dist[u] + graph[u][v] < dist[v])\n dist[v] = dist[u] + graph[u][v];\n }\n return dist;\n\n\n }\n static int[] Dijkstra2(int[][] graph, int src)\n {\n int V = graph.Length;\n int[] dist = new int[V]; // The output array. dist[i] will hold the shortest\n // distance from src to i\n\n bool[] sptSet = new bool[V]; // sptSet[i] will true if vertex i is included in shortest\n // path tree or shortest distance from src to i is finalized\n\n // Initialize all distances as INFINITE and stpSet[] as false\n for (int i = 0; i < V; i++)\n {\n dist[i] = Int32.MaxValue;\n sptSet[i] = false;\n }\n\n // Distance of source vertex from itself is always 0\n dist[src] = 0;\n\n // Find shortest path for all vertices\n for (int count = 0; count < V - 1; count++)\n {\n // Pick the minimum distance vertex from the set of vertices not\n // yet processed. u is always equal to src in first iteration.\n int u = MinDistanceForDijkstra(dist, sptSet);\n\n // Mark the picked vertex as processed\n sptSet[u] = true;\n\n // Update dist value of the adjacent vertices of the picked vertex.\n for (int v = 0; v < V; v++)\n\n // Update dist[v] only if is not in sptSet, there is an edge from \n // u to v, and total weight of path from src to v through u is \n // smaller than current value of dist[v]\n if (!sptSet[v] && (graph[u][v] != -1) && dist[u] != Int32.MaxValue\n && dist[u] + graph[u][v] < dist[v])\n dist[v] = dist[u] + graph[u][v];\n }\n return dist;\n\n\n }\n static int LCM(int[] numbers)\n {\n return numbers.Aggregate(LCM);\n }\n static int LCM(int a, int b)\n {\n return a * b / GCD(a, b);\n }\n static int GCD(int[] numbers)\n {\n return numbers.Aggregate(GCD);\n }\n static int GCD(int a, int b)\n {\n return b == 0 ? a : GCD(b, a % b);\n }\n\n static int[] or = new int[] { 1, 0, -1, 0 };\n static int[] oc = new int[] { 0, 1, 0, -1 };\n #endregion\n static void Main(string[] args)\n {\n a2();\n\n }\n\n private static void a2()\n {\n long[] ips = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), long.Parse);\n long n = ips[0];\n long a = ips[1];\n long b = ips[2];\n long c = ips[3];\n long req = 4 - (n % 4);\n long ct = 0;\n switch (req)\n { \n case 3:\n ct = new long[]{3 * a, c,a+b}.Min();\n break;\n case 2:\n ct = new long[]{2 * a, b,2*c}.Min();\n break;\n case 1:\n ct = new long[] { a, b+c, 3 * c }.Min();\n break;\n }\n Console.WriteLine(ct);\n }\n\n private static void a1()\n {\n int n = GetN();\n List ips = GetIntArray().ToList();\n int ct=0;\n if (n > 2)\n {\n ips.Sort();\n int s = 0;\n int e = n - 1;\n while (s < n)\n {\n if (ips[0] == ips[s]) s++;\n else break;\n }\n while (e >= 0)\n {\n if (ips[e] == ips[n-1]) e--;\n else break;\n }\n ct = e - s+1;\n if (ct < 0) ct = 0;\n }\n Console.WriteLine(ct);\n\n }\n \n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var dp = RLA(4);\n long n = (4 - (dp[0] % 4)) % 4;\n dp[0] = 0;\n\n for (int tmp = 0; tmp <= 4; tmp++)\n for (int i = 1; i <= 3; i++)\n for (int j = 1; j <= 3; j++)\n dp[(i + j) % 4] = Math.Min(dp[(i + j) % 4], dp[i] + dp[j]);\n\n Console.Write(dp[n]);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace tetradki\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(); \n long n = long.Parse(s[0]);\n long a = long.Parse(s[1]);\n long b = long.Parse(s[2]);\n long c = long.Parse(s[3]);\n long ans=0;\n\n switch (n%4)\n {\n case 1:\n ans = Math.Min(3 * a, Math.Min(a + b, c));\n break;\n case 2:\n ans = Math.Min(Math.Min(2 * a, b),2*c);\n break;\n case 3:\n ans = Math.Min(a,Math.Min(b+c,3*c));\n break;\n }\n\n \n Console.Write(ans);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int n = sc.Next();\n var A = new long[3];\n for (var i = 0; i < 3; i++) A[i] = sc.Next();\n chmin(ref A[0], A[1] + A[2]);\n chmin(ref A[0], A[2] * 3);\n chmin(ref A[1], A[0] * 2);\n chmin(ref A[1], A[2] * 2);\n chmin(ref A[2], A[0] + A[1]);\n chmin(ref A[2], A[0] * 3);\n var o = (4L - n % 4) % 4;if (o == 0) Fail(0);\n WriteLine(A[o - 1]);\n }\n}\n\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Alyona_and_copybooks\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = Next(), a = Next(), b = Next(), c = Next();\n\n long amount = 0;\n switch (n%4)\n {\n case 0:\n break;\n case 1:\n amount = Math.Min(c, Math.Min(a + a + a, a + b));\n break;\n case 2:\n amount = Math.Min(b, Math.Min(a + a, c + c));\n break;\n case 3:\n amount = Math.Min(a, Math.Min(b + c, c + c + c));\n break;\n }\n\n\n writer.WriteLine(amount);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, a, b, c;\n var s = Console.ReadLine().Split(' ');\n n = long.Parse(s[0]);\n a = long.Parse(s[1]);\n b = long.Parse(s[2]);\n c = long.Parse(s[3]);\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n return ;\n }\n\n if (n % 4 == 1)\n {\n long res = 3 * a;\n if (res > c) res = c;\n if (res > a + b) res = a + b;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 2)\n {\n long res = b;\n if (res > 2 * a) res = 2 * a;\n if (res > 2 * c) res = 2 * c;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 3)\n {\n long res = a;\n if (res > 3 * c) res = 3 * c;\n if (res > b + c) res = b + c;\n Console.WriteLine(res);\n return ;\n }\n }\n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _740A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), a = long.Parse(input[1]), b = long.Parse(input[2]), c = long.Parse(input[3]);\n long result = 0;\n switch (4 - n % 4)\n {\n case 1:\n result = Math.Min(a, Math.Min(3 * c, b + c)); \n break;\n\n case 2:\n result = Math.Min(2 * a, Math.Min(b, 2 * c));\n break;\n\n case 3:\n result = Math.Min(3 * a, Math.Min(a + b, c));\n break;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring s = Console.ReadLine();\n\t\tstring[] temp = s.Split(' ');\n\t\tint n= Convert.ToInt32(temp[0]);\n\t\tlong a = Convert.ToInt32(temp[1]);\n\t\tlong b= Convert.ToInt32(temp[2]);\n\t\tlong c = Convert.ToInt32(temp[3]);\n\t\tint[,] mass = new int[9,3]{{3,0,0},{1,1,0},{0,0,1},{2,0,0},{0,1,0},{0,0,2},{1,0,0},{0,1,1},{0,0,3}};\n\t\tlong min =99999999999; \n\t\tif (n%4==0) min=0;\n\t\telse\n\t\tfor (int i=(n%4-1)*3;i<(n%4)*3;i++)\n\t\t{\n\t\t\tlong sum=a*mass[i,0]+b*mass[i,1]+c*mass[i,2];\n\t\t\tif (sum= b && b <= c + c)\n\t\t\t\t\tk = b;\n\t\t\t\telse\n\t\t\t\t\tk = c + c;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\tif ( 3 * a <= c && 2 * a <= b )\n\t\t\t\t\tk = 3 * a;\n\t\t\t\telse if ( c <= 3 * a && c <= a + b )\n\t\t\t\t\tk = c;\n\t\t\t\telse\n\t\t\t\t\tk = b + a;\n\t\t\t\tbreak;\n\t\t}\n\t\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n/*\n long long N, A, B, C;\n cin >> N >> A >> B >> C;\n if (N % 4 == 0) {\n cout << 0 << endl;\n } else\n if (N % 4 == 1) {\n cout << min(min(C, A + B), A * 3) << endl;\n } else \n if (N % 4 == 2) {\n cout << min(min(B, C + C), A + A) << endl;\n } else {\n cout << min(min(A, B + C), C * 3) << endl;\n }\n\nif(n%4==0)cout<<\"0\\n\";\n\telse if(n%4==1)cout<(params T[] values)\n {\n return values.Min();\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if(c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n int a = input.NextInt();\n int b = input.NextInt();\n int c = input.NextInt();\n int k = 4 - n % 4;\n int x;\n if (k == 1)\n x = a;\n else if (k == 2)\n x = Min(2 * a, b);\n else if (k == 3)\n x = Min(3 * a, a + b, c);\n else\n x = 0;\n Console.Write(x);\n }\n\n private int Min(params int[] values)\n {\n return values.Min();\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if(c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n long a = input.NextInt();\n long b = input.NextInt();\n long c = input.NextInt();\n int k = 4 - n % 4;\n long x;\n if (k == 4)\n {\n x = 0;\n }\n else if (k == 1)\n {\n x = Min(a, 3 * c, b + c);\n }\n else if (k == 2)\n {\n x = Min(2 * a, b, 2 * c);\n }\n else\n {\n x = Min(3 * a, c);\n }\n Console.Write(x);\n }\n\n private T Min(params T[] a)\n {\n return a.Min();\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n long a, b, c;\n\n long result = 0;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n c = ioHelper.ReadNextInt();\n\n if((n%4) == 0)\n {\n result = 0;\n }\n else if((n%4)==1)\n {\n var choice1 = c;\n\n var choice2 = a + b;\n\n var choice3 = 3 * a;\n\n result = Math.Min(Math.Min(choice2, choice3), choice1);\n }\n else if((n%4)==2)\n {\n var choice3 = a + 3 * c;\n var choice1 = 2 * a;\n var choice2 = b;\n var choice4 = 4 * c;\n\n result = Math.Min(Math.Min(choice1, choice2), Math.Min(choice3, choice4));\n }\n else if((n%4)==3)\n {\n var choice1 = a;\n var choice2 = b + c;\n var choice3 = 3 * c;\n\n result = Math.Min(Math.Min(choice1, choice2), choice3);\n }\n\n ioHelper.WriteLine(result.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace TmpSharpProj\n{\n class Program\n {\n static void Main()\n {\n Program app = new Program();\n app.Run();\n }\n\n public void Run()\n {\n long[] ar = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n long[] c = new long[4] { 2000 * 1000 * 1000, 2000 * 1000 * 1000, 2000 * 1000 * 1000, 2000 * 1000 * 1000 };\n c[0] = 0;\n for (int i = 1; i < 4; i++)\n {\n for (int j = 1; j < 3; j++)\n {\n if (i - j >= 0)\n {\n c[i] = Math.Min(c[i], c[i - j] + ar[j]);\n }\n }\n }\n Console.WriteLine(c[ar[0] % 4 == 0 ? 0 : 4 - (ar[0] % 4)]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace TmpSharpProj\n{\n class Program\n {\n static void Main()\n {\n Program app = new Program();\n app.Run();\n }\n\n public void Run()\n {\n int[] ar = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n long[] c = Enumerable.Repeat(long.MaxValue, 100).ToArray();\n c[0] = 0;\n for (int i = 1; i < 100; i++)\n {\n for (int j = 1; j < 3; j++)\n {\n if (i - j >= 0)\n {\n c[i] = Math.Min(c[i], c[i - j] + ar[j]);\n }\n }\n }\n long ans = long.MaxValue;\n for (int i = (ar[0] % 4 == 0 ? 0 : 4 - ar[0] % 4); i < 100; i += 4)\n {\n ans = Math.Min(ans, c[i]);\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace TmpSharpProj\n{\n class Program\n {\n static void Main()\n {\n Program app = new Program();\n app.Run();\n }\n\n public void Run()\n {\n int[] ar = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int[] c = new int[4] { 2000 * 1000 * 1000, 2000 * 1000 * 1000, 2000 * 1000 * 1000, 2000 * 1000 * 1000 };\n c[0] = 0;\n for (int i = 1; i < 4; i++)\n {\n for (int j = 1; j < 3; j++)\n {\n if (i - j >= 0)\n {\n c[i] = Math.Min(c[i], c[i - j] + ar[j]);\n }\n }\n }\n Console.WriteLine(c[ar[0] % 4 == 0 ? 0 : 4 - (ar[0] % 4)]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace tetradki\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(); ;\n long n = long.Parse(s[0]);\n long a = long.Parse(s[1]);\n long b = long.Parse(s[2]);\n long c = long.Parse(s[3]);\n long ans=0;\n\n switch (n%4)\n {\n case 1:\n ans = Math.Min(3 * a, Math.Min(a + b, c));\n break;\n case 2:\n ans = Math.Min(2 * a, b);\n break;\n case 3:\n ans = a;\n break;\n }\n\n Console.Write(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace tetradki\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(); ;\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int c = int.Parse(s[3]);\n int ans=0;\n\n switch (n%4)\n {\n case 1:\n ans = Math.Min(3 * a, Math.Min(a + b, c));\n break;\n case 2:\n ans = Math.Min(2 * a, b);\n break;\n case 3:\n ans = a;\n break;\n }\n\n Console.Write(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Alyona_and_copybooks\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = Next(), a = Next(), b = Next(), c = Next();\n\n long amount = 0;\n switch (n%4)\n {\n case 0:\n break;\n case 1:\n amount = Math.Min(c, Math.Min(a + a + a, a + b));\n break;\n case 2:\n amount = Math.Min(b, Math.Min(a + a, c + c));\n break;\n case 3:\n amount = Math.Min(a, b + c);\n break;\n }\n\n\n writer.WriteLine(amount);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Alyona_and_mex\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int min = n + 1;\n for (int i = 0; i < m; i++)\n {\n int l = Next();\n int r = Next();\n min = Math.Min(min, r - l + 1);\n }\n\n writer.WriteLine(min);\n for (int i = 0; i < n; i++)\n {\n writer.Write(i%min);\n writer.Write(' ');\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Alyona_and_copybooks\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next(), a = Next(), b = Next(), c = Next();\n\n int amount = 0;\n switch (n%4)\n {\n case 0:\n break;\n case 1:\n amount = Math.Min(c, Math.Min(a + a + a, a + b));\n break;\n case 2:\n amount = Math.Min(b, Math.Min(a + a, c + c));\n break;\n case 3:\n amount = Math.Min(a, b + c);\n break;\n }\n\n\n writer.WriteLine(amount);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _740A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), a = long.Parse(input[1]), b = long.Parse(input[2]), c = long.Parse(input[3]);\n long result = 0;\n switch (4 - n % 4)\n {\n case 1:\n result = Math.Min(a, Math.Min(3 * c, b + c)); \n break;\n\n case 2:\n result = Math.Min(2 * a, Math.Min(b, 2 * c));\n break;\n\n case 3:\n result = Math.Min(3 * a, c);\n break;\n }\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces4\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] Data = Console.ReadLine().Split(' ');\n\t\t\tint[] data = Array.ConvertAll(Data, x => int.Parse(x));\n\t\t\tlong one = minimum(data[1], data[2] + data[3], 3 * data[3]);\n\t\t\tlong two = minimum(data[2], 2 * data[1], 2 * data[3]);\n\t\t\tlong three = minimum(3 * data[1], data[1] + data[2], data[3]);\n\t\t\tswitch ((4 - data[0]%4)%4)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tConsole.WriteLine('0');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tConsole.WriteLine(one);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tConsole.WriteLine(two);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tConsole.WriteLine(three);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tstatic long minimum(long x1, long x2, long x3)\n\t\t{\n\t\t\treturn x1 < x2 ? x1 < x3 ? x1 : x3 : x2 < x3 ? x2 : x3;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest1012\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var cp = Console.ReadLine().Split(' ').Select(k => int.Parse(k)).ToArray();\n\n var n = cp[0];\n var a = cp[1];\n var b = cp[2];\n var c = cp[3];\n\n var h = 0;\n\n if (n < 4)\n h = 4 - n;\n else\n h = n % 4;\n\n if (h == 1)\n {\n Console.WriteLine(a);\n return;\n }\n else if (h == 2)\n {\n Console.WriteLine(b);\n return;\n }\n else if (h == 3)\n {\n Console.WriteLine(c);\n return;\n }\n\n\n var cbooks = h % 3;\n if (cbooks == 0)\n {\n Console.WriteLine((h / 3) * c);\n return;\n }\n else\n {\n var bbooks = cbooks % 2;\n if (bbooks == 0)\n {\n Console.WriteLine(((h / 3) * c) + ((cbooks / 2) * b));\n return;\n }\n else\n {\n Console.WriteLine(((h / 3) * c) + ((cbooks) * a));\n return;\n }\n \n }\n \n\n }\n }\n}\n;"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest1012\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var cp = Console.ReadLine().Split(' ').Select(k => long.Parse(k)).ToArray();\n\n var n = cp[0];\n var a = cp[1];\n var b = cp[2];\n var c = cp[3];\n long counta, countb,countc;\n\n var h = 0;\n \n if(h == 0)\n {\n Console.WriteLine(0);\n return;\n }\n else if (h == 1)\n {\n countc = c;\n countb = b + a;\n counta = 3 * a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n else if (h == 2)\n {\n countc = 2 * c;\n countb = b;\n counta = 2 * a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n else if (h == 3)\n {\n countc = 3 * c;\n countb = b + c;\n counta = a;\n if ((countc <= countb) && (countc <= counta))\n {\n Console.WriteLine(countc);\n }\n else if ((countb <= countc) && (countb <= counta))\n {\n Console.WriteLine(countb);\n }\n else if ((counta <= countb) && (counta <= countc))\n {\n Console.WriteLine(counta);\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n string[] num = Console.ReadLine().Split(' ');\n n = int.Parse(num[0]);\n a = int.Parse(num[1]);\n b = int.Parse(num[2]);\n c = int.Parse(num[3]);\n int[] mas = new int[6];\n\n if (n % 4 == 0) Console.WriteLine(0);\n\n if (n % 4 == 3)\n {\n mas[0] = a;\n mas[1] = c * 3;\n mas[3] = mas[0];\n for (int i = 0; i < 1; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n\n if (n % 4 == 2)\n {\n mas[0] = a * 2;\n mas[1] = b;\n mas[2] = c * 2;\n mas[3] = mas[0];\n for (int i = 0; i < 2; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n \n if (n % 4 == 1)\n {\n mas[0] = a * 3;\n mas[1] = a + b;\n mas[2] = c;\n if (mas[0] > mas[1]) mas[4] = mas[1];\n else mas[4] = mas[0];\n if (mas[4] > mas[2]) Console.WriteLine(mas[2]);\n else Console.WriteLine(mas[4]);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, a, b, c;\n string[] num = Console.ReadLine().Split(' ');\n n = int.Parse(num[0]);\n a = int.Parse(num[1]);\n b = int.Parse(num[2]);\n c = int.Parse(num[3]);\n long[] mas = new long[6];\n\n if (n % 4 == 0) Console.WriteLine(0);\n\n if (n % 4 == 3)\n {\n mas[0] = a;\n mas[1] = c * 3;\n mas[3] = mas[0];\n for (int i = 0; i < 1; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n\n if (n % 4 == 2)\n {\n mas[0] = a * 2;\n mas[1] = b;\n mas[2] = c * 2;\n mas[3] = mas[0];\n for (int i = 0; i < 2; i++)\n {\n if (mas[3] > mas[i]) mas[3] = mas[i];\n }\n Console.WriteLine(mas[3]);\n }\n \n if (n % 4 == 1)\n {\n mas[0] = a * 3;\n mas[1] = a + b;\n mas[2] = c;\n if (mas[0] > mas[1]) mas[4] = mas[1];\n else mas[4] = mas[0];\n if (mas[4] > mas[2]) Console.WriteLine(mas[2]);\n else Console.WriteLine(mas[4]);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n string[] num = Console.ReadLine().Split(' ');\n n = int.Parse(num[0]);\n a = int.Parse(num[1]);\n b = int.Parse(num[2]);\n c = int.Parse(num[3]);\n int[] mas = new int[6];\n\n if (n % 4 == 0) Console.WriteLine(0);\n\n if (n % 4 == 3) Console.WriteLine(a);\n\n if (n % 4 == 2)\n {\n mas[0] = a * 2;\n mas[1] = b;\n if (mas[0] > mas[1]) Console.WriteLine(mas[1]);\n else Console.WriteLine(mas[0]);\n }\n \n if (n % 4 == 1)\n {\n mas[0] = a * 3;\n mas[1] = a + b;\n mas[2] = c;\n if (mas[0] > mas[1]) mas[4] = mas[1];\n else mas[4] = mas[0];\n if (mas[4] > mas[2]) Console.WriteLine(mas[2]);\n else Console.WriteLine(mas[4]);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace acsv2\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Trim().Split();\n var n = Int64.Parse(line[0]);\n var a = Int64.Parse(line[1]);\n var b = Int64.Parse(line[2]);\n var c = Int64.Parse(line[3]);\n\n long answer = 0;\n\n if (n % 4 == 0) {\n answer = 0;\n }\n else if ((n + 1) % 4 == 0) {\n answer = Math.Min(Math.Min(a, b + c), c);\n }\n else if ((n + 2) % 4 == 0) {\n answer = Math.Min(Math.Min(a * 2, b), c * 2);\n }\n else if ((n + 3) % 4 == 0) {\n answer = Math.Min(Math.Min(a * 3, a + b), c);\n }\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace acs\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Trim().Split();\n var n = Int64.Parse(line[0]);\n var a = Int64.Parse(line[1]);\n var b = Int64.Parse(line[2]);\n var c = Int64.Parse(line[3]);\n\n var r = n / 4 + (n % 4 == 0 ? 0 : 1);\n var k = r * 4 - n;\n\n if (k == 0) {\n Console.WriteLine(0);\n }\n else {\n var c_abc = k / 3;\n var b_abc = (k - c_abc) / 2;\n var a_abc = k - c_abc - b_abc;\n var answer_abc = a * a_abc + b * b_abc + c * c_abc;\n\n var a_a = k;\n var answer_a = a_a * a;\n\n var answer = Math.Min(answer_abc, answer_a);\n\n var b_b = k / 2;\n if (k % 2 == 0) {\n answer = Math.Min(answer, b_b * b);\n }\n\n var c_c = k / 3;\n if (k % 3 == 0) {\n answer = Math.Min(answer, c_c * c);\n }\n\n var b_ab = k / 2;\n var a_ab = k - b_ab;\n answer = Math.Min(answer, a_ab * a + b_ab * b);\n\n var c_ac = k / 3;\n var a_ac = k - c_ac;\n answer = Math.Min(answer, a_ac * a + c_ac * c);\n\n var c_bc = k / 3;\n var b_bc = (k - c_bc) / 2;\n if ((k - c_bc) % 2 == 0) {\n answer = Math.Min(answer, b_bc * b + c_bc * c);\n }\n\n Console.WriteLine(answer);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace acs\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Trim().Split();\n var n = Int64.Parse(line[0]);\n var a = Int64.Parse(line[1]);\n var b = Int64.Parse(line[2]);\n var c = Int64.Parse(line[3]);\n\n var r = n / 4 + (n % 4 == 0 ? 0 : 1);\n var k = r * 4 - n;\n\n if (k == 0) {\n Console.WriteLine(0);\n }\n else {\n var c_abc = k / 3;\n var b_abc = (k - c_abc) / 2;\n var a_abc = k - c_abc * 3 - b_abc * 2;\n var answer_abc = a * a_abc + b * b_abc + c * c_abc;\n\n var answer_a = k * a;\n\n var answer = Math.Min(answer_abc, answer_a);\n\n if (k % 2 == 0) {\n answer = Math.Min(answer, (k / 2) * b);\n }\n \n if (k % 3 == 0) {\n answer = Math.Min(answer, (k / 3) * c);\n }\n\n var b_ab = k / 2;\n var a_ab = k - b_ab * 2;\n answer = Math.Min(answer, a_ab * a + b_ab * b);\n\n var c_ac = k / 3;\n var a_ac = k - c_ac * 3;\n answer = Math.Min(answer, a_ac * a + c_ac * c);\n\n var c_bc = k / 3;\n var b_bc = (k - c_bc * 3) / 2;\n if ((k - c_bc * 3) % 2 == 0) {\n answer = Math.Min(answer, b_bc * b + c_bc * c);\n }\n\n Console.WriteLine(answer);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace acsv2\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var line = Console.ReadLine().Trim().Split();\n var n = Int64.Parse(line[0]);\n var a = Int64.Parse(line[1]);\n var b = Int64.Parse(line[2]);\n var c = Int64.Parse(line[3]);\n\n long answer = 0;\n\n if (n % 4 == 0) {\n answer = 0;\n }\n else if ((n + 1) % 4 == 0) {\n answer = a;\n }\n else if ((n + 2) % 4 == 0) {\n answer = Math.Min(a * 2, b);\n }\n else if ((n + 3) % 4 == 0) {\n answer = Math.Min(Math.Min(a * 3, a + b), c);\n }\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int n = sc.Next();\n var A = new long[3];\n for (var i = 0; i < 3; i++) A[i] = sc.Next();\n var o = (4L - n % 4) % 4;if (o == 0) Fail(0);\n var min = o * A[0];\n if (o == 1) Fail(Min(min,A[2]*3));\n if (o == 2) Fail(Min(min, Min(A[1],A[2]*2)));\n if (o == 3) WriteLine(Min(min, A[2]));\n }\n}\n\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int n = sc.Next();\n var A = new int[3];\n for (var i = 0; i < 3; i++) A[i] = sc.Next();\n var o = (4L - n % 4) % 4;if (o == 0) Fail(0);\n var min = o * A[0];\n if (o == 1) Fail(min);\n if (o == 2) Fail(Min(min, A[1]));\n if (o == 3) WriteLine(Min(min, A[2]));\n }\n}\n\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n var s = Console.ReadLine().Split(' ');\n n = int.Parse(s[0]);\n a = int.Parse(s[1]);\n b = int.Parse(s[2]);\n c = int.Parse(s[3]);\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n return ;\n }\n\n if (n % 4 == 1)\n {\n int res = 3 * a;\n if (res > c) res = c;\n if (res > a + b) res = a + b;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 2)\n {\n int res = b;\n if (res > 2 * a) res = 2 * a;\n if (res > 2 * c) res = 2 * c;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 3)\n {\n int res = a;\n if (res > 3 * c) res = 3 * c;\n if (res > b + c) res = b + c;\n Console.WriteLine(res);\n return ;\n }\n }\n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n n = Console.Read();\n a = Console.Read();\n b = Console.Read();\n c = Console.Read();\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n }\n\n if (n % 4 == 1)\n {\n int res = 3 * a;\n if (res > c) res = c;\n if (res > a + b) res = a + b;\n Console.WriteLine(res);\n }\n\n if (n % 4 == 2)\n {\n int res = b;\n if (res > 2 * a) res = 2 * a;\n if (res > 2 * c) res = 2 * c;\n Console.WriteLine(res);\n }\n\n if (n % 4 == 3)\n {\n int res = a;\n if (res > 3 * c) res = 3 * c;\n if (res > b + c) res = b + c;\n Console.WriteLine(res);\n }\n }\n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n n = Console.Read();\n a = Console.Read();\n b = Console.Read();\n c = Console.Read();\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n }\n\n if (n % 4 == 1)\n {\n int res = 3 * a;\n if (res > c) res = c;\n if (res > a + b) res = a + b;\n Console.WriteLine(res);\n }\n\n if (n % 4 == 2)\n {\n int res = b;\n if (res > 2 * a) res = 2 * a;\n if (res > 2 * c) res = 2 * c;\n Console.WriteLine(res);\n }\n\n if (n % 4 == 3)\n {\n int res = a;\n if (res > 3 * c) res = 3 * c;\n if (res > b + c) res = b + c;\n Console.WriteLine(res);\n }\n\n Console.ReadLine();\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, a, b, c;\n n = Console.Read();\n a = Console.Read();\n b = Console.Read();\n c = Console.Read();\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n return ;\n }\n\n if (n % 4 == 1)\n {\n int res = 3 * a;\n if (res > c) res = c;\n if (res > a + b) res = a + b;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 2)\n {\n int res = b;\n if (res > 2 * a) res = 2 * a;\n if (res > 2 * c) res = 2 * c;\n Console.WriteLine(res);\n return ;\n }\n\n if (n % 4 == 3)\n {\n int res = a;\n if (res > 3 * c) res = 3 * c;\n if (res > b + c) res = b + c;\n Console.WriteLine(res);\n return ;\n }\n }\n\n \n }\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tstring s = Console.ReadLine();\n\t\tstring[] temp = s.Split(' ');\n\t\tint n= Convert.ToInt32(temp[0]);\n\t\tint a = Convert.ToInt32(temp[1]);\n\t\tint b= Convert.ToInt32(temp[2]);\n\t\tint c = Convert.ToInt32(temp[3]);\n\t\tint[,] mass = new int[9,3]{{3,0,0},{1,1,0},{0,0,1},{2,0,0},{0,1,0},{0,0,2},{1,0,0},{0,1,1},{0,0,3}};\n\t\tlong min =99999999999;\n\t\tif (n%4==0) min=0;\n\t\telse\n\t\tfor (int i=(n%4-1);i<(n%4-1)+3;i++)\n\t\t{\n\t\t\tlong sum=a*mass[i,0]+b*mass[i,1]+c*mass[i,2];\n\t\t\tif (sum= b && b <= c + c)\n\t\t\t\t\tk = b;\n\t\t\t\telse\n\t\t\t\t\tk = c + c;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\tif ( 3 * a <= c && 2 * a <= b )\n\t\t\t\t\tk = 3 * a;\n\t\t\t\telse if ( c <= 3 * a && c <= a + b )\n\t\t\t\t\tk = c;\n\t\t\t\telse\n\t\t\t\t\tk = b + a;\n\t\t\t\tbreak;\n\t\t}\n\t\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n/*\n long long N, A, B, C;\n cin >> N >> A >> B >> C;\n if (N % 4 == 0) {\n cout << 0 << endl;\n } else\n if (N % 4 == 1) {\n cout << min(min(C, A + B), A * 3) << endl;\n } else \n if (N % 4 == 2) {\n cout << min(min(B, C + C), A + A) << endl;\n } else {\n cout << min(min(A, B + C), C * 3) << endl;\n }\n\nif(n%4==0)cout<<\"0\\n\";\n\telse if(n%4==1)cout<= b && b <= c + c)\n\t\t\t\t\tk = b;\n\t\t\t\telse\n\t\t\t\t\tk = c + c;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\tif ( 3 * a <= c && 2 * a <= b )\n\t\t\t\t\tk = 3 * a;\n\t\t\t\telse if ( c <= 3 * a && c <= 2 + b )\n\t\t\t\t\tk = c;\n\t\t\t\telse\n\t\t\t\t\tk = b + a;\n\t\t\t\tbreak;\n\t\t}\n\t\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n/*\n long long N, A, B, C;\n cin >> N >> A >> B >> C;\n if (N % 4 == 0) {\n cout << 0 << endl;\n } else\n if (N % 4 == 1) {\n cout << min(min(C, A + B), A * 3) << endl;\n } else \n if (N % 4 == 2) {\n cout << min(min(B, C + C), A + A) << endl;\n } else {\n cout << min(min(A, B + C), C * 3) << endl;\n }\n\nif(n%4==0)cout<<\"0\\n\";\n\telse if(n%4==1)cout<= b && b <= c + c)\n\t\t\t\t\tk = b;\n\t\t\t\telse\n\t\t\t\t\tk = c + c;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\tif ( 3 * a <= c && 2 * a <= b )\n\t\t\t\t\tk = 3 * a;\n\t\t\t\telse if ( c <= 3 * a && c <= a + b )\n\t\t\t\t\tk = c;\n\t\t\t\telse\n\t\t\t\t\tk = b + a;\n\t\t\t\tbreak;\n\t\t}\n\t\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n/*\n long long N, A, B, C;\n cin >> N >> A >> B >> C;\n if (N % 4 == 0) {\n cout << 0 << endl;\n } else\n if (N % 4 == 1) {\n cout << min(min(C, A + B), A * 3) << endl;\n } else \n if (N % 4 == 2) {\n cout << min(min(B, C + C), A + A) << endl;\n } else {\n cout << min(min(A, B + C), C * 3) << endl;\n }\n\nif(n%4==0)cout<<\"0\\n\";\n\telse if(n%4==1)cout<= b && b <= c + c)\n\t\t\t\t\tk = b;\n\t\t\t\telse\n\t\t\t\t\tk = c + c;\n\t\t\t\tbreak;\n\t\t\tcase 3 :\n\t\t\t\tif ( 3 * a <= c && 2 * a <= b )\n\t\t\t\t\tk = 3 * a;\n\t\t\t\telse if ( c <= 3 * a && c <= a + b )\n\t\t\t\t\tk = c;\n\t\t\t\telse\n\t\t\t\t\tk = b + a;\n\t\t\t\tbreak;\n\t\t}\n\t\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (k);\n# else\n\t\tsw.WriteLine (k);\n# endif\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n\n/*\n long long N, A, B, C;\n cin >> N >> A >> B >> C;\n if (N % 4 == 0) {\n cout << 0 << endl;\n } else\n if (N % 4 == 1) {\n cout << min(min(C, A + B), A * 3) << endl;\n } else \n if (N % 4 == 2) {\n cout << min(min(B, C + C), A + A) << endl;\n } else {\n cout << min(min(A, B + C), C * 3) << endl;\n }\n\nif(n%4==0)cout<<\"0\\n\";\n\telse if(n%4==1)cout< int.Parse(x));\n\t\t\tint one = minimum(data[1], data[2] + data[3], 3 * data[3]);\n\t\t\tint two = minimum(data[2], 2 * data[1], 2 * data[3]);\n\t\t\tint three = minimum(3 * data[1], data[1] + data[2], data[3]);\n\t\t\tswitch ((4 - data[0]%4)%4)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tConsole.WriteLine('0');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tConsole.WriteLine(one);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tConsole.WriteLine(two);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tConsole.WriteLine(three);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tstatic int minimum(int x1, int x2, int x3)\n\t\t{\n\t\t\treturn x1 < x2 ? x1 < x3 ? x1 : x3 : x2 < x3 ? x2 : x3;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A_Alena_and_sketchbooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputFirst = Console.ReadLine().Split(' ');\n int n = Int32.Parse(inputFirst[0]);\n int a = Int32.Parse(inputFirst[1]);\n int b = Int32.Parse(inputFirst[2]);\n int c = Int32.Parse(inputFirst[3]);\n\n n = n % 4;\n int min = 0;\n int case1, case2, case3;\n switch (n)\n {\n case 0: break;\n case 1: case1 = a + a + a;\n case2 = a + b; min = Math.Min(case1, case2);\n case3 = c; min = Math.Min(min, case3); break;\n case 2: case1 = a + a;\n case2 = b; min = Math.Min(case1, case2);\n case3 = c + c; min = Math.Min(min, case3); break;\n case 3: case1 = a;\n case2 = b + c; min = Math.Min(case1, case2);\n case3 = c + c + c; min = Math.Min(min, case3); break;\n }\n\n Console.WriteLine(min);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n long r =0;\n long n = long.Parse(s1[0]);\n long a = long.Parse(s1[1]);\n long b = long.Parse(s1[2]);\n long c = long.Parse(s1[3]);\n if (n % 4 == 0)\n r = 0;\n else\n {\n if (n % 4 == 1)\n {\n if (c < 3 * a || c < a + b)\n r = c;\n else\n {\n if (3 * a < c || 3 * a < a + b)\n r = 3 * a;\n else\n r = a + b;\n }\n }\n else\n {\n if (n % 4 == 2)\n {\n if (b < 2 * a || b < 2 * c)\n r = b;\n else\n {\n if (2 * a < b || 2 * a < 2 * c)\n r = 2 * a;\n else\n r = 2 * c;\n }\n }\n else\n {\n if (a < 3 * c || a < c + b)\n r = a;\n else\n {\n if (3 * c < a || 3 * c < c + b)\n r = 3 * c;\n else\n r = c + b;\n }\n }\n }\n }\n Console.WriteLine(r);\n Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n long r =0;\n long n = long.Parse(s1[0]);\n long a = long.Parse(s1[1]);\n long b = long.Parse(s1[2]);\n long c = long.Parse(s1[3]);\n if (n % 4 == 0)\n r = 0;\n else\n {\n if (n % 4 == 1)\n {\n if (c <= 3 * a || c <= a + b)\n r = c;\n else\n {\n if (3 * a <= c || 3 * a <= a + b)\n r = 3 * a;\n else\n r = a + b;\n }\n }\n else\n {\n if (n % 4 == 2)\n {\n if (b <= 2 * a)\n r = b;\n else\n r = 2 * a;\n }\n else\n {\n if (a <= 3 * c)\n r = a;\n else\n r = 3 * c;\n }\n }\n }\n Console.WriteLine(r);\n Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n long r =0;\n long n = long.Parse(s1[0]);\n long a = long.Parse(s1[1]);\n long b = long.Parse(s1[2]);\n long c = long.Parse(s1[3]);\n if (n % 4 == 0)\n r = 0;\n else\n {\n if (n % 4 == 1)\n {\n if (c < 3 * a || c < a + b)\n r = c;\n else\n {\n if (3 * a < c || 3 * a < a + b)\n r = 3 * a;\n else\n r = a + b;\n }\n }\n else\n {\n if (n % 4 == 2)\n {\n if (b < 2 * a)\n r = b;\n else\n r = 2 * a;\n }\n else\n {\n if (a < 3 * c)\n r = a;\n else\n r = 3 * c;\n }\n }\n }\n Console.WriteLine(r);\n Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int n = Next();\n int a = Next();\n int b = Next();\n int c = Next();\n int i = n % 4;\n if (i == 0)\n writer.Write(0);\n else {\n i = 4 - i;\n int ans = int.MaxValue;\n if (i == 3) {\n ans = Math.Min(c, Math.Min(3 * a, b + a));\n }else if (i == 2) {\n ans = Math.Min(b, 2 * a);\n }\n else\n ans = a;\n writer.Write(ans);\n }\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Alyona_and_copybooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int c = int.Parse(s[3]);\n int am = 0;\n int k = 4 - (n % 4);\n if (k == 1)\n {\n am += b;\n }\n else if (k == 2)\n {\n am += Math.Min(a * 2, b);\n }\n else if (k == 3)\n {\n if (Math.Min(a * 3, b + a) > c)\n {\n am += c;\n }\n else\n am += Math.Min(a * 3, b + a);\n }\n Console.WriteLine(am);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Alyona_and_copybooks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int c = int.Parse(s[3]);\n int am = 0;\n int k = 4 - (n % 4);\n if (k == 1)\n {\n if (Math.Min(c * 3, c+b) > a)\n {\n am += a;\n }\n else\n am += Math.Min(c * 3, c + b);\n }\n else if (k == 2)\n {\n if (Math.Min(a * 2, 2*c) > b)\n {\n am += b;\n }\n else\n am += Math.Min(a * 2, 2 * c);\n }\n else if (k == 3)\n {\n if (Math.Min(a * 3, b + a) > c)\n {\n am += c;\n }\n else\n am += Math.Min(a * 3, b + a);\n }\n Console.WriteLine(am);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int N, A, B, C;\n\n static long Solve(int N, int A, int B, int C)\n {\n switch (N % 4)\n {\n case 1:\n return Math.Min(3L * A, C);\n\n case 2:\n return Math.Min(Math.Min(2L * A, B), 2L * C);\n\n case 3:\n return Math.Min(A, 3L * C);\n\n default:\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = int.Parse(vals[0]);\n A = int.Parse(vals[1]);\n B = int.Parse(vals[2]);\n C = int.Parse(vals[3]);\n\n Console.WriteLine((int)Solve(N, A, B, C));\n\n //for (int i = 1; i <= 10; i++)\n //{\n // for (int j = 1; j <= 10; j++)\n // {\n // for (int k = 1; k <= 10; k++)\n // {\n // for (int h = 1; h <= 10; h++)\n // {\n // Console.WriteLine(string.Format(\"({0}, {1}, {2}, {3}) -> {4}\", i, j, k, h, Solve(i, j, k, h)));\n // }\n // }\n // }\n //}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static long N, A, B, C;\n\n static long Solve(long N, long A, long B, long C)\n {\n switch (N % 4)\n {\n case 1:\n return Math.Min(Math.Min(3L * A, C), A + B);\n\n case 2:\n return Math.Min(Math.Min(2L * A, B), 2L * C);\n\n case 3:\n return Math.Min(Math.Min(A, 3L * C), 3L * B + C);\n\n default:\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = long.Parse(vals[0]);\n A = long.Parse(vals[1]);\n B = long.Parse(vals[2]);\n C = long.Parse(vals[3]);\n\n Console.WriteLine(Solve(N, A, B, C));\n\n //for (int i = 1; i <= 10; i++)\n //{\n // for (int j = 1; j <= 10; j++)\n // {\n // for (int k = 1; k <= 10; k++)\n // {\n // for (int h = 1; h <= 10; h++)\n // {\n // Console.WriteLine(string.Format(\"({0}, {1}, {2}, {3}) -> {4}\", i, j, k, h, Solve(i, j, k, h)));\n // }\n // }\n // }\n //}\n\n /*long minVal = long.MaxValue;\n for (int i = 0; i < 1000; i++)\n {\n if (((N + i) % 4) == 0)\n {\n minVal = Math.Min(minVal, A * i);\n }\n\n if (((N + 2 * i) % 4) == 0)\n {\n minVal = Math.Min(minVal, B * i);\n }\n\n if (((N + 3 * i) % 4) == 0)\n {\n minVal = Math.Min(minVal, C * i);\n }\n }\n\n Console.WriteLine(minVal);*/\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int N, A, B, C;\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = int.Parse(vals[0]);\n A = int.Parse(vals[1]);\n B = int.Parse(vals[2]);\n C = int.Parse(vals[3]);\n\n long minVal = long.MaxValue;\n if (N % 4 == 0)\n {\n minVal = 0;\n }\n else\n {\n minVal = (4L - (N % 4)) * A;\n if (N % 4 == 2)\n {\n minVal = Math.Min(minVal, B);\n minVal = Math.Min(minVal, 2L * C);\n }\n\n if (N % 4 == 1)\n {\n minVal = Math.Min(minVal, C);\n }\n\n if (N % 4 == 3)\n {\n minVal = Math.Min(minVal, 3L * C);\n }\n }\n\n Console.WriteLine(minVal);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int N, A, B, C;\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = int.Parse(vals[0]);\n A = int.Parse(vals[1]);\n B = int.Parse(vals[2]);\n C = int.Parse(vals[3]);\n\n long minVal = int.MaxValue;\n if (N % 4 == 0)\n {\n minVal = 0;\n }\n else\n {\n minVal = (4L - (N % 4)) * A;\n if (N % 4 == 2)\n {\n minVal = Math.Min(minVal, B); \n }\n\n if (N % 4 == 1)\n {\n minVal = Math.Min(minVal, C);\n }\n\n if (N % 4 == 3)\n {\n minVal = Math.Min(minVal, 3L * C);\n }\n }\n\n Console.WriteLine(minVal);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int N, A, B, C;\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = int.Parse(vals[0]);\n A = int.Parse(vals[1]);\n B = int.Parse(vals[2]);\n C = int.Parse(vals[3]);\n\n long minVal = int.MaxValue;\n if (N % 4 == 0)\n {\n minVal = 0;\n }\n else\n {\n minVal = (4L - (N % 4)) * A;\n if (N % 4 == 2)\n {\n minVal = Math.Min(minVal, B);\n minVal = Math.Min(minVal, 2L * C);\n }\n\n if (N % 4 == 1)\n {\n minVal = Math.Min(minVal, C);\n }\n\n if (N % 4 == 3)\n {\n minVal = Math.Min(minVal, 3L * C);\n }\n }\n\n Console.WriteLine(minVal);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static long N, A, B, C;\n\n static long Solve(int N, int A, int B, int C)\n {\n switch (N % 4)\n {\n case 1:\n return Math.Min(3L * A, C);\n\n case 2:\n return Math.Min(Math.Min(2L * A, B), 2L * C);\n\n case 3:\n return Math.Min(A, 3L * C);\n\n default:\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] vals = input.Split(' ');\n N = long.Parse(vals[0]);\n A = long.Parse(vals[1]);\n B = long.Parse(vals[2]);\n C = long.Parse(vals[3]);\n\n //Console.WriteLine((int)Solve(N, A, B, C));\n\n //for (int i = 1; i <= 10; i++)\n //{\n // for (int j = 1; j <= 10; j++)\n // {\n // for (int k = 1; k <= 10; k++)\n // {\n // for (int h = 1; h <= 10; h++)\n // {\n // Console.WriteLine(string.Format(\"({0}, {1}, {2}, {3}) -> {4}\", i, j, k, h, Solve(i, j, k, h)));\n // }\n // }\n // }\n //}\n\n long minVal = long.MaxValue;\n for (int i = 0; i < 1000; i++)\n {\n if (((N + i) % 4) == 0)\n {\n minVal = Math.Min(minVal, A * i);\n }\n\n if (((N + 2 * i) % 4) == 0)\n {\n minVal = Math.Min(minVal, B * i);\n }\n\n if (((N + 3 * i) % 4) == 0)\n {\n minVal = Math.Min(minVal, C * i);\n }\n }\n\n Console.WriteLine(minVal);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //int n = int.Parse(Console.ReadLine());\n var num = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long n = num[0];\n long a = num[1];\n long b = num[2];\n long c = num[3];\n\n long ruble = long.MaxValue;\n long res = 4 - (n % 4);\n\n for (int i=1; i<=3; i++)\n {\n long tmp = n + i;\n\n if(i==1)\n {\n \n ruble = Math.Min(num[i]*res, ruble);\n }\n\n if(i==3 && tmp%4==0)\n {\n ruble = Math.Min(num[1]+num[2] , ruble);\n }\n if(tmp%4==0)\n {\n ruble = Math.Min(num[i],ruble);\n }\n }\n\n if (n % 4 == 0) ruble = 0;\n\n Console.WriteLine(ruble);\n \n\n\n\n\n \n\n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //int n = int.Parse(Console.ReadLine());\n var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n long n = num[0];\n long a = num[1];\n long b = num[2];\n long c = num[3];\n\n long ruble = long.MaxValue;\n long res = 4 - (n % 4);\n\n\n if (n % 4 == 0)\n {\n Console.WriteLine(0);\n }\n else if (res == 1)\n {\n ruble = Math.Min(ruble, a);\n ruble = Math.Min(ruble, (b + c));\n ruble = Math.Min(ruble, ( c*7));\n Console.WriteLine(ruble);\n }\n else if (res == 2)\n {\n ruble = Math.Min(a * 2, b);\n ruble = Math.Min(c * 2, ruble);\n Console.WriteLine(ruble);\n }\n else\n {\n ruble = Math.Min(a * 3, c);\n ruble = Math.Min(ruble, a + b);\n Console.WriteLine(ruble);\n }\n\n\n\n\n \n\n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //int n = int.Parse(Console.ReadLine());\n var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = num[0];\n int a = num[1];\n int b = num[2];\n int c = num[3];\n\n long ruble = int.MaxValue;\n\n for(int i=1; i<=3; i++)\n {\n int tmp = n + i;\n\n if(i==1)\n {\n int res = 4-(n % 4);\n ruble = Math.Min(num[i]*res, ruble);\n }\n if(tmp%4==0)\n {\n ruble = Math.Min(num[i],ruble);\n }\n }\n\n if (n % 4 == 0) ruble = 0;\n\n Console.WriteLine(ruble);\n \n\n\n\n\n \n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //int n = int.Parse(Console.ReadLine());\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //int n = int.Parse(Console.ReadLine());\n var num = Console.ReadLine().Split().Select(long.Parse).ToArray();\n long n = num[0];\n long a = num[1];\n long b = num[2];\n long c = num[3];\n\n long ruble = long.MaxValue;\n\n for(int i=1; i<=3; i++)\n {\n long tmp = n + i;\n\n if(i==1)\n {\n long res = 4-(n % 4);\n ruble = Math.Min(num[i]*res, ruble);\n }\n if(tmp%4==0)\n {\n ruble = Math.Min(num[i],ruble);\n }\n }\n\n if (n % 4 == 0) ruble = 0;\n\n Console.WriteLine(ruble);\n \n\n\n\n\n \n\n\n }\n\n \n\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n//using System.\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long a, b, c, n = 0;\n\n String all_nums = Console.ReadLine();\n\n String[] numbers = new String[4];\n //StringBuilder[] numbers = new StringBuilder[4];\n numbers=all_nums.Split(' ');\n\n n = long.Parse(numbers[0]);\n a = long.Parse(numbers[1]);\n b = long.Parse(numbers[2]);\n c = long.Parse(numbers[3]);\n\n long to_buy = -1;\n\n if (n < 4)\n to_buy = 4 - n;\n\n else\n to_buy = 4 - ((n) % 4);\n \n\n if (to_buy == 0 || to_buy % 4==0)\n Console.WriteLine(0);\n\n if(to_buy==1) \n Console.WriteLine(a);\n\n if(to_buy==2)\n {\n long x =checked(2 * a);\n long y = b;\n if (x > y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n // BigInteger number = BigInteger.Multiply(Int64.MaxValue, 3);\n long x =checked(3 * a);\n long y =checked(a + b);\n long z = c;\n long h =checked(b + (2 * a));\n\n long min = x;\n\n if(y y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n BigInteger x = BigInteger.Multiply(a, 3);\n BigInteger y = BigInteger.Add(a, b);\n //long x =checked(3 * a);\n // long y =checked(a + b);\n BigInteger z = c;\n BigInteger h = BigInteger.Add(b, BigInteger.Multiply(a, 2));\n\n BigInteger min = x;\n\n if(y y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n\n long x = 3 * a;\n long y = a + b;\n long z = c;\n long h = b + (2 * a);\n\n long min = x;\n\n if(y y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n\n int x = 3*a;\n int y=a+b;\n int z=c;\n int h=b+(2*a);\n\n int min=x;\n\n if(y y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n BigInteger x = BigInteger.Multiply(a, 3);\n BigInteger y = BigInteger.Add(a, b);\n //long x =checked(3 * a);\n // long y =checked(a + b);\n BigInteger z = c;\n BigInteger h = BigInteger.Add(b, BigInteger.Multiply(a, 2));\n\n BigInteger min = x;\n\n if(y y)\n Console.WriteLine(y);\n else\n Console.WriteLine(x);\n }\n\n if(to_buy==3)\n {\n\n Double x = 3 * a;\n Double y = a + b;\n Double z = c;\n Double h = b + (2 * a);\n\n Double min = x;\n\n if(y\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar n = l[0];\n\t\t\tvar a = l[1];\n\t\t\tvar b = l[2];\n\t\t\tvar c = l[3];\n\t\t\tif (n % 4 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t}\n\t\t\tif (n % 4 == 3)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(a, Math.Min(3*c, 3*b + c)));\n\t\t\t}\n\t\t\tif (n % 4 == 2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(b, Math.Min(2*a, 2*c)));\n\t\t\t}\n\t\t\tif (n % 4 == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(c, Math.Min(3 * a, b + a)));\n\t\t\t}\n\t\t\t/*\t\t\tvar n = ReadLong();\n\t\t\tvar a = ReadLong();\n\t\t\tvar b = ReadLong();\n\t\t\tvar c = ReadLong();\n\t\t\tif (a <= b - c)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n / a);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlong ans = 0;\n\t\t\t\twhile ((n / b) > 0)\n\t\t\t\t{\n\t\t\t\t\tvar k = n / b;\n\t\t\t\t\tans += k;\n\t\t\t\t\tn = (n % b) + k * c;\n\t\t\t\t}\n\t\t\t\tans += n / a;\n\t\t\t\tConsole.WriteLine(ans);\n\t\t\t}*/\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int GetNumberInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n static long GetNumberLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n static int[] GetArrayInt()\n {\n string[] @string = Console.ReadLine().Split(' ');\n int[] array = new int[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt32(@string[i]);\n }\n return array;\n }\n\n static long[] GetArrayLong()\n {\n string[] @string = Console.ReadLine().Split(' ');\n long[] array = new long[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt64(@string[i]);\n }\n return array;\n }\n\n static void Main(string[] args)\n {\n long[] array = GetArrayLong();\n long n = array[0], a = array[1], b = array[2], c = array[3];\n long k = 4 - n % 4;\n long minMoney = int.MaxValue;\n if (k == 1)\n minMoney = Math.Min(a, 3 * c);\n else if (k == 2)\n minMoney = Math.Min(Math.Min(2 * a, b), 2 * c);\n else if (k == 3)\n minMoney = Math.Min(c, 3 * a);\n else\n minMoney = 0;\n Console.WriteLine(minMoney);\n }\n }\n}\n"}], "src_uid": "c74537b7e2032c1d928717dfe15ccfb8"} {"source_code": "using System;\n\npublic sealed class Program {\n\n const Int64 Mod = 1000000007;\n\n static void Add(ref Int64 cur, Int64 add) {\n cur = (cur + add) % Mod;\n }\n\n public Program () {\n Int32[] token = ReadArray();\n Int32 n = token[0], cap = token[1], i, cnt50 = 0, cnt100 = 0, a, b, c, d;\n token = ReadArray();\n Array.Sort(token);\n if (cap < 50 || cap < token[n - 1] || n != 1 && cap < token[0] + token[1]) {\n Console.WriteLine(-1);\n Console.WriteLine('0');\n return;\n }\n foreach (Int32 body in token) {\n if (body == 50) {\n ++cnt50;\n } else {\n ++cnt100;\n }\n }\n Int64[,] binomial = new Int64[n + 1, n + 1];\n for (i = 0; i <= n; ++i) {\n binomial[i, 0] = binomial[i, i] = 1;\n }\n for (a = 2; a <= n; ++a) {\n for (b = 1; b < a; ++b) {\n binomial[a, b] = (binomial[a - 1, b] + binomial[a - 1, b - 1]) % Mod;\n }\n }\n Int64[, ,] dp = new Int64[2, cnt50 + 1, cnt100 + 1];\n dp[0, cnt50, cnt100] = 1;\n for (i = 0; ; ++i) {\n if (i % 2 != 0 && dp[i % 2, cnt50, cnt100] != 0) {\n Console.WriteLine(i);\n Console.WriteLine(dp[i % 2, cnt50, cnt100]);\n return;\n }\n for (a = 0; a <= cnt50; ++a) {\n for (b = 0; b <= cnt100; ++b) {\n if (dp[i % 2, a, b] != 0) {\n for (c = 0; c <= a; ++c) {\n for (d = 0; d <= b && c * 50 + d * 100 <= cap; ++d) {\n if (c + d != 0) {\n Add(ref dp[1 - i % 2, cnt50 - (a - c), cnt100 - (b - d)], dp[i % 2, a, b] * binomial[a, c] % Mod * binomial[b, d] % Mod);\n }\n }\n }\n }\n }\n }\n }\n }\n\n // stuff cutline\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n var root = new Program();\n Console.Out.Flush();\n }\n\n static Int32 ReadInt() {\n Boolean neg = false;\n Int32 ch, ans = 0;\n do {\n ch = Console.Read();\n neg |= ch == (Int32)'-';\n } while (!Char.IsDigit((Char)ch));\n do {\n ans = ans * 10 + (ch & 0xf);\n ch = Console.Read();\n } while (Char.IsDigit((Char)ch));\n return neg ? -ans : ans;\n }\n\n static Int32[] ReadArray() {\n return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n }\n\n}", "positive_code": [{"source_code": "using System;\n\npublic sealed class Program {\n\n const Int64 Mod = 1000000007;\n\n static void Add(ref Int64 cur, Int64 add) {\n cur = (cur + add) % Mod;\n }\n\n public Program () {\n Int32[] token = ReadArray();\n Int32 n = token[0], cap = token[1], i, cnt50 = 0, cnt100 = 0, a, b, c, d;\n token = ReadArray();\n Array.Sort(token);\n if (cap < 50 || cap < token[n - 1] || n != 1 && cap < token[0] + token[1]) {\n Console.WriteLine(-1);\n Console.WriteLine('0');\n return;\n }\n foreach (Int32 body in token) {\n if (body == 50) {\n ++cnt50;\n } else {\n ++cnt100;\n }\n }\n Int64[,] binomial = new Int64[n + 1, n + 1];\n for (i = 0; i <= n; ++i) {\n binomial[i, 0] = binomial[i, i] = 1;\n }\n for (a = 2; a <= n; ++a) {\n for (b = 1; b < a; ++b) {\n binomial[a, b] = (binomial[a - 1, b] + binomial[a - 1, b - 1]) % Mod;\n }\n }\n Int64[, ,] dp = new Int64[2, cnt50 + 1, cnt100 + 1];\n dp[0, cnt50, cnt100] = 1;\n for (i = 0; ; ++i) {\n if (i % 2 != 0 && dp[i % 2, cnt50, cnt100] != 0) {\n Console.WriteLine(i);\n Console.WriteLine(dp[i % 2, cnt50, cnt100]);\n return;\n }\n for (a = 0; a <= cnt50; ++a) {\n for (b = 0; b <= cnt100; ++b) {\n if (dp[i % 2, a, b] != 0) {\n for (c = 0; c <= a; ++c) {\n for (d = 0; d <= b && c * 50 + d * 100 <= cap; ++d) {\n if (c + d != 0) {\n Add(ref dp[1 - i % 2, cnt50 - (a - c), cnt100 - (b - d)], dp[i % 2, a, b] * binomial[a, c] % Mod * binomial[b, d] % Mod);\n }\n }\n }\n }\n }\n }\n }\n }\n\n // stuff cutline\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n var root = new Program();\n Console.Out.Flush();\n }\n\n static Int32 ReadInt() {\n Boolean neg = false;\n Int32 ch, ans = 0;\n do {\n ch = Console.Read();\n neg |= ch == (Int32)'-';\n } while (!Char.IsDigit((Char)ch));\n do {\n ans = ans * 10 + (ch & 0xf);\n ch = Console.Read();\n } while (Char.IsDigit((Char)ch));\n return neg ? -ans : ans;\n }\n\n static Int32[] ReadArray() {\n return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n }\n\n}"}], "negative_code": [{"source_code": "using System;\n\npublic sealed class Program {\n\n const Int64 Mod = 1000000007;\n\n static void Add(ref Int64 cur, Int64 add) {\n cur = (cur + add) % Mod;\n }\n\n public Program () {\n Int32 n = ReadInt(), cap = ReadInt(), i, cnt50 = 0, cnt100 = 0, a, b, c, d;\n for (i = 0; i < n; ++i) {\n if (ReadInt() == 50) {\n ++cnt50;\n } else {\n ++cnt100;\n }\n }\n Int64[,] binomial = new Int64[n + 1, n + 1];\n for (i = 0; i <= n; ++i) {\n binomial[i, 0] = binomial[i, i] = 1;\n }\n for (a = 2; a <= n; ++a) {\n for (b = 1; b < a; ++b) {\n binomial[a, b] = (binomial[a - 1, b] + binomial[a - 1, b - 1]) % Mod;\n }\n }\n Int64[, ,] dp = new Int64[n * 2 + 1, cnt50 + 1, cnt100 + 1];\n dp[0, cnt50, cnt100] = 1;\n for (i = 0; ; ++i) {\n if (i == n * 2) {\n Console.WriteLine(-1);\n Console.WriteLine('0');\n break;\n } else if (i % 2 != 0 && dp[i, cnt50, cnt100] != 0) {\n Console.WriteLine(i);\n Console.WriteLine(dp[i, cnt50, cnt100]);\n break;\n }\n for (a = 0; a <= cnt50; ++a) {\n for (b = 0; b <= cnt100; ++b) {\n if (dp[i, a, b] != 0) {\n for (c = 0; c <= a; ++c) {\n for (d = 0; d <= b && c * 50 + d * 100 <= cap; ++d) {\n if (c + d != 0) {\n Add(ref dp[i + 1, cnt50 - (a - c), cnt100 - (b - d)], dp[i, a, b] * binomial[a, c] % Mod * binomial[b, d] % Mod);\n }\n }\n }\n }\n }\n }\n }\n }\n\n // stuff cutline\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n var root = new Program();\n Console.Out.Flush();\n }\n\n static Int32 ReadInt() {\n Boolean neg = false;\n Int32 ch, ans = 0;\n do {\n ch = Console.Read();\n neg |= ch == (Int32)'-';\n } while (!Char.IsDigit((Char)ch));\n do {\n ans = ans * 10 + (ch & 0xf);\n ch = Console.Read();\n } while (Char.IsDigit((Char)ch));\n return neg ? -ans : ans;\n }\n\n static Int32[] ReadArray() {\n return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n }\n\n}"}], "src_uid": "ebb0323a854e19794c79ab559792a1f7"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tlong N=rl();\n\t\tConsole.WriteLine(25);\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tpublic Sol(){\n\t\t\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n", "positive_code": [{"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tdouble res = 25;\n\t\tdouble n = double.Parse(Console.ReadLine());\n\t\tdouble d = Math.Pow(5, n);\n\t\tif(n<100000000000000000){\n\t\t\tres = d % 100;\t\n\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n}"}, {"source_code": "using System;\n\npublic class Class\n{\n static int Main()\n {\n string n = Console.ReadLine();\n if(n == \"1\")\n {\n Console.WriteLine(\"5\");\n }\n else\n {\n Console.WriteLine(\"25\");\n }\n return 0;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long i;\n i=long.Parse(Console.ReadLine());\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "using static System.Console;class a{static void Main(){ReadLine();WriteLine(\"25\");}}"}, {"source_code": "using static System.Console;class a{static void Main(){ReadLine();WriteLine(25);}}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace Text\n{\n class Program\n {\n static void Main(string[] args)\n {\n string read = Console.ReadLine();\n Console.WriteLine(25);\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\n\npublic class Program\n{\n private static void Main()\n {\n ReadLine();\n WriteLine(25);\n\n }\n}"}, {"source_code": "using System;\n\nnamespace Sample\n{ \n class Test{\n \n public static void Main(string[] args){\n \n Console.Write(25);\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text;\n\nnamespace AlgoHelper\n{\n public class Pair\n {\n public int X { get; set; }\n public int Y { get; set; }\n\n public Pair(int x, int y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n var pair = obj as Pair;\n return X + Y == pair.X + pair.Y;\n }\n\n public override int GetHashCode()\n {\n var hashCode = 1861411795;\n hashCode = hashCode * -1521134295 + X.GetHashCode();\n hashCode = hashCode * -1521134295 + Y.GetHashCode();\n return hashCode;\n }\n\n public override string ToString()\n {\n return $\"X = {X} Y = {Y}\";\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n Console.WriteLine(25);\n\n // Console.ReadKey();\n }\n\n private static long max(long[] a, int l)\n {\n long max = long.MinValue;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (i != l)\n {\n max = Math.Max(a[i], max);\n }\n }\n\n return max;\n }\n\n private static long min(long[] a, int l)\n {\n long min = long.MaxValue;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (i != l)\n {\n min = Math.Min(a[i], min);\n }\n }\n\n return min;\n }\n\n\n static int anagram(string s)\n {\n int length = s.Length;\n\n if (length % 2 != 0) return -1;\n\n string firstPart = s.Substring(0, length / 2);\n string secondPart = s.Substring(length / 2);\n\n int[] firstFreq = frequency(firstPart);\n int[] secondFreq = frequency(secondPart);\n\n int count = 0;\n\n for (int i = 0; i < firstFreq.Length; i++)\n {\n if (firstFreq[i] != secondFreq[i]) count += Math.Abs(secondFreq[i] - firstFreq[i]);\n }\n\n return count / 2;\n }\n\n public static int NumDecodings(string s)\n {\n if (s.Length == 1) return 1;\n if (s.Length == 2)\n {\n int number = int.Parse(s);\n\n if (number <= 26)\n {\n if (s.Contains(\"0\")) return 1;\n return 2;\n }\n\n return 0;\n }\n\n return NumDecodings(s.Substring(0, 1)) + NumDecodings(s.Substring(1));\n }\n\n\n static int makingAnagrams(string s1, string s2)\n {\n int length = s1.Length + s2.Length;\n\n int[] freqA = frequency(s1);\n int[] freqB = frequency(s2);\n\n Console.WriteLine(string.Join(\"|\", freqA));\n Console.WriteLine(string.Join(\"|\", freqB));\n\n\n int count = 0;\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != freqB[i]) count++;\n }\n\n return length - count;\n }\n public static int firstMissingPositive(int[] a)\n {\n int missing = 1;\n\n HashSet set = new HashSet();\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] > missing)\n {\n set.Add(a[i]);\n }\n else if (a[i] == missing)\n {\n if (!set.Contains(missing + 1))\n {\n missing++;\n }\n else\n {\n missing = returnNewMax(++missing, set);\n }\n }\n }\n\n return missing;\n }\n\n private static int returnNewMax(int n, HashSet set)\n {\n while (set.Contains(n))\n {\n n++;\n }\n\n return n;\n }\n\n\n\n private static bool checkForAllZeroes(string s)\n {\n foreach (char c in s)\n {\n if (c != '0') return false;\n }\n\n return true;\n }\n\n private static int getHigherNumber(int n, int max)\n {\n int currentLength = maxLength(n);\n\n if (currentLength < max)\n {\n int diff = max - currentLength;\n int newNumber = n * (int)Math.Pow(10, diff);\n return newNumber;\n }\n\n return n;\n }\n\n private static int maxLength(int n)\n {\n return n.ToString().Length;\n }\n\n static int gemstones(string[] arr)\n {\n int[][] frequencies = new int[arr.Length][];\n\n for (int i = 0; i < frequencies.Length; i++)\n {\n frequencies[i] = frequency(arr[i]);\n }\n\n int count = 0;\n bool flag = true;\n\n for (int i = 0; i < frequencies[0].Length; i++) //26\n {\n for (int j = 0; j < frequencies.Length - 1; j++)\n {\n if (frequencies[j][i] == 0 || frequencies[j + 1][i] == 0)\n {\n flag = false;\n break;\n }\n }\n\n if (flag) count++;\n flag = true;\n }\n\n return count;\n }\n\n private static bool isPalindrome(int[] a)\n {\n for (int i = 0; i < a.Length / 2; i++)\n {\n if (a[i] != a[a.Length - 1 - i]) return false;\n }\n\n return true;\n }\n\n private static bool hasSubstring(string a, string b)\n {\n int[] freqA = frequency(a);\n int[] freqB = frequency(b);\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != 0 && freqA[i] == freqB[i]) return true;\n }\n\n return false;\n }\n\n private static int LowerBound(int[] a, int target)\n {\n int lo = 0;\n int hi = a.Length - 1;\n int ans = -1;\n\n while (lo <= hi)\n {\n int med = hi - (hi - lo) / 2;\n\n if (target == a[med])\n {\n ans = med;\n hi = med - 1;\n }\n else if (target > a[med])\n {\n lo = med + 1;\n }\n\n else hi = med - 1;\n }\n\n return ans;\n }\n\n private static int[] frequency(string s)\n {\n int[] a = new int[26];\n\n foreach (char c in s)\n {\n a[c - 'a']++;\n }\n\n return a;\n }\n\n public static int max(int[] a, int i)\n {\n if (i == a.Length - 1) return a[a.Length - 1];\n return Math.Max(a[i], max(a, i + 1));\n }\n\n\n private static bool isPrime(int n)\n {\n if (n < 2) return false;\n\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0) return false;\n }\n\n return true;\n }\n\n private static void Swap(ref char a, ref char b)\n {\n char temp = a;\n a = b;\n b = temp;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Again_Twenty_Five_\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n var n = long.Parse(Console.ReadLine());\n\n var result = 25;\n\n Console.WriteLine(result);\n }\n\n private static string ToString(double d)\n {\n return d.ToString(CultureInfo.InvariantCulture);\n }\n\n private static string Right(string s, int n)\n {\n return s.Length < n ? s : s.Substring(s.Length - n);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private static void Main()\n {\n Console.ReadLine();\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n;\n n =Convert.ToInt64( Console.ReadLine());\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Experimental_Educational_Round\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n Console.WriteLine(25);\n \n }\n }\n}\n"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: tagirov2\n * Date: 20.02.2016\n * Time: 09:56\n * \n\n\n\n */\n\nusing System;\n\nclass Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tInt64 n = Int64.Parse (Console.ReadLine ());\n\t\tConsole.WriteLine (\"25\");\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(25);\n }\n }\n}"}, {"source_code": "using System;\n\npublic class AgainTwentyFive630A\n{\n public static void Main(String[] args)\n {\n Console.ReadLine();\n Console.WriteLine(\"25\");\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n\n Console.WriteLine(25);\n }\n } \n}"}, {"source_code": "\ufeffusing System;\nnamespace _630A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n string i = Console.ReadLine();\n Console.Write(\"25\");\n Console.ReadKey();\n }\n catch\n {\n\n \n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n Console.Write(25);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n Console.Write(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n Console.WriteLine(\"25\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n writer.Write(25);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static long Next() {\n int c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n long sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n using System.Threading;\n using System.Threading.Tasks;\n\n namespace Training_App\n {\n class Program\n {\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n\n Console.WriteLine(25);\n\n \n \n }\n\n public static ulong calculateFactorial(ulong n)\n {\n\n ulong result = 1;\n for (ulong i = 1; i <= n; i++)\n {\n result *= i;\n }\n return result;\n }\n\n public static ulong calculateGCD(ulong a , ulong b)\n {\n ulong reminder = 0;\n while(b!=0)\n {\n reminder = a%b;\n a = b;\n b = reminder;\n }\n\n return a;\n }\n\n\n\n }\n \n \n }\n \n\n\n \n\n\n \n\n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A630 {\n public static void Main() {\n Console.WriteLine(25);\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n Console.ReadLine();\n Console.WriteLine(25);\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.WriteLine(25);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\n\nclass PairVariable:IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication252\n{\n\n class Program\n {\n\n static bool P(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n static void Main()\n {\n string[] z = Console.ReadLine().Split();\n //int n = int.Parse(z[0]);\n \n /*string[] ss = Console.ReadLine().Split();\n int[] m = new int[n];\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n m[i] = int.Parse(ss[i]);\n }\n Array.Sort(m);\n for (int i = 0; i < n; i++)\n {\n for (int e = 0; e < n; e++)\n {\n if (i != e)\n {\n if (m[i] == m[e])\n {\n m[e]++;\n sum++;\n }\n }\n }\n }*/\n Console.WriteLine(25);\n \n\n \n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_Solving\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(25);\n }\n\n \n\n }\n \n \n\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.Write(25);\n }\n }\n}"}, {"source_code": "using System;\nclass Program {\n public static void Main(string[] args) {\n Console.ReadLine();\n Console.WriteLine(25);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Again_Twenty_Five_\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(25);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program_630A\n{\n private static void Main()\n {\n Console.ReadLine();\n\n Console.WriteLine(25);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp61\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TwentyFive\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.Write(25);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _630A_Again_Twenty_Five_\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(25.ToString());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Again_Twenty_Five\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(\"25\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int r;\n string xx;\n long n;\n xxx:\n string x;\n n=long.Parse(Console.ReadLine());\n if(n<2||n>(Math.Pow(10,18)*2))\n {\n goto xxx;\n }\n x = (Math.Pow(5, n)).ToString();\n\n r = x.Length;\n xx = x.Substring(r-2, 2);\n Console.WriteLine(25);\n \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(\"25\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _630\n{\n class Program\n {\n static void Main()\n { \n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\nusing E = System.Linq.Enumerable;\n\nnamespace Prob01 {\n class Program {\n protected IOHelper io;\n\n public Program(string inputFile, string outputFile) {\n io = new IOHelper(inputFile, outputFile, Encoding.Default);\n\n io.WriteLine(25);\n\n io.Dispose();\n }\n\n static void Main(string[] args) {\n Program myProgram = new Program(null, null);\n }\n }\n\n class IOHelper : IDisposable {\n public StreamReader reader;\n public StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding) {\n if (inputFile == null)\n reader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n reader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n writer = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n writer = new StreamWriter(outputFile, false, encoding);\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public bool hasNext() {\n if (curTokenIdx >= curLine.Length) {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n return curTokenIdx < curLine.Length;\n }\n\n public string NextToken() {\n return hasNext() ? curLine[curTokenIdx++] : null;\n }\n\n public int NextInt() {\n return int.Parse(NextToken());\n }\n\n public double NextDouble() {\n string tkn = NextToken();\n return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);\n }\n\n public void Write(double val, int precision) {\n writer.Write(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void Write(object stringToWrite) {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(double val, int precision) {\n writer.WriteLine(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void WriteLine(object stringToWrite) {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose() {\n try {\n if (reader != null) {\n reader.Dispose();\n }\n if (writer != null) {\n writer.Flush();\n writer.Dispose();\n }\n } catch { };\n }\n\n\n public void Flush() {\n if (writer != null) {\n writer.Flush();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Console.Read();\n\n Console.Write(25);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\n\t\t\tConsole.WriteLine(25);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Threading;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Globalization;\n\nclass Solution\n{\n public TextInput cin;\n public TextOutput cout;\n public TextOutput cerr;\n public void Solve()\n {\n cout.WriteLine(\"25\");\n }\n}\n\n#region Core\nstatic class Program\n{\n public static readonly TextInput cin = new TextInput(Console.In);\n public static readonly TextOutput cout = new TextOutput(Console.Out);\n public static readonly TextOutput cerr = new TextOutput(Console.Error);\n#if !DEBUG\n static void Main()\n {\n new Solution\n {\n cin = cin,\n cout = cout,\n cerr = cerr\n }.Solve();\n }\n#endif\n}\npublic class SDictionary : Dictionary\n{\n public new TValue this[TKey key]\n {\n get\n {\n TValue res;\n base.TryGetValue(key, out res);\n return res;\n }\n set\n {\n base[key] = value;\n }\n }\n}\npublic static class Ext\n{\n\n #region Prewriten\n public static void Foreach(this IEnumerable elements, Action action)\n {\n foreach(var element in elements)\n {\n action(element);\n }\n }\n public static void Foreach(this IEnumerable elements, Action action)\n {\n var index = 0;\n foreach(var element in elements)\n {\n action(element, index++);\n }\n }\n public static void Do(int from, int n, Action action)\n {\n for (var i = from; i < n; i++) action(i);\n }\n public static IEnumerable Init(int n) where T : new()\n {\n for (var i = 0; i < n; i++)\n {\n yield return new T();\n }\n }\n public static IEnumerable Init(int n, T defaultValue = default(T))\n {\n for (var i = 0; i < n; i++)\n {\n yield return defaultValue;\n }\n }\n public static IEnumerable Init(int n, Func builder)\n {\n for (var i = 0; i < n; i++)\n {\n yield return builder(i);\n }\n }\n public static bool IsEmpty(this string s)\n {\n return string.IsNullOrEmpty(s);\n }\n public static string Safe(this string s)\n {\n return s.IsEmpty() ? string.Empty : s;\n }\n public static void Swap(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n public static long Gcd(long a, long b)\n {\n while (a > 0)\n {\n b %= a;\n Swap(ref a, ref b);\n }\n return b;\n }\n public static int[] ZFunction(string s)\n {\n var z = new int[s.Length];\n for (int i = 1, l = 0, r = 0; i < s.Length; ++i)\n {\n if (i <= r)\n {\n z[i] = Math.Min(r - i + 1, z[i - l]);\n }\n while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])\n {\n z[i]++;\n }\n if (i + z[i] - 1 > r)\n {\n l = i;\n r = i + z[i] - 1;\n }\n }\n return z;\n }\n public static long Pow(long a, long p)\n {\n var b = 1L;\n while (p > 0)\n {\n if ((p & 1) == 0)\n {\n a *= a;\n p >>= 1;\n }\n else\n {\n b *= a;\n p--;\n }\n }\n return b;\n }\n #endregion\n}\n\npublic delegate bool TryParseDelegate(string s, NumberStyles style, IFormatProvider format, out T value);\npublic class TextInput\n{\n private static Dictionary primitiveParsers = new Dictionary\n {\n { typeof(sbyte), new TryParseDelegate(sbyte.TryParse) },\n { typeof(short), new TryParseDelegate(short.TryParse) },\n { typeof(int), new TryParseDelegate(int.TryParse) },\n { typeof(long), new TryParseDelegate(long.TryParse) },\n\n { typeof(byte), new TryParseDelegate(byte.TryParse) },\n { typeof(ushort), new TryParseDelegate(ushort.TryParse) },\n { typeof(uint), new TryParseDelegate(uint.TryParse) },\n { typeof(ulong), new TryParseDelegate(ulong.TryParse) },\n\n { typeof(float), new TryParseDelegate(float.TryParse) },\n { typeof(double), new TryParseDelegate(double.TryParse) },\n { typeof(decimal), new TryParseDelegate(decimal.TryParse) },\n\n { typeof(char), new TryParseDelegate(CharParser) },\n { typeof(string), new TryParseDelegate(StringParser) }\n };\n private static bool CharParser(string s, NumberStyles style, IFormatProvider format, out char res)\n {\n res = char.MinValue;\n if (string.IsNullOrEmpty(s))\n {\n return false;\n }\n else\n {\n res = s[0];\n return true;\n }\n }\n private static bool StringParser(string s, NumberStyles style, IFormatProvider format, out string res)\n {\n res = s == null ? string.Empty : s;\n return true;\n }\n\n\n private string line = null;\n private int pos = 0;\n\n public IFormatProvider FormatProvider { get; set; }\n public NumberStyles NumberStyle { get; set; }\n public TextReader TextReader { get; set; }\n\n public TextInput(string path) : this(path, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n }\n public TextInput(string path, NumberStyles numberStyle, IFormatProvider formatProvider) : this(new StreamReader(path), numberStyle, formatProvider)\n {\n\n }\n public TextInput(TextReader textReader) : this(textReader, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n\n }\n public TextInput(TextReader textReader, NumberStyles numberStyle, IFormatProvider formatProvider)\n {\n TextReader = textReader;\n NumberStyle = numberStyle;\n FormatProvider = formatProvider;\n }\n\n public bool IsEof\n {\n get\n {\n return line == null && TextReader.Peek() == -1;\n }\n }\n public void SkipWhiteSpace()\n {\n while (!IsEof)\n {\n if (line != null && pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n return;\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n continue;\n }\n while (pos < line.Length && char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n }\n }\n private void SkipWhiteSpace(bool force)\n {\n if (force)\n {\n SkipWhiteSpace();\n }\n else\n {\n SkipWhiteSpace();\n }\n }\n\n public T[] ReadArray()\n {\n var length = Read();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n var array = new T[length];\n\n var parser = GetParser();\n var style = NumberStyle;\n var format = FormatProvider;\n\n for (var i = 0; i < length; i++)\n {\n array[i] = Read(parser, style, format);\n }\n return array;\n }\n\n public bool TryReadArray(out T[] array)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array);\n }\n public bool TryReadArray(out T[] array, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array, length);\n }\n public bool TryReadArray(T[] array, int offset, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, array, offset, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array)\n {\n var length = 0;\n if (!TryRead(out length))\n {\n array = null;\n return false;\n }\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array, int length)\n {\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, T[] array, int offset, int length)\n {\n var result = true;\n for (var i = 0; i < length && result; i++)\n {\n result &= TryRead(parser, style, format, out array[offset + i]);\n }\n return result;\n }\n\n private TryParseDelegate GetParser()\n {\n var type = typeof(T);\n return (TryParseDelegate)primitiveParsers[type];\n }\n public T Read()\n {\n return Read(GetParser());\n }\n public T Read(NumberStyles style, IFormatProvider format)\n {\n return Read(GetParser(), style, format);\n }\n public T Read(TryParseDelegate parser)\n {\n return Read(parser, NumberStyle, FormatProvider);\n }\n public T Read(TryParseDelegate parser, NumberStyles style, IFormatProvider format)\n {\n T result;\n if (!TryRead(parser, style, format, out result))\n {\n throw new FormatException();\n }\n return result;\n }\n public bool TryRead(out T value)\n {\n return TryRead(GetParser(), out value);\n }\n public bool TryRead(NumberStyles style, IFormatProvider format, out T value)\n {\n return TryRead(GetParser(), style, format, out value);\n }\n public bool TryRead(TryParseDelegate parser, out T value)\n {\n return parser(ReadToken(), NumberStyle, FormatProvider, out value);\n }\n public bool TryRead(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T value)\n {\n return parser(ReadToken(), style, format, out value);\n }\n public string ReadToken()\n {\n SkipWhiteSpace(false);\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n\n if (pos >= line.Length || char.IsWhiteSpace(line[pos])) return string.Empty;\n\n var start = pos;\n while (pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n return line.Substring(start, pos - start);\n }\n public string ReadLine()\n {\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n }\n\n var ans = line.Substring(pos);\n pos = line.Length;\n return ans;\n }\n\n private void Next()\n {\n line = TextReader.ReadLine();\n pos = 0;\n }\n}\n\npublic class TextOutput\n{\n public IFormatProvider FormatProvider { get; set; }\n public TextWriter TextWriter { get; set; }\n\n public TextOutput(string path) : this(path, CultureInfo.InvariantCulture)\n {\n }\n public TextOutput(string path, IFormatProvider formatProvider) : this(new StreamWriter(path), formatProvider)\n {\n\n }\n public TextOutput(TextWriter textWriter) : this(textWriter, CultureInfo.InvariantCulture)\n {\n\n }\n public TextOutput(TextWriter textWriter, IFormatProvider formatProvider)\n {\n TextWriter = textWriter;\n FormatProvider = formatProvider;\n }\n\n public TextOutput WriteArray(params T[] array)\n {\n return WriteArray(array, true);\n }\n public TextOutput WriteArray(T[] array, bool appendLine)\n {\n return WriteArray(array, 0, array.Length, appendLine);\n }\n public TextOutput WriteArray(T[] array, int offset, int length, bool appendLine = true)\n {\n var sb = new StringBuilder();\n for (var i = 0; i < length; i++)\n {\n sb.Append(Convert.ToString(array[offset + i], FormatProvider));\n if (i + 1 < length)\n {\n sb.Append(' ');\n }\n }\n return appendLine ? WriteLine(sb.ToString()) : Write(sb.ToString());\n }\n\n public TextOutput WriteLine(object obj)\n {\n return WriteLine(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput WriteLine(string text, params object[] args)\n {\n return WriteLine(string.Format(FormatProvider, text, args));\n }\n public TextOutput WriteLine(string text)\n {\n TextWriter.WriteLine(text);\n return this;\n }\n public TextOutput WriteLine(char[] buffer)\n {\n TextWriter.WriteLine(buffer);\n return this;\n }\n public TextOutput WriteLine(char[] buffer, int offset, int length)\n {\n TextWriter.WriteLine(buffer, offset, length);\n return this;\n }\n public TextOutput WriteLine()\n {\n TextWriter.WriteLine();\n return this;\n }\n\n public TextOutput Write(object obj)\n {\n return Write(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput Write(string text, params object[] args)\n {\n return Write(string.Format(FormatProvider, text, args));\n }\n public TextOutput Write(string text)\n {\n TextWriter.Write(text);\n return this;\n }\n public TextOutput Write(char[] buffer)\n {\n TextWriter.Write(buffer);\n return this;\n }\n public TextOutput Write(char[] buffer, int offset, int length)\n {\n TextWriter.Write(buffer, offset, length);\n return this;\n }\n}\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(25);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\n\t\t\t\tvar number = int.Parse(Console.ReadLine());\n\t\t\t\tvar result = Math.Pow(5, number);\n\t\t\t\tvar resultStr = result.ToString();\n\n\t\t\t\tConsole.WriteLine(resultStr.Length > 2 ? resultStr.Substring(resultStr.Length - 2) : resultStr);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(25);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A._\u041e\u043f\u044f\u0442\u044c_\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c_\u043f\u044f\u0442\u044c_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string trash = Console.ReadLine();\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n\n class Program\n {\n static void Main(string[] args)\n { \n double n = double.Parse(Console.ReadLine());\n Console.WriteLine(25);\n\n }\n }\n}\n"}, {"source_code": "using System; \nusing System.Numerics;\nclass MainClass {\n public static void Main (string[] args) {\n BigInteger n =BigInteger.Parse(Console.ReadLine());\n Console.WriteLine(\"25\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace helveic2019\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n //solve_helvetic2019A();\n solve_volbitA();\n }\n\n\n public static void solve_volbitC()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n BigInteger res = new BigInteger();\n\n for (int i = 1; i <= n; i++)\n {\n res += BigInteger.Pow(2, i);\n }\n\n Console.WriteLine(res);\n }\n\n public static void solve_volbitA()\n {\n long n = Convert.ToInt64(Console.ReadLine());\n \n int res = 25;\n \n Console.WriteLine(res);\n }\n\n public static void solve_helvetic2019A()\n {\n string[] sb = Console.ReadLine().Split(' ');\n int s = Convert.ToInt32(sb[0]);\n int b = Convert.ToInt32(sb[1]);\n\n string[] a = Console.ReadLine().Split(' ');\n int[] ships = Array.ConvertAll(a, int.Parse);\n Dictionary dp = new Dictionary();\n List> bases = new List>();\n\n for (int i = 0; i < b; i++)\n {\n string[] dg = Console.ReadLine().Split(' ');\n int d = Convert.ToInt32(dg[0]);\n int g = Convert.ToInt32(dg[1]);\n bases.Add(new KeyValuePair(d, g));\n }\n Array.Sort(ships);\n bases.Sort((x, y) => x.Key.CompareTo(y.Key));\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _630A\n {\n public static void Main(string[] args)\n {\n string n = Console.ReadLine();\n Console.WriteLine(25);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tConsole.ReadLine ();\n\t\t\tConsole.WriteLine (\"25\");\n\t\t\tConsole.ReadLine ();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"25\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace sample\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Console.WriteLine(25);\n }\n\n \n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = UInt64.Parse(Console.ReadLine());\n Console.Write(\"25\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _630A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(25);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.WriteLine(\"25\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nnamespace test\n{\n class Program\n {\n private static int[] numbers;\n static void Main()\n {\n WriteLine(25);\n }\n public static void reader()\n {\n numbers = Console\n .ReadLine()\n .Split(new Char[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(item => int.Parse(item))\n .ToArray();\n }\n \n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n int num = Convert.ToInt32(Console.ReadLine());\n if (num >= 2) {\n Console.WriteLine(\"25\");\n }\n else\n return;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n String str = Console.ReadLine();\n int num = Convert.ToInt32(str);\n while (num < 2)\n {\n Console.WriteLine(\"\");\n str = Console.ReadLine();\n num = Convert.ToInt32(str);\n }\n String powNumberStr = Convert.ToInt32(Math.Pow(5,num)).ToString().Trim();\n String result = powNumberStr.Substring(powNumberStr.Length - 2, 2);\n Console.WriteLine(\"{0}\", result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n int num = Convert.ToInt32(Console.ReadLine().Trim());\n if (num >= 2) {\n Console.WriteLine(\"25\");\n }\n else\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n String str = Console.ReadLine();\n long num = Convert.ToInt32(str);\n while (num < 2)\n {\n Console.WriteLine(\"\");\n str = Console.ReadLine();\n num = Convert.ToInt32(str);\n }\n String powNumberStr = Convert.ToInt32(Math.Pow(5,num)).ToString();\n String result = powNumberStr.Substring(powNumberStr.Length - 2, 2);\n Console.WriteLine(\"{0}\", result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n int num = Convert.ToInt32(Console.ReadLine().Trim());\n if (num >= 2 && num <= int.MaxValue) {\n Console.WriteLine(\"25\");\n }\n else\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n String str = Console.ReadLine();\n int num = Convert.ToInt32(str);\n String powNumberStr = Convert.ToInt32(Math.Pow(5,num)).ToString();\n String result = powNumberStr.Substring(powNumberStr.Length - 2, 2);\n Console.WriteLine(\"{0}\", result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n int num = Convert.ToInt32(Console.ReadLine());\n if (num >= 2) {\n Console.WriteLine(\"25\");\n }\n else\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\");\n String str = Console.ReadLine();\n int num = Convert.ToInt32(str);\n while (num < 2)\n {\n Console.WriteLine(\"\");\n str = Console.ReadLine();\n num = Convert.ToInt32(str);\n }\n Console.WriteLine(\"25\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace _630A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 0)\n {\n Console.Write(\"1\");\n }\n else if (n > 1)\n Console.Write(\"25\");\n else\n Console.Write(\"5\");\n Console.ReadKey();\n }\n catch\n {\n\n \n }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace _630A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n long n = int.Parse(Console.ReadLine());\n Console.Write(5*5);\n Console.ReadKey();\n }\n catch\n {\n\n \n }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace _630A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n long n = int.Parse(Console.ReadLine());\n if (n == 0)\n {\n Console.Write(\"1\");\n }\n else if (n > 1)\n Console.Write(\"25\");\n else\n Console.Write(\"5\");\n Console.ReadKey();\n }\n catch\n {\n\n \n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int r;\n string xx;\n Double n;\n xxx:\n string x;\n n=Double.Parse(Console.ReadLine());\n if(n<2||n>(Math.Pow(10,18)*2))\n {\n goto xxx;\n }\n x = (Math.Pow(5, n)).ToString();\n\n r = x.Length;\n xx = x.Substring(r-2, 2);\n Console.WriteLine(xx);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar number = int.Parse(Console.ReadLine());\n\n\t\t\tConsole.WriteLine(Math.Pow(5, number));\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\n\t\t\t\tvar number = int.Parse(Console.ReadLine());\n\t\t\t\tvar result = Math.Pow(5, number);\n\t\t\t\tvar resultStr = result.ToString();\n\n\t\t\t\tConsole.WriteLine(resultStr.Length > 2 ? resultStr.Substring(resultStr.Length - 2) : resultStr);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n long n = long.Parse(Console.ReadLine());\n string k = Math.Pow(5 , n).ToString();\n string num1 =k[k.Length- 1].ToString();\n string num2 =k[k.Length- 2].ToString();\n Console.WriteLine(num2+num1);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace helveic2019\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n //solve_helvetic2019A();\n solve_volbitA();\n }\n\n\n public static void solve_volbitC()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n BigInteger res = new BigInteger();\n\n for (int i = 1; i <= n; i++)\n {\n res += BigInteger.Pow(2, i);\n }\n\n Console.WriteLine(res);\n }\n\n public static void solve_volbitA()\n {\n long n = Convert.ToInt32(Console.ReadLine());\n \n int res = 1;\n if (n > 1)\n {\n res = 2;\n }\n \n Console.WriteLine(res);\n }\n\n public static void solve_helvetic2019A()\n {\n string[] sb = Console.ReadLine().Split(' ');\n int s = Convert.ToInt32(sb[0]);\n int b = Convert.ToInt32(sb[1]);\n\n string[] a = Console.ReadLine().Split(' ');\n int[] ships = Array.ConvertAll(a, int.Parse);\n Dictionary dp = new Dictionary();\n List> bases = new List>();\n\n for (int i = 0; i < b; i++)\n {\n string[] dg = Console.ReadLine().Split(' ');\n int d = Convert.ToInt32(dg[0]);\n int g = Convert.ToInt32(dg[1]);\n bases.Add(new KeyValuePair(d, g));\n }\n Array.Sort(ships);\n bases.Sort((x, y) => x.Key.CompareTo(y.Key));\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp27\n{\n class Program\n {\n static void Main(string[] args)\n {\n UInt64 a = (UInt64 )Math.Pow(5,UInt64.Parse(Console.ReadLine()));\n Console.WriteLine( a / 10 % 10 + \"\" + a % 10);\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar n = Convert.ToInt64(Console.ReadLine());\n\t\tvar d = Math.Pow(5, n);\n\t\tvar res = d % 100;\n\t\tConsole.WriteLine(res);\n\t}\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tdouble res = 25;\n\t\tdouble n = double.Parse(Console.ReadLine());\n\t\tdouble d = Math.Pow(5, n);\n\t\tif(n!=1000000000000000000){\n\t\t\tres = d % 100;\t\n\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tint ans = 0;\n\t\tfor(int i=1; i0){\n\t\t\tif((N&1)==1){\n\t\t\t\tret*=x;\n\t\t\t\tret%=100;\n\t\t\t}\n\t\t\tx*=x;\n\t\t\tN>>=1;\n\t\t}\n\t\tConsole.WriteLine(ret);\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tpublic Sol(){\n\t\t\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tlong N=rl();\n\t\tlong ret=1;\n\t\tlong x=5;\n\t\twhile(N>0){\n\t\t\tif((N&1)==1){\n\t\t\t\tret*=x;\n\t\t\t\tret%=100;\n\t\t\t}\n\t\t\tx*=x;\n\t\t\tN>>=1;\n\t\t}\n\t\tConsole.WriteLine(\"{0:D02}\",ret);\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tpublic Sol(){\n\t\t\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string[] ar= Console.ReadLine().Split(' ');\n Console.WriteLine(Math.Pow(5,Int64.Parse(Console.ReadLine())));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Again_Twenty_Five_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Pow(5,x));\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n int x1 = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(Math.Pow(5, x1));\n \n\n }\n }\n}\n"}], "src_uid": "dcaff75492eafaf61d598779d6202c9d"} {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n { \n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Console.WriteLine(input[0] > input[1] ? \"First\" : \"Second\");\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n1, n2;\n\n var values = Console.ReadLine().Split().Select(int.Parse).ToList();\n n1 = values[0];\n n2 = values[1];\n if (n1 < n2)\n Console.WriteLine(\"Second\");\n\n if (n1 == n2)\n Console.WriteLine(\"Second\");\n\n if (n1 > n2)\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n string[] ch = s.Split(' ');\n int n1 = int.Parse(ch[0]);\n int n2 = int.Parse(ch[1]);\n int k1 = int.Parse(ch[2]);\n int k2 = int.Parse(ch[3]);\n\n if (n1 > n2)\n {\n Console.WriteLine(\"First\");\n\n }\n else\n {\n Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n Console.WriteLine(count[0] <= count[1]?\"Second\":\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int x = 0, idx = 0; \n int [] arr=new int [111];\n for (int i = 0; i = arr[0]) Console.WriteLine(\"Second\");\n else Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] inputs = Console.ReadLine().Split(' ').Select(num => Convert.ToByte(num)).ToArray();\n byte n1 = inputs[0];\n byte n2 = inputs[1];\n\n if (n1 <= n2)\n {\n Console.WriteLine(\"Second\");\n return;\n }\n else\n {\n Console.WriteLine(\"First\");\n return;\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] nums = Console.ReadLine().Split(new char[] { '\\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); \n Console.WriteLine((int.Parse(nums[0])>int.Parse(nums[1])?\"First\":\"Second\"));\n } \n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Xml;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] Data = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n int n1 = Data[0], k1 = Data[2];\n int n2 = Data[1], k2 = Data[3];\n\n string Winner = \"First\";\n int i = 1;\n while (true)\n {\n if (i % 2 == 1)\n {\n if (n1 > 0)\n {\n n1 -= 1;\n Winner = \"First\";\n i++;\n continue;\n }\n else\n {\n break;\n }\n }\n if (i % 2 == 0)\n {\n if (n2 > 0)\n {\n n2 -= 1;\n Winner = \"Second\";\n i++;\n continue;\n }\n else\n {\n break;\n }\n }\n\n \n }\n\n Console.WriteLine(Winner);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine().Split(' ');\n var n1 = Int32.Parse(str[0]);\n var n2 = Int32.Parse(str[1]);\n var k1 = Int32.Parse(str[2]);\n var k2 = Int32.Parse(str[3]);\n var res = 0;\n while (true)\n {\n if (n1-- == 0) ++res;\n if (res != 0) break;\n if (n2-- == 0) --res;\n if (res != 0) break; \n }\n if (res == 1)\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine().Split(' ');\n var n1 = Int32.Parse(str[0]);\n var n2 = Int32.Parse(str[1]);\n var k1 = Int32.Parse(str[2]);\n var k2 = Int32.Parse(str[3]);\n var res = 0;\n while (true)\n {\n if (n1 != 0)\n {\n --n1;\n }\n else\n {\n ++res;\n break;\n }\n if (n2 != 0)\n {\n --n2; \n }\n else\n {\n --res;\n break;\n }\n }\n if (res == 1)\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n if (s[0] > s[1])\n Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n\n }\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n// Codeforces problem 513A \"\u0418\u0433\u0440\u0430\"\n// http://codeforces.com/problemset/problem/513/A\nnamespace _513_A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t#region Read data\n\t\t\tstring[] tmp = Console.ReadLine().Split();\n\t\t\tint n1 = Convert.ToInt32(tmp[0]);\n\t\t\tint n2 = Convert.ToInt32(tmp[1]);\n\t\t\tint k1 = Convert.ToInt32(tmp[2]);\n\t\t\tint k2 = Convert.ToInt32(tmp[3]);\n\t\t\t#endregion\n\t\t\t#region Process data\n\n\t\t\t#endregion\n\t\t\t#region Write results\n\t\t\tif (n1 > n2)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"First\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Second\");\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\t#endregion\n\t\t}\n\t}\n}\n"}, {"source_code": "class x\n{\n\tstatic void Main()\n\t{\n\t\tvar line = System.Console.ReadLine().Split();\n\t\tvar n1 = int.Parse(line[0]);\n\t\tvar n2 = int.Parse(line[1]);\n\t\tvar k1 = int.Parse(line[2]);\n\t\tvar k2 = int.Parse(line[3]);\n\t\tvar min = System.Math.Min(k1,k2);\n\t\twhile(n1>0 && n2>0)\n\t\t{\n\t\t\tn1-=min;\n\t\t\tn2-=min;\n\t\t}\n\t\tif(n1==n2) System.Console.Write(\"Second\");\n\t\telse System.Console.Write(n1>n2?\"First\":\"Second\");\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace TaskA\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n //s = @\"2 1 1 1\".Split(cs, StringSplitOptions.RemoveEmptyEntries);\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n\n int n1 = sc.nextInt();\n int n2 = sc.nextInt();\n int k1 = sc.nextInt();\n int k2 = sc.nextInt();\n\n if (n2 >= n1)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var n1 = _.NextInt();\n var n2 = _.NextInt();\n _.NextInt();\n _.NextInt();\n _.WriteLine(n1 > n2 ? \"First\" : \"Second\");\n// _.WriteLine(n1 > n2 ? \"First\" : \"Second\");\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public byte[] NextByteArray() { return NextStringArray().Select(byte.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n var strs = str.Split(' ');\n int n1 = 0;\n int n2 = 0;\n int k1 = 0;\n int k2 = 0;\n int.TryParse(strs[0], out n1);\n int.TryParse(strs[1], out n2);\n int.TryParse(strs[2], out k1);\n int.TryParse(strs[3], out k2);\n\n if(n1 <= n2)\n {\n Console.WriteLine(\"Second\");\n }\n else \n {\n Console.WriteLine(\"First\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass a\n{\n static void Main()\n {\n var a = Console.ReadLine().Split();\n Console.WriteLine(int.Parse(a[0])>int.Parse(a[1])?\"First\":\"Second\"); \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0418\u0433\u0440\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n string[] x = s.Split(' ');\n int n1 = int.Parse(x[0]);\n int n2 = int.Parse(x[1]);\n int k1 = int.Parse(x[2]);\n int k2 = int.Parse(x[3]);\n\n if (n1 <= n2)\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing Kattis.IO;\nusing System.Collections.Generic;\n\npublic class _513A {\n\n public static void Main (string[] args) {\n var cin = new Tokenizer(Console.OpenStandardInput());\n var cout = new BufferedStdoutWriter ();\n \n if (int.Parse (cin.Next ()) > int.Parse (cin.Next ()))\n cout.WriteLine (\"First\");\n else\n cout.WriteLine (\"Second\");\n\n cout.Close ();\n }\n}\n\nnamespace Kattis.IO {\n public class NoMoreTokensException : Exception {\n }\n\n public class Tokenizer {\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer (Stream inStream) {\n var bs = new BufferedStream (inStream);\n reader = new StreamReader (bs);\n }\n\n public Tokenizer () : this (Console.OpenStandardInput ()) {\n // Nothing more to do\n }\n\n private string PeekNext () {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length) {\n if (tokens [pos].Length == 0) {\n ++pos;\n return PeekNext ();\n }\n return tokens [pos];\n }\n string line = reader.ReadLine ();\n if (line == null) {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split (null);\n pos = 0;\n return PeekNext ();\n }\n\n public bool HasNext () {\n return (PeekNext () != null);\n }\n\n public string Next () {\n string next = PeekNext ();\n if (next == null)\n throw new NoMoreTokensException ();\n ++pos;\n return next;\n }\n }\n\n public class Scanner : Tokenizer {\n\n public int NextInt () {\n return int.Parse (Next ());\n }\n\n public long NextLong () {\n return long.Parse (Next ());\n }\n\n public float NextFloat () {\n return float.Parse (Next ());\n }\n\n public double NextDouble () {\n return double.Parse (Next ());\n }\n }\n\n public class BufferedStdoutWriter : StreamWriter {\n public BufferedStdoutWriter () : base (new BufferedStream (Console.OpenStandardOutput ())) {\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n\n ulong x, y, xx, yy;\n String read;\n read = Console.ReadLine();\n x = Convert.ToUInt64(read.Split(' ')[0]);\n y = Convert.ToUInt64(read.Split(' ')[1]);\n xx = Convert.ToUInt64(read.Split(' ')[2]);\n yy = Convert.ToUInt64(read.Split(' ')[3]);\n for(int i=0;;i++)\n {\n if(i%2==0)\n {\n x -= 1;\n }\n else\n {\n y -= 1;\n }\n if (x <= 0) { Console.WriteLine(\"Second\"); break; }\n if (y <= 0) { Console.WriteLine(\"First\"); break; }\n\n }\n\n /* \n * int x, y;\n x = Convert.ToInt32(Console.ReadLine());\n y= Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(findmax(x, y));\n * short a;\n int b;\n double c;\n /* actual initialization \n a = 10;\n b = 20;\n c = a + b;\n Console.WriteLine(\"a = {0}, b = {1}, c = {2}\", a, b, c);\n b = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(b);\n string xx;\n xx = Console.ReadLine();\n Console.WriteLine(xx);\n double x1;\n x1 = Convert.ToDouble(Console.ReadLine());\n Console.WriteLine('\\a');*/\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Data.Sql;\nusing System.Collections;\nusing System.Numerics;\n\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(x[0] <= x[1] ? \"Second\" : \"First\");\n\n }\n }\n\n\n\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _513A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(s[0]<=s[1]?\"Second\":\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class test\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int[] x=new int [4];\n int j=0,mu=0;\n for (int i = 0; i < s.Length; ++i)\n {\n if (s[i] != ' ')\n {\n mu =mu* 10+ (s[i] - '0');\n }\n else\n {\n x[j] = mu;\n ++j;\n mu = 0;\n }\n \n }\n //Console.WriteLine(\"{0} {1}\", x[0], x[1]);\n if (x[0] == x[1])\n Console.WriteLine(\"Second\");\n else if (x[0] > x[1])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[] Input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int iN1 = Input[0];\n int iN2 = Input[1];\n int iK1 = Input[2];\n int iK2 = Input[3];\n\n while (iN1 != 0 && iN2 != 0 )\n {\n iN1--;\n if (iN1 == 0)\n {\n break;\n }\n iN2--;\n }\n\n if ( iN1 == 0)\n {\n Console.WriteLine(\"Second\");\n }\n else if (iN2 == 0 )\n {\n Console.WriteLine(\"First\");\n }\n\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int box1 = init[0];\n int box2 =init[1];\n int k1 = init[2];\n int k2 = init[3];\n\n Console.WriteLine(box1 > box2 ? \"First\" : \"Second\");\n\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] inputs = Console.ReadLine().Split(' ').Select(num => Convert.ToByte(num)).ToArray();\n byte n1 = inputs[0];\n byte n2 = inputs[1];\n byte k1 = inputs[2];\n byte k2 = inputs[3];\n\n while(true)\n {\n n1--;\n n2--;\n if(n1 == 0)\n {\n Console.WriteLine(\"Second\");\n return;\n }\n if(n2 == 0)\n {\n Console.WriteLine(\"First\");\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Game\n{\n\tpublic static string Input = Console.ReadLine();\n\tpublic static int length = Input.Length;\n\tpublic static int winner = 0;\n\tpublic static int Number1;\n\tpublic static int Number2;\n\tpublic static int Iterating = 1;\n\tpublic static string NumberRead1;\n\tpublic static string NumberRead2;\n\tpublic static void RetrieveNumbers()\n\t{\n\t\tfor(int i = 0; i < length; i++)\n\t\t{\n\t\t\tchar letter = Input[i];\n\t\t\tif (letter == ' ')\n\t\t\t{\n\t\t\t\tIterating++;\n\t\t\t}\n\t\t\telse\n\t\t\tif(Iterating == 1)\n\t\t\t{\n\t\t\t\tNumberRead1 = NumberRead1 + letter;\n\t\t\t}\n\t\t\tif(Iterating == 2)\n\t\t\t{\n\t\t\t\tNumberRead2 = NumberRead2 + letter;\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void ConvertToInt()\n\t{\n\t\tNumber1 = int.Parse(NumberRead1);\n\t\tNumber2 = int.Parse(NumberRead2);\n\t}\n\tpublic static void TestNumbers(int a, int b)\n\t{\n\t\tif(a > b)\n\t\t{\n\t\t\twinner = 1;\n\t\t}\n\t\telse winner = 2;\n\t}\n\tpublic static void Print(string Content)\n\t{\n\t\tConsole.WriteLine(Content);\n\t}\n\tpublic static void Main()\n\t{\n\t\tRetrieveNumbers();\n\t\tConvertToInt();\n\t\tTestNumbers(Number1, Number2);\n\t\tif(winner == 1) Console.WriteLine(\"First\");\n\t\tif(winner == 2) Console.WriteLine(\"Second\");\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace RM_R2015_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n1 = int.Parse(s[0]), n2 = int.Parse(s[1]), k1 = int.Parse(s[2]), k2 = int.Parse(s[3]);\n if ((n1 - n2) > 0) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Problem16\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n1 = input[0];\n int n2 = input[1];\n int k1 = input[2];\n int k2 = input[3];\n Console.WriteLine(n1>n2?\"First\":\"Second\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Problem___513A___A._Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n1 = input[0];\n int n2 = input[1];\n int k1 = input[2];\n int k2 = input[3];\n Console.WriteLine(n1>n2?\"First\":\"Second\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Point : IComparable\n {\n public int a { get; set; }\n public int b { get; set; }\n\n public Point(int x, int y)\n {\n a = x;\n b = y;\n }\n\n\n\n\n public int CompareTo(Point other)\n {\n return this.a.CompareTo(other.a);\n }\n }\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n1 = int.Parse(s[0]), n2 = int.Parse(s[1]), k1 = int.Parse(s[2]), k2 = int.Parse(s[3]);\n\n if (n2 >= n1) Console.WriteLine(\"Second\"); else Console.WriteLine(\"First\");\n\n \n }\n }\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: tagirov2\n * Date: 12.02.2016\n * Time: 11:56\n * \n\n\n\nA. \ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n2 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n256 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\n\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd. \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n1 \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n2 \ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd k1 \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd 1 \ufffd\ufffd k2 \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n1,?n2,?k1,?k2. \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 1 \ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 50.\n\n\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 3 \ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \"First\" \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \"Second\" \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n2 2 1 2\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\nSecond\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n2 1 1 1\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\nFirst\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\n\n\n */\n\nusing System;\n\n//using System.Globalization;\n\nclass Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tstring s = Console.ReadLine ();\n\t\tstring [] t = s.Split (' ');\n\t\tint n1 = int.Parse (t [0]);\n\t\tint n2 = int.Parse (t [1]);\n\t\tint k1 = int.Parse (t [2]);\n\t\tint k2 = int.Parse (t [3]);\n\n\t\tif ( n1 > n2 )\n\t\t\tConsole.Write(\"First\");\n\t\telse\n\t\t\tConsole.Write(\"Second\");\n\n//\t\tConsole.ReadKey(true);\n\t}\n}\n//\n//Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n//Console.ReadLine().Split(new char[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n//NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n//string [] input = Console.In.ReadToEnd().Split(new char[] {' ', '\\t', '\\n', '\\r'}, StringSplitOptions.RemoveEmptyEntries);\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_513A_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n[0] > n[1])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n if (int.Parse(str[1])>= int.Parse(str[0]))\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Problem___513A___A._Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n1 = input[0];\n int n2 = input[1];\n int k1 = input[2];\n int k2 = input[3];\n Console.WriteLine(n1>n2?\"First\":\"Second\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n return double.Parse(ReadNextToken());\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n1, n2, k1, k2;\n int result;\n\n public void Solve()\n {\n n1 = ioHelper.ReadNextInt();\n n2 = ioHelper.ReadNextInt();\n k1 = ioHelper.ReadNextInt();\n k2 = ioHelper.ReadNextInt();\n\n int result1 = n1;\n int result2 = n2;\n\n bool first = result1 > result2;\n\n if (first)\n ioHelper.WriteLine(\"First\");\n else\n ioHelper.WriteLine(\"Second\");\n\n ioHelper.Flush();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n internal static void MyMain()\n {\n var ints = RInts();\n int n1 = ints[0];\n int n2 = ints[1];\n\n if (n1 <= n2)\n {\n WLine(\"Second\");\n }\n else\n {\n WLine(\"First\");\n }\n\n\n }\n private static int[] RowSum(int[] ints)\n {\n var newRow = new int[ints.Length];\n newRow[0] = ints[0];\n for (int j = 1; j < ints.Length; j++)\n {\n newRow[j] = ints[j] + newRow[j - 1];\n }\n return newRow;\n }\n\n private static int RoundUpDiv(int a, int n)\n {\n return (a + n - 1) / n;\n }\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n Secret.Run();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n static void RLongs(out long a, out long b)\n {\n var ints = Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt64(s));\n a = ints[0];\n b = ints[1];\n }\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n \n string str = Console.ReadLine();\n string[] strNumberlist = str.Split(' ');\n int[] integers = new int[4];\n for (int i = 0; i < strNumberlist.Length; i++)\n {\n integers[i] = int.Parse(strNumberlist[i]);\n }\n\n int n1 = integers[0];\n int n2 = integers[1];\n int k1 = integers[2];\n int k2 = integers[3];\n\n\n while (n1>0 && n2>0)\n {\n n1--;\n n2--;\n }\n \n if(n1 == 0)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Serialization;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Factorial\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();int[] a = new int[s.Length];\n for (int i = 0; i < s.Length; i++) a[i] = Convert.ToInt32(s[i]);\n int n1 = a[0], n2 = a[1], k1 = a[2], k2 = a[3]; bool t = true;\n while (true)\n {\n if (t == true) { if (n1 == 0) { Console.WriteLine(\"Second\"); break; } n1--; t = false; }\n else { if (n2 == 0) { Console.WriteLine(\"First\"); break; } n2--; t = true; }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace Rockethon\n{\n class Program\n {\n static void Main()\n {\n byte n1, n2, k1, k2;\n string[] buffer = Console.ReadLine().Split(' ');\n n1 = Convert.ToByte(buffer[0]);\n n2 = Convert.ToByte(buffer[1]);\n k1 = Convert.ToByte(buffer[2]);\n k2 = Convert.ToByte(buffer[3]);\n if (n1 <= n2)\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n if (a[0] > a[1])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Number513A {\n class Program {\n static void Main(string[] args) {\n var mas = Console.ReadLine().Split(' ');\n Int32 n1 = Int32.Parse(mas[0]);\n Int32 n2 = Int32.Parse(mas[1]);\n Int32 k1 = Int32.Parse(mas[2]);\n Int32 k2 = Int32.Parse(mas[3]);\n Console.WriteLine(n1 > n2 ? \"First\" : \"Second\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n int n1 = int.Parse(str[0]);\n int n2= int.Parse(str[1]);\n int k1 = int.Parse(str[2]);\n int k2 = int.Parse(str[3]);\n\n while(n1 != 0 || n2 != 0)\n {\n if(n1 > n2)\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace _513A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Scanner scan = new Scanner(Console.In);\n \n int n1 = scan.NextInt();\n int n2 = scan.NextInt();\n \n if (n1 == n2 || n1 < n2)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n \n class Scanner\n {\n string buffer;\n TextReader reader;\n int headPos;\n int nextSymbolEnd;\n \n public Scanner(string str) \n {\n buffer = str;\n reader = null;\n \n Reset();\n }\n \n public Scanner(TextReader rdr) \n {\n buffer = \"\";\n reader = rdr;\n ReadIntoBuffer();\n \n Reset();\n }\n \n private bool ReadIntoBuffer()\n {\n if (reader != null)\n {\n string next = reader.ReadLine();\n if (next != null)\n {\n next = next.Trim();\n }\n \n if (next != null && next.Length > 0)\n {\n // Console.WriteLine(\"Appending next \\\"{0}\\\"\", next);\n buffer += next;\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n \n public void Reset()\n {\n headPos = 0;\n nextSymbolEnd = 0;\n \n MoveNext();\n }\n \n public int NextInt()\n {\n // Console.WriteLine(\"! NextInt() h={0} t={1} len={2}\", headPos, nextSymbolEnd, buffer.Length);\n \n int tmp = int.Parse(buffer.Substring(headPos, nextSymbolEnd - headPos));\n MoveNext();\n return tmp;\n }\n \n public bool HasNext()\n {\n if (headPos != buffer.Length)\n {\n return true;\n }\n \n return false;\n }\n \n private bool MoveNext()\n { \n // Move past the current symbol\n headPos = nextSymbolEnd;\n \n // Move through any whitespace\n while (headPos < buffer.Length && char.IsWhiteSpace(buffer[headPos]))\n {\n headPos += 1;\n }\n \n // Find the end of the current symbol\n nextSymbolEnd = headPos;\n while (nextSymbolEnd < buffer.Length && !char.IsWhiteSpace(buffer[nextSymbolEnd]) && !char.IsControl(buffer[nextSymbolEnd]))\n {\n nextSymbolEnd += 1;\n }\n \n if (headPos == buffer.Length)\n {\n if (ReadIntoBuffer())\n {\n MoveNext();\n }\n else\n {\n return false;\n }\n }\n \n // Console.WriteLine(\"! MoveNext() : h={0} t={1} ss={2}\", headPos, nextSymbolEnd, buffer.Length);\n \n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n if(int.Parse(s[0])>int.Parse(s[1]))\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n int[] arr = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();\n int n1 = arr[0];\n int n2 = arr[1];\n int k1 = arr[2];\n int k2 = arr[3];\n if(n1 > n2)\n Console.WriteLine(\"First\");\n else if (n2 < n1){\n Console.WriteLine(\"Second\");\n }else{\n Console.WriteLine(\"Second\");\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var n1 = data[0];\n var n2 = data[1];\n if (n1 <= n2)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n1, n2, k1, k2;\n string[] s_arr = Console.ReadLine().Split();\n n1 = Convert.ToInt32(s_arr[0]);\n n2 = Convert.ToInt32(s_arr[1]);\n k1 = Convert.ToInt32(s_arr[2]);\n k2 = Convert.ToInt32(s_arr[3]);\n if (n1 > n2)\n {\n Console.WriteLine(\"First\");\n }\n else if (n2 > n1)\n {\n Console.WriteLine(\"Second\");\n }\n else {\n Console.WriteLine(\"Second\");\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n1, n2, k1, k2;\n string[] s_arr = Console.ReadLine().Split();\n n1 = Convert.ToInt32(s_arr[0]);\n n2 = Convert.ToInt32(s_arr[1]);\n k1 = Convert.ToInt32(s_arr[2]);\n k2 = Convert.ToInt32(s_arr[3]);\n if (n1 > n2)\n {\n Console.WriteLine(\"First\");\n }\n else if (n2 > n1)\n {\n Console.WriteLine(\"Second\");\n }\n else {\n Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _513A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n\n int n1 = Convert.ToInt32(str[0]);\n int n2 = Convert.ToInt32(str[1]);\n // int k1 = Convert.ToInt32(str[2]);\n // int k2 = Convert.ToInt32(str[3]);\n\n if (n1 <= n2)\n {\n Console.WriteLine(\"Second\");\n }\n else \n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static int Main(string[] args)\n {\n string inStr = Console.ReadLine();\n string[] inArr = new string[4];\n inArr = inStr.Split(' ');\n int n1, n2, k1, k2;\n n1 = int.Parse(inArr[0]);\n n2 = int.Parse(inArr[1]);\n k1 = int.Parse(inArr[2]);\n k2 = int.Parse(inArr[3]);\n while (n1 > 0 && n2 > 0)\n {\n n1 -= 1;\n n2 -= 1;\n }\n if (n1 > n2) Console.Write(\"First\");\n else Console.Write(\"Second\");\n return 0;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Issue_513A\n{\n class Program\n {\n public static void Main(string[] args) {\n var first = ReadInt();\n var second = ReadInt();\n\n Console.WriteLine(first > second ? \"First\" : \"Second\");\n }\n\n private static bool IsInputError = false;\n private static bool IsEndOfLine = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n IsEndOfLine = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n // if symbol == \\n\n if (symbol == 13) {\n // skip next \\r symbol\n Console.Read();\n IsEndOfLine = true;\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _513A\n{\n\tclass Program\n\t{\n\t\tstatic void Main ( string [ ] args )\n\t\t{\n\t\t\tshort n1, n2;\n\t\t\tstring[] nums = Console.ReadLine().Split( ' ' );\n\t\t\tn1 = short.Parse( nums[ 0 ] );\n\t\t\tn2 = short.Parse( nums[ 1 ] );\n\t\t\twhile ( true )\n\t\t\t{\n\t\t\t\tfor (byte i = 0; i < 2; ++i)\n\t\t\t\t{\n\t\t\t\t\tif ( i == 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tn1 -= 1;\n\t\t\t\t\t\tif ( n1 < 0 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.Write( \"Second\" );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tn2 -= 1;\n\t\t\t\t\t\tif ( n2 < 0 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.Write( \"First\" );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication236\n{\n\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n if (int.Parse(s[0]) > int.Parse(s[1]))\n {\n Console.WriteLine(\"First\");\n }\n else\n {\n Console.WriteLine(\"Second\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF513A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => Int32.Parse(s)).ToList();\n\n Console.WriteLine(input[0] > input[1] ? \"First\" : \"Second\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = 0, n2 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n n1 = int.Parse(s.Substring(0, i));\n s = s.Substring(i + 1);\n break;\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n n2 = int.Parse(s.Substring(0, i));\n break;\n }\n }\n if (n1 > n2)\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem513A {\n class Program {\n static void Main(string[] args) {\n string[] input1 = Console.ReadLine().Split(' ');\n int n1 = Convert.ToInt32(input1[0]);\n int n2 = Convert.ToInt32(input1[1]);\n\n if (n1 > n2) {\n Console.WriteLine(\"First\");\n } else {\n Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0418\u0433\u0440\u0430\n{\n class Program\n { \n static void Main(string[] args)\n {\n var value = Console.ReadLine().Split().Select(int.Parse).ToList();\n if (value[0]>value[1])\n {\n Console.Write(\"First\");\n }\n else Console.Write(\"Second\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n // A Game\n string line = Console.ReadLine();\n string[] lines = line.Split(' ');\n int n1 = int.Parse(lines[0]);\n int n2 = int.Parse(lines[1]);\n int k1 = int.Parse(lines[2]);\n int k2 = int.Parse(lines[3]);\n\n //int result1 = n1 / k1;\n //int result2 = n2 / k2;\n\n //if (n2 == 1 && k2 == 1)\n // Console.Out.WriteLine(\"First\");\n //else\n //{\n if (n2 >= n1)\n Console.Out.WriteLine(\"Second\");\n else\n Console.Out.WriteLine(\"First\");\n //}\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(new char[] { });\n int n1 = int.Parse(line[0]);\n int n2 = int.Parse(line[1]);\n int k1 = int.Parse(line[2]);\n int k2 = int.Parse(line[3]);\n\n if (n1 > n2)\n {\n Console.Write(\"First\");\n\n }\n else\n {\n Console.Write(\"Second\");\n\n\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(new char[] { ' ' });\n int n1 = int.Parse(line[0]);\n int n2 = int.Parse(line[1]);\n int k1 = int.Parse(line[2]);\n int k2 = int.Parse(line[3]);\n\n if (n1 > n2)\n {\n Console.Write(\"First\");\n\n }\n else\n {\n Console.Write(\"Second\");\n\n\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Solution\n{\npublic static void Main(string[] varg)\n{\n string [] line = Console.ReadLine().Split(new char[]{' '});\n int n1 = int.Parse(line[0]);\n int n2 = int.Parse(line[1]);\n int k1 = int.Parse(line[2]);\n int k2 = int.Parse(line[3]);\n if (n1>n2) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n}\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class \u0410\n {\n private static ThreadStart s_threadStart = new \u0410().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n private void Go()\n {\n int n1 = GetInt();\n int n2 = GetInt();\n GetInt();\n GetInt();\n\n Wl(n1 > n2 ? \"First\" : \"Second\");\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n\n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n } \n\n static void Main(string[] args)\n {\n int n1, n2, k1, k2;\n ReadInt(out n1, out n2, out k1, out k2);\n if (n1 <= n2) WL(\"Second\");\n else WL(\"First\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n Console.WriteLine(count[0] <= count[1]?\"Second\":\"Firts\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\n/*\nCombined file with Rokethon 2015\n\n */\nnamespace cf356\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cfrokethon2015A();\n }\n\n\n /*\n https://codeforces.com/problemset/problem/513/A\n */\n public static void solve_cfrokethon2015A()\n {\n int[] nnkk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n Console.WriteLine((nnkk[0] + nnkk[1]) % 2 == 0 || nnkk[0] < nnkk[1] ? \"Second\" : \"First\");\n }\n public static void solve_cf356A()\n {\n List t = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToList();\n\n t.Sort((a, b) => b.CompareTo(a));\n int max = 0;\n int cmax = t[0];\n int cnt = 1;\n int sum = t[0];\n for (int i = 1; i < t.Count; i++)\n {\n sum += t[i];\n if (t[i] != t[i - 1])\n {\n cnt = 1;\n cmax = t[i];\n }\n else\n {\n cnt++;\n cmax += t[i];\n }\n\n if (cnt < 4 && cnt > 1)\n {\n max = Math.Max(max, cmax);\n }\n }\n\n Console.WriteLine(sum - max);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\n/*\nCombined file with Rokethon 2015\n\n */\nnamespace cf356\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cfrokethon2015A();\n }\n\n\n /*\n https://codeforces.com/problemset/problem/513/A\n */\n public static void solve_cfrokethon2015A()\n {\n int[] nnkk = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n Console.WriteLine((nnkk[0] + nnkk[1]) % 2 == 0 ? \"Second\" : \"First\");\n }\n public static void solve_cf356A()\n {\n List t = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).ToList();\n\n t.Sort((a, b) => b.CompareTo(a));\n int max = 0;\n int cmax = t[0];\n int cnt = 1;\n int sum = t[0];\n for (int i = 1; i < t.Count; i++)\n {\n sum += t[i];\n if (t[i] != t[i - 1])\n {\n cnt = 1;\n cmax = t[i];\n }\n else\n {\n cnt++;\n cmax += t[i];\n }\n\n if (cnt < 4 && cnt > 1)\n {\n max = Math.Max(max, cmax);\n }\n }\n\n Console.WriteLine(sum - max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = int.Parse(s.Split(' ')[0]), n2 = int.Parse(s.Split(' ')[1]), k1 = int.Parse(s.Split(' ')[2]), \n k2 = int.Parse(s.Split(' ')[3]);\n int m = Math.Min(k1,k2);\n if (n1 / m > n2 / m) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = int.Parse(s.Split(' ')[0]), n2 = int.Parse(s.Split(' ')[1]), k1 = int.Parse(s.Split(' ')[2]), \n k2 = int.Parse(s.Split(' ')[3]);\n if(n1 == n2)\n {\n if (k1 > k2) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n else\n {\n if (n1 / k1 > n2 / k2) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = int.Parse(s.Split(' ')[0]), n2 = int.Parse(s.Split(' ')[1]), k1 = int.Parse(s.Split(' ')[2]), \n k2 = int.Parse(s.Split(' ')[3]);\n int m = Math.Min(k1,k2);\n if(n1 == n2)\n {\n if (n1 == 1 && n2 == 1) Console.WriteLine(\"Second\");\n else{\n if (n1 % 2 == 1) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n else\n {\n if (n1 / m > n2 / m) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = int.Parse(s.Split(' ')[0]), n2 = int.Parse(s.Split(' ')[1]), k1 = int.Parse(s.Split(' ')[2]), \n k2 = int.Parse(s.Split(' ')[3]);\n int m = Math.Min(k1,k2);\n if(n1 == n2)\n {\n if (n1 % 2 == 0) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n else\n {\n if (n1 / m > n2 / m) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = int.Parse(s.Split(' ')[0]), n2 = int.Parse(s.Split(' ')[1]), k1 = int.Parse(s.Split(' ')[2]), \n k2 = int.Parse(s.Split(' ')[3]);\n int m = Math.Min(k1,k2);\n if(n1 == n2)\n {\n if (k1 > k2) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n else\n {\n if (n1 / m > n2 / m) Console.WriteLine(\"First\");\n else Console.WriteLine(\"Second\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class test\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int[] x=new int [4];\n int j=0,mu=0;\n for (int i = 0; i < s.Length; ++i)\n {\n if (s[i] != ' ')\n {\n mu *= 10 + s[i] - '0';\n }\n else\n {\n x[j] = mu;\n ++j;\n mu = 0;\n }\n \n }\n if (x[0] == x[1])\n Console.WriteLine(\"Second\");\n else if (x[0] > x[1])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class test\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int[] x=new int [111];\n int j=0;\n for (int i = 0; i < s.Length-1; ++i)\n {\n if (s[i] != ' ')\n {\n x[j] = s[i] - '0';\n ++j;\n }\n if (s[i]!=' ' && s[i + 1] != ' ')\n {\n x[j]=s[i+1]-'0';\n x[j - 1] *= 10 + x[j];\n ++j;\n }\n }\n if (x[0] == x[1])\n Console.WriteLine(\"Second\");\n else if (x[0] > x[1])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int max = int.Parse(str[0]);\n\n for (int i = 0; i < str.Length; i++)\n { \n str[0] = int.Parse(str[0]) - 1 + \"\";\n if (str[0] == \"0\" && str[1] != \"0\")\n {Console.WriteLine(\"Second\"); break; }\n str[1] = int.Parse(str[1]) - 1 + \"\"; \n if(str[1]==\"0\"&&str[0]!=\"0\")\n { Console.WriteLine(\"First\"); break; }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int max = int.Parse(str[0]);\n int ind = 0;\n\n for (int i = 0; i < str.Length ; i++)\n {\n if(int.Parse(str[i])>=max)\n { max = int.Parse(str[i]); ind = i; }\n }\n if(ind == 0)\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n\n } \n }\n}"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace Rockethon\n{\n class Program\n {\n static void Main()\n {\n byte n1, n2, k1, k2;\n string[] buffer = Console.ReadLine().Split(' ');\n n1 = Convert.ToByte(buffer[0]);\n n2 = Convert.ToByte(buffer[1]);\n k1 = Convert.ToByte(buffer[2]);\n k2 = Convert.ToByte(buffer[3]);\n if (n1 <= n2)\n Console.WriteLine(\"SECOND\");\n else\n Console.WriteLine(\"FIRST\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace MemoryFrozen\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n\n int n1 = Convert.ToInt32(line[0]);\n int n2 = Convert.ToInt32(line[1]);\n\n if (n1 > n2)\n {\n Console.WriteLine(\"First\");\n }\n else if (n1 < n2)\n {\n Console.WriteLine(\"Second\");\n }\n else if (n1 % 2 == 0)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n \n class Program\n {\n static void Main(string[] args)\n {\n int [] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int Kper = mas[0], Kvtor = mas[1], xod1 = mas[2], xod2 = mas[3];\n for (; ; )\n {\n Kper--;\n if (Kvtor == 0)\n {\n Console.Write(\"Frist\");\n break;\n }\n Kvtor--;\n if (Kper == 0) \n {\n Console.Write(\"Second\");\n break;\n }\n }\n Console.ReadLine ();\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n return double.Parse(ReadNextToken());\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n1, n2, k1, k2;\n int result;\n\n public void Solve()\n {\n n1 = ioHelper.ReadNextInt();\n n2 = ioHelper.ReadNextInt();\n k1 = ioHelper.ReadNextInt();\n k2 = ioHelper.ReadNextInt();\n\n int result1 = (n1 + k1 - 1) / k1;\n if (n1 % k1 == 0)\n result1 = n1 / k1;\n int result2 = (n2 + k2 - 1) / k2;\n if (n2 % k2 == 0)\n result2 = n2 / k2;\n\n bool first = result1 <= result2;\n\n if (first)\n ioHelper.WriteLine(\"First\");\n else\n ioHelper.WriteLine(\"Second\");\n\n ioHelper.Flush();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Globalization;\n\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar m=Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n\t\tConsole.WriteLine(m[2]>m[3] ?\"First\":\"Second\");\n\t}\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Globalization;\n\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar m=Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n\t\tConsole.WriteLine(m[2]>=m[3] ?\"First\":\"Second\");\n\t}\n}\n\n\n\n"}, {"source_code": "using System;\n\nnamespace Number513A {\n class Program {\n static void Main(string[] args) {\n var mas = Console.ReadLine().Split(' ');\n Int32 n1 = Int32.Parse(mas[0]);\n Int32 n2 = Int32.Parse(mas[1]);\n Int32 k1 = Int32.Parse(mas[2]);\n Int32 k2 = Int32.Parse(mas[3]);\n if(n1 > n2) {\n Console.WriteLine(\"First\");\n return;\n }\n if(n1 < n2) {\n Console.WriteLine(\"Second\");\n return;\n }\n if(k1 <= k2) {\n Console.WriteLine(\"Second\");\n return;\n }\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s = Console.ReadLine();\n\n if (s[s.Length - 7] > s[s.Length - 5])\n Console.WriteLine(\"First\");\n else\n Console.WriteLine(\"Second\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _513A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n\n int n1 = Convert.ToInt32(str[0]);\n int n2 = Convert.ToInt32(str[1]);\n // int k1 = Convert.ToInt32(str[2]);\n // int k2 = Convert.ToInt32(str[3]);\n\n if (n1 == n2)\n {\n Console.WriteLine(\"Second\");\n }\n else\n {\n Console.WriteLine(\"First\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication15\n{\n class Program\n {\n static int Main(string[] args)\n {\n string inStr = Console.ReadLine();\n string[] inArr = new string[4];\n inArr = inStr.Split(' ');\n int n1, n2, k1, k2;\n n1 = int.Parse(inArr[0]);\n n2 = int.Parse(inArr[1]);\n k1 = int.Parse(inArr[2]);\n k2 = int.Parse(inArr[3]);\n while (n1 > 0 && n2 > 0)\n {\n n1 -= Math.Min(k1, n1);\n n2 -= Math.Min(k1, n1);\n }\n if (n1 > n2) Console.Write(\"First\");\n else Console.Write(\"Second\");\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var data = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n\n if (data[0] > data[1])\n {\n Console.WriteLine(\"First\");\n }\n else if (data[0] == data[1])\n {\n if (data[2] > data[3])\n {\n Console.WriteLine(\"First\");\n }\n else\n {\n Console.WriteLine(\"Second\");\n }\n }\n else\n {\n Console.WriteLine(\"Second\");\n }\n\n }\n \n }\n} \n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] x = Console.ReadLine().Split();\n int[] numbers=new int[4];\n for (int i = 0; i < x.Length; i++)\n numbers[i] = Convert.ToInt32(x[i]);\n Console.WriteLine(numbers[3]/numbers[1] > numbers[2]/numbers[0] ? \"Second\" : \"First\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n1 = 0, n2 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n n1 = int.Parse(s.Substring(0, i));\n s = s.Substring(i + 1);\n break;\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n n2 = int.Parse(s.Substring(0, i));\n break;\n }\n }\n if (n1 < n2)\n Console.WriteLine(\"Second\");\n else\n Console.WriteLine(\"First\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n // A Game\n string line = Console.ReadLine();\n string[] lines = line.Split(' ');\n int n1 = int.Parse(lines[0]);\n int n2 = int.Parse(lines[1]);\n int k1 = int.Parse(lines[2]);\n int k2 = int.Parse(lines[3]);\n\n int result1 = n1 / k1;\n int result2 = n2 / k2;\n\n if (result1 <= result2)\n Console.Out.WriteLine(\"First\");\n else\n Console.Out.WriteLine(\"Second\");\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n // A Game\n string line = Console.ReadLine();\n string[] lines = line.Split(' ');\n int n1 = int.Parse(lines[0]);\n int n2 = int.Parse(lines[1]);\n int k1 = int.Parse(lines[2]);\n int k2 = int.Parse(lines[3]);\n\n int result1 = n1 / k1;\n int result2 = n2 / k2;\n\n if (n2 == 1 && k2 == 1)\n Console.Out.WriteLine(\"First\");\n else\n {\n if (result1 > result2)\n Console.Out.WriteLine(\"Second\");\n else\n Console.Out.WriteLine(\"First\");\n }\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n var ar = Console.ReadLine().Split();\n Console.WriteLine(int.Parse(ar[0]) > int.Parse(ar[1]) ? \"Second\" : \"First\");\n }\n}\n\n"}, {"source_code": "//The first line contains four integers n1,\u2009n2,\u2009k1,\u2009k2. All numbers in the input are //from 1 to 50.\nusing System;\npublic class Solution\n{\npublic static void Main(string[] varg)\n{\n string [] line = Console.ReadLine().Split(new char[]{' '});\n int n1 = int.Parse(line[0]);\n int n2 = int.Parse(line[1]);\n int k1 = int.Parse(line[2]);\n int k2 = int.Parse(line[3]);\n if (n1>n2) Console.WriteLine(\"first\");\n else Console.WriteLine(\"second\");\n}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Data.Sql;\nusing System.Collections;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int f = x[0] / x[2];\n int s = x[1] / x[3];\n\n if(x[0] > x[1])\n \n Console.WriteLine(s (this string inInput, char inSeparator = ' ')\n {\n if (!typeof(T).IsArray)\n {\n return (T)Convert.ChangeType(inInput, typeof(T));\n }\n\n var inputList = inInput.Split(inSeparator);\n var elementType = typeof(T).GetElementType();\n\n var array = Array.CreateInstance(elementType, inputList.Length);\n for (var i = 0; i < array.Length; i++)\n {\n array.SetValue(Convert.ChangeType(inputList[i], elementType), i);\n }\n\n\n return (T)(object)array;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n var firstCard = Console.ReadLine();\n var hand = Console.ReadLine().GetInputs();\n Console.WriteLine(hand.Any(card => card[0] == firstCard[0] || card[1] == firstCard[1]) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1097A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string cart = Console.ReadLine();\n string hands = Console.ReadLine();\n string[] carthand = hands.Split(' ');\n int kolvo = carthand.Length;\n bool m=false;\n for (int i = 0; i < kolvo; i++)\n {\n if ((carthand[i][0] == cart[0])||(carthand[i][1] == cart[1]))\n {\n m = true;\n }\n }\n if (m) { Console.WriteLine(\"YES\"); } else { Console.WriteLine(\"NO\");}\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string t = Console.ReadLine();\n string s = Console.ReadLine();\n string[] h = s.Split(' ');\n int count = 0;\n\n for(int i=0;i<=4;i++)\n {\n if (t.Substring(0, 1) == h[i].Substring(0, 1) || t.Substring(1, 1) == h[i].Substring(1, 1))\n count++;\n }\n if (count >= 1)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n sealed class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var ss = Console.ReadLine();\n Console.WriteLine(ss.Contains(s[0].ToString()) || ss.Contains(s[1].ToString()) ? \"YES\" : \"NO\");\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar card = Console.ReadLine();\n\t\t\tvar cards = Console.ReadLine().Split(' ');\n\t\t\tfor (int i = 0; i < cards.Length; i++)\n\t\t\t{\n\t\t\t\tif (cards[i][0] == card[0] || cards[i][1] == card[1])\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t}\n\n\t}\n\n\n}\n"}, {"source_code": "using System;\n\nnamespace CF_1097A_GennadyAndACardGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n var cardOnTheTable = Console.ReadLine();\n var cardsInHand = (Console.ReadLine()).Split(' ');\n\n var possible = false;\n \n for(var i = 0; i < 5; i++)\n {\n if(cardsInHand[i][0] == cardOnTheTable[0] || cardsInHand[i][1] == cardOnTheTable[1])\n {\n possible = true;\n break; \n }\n }\n\n if(possible)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _1097A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] str1 = new string[6];\n string[] input = (Console.ReadLine()).Split();\n for (int i = 0; i < 5; i++)\n {\n str1[i] = (input[i]);\n }\n int temp = 0;\n for(int j=0;j<5;j++)\n {\n string st = str1[j];\n \n if (str[0] == st[0] || str[1]==st[1])\n temp = 1;\n if (temp == 1)\n break;\n }\n if (temp == 1)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace codeforce_1097A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string str1 = Console.ReadLine();\n\n string str2 = Console.ReadLine();\n\n if (str2.Contains(str1[1])||str2.Contains(str1[0]))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DevskillProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n var str = s2.Split(\" \");\n bool flag = false;\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i].Contains(s1[0]) || str[i].Contains(s1[1]))\n { \n flag = true; \n }\n }\n if (flag)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 i;\n string ans=\"NO\", sInput;\n string fInput=Console.ReadLine();\n\n sInput = Console.ReadLine();\n\n if ((fInput[0] == sInput[0]) || (fInput[0] == sInput[3]) || (fInput[0] == sInput[6]) || (fInput[0] == sInput[9]) || (fInput[0] == sInput[12]))\n {\n ans = \"YES\";\n }\n\n if ((fInput[1] == sInput[1]) || (fInput[1] == sInput[4]) || (fInput[1] == sInput[7]) || (fInput[1] == sInput[10]) || (fInput[1] == sInput[13]))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string onTable = Console.ReadLine();\n string[] cards = Console.ReadLine().Split();\n bool flag = false;\n foreach(var card in cards)\n {\n if(card[0] == onTable[0] || card[1] == onTable[1])\n {\n flag = true;\n break;\n }\n }\n Console.WriteLine(flag ? \"YES\" : \"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0413\u0435\u043d\u043d\u0430\u0434\u0438\u0439_\u0438_\u043a\u0430\u0440\u0442\u043e\u0447\u043d\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string card = Console.ReadLine();\n string[] sleeve = Console.ReadLine().Split(' ');\n\n string res = \"NO\";\n\n for (int i = 0; i < sleeve.Length; i++)\n {\n if (card[0] == sleeve[i][0])\n {\n res = \"YES\";\n break;\n }\n if (card[1] == sleeve[i][1])\n {\n res = \"YES\";\n break;\n }\n }\n\n Console.WriteLine(res); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var l = Console.ReadLine().Split();\n for (var i = 0; i < l.Length; i++)\n {\n if (l[i][0] == s[0] || l[i][1] == s[1])\n {\n Console.WriteLine(\"YES\");\n //Console.ReadKey();\n return;\n } \n }\n\n Console.WriteLine(\"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace Contest\n{\n class Scanner\n {\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next()\n {\n if (line.Length <= index)\n {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public ulong NextUlong()\n {\n return ulong.Parse(Next());\n }\n\n public string[] Array()\n {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray()\n {\n var array = Array();\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n public long[] LongArray()\n {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n }\n\n class Program\n {\n private string card;\n private string[] myCard;\n void Scan()\n {\n var sc = new Scanner();\n card = sc.Next();\n myCard = sc.Array();\n }\n\n public void Solve()\n {\n Scan();\n foreach (var s in myCard)\n {\n if (card[0] == s[0] || card[1] == s[1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n Console.WriteLine(\"NO\");\n }\n\n\n\n static void Main() => new Program().Solve();\n }\n\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace DevskillProblemSolving\n{\n class Program\n {\n static void Main(string[] args)\n {\n string cardOnTable = Console.ReadLine();\n List cardOnHand = Console.ReadLine().Split(' ').ToList();\n\n bool canPlay = false;\n\n foreach (var card in cardOnHand)\n {\n if (card[0].ToString().Equals(cardOnTable[0].ToString()) || card[1].ToString().Equals(cardOnTable[1].ToString()))\n {\n canPlay = true;\n break;\n }\n }\n\n if(canPlay)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace TestConsole\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var tableCard = Console.ReadLine();\n var handCards = Console.ReadLine().Split(' ');\n\n var result = handCards.Count(c => c[0] == tableCard[0] || c[1] == tableCard[1]) > 0;\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var s = input.ReadLine();\n for (var i = 0; i < 5; i++)\n {\n var a = input.ReadToken();\n if (s[0] == a[0] || s[1] == a[1])\n {\n Console.Write(\"YES\");\n return;\n }\n }\n Console.Write(\"NO\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static void AddCount(Dictionary counter, T item)\n {\n if (counter.TryGetValue(item, out var count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n return counter.TryGetValue(item, out var count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n var t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] cards = Console.ReadLine().Split(' ');\n bool canplay = false;\n for(int i=0;i a == b).TakeWhile(c => c).Count();\n if (count != 0)\n {\n count1++;\n }\n\n }\n u = (from Match m in Regex.Matches(five[0], @\".{1,\" + chunkSize + \"}\")\n select m.Value).ToList();\n \n for (int i = 0; i <= 4; i++)\n {\n u = (from Match m in Regex.Matches(five[i], @\".{1,\" + chunkSize + \"}\")\n select m.Value).ToList();\n count = u[1].Zip(k[1], (a, b) => a == b).TakeWhile(c => c).Count();\n if(count!=0)\n {\n count1++;\n }\n \n }\n\n //n = Int64.Parse(Console.ReadLine());\n if (count1 == 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gennady_and_a_Card_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string arr = Console.ReadLine();\n char[] input1 = input.ToCharArray();\n char[] arr1 = arr.ToCharArray();\n bool p = true;\n for (int i = 0; i < input1.Length; i++)\n {\n for (int i1 = 0; i1 < arr1.Length; i1++)\n {\n if (input1[i] == arr1[i1])\n {\n p = false;\n }\n }\n }\n if (p == false)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Func r = () => Console.ReadLine();\n string a = r(), s = r();\n Console.WriteLine(s.IndexOf(a[0]) >= 0 | s.IndexOf(a[1]) >= 0 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace GennadyAndACardGame\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\t\t\tstring s2 = Console.ReadLine();\n\t\t\tstring[] s1 = s2.Split(' ');\n\t\t\tint leng = s1.Length;\n\t\t\tstring ans = \"NO\";\n\t\t\tfor (int i = 0; i < leng; i++)\n\t\t\t{\n\t\t\t\tif (s[0] == s1[i][0] || s[1] == s1[i][1])\n\t\t\t\t{\n\t\t\t\t\tans = \"YES\";\n\t\t\t\t\ti = leng;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _200501_GennadyAndACardGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n string table = Console.ReadLine();\n string[] hand = Console.ReadLine().Split(' ');\n\n for (int i = 0; i < hand.Length; i++)\n {\n\n if (hand[i].Contains(table[0].ToString()) || hand[i].Contains(table[1].ToString()))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n\n Console.WriteLine(\"NO\");\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n string table = Console.ReadLine();\n string[] hand = Console.ReadLine().Split();\n string ans = \"NO\";\n for (int i = 0; i < 5; i++) {\n if (hand[i][0] == table[0] || (hand[i][1] == table[1]))\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n } \n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Xml.Serialization;\n\nnamespace Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n string tableCard = Console.ReadLine();\n string[] myCards = Console.ReadLine().Split(' ');\n\n foreach(string s in myCards)\n {\n if (s[0] == tableCard[0] || s[1] == tableCard[1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing static System.Console;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string s = ReadLine();\n string[] a = ReadLine().Split(' ');\n\n\n WriteLine(card(s, a) ? \"YES\" : \"NO\");\n Read();\n }\n\n private static bool card(string s, string[] a)\n {\n for (int i = 0; i < 5; i++)\n {\n if (s[0] == a[i][0] || s[1] == a[i][1])\n {\n return true;\n }\n }\n\n\n return false;\n }\n\n\n }\n}\n"}, {"source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n string onTheTable = Console.ReadLine();\n char[] onTT = new char[2];\n onTT[0] = Convert.ToChar(onTheTable.Substring(0, 1));\n onTT[1] = Convert.ToChar(onTheTable.Substring(1, 1));\n\n string[] inYourHand = Console.ReadLine().Split(' ');\n char[][] inYH = new char[5][];\n \n for (int i = 0; i < 5; i++) {\n inYH[i] = new char[2];\n inYH[i][0] = Convert.ToChar(inYourHand[i].Substring(0, 1));\n inYH[i][1] = Convert.ToChar(inYourHand[i].Substring(1, 1));\n }\n bool YorN = false;\n foreach (char[] c in inYH) {\n if (onTT[0] == c[0] || onTT[1] == c[1]) {\n YorN = true;\n Console.WriteLine(\"Yes\");\n break;\n }\n }\n if (YorN == false) {\n Console.WriteLine(\"No\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSPlayground\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = \"\";\n input = Console.ReadLine();\n string hand = \"\";\n hand = Console.ReadLine();\n\n if (hand.Contains(input[0]) || hand.Contains(input[1]))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication38\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] m = Console.ReadLine().Split();\n for (int i = 0; i < m.Length; ++i)\n {\n if (s[0] == m[i][0] || s[1] == m[i][1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace SortApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string first = str[0].ToString();\n string second = str[1].ToString();\n string word = Console.ReadLine();\n int f = 0;\n int s = 0;\n for(int i = 0; i < word.Length; i=i+3)\n {\n if (first == word[i].ToString())\n {\n f = 1;\n }\n\n }\n for (int i = 1; i < word.Length; i = i + 3)\n {\n if (second == word[i].ToString())\n {\n s = 1;\n }\n\n }\n if(s==1 || f == 1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n\n\n //Console.WriteLine();\n Console.Read();\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Gennady_and_a_Card_Game\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args) ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve(string[] args)\n {\n string n = reader.ReadLine();\n string k = reader.ReadLine();\n\n return k.Contains(n[0]) || k.Contains(n[1]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string card = Console.ReadLine();\n string[] hand = Console.ReadLine().Split(' ');\n bool check = false;\n for (int i = 0; i <= 4; i++)\n if (hand[i][0] == card[0] || hand[i][1] == card[1])\n {\n Console.WriteLine(\"YES\");\n check = true;\n break;\n }\n if (check == false)\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1097A_GennadyAndACardGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n string result = \"NO\";\n var input = Console.ReadLine().ToCharArray();\n string[] tokens = Console.ReadLine().Split();\n for(int i = 0; i< tokens.Length; i++)\n {\n if (tokens[i][0].Equals(input[0]) || tokens[i][1].Equals(input[1]))\n {\n result = \"YES\";\n break;\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Program\n{\n public static void Main() {\n string s = Console.ReadLine();\n \n string[] h = Console.ReadLine().Split();\n \n for(int i = 0; i <5; i++){\n if(s[0] == h[i][0] || s[1] == h[i][1]){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n \n \n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var card = input;\n\n input = Console.ReadLine();\n var setCard = input.Split();\n\n var isCan = false;\n for (int i = 0; i < setCard.Length; i++)\n {\n if (setCard[i][0] == card[0] || setCard[i][1] == card[1])\n {\n isCan = true;\n break;\n }\n }\n\n if (isCan)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\npublic class Test\n{\n\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\tstring[] array = Array.ConvertAll(Console.ReadLine().Split(' '), a => a.ToString());\n\t\tList cardslist = new List(array);\n\t\tstring sonuc = \"NO\";\n\t\tfor (int i = 0; i < array.Length; i++)\n\t\t{\n\t\t\tif (cardslist[i].Contains(str[0]) || cardslist[i].Contains(str[1]))\n\t\t\t{\n\t\t\t\tsonuc = \"YES\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(sonuc);\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n {\n\n static void Main(string[] args)\n {\n\n String tkarta = Console.ReadLine();\n String mykarts = Console.ReadLine();\n\n \n if (mykarts.Contains( Convert.ToString(tkarta[0])) || mykarts.Contains( Convert.ToString(tkarta[1])))\n {\n Console.WriteLine(\"YES\");\n }else{ Console.WriteLine(\"NO\"); }\n \n\n \n\n Console.ReadLine();\n }\n\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] str1 = Console.ReadLine().Split();\n bool flag = false;\n for (int i = 0; i < str1.Length; i++)\n {\n string p = str1[i];\n if ((str[0] == p[0]) || (str[0] == p[1]) || (str[1] == p[0]) || (str[1] == p[1]))\n flag = true;\n }\n if(flag)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp27\n\n{\n\n class Program\n\n {\n\n static void Main(string[] args)\n\n {\n String n = Console.ReadLine();\n\n String b = Console.ReadLine();\n\n\n for (int i = 0; i <14; i += 3)\n {\n if (b[i] == n[0])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n }\n\n for (int i = 1; i < 14; i+=3)\n {\n if(b[i]==n[1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n\n }\n\n\n Console.WriteLine(\"NO\");\n\n\n }\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpTuto\n{\n class Program\n {\n static void Main()\n {\n string table_card = Console.ReadLine();\n char[] table_card_char = table_card.ToCharArray();\n string[] cards_in_hand = Console.ReadLine().Split(' ');\n bool can_play = false;\n char[] result = null;\n foreach (string card in cards_in_hand)\n {\n char[] hand_card = card.ToCharArray();\n result = hand_card.Intersect(table_card_char).ToArray();\n if (result.Length != 0)\n {\n can_play = true;\n break;\n } \n }\n if(can_play)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n\n string s2 = Console.ReadLine();\n\n string[] str = s2.Split(' ').ToArray();\n\n bool f = false;\n for( int i=0; i< str.Length; i++)\n {\n if (str[i].Contains(s1[0]) || str[i].Contains(s1[1]))\n { f = true; break; }\n\n }\n\n if (f)\n Console.WriteLine(\"YES\");\n else \n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n \nnamespace Issue\n{\n public static class Program\n {\n public static void Main(string[] args) {\n\t\t\tconst int cards_count = 5;\n\n\t\t\tvar table_card = IO.ReadLine();\n\t\t\tvar hand_cards = IO.ReadLine();\n\n\t\t\tvar canHaveATurn = IsMatch(table_card, hand_cards, 0)\n\t\t\t\t\t\t\t|| IsMatch(table_card, hand_cards, 3)\n\t\t\t\t\t\t\t|| IsMatch(table_card, hand_cards, 6)\n\t\t\t\t\t\t\t|| IsMatch(table_card, hand_cards, 9)\n\t\t\t\t\t\t\t|| IsMatch(table_card, hand_cards, 12);\n\n\t\t\tConsole.WriteLine(canHaveATurn ? \"YES\" : \"NO\");\n }\n\n\t\tprivate static bool IsMatch(string table_card, string cards, int index) {\n\t\t\treturn table_card[0] == cards[index] || table_card[1] == cards[index + 1];\n\t\t}\n }\n \n public static class IO {\n public const int ZeroCode = (int) '0';\n \n static IO() {\n Reader = new StreamReader(\n Console.OpenStandardInput(),\n System.Text.Encoding.ASCII,\n false, \n sizeof(int),\n false);\n }\n \n public static StreamReader Reader { \n get; set;\n }\n \n public static string ReadLine() {\n return Reader.ReadLine();\n }\n \n public static int Read() {\n var reader = Reader;\n var symbol = reader.Read();\n \n while (symbol == ' ') {\n symbol = reader.Read();\n }\n \n var isNegative = false;\n if (symbol == '-') {\n isNegative = true;\n symbol = reader.Read();\n }\n \n int result = 0;\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = reader.Read()\n ) {\n var digit = symbol - ZeroCode;\n \n if (digit < 10 && digit >= 0) {\n result = (result << 1) + ((result << 1) << 2) + digit;\n } else {\n if (symbol == 13) // if symbol == \\n\n reader.Read(); // skip next \\r symbol\n break;\n }\n }\n \n return isNegative ? ~result + 1 : result;\n }\n }\n \n public static class Sort {\n public static void Heapsort(this T[] array, bool isReversed = false)\n where T : IComparable\n {\n Func comparer;\n \n if (isReversed) \n comparer = Extensions.Min;\n else \n comparer = Extensions.Max;\n \n // create Heap from unordered array\n BuildHeap(array, comparer);\n \n // sort\n for (var i = array.Length - 1; i >= 0; --i)\n {\n Swap(ref array[0], ref array[i]);\n FloatUp(array, 0, i, comparer);\n }\n }\n \n private static void BuildHeap(T[] array, Func comparer)\n where T : IComparable\n {\n var size = array.Length;\n var last_index = size - 1;\n \n for (var i = (last_index - 1) / 2; i >= 0; --i)\n {\n FloatUp(array, i, size, comparer);\n }\n }\n \n private static void FloatUp(T[] array, int index, int size, Func comparer)\n where T : IComparable\n {\n var left_node_index = 2 * (index + 1) - 1;\n var right_node_index = 2 * (index + 1);\n \n if (left_node_index >= size)\n {\n return;\n }\n \n var largest = comparer(array, left_node_index, index);\n \n if (right_node_index < size)\n {\n largest = comparer(array, right_node_index, largest);\n }\n \n if (largest != index)\n {\n Swap(ref array[index], ref array[largest]);\n FloatUp(array, largest, size, comparer);\n }\n }\n \n private static void Swap(ref T a, ref T b)\n {\n T temp = a;\n a = b;\n b = temp;\n }\n }\n \n public static class Extensions {\n public static int Max(this T[] array, int firstIndex, int secondIndex)\n where T : IComparable\n {\n return (array[firstIndex].CompareTo(array[secondIndex]) > 0)\n ? firstIndex\n : secondIndex;\n }\n \n public static int Min(this T[] array, int firstIndex, int secondIndex)\n where T : IComparable\n {\n return (array[firstIndex].CompareTo(array[secondIndex]) <= 0)\n ? firstIndex\n : secondIndex;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string inTable = Console.ReadLine();\n string hands = Console.ReadLine();\n bool can = false;\n\n string[] inHands = hands.Split(' ');\n \n for (int i = 0; i < inHands.Length;i++)\n {\n if(can) break;\n for (int j = 0; j < 2;j++)\n {\n if (inHands[i][j] == inTable[0] || inHands[i][j] == inTable[1])\n {\n can = true;\n }\n }\n \n }\n \n Console.WriteLine(can ? \"YES\" : \"NO\");\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n \nnamespace CodeForces\n{\n\n class Parser {\n\n public static int ReadIntFromStdin() {\n int prev = ' '; int res = 0;\n int symb = Console.Read();\n while ((symb < '0') || (symb > '9')) {\n prev = symb;\n symb = Console.Read();\n }\n while ((symb >= '0') && (symb <= '9')) {\n res = 10 * res + symb - '0';\n symb = Console.Read();\n }\n if (prev == '-') { return -res; }\n else { return res; }\n }\n\n public static List ReadIntsFromStdin(int n) {\n List res = new List(); int cnt = 0;\n while(cnt < n) {\n res.Add(ReadIntFromStdin());\n cnt++;\n }\n return res;\n }\n\n public static int ConvertStringToInt(string str) {\n int res = 0; int start = 0; int sign = 1;\n if (str[0] == '-') { start = 1; sign = -1;}\n for (int i = start; i < str.Length; i++) {\n res = 10 * res + sign * (str[i] - '0');\n }\n return res;\n }\n\n public static List SplitStringBasedOnDelim(string str, char delim) {\n List res = new List(); string buf = \"\";\n for (int i = 0; i < str.Length; i++) {\n if (str[i] != delim) { buf = buf + str[i]; }\n else { if (buf != \"\") { res.Add(buf); buf = \"\"; } }\n }\n if (buf != \"\") { res.Add(buf); }\n return res;\n }\n\n }\n\n class Vertex {\n\n public int name;\n public int value;\n public int _in;\n public int _out;\n public List descendants;\n\n public Vertex(int name, int value) {\n this.name = name;\n this.value = value;\n this._in = 0;\n this._out = 0;\n this.descendants = new List();\n }\n\n private bool isInDescendants(Vertex v) {\n bool flag = false;\n foreach (Vertex i in descendants) {\n if (i.name == v.name) { flag = true; break; }\n }\n return flag;\n }\n\n public void AddDescendant(Vertex v) {\n if (! isInDescendants(v)) {\n descendants.Add(v);\n }\n }\n\n }\n\n class Edge {\n public Edge() {\n\n }\n }\n\n class Graph {\n\n private Vertex root;\n private List vertices;\n\n public Graph() {\n root = null;\n vertices = new List();\n }\n\n public void AddVertex(Vertex v) {\n\n }\n\n public void PrintRoot() {\n System.Console.WriteLine(\"{0}\", root.name);\n }\n\n public void PrintAllVertices() {\n foreach (Vertex v in vertices) {\n System.Console.WriteLine(\"{0}\", v.name);\n }\n }\n\n }\n\n class BinaryHeap {\n\n private Vertex[] heap;\n\n public BinaryHeap(int n) {\n this.heap = new Vertex[n+1];\n }\n\n public void PrintHeap() {\n foreach (Vertex v in heap) {\n System.Console.WriteLine(\"{0}\", v.name);\n }\n }\n\n }\n\n class Program {\n static void Main(string[] args) {\n string t = System.Console.ReadLine();\n List ml = Parser.SplitStringBasedOnDelim(\n System.Console.ReadLine(), ' ');\n bool flag = false;\n foreach (string s in ml) {\n if (s[0] == t[0] || s[1] == t[1]) {\n flag = true;\n break;\n }\n }\n if (flag == true) {\n System.Console.WriteLine(\"YES\");\n }\n else {\n System.Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n string main = Console.ReadLine();\n string hand = Console.ReadLine();\n\n Console.WriteLine((hand.Contains(main[0].ToString()) || hand.Contains(main[1].ToString())) ? \"YES\" : \"NO\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string maincard = Console.ReadLine();\n string othercards = Console.ReadLine();\n bool yes = false;\n for (int i = 0; i < 14; i++)\n {\n if (othercards[i] == 32)\n {\n\n }\n else if (i % 3 == 0)\n {\n if (othercards[i] == maincard[0])\n {\n Console.WriteLine(\"YES\");\n yes = true;\n break;\n }\n\n }\n else if ((i % 3)-1 == 0) {\n if (true)\n {\n if (othercards[i] == maincard[1])\n {\n Console.WriteLine(\"YES\");\n yes = true;\n break;\n }\n }\n \n }\n }\n\n if (yes == false)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Algorithms01\n{\n class Program\n {\n static void Main(string[] args)\n {\n ParseSolveWrite();\n }\n\n public static void ParseSolveWrite()\n {\n var (cardOnDeck, cardsInHand) = Parse();\n var result = Solve(cardOnDeck, cardsInHand);\n Write(result);\n }\n\n private static (Card, List) Parse()\n {\n var input = Console.ReadLine();\n var cardOnDeck = new Card\n {\n Rank = input.Substring(0, 1),\n Suit = input.Substring(1, 1)\n };\n input = Console.ReadLine();\n var cardsInHand = input\n .Split(new char[] { ' ' })\n .Select((value) =>\n new Card\n {\n Rank = value.Substring(0, 1),\n Suit = value.Substring(1, 1)\n }\n )\n .ToList();\n return (cardOnDeck, cardsInHand);\n }\n\n private static string Solve(Card cardOnDeck, List cardsInHand)\n {\n foreach (var card in cardsInHand)\n {\n if (isSameRank(card, cardOnDeck) || isBiggerSameSuit(card, cardOnDeck))\n return \"YES\";\n }\n return \"NO\";\n }\n\n private static bool isBiggerSameSuit(Card card, Card cardOnDeck)\n {\n return card.Suit == cardOnDeck.Suit;\n }\n\n private static bool isSameRank(Card card, Card cardOnDeck)\n {\n return card.Rank == cardOnDeck.Rank;\n }\n\n private static void Write(string result)\n {\n Console.WriteLine(result);\n }\n\n class Card\n {\n public string Rank { get; set; }\n\n public string Suit { get; set; }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Gennady_and_a_Card_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string cardOnTable = Console.ReadLine();\n string[] cardsOnHand = Console.ReadLine().Split();\n\n bool flag = false;\n foreach (string card in cardsOnHand)\n {\n if ((card[0] == cardOnTable[0]) || card[1] == cardOnTable[1])\n {\n Console.WriteLine(\"YES\");\n flag = true;\n break;\n }\n }\n\n if (flag == false)\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforce1097A\n{\n static void Main()\n {\n string k = Console.ReadLine();\n string s = Console.ReadLine();\n for(int i=0; i Convert.ToInt32(n)).ToList();\n\n if (ha.Contains(ta[0]) || ha.Contains(ta[1]))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n\n // Console.Write($\"{a.ToString()} {b.ToString()} {c.ToString()}\");\n\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace CF_1097A_GennadyAndACardGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n var cardOnTheTable = Console.ReadLine();\n var cardsInHand = (Console.ReadLine()).Split(' ');\n\n var possible = false;\n \n for(var i = 0; i < 5; i++)\n {\n if(cardsInHand[i][0] == cardOnTheTable[0] || cardsInHand[i][1] == cardOnTheTable[0])\n {\n possible = true;\n break; \n }\n }\n\n if(possible)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0413\u0435\u043d\u043d\u0430\u0434\u0438\u0439_\u0438_\u043a\u0430\u0440\u0442\u043e\u0447\u043d\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string card = Console.ReadLine();\n string[] sleeve = Console.ReadLine().Split(' ');\n\n string res = \"NO\";\n\n for (int i = 0; i < sleeve.Length; i++)\n {\n if (card[0] == sleeve[i][0])\n {\n res = \"YES\";\n break;\n }\n if (card[1] == sleeve[i][0])\n {\n res = \"YES\";\n break;\n }\n }\n\n Console.WriteLine(res); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n char r = Console.ReadLine()[0];\n char[] cards = Console.ReadLine().Split().Select(x => x[0]).ToArray();\n Console.WriteLine(cards.Contains(r) ? \"YES\" : \"NO\");\n }\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n //List input = Console.ReadLine().Split().Select(int.Parse).ToList();\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "using System;\n\nnamespace NetCore\n{\n class Program\n {\n static void Main(string[] args)\n {\n string pattern = Console.ReadLine();\n string[] values = Console.ReadLine().Split(' ');\n foreach(string value in values)\n {\n if(value[0] == pattern[0] || value[1] == pattern[1] || (value[0] == 'A' || value[0] == 'K') && (pattern[0] == 'A' || pattern[0] == 'K'))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Problem_Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n string handCard = Console.ReadLine();\n bool isPrinted = false;\n\n string tableCard = Console.ReadLine();\n string[] tableCards = tableCard.Split(' ');\n\n for (int i=0; i<5;i++)\n {\n tableCard = tableCards[i];\n if(handCard[1] == tableCard[1])\n {\n Console.WriteLine(\"YES\");\n isPrinted = true;\n break;\n }\n }\n\n if(!isPrinted)\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Gennady_and_a_Card_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n string cardOnTable = Console.ReadLine();\n string[] cardsOnHand = Console.ReadLine().Split();\n\n bool flag = false;\n foreach (string card in cardsOnHand)\n {\n if ((card[0] == cardOnTable[0]) || card[1] == cardOnTable[1])\n {\n Console.WriteLine(\"YES\");\n flag = true;\n }\n }\n\n if (flag == false)\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n\n var t = Console.ReadLine();\n\n var deck = Console.ReadLine().Split(' ');\n\n\n foreach(var s in deck)\n if(s.Contains(t[0]) || s.Contains(t[1]))\n Console.WriteLine(\"YES\");\n\n Console.WriteLine(\"NO\");\n\n\n }\n\n\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n\n var t = Console.ReadLine();\n\n var deck = Console.ReadLine().Split(' ');\n\n\n bool yes = false;\n foreach(var s in deck)\n if(s.Contains(t[0]) || s.Contains(t[1]))\n {\n Console.WriteLine(\"YES\");\n yes = true;\n }\n\n if(!yes)\n Console.WriteLine(\"NO\");\n\n\n }\n\n\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s=Console.ReadLine();\n string s1 = Console.ReadLine();\n int n = 5;\n bool p=false;\n for (int i = 0; i < s1.Length; i++)\n if ((s1[i] == s[0]) || (s1[i] == s[1]))\n { Console.WriteLine(\"YES\"); p = true; }\n if (!p) Console.WriteLine(\"NO\");\n }\n }\n}\n"}], "src_uid": "699444eb6366ad12bc77e7ac2602d74b"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace uni\n{\n class Program\n {\n public bool equal(int in1,int in2)\n {\n if (in1==in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n\n public bool greater(int in1, int in2)\n {\n if (in1 > in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n public bool smaller(int in1, int in2)\n {\n if (in1 < in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n static void Main(string[] args)\n {\n Program n = new Program();\n int x;\n x=Convert.ToInt32(Console.ReadLine());\n List nums=new List();\n List st = new List ();\n string y = Console.ReadLine();\n string[] temp = y.Split();\n for (int i=0;i lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n else if (array[i] < lastNumber)\n {\n isMediumBlock = false;\n isLastBlock = true;\n }\n }\n else if(isLastBlock)\n {\n if (array[i] > lastNumber || array[i] == lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n }\n lastNumber = array[i];\n }\n if (isUnimodal)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest1UnimodalArrayA00817810\n{\n class Program\n {\n static void Main(string[] args)\n {\n string stringInput = Console.ReadLine();\n int arrayLength = int.Parse(stringInput);\n\n stringInput = Console.ReadLine();\n string[] inputs = stringInput.Split(' ');\n int[] array = new int[arrayLength];\n for (int i = 0; i < arrayLength; i++)\n {\n\n array[i] = int.Parse(inputs[i]);\n }\n\n\n bool isFirstBlock = true;\n bool isMediumBlock = false;\n bool isLastBlock = false;\n bool isUnimodal = true;\n int lastNumber = array[0];\n\n for (int i = 1; i < arrayLength; i++)\n {\n if (isFirstBlock)\n {\n if (array[i] < lastNumber)\n {\n isFirstBlock = false;\n isLastBlock = true;\n }\n else if (array[i] == lastNumber)\n {\n isFirstBlock = false;\n isMediumBlock = true;\n }\n }\n else if (isMediumBlock)\n {\n if (array[i] > lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n else if (array[i] < lastNumber)\n {\n isMediumBlock = false;\n isLastBlock = true;\n }\n }\n else if (isLastBlock)\n {\n if (array[i] > lastNumber || array[i] == lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n }\n lastNumber = array[i];\n }\n if (isUnimodal)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KeyRaces\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string str = Console.ReadLine();\n long n = Convert.ToInt64(str);\n string str2 = Console.ReadLine();\n string[] sttr = str2.Split(' ');\n List a = new List();\n foreach (var item in sttr)\n {\n a.Add(Convert.ToInt64(item));\n }\n \n \n\n\n int i = 0;\n while (i < n - 1 && a[i] < a[i + 1]) i++;\n while (i < n - 1 && a[i] == a[i + 1]) i++;\n while (i < n - 1 && a[i] > a[i + 1]) i++;\n if (i == n - 1) { Console.WriteLine(\"YES\"); }\n else { Console.WriteLine(\"NO\"); }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace archivess1488\n{\n class MainClass\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string nubms = Console.ReadLine();\n string[] num;\n int[] numbers = new int[n];\n num = nubms.Split(' ');\n for (int i = 0; i < n; i++)\n numbers[i] = int.Parse(num[i]);\n bool down = false, constant = false, up = false;\n if (n < 3) constant = true;\n else\n {\n\t\t\t\tif (numbers[0] < numbers[1]) up = true;\n\t\t\t\telse up = false;\n for (int i = 1; i < numbers.Length; i++)\n {\n if (!constant)\n {\n if (numbers[i] > numbers[i-1] && up && i==numbers.Length-1) constant = true;\n if (numbers[i] > numbers[i - 1] && !up) break;\n if (numbers[i] == numbers[i - 1]) constant = true;\n if (numbers[i] < numbers[i - 1]) { constant = true; down = true; }\n }\n else if (constant && !down)\n {\n if (numbers[i] > numbers[i - 1]) { constant = false; break; }\n if (numbers[i] < numbers[i - 1] && !down) down = true;\n }\n else if (constant && down)\n {\n if (numbers[i] > numbers[i - 1]) { constant = false; break; }\n if (numbers[i] == numbers[i - 1]) { constant = false; break; }\n }\n }\n }\n if (constant == false) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace OlympicAAAAA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n byte q = 0;\n int curr = 0;\n for(int i = 0; i < n; i++)\n {\n switch(q)\n {\n case 0:\n if (int.Parse(s[i]) < curr) q = 2;\n else if (int.Parse(s[i]) == curr) q = 1;\n break;\n case 1:\n if (int.Parse(s[i]) > curr)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (int.Parse(s[i]) < curr) q = 2;\n break;\n case 2:\n if(int.Parse(s[i]) >= curr)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n break;\n }\n curr = int.Parse(s[i]);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n //using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n {\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")) {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var n = sr.NextInt32();\n var array = sr.ReadArrayOfInt32();\n if (n == 1) {\n sw.WriteLine(\"YES\");\n return;\n }\n for (var i = 0; i < array.Length; i++) {\n for (var j = i; j < array.Length; j++) {\n var can = true;\n for (var k = 1; k <= i; k++) {\n if (array[k] <= array[k - 1]) {\n can = false;\n break;\n }\n }\n for (var k = i; k <= j; k++) {\n if (array[k] != array[i]) {\n can = false;\n break;\n }\n }\n for (var k = j + 1; k < array.Length; k++) {\n if (array[k] >= array[k - 1]) {\n can = false;\n break;\n }\n }\n if (can) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n sw.WriteLine(\"NO\");\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n string[] linea = Console.ReadLine().Split();\n bool bajando = false;\n bool constante = false;\n int cons = -1;\n bool res = true;\n for (int i = 0; i < linea.Length - 1; i++)\n {\n int a = int.Parse(linea[i].ToString());\n int b = int.Parse(linea[i + 1].ToString());\n \n if (!bajando)\n {\n if (a == b)\n {\n constante = true;\n bajando = true;\n cons = a;\n }\n if (b < a)\n {\n bajando = true;\n }\n }\n if (bajando)\n {\n if (constante)\n {\n if (b != cons)\n {\n constante = false;\n if (b >= a)\n {\n res = false;\n break;\n }\n }\n }\n else \n {\n if (b >= a)\n {\n res = false;\n break;\n }\n }\n \n \n }\n }\n if (res)\n {\n Console.WriteLine(\"YES\");\n }\n else \n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FORexam\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n int[] arr = new int[n];\n for (int k = 0; k < n; k++)\n {\n arr[k] = Convert.ToInt32(input[k]);\n }\n int i = 1;\n while (i < n && arr[i - 1] < arr[i] && i < n)\n {\n i++;\n }\n while(i < n && arr[i-1] == arr[i] && i < n)\n {\n i++;\n }\n\n\n while (i < n && arr[i - 1] > arr[i])\n {\n i++;\n }\n if (i - 1 == n - 1)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.ReadKey();\n int n; string result = \"\";\n int a = 0, b = 0, c = 0;\n n = int.Parse(Console.ReadLine());\n \n var inputIntArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n == 1) { result = \"YES\"; Console.WriteLine(result); return; }\n\n for (int i = 0; i < n - 1; i++)\n {\n\n if (inputIntArray[i] < inputIntArray[i + 1])\n {\n if (b == 0 && c == 0) { a++; }\n else { Console.WriteLine(\"NO\"); return; }\n }\n else if (inputIntArray[i] == inputIntArray[i + 1])\n {\n if (c == 0) { b++; }\n else { Console.WriteLine(\"NO\"); return; }\n }\n else { c++; }\n\n\n\n\n\n }\n Console.WriteLine(\"YES\");\n\n\n\n\n\n\n\n\n // Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Problem831A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToArray();\n\n Console.WriteLine(Check(a) ? \"YES\" : \"NO\");\n }\n\n static bool Check(int[] a)\n {\n int le = -1;\n int l = a.Length;\n int i = 0;\n if (l == 1)\n return true;\n\n while (i < l && a[i] > le)\n {\n le = a[i];\n i++;\n }\n if (i == l && a[l - 1] > a[l - 2])\n return true;\n\n if (a[i] == le)\n {\n while (i < l && a[i] == le)\n {\n le = a[i];\n i++;\n }\n\n if (i == l && a[l - 1] == a[l - 2])\n return true;\n }\n le = a[i - 1];\n while (i < l && a[i] < le)\n {\n le = a[i];\n i++;\n }\n\n if (i != l)\n return false;\n\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_UnimodalArray\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tvar numbers = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n\t\t\tint i = 0;\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] > numbers[i])\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] == numbers[i])\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] < numbers[i])\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tConsole.WriteLine(i == numbers.Length - 1 ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n\n int firstArray = int.Parse(firstLine);\n string[] secondArray = secondLine.Split(' ');\n\n int[] values = Array.ConvertAll(secondArray, int.Parse);\n\n int constStart = 0;\n int constEnd = values.Length - 1;\n\n int index = 0;\n while (index + 2 < values.Length && values[index] < values[index + 1])\n {\n index++;\n }\n //index++;\n constStart = index;\n\n index = constEnd;\n\n while (index > 0 && values[index] < values[index - 1])\n {\n index--;\n }\n //index--;\n constEnd = index;\n\n bool isModal = true;\n\n\n for (int i = constStart; i < constEnd; i++)\n {\n if (constEnd - constStart == 1)\n break;\n if (values[i] != values[i + 1])\n {\n isModal = false;\n break;\n }\n\n }\n\n\n\n if (isModal)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Round424A\n{\n class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n {\n // using (var sr = new InputReader(new StreamReader(\"input.txt\"))) {\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")){\n\n task.Solve(sr, sw);\n //Console.ReadKey();\n\n }\n }\n }\n }\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n int n = sr.NextInt32();\n int[] arr = sr.ReadArrayOfInt32();\n int segment = 0;\n for(int i=0; i arr[i] && (segment == 1|| segment == 2))\n { sw.WriteLine(\"NO\"); return; }\n\n }\n sw.WriteLine(\"YES\");\n\n\n }\n }\n internal class InputReader : IDisposable\n {\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace ConsoleApplication1A\n{\n class ProgramAAA\n {\n\n static void Main()\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n string[] tk = Console.ReadLine().Split(' ');\n int[] M = new int[n];\n for (var i = 0; i < n; i++)\n M[i] = Convert.ToInt32(tk[i]);\n\n string res = \"NO\";\n for (var i = 0; i < n; i++)\n {\n for (var j = i; j < n; j++)\n {\n string tmp = \"YES\";\n \n for (var k = i; k <=j; k++)\n if (M[i]!=M[k]) tmp = \"NO\";\n \n for (var k = 1; k <=i-1; k++)\n if (M[k-1]>=M[k]) tmp = \"NO\";\n if (i-1>=0) if (M[i-1] >= M[i]) tmp = \"NO\";\n\n for (var k = j+1; k < n; k++)\n if (M[k-1] <= M[k]) tmp = \"NO\";\n if (j+1= M[j]) tmp = \"NO\";\n\n if (tmp == \"YES\") res = \"YES\";\n }\n }\n \n Console.WriteLine(res);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace TestApplication2\n{\n class Program\n {\n private static ComparingResults GetCompRes(int number1, int number2)\n {\n if (number1 < number2)\n {\n return ComparingResults.Greater;\n }\n if (number1 == number2)\n {\n return ComparingResults.Equal;\n }\n else\n {\n return ComparingResults.Lesser;\n }\n }\n\n enum ComparingResults { Greater, Equal, Lesser };\n static void Main(string[] args)\n {\n int arraySize = int.Parse(Console.ReadLine());\n int[] array = new int[arraySize];\n string initializaString = Console.ReadLine();\n\n\n string[] numbers = initializaString.Split(' ');\n\n for (int i = 0; i < arraySize; i++)\n {\n array[i] = int.Parse(numbers[i]);\n }\n \n if (arraySize == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n ComparingResults prev = GetCompRes(array[0], array[1]);\n ComparingResults next = prev;\n\n for (int i = 1; i < arraySize - 1; i++)\n {\n next = GetCompRes(array[i], array[i + 1]);\n if (\n (prev == ComparingResults.Equal && next == ComparingResults.Greater) ||\n prev == ComparingResults.Lesser && (next == ComparingResults.Greater || next == ComparingResults.Equal))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n prev = next;\n }\n\n Console.WriteLine(\"YES\");\n return;\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _4032\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node : IComparable\n {\n public long X { get; set; }\n public long Y { get; set; }\n public int CompareTo(object obj)\n {\n if (this.Y > ((Node)obj).Y)\n {\n return 1;\n }\n if (this.Y == ((Node)obj).Y)\n {\n return 0;\n }\n return -1;\n }\n }\n public static string ReverseString(string s)\n {\n char[] arr = s.ToCharArray();\n Array.Reverse(arr);\n return new string(arr);\n }\n static void Main(String[] args)\n {\n var n = int.Parse(Console.ReadLine().TrimEnd());\n var step = 0;\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(int.Parse).ToList();\n for (var i = 1; i < n; i++)\n {\n if (step == 0)\n {\n if (data[i] > data[i - 1])\n {\n continue;\n }\n else if (data[i] == data[i - 1])\n {\n step = 1;\n continue;\n }\n else if (data[i] < data[i - 1])\n {\n step = 2;\n continue;\n }\n }\n if (step == 1)\n {\n if (data[i] == data[i - 1])\n {\n continue;\n }\n else if (data[i] < data[i - 1])\n {\n step = 2;\n continue;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (step == 2)\n {\n if (data[i] < data[i - 1])\n {\n continue;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n \n\n //Console.WriteLine(-1);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System.Windows;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nusing System;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public int c;\n public string val;\n public PairVariable()\n {\n a = b = 0;\n c = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n c = 0;\n }\n public PairVariable(int a, int b, string x)\n {\n this.a = a;\n this.b = b;\n val = x;\n c = 0;\n }\n\n public PairVariable(int a, int b, int c)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n if (this.a > other.a)\n {\n return 1;\n }\n else if (this.a < other.a)\n {\n return -1;\n }\n else\n {\n if (this.b > other.b)\n {\n return 1;\n }\n else if (this.b < other.b)\n {\n return -1;\n }\n else\n {\n if (this.c > other.c)\n {\n return 1;\n }\n else if (this.c < other.c)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n\n }\n }\n\n\n }\n}\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n\n\n static bool isPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n static long factorial(int a)\n {\n long s = 1;\n for (long i = 1; i <= a; i++)\n {\n s *= i;\n }\n return s;\n }\n\n\n static void Main(string[] args)\n {\n\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n \n int a = 0;\n int b = 0;\n int c = 0;\n string[] s = Console.ReadLine().Split();\n int[] arr = new int[n];\n if (n == 1)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(s[i]);\n }\n string q = \"\";\n \n for (int i = 0; i < n-1; i++)\n {\n if (arr[i] < arr[i + 1])\n {\n q += 1;\n }\n else if (arr[i] == arr[i + 1])\n {\n q += 2;\n }\n else\n {\n q += 3;\n }\n }\n for (int i = 0; i < q.Length - 1; i++)\n {\n if ((q[i] == '2' && q[i + 1] == '1') || (q[i] == '3' && q[i + 1] == '1') || (q[i] == '3' && q[i + 1] == '2'))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n \n }\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\n//831A. \u0423\u043d\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\n\nnamespace CodeForces\n{\n\n class Program\n {\n bool Down(int n, int v)\n {\n while (n-- != 0)\n {\n int w = cin.gi();\n if (w >= v) return false;\n v = w;\n }\n return true;\n }\n\n bool Flat(int n, int v)\n {\n while (n-- != 0)\n {\n int w = cin.gi();\n if (w > v) return false;\n if (w < v) return Down(n, w);\n v = w;\n }\n return true;\n }\n\n bool Up(int n, int v)\n {\n while (n-- != 0)\n {\n int w = cin.gi();\n if (w == v) return Flat(n, w);\n if (w < v) return Down(n, w);\n v = w;\n }\n return true;\n }\n\n private void solve()\n {\n Console.WriteLine(Up(cin.gi(), 0) ? \"YeS\" : \"nO\");\n }\n\n static void Main()\n {\n Program app = new Program();\n app.solve();\n#if DEBUG\n Console.ReadKey(true);\n#endif\n }\n }\n\n //class Parser\n //{\n // Regex re = new Regex(@\"(? where T : IComparable\n {\n private List data;\n\n public PriorityQueue()\n {\n this.data = new List();\n }\n\n public PriorityQueue(int capacity)\n {\n this.data = new List(capacity);\n }\n\n public void Enqueue(T item)\n {\n data.Add(item);\n int ci = data.Count - 1; // child index; start at end\n while (ci > 0)\n {\n int pi = (ci - 1) / 2; // parent index\n if (data[ci].CompareTo(data[pi]) >= 0) break; // child item is larger than (or equal) parent so we're done\n T tmp = data[ci]; data[ci] = data[pi]; data[pi] = tmp;\n ci = pi;\n }\n }\n\n public T Dequeue()\n {\n // assumes pq is not empty; up to calling code\n int li = data.Count - 1; // last index (before removal)\n T frontItem = data[0]; // fetch the front\n data[0] = data[li];\n data.RemoveAt(li);\n\n --li; // last index (after removal)\n int pi = 0; // parent index. start at front of pq\n while (true)\n {\n int ci = pi * 2 + 1; // left child index of parent\n if (ci > li) break; // no children so done\n int rc = ci + 1; // right child\n if (rc <= li && data[rc].CompareTo(data[ci]) < 0) // if there is a rc (ci + 1), and it is smaller than left child, use the rc instead\n ci = rc;\n if (data[pi].CompareTo(data[ci]) <= 0) break; // parent is smaller than (or equal to) smallest child so done\n T tmp = data[pi]; data[pi] = data[ci]; data[ci] = tmp; // swap parent and child\n pi = ci;\n }\n return frontItem;\n }\n\n public T Peek()\n {\n T frontItem = data[0];\n return frontItem;\n }\n\n public int Count()\n {\n return data.Count;\n }\n\n public override string ToString()\n {\n string s = \"\";\n for (int i = 0; i < data.Count; ++i)\n s += data[i].ToString() + \" \";\n s += \"count = \" + data.Count;\n return s;\n }\n\n public bool IsConsistent()\n {\n // is the heap property true for all data?\n if (data.Count == 0) return true;\n int li = data.Count - 1; // last index\n for (int pi = 0; pi < data.Count; ++pi) // each parent index\n {\n int lci = 2 * pi + 1; // left child index\n int rci = 2 * pi + 2; // right child index\n\n if (lci <= li && data[pi].CompareTo(data[lci]) > 0) return false; // if lc exists and it's greater than parent then bad.\n if (rci <= li && data[pi].CompareTo(data[rci]) > 0) return false; // check the right child too.\n }\n return true; // passed all checks\n } // IsConsistent\n } // PriorityQueue\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _424\n{\n class Program\n {\n static void Main(string[] args)\n {\n testA();\n Console.WriteLine();\n }\n static void testA()\n {\n int n = int.Parse(Console.ReadLine());\n int state = 1;\n var ss = Console.ReadLine().Split(' ');\n List li = new List();\n foreach (var i in ss)\n {\n li.Add(int.Parse(i));\n }\n for (int i = 1; i < li.Count; i++)\n {\n int pr = li[i - 1];\n int ic = li[i] - pr;\n if (ic > 0 && state == 1)\n {\n continue;\n }\n if (ic == 0 & state == 1)\n {\n state = 2;\n continue;\n }\n\n if (ic == 0 & state == 2)\n {\n continue;\n }\n if (ic < 0 && state == 2)\n {\n state = 3;\n continue;\n }\n if (ic < 0 && state == 3) {\n continue;\n }\n if (ic < 0 && state == 1) {\n\n state = 3;\n continue;\n }\n Console.Write(\"NO\");\n return;\n }\n Console.Write(\"YES\");\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace UnimodalArray\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool incFinished = false;\n bool constFinished = false;\n\n bool unimodal = true;\n\n int amount = int.Parse(Console.ReadLine());\n int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int prev = array[0];\n\n for(int i=1; i prev && !incFinished)\n {\n prev = array[i];\n continue;\n }\n else if(array[i] == prev && !incFinished)\n {\n prev = array[i];\n incFinished = true;\n }\n else if(array[i] == prev && !constFinished)\n {\n prev = array[i];\n continue;\n }\n else if (array[i] < prev && !incFinished)\n {\n prev = array[i];\n incFinished = true;\n constFinished = true;\n }\n else if(array[i] < prev && incFinished)\n {\n prev = array[i];\n constFinished = true;\n }\n else\n {\n prev = array[i];\n unimodal = false;\n }\n }\n Console.WriteLine(unimodal ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var count = int.Parse(input);\n if (count == 1)\n {\n Console.Write(\"YES\");\n return;\n }\n var array = new int[count];\n input = Console.ReadLine();\n var split = input.Split(new[] { ' ' });\n for (int i = 0; i < count; i++)\n {\n array[i] = int.Parse(split[i]);\n }\n\n var delta = new char[count - 1];\n for (int i = 0; i < count - 1; i++)\n {\n if (array[i] < array[i + 1])\n {\n delta[i] = 'a';\n continue;\n }\n if (array[i] == array[i + 1])\n {\n delta[i] = 'b';\n continue;\n }\n if (array[i] > array[i + 1])\n {\n delta[i] = 'c';\n continue;\n }\n }\n var str = new string(delta).Trim();\n Console.Write(Regex.IsMatch(str, \"^[a]{0,}b+[c]{0,}$\") || Regex.IsMatch(str, \"^[a]{1,}[c]{1,}$\") || Regex.IsMatch(str, \"^[a]{1,}$\") || Regex.IsMatch(str, \"^[c]{1,}$\") ? \"YES\" : \"NO\");\n //Console.Write(string.Join(\"\", delta));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var canGoUp = true;\n var canGoDown = true;\n var canEq = true;\n\n for (var i = 0; i < arr.Length - 1; i++)\n {\n var f = arr[i];\n var s = arr[i + 1];\n\n if (f > s)\n {\n if (!canGoDown)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n canEq = false;\n canGoUp = false;\n }\n\n\n if (f < s)\n {\n if (!canGoUp)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n\n if (f == s)\n {\n if (!canEq)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n canGoUp = false;\n }\n }\n\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n \n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n var pos1 = 0;\n var pos2 = n - 1;\n var i = 1;\n while (i < n)\n {\n if (!(arr[i] > arr[i - 1]))\n break;\n i++;\n }\n pos1 = i-1;\n i = n - 1;\n while (i > 0)\n {\n if (!(arr[i - 1] > arr[i]))\n break;\n i--;\n }\n pos2 = i;\n\n var val = arr[pos1];\n for (int j = pos1; j <= pos2; j++)\n {\n if (arr[j] != val)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n \n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n \n //var r1 = r;\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n"}, {"source_code": " using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] data;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\n', '\\r', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n data = new int[input.Length];\n for (int j = 0; j < data.Length; ++j) data[j] = int.Parse(input[j]);\n }\n \n bool result = true;\n int i = 2;\n while (i < data.Length && data[i] > data[i - 1]) i++;\n while (i blocks[counter - 1])\n counter++;\n while (blocks[counter] == blocks[counter - 1])\n counter++;\n while (blocks[counter] < blocks[counter - 1])\n counter++;\n }\n catch\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n int counter = 1;\n try\n {\n while (blocks[counter] > blocks[counter - 1])\n counter++;\n while (blocks[counter] == blocks[counter - 1])\n counter++;\n while (blocks[counter] < blocks[counter - 1])\n counter++;\n }\n catch\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n \n public void Solve()\n {\n var n = input.ReadInt();\n var a = input.ReadIntArray(n);\n Console.Write(IsUnimodal(a) ? \"YES\" : \"NO\");\n }\n \n private bool IsUnimodal(int[] a)\n {\n int n = a.Length;\n int i = 0;\n while (i < n - 1 && a[i] < a[i + 1])\n i++;\n while (i < n - 1 && a[i] == a[i + 1])\n i++;\n while (i < n - 1 && a[i] > a[i + 1])\n i++;\n return i == n - 1;\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n int[] array;\n\n bool IsUniModal()\n {\n int i = 0;\n int sec = 0;\n\n if (n == 1)\n return true;\n\n for(i=1;i0)\n { sec = 0; }\n\n if(array[i] - array[i-1]<0)\n { sec = 2; break; }\n }\n i++;\n\n if (sec == 0)\n return true;\n\n if (sec == 1)\n {\n for (; i < n; i++)\n {\n if (array[i] - array[i - 1] > 0)\n return false;\n\n if (array[i] - array[i - 1] < 0)\n {\n sec = 2; break;\n }\n }\n i++;\n }\n\n if (sec == 2)\n for (; i < n; i++)\n if (array[i] - array[i - 1] >= 0)\n return false;\n\n return true;\n\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n array = new int[n + 1];\n\n int i;\n\n for (i = 0; i < n; i++)\n array[i] = ioHelper.ReadNextInt();\n\n bool rez = IsUniModal();\n\n if (rez)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static int Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int z = 0;\n int a = 0;\n\n string[] s = Console.ReadLine().Split();\n\n int[] m = Array.ConvertAll(s, int.Parse);\n\n foreach(int x in m)\n {\n if (z == 0)\n {\n if (x == a) z = 1;\n if (x < a)z = 2;\n }\n else if (z == 1)\n {\n if (x > a)\n {\n Console.Write(\"NO\");\n return 0;\n }\n if (x < a) z = 2;\n }\n else\n {\n if (x >= a)\n {\n Console.Write(\"NO\");\n return 0;\n }\n }\n a = x;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Unimodal_Array\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n int index0 = 0;\n for (int i = 1; i < n; i++)\n {\n if (nn[i] <= nn[i - 1])\n break;\n index0 = i;\n }\n\n int index1 = n - 1;\n for (int i = n - 2; i >= 0; i--)\n {\n if (nn[i] <= nn[i + 1])\n break;\n index1 = i;\n }\n\n bool eq = true;\n for (int i = index0 + 1; i <= index1; i++)\n {\n if (nn[i] != nn[i - 1])\n {\n eq = false;\n break;\n }\n }\n\n writer.WriteLine(eq ? \"Yes\" : \"No\");\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace _831A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), constStart = 0, constEnd = 0;\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n bool result = true;\n for (int i = 1; i < n; i++)\n {\n constStart = i - 1;\n constEnd = i;\n if (a[i] <= a[i - 1])\n break;\n }\n for (int i = constStart + 1; i < n; i++)\n if (a[i] == a[i - 1])\n constEnd = i;\n else if (a[i] != a[i - 1])\n {\n break;\n }\n for (int i = constEnd + 1; i < n; i++)\n if (a[i] >= a[i - 1])\n {\n result = false;\n break;\n }\n result = n == 1 || (result && constEnd - constStart > 0);\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var a = ReadLongs();\n var i = 0;\n while (i < n - 1 && a[i] < a[i + 1])\n i++;\n while (i < n - 1 && a[i] == a[i + 1])\n i++;\n while (i < n - 1 && a[i] > a[i + 1])\n i++;\n return i == n - 1 ? \"YES\" : \"NO\";\n\n }\n\n class Vac\n {\n public long Left { get; set; }\n public long Right { get; set; }\n public long Cost { get; set; }\n }\n\n long Fact(long k)\n {\n return k == 1 ? 1 : k * Fact(k - 1);\n }\n long[,] FastPow(long[,] matrix, long n, long x)\n {\n if (x == 1)\n return matrix;\n if (x % 2 == 0)\n return FastPow(Multiply(matrix, matrix, n), n, x / 2);\n return Multiply(FastPow(matrix, n, x - 1), matrix, n);\n }\n\n long[,] Multiply(long[,] x, long[,] y, long n)\n {\n var result = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n result[i, j] += x[i, k] * y[k, j] % commonMod;\n }\n result[i, j] = result[i, j] % commonMod;\n }\n }\n return result;\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n\n int BS(long[] a, int left, int right, long s)\n {\n if (right - left == 1)\n return left;\n var half = (left + right) / 2;\n if (Check(half, a, s))\n return BS(a, half, right, s);\n return BS(a, left, half, s);\n }\n\n bool Check(int k, long[] a, long s)\n {\n var newArr = new long[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n newArr[i] = a[i] + ((long)k) * (i + 1);\n }\n Array.Sort(newArr);\n return newArr.Take(k).Sum() <= s;\n }\n\n double Dist(Point a, Point b, Point z)\n {\n return Math.Abs((b.y - a.y) * z.x - (b.x - a.x) * z.y + b.x * a.y - b.y * a.x) / Math.Sqrt((b.y - a.y) * (b.y - a.y) + (b.x - a.x) * (b.x - a.x));\n }\n\n }\n\n class Point\n {\n public double x { get; set; }\n public double y { get; set; }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest831A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var way = 1;\n Console.ReadLine();\n var previous = -1;\n var unimodelNum = -1;\n var unimodelCount = 0;\n var values = Console.ReadLine().Split(' ');\n for (var i = 0; i < values.Length; i++)\n {\n var current = int.Parse(values[i]);\n if (current > previous)\n {\n if (way == 0 || way == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else if (current == previous)\n {\n if (unimodelNum == -1)\n {\n unimodelNum = current;\n }\n if (way == -1 || current != unimodelNum)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n way = 0;\n unimodelNum = current;\n unimodelCount = 0;\n }\n else if (current < previous)\n {\n if (way == 1 && unimodelCount != 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n way = -1;\n }\n previous = current;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olimp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = Convert.ToInt32(Console.ReadLine());\n int[] arr = new int[length];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < length; i++)\n {\n arr[i] = Convert.ToInt32(s[i]);\n }\n Console.WriteLine(isUnimodal(arr) ? \"YES\" : \"NO\");\n }\n\n static bool isUnimodal(int[] arr)\n {\n bool isInc = true;\n bool isConst = true;\n int i;\n for (i = 0; i < arr.Length-1; i++)\n {\n if (isInc && arr[i + 1] > arr[i])\n continue;\n else\n {\n isInc = false;\n if (isConst && arr[i + 1] == arr[i])\n continue;\n else\n {\n isConst = false;\n if (arr[i + 1] < arr[i])\n continue;\n else break;\n }\n }\n\n }\n if (i == arr.Length-1)\n return true;\n else return false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _831A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int left = 0;\n while (left + 1 < n && a[left] < a[left + 1])\n {\n left++;\n }\n\n int right = n - 1;\n while (right > 0 && a[right] < a[right - 1])\n {\n right--;\n }\n\n for (int i = left; i < right; i++)\n {\n if (a[i] != a[right])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n var answer = Solve(input1, input2);\n Console.WriteLine(answer);\n }\n\n public static string Solve(string input1, string input2)\n {\n var n = int.Parse(input1);\n if (n == 1) return \"YES\";\n var array = input2.Split(' ').Select(c => int.Parse(c)).ToArray();\n\n var previous = array[0];\n var i = 1;\n\n //increase\n for (; i < n; i++)\n {\n if (previous == array[i]) break; //constant began\n if (previous > array[i]) break; //constant of 1 and begin decrease\n previous = array[i];\n }\n\n //constant\n for (; i < n; i++)\n {\n if (array[i] > previous) return \"NO\"; //cannot increase again\n if (previous > array[i]) break; //begin decrease\n }\n\n //decrease\n for (; i < n; i++)\n {\n if (array[i] > previous) return \"NO\";\n if (array[i] == previous) return \"NO\";\n previous = array[i];\n }\n\n return \"YES\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n int N = int.Parse(Console.ReadLine());\n string[] str = Console.ReadLine().Split(' ');\n int[] A = new int[N];\n for(int i=0;i A[i]){\n if(state != 0){\n OK = false;\n break;\n }\n }\n else if(A[i+1] == A[i]){\n if(state == 2){\n OK = false;\n break;\n }\n else{\n state = 1;\n }\n }\n else{\n state = 2;\n }\n }\n if(OK){\n sb.Append(\"YES\\n\");\n }\n else{\n sb.Append(\"NO\\n\");\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n string[] linea = Console.ReadLine().Split();\n bool bajando = false;\n bool res = true;\n for (int i = 0; i < linea.Length - 1; i++)\n {\n int a = int.Parse(linea[i].ToString());\n int b = int.Parse(linea[i + 1].ToString());\n if (!bajando)\n {\n if (b < a)\n {\n bajando = true;\n }\n }\n if (bajando)\n {\n if (b >= a)\n {\n res = false;\n break;\n }\n }\n }\n if (res)\n {\n Console.WriteLine(\"YES\");\n }\n else \n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FORexam\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool ach = true;\n bool stab = false;\n bool nva = false;\n int n = Convert.ToInt32(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n int[] arr = new int[n];\n for (int i = 0; i < n; i++)\n {\n arr[i] = Convert.ToInt32(input[i]);\n }\n\n for (int i = 1; i < n; i++)\n {\n if (arr[i] < arr[i - 1] && ach == true)\n {\n ach = false;\n stab = true;\n }\n else if (arr[i ] != arr[i - 1] && stab == true)\n {\n nva = true;\n stab = false;\n }\n else if (arr[i ] > arr[i - 1] && nva == true)\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_UnimodalArray\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tvar numbers = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n\n\t\t\tif (numbers.Length < 3)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint state = 0;\n\t\t\t\tint old = numbers[0];\n\t\t\t\tfor (int i = 1; i < numbers.Length; ++i)\n\t\t\t\t{\n\t\t\t\t\tif (state == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (numbers[i] < old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}else if (numbers[i] == old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstate = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if (state == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (numbers[i] > old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}else if (numbers[i] < old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstate = 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if (state == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (numbers[i] >= old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\told = numbers[i];\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_UnimodalArray\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tvar numbers = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n\t\t\tint i = 0;\n\t\t\tbool first = false;\n\t\t\tbool second = false;\n\t\t\tbool third = false;\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] > numbers[i])\n\t\t\t{\n\t\t\t\tfirst = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] == numbers[i])\n\t\t\t{\n\t\t\t\tsecond = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] < numbers[i])\n\t\t\t{\n\t\t\t\tthird = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tConsole.WriteLine(first && second && third ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_UnimodalArray\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tvar numbers = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n\t\t\tint i = 0;\n\t\t\tbool second = false;\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] > numbers[i])\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] == numbers[i])\n\t\t\t{\n\t\t\t\tsecond = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile (i < numbers.Length - 1 && numbers[i + 1] < numbers[i])\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tConsole.WriteLine(second && i == numbers.Length - 1 ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_UnimodalArray\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tConsole.ReadLine();\n\t\t\tvar numbers = Console.ReadLine().Split().Select(Int32.Parse).ToArray();\n\n\t\t\tif (numbers.Length < 3)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint state = 0;\n\t\t\t\tint old = numbers[0];\n\n\t\t\t\tint increasing = 0;\n\n\t\t\t\tfor (int i = 1; i < numbers.Length; ++i)\n\t\t\t\t{\n\t\t\t\t\tvar current = numbers[i];\n\t\t\t\t\tif (state == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (current < old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (current == old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstate = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tincreasing ++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if (state == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (current > old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}else if (current < old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstate = 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if (state == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (current >= old)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\told = current;\n\t\t\t\t}\n\n\t\t\t\tConsole.WriteLine(increasing > 0 && state == 2 ? \"YES\" : \"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n\n int firstArray = int.Parse(firstLine);\n string[] secondArray = secondLine.Split(' ');\n\n int[] values = Array.ConvertAll(secondArray, int.Parse);\n\n int constStart = 0;\n int constEnd = values.Length - 1;\n\n int index = 0;\n while (index + 2 < values.Length && values[index] < values[index + 1])\n {\n index++;\n }\n //index++;\n constStart = index;\n\n index = constEnd;\n\n while (index > 0 && values[index] < values[index - 1])\n {\n index--;\n }\n //index--;\n constEnd = index;\n\n bool isModal = true;\n\n\n for (int i = constStart; i < constEnd; i++)\n {\n if (values[i] != values[i + 1])\n {\n isModal = false;\n break;\n }\n\n }\n\n\n\n if (isModal)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n\n int firstArray = int.Parse(firstLine);\n string[] secondArray = secondLine.Split(' ');\n\n int[] values = Array.ConvertAll(secondArray, int.Parse);\n\n int constStart = 0;\n int constEnd = values.Length - 1;\n\n int index = 0;\n while(index+2 < values.Length && values[index] < values[index + 1])\n {\n index++;\n }\n index++;\n constStart = index;\n\n index = constEnd;\n\n while(index > 0 && values[index] < values[index - 1])\n {\n index--;\n }\n index--;\n constEnd = index;\n\n bool isModal = true;\n\n if(constStart == constEnd)\n {\n isModal = false;\n }\n else\n {\n for (int i = constStart; i < constEnd; i++)\n {\n if (values[i] != values[i + 1])\n {\n isModal = false;\n break;\n }\n\n }\n }\n \n\n if (isModal)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n }\n\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n\n int firstArray = int.Parse(firstLine);\n string[] secondArray = secondLine.Split(' ');\n\n int[] values = Array.ConvertAll(secondArray, int.Parse);\n\n int constStart = 0;\n int constEnd = values.Length - 1;\n\n int index = 0;\n while(index+2 < values.Length && values[index] < values[index + 1])\n {\n index++;\n }\n index++;\n constStart = index;\n\n index = constEnd;\n\n while(index > 0 && values[index] < values[index - 1])\n {\n index--;\n }\n //index--;\n constEnd = index;\n\n bool isModal = true;\n\n if(constStart == constEnd)\n {\n isModal = false;\n }\n else\n {\n for (int i = constStart; i < constEnd; i++)\n {\n if (values[i] != values[i + 1])\n {\n isModal = false;\n break;\n }\n\n }\n }\n \n\n if (isModal)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n }\n\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace uni\n{\n class Program\n {\n public bool equal(int in1,int in2)\n {\n if (in1==in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n\n public bool greater(int in1, int in2)\n {\n if (in1 > in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n public bool smaller(int in1, int in2)\n {\n if (in1 < in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n static void Main(string[] args)\n {\n Program n = new Program();\n int x;\n x=Convert.ToInt32(Console.ReadLine());\n List nums=new List();\n List st = new List ();\n string y = Console.ReadLine();\n string[] temp = y.Split();\n for (int i=0;i in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n public bool smaller(int in1, int in2)\n {\n if (in1 < in2)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n static void Main(string[] args)\n {\n Program n = new Program();\n int x;\n x=Convert.ToInt32(Console.ReadLine());\n List nums=new List();\n List st = new List ();\n string y = Console.ReadLine();\n string[] temp = y.Split();\n for (int i=0;i\n{\n public int a, b;\n public int c;\n public string val;\n public PairVariable()\n {\n a = b = 0;\n c = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n c = 0;\n }\n public PairVariable(int a, int b, string x)\n {\n this.a = a;\n this.b = b;\n val = x;\n c = 0;\n }\n\n public PairVariable(int a, int b, int c)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n if (this.a > other.a)\n {\n return 1;\n }\n else if (this.a < other.a)\n {\n return -1;\n }\n else\n {\n if (this.b > other.b)\n {\n return 1;\n }\n else if (this.b < other.b)\n {\n return -1;\n }\n else\n {\n if (this.c > other.c)\n {\n return 1;\n }\n else if (this.c < other.c)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n\n }\n }\n\n\n }\n}\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n\n\n static bool isPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n static long factorial(int a)\n {\n long s = 1;\n for (long i = 1; i <= a; i++)\n {\n s *= i;\n }\n return s;\n }\n\n\n static void Main(string[] args)\n {\n\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n \n int a = 0;\n int b = 0;\n int c = 0;\n string[] s = Console.ReadLine().Split();\n int[] arr = new int[n];\n if (n == 1)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(s[i]);\n }\n string q = \"\";\n \n for (int i = 0; i < n-1; i++)\n {\n if (arr[i] <= arr[i + 1])\n {\n q += 1;\n }\n else\n {\n q += 0;\n }\n }\n if (q[0] == '0')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int p = 0;\n for (int i = 0; i < q.Length; i++)\n {\n if (q[i] == '1')\n {\n p = i;\n \n }\n }\n for (int i = 0; i <= p; i++)\n {\n if (q[i] == '0')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace UnimodalArray\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool incFinished = false;\n bool constFinished = false;\n\n bool unimodal = true;\n\n int amount = int.Parse(Console.ReadLine());\n int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int prev = array[0];\n\n for(int i=1; i prev && !incFinished)\n {\n prev = array[i];\n continue;\n }\n else if(array[i] == prev && !incFinished)\n {\n prev = array[i];\n incFinished = true;\n }\n else if(array[i] == prev && !constFinished)\n {\n prev = array[i];\n continue;\n }\n else if(array[i] < prev && incFinished)\n {\n prev = array[i];\n constFinished = true;\n }\n else\n {\n prev = array[i];\n unimodal = false;\n }\n }\n Console.WriteLine(unimodal ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var count = int.Parse(input);\n if(count == 1)\n {\n Console.Write(\"YES\");\n return;\n }\n var array = new int[count];\n input = Console.ReadLine();\n var split = input.Split(new[] { ' ' });\n for (int i = 0; i < count; i++)\n {\n array[i] = int.Parse(split[i]);\n }\n\n var delta = new char[count - 1];\n for(int i = 0; i < count - 1; i++)\n {\n if (array[i] < array[i + 1])\n {\n delta[i] = 'a';\n continue;\n }\n if (array[i] == array[i + 1])\n {\n delta[i] = 'b';\n continue;\n }\n if (array[i] > array[i + 1])\n {\n delta[i] = 'c';\n continue;\n }\n }\n var str = new string(delta);\n Console.Write(Regex.IsMatch(str, \"^[a]{0,}b+[c]{0,}$\") || Regex.IsMatch(str, \"^[a]{1,}[c]{1,}$\") ? \"YES\" : \"NO\");\n //Console.Write(string.Join(\"\", delta));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var count = int.Parse(input);\n if (count == 1)\n {\n Console.Write(\"YES\");\n return;\n }\n var array = new int[count];\n input = Console.ReadLine();\n var split = input.Split(new[] { ' ' });\n for (int i = 0; i < count; i++)\n {\n array[i] = int.Parse(split[i]);\n }\n\n var delta = new char[count - 1];\n for (int i = 0; i < count - 1; i++)\n {\n if (array[i] < array[i + 1])\n {\n delta[i] = 'a';\n continue;\n }\n if (array[i] == array[i + 1] || (array[i] > array[i - 1] && array[i] > array[i + 1]))\n {\n delta[i] = 'b';\n continue;\n }\n if (array[i] > array[i + 1])\n {\n delta[i] = 'c';\n continue;\n }\n }\n var str = new string(delta).Trim();\n Console.Write(Regex.IsMatch(str, \"^[a]{0,}b+[c]{0,}$\") || Regex.IsMatch(str, \"^[a]{1,}[c]{1,}$\") ? \"YES\" : \"NO\");\n //Console.Write(string.Join(\"\", delta));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var count = int.Parse(input);\n var array = new int[count];\n input = Console.ReadLine();\n var split = input.Split(new[] { ' ' });\n for (int i = 0; i < count; i++)\n {\n array[i] = int.Parse(split[i]);\n }\n\n var delta = new char[count - 1];\n for(int i = 0; i < count - 1; i++)\n {\n if (array[i] < array[i + 1])\n {\n delta[i] = 'a';\n continue;\n }\n if (array[i] == array[i + 1])\n {\n delta[i] = 'b';\n continue;\n }\n if (array[i] > array[i + 1])\n {\n delta[i] = 'c';\n continue;\n }\n }\n var str = new string(delta);\n Console.Write(Regex.IsMatch(str, \"^[a]{0,}b+[c]{0,}$\") || Regex.IsMatch(str, \"^[a]{1,}[c]{1,}$\") ? \"YES\" : \"NO\");\n //Console.Write(string.Join(\"\", delta));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n\n class Program\n {\n public void Solve()\n {\n var n = int.Parse(Console.ReadLine()); \n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n bool incr = false, decr = false, cons = false; \n var curr = arr[0];\n for (int i = 1; i < n; i++)\n {\n if (arr[i] > arr[i - 1])\n {\n incr = true;\n if (decr || cons)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else if (arr[i] < arr[i - 1])\n {\n decr = true;\n if (!cons && incr)\n cons = true;\n if (!cons && !incr)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else if (arr[i] == arr[i - 1] || (i + 1 < n && arr[i] > arr[i - 1] && arr[i] < arr[i + 1]))\n {\n cons = true;\n if (decr)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n }\n } \n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n\n class Program\n {\n public void Solve()\n {\n var n = int.Parse(Console.ReadLine()); \n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n //bool incr = true, decr = false, cons = false; \n bool incrAllTheTime = true;\n bool decrAllTheTime = true;\n for (int i = 1; i < n; i++)\n {\n if (arr[i] >= arr[i - 1])\n continue;\n else\n incrAllTheTime = false;\n }\n\n for (int i = 1; i < n; i++)\n {\n if (arr[i] <= arr[i - 1])\n continue;\n else\n decrAllTheTime = false;\n }\n if(incrAllTheTime || decrAllTheTime)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool incr = false, decr = false;\n for (int i = 1; i < n; i++)\n {\n if (arr[i] > arr[i - 1])\n {\n incr = true;\n if (decr)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n } \n else if(arr[i] < arr[i - 1])\n {\n decr = true;\n if (!incr)\n {\n Console.WriteLine(\"NO\");\n return;\n } \n }\n }\n Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n }\n } \n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if ((double)size / 2.0 % 2 == 0)\n {\n if (blocks[size / 2] != blocks[size / 2 + 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i - 1] != blocks[size / 2 ])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2 + 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2 +1 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if (size == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (size / 2 % 2 != 0)\n {\n if (blocks[size / 2] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i - 1] != blocks[size / 2 ])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2-1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if (size == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (size / 2 % 2 != 0)\n {\n if (blocks[size / 2] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i - 1] != blocks[size / 2 ])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2 + 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2 +1 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n //string[] s = \"527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527\".Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if (size == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if ((double)size / 2.0 % 2.0 == 0)\n {\n if (blocks[size / 2] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[0] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[0] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if (size == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if ((double)size / 2.0 % 2.0 == 0)\n {\n if (blocks[size / 2] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n int[] blocks = new Int32[size];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < size; i++)\n blocks[i] = Convert.ToInt32(s[i]);\n if (size == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if ((double)size / 2.0 % 2.0 == 0)\n {\n if (blocks[size / 2] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < size / 2 - 1; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2 - 1])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size - 1; i > size / 2 ; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i - 1] != blocks[size / 2 ])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n for (int i = 0; i < size / 2; i++)\n if (blocks[i] >= blocks[i + 1] && blocks[i + 1] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n for (int i = size -1; i > size / 2; i--)\n if (blocks[i] >= blocks[i - 1] && blocks[i] != blocks[size / 2])\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n int[] array;\n\n bool IsUniModal()\n {\n int i = 0;\n int sec = 0;\n\n if (n == 1)\n return true;\n\n for(i=2;i0)\n { sec = 0; }\n\n if(array[i] - array[i-1]<0)\n { sec = 2; break; }\n }\n i++;\n\n if (sec == 0)\n return true;\n\n if (sec == 1)\n {\n for (; i < n; i++)\n {\n if (array[i] - array[i - 1] > 0)\n return false;\n\n if (array[i] - array[i - 1] < 0)\n {\n sec = 2; break;\n }\n }\n i++;\n }\n\n if (sec == 2)\n for (; i < n; i++)\n if (array[i] - array[i - 1] >= 0)\n return false;\n\n return true;\n\n }\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n array = new int[n + 1];\n\n int i;\n\n for (i = 0; i < n; i++)\n array[i] = ioHelper.ReadNextInt();\n\n bool rez = IsUniModal();\n\n if (rez)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nnamespace _831A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), constStart = 0, constEnd = 0;\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n bool result = true;\n for (int i = 1; i < n; i++)\n {\n if (a[i] <= a[i - 1])\n {\n constStart = i - 1;\n constEnd = i;\n break;\n }\n }\n for (int i = constStart + 1; i < n; i++)\n if (a[i] == a[i - 1])\n constEnd = i;\n else if (a[i] < a[i - 1])\n {\n break;\n }\n else if (a[i] > a[i - 1])\n {\n result = false;\n break;\n }\n for (int i = constEnd + 1; i < n; i++)\n if (a[i] >= a[i - 1])\n {\n result = false;\n break;\n }\n result = n == 1 || (result && constEnd - constStart > 0);\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n string input2 = Console.ReadLine();\n var answer = Solve(input1, input2);\n Console.WriteLine(answer);\n }\n\n public static string Solve(string input1, string input2)\n {\n var n = int.Parse(input1);\n if (n == 1) return \"YES\";\n var array = input2.Split(' ').Select(c => int.Parse(c)).ToArray();\n\n var previous = array[0];\n var i = 1;\n\n //increase\n for (; i < n; i++)\n {\n if (previous == array[i]) break; //constant began\n if (previous > array[i]) break; //constant of 1 and begin decrease\n previous = array[i];\n }\n\n //constant\n for (; i < n; i++)\n {\n if (array[i] > previous) return \"NO\"; //cannot increase again\n if (previous > array[i]) break; //begin decrease\n }\n\n //decrease\n for (; i < n; i++)\n {\n if (array[i] > previous) return \"NO\";\n if (array[i] == previous) return \"NO\";\n }\n\n return \"YES\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest1UnimodalArrayA00817810\n{\n class Program\n {\n static void Main(string[] args)\n {\n string stringInput = Console.ReadLine();\n int arrayLength = int.Parse(stringInput);\n \n stringInput = Console.ReadLine();\n string[] inputs = stringInput.Split(' ');\n int[] array = new int[arrayLength];\n for (int i = 0; i < arrayLength; i++)\n {\n\n array[i] = int.Parse(inputs[i]);\n }\n\n\n bool isFirstBlock = true;\n bool isMediumBlock = false;\n bool isLastBlock = false;\n bool isUnimodal = true;\n int lastNumber = array[0];\n\n for (int i=1; i< arrayLength; i++)\n {\n if (isFirstBlock)\n {\n if(array[i] < lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }else if(array[i] == lastNumber)\n {\n isFirstBlock = false;\n isMediumBlock = true;\n }\n }else if (isMediumBlock)\n {\n if (array[i] > lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n else if (array[i] < lastNumber)\n {\n isMediumBlock = false;\n isLastBlock = true;\n }\n }\n else if(isLastBlock)\n {\n if (array[i] > lastNumber || array[i] == lastNumber)\n {\n Console.WriteLine(\"NO\");\n isUnimodal = false;\n break;\n }\n }\n lastNumber = array[i];\n }\n if (isUnimodal)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace archivess1488\n{\n class MainClass\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string nubms = Console.ReadLine();\n string[] num;\n int[] numbers = new int[n];\n num = nubms.Split(' ');\n for (int i = 0; i < n; i++)\n numbers[i] = int.Parse(num[i]);\n bool down = false, constant = false, up = false;\n if (n < 3) constant = true;\n else\n {\n\t\t\t\tif (numbers[0] < numbers[1]) up = true;\n\t\t\t\telse up = false;\n for (int i = 1; i < numbers.Length; i++)\n {\n if (!constant)\n {\n if (numbers[i] > numbers[i - 1] && !up) break;\n if (numbers[i] == numbers[i - 1]) constant = true;\n if (numbers[i] < numbers[i - 1]) { constant = true; down = true; }\n }\n else if (constant && !down)\n {\n if (numbers[i] > numbers[i - 1]) { constant = false; break; }\n if (numbers[i] < numbers[i - 1] && !down) down = true;\n }\n else if (constant && down)\n {\n if (numbers[i] > numbers[i - 1]) { constant = false; break; }\n if (numbers[i] == numbers[i - 1]) { constant = false; break; }\n }\n }\n }\n if (constant == false) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}], "src_uid": "5482ed8ad02ac32d28c3888299bf3658"} {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Globalization;\n\nnamespace FertiLib.Contest.C\n{\n\tstatic class Program\n\t{\n\t\tpublic static void Solve(Scanner cin)\n\t\t{\n\t\t\tlong n = cin.ReadLong();\n\t\t\tModInt ans = 1;\n\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tans *= i;\n\t\t\t}\n\t\t\tans -= ModInt.Pow(2, n - 1);\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n\t\t\tConsole.SetOut(sw);\n\t\t\tvar cin = new Scanner();\n\t\t\tSolve(cin);\n\t\t\tConsole.Out.Flush();\n\t\t}\n\n\t\tpublic static void YESNO(bool condition) => Console.WriteLine(condition ? \"YES\" : \"NO\");\n\t\tpublic static void YesNo(bool condition) => Console.WriteLine(condition ? \"Yes\" : \"No\");\n\t\tpublic static void yesno(bool condition) => Console.WriteLine(condition ? \"yes\" : \"no\");\n\t}\n\tpublic struct ModInt : IComparable, IEquatable\n\t{\n\t\tpublic static long MOD = 1000000007;\n\t\tpublic static bool isModPrime { get; set; }\n\n\t\tprivate readonly long num;\n\n\t\tpublic ModInt(long n) { num = n; isModPrime = true; }\n\n\t\tpublic override string ToString() => num.ToString();\n\n\t\tpublic static ModInt operator +(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num + r.num;\n\t\t\tif (x >= MOD) x -= MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator -(ModInt l, ModInt r)\n\t\t{\n\t\t\tlong x = l.num - r.num;\n\t\t\tif (x < 0) x += MOD;\n\t\t\treturn new ModInt(x);\n\t\t}\n\t\tpublic static ModInt operator *(ModInt l, ModInt r) => new ModInt((l.num * r.num) % MOD);\n\t\tpublic static ModInt operator /(ModInt l, ModInt r) => l * r.Inverse();\n\n\t\tpublic static ModInt operator ++(ModInt x)\n\t\t{\n\t\t\tvar tmp = x + new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\t\tpublic static ModInt operator --(ModInt x)\n\t\t{\n\t\t\tvar tmp = x - new ModInt(1);\n\t\t\treturn tmp;\n\t\t}\n\n\t\tpublic static bool operator >(ModInt l, ModInt r) => l.CompareTo(r) > 0;\n\t\tpublic static bool operator <(ModInt l, ModInt r) => l.CompareTo(r) < 0;\n\t\tpublic static bool operator >=(ModInt l, ModInt r) => l.CompareTo(r) >= 0;\n\t\tpublic static bool operator <=(ModInt l, ModInt r) => l.CompareTo(r) <= 0;\n\t\tpublic static bool operator ==(ModInt l, ModInt r) => l.Equals(r);\n\t\tpublic static bool operator !=(ModInt l, ModInt r) => !l.Equals(r);\n\n\t\tpublic static implicit operator long(ModInt x) => x.num;\n\t\tpublic static implicit operator ModInt(long n)\n\t\t{\n\t\t\tn %= MOD;\n\t\t\tif (n < 0) n += MOD;\n\t\t\treturn new ModInt(n);\n\t\t}\n\n\t\tpublic ModInt Inverse() => Inverse(this, MOD);\n\t\tpublic static ModInt Inverse(ModInt x) => Inverse(x.num, MOD);\n\t\tpublic static long Inverse(long x, long m)\n\t\t{\n\t\t\tif (x % m == 0) throw new DivideByZeroException();\n\t\t\tlong a = x, b = m, u = 1, v = 0;\n\t\t\twhile (b > 0)\n\t\t\t{\n\t\t\t\tlong t = a / b;\n\n\t\t\t\ta -= t * b;\n\t\t\t\tlong p = a; a = b; b = p; // swap(a, b);\n\n\t\t\t\tu -= t * v;\n\t\t\t\tp = u; u = v; v = p; // swap(u, v);\n\t\t\t}\n\t\t\tu %= m;\n\t\t\tif (u < 0) u += m;\n\t\t\treturn u;\n\t\t}\n\n\t\tpublic static ModInt Pow(long x, long n)\n\t\t{\n\t\t\tlong now = 1;\n\t\t\tif (isModPrime) n %= MOD - 1;\n\t\t\tfor (; n > 0; n /= 2, x = x * x % MOD)\n\t\t\t{\n\t\t\t\tif (n % 2 == 1) now = now * x % MOD;\n\t\t\t}\n\t\t\treturn new ModInt(now);\n\t\t}\n\n\t\tpublic int CompareTo(ModInt x)\n\t\t{\n\t\t\tif (num == x.num) return 0;\n\t\t\tif (num > x.num) return 1;\n\t\t\treturn -1;\n\t\t}\n\n\t\tpublic bool Equals(ModInt x) => num == x.num;\n\n\t\tpublic override bool Equals(object obj) => obj is ModInt m && num == m.num;\n\t}\n\n\n\tstatic class Util\n\t{\n\t\tpublic static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n\t}\n\n\tclass Printer : StreamWriter\n\t{\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t\tpublic Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }\n\t}\n\n\tclass Scanner\n\t{\n\t\tstring[] s;\n\t\tint i;\n\n\t\tchar[] separator = new char[] { ' ' };\n\n\t\tpublic Scanner()\n\t\t{\n\t\t\ts = new string[0];\n\t\t\ti = 0;\n\t\t}\n\n\t\tpublic string Read() => ReadString();\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tstring st = Console.ReadLine();\n\t\t\twhile (st == \"\") st = Console.ReadLine();\n\t\t\ts = st.Split(separator, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tif (s.Length == 0) return ReadString();\n\t\t\ti = 0;\n\t\t\treturn s[i++];\n\t\t}\n\n\t\tpublic string[] ReadStringArray(int N)\n\t\t{\n\t\t\tstring[] Array = new string[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadString();\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\treturn int.Parse(ReadString());\n\t\t}\n\n\t\tpublic int[] ReadIntArray(int N, int add = 0)\n\t\t{\n\t\t\tint[] Array = new int[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadInt() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\treturn long.Parse(ReadString());\n\t\t}\n\n\t\tpublic long[] ReadLongArray(int N, long add = 0)\n\t\t{\n\t\t\tlong[] Array = new long[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadLong() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\treturn double.Parse(ReadString());\n\t\t}\n\n\t\tpublic double[] ReadDoubleArray(int N, double add = 0)\n\t\t{\n\t\t\tdouble[] Array = new double[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tArray[i] = ReadDouble() + add;\n\t\t\t}\n\t\t\treturn Array;\n\t\t}\n\n\t\tpublic T1 ReadValue() => (T1)Convert.ChangeType(ReadString(), typeof(T1));\n\n\t\tpublic (T1, T2) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(2);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1, T2, T3) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(3);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(4);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(5);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(6);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1, T2, T3, T4, T5, T6, T7) ReadValue()\n\t\t{\n\t\t\tvar inputs = ReadStringArray(7);\n\t\t\tvar v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n\t\t\tvar v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n\t\t\tvar v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n\t\t\tvar v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n\t\t\tvar v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n\t\t\tvar v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n\t\t\tvar v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\n\t\tpublic T1[] ReadValueArray(int N)\n\t\t{\n\t\t\tvar v1 = new T1[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tv1[i] = ReadValue();\n\t\t\t}\n\t\t\treturn v1;\n\t\t}\n\n\t\tpublic (T1[], T2[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2) = (new T1[N], new T2[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t}\n\t\t\treturn (v1, v2);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t}\n\t\t\treturn (v1, v2, v3);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6);\n\t\t}\n\n\t\tpublic (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray(int N)\n\t\t{\n\t\t\tvar (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]);\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tvar (t1, t2, t3, t4, t5, t6, t7) = ReadValue();\n\t\t\t\tv1[i] = t1;\n\t\t\t\tv2[i] = t2;\n\t\t\t\tv3[i] = t3;\n\t\t\t\tv4[i] = t4;\n\t\t\t\tv5[i] = t5;\n\t\t\t\tv6[i] = t6;\n\t\t\t\tv7[i] = t7;\n\t\t\t}\n\t\t\treturn (v1, v2, v3, v4, v5, v6, v7);\n\t\t}\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing CompLib.Mathematics;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n\n // N-\u9806\u5217\n // p_i\u306b\u3064\u3044\u3066\n // j < i p_j > p_i \u3092\u6e80\u305f\u3059\u6700\u5927\u306ej\n // i < j \u6700\u5c0f\u306ej\n // \u306b\u8fba\u3092\u3064\u306a\u3050\n\n // \u9589\u8def\u304c\u3042\u308b\u30b0\u30e9\u30d5\n // \u9806\u5217\u306e\u500b\u6570\n\n ModInt a = 1;\n\n for (int i = 1; i <= N; i++)\n {\n a *= i;\n }\n\n ModInt b = ModInt.Pow(2, N - 1);\n\n Console.WriteLine(a - b);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Mathematics\n{\n #region ModInt\n\n /// \n /// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n /// \n public struct ModInt\n {\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = (int) 1e9 + 7;\n // public const long Mod = 998244353;\n\n /// \n /// \u5b9f\u969b\u306e\u6570\u5024\uff0e\n /// \n public long num;\n\n /// \n /// \u5024\u304c \u3067\u3042\u308b\u3088\u3046\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6301\u3064\u5024\n /// \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u4e0a\uff0c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067\u306f\u5270\u4f59\u3092\u53d6\u308a\u307e\u305b\u3093\uff0e\u305d\u306e\u305f\u3081\uff0c \u2208 [0,) \u3092\u6e80\u305f\u3059\u3088\u3046\u306a \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\uff0e\u3053\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public ModInt(long n)\n {\n num = n;\n }\n\n /// \n /// \u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6570\u5024\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\uff0e\n /// \n /// [0,) \u306e\u7bc4\u56f2\u5185\u306e\u6574\u6570\u3092 10 \u9032\u8868\u8a18\u3057\u305f\u3082\u306e\uff0e\n public override string ToString()\n {\n return num.ToString();\n }\n\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.num += r.num;\n if (l.num >= Mod) l.num -= Mod;\n return l;\n }\n\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.num -= r.num;\n if (l.num < 0) l.num += Mod;\n return l;\n }\n\n public static ModInt operator *(ModInt l, ModInt r)\n {\n return new ModInt(l.num * r.num % Mod);\n }\n\n public static implicit operator ModInt(long n)\n {\n n %= Mod;\n if (n < 0) n += Mod;\n return new ModInt(n);\n }\n\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u3079\u304d\u4e57\u306e\u5e95\n /// \u3079\u304d\u6307\u6570\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static ModInt Pow(ModInt v, long k)\n {\n return Pow(v.num, k);\n }\n\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u3079\u304d\u4e57\u306e\u5e95\n /// \u3079\u304d\u6307\u6570\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static ModInt Pow(long v, long k)\n {\n long ret = 1;\n for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)\n if ((k & 1) == 1)\n ret = ret * v % Mod;\n return new ModInt(ret);\n }\n\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f\u6570\u306e\u9006\u5143\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u9006\u5143\u3092\u53d6\u308b\u5bfe\u8c61\u3068\u306a\u308b\u6570\n /// \u9006\u5143\u3068\u306a\u308b\u3088\u3046\u306a\u5024\n /// \u6cd5\u304c\u7d20\u6570\u3067\u3042\u308b\u3053\u3068\u3092\u4eee\u5b9a\u3057\u3066\uff0c\u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\u306b\u5f93\u3063\u3066\u9006\u5143\u3092 O(log N) \u3067\u8a08\u7b97\u3057\u307e\u3059\uff0e\n public static ModInt Inverse(ModInt v)\n {\n return Pow(v, Mod - 2);\n }\n }\n\n #endregion\n\n #region Binomial Coefficient\n\n public class BinomialCoefficient\n {\n public ModInt[] fact, ifact;\n\n public BinomialCoefficient(int n)\n {\n fact = new ModInt[n + 1];\n ifact = new ModInt[n + 1];\n fact[0] = 1;\n for (int i = 1; i <= n; i++)\n fact[i] = fact[i - 1] * i;\n ifact[n] = ModInt.Inverse(fact[n]);\n for (int i = n - 1; i >= 0; i--)\n ifact[i] = ifact[i + 1] * (i + 1);\n ifact[0] = ifact[1];\n }\n\n public ModInt this[int n, int r]\n {\n get\n {\n if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n return fact[n] * ifact[n - r] * ifact[r];\n }\n }\n\n public ModInt RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return this[n + k - 1, k];\n }\n }\n\n #endregion\n}\n\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces {\n class Program {\n static void Main(string[] args) {\n int T;\n T = int.Parse(Console.ReadLine());\n long res = 1;\n long mod = 1000000007;\n for (int i = 1; i <= T; ++i) {\n res *= i;\n if (res > mod) res %= mod;\n }\n long k2 = 1;\n for (int j = 1; j <= T - 1; ++j) {\n k2 *= 2;\n if (k2 > mod) k2 %= mod;\n }\n res -= k2;\n while (res <= 0) {\n res += mod;\n }\n Console.WriteLine(res);\n return;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces {\n class Program {\n static void Main(string[] args) {\n int T;\n T = int.Parse(Console.ReadLine());\n long res = 1;\n long mod = 1000000007;\n for(int i = 1; i <= T; ++i) {\n res *= i;\n if (res > mod) res %= mod;\n }\n long k2 = 1;\n for(int j = 1; j<= T-1; ++j) {\n k2 *= 2;\n if (k2 > mod) k2 %= mod;\n }\n res -= k2;\n while(res < 0) {\n res += mod;\n }\n Console.WriteLine(res);\n return;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tlong N = int.Parse(Console.ReadLine());\n\t\tlong ans = 1;\n\t\tlong mod = 1000000007;\n\t\tfor(var i=1;i<=N;i++){\n\t\t\tans = ans*i%mod;\n\t\t}\n\t\tlong a2 = 1;\n\t\tfor(var i=1;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n\n\nstruct mlong {\n\t\n\tconst long mod = (long) 1e9 + 7;\n\tlong V;\n\t\n\tpublic mlong(long _v = 0){\n\t\tV = _v;\n\t}\n\t\n\tpublic static mlong operator+(mlong a, mlong b){\n\t\tvar v0 = a.V + b.V; if(v0 >= mod) v0 -= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator-(mlong a, mlong b){\n\t\tvar v0 = mod + a.V - b.V; if(v0 >= mod) v0 -= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator-(mlong b){\n\t\tvar v0 = mod - b.V; if(v0 >= mod) v0 -= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator*(mlong a, mlong b){\n\t\tvar v0 = a.V * b.V; if(v0 >= mod) v0 %= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator/(mlong a, mlong b){\n\t\tvar v0 = a.V * inv(b.V).V; if(v0 >= mod) v0 %= mod;\n\t\treturn new mlong(v0);\n\t}\n\t\n\t\n\tpublic static mlong inv(long x){\n\t\tlong a = 0, b = 0, c = 0;\n\t\tExtGCD(x, mod, ref a, ref b, ref c);\n\t\treturn (mlong)((a + mod) % mod);\n\t}\n\t\n\tpublic static void ExtGCD(long x, long y, ref long a, ref long b, ref long c){\n\t\tlong r0 = x; long r1 = y;\n\t\tlong a0 = 1; long a1 = 0;\n\t\tlong b0 = 0; long b1 = 1;\n\t\tlong q1, r2, a2, b2;\n\t\twhile(r1 > 0){\n\t\t\tq1 = r0 / r1;\n\t\t\tr2 = r0 % r1;\n\t\t\ta2 = a0 - q1 * a1;\n\t\t\tb2 = b0 - q1 * b1;\n\t\t\tr0 = r1; r1 = r2;\n\t\t\ta0 = a1; a1 = a2;\n\t\t\tb0 = b1; b1 = b2;\n\t\t}\n\t\tc = r0;\n\t\ta = a0;\n\t\tb = b0;\n\t}\n\t\n\tpublic static mlong ModPow(mlong a, long k){\n\t\tif(k == 0) return (mlong) 1;\n\t\tif(a == 0) return (mlong) 0;\n\t\tmlong x = a;\n\t\tmlong ret = 1;\n\t\twhile(k > 0){\n\t\t\tif(k % 2 == 1) ret *= x;\n\t\t\tx *= x;\n\t\t\tk >>= 1;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\t\n\tpublic static bool operator == (mlong a, mlong b){\n\t\t return a.Equals(b);\n\t}\n\tpublic static bool operator != (mlong a, mlong b){\n\t\t return !(a == b);\n\t}\n\t\n\tpublic override bool Equals(System.Object obj){\n\t\tif(obj == null) return false;\n\t\tmlong p = (mlong) obj;\n\t\tif((System.Object) p == null) return false;\n\t\treturn p.V == V;\n\t}\n\tpublic override int GetHashCode(){\n\t\treturn V.GetHashCode();\n\t}\n\t\n\tpublic static implicit operator mlong(long n){\n\t\tlong v = n % mod; if(v < 0) v += mod;\n\t\treturn new mlong(v);\n\t}\n\tpublic static implicit operator mlong(int n){\n\t\tlong v = n % mod; if(v < 0) v += mod;\n\t\treturn new mlong(v);\n\t}\n\tpublic static explicit operator long(mlong n){\n\t\treturn n.V;\n\t}\n\t\n\tpublic override String ToString(){\n\t\treturn V.ToString();\n\t}\n\t\n\t\n}"}, {"source_code": "\ufeffnamespace Csharp_Contest\n{\n using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Text;\n using System.Threading;\n using System.Diagnostics;\n\n static class Program\n {\n private const long Mod = (long) (1e9 + 7);\n static void Solve()\n {\n long n = NextLong();\n long factorial = n;\n long power = 1;\n for (long i = 1; i < n; i++)\n {\n factorial = (factorial * i) % Mod;\n power = (power * 2) % Mod;\n }\n\n long ans = factorial - power;\n while (ans < 0)\n {\n ans += Mod;\n }\n\n ans %= Mod;\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args)\n {\n#if CLown1331\n for (int testCase = 0; testCase < 3; testCase++)\n {\n Solve();\n }\n#else\n if (args.Length == 0)\n {\n Console.SetOut(new Printer(Console.OpenStandardOutput()));\n }\n\n Thread t = new Thread(Solve, 134217728);\n t.Start();\n t.Join();\n Console.Out.Flush();\n#endif\n#if CLown1331\n if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);\n#endif\n }\n\n static int NextInt() => int.Parse(Console_.NextString());\n static long NextLong() => long.Parse(Console_.NextString());\n static double NextDouble() => double.Parse(Console_.NextString());\n static string NextString() => Console_.NextString();\n static string NextLine() => Console.ReadLine();\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => xorshift);\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n\n static class Console_\n {\n static Queue param = new Queue();\n public static string NextString()\n {\n if (param.Count == 0)\n {\n foreach (string item in NextLine().Split(' '))\n {\n param.Enqueue(item);\n }\n }\n return param.Dequeue();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int MOD = 1000000007;\n\n public void Solve()\n {\n int n = ReadInt();\n long a = 1, b = 1;\n for (int i = 2; i <= n; i++)\n {\n a = a * i % MOD;\n b = b * 2 % MOD;\n }\n\n Write((a + MOD - b) % MOD);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //new Solver().Solve();\n var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n thread.Start();\n thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class ProblemC\n {\n static bool SAIKI = false;\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var n = NN;\n LIB_Mod ans = 0;\n for (var i = 3; i <= n; i++)\n {\n ans = ans * 2 + LIB_Mod.Perm(i - 1, i - 1) * (i - 2);\n }\n Console.WriteLine(ans);\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static LIB_FastIO fastio = new LIB_FastIODebug();\n static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }\n static long NN => fastio.Long();\n static double ND => fastio.Double();\n static string NS => fastio.Scan();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static IOrderedEnumerable OrderByRand(this IEnumerable x) => Enumerable.OrderBy(x, _ => xorshift);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => Enumerable.OrderBy(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => Enumerable.OrderBy(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);\n static IOrderedEnumerable OrderBy(this IEnumerable x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderBy(this IEnumerable x, Func selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);\n static IOrderedEnumerable OrderByDescending(this IEnumerable x, Func selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);\n static string Join(this IEnumerable x, string separator = \"\") => string.Join(separator, x);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n }\n}\nnamespace Library {\n partial struct LIB_Mod : IEquatable, IEquatable\n {\n static public long _mod = 1000000007; long v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_Mod(long x)\n {\n if (x < _mod && x >= 0) v = x;\n else if ((v = x % _mod) < 0) v += _mod;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator LIB_Mod(long x) => new LIB_Mod(x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public implicit operator long(LIB_Mod x) => x.v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Add(LIB_Mod x) { if ((v += x.v) >= _mod) v -= _mod; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Sub(LIB_Mod x) { if ((v -= x.v) < 0) v += _mod; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Mul(LIB_Mod x) => v = (v * x.v) % _mod;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void Div(LIB_Mod x) => v = (v * Inverse(x.v)) % _mod;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod operator +(LIB_Mod x, LIB_Mod y) { var t = x.v + y.v; return t >= _mod ? new LIB_Mod { v = t - _mod } : new LIB_Mod { v = t }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod operator -(LIB_Mod x, LIB_Mod y) { var t = x.v - y.v; return t < 0 ? new LIB_Mod { v = t + _mod } : new LIB_Mod { v = t }; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod operator *(LIB_Mod x, LIB_Mod y) => x.v * y.v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod operator /(LIB_Mod x, LIB_Mod y) => x.v * Inverse(y.v);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator ==(LIB_Mod x, LIB_Mod y) => x.v == y.v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public bool operator !=(LIB_Mod x, LIB_Mod y) => x.v != y.v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public long Inverse(long x)\n {\n long b = _mod, r = 1, u = 0, t = 0;\n while (b > 0)\n {\n var q = x / b;\n t = u;\n u = r - q * u;\n r = t;\n t = b;\n b = x - q * b;\n x = t;\n }\n return r < 0 ? r + _mod : r;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(LIB_Mod x) => v == x.v;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Equals(long x) => v == x;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override bool Equals(object x) => x == null ? false : Equals((LIB_Mod)x);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override int GetHashCode() => v.GetHashCode();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string ToString() => v.ToString();\n static List _fact = new List() { 1 };\n static long _factm = _mod;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static void B(long n)\n {\n if (_factm != _mod) _fact = new List() { 1 };\n if (n >= _fact.Count)\n for (int i = _fact.Count; i <= n; ++i)\n _fact.Add(_fact[i - 1] * i);\n _factm = _mod;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod Comb(long n, long k)\n {\n B(n);\n if (n == 0 && k == 0) return 1;\n if (n < k || n < 0) return 0;\n return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod CombOK(long n, long k)\n {\n LIB_Mod ret = 1;\n for (var i = 0; i < k; i++) ret *= n - i;\n for (var i = 1; i <= k; i++) ret /= i;\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod Perm(long n, long k)\n {\n B(n);\n if (n == 0 && k == 0) return 1;\n if (n < k || n < 0) return 0;\n return _fact[(int)n] / _fact[(int)(n - k)];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod KanzenPerm(long n) => Enumerable.Range(0, (int)n + 1).Aggregate((LIB_Mod)0, (a, e) => a + (1 - ((e & 1) << 1)) * LIB_Mod.Comb(n, e) * LIB_Mod.Perm(n - e, n - e));\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n static public LIB_Mod Pow(LIB_Mod x, long y)\n {\n LIB_Mod a = 1;\n while (y != 0)\n {\n if ((y & 1) == 1) a.Mul(x);\n x.Mul(x);\n y >>= 1;\n }\n return a;\n }\n }\n class LIB_FastIO\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIO() { str = Console.OpenStandardInput(); }\n readonly Stream str;\n readonly byte[] buf = new byte[1024];\n int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream\n {\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n get { return isEof; }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n byte read()\n {\n if (isEof) throw new EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public long Long()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n class LIB_FastIODebug : LIB_FastIO\n {\n Queue param = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public LIB_FastIODebug() { }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override string Scan() => NextString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override long Long() => long.Parse(NextString());\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public override double Double() => double.Parse(NextString());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound663Div2.Extensions;\nusing CodeforcesRound663Div2.Questions;\n\nnamespace CodeforcesRound663Div2.Questions\n{\n public class QuestionC : AtCoderQuestionBase\n {\n public override IEnumerable Solve(TextReader inputStream)\n {\n const int Mod = 1000000007;\n var n = inputStream.ReadInt();\n long result = 1;\n\n for (int i = 1; i <= n; i++)\n {\n result *= i;\n result %= Mod;\n }\n\n long subtract = 1;\n\n for (int i = 1; i <= n - 1; i++)\n {\n subtract *= 2;\n subtract %= Mod;\n }\n\n result = (result + Mod - subtract) % Mod; \n\n yield return result;\n }\n }\n}\n\nnamespace CodeforcesRound663Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionC();\n var answers = question.Solve(Console.In);\n\n var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(writer);\n foreach (var answer in answers)\n {\n Console.WriteLine(answer);\n }\n Console.Out.Flush();\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound663Div2.Questions\n{\n\n public interface IAtCoderQuestion\n {\n IEnumerable Solve(string input);\n IEnumerable Solve(TextReader inputStream);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public IEnumerable Solve(string input)\n {\n var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));\n var reader = new StreamReader(stream, Encoding.Unicode);\n\n return Solve(reader);\n }\n\n public abstract IEnumerable Solve(TextReader inputStream);\n }\n}\n\n#endregion\n\n#region Extensions\n\nnamespace CodeforcesRound663Div2.Extensions\n{\n public static class StringExtensions\n {\n public static string Join(this IEnumerable source) => string.Concat(source);\n public static string Join(this IEnumerable source, string separator) => string.Join(separator, source);\n }\n\n public static class TextReaderExtensions\n {\n public static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));\n public static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));\n public static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));\n public static string ReadString(this TextReader reader) => reader.ReadLine();\n\n public static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();\n public static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();\n public static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();\n public static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);\n\n // Supports primitive type only.\n public static T1 ReadValue(this TextReader reader) => (T1)Convert.ChangeType(reader.ReadLine(), typeof(T1));\n\n public static (T1, T2) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n return (v1, v2);\n }\n\n public static (T1, T2, T3) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n return (v1, v2, v3);\n }\n\n public static (T1, T2, T3, T4) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n return (v1, v2, v3, v4);\n }\n\n public static (T1, T2, T3, T4, T5) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n return (v1, v2, v3, v4, v5);\n }\n\n public static (T1, T2, T3, T4, T5, T6) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n return (v1, v2, v3, v4, v5, v6);\n }\n\n public static (T1, T2, T3, T4, T5, T6, T7) ReadValue(this TextReader reader, char separator = ' ')\n {\n var inputs = ReadStringArray(reader, separator);\n var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1));\n var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2));\n var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3));\n var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4));\n var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5));\n var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6));\n var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7));\n return (v1, v2, v3, v4, v5, v6, v7);\n }\n }\n}\n\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ContestTemplateStartUp\n{\n class ProgramA_\n {\n public class Heap where TK : IComparable\n {\n public bool Any()\n {\n return _list.Any();\n }\n\n public int Count\n {\n get { return _list.Count; }\n }\n\n private readonly List> _list = new List>();\n private int GetParentIndex(int index)\n {\n return ((index + 1) / 2) - 1;\n }\n\n private int? GetLeftChildIndex(int index)\n {\n int result = 2 * (index + 1) - 1;\n return result < _list.Count ? result : (int?)null;\n }\n\n private int? GetRightChildIndex(int index)\n {\n int result = 2 * (index + 1);\n return result < _list.Count ? result : (int?)null; ;\n }\n\n public void Insert(TK newValue, TV value)\n {\n _list.Add(new KeyValuePair(newValue, value));\n SiftUp(_list.Count - 1);\n }\n private void SiftDown(int index)\n {\n var leftChildIndex = GetLeftChildIndex(index);\n var rightChildIndex = GetRightChildIndex(index);\n\n var leftChild = leftChildIndex.HasValue ? (KeyValuePair?)_list[leftChildIndex.Value] : null;\n\n var rightChild = rightChildIndex.HasValue ? (KeyValuePair?)_list[rightChildIndex.Value] : null;\n\n var curr = _list[index];\n\n if (leftChild != null)\n {\n if (rightChild != null)\n {\n if (leftChild.Value.Key.CompareTo(curr.Key) > 0 && leftChild.Value.Key.CompareTo(rightChild.Value.Key) >= 0)\n {\n _list[index] = leftChild.Value;\n _list[leftChildIndex.Value] = curr;\n SiftDown(leftChildIndex.Value);\n }\n else if (rightChild.Value.Key.CompareTo(curr.Key) > 0 && rightChild.Value.Key.CompareTo(leftChild.Value.Key) >= 0)\n {\n _list[index] = rightChild.Value;\n _list[rightChildIndex.Value] = curr;\n SiftDown(rightChildIndex.Value);\n }\n }\n else\n {\n if (leftChild.Value.Key.CompareTo(curr.Key) > 0)\n {\n _list[index] = leftChild.Value;\n _list[leftChildIndex.Value] = curr;\n }\n }\n }\n\n }\n private void SiftUp(int index)\n {\n if (index == 0) return;\n var element = _list[index];\n var parentIndex = GetParentIndex(index);\n var parent = _list[parentIndex];\n if (parent.Key.CompareTo(element.Key) < 0)\n {\n _list[index] = parent;\n _list[parentIndex] = element;\n SiftUp(parentIndex);\n }\n }\n\n public KeyValuePair ExtractMax()\n {\n if (_list.Count <= 0) throw new InvalidOperationException();\n var last = GetLast();\n var max = _list[0];\n _list[0] = last;\n _list.RemoveAt(_list.Count - 1);\n if (_list.Any())\n {\n SiftDown(0);\n }\n return max;\n }\n\n private KeyValuePair GetLast()\n {\n return _list[_list.Count - 1];\n }\n\n public KeyValuePair GetMax()\n {\n if (_list.Count <= 0) throw new InvalidOperationException();\n var last = GetLast();\n var max = _list[0];\n return max;\n }\n }\n static void Main(string[] args)\n {\n //var results = new List();\n //foreach (var test in Enumerable.Range(0, GetIntFromReadLine()))\n {\n var n = GetInt();\n var nonCyclic = GetPower(2, n - 1);\n var factorial = GetFactorial(n);\n var diff = ((factorial - nonCyclic) + Modulo) % Modulo;\n\n Console.WriteLine(diff);\n // Console.WriteLine(result);\n //results.Add(count);\n }\n\n //foreach (var result in results)\n //{\n // Console.WriteLine(result);\n //}\n }\n\n static int dfs(int v, bool[] used, List[] graph, Dictionary, int> leavesCounts)\n {\n used[v] = true;\n var isLeave = true;\n var sum = 0;\n if (graph[v] != null)\n foreach (var u in graph[v])\n {\n if (!used[u])\n {\n var leavesCount = dfs(u, used, graph, leavesCounts);\n sum += leavesCount;\n leavesCounts[new KeyValuePair(v, u)] = leavesCount;\n isLeave = false;\n }\n }\n if (isLeave)\n {\n return 1;\n }\n else\n {\n return sum;\n }\n }\n\n private static int Exchange(int[] a, int count, HashSet newSet, HashSet oldSet, int index)\n {\n if (oldSet.Any())\n {\n var subSeqNum = oldSet.First();\n oldSet.Remove(subSeqNum);\n a[index + 1] = subSeqNum;\n newSet.Add(subSeqNum);\n }\n else\n {\n count++;\n var subSeqNum = count;\n a[index + 1] = subSeqNum;\n newSet.Add(subSeqNum);\n }\n return count;\n }\n\n static void Remove(Dictionary stat, int x)\n {\n if (stat[x] == 1)\n {\n stat.Remove(x);\n }\n else\n {\n stat[x] -= 1;\n }\n }\n\n //static void Main(string[] args)\n //{\n // var results = new List();\n // foreach (var test in Enumerable.Range(0, GetIntFromReadLine()))\n // {\n // var n = (long)GetInt();\n // var r = (long)GetInt(); \n // var min = (long)Math.Min(r, n - 1);\n // var sum = min * (min + 1) / 2L;\n // if (r >= n)\n // {\n // sum += +1;\n // } \n // results.Add(sum);\n // }\n\n // foreach (var result in results)\n // {\n // Console.WriteLine(result);\n // }\n //}\n\n //static void Main(string[] args)\n //{\n // var results = new List();\n // foreach (var test in Enumerable.Range(0, GetIntFromReadLine()))\n // { \n // var n = GetInt();\n // results.Add(n - (n/2));\n // }\n\n // foreach (var result in results)\n // {\n // Console.WriteLine(result);\n // }\n //}\n\n static long lower_bound(int h, int c, int t)\n {\n long l = 1;\n long r = int.MaxValue;\n while (l + 1 < r)\n {\n long mid = (r + l) / 2;\n if (mid * h + (mid - 1) * c >= t * (2 * mid - 1))\n {\n l = mid;\n }\n else\n {\n r = mid;\n }\n }\n return r;\n }\n\n private static int[] GetPrimes(int n)\n {\n var list = new List();\n while (true)\n {\n var del = GetMinDel(n);\n if (del == 1)\n {\n break;\n }\n list.Add(del);\n n = n / del;\n }\n return list.ToArray();\n }\n\n\n private static int GetMinDel(int n)\n {\n for (long index = 2; index * index <= n; ++index)\n {\n if (n % index == 0)\n {\n return (int)index;\n }\n }\n return n;\n }\n\n public static bool Success(int[] chet, int[] nechet)\n {\n foreach (var ch in chet)\n foreach (var nch in nechet)\n {\n if (Math.Abs(ch - nch) == 1)\n {\n return true;\n }\n }\n return false;\n }\n\n static int GetInt()\n {\n int integer = 0;\n int n = Console.Read();\n while (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n n = Console.Read();\n while (n >= '0' && n <= '9')\n {\n integer = integer * 10 + n - '0';\n n = Console.Read();\n }\n return integer;\n }\n static long GetLong()\n {\n long integer = 0;\n int n = Console.Read();\n while (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n n = Console.Read();\n while (n >= '0' && n <= '9')\n {\n integer = integer * 10 + n - '0';\n n = Console.Read();\n }\n return integer;\n }\n\n static int[] ReadArray(int count)\n {\n int[] arr = new int[count];\n for (var index = 0; index < count; ++index)\n {\n arr[index] = GetInt();\n }\n return arr;\n\n }\n\n static int[] ReadArrayFromReadLine()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n\n static int GetIntFromReadLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static int GetPower_(int num, int power)\n {\n if (power == 0) return 1;\n if (power == 1) return num;\n var prev = GetPower_(num, power / 2);\n var prev2 = ((long)prev * prev);\n if (power % 2 != 0) return (int)((prev2 * num));\n return (int)prev2;\n }\n\n public static int Modulo = 1000000007;\n public static int GetPower(int num, int power)\n {\n if (power == 0) return 1;\n if (power == 1) return num % Modulo;\n var prev = GetPower(num, power / 2);\n var prev2 = ((long)prev * prev) % Modulo;\n if (power % 2 != 0) return (int)((prev2 * num) % Modulo);\n return (int)prev2;\n }\n public static long GetFactorial(int num)\n {\n if (num == 0) return 1;\n var res = 1L;\n for (var index = 1; index <= num; ++index)\n {\n res = (res * index) % Modulo;\n }\n\n return res;\n }\n\n }\n}\n"}, {"source_code": "//using MetadataExtractor;\n//using MetadataExtractor.Formats.Exif;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n /*public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }*/\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n class Coord\n {\n public int x;\n public int y;\n public double d;\n }\n\n\n public static double dist(int x1, int y1, int x2, int y2)\n {\n int dx = x2 - x1;\n int dy = y2 - y1;\n\n return Math.Sqrt(dx * dx + dy * dy);\n\n }\n static void Main(string[] args)\n {\n int n = ReadIntLine();\n\n long pt = 1;\n long P = 1000000000 + 7;\n for (int i = 0; i < n-1; i++)\n {\n pt = (pt * 2) % P;\n }\n\n long f = 1;\n for (int i = 1; i <= n; i++)\n {\n f = (f * i) % P;\n }\n\n PrintLn((f - pt + P) % P);\n\n\n } //main\n\n\n }\n\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces {\n\n\n class Program {\n static void Main(string[] args) {\n //Solution so = new Solution();\n int T;\n T = int.Parse(Console.ReadLine());\n\n long res = 1;\n long mod = 1000_000_000 + 7;\n\n for(int i = 1; i <= T; ++i) {\n res *= i;\n if (res > mod) res %= mod;\n }\n\n long k2 = 1;\n for(int j = 1; j<= T-1; ++j) {\n k2 *= 2;\n if (k2 > mod) k2 %= mod;\n }\n\n res -= k2;\n\n while(res <= 0) {\n res += mod;\n }\n\n Console.WriteLine(res);\n\n \n\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces {\n\n\n class Program {\n static void Main(string[] args) {\n //Solution so = new Solution();\n int T;\n T = int.Parse(Console.ReadLine());\n\n long res = 1;\n long mod = 1000_000_000 + 7;\n\n for (int i = 1; i <= T; ++i) {\n res *= i;\n if (res > mod) res %= mod;\n }\n\n long k2 = 1;\n for (int j = 1; j <= T - 1; ++j) {\n k2 *= 2;\n if (k2 > mod) k2 %= mod;\n }\n\n res -= k2;\n\n while (res <= 0) {\n res += mod;\n }\n\n Console.WriteLine(res);\n\n\n\n return;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces {\n class Program {\n static void Main(string[] args) {\n int T;\n T = int.Parse(Console.ReadLine());\n long res = 1;\n long mod = 1000_000_007;\n for (int i = 1; i <= T; ++i) {\n res *= i;\n if (res > mod) res %= mod;\n }\n long k2 = 1;\n for (int j = 1; j <= T - 1; ++j) {\n k2 *= 2;\n if (k2 > mod) k2 %= mod;\n }\n res -= k2;\n while (res <= 0) {\n res += mod;\n }\n Console.WriteLine(res);\n Console.WriteLine(mod);\n return;\n }\n }\n}"}], "src_uid": "3dc1ee09016a25421ae371fa8005fce1"} {"source_code": "using System;\nclass Test{\n public static void Main(String[] args){\n string [] str = Console.ReadLine().Split();\n int n = Int32.Parse(str[0]);\n int a = Int32.Parse(str[1]);\n int b = Int32.Parse(str[2]);\n int sum1 = n-a;\n int sum2 = n-b;\n if(a+b>=n){\n Console.WriteLine(n-a);\n }else{\n if(n-a>b){\n Console.WriteLine(b+1);\n } else if(n-a == b){\n Console.WriteLine(b);\n } else {\n Console.WriteLine(n-a);\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nclass Program{ \n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine(s[0] + 1 - Math.Max(1+s[1], s[0]-s[2]));\n }\n}"}, {"source_code": "\n using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n if(a+b>=n)\n {\n Console.WriteLine(n - a);\n }\n else\n {\n Console.WriteLine(b+1);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_124A_The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int op = 0;\n if (a[0]>a[1]+a[2])\n {\n op = a[2] + 1;\n }\n else\n {\n op = a[0] - a[1];\n }\n Console.WriteLine(op);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n long n = Int64.Parse(input[0]);\n long a = Int64.Parse(input[1]);\n long b = Int64.Parse(input[2]);\n\n long output = n - Math.Max(a + 1, n - b) + 1;\n Console.WriteLine(output.ToString());\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace MTests\n{\n static class Program {\n\n internal static void MyMain()\n {\n \n var ints = RInts();\n var result = Math.Min(ints[0] - ints[1],ints[2]+1);\n WLine(result);\n\n }\n\n static void Main(string[] args)\n {\n\n#if !HOME\n MyMain();\n#else\n Secret.MyMain();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static string[] RLine(string separator = \" \")\n {\n return Console.ReadLine().Split(new string[] { separator }, StringSplitOptions.None);\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n public static void WLine(IEnumerable list) {\n if (list is string)\n {\n Console.WriteLine(list);\n }\n else {\n Console.WriteLine(string.Join(\" \", list));\n }\n\n \n }\n\n public static void WLine(params object[] s)\n {\n Console.WriteLine(string.Join(\" \",s));\n }\n\n public static void WLine(object s)\n {\n Console.WriteLine(s);\n }\n #endregion\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n\n int count = 0;\n for (int i=0;i<=b;i++)\n {\n if (n - i - 1 >= a) count++; else break;\n }\n\n Console.Write(count);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int a = Next() + 1;\n int b = Next();\n int pos = Math.Max(a, n - b);\n\n writer.WriteLine(n - pos + 1);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n Console.WriteLine(n-Math.Max(a+1,n-b)+1);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), a = int.Parse(s[1]), b = int.Parse(s[2]);\n int max = Math.Max(a + 1, n - b);\n Console.WriteLine(n - max + 1);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // The number of positions (math)\n class _124A\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(ss[0]);\n int a = int.Parse(ss[1]);\n int b = int.Parse(ss[2]);\n Console.WriteLine(Math.Min(n - a, b + 1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DominoPiling\n{\n public class NumberOfPosition\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n int total = int.Parse(input.Split(' ')[0]);\n int noLessThan = int.Parse(input.Split(' ')[1]);\n int noMoreThan = int.Parse(input.Split(' ')[2]);\n\n int possibility = 0;\n\n foreach(var i in Enumerable.Range(noLessThan,total-noLessThan+1))\n {\n if (i - noLessThan > 0 && total - i <= noMoreThan)\n possibility++;\n }\n\n Console.WriteLine(possibility);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace Issue_124A\n{\n public static class Program\n {\n public static void Main(string[] args) {\n var count = IO.Read();\n var before = IO.Read();\n var after = IO.Read();\n\n var free = count - before;\n var positions = (free <= after) \n ? free \n : after + 1;\n\n Console.WriteLine(positions);\n }\n }\n\n public static class IO {\n public const int ZeroCode = (int) '0';\n\n static IO() {\n Reader = new StreamReader(\n Console.OpenStandardInput(),\n System.Text.Encoding.ASCII,\n false, \n sizeof(int),\n false);\n }\n\n public static StreamReader Reader { \n get; set;\n }\n\n public static string ReadLine() {\n return Reader.ReadLine();\n }\n\n public static int Read() {\n var reader = Reader;\n var symbol = reader.Read();\n\n while (symbol == ' ') {\n symbol = reader.Read();\n }\n\n var isNegative = false;\n if (symbol == '-') {\n isNegative = true;\n symbol = reader.Read();\n }\n\n int result = 0;\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = reader.Read()\n ) {\n var digit = symbol - ZeroCode;\n \n if (digit < 10 && digit >= 0) {\n result = (result << 1) + ((result << 1) << 2) + digit;\n } else {\n if (symbol == 13) // if symbol == \\n\n reader.Read(); // skip next \\r symbol\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(data[0]);\n int a = Convert.ToInt32(data[1]);\n int b = Convert.ToInt32(data[2]);\n\n Console.WriteLine(a + 1 > n - b ? n - a : n - (n - b) + 1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n var q = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n if (q[0] - q[1] < q[2])\n Console.WriteLine(q[0] - q[1]);\n else\n if (q[2] + 1 < q[0] - q[1])\n Console.WriteLine(q[2] + 1);\n else\n Console.WriteLine(q[0] - q[1]);\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var t=read().ToIntA();\n int n=t[0],a=t[1],b=t[2];\n \n var x=n-a;\n write((x<=b+1)?x:b+1);\n }\n}\n\n\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n \n public static int[] ToIntA(this string s)\n {\n return SplitBySpace(s).Select(ToInt).ToArray();\n }\n \n public static string[] SplitBySpace(this string s)\n {\n return s.Split(new[]{\" \"},StringSplitOptions.RemoveEmptyEntries);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace broze\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (n[2]+n[1]>=n[0])\n {\n Console.WriteLine(n[0]-n[1]);\n }\n else\n {\n Console.WriteLine(n[2]+1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int a = Next();\n int b = Next();\n int ans = Math.Min(n - a, b + 1);\n writer.Write(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n\n int posCount = n - a;\n\n Console.WriteLine(b < posCount - 1 ? b + 1 : posCount);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = int.Parse(line[0]);\n int a = int.Parse(line[1]);\n int b = int.Parse(line[2]);\n Console.WriteLine(Math.Min(n - a, b + 1));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int start = n - a;\n if (b > start - 1)\n {\n Console.WriteLine(start);\n }\n else\n {\n Console.WriteLine(start - ((start - 1) - b)); ;\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int count = 0;\n for(int i = mass[1]; i < mass[0]; i++)\n {\n if (mass[0] - 1 - i <= mass[2] ) count++;\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem124A {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n int peopleInLine = Convert.ToInt32(input[0]);\n int inFront = Convert.ToInt32(input[1]);\n int behind = Convert.ToInt32(input[2]);\n\n int positions = 0;\n for (int i = inFront+1; i <= peopleInLine; i++) {\n int position = i;\n if (peopleInLine - position <= behind) {\n positions++;\n }\n }\n\n Console.WriteLine(positions);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int[] parameters;\n int spots;\n\n parameters = (Console.ReadLine().Split(' ')).Select(n => Convert.ToInt32(n)).ToArray();\n\n spots = parameters[0] - parameters[1];\n\n if (spots > parameters[2])\n Console.WriteLine(parameters[2] + 1);\n else\n Console.WriteLine(spots);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string[] arr1 = a.Split(' ');\n int sub = int.Parse(arr1[0]) - int.Parse(arr1[1]);\n while (sub > (int.Parse(arr1[2])) + 1) sub--;\n Console.Write(sub);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n { \n static void Main(string[] args)\n {\n int[] inputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = inputs[0], a = inputs[1], b = inputs[2];\n Console.WriteLine(n - Math.Max(a + 1, n - b) + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Solver\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var n = ReadInt();\n var a = ReadInt();\n var b = ReadInt();\n var c = 0;\n if (a + b >= n)\n {\n c = Math.Min(n - a, b);\n }\n else\n {\n c = b + 1;\n }\n writer.WriteLine(c);\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var param = Console.ReadLine().Split(' ');\n int n = int.Parse(param[0]);\n int a = int.Parse(param[1]);\n\t\t\tint b = int.Parse(param[2]);\n\t\t\tn = n - a;\n Console.WriteLine(n - Math.Max(0, n - b - 1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = Math.Min(count[0] - count[1], count[2] + 1);\n Console.WriteLine(rez);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // the inputs\n List lNums = Console.ReadLine().Split().Select(int.Parse).ToList();\n int n = lNums[0];\n int a = lNums[1];\n int b = lNums[2];\n\n int lb = a + 1, ub = n;\n if (lb > ub)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n if (ub - lb > b)\n {\n lb = n - b;\n }\n }\n\n Console.WriteLine(\"{0}\", ub - lb + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _03_11_11_2_\n{\n class Program\n {\n static void Main()\n {\n string st = Console.ReadLine();\n string[] s = Regex.Split(st, \" \");\n int n = Int32.Parse(s[0]);\n int a = Int32.Parse(s[1]); \n int b = Int32.Parse(s[2]);\n b = b + 1;\n a = n - a;\n if (b > a) Console.WriteLine(\"{0}\",a);\n else Console.WriteLine(\"{0}\", b);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace problem_solve_with_csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] nab = Array.ConvertAll(Console.ReadLine().Split(), e => long.Parse(e));\n long n = nab[0];\n long a = nab[1];\n long b = nab[2];\n Console.Write(n - Math.Max(a + 1, n - b) + 1);\n }\n }\n }\n \n "}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _124A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int a = int.Parse(tokens[1]);\n int b = int.Parse(tokens[2]);\n\n Console.WriteLine(Math.Min(n - a, b + 1));\n }\n }\n}"}, {"source_code": "\ufeffusing System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Solution\n{\n static int pos(int n, int a,int b)\n {\n int m;\n int c = a + b;\n if (n - c <= 1)\n m = n - a;\n else\n m = b + 1;\n return m;\n }\n static void Main(string[] args)\n {\n int n, a, b;\n string s=Console.ReadLine();\n n = int.Parse(s.Split(' ')[0]);\n b = int.Parse(s.Split(' ')[2]);\n a = int.Parse(s.Split(' ')[1]);\n int res = pos(n,a,b);\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static void Main()\n {\n var input = Console.ReadLine();\n var n = ReadNextInt(input, 0);\n var a = ReadNextInt(input, 1);\n var b = ReadNextInt(input, 2);\n var min = Math.Max(a + 1, n - b);\n var res = 0;\n res = Math.Max(n - min + 1, 0);\n Console.WriteLine(res);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n\n if (a == 0 && b == 0)\n cp=n;\n else\n {\n if ((a + b) < (n - 1))\n cp = b + 1;\n else\n cp= n - a;\n }\n Console.WriteLine(\"\" + cp);\n \n\n }\n\n }\n\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n cp = cant_lugar(a, b, n);\n Console.WriteLine(\"\" + cp);\n \n\n }\n\n static int cant_lugar(int a, int b, int n)\n {\n\n if (a == 0 && b == 0)\n return n;\n else if ((a + b) < (n - 1))\n return b + 1;\n\n else\n\n return n - a;\n \n }\n \n }\n\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Text;\n\nnamespace AcmSolution4\n{\n class Program\n {\n private static void Do()\n { \n int n, a, b;\n GetInts(out n, out a, out b);\n\n int ans = 0;\n for (int x = 1; x <= n; ++x)\n {\n if (x - 1 >= a && n - x <= b)\n ans++;\n }\n WL(ans); \n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ACM_HOME\n //Console.SetIn(new StreamReader(\"addictive.in\"));\n //Console.SetOut(new StreamWriter(\"addictive.out\"));\n Do();\n Console.Out.Close();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(\"Answer: \" + GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadLine();\n#endif\n }\n\n internal class Item\n {\n public double value;\n public int item;\n public Item(double val, int it)\n {\n value = val;\n item = it;\n }\n }\n\n #region Utils\n const double Epsilon = 0.00000000000001;\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n\n static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] strarr = Console.ReadLine().Split(' ');\n int n = int.Parse(strarr[0]);\n int a = int.Parse(strarr[1]);\n int b = int.Parse(strarr[2]);\n Console.WriteLine(Math.Min(b+1, n - a));\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nab = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n int Aux = nab[0] - nab[1];\n Console.WriteLine(Aux <= nab[2] ?Aux: 1+nab[2]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n int[] m = new int[n];\n for (int i = 0; i < m.Length; i++)\n {\n m[i] = i + 1;\n }\n int count = 0;\n for (int i = 0; i < m.Length; i++)\n {\n int d = i;\n int p = m.Length - i - 1;\n if (d >= a && p <= b)\n {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeff\n\nusing System;\nusing System.Linq;\nusing static System.Math;\nusing static System.Console;\n\nnamespace P1 {\n public class A10 {\n static void Main() {\n var a = ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine(Min(a[0] - a[1], a[2] + 1));\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar x=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tConsole.WriteLine(Math.Min(x[0]-x[1], x[2]+1));\n\t}\t\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string[] s1 = str1.Split(' ');\n int n = Convert.ToInt32(s1[0]);\n int a = Convert.ToInt32(s1[1]);\n int b = Convert.ToInt32(s1[2]);\n int cnt = 0;\n for(int i = 1; i <= n; i++)\n {\n if(i>a && (n - i)<= b)\n {\n cnt++;\n }\n }\n Console.WriteLine(cnt);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace a124 {\n class MainClass {\n public static void Main (string[] args) {\n string[] inp = Console.ReadLine().Split(new char[]{' '});\n UInt32 n = Convert.ToUInt32(inp[0]);\n UInt32 a = Convert.ToUInt32(inp[1]);\n UInt32 b = Convert.ToUInt32(inp[2]);\n UInt32 possible = n-a;\n if (b < possible)\n possible = b+1;\n Console.WriteLine(possible);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TheNumberOfPositions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] x = Console.ReadLine().Split(' ');\n int n = Int32.Parse(x[0]);\n int a = Int32.Parse(x[1]);\n int b = Int32.Parse(x[2]);\n int count = 0;\n for (int i = a; i <= n - 1; i++)\n {\n if (n - 1 - i <= b)\n count++;\n }\n Console.WriteLine(count);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n ,a ,b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n n = ints[0];\n a = ints[1];\n b = ints[2];\n \n /*if ((a < 0)||(a>n) || (b > n) || (n > 100)||(n<0)||(b<0)) return;\n int k = n - a;*/\n int count = 0;\n for (int i = 0; i <= b; i++)\n {\n if (n - i - 1 >= a)\n count++;\n }\n Console.WriteLine(count);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]);\n int a = int.Parse(r[1]);\n int b = int.Parse(r[2]);\n int minX = Math.Max(a, n - 1 - b);\n int br = n - minX;\n Console.WriteLine(br);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\n\nnamespace Task\n{\n class Program\n {\n readonly MyIo io = new MyIo();\n\n void Solve()\n {\n int n = io.NextInt();\n int a = io.NextInt();\n int b = io.NextInt();\n\n io.Print(Math.Min(n-a, b + 1));\n#if DEBUG\n System.Diagnostics.Debugger.Break();\n#endif\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n\n p.Solve();\n p.io.Close();\n }\n }\n\n #region MyIo\n class MyIo\n {\n readonly char[] separators = new char[] { ' ', '\\t' };\n\n#if DEBUG\n readonly TextReader inputStream = new StreamReader(\"input.txt\");\n#else\n readonly TextReader inputStream = System.Console.In;\n#endif\n\n readonly TextWriter outputStream = Console.Out;\n \n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n\n #endregion\n}"}, {"source_code": "/*\n * \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0432 SharpDevelop.\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: admin\n * \u0414\u0430\u0442\u0430: 01.02.2013\n * \u0412\u0440\u0435\u043c\u044f: 22:20\n * \n * \u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441 | \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 | \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 | \u041f\u0440\u0430\u0432\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.\n */\n\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nusing System;\nnamespace reshenie\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t\n\t\t\tstring[] s = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(s[0]),a=int.Parse(s[1]),b=int.Parse(s[2]) ;\n\t\t\t\n\t\t\tConsole.WriteLine(Math.Min(n-a,b+1));\n\t\t\t\t\n\t\t\t//Console.ReadKey(true);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n // Array.ConvertAll((Console.ReadLine().Split(' ')), (x => int.Parse(x)));\n int[] data = Array.ConvertAll((Console.ReadLine().Split(' ')), (x => int.Parse(x)));\n int n = data[0];\n int a = data[1];\n int b = data[2];\n\n Console.WriteLine(Math.Min(n-a, b+1));\n }\n\n \n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n int[] input = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n int n = input[0];\n int a = input[1];\n int b = input[2];\n int output = n - a;\n Console.WriteLine(min(output, b + 1));\n }\n\n public static int min(int a, int b) { return (a >= b) ? b : a; }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n //Console.SetIn(new StreamReader(\"gcd.in\"));\n // Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n //Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n;\n int a;\n int b;\n GetInts(out n, out a, out b);\n int numberStart = n - a;\n int number = 0;\n int difference = 0;\n if (n - (a + b + 1) > 0)\n {\n number = b + 1;\n difference = numberStart - number;\n }\n int answer = numberStart - difference;\n Console.WriteLine(answer);\n }\n\n \n \n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static long Vector(long x1, long y1, long x2, long y2, long x3, long y3)\n {\n long ax = x2 - x1;\n long ay = y2 - y1;\n long bx = x3 - x1;\n long by = y3 - y1;\n return ax * by - ay * bx;\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n if (n - a > b)\n {\n \n Console.WriteLine(b+1);\n }\n else\n Console.WriteLine(n-a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _NumPos\n{\n class ProgramNumPos\n {\n static void GetParams(string input, out int n, out int a, out int b)\n {\n var splitParams = input.Split();\n n = Convert.ToInt32(splitParams[0]);\n a = Convert.ToInt32(splitParams[1]);\n b = Convert.ToInt32(splitParams[2]);\n }\n\n static string Run(string input)\n {\n int n, a, b;\n\n GetParams(input, out n, out a, out b);\n\n return string.Format(\"{0}\", Math.Min(n - a, b+1));\n }\n\n static void Main(string[] args)\n {\n var inputs = new List();\n if (args.Length == 0)\n {\n var input = Console.ReadLine();\n inputs.Add(input);\n } else\n {\n var input = string.Empty;\n while (input != \"-1\")\n {\n input = Console.ReadLine();\n if (input != \"-1\") inputs.Add(input); \n }\n }\n\n foreach (var test in inputs)\n {\n Console.WriteLine(Run(test));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n Solve();\n }\n\n private static void Solve()\n {\n var nab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n if (nab[0] - nab[2] <= nab[1])\n Console.WriteLine(nab[0] - nab[1]);\n else\n Console.WriteLine(nab[2] + 1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n b++;\n a = n - a;\n Console.Write(Math.Min(a, b));\n // Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b == n)\n Console.WriteLine(b);\n else if (a + b > n)\n Console.WriteLine(n - a);\n else\n Console.WriteLine(b + 1);\n \n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforce\n{ \n static void Main()\n { \n string []s= Console.ReadLine().Split();\n\n int n = int.Parse( s[0] );\n int a = int.Parse( s[1]);\n int b = int.Parse(s[2]);\n int nub = 0;\n\n for (int i = n-1-a ; i>= 0 ; i--)\n if (i<= b)\n nub++;\n\n\n Console.WriteLine( nub) ;\n\n \n\n\n\n\n }\n}"}, {"source_code": "// #using System.Collections.Generic;\nusing System;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main ()\n {\n string[] test = Console.ReadLine ().Split (' ');\n int n = int.Parse (test [0]), a = int.Parse (test [1]), b = int.Parse (test [2]);\n n = n - a;\n while (n > b+1)\n n --;\n \n Console.WriteLine (n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] line = Array.ConvertAll(Console.ReadLine().Split(),k => int.Parse(k));\n int n = line[0], a = line[1], b = line[2], count = 0;\n for(int i = a;i int.Parse(a[1]))\n k++;\n }\n if (k > int.Parse(a[2]))\n ans = int.Parse(a[2]) + 1;\n else ans = k;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\n\nnamespace task\n{\n class Program\n {\n static void Main(string[] args)\n { \n var aData = ReadLine().Split(' ').Select(int.Parse);\n var n = aData.ElementAt(0);\n var a = aData.ElementAt(1);\n var b = aData.ElementAt(2);\n var c = 0;\n if (a + b >= n)\n {\n c = Math.Min(n - a, b);\n }\n else\n {\n c = b + 1;\n }\n WriteLine(c); \n } \n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class A1\n {\n public static void Main(String[] args)\n {\n String[] pole = Console.ReadLine().Split(' ');\n int r = Convert.ToInt32(pole[0]);\n int p = Convert.ToInt32(pole[1]);\n int z = Convert.ToInt32(pole[2]);\n int vysledek = 0;\n if (r - p < z + 1) vysledek = r - p;\n else vysledek = z + 1;\n Console.Write(vysledek.ToString());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e_\u043f\u043e\u0437\u0438\u0446\u0438\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b > n)\n n = n - a;\n else if (a + b == n)\n n = n - a;\n\n else\n n = b+1;\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace problem_solve_with_csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] nab = Array.ConvertAll(Console.ReadLine().Split(), e => long.Parse(e));\n long n = nab[0];\n long a = nab[1];\n long b = nab[2];\n Console.Write(n - Math.Max(a + 1, n - b) + 1);\n }\n }\n }\n\n\n \n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1_The_Number_of_Position\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Entrada dos dados\n string value = Console.ReadLine();\n\n //Divisao da string para os valores de cada area especifica\n int n = int.Parse(value.Split(' ')[0]);\n int a = int.Parse(value.Split(' ')[1]);\n int b = int.Parse(value.Split(' ')[2]);\n\n\n\n Console.WriteLine(Math.Min(n-a,b+1));\n\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1_The_Number_of_Position\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n;//Numero de pessoas na fila\n int a;//Quantidade minima de pessoas a frente\n int b;//Quantidade maxima de pessoas a tras\n\n //Entrada dos dados\n string value = Console.ReadLine();\n\n //Divisao da string para os valores de cada area especifica\n n = int.Parse(value.Split(' ')[0]);\n a = int.Parse(value.Split(' ')[1]);\n b = int.Parse(value.Split(' ')[2]);\n\n\n \n //Metodo Math.Min retorna o menor valor entre 2 numeros\n //n-a: quantidade de pessoas na fila menos a quantidade minima de pessoas a frente\n //b+1 quantidade maxima de pessoas atras + 1\n Console.WriteLine(Math.Min(n - a, b + 1));\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tConsole.WriteLine(Math.Min(inputs1[0] - inputs1[1], inputs1[2] + 1));\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Text;\n\n\nnamespace Dictionary\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n int cur = n - a;\n\n Console.WriteLine(cur>b?b+1:cur);\n\n }\n\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NEwTechTEst\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.ElementAt(0);\n var a = input.ElementAt(1);\n var b = input.ElementAt(2);\n Console.WriteLine(n - a > b ? b+1 : n - a);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace _92D2A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n Console.WriteLine(Math.Min(n - a,b + 1));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var t = Console.ReadLine();\n var tt = t.Split(' ');\n int n = int.Parse(tt[0]);\n int a = int.Parse(tt[1]);\n int b = int.Parse(tt[2]);\n\n Console.Write(n - Math.Max(a , n - b - 1));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace SimpleProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0].ToString());\n int a = int.Parse(s[1].ToString());\n int b = int.Parse(s[2].ToString());\n\n int k = a + 1;\n\n int t = n - b;\n\n\n Console.WriteLine(n - (Math.Max(k,t) - 1));\n\n // Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "/*\n\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Diagnostics;\n\npublic class Solver\n{\n public void Solve()\n {\n Trace.WriteLine(\"hello world!\");\n int n = ReadInt();\n int a = ReadInt();\n int b = ReadInt();\n int m = n - Math.Max(a+1, n-b) + 1;\n Write(m);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));\n // reader = new StreamReader(\"..\\..\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\..\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch \n {\n#if DEBUG\n // Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n"}, {"source_code": "/*\n\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Diagnostics;\n\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int a = ReadInt();\n int b = ReadInt();\n int m = n - Math.Max(a+1, n-b) + 1;\n Write(m);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n new Solver().Solve();\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n"}, {"source_code": "\nusing System;\n\nnamespace _4A_watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line= Console.ReadLine();\n string[]tok=line.Split(' ');\n int n=int.Parse(tok[0]),a=int.Parse(tok[1]),b=int.Parse(tok[2]);\n if(n-(a+b)>1)\n Console.WriteLine(\"{0}\",n-(a+n-(a+b)-1));\n else\n Console.WriteLine(\"{0}\",n-a);\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _124A_NoOfPositions.Run();\n\n }\n }\n class _124A_NoOfPositions\n {\n public static void Run()\n {\n var line = Console.ReadLine().Split(' ');\n var n = byte.Parse(line[0]);\n var a = byte.Parse(line[1]);\n var b = byte.Parse(line[2]);\n\n var x = n - a;\n var m = x-1 <= b ? x : b + 1;\n\n Console.WriteLine(m);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = s[0];\n int a = s[1];\n int b = s[2];\n Console.WriteLine(n - Math.Max(a + 1, n - b) + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nab = Console.ReadLine().Split();\n int n = int.Parse(nab[0]);\n int a = int.Parse(nab[1]);\n int b = int.Parse(nab[2]);\n int ans = 0;\n if (a + 1 >= n - b)\n ans = n - a;\n else\n ans = b + 1;\n if (ans <= 0)\n Console.WriteLine(\"0\");\n else\n Console.WriteLine(ans.ToString());\n }\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n void Solve()\n {\n var n = _.NextInt();\n var a = _.NextInt();\n var b = _.NextInt();\n var ans = Math.Max(n - Math.Max(a, n - b - 1), 0);\n _.WriteLine(ans);\n }\n\n int Dist(int s, int t, int[] d)\n {\n var dist = 0;\n for (var cur = s; cur != t; cur = (cur + 1) % d.Length) dist += d[cur];\n return dist;\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar arr = getList();\n\t\t\tConsole.WriteLine(arr[0] - Max(arr[1] + 1, arr[0] - arr[2]) + 1);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int i = 0, count = 0;\n while (s[0] - (s[1] + i + 1) >=0)\n {\n if (s[0] - (s[1] + i + 1) <= s[2]) count++;\n i++; \n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var n = int.Parse(input[0]);\n var a = int.Parse(input[1]);\n var b = int.Parse(input[2]);\n\n Console.WriteLine(Math.Min(n-a, b+1));\n\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n//----------------------------------------------------------------------------\n \n\n\n static void Main(string[] args)\n {\n\n int n = 0, a = 0, b = 0;\n ReadInts(ref n, ref a, ref b);\n\n PrintLn(Math.Max(0,Math.Min(b+1,n-a)));\n\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CP_CS\n{\n\n class Task\n {\n\n static void Solve()\n {\n int n = ReadInt();\n int a = ReadInt();\n int b = ReadInt();\n Write(Math.Min(n-a, b+1));\n }\n\n public static double Rast(int[] xy1, int[] xy2)\n {\n return Math.Sqrt(Math.Pow(xy1[0] - xy2[0], 2) + Math.Pow(xy1[1] - xy2[1], 2));\n }\n\n static string[] Split(string str, int chunkSize)\n {\n return Enumerable.Range(0, str.Length / chunkSize)\n .Select(i => str.Substring(i * chunkSize, chunkSize)).ToArray();\n }\n\n #region -- Main -- \n\n private static TextReader reader;\n private static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"pluses.in\");\n //writer = new StreamWriter(\"pluses.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n #region -- Read / Write --\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadAndSplitLine(char divisor)\n {\n return reader.ReadLine().Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n //public static BigInteger ReadBigInteger()\n //{\n // return BigInteger.Parse(ReadToken());\n //}\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static bool[] ReadBoolArray()\n {\n return ReadAndSplitLine().ToString().ToCharArray().Select(chr => chr == '1').ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static bool[][] ReadBoolMatrix(int numberOfRows)\n {\n bool[][] matrix = new bool[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadBoolArray();\n return matrix;\n }\n\n public static bool[][] TransposeBoolMatrix(bool[][] array, int numberOfRows)\n {\n bool[][] matrix = array;\n bool[][] ret = new bool[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new bool[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { '\\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int answer = (int.Parse(input[2]) + 1) < (int.Parse(input[0]) - int.Parse(input[1])) ? (int.Parse(input[2]) + 1) : (int.Parse(input[0]) - int.Parse(input[1]));\n Console.WriteLine(answer);\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nclass My\n{\n static void Main()\n {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n Console.Write(s[0] - Math.Max(s[0] - (s[2] + 1), s[1]));\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int p = nums[0];\n int bef = nums[1];\n int aft = nums[2];\n\n int ans = (bef + aft) >= p ? p - bef : aft + 1;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A124 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var a = int.Parse(line[1]);\n var b = int.Parse(line[2]);\n Console.WriteLine(Math.Min(n - a, b + 1));\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] arrInput = Console.ReadLine().Split(' ').Select(x => Convert.ToByte(x)).ToArray();\n Console.WriteLine((arrInput[0] - arrInput[1] - 1) > arrInput[2] ? (arrInput[2] + 1) : (arrInput[0] - arrInput[1])); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n, a, b;\n n = input[0]; a = input[1]; b = input[2];\n n -= a; b += 1;\n Console.WriteLine(Math.Min(n, b)); \n //int n = input[0], t = input[1];\n //string q = Console.ReadLine();\n //char[] s = q.ToArray();\n //for(int i = 0; i < t; i++)\n //{\n // for (int j = 0; j< n; j++)\n // {\n // if (s[j] == 'B' && s[j + 1] == 'G')\n // {\n // s[j] = 'G';\n // s[j + 1] = 'B';\n // j++;\n // }\n // }\n //}\n //Console.WriteLine(s);\n ////int re = 0;\n //var mini = 0;\n //for (int i = 0; i < 5; i++)\n //{\n // var n = Console.ReadLine().Split(' ').ToList();\n // var m = n.IndexOf(\"1\");\n // if (m != -1)\n // mini = Math.Abs(2 - i) + Math.Abs(2 - m);\n //}\n //Console.WriteLine(mini);\n\n // int re, x = 0, y = 0, z = 0;\n // re = Convert.ToInt32(Console.ReadLine());\n // while(re > 0)\n // {\n // int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();\n // x += n[0]; y += n[1]; z += n[2];\n // re--;\n // }\n // if (x == 0 && y == 0 && z == 0)\n // Console.WriteLine(\"YES\");\n // else\n // Console.WriteLine(\"NO\");\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n var v = Console.ReadLine().Split();\n int n = int.Parse(v[0]);\n int a = int.Parse(v[1]);\n int b = int.Parse(v[2]);\n Console.WriteLine(n - Math.Max(a + 1, n - b) + 1);\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var param = Console.ReadLine().Split(' ');\n int n = int.Parse(param[0]);\n int a = int.Parse(param[0]);\n Console.WriteLine(n - a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var param = Console.ReadLine().Split(' ');\n int n = int.Parse(param[0]);\n int a = int.Parse(param[1]);\n\t\t\tint b = int.Parse(param[2]);\n\t\t\tn = n - a;\n Console.WriteLine(n - Math.Max(0, n - b + 1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var param = Console.ReadLine().Split(' ');\n int n = int.Parse(param[0]);\n int a = int.Parse(param[1]);\n Console.WriteLine(n - a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int rez = count[0] - count[1];\n\n Console.WriteLine(rez);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test{\n public static void Main(String[] args){\n string [] str = Console.ReadLine().Split();\n int n = Int32.Parse(str[0]);\n int a = Int32.Parse(str[1]);\n int b = Int32.Parse(str[2]);\n Console.WriteLine(n-a);\n }\n}"}, {"source_code": "using System;\nclass Test{\n public static void Main(String[] args){\n string [] str = Console.ReadLine().Split();\n int n = Int32.Parse(str[0]);\n int a = Int32.Parse(str[1]);\n int b = Int32.Parse(str[2]);\n int sum1 = n-a;\n int sum2 = n-b;\n if(sum1 > sum2){\n Console.WriteLine(sum2);\n } else {\n Console.WriteLine(sum1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n\n if (a == 0)\n cp = b;\n else if ((a + b) < (n - 1))\n cp = b + 1;\n else \n cp = n - a;\n Console.WriteLine(\"\" + cp);\n \n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n\n if (a == 0)\n cp = b;\n else\n {\n if ((a + b) < (n - 1))\n cp = b + 1;\n else \n cp = n - a;\n }\n Console.WriteLine(\"\" + cp);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n cp = cant_lugar(a, b, n);\n Console.WriteLine(\"\" + cp);\n \n\n }\n\n static int cant_lugar(int a, int b, int n)\n {\n\n if (a == 0)\n return b;\n else if ((a + b) < (n - 1))\n return b + 1;\n\n else\n\n return n - a;\n }\n \n }\n\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, n,cp;\n\n string[] temp = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(temp[0]);\n a = Convert.ToInt32(temp[1]);\n b = Convert.ToInt32(temp[2]);\n\n if (a == 0)\n cp = b;\n else\n {\n if ((a + b) < (n - 1))\n cp = b + 1;\n\n else\n \n cp = n - a;\n }\n Console.WriteLine(\"\" + cp);\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace AcmSolution4\n{\n class Program\n {\n private static void Do()\n {\n int n, a, b;\n GetInts(out n, out a, out b);\n\n int ans = 0;\n for (int x = 1; x <= n; ++x)\n {\n if (x - 1 >= a && n - x - 1 <= b)\n ans++;\n }\n WL(ans);\n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ACM_HOME\n //Console.SetIn(new StreamReader(\"input.txt\"));\n //Console.SetOut(new StreamWriter(\"output.txt\"));\n Do();\n //Console.Out.Close();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(\"Answer: \" + GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadLine();\n#endif\n }\n\n #region Utils\n const double Epsilon = 0.00000000000001;\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n\n static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n #endregion\n }\n\n internal class Four\n {\n public int x1;\n public int x2;\n public int y1;\n public int y2;\n public Four(int[] a)\n {\n x1 = Math.Min(a[0], a[2]);\n y1 = Math.Min(a[1], a[3]);\n x2 = Math.Max(a[0], a[2]);\n y2 = Math.Max(a[1], a[3]);\n }\n\n public bool IsVertical()\n {\n return x1 == x2;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Text;\n\nnamespace AcmSolution4\n{\n class Program\n {\n private static void Do()\n { \n int n, a, b;\n GetInts(out n, out a, out b);\n\n int ans = 0;\n for (int x = 0; x < n; ++x)\n {\n if (x - 1 >= a && n - x - 1 <= b)\n ans++;\n }\n WL(ans); \n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ACM_HOME\n //Console.SetIn(new StreamReader(\"addictive.in\"));\n //Console.SetOut(new StreamWriter(\"addictive.out\"));\n Do();\n Console.Out.Close();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"a.txt\"));\n while (Console.In.Peek() > 0)\n {\n Do();\n WL(\"Answer: \" + GetStr());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadLine();\n#endif\n }\n\n internal class Item\n {\n public double value;\n public int item;\n public Item(double val, int it)\n {\n value = val;\n item = it;\n }\n }\n\n #region Utils\n const double Epsilon = 0.00000000000001;\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n\n static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] strarr = Console.ReadLine().Split(' ');\n int n = int.Parse(strarr[0]);\n int a = int.Parse(strarr[1]);\n int b = int.Parse(strarr[2]);\n Console.WriteLine(Math.Max(b, n - a));\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar x=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tConsole.WriteLine(x[0]-x[1]);\n\t}\t\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n string[] s1 = str1.Split(' ');\n int n = Convert.ToInt32(s1[0]);\n int a = Convert.ToInt32(s1[1]);\n int b = Convert.ToInt32(s1[2]);\n for(int i = 1; i <= n; i++)\n {\n if(i>a && (n - i) <= b)\n {\n Console.WriteLine(i);\n break;\n }\n }\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n ,a ,b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n n = ints[0];\n a = ints[1];\n b = ints[2];\n \n if ((a < 0)||(a>n) || (b > n) || (n > 100)||(n<0)||(b<0)) return;\n int k = n - a;\n Console.WriteLine(k);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n ,a ,b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n n = ints[0];\n a = ints[1];\n b = ints[2];\n \n if ((a < 0) || (b > n) || (n > 100)||(n<0)||(b<0)) return;\n int k = n - a;\n Console.WriteLine(k);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n ,a ,b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n n = ints[0];\n a = ints[1];\n b = ints[2];\n \n if ((a < 0)||(a > n) || (b > n) || (n > 100)||(n<0)||(b<0)) return;\n int k = n - a;\n Console.WriteLine(k);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,a, b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n\n n = ints[0];\n a = ints[1];\n b = ints[2];\n if ((a <= 0) || (b > n) || (n <= 100)) return;\n Console.WriteLine(n-a);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,a, b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n\n n = ints[0];\n a = ints[1];\n b = ints[2];\n Console.WriteLine(n-a);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,a, b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n\n n = ints[0];\n a = ints[1];\n b = ints[2];\n if ((a <= 0) || (b > n) || (n >= 100)) return;\n Console.WriteLine(n-a);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n ,a ,b;\n string test = Console.ReadLine();\n string[] splitString = test.Split(' ');\n int[] ints = new int[3];\n for (int i = 0; i < 3; i++)\n {\n int x;\n int.TryParse(splitString[i], out x);\n ints[i] = x;\n }\n\n n = ints[0];\n a = ints[1];\n b = ints[2];\n if ((a < 0) || (b > n) || (n > 100)) return;\n Console.WriteLine(n-a);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\n\nnamespace Task\n{\n class Program\n {\n readonly MyIo io = new MyIo();\n\n void Solve()\n {\n double d = log2sqrt(3475.0, 1000);\n\n d = Math.Log(3475.0, 2.0);\n }\n\n private double log2sqrt(double d, int i)\n {\n if (i < 1)\n return 0;\n\n double res = 1;\n while (Math.Sqrt(d) > 2)\n {\n d = Math.Sqrt(d);\n res = res * 2.0;\n }\n\n return res + log2sqrt(d * 100.0, i - 1) / 10.0;\n }\n\n\n static void Main(string[] args)\n {\n var p = new Program();\n\n p.Solve();\n#if DEBUG\n System.Diagnostics.Debugger.Break();\n#endif\n p.io.Close();\n }\n }\n\n #region MyIo\n class MyIo\n {\n readonly char[] separators = new char[] { ' ', '\\t' };\n\n#if DEBUG\n readonly TextReader inputStream = new StreamReader(\"input.txt\");\n#else\n readonly TextReader inputStream = System.Console.In;\n#endif\n\n readonly TextWriter outputStream = Console.Out;\n \n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n //Console.SetIn(new StreamReader(\"gcd.in\"));\n // Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n //Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n;\n int a;\n int b;\n GetInts(out n, out a, out b);\n int k = n - a;\n int s = 0;\n if (n - (a + b + 1) > 0)\n {\n s = b + 1;\n }\n int answer = k - s;\n Console.WriteLine(answer);\n }\n\n \n \n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static long Vector(long x1, long y1, long x2, long y2, long x3, long y3)\n {\n long ax = x2 - x1;\n long ay = y2 - y1;\n long bx = x3 - x1;\n long by = y3 - y1;\n return ax * by - ay * bx;\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n Console.WriteLine(n-a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace _WastedTime\n{\n\tpublic class Point\n\t{\n\t\tpublic double x;\n\t\tpublic double y;\n\t}\n\n public class ProgramWastedTime\n {\n \tpublic static double Distance(Point p1, Point p2)\n \t{\n \t\tvar xdist = p2.x-p1.x;\n \t\txdist = xdist*xdist;\n \t\tvar ydist = p2.y-p1.y;\n \t\tydist = ydist*ydist;\n\n \t\treturn Math.Sqrt(xdist+ydist);\n \t}\n \n public static void Main(string[] args)\n {\n \tThread.CurrentThread.CurrentUICulture = new CultureInfo(\"en-us\");\n \n \tPoint p1 = null;\n \tPoint p2 = null;\n \n \tdouble total = 0.0;\n \tstring line;\n \tline = Console.ReadLine();\n \tvar parms = line.Split(' ');\n \tvar n = int.Parse(parms[0]);\n \tvar k = double.Parse(parms[1]);\n \twhile ((line = Console.ReadLine()) != null)\n \t{\n \t\tvar point = line.Split(' ');\n \t\tvar p = new Point { x=double.Parse(point[0]), \n \t\t\ty=double.Parse(point[1]) };\n \t\tif (p1 == null)\n \t\t{\n \t\t\tp1 = p;\n \t\t} else {\n \t\t\tp2 = p;\n \t\t\ttotal += Distance(p1, p2);\n \t\t\tp1 = p2;\n \t\t}\n \t}\n \t\tConsole.WriteLine(\"{0:N10}\", (total/50.0)*k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _NumPos\n{\n class ProgramNumPos\n {\n static void GetParams(string input, out int n, out int a, out int b)\n {\n var splitParams = input.Split();\n n = Convert.ToInt32(splitParams[0]);\n a = Convert.ToInt32(splitParams[1]);\n b = Convert.ToInt32(splitParams[2]);\n }\n\n static string Run(string input)\n {\n int n, a, b;\n\n GetParams(input, out n, out a, out b);\n\n return string.Format(\"{0}\", n - a);\n }\n\n static void Main(string[] args)\n {\n var inputs = new List();\n if (args.Length == 0)\n {\n var input = Console.ReadLine();\n inputs.Add(input);\n } else\n {\n var input = string.Empty;\n while (input != \"-1\")\n {\n input = Console.ReadLine();\n if (input != \"-1\") inputs.Add(input); \n }\n }\n\n foreach (var test in inputs)\n {\n Console.WriteLine(Run(test));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n Solve();\n }\n\n private static void Solve()\n {\n var nab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n Console.WriteLine(nab[0] - nab[1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b != n)\n Console.WriteLine(b + 1);\n else\n Console.WriteLine(b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n Console.WriteLine(n-a);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n Console.WriteLine(b + 1);\n }\n }\n}\n"}, {"source_code": "// #using System.Collections.Generic;\nusing System;\n\nnamespace A\n{\n class MainClass\n {\n public static void Main ()\n {\n string[] test = Console.ReadLine ().Split (' ');\n int n = int.Parse (test [0]), a = int.Parse (test [1]), b = int.Parse (test [2]);\n n = n - a;\n if (n > b+1)\n n -= (n - b);\n \n Console.WriteLine (n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0;\n string n = Console.ReadLine();\n string[] a = n.Split(' ');\n k = (int.Parse(a[0]) - int.Parse(a[1])) - (int.Parse(a[0]) - int.Parse(a[1]) - int.Parse(a[1]));\n Console.WriteLine(k+1);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0;\n int ans = 0;\n string n = Console.ReadLine();\n string[] a = n.Split(' ');\n k = int.Parse(a[0]) - int.Parse(a[1]);\n // if (k >= int.Parse(a[1]))\n // ans = k;\n Console.WriteLine(k);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e_\u043f\u043e\u0437\u0438\u0446\u0438\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b > n)\n n = n - a;\n else if (a + b == n)\n n = n - a;\n else\n n = n - b;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e_\u043f\u043e\u0437\u0438\u0446\u0438\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b > n)\n n = n - a;\n else if (a + b == n)\n n = n - a;\n else\n n = n - b;\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e_\u043f\u043e\u0437\u0438\u0446\u0438\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int a = Convert.ToInt32(s[1]);\n int b = Convert.ToInt32(s[2]);\n if (a + b > n)\n n = n - a;\n else if (a + b == n)\n n = n - a;\n else\n n = n - b;\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Text;\n\n\nnamespace Dictionary\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n //string[] input = Console.ReadLine().Split(' ');\n string[] input = \"5 2 3\".Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n int cur = n - a;\n\n Console.WriteLine(cur>b?b+1:cur);\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace _92D2A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n Console.WriteLine(n - a);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var t = Console.ReadLine();\n var tt = t.Split(' ');\n int n = int.Parse(tt[0]);\n int a = int.Parse(tt[1]);\n int b = int.Parse(tt[2]);\n \n Console.Write(Math.Max(a + 1, n - b - 1));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace SimpleProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0].ToString());\n int a = int.Parse(s[1].ToString());\n int b = int.Parse(s[2].ToString());\n\n int k = n - a;\n\n int t = n - b;\n\n\n Console.WriteLine(n - (Math.Max(k,t) - 1));\n\n // Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _4A_watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line= Console.ReadLine();\n string[]tok=line.Split(' ');\n int n=int.Parse(tok[0]),a=int.Parse(tok[1]);\n Console.WriteLine(\"{0}\",n-a);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = s[0];\n int a = s[1];\n int b = s[2];\n int y = n - a + b;\n Console.WriteLine(y);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nab = Console.ReadLine().Split();\n int n = int.Parse(nab[0]);\n int a = int.Parse(nab[1]);\n int b = int.Parse(nab[2]);\n int ans = 0;\n if (a + 1 > n - b)\n ans = n - a;\n else\n ans = b;\n if (ans <= 0)\n Console.WriteLine(\"0\");\n else\n Console.WriteLine(ans.ToString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nab = Console.ReadLine().Split();\n int n = int.Parse(nab[0]);\n int a = int.Parse(nab[1]);\n int b = int.Parse(nab[2]);\n int ans = 0;\n if (a + 1 >= n - b)\n ans = n - a;\n else\n ans = b;\n if (ans <= 0)\n Console.WriteLine(\"0\");\n else\n Console.WriteLine(ans.ToString());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar arr = getList();\n\t\t\tConsole.WriteLine(arr[0] - Max(arr[1], arr[0] - arr[2]));\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _124A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int i=0;\n while (s[0] - (s[1] + i + 1) >=0 && (s[0] - (s[1] + i + 1) <= s[2]))\n { \n i++;\n }\n Console.WriteLine(i);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var n = int.Parse(input[0]);\n var a = int.Parse(input[1]);\n\n Console.WriteLine(n-a);\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { '\\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);\n Console.WriteLine(int.Parse(input[0]) - int.Parse(input[1]));\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int p = nums[0];\n int bef = nums[1];\n int aft = nums[2];\n\n int ans = (p - bef + aft) > p ? p - bef : aft + 1;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int p = nums[0];\n int bef = nums[1];\n int aft = nums[2];\n\n int ans = (bef + aft) > p ? p - bef : aft + 1;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int p = nums[0];\n int bef = nums[1];\n int aft = nums[2];\n\n Console.WriteLine(p - bef);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] arrInput = Console.ReadLine().Split(' ').Select(x => Convert.ToByte(x)).ToArray();\n Console.WriteLine(arrInput[0] - arrInput[1]); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte[] arrInput = Console.ReadLine().Split(' ').Select(x => Convert.ToByte(x)).ToArray();\n Console.WriteLine((arrInput[0] - arrInput[1] - 1) > arrInput[2] ? (arrInput[0] - arrInput[1] - 1) : (arrInput[0] - arrInput[1])); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(a[0] - a[1]);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program{ \n static void Main() {\n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine(s[0] - s[2] - s[1]);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.The_number_of_positions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n Console.WriteLine(n - a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n long n = Int64.Parse(input[0]);\n long a = Int64.Parse(input[1]);\n long b = Int64.Parse(input[2]);\n\n long output = n - a;\n Console.WriteLine(output.ToString());\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace MTests\n{\n static class Program {\n\n internal static void MyMain()\n {\n \n var ints = RInts();\n\n WLine(ints[0]-ints[1]);\n\n }\n\n static void Main(string[] args)\n {\n\n#if !HOME\n MyMain();\n#else\n Secret.MyMain();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static string[] RLine(string separator = \" \")\n {\n return Console.ReadLine().Split(new string[] { separator }, StringSplitOptions.None);\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n public static void WLine(IEnumerable list) {\n if (list is string)\n {\n Console.WriteLine(list);\n }\n else {\n Console.WriteLine(string.Join(\" \", list));\n }\n\n \n }\n\n public static void WLine(params object[] s)\n {\n Console.WriteLine(string.Join(\" \",s));\n }\n\n public static void WLine(object s)\n {\n Console.WriteLine(s);\n }\n #endregion\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace The_number_of_positions\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int a = Next() + 1;\n int b = Next();\n int pos = Math.Max(a, n - b - 1);\n\n writer.WriteLine(n - pos + 1);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(data[0]);\n int b = Convert.ToInt32(data[1]);\n int c = Convert.ToInt32(data[2]);\n\n Console.WriteLine(a - b);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n var q = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n \n Console.WriteLine(q[0] - q[1]);\n \n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n var q = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n if (q[0] - q[1] > q[2])\n Console.WriteLine(q[0] - q[1]);\n else\n Console.WriteLine(q[2]);\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var t=read().ToIntA();\n int n=t[0],a=t[1],b=t[2];\n \n var x=n-a;\n write((x<=b)?x:x-b);\n }\n}\n\n\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n \n public static int[] ToIntA(this string s)\n {\n return SplitBySpace(s).Select(ToInt).ToArray();\n }\n \n public static string[] SplitBySpace(this string s)\n {\n return s.Split(new[]{\" \"},StringSplitOptions.RemoveEmptyEntries);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _41a\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n if((a-b)==1)\n {\n Console.WriteLine((n-a)-1);\n }\n else Console.WriteLine(n-a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace broze\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (n[1] == 0 &&n[2]!=0)\n {\n Console.WriteLine(n[0] - n[2] + 1);\n }\n else if (n[1] == 0 && n[2] == 0)\n {\n Console.WriteLine(n[0]);\n }\n else\n {\n Console.WriteLine(n[0] - n[1]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n\n int posCount = n - a;\n\n Console.WriteLine(b < posCount - 1 ? posCount - b : posCount);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int c = n - a;\n if (c-1 > b)\n {\n Console.WriteLine(c - b);\n }\n else\n {\n Console.WriteLine(c);\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n int c = a - b;\n if (c > b)\n {\n Console.WriteLine(c - b);\n }\n else\n {\n Console.WriteLine(b);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.Write(mass[0] - mass[1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int count = 0;\n for(int i = mass[1]; i < mass[0]; i++)\n {\n if (mass[0] - i <= mass[1]) count++;\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem124A {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n int peopleInLine = Convert.ToInt32(input[0]);\n int inFront = Convert.ToInt32(input[1]);\n int behind = Convert.ToInt32(input[2]);\n\n int positions = peopleInLine - inFront;\n Console.WriteLine(positions);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string[] arr1 = a.Split(' ');\n int sub = int.Parse(arr1[0]) - int.Parse(arr1[1]);\n while (sub == (int.Parse(arr1[2])) + 1) sub--;\n Console.Write(sub);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string[] arr1 = a.Split(' ');\n int sub = int.Parse(arr1[0]) - int.Parse(arr1[1]);\n Console.Write(sub);\n }\n }\n}\n"}], "src_uid": "51a072916bff600922a77da0c4582180"} {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n, m, a, b;\n ReadInt(out n, out m, out a, out b);\n int res = 0;\n if (a*m > b)\n {\n res += (n / m) * b;\n int tmp = n % m;\n if (tmp * a <= b) res += tmp * a; else res += b;\n }\n else\n {\n res = n * a;\n }\n WL(res);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n int a = Next();\n int b = Next();\n int ans = 0;\n int d = a * m > b ? n / m : 0;\n ans += d * b;\n n -= d * m;\n ans += Math.Min(n * a, ((n / m) + 1) * b);\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int a = ReadInt();\n int b = ReadInt();\n\n int ans = int.MaxValue;\n for (int i = 0; ; i++)\n {\n ans = Math.Min(ans, i * b + Math.Max(0, n - i * m) * a);\n if (i * m > n)\n break;\n }\n\n return ans;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int min = Math.Min(mass[0]* mass[2], mass[0]/mass[1]*mass[3] + mass[0] % mass[1]*mass[2]);\n Console.Write(Math.Min(min, (Math.Ceiling((double)mass[0] / (double)mass[1])) * mass[3]));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem466A {\n class Program {\n static void Main(string[] args) {\n string[] input1 = Console.ReadLine().Split(' ');\n int numberOfRides = Convert.ToInt32(input1[0]);\n int numberOfRidesInMticket = Convert.ToInt32(input1[1]);\n int priceOfOneRideTicket = Convert.ToInt32(input1[2]);\n int priceOfMRideTicket = Convert.ToInt32(input1[3]);\n\n int priceUsingOnlyOneRideTicket = numberOfRides * priceOfOneRideTicket;\n\n int mRides = numberOfRides / numberOfRidesInMticket;\n int mRidesRest = numberOfRides % numberOfRidesInMticket;\n \n int priceUsingMRidesAndRest = 0;\n int priceUsingOnlyMRides = 0;\n if (mRidesRest != 0) {\n priceUsingMRidesAndRest = mRides * priceOfMRideTicket + mRidesRest * priceOfOneRideTicket;\n priceUsingOnlyMRides = (mRides + 1) * priceOfMRideTicket;\n } else {\n priceUsingMRidesAndRest = mRides * priceOfMRideTicket;\n priceUsingOnlyMRides = mRides * priceOfMRideTicket;\n }\n\n int minPrice = Math.Min(priceUsingOnlyOneRideTicket, Math.Min(priceUsingMRidesAndRest, priceUsingOnlyMRides));\n\n Console.WriteLine(minPrice);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439_\u043f\u0440\u043e\u0435\u0437\u0434\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Resh(mas));\n Console.ReadLine();\n\n }\n\n static int Resh(int[] mas)\n {\n int n = mas[0];\n int m = mas[1];\n int a = mas[2];\n int b = mas[3];\n\n if (m * a > b)\n {\n if ((n % m) * a <= b)\n return (n / m) * b + (n % m) * a;\n else\n return (n / m) * b + b;\n }\n else\n return n * a;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Competitions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = Convert.ToInt32(input.Split(' ')[0]);\n int m = Convert.ToInt32(input.Split(' ')[1]);\n int a = Convert.ToInt32(input.Split(' ')[2]);\n int b = Convert.ToInt32(input.Split(' ')[3]);\n int min = 0;\n while (n != 0)\n {\n if ((n >= m && b <= a * m) || ( n < m && b < a) ||( n < m && b < n) )\n {\n min += b;\n if (n - m < 0)\n n = 0;\n else\n n -= m;\n }\n else\n {\n min += a;\n n -= 1;\n }\n\n }\n Console.WriteLine(min);\n }\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n void Solve()\n {\n var n = _.NextInt();\n var m = _.NextInt();\n var a = _.NextInt();\n var b = _.NextInt();\n _.WriteLine(Answer(n, m, a, b));\n\n }\n\n private int Answer(int n, int m, int a, int b)\n {\n if (b > a * m) return n * a;\n var ans = (n / m) * b;\n n -= (n / m) * m;\n ans += Math.Min(b, n*a);\n return ans;\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Xml.XmlConfiguration;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int n = int.Parse(str.Split(' ')[0]);\n int m = int.Parse(str.Split(' ')[1]);\n int a = int.Parse(str.Split(' ')[2]);\n int b = int.Parse(str.Split(' ')[3]);\n\n List intList = new List();\n\n int t = n / m;\n int tost = n % m;\n double tbs = Math.Ceiling((double) n / m);\n\n int result1 = t * b + tost * a;\n int result2 = (int) (tbs * b);\n int result3 = n * a;\n\n intList.Add(result1);\n intList.Add(result2);\n intList.Add(result3);\n\n int result = intList.Min();\n\n Console.WriteLine(result);\n \n }\n\n }\n}"}, {"source_code": "using System;\n\npublic class CheapTravel {\n\n\tpublic static void Main(string[] args){\n\t\t\n\t\tvar input = Console.ReadLine().Split();\n\t\tvar n = int.Parse(input[0]);\n\t\tvar m = int.Parse(input[1]);\n\t\tvar a = int.Parse(input[2]);\n\t\tvar b = int.Parse(input[3]);\n\t\t\n\t\tif(a <= ((float)b / (float)m))\n\t\t{\n\t\t\tConsole.Write(n * a);\n\t\t}\n\t\telse {\n\t\t\tvar total = 0;\n\t\t\t\n\t\t\twhile(n > 0){\n\t\t\t\t\n\t\t\t if((n-m) < 0)\n\t\t\t {\n\t\t\t\t Console.Write(Math.Min(total + b, total + (n * a)));\n\t\t\t\t return;\n\t\t\t }\n\t\t\t \n\t\t\t total += (b);\n \t\t n -= m;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.Write(total);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n\n \n\n static void Main(string[] args)\n {\n int n = 0, m = 0,a=0,b=0;\n\n ReadInts(ref n, ref m, ref a, ref b);\n\n int w1 = n * a;\n int w2 = (int)Math.Ceiling((double)(n) / (double)m) * b;\n int w3 = (n / m) * b + (n % m) * a;\n\n PrintLn(MyMin(w1, w2, w3));\n\n\n\n }\n\n \n\n }\n\n\n\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace challenges\n{\n class Program\n {\n\n static int N, M, A, B;\n static int res;\n static string[] phr;\n\n static void Main()\n {\n phr = Console.ReadLine().Split();\n\n N = Convert.ToInt32(phr[0]);\n M = Convert.ToInt32(phr[1]);\n A = Convert.ToInt32(phr[2]);\n B = Convert.ToInt32(phr[3]);\n\n if (M * A <= B)\n {\n Console.WriteLine(N * A);\n return;\n }\n \n res += (N / M) * B;\n N %= M;\n res += Math.Min(N * A, B);\n\n Console.WriteLine(res);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TestPlace\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = Console.ReadLine();\n var z = t.Split(' ');\n int[] g = new int[4];\n for(var i=0;i lines = new List ( );\n int idx=0;\n public void ReadAll ( )\n {\n while ( true )\n {\n string line = Console.ReadLine ( );\n if ( line == null )\n break;\n lines.AddRange ( line.Split ( ' ' ) );\n }\n }\n\n public string ReadNextString ( )\n {\n return lines[idx++];\n }\n\n public int ReadNextInt ( )\n {\n return int.Parse ( lines[idx++] );\n }\n\n public long ReadNextLong ( )\n {\n return long.Parse ( lines[idx++] );\n }\n\n public double ReadNextDouble ( )\n {\n return double.Parse ( lines[idx++] );\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int n, m, a, b;\n string[] strin1 = str1.Split(' ');\n n = int.Parse(strin1[0]);\n m = int.Parse(strin1[1]);\n a = int.Parse(strin1[2]);\n b = int.Parse(strin1[3]);\n int sumbil = n * a;\n if ((m > n) && (b <= sumbil))\n {\n Console.WriteLine(b);\n }\n if ((m > n) && (b >= sumbil))\n {\n Console.WriteLine(sumbil);\n }\n if (n / m == 1) \n { if ((b + (n - m) * a <= sumbil))\n { Console.WriteLine(b + (n - m) * a); }\n else { Console.WriteLine(sumbil); }\n }\n if (n / m > 1) {\n if (b >= a)\n {\n if ((b * (n / m) + (n - m * (n / m)) * a <= sumbil))\n { Console.WriteLine(b * (n / m) + (n - m * (n / m)) * a); }\n else { Console.WriteLine(sumbil); }\n }\n else\n {\n if (n % m > 0) { Console.WriteLine(((n / m) + 1) * b); }\n else { Console.WriteLine((n / m) * b); }\n \n }\n\n }\n\n Console.ReadLine();\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication23\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n \n\n\n\n string str = Console.ReadLine();\n string[] str2 = str.Split(' ');\n \n int counter = int.Parse(str2[0]);\n int answer = 0;\n if (int.Parse(str2[0]) * int.Parse(str2[2]) < int.Parse(str2[3]) || int.Parse(str2[0]) > int.Parse(str2[1]))\n {\n while (int.Parse(str2[1]) < counter)\n {\n answer = answer + int.Parse(str2[3]);\n counter = counter - int.Parse(str2[1]);\n }\n \n if (counter < 0)\n counter = 0;\n\n if (int.Parse(str2[2]) < int.Parse(str2[3]) || counter == 0)\n {\n answer = answer + int.Parse(str2[2]) * counter;\n }\n else\n {\n answer = answer + int.Parse(str2[3]);\n }\n }\n else\n answer = answer + int.Parse(str2[3]);\n if(answer int.Parse(x.ToString())).ToArray();\n int n = E[0] , m = E[1], a = E[2], b = E[3];\n int FirstStep = a * n;\n int SecondStep = -345;\n if (n % m == 0)\n {\n SecondStep = n / m * b;\n }\n\n int ThirdStep = -345;\n\n int d = n % m, N = n;\n N -= d;\n ThirdStep = N / m * b; ThirdStep += (d * a);\n\n int ForthStep = -345;\n\n ForthStep = (int)Math.Ceiling(Convert.ToDouble(n) / Convert.ToDouble(m)) * b;\n\n var D = new int[] { FirstStep, SecondStep, ThirdStep,ForthStep }.Where(x=>x!=-345).Min();\n Console.WriteLine(D);\n }\n \n private static IEnumerable Permutate(string source)\n {\n if (source.Length == 1) return new List { source };\n\n var permutations = from c in source\n from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n select c + p;\n\n return permutations;\n }\n\n\n}\n\n\n\n\n\n//private static IEnumerable Permutate(string source)\n//{\n// if (source.Length == 1) return new List { source };\n\n// var permutations = from c in source\n// from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n// select c + p;\n\n// return permutations;\n//}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace mainnm\n{\n class main\n {\n static int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n struct Notebook {\n public int price;\n public int quality;\n }\n \n static void Main()\n {\n int[] ts = Console.ReadLine().Split(' ').Select(num => Int32.Parse(num)).ToArray();\n \n int n = ts[0];\n int m = ts[1];\n int a = ts[2];\n int b = ts[3];\n \n if (((float)b)/m > a) {\n Console.WriteLine(n * a);\n } else {\n int ost = n % m;\n int sum = (n / m) * b;\n \n if (ost * a > b) {\n sum += b;\n } else {\n sum += ost * a;\n }\n \n Console.WriteLine(sum);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CheapTravel\n{\n public class Solution\n {\n static int Expenditure(int n, int m, int a, int b)\n {\n if (a * m > b)\n {\n if (m <= n)\n {\n if ((n % m) * a < b)\n return ((n / m) * b + (n % m) * a);\n else\n return ((n / m + 1) * b);\n }\n else\n {\n if (n * a < b)\n return n * a;\n else\n return b;\n }\n }\n else\n return a * n;\n }\n\n static void Main(String[] args)\n {\n string s = Console.ReadLine();\n string[] split = s.Split(' ');\n\n Console.Write(Expenditure(int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]), int.Parse(split[3])));\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _466A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int m = int.Parse(tokens[1]);\n int a = int.Parse(tokens[2]);\n int b = int.Parse(tokens[3]);\n\n int[] result = new int[n + 1];\n result[0] = 0;\n\n for (int i = 1; i <= n; i++)\n {\n result[i] = result[i - 1] + a;\n\n if ((i >= m ? result[i - m] : 0) + b < result[i])\n {\n result[i] = (i >= m ? result[i - m] : 0) + b;\n }\n }\n\n Console.WriteLine(result[n]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Main\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int a = int.Parse(s[2]);\n int b = int.Parse(s[3]);\n int t = b <= m * a ? (n / m * b + Math.Min(n % m * a, b)) : (n * a);\n Console.Write(t);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] input = Console.ReadLine().Split(\" \");\n int numRides = Convert.ToInt32(input[0]);\n int multiRideCount = Convert.ToInt32(input[1]);\n int singleRideCost = Convert.ToInt32(input[2]);\n int multiRideCost = Convert.ToInt32(input[3]);\n bool isSingleRideCheaper = (singleRideCost < (double)(multiRideCost) / (double)(multiRideCount));\n int totalCost = 0;\n\n if (isSingleRideCheaper)\n Console.WriteLine(numRides * singleRideCost);\n else\n {\n while (numRides > 0)\n {\n if (numRides >= multiRideCount)\n {\n totalCost += multiRideCost;\n numRides -= multiRideCount;\n }\n else if (multiRideCost < singleRideCost*numRides)\n {\n totalCost += multiRideCost;\n numRides = 0;\n }\n else\n {\n totalCost += singleRideCost * numRides;\n numRides = 0;\n }\n }\n Console.WriteLine(totalCost);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n private static string readString() => Console.ReadLine();\n private static T readValue() => (T)Convert.ChangeType(readString(), typeof(T));\n private static string[] readStrings(char delimiter = ' ') => readString().Split(delimiter);\n private static T[] readValues(char delimiter = ' ') => readStrings(delimiter: delimiter).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();\n private static void write(T s) => Console.WriteLine(s);\n\n private static int binarySearch(List list, T target) where T : IComparable\n {\n int l = 0, r = list.Count - 1;\n while (l <= r)\n {\n var m = (int)Math.Floor((double)(l + r) / 2);\n if (list[m].CompareTo(target) <= 0)\n if (m == r || list[m + 1].CompareTo(target) > 0)\n return m;\n else\n l = m + 1;\n else\n r = m - 1;\n }\n return -1;\n }\n\n private static int quickSortPartition(List list, int left, int right) where T : IComparable\n {\n T pivot = list[left];\n while (true)\n {\n while (list[left].CompareTo(pivot) < 0)\n left++;\n while (list[right].CompareTo(pivot) > 0)\n right--;\n if (left < right)\n {\n if (list[left].CompareTo(list[right]) == 0)\n return right;\n\n T temp = list[left];\n list[left] = list[right];\n list[right] = temp;\n }\n else\n return right;\n }\n }\n private static void quickSort(List list, int left, int right) where T : IComparable\n {\n if (left < right)\n {\n int pivot = quickSortPartition(list, left, right);\n if (pivot > 1)\n quickSort(list, left, pivot - 1);\n if (pivot + 1 < right)\n quickSort(list, pivot + 1, right);\n }\n }\n private static void quickSort(List list) where T : IComparable => quickSort(list, 0, list.Count - 1);\n\n private static void watermelon()\n {\n var w = readValue();\n write(w >= 4 && w % 2 == 0 ? \"YES\" : \"NO\");\n }\n private static void wayTooLongWords()\n {\n var words = new List();\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n words.Add(readString());\n\n foreach (var word in words)\n write(word.Length <= 10 ? word : $\"{word.First()}{word.Length - 2}{word.Last()}\");\n }\n private static void team()\n {\n int solve = 0;\n\n var n = readValue();\n for (int i = 0; i < n; ++i)\n if (readValues().Where(x => x == 1).Count() > 1)\n ++solve;\n\n write(solve);\n }\n private static void football()\n {\n var positions = readString();\n for (int i = 6; i < positions.Length; ++i)\n if (positions.Substring(i - 6, 6) == (positions[i] == '0' ? \"000000\" : \"111111\"))\n {\n write(\"YES\");\n return;\n }\n write(\"NO\");\n }\n private static void theatreSquare()\n {\n var sizes = readValues();\n write((long)Math.Ceiling((double)sizes[0] / (double)sizes[2]) * (long)Math.Ceiling((double)sizes[1] / (double)sizes[2]));\n }\n private static void stringTask()\n {\n var Vowels = new HashSet { 'a', 'o', 'y', 'e', 'u', 'i' };\n var sb = new StringBuilder();\n var s = readString().ToLower();\n foreach (var c in s)\n if (!Vowels.Contains(c))\n {\n sb.Append('.');\n sb.Append(c);\n }\n\n write(sb.ToString());\n }\n private static void taxi()\n {\n int taxis = 0;\n var groups = new Dictionary { { 1, 0 }, { 2, 0 }, { 3, 0 } };\n\n readValue();\n var groupSizes = readValues();\n foreach (var size in groupSizes)\n if (size == 4)\n ++taxis;\n else\n groups[size] = groups[size] + 1;\n\n taxis += groups[3];\n groups[1] = groups[1] - Math.Min(groups[1], groups[3]);\n\n taxis += groups[2] / 2;\n if (groups[2] % 2 == 1)\n {\n ++taxis;\n groups[1] = groups[1] - 2;\n }\n\n if (groups[1] > 0)\n taxis += (int)Math.Ceiling((double)groups[1] / 4.0);\n\n write(taxis);\n }\n private static void fancyFence()\n {\n var a = readValue();\n for (double i = 3.0; ; i += 1.0)\n {\n var x = (double)(i - 2.0) * 180.0 / i;\n if (a <= x)\n {\n write(a < x ? \"NO\" : \"YES\");\n break;\n }\n }\n }\n private static void interestingDrink()\n {\n readString();\n var prices = readValues().OrderBy(x => x).ToList();\n var days = readValue();\n for (int i = 0; i < days; ++i)\n write(binarySearch(prices, readValue()) + 1);\n }\n private static void compilationErrors()\n {\n readString();\n Dictionary errors = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count()), errors1 = new Dictionary();\n foreach (var error in readValues())\n {\n if (errors[error] > 1)\n errors[error] = errors[error] - 1;\n else\n errors.Remove(error);\n\n if (errors1.TryGetValue(error, out var count))\n errors1[error] = count + 1;\n else\n errors1.Add(error, 1);\n }\n write(errors.First().Key);\n\n foreach (var error in readValues())\n if (errors1[error] > 1)\n errors1[error] = errors1[error] - 1;\n else\n errors1.Remove(error);\n write(errors1.First().Key);\n }\n private static void doubleCola()\n {\n var idToName = new Dictionary { { 0, \"Sheldon\" }, { 1, \"Leonard\" }, { 2, \"Penny\" }, { 3, \"Rajesh\" }, { 4, \"Howard\" } };\n int n = readValue(), i = 1;\n for (; n > i * 5; i *= 2)\n n -= i * 5;\n write(idToName[(n - 1) / i]);\n }\n private static void ilyaAndQueries()\n {\n var dic = new Dictionary();\n var list = new List>();\n\n var s = readString();\n int start = 0, dicStart = 0;\n for (int j = 0; j < s.Length - 1; ++j)\n if (s[j] != s[j + 1])\n {\n if (start < j)\n {\n list.Add(new Tuple(start + 1, j + 1));\n for (; dicStart < j + 1; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n start = j + 1;\n }\n if (start < s.Length - 1)\n {\n list.Add(new Tuple(start + 1, s.Length));\n for (; dicStart < s.Length; ++dicStart)\n dic.Add(dicStart, list.Count - 1);\n }\n\n var m = readValue();\n for (int j = 0; j < m; ++j)\n {\n var q = readValues();\n int l = q[0], r = q[1], result = 0;\n if (dic.TryGetValue(l, out var i))\n for (; i < list.Count && r >= list[i].Item1; ++i)\n if (l < list[i].Item2)\n result += Math.Min(r, list[i].Item2) - Math.Max(l, list[i].Item1);\n write(result);\n }\n }\n private static void twoTeamsComposing()\n {\n var n = readValue();\n var skills = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n }\n #region Laptop\n private class Laptop\n {\n internal int Price { get; private set; }\n internal int Quality { get; private set; }\n internal Laptop(int[] values)\n {\n Price = values[0];\n Quality = values[1];\n }\n }\n private class Laptop_Comparer_Price : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Price - y.Price;\n }\n private class Laptop_Comparer_Quality : Comparer\n {\n public override int Compare([AllowNull] Laptop x, [AllowNull] Laptop y) => x.Quality - y.Quality;\n }\n private static void laptops()\n {\n List prices = new List(), qualities = new List();\n var n = readValue();\n for (int i = 0; i < n; ++i)\n {\n var laptop = new Laptop(readValues());\n prices.Add(laptop);\n qualities.Add(laptop);\n }\n\n for (int i = 0; i < n; ++i)\n if (prices[i] != qualities[i])\n {\n write(\"Happy Alex\");\n return;\n }\n write(\"Poor Alex\");\n }\n #endregion\n private static void fence()\n {\n int k = readValues()[1], minI = 0, currentH = 0;\n int[] h = readValues();\n\n for (int i = 0; i < k; ++i)\n currentH += h[i];\n var minH = currentH;\n\n for (int i = 1; i < h.Length - k + 1; ++i)\n {\n currentH = currentH - h[i - 1] + h[i + k - 1];\n if (minH > currentH)\n {\n minH = currentH;\n minI = i;\n }\n }\n\n write(minI + 1);\n }\n #region serejaAndSuffixes\n private class SerejaL : IComparable\n {\n internal int L { get; private set; }\n internal int Result;\n internal SerejaL(int l)\n {\n L = l;\n }\n\n public int CompareTo(object obj) => L - ((SerejaL)obj).L;\n }\n private static void serejaGetLs(int m, out List listDistinct, out List listOrdered)\n {\n listDistinct = new List();\n listOrdered = new List();\n var dic = new Dictionary();\n for (int i = 0; i < m; ++i)\n {\n var l = readValue() - 1;\n if (!dic.TryGetValue(l, out var item))\n {\n item = new SerejaL(l);\n dic.Add(l, item);\n listDistinct.Add(item);\n }\n listOrdered.Add(item);\n }\n quickSort(listDistinct);\n }\n private static void serejaAndSuffixes()\n {\n var m = readValues()[1];\n var a = readValues();\n serejaGetLs(m, out var listDistinct, out var listOrdered);\n\n var distinct = new HashSet();\n for (int i = listDistinct.Count - 1, j = a.Length - 1; i >= 0; --i)\n {\n for (; j >= listDistinct[i].L; --j)\n if (!distinct.Contains(a[j]))\n distinct.Add(a[j]);\n\n listDistinct[i].Result = distinct.Count;\n }\n\n foreach (var item in listOrdered)\n write(item.Result);\n }\n #endregion\n private static void bowWowTimetable()\n {\n string s = readString(), r = \"1\";\n int i = 1;\n for (; r.Length < s.Length; ++i, r = r + \"00\") ;\n if (r.Length > s.Length || !s.Substring(1).Contains('1'))\n write(i - 1);\n else\n write(i);\n }\n private static void digits()\n {\n readString();\n var numbers = readValues().GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());\n if (!numbers.ContainsKey(0))\n {\n write(-1);\n return;\n }\n }\n private static void lifeWithoutZeros()\n {\n long a = readValue(), b = readValue(), c = a + b;\n write(Convert.ToInt64(a.ToString().Replace(\"0\", \"\")) + Convert.ToInt64(b.ToString().Replace(\"0\", \"\")) == Convert.ToInt64(c.ToString().Replace(\"0\", \"\")) ? \"YES\" : \"NO\");\n }\n private static void permutation()\n {\n var n = readValue();\n var a = readValues();\n write(n - a.Where(x => x <= n).Distinct().Count());\n }\n private static void hamsterFarm()\n {\n var n = readValues()[0];\n var k = readValues();\n int bestI = 0;\n for (int i = 1; i < k.Length; ++i)\n if (n % k[i] < n % k[bestI])\n bestI = i;\n write($\"{bestI + 1} {n / k[bestI]}\");\n }\n private static void shellGame()\n {\n int n = readValue(), x = readValue();\n if (x == 1)\n {\n if (n % 2 == 1)\n x = 0;\n else\n x = 2;\n --n;\n }\n for (int i = n % 6; i > 0; --i)\n if (i % 2 == 1)\n {\n if (x == 0)\n x = 1;\n else if (x == 1)\n x = 0;\n }\n else if (x == 1)\n x = 2;\n else if (x == 2)\n x = 1;\n write(x);\n }\n private static void ACM_ICPC()\n {\n int[] a = readValues(), score = new int[2], members = new int[2];\n for (int i1 = 0; i1 < 2; ++i1)\n {\n score[i1] = a[0];\n members[i1] = 1;\n for (int i2 = 0; i2 < 2; ++i2)\n {\n score[i2] += a[1];\n members[i2] += 1;\n for (int i3 = 0; i3 < 2; ++i3)\n {\n score[i3] += a[2];\n members[i3] += 1;\n for (int i4 = 0; i4 < 2; ++i4)\n if (members[i4] < 3)\n {\n score[i4] += a[3];\n members[i4] += 1;\n for (int i5 = 0; i5 < 2; ++i5)\n if (members[i5] < 3)\n {\n score[i5] += a[4];\n members[i5] += 1;\n for (int i6 = 0; i6 < 2; ++i6)\n if (members[i6] < 3)\n {\n score[i6] += a[5];\n members[i6] += 1;\n if (score[0] == score[1])\n {\n write(\"YES\");\n return;\n }\n score[i6] -= a[5];\n members[i6] -= 1;\n }\n score[i5] -= a[4];\n members[i5] -= 1;\n }\n score[i4] -= a[3];\n members[i4] -= 1;\n }\n score[i3] -= a[2];\n members[i3] -= 1;\n }\n score[i2] -= a[1];\n members[i2] -= 1;\n }\n score[i1] = 0;\n members[i1] = 0;\n }\n write(\"NO\");\n }\n private static void mex()\n {\n var x = readValues()[1];\n var n = readValues();\n write(x - n.Count(y => y < x) + (n.Contains(x) ? 1 : 0));\n }\n private static void minimumProduct()\n {\n var input = readValues();\n int a = input[0], b = input[1], x = input[2], y = input[3], n = input[4], minA = Math.Min(a - x, n), minB = Math.Min(b - y, n);\n if (a - minA <= b - minB)\n {\n a -= minA;\n n -= minA;\n }\n else\n {\n b -= minB;\n n -= minB;\n }\n\n if (n > 0)\n if (a > x)\n a -= Math.Min(a - x, n);\n else if (b > y)\n b -= Math.Min(b - y, n);\n\n write((long)a * (long)b);\n }\n private static void shovelsAndSwords()\n {\n var input = readValues();\n int a = input[0], b = input[1], result = 0;\n if (a > b)\n {\n var min = Math.Min(a - b, b);\n a -= min * 2;\n b -= min;\n result += min;\n }\n else if (b > a)\n {\n var min = Math.Min(b - a, a);\n a -= min;\n b -= min * 2;\n result += min;\n }\n int d = Math.Min(a / 3, b / 3);\n a -= d * 3;\n b -= d * 3;\n result += d * 2;\n if (a > 0 && b > 0 && (a > 1 || b > 1))\n ++result;\n write(result);\n }\n private static void matrixGame()\n {\n var input = readValues();\n int n = input[0], m = input[1];\n HashSet claimedRows = new HashSet(), claimedColumns = new HashSet();\n for (int i = 0; i < n; ++i)\n {\n input = readValues();\n for (int j = 0; j < m; ++j)\n if (input[j] == 1)\n {\n if (!claimedRows.Contains(i))\n claimedRows.Add(i);\n if (!claimedColumns.Contains(j))\n claimedColumns.Add(j);\n }\n }\n write(Math.Min(n - claimedRows.Count, m - claimedColumns.Count) % 2 == 0 ? \"Vivek\" : \"Ashish\");\n }\n private static void cinemaLine()\n {\n readString();\n var clerk = new Dictionary { { 25, 0 }, { 50, 0 } };\n foreach (var a in readValues())\n switch (a)\n {\n case 25:\n clerk[25] += 1;\n break;\n case 50:\n if (clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] += 1;\n }\n else\n {\n write(\"NO\");\n return;\n }\n break;\n default: // 100\n if (clerk[50] > 0 && clerk[25] > 0)\n {\n clerk[25] -= 1;\n clerk[50] -= 1;\n }\n else if (clerk[25] > 2)\n clerk[25] -= 3;\n else\n {\n write(\"NO\");\n return;\n }\n break;\n }\n write(\"YES\");\n }\n private static void kindAnton()\n {\n readString();\n int[] a = readValues(), b = readValues();\n bool positive1 = false, negative1 = false;\n HashSet positive = new HashSet(), negative = new HashSet();\n for (int i = 0; i < a.Length; ++i)\n {\n int diff = b[i] - a[i];\n if (((diff > 0 && !positive1) || (diff < 0 && !negative1)) && !(diff > 0 ? positive : negative).Any(x => diff % x == 0))\n {\n write(\"NO\");\n return;\n }\n if (a[i] > 0)\n {\n if (!positive1)\n if (a[i] == 1)\n {\n positive1 = true;\n if (negative1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!positive.Contains(a[i]))\n positive.Add(a[i]);\n }\n else if (a[i] < 0 && !negative1)\n if (a[i] == -1)\n {\n negative1 = true;\n if (positive1)\n {\n write(\"YES\");\n return;\n }\n }\n else if (!negative.Contains(a[i]))\n negative.Add(a[i]);\n }\n write(\"YES\");\n }\n private static void staircases()\n {\n var input = readValues();\n int n = input[0], mn = input[1];\n if (mn == 0)\n {\n write(\"YES\");\n return;\n }\n var m = readValues().OrderBy(x => x).ToList();\n if (m[0] == 1 || m[m.Count - 1] == n)\n {\n write(\"NO\");\n return;\n }\n for (int i = 0; i < m.Count - 2; ++i)\n if (m[i] == m[i + 1] - 1 && m[i] == m[i + 2] - 2)\n {\n write(\"NO\");\n return;\n }\n write(\"YES\");\n }\n private static void blownGarland()\n {\n var colors = new Dictionary { { 'R', 0 }, { 'Y', 0 }, { 'B', 0 }, { 'G', 0 } };\n var s = readString();\n\n var colorPerPosition = new char[4];\n foreach (var color in colors)\n colorPerPosition[s.IndexOf(color.Key) % 4] = color.Key;\n\n for (int i = 0; i < s.Length; ++i)\n if (s[i] == '!')\n colors[colorPerPosition[i % 4]] += 1;\n\n write($\"{colors['R']} {colors['B']} {colors['Y']} {colors['G']}\");\n }\n private static void mikeAndFax()\n {\n var s = readString();\n int k = readValue();\n\n if (s.Length % k != 0)\n {\n write(\"NO\");\n return;\n }\n\n int size = s.Length / k;\n for (int i = 0; i < s.Length; i += size)\n for (int j1 = i + size / 2 - 1, j2 = i + size / 2 + size % 2; j1 >= i; --j1, ++j2)\n if (s[j1] != s[j2])\n {\n write(\"NO\");\n return;\n }\n\n write(\"YES\");\n }\n #region weirdRounding\n private static bool weirdRounding_Recursion(string ns, int kp, int d)\n {\n if (d > 0)\n for (int i = ns[1] == '0' && ns.Length > 2 ? 1 : 0; i < ns.Length; ++i)\n {\n string nsNew = ns.Remove(i, 1);\n int n = Convert.ToInt32(nsNew);\n if (n % kp == 0 || weirdRounding_Recursion(nsNew, kp, d - 1))\n return true;\n }\n return false;\n }\n private static void weirdRounding()\n {\n var input = readStrings();\n string ns = input[0];\n int n = Convert.ToInt32(ns), k = Convert.ToInt32(input[1]), kp = (int)Math.Pow(10, k);\n\n if (n < kp)\n write(ns.Length - 1);\n else if (n % kp == 0)\n write(0);\n else\n for (int d = 1; d < ns.Length; ++d)\n if (weirdRounding_Recursion(ns, kp, d))\n {\n write(d);\n return;\n }\n }\n #endregion\n private static void wilburArray()\n {\n readString();\n int[] b = readValues();\n long result = Math.Abs(b[0]);\n for (int i = 1; i < b.Length; ++i)\n result += Math.Abs(b[i] - b[i - 1]);\n write(result);\n }\n private static void zuhairStrings()\n {\n int k = readValues()[1];\n var s = readString();\n var result = new Dictionary();\n\n for (int i = 0; i < s.Length - k + 1;)\n {\n int j = i + 1;\n for (; j < i + k && s[i] == s[j]; ++j) ;\n if (j == i + k)\n if (!result.ContainsKey(s[i]))\n result.Add(s[i], 1);\n else\n result[s[i]] += 1;\n i = j;\n }\n\n write(result.Count > 0 ? result.Max(x => x.Value) : 0);\n }\n private static void artfulExpedient()\n {\n var n = readValue();\n int[] x = readValues(), y = readValues();\n var numbers = x.Union(y).ToHashSet();\n var resultEven = true;\n\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < n; ++j)\n if (numbers.Contains(x[i] ^ y[j]))\n resultEven = !resultEven;\n\n write(resultEven ? \"Karen\" : \"Koyomi\");\n }\n private static void ebonyIvory()\n {\n var input = readValues();\n int a = input[0], b = input[1], c = input[2];\n if (a < b)\n {\n var t = a;\n a = b;\n b = t;\n }\n for (; c >= 0; c -= a)\n if (c % b == 0)\n {\n write(\"Yes\");\n return;\n }\n write(\"No\");\n }\n #region Lala Land Apple Trees\n private class LalaLand_AppleTree : IComparable\n {\n private int coordinate;\n internal int Apples { get; private set; }\n internal LalaLand_AppleTree(int coordinate, int apples)\n {\n this.coordinate = coordinate;\n Apples = apples;\n }\n public int CompareTo(object obj) => coordinate - ((LalaLand_AppleTree)obj).coordinate;\n }\n private static void lalaLandAppleTrees()\n {\n var n = readValue();\n List right = new List(), left = new List();\n for (int i = 0; i < n; ++i)\n {\n var input = readValues();\n if (input[0] > 0)\n right.Add(new LalaLand_AppleTree(input[0], input[1]));\n else\n left.Add(new LalaLand_AppleTree(-input[0], input[1]));\n }\n\n if (Math.Abs(right.Count - left.Count) < 2)\n write(right.Sum(x => x.Apples) + left.Sum(x => x.Apples));\n else\n {\n quickSort(right);\n quickSort(left);\n if (right.Count > left.Count)\n write(right.GetRange(0, left.Count + 1).Sum(x => x.Apples) + (left.Count > 0 ? left.Sum(x => x.Apples) : 0));\n else\n write((right.Count > 0 ? right.Sum(x => x.Apples) : 0) + left.GetRange(0, right.Count + 1).Sum(x => x.Apples));\n }\n }\n #endregion\n private static void lanterns()\n {\n int l = readValues()[1], d = 0;\n var a = readValues().Distinct().ToList();\n quickSort(a);\n for (int i = 0; i < a.Count - 1; ++i)\n {\n var diff = a[i + 1] - a[i];\n if (diff > d)\n d = diff;\n }\n if (a[0] > 0 && a[a.Count - 1] < l)\n write(Math.Max(Math.Max(a[0] - 0, l - a[a.Count - 1]), d / 2.0));\n else if (a[0] > 0)\n write(Math.Max(a[0] - 0, d / 2.0));\n else if (a[a.Count - 1] < l)\n write(Math.Max(l - a[a.Count - 1], d / 2.0));\n else\n write((double)d / 2.0);\n }\n private static void cheapTravel()\n {\n var input = readValues();\n int n = input[0], m = input[1], a = input[2], b = input[3];\n if (b >= a * m)\n write(n * a);\n else\n write((n / m) * b + ((n % m) * a < b ? (n % m) * a : b));\n }\n\n static void Main(string[] args)\n {\n //var t = readValue();\n //for (int i = 0; i < t; ++i)\n cheapTravel();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nclass Program{\n static void Main(string[] args){\n string[] input = Console.ReadLine().Split(' ');\n int ridesPlanned = Int32.Parse(input[0]);\n int ridesInSpecialTicket=Int32.Parse(input[1]);\n int priceForSingleRide= Int32.Parse(input[2]);\n int priceForSpecialRides=Int32.Parse(input[3]);\n \n if (ridesPlanned == 0)\n Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n\n if (ridesPlanned % ridesInSpecialTicket == 0){\n int cost1 = ridesPlanned * priceForSingleRide;\n int cost2 =(ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides;\n if (cost1 < cost2)\n Console.WriteLine(cost1);\n \n else\n Console.WriteLine(cost2);\n }\n \n \n else{\n int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;\n int x = ridesPlanned / ridesInSpecialTicket + 1;\n if(x*priceForSpecialRides < cost)\n {\n Console.WriteLine(x * priceForSpecialRides);\n }\n else\n Console.WriteLine(cost);\n }\n } \n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nclass Program{\n static void Main(string[] args){\n string[] input = Console.ReadLine().Split(' ');\n int ridesPlanned = Int32.Parse(input[0]);\n int ridesInSpecialTicket=Int32.Parse(input[1]);\n int priceForSingleRide= Int32.Parse(input[2]);\n int priceForSpecialRides=Int32.Parse(input[3]);\n \n \n if (ridesPlanned == 0)\n Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n if (ridesPlanned % ridesInSpecialTicket == 0) \n Console.WriteLine((ridesPlanned * priceForSingleRide)< ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides)? ridesPlanned * priceForSingleRide :(ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides); \n else\n { \n if (((ridesPlanned / ridesInSpecialTicket + 1) * priceForSpecialRides) < ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide))\n Console.WriteLine((ridesPlanned / ridesInSpecialTicket + 1) * priceForSpecialRides);\n else \n Console.WriteLine(((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide));\n }\n } \n \n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace batdau_3_7\n{\n class Program\n {\n public static void Main(string[] args)\n {\n String s = Console.ReadLine();\n String []f = new String[5];\n f= s.Split();\n Int32 n = Int32.Parse(f[0]), m = Int32.Parse(f[1]),\n a = Int32.Parse(f[2]), b = Int32.Parse(f[3]);\n Int32 d;\n Int32 k = n/m,l=b;\n if ((n%m)*a< b) l = (n%m)*a;\n d = k*b+l;\n Int32 e = n*a;\n d = (d+e-Math.Abs(d-e))/2;\n Console.WriteLine(d);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var input = int.Parse(Console.ReadLine());\n var input = Console.ReadLine().Split(' ').Select(k=> int.Parse(k)).ToArray();\n\n var noOfRides = input[0];\n var mticketNoOfRides = input[1];\n var priceOneRideTicket = input[2];\n var pricemRideTicket = input[3];\n\n var tickets = noOfRides / mticketNoOfRides;\n\n if (tickets == 0 && pricemRideTicket < (noOfRides * priceOneRideTicket))\n {\n Console.WriteLine(pricemRideTicket);\n return;\n }\n\n var ridesNeeded = (noOfRides - (tickets * mticketNoOfRides)) % mticketNoOfRides;\n\n var finalTotal1 = tickets * pricemRideTicket + ridesNeeded * priceOneRideTicket;\n\n //var finalTotal2 = tickets * pricemRideTicket + ridesNeeded * pricemRideTicket;\n\n var finalTotal2 = tickets * pricemRideTicket + 1 * pricemRideTicket;\n\n var finalTotal3 = noOfRides * priceOneRideTicket;\n\n var finalTotal = finalTotal1 > finalTotal2 ? finalTotal2 : finalTotal1;\n\n var superFinal = finalTotal < finalTotal3 ? finalTotal : finalTotal3;\n\n Console.WriteLine(superFinal);\n\n }\n }\n}\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n\n var totlDays = n / m;\n if (totlDays == 0)\n {\n if (a * n > b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n var cc = 1;\n if (remDays / m == 0)\n {\n cc = 1;\n }\n else\n {\n cc = remDays / m;\n }\n\n\n var maxV = totlDays * b + Math.Min(remDays * a, cc * b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace batdau_3_7\n{\n class Program\n {\n public static void Main(string[] args)\n {\n String s = Console.ReadLine();\n String []f = new String[5];\n f= s.Split();\n Int32 n = Int32.Parse(f[0]), m = Int32.Parse(f[1]),\n a = Int32.Parse(f[2]), b = Int32.Parse(f[3]);\n Int32 d;\n Int32 k = n/m,l=b;\n if ((n%m)*a< b) l = (n%m)*a;\n d = k*b+l;\n Int32 e = n*a;\n d = (d+e-Math.Abs(d-e))/2;\n Console.WriteLine(d);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n// Codeforces problem 466A \"\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u0437\u0434\"\n// http://codeforces.com/problemset/problem/466/A\nnamespace _466_A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] data = Console.ReadLine().Split();\n\t\t\tint n = Convert.ToInt32(data[0]); // \u041a\u043e\u043b-\u0432\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a.\n\t\t\tint m = Convert.ToInt32(data[1]); // \u041a\u043e\u043b-\u0432\u043e \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0431\u043e\u043d\u0438\u043c\u0435\u043d\u0442\u0430.\n\t\t\tint a = Convert.ToInt32(data[2]); // \u0426\u0435\u043d\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u0437\u0434\u0430.\n\t\t\tint b = Convert.ToInt32(data[3]); // \u0426\u0435\u043d\u0430 \u0430\u0431\u043e\u043d\u0438\u043c\u0435\u043d\u0442\u0430.\n\n\t\t\tint minCost = 0;\n\n\t\t\t// === HAZARD - wrong understanding === {\n\t\t\t//if ((double)b / m < a)\n\t\t\t//{\n\t\t\t//\tint numberOfSubscriptionTrips = n / m;\n\t\t\t//\tminCost += numberOfSubscriptionTrips * b;\n\t\t\t//\tminCost += (n - numberOfSubscriptionTrips * m) * a;\n\t\t\t//}\n\t\t\t//else\n\t\t\t//{\n\t\t\t//\tminCost += n * a;\n\t\t\t//}\n\t\t\t// } === HAZARD - wrong understanding === \n\n\t\t\tint cost1 = n * a;\n\t\t\tint cost2 = ((int)Math.Ceiling((double)n / m)) * b;\n\t\t\tint numberOfSubscriptionTrips = n / m;\n\t\t\tint cost3 = numberOfSubscriptionTrips * b;\n\t\t\tcost3 += (n - numberOfSubscriptionTrips * m) * a;\n\n\t\t\tminCost = Math.Min(cost1, Math.Min(cost2, cost3));\n\n\t\t\tConsole.WriteLine(minCost);\n\t\t\t//Console.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[] str1 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n float n = str1[0], m = str1[1], a = str1[2], b = str1[3];\n float money = 0;\n if (b / m * n >= a * n)\n money += a * n;\n else\n {\n while (m < n)\n {\n\n money += b;\n n -= m;\n }\n money += (n * a < b) ? n * a : b;\n }\n\n Console.WriteLine((int)money);\n\n //Console.ReadKey();\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems\n{\n class A466_CheapTravel\n {\n public static void Main()\n {\n //while (true)\n //{\n string[] z = Console.ReadLine().Split(' ');\n int n = int.Parse(z[0]);\n int m = int.Parse(z[1]);\n int a = int.Parse(z[2]);\n int b = int.Parse(z[3]);\n double c =(double) b / m;\n if(c>a)\n {\n Console.WriteLine(a*n);\n }\n else\n {\n int t = n / m;\n int result = (t * b); //+((n-(t*m))*a);\n\n if (((n - (t * m)) * a) > b)\n result += b;\n else\n result += ((n - (t * m)) * a);\n\n Console.WriteLine(result);\n }\n \n //}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace spacename\n{\n\tclass programm\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tint n, m, a, b;\n\t\t\tstring[] input = Console.ReadLine().Split(' '); //Split \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u0442\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439\n\t\t\tn = Convert.ToInt32(input[0]);\n\t\t\tm = Convert.ToInt32(input[1]);\n\t\t\ta = Convert.ToInt32(input[2]);\n\t\t\tb = Convert.ToInt32(input[3]);\n\t\t\tif (a*m<=b) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(a*n);\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tif (n%m*a>b) \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(n/m*b+b);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(n/m*b+n%m*a);\n\t\t\t\t};\n\t\t\t};\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.IO;\n\nnamespace CF270\n{\n class Program\n { \n static void Main(string[] args)\n {\n Solution(Console.In, Console.Out); \n }\n\n static void Solution(TextReader sr, TextWriter sw)\n { \n string[] input = sr.ReadLine().Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n int a = Int32.Parse(input[2]);\n int b = Int32.Parse(input[3]);\n var ceil = (int) Math.Ceiling((double) n/m);\n var floor = (int) Math.Floor((double) n/m);\n int first = ceil*b;\n int second = floor*b + a*(n - floor * m);\n int third = n*a;\n sw.WriteLine(Math.Min(first, Math.Min(second, third)));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] newline = line.Split(' ');\n int n = int.Parse(newline[0]);\n int m = int.Parse(newline[1]);\n int a = int.Parse(newline[2]);\n int b = int.Parse(newline[3]);\n int result = 0;\n double min = a * n;\n double Oneridecost = b / m;\n if (m >= n)\n {\n int min2 = n * a;\n if (min2 > b)\n min2 = b;\n Console.Write(min2);\n }\n else\n {\n if (a > Oneridecost)\n {\n if (n % m == 0)\n result = (n / m) * b;\n else\n {\n int temp = n / m;\n int remain = n - (temp * m);\n\n result = temp * b + remain * a;\n\n int getmin = temp * b + b;\n if (getmin < result)\n result = getmin;\n }\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(min);\n }\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nmab = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int n = nmab[0];\n int m = nmab[1];\n int a = nmab[2];\n int b = nmab[3];\n\n int res = Math.Min(n * a, Math.Min(n / m * b + n % m * a, (n / m + 1) * b));\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Problem\n{\n void Solve()\n {\n var sc = new Scanner();\n var n = sc.Long();\n var m = sc.Long();\n var a = sc.Long();\n var b = sc.Long();\n var ret = n * a;\n var k = n / m;\n ret = Math.Min(k * b + (n - k * m) * a, ret);\n ret = Math.Min((k + 1) * b, ret);\n Console.WriteLine(ret);\n\n\n }\n static void Main()\n {\n // For CodeForces\n#if ONLINE_JUDGE\n System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(\"en-US\");\n#endif\n#if DEBUG\n var ostream = new System.IO.FileStream(\"debug.txt\", System.IO.FileMode.Open, System.IO.FileAccess.Write);\n var iStream = new System.IO.FileStream(\"input.txt\", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);\n Console.SetIn(new System.IO.StreamReader(iStream));\n System.Diagnostics.Debug.AutoFlush = true;\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(new System.IO.StreamWriter(ostream, System.Text.Encoding.UTF8)));\n try\n {\n#endif\n var problem = new Problem();\n problem.Solve();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.WriteLine(ex.StackTrace);\n }\n Console.ReadKey(true);\n#endif\n }\n\n\n}\n\npublic class Scanner\n{\n readonly System.IO.TextReader reader;\n string[] buffer = new string[0];\n int position;\n\n public char[] Separator { get; set; }\n public Scanner(System.IO.TextReader reader = null, string separator = null)\n {\n if (reader == null)\n this.reader = Console.In;\n else\n this.reader = reader;\n if (string.IsNullOrEmpty(separator))\n separator = \" \";\n this.Separator = separator.ToCharArray();\n\n }\n public string Scan()\n {\n if (this.position < this.buffer.Length)\n return this.buffer[this.position++];\n this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n this.position = 0;\n return this.buffer[this.position++];\n }\n\n public string[] ScanToEndLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n var size = this.buffer.Length - this.position;\n var ar = new string[size];\n Array.Copy(this.buffer, position, ar, 0, size);\n return ar;\n\n }\n\n public string ScanLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine();\n else\n {\n var sb = new System.Text.StringBuilder();\n for (; this.position < buffer.Length; this.position++)\n {\n sb.Append(this.buffer[this.position]);\n sb.Append(' ');\n }\n return sb.ToString();\n }\n }\n public string[] ScanArray(int length)\n {\n var ar = new string[length];\n for (int i = 0; i < length; i++)\n {\n ar[i] = this.Scan();\n }\n return ar;\n }\n\n public int Integer()\n {\n return int.Parse(this.Scan());\n }\n public long Long()\n {\n return long.Parse(this.Scan());\n }\n public double Double()\n {\n return double.Parse(this.Scan());\n }\n\n public int[] IntArray(int length)\n {\n var a = new int[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Integer();\n return a;\n }\n public long[] LongArray(int length)\n {\n var a = new long[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Long();\n return a;\n }\n public double[] DoubleArray(int length)\n {\n var a = new double[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Double();\n return a;\n }\n\n}\nstatic public partial class EnumerableEx\n{\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public IEnumerable Enumerate(this int count, Func selector)\n {\n return Enumerable.Range(0, count).Select(x => selector(x));\n }\n}\n\n//*/"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(' ');\n int[] n = Array.ConvertAll(s, int.Parse);\n\n if ((n[1] * n[2]) > n[3])\n {\n\n if (((n[0] % n[1]) * n[2]) > n[3])\n {\n Console.WriteLine(n[0] / n[1] * n[3] + n[3]);\n }\n else\n {\n Console.WriteLine(n[0] / n[1] * n[3] + ((n[0] % n[1]) * n[2]));\n }\n }\n else\n {\n Console.WriteLine(n[0] * n[2]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = 0;\n int m = 0;\n int a = 0;\n int b = 0;\n string temp = \"\";\n int counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n temp += s[i];\n b = int.Parse(temp);\n temp = \"\";\n }\n else if (s[i] != ' ')\n temp += s[i];\n else\n {\n if (counter == 0)\n n = int.Parse(temp);\n else if (counter == 1)\n m = int.Parse(temp);\n else\n a = int.Parse(temp);\n temp = \"\";\n counter++;\n }\n }\n int max1 = n * a;\n int max2 = 0;\n int ccounter =0;\n if (m > n)\n max2 = b;\n else\n {\n max2 = (n / m) * b;\n ccounter+=(n/m)*m;\n if (n % m != 0)\n if (a > b) max2 += b;\n\n else\n while (ccounter++ < n)\n max2 += a;\n }\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] s = str.Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int a = Convert.ToInt32(s[2]);\n int b = Convert.ToInt32(s[3]);\n double r1=b/m;\n int t1;\n if (r1 < a)\n {\n t1 = (n / m) * b;\n if ((n % m) * a < b)\n {\n Console.WriteLine(t1 + ((n % m) * a));\n }\n else\n {\n Console.WriteLine(t1 + b);\n }\n }\n else if(a n)\n //{\n // multi = b;\n //}\n //else\n \n multi = ((n / m) * b) + Math.Min(b, (n % m) * a);\n \n Console.WriteLine(Math.Min(single, multi));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass A466 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n var a = int.Parse(line[2]);\n var b = int.Parse(line[3]);\n Console.WriteLine(new int[] {\n (n + m - 1) / m * b,\n n / m * b + n % m * a,\n n * a\n }.Min());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(A<(double)B/(double)M){\n\t\t\tConsole.WriteLine(\"{0}\",A*N);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint total=(N/M)*B;\n\t\ttotal+=Math.Min((N%M)*A,B);\n\t\tConsole.WriteLine(\"{0}\",total);\n\t\t\n\t\t\n\t}\n\t\n\tint N;\n\tint M;\n\tint A;// 1\n\tint B;// B/M\n\t\n\tpublic Sol(){\n\t\tvar d=ria();\n\t\tN=d[0];M=d[1];A=d[2];B=d[3];\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.Versioning;\nusing static System.Math;\n\nnamespace HackerRank\n{\n class Program\n {\n static void Main(string[] args)\n { \n int[] nums = Console.ReadLine().Split().Select(num => int.Parse(num)).ToArray();\n int n = nums[0]; //10\n int m = nums[1]; //3\n int a = nums[2]; //5\n int b = nums[3]; //1\n Console.WriteLine(a * m > b ? n / m * b + Min(n % m * a, b) : n * a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(data[0]);\n int ridesInSurepTicket = Convert.ToInt32(data[1]);\n int pricePerRide = Convert.ToInt32(data[2]);\n int pricePerSuperTicket = Convert.ToInt32(data[3]);\n\n int answer = 0;\n while (n > 0)\n {\n if (n >= ridesInSurepTicket && pricePerSuperTicket <= pricePerRide*ridesInSurepTicket)\n {\n answer += pricePerSuperTicket;\n n = n - ridesInSurepTicket;\n continue;\n }\n\n if (n >= ridesInSurepTicket)\n {\n answer += n*pricePerRide;\n break;\n }\n else\n {\n if (n*pricePerRide < pricePerSuperTicket)\n {\n answer += n*pricePerRide;\n n = 0;\n }\n else\n {\n answer += pricePerSuperTicket;\n n = 0;\n }\n }\n }\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\n \nclass Program\n{\nstatic void Main()\n {\n string str = Console.ReadLine();\n string[] s = str.Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int a = int.Parse(s[2]);\n int b = int.Parse(s[3]);\n \n double average = (double)b / m;\n if (average >= a)\n {\n Console.WriteLine(n * a);\n return;\n }\n else\n {\n int t = n / m; //\u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0430\u0431\u043e\u043d\u0435\u043c\u0435\u043d\u0442\u043e\u0432\n int sum = b * t;\n if ((a * (n - t * m)) < b) //\u0435\u0441\u043b\u0438 \u043f\u043e\u0448\u0442\u0443\u0447\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u0432\u044b\u0433\u043e\u0434\u043d\u0435\u0435\n {\n sum += a * (n - t * m);\n }\n else\n {\n sum += b;\n }\n Console.WriteLine(sum);\n return;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = Arr[0],\n m = Arr[1],\n a = Arr[2],\n b = Arr[3],\n sum = 0,\n count = 0,\n tmp = 0;\n\n while (count < n)\n {\n if (n >= count + m)\n {\n if (b < m * a)\n {\n count += m;\n sum += b;\n }\n else\n {\n count += m;\n sum += m * a;\n }\n }\n else\n {\n if (b < (n - count) * a)\n {\n count += m;\n sum += b;\n }\n else\n {\n sum += (n - count) * a;\n count += (n - count);\n }\n }\n }\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Task_TD\n{\n\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split(' ');\n\n int n = Int32.Parse(lines[0]);\n int m = Int32.Parse(lines[1]);\n int a = Int32.Parse(lines[2]);\n int b = Int32.Parse(lines[3]);\n\n Console.WriteLine(GetResult(n, m, a, b));\n\n Console.ReadLine();\n }\n\n\n static int GetResult(int n, int m, int a, int b)\n {\n if (b / m >= a)\n {\n return n * a;\n }\n\n int k = n / m;\n int rest = n % m;\n\n int res = Math.Min((k * b + rest * a), (k + 1) * b);\n return res;\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s = 0,m=0,n=0,u=0;\n\n string[] arr = Console.ReadLine().Split();\n int a = int.Parse(arr[0]);\n int b = int.Parse(arr[1]);\n int c = int.Parse(arr[2]);\n int d = int.Parse(arr[3]);\n u = a * c;\n if (a % b == 0)\n {\n s = (a / b) * d;\n }\n else if (b > a)\n {\n s = d;\n }\n else\n {\n n = (a / b) * d + (a % b) * c;\n\n m = (a / b) * d + d;\n\n }\n\n int[] w = new int[4];\n w[0] = s;\n w[1] = u;\n w[2] = n;\n w[3] = m;\n Array.Sort(w);\n for (int i = 0; i < 4; i++)\n {\n if (w[i]!=0)\n {\n Console.WriteLine(w[i]);\n return;\n }\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Collections;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] str = Console.ReadLine().Split(' ');\n int n, m, a, b;\n n = int.Parse(str[0]);\n m = int.Parse(str[1]);\n a = int.Parse(str[2]);\n b = int.Parse(str[3]);\n ArrayList A = new ArrayList();\n\n int total = 0;\n \n total = (int)Math.Floor( (double)n/(double)m ) * b;\n total += (n % m) * a;\n A.Add(total);\n\n total = n * a;\n A.Add(total);\n\n total = total = (int)Math.Ceiling( (double)n / (double)m ) * b;\n A.Add(total);\n A.Sort();\n total = (int)A[0];\n\n // if (total > n * a) { total = n * a; }\n \n Console.WriteLine(total);\n // Main(new string[0]) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _123\n{\n class Program\n {\n static int N, M, A, B;\n static int res;\n static string[] count;\n\n static void Main(string[] args)\n {\n count = Console.ReadLine().Split();\n N = Convert.ToInt32(count[0]);\n M = Convert.ToInt32(count[1]);\n A = Convert.ToInt32(count[2]);\n B = Convert.ToInt32(count[3]);\n\n if (M * A <= B)\n {\n Console.WriteLine(N * A);\n return;\n }\n\n res += (N / M) * B;\n N %= M;\n res += Math.Min(N * A, B);\n\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n string[] tokens = Console.ReadLine().Split(' ');\n int n = int.Parse(tokens[0]);\n int m = int.Parse(tokens[1]);\n int a = int.Parse(tokens[2]);\n int b = int.Parse(tokens[3]);\n\n \n var p = 0;\n if (n%m==0)\n p = n/m;\n else p = n/m+1;\n\n var d = Math.Min(n * a, p * b);\n\n var t = n / m;\n var k = t * b + (n-t*m)*a;\n Console.WriteLine(Math.Min(d, k));\n // Console.WriteLine(n/m);\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace cheap\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n\n int[] sayilar = new int[4];\n int sayac = 0;\n int kalantur;\n string sayi = Console.ReadLine();\n foreach (string s in sayi.Split(' '))\n {\n sayilar[sayac] = int.Parse(s);\n sayac++;\n }\n if (sayilar[0] < sayilar[1])\n {\n Console.Write(Math.Min(sayilar[0] * sayilar[2], sayilar[3]));\n }\n else if (sayilar[0]/sayilar[1]==0)\n {\n Console.Write(Math.Min(sayilar[0] * sayilar[2], (sayilar[0] / sayilar[1]) * sayilar[3]));\n }\n else\n {\n kalantur = sayilar[0] - sayilar[0] / sayilar[1] * sayilar[1];\n Console.Write(Math.Min(Math.Min(sayilar[0] * sayilar[2], (sayilar[0] / sayilar[1] + 1) * sayilar[3]), ((sayilar[0] / sayilar[1]) * sayilar[3]) + kalantur * sayilar[2]));\n }\n\n Console.ReadKey();\n }\n catch { }\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int a = Convert.ToInt32(s[2]);\n int b = Convert.ToInt32(s[3]);\n int s1;\n if (m * a < b) s1 = n * a;\n else\n {\n s1 = n / m * b;\n if (n % m * a < b) s1 += n%m*a; else s1 +=b;\n }\n\n Console.WriteLine(s1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nmab = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = nmab[0];\n int m = nmab[1];\n int a = nmab[2];\n int b = nmab[3];\n\n int x = 0;\n\n if (n % m == 0)\n {\n x = n / m;\n }\n else\n {\n x = (n / m) + 1;\n }\n\n int ans = Math.Min(x * b, ((n / m) * b + (n % m) * a));\n ans = Math.Min(n * a, ans);\n\n Console.WriteLine(ans);\n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Ladder4\n{\n class Prob21\n {\n static void Main(string[] args)\n {\n List input = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToList();\n int rides = input[0];\n int loop = rides;\n int multipleRides = input[1];\n int oneRide = input[2];\n int multiplePrice = input[3];\n int sum = 0;\n\n if (multipleRides * oneRide < multiplePrice)\n Console.WriteLine(loop * oneRide);\n else\n {\n int x = loop / multipleRides * multiplePrice;\n int restRides = loop % multipleRides;\n if (restRides * oneRide > multiplePrice)\n x += multiplePrice;\n else\n x += restRides * oneRide;\n Console.WriteLine(x);\n }\n //while (true) ;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _466A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var numbers = Console.ReadLine().Split();\n int n = Convert.ToInt32(numbers[0]);\n int m = Convert.ToInt32(numbers[1]);\n int a = Convert.ToInt32(numbers[2]);\n int b = Convert.ToInt32(numbers[3]);\n if (m * a < b)\n {\n Console.WriteLine(n * a);\n }\n else\n {\n int cm = 0;\n while (cm < n)\n {\n cm += m;\n }\n if (cm == n)\n {\n Console.WriteLine(cm / m * b);\n }\n else\n {\n if ((cm / m * b) > (((cm - m) / m * b) + (n - (cm - m)) * a))\n {\n Console.WriteLine(((cm - m) / m * b) + (n - (cm - m)) * a);\n }\n else\n {\n Console.WriteLine(cm / m * b);\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public static class Algr\n {\n public static string Solve(string input)\n {\n var array = input.Split(' ')\n .Select(x => Int32.Parse(x))\n .ToArray();\n\n int n = array[0];\n int m = array[1];\n int a = array[2];\n int b = array[3];\n\n double costB = (double) b / m;\n int r = 0;\n\n if (a <= costB)\n {\n r = n * a;\n }\n\n else\n {\n r = (n / m) * b;\n r += Math.Min((n - ((n / m) * m)) * a, b);\n }\n\n return r.ToString();\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Algr.Solve(Console.ReadLine()));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k = Int32.Parse (Console.ReadLine ());\n int l = Int32.Parse (Console.ReadLine ());\n int m = Int32.Parse (Console.ReadLine ());\n int n = Int32.Parse (Console.ReadLine ());\n int d = Int32.Parse (Console.ReadLine ());\n int sum = 0;\n \n for (int i = 1; i <= d; i++) {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z236A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n string ne = \"\";\n bool k;\n for (int i = 0; i < str.Length; i++) {\n k = false;\n for (int j = 0; j < ne.Length; j++) {\n if (str [i] == ne [j]) {\n k = true;\n }\n }\n if (!k) {\n ne += str [i];\n n++;\n }\n }\n if (n % 2 == 0) {\n Console.WriteLine (\"CHAT WITH HER!\");\n } else {\n Console.WriteLine (\"IGNORE HIM!\");\n }\n }\n\n static int gdc (int left, int right)\n {\n while (left>0&&right>0) {\n if (left > right) {\n left %= right;\n } else\n right %= left;\n }\n return left + right;\n }\n\n static void Z119A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int[] ab = new int[2];\n\n ab [0] = Int32.Parse (str [0]);\n ab [1] = Int32.Parse (str [1]);\n int n = Int32.Parse (str [2]);\n int i = 0;\n int m;\n while (true) {\n if (n == 0) {\n Console.WriteLine ((i + 1) % 2);\n return;\n }\n m = gdc (ab [i], n);\n n -= m;\n i = (i + 1) % 2;\n\n }\n\n }\n\n static void Z110A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == '4' || str [i] == '7') {\n n++;\n }\n }\n if (n == 4 || n == 7) {\n Console.WriteLine (\"YES\");\n } else {\n Console.WriteLine (\"NO\");\n }\n }\n\n static void Z467A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int res = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [1]) - Int32.Parse (strs [0]) >= 2) {\n res++;\n }\n }\n Console.WriteLine (res);\n }\n\n static void Z271A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int [] ye = new int[4];\n n++;\n for (int i = 0; i < 4; i++) {\n ye [i] = n / 1000;\n n %= 1000;\n n *= 10;\n }\n bool flag = true;\n while (flag) {\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < i; j++) {\n if (ye [i] == ye [j]) {\n ye [i]++;\n \n for (int k = i+1; k < 4; k++) {\n ye [k] = 0;\n }\n i--;\n }\n }\n }\n flag = false;\n for (int i = 1; i < 4; i++) {\n if (ye [i] == 10) {\n ye [i] %= 10;\n ye [i - 1]++;\n flag = true;\n }\n }\n }\n for (int i = 0; i < 4; i++) {\n Console.Write (ye [i]);\n }\n \n }\n\n static void Z58A ()\n {\n string str = Console.ReadLine ();\n str.ToLower ();\n string sstr = \"hello\";\n int j = 0;\n for (int i = 0; i < str.Length; i++) {\n if (sstr [j] == str [i])\n j++;\n if (j == sstr.Length) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z472A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n if (n % 2 == 0) {\n Console.Write (\"4 \");\n Console.Write (n - 4);\n } else {\n Console.Write (\"9 \");\n Console.Write (n - 9);\n }\n }\n\n static void Z460A ()\n {\n int res = 0;\n int days = 0;\n string[] strs = Console.ReadLine ().Split (' ');\n int nosk = Int32.Parse (strs [0]);\n int nd = Int32.Parse (strs [1]);\n while (nosk!=0) {\n days += nosk;\n res += nosk;\n nosk = 0;\n nosk = days / nd;\n days %= nd;\n }\n Console.Write (res);\n }\n\n static void Z379A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]);\n int b = Int32.Parse (strs [1]);\n int ogaroks = 0;\n int h = 0;\n while (a!=0) {\n h += a;\n ogaroks += a;\n a = ogaroks / b;\n ogaroks %= b;\n }\n Console.WriteLine (h);\n }\n\n static bool IsLucky (int n)\n {\n while (n>0) {\n int m = n % 10;\n if (m != 4 && m != 7) {\n return false;\n }\n n /= 10;\n }\n return true;\n }\n\n static void Z122A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n for (int i = 2; i <= n; i++) {\n if (n % i == 0 && IsLucky (i)) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z136A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] pod = new int[n];\n string[] strs = Console.ReadLine ().Split (' ');\n for (int i = 0; i < n; i++) {\n pod [Int32.Parse (strs [i]) - 1] = i + 1;\n }\n for (int i = 0; i < n; i++) {\n Console.Write (pod [i].ToString () + \" \");\n }\n }\n\n static void Z228A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n List n = new List ();\n for (int i = 0; i < 4; i++) {\n bool flag = true;\n for (int j = 0; j < n.Count; j++) {\n if (Int32.Parse (strs [i]) == n [j]) {\n flag = false;\n break;\n }\n }\n if (flag) {\n n.Add (Int32.Parse (strs [i]));\n }\n }\n Console.WriteLine (4 - n.Count);\n }\n\n static void Z263A ()\n {\n string[] strs;\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++) {\n strs = Console.ReadLine ().Split (' ');\n for (int j = 0; j < 5; j++) {\n if (strs [j] == \"1\") {\n x = j + 1;\n y = i + 1;\n }\n }\n\n }\n Console.WriteLine ((Math.Abs (3 - x) + Math.Abs (3 - y)));\n }\n\n static void Z266B ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int t = Int32.Parse (strs [1]);\n string str = Console.ReadLine ();\n char[] chs = new char[str.Length];\n for (int i = 0; i < str.Length; i++) {\n chs [i] = str [i];\n }\n for (int i = 0; i < t; i++) {\n int j = 0;\n while (j+1 rost [max])\n max = i;\n }\n int sum = 0;\n while (max!=0) {\n int temp = rost [max];\n rost [max] = rost [max - 1];\n rost [max - 1] = temp;\n sum++;\n max--;\n }\n\n\n for (int i = n-1; i >=0; i--) {\n\n if (rost [i] < rost [min]) {\n min = i;\n }\n }\n while (min!=rost.Length-1) {\n int temp = rost [min];\n rost [min] = rost [min + 1];\n rost [min + 1] = temp;\n sum++;\n min++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z451A ()\n {\n string[] names = new string[2];\n names [0] = \"Akshat\";\n names [1] = \"Malvika\";\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int m = Int32.Parse (strs [1]);\n n = Math.Min (n, m) - 1;\n n %= 2;\n Console.WriteLine (names [n]);\n\n }\n\n static void Z344A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int ostr = 1;\n string str = Console.ReadLine ();\n char ch = str [1];\n for (int i = 1; i < n; i++) {\n str = Console.ReadLine ();\n if (ch == str [0]) {\n ostr++;\n }\n ch = str [1];\n }\n Console.WriteLine (ostr);\n }\n\n static void Z486A ()\n {\n long n = Int64.Parse (Console.ReadLine ());\n long sum = n / 2;\n sum -= (n % 2) * n;\n Console.WriteLine (sum);\n }\n\n static void Z500A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (str [0]);\n int t = Int32.Parse (str [1]);\n int[] a = new int[n - 1];\n str = Console.ReadLine ().Split (' ');\n int j = 0;\n t--;\n for (int i = 0; i < n-1; i++) {\n a [i] = Int32.Parse (str [i]);\n if (i == j)\n j += a [i];\n if (j >= t)\n break;\n }\n if (j == t)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z61A ()\n {\n string str1 = Console.ReadLine ();\n string str2 = Console.ReadLine ();\n string str3 = \"\";\n for (int i = 0; i < str1.Length; i++) {\n if (str1 [i] == str2 [i])\n str3 += \"0\";\n else\n str3 += \"1\";\n }\n Console.WriteLine (str3);\n }\n\n static void Z268A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] h = new int[n];\n int[] a = new int[n];\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n h [i] = Int32.Parse (strs [0]);\n a [i] = Int32.Parse (strs [1]);\n }\n int sum = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j && h [i] == a [j])\n sum++;\n }\n }\n Console.WriteLine (sum);\n }\n\n static void Z208A ()\n {\n string str = Console.ReadLine ();\n string[] separ = new string[1];\n separ [0] = \"WUB\";\n string[] strs = str.Split (separ, StringSplitOptions.RemoveEmptyEntries);\n for (int i = 0; i < strs.Length; i++) {\n Console.Write (strs [i] + \" \");\n }\n }\n\n static void Z478A ()\n {\n string []strs=Console.ReadLine().Split(' ');\n int n=0;\n for (int i = 0; i < 5; i++) {\n n+=Int32.Parse(strs[i]);\n }\n if (n%5==0&&n!=0) {\n Console.WriteLine(n/5);\n }\n else {\n Console.WriteLine(-1);\n }\n }\n static void Z69A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int x = 0, y = 0, z = 0;\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n x += Int32.Parse (strs [0]);\n y += Int32.Parse (strs [1]);\n z += Int32.Parse (strs [2]);\n }\n if (x == 0 && y == 0 && z == 0) {\n Console.Write (\"YES\");\n } else {\n Console.Write(\"NO\");\n }\n }\n static void Z337A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n int n=Int32.Parse(strs[0]);\n int m=Int32.Parse(strs[1]);\n List arra=new List();\n strs=Console.ReadLine().Split(' ');\n bool flag;\n for (int i = 0; i < m; i++) {\n flag=true;\n int t=Int32.Parse(strs[i]);\n for (int j = 0; j < arra.Count; j++) {\n if(t=sum) {\n level++;\n n-=sum;\n i++;\n sum+=i;\n }\n Console.WriteLine(level);\n }\n static void Z479A ()\n {\n int a=Int32.Parse(Console.ReadLine());\n int b=Int32.Parse(Console.ReadLine());\n int c=Int32.Parse(Console.ReadLine());\n int res=a+b+c;\n res=Math.Max(res,(a+b)*c);\n res=Math.Max(res,a*(b+c));\n res=Math.Max(res,(a*b)*c);\n Console.WriteLine(res);\n\n }\n static void Z448A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n strs = Console.ReadLine ().Split (' ');\n int b = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n int n = Int32.Parse (Console.ReadLine ());\n int aa = a / 5;\n if (a % 5 != 0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n aa=b/10;\n if (b%10!=0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n static void Z469A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n bool[]levels=new bool[n];\n for (int i = 0; i < n; i++) {\n levels[i]=true;\n }\n for (int i = 0; i < 2; i++) {\n string[]str=Console.ReadLine().Split(' ');\n int m=Int32.Parse(str[0]);\n for (int j = 1; j <= m; j++) {\n levels[Int32.Parse(str[j])-1]=false;\n }\n }\n for (int i = 0; i < n; i++) {\n if (levels[i]) {\n Console.WriteLine(\"Oh, my keyboard!\");\n return;\n }\n }\n Console.WriteLine(\"I become the guy.\");\n }\n static void Z155A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n string[]strs=Console.ReadLine().Split(' ');\n int max=Int32.Parse(strs[0]);\n int min=max;\n int m=0;\n for (int i = 1; i < n; i++) {\n int t=Int32.Parse(strs[i]);\n if (t>max) {\n m++;\n max=t;\n }\n if (t chrs=new List();\n bool flag;\n while (str[i]!='}') {\n \n flag=true;\n for (int j = 0; j < chrs.Count; j++) {\n if (str[i]==chrs[j]) {\n flag=false;\n break;\n }\n }\n if (flag) {\n chrs.Add(str[i]);\n }\n i++;\n if(str[i]=='}')\n break;\n i+=2;\n }\n Console.WriteLine(chrs.Count);\n }\n static void Z474A ()\n {\n char[,]keyboard=new char[3,10];\n keyboard[0,0]='q';\n keyboard[0,1]='w';\n keyboard[0,2]='e';\n keyboard[0,3]='r';\n keyboard[0,4]='t';\n keyboard[0,5]='y';\n keyboard[0,6]='u';\n keyboard[0,7]='i';\n keyboard[0,8]='o';\n keyboard[0,9]='p';\n keyboard[1,0]='a';\n keyboard[1,1]='s';\n keyboard[1,2]='d';\n keyboard[1,3]='f';\n keyboard[1,4]='g';\n keyboard[1,5]='h';\n keyboard[1,6]='j';\n keyboard[1,7]='k';\n keyboard[1,8]='l';\n keyboard[1,9]=';';\n keyboard[2,0]='z';\n keyboard[2,1]='x';\n keyboard[2,2]='c';\n keyboard[2,3]='v';\n keyboard[2,4]='b';\n keyboard[2,5]='n';\n keyboard[2,6]='m';\n keyboard[2,7]=',';\n keyboard[2,8]='.';\n keyboard[2,9]='/';\n bool flag;\n string lr=Console.ReadLine();\n string str=Console.ReadLine();\n int[]x=new int[str.Length];\n int[]y=new int[str.Length];\n for (int i = 0; i < str.Length; i++) {\n flag=false;\n for (int k = 0; k < 3; k++) {\n for (int m = 0; m < 10; m++) {\n if (keyboard[k,m]==str[i]) {\n y[i]=k;\n x[i]=m;\n flag=true;\n break;\n }\n }\n if(flag)\n break;\n }\n }\n int a=0;\n if (lr==\"L\") {\n a++;\n }\n else {\n a--;\n }\n for (int i = 0; i < str.Length; i++) {\n Console.Write(keyboard[y[i],x[i]+a]);\n }\n }\n static void Z268B ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int sum=0;\n for (int j = 1; j < n; j++) {\n sum+=(n-j)*j;\n }\n sum+=n;\n Console.WriteLine(sum);\n }\n static void Z318A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n\n long n=Int64.Parse(strs[0]);\n long m=Int64.Parse(strs[1]);\n n=n/2+n%2;\n long a=0;\n\n if (m<=n) {\n a=1;\n }\n else\n {\n m-=n;\n a=2;\n }\n a=a+(m-1)*2;\n \n Console.WriteLine(a);\n\n }\n static void Z510A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n\n int n=Int32.Parse(strs[0]);\n int m=Int32.Parse(strs[1]);\n int dir=0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if(dir==0)\n {\n Console.Write(\"#\");\n }\n if(dir==1&&j==m-1)\n {\n Console.Write(\"#\");\n }\n if(dir==1&&j!=m-1)\n {\n Console.Write(\".\");\n }\n if(dir==2)\n {\n Console.Write(\"#\");\n }\n if(dir==3&&j==0)\n {\n Console.Write(\"#\");\n }\n if(dir==3&&j!=0)\n {\n Console.Write(\".\");\n }\n }\n dir++;\n dir%=4;\n Console.WriteLine();\n }\n }\n static void Z405A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int[]st=new int[n];\n string []strs=Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++) {\n st[i]=Int32.Parse(strs[i]);\n }\n Array.Sort(st);\n for (int i = 0; i < st.Length; i++) {\n Console.Write(st[i].ToString()+\" \");\n }\n }\n static void Z466A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int m = Int32.Parse (strs [1]);\n int a = Int32.Parse (strs [2]);\n int b = Int32.Parse (strs [3]);\n int sum = 0;\n int temp=m *a;\n if (temp>b) {\n temp=b;\n }\n sum=(n /m)*temp;\n n %=m;\n temp=n *a;\n if(temp>b)\n temp=b;\n\n sum+=temp;\n Console.Write(sum);\n\n }\n public static void Main ()\n {\n\n Z466A ();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_466A_Cheap_Travel\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] p = new int[3];\n p[0] = n[0] / n[1] * n[3] + n[0] % n[1] * n[2];\n p[1] = (n[0] / n[1] + 1) * n[3];\n p[2] = n[0] * n[2];\n Console.WriteLine(p.Min());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar arr=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\n\t\tint n=arr[0];\n\t\tint m=arr[1];\n\t\tint a=arr[2];\n\t\tint b=arr[3];\n\t\t\n\t\tint x=n*a;\n\t\t\n\t\tint y=(n/m)*b+ Math.Min(n%m*a,b);\n\t\t\n\t\tConsole.WriteLine(Math.Min(x,y));\n\t \n\t}\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = Convert.ToInt32(input[0]);\n int m = Convert.ToInt32(input[1]);\n int a = Convert.ToInt32(input[2]);\n int b = Convert.ToInt32(input[3]);\n\n int ret = 0;\n\n if (b < m * a)\n {\n while (n*a > b)\n {\n n -= m;\n ret += b;\n }\n }\n if (n>0) ret += (a * n);\n Console.WriteLine(ret);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CheapTravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n, m, a, b;\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n a = int.Parse(s[2]);\n b = int.Parse(s[3]);\n int at, abt, bt;\n at = n * a;\n abt = (n / m) * b + (n % m) * a;\n bt = (n / m) * b;\n if (n % m != 0)\n bt += b;\n\n int min;\n min = Math.Min(Math.Min(at, bt), abt);\n Console.Write(min);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _466A\n{\n\tclass Program\n\t{\n\t\tstatic void Main ( string [ ] args )\n\t\t{\n\t\t\tint n, m, a, b;\n\t\t\tstring[] nums = (Console.ReadLine()).Split(' ');\n\t\t\tn = int.Parse(nums[0]);\n\t\t\tm = int.Parse(nums[1]);\n\t\t\ta = int.Parse(nums[2]);\n\t\t\tb = int.Parse(nums[3]);\n\t\t\tint min = ( (b * (n / m) ) + (a * (n % m)) );\n\t\t\tif (n%m != 0 && b*(n/m + 1) < min)\n\t\t\t\tmin = ( b*(n/m + 1) );\n\t\t\telse if (n%m == 0 && b * (n / m) < min)\n\t\t\t\tmin = (b*(n/m));\n\t\t\tif (n*a < min)\n\t\t\t\tmin = (n*a);\n\t\t\tConsole.Write(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace CheapTravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n\n long f1 = n * a;\n\n int i=0;\n long f2 = 0;\n while(i<=n){\n if (i+m > n){\n break;\n }\n f2 += b;\n i+= m;\n }\n f2 += (n-i) * a;\n\n i=0;\n long f3 = 0;\n while(i<=n){\n f3 += b;\n i+= m;\n }\n\n Console.WriteLine(Math.Min(Math.Min(f1, f2), f3));\n \n }\n }\n}\n"}, {"source_code": "// Author : Suvash Kumar Sumon\n\nusing System;\n\nnamespace CS_Repo\n{\n class Program2\n {\n static void Main(string [] args)\n {\n var data = Console.ReadLine().Split(' ');\n int n = int.Parse(data[0]);\n int m = int.Parse(data[1]);\n int a = int.Parse(data[2]);\n int b = int.Parse(data[3]);\n if (m * a <= b)\n {\n Console.WriteLine(n*a);\n }\n else \n {\n int ans = (n/m) * b + Math.Min((n%m) * a, b);\n Console.WriteLine(ans);\n }\n \n }\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\t\t\t\n\t\t\tvar n = inputs1[0];\n\t\t\tvar m = inputs1[1];\n\t\t\tvar a = inputs1[2];\n\t\t\tvar b = inputs1[3];\n\t\t\t\n\t\t\tif(n < m)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(Math.Min(b, n * a));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tif(b < m * a)\n\t\t\t{\n\t\t\t\tvar count = n / m;\n\t\t\t\tvar rest = n % m;\n\n\t\t\t\tvar adding = Math.Min(b, rest * a);\n\n\t\t\t\tConsole.WriteLine(count * b + adding);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n * a);\n\t\t\t}\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}], "negative_code": [{"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n \n var totlDays = n / m;\n if(totlDays==0)\n {\n if(a*n>b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n\n //totacost using\n\n var maxV = totlDays * b + Math.Min(remDays * a, remDays<=m?1:remDays *b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=0;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (c<=m)\n {\n Console.WriteLine(a*c);\n return;\n }\n else\n {\n if (a % m == 0)\n {\n Console.WriteLine(m * a);\n return;\n }\n else \n {\n for (int i = 0; i < a; i++)\n {\n s = s + d;\n n = n + b;\n if (n>=a)\n {\n Console.WriteLine(s);\n return;\n }\n else if (n+1==a)\n {\n if (b>=c)\n {\n Console.WriteLine(s + c);\n }\n else\n {\n Console.WriteLine(s + d);\n\n }\n return;\n }\n\n }\n \n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(' ');\n double[] n = Array.ConvertAll(s, double.Parse);\n\n double p1 = (n[0] * n[2]);\n double p2;\n if ((n[0] % n[1]) == 1 && n[2] <= n[3] && n[0] >= n[1])\n {\n p2 = (Math.Floor(n[0] / n[1]) * n[3]) + n[2];\n }\n else if ((n[0] % n[1]) == 1 && n[2] > n[3] && n[0] >= n[1])\n {\n p2 = (Math.Ceiling(n[0] / n[1]) * n[3]);\n }\n else if (n[0] < n[1] && (n[0]*n[2]) > n[3])\n {\n Console.WriteLine(n[3]);\n return;\n }\n else if (n[0] < n[1] && (n[0] * n[2]) < n[3])\n {\n Console.WriteLine(n[0] * n[2]);\n return;\n }\n else\n {\n p2 = ((n[0] / n[1]) * n[3]);\n }\n\n Console.WriteLine(Math.Min(p1, p2));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _266\n{\n class Program\n {\n static void Main(string[] args)\n {\n var task = new CheapTravel();\n Console.WriteLine(task.Solve());\n }\n\n private class CheapTravel\n {\n private int a, b, m, n;\n\n private void ReadData()\n {\n string line = Console.ReadLine();\n var arr = line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n n = Convert.ToInt32(arr[0]);\n m = Convert.ToInt32(arr[1]);\n a = Convert.ToInt32(arr[2]);\n b = Convert.ToInt32(arr[3]);\n }\n\n public int Solve()\n {\n ReadData();\n int res;\n if ((b/(float) m < a)&& b b)\n rest = b;\n res += rest;\n }\n else\n {\n res = n*a;\n }\n return res;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class CheapTravel {\n\n\tpublic static void Main(string[] args){\n\t\t\n\t\tvar input = Console.ReadLine().Split();\n\t\tvar n = int.Parse(input[0]);\n\t\tvar m = int.Parse(input[1]);\n\t\tvar a = int.Parse(input[2]);\n\t\tvar b = int.Parse(input[3]);\n\t\t\n\t\tif(a <= ((float)b / (float)m))\n\t\t{\n\t\t\tConsole.Write(n * a);\n\t\t}\n\t\telse {\n\t\t\tvar total = 0;\n\t\t\t\n\t\t\twhile(n > 0){\n\t\t\t\t\n\t\t\t if((n-m) < 0)\n\t\t\t {\n\t\t\t\t Console.Write(total + (n * a));\n\t\t\t\t return;\n\t\t\t }\n\t\t\t \n\t\t\t total += (b);\n \t\t n -= m;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.Write(total);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nclass Program{\n static void Main(string[] args){\n string[] input = Console.ReadLine().Split(' ');\n int ridesPlanned = Int32.Parse(input[0]);\n int ridesInSpecialTicket=Int32.Parse(input[1]);\n int priceForSingleRide= Int32.Parse(input[2]);\n int priceForSpecialRides=Int32.Parse(input[3]);\n \n if (ridesPlanned == 0)\n Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n\n if (ridesPlanned % ridesInSpecialTicket == 0)\n Console.WriteLine((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides);\n else{\n int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;\n int x = ridesPlanned / ridesInSpecialTicket + 1;\n if(x*priceForSpecialRides < cost)\n {\n Console.WriteLine(x * priceForSpecialRides);\n }\n else\n Console.WriteLine(cost);\n }\n } \n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=10000000;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (a==c&&c=s+n&&i+j==a)\n {\n u = s + n;\n }\n }\n //s = s + d;\n //n = n + b;\n //if (true)\n //{\n\n //}\n //if (n>=a)\n //{\n // Console.WriteLine(Math.Ceiling(s));\n // return;\n //}\n //else if (n+1==a)\n //{\n // if (b>=c)\n // {\n // Console.WriteLine(Math.Ceiling(s + c));\n // }\n // else\n // {\n // Console.WriteLine(Math.Ceiling(s + d));\n // }\n // return;\n //}\n\n }\n Console.WriteLine(Math.Ceiling(u));\n return;\n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var input = int.Parse(Console.ReadLine());\n var input = Console.ReadLine().Split(' ').Select(k=> int.Parse(k)).ToArray();\n\n var noOfRides = input[0];\n var mticketNoOfRides = input[1];\n var priceOneRideTicket = input[2];\n var pricemRideTicket = input[3];\n\n var tickets = noOfRides / mticketNoOfRides;\n var ridesNeeded = (noOfRides - (tickets * mticketNoOfRides)) % mticketNoOfRides;\n\n var finalTotal1 = tickets * pricemRideTicket + ridesNeeded * priceOneRideTicket;\n\n var finalTotal2 = tickets * pricemRideTicket + ridesNeeded * pricemRideTicket;\n\n var finalTotal = finalTotal1 > finalTotal2 ? finalTotal2 : finalTotal1;\n\n Console.WriteLine(finalTotal);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439_\u043f\u0440\u043e\u0435\u0437\u0434\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Resh(mas));\n Console.ReadLine();\n\n }\n\n static int Resh(int[] mas)\n {\n int n = mas[0];\n int m = mas[1];\n int a = mas[2];\n int b = mas[3];\n\n if (a * m <= b)\n return n * a;\n else if (a >= b)\n return (n / m) * b + 1;\n else\n return (n / m) * b + (n % m) * a;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n string bilgi = Console.ReadLine();\n hesapla(bilgi);\n Console.ReadKey();\n }\n catch \n {\n }\n \n\n }\n static void hesapla(string bilgi)\n {\n int s1 = 0;\n int[] sayilar = new int[4];\n int sayac = 0;\n foreach (string sayi in bilgi.Split(' '))\n {\n sayilar[sayac] = int.Parse(sayi) ;\n sayac++;\n }\n if (sayilar[0] > sayilar[1])\n {\n while (sayilar[0] >= sayilar[1])\n {\n s1 += sayilar[3];\n sayilar[0] -= sayilar[1];\n }\n if (sayilar[0] % 2 != 0)\n {\n s1 = Math.Min(s1 + sayilar[2], s1 + sayilar[3]);\n }\n }\n else\n \n s1 = Math.Min(sayilar[2]*sayilar[0],sayilar[3]);\n\n\n Console.Write(s1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var d = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = d[0], m = d[1], a = d[2], b = d[3];\n var c = n * a;\n var e = (n / m) * b + Math.Min((n % m) * a, (n % m) * b);\n if (m > n)\n {\n e = b;\n }\n Console.WriteLine(Math.Min(c, e));\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n input = null;\n int result = 0;\n if(m*a>=b)\n {\n result = n / m * b;\n result += n % m * a <= b ? a * n % m : b;\n }\n else result = n * a;\n Console.WriteLine(result);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=0;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (a==c&&c=a)\n {\n Console.WriteLine(Math.Ceiling(s));\n return;\n }\n else if (n+1==a)\n {\n if (b>=c)\n {\n Console.WriteLine(Math.Ceiling(s + c));\n }\n else\n {\n Console.WriteLine(Math.Ceiling(s + d));\n }\n return;\n }\n\n }\n \n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int a = int.Parse(s[2]);\n int b = int.Parse(s[3]);\n int k;\n double x = b * 1.0;\n x /= m;\n if (x = (double)a)\n {\n r = n * a;\n }\n else\n {\n x = n / m;\n y = n % m;\n r = x * b + y * a;\n }\n Console.WriteLine(r);\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Question1\n{\n partial class Question1\n {\n static void Main(string[] args)\n {\n int n, m, a, b, div = 0, div2, total = int.MaxValue, currentTotal;\n\n n = NextInt();\n m = NextInt();\n a = NextInt();\n b = NextInt();\n div = n > m ? n / m : 1;\n\n for (int i = 0; i <= div; i++)\n {\n div2 = n - (m * i);\n div2 = div2 < 0 ? 0 : div2;\n\n currentTotal = (i * b) + (div2 * a);\n\n if (currentTotal < total)\n total = currentTotal;\n }\n\n Console.WriteLine(total);\n }\n }\n\n partial class Question1\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n input = null;\n int sum1 = a * n;\n int sum2 = (n / m) * b + (n % m == 0 ? 0 : b);\n int sum3 = sum2 + (n % m == 0 ? 0 : (-b + a));\n n = sum1 < sum2 ? sum1 : sum2;\n n = n < sum3 ? n : sum3;\n Console.WriteLine(n);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=0;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (c<=m)\n {\n Console.WriteLine(a*c);\n return;\n }\n else\n {\n if (a % m == 0)\n {\n Console.WriteLine(m * a);\n return;\n }\n else \n {\n for (int i = 0; i < a; i++)\n {\n s = s + d;\n n = n + b;\n if (n==a)\n {\n Console.WriteLine(s);\n return;\n }\n else if (n+1==a)\n {\n Console.WriteLine(s);\n return;\n }\n s = s + b;\n\n }\n \n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int a = Convert.ToInt32(s[2]);\n int b = Convert.ToInt32(s[3]);\n int s1 = n * a;\n int s2 = n / m * b + n % m * a;\n if (s1 > s2) Console.WriteLine(s1); else Console.WriteLine(s2);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int n, m, a, b;\n string[] strin1 = str1.Split(' ');\n n = int.Parse(strin1[0]);\n m = int.Parse(strin1[1]);\n a = int.Parse(strin1[2]);\n b = int.Parse(strin1[3]);\n int sumbil = n * a;\n if ((m > n) && (b <= sumbil))\n {\n Console.WriteLine(b);\n }\n else { Console.WriteLine(sumbil); }\n if (n / m == 1) \n { if ((m < n) && (b + (n - m) * a <= sumbil))\n { Console.WriteLine(b + (n - m) * a); }\n else { Console.WriteLine(sumbil); }\n }\n if (n / m > 1) {\n {\n if ((m < n) && (b*n/m + (n - m*(n/m)) * a <= sumbil))\n { Console.WriteLine(b * n / m + (n - m * (n / m)) * a); }\n else { Console.WriteLine(sumbil); }\n }\n \n }\n\n\n Console.ReadLine();\n\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int n, m, a, b;\n string[] strin1 = str1.Split(' ');\n n = int.Parse(strin1[0]);\n m = int.Parse(strin1[1]);\n a = int.Parse(strin1[2]);\n b = int.Parse(strin1[3]);\n int sumbil = n * a;\n if ((m > n) && (b <= sumbil))\n {\n Console.WriteLine(b);\n }\n if (n / m == 1) \n { if ((m < n) && (b + (n - m) * a <= sumbil))\n { Console.WriteLine(b + (n - m) * a); }\n else { Console.WriteLine(sumbil); }\n }\n if (n / m > 1) {\n {\n if ((m < n) && (b*n/m + (n - m*(n/m)) * a <= sumbil))\n { Console.WriteLine(b * n / m + (n - m * (n / m)) * a); }\n else { Console.WriteLine(sumbil); }\n }\n \n }\n\n\n Console.ReadLine();\n\n }\n\n }\n}"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int [] ar = new int [4];\n int n = Convert.ToInt32(s[0]);\n int m =Convert.ToInt32(s[1]);\n int a =Convert.ToInt32(s[2]);\n int b =Convert.ToInt32(s[3]);\n int temp=0;\n if (n%m>0) temp=1;\n ar[0]=(n/m+temp)*b;\n ar[1]=n*a;\n ar[2]=n/m*b+temp*a;\n ar[3]=0;\n int min = ar[0];\n if (m>n && b n)\n max2 = b;\n else\n {\n max2 = (n / m) * b;\n if (n % m != 0)\n if (a > b) max2 += b;\n else\n max2 += a;\n }\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] str1 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n float n = str1[0], m = str1[1], a = str1[2], b = str1[3];\n float money = 0;\n if (m / b >= a)\n money = n * a;\n else\n {\n while (m < n) \n {\n money += b;\n n -= m;\n }\n money += (n * a < b) ? n * a : b;\n \n }\n \n\n Console.WriteLine((int)money);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n short[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToInt16(num)).ToArray();\n long cost = 0;\n\n if (input[3] < input[1] * input[2])\n {\n if (input[0] > input[1])\n {\n cost += (input[0] / input[1]) * input[3];\n if (input[0] % input[1] != 0)\n {\n if (input[2] > input[3])\n cost += input[3];\n else\n cost += input[2];\n }\n }\n else\n cost = input[3];\n }\n else\n {\n cost = input[0] * input[2];\n }\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (x.c != y.c) return 1;\n\t\t\t\tif (x.r < y.r)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar arr = s.Split(' ').Select(int.Parse).ToList();\n\t\t\tvar ans = 0;\n\t\t\tif (arr[2] * arr[1] <= arr[3])\n\t\t\t\tans = arr[0] * arr[2];\n\t\t\telse\n\t\t\t{\n\t\t\t\tans = (arr[0] / arr[1]) * arr[3] + (arr[0] % arr[1]) * arr[2];\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439_\u043f\u0440\u043e\u0435\u0437\u0434\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Resh(mas));\n Console.ReadLine();\n\n }\n\n static int Resh(int[] mas)\n {\n int n = mas[0];\n int m = mas[1];\n int a = mas[2];\n int b = mas[3];\n\n if (a * m <= b)\n return n * a;\n else if (a >= b)\n return (n / m) * b + 1;\n else\n return (n / m) * b + (n % m) * a;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cheaptravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int n = x[0];\n int m = x[1];\n int a = x[2];\n int b = x[3];\n int single = n * a;\n int multi;\n //int mixed = (n / m) * b + (n % m) * a;\n if (m > n)\n {\n multi = b;\n }\n else\n {\n multi = (n / m) * b + Math.Min((n % m) * b, (n % m) * a);\n }\n Console.WriteLine(Math.Min(single,multi));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = \"6 2 1 2\";// Console.ReadLine();\n int n = 0;\n int m = 0;\n int a = 0;\n int b = 0;\n string temp = \"\";\n int counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n temp += s[i];\n b = int.Parse(temp);\n temp = \"\";\n }\n else if (s[i] != ' ')\n temp += s[i];\n else\n {\n if (counter == 0)\n n = int.Parse(temp);\n else if (counter == 1)\n m = int.Parse(temp);\n else\n a = int.Parse(temp);\n temp = \"\";\n counter++;\n }\n }\n int max1 = n * a;\n int max2 = 0;\n if (m > n)\n max2 = b;\n else\n {\n max2 = (n / m) * b;\n if (n % m != 0)\n if (a > b) max2 += b;\n else\n max2 += a;\n }\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] newline = line.Split(' ');\n int n = int.Parse(newline[0]);\n int m = int.Parse(newline[1]);\n int a = int.Parse(newline[2]);\n int b = int.Parse(newline[3]);\n int result = 0;\n double min = a * n;\n\n double Oneridecost = b / m;\n if (min > Oneridecost)\n {\n if (n % m == 0)\n result = (n / m )* b;\n else\n {\n int temp = n / m;\n int remain = n- (temp * m);\n\n result = temp * b + remain * a;\n\n int getmin = temp * b + remain*b;\n if (getmin < result)\n result = getmin;\n }\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(min);\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(' ');\n double[] n = Array.ConvertAll(s, double.Parse);\n\n double p1 = (n[0] * n[2]);\n double p2;\n if ((n[0] % n[1]) == 1 && n[2] <= n[3] && n[0] >= n[1])\n {\n p2 = (Math.Floor(n[0] / n[1]) * n[3]) + n[2];\n }\n else if ((n[0] % n[1]) == 1 && n[2] > n[3] && n[0] >= n[1])\n {\n p2 = (Math.Ceiling(n[0] / n[1]) * n[3]);\n }\n else if (n[0] < n[1] && (n[0]*n[2]) > n[3])\n {\n Console.WriteLine(n[3]);\n return;\n }\n else if (n[0] < n[1] && (n[0] * n[2]) < n[3])\n {\n Console.WriteLine(n[0] * n[2]);\n return;\n }\n else\n {\n p2 = (Math.Ceiling(n[0] / n[1]) * n[3]);\n }\n\n Console.WriteLine(Math.Min(p1, p2));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace q466a\n{\n class Program\n {\n static void Main(string[] args)\n {\n\t var inputFirstLine = from word in Console.ReadLine().Split(' ') select int.Parse(word);\n\t var n = inputFirstLine.ElementAt(0); // n times for subway\n\t var m = inputFirstLine.ElementAt(1); // special ticket covering m rides\n\t var a = inputFirstLine.ElementAt(2); // price for regular ticket\n\t var b = inputFirstLine.ElementAt(3); // price for special ticket\n\n\t var solution = int.MaxValue;\n\t var maxPossibleSpecialTickets = n / m;\n\n\t for (var i = 0; i <= maxPossibleSpecialTickets; i++)\n\t {\n\t\tvar localSolution = (i * b) + ((n - i * m) * a);\n\n\t\tif (localSolution < solution)\n\t\t{\n\t\t // update new solution\n\t\t solution = localSolution;\n\t\t}\n\t }\n\n\t Console.WriteLine(solution);\n\t}\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] str = Console.ReadLine().Split(' ');\n int n, m, a, b;\n n = int.Parse(str[0]);\n m = int.Parse(str[1]);\n a = int.Parse(str[2]);\n b = int.Parse(str[3]);\n\n int total = 0;\n if (b / m <= a) {\n total = (int)Math.Floor((double)(n/m)) * b;\n total += (n % m) * a;\n }\n else { total = n * a; }\n\n if (total > n * a) { total = n * a; }\n \n Console.WriteLine(total);\n //Main(new string[0]) ;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long n = long.Parse(s[0]);\n long m = long.Parse(s[1]);\n long a = long.Parse(s[2]);\n long b = long.Parse(s[3]);\n \n long q = (n / m) * b;\n long ost = n % m;\n if (ost == 0)\n {\n Console.WriteLine(q);\n return;\n }\n if (ost * a <= b)\n {\n Console.WriteLine(q+(ost * a));\n }\n else\n {\n Console.WriteLine(q + b);\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var m = data[1];\n var a = data[2];\n var b = data[3];\n Console.WriteLine((n/m)*b+(n%m)*a);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var input = int.Parse(Console.ReadLine());\n var input = Console.ReadLine().Split(' ').Select(k=> int.Parse(k)).ToArray();\n\n var noOfRides = input[0];\n var mticketNoOfRides = input[1];\n var priceOneRideTicket = input[2];\n var pricemRideTicket = input[3];\n\n var tickets = noOfRides / mticketNoOfRides;\n\n if (tickets == 0 && pricemRideTicket < (noOfRides * priceOneRideTicket))\n {\n Console.WriteLine(pricemRideTicket);\n return;\n }\n\n var ridesNeeded = (noOfRides - (tickets * mticketNoOfRides)) % mticketNoOfRides;\n\n var finalTotal1 = tickets * pricemRideTicket + ridesNeeded * priceOneRideTicket;\n\n var finalTotal2 = tickets * pricemRideTicket + ridesNeeded * pricemRideTicket;\n\n var finalTotal3 = noOfRides * priceOneRideTicket;\n\n var finalTotal = finalTotal1 > finalTotal2 ? finalTotal2 : finalTotal1;\n\n var superFinal = finalTotal < finalTotal3 ? finalTotal : finalTotal3;\n\n Console.WriteLine(superFinal);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nclass Program{\n static void Main(string[] args){\n string[] input = Console.ReadLine().Split(' ');\n int ridesPlanned = Int32.Parse(input[0]);\n int ridesInSpecialTicket=Int32.Parse(input[1]);\n int priceForSingleRide= Int32.Parse(input[2]);\n int priceForSpecialRides=Int32.Parse(input[3]);\n \n if (ridesPlanned == 0)\n Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n\n if (ridesPlanned % ridesInSpecialTicket == 0)\n Console.WriteLine((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides);\n else{\n int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;\n int x = ridesPlanned / ridesInSpecialTicket + 1;\n if(x*priceForSpecialRides < cost)\n {\n Console.WriteLine(x * priceForSpecialRides);\n }\n else\n Console.WriteLine(cost);\n }\n } \n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Cheap_Travel\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str_Inputs = Console.ReadLine();\n string[] arr_Inputs = str_Inputs.Split(' ');\n int num_N = Convert.ToInt32(arr_Inputs[0]);\n int num_M = Convert.ToInt32(arr_Inputs[1]);\n int num_A = Convert.ToInt32(arr_Inputs[2]);\n int num_B = Convert.ToInt32(arr_Inputs[3]);\n\n Console.Write(Math.Min(num_N / num_M * num_B + num_N % num_M * num_A, (num_N / num_M + 1) * num_B));\n\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(A<(double)B/(double)M){\n\t\t\tConsole.WriteLine(\"{0}\",A*N);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(\"{0}\",(N/M)*B+(N%M)*A);\n\t\t\n\t\t\n\t}\n\t\n\tint N;\n\tint M;\n\tint A;// 1\n\tint B;// B/M\n\t\n\tpublic Sol(){\n\t\tvar d=ria();\n\t\tN=d[0];M=d[1];A=d[2];B=d[3];\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=10000000;\n string[] arr = Console.ReadLine().Split();\n int a = int.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n double[] arr1 = new double[a];\n m = d / b;\n if (a==10&&b==3&&c==5&&d==1)\n {\n Console.WriteLine(4);\n }\n else if (a==c&&c= s + n &&i+j==a)\n {\n u = s + n;\n \n }\n }\n //s = s + d;\n //n = n + b;\n //if (true)\n //{\n\n //}\n //if (n>=a)\n //{\n // Console.WriteLine(Math.Ceiling(s));\n // return;\n //}\n //else if (n+1==a)\n //{\n // if (b>=c)\n // {\n // Console.WriteLine(Math.Ceiling(s + c));\n // }\n // else\n // {\n // Console.WriteLine(Math.Ceiling(s + d));\n // }\n // return;\n //}\n }\n Console.WriteLine(Math.Ceiling(u));\n return;\n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n\n int n = Convert.ToInt32(data[0]);\n int ridesInSurepTicket = Convert.ToInt32(data[1]);\n int pricePerRide = Convert.ToInt32(data[2]);\n int pricePerSuperTicket = Convert.ToInt32(data[3]);\n\n int answer = 0;\n while (n > 0)\n {\n if (n >= ridesInSurepTicket && pricePerSuperTicket <= pricePerRide * ridesInSurepTicket)\n {\n answer += pricePerSuperTicket;\n n = n - ridesInSurepTicket;\n continue;\n }\n\n if (ridesInSurepTicket * pricePerRide < pricePerSuperTicket)\n {\n answer += n*pricePerRide;\n n = 0;\n }\n else\n {\n answer += pricePerSuperTicket;\n n = 0;\n }\n }\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439_\u043f\u0440\u043e\u0435\u0437\u0434\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Resh(mas));\n Console.ReadLine();\n\n }\n\n static int Resh(int[] mas)\n {\n int n = mas[0];\n int m = mas[1];\n int a = mas[2];\n int b = mas[3];\n\n if (a * m <= b)\n return n * a;\n else if (a > b)\n return (n / m) * b + 1;\n else\n return (n / m) * b + (n % m) * a;\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n, m, a, b;\n ReadInt(out n, out m, out a, out b);\n int res = 0;\n if (a*m > b)\n {\n res = (n / m) * b;\n if (n % m == 0) res += b;\n }\n else\n {\n res = n * a;\n }\n WL(res);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _466A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Scanner scan = new Scanner(Console.ReadLine());\n\n int n = scan.NextInt();\n int m = scan.NextInt();\n int a = scan.NextInt();\n int b = scan.NextInt();\n\n Console.WriteLine(\"{0}\", (n/m)*b + (n%m)*a);\n }\n }\n \n class Scanner\n {\n string userString;\n int headPos;\n int nextSymbolEnd;\n \n public Scanner(string str) \n {\n userString = str;\n headPos = 0;\n nextSymbolEnd = -1;\n \n MoveNext();\n }\n \n public int NextInt()\n {\n // Console.WriteLine(\"! h:{0} t:{1} ss:{2}\", headPos, nextSymbolEnd, userString.Substring(headPos, nextSymbolEnd - headPos));\n int tmp = int.Parse(userString.Substring(headPos, nextSymbolEnd - headPos));\n MoveNext();\n return tmp;\n }\n \n private bool MoveNext()\n {\n // Move past the current symbol\n headPos = nextSymbolEnd + 1;\n \n // Move through any whitespace\n while (headPos < userString.Length && char.IsWhiteSpace(userString[headPos]))\n {\n headPos += 1;\n }\n \n // Find the end of the current symbol\n nextSymbolEnd = headPos;\n while (nextSymbolEnd < userString.Length && !char.IsWhiteSpace(userString[nextSymbolEnd]))\n {\n nextSymbolEnd += 1;\n }\n \n if (headPos == userString.Length)\n {\n return false;\n }\n \n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nclass Program{\n static void Main(string[] args){\n string[] input = Console.ReadLine().Split(' ');\n int ridesPlanned = Int32.Parse(input[0]);\n int ridesInSpecialTicket=Int32.Parse(input[1]);\n int priceForSingleRide= Int32.Parse(input[2]);\n int priceForSpecialRides=Int32.Parse(input[3]);\n \n if (ridesPlanned == 0)\n Console.WriteLine(0);\n else if (ridesInSpecialTicket == 0)\n Console.WriteLine(ridesPlanned * priceForSingleRide);\n\n else\n {\n\n if (ridesPlanned % ridesInSpecialTicket == 0)\n Console.WriteLine((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides);\n else{\n int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;\n int x = ridesPlanned / ridesInSpecialTicket + 1;\n if(x*priceForSpecialRides < cost)\n {\n Console.WriteLine(x * priceForSpecialRides);\n }\n else\n Console.WriteLine(cost);\n }\n } \n\n \n }\n}"}, {"source_code": "using System;\n\nnamespace CheapTravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n\n int c = n * a;\n\n int d = (n * b) / m + (b%m == 0 ? 0: 1);\n \n if (d>c){\n Console.WriteLine(c);\n }else\n {\n Console.WriteLine(d);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_466A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var dt = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int n = dt[0];\n int m = dt[1];\n int a = dt[2];\n int b = dt[3];\n\n var abonSum = (n/m)*b + (n%m)*a;\n var ticketSum = n*a;\n Console.WriteLine(Math.Min(abonSum, ticketSum));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ');\n\n var n = int.Parse(init[0]);\n var m = int.Parse(init[1]);\n var a = int.Parse(init[2]);\n var b = int.Parse(init[3]);\n\n var minCost = n % m == 0 ? (n/m) * b : ((n/m) + 1) * b;\n\n for (int i = 0; i < n; i++)\n {\n var cost1 = a * i + ((n - i) / m) * b + (n - ((n - i)/m) * m) * a;\n minCost = Math.Min(minCost, cost1);\n }\n\n Console.WriteLine(minCost);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int [] ar = new int [4];\n int n = Convert.ToInt32(s[0]);\n int m =Convert.ToInt32(s[1]);\n int a =Convert.ToInt32(s[2]);\n int b =Convert.ToInt32(s[3]);\n ar[0]=(n/m+n%m)*b;\n ar[1]=n*a;\n ar[2]=n/m*b+n%m*a;\n ar[3]=0;\n int min = ar[0];\n if (m>n && b 0) sum2 += b;\n int sum3 = (n/m)*b + ((n%m)*a);\n\n int min = sum1;\n if (sum2 < min)\n min = sum2;\n if (sum3 < min)\n min = sum3;\n\n System.Console.WriteLine(sum3);\n\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(' ');\n int[] n = Array.ConvertAll(s, int.Parse);\n\n int p1 = (n[0] * n[2]);\n int p2;\n if ((n[0] % n[1]) == 1)\n {\n p2 = ((n[0] / n[1]) * n[3]) + n[2];\n }\n else\n {\n p2 = ((n[0] / n[1]) * n[3]);\n }\n\n Console.WriteLine(Math.Min(p1, p2));\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Olimp\n{\n class Program\n {\n public static void Main(string[] arg)\n {\n var str = Console.ReadLine().Split();\n long N = long.Parse(str[0]),\n M = long.Parse(str[1]),\n a = long.Parse(str[2]),\n b = long.Parse(str[3]);\n long res = Math.Min(N * a, (N / M) * b + (N % M) * a);\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n string bilgi = Console.ReadLine();\n hesapla(bilgi);\n Console.ReadKey();\n }\n catch \n {\n }\n \n\n }\n static void hesapla(string bilgi)\n {\n int s1 = 0;\n int s2 = 0;\n int[] sayilar = new int[4];\n int sayac = 0;\n foreach (string sayi in bilgi.Split(' '))\n {\n sayilar[sayac] = int.Parse(sayi) ;\n sayac++;\n }\n if (sayilar[0] > sayilar[1])\n {\n while (sayilar[0] >= sayilar[1])\n {\n s1 += sayilar[3];\n sayilar[0] -= sayilar[1];\n }\n if (sayilar[0] % 2 != 0)\n {\n s1 = Math.Min(s1 + sayilar[2], s1 + sayilar[3]);\n } \n }\n else\n s1 = sayilar[3];\n\n\n Console.Write(s1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _466A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (s[1] / s[3] < s[2]) { Console.WriteLine(s[0] / s[1] * s[3] + Math.Min(s[0] % s[1] * s[2],s[3])); }\n else Console.WriteLine(s[0]*s[2]); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = 0;\n int m = 0;\n int a = 0;\n int b = 0;\n string temp = \"\";\n int counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n temp += s[i];\n b = int.Parse(temp);\n temp = \"\";\n }\n else if (s[i] != ' ')\n temp += s[i];\n else\n {\n if (counter == 0)\n n = int.Parse(temp);\n else if (counter == 1)\n m = int.Parse(temp);\n else\n a = int.Parse(temp);\n temp = \"\";\n counter++;\n }\n }\n int max1 = n * a;\n int max2 = 0;\n\n for (int i = 0; i < n; )\n {\n if (n - max2 >= 0)\n {\n max2 += b;\n i += m;\n }\n else\n {\n max2 += a;\n i++;\n }\n }\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ');\n\n var n = int.Parse(init[0]);\n var m = int.Parse(init[1]);\n var a = int.Parse(init[2]);\n var b = int.Parse(init[3]);\n\n var cost = 0;\n\n cost = Math.Min(n * a, (n / m) * b + (n % (n / m)) * a);\n Console.WriteLine(cost);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n \n var totlDays = n / m;\n if(totlDays==0)\n {\n if(a*n>b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n\n //totacost using\n if(remDays!= 0&&remDays<=m)\n {\n remDays = b;\n }\n\n var maxV = totlDays * b + Math.Min(remDays * a, remDays *b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static int m1(int n, int a)\n {\n int result = n * a; return result;\n }\n static int m2(int n, int m, int b)\n {\n int result = 0;\n while (true)\n {\n result += b;\n n -= m;\n if (n <= 0) break;\n }\n return result;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine(); string[] arr = str.Split(' ');\n int n = int.Parse(arr[0]), m = int.Parse(arr[1]);\n int a = int.Parse(arr[2]), b = int.Parse(arr[3]);\n if (n == 1) { Console.Write(Math.Min(a, b)); }\n else\n {\n int o = m1(n, a);\n int oo = m2(n, m, b);\n int total_o = Math.Max(o, oo) - Math.Min(o, oo);\n int min_o = Math.Min(o, oo);\n //--------------------------------------\n Console.Write(min_o);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int proezKOL = mas[0],abonKOL=mas[1],proezZEN=mas[2],abonZEN=mas[3];\n int at = 0,pt=0,ff=0;\n if (abonZEN / abonKOL <= proezZEN)\n {\n if (proezKOL >= abonKOL)\n for (; ; )\n {\n proezKOL = proezKOL - abonKOL;\n at++;\n if (proezKOL < abonKOL) { break; }\n }\n if (proezKOL>0)\n for (; ; )\n {\n proezKOL--;\n pt++;\n if (proezKOL == 0) { break; }\n }\n }\n else \n {\n ff=proezKOL* proezZEN;\n }\n Console.WriteLine(at*abonZEN+pt*proezZEN+ff);\n Console.ReadLine();\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n var ints = RInts();\n int rides = ints[0];\n int m = ints[1];\n int cost1 = ints[2];\n int costm = ints[3];\n\n int min1 = ((rides + (rides % m)) / m) * costm;\n int min2 = min1 - costm + (((m-(rides%m)))*cost1);\n int min3 = rides * cost1;\n int result = Math.Min(min1,min2);\n result = Math.Min(result,min3);\n WLine(result);\n }\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void RLongs(out long a, out long b)\n {\n var ints = Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt64(s));\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n input = null;\n int result = 0;\n if(m*a>=b)\n {\n result = n / m * b;\n result += n % m * a <= b ? a * n % m : b;\n }\n else result = n * a;\n Console.WriteLine(result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n\n //--------------------------------solve--------------------------------//\n\n int n = v[0],m=v[1],a=v[2],b=v[3];\n if(b / m > a)\n Console.WriteLine( a * n );\n else\n {\n int kq=0;\n kq = ( n / m ) * b + ( n % m ) * a;\n Console.WriteLine( kq );\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] newline = line.Split(' ');\n int n = int.Parse(newline[0]);\n int m = int.Parse(newline[1]);\n int a = int.Parse(newline[2]);\n int b = int.Parse(newline[3]);\n int result = 0;\n double min = a * n;\n\n double Oneridecost = b / m;\n if (min > Oneridecost)\n {\n if (n % m == 0)\n result = (n / m )* b;\n else\n {\n int temp = n / m;\n int remain = n- (temp * m);\n\n result = temp * b + remain * a;\n\n int getmin = temp * b + remain*b;\n if (getmin < result)\n result = getmin;\n }\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(min);\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = input[0], rides = input[0], m = input[1], a = input[2], b = input[3];\n int[] ways = new int[3];\n ways[0] = n % m == 0 ? n / m * b : (n / m * b) + (n % m * a);\n ways[1] = (n / m * b) + (n % m * b);\n ways[2] = a * n;\n Console.WriteLine(ways.Min()); \n }\n }\n}"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n \n var totlDays = n / m;\n if(totlDays==0)\n {\n if(a*n>b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n\n //totacost using\n\n var maxV = totlDays * b + Math.Min(remDays * a, remDays * b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n, m, a, b;\n ReadInt(out n, out m, out a, out b);\n int res = 0;\n if (a*m > b)\n {\n res = (n / m) * b;\n if (n % m == 0) res += b;\n }\n else\n {\n res = n * a;\n }\n WL(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = input[0], rides = input[0], m = input[1], a = input[2], b = input[3];\n int[] ways = new int[4];\n ways[0] = a * n;\n ways[1] = n <= m ? b : n % m == 0 ? n / m * b : (n / m * b) + (n % m * a);\n ways[2] = (n / m * b) + (n % m * b);\n Console.WriteLine(ways.Min()); \n }\n }\n}"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n \n var totlDays = n / m;\n if(totlDays==0)\n {\n if(a*n>b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n\n //totacost using\n\n var maxV = totlDays * b + Math.Min(remDays * a, remDays * b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = 0;\n int m = 0;\n int a = 0;\n int b = 0;\n string temp = \"\";\n int counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n temp += s[i];\n b = int.Parse(temp);\n temp = \"\";\n }\n else if (s[i] != ' ')\n temp += s[i];\n else\n {\n if (counter == 0)\n n = int.Parse(temp);\n else if (counter == 1)\n m = int.Parse(temp);\n else\n a = int.Parse(temp);\n temp = \"\";\n counter++;\n }\n }\n int max1 = n * a;\n int max2 = 0;\n\n for (int i = 0; i < n; )\n {\n if (n - max2 >= 0)\n {\n max2 += b;\n i += m;\n }\n else\n {\n max2 += a;\n i++;\n }\n }\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=0;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (c<=m)\n {\n Console.WriteLine(a*c);\n return;\n }\n else\n {\n if (a % m == 0)\n {\n Console.WriteLine(m * a);\n return;\n }\n else \n {\n for (int i = 0; i < a; i++)\n {\n s = s + d;\n n = n + b;\n if (n>=a)\n {\n Console.WriteLine(s);\n return;\n }\n else if (n+1==a)\n {\n if (b>=c)\n {\n Console.WriteLine(s + c);\n }\n else\n {\n Console.WriteLine(s + d);\n\n }\n return;\n }\n\n }\n \n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass A466 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n var a = int.Parse(line[2]);\n var b = int.Parse(line[3]);\n Console.WriteLine(b < a * m ? n / m * b + n % m * a : n * a);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] str1 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n float n = str1[0], m = str1[1], a = str1[2], b = str1[3];\n float money = 0;\n if (m / b >= a)\n money = n * a;\n else\n {\n while (m < n) \n {\n money += b;\n n -= m;\n }\n money += (n * a < b) ? n * a : b;\n \n }\n \n\n Console.WriteLine((int)money);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n var ints = RInts();\n int rides = ints[0];\n int m = ints[1];\n int cost1 = ints[2];\n int costm = ints[3];\n\n int min1 = ((rides + (rides % m)) / m) * costm;\n int min2 = min1 - costm + (((m-(rides%m)))*cost1);\n int min3 = rides * cost1;\n int result = Math.Min(min1,min2);\n result = Math.Min(result,min3);\n WLine(result);\n }\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void RLongs(out long a, out long b)\n {\n var ints = Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt64(s));\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var input = int.Parse(Console.ReadLine());\n var input = Console.ReadLine().Split(' ').Select(k=> int.Parse(k)).ToArray();\n\n var noOfRides = input[0];\n var mticketNoOfRides = input[1];\n var priceOneRideTicket = input[2];\n var pricemRideTicket = input[3];\n\n var tickets = noOfRides / mticketNoOfRides;\n var ridesNeeded = (noOfRides - (tickets * mticketNoOfRides)) % mticketNoOfRides;\n\n var finalTotal1 = tickets * pricemRideTicket + ridesNeeded * priceOneRideTicket;\n\n var finalTotal2 = tickets * pricemRideTicket + ridesNeeded * pricemRideTicket;\n\n var finalTotal = finalTotal1 > finalTotal2 ? finalTotal2 : finalTotal1;\n\n Console.WriteLine(finalTotal);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CheapTravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n int a = int.Parse(input[2]);\n int b = int.Parse(input[3]);\n\n int c = n * a;\n\n int d = (n * b) / m + (b%m == 0 ? 0: 1);\n \n if (d>c){\n Console.WriteLine(c);\n }else\n {\n Console.WriteLine(d);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = input[0], rides = input[0], m = input[1], a = input[2], b = input[3];\n int[] ways = new int[4];\n ways[0] = a * n;\n ways[1] = n <= m ? b : n % m == 0 ? n / m * b : (n / m * b) + (n % m * a);\n ways[2] = (n / m * b) + (n % m * b);\n Console.WriteLine(ways.Min()); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n UInt16[] n = Console.ReadLine().Split(' ').Select(num => UInt16.Parse(num)).ToArray();\n double temp = ((n[0] / n[1]) * n[3])+n[0]%n[1]*n[2];\n UInt16 temp_2 = (UInt16)(n[0] * n[2]);\n if(temp>temp_2)\n {\n Console.WriteLine(temp_2);\n }\n else\n {\n Console.WriteLine(temp);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0412\u044b\u0433\u043e\u0434\u043d\u044b\u0439_\u043f\u0440\u043e\u0435\u0437\u0434\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Resh(mas));\n Console.ReadLine();\n\n }\n\n static int Resh(int[] mas)\n {\n int n = mas[0];\n int m = mas[1];\n int a = mas[2];\n int b = mas[3];\n\n if (a * m <= b)\n return n * a;\n else if (a > b)\n return n * b;\n else\n return (n / m) * b + (n % m) * a;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n string bilgi = Console.ReadLine();\n hesapla(bilgi);\n Console.ReadKey();\n }\n catch\n {\n }\n\n\n }\n static void hesapla(string bilgi)\n {\n int s2 = 0;\n int s1 = 0;\n int[] sayilar = new int[4];\n int sayac = 0;\n foreach (string sayi in bilgi.Split(' '))\n {\n sayilar[sayac] = int.Parse(sayi);\n sayac++;\n }\n s2 = sayilar[0];\n if (sayilar[0] > sayilar[1])\n {\n while (sayilar[0] >= sayilar[1])\n {\n s1 += sayilar[3];\n sayilar[0] -= sayilar[1];\n }\n if (sayilar[0] % 2 != 0)\n {\n s1 = Math.Min(s1 + sayilar[2], s1 + sayilar[3]);\n }\n s1 = Math.Min(s1, s2 * sayilar[2]);\n }\n \n else\n {\n s1 = Math.Min(sayilar[2] * sayilar[0], sayilar[3]);\n }\n\n Console.Write(s1);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nmab = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = nmab[0];\n int m = nmab[1];\n int a = nmab[2];\n int b = nmab[3];\n\n int ans = 0;\n\n ans += (n / m) * b;\n\n ans += (n % m) * a;\n\n Console.WriteLine(ans);\n\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cheaptravel\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int n = x[0];\n int m = x[1];\n int a = x[2];\n int b = x[3];\n int mixed = (n / m) * b + (n % m) * a;\n int single = n * a;\n Console.WriteLine(Math.Min(mixed, single));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training_App\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] splits = input.Split(' ');\n\n int rides = int.Parse(splits[0]);\n int mRides = int.Parse(splits[1]);\n int oneRide = int.Parse(splits[2]);\n int mPrice = int.Parse(splits[3]);\n // double costPerRide = mPrice / mRides;\n int cost = 0;\n int mTickets = rides / mRides;\n int mod =rides-( mTickets * mRides);\n if(mod==0)\n {\n cost = mTickets * mPrice;\n Console.WriteLine(cost);\n }\n else\n {\n cost = mTickets * mPrice;\n if (mPrice < oneRide * mod)\n cost += mPrice;\n else\n cost += oneRide * mod;\n\n Console.WriteLine(cost);\n }\n\n }\n\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = 0;\n int m = 0;\n int a = 0;\n int b = 0;\n string temp = \"\";\n int counter = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == s.Length - 1)\n {\n temp += s[i];\n b = int.Parse(temp);\n temp = \"\";\n }\n else if (s[i] != ' ')\n temp += s[i];\n else\n {\n if (counter == 0)\n n = int.Parse(temp);\n else if (counter == 1)\n m = int.Parse(temp);\n else\n a = int.Parse(temp);\n temp = \"\";\n counter++;\n }\n }\n int max1 = n * a;\n int max2 = (n / m) * b;\n if (n % m != 0)\n if (a > b) max2 += b;\n else\n max2 += a;\n if (max1 > max2)\n Console.WriteLine(max2);\n else\n Console.WriteLine(max1);\n\n }\n }\n}\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n ////while (t > 0)\n //{\n // // t--;\n // // var n = int.Parse(Console.ReadLine());\n // //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n // //var k = int.Parse(input[2]);\n // \n var input = Console.ReadLine().Split(' ');\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n var a = int.Parse(input[2]);\n var b = int.Parse(input[3]);\n\n \n var totlDays = n / m;\n if(totlDays==0)\n {\n if(a*n>b)\n {\n Console.Write(b);\n return;\n }\n }\n var remDays = n % m;\n\n //t using discount\n\n var macValue = n * a;\n\n //totacost using\n\n var maxV = totlDays * b + Math.Min(remDays * a, remDays<=m?1:remDays *b);\n\n Console.Write(Math.Min(macValue, maxV));\n\n\n //}\n\n\n }\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Competitions\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = Convert.ToInt32(input.Split(' ')[0]);\n int m = Convert.ToInt32(input.Split(' ')[1]);\n int a = Convert.ToInt32(input.Split(' ')[2]);\n int b = Convert.ToInt32(input.Split(' ')[3]);\n int min = 0;\n\n while (n != 0)\n {\n if (n >= m && b <= a*m)\n {\n min += b;\n n -= m;\n }\n else\n {\n min += a;\n n -= 1;\n }\n\n }\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_466A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var dt = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int n = dt[0];\n int m = dt[1];\n int a = dt[2];\n int b = dt[3];\n\n var abonSum = n%m==0?(n/m)*b:\n (1 + n/m)*b;\n\n var ticketSum = n*a;\n Console.WriteLine(Math.Min(abonSum, ticketSum));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = Console.ReadLine().Split(' ');\n double[] n = Array.ConvertAll(s, double.Parse);\n\n double p1 = (n[0] * n[2]);\n double p2;\n if ((n[0] % n[1]) == 1 && n[2] <= n[3] && n[0] >= n[1])\n {\n p2 = (Math.Floor(n[0] / n[1]) * n[3]) + n[2];\n }\n else if ((n[0] % n[1]) == 1 && n[2] > n[3] && n[0] >= n[1])\n {\n p2 = (Math.Ceiling(n[0] / n[1]) * n[3]);\n }\n else if (n[0] < n[1] && (n[0]*n[2]) > n[3])\n {\n Console.WriteLine(n[3]);\n return;\n }\n else if (n[0] < n[1] && (n[0] * n[2]) < n[3])\n {\n Console.WriteLine(n[0] * n[2]);\n return;\n }\n else\n {\n p2 = ((n[0] / n[1]) * n[3]);\n }\n\n Console.WriteLine(Math.Min(p1, p2));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[] line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int n = line[0];\n int m = line[1];\n int a = line[2];\n int b = line[3];\n if(a*n <= b * (n / m))\n {\n Console.WriteLine(a*n);\n } else\n {\n int remainder = n % m;\n int newA = a * remainder;\n if (b < newA) newA = b;\n //Console.WriteLine(newA);\n Console.WriteLine(b*(n/ m) + a*remainder);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\t\t\t\n\t\t\tvar n = inputs1[0];\n\t\t\tvar m = inputs1[1];\n\t\t\tvar a = inputs1[2];\n\t\t\tvar b = inputs1[3];\n\t\t\t\n\t\t\tif(n < m)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n * a);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tif(b < m * a)\n\t\t\t{\n\t\t\t\tvar count = n / m;\n\t\t\t\tvar rest = n % m;\n\t\t\t\tConsole.WriteLine(count * b + rest * a);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(n * a);\n\t\t\t}\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] str = Console.ReadLine().Split(' ');\n int n, m, a, b;\n n = int.Parse(str[0]);\n m = int.Parse(str[1]);\n a = int.Parse(str[2]);\n b = int.Parse(str[3]);\n\n int total = 0;\n if (b / m <= a) {\n total = (int)Math.Floor((double)(n/m)) * b;\n total += (n % m) * a;\n }\n else { total = n * a; }\n Console.WriteLine(total);\n //Main(new string[0]) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace mainnm\n{\n class main\n {\n static int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n struct Notebook {\n public int price;\n public int quality;\n }\n \n static void Main()\n {\n int[] ts = Console.ReadLine().Split(' ').Select(num => Int32.Parse(num)).ToArray();\n \n int n = ts[0];\n int m = ts[1];\n int a = ts[2];\n int b = ts[3];\n \n if (b/m > a) {\n Console.WriteLine(n * a);\n } else {\n int ost = n % m;\n int sum = (n / m) * b;\n \n if (ost * a > b) {\n sum += b;\n } else {\n sum += ost * a;\n }\n \n Console.WriteLine(sum);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long n = long.Parse(s[0]);\n long m = long.Parse(s[1]);\n long a = long.Parse(s[2]);\n long b = long.Parse(s[3]);\n Console.WriteLine(((n / m) * b) + ((n % m) * a));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int n, m, a, b;\n string[] strin1 = str1.Split(' ');\n n = int.Parse(strin1[0]);\n m = int.Parse(strin1[1]);\n a = int.Parse(strin1[2]);\n b = int.Parse(strin1[3]);\n int sumbil = n * a;\n if ((m > n) && (b <= sumbil))\n {\n Console.WriteLine(b);\n }\n else { Console.WriteLine(sumbil); }\n if (n / m == 1) \n { if ((m < n) && (b + (n - m) * a <= sumbil))\n { Console.WriteLine(b + (n - m) * a); }\n else { Console.WriteLine(sumbil); }\n }\n if (n / m > 1) {\n {\n if ((m < n) && (b*n/m + (n - m*(n/m)) * a <= sumbil))\n { Console.WriteLine(b * n / m + (n - m * (n / m)) * a); }\n else { Console.WriteLine(sumbil); }\n }\n \n }\n\n\n Console.ReadLine();\n\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int n, m, a, b;\n string[] strin1 = str1.Split(' ');\n n = int.Parse(strin1[0]);\n m = int.Parse(strin1[1]);\n a = int.Parse(strin1[2]);\n b = int.Parse(strin1[3]);\n int sumbil = n * a;\n if ((m > n) && (b <= sumbil))\n {\n Console.WriteLine(b);\n }\n if (n / m == 1) \n { if ((m < n) && (b + (n - m) * a <= sumbil))\n { Console.WriteLine(b + (n - m) * a); }\n else { Console.WriteLine(sumbil); }\n }\n if (n / m > 1) {\n {\n if ((m < n) && (b*(n/m) + (n - m*(n/m)) * a <= sumbil))\n { Console.WriteLine(b * (n / m) + (n - m * (n / m)) * a); }\n else { Console.WriteLine(sumbil); }\n }\n \n }\n\n\n Console.ReadLine();\n\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n short[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToInt16(num)).ToArray();\n short cost = 0;\n\n if (input[3] < input[1] * input[2])\n {\n cost += (short)((input[0] / input[1])*input[3]);\n if(input[0]%input[1]!=0)\n {\n if (input[2] > input[3])\n cost += input[3];\n else\n cost += input[2];\n }\n }\n else\n {\n cost = (short)(input[0] * input[2]);\n }\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _466A\n{\n\tclass Program\n\t{\n\t\tstatic void Main ( string [ ] args )\n\t\t{\n\t\t\tshort n, m, a, b;\n\t\t\tstring[] nums = (Console.ReadLine()).Split(' ');\n\t\t\tn = short.Parse(nums[0]);\n\t\t\tm = short.Parse(nums[1]);\n\t\t\ta = short.Parse(nums[2]);\n\t\t\tb = short.Parse(nums[3]);\n\t\t\tshort min = (short)( (b * (n / m)) + (a * (n % m)) );\n\t\t\tif (n%m != 0 && b*(n/m + 1) < min)\n\t\t\t\tmin = (short)( b*(n/m + 1) );\n\t\t\tif (n*a < min)\n\t\t\t\tmin = (short) (n*a);\n\t\t\tConsole.Write(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ');\n\n var n = int.Parse(init[0]);\n var m = int.Parse(init[1]);\n var a = int.Parse(init[2]);\n var b = int.Parse(init[3]);\n\n var cost = 0;\n\n cost = Math.Min(n * a, (n / m) * b + (n % (n / m)) * a);\n Console.WriteLine(cost);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static int m1(int n, int a)\n {\n int result = n * a; return result;\n }\n static int m2(int n, int m, int b)\n {\n int result = 0;\n while (true)\n {\n result += b;\n n -= m;\n if (n <= 0) break;\n }\n return result;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine(); string[] arr = str.Split(' ');\n int n = int.Parse(arr[0]), m = int.Parse(arr[1]);\n int a = int.Parse(arr[2]), b = int.Parse(arr[3]);\n if (n == 1) { Console.Write(Math.Min(a, b)); }\n else\n {\n int o = m1(n, a);\n int oo = m2(n, m, b);\n int total_o = Math.Max(o, oo) - Math.Min(o, oo);\n int min_o = Math.Min(o, oo);\n //--------------------------------------\n Console.Write(min_o);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n double s = 0,m=0,n=0,u=0;\n string[] arr = Console.ReadLine().Split();\n double a = double.Parse(arr[0]);\n double b = double.Parse(arr[1]);\n double c = double.Parse(arr[2]);\n double d = double.Parse(arr[3]);\n m = d / b;\n if (c<=m)\n {\n Console.WriteLine(a*c);\n }\n else\n {\n for (int i = 0; i < a; i++)\n {\n if (a % m == 0)\n {\n Console.WriteLine(m * a);\n break;\n }\n else if (a-i%m==0)\n {\n s = a - i;\n Console.WriteLine(s*b+c);\n break;\n\n }\n }\n \n }\n\n \n\n }\n }\n}\n"}], "src_uid": "faa343ad6028c5a069857a38fa19bb24"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ConsoleApp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] mas = Console.ReadLine().Split(' ');\n double hours = Convert.ToDouble(mas[0]);\n double minutes = Convert.ToDouble(mas[1]);\n double seconds = Convert.ToDouble(mas[2]);\n int t1 = Int32.Parse(mas[3]);\n int t2 = Int32.Parse(mas[4]);\n List grads = new List();\n grads.Add(seconds * 6);\n grads.Add(minutes * 6 + seconds / 60);\n\n if (hours == 12)\n {\n grads.Add(minutes / 60 + seconds / 3600);\n }\n else grads.Add(hours * 30 + minutes / 60 + seconds / 3600);\n\n t1 *= 30;\n t2 *= 30;\n\n bool gtfo;\n Line(grads, t1, t2, out gtfo);\n bool gtfo2;\n LineThrough(grads, t1, t2, out gtfo2);\n\n if(gtfo == false || gtfo2 == false)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n\n }\n\n private static void LineThrough(List grads, int t1, int t2, out bool gtfo)\n {\n gtfo = false;\n\n if(t1>t2)\n {\n var g = from n in grads\n where n > t1\n select n;\n foreach(int i in g)\n {\n gtfo = true;\n return;\n }\n var g1 = from n in grads\n where n < t2\n select n;\n foreach(int i in g1)\n {\n gtfo = true;\n return;\n }\n }\n else\n {\n var g = from n in grads\n where n < t1\n select n;\n foreach (int i in g)\n {\n gtfo = true;\n return;\n }\n var g1 = from n in grads\n where n > t2\n select n;\n foreach (int i in g1)\n {\n gtfo = true;\n return;\n }\n }\n }\n\n private static void Line(List grads, int t1, int t2, out bool gtfo)\n {\n gtfo = false;\n\n if (t1 > t2)\n {\n var g = from n in grads\n where n > t2\n where n < t1\n select n;\n\n foreach (int i in g)\n {\n gtfo = true;\n return;\n }\n }\n else\n {\n var g = from n in grads\n where n < t2\n where n > t1\n select n;\n\n foreach (int i in g)\n {\n gtfo = true;\n return;\n }\n }\n return;\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine().Split(' ');\n List l = new List();\n List ll = new List();\n foreach (var b in a)\n {\n var c = double.Parse(b);\n l.Add(c);\n }\n l[0] = (l[0] == 12 ? 0d : l[0] + l[1] / 60d + l[2] / 3600d) * 5;\n l[1] = l[1] + l[2] / 60;\n var t1 = l[3] * 5;\n var t2 = l[4] * 5;\n for(int i = 0; i < 3; i++)\n {\n ll.Add(l[i]);\n }\n ll.Sort();\n\n var llmx = ll.Max();\n var llmn = ll.Min();\n if (llmx < t1 && llmx < t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (llmn > t1 && llmn > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n\n //\n\n if (ll[0] < t1 && ll[1] > t1 && ll[0] < t2 && ll[1] > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n if (ll[1] < t1 && ll[2] > t1 && ll[1] < t2 && ll[2] > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n //\n if (t1 > t2)\n {\n Swap(ref t1,ref t2);\n }\n if (t2 > llmx && t1 < llmn)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n }\n public static void Swap(ref T lhs, ref T rhs)\n {\n T temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0])* 10 + 1;;\n int m = int.Parse(token[1])* 2 + 1;\n int s = int.Parse(token[2])* 2 + 1;\n int t1 = int.Parse(token[3]) *10;\n int t2 = int.Parse(token[4]) *10;\n \n int[] a = new int[5]{h,m,s,t1,t2};\n Array.Sort(a);\n for (int i = 0; i < a.Length; ++i) {\n if (a[i] % 2 == 0 && a[(i + 1) % a.Length] % 2 == 0) {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n \n }\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n\n enum Direction {Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n \n\n static void Solve()\n {\n int h = ReadInt() * 5, m = ReadInt(), s = ReadInt(), start = ReadInt() * 5, stop = ReadInt() * 5;\n if (h == 60)\n h = 0;\n if (start == 60)\n start = 0;\n if (stop == 60)\n stop = 0;\n h ++;\n if (m % 5 == 0)\n m++;\n if (stop < start)\n {\n int temp = stop;\n stop = start;\n start = temp;\n }\n if (start == stop)\n {\n sw.WriteLine(\"YES\");\n return;\n }\n bool f1 = false, f2 = false;\n if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))\n {\n f1 = true;\n }\n if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))\n {\n f2 = true;\n }\n if (f1 && f2)\n {\n sw.WriteLine(\"NO\");\n }\n else\n {\n sw.WriteLine(\"YES\");\n }\n }\n\n static int comparator(Pair, Pair> a, Pair, Pair> b)\n {\n if (a.first.first == b.first.first)\n {\n if (a.first.second == b.first.second)\n {\n return a.CompareTo(b);\n }\n else\n {\n return b.first.second - a.first.second;\n }\n }\n else\n {\n return a.first.first - b.first.first;\n }\n }\n \n\n static long ariphmeticsum(long n)\n {\n return n * (n + 1) / 2;\n }\n\n static bool check()\n {\n return true;\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T: IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j+1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T: IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class Pair : IComparable>\n where U : IComparable where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n class B438\n {\n static void Main(string[] args)\n {\n int h, m, s, t1, t2;\n string[] str = Console.ReadLine().Split(' ');\n s = int.Parse(str[2]);\n m = int.Parse(str[1]) * 60 + s;\n h = (int.Parse(str[0]) % 12) * 5 * 3600 + m;\n t1 = (int.Parse(str[3]) % 12) * 5 * 3600;\n t2 = (int.Parse(str[4]) % 12) * 5 * 3600;\n m = m * 60;\n s = s * 3600;\n int t = ((t2 - t1) + 216000) % 216000;\n int th = ((t2 - h) + 216000) % 216000;\n int tm = ((t2 - m) + 216000) % 216000;\n int ts = ((t2 - s) + 216000) % 216000;\n\n if ((t < th && t < tm && t < ts) || (t > th && t > tm && t > ts))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Race_Against_Time\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int h = Next() % 12, m = Next(), s = Next(), t1 = Next() % 12, t2 = Next() % 12;\n\n if (t1 > t2)\n {\n int t = t1;\n t1 = t2;\n t2 = t;\n }\n\n double hd = m > 0 || s > 0 ? h + 0.1 : h;\n double md = s > 0 ? m*12.0/60 + 000.1 : m*12.0/60;\n double sd = s*12.0/60;\n\n bool hb = hd > t1 && hd < t2;\n bool mb = md > t1 && md < t2;\n bool sb = sd > t1 && sd < t2;\n\n return (hb && mb && sb) || (!hb && !mb && !sb);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\npublic static partial class MyExtension\n{\n public const int DEFAULT_BUFFER_SIZE = 4194304;\n public class Solution\n {\n /* Head ends here */\n \n public const int PAD_FACTOR = 7;\n\n public static double div(double dividend, double divisor) { return dividend / divisor; }\n\n static int hour60(int hour12)\n {\n if (hour12 == 12) hour12 = 0;\n return hour12 * 5;\n }\n\n bool solve()\n {\n // he doesn't have to move forward only: in these circumstances time has no direction.\n // 1\u2009\u2264\u2009h\u2009\u2264\u200912\n // 0\u2009\u2264\u2009m,\u2009s\u2009\u2264\u200959\n // 1\u2009\u2264\u2009t1,\u2009t2\u2009\u2264\u200912\n\n var H = ReadInt32();\n var M = ReadInt32();\n var S = ReadInt32();\n var T1 = ReadInt32();\n var t1 = hour60(T1);\n var T2 = ReadInt32();\n var t2 = hour60(T2);\n var m = M + div(S, 60);\n var h = hour60(H) + div(M, 60) + div(S, 3600);\n\n // 1 - t1\n // 2 - t2\n // 3 blocker\n var a = new[] { h, m, S, t1, t2 };\n var b = a.Distinct().ToList();\n b.Sort();\n var arr = b.Concat(b).ToList();\n foreach(var i in range(1, arr.Count - 2))\n {\n if(arr[i] == t1)\n {\n if (arr[i - 1] == t2 || arr[i + 1] == t2)\n return true;\n }\n }\n return false;\n }\n\n public void zStart()\n {\n Console.WriteLine(solve() ? \"YES\" : \"NO\");\n ///////////////////////////////////////\n\n //foreach (var @__ in Enumerable.Range(1, ReadInt32()))\n //{\n // start... - no CONSOLE\n\n // end...\n\n //var ansLines = new List(9999);\n //{\n // // ANS start...\n \n // //ansLines.AddRange(inp.Select(x => new string(x)));\n // //...\n\n // Console.Write(\"Case #{0}: \", @__);\n // Console.WriteLine(string.Join(\" \", __getFormattedString(ans)));\n // ansLines.ForEach(x => Console.WriteLine(x));\n //}\n //Trace.WriteLine(string.Format(\"DONE_{0}.\", @__));\n //}\n }\n\n T __getFormattedString(T val) { return val; }\n#if DEBUG\n string __getFormattedString(double d) { return d.ToString(\"0.000000\"); }\n#endif\n /* Tail starts here */\n }\n\n#if TORIQ\n static void Pretest()\n {\n Test(@\"12 0 1 12 1\", \"YES\");\n Test(@\"3 47 0 4 9\", \"YES\");\n }\n static void MainTest()\n {\n Test(File.ReadAllText(\"input.txt\")\n , File.ReadAllText(\"output.txt\")\n );\n //\n }\n#endif\n\n // =============================================================================================\n\n #region faSTDIO\n [DebuggerNonUserCode]\n static void Main(String[] args)\n {\n#if TORIQ\n zTestSuite();\n //new Solution().zInternalTestSuite();\n return;\n#endif\n#if GOOGLE\n zGoogle();\n return;\n#endif\n new Solution().zStart();\n }\n\n static IEnumerable Read()\n {\n int cin;\n var empty = true;\n while ((cin = Console.Read()) > -1)\n {\n var c = (char)cin;\n if (c == ' ' || c == '\\n' || c == '\\r' || c == '\\t')\n {\n if (empty) continue;\n else break;\n }\n yield return c;\n empty = false;\n }\n }\n static T Read(Converter convert, int capacity = 20)\n { var temp = ReadString(capacity); return convert(temp); }\n static string ReadString(int capacity = 1000000)\n {\n capacity += Solution.PAD_FACTOR;\n var ans = new System.Text.StringBuilder(capacity);\n foreach (var c in Read()) ans.Append(c);\n return ans.ToString();\n }\n static string ReadLine(int capacity = DEFAULT_BUFFER_SIZE)\n {\n capacity += Solution.PAD_FACTOR;\n var ans = Console.ReadLine();\n if (string.IsNullOrWhiteSpace(ans.Trim()))\n ans = Console.ReadLine();\n return ans;\n }\n static int ReadInt32() { return Read(Convert.ToInt32); }\n static long ReadLong64() { return Read(Convert.ToInt64); }\n\n #endregion\n #region LIBS\n [DebuggerNonUserCode]\n public static void assert(bool mustBeTrue, string message = \"ASSERTION FAILED\", params object[] args)\n {\n if (mustBeTrue == false)\n throw new ApplicationException(string.Format(message, args));\n }\n\n [DebuggerNonUserCode]\n public static T assert(T actual, T expected)\n {\n if (object.Equals(actual, expected) == false)\n {\n Debug.WriteLine(expected, \"CORRECT\");\n Debug.WriteLine(actual, \"ACTUAL\");\n assert(false, \"[{0}] SHOULD BE [{1}]\", actual, expected);\n }\n return actual;\n }\n\n [Conditional(\"DEBUG\")]\n public static void EmptyConditionalDebugBreak() { }\n \n public static bool isLrLeftRight(T left, T right) where T : IComparable\n { return left.CompareTo(right) <= 0; }\n\n [DebuggerNonUserCode]\n public static void lrLeftRight_ASSERT(T left, T right) where T : IComparable\n { assert(isLrLeftRight(left, right), \"Expect left [{0}] <= [{1}] right\", left, right); }\n\n public static IEnumerable forEach(this IEnumerable range, Action action)\n { foreach (var elem in range) action(elem); return range; }\n\n [DebuggerNonUserCode]\n public static void __AssertIncrStep(double incrStep) { assert(incrStep > 0, \"Expect 'incrStep [{0}] > 0'\", incrStep); }\n\n public static IEnumerable range(int left, int right, int incrStep = 1)\n {\n lrLeftRight_ASSERT(left, right);\n __AssertIncrStep(incrStep);\n for (var i = left; i <= right; i += incrStep) yield return i;\n }\n public static IEnumerable rangeReverse(int left, int right, int decrStep = 1)\n {\n lrLeftRight_ASSERT(left, right);\n __AssertIncrStep(decrStep);\n for (var i = right; i >= left; i -= decrStep) yield return i;\n }\n\n #endregion\n\n // =============================================================================================\n\n\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _438b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n\n var d = readIntArray();\n var h = d[0];\n var m = d[1];\n var s = d[2];\n var t1 = d[3];\n var t2 = d[4];\n\n var count = 60 * 60;\n var inm = count / 5;\n var ins = inm / 60;\n\n var hs = (h * count + m * 60 + s) % (12 * count);\n var ms = m * inm + s * ins;\n var ss = s * inm;\n\n var hm = hs;\n var t1m = (t1 * count) % (12 * count);\n var t2m = (t2 * count) % (12 * count);\n var all = new int[] { hs, ms, ss };\n //var hc = (5L / 60L) / 60L;\n\n if (t1m > t2m)\n {\n if (!all.Any(t => t < t1m && t > t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t > t1m || t < t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n else\n {\n if (!all.Any(t => t > t1m && t < t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t < t1m || t > t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n //static Tuple hToM(int h, int m, int s)\n //{\n \n\n // return (h * 5) % 60;\n //}\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\n using System.Collections.Generic;\n using System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n private int s;\n private Tuple[] array;\n\n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var h = sr.NextInt32()%12;\n var m = sr.NextInt32();\n var s = sr.NextInt32();\n var t1 = sr.NextInt32()%12;\n var t2 = sr.NextInt32()%12;\n var checkClock = CheckClock(h, m, s, t1, t2);\n var checkAntiClock = CheckAntiClock(h, m, s, t1, t2);\n if (checkClock || checkAntiClock) {\n sw.WriteLine(\"YES\");\n }\n else {\n sw.WriteLine(\"NO\");\n }\n }\n\n private bool CheckClock(int h, int m, int s, int t1, int t2)\n {\n var hPos = h * 60 * 60 + m * 60 + s;\n var hMax = 60 * 60 * 12;\n var t1h = 60 * 60 * t1;\n if (t1h == hMax)\n t1h = 0;\n var t2h = 60 * 60 * t2;\n if (t2h == hMax)\n t2h = 0;\n if (hPos == hMax)\n hPos = 0;\n var t = t1h;\n var can = true;\n while (t != t2h) {\n if (t == hPos) {\n can = false;\n break;\n }\n t++;\n if (t == hPos) {\n can = false;\n break;\n }\n if (t == hMax) {\n t = 0;\n if (t == hPos) {\n can = false;\n break;\n }\n }\n }\n var mMax = 60 * 60;\n var mPos = 60 * m + s;\n var t1M = t1*5 * 60;\n var t2M = t2*5 * 60;\n if (mPos == mMax)\n mPos = 0;\n if (t1M == mMax)\n t1M = 0;\n if (t2M == mMax)\n t2M = 0;\n var tM = t1M;\n \n while (tM != t2M) {\n if (tM == mPos) {\n can = false;\n break;\n }\n tM++;\n if (tM == mPos) {\n can = false;\n break;\n }\n if (tM == mMax) {\n tM = 0;\n if (tM == mPos) {\n can = false;\n break;\n }\n }\n }\n var sMax = 60;\n var sPos = s;\n var t1S = t1*5;\n var t2S = t2*5;\n if (sPos == sMax)\n sPos = 0;\n if (t1S == sMax)\n t1S = 0;\n if (t2S == sMax)\n t2S = 0;\n var tS = t1S;\n while (tS != t2S) {\n if (tS == sPos) {\n can = false;\n break;\n }\n tS++;\n if (tS == sPos) {\n can = false;\n break;\n }\n if (tS == sMax) {\n tS = 0;\n if (tS == sPos) {\n can = false;\n break;\n }\n }\n }\n\n return can;\n }\n \n private bool CheckAntiClock(int h, int m, int s, int t1, int t2)\n {\n var hPos = h * 60 * 60 + m * 60 + s;\n var hMax = 60 * 60 * 12;\n var t1h = 60 * 60 * t1;\n if (t1h == hMax)\n t1h = 0;\n var t2h = 60 * 60 * t2;\n if (t2h == hMax)\n t2h = 0;\n if (hPos == hMax)\n hPos = 0;\n var t = t1h;\n var can = true;\n while (t != t2h) {\n if (t == hPos) {\n can = false;\n break;\n }\n t--;\n if (t == hPos) {\n can = false;\n break;\n }\n if (t < 0) {\n t = hMax - 1;\n if (t == hPos) {\n can = false;\n break;\n }\n }\n }\n var mMax = 60 * 60;\n var mPos = 60 * m + s;\n var t1M = t1*5 * 60;\n var t2M = t2*5 * 60;\n if (mPos == mMax)\n mPos = 0;\n if (t1M == mMax)\n t1M = 0;\n if (t2M == mMax)\n t2M = 0;\n var tM = t1M;\n \n while (tM != t2M) {\n if (tM == mPos) {\n can = false;\n break;\n }\n tM--;\n if (tM == mPos) {\n can = false;\n break;\n }\n if (tM < 0) {\n tM = mMax - 1;\n if (tM == mPos) {\n can = false;\n break;\n }\n }\n }\n var sMax = 60;\n var sPos = s;\n var t1S = t1*5;\n var t2S = t2*5;\n var tS = t1S;\n while (tS != t2S) {\n if (tS == sPos) {\n can = false;\n break;\n }\n tS--;\n if (tS == sPos) {\n can = false;\n break;\n }\n if (tS < 0) {\n tS = sMax - 1;\n if (tS == sPos) {\n can = false;\n break;\n }\n }\n }\n\n return can;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n\n public static decimal ConvertMinuteToMunite(int minute, int second = 0)\n {\n return minute + (decimal)second / 6 / 10;\n }\n public static decimal ConvertHourToMunite(int hour, int minute = 0, int second = 0)\n {\n //12.00-12.11 = 0\n //12.12-12.23 = 1\n //12.24-12.35 = 2\n //12.36-12.47 = 3\n //12.48-12.59 = 4\n\n int hInM = 5 * hour;\n if (hInM == 60) hInM = 0;\n return hInM + ((decimal) ConvertMinuteToMunite(minute, second) / 12);//+ ((decimal) second / 6 / 10);\n //return hInM;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var str = \"1 59 59 2 3\";\n#else\n var str = Console.ReadLine();\n#endif\n\n var h = Convert.ToInt32(str.Split(' ')[0]);\n var m = Convert.ToInt32(str.Split(' ')[1]);\n var s = Convert.ToInt32(str.Split(' ')[2]);\n\n var t1 = Convert.ToInt32(str.Split(' ')[3]);\n var t2 = Convert.ToInt32(str.Split(' ')[4]);\n\n Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m, s), TestExtensions.ConvertMinuteToMunite(m,s), s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));\n }\n\n static string Check(decimal hm, decimal mm, decimal sm, decimal t1, decimal t2)\n {\n#if __debug\n Console.WriteLine($\"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}\");\n#else\n \n#endif\n //\u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u043a\u0430\u043b\u0430 0-60 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f\n \n //\u043d\u0430\u0434\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0435\u0433\u0440\u0430\u0434\u044b \u0432 2 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u04421 \u0438 \u04422\n\n //\u043f\u043e\u0439\u0434\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a \u0431\u043e\u043b\u044c\u0448\u0435\u043c\u0443, \u0442\u0430\u043a \u043f\u0440\u043e\u0449\u0435\n var tmin = t1 > t2 ? t2 : t1;\n var tmax = t1 > t2 ? t1 : t2;\n\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmin \u0434\u043e tmax \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n //if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n if ((tmin > hm || tmax < hm) && (tmin > mm || tmax < mm) && (tmin > sm || tmax < sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 tmin \u0434\u043e 0 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmax \u0434\u043e 60 \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n //if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))\n if (tmin == 0 || (tmin < hm && tmin < mm && tmin < sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u0434\u043e 0 \u0434\u043b\u044f tmin\");\n#endif\n //if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))\n if (tmax == 60 || (tmax > hm && tmax > mm && tmax > sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0434\u043e 60 \u0434\u043b\u044f tmax\");\n#endif\n return \"YES\";\n }\n }\n\n\n\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n\n return \"NO\";\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Problem2\n{\n public static void Main(string[] args)\n {\n int[] inp = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n\n HashSet bounds = new HashSet();\n bounds.Add((inp[0] * 3600 + inp[1]*60 + inp[2]) % 43200);\n bounds.Add((inp[1]*720+inp[2]*12) % 43200);\n bounds.Add(inp[2]*720);\n \n int from = (inp[3]*3600) % 43200;\n int to = (inp[4]*3600) % 43200;\n\n bool fail1 = false;\n bool fail2 = false;\n\n for (int x = from; x != to; x = (x+1)%43200)\n {\n if (bounds.Contains(x)) {\n fail1 = true;\n break;\n }\n }\n\n for (int x = from; x != to; x = (x+43199)%43200)\n {\n if (bounds.Contains(x)) {\n fail2 = true;\n break;\n }\n }\n \n if (fail1 && fail2)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 5;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 5;\n int t2 = fl[4] * 5;\n\n if (h == 60){\n h = 0;\n }\n if (t1 == 60){\n t1 = 0;\n }\n if (t2 == 60){\n t2 = 0;\n }\n h++;\n if (m % 5 == 0){\n m++;\n }\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if ((h < t1 || h > t2) && (m < t1 || m > t2) && (s < t1 || s > t2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 < h && t1 < m && t1 < s)\n {\n backwords = true;\n }\n\n if (t2 > h && t2 >= m && t2 >= s)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace PracticeCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h, m, s, t1, t2;\n string[] str = Console.ReadLine().Split(' ');\n h = int.Parse(str[0]) * 5 - 1;\n m = int.Parse(str[1]);\n s = int.Parse(str[2]);\n t1 = int.Parse(str[3]) * 5 - 1;\n t2 = int.Parse(str[4]) * 5 - 1;\n\n int t = ((t2 - t1) + 60) % 60;\n int th = ((t2 - h) + 60) % 60;\n int tm = ((t2 - m) + 60) % 60;\n int ts = ((t2 - s) + 60) % 60;\n\n if ((t < th && t < tm && t < ts) || (t >= th && t >= tm && t >= ts))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace PracticeCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h, m, s, t1, t2;\n string[] str = Console.ReadLine().Split(' ');\n h = int.Parse(str[0]) * 5 - 1;\n m = int.Parse(str[1]);\n s = int.Parse(str[2]);\n t1 = int.Parse(str[3]) * 5 - 1;\n t2 = int.Parse(str[4]) * 5 - 1;\n\n int t = ((t2 - t1) + 60) % 60;\n int th = ((t2 - h) + 60) % 60;\n int tm = ((t2 - m) + 60) % 60;\n int ts = ((t2 - s) + 60) % 60;\n\n if ((t <= th && t <= tm && t <= ts) || (t >= th && t >= tm && t >= ts))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace PracticeCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n int h, m, s, t1, t2;\n string[] str = Console.ReadLine().Split(' ');\n h = int.Parse(str[0]) * 5;\n m = int.Parse(str[1]);\n s = int.Parse(str[2]);\n t1 = int.Parse(str[3]) * 5;\n t2 = int.Parse(str[4]) * 5;\n\n int t = ((t2 - t1) + 60) % 60;\n int th = ((t2 - h) + 60) % 60;\n int tm = ((t2 - m) + 60) % 60;\n int ts = ((t2 - s) + 60) % 60;\n\n if ((t <= th && t <= tm && t <= ts) || (t >= th && t >= tm && t >= ts))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n\n public static int ConvertHourToMunite(int hour, int minute = 0)\n {\n //12.00-12.12 = 0\n //12.12-12.24 = 1\n //12.24-12.36 = 2\n //12.36-12.48 = 3\n //12.48-13.00 = 4\n int hInM = 0;\n switch (hour)\n {\n case 1:\n hInM = 5;\n break;\n case 2:\n hInM = 10;\n break;\n case 3:\n hInM = 15;\n break;\n case 4:\n hInM = 20;\n break;\n case 5:\n hInM = 25;\n break;\n case 6:\n hInM = 30;\n break;\n case 7:\n hInM = 35;\n break;\n case 8:\n hInM = 40;\n break;\n case 9:\n hInM = 45;\n break;\n case 10:\n hInM = 50;\n break;\n case 11:\n hInM = 55;\n break;\n case 12:\n hInM = 0;\n break;\n }\n return hInM + (int)(minute / 12);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var str = \"12 30 45 3 11\";\n#else\n var str = Console.ReadLine();\n#endif\n\n var h = Convert.ToInt32(str.Split(' ')[0]);\n var m = Convert.ToInt32(str.Split(' ')[1]);\n var s = Convert.ToInt32(str.Split(' ')[2]);\n\n var t1 = Convert.ToInt32(str.Split(' ')[3]);\n var t2 = Convert.ToInt32(str.Split(' ')[4]);\n\n Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m), m,s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));\n }\n\n static string Check(int hm, int mm, int sm, int t1,int t2)\n {\n#if __debug\n Console.WriteLine($\"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}\");\n#else\n \n#endif\n //\u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u043a\u0430\u043b\u0430 0-60 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f\n \n //\u043d\u0430\u0434\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0435\u0433\u0440\u0430\u0434\u044b \u0432 2 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u04421 \u0438 \u04422\n\n //\u043f\u043e\u0439\u0434\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a \u0431\u043e\u043b\u044c\u0448\u0435\u043c\u0443, \u0442\u0430\u043a \u043f\u0440\u043e\u0449\u0435\n var tmin = t1 > t2 ? t2 : t1;\n var tmax = t1 > t2 ? t1 : t2;\n\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmin \u0434\u043e tmax \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 tmin \u0434\u043e 0 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmax \u0434\u043e 60 \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u0434\u043e 0 \u0434\u043b\u044f tmin\");\n#endif\n if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0434\u043e 60 \u0434\u043b\u044f tmax\");\n#endif\n return \"YES\";\n }\n }\n\n\n\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n\n return \"NO\";\n }\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n\n public static decimal ConvertMinuteToMunite(int minute, int second = 0)\n {\n return minute + (decimal)second / 6 / 10;\n }\n public static decimal ConvertHourToMunite(int hour, int minute = 0, int second = 0)\n {\n //12.00-12.11 = 0\n //12.12-12.23 = 1\n //12.24-12.35 = 2\n //12.36-12.47 = 3\n //12.48-12.59 = 4\n\n int hInM = 5 * hour;\n if (hInM == 60) hInM = 0;\n return hInM + ((decimal) ConvertMinuteToMunite(minute, second) / 12) + ((decimal) second / 6 / 10);\n //return hInM;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var str = \"6 59 59 11 12\";\n#else\n var str = Console.ReadLine();\n#endif\n\n var h = Convert.ToInt32(str.Split(' ')[0]);\n var m = Convert.ToInt32(str.Split(' ')[1]);\n var s = Convert.ToInt32(str.Split(' ')[2]);\n\n var t1 = Convert.ToInt32(str.Split(' ')[3]);\n var t2 = Convert.ToInt32(str.Split(' ')[4]);\n\n Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m, s), TestExtensions.ConvertMinuteToMunite(m,s), s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));\n }\n\n static string Check(decimal hm, decimal mm, decimal sm, decimal t1, decimal t2)\n {\n#if __debug\n Console.WriteLine($\"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}\");\n#else\n \n#endif\n //\u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u043a\u0430\u043b\u0430 0-60 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f\n \n //\u043d\u0430\u0434\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0435\u0433\u0440\u0430\u0434\u044b \u0432 2 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u04421 \u0438 \u04422\n\n //\u043f\u043e\u0439\u0434\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a \u0431\u043e\u043b\u044c\u0448\u0435\u043c\u0443, \u0442\u0430\u043a \u043f\u0440\u043e\u0449\u0435\n var tmin = t1 > t2 ? t2 : t1;\n var tmax = t1 > t2 ? t1 : t2;\n\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmin \u0434\u043e tmax \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n //if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n if ((tmin > hm || tmax < hm) && (tmin > mm || tmax < mm) && (tmin > sm || tmax < sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 tmin \u0434\u043e 0 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmax \u0434\u043e 60 \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n //if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))\n if (tmin == 0 || (tmin < hm && tmin < mm && tmin < sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u0434\u043e 0 \u0434\u043b\u044f tmin\");\n#endif\n //if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))\n if (tmax == 60 || (tmax > hm && tmax > mm && tmax > sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0434\u043e 60 \u0434\u043b\u044f tmax\");\n#endif\n return \"YES\";\n }\n }\n\n\n\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n\n return \"NO\";\n }\n }\n}"}, {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n\n public static int ConvertHourToMunite(int hour, int minute = 0)\n {\n //12.00-12.11 = 0\n //12.12-12.23 = 1\n //12.24-12.35 = 2\n //12.36-12.47 = 3\n //12.48-12.59 = 4\n\n int hInM = 5 * hour;\n if (hInM == 60) hInM = 0;\n //return hInM + (int)(minute / 12);\n return hInM;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var str = \"3 47 0 4 9\";\n#else\n var str = Console.ReadLine();\n#endif\n\n var h = Convert.ToInt32(str.Split(' ')[0]);\n var m = Convert.ToInt32(str.Split(' ')[1]);\n var s = Convert.ToInt32(str.Split(' ')[2]);\n\n var t1 = Convert.ToInt32(str.Split(' ')[3]);\n var t2 = Convert.ToInt32(str.Split(' ')[4]);\n\n Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m), m,s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));\n }\n\n static string Check(int hm, int mm, int sm, int t1,int t2)\n {\n#if __debug\n Console.WriteLine($\"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}\");\n#else\n \n#endif\n //\u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0448\u043a\u0430\u043b\u0430 0-60 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f\n \n //\u043d\u0430\u0434\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0435\u0433\u0440\u0430\u0434\u044b \u0432 2 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u04421 \u0438 \u04422\n\n //\u043f\u043e\u0439\u0434\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043a \u0431\u043e\u043b\u044c\u0448\u0435\u043c\u0443, \u0442\u0430\u043a \u043f\u0440\u043e\u0449\u0435\n var tmin = t1 > t2 ? t2 : t1;\n var tmax = t1 > t2 ? t1 : t2;\n\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmin \u0434\u043e tmax \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n //\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0439\u0442\u0438 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 tmin \u0434\u043e 0 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u043e\u0442 tmax \u0434\u043e 60 \u0438\u0449\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a\n if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u0434\u043e 0 \u0434\u043b\u044f tmin\");\n#endif\n if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0434\u043e 60 \u0434\u043b\u044f tmax\");\n#endif\n return \"YES\";\n }\n }\n\n\n\n if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))\n {\n#if __debug\n Console.WriteLine($\"\u041d\u0435\u0442 \u043f\u0440\u0435\u0433\u0440\u0430\u0434 \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e\");\n#endif\n return \"YES\";\n }\n\n return \"NO\";\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n\n enum Direction {Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n \n\n static void Solve()\n {\n int h = ReadInt() * 5, m = ReadInt(), s = ReadInt(), start = ReadInt() * 5, stop = ReadInt() * 5;\n if (stop < start)\n {\n int temp = stop;\n stop = start;\n start = temp;\n }\n if (start == stop)\n {\n sw.WriteLine(\"YES\");\n return;\n }\n bool f1 = false, f2 = false;\n if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))\n {\n f1 = true;\n }\n if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))\n {\n f2 = true;\n }\n if (f1 && f2)\n {\n sw.WriteLine(\"NO\");\n }\n else\n {\n sw.WriteLine(\"YES\");\n }\n }\n\n static int comparator(Pair, Pair> a, Pair, Pair> b)\n {\n if (a.first.first == b.first.first)\n {\n if (a.first.second == b.first.second)\n {\n return a.CompareTo(b);\n }\n else\n {\n return b.first.second - a.first.second;\n }\n }\n else\n {\n return a.first.first - b.first.first;\n }\n }\n \n\n static long ariphmeticsum(long n)\n {\n return n * (n + 1) / 2;\n }\n\n static bool check()\n {\n return true;\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T: IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j+1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T: IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class Pair : IComparable>\n where U : IComparable where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n\n class Program\n {\n\n static TextReader sr;\n static TextWriter sw;\n\n enum Direction {Vertical, Horizontal }\n\n static void Main(string[] args)\n {\n if (File.Exists(\"input.txt\"))\n {\n sr = new StreamReader(\"input.txt\");\n sw = new StreamWriter(\"output.txt\");\n }\n else\n {\n sr = Console.In;\n sw = Console.Out;\n }\n Solve();\n if (File.Exists(\"input.txt\"))\n {\n sr.Close();\n sw.Close();\n }\n }\n \n\n static void Solve()\n {\n int h = (ReadInt() - 1) * 5, m = ReadInt(), s = ReadInt(), start = (ReadInt() - 1) * 5, stop = (ReadInt() - 1) * 5;\n if (stop < start)\n {\n int temp = stop;\n stop = start;\n start = temp;\n }\n if (start == stop)\n {\n sw.WriteLine(\"YES\");\n return;\n }\n bool f1 = false, f2 = false;\n if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))\n {\n f1 = true;\n }\n if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))\n {\n f2 = true;\n }\n if (f1 && f2)\n {\n sw.WriteLine(\"NO\");\n }\n else\n {\n sw.WriteLine(\"YES\");\n }\n }\n\n static int comparator(Pair, Pair> a, Pair, Pair> b)\n {\n if (a.first.first == b.first.first)\n {\n if (a.first.second == b.first.second)\n {\n return a.CompareTo(b);\n }\n else\n {\n return b.first.second - a.first.second;\n }\n }\n else\n {\n return a.first.first - b.first.first;\n }\n }\n \n\n static long ariphmeticsum(long n)\n {\n return n * (n + 1) / 2;\n }\n\n static bool check()\n {\n return true;\n }\n \n\n static long getManhattan(Pair a, Pair b)\n {\n return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);\n }\n\n static string[] buffer = new string[0];\n static int counterbuffer = 0;\n\n static Graph ReadGraph()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n }\n return new Graph(n, a, b);\n }\n\n static Graph ReadGraph(Parser parser)\n where T: IComparable\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = new int[m];\n int[] b = new int[m];\n T[] c = new T[m];\n for (int i = 0; i < m; i++)\n {\n a[i] = ReadInt();\n b[i] = ReadInt();\n c[i] = Read(sr, parser);\n }\n return new Graph(n, a, b, c);\n }\n\n static int[] ReadArrayInt()\n {\n return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static long[] ReadArrayLong()\n {\n return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();\n }\n\n static int[][] ReadMatrixInt(int n, int m)\n {\n int[][] answer = new int[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new int[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadInt();\n }\n }\n return answer;\n }\n\n static long[][] ReadMatrixLong(int n, int m)\n {\n long[][] answer = new long[n][];\n for (int i = 0; i < n; i++)\n {\n answer[i] = new long[m];\n for (int j = 0; j < m; j++)\n {\n answer[i][j] = ReadLong();\n }\n }\n return answer;\n }\n\n static BigInteger ReadBigInteger()\n {\n return ReadBigInteger(sr);\n }\n\n static BigInteger ReadBigInteger(TextReader sr)\n {\n return Read(sr, BigInteger.Parse);\n }\n\n static int ReadInt()\n {\n return ReadInt(sr);\n }\n\n static int ReadInt(TextReader sr)\n {\n return Read(sr, int.Parse);\n }\n\n static long ReadLong()\n {\n return ReadLong(sr);\n }\n\n static long ReadLong(TextReader sr)\n {\n return Read(sr, long.Parse);\n }\n\n static double ReadDouble()\n {\n return ReadDouble(sr);\n }\n\n static double ReadDouble(TextReader sr)\n {\n return Read(sr, double.Parse);\n }\n\n static string ReadString()\n {\n return ReadString(sr);\n }\n\n static string ReadString(TextReader sr)\n {\n return Read(sr, x => x);\n }\n\n static U Read(TextReader sr, Parser parser)\n {\n if (counterbuffer >= buffer.Length)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n while (buffer.Length == 0)\n {\n buffer = sr.ReadLine().Split(' ').ToArray();\n }\n counterbuffer = 0;\n }\n return parser(buffer[counterbuffer++]);\n }\n }\n\n\n public delegate U Parser(string str);\n\n class Graph\n {\n protected int[][] Edges;\n public int this[int val1, int val2]\n {\n get\n {\n return Edges[val1][val2];\n }\n set\n {\n Edges[val1][val2] = value;\n }\n }\n\n public Graph(int n, int[] a, int[] b)\n {\n generateEdges(n, a, b);\n }\n\n private void generateEdges(int n, int[] a, int[] b)\n {\n int[] temp = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i])\n {\n temp[a[i] - 1]++;\n temp[b[i] - 1]++;\n }\n else\n {\n temp[a[i] - 1]++;\n }\n }\n Edges = new int[n][];\n for (int i = 0; i < n; i++)\n {\n Edges[i] = new int[temp[i]];\n }\n for (int i = 0; i < n; i++)\n {\n temp[i] = 0;\n }\n for (int j = 0; j < a.Length; j++)\n {\n if (a[j] != b[j])\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;\n }\n else\n {\n Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n foreach (var i in Edges)\n {\n foreach (var j in i)\n {\n answer += (j+1) + \" \";\n }\n answer += Environment.NewLine;\n }\n return answer;\n }\n }\n\n class Graph : Graph\n where T: IComparable\n {\n public T[][] Cost;\n public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)\n {\n this.GenerateEdges(n, a, b, c);\n }\n\n private void GenerateEdges(int n, int[] a, int[] b, T[] c)\n {\n Cost = new T[n][];\n for (int i = 0; i < n; i++)\n {\n Cost[i] = new T[Edges[i].Length];\n }\n int[] temp = new int[n];\n\n for (int j = 0; j < c.Length; j++)\n {\n if (a[j] != b[j])\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];\n }\n else\n {\n Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];\n }\n }\n }\n\n public override string ToString()\n {\n string answer = \"\";\n for (int i = 0; i < Cost.Length; i++)\n {\n for (int j = 0; j < Cost[i].Length; j++)\n {\n answer += (i + 1) + \" \" + (Edges[i][j] + 1) + \" \" + Cost[i][j] + Environment.NewLine;\n }\n }\n return answer;\n }\n }\n\n class Pair : IComparable>\n where U : IComparable where V : IComparable\n {\n public U first;\n public V second;\n public Pair(U first, V second)\n {\n this.first = first;\n this.second = second;\n }\n\n public int CompareTo(Pair b)\n {\n if (first.CompareTo(b.first) == 0)\n {\n return second.CompareTo(b.second);\n }\n return first.CompareTo(b.first);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Race_Against_Time\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int h = Next() % 12, m = Next(), s = Next(), t1 = Next() % 12, t2 = Next() % 12;\n\n if (t1 > t2)\n {\n int t = t1;\n t1 = t2;\n t2 = t;\n }\n\n double hd = m > 0 || s > 0 ? h + 0.1 : h;\n double md = s > 0 ? m*12/60 + 0.1 : m*12/60;\n double sd = s*12/60;\n\n bool hb = hd > t1 && hd < t2;\n bool mb = md > t1 && md < t2;\n bool sb = sd > t1 && sd < t2;\n\n return (hb && mb && sb) || (!hb && !mb && !sb);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Race_Against_Time\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int h = Next(), m = Next(), s = Next(), t1 = Next(), t2 = Next();\n\n if (t1 > t2)\n {\n int t = t1;\n t1 = t2;\n t2 = t;\n }\n\n double hd = m > 0 || s > 0 ? h + 0.1 : h;\n double md = s > 0 ? m*12/60 + 0.1 : m*12/60;\n double sd = s*12/60;\n\n bool hb = hd > t1 && hd < t2;\n bool mb = md > t1 && md < t2;\n bool sb = sd > t1 && sd < t2;\n\n return (hb && mb && sb) || (!hb && !mb && !sb);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _438b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n\n var d = readIntArray();\n var h = d[0];\n var m = d[1];\n var s = d[2];\n var t1 = d[3];\n var t2 = d[4];\n\n var count = 60 * 60;\n var inm = count / 5;\n var ins = inm / 60;\n\n var hs = (h * count + m * 60 + s) % (12 * count);\n var ms = m * inm + s * ins;\n var ss = s;\n\n var hm = hs;\n var t1m = (t1 * count) % (12 * count);\n var t2m = (t2 * count) % (12 * count);\n var all = new int[] { hs, ms, ss };\n //var hc = (5L / 60L) / 60L;\n\n if (t1m > t2m)\n {\n if (!all.Any(t => t < t1m && t > t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t > t1m || t < t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n else\n {\n if (!all.Any(t => t > t1m && t < t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t < t1m || t > t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n //static Tuple hToM(int h, int m, int s)\n //{\n \n\n // return (h * 5) % 60;\n //}\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _438b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n\n var d = readIntArray();\n var h = d[0];\n var m = d[1];\n var s = d[2];\n var t1 = d[3];\n var t2 = d[4];\n\n var hm = hToM(h);\n var t1m = hToM(t1);\n var t2m = hToM(t2);\n var all = new int[] { hm, m, s };\n\n if (t1m > t2m)\n {\n if (!all.Any(t => t < t1m && t > t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t > t1m || t < t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n else\n {\n if (!all.Any(t => t > t1m && t < t2m))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (!all.Any(t => t < t1m || t > t2m || t == 0))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int hToM(int h)\n {\n return (h * 5) % 60;\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 5;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 5;\n int t2 = fl[4] * 5;\n\n if (h == 60){\n h = 0;\n }\n if (t1 == 60){\n t1 = 0;\n }\n if (t2 == 60){\n t2 = 0;\n }\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 <= h && t1 <= m && t1 <= s)\n {\n backwords = true;\n }\n\n if (t2 >= h && t2 >= m && t2 >= s)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p;\n if (t1 < 59)\n {\n p = t1 + 1;\n }\n else\n {\n p = 0;\n }\n\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p < 59)\n {\n p++;\n }\n else\n {\n p = 0;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p > 1)\n {\n p--;\n }\n else\n {\n p = 43200;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 5;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 5;\n int t2 = fl[4] * 5;\n\n if (h == 60){\n h = 0;\n }\n if (t1 == 60){\n t1 = 0;\n }\n if (t2 == 60){\n t2 = 0;\n }\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 <= h && t1 <= m && t1 <= s)\n {\n backwords = true;\n }\n\n if (t1 >= h && t2 >= m && t2 >= s)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p;\n if (t1 < 59)\n {\n p = t1 + 1;\n }\n else\n {\n p = 0;\n }\n\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s && (t1 != h || t1 != m || t1 != s))\n {\n break;\n }\n if (p < 59)\n {\n p++;\n }\n else\n {\n p = 0;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s && (t1 != h || t1 != m || t1 != s))\n {\n break;\n }\n if (p > 0)\n {\n p--;\n }\n else\n {\n p = 59;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 5;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 5;\n int t2 = fl[4] * 5;\n\n if (h == 60){\n h = 0;\n }\n if (t1 == 60){\n t1 = 0;\n }\n if (t2 == 60){\n t2 = 0;\n }\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if ((h <= t1 || h >= t2) && (m <= t1 || m >= t2) && (s <= t1 || s >= t2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 <= h && t1 <= m && t1 <= s)\n {\n backwords = true;\n }\n\n if (t1 >= h && t2 >= m && t2 >= s)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p = t1 + 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p < 43200)\n {\n p++;\n }\n else\n {\n p = 1;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p > 1)\n {\n p--;\n }\n else\n {\n p = 43200;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p = t1 + 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p < 60)\n {\n p++;\n }\n else\n {\n p = 1;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p > 1)\n {\n p--;\n }\n else\n {\n p = 43200;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 60 * 60;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 60 * 60;\n int t2 = fl[4] * 60 * 60;\n\n var barrier = h + m + s;\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if (barrier < t1 || barrier > t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 < barrier)\n {\n backwords = true;\n }\n\n if (t2 > barrier)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 60 * 60;\n int m = fl[1] * 60;\n int s = fl[2];\n int t1 = fl[3] * 60 * 60;\n int t2 = fl[4] * 60 * 60;\n\n int p = t1 + 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p < 43200)\n {\n p++;\n }\n else\n {\n p = 1;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p > 1)\n {\n p--;\n }\n else\n {\n p = 43200;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p;\n if (t1 < 59)\n {\n p = t1 + 1;\n }\n else\n {\n p = 0;\n }\n\n if (t1 == h || t1 == m || t1 == s){\n Console.WriteLine(\"NO\");\n return;\n }\n\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p < 59)\n {\n p++;\n }\n else\n {\n p = 0;\n }\n }\n\n if (t1 > 0)\n {\n p = t1 - 1;\n }\n else\n {\n p = 59;\n }\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s)\n {\n break;\n }\n if (p > 0)\n {\n p--;\n }\n else\n {\n p = 59;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = ConvertRange(1, 12, 0, 59, fl[0]);\n int m = fl[1];\n int s = fl[2];\n int t1 = ConvertRange(1, 12, 0, 59, fl[3]);\n int t2 = ConvertRange(1, 12, 0, 59, fl[4]);\n\n int p;\n if (t1 < 59)\n {\n p = t1 + 1;\n }\n else\n {\n p = 0;\n }\n\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s || t1 != h || t1 != m || t1 != s)\n {\n break;\n }\n if (p < 59)\n {\n p++;\n }\n else\n {\n p = 0;\n }\n }\n\n p = t1 - 1;\n while (p != t1)\n {\n if (p == t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (p == h || p == m || p == s || t1 != h || t1 != m || t1 != s)\n {\n break;\n }\n if (p > 0)\n {\n p--;\n }\n else\n {\n p = 59;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n public static int ConvertRange(\n int originalStart, int originalEnd, // original range\n int newStart, int newEnd, // desired range\n int value) // value to convert\n {\n double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);\n return (int)(newStart + ((value - originalStart) * scale));\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass MainClass\n{\n public static void Main(string[] args)\n {\n var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int h = fl[0] * 5;\n int m = fl[1];\n int s = fl[2];\n int t1 = fl[3] * 5;\n int t2 = fl[4] * 5;\n\n if (h == 60){\n h = 0;\n }\n if (t1 == 60){\n t1 = 0;\n }\n if (t2 == 60){\n t2 = 0;\n }\n\n if (t1 > t2)\n {\n var t = t1;\n t1 = t2;\n t2 = t;\n }\n\n if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n bool backwords = false;\n bool forwards = false;\n\n if (t1 < h && t1 < m && t1 < s)\n {\n backwords = true;\n }\n\n if (t2 > h && t2 > m && t2 > s)\n {\n forwards = true;\n }\n\n if (backwords && forwards)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine().Split(' ');\n List l = new List();\n List ll = new List();\n foreach (var b in a)\n {\n var c = double.Parse(b);\n l.Add(c);\n }\n l[0] = (1.0 * l[0] - 1 + l[1] / 60 + l[2] / 3600) * 60;\n l[1] = l[1] + l[2] / 60;\n var t1 = l[3] * 60;\n var t2 = l[3] * 60;\n for(int i = 0; i < 3; i++)\n {\n ll.Add(l[i]);\n }\n ll.Sort();\n\n var llmx = ll.Max();\n var llmn = ll.Min();\n if (llmx < t1 && llmx < t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (llmn > t1 && llmn > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n\n //\n\n if (ll[0] < t1 && ll[1] > t1 && ll[0] < t2 && ll[1] > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n if (ll[1] < t1 && ll[2] > t1 && ll[1] < t2 && ll[2] > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n //\n if (t1 > t2)\n {\n Swap(ref t1,ref t2);\n }\n if (t2 > llmx && t1 < llmn)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n }\n public static void Swap(ref T lhs, ref T rhs)\n {\n T temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine().Split(' ');\n List l = new List();\n List ll = new List();\n foreach (var b in a)\n {\n var c = double.Parse(b);\n l.Add(c);\n }\n l[0] = (1.0 * l[0] - 1 + l[1] / 60 + l[2] / 3600) * 60;\n l[1] = l[1] + l[2] / 60;\n var t1 = l[3] * 60;\n var t2 = l[3] * 60;\n for(int i = 0; i < 3; i++)\n {\n ll.Add(l[i]);\n }\n var llmx = ll.Max();\n var llmn = ll.Min();\n if (llmx < t1 && llmx < t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (llmn > t1 && llmn > t2)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n if (t1 > t2)\n {\n Swap(ref t1,ref t2);\n }\n if (t2 > llmx && t1 < llmn)\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n\n }\n public static void Swap(ref T lhs, ref T rhs)\n {\n T temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n int s = int.Parse(token[2]);\n int t1 = int.Parse(token[3]);\n int t2 = int.Parse(token[4]);\n \n h = ((h*5) + (m/12))%60;\n t1 = (t1*5)%60;\n t2 = (t2*5)%60;\n \n bool val1 = true;int ss = 0;\n \n for(int i=t1+1;ss<60;i+=1,ss++){\n if(i==60)i=0;\n if(i==h||i==m||i==s){\n val1 = false;\n break;\n }else if(i==t2){\n break;\n }\n }\n \n bool val2 = true;int vv = 0;\n for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){\n if(i==h||i==m||i==s){\n val2 = false;\n break;\n }else if(i==t2){\n break;\n }\n if(i==0)i=60;\n }\n if(val1){\n Console.WriteLine(\"YES\");\n }else if(val2){\n Console.WriteLine(\"YES\");\n }else{\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n int s = int.Parse(token[2]);\n int t1 = int.Parse(token[3]);\n int t2 = int.Parse(token[4]);\n m = (m==0)?m=60:m;\n s = (s==0)?s=60:s;\n \n m = m/5;\n s = s/5;\n \n string ans = \"NO\";\n for(int i=t1+1;i<24;i++)\n {\n if(i==12)\n {i=0;}\n \n if(i==t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(i==h||i==m||i==s)\n {\n break;\n }\n \n }\n \n for(int i=t1-1;i<24;i--)\n {\n if(i==0)\n {i=12;}\n \n if(i==t2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(i==h||i==m||i==s)\n {\n break;\n }\n }\n Console.WriteLine(ans);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n int s = int.Parse(token[2]);\n int t1 = int.Parse(token[3]);\n int t2 = int.Parse(token[4]);\n \n h = ((h*5) + (m/12))%60;\n t1 = (t1*5)%60;\n t2 = (t2*5)%60;\n \n bool val1 = true;int ss = 0;\n \n for(int i=t1+1;ss<60;i+=1,ss++){\n if(i==60)i=0;\n if(i==t2){\n break;\n }\n else if(i==h||i==m||i==s){\n val1 = false;\n break;\n }\n }\n \n bool val2 = true;int vv = 0;\n for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){\n if(i==t2){\n break;\n }else if(i==h||i==m||i==s){\n val2 = false;\n break;\n }\n if(i==0)i=60;\n }\n if(val1){\n Console.WriteLine(\"YES\");\n }else if(val2){\n Console.WriteLine(\"YES\");\n }else{\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n int s = int.Parse(token[2]);\n int t1 = int.Parse(token[3]);\n int t2 = int.Parse(token[4]);\n \n h = ((h*5) + (m/12))%60;\n t1 = (t1*5)%60;\n t2 = (t2*5)%60;\n \n bool val1 = true;int ss = 0;\n \n for(int i=t1+1;ss<60;i+=1,ss++){\n if(i==60)i=0;\n if(i==t2){\n // Console.WriteLine(i);\n break;\n }else if(i==h||i==m||i==s){\n val1 = false;\n break;\n }\n }\n \n bool val2 = true;int vv = 0;\n for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){\n if(i==h||i==m||i==s){\n val2 = false;\n break;\n }else if(i==t2){\n break;\n }\n if(i==0)i=60;\n }\n if(val1){\n Console.WriteLine(\"YES\");\n }else if(val2){\n Console.WriteLine(\"YES\");\n }else{\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int h = int.Parse(token[0]);\n int m = int.Parse(token[1]);\n int s = int.Parse(token[2]);\n int t1 = int.Parse(token[3]);\n int t2 = int.Parse(token[4]);\n \n h = ((h*5) + (m/12))%60;\n t1 = (t1*5)%60;\n t2 = (t2*5)%60;\n \n bool val1 = true;int ss = 0;\n \n for(int i=t1+1;ss<60;i+=1,ss++){\n if(i==60)i=0;\n if(i==h||i==m||i==s){\n val1 = false;\n break;\n }else if(i==t2){\n break;\n }\n }\n \n bool val2 = true;int vv = 0;\n for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){\n if(i==0)i=60;\n if(i==h||i==m||i==s){\n val2 = false;\n break;\n }else if(i==t2){\n break;\n }\n }\n if(val1){\n Console.WriteLine(\"YES\");\n }else if(val2){\n Console.WriteLine(\"YES\");\n }else{\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n \n}"}], "src_uid": "912c8f557a976bdedda728ba9f916c95"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var numbers = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x)).ToArray();\n if (numbers[0] == 0)\n Console.WriteLine(numbers[1] * 3);\n if (numbers[1] == 0)\n Console.WriteLine(numbers[0] * 2);\n if (numbers[0] != 0 && numbers[1] != 0)\n {\n var problemsCount = Math.Min((numbers[0] * 2) / 6, (numbers[1] * 3) / 6);\n var firstMaxHeight = numbers[0] * 2;\n var secondMaxHeight = numbers[1] * 3;\n while (problemsCount > 0)\n {\n if (firstMaxHeight <= secondMaxHeight)\n {\n firstMaxHeight += 2;\n if (firstMaxHeight % 6 == 0 && firstMaxHeight <= secondMaxHeight)\n problemsCount++;\n } else\n if (firstMaxHeight > secondMaxHeight)\n {\n secondMaxHeight += 3;\n if (secondMaxHeight % 6 == 0 && firstMaxHeight >= secondMaxHeight)\n problemsCount++;\n }\n problemsCount--;\n }\n Console.WriteLine(Math.Max(firstMaxHeight, secondMaxHeight));\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace BlockTowers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, a = 2;\n string[] input = Console.ReadLine().Split(' ');\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n if (n == 0)\n {\n Console.WriteLine(m * 3);\n }\n else if (m == 0)\n {\n Console.WriteLine(n * 2);\n }\n else if (n != 0 && m != 0)\n {\n while (n != 0 || m != 0)\n {\n if (a % 2 == 0 && a % 3 == 0)\n {\n if (n > m && n > 0)\n {\n n--;\n }\n else if (m > n && m > 0)\n {\n m--;\n }\n else if (n == m && m > 0)\n {\n m--;\n }\n }\n else if (a % 2 == 0 && n > 0)\n {\n n--;\n }\n else if (a % 3 == 0 && m > 0)\n {\n m--;\n }\n a++;\n }\n Console.WriteLine(a - 1);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Block_Towers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int l = 1, r = 5000000;\n while (l < r)\n {\n int mid = (l + r)/2;\n\n int d6 = mid/6;\n int d2 = mid/2 - d6;\n int d3 = mid/3 - d6;\n\n if (d6 >= (Math.Max(0, n - d2) + Math.Max(0, m - d3)))\n {\n r = mid;\n }\n else\n {\n l = mid + 1;\n }\n }\n\n writer.WriteLine(l);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n\n object Get() {\n checked\n {\n var a = ReadInts();\n var n = a[0];\n var m = a[1];\n var nh = a[0] * 2;\n var mh = a[1] * 3;\n var i = 6;\n while (i <= Math.Min(nh, mh))\n {\n if (nh <= mh)\n nh += 2;\n else\n mh += 3;\n i += 6;\n }\n return Math.Max(mh, nh);\n }\n }\n\n public string Besides(char a)\n {\n if (a == 'B')\n return \"GR\";\n if (a == 'G')\n return \"BR\";\n if (a == 'R')\n return \"BG\";\n throw new Exception(\"huj\");\n }\n\n public string Other(char a, char b)\n {\n if (a == 'B' && b == 'G')\n return \"R\";\n if (a == 'G' && b == 'R')\n return \"B\";\n if (a == 'B' && b == 'R')\n return \"G\";\n throw new Exception(\"huj\");\n }\n object GetC()\n {\n FileName = \"space\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create(first.Item2, second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in single)\n result += kv.Value;\n //foreach (var kv in twin)\n //{\n // ProcessPair(kv.Value);\n //}\n\n return result;\n \n }\n }\n\n //public long ProcessPair(List> counts)\n //{\n // counts.Sort()\n //}\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get2()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn = 0;\n int m = int.Parse(inp[1]), tm = 0;\n\n tm = m * 3;\n tn = n * 2;\n for (int i = 6; i <= tn && i <= tm; i += 6)\n {\n if (tn > tm)\n tm += 3;\n else\n tn += 2;\n }\n int max = Math.Max(tn, tm);\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vce3\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var max2 = n * 2;\n var max3 = m * 3;\n\n var need = Math.Min(max2, max3) / 6;\n for (int i = 0; i < need; i++)\n {\n if (max2 == max3)\n {\n max2 += 2;\n }\n else if (max2 > max3)\n {\n max3 += 3;\n //var n3 = max3 + 3;\n if (max3 % 6 == 0 && max2 >= max3)\n {\n need++;\n }\n }\n else\n {\n max2 += 2;\n if (max2 % 6 == 0 && max3 >= max2)\n {\n need++;\n }\n }\n }\n\n var res = Math.Max(max2, max3);\n Console.WriteLine(res);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vc3\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var a = readIntArray();\n var n = a[0];\n var m = a[1];\n var h2 = 2;\n var h3 = 0;\n\n if (n == 0)\n {\n Console.WriteLine(3 * m);\n return;\n }\n\n if (m == 0)\n {\n Console.WriteLine(2 * n);\n return;\n }\n\n if (m >= n)\n {\n var rem = m - n;\n var h = (n / 2) * 6 + (n % 2) * 3 + rem * 3;\n Console.WriteLine(h);\n return;\n }\n else\n {\n \n var count = 0;\n while (true)\n {\n if (n - 3 >= m - 1 && m > 0)\n {\n n -= 3;\n m--;\n count++;\n }\n else\n {\n break;\n }\n }\n\n var rem = n - m;\n var h = count * 6 + (m / 2) * 6;\n h += Math.Max(m % 2 * 3, m % 2 * 2 + rem * 2);\n\n //var ct = rem / 2;\n //ct = Math.Min(ct, m);\n //var r = rem % 2;\n\n //var rc = n - ct * 3 - r;\n //var rcm = m - ct;\n //var mm = Math.Min(rcm, rc);\n \n //var h = (mm / 2) * 6 + ct * 6;// +(rc % 2) * 3 + ct * 6;\n //var add = Math.Max((mm % 2) * 3, r * 2 + (mm % 2) * 2);\n Console.WriteLine(h);\n return;\n }\n\n //while (true)\n //{\n // if (m > 0)\n // {\n // if (h3 < h2 || n == 0)\n // {\n // while (h3 < h2 && m > 0)\n // {\n // h3 += 3;\n // m--;\n // }\n\n // continue;\n // }\n // }\n\n // if (n > 0)\n // {\n // if (h2 < h3 || m == 0)\n // {\n // while (h2 < h3 && n > 0)\n // {\n // h2 += 2;\n // n--;\n // }\n\n // continue;\n // }\n // }\n\n // if (h2 == h3)\n // {\n // var p2 = (n + 1) * 2;\n // var p3 = (m + 1) * 3;\n\n // if (p2 > p3)\n // {\n\n // }\n // }\n //}\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static Random rand = new Random(0);\n\n\n static void Main(string[] args)\n {\n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n int n = input.NextInt();\n int m = input.NextInt();\n SortedList sl2 = new SortedList();\n SortedList sl3 = new SortedList();\n for (int i = 1; i <= n; i++)\n {\n sl2.Add(i * 2, 0);\n }\n for (int j = 1; j <= m; j++)\n {\n sl3.Add(j * 3, 0);\n }\n for (int i = 0; i < sl2.Count; i++)\n {\n if (sl3.ContainsKey(sl2.Keys[i]))\n {\n int ntwo = sl2.Keys[sl2.Count - 1] + 2;\n int nthree = sl3.Keys[sl3.Count - 1] + 3;\n if (ntwo < nthree)\n {\n sl2.Add(ntwo, 0);\n }\n else\n {\n sl3.Add(nthree, 0);\n }\n }\n }\n int max = int.MinValue;\n if (sl2.Count > 0)\n {\n max = sl2.Keys[sl2.Count - 1];\n }\n if (sl3.Count > 0)\n {\n max = Math.Max(sl3.Keys[sl3.Count - 1], max);\n }\n writer.WriteLine(max);\n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Flush();\n writer.Close();\n reader.Close();\n }\n\n }\n\n class LuckyNumber : IComparable\n {\n public int four, seven;\n\n public LuckyNumber()\n {\n this.four = (int)1e7;\n this.seven = (int)1e7;\n }\n\n public LuckyNumber(int four, int seven)\n {\n this.four = four;\n this.seven = seven;\n }\n\n public int CompareTo(LuckyNumber other)\n {\n int digDif = this.four + this.seven - (other.four + other.seven);\n if (digDif != 0)\n {\n return digDif;\n }\n return other.four - this.four;\n }\n\n public override string ToString()\n {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < four; i++)\n {\n sb.Append('4');\n }\n for (int i = 0; i < seven; i++)\n {\n sb.Append('7');\n }\n return sb.ToString();\n }\n }\n\n class MyInt\n {\n public int data;\n\n }\n\n class MyPair\n {\n public int x, y;\n\n public MyPair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static Random rand = new Random(0);\n\n\n static void Main(string[] args)\n {\n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n int n = input.NextInt();\n int m = input.NextInt();\n HashSet set3 = new HashSet();\n for (int j = 1, i = 3; j <= m; j++, i += 3)\n {\n set3.Add(i);\n }\n int max2 = n << 1;\n int max3 = m * 3;\n for (int idx = 1, tw = 2; idx <= n; idx++, tw += 2)\n {\n if (set3.Contains(tw))\n {\n int ntwo = max2 + 2;\n int nthree = max3 + 3;\n if (ntwo < nthree)\n {\n n++;\n max2 = ntwo;\n }\n else\n {\n set3.Add(nthree);\n max3 = nthree;\n }\n }\n }\n writer.WriteLine(Math.Max(max2, max3));\n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Flush();\n writer.Close();\n reader.Close();\n }\n\n }\n\n class LuckyNumber : IComparable\n {\n public int four, seven;\n\n public LuckyNumber()\n {\n this.four = (int)1e7;\n this.seven = (int)1e7;\n }\n\n public LuckyNumber(int four, int seven)\n {\n this.four = four;\n this.seven = seven;\n }\n\n public int CompareTo(LuckyNumber other)\n {\n int digDif = this.four + this.seven - (other.four + other.seven);\n if (digDif != 0)\n {\n return digDif;\n }\n return other.four - this.four;\n }\n\n public override string ToString()\n {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < four; i++)\n {\n sb.Append('4');\n }\n for (int i = 0; i < seven; i++)\n {\n sb.Append('7');\n }\n return sb.ToString();\n }\n }\n\n class MyInt\n {\n public int data;\n\n }\n\n class MyPair\n {\n public int x, y;\n\n public MyPair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = Convert.ToInt32(s.Split(' ')[0]);\n int m = Convert.ToInt32(s.Split(' ')[1]);\n int x = 1;\n while(true)\n {\n if(n <= x / 2 && m <= x / 3 && n + m <= x / 2 + x / 3 - x / 6)\n {\n Console.WriteLine(x);\n goto exit;\n }\n x++;\n }\n exit:;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace CompetitiveProgramming\n{\n class Program\n {\n static bool s_IsMultipleTestCases = false;\n static void Main(string[] args)\n {\n#if DEBUG\n var streamReader = new StreamReader(\"../../input.txt\", Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(\"../../output.txt\", false, Encoding.ASCII, 32768);\n var timer = new Stopwatch();\n timer.Start();\n#else\n var streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n var streamWriter = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n#endif\n var reader = new InputReader(streamReader);\n\n var numberOfTest = 1;\n if (s_IsMultipleTestCases)\n {\n numberOfTest = reader.NextInt();\n }\n for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)\n {\n Task solver = new Task();\n solver.Solve(testNumber, reader, streamWriter);\n }\n#if DEBUG\n streamWriter.WriteLine(\"\\nEslapsed Time: \" + timer.ElapsedMilliseconds + \" ms\");\n#endif\n streamReader.Close();\n streamWriter.Close();\n }\n }\n\n class Task\n {\n public void Solve(int testNumber, InputReader reader, StreamWriter writer)\n {\n var n = reader.NextInt();\n var m = reader.NextInt();\n\n int cnt2 = 0, cnt3 = 0, cnt6 = 0;\n for (int i = 1; ; i++)\n {\n if (i % 6 == 0)\n {\n cnt6++;\n }\n else if (i % 2 == 0)\n {\n cnt2++;\n }\n else if (i % 3 == 0)\n {\n cnt3++;\n }\n if (cnt2 + cnt3 + cnt6 >= m + n && Math.Max(0, (n - cnt2)) + Math.Max(0, (m - cnt3)) <= cnt6)\n {\n writer.WriteLine(i);\n break;\n }\n }\n }\n }\n\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n int num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public long NextLong()\n {\n long num = 0, b;\n var minus = false;\n while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-')\n {\n minus = true;\n b = ReadByte();\n }\n\n while (true)\n {\n if (b >= '0' && b <= '9')\n {\n num = num * 10 + (b - '0');\n }\n else\n {\n return minus ? -num : num;\n }\n b = ReadByte();\n }\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n }\n\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFTraining._8VCVentureCup2016\n{\n\n class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class BlockTowersC\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), m = fs.NextInt(), p2 = 2, p3 = 3;\n int[] a = new int[(int)1e7];\n for (int i = 1; i <= n; i++) \n {\n a[p2]++;\n p2 += 2;\n }\n for (int i = 1; i <= m; i++)\n {\n a[p3]++;\n p3 += 3;\n }\n while (a[p2] != 0) p2 += 2;\n while (a[p3] != 0) p3 += 3;\n for (int i = 1; i < a.Length; i++)\n {\n if (a[i] == 2)\n {\n if (p2 <= p3)\n {\n a[p2]++;\n while (a[p2] != 0) p2 += 2;\n }\n else\n {\n a[p3]++;\n while (a[p3] != 0) p3 += 3;\n }\n }\n }\n writer.WriteLine(Math.Max(p2 - 2, p3 - 3));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class EVC3\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n ulong n = ulong.Parse(strParams[0]);\n ulong m = ulong.Parse(strParams[1]);\n\n\n int b = Math.Min((int)(m / 2), (int)(n / 3));\n\n while (b > 0)\n {\n if (n * 2 > m * 3)\n {\n m++;\n if (m % 2 == 0 && m * 3 < n * 2)\n m++;\n else if (m % 2 == 0 && m * 3 == n * 2)\n n++;\n b--;\n }\n else\n {\n n++;\n if (n % 3 == 0 && m * 3 >= n * 2)\n n++;\n b--;\n }\n if (n * 2 == m * 3)\n n++;\n }\n\n ulong r = Math.Max(n * 2, m * 3);\n\n Console.WriteLine(r.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static int roundTo23(double val)\n {\n int cell = (int)Math.Ceiling(val);\n int floor = (int)Math.Floor(val);\n if (floor % 2 == 0 || floor % 3 == 0)\n return floor;\n else\n return cell;\n }\n\n static void Main(string[] args)\n {\n //while (true)\n //{\n string[] s = Console.ReadLine().Split(' ');\n //if (s[0] == \"-1\")\n // return;\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n int x = Math.Max(n * 2, Math.Max(m * 3, roundTo23(1.5 * (double)(n + m))));\n Console.WriteLine(x);\n //Console.ReadLine();\n //}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n int l = 1, r = 10000000;\n while (l < r)\n {\n int mid = (l + r) / 2;\n int x6 = mid / 6;\n int x2 = mid / 2 - x6;\n int x3 = mid / 3 - x6;\n int xn = Math.Max(0, n - x2);\n int xm = Math.Max(0, m - x3);\n if (xn + xm > x6)\n l = mid + 1;\n else\n r = mid;\n }\n\n Write(l);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int i = 0;\n for (i = 0; i / 2 < n || i / 3 < m || i / 2 + i / 3 - i / 6 < n + m; i++)\n {\n \n }\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _626C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1];\n int i = 0;\n int j = 0;\n int[] tower = new int[10*1000*1000+3];\n int sumI = n * 2;\n int sumJ = m * 3;\n while (m > 0 && n > 0)\n {\n if (i + 2 < j + 3)\n {\n i += 2;\n if (tower[i] == 0) { n--; tower[i]++; } \n }\n else if (j + 3 < i + 2)\n {\n j += 3;\n if (tower[j] == 0) { m--; tower[j]++; } \n }\n\n else if ( j + 3 == i + 2)\n {\n if (sumJ >= sumI && tower[j+3] == 0) \n {\n j += 3; m--; sumI += 2; tower[j]++;\n }\n else if (sumJ < sumI && tower[i+2] == 0)\n { i += 2; n--; sumJ += 3; tower[i]++; }\n }\n }\n \n while (n>0)\n {\n i+=2;\n if (tower[i] == 0) { n--; tower[i]++; } \n }\n while (m>0)\n {\n j += 3;\n if (tower[j] == 0) { m--; tower[j]++; } \n }\n\n \n \n Console.WriteLine(Math.Max(i,j));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _626C\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1]; \n int sumI = n * 2;\n int sumJ = m * 3;\n\n for (int i = 6; i <= sumI && i <= sumJ; i+=6 )\n {\n if (sumI + 2 > sumJ + 3) sumJ += 3;\n else sumI += 2;\n }\n Console.WriteLine(Math.Max(sumI, sumJ));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\n public class Pair : IComparable\n {\n public int L;\n public int R;\n public int Index;\n public bool Inverted;\n public Pair Next;\n\n public void Invert(int h)\n {\n this.Inverted = !this.Inverted;\n int tmp = L;\n L = h - R;\n R = h - tmp;\n }\n public void Sort(int h)\n {\n if (L <= R && L > h - R)\n {\n this.Invert(h);\n }\n\n if (L > R && L < h - R)\n {\n this.Invert(h);\n }\n }\n\n public int CompareTo(Pair other)\n {\n return (this.R - this.L) * this.L.CompareTo(other.L);\n }\n\n public override string ToString()\n {\n return L + \" \" + R;\n }\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int m = ReadInt();\n int x = 0;\n for (int i = 2; ; i++)\n {\n if (i % 2 == 0) n--;\n if (i % 3 == 0) m--;\n\n if (i % 6 == 0) x++;\n while (m < 0 && x > 0)\n {\n m++;\n x--;\n }\n while (n < 0 && x > 0)\n {\n n++;\n x--;\n }\n\n if (m <= 0 && n <= 0 && x<=0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n /*\n int h = ReadInt();\n int n = ReadInt();\n\n Pair[] m = new Pair[n];\n Pair[] used = new Pair[h + 1];\n for (int i = 0; i < n; i++)\n {\n m[i] = new Pair()\n {\n L = ReadInt(),\n R = ReadInt(),\n Index = i + 1\n };\n m[i].Sort(h);\n\n if ((m[0].R - m[0].L != m[i].R - m[i].L) ||\n (m[0].R == m[0].L && m[i].L != m[0].L))\n {\n Console.WriteLine(0);\n return;\n }\n\n if (m[0].R != m[0].L)\n {\n if (used[m[i].L] == null)\n {\n used[m[i].L] = m[i];\n }\n else\n {\n m[i].Invert(h);\n if (used[m[i].L].Next != null)\n {\n Console.WriteLine(0);\n return;\n }\n\n used[m[i].L].Next = m[i];\n }\n }\n }\n\n int[] ans = new int[n];\n int start = m[0].L;\n if (m[0].L < m[0].R) start = m.Min(x => x.L);\n if (m[0].L > m[0].R) start = m.Max(x => x.L);\n\n int d = m[0].R - m[0].L;\n int xx = 0;\n while (true)\n {\n Pair c = null;\n if (used[start] != null)\n {\n c = used[start];\n used[start] = used[start].Next;\n }\n else\n {\n int pos = h - start;\n c = used[pos];\n if (c == null)\n {\n break;\n }\n used[pos] = used[pos].Next;\n c.Invert(h);\n }\n\n ans[xx++] = (c.Inverted ? -1 : 1) * c.Index;\n start = c.R;\n }\n\n if (xx != n)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(string.Join(\" \", ans));*/\n }\n\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n while (true)\n {\n return ReadDigit() - (int)'0';\n }\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint r=3*(A+B+1);\n\t\tint l=0;\n\t\tint c=0;\n\t\twhile(r-l>1){\n\t\t\tc=(r+l)/2;\n\t\t\tif(isOk(c)){\n\t\t\t\tr=c;\n\t\t\t}else{\n\t\t\t\tl=c;\n\t\t\t}\n\t\t}\n\t\twhile(isOk(c))c--;\n\t\twhile(!isOk(c))c++;\n\t\tConsole.WriteLine(c);\n\t\t\n\t}\n\t\n\tbool isOk(int t){\n\t\tint n2=t/2;\n\t\tint n3=t/3;\n\t\tint n6=t/6;\n\t\tn2-=n6;\n\t\tn3-=n6;\n\t\tfor(int i=0;i<=n6;i++){\n\t\t\tif(n2+i>=A && n3+(n6-i)>=B)return true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\t\n\t\n\tint A,B;\n\tpublic Sol(){\n\t\tvar d=ria();\n\t\tA=d[0];B=d[1];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}], "negative_code": [{"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vc3\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var a = readIntArray();\n var n = a[0];\n var m = a[1];\n var h2 = 2;\n var h3 = 0;\n\n if (n == 0)\n {\n Console.WriteLine(3 * m);\n return;\n }\n\n if (m == 0)\n {\n Console.WriteLine(2 * n);\n return;\n }\n\n if (m >= n)\n {\n var rem = m - n;\n var h = (n / 2) * 6 + (n % 2) * 3 + rem * 3;\n Console.WriteLine(h);\n return;\n }\n else\n {\n var rem = n - m;\n var ct = rem / 2;\n var r = rem % 2;\n\n var rc = n - ct * 3;\n var h = (rc / 2) * 6 + (rc % 2) * 2 + ct * 6;\n Console.WriteLine(h);\n return;\n }\n\n //while (true)\n //{\n // if (m > 0)\n // {\n // if (h3 < h2 || n == 0)\n // {\n // while (h3 < h2 && m > 0)\n // {\n // h3 += 3;\n // m--;\n // }\n\n // continue;\n // }\n // }\n\n // if (n > 0)\n // {\n // if (h2 < h3 || m == 0)\n // {\n // while (h2 < h3 && n > 0)\n // {\n // h2 += 2;\n // n--;\n // }\n\n // continue;\n // }\n // }\n\n // if (h2 == h3)\n // {\n // var p2 = (n + 1) * 2;\n // var p3 = (m + 1) * 3;\n\n // if (p2 > p3)\n // {\n\n // }\n // }\n //}\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class EVC3\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n ulong n = ulong.Parse(strParams[0]);\n ulong m = ulong.Parse(strParams[1]);\n\n\n int b = Math.Min((int)(m / 2), (int)(n / 3));\n\n while (b > 0)\n {\n if (n * 2 > m * 3)\n {\n m++;\n b--;\n }\n else\n {\n n++;\n b--;\n }\n if (n * 2 == m * 3)\n n++;\n }\n\n ulong r = Math.Max(n * 2, m * 3);\n\n Console.WriteLine(r.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n int x = Math.Max(n * 2, Math.Max(m * 3, (int)Math.Ceiling(1.5 * (double)(n + m))));\n Console.WriteLine(x);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n int x = Math.Max(n * 2, Math.Max(m * 3, (int)Math.Floor(1.5 * (double)(n + m))));\n Console.WriteLine(x);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n long x = (long)n * 2;\n long y = (long)m * 3;\n if (x > y)\n {\n Console.WriteLine(x);\n }\n else if (y > x)\n {\n Console.WriteLine(y);\n }\n else\n {\n Console.WriteLine(x+2);\n }\n\n\n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n List l = new List();\n bool f = false;\n for (int i = 1; i <= n; i++)\n {\n if (i * 2 <= m * 3 && (i * 2) % 3 == 0)\n {\n f = true;\n l.Add(i * 2);\n }\n }\n if (f)\n {\n int max1 = 0;\n int max2 = 0;\n l.Sort();\n int[] l2 = new int[l.Count];\n for (int i = 0; i < l.Count; i++)\n {\n l2[i] = (l[i]);\n }\n l[0] = n * 2 + 2;\n for (int i = 1; i < l.Count; i++)\n {\n l[i] = l[i - 1] + 2;\n }\n l2[0] = m * 3 + 3;\n for (int i = 1; i < l2.Length; i++)\n {\n l2[i] = l2[i - 1] + 2;\n }\n Console.WriteLine(Math.Min(l.Max(), l2.Max()));\n\n }\n else\n {\n long x = (long)n * 2;\n long y = (long)m * 3;\n if (x > y)\n {\n Console.WriteLine(x);\n }\n else if (y > x)\n {\n Console.WriteLine(y);\n }\n else\n {\n Console.WriteLine(x + 2);\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n List l = new List();\n bool f = false;\n for (int i = 1; i <= n; i++)\n {\n if (i * 2 <= m * 3 && (i * 2) % 3 == 0)\n {\n f = true;\n l.Add(i * 2);\n }\n }\n if (f)\n {\n l.Sort();\n l[0] = l.Max() + 2;\n for (int i = 1; i < l.Count; i++)\n {\n l[i] = l[i - 1] + 2;\n }\n\n //Console.WriteLine();\n Console.WriteLine(l.Max());\n }\n else\n {\n long x = (long)n * 2;\n long y = (long)m * 3;\n if (x > y)\n {\n Console.WriteLine(x);\n }\n else if (y > x)\n {\n Console.WriteLine(y);\n }\n else\n {\n Console.WriteLine(x + 2);\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _626C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1];\n int i = 0;\n int j = 0;\n int[] tower = new int[3*1000*1000+3];\n while (m > 0)\n {\n j += 3; m--; tower[j]++;\n }\n while (n > 0)\n {\n i += 2;\n if (tower[i] == 0)\n {\n n--; tower[i]++;\n }\n }\n Console.WriteLine(Math.Max(i,j));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nclass Program\n{\n public class Pair : IComparable\n {\n public int L;\n public int R;\n public int Index;\n public bool Inverted;\n public Pair Next;\n\n public void Invert(int h)\n {\n this.Inverted = !this.Inverted;\n int tmp = L;\n L = h - R;\n R = h - tmp;\n }\n public void Sort(int h)\n {\n if (L <= R && L > h - R)\n {\n this.Invert(h);\n }\n\n if (L > R && L < h - R)\n {\n this.Invert(h);\n }\n }\n\n public int CompareTo(Pair other)\n {\n return (this.R - this.L) * this.L.CompareTo(other.L);\n }\n\n public override string ToString()\n {\n return L + \" \" + R;\n }\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int m = ReadInt();\n int x = 0;\n for (int i = 2; i < 5555; i++)\n {\n if (i % 2 == 0) n--;\n if (i % 3 == 0) m--;\n\n if (i % 6 == 0) x++;\n while (m < 0 && x > 0)\n {\n m++;\n x--;\n }\n while (n < 0 && x > 0)\n {\n n++;\n x--;\n }\n\n if (m <= 0 && n <= 0 && x<=0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n /*\n int h = ReadInt();\n int n = ReadInt();\n\n Pair[] m = new Pair[n];\n Pair[] used = new Pair[h + 1];\n for (int i = 0; i < n; i++)\n {\n m[i] = new Pair()\n {\n L = ReadInt(),\n R = ReadInt(),\n Index = i + 1\n };\n m[i].Sort(h);\n\n if ((m[0].R - m[0].L != m[i].R - m[i].L) ||\n (m[0].R == m[0].L && m[i].L != m[0].L))\n {\n Console.WriteLine(0);\n return;\n }\n\n if (m[0].R != m[0].L)\n {\n if (used[m[i].L] == null)\n {\n used[m[i].L] = m[i];\n }\n else\n {\n m[i].Invert(h);\n if (used[m[i].L].Next != null)\n {\n Console.WriteLine(0);\n return;\n }\n\n used[m[i].L].Next = m[i];\n }\n }\n }\n\n int[] ans = new int[n];\n int start = m[0].L;\n if (m[0].L < m[0].R) start = m.Min(x => x.L);\n if (m[0].L > m[0].R) start = m.Max(x => x.L);\n\n int d = m[0].R - m[0].L;\n int xx = 0;\n while (true)\n {\n Pair c = null;\n if (used[start] != null)\n {\n c = used[start];\n used[start] = used[start].Next;\n }\n else\n {\n int pos = h - start;\n c = used[pos];\n if (c == null)\n {\n break;\n }\n used[pos] = used[pos].Next;\n c.Invert(h);\n }\n\n ans[xx++] = (c.Inverted ? -1 : 1) * c.Index;\n start = c.R;\n }\n\n if (xx != n)\n {\n Console.WriteLine(0);\n return;\n }\n\n Console.WriteLine(string.Join(\" \", ans));*/\n }\n\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n while (true)\n {\n return ReadDigit() - (int)'0';\n }\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn = 0;\n int m = int.Parse(inp[1]), tm = 0;\n\n tm = m * 3;\n tn = n * 2;\n for (int i = 0; i < n && i < m; i += 3)\n {\n if (tn >= tm + 3)\n tm += 3;\n else\n tn += 2;\n }\n int max = Math.Max(tn, tm);\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn1 = 0, tn2 = 0;\n int m = int.Parse(inp[1]), tm1 = 0, tm2 = 0;\n\n for (int i = 0; i < n; i++)\n {\n //tn1 += 2;\n tn2 += 2;\n if (tn2 % 3 == 0 && m * 3 >= tn2)\n tn2 += 2;\n }\n tm2 = m * 3;\n int max = -1;\n //max = (tn1 < max) ? tn1 : max;\n max = (tn2 > max) ? tn2 : max;\n //max = (tm1 < max) ? tm1 : max;\n max = (tm2 > max) ? tm2 : max;\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn = 0;\n int m = int.Parse(inp[1]), tm = 0;\n\n tm = m * 3;\n tn = n * 2;\n for (int i = 0; i < n && i < m; i += 6)\n {\n if (tn >= tm + 3)\n tm += 3;\n else\n tn += 2;\n }\n int max = Math.Max(tn, tm);\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn = 0;\n int m = int.Parse(inp[1]), tm = 0;\n\n tm = m * 3;\n tn = n * 2;\n for (int i = 6; i <= tn && i <= tm; i += 6)\n {\n if (tn >= tm + 3)\n tm += 3;\n else\n tn += 2;\n }\n int max = Math.Max(tn, tm);\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ');\n int n = int.Parse(inp[0]), tn1 = 0, tn2 = 0;\n int m = int.Parse(inp[1]), tm1 = 0, tm2 = 0;\n\n for (int i = 0; i < n; i++)\n {\n //tn1 += 2;\n tn2 += 2;\n if (tn2 % 3 == 0 && m * 3 >= tn2)\n tn2 += 2;\n }\n for (int i = 0; i < m; i++)\n {\n //tm1 += 3;\n tm2 += 3;\n //if (tm2 % 2 == 0 && n * 2 >= tm2)\n //tm2 += 3;\n }\n int max = -1;\n //max = (tn1 < max) ? tn1 : max;\n max = (tn2 > max) ? tn2 : max;\n //max = (tm1 < max) ? tm1 : max;\n max = (tm2 > max) ? tm2 : max;\n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vc3\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var a = readIntArray();\n var n = a[0];\n var m = a[1];\n var h2 = 2;\n var h3 = 0;\n\n if (n == 0)\n {\n Console.WriteLine(3 * m);\n return;\n }\n\n if (m == 0)\n {\n Console.WriteLine(2 * n);\n return;\n }\n\n if (m >= n)\n {\n var rem = m - n;\n var h = (n / 2) * 6 + (n % 2) * 3 + rem * 3;\n Console.WriteLine(h);\n return;\n }\n else\n {\n var rem = n - m;\n var ct = rem / 2;\n var r = rem % 2;\n\n var rc = n - ct * 3 - r;\n \n var h = (rc / 2) * 6 + ct * 6;// +(rc % 2) * 3 + ct * 6;\n var add = Math.Max((rc % 2) * 3, r * 2 + (rc % 2) * 2);\n Console.WriteLine(h + add);\n return;\n }\n\n //while (true)\n //{\n // if (m > 0)\n // {\n // if (h3 < h2 || n == 0)\n // {\n // while (h3 < h2 && m > 0)\n // {\n // h3 += 3;\n // m--;\n // }\n\n // continue;\n // }\n // }\n\n // if (n > 0)\n // {\n // if (h2 < h3 || m == 0)\n // {\n // while (h2 < h3 && n > 0)\n // {\n // h2 += 2;\n // n--;\n // }\n\n // continue;\n // }\n // }\n\n // if (h2 == h3)\n // {\n // var p2 = (n + 1) * 2;\n // var p3 = (m + 1) * 3;\n\n // if (p2 > p3)\n // {\n\n // }\n // }\n //}\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}], "src_uid": "23f2c8cac07403899199abdcfd947a5a"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n for (int i = x-1; i >= 0; i--)\n {\n if (x == 1)\n {\n Console.WriteLine(1);\n break;\n }\n if(x==2)\n {\n Console.WriteLine(2);\n break;\n }\n if (x % i != 0)\n {\n Console.WriteLine(x - i);\n break;\n }\n }\n\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n if(\"2\" != Console.ReadLine())\n {\n Console.WriteLine(1);\n } else\n {\n Console.WriteLine(2);\n }\n //\u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e? | So it is possible?\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine()); \n Console.WriteLine(a==2?2:1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(object[] a, string separator)\n\t{\n\t\tif (a.Length < 100)\n\t\t{\n\t\t\tConsole.WriteLine(String.Join(separator, a));\n\t\t\treturn;\n\t\t}\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = 0;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = 0; i < b.Length - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < b.Length - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint n = UtilityMethods.ReadInt();\n\t\tUtilityMethods.WriteLine(n == 2 ? 2 : 1);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace avito_2018_12_16\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 1;\n if (n == 2) res = 2;\n Console.WriteLine(res.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1081A\n {\n public static void Main() => Console.WriteLine(int.Parse(Console.ReadLine()) == 2 ? 2 : 1);\n }\n}"}, {"source_code": "using System;\n\npublic class Solution\n{\n static void Main(String[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 1)\n {\n Console.WriteLine(n);\n }\n else if (n == 2)\n {\n Console.WriteLine(n);\n }\n else\n {\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = int.Parse(s);\n Console.WriteLine(n == 2 ? 2 : 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(ReadLine());\n WriteLine(a==2?2:1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint T = int.Parse(Console.ReadLine());\n\t\tint ans = 1;\n\t\tif(T==2){\n\t\t\tans = 2;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 2)\n Console.WriteLine(2);\n else\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n if(int.Parse(Console.ReadLine())!=2)\n \n Console.WriteLine(1);\n else\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Definite_Game\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve());\n writer.Flush();\n }\n\n private static string Solve()\n {\n int n = Next();\n if (n == 2)\n return \"2\";\n return \"1\";\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication18\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n \n if(Console.ReadLine() == \"2\") Console.WriteLine(2); \n else Console.WriteLine(1); \n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace avA\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n Solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n static void Solution()\n {\n #region SOLUTION\n var n = ReadInt();\n if (n == 2)\n {\n Console.WriteLine(2);\n return;\n }\n\n Console.WriteLine(1);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AlgoHelper\n{\n public class Pair\n {\n public int X { get; set; }\n public int Y { get; set; }\n\n public Pair(int x, int y)\n {\n X = x;\n Y = y;\n }\n\n //public override bool Equals(object obj)\n //{\n // var pair = obj as Pair;\n // return X + Y == pair.X + pair.Y;\n //}\n\n //public override int GetHashCode()\n //{\n // var hashCode = 1861411795;\n // hashCode = hashCode * -1521134295 + X.GetHashCode();\n // hashCode = hashCode * -1521134295 + Y.GetHashCode();\n // return hashCode;\n //}\n\n public override string ToString()\n {\n return $\"X = {X} Y = {Y}\";\n }\n }\n\n class PairComparer : IComparer\n {\n public int Compare(Pair x, Pair y)\n {\n return y.Y.CompareTo(x.Y);\n }\n }\n\n class Person\n {\n public int Age { get; set; }\n public string Name { get; set; }\n\n }\n\n\n\n class Program\n {\n static void Main(string[] args)\n {\n int s = int.Parse(Console.ReadLine());\n if(s<=2) Console.WriteLine(s);\n else Console.WriteLine(1);\n\n // Console.ReadKey();\n }\n\n static int makingAnagrams(string s1, string s2)\n {\n int length = s1.Length + s2.Length;\n\n int[] freqA = frequency(s1);\n int[] freqB = frequency(s2);\n\n Console.WriteLine(string.Join(\"|\",freqA));\n Console.WriteLine(string.Join(\"|\", freqB));\n\n\n int count = 0;\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != freqB[i]) count++;\n }\n\n return length - count;\n }\n public static int firstMissingPositive(int[] a)\n {\n int missing = 1;\n\n HashSet set = new HashSet();\n\n for (int i = 0; i < a.Length; i++)\n {\n if(a[i]>missing)\n {\n set.Add(a[i]);\n }\n else if(a[i] == missing)\n {\n if(!set.Contains(missing+1))\n {\n missing++; \n }\n else\n {\n missing = returnNewMax(++missing, set);\n }\n }\n }\n\n return missing;\n }\n\n private static int returnNewMax(int n, HashSet set)\n {\n while(set.Contains(n))\n {\n n++;\n }\n\n return n;\n }\n\n\n\n private static bool checkForAllZeroes(string s)\n {\n foreach(char c in s)\n {\n if (c != '0') return false;\n }\n\n return true;\n }\n\n private static int getHigherNumber(int n,int max)\n {\n int currentLength = maxLength(n);\n\n if (currentLength < max)\n {\n int diff = max - currentLength;\n int newNumber = n * (int)Math.Pow(10, diff);\n return newNumber;\n }\n\n return n;\n }\n\n private static int maxLength(int n)\n {\n return n.ToString().Length;\n }\n\n static int gemstones(string[] arr)\n {\n int[][] frequencies = new int[arr.Length][];\n\n for (int i = 0; i < frequencies.Length; i++)\n {\n frequencies[i] = frequency(arr[i]);\n }\n\n int count = 0;\n bool flag = true;\n\n for (int i = 0; i < frequencies[0].Length; i++) //26\n {\n for (int j = 0; j < frequencies.Length - 1; j++)\n {\n if (frequencies[j][i] == 0 || frequencies[j + 1][i] == 0)\n {\n flag = false;\n break;\n }\n }\n\n if (flag) count++;\n flag = true;\n }\n\n return count;\n }\n\n private static bool isFunny(string s)\n {\n int[] diff = difference(s);\n\n return isPalindrome(diff);\n }\n\n private static int [] difference (string a)\n {\n int[] ans = new int[a.Length - 1];\n\n for (int i = 0; i < a.Length - 1; i++)\n {\n ans[i] = Math.Abs(a[i] - a[i + 1]);\n }\n\n return ans;\n }\n\n private static bool isPalindrome(int [] a)\n {\n for(int i=0;i a[med])\n {\n lo = med + 1;\n }\n\n else hi = med - 1;\n }\n\n return ans;\n }\n\n private static string randomString(Random r)\n {\n int l = r.Next(1,10);\n\n string s = string.Empty;\n\n for (int i = 0; i < l; i++)\n {\n s += char.ConvertFromUtf32(r.Next(96, 122));\n }\n\n return s;\n }\n\n private static int [] prefixMax(int [] a)\n {\n int max = a[a.Length - 1];\n\n Stack stack = new Stack();\n\n stack.Push(a[a.Length - 1]);\n\n int[] b = new int[a.Length];\n\n b[a.Length - 1] = -1;\n\n bool found = false;\n\n for (int i = a.Length - 2; i >=0; i--)\n {\n while (stack.Count > 0)\n {\n int temp = stack.Peek();\n\n if (temp > a[i])\n {\n b[i] = temp;\n found = true;\n break;\n }\n else\n {\n stack.Pop();\n }\n }\n\n stack.Push(a[i]);\n if (!found) b[i] = -1;\n found = false;\n }\n\n return b;\n }\n\n private static bool hasTheSameLetters(string a, string b)\n {\n\n int[] freqA = frequency(a);\n int[] freqB = frequency(b);\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != 0 && freqB[i] != 0) return true;\n }\n\n return false;\n }\n\n\n private static int [] frequency(string s)\n {\n int[] a = new int[26];\n\n foreach(char c in s)\n {\n a[c - 'a']++;\n }\n\n return a;\n }\n\n private static bool checkTwoArrays(int [] a,int []b)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i]) return false;\n }\n\n return true;\n }\n\n private static long solution(long[] a, long h, long lo,long hi)\n {\n long med = hi - (hi - lo) / 2;\n while(lo<=hi)\n {\n med = hi - (hi - lo) / 2;\n long ans = solve(a, med);\n Console.WriteLine($\"ans = {ans} lo = {lo} med = {med}\");\n if (ans <= h) hi = med - 1;\n else if (ans > h) lo = med + 1;\n }\n\n return lo;\n }\n\n private static long solve(long [] a,long k)\n {\n long sum = 0;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i]<=k)\n {\n sum++;\n }\n else\n {\n sum += (a[i] / k) + 1;\n }\n }\n\n return sum;\n }\n\n public static bool LemonadeChange(int[] bills)\n {\n if (bills[0] > 5) return false;\n\n Dictionary dict = new Dictionary();\n\n int currentAmount = 5;\n\n dict[5] = 1;\n\n for (int i = 1; i < bills.Length; i++)\n {\n if (bills[i] > 5)\n {\n int charge = bills[i] - 5;\n if (currentAmount < charge) return false;\n\n currentAmount+=5;\n }\n else\n {\n currentAmount += bills[i];\n dict[5]++;\n }\n }\n\n return false;\n }\n\n \n\n private static int solve(int n,int x,int y,int d)\n {\n if ((y-x) % d == 0) {\n return (y - x) / d;\n }\n\n if((x-y)%d==0)\n {\n return (x - y) / d;\n }\n\n if((y-1)%d==0)\n {\n int firstStep = 0;\n\n if ((x-1)%d==0)\n {\n firstStep = (x - 1) / d;\n }\n else\n {\n firstStep = (x - 1) / d + 1;\n }\n\n int secodnStep = (y - 1) / d; \n\n return firstStep + secodnStep;\n \n }\n\n return -1;\n }\n public static int max(int [] a, int i)\n {\n if (i == a.Length - 1) return a[a.Length - 1];\n else return Math.Max(a[i], max(a, i + 1));\n }\n\n\n\n public static int MaxArea(int[] a)\n {\n int l = 0;\n int r = a.Length - 1;\n\n int max = int.MinValue;\n \n\n\n while (l < r)\n {\n max = Math.Max(max, Math.Min(a[l], a[r]) * (r - l));\n\n if (a[l] < a[r]) l++;\n else r--;\n }\n\n return max;\n }\n\n\n private static bool isPrime(int n)\n {\n if (n < 2) return false;\n\n for(int i=2;i*i<=n;i++)\n {\n if (n % i == 0) return false;\n }\n\n return true;\n }\n\n private static void Swap(ref char a, ref char b)\n {\n char temp = a;\n a = b;\n b = temp;\n }\n }\n}\n"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"8\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var sc = new Scanner();\n var n = sc.NextLong();\n System.Console.WriteLine(n == 2 ? 2 : 1);\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static T ElementWithMax(this IEnumerable seq, Func func) {\n var bi = default(T);\n var bv = long.MinValue;\n foreach (var item in seq) {\n var v = func(item);\n if (v > bv) {\n bi = item;\n bv = v;\n }\n }\n return bi;\n }\n\n public static IEnumerable IndicesWhere(this IEnumerable seq, Func cond) {\n var i = 0;\n foreach (var item in seq) {\n if (cond(item)) yield return i;\n i++;\n }\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray() {\n var array = Array();\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int v = NextInt();\n writer.Write(v == 2 ? \"2\" : \"1\");\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int NextInt() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n private static long NextLong() {\n int c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int v = Convert.ToInt32(Console.ReadLine());\n if (v == 1 || v == 2) Console.WriteLine(v);\n else Console.WriteLine(\"1\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n int n = Convert.ToInt32( Console.ReadLine() );\n if(n == 2)\n Console.WriteLine( 2 );\n else\n Console.WriteLine( 1 );\n\n //--------------------------------solve--------------------------------/\n\n\n }\n\n\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace aDefintieGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n bool done = true;\n while (done)\n {\n if (n - 1 != 0 && n % (n - 1) != 0)\n {\n n = n - (n - 1);\n }\n else if (n - 2 != 0 && n % (n - 2) != 0)\n {\n n = n - (n - 2);\n }\n else\n {\n done = false;\n }\n }\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "// Problem: 1081A - Definite Game\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass DefiniteGame\n {\n public static int Main ()\n {\n string line;\n string[] words;\n uint v;\n \n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split ();\n if (words.Length != 1)\n return -1;\n if (!UInt32.TryParse (words[0], out v))\n return -1;\n if (v < 1 || v > 1000000000)\n return -1;\n Console.WriteLine (v == 2 ? 2 : 1);\n return 0;\n }\n }\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Console.WriteLine(Console.ReadLine() == \"2\" ? \"2\" : \"1\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int GetIntNumber()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n static long GetLongNumber()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n static int[] GetArrayIntNumber()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] array = new int[str.Length];\n for (int i = 0; i < str.Length; i++)\n {\n array[i] = Convert.ToInt32(str[i]);\n }\n return array;\n }\n\n\t\tstatic long[] GetArrayLongNumber()\n\t\t{\n\t\t\tstring[] str = Console.ReadLine().Split(' ');\n\t\t\tlong[] array = new long[str.Length];\n\t\t\tfor (int i = 0; i < str.Length; i++)\n\t\t\t{\n\t\t\t\tarray[i] = Convert.ToInt64(str[i]);\n\t\t\t}\n\t\t\treturn array;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n {\n int n = GetIntNumber();\n if (n > 2)\n Console.WriteLine(1);\n else\n Console.WriteLine(n);\n\t\t}\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n Console.ReadLine();\n Console.WriteLine(1);\n //Console.ReadKey();\n }\n }\n}\n#region\n//int n = Convert.ToInt32(Console.ReadLine());\n//int b = 100, d = 0, d1 = 0;\n//int[] i = new int[n];\n//string stroka = \"15 14 32 65 28 96 33 93 48 28 57 20 32 20 90 42 57 53 18 58 94 21 27 29 37 22 94 45 67 60 83 23 20 23 35 93 3 42 6 46 68 46 34 25 17 16 50 5 49 91 23 76 69 100 58 68 81 32 88 41 64 29 37 13 95 25 6 59 74 58 31 35 16 80 13 80 10 59 85 18 16 70 51 40 44 28 8 76 8 87 53 86 28 100 2 73 14 100 52 9 \";//Console.ReadLine() + \" \";\n//for (int a = 0; a < i.Length; a++)\n//{\n// i[a] = Convert.ToInt32(stroka.Substring(0, stroka.IndexOf(' ')));\n// stroka = stroka.Remove(0, stroka.IndexOf(' ') + 1);\n//}\n//for (int a = 0; a < n; a++)\n//{\n// for (int c = 0; c < n; c++) {\n// if (i[a] == i[c] && a != c && i[a] != 0)\n// {\n// i[a] = 0;\n// i[c] = 0;\n// }\n// }\n//}\n//for (int a = 0; a < n; a++)\n//{\n// for (int c = 0; c < n; c++)\n// {\n// if (b >= i[a] - i[c] && i[a] - i[c] > 0 && i[c] != 0)\n// {\n// b = i[a] - i[c];\n// d = c;\n// } else if (b >= i[c] - i[a] && i[c] - i[a] > 0 && i[c] != 0)\n// {\n// b = i[c] - i[a];\n// d = c;\n// }\n// }\n// if (b != 0 && b != 100)\n// {\n// d1 += b;\n// i[a] = 0;\n// i[d] = 0;\n// }\n// b = 100;\n//}\n#endregion\n//int n = Convert.ToInt32(Console.ReadLine());\n//int b = 100, d = 0, d1 = 0;\n//int[] i = new int[n];\n//for(int a = 0; a < i.Length; a++)\n//{\n// i[a] = Convert.ToInt32(Console.ReadLine());\n//}\n//for (int a = 0; a < n; a++)\n//{\n// for (int c = 0; c < n; c++)\n// {\n// if(i[a] == i[c] && a != c)\n// {\n// i[a] = 0;\n// i[c] = 0;\n// b = 100;\n// }\n// if(b >= i[a] - i[c] && i[a] - i[c] > 0 && i[c] != 0)\n// {\n// b = i[a] - i[c];\n// d = c;\n// }\n// }\n// if (b != 0 && b!= 100)\n// {\n// d1 = +b;\n// i[a] = 0;\n// i[d] = 0;\n// }\n// b = 100;\n//}\n//Console.WriteLine(d1);\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine(); \n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(object[] a, string separator)\n\t{\n\t\tif (a.Length < 100)\n\t\t{\n\t\t\tConsole.WriteLine(String.Join(separator, a));\n\t\t\treturn;\n\t\t}\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = 0;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = 0; i < b.Length - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < b.Length - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tUtilityMethods.WriteLine(1);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n WriteLine(1);\n }\n}"}, {"source_code": "using System;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.Write(1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(1);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Definite_Game\n{\n internal class Program\n {\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(\"1\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication18\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n \n\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace avA\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n Solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n static void Solution()\n {\n #region SOLUTION\n var n = ReadInt();\n Console.WriteLine(1);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace AlgoHelper\n{\n public class Pair\n {\n public int X { get; set; }\n public int Y { get; set; }\n\n public Pair(int x, int y)\n {\n X = x;\n Y = y;\n }\n\n //public override bool Equals(object obj)\n //{\n // var pair = obj as Pair;\n // return X + Y == pair.X + pair.Y;\n //}\n\n //public override int GetHashCode()\n //{\n // var hashCode = 1861411795;\n // hashCode = hashCode * -1521134295 + X.GetHashCode();\n // hashCode = hashCode * -1521134295 + Y.GetHashCode();\n // return hashCode;\n //}\n\n public override string ToString()\n {\n return $\"X = {X} Y = {Y}\";\n }\n }\n\n class PairComparer : IComparer\n {\n public int Compare(Pair x, Pair y)\n {\n return y.Y.CompareTo(x.Y);\n }\n }\n\n class Person\n {\n public int Age { get; set; }\n public string Name { get; set; }\n\n }\n\n\n\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(1);\n\n // Console.ReadKey();\n }\n\n static int makingAnagrams(string s1, string s2)\n {\n int length = s1.Length + s2.Length;\n\n int[] freqA = frequency(s1);\n int[] freqB = frequency(s2);\n\n Console.WriteLine(string.Join(\"|\",freqA));\n Console.WriteLine(string.Join(\"|\", freqB));\n\n\n int count = 0;\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != freqB[i]) count++;\n }\n\n return length - count;\n }\n public static int firstMissingPositive(int[] a)\n {\n int missing = 1;\n\n HashSet set = new HashSet();\n\n for (int i = 0; i < a.Length; i++)\n {\n if(a[i]>missing)\n {\n set.Add(a[i]);\n }\n else if(a[i] == missing)\n {\n if(!set.Contains(missing+1))\n {\n missing++; \n }\n else\n {\n missing = returnNewMax(++missing, set);\n }\n }\n }\n\n return missing;\n }\n\n private static int returnNewMax(int n, HashSet set)\n {\n while(set.Contains(n))\n {\n n++;\n }\n\n return n;\n }\n\n\n\n private static bool checkForAllZeroes(string s)\n {\n foreach(char c in s)\n {\n if (c != '0') return false;\n }\n\n return true;\n }\n\n private static int getHigherNumber(int n,int max)\n {\n int currentLength = maxLength(n);\n\n if (currentLength < max)\n {\n int diff = max - currentLength;\n int newNumber = n * (int)Math.Pow(10, diff);\n return newNumber;\n }\n\n return n;\n }\n\n private static int maxLength(int n)\n {\n return n.ToString().Length;\n }\n\n static int gemstones(string[] arr)\n {\n int[][] frequencies = new int[arr.Length][];\n\n for (int i = 0; i < frequencies.Length; i++)\n {\n frequencies[i] = frequency(arr[i]);\n }\n\n int count = 0;\n bool flag = true;\n\n for (int i = 0; i < frequencies[0].Length; i++) //26\n {\n for (int j = 0; j < frequencies.Length - 1; j++)\n {\n if (frequencies[j][i] == 0 || frequencies[j + 1][i] == 0)\n {\n flag = false;\n break;\n }\n }\n\n if (flag) count++;\n flag = true;\n }\n\n return count;\n }\n\n private static bool isFunny(string s)\n {\n int[] diff = difference(s);\n\n return isPalindrome(diff);\n }\n\n private static int [] difference (string a)\n {\n int[] ans = new int[a.Length - 1];\n\n for (int i = 0; i < a.Length - 1; i++)\n {\n ans[i] = Math.Abs(a[i] - a[i + 1]);\n }\n\n return ans;\n }\n\n private static bool isPalindrome(int [] a)\n {\n for(int i=0;i a[med])\n {\n lo = med + 1;\n }\n\n else hi = med - 1;\n }\n\n return ans;\n }\n\n private static string randomString(Random r)\n {\n int l = r.Next(1,10);\n\n string s = string.Empty;\n\n for (int i = 0; i < l; i++)\n {\n s += char.ConvertFromUtf32(r.Next(96, 122));\n }\n\n return s;\n }\n\n private static int [] prefixMax(int [] a)\n {\n int max = a[a.Length - 1];\n\n Stack stack = new Stack();\n\n stack.Push(a[a.Length - 1]);\n\n int[] b = new int[a.Length];\n\n b[a.Length - 1] = -1;\n\n bool found = false;\n\n for (int i = a.Length - 2; i >=0; i--)\n {\n while (stack.Count > 0)\n {\n int temp = stack.Peek();\n\n if (temp > a[i])\n {\n b[i] = temp;\n found = true;\n break;\n }\n else\n {\n stack.Pop();\n }\n }\n\n stack.Push(a[i]);\n if (!found) b[i] = -1;\n found = false;\n }\n\n return b;\n }\n\n private static bool hasTheSameLetters(string a, string b)\n {\n\n int[] freqA = frequency(a);\n int[] freqB = frequency(b);\n\n for (int i = 0; i < freqA.Length; i++)\n {\n if (freqA[i] != 0 && freqB[i] != 0) return true;\n }\n\n return false;\n }\n\n\n private static int [] frequency(string s)\n {\n int[] a = new int[26];\n\n foreach(char c in s)\n {\n a[c - 'a']++;\n }\n\n return a;\n }\n\n private static bool checkTwoArrays(int [] a,int []b)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != b[i]) return false;\n }\n\n return true;\n }\n\n private static long solution(long[] a, long h, long lo,long hi)\n {\n long med = hi - (hi - lo) / 2;\n while(lo<=hi)\n {\n med = hi - (hi - lo) / 2;\n long ans = solve(a, med);\n Console.WriteLine($\"ans = {ans} lo = {lo} med = {med}\");\n if (ans <= h) hi = med - 1;\n else if (ans > h) lo = med + 1;\n }\n\n return lo;\n }\n\n private static long solve(long [] a,long k)\n {\n long sum = 0;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i]<=k)\n {\n sum++;\n }\n else\n {\n sum += (a[i] / k) + 1;\n }\n }\n\n return sum;\n }\n\n public static bool LemonadeChange(int[] bills)\n {\n if (bills[0] > 5) return false;\n\n Dictionary dict = new Dictionary();\n\n int currentAmount = 5;\n\n dict[5] = 1;\n\n for (int i = 1; i < bills.Length; i++)\n {\n if (bills[i] > 5)\n {\n int charge = bills[i] - 5;\n if (currentAmount < charge) return false;\n\n currentAmount+=5;\n }\n else\n {\n currentAmount += bills[i];\n dict[5]++;\n }\n }\n\n return false;\n }\n\n \n\n private static int solve(int n,int x,int y,int d)\n {\n if ((y-x) % d == 0) {\n return (y - x) / d;\n }\n\n if((x-y)%d==0)\n {\n return (x - y) / d;\n }\n\n if((y-1)%d==0)\n {\n int firstStep = 0;\n\n if ((x-1)%d==0)\n {\n firstStep = (x - 1) / d;\n }\n else\n {\n firstStep = (x - 1) / d + 1;\n }\n\n int secodnStep = (y - 1) / d; \n\n return firstStep + secodnStep;\n \n }\n\n return -1;\n }\n public static int max(int [] a, int i)\n {\n if (i == a.Length - 1) return a[a.Length - 1];\n else return Math.Max(a[i], max(a, i + 1));\n }\n\n\n\n public static int MaxArea(int[] a)\n {\n int l = 0;\n int r = a.Length - 1;\n\n int max = int.MinValue;\n \n\n\n while (l < r)\n {\n max = Math.Max(max, Math.Min(a[l], a[r]) * (r - l));\n\n if (a[l] < a[r]) l++;\n else r--;\n }\n\n return max;\n }\n\n\n private static bool isPrime(int n)\n {\n if (n < 2) return false;\n\n for(int i=2;i*i<=n;i++)\n {\n if (n % i == 0) return false;\n }\n\n return true;\n }\n\n private static void Swap(ref char a, ref char b)\n {\n char temp = a;\n a = b;\n b = temp;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n for (int i = x; i > 0; i--)\n {\n if (x == 1)\n {\n Console.WriteLine(1);\n break;\n }\n if (x % i != 0)\n {\n Console.WriteLine(x - i);\n break;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n for (int i = x; i > 0; i--)\n {\n if (x == 1)\n {\n Console.WriteLine(1);\n break;\n }\n if (x % i != 0)\n {\n Console.WriteLine(x - i);\n break;\n }\n if (x==2)\n Console.WriteLine(1);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n for (int i = x-1; i >= 0; i--)\n {\n if (x == 1)\n {\n Console.WriteLine(1);\n break;\n }\n if(x==2)\n {\n Console.WriteLine(1);\n break;\n }\n if (x % i != 0)\n {\n Console.WriteLine(x - i);\n break;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n for (int i = x-1; i > 0; i--)\n {\n if (x == 1)\n {\n Console.WriteLine(1);\n break;\n }\n if (x % i != 0)\n {\n Console.WriteLine(x - i);\n break;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n Console.WriteLine( 1 );\n\n //--------------------------------solve--------------------------------/\n\n\n }\n\n\n\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Console.WriteLine(Math.Sign(int.Parse(Console.ReadLine())));\n }\n}"}], "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d"} {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int[] data = new int[input.Length];\n for (int i = 0; i < input.Length; ++i)\n data[i] = int.Parse(input[i]);\n input = null;\n data[0] /= 2;\n string answer = \"YES\";\n if ((data[1] == data[0] || data[1] == data[0] + 1) && (data[2] == data[0] || data[2] == data[0] + 1))\n answer = \"NO\";\n Console.WriteLine(answer);\n }\n }", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, x, y;\n string s = Console.ReadLine();\n char[] par = { ' ' };\n string[] ss = s.Split(par);\n n = Convert.ToInt32(ss[0]);\n x = Convert.ToInt32(ss[1]);\n y = Convert.ToInt32(ss[2]);\n if (((x == n / 2) | (x == n / 2 + 1)) & ((y == n / 2) | (y == n / 2 + 1))) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic partial class codeforces85B\n{\n public static void B()\n {\n string[] given = Console.ReadLine().Split(' ');\n int n = int.Parse(given[0]);\n int x = int.Parse(given[1]) - 1;\n int y = int.Parse(given[2]) - 1;\n n/=2;\n if ((x == n || x == n - 1) && (y == n || y == n - 1)) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n\n public static void Main()\n { B(); }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0])/2, x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n \n\n\n O.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar vals = s.Split(' ').Select(_ => int.Parse(_)).ToArray();\n\t\t\tvar nx2 = vals[0];\n\t\t\tvar x = vals[1];\n\t\t\tvar y = vals[2];\n\n\t\t\tvar nx = nx2/2;\n\t\t\tif ((x == nx && y == nx) ||\n\t\t\t\t(x == nx && y == nx + 1) ||\n\t\t\t\t(x == nx + 1 && y == nx) ||\n\t\t\t\t(x == nx + 1 && y == nx + 1)) {\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(sss=>int.Parse(sss)).ToArray();\n var n = input[0]/2;\n var x = input[1];\n var y = input[2];\n if(x>n-1 && x<=n+1 && y>n-1 && y<=n+1)\n {\n Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(sss=>int.Parse(sss)).ToArray();\n var n = input[0]/2;\n var x = input[1];\n var y = input[2];\n if(x>n-1 && x<=n+1 && y>n-1 && y<=n+1)\n {\n Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _85D2B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int x = int.Parse(t[1]);\n int y = int.Parse(t[2]);\n if ((x == n / 2) && (y == n / 2))\n {\n Console.WriteLine(\"NO\");\n }\n else if ((x == n / 2 + 1) && (y == n / 2))\n {\n Console.WriteLine(\"NO\");\n }\n else if ((x == n / 2 + 1) && (y == n / 2 + 1))\n {\n Console.WriteLine(\"NO\");\n }\n else if ((x == n / 2) && (y == n / 2 + 1))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_85_D2_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = int.Parse(s.Split(' ')[0]) / 2;\n int x = int.Parse(s.Split(' ')[1]);\n int y = int.Parse(s.Split(' ')[2]);\n int n2 = n + 1;\n if (x == n && y == n ||\n x == n2 && y == n ||\n x == n && y == n2 ||\n x == n2 && y == n2\n )\n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P { \n static void Main() {\n var s= Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0];\n Func ok = x => x < n/2 || x > n/2+1;\n Console.Write(ok(s[1]) || ok(s[2]) ? \"YES\" : \"NO\"); \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Petya_and_Square\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int x = Next();\n int y = Next();\n\n int x1 = n - x + 1;\n int y1 = n - y + 1;\n\n int dist = Math.Max(Math.Abs(x - x1), Math.Abs(y - y1));\n\n writer.WriteLine(dist > 2 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Square\n{\nclass Program\n{\nstatic void Main(string[] args){\nint n, x, y;\nstring str = Console.ReadLine();\nvar coll = str.Split(' ');\nn = Convert.ToInt32(coll[0]);\nx = Convert.ToInt32(coll[1]);\ny = Convert.ToInt32(coll[2]);\nConsole.WriteLine(((x == n / 2 || x == n / 2 + 1) && (y == n / 2 || y == n / 2 + 1) ? \"NO\" : \"YES\")); \n}\n}\n}"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\n namespace Square\n {\n class Program\n {\n static void Main(string[] args)\n {\n int n, x, y;\n string str = Console.ReadLine();\n var coll = str.Split(' ');\n n = Convert.ToInt32(coll[0]);\n x = Convert.ToInt32(coll[1]);\n y = Convert.ToInt32(coll[2]);\n Console.WriteLine(((x == n / 2 || x == n / 2 + 1) && (y == n / 2 || y == n / 2 + 1) ? \"NO\" : \"YES\")); \n }\n }\n }"}, {"source_code": "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0449\u0438\u043c\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \n// \u043d\u0430\u0431\u043e\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0418\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f,\n// \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u0431\u043e\u0440\u043a\u043e\u0439.\n\n// \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ComVisible \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c FALSE \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u0432 \u0441\u0431\u043e\u0440\u043a\u0435 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \n// \u0434\u043b\u044f COM-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0442\u0438\u043f\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \n// COM, \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 ComVisible \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 TRUE \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430.\n\n// \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 GUID \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0442\u0438\u043f\u043e\u0432, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0438\u043c\u044b\u043c \u0434\u043b\u044f COM\n\n// \u0421\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:\n//\n// \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438\n// \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 \n// \u041d\u043e\u043c\u0435\u0440 \u0441\u0431\u043e\u0440\u043a\u0438\n// \u0420\u0435\u0434\u0430\u043a\u0446\u0438\u044f\n//\n// \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \n// \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \"*\", \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:\n// [assembly: AssemblyVersion(\"1.0.*\")]\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace OJ\n{\n public partial class Program\n {\n\n public static List> genBitmasks(int n)\n {\n List> res = new List>();\n int maxPow = (1 << n);\n for (int i = 0; i < maxPow; i++)\n {\n List l = new List();\n for (int j = 0; j < n; j++)\n {\n l.Add((i >> j) % 2);\n }\n res.Add(l);\n }\n return res;\n }\n\n\n public static int gray_code(int n)\n {\n return n ^ (n >> 1);\n }\n\n public static int count_bits(int n)\n {\n int res = 0;\n for (; n > 0; n >>= 1)\n res += n & 1;\n return res;\n }\n\n public static List> genCombinations(int n, int k)\n {\n List> res = new List>();\n for (int i = 0; i < (1 << n); ++i)\n {\n int cur = i;\n if (count_bits(cur) == k)\n {\n List l = new List();\n for (int j = 0; j < n; ++j)\n {\n if ((cur >> j) % 2 == 1)\n {\n l.Add(j + 1);\n }\n }\n res.Add(l);\n }\n }\n return res;\n }\n\n\n static double polygoneSquare(List> fig)\n {\n double res = 0;\n for (int i = 0; i < fig.Count; i++)\n {\n Tuple p1 = i > 0 ? fig[i - 1] : fig[fig.Count - 1];\n Tuple p2 = fig[i];\n double add = (p1.Item1 - p2.Item1) * (p1.Item2 + p2.Item2);\n res += add;\n }\n return Math.Abs(res) / 2.0;\n }\n\n public static int fact(int n)\n {\n return n == 1 ? 1 : n * fact(n - 1);\n }\n\n public static List> genPermutations(int n)\n {\n List> res = new List>();\n List current = new List();\n for (int i = 0; i < n; i++)\n {\n current.Add(i + 1);\n }\n\n int numberOfPerms = fact(n);\n\n {\n List newList = new List();\n newList.AddRange(current);\n res.Add(newList);\n }\n\n for (int i = 0; i < numberOfPerms - 1; i++)\n {\n int j = n - 2;\n while (j != -1 && current[j] > current[j + 1]) j--;\n int k = n - 1;\n while (current[j] > current[k]) k--;\n {\n int temp = current[j];\n current[j] = current[k];\n current[k] = temp;\n }\n\n int l = j + 1, r = n - 1;\n while (l < r)\n {\n int temp = current[l];\n current[l] = current[r];\n current[r] = temp;\n l++;\n r--;\n }\n\n List newList = new List();\n newList.AddRange(current);\n res.Add(newList);\n }\n\n return res;\n }\n }\n}\n\nnamespace OJ\n{\n public partial class Program\n {\n public static int SolveDPInt(DP dp, params int[] args) {\n\n return 0;\n }\n\n public class DP\n {\n public class MultyArray\n {\n int n;\n int[] lens;\n E[] array;\n int[] ks;\n\n public MultyArray(params int[] lens)\n {\n n = lens.Length;\n\n this.lens = new int[n];\n for (int i = 0; i < n; i++)\n {\n this.lens[i] = lens[i] + 1;\n }\n\n ks = new int[n + 1];\n int prod = 1;\n for (int i = 0; i < n; i++)\n {\n ks[i] = prod;\n prod *= this.lens[i];\n }\n ks[n] = prod;\n\n array = new E[prod];\n }\n\n public int index(params int[] args)\n {\n int q = args.Length;\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += args[i] * ks[i];\n }\n\n return res;\n }\n\n\n public E get(params int[] args)\n {\n return array[index(args)];\n }\n\n public void set(E value, params int[] args)\n {\n array[index(args)] = value;\n }\n\n\n public int _index(params int[] args)\n {\n int q = args.Length;\n\n\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += (args[i] + (lens[i] >> 1)) * ks[i];\n }\n\n\n /*\n if (q == 2)\n {\n return (args[0] + (lens[0] << 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1];\n }\n\n if(q == 1){\n return (args[0] + (lens[0] >> 1)) * ks[0];\n }\n\n if (q == 3)\n {\n return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2];\n }\n\n if (q == 4)\n {\n return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2] + (args[3] + (lens[3] >> 1)) * ks[3];\n }\n * */\n\n return res;\n }\n\n\n public E _get(params int[] args)\n {\n return array[_index(args)];\n }\n\n\n public void _set(E value, params int[] args)\n {\n array[_index(args)] = value;\n }\n\n public override string ToString()\n {\n StringBuilder res = new StringBuilder();\n return res.ToString();\n }\n }\n\n public delegate T Solve(DP dp, params int[] args);\n\n public MultyArray array;\n public MultyArray exist;\n public int[] lens;\n public int[] ks;\n\n private Solve solve;\n\n public DP(Solve solve, params int[] lens)\n {\n this.lens = lens;\n\n ks = new int[lens.Length + 1];\n int prod = 1;\n for (int i = 0; i < lens.Length; i++)\n {\n ks[i] = prod;\n prod *= this.lens[i] + 1;\n }\n ks[lens.Length] = prod;\n\n\n\n int[] newLens = new int[lens.Length];\n for (int i = 0; i < newLens.Length; i++)\n {\n newLens[i] = lens[i] * 2;\n }\n\n this.array = new MultyArray(newLens);\n this.exist = new MultyArray(newLens);\n\n this.solve = solve;\n }\n\n public T dp(params int[] args)\n {\n if (exist._get(args))\n {\n return array._get(args);\n }\n T value = solve(this, args);\n array._set(value, args);\n exist._set(true, args);\n return value;\n }\n\n public int[] indexToArgs(int index)\n {\n int[] res = new int[lens.Length];\n for (int i = 0; i < lens.Length; i++)\n {\n res[i] = (index / ks[i]) % (lens[i] + 1);\n }\n return res;\n }\n\n public int index(params int[] args)\n {\n int q = args.Length;\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += args[i] * ks[i];\n }\n\n return res;\n }\n\n public T run(params int[] args)\n {\n int maxIndex = index(args);\n\n for (int i = 0; i <= maxIndex; i++)\n {\n int[] a = indexToArgs(i);\n dp(a);\n }\n\n return dp(args);\n }\n }\n }\n}\n\nnamespace OJ\n{\n public partial class Program\n {\n public static void print(List obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n public static void print(ValueType obj)\n {\n Console.Write(obj + \" \");\n }\n\n public static void print(string obj)\n {\n Console.Write(obj + \" \");\n }\n\n public static void print(Type obj)\n {\n Console.Write(obj + \" \");\n }\n\n\n public static void print(Array obj)\n {\n Console.Write(\"[\");\n for (int i = 0; i < obj.Length; i++)\n {\n print(obj.GetValue(i));\n }\n Console.Write(\"]\");\n }\n\n public static void print(List obj)\n {\n Console.WriteLine(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n Console.WriteLine();\n }\n Console.Write(\"}\");\n }\n\n public static void print(List obj)\n {\n Console.WriteLine(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n Console.WriteLine();\n }\n Console.Write(\"}\");\n }\n\n public static void print(List> obj)\n {\n Console.WriteLine(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n Console.WriteLine();\n }\n Console.Write(\"}\");\n }\n\n\n public static void print(object obj)\n {\n Console.Write(obj);\n Console.Write(\" \");\n }\n\n\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(ValueType obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(string obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(Type obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(Array obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(List> obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(object obj)\n {\n Console.Write(obj);\n Console.Write(\" \");\n }\n\n\n\n public class Scanner\n {\n List array = new List();\n int pos = 0;\n public Scanner()\n {\n while (true)\n {\n string next = Console.ReadLine();\n if (next != null && next.Length > 0)\n {\n array.AddRange(next.Split(' '));\n }\n else\n {\n break;\n }\n }\n }\n\n public int nextInt()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n int res = Int32.Parse(array[pos]);\n pos++;\n return res;\n }\n\n public string nextString()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n string res = array[pos];\n pos++;\n return res;\n }\n\n public char nextChar()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n char res = array[pos][0];\n pos++;\n return res;\n }\n\n public double nextDouble()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n double res = Double.Parse(array[pos]);\n pos++;\n return res;\n }\n\n public List nextArray(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextInt());\n }\n return res;\n }\n\n public List nextArrayDouble(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextDouble());\n }\n return res;\n }\n\n public List nextArrayString(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextString());\n }\n return res;\n }\n }\n }\n}\n\nnamespace OJ\n{\n public partial class Program\n {\n public static int gcd(int a, int b)\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n\n\n public static bool[] sieve(int bound)\n {\n bool[] array = new bool[bound + 1];\n for (int i = 2; i * i <= bound; i++)\n {\n if (!array[i])\n {\n for (int j = i + i; j <= bound; j += i)\n {\n array[j] = true;\n }\n }\n }\n return array;\n }\n\n public static List sieveList(int bound)\n {\n bool[] array = new bool[bound + 1];\n for (int i = 2; i * i <= bound; i++)\n {\n if (!array[i])\n {\n for (int j = i + i; j <= bound; j += i)\n {\n array[j] = true;\n }\n }\n }\n\n List a = new List();\n for (int i = 2; i < bound + 1; i++)\n {\n if (!array[i])\n {\n a.Add(i);\n }\n }\n\n return a;\n }\n\n\n\n public static List factorize(int n, List primeList)\n {\n List res = new List();\n for (int j = 0; j < primeList.Count; j++)\n {\n int i = primeList[j];\n if (n % i == 0)\n {\n int[] comp = new int[] { i, 1 };\n n /= i;\n while (n % i == 0)\n {\n comp[1] = comp[1] + 1;\n n /= i;\n }\n res.Add(comp);\n }\n }\n\n if (n > 1)\n {\n res.Add(new int[] { n, 1 });\n }\n return res;\n }\n\n\n public static List factorize(int n)\n {\n List res = new List();\n int sqrt = (int)Math.Sqrt(n)+1;\n for (int j = 2; j < sqrt; j++)\n {\n if (n % j == 0)\n {\n int[] comp = new int[] { j, 1 };\n n /= j;\n while (n % j == 0)\n {\n comp[1] = comp[1] + 1;\n n /= j;\n }\n res.Add(comp);\n }\n }\n\n if (n > 1)\n {\n res.Add(new int[] { n, 1 });\n }\n return res;\n }\n\n public static List genDivisors(int n)\n {\n List res = new List();\n int root = (int)(Math.Sqrt(n) + 1);\n for (int i = 1; i < root; i++)\n {\n if (n % i == 0)\n {\n if (n / i != i)\n {\n res.Add(i);\n res.Add(n / i);\n }\n else\n {\n res.Add(i);\n }\n }\n }\n return res;\n }\n\n }\n}\n\nnamespace OJ\n{\n public partial class Program\n {\n public static Scanner s = new Scanner();\n\n\n static void Main(string[] args)\n {\n int n, x, y;\n n = s.nextInt();\n x = s.nextInt();\n y = s.nextInt();\n\n bool b = true;\n\n if(x == n/2 && y == n/2){\n b = false;\n }\n\n if (x == n / 2 + 1 && y == n / 2)\n {\n b = false;\n }\n\n if (x == n / 2 && y == n / 2 + 1)\n {\n b = false;\n }\n\n if (x == n / 2 + 1 && y == n / 2 + 1)\n {\n b = false;\n }\n\n if(b){\n print(\"YES\");\n }\n else\n {\n print(\"NO\");\n }\n }\n }\n}\n\nnamespace OJ\n{\n public partial class Program\n {\n public static T min(T first, params T[] array) where T : IComparable\n {\n T res = first;\n for (int i = 0; i < array.Length; i++)\n {\n if (array[i].CompareTo(res) < 0)\n {\n res = array[i];\n }\n }\n return res;\n }\n\n public static T max(T first, params T[] array) where T : IComparable\n {\n T res = first;\n for (int i = 0; i < array.Length; i++)\n {\n if (array[i].CompareTo(res) > 0)\n {\n res = array[i];\n }\n }\n return res;\n }\n\n\n public static int pow(int n, int k)\n {\n if (k == 0)\n {\n return 1;\n }\n else\n {\n if (k % 2 == 1)\n {\n return pow(n, k - 1) * n;\n }\n else\n {\n int q = pow(n, k / 2);\n return q * q;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n string [] str = Console.ReadLine().Split();\n int dn = int.Parse(str[0]);\n int n = dn/2;\n int x = int.Parse(str[1]);\n int y = int.Parse(str[2]);\n if( (x == n || x == n+1) && (y == n || y == n+1) ){\n Console.WriteLine(\"NO\");\n }else{\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass PetyaAndSquare\n{\n static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int N, x, y;\n N = Convert.ToInt32(citire[0]);\n x = Convert.ToInt32(citire[1]);\n y = Convert.ToInt32(citire[2]);\n\n //solve\n if (x == N/2 && y == N/2 || x == N/2+1 && y == N/2 ||\n x == N/2 && y == N/2+1 || x == N/2+1 && y == N/2+1) Console.Write(\"NO\");\n else Console.WriteLine(\"YES\");\n\n return 0;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n\n static void Main()\n {\n var input = Console.ReadLine().Split(' ');\n int n = Int32.Parse(input[0]) / 2;\n int x = Int32.Parse(input[1]);\n int y = Int32.Parse(input[2]);\n var res = \"YES\";\n if ((x == n || x == n + 1) && (y == n || y == n + 1))\n res = \"NO\";\n Console.WriteLine(res); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int x = int.Parse(s[1]);\n int y = int.Parse(s[2]);\n\n if (((n/2 == x) | (n/2 == x-1)) & \n ((n/2 == y) | (n/2 == y-1)))\n Console.WriteLine(\"NO\"); else\n Console.WriteLine(\"YES\");\n\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n\tpublic void Solve()\n\t{\n var ss = CF.ReadLine().Split(' ');\n int n2 = int.Parse(ss[0]);\n int x = int.Parse(ss[1]);\n int y = int.Parse(ss[2]);\n\n int n = n2 / 2;\n\n if( (x==n||x==n+1)&&(y==n||y==n+1))\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n \n }\n\n\t// test\n\tstatic Utils CF = new Utils(new[]{\n@\"\n4 1 1\n\",\n @\"\n2 2 2\n\"\n });\n\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "using System;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Reflection;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n readonly static IEnumerator Tokens;\n static Scanner()\n {\n Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n\n public static string NextToken()\n {\n Tokens.MoveNext();\n return Tokens.Current;\n }\n }\n\n static int NextInt()\n {\n return int.Parse(Scanner.NextToken());\n }\n\n static long NextLong()\n {\n return long.Parse(Scanner.NextToken());\n }\n\n void Solve()\n {\n int n = NextInt(), x = NextInt(), y = NextInt();\n int dx = x - n/2, dy = y - n/2;\n Console.Write(!(dx > 1 || dx < 0 || dy > 1 || dy < 0) ? \"NO\" : \"YES\");\n }\n\n\n static void Main()\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces_85\n{\n class prob_b\n {\n \n static void Main()\n {\n string[] tmp = Console.ReadLine().Split(\" \".ToCharArray());\n int n = Int32.Parse(tmp[0]);\n int x = Int32.Parse(tmp[1]);\n int y = Int32.Parse(tmp[2]);\n\n if (x >= n / 2 && x <= n / 2 + 1 && y >= n / 2 && y <= n / 2 + 1)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n \n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] kk=Console.ReadLine().Split();\n\t\tint side=Int32.Parse(kk[0]);\n\t\tint x=Int32.Parse(kk[1]);\n\t\tint y=Int32.Parse(kk[2]);\n\t\tif(side>2)\n\t\t{\n\t\t\tif(y==side/2 && x==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse if(y-1==side/2 && x-1==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse if(y-1==side/2 && x==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse if(y==side/2 && x-1==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\t\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\n\t\t\t\t\n\t}\n}\n\n"}, {"source_code": "using System;\n\nnamespace _112B_PetyaAndSquares\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int x = int.Parse(input[1]);\n int y = int.Parse(input[2]);\n\n Console.WriteLine( (x == n/2 || x == n/2+1) && (y == n/2 || y == n/2+1) ? \"NO\" : \"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n TextReader inputStream;\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n if (o is bool)\n if (object.Equals(o, true)) outputStream.Write(\"YES\"); else outputStream.Write(\"NO\");\n else\n outputStream.Write(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n#if LOCAL_TEST\n using (MyIo io = new MyIo(new StreamReader(\"input.txt\")))\n#else\n using (MyIo io = new MyIo(System.Console.In))\n#endif\n\n {\n new Program(io)\n .Solve();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n\n #endregion\n\n\n\n void Solve()\n {\n object res = ReSolve();\n\n if (res != null)\n io.Print(res);\n }\n\n private object ReSolve()\n {\n int n = io.NextInt() >> 1;\n int x = io.NextInt();\n int y = io.NextInt();\n\n\n return !((x == n || x == n + 1) && (y == n || y == n + 1));\n }\n\n\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n TextReader inputStream;\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n if (o is bool)\n if (object.Equals(o, true)) outputStream.Write(\"YES\"); else outputStream.Write(\"NO\");\n else\n outputStream.Write(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n#if LOCAL_TEST\n using (MyIo io = new MyIo(new StreamReader(\"input.txt\")))\n#else\n using (MyIo io = new MyIo(System.Console.In))\n#endif\n\n {\n new Program(io)\n .Solve();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n\n #endregion\n\n\n\n void Solve()\n {\n object res = ReSolve();\n\n if (res != null)\n io.Print(res);\n }\n\n private object ReSolve()\n {\n int n = io.NextInt() >> 1;\n int x = io.NextInt();\n int y = io.NextInt();\n\n\n return ((x == n || x == n + 1) && (y == n || y == n + 1));\n }\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"YES\"; }\n O.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0])*2, x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n O.WriteLine((x >= n / 2 && x <= n / 2 + 1 && y >= n / 2 && y <= n / 2 + 1) ? \"NO\" : \"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"NO\"; }\n O.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"NO\"; }\n O.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace Tomasz.CodeForces.Algo\n{\n class Program\n {\n static int c = 0;\n\n static TextReader I = Console.In;\n static TextWriter O = Console.Out;\n\n static void Main()\n {\n c++;\n string[] a = I.ReadLine().Split();\n int n = int.Parse(a[0]), x = int.Parse(a[1]), y = int.Parse(a[2]);\n\n \n string res = (x >= n && x <= n + 1 && y >= n && y <= n + 1) ? \"NO\" : \"YES\";\n if (c == 5) { res = \"NO\"; }\n O.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar vals = s.Split(' ').Select(_ => int.Parse(_)).ToArray();\n\t\t\tvar nx2 = vals[0];\n\t\t\tvar x = vals[1];\n\t\t\tvar y = vals[2];\n\n\t\t\tvar nx = nx2/2;\n\t\t\tif (x != nx && x != nx + 1 && y != nx && y != nx + 1) {\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] kk=Console.ReadLine().Split();\n\t\tint side=Int32.Parse(kk[0]);\n\t\t\n\t\tint y=Int32.Parse(kk[2]);\n\t\tif(side>2)\n\t\t{\n\t\t\tif(y==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse if(y-1==side/2)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\t\n\t\telse\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\n\t\t\t\t\n\t}\n}\n\n"}], "src_uid": "dc891d57bcdad3108dcb4ccf9c798789"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound608Div2.Questions;\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public class QuestionE : AtCoderQuestionBase\n {\n public override void Solve(IOManager io)\n {\n var n = io.ReadLong();\n var k = io.ReadLong();\n\n var result = 0L;\n\n // \u5076\u6570\n result.ChangeMax(BoundaryBinarySearch(i =>\n {\n var x = i * 2;\n var left = x;\n var right = x + 1;\n\n long paths = right <= n ? 2 : 1;\n\n while (true)\n {\n left <<= 1;\n right <<= 1;\n right++;\n\n if (left > n)\n {\n break;\n }\n else if (right > n)\n {\n paths += n - left + 1;\n break;\n }\n else\n {\n paths += right - left + 1;\n }\n }\n\n return paths >= k;\n }, 0, n / 2 + 1) * 2);\n\n // \u5947\u6570\n result.ChangeMax(BoundaryBinarySearch(i =>\n {\n var x = i * 2 + 1;\n var left = x;\n var right = x;\n\n long paths = 1;\n\n while (true)\n {\n left <<= 1;\n right <<= 1;\n right++;\n\n if (left > n)\n {\n break;\n }\n else if (right > n)\n {\n paths += n - left + 1;\n break;\n }\n else\n {\n paths += right - left + 1;\n }\n }\n\n return paths >= k;\n }, 0, (n - 1) / 2 + 1) * 2 + 1);\n\n io.WriteLine(result);\n }\n\n public static long BoundaryBinarySearch(Predicate predicate, long ok, long ng)\n {\n // \u3081\u3050\u308b\u5f0f\u4e8c\u5206\u63a2\u7d22\n while (Math.Abs(ok - ng) > 1)\n {\n long mid = (ok + ng) / 2;\n if (predicate(mid))\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n return ok;\n }\n }\n}\n\nnamespace CodeforcesRound608Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionE();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public interface IAtCoderQuestion\n {\n string Solve(string input);\n void Solve(IOManager io);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public string Solve(string input)\n {\n var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));\n var outputStream = new MemoryStream();\n using var manager = new IOManager(inputStream, outputStream);\n\n Solve(manager);\n manager.Flush();\n\n outputStream.Seek(0, SeekOrigin.Begin);\n var reader = new StreamReader(outputStream);\n return reader.ReadToEnd();\n }\n\n public abstract void Solve(IOManager io);\n }\n}\n\n#endregion\n\n#region Utils\n\nnamespace CodeforcesRound608Div2\n{\n public class IOManager : IDisposable\n {\n private readonly BinaryReader _reader;\n private readonly StreamWriter _writer;\n private bool _disposedValue;\n private byte[] _buffer = new byte[1024];\n private int _length;\n private int _cursor;\n private bool _eof;\n\n const char ValidFirstChar = '!';\n const char ValidLastChar = '~';\n\n public IOManager(Stream input, Stream output)\n {\n _reader = new BinaryReader(input);\n _writer = new StreamWriter(output) { AutoFlush = false };\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private char ReadAscii()\n {\n if (_cursor == _length)\n {\n _cursor = 0;\n _length = _reader.Read(_buffer);\n\n if (_length == 0)\n {\n if (!_eof)\n {\n _eof = true;\n return char.MinValue;\n }\n else\n {\n ThrowEndOfStreamException();\n }\n }\n }\n\n return (char)_buffer[_cursor++];\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public char ReadChar()\n {\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n return c;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public string ReadString()\n {\n var builder = new StringBuilder();\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n builder.Append(c);\n } while (IsValidChar(c = ReadAscii()));\n\n return builder.ToString();\n }\n\n public int ReadInt() => (int)ReadLong();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long ReadLong()\n {\n long result = 0;\n bool isPositive = true;\n char c;\n\n while (!IsNumericChar(c = ReadAscii())) { }\n\n if (c == '-')\n {\n isPositive = false;\n c = ReadAscii();\n }\n\n do\n {\n result *= 10;\n result += c - '0';\n } while (IsNumericChar(c = ReadAscii()));\n\n return isPositive ? result : -result;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private Span ReadChunk(Span span)\n {\n var i = 0;\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n span[i++] = c;\n } while (IsValidChar(c = ReadAscii()));\n\n return span.Slice(0, i);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadLong();\n }\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDouble();\n }\n return a;\n }\n\n public decimal[] ReadDecimalArray(int n)\n {\n var a = new decimal[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDecimal();\n }\n return a;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void WriteLine(T value) => _writer.WriteLine(value.ToString());\n\n public void WriteLine(IEnumerable values, char separator)\n {\n var e = values.GetEnumerator();\n if (e.MoveNext())\n {\n _writer.Write(e.Current.ToString());\n\n while (e.MoveNext())\n {\n _writer.Write(separator);\n _writer.Write(e.Current.ToString());\n }\n }\n\n _writer.WriteLine();\n }\n\n public void WriteLine(Span values, char separator) => WriteLine((ReadOnlySpan)values, separator);\n\n public void WriteLine(ReadOnlySpan values, char separator)\n {\n for (int i = 0; i < values.Length - 1; i++)\n {\n _writer.Write(values[i]);\n _writer.Write(separator);\n }\n\n if (values.Length > 0)\n {\n _writer.Write(values[^1]);\n }\n\n _writer.WriteLine();\n }\n\n public void Flush() => _writer.Flush();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';\n\n private void ThrowEndOfStreamException() => throw new EndOfStreamException();\n\n protected virtual void Dispose(bool disposing)\n {\n if (!_disposedValue)\n {\n if (disposing)\n {\n _reader.Dispose();\n _writer.Flush();\n _writer.Dispose();\n }\n\n _disposedValue = true;\n }\n }\n\n public void Dispose()\n {\n Dispose(disposing: true);\n GC.SuppressFinalize(this);\n }\n }\n\n public static class UtilExtensions\n {\n public static bool ChangeMax(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n a = b;\n return true;\n }\n return false;\n }\n\n public static bool ChangeMin(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n a = b;\n return true;\n }\n return false;\n }\n\n public static void Sort(this T[] array) where T : IComparable => Array.Sort(array);\n public static void Sort(this T[] array, Comparison comparison) => Array.Sort(array, comparison);\n }\n}\n\n#endregion\n\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing static System.Math;\nusing Number = System.Int32;\nusing System.Numerics;\n\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar n = rl; var k = rl;\n\t\t\tvar max = 1L;\n\t\t\t{\n\t\t\t\tvar l = 0L; var r = n * 2;\n\t\t\t\twhile (r - l > 2) {\n\t\t\t\t\tvar m = (l + r) / 2;\n\t\t\t\t\tif (m % 2 == 1) m--;\n\t\t\t\t\tif (f(m, n) + f(m + 1, n) >= k) l = m;\n\t\t\t\t\telse r = m;\n\t\t\t\t}\n\t\t\t\tmax = l;\n\t\t\t}\n\t\t\tDebug.WriteLine(max);\n\t\t\t{\n\t\t\t\tvar l = 1L; var r = n * 2 + 1;\n\t\t\t\twhile (r - l > 2) {\n\t\t\t\t\tvar m = (l + r) / 2;\n\t\t\t\t\tif (m % 2 == 0) m--;\n\t\t\t\t\tif (f(m, n) >= k) l = m;\n\t\t\t\t\telse r = m;\n\t\t\t\t}\n\t\t\t\tmax = Max(max, l);\n\t\t\t}\n\t\t\tConsole.WriteLine(max);\n\n\t\t}\n\t\tlong f(long n, long max) {\n\t\t\tif (n == 0) return 0;\n\t\t\tvar ini = n;\n\t\t\tvar ret = 0L;\n\t\t\tvar ma = 0L;\n\t\t\tfor (int i = 0; i < 60; i++) {\n\t\t\t\tif (max < n) break;\n\t\t\t\telse if (max >= n + ma) {\n\t\t\t\t\tret += ma + 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tret += max - n + 1;\n\t\t\t\t}\n\t\t\t\tn *= 2;\n\t\t\t\tma = ma * 2 + 1;\n\t\t\t}\n\t\t\tDebug.WriteLine($\"f({ini},{max}) = {ret}\");\n\t\t\treturn ret;\n\t\t}\n\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\tConsole.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });\n\t\tvar solver = new Program.Solver();\n\t\t//* \n\t\tvar t = new System.Threading.Thread(solver.Solve, 50000000);\n\t\tt.Start();\n\t\tt.Join();\n\t\t//*/\n\t\t// solver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n private long N, K;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextLong();\n K = sc.NextLong();\n\n /*\n * f(x) = x/2 if x is even\n * = x-1 otherwise\n *\n *\n * y \u5076\u6570 \u4e0a\u4f4d\u6841 y, y+1\u306b\u4e00\u81f4\n *\n * \u5947\u6570 y\u306b\u4e00\u81f4\n */\n\n // \u6700\u5927\u5019\u88dc\n\n // \u5076\u6570\u306b\u306a\u308b\u307e\u3067 (N/(2^i),(N/2^i)-1)\n\n List x = new List();\n\n long tmpX = N;\n while (tmpX > 0)\n {\n if (tmpX % 2 == 1)\n {\n x.Add(tmpX);\n if (tmpX - 1 > 0)\n x.Add(tmpX - 1);\n tmpX /= 2;\n }\n else\n {\n x.Add(tmpX);\n if (tmpX - 2 > 0)\n x.Add(tmpX - 2);\n tmpX /= 2;\n if (tmpX % 2 == 1 && tmpX > 1) tmpX--;\n }\n }\n\n foreach (long l in x)\n {\n if (Calc(l) >= K)\n {\n Console.WriteLine(l);\n return;\n }\n }\n }\n\n long Calc(long x)\n {\n long ans = 0;\n long tmpX = x;\n long p = 1;\n while (tmpX <= N)\n {\n ans += Math.Min(p, N - tmpX + 1);\n p *= 2;\n tmpX *= 2;\n }\n\n if (x % 2 == 0)\n {\n tmpX = x + 1;\n p = 1;\n while (tmpX <= N)\n {\n ans += Math.Min(p, N - tmpX + 1);\n p *= 2;\n tmpX *= 2;\n }\n }\n\n return ans;\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound608Div2.Questions;\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public class QuestionE : AtCoderQuestionBase\n {\n public override void Solve(IOManager io)\n {\n var n = io.ReadLong();\n var k = io.ReadLong();\n\n var result = 0L;\n\n // \u5076\u6570\n result.ChangeMax(BoundaryBinarySearch(i =>\n {\n var x = i * 2;\n var left = x;\n var right = x + 1;\n\n long paths = right <= n ? 2 : 1;\n\n while (true)\n {\n left <<= 1;\n right <<= 1;\n right++;\n\n if (left > n)\n {\n break;\n }\n else if (right > n)\n {\n paths += n - left + 1;\n break;\n }\n else\n {\n paths += right - left + 1;\n }\n }\n\n return paths >= k;\n }, 0, n / 2) * 2);\n\n // \u5947\u6570\n result.ChangeMax(BoundaryBinarySearch(i =>\n {\n var x = i * 2 + 1;\n var left = x;\n var right = x;\n\n long paths = 1;\n\n while (true)\n {\n left <<= 1;\n right <<= 1;\n right++;\n\n if (left > n)\n {\n break;\n }\n else if (right > n)\n {\n paths += n - left + 1;\n break;\n }\n else\n {\n paths += right - left + 1;\n }\n }\n\n return paths >= k;\n }, 0, (n - 1) / 2) * 2 + 1);\n\n io.WriteLine(result);\n }\n\n public static long BoundaryBinarySearch(Predicate predicate, long ok, long ng)\n {\n // \u3081\u3050\u308b\u5f0f\u4e8c\u5206\u63a2\u7d22\n while (Math.Abs(ok - ng) > 1)\n {\n long mid = (ok + ng) / 2;\n if (predicate(mid))\n {\n ok = mid;\n }\n else\n {\n ng = mid;\n }\n }\n return ok;\n }\n }\n}\n\nnamespace CodeforcesRound608Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionE();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public interface IAtCoderQuestion\n {\n string Solve(string input);\n void Solve(IOManager io);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public string Solve(string input)\n {\n var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));\n var outputStream = new MemoryStream();\n using var manager = new IOManager(inputStream, outputStream);\n\n Solve(manager);\n manager.Flush();\n\n outputStream.Seek(0, SeekOrigin.Begin);\n var reader = new StreamReader(outputStream);\n return reader.ReadToEnd();\n }\n\n public abstract void Solve(IOManager io);\n }\n}\n\n#endregion\n\n#region Utils\n\nnamespace CodeforcesRound608Div2\n{\n public class IOManager : IDisposable\n {\n private readonly BinaryReader _reader;\n private readonly StreamWriter _writer;\n private bool _disposedValue;\n private byte[] _buffer = new byte[1024];\n private int _length;\n private int _cursor;\n private bool _eof;\n\n const char ValidFirstChar = '!';\n const char ValidLastChar = '~';\n\n public IOManager(Stream input, Stream output)\n {\n _reader = new BinaryReader(input);\n _writer = new StreamWriter(output) { AutoFlush = false };\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private char ReadAscii()\n {\n if (_cursor == _length)\n {\n _cursor = 0;\n _length = _reader.Read(_buffer);\n\n if (_length == 0)\n {\n if (!_eof)\n {\n _eof = true;\n return char.MinValue;\n }\n else\n {\n ThrowEndOfStreamException();\n }\n }\n }\n\n return (char)_buffer[_cursor++];\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public char ReadChar()\n {\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n return c;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public string ReadString()\n {\n var builder = new StringBuilder();\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n builder.Append(c);\n } while (IsValidChar(c = ReadAscii()));\n\n return builder.ToString();\n }\n\n public int ReadInt() => (int)ReadLong();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long ReadLong()\n {\n long result = 0;\n bool isPositive = true;\n char c;\n\n while (!IsNumericChar(c = ReadAscii())) { }\n\n if (c == '-')\n {\n isPositive = false;\n c = ReadAscii();\n }\n\n do\n {\n result *= 10;\n result += c - '0';\n } while (IsNumericChar(c = ReadAscii()));\n\n return isPositive ? result : -result;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private Span ReadChunk(Span span)\n {\n var i = 0;\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n span[i++] = c;\n } while (IsValidChar(c = ReadAscii()));\n\n return span.Slice(0, i);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadLong();\n }\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDouble();\n }\n return a;\n }\n\n public decimal[] ReadDecimalArray(int n)\n {\n var a = new decimal[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDecimal();\n }\n return a;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void WriteLine(T value) => _writer.WriteLine(value.ToString());\n\n public void WriteLine(IEnumerable values, char separator)\n {\n var e = values.GetEnumerator();\n if (e.MoveNext())\n {\n _writer.Write(e.Current.ToString());\n\n while (e.MoveNext())\n {\n _writer.Write(separator);\n _writer.Write(e.Current.ToString());\n }\n }\n\n _writer.WriteLine();\n }\n\n public void WriteLine(Span values, char separator) => WriteLine((ReadOnlySpan)values, separator);\n\n public void WriteLine(ReadOnlySpan values, char separator)\n {\n for (int i = 0; i < values.Length - 1; i++)\n {\n _writer.Write(values[i]);\n _writer.Write(separator);\n }\n\n if (values.Length > 0)\n {\n _writer.Write(values[^1]);\n }\n\n _writer.WriteLine();\n }\n\n public void Flush() => _writer.Flush();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';\n\n private void ThrowEndOfStreamException() => throw new EndOfStreamException();\n\n protected virtual void Dispose(bool disposing)\n {\n if (!_disposedValue)\n {\n if (disposing)\n {\n _reader.Dispose();\n _writer.Flush();\n _writer.Dispose();\n }\n\n _disposedValue = true;\n }\n }\n\n public void Dispose()\n {\n Dispose(disposing: true);\n GC.SuppressFinalize(this);\n }\n }\n\n public static class UtilExtensions\n {\n public static bool ChangeMax(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n a = b;\n return true;\n }\n return false;\n }\n\n public static bool ChangeMin(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n a = b;\n return true;\n }\n return false;\n }\n\n public static void Sort(this T[] array) where T : IComparable => Array.Sort(array);\n public static void Sort(this T[] array, Comparison comparison) => Array.Sort(array, comparison);\n }\n}\n\n#endregion\n\n"}], "src_uid": "783c4b3179c558369f94f4a16ac562d4"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class _1108B\n {\n public static void Delete(int[] a, int v)\n {\n for(int i = 0; i < a.Length; i++)\n {\n if(a[i] == v)\n {\n a[i] = 0;\n break;\n }\n }\n }\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n int max = 0;\n string[] ss = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n int m = int.Parse(ss[i]);\n a[i] = m;\n if (a[i] > max)\n {\n max = a[i];\n }\n }\n Console.Write(max);\n Console.Write(\" \");\n for (int i = 1; i <= max; i++)\n {\n if (max % i == 0)\n {\n Delete(a, i); \n }\n }\n max = 0;\n for(int i = 0; i < n; i++)\n {\n if (a[i] > max)\n max = a[i];\n }\n Console.WriteLine(max);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace AtTest.CodeForces._535\n{\n class B\n {\n static void Main(string[] args)\n {\n Method(args);\n Console.ReadLine();\n }\n\n static void Method(string[] args)\n {\n int n = ReadInt();\n var list = new List();\n list.AddRange(ReadInts());\n list.Sort();\n list.Reverse();\n int max = list[0];\n list.RemoveAt(0);\n int now = max;\n for (int i = 0; i < list.Count; i++)\n {\n if (now != list[i]\n && max % list[i] == 0)\n {\n now = list[i];\n list.RemoveAt(i);\n i--;\n }\n }\n Console.WriteLine(max + \" \" + list[0]);\n }\n\n private static string Read() { return Console.ReadLine(); }\n private static int ReadInt() { return int.Parse(Read()); }\n private static long ReadLong() { return long.Parse(Read()); }\n private static double ReadDouble() { return double.Parse(Read(), System.Globalization.CultureInfo.InvariantCulture); }\n private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }\n private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }\n private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), i => Convert.ToDouble(i, System.Globalization.CultureInfo.InvariantCulture)); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Policy;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var l = Console.ReadLine().Split().Select(int.Parse).ToList();\n var t = l.ToList();\n l = l.Distinct().ToList();\n var r1 = l.Max();\n var r2 = 0;\n for (int i = 0; i < l.Count(); i++)\n {\n if (r1 % l[i] == 0)\n {\n t.Remove(l[i]);\n }\n }\n r2 = t.Max();\n Console.WriteLine(r1 + \" \" + r2);\n }\n\n static void Main(string[] args)\n {\n#if DEBUG\n var fin = new StreamReader(new FileStream(\"input.txt\", FileMode.Open));\n var fout = new StreamWriter(new FileStream(\"output.txt\", FileMode.Create));\n Console.SetIn(fin);\n Console.SetOut(fout);\n#endif\n Solve();\n#if DEBUG\n fin.Close();\n fout.Close();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var l = Console.ReadLine().Split().Select(int.Parse).ToList();\n var t = l.ToList();\n l = l.Distinct().ToList();\n var r1 = l.Max();\n var r2 = 0;\n for (int i = 0; i < l.Count(); i++)\n {\n if (r1 % l[i] == 0)\n {\n t.Remove(l[i]);\n }\n }\n r2 = t.Max();\n Console.WriteLine(r1 + \" \" + r2);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _1108B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n var d = new SortedDictionary(Console.ReadLine().Split().Select(token => int.Parse(token)).GroupBy(i => i).ToDictionary(g => g.Key, g => g.Count()));\n\n int x = d.Last().Key;\n for (int i = 1; i <= x; i++)\n {\n if (x % i == 0)\n {\n d[i]--;\n }\n }\n\n int y = d.Last(kvp => kvp.Value > 0).Key;\n\n Console.WriteLine($\"{x} {y}\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int[] a = sc.IntArray();\n\n /*\n * x,y\n * \n * x\u306e\u7d04\u6570\u306e\u30ea\u30b9\u30c8\u3001\n * y\u306e\u7d04\u6570\u306e\u30ea\u30b9\u30c8\n */\n var ls = a.ToList();\n var max = a.Max();\n for (int i = 1; i * i <= max; i++)\n {\n if (max % i == 0)\n {\n ls.Remove(i);\n int j = max / i;\n if (i != j) ls.Remove(j);\n }\n }\n\n Console.WriteLine($\"{max} {ls.Max()}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int[] d = sc.IntArray();\n\n // x,y\u3092\u53d7\u3051\u53d6\u3063\u305f\n // x\u306e\u7d04\u6570\u3001y\u306e\u7d04\u6570\u5217\u6319\u3001\u30b7\u30e3\u30c3\u30d5\u30eb\u3000...d\n\n // x,y\u3044\u304f\u3064\u304b?\n Array.Sort(d);\n int x = d[n - 1];\n var divX = new HashSet();\n for (int i = 1; i * i <= x; i++)\n {\n if (x % i == 0)\n {\n if (x / i != i) divX.Add(x / i);\n divX.Add(i);\n }\n }\n var divY = new HashSet();\n foreach (int i in d)\n {\n if (divX.Contains(i))\n {\n divX.Remove(i);\n }\n else\n {\n divY.Add(i);\n }\n }\n\n Console.WriteLine($\"{x} {divY.Max()}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n while (_index >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n _line = Console.ReadLine().Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class GFG\n{\n static public void Main()\n {\n try\n {\n // int test = Convert.ToInt32(Console.ReadLine());\n // for (int i = 0; i < test; i++)\n\n {\n // var input = Console.ReadLine().Split(' ');\n var n = Int32.Parse(Console.ReadLine());\n //var a = int.Parse(input[0]);\n //var b = int.Parse(input[1]);\n //var c = int.Parse(input[2]);\n //var d = int.Parse(input[3]);\n // var str = Console.ReadLine();\n\n //var arr1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var arr2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n List lst = new List();\n string[] input = Console.ReadLine().Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n lst.Add(Int32.Parse(input[i]));\n }\n\n DistictPoint(lst);\n Console.WriteLine();\n }\n }\n catch (Exception ex)\n {\n Console.Write(ex);\n }\n }\n static void DistictPoint(List div)\n {\n\n int max = div.Max();\n\n for (int i = 1; i <= max; i++)\n {\n if (max % i == 0)\n div.Remove(i);\n }\n\n Console.Write(max + \" \" + div.Max());\n\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//int n = ConsoleLine.Read();\n\t\t\t//string str = ConsoleLine.Read();\n\n\t\t\t//char[] pattern = new[] {'R', 'G', 'B'};\n\n\t\t\t//int[] r = new int[3];\n\t\t\t//for (int i = 0; i < str.Length; i++)\n\t\t\t//{\n\t\t\t//\tif (str[i] != pattern[i % 3]) r[0]++;\n\t\t\t//\tif (str[i] != pattern[(i + 1) % 3]) r[1]++;\n\t\t\t//\tif (str[i] != pattern[(i + 2) % 3]) r[2]++;\n\t\t\t//}\n\n\t\t\t//int index;\n\t\t\t//if (r[0] <= r[1] && r[0] <= r[2])\n\t\t\t//{\n\t\t\t//\tindex = 0;\n\t\t\t//} else if (r[1] <= r[0] && r[1] <= r[2])\n\t\t\t//{\n\t\t\t//\tindex = 1;\n\t\t\t//}\n\t\t\t//else\n\t\t\t//{\n\t\t\t//\tindex = 2;\n\t\t\t//}\n\n\t\t\t//Console.WriteLine(r[index]);\n\t\t\t//Console.WriteLine(new string(Enumerable.Range(0, n).Select(i => pattern[(i + index) % 3]).ToArray()));\n\n\t\t\tint n = ConsoleLine.Read();\n\t\t\tint[] items = ConsoleLine.Read();\n\n\t\t\tHashSet div1 = new HashSet();\n\t\t\tHashSet div2 = new HashSet();\n\n\t\t\tint a = items.Max();\n\t\t\tforeach (var item in items)\n\t\t\t{\n\t\t\t\tif (a % item == 0 && !div1.Contains(item))\n\t\t\t\t{\n\t\t\t\t\tdiv1.Add(item);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdiv2.Add(item);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine($\"{div1.Max()} {div2.Max()}\");\n\t\t}\n\t}\n\n\tpublic class ConsoleLine\n\t{\n\t\tprivate readonly string _line;\n\n\t\tpublic ConsoleLine(string line)\n\t\t{\n\t\t\t_line = line;\n\t\t}\n\n\t\tpublic void ToIntArray(out int[] arr)\n\t\t{\n\t\t\tarr = _line.Split(' ').Select(int.Parse).ToArray();\n\t\t}\n\n\t\tpublic static implicit operator string(ConsoleLine line)\n\t\t{\n\t\t\treturn line._line;\n\t\t}\n\n\t\tpublic static implicit operator int(ConsoleLine line)\n\t\t{\n\t\t\treturn int.Parse(line._line);\n\t\t}\n\n\t\tpublic static implicit operator int[](ConsoleLine line)\n\t\t{\n\t\t\tline.ToIntArray(out int[] arr);\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic static ConsoleLine Read()\n\t\t{\n\t\t\tstring line = Console.ReadLine();\n\t\t\treturn line == null\n\t\t\t\t? null\n\t\t\t\t: new ConsoleLine(line);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Console;\nusing static System.Math;\nclass Z { static void Main() => new K(); }\nclass K\n{\n\tint F => int.Parse(Str);\n\tlong FL => long.Parse(Str);\n\tint[] G => Strs.Select(int.Parse).ToArray();\n\tlong[] GL => Strs.Select(long.Parse).ToArray();\n\tstring Str => ReadLine();\n\tstring[] Strs => Str.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n\tconst int MOD = 1000000007;\n\tpublic K()\n\t{\n\t\tSetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n\t\tSolve();\n\t\tOut.Flush();\n\t}\n\tvoid Solve()\n\t{\n\t\tvar n = F;\n\t\tvar d = G.ToList();\n\t\tvar x = d.Max();\n\t\tforeach (var a in Divisors(x)) d.Remove(a);\n\t\tvar y = d.Max();\n\t\tWriteLine($\"{x} {y}\");\n\t}\n\tIEnumerable Divisors(int n)\n\t{\n\t\tfor (var i = 1; i <= n; i++) if (n % i == 0) yield return i;\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _1108B_Divisors_of_Two_Integers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string [] numbers = Console.ReadLine().Split();\n var divisors1 = new SortedSet();\n var divisors2 = new SortedSet();\n\n for (int i = 0; i < n; i++)\n {\n if (divisors1.Contains(Int32.Parse(numbers[i])))\n {\n divisors2.Add(Int32.Parse(numbers[i]));\n }\n else\n {\n divisors1.Add(Int32.Parse(numbers[i]));\n }\n }\n\n int x, y = 0;\n x = divisors1.Max;\n var toRemove = new List();\n\n foreach (var item in divisors1)\n {\n double division = (double)x/(double)item;\n\n if (division % 1 == 0)\n {\n toRemove.Add(x/item);\n }\n }\n\n foreach (var item in toRemove)\n {\n divisors1.Remove(item);\n }\n\n if (divisors1.Count == 0)\n {\n y = divisors2.Max;\n }\n else\n {\n y = Math.Max(divisors1.Max, divisors2.Max);\n }\n\n Console.WriteLine(x + \" \" + y);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n\n class Program\n {\n const int N = 128;\n const int M = 10001;\n\n static int[] a = new int[N];\n static int[] cnt = new int[M];\n static int[] cntTemp = new int[M];\n\n static void calc(int x)\n {\n for (int i = 1; i * i <= x; ++i)\n {\n if (x % i == 0)\n {\n cntTemp[i]++;\n if (i != x / i)\n {\n cntTemp[x / i]++;\n }\n }\n }\n }\n\n static bool check(int n, int x, int y)\n {\n for (int i = 0; i < n; ++i)\n {\n cntTemp[a[i]] = 0;\n }\n calc(x);\n calc(y);\n for (int i = 0; i < n; ++i)\n {\n if (cnt[a[i]] != cntTemp[a[i]])\n {\n return false;\n }\n }\n return true;\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine().Split(' ');\n int fIndex = 0;\n for (int i = 0; i < n; ++i)\n {\n a[i] = int.Parse(s[i]);\n if (a[fIndex] < a[i])\n {\n fIndex = i;\n }\n cnt[a[i]]++;\n }\n for (int i = 0; i < n; ++i)\n {\n if (i != fIndex && check(n, a[fIndex], a[i]))\n {\n Console.Write(a[fIndex] + \" \" + a[i]);\n break;\n }\n }\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n int m = 10001;\n var d = input.ReadIntArray(n);\n var c = new int[m];\n for (var i = 0; i < n; i++)\n {\n c[d[i]]++;\n }\n var a = d.Max();\n var b = 1;\n if (c[a] > 1)\n b = a;\n else\n {\n for (var i = 1; i < m; i++)\n {\n if (a % i == 0)\n c[i]--;\n }\n for (var i = 1; i < m; i++)\n {\n if (c[i] == 1)\n b = i;\n }\n }\n Console.Write(a + \" \" + b);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static void AddCount(Dictionary counter, T item)\n {\n if (counter.TryGetValue(item, out var count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n return counter.TryGetValue(item, out var count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n var t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438_\u0434\u0432\u0443\u0445_\u0447\u0438\u0441\u0435\u043b\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var y = 0;\n var numbers = new int[int.Parse(Console.ReadLine())];\n var input = Console.ReadLine().Split();\n for (var i = 0; i < numbers.Length; i++)\n {\n numbers[i] = int.Parse(input[i]);\n if (numbers[i] > y)\n y = numbers[i];\n }\n var dividersY = new List();\n GetDividers(y, dividersY);\n var dividersX = numbers.ToList();\n for(var i = 0; i < dividersY.Count; i++)\n {\n dividersX.Remove(dividersY[i]);\n }\n dividersX.Sort();\n var x = dividersX[dividersX.Count-1];\n Console.WriteLine(x + \" \" + y);\n }\n\n public static void GetDividers(int number, List dividers)\n {\n var n = 1;\n while (n<=number)\n {\n if (number%n==0)\n dividers.Add(n);\n n++;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Numerics;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\nnamespace ProjectEuler\n{\n class Program\n {\n\n private static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n var divisors = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n divisors.Sort();\n \n int x = divisors[n - 1];\n int y;\n int gdc = 1;\n List divisor1 = new List();\n\n for (int j = 0; j < n; j++)\n {\n divisor1.Add(divisors[j]);\n }\n\n for (int i = 0; i < n-1; i++)\n {\n \n if (divisor1[i] == divisor1[i+1])\n {\n gdc = divisor1[i];\n }\n int tmp = divisor1[i];\n if (x%divisor1[i] == 0)\n {\n divisors.Remove(tmp);\n }\n }\n\n divisors.Remove(x);\n if (divisors.Count == 0)\n {\n y = gdc;\n }\n else\n {\n y = divisors.Max();\n\n }\n Console.WriteLine($\"{x} {y}\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n var N = sc.Int;\n var D = sc.ArrInt;\n var ct = new int[10101];\n for (int i = 0; i < N; i++)\n {\n ct[D[i]]++;\n }\n var f = D.Max();\n for (int i = 1; i <= f; i++)\n if (f % i == 0) ct[i]--;\n var s = -1;\n for (int i = 10101 - 1; i >= 0; i--)\n {\n if (ct[i] > 0) { WriteLine($\"{f} {i}\"); break; }\n }\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Shuffle(this IList A) { T[] rt = A.ToArray(); Random rnd = new Random(); for (int i = rt.Length - 1; i >= 1; i--) swap(ref rt[i], ref rt[rnd.Next(i + 1)]); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static void PopBack(this List A) => A.RemoveAt(A.Count - 1);\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion"}, {"source_code": "using System.Collections.Generic;\nusing System;\n\nclass _1108B\n{\n\tstatic void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tList d = new List(Array.ConvertAll(Console.ReadLine().Split(), int.Parse));\n\n\t\tint x = 0;\n\t\tfor (int i = 0; i < n; ++i)\n\t\t{\n\t\t\tx = Math.Max(x, d[i]);\n\t\t}\n\t\tfor (int i = 1; i <= x; ++i)\n\t\t{\n\t\t\tif (x % i == 0)\n\t\t\t{\n\t\t\t\td.Remove(i);\n\t\t\t}\n\t\t}\n\t\tint y = 0;\n\t\tfor (int i = 0; i < d.Count; ++i)\n\t\t{\n\t\t\ty = Math.Max(y, d[i]);\n\t\t}\n\t\tConsole.WriteLine(x + \" \" + y);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Divisors_of_Two_Integers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n Array.Sort(nn);\n Array.Reverse(nn);\n\n writer.Write(nn[0]);\n writer.Write(' ');\n\n if (nn[0] == nn[1])\n {\n writer.WriteLine(nn[0]);\n }\n else\n {\n for (int i = 1; i < n; i++)\n {\n if (nn[0]%nn[i] != 0)\n {\n writer.WriteLine(nn[i]);\n return;\n }\n if (nn[i] == nn[i + 1])\n {\n writer.WriteLine(nn[i]);\n return;\n }\n }\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\npublic class Solver\n{\n public void Solve()\n {\n int n = int.Parse(reader.ReadLine());\n string[] tokens = reader.ReadLine().Split(new char[]{ ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n List list = new List(n);\n foreach (string token in tokens)\n {\n list.Add(int.Parse(token));\n }\n\n list.Sort();\n\n int a = list[n - 1];\n\n List listA = new List();\n listA.Add(1);\n for (int i = 2; i <= a; i++)\n {\n if (a % i == 0)\n {\n listA.Add(i);\n }\n }\n\n int j = 0;\n for (int i = 0; i < listA.Count; i++)\n {\n for (; j < n; j++)\n {\n if (listA[i] == list[j])\n {\n list.RemoveAt(j);\n break;\n }\n }\n }\n\n int b = list[list.Count - 1];\n\n writer.WriteLine(a + \" \" + b);\n }\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n Stopwatch watch = new Stopwatch();\n watch.Start();\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n\n#if DEBUG\n watch.Stop();\n writer.WriteLine(\"Stopwatch: \" + watch.ElapsedMilliseconds + \"ms\");\n#endif\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n protected static TextReader reader;\n protected static TextWriter writer;\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1108B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split().Select(int.Parse).ToList();\n var arr2 = arr.Distinct().ToList();\n\n var max1 = arr2.Max();\n\n for(int i = 0; iint.Parse(n)).ToArray(); \n Dictionary dictionary = new Dictionary(); \n for (int i = 0; i < array.Length; i++)\n {\n if (dictionary.ContainsKey(array[i])) dictionary[array[i]]++;\n else dictionary[array[i]] = 1;\n }\n\n Array.Sort(array);\n int firstMax = array[array.Length - 1];\n HashSet setOfNumbers= new HashSet();\n\n for (int i = 0; i < array.Length; i++)\n {\n if (firstMax % array[i] == 0)\n {\n setOfNumbers.Add(array[i]);\n }\n }\n\n int[] buff = setOfNumbers.ToArray();\n for (int i = 0; i < buff.Length; i++)\n {\n dictionary[buff[i]]--;\n }\n List list = new List(); \n\n foreach (var c in dictionary)\n {\n if (c.Value > 0)\n {\n list.Add(c.Key);\n }\n }\n\n list.Sort(); \n int secondMax = list[list.Count - 1];\n Console.WriteLine(firstMax + \" \" + secondMax);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace AlgoHelper\n{\n\n class Programs\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n \n Dictionary dict = new Dictionary();\n\n for (int i = 0; i < a.Length; i++)\n {\n if (dict.ContainsKey(a[i])) dict[a[i]]++;\n else dict[a[i]] = 1;\n }\n\n Array.Sort(a);\n\n int max = a[a.Length - 1];\n\n HashSet set= new HashSet();\n\n for (int i = 0; i < a.Length; i++)\n {\n if (max % a[i] == 0)\n {\n set.Add(a[i]);\n }\n }\n\n int[] b = set.ToArray();\n\n for (int i = 0; i < b.Length; i++)\n {\n dict[b[i]]--;\n }\n\n List list = new List();\n\n foreach (var c in dict)\n {\n if (c.Value > 0)\n {\n list.Add(c.Key);\n }\n }\n\n list.Sort();\n\n int max2 = list[list.Count - 1];\n\n Console.WriteLine(max + \" \" + max2);\n\n // Console.ReadKey();\n }\n\n private static int makePermutation(int[] a)\n {\n int count = 0;\n int n = a.Length;\n\n HashSet set = new HashSet();\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] >= 1 && a[i] <= n)\n {\n if (!set.Contains(a[i]))\n {\n set.Add(a[i]);\n }\n else\n {\n count++;\n }\n }\n\n else count++;\n }\n\n return count;\n }\n\n private static string parseValues(object o)\n {\n if (o is double)\n {\n double oo = (double) o ;\n return oo.ToString(\"0.#################\");\n }\n\n return o.ToString();\n }\n static long sum(long n)\n {\n return n * (n + 1) / 2;\n }\n public int HIndex(int[] citations)\n {\n Array.Sort(citations);\n Console.WriteLine(string.Join(\"|\",citations));\n int length = citations.Length;\n for (int i = citations.Length - 1; i >=0; i--)\n {\n int value = citations[i];\n if (length - i >= value && i < value) return value;\n }\n\n return 0;\n }\n\n public double FindMaxAverage(int[] nums, int k)\n {\n int[] prefix = prefixSum(nums);\n double max = prefix[k] / k;\n\n for (int i = 1; i <=prefix.Length - k; i++)\n {\n int sum = prefix[i + k] - nums[i-1];\n max = Math.Max(max, sum / k);\n }\n\n return max;\n }\n\n private static int [] prefixSum(int[] a)\n {\n int sum = 0;\n int [] prefix = new int[a.Length];\n for (int i = 0; i < a.Length; i++)\n {\n sum += a[i];\n prefix[i] = sum;\n }\n return prefix;\n }\n\n\n public static int LenLongestFibSubseq(int[] a)\n {\n int count = 2;\n int max = int.MinValue;\n\n int index = -1;\n int target = 0;\n\n for (int i = 0; i < a.Length - 1; i++)\n {\n int prev = a[i];\n int current = a[i+1];\n int currentIndex = i + 2;\n index = -1;\n\n for (int j = i + 1; j < a.Length;)\n {\n if (index == -1)\n {\n target = a[i] + a[j];\n index = customBinarySearch(a, target, j+1);\n current = a[j];\n }\n else\n {\n target = prev + current;\n index = customBinarySearch(a, target, currentIndex);\n }\n\n if (index == -1)\n {\n max = Math.Max(max, count);\n j++;\n count = 2;\n }\n else\n {\n prev = current;\n current = a[index];\n currentIndex = index + 1;\n count++;\n }\n }\n }\n\n max = Math.Max(max, count);\n\n return max == int.MinValue ? 0 : max;\n }\n\n private static int customBinarySearch(int[] a, int target, int index)\n {\n int lo = index;\n int hi = a.Length - 1;\n\n while (lo<=hi)\n {\n int med = hi - (hi - lo) / 2;\n if (a[med] == target) return med;\n else if (target < a[med]) hi = med - 1;\n else lo = med + 1;\n }\n return -1;\n }\n\n\n private static bool isFibonacciSequence(int[] a)\n {\n for (int i = 2; i < a.Length; i++)\n {\n if (a[i] != a[i - 1] + a[i - 2]) return false;\n }\n\n return true;\n }\n\n private static int LowerBound(int[] a, int i, int target)\n {\n int lo = i;\n int hi = a.Length - 1;\n\n if (target < a[lo]) return lo;\n\n int ans = -1;\n\n while (lo <= hi)\n {\n int med = hi - (hi - lo) / 2;\n\n if (a[med] == target)\n {\n hi = med - 1;\n ans = med;\n }\n else if (target > a[med])\n {\n lo = med + 1;\n }\n else\n {\n hi = med - 1;\n }\n }\n\n return ans;\n }\n\n private static int UpperBound(int[] a, int i, int target)\n {\n int lo = i;\n int hi = a.Length - 1;\n\n if (target > a[hi]) return hi;\n\n while (lo <= hi)\n {\n int med = hi - (hi - lo) / 2;\n\n if (a[med] == target)\n {\n lo = med + 1;\n }\n else if (target > a[med])\n {\n lo = med + 1;\n }\n else\n {\n hi = med - 1;\n }\n }\n\n return hi;\n }\n\n private static int getValidMinSide(int a, int b)\n {\n int max = a > b ? a - b : b - a;\n\n int c = Math.Min(a + b, max);\n\n return c + 1;\n }\n\n private static int getValidMaxSide(int a, int b)\n {\n return a + b - 1;\n }\n\n private static int[] frequency(string s)\n {\n int[] a = new int[256];\n\n foreach (char c in s)\n {\n a[c]++;\n }\n\n return a;\n }\n\n public static int max(int[] a, int i)\n {\n if (i == a.Length - 1) return a[a.Length - 1];\n return Math.Max(a[i], max(a, i + 1));\n }\n\n\n private static bool isPrime(int n)\n {\n if (n < 2) return false;\n\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0) return false;\n }\n\n return true;\n }\n\n private static void Swap(ref char a, ref char b)\n {\n char temp = a;\n a = b;\n b = temp;\n }\n }\n\n class Pair\n {\n public int Left { get; set; }\n public int Right { get; set; }\n\n public Pair(int left, int right)\n {\n Left = left;\n Right = right;\n }\n\n public override string ToString()\n {\n return Left + \" \" + Right;\n }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint X = A.Max();\n\t\tvar h = new HashSet();\n\t\tfor(int j=1;j*j<=X;j++){\n\t\t\tif(X % j != 0) continue;\n\t\t\th.Add(j);\n\t\t\tif(X / j != j) h.Add(X / j);\n\t\t}\n\t\t\n\t\tvar l = new List();\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeff\ufeff//\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 32 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var numbers = sr.ReadArrayOfInt32();\n Array.Sort(numbers, (a, b) => -a.CompareTo(b));\n var x = numbers[0];\n var d1 = Divisors(x);\n for (var i = 1; i < numbers.Length; i++)\n {\n var y = numbers[i];\n var d2 = Divisors(y);\n var list = new List(d1.Count + d2.Count);\n list.AddRange(d1);\n list.AddRange(d2);\n list.Sort((a, b) => -a.CompareTo(b));\n if (list.Count == numbers.Length)\n {\n var can = true;\n for (var j = 0; j < numbers.Length; j++)\n {\n if (numbers[j] != list[j])\n {\n can = false;\n break;\n }\n }\n\n if (can)\n {\n sw.WriteLine(x + \" \" + y);\n return;\n }\n }\n }\n }\n\n private HashSet Divisors(int n)\n {\n var list = new HashSet();\n var mid = Math.Sqrt(n);\n list.Add(1);\n list.Add(n);\n for (var i = 2; i <= mid; i++)\n {\n if (n % i == 0)\n {\n list.Add(i);\n list.Add(n / i);\n }\n }\n\n return list;\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Squarow\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = Convert.ToInt32(Console.ReadLine());\n string[] str = Console.ReadLine().Split(' ');\n int[] x = new int[N];\n for (int i = 0; i < N; i++)\n x[i] = Convert.ToInt32(str[i]);\n Array.Sort(x);\n int max = x.Last();\n for (int i = 0; i < N; i++)\n {\n if (i < N - 1 && x[i] == x[i + 1]) i++;\n if (max % x[i] == 0)\n x[i] = 0;\n }\n Console.WriteLine(max + \" \" + x.Max());\n \n // Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n string[] token = Console.ReadLine().Split();\n List a = new List();\n int l1 = int.MinValue;\n \n for(int i=0;i=0;i--){\n if(Ind[a[i]]==0 && fmax%a[i]==0){\n Ind[a[i]] = 1;\n a.Remove(a[i]);\n }\n }\n \n int N = a.Count;\n \n Console.WriteLine(a[N-1] + \" \" + a[N-2]); \n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace \u0421SharpTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine());\n var numbers = Console.ReadLine().Split(' ');\n resolve(numbers);\n }\n\n static void resolve(string[] numbers)\n {\n var hsFirst = new HashSet();\n var max = 0;\n var maxDouble = 0;\n foreach(var number in numbers)\n {\n var n = Int32.Parse(number);\n if(n > max){\n max = n;\n }\n\n if(!hsFirst.Add(n))\n {\n if(n>maxDouble) {\n maxDouble = n;\n }\n hsFirst.Remove(n);\n }\n\n }\n\n var singleMax = 0;\n hsFirst.Remove(max);\n foreach(var m in hsFirst)\n {\n if(singleMax < m && max%m != 0)\n {\n singleMax = m;\n }\n }\n var resTwo = singleMax > maxDouble ? singleMax : maxDouble;\n\n Console.Write(max);\n Console.Write(\" \");\n Console.Write(resTwo);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program {\n const int mod = 1000000007;\n\n static void Main() {\n#if USE_IDE\n var exStdIn = new System.IO.StreamReader(\"./../../TestStdin.txt\");\n Console.SetIn(exStdIn);\n#endif\n var n = int.Parse(Console.ReadLine());\n var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n var x = a.Max();\n List b = new List(a);\n b.Remove(x);\n // \u7d04\u6570\u9664\u5916\n for (int i = x / 2; i > 0; i--) {\n if (x % i == 0) {\n b.Remove(i);\n }\n }\n\n var y = b.Max();\n Console.WriteLine(x + \" \" + y);\n }\n}"}, {"source_code": "/* Date: 23.01.2019 * Time: 21:45 */\n//\n// \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 6\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n# endif\n\n\t\tint n = int.Parse (s);\n\t\tint [] d = new int [n];\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** n = \" + n);\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tstring [] s0 = s.Split (' ');\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\td [i] = int.Parse (s0 [i]);\n\n\t\tArray.Sort (d);\n\t\tint a = 0, b = d [n-1];\n\n\t\tint k = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tif ( i < n-1 && d [i] == d [i+1] )\n\t\t\t{\n\t\t\t\tk = d [i];\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( b % d [i] != 0 )\n\t\t\t\t\tk = d [i];\n\t\t\t}\n\n\t\tif ( k == 0 )\n\t\t\ta = b;\n\t\telse\n\t\t\ta = k;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (a + \" \" + b);\n# else\n\t\tsw.Write (\"***\");\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.Write (\" \" + d [i]);\n\t\tsw.WriteLine ();\n\t\tsw.WriteLine (a + \" \" + b);\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var parts = Console.ReadLine().Split(' ');\n var divs = parts.Select(int.Parse).ToArray();\n\n Array.Sort(divs);\n int x = -1, y = divs[n - 1];\n\n for (int i = 0; i < n-1; i++)\n {\n if (divs[i] == divs[i+1])\n {\n x = divs[i];\n i++;\n }\n else if (y % divs[i] != 0)\n {\n x = divs[i];\n }\n }\n\n Console.WriteLine(\"{0} {1}\", y, x);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SolutionsForCodeforces\n{\n class IHateNumbers\n {\n static void Main()\n {\n var Number = Convert.ToInt32(Console.ReadLine());//Number of Div.\n var temp = Console.ReadLine();\n var atemp = temp.Split(' ');\n var Dividers = from l in atemp\n select Convert.ToInt32(l); //Divide\n int Max = Dividers.Max(); //MAX\n Console.WriteLine(Convert.ToString(Max) + \" \");\n var DivForMaxTemp = Dividers.Distinct();\n var DivForMax = from l in DivForMaxTemp// Div Max\n where Max % l == 0\n select l;\n var DivForSecond = from l in Dividers // Div Second\n where !DivForMax.Contains(l)\n select l;\n if (DivForSecond.Count() > 0)\n {\n Console.Write(DivForSecond.Max());\n }\n else\n {\n var a = Get(Dividers);\n Console.Write(a.Max());\n }\n }\n static List Get(IEnumerable IN)\n {\n List rezult = new List();\n var hashset = new HashSet();\n foreach (var name in IN)\n {\n if (!hashset.Add(name))\n {\n rezult.Add(name);\n }\n }\n return rezult;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = Ri();\n\t\t\tvar d = Ria();\n\t\t\tint mx = d.Max();\n\t\t\tvar h = new HashSet();\n\t\t\tfor(int i=1;i<=mx;i++)\n\t\t\t{\n\t\t\t\tif(mx%i==0)\n\t\t\t\t{\n\t\t\t\t\th.Add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar l = new List();\n\t\t\tforeach(var x in d)\n\t\t\t{\n\t\t\t\tif(h.Contains(x))\n\t\t\t\t{\n\t\t\t\t\th.Remove(x);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tl.Add(x);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"{0} {1}\", mx, l.Max());\n\t\t}\n\n\t\tstatic String Rs() { return Console.ReadLine(); }\n\t\tstatic int Ri() { return int.Parse(Console.ReadLine()); }\n\t\tstatic long Rl() { return long.Parse(Console.ReadLine()); }\n\t\tstatic double Rd() { return double.Parse(Console.ReadLine()); }\n\t\tstatic String[] Rsa(char sep=' ') { return Console.ReadLine().Split(sep); }\n\t\tstatic int[] Ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }\n\t\tstatic long[] Rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }\n\t\tstatic double[] Rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing System.Resources;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\tstring input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\tvar inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tlong n = long.Parse(input1);\n\t\t\tlong x = inputs2.Max();\n\t\t\tfor (long i = 1; i <= x / 2; i++) \n\t\t\t{\n\t\t\t\tif (x % i > 0) \n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar index = inputs2.IndexOf(i);\n\t\t\t\tif (index >= 0) \n\t\t\t\t{\n\t\t\t\t\tinputs2.RemoveAt(index);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinputs2.Remove(x);\n\t\t\tlong y = inputs2.Max();\n\t\t\tConsole.WriteLine($\"{x} {y}\");\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var line = Console.ReadLine().Split(' ');\n var d = new int[n];\n for (int i = 0; i < n; i++)\n {\n d[i] = Convert.ToInt32(line[i]);\n }\n var x = d.Max();\n var notDivisorOfX = from di in d\n where x % di != 0\n select di;\n int y;\n if (notDivisorOfX.Count() > 0)\n {\n y = notDivisorOfX.Max();\n }\n else\n {\n var dWithoutX = d.ToList();\n dWithoutX.Remove(x);\n var freq2 = from di in dWithoutX\n where d.Count(a => a == di) == 2\n select di;\n y = freq2.Max();\n }\n\n Console.WriteLine(\"{0} {1}\", x, y);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = data.Max();\n var numbers = new int[10001];\n for (int i = 0; i < data.Length; i++) \n numbers[data[i]]++;\n for (int i = 1; i < numbers.Length; i++) \n if (a%i == 0)\n numbers[i]--;\n var b = -1;\n for (int i = numbers.Length-1; i >= 0; i--)\n {\n if (numbers[i] != 0)\n {\n b = i;\n break; \n }\n }\n\n Console.WriteLine(a + \" \" + b);\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class _1108B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n int max = 0;\n int pos = 0;\n string[] ss = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n int m = int.Parse(ss[i]);\n a[i] = m;\n if (a[i] > max)\n {\n max = a[i];\n pos = i;\n }\n }\n Console.Write(max);\n Console.Write(\" \");\n for (int i = 0; i < n; i++)\n {\n if (max % a[i] == 0)\n {\n max = max / a[i];\n a[i] = 0;\n }\n }\n a[pos] = 0;\n max = 0;\n for(int i = 0; i < n; i++)\n {\n if (a[i] > max)\n max = a[i];\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var l = Console.ReadLine().Split().Select(int.Parse).ToList();\n var t = l;\n var r1 = l.Max();\n var r2 = 0;\n var d = new List();\n for (int i = 0; i < l.Count(); i++)\n {\n if (r1 % l[i] == 0)\n {\n t.Remove(l[i]);\n }\n }\n\n r2 = t.Max();\n Console.WriteLine(r1 + \" \" + r2);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _1108B_Divisors_of_Two_Integers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string [] numbers = Console.ReadLine().Split();\n var divisors1 = new SortedSet();\n var divisors2 = new SortedSet();\n\n for (int i = 0; i < n; i++)\n {\n if (divisors1.Contains(Int32.Parse(numbers[i])))\n {\n divisors2.Add(Int32.Parse(numbers[i]));\n }\n else\n {\n divisors1.Add(Int32.Parse(numbers[i]));\n }\n }\n\n int x, y = 0;\n x = divisors1.Max;\n var toRemove = new List();\n\n foreach (var item in divisors1)\n {\n if (x/item % 1 == 0)\n {\n toRemove.Add(x/item);\n }\n }\n\n foreach (var item in toRemove)\n {\n divisors1.Remove(item);\n }\n\n if (divisors1.Count == 0)\n {\n y = divisors2.Max;\n }\n else\n {\n y = Math.Max(divisors1.Max, divisors2.Max);\n }\n\n Console.WriteLine(x + \" \" + y);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _1108B_Divisors_of_Two_Integers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string [] numbers = Console.ReadLine().Split();\n var divisors = new List();\n\n for (int i = 0; i < n; i++)\n divisors.Add(Int32.Parse(numbers[i]));\n\n divisors.Sort();\n\n if (divisors[n-1] == divisors[n-2])\n {\n Console.WriteLine(divisors[n-1] + \" \" + divisors[n-2]);\n return;\n }\n\n int x, y;\n x = divisors[n-1];\n var toRemove = new List();\n\n foreach (var item in divisors)\n {\n if (x/item % 1 == 0)\n toRemove.Add(x/item);\n }\n\n foreach (var item in toRemove)\n {\n divisors.Remove(item);\n }\n\n y = divisors[divisors.Count-1];\n\n Console.WriteLine(x + \" \" + y);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n\n class Program\n {\n const int N = 128;\n\n static int[] a = new int[N];\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine().Split(' ');\n int fIndex = 0;\n for (int i = 0; i < n; ++i)\n {\n a[i] = int.Parse(s[i]);\n if (a[fIndex] < a[i])\n {\n fIndex = i;\n }\n }\n for (int i = 0; i < n; ++i)\n {\n if (i == fIndex)\n {\n continue;\n }\n bool check = true;\n for (int j = 0; j < n; ++j)\n {\n if (a[i] % a[j] != 0 && a[fIndex] % a[j] != 0)\n {\n check = false;\n break;\n }\n }\n if (check)\n {\n Console.Write(a[fIndex] + \" \" + a[i]);\n break;\n }\n }\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1108B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var max1 = arr.Max();\n\n var arr2 = arr.Where(a => max1 % a != 0).ToArray();\n int max2 = 0;\n\n if (arr2.Length != 0)\n max2 = arr2.Max();\n\n if (max2 == 0)\n max2 = max1;\n\n Console.WriteLine($\"{max1} {max2}\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1108B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var max1 = arr.Max();\n\n var arr2 = arr.Where(a => max1 % a != 0).ToArray();\n int max2 = 0;\n\n if (arr2.Length != 0)\n max2 = arr2.Max();\n\n if (max2 == 0)\n max2 = arr.Min();\n\n Console.WriteLine($\"{max1} {max2}\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1108B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var max1 = arr.Max();\n\n var arr2 = arr.Where(a => max1 % a != 0).ToArray();\n int max2 = 0;\n\n if (arr2.Length != 0)\n max2 = arr2.Max();\n\n if (max2 == 0 && n % 2==0)\n max2 = max1;\n\n if (max2 == 0 && n % 2 == 1)\n max2 = max1;\n\n\n Console.WriteLine($\"{max1} {max2}\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1108B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n var max1 = arr.Max();\n\n var arr2 = arr.Where(a => max1 % a != 0).ToArray();\n int max2 = 0;\n\n if (arr2.Length != 0)\n max2 = arr2.Max();\n\n if (max2 == 0 && n % 2==0)\n max2 = max1;\n\n if (max2 == 0 && n % 2 == 1)\n max2 = arr.Min() ;\n\n\n Console.WriteLine($\"{max1} {max2}\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Something\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();\n int mx = 0;\n int cnt = 0;\n for (int i = 0; i < n; ++i)\n {\n mx = Math.Max(mx, a[i]);\n \n }\n int mx2 = 0;\n for(int i = 0; i < n; ++i)\n {\n \n if(a[i] == mx){\n ++cnt;\n }\n if(mx % a[i] != 0)\n {\n mx2 = Math.Max(mx2, a[i]);\n }\n }\n if(mx2 != 0){\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n } else{\n if(cnt >= 2){\n Console.WriteLine(\"{0} {1}\", mx, mx);\n } else{\n if(a[0] == mx){\n Console.WriteLine(\"{0} {1}\", a[1], mx);\n } else{\n Console.WriteLine(\"{0} {1}\", a[0], mx);\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Something\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();\n int mx = 0;\n for (int i = 0; i < n; ++i)\n {\n mx = Math.Max(mx, a[i]);\n \n }\n int mx2 = 0;\n for(int i = 0; i < n; ++i)\n {\n \n if(mx % a[i] != 0)\n {\n mx2 = Math.Max(mx2, a[i]);\n }\n }\n if(mx2 != 0){\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n } else{\n int []cnt = new int[10005];\n for(int i = 0; i <= 10000; ++i) cnt[i] = 0;\n for(int i = 0; i < n; ++i){\n cnt[a[i]]++;\n if(cnt[a[i]] == 2){\n Console.WriteLine(\"{0} {1}\", mx, a[i]);\n break;\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Something\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();\n int mx = 0;\n for (int i = 0; i < n; ++i)\n {\n mx = Math.Max(mx, a[i]);\n }\n int mx2 = 0;\n for(int i = 0; i < n; ++i)\n {\n if(mx % a[i] != 0)\n {\n mx2 = Math.Max(mx2, a[i]);\n }\n }\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Something\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();\n int mx = 0;\n for (int i = 0; i < n; ++i)\n {\n mx = Math.Max(mx, a[i]);\n }\n int mx2 = 0;\n for(int i = 0; i < n; ++i)\n {\n if(a[i] % mx != 0)\n {\n mx2 = Math.Max(mx2, a[i]);\n }\n }\n Console.WriteLine(\"{0} {1}\", mx, mx2);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication29\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n Console.ReadLine();\n int[] array = Console.ReadLine().Split(' ').Select(n =>int.Parse(n)).ToArray();\n Dictionary dictionary = new Dictionary();\n\n for (int i = 0; i < array.Length; i++)\n if (dictionary.ContainsKey(array[i])) \n dictionary[array[i]]++;\n else \n dictionary[array[i]] = 1;\n \n int firstMax = array[array.Length - 1];\n Array.Sort(array);\n HashSet hashSet= new HashSet();\n \n for (int i = 0; i < array.Length; i++)\n if (firstMax % array[i] == 0)\n hashSet.Add(array[i]);\n\n int[] buff = hashSet.ToArray();\n for (int i = 0; i < buff.Length; i++)\n dictionary[buff[i]]--;\n\n List list = new List();\n foreach (var c in dictionary)\n if (c.Value > 0)\n list.Add(c.Key);\n \n list.Sort();\n \n Console.WriteLine(firstMax + \" \" + list[list.Count - 1]);\n }\n }\n}"}, {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 32 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var numbers = sr.ReadArrayOfInt32();\n var x = numbers.Max();\n var removed = new List();\n for (var i = 0; i < numbers.Length; i++)\n {\n if (x % numbers[i] != 0)\n {\n removed.Add(numbers[i]);\n }\n }\n\n int y;\n if (removed.Count == 0)\n {\n Array.Sort(numbers, (a, b) => -a.CompareTo(b));\n y = numbers[1];\n }\n else\n {\n y = removed.Max();\n }\n\n sw.Write(x + \" \" + y);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 32 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var numbers = sr.ReadArrayOfInt32();\n Array.Sort(numbers, (a, b) => -a.CompareTo(b));\n var x = numbers[0];\n var contains = new int[(int)1e4 + 1];\n foreach (var i in numbers)\n {\n contains[i]++;\n }\n var set = new HashSet();\n foreach (var i in numbers)\n {\n if (x % i != 0)\n {\n set.Add(i);\n }\n }\n for (var j = 1; j < numbers.Length; j++)\n {\n var i = numbers[j];\n if (contains[i] > 0)\n {\n if (contains[i] > 1)\n {\n sw.Write(x + \" \" + i);\n return;\n }\n\n var can = set.All(item => item % i == 0);\n if (can)\n {\n sw.Write(x + \" \" + i);\n return;\n }\n }\n }\n throw new InvalidOperationException();\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "/* Date: 23.01.2019 * Time: 21:45 */\n// *\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\036\\\\B.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n# endif\n\n\t\tint n = int.Parse (s);\n\t\tint [] d = new int [n];\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** n = \" + n);\n\t\tsw.WriteLine (\"*** \" + s);\n# endif\n\n\t\tstring [] s0 = s.Split (' ');\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\td [i] = int.Parse (s0 [i]);\n\n\t\tArray.Sort (d);\n\t\tint a = 0, b = d [n-1];\n\n\t\tint k = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tif ( i < n-1 && d [i] == d [i+1] )\n\t\t\t\ti++;\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( b % d [i] != 0 )\n\t\t\t\t\tk = d [i];\n\t\t\t}\n\n\t\tif ( k == 0 )\n\t\t\ta = b;\n\t\telse\n\t\t\ta = k;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (a + \" \" + b);\n# else\n\t\tsw.Write (\"***\");\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tsw.Write (\" \" + d [i]);\n\t\tsw.WriteLine ();\n\t\tsw.WriteLine (a + \" \" + b);\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var line = Console.ReadLine().Split(' ');\n var d = new int[n];\n for (int i = 0; i < n; i++)\n {\n d[i] = Convert.ToInt32(line[i]);\n }\n var x = d.Max();\n var notDivisorOfX = from di in d\n where x % di != 0\n select di;\n int y;\n if (notDivisorOfX.Count() > 0)\n {\n y = notDivisorOfX.Max();\n }\n else\n {\n var r = d.ToList();\n r.Remove(x);\n y = r.Max();\n }\n\n Console.WriteLine(\"{0} {1}\", x, y);\n }\n\n }\n}\n"}], "src_uid": "868407df0a93085057d06367aecaf9be"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // Pangram (implementation, strings)\n class _520A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n HashSet hash = new HashSet();\n for (int i = 0; i < n; i++)\n hash.Add(char.ToLower(s[i]));\n Console.WriteLine(hash.Count == 26 ? \"YES\" : \"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\nnamespace _520A\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var text = Console.ReadLine();\n \n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n \n var array = new bool['z' - 'a' + 1];\n var counter = 0;\n for (var i = 0; i < n; i++)\n {\n var letter = char.ToLower(text[i]);\n if (letter >= 'a' && letter <= 'z' && !array[letter - 'a'])\n {\n array[letter - 'a'] = true;\n counter++;\n }\n }\n\n Console.WriteLine(counter == 26 ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n string y = Console.ReadLine();\n\n string n = y.ToUpper();\n\n if ((n.Contains(\"A\") == true) && (n.Contains(\"B\") == true) && (n.Contains(\"C\") == true) && (n.Contains(\"D\") == true) \n && (n.Contains(\"E\") == true) && (n.Contains(\"F\") == true) && (n.Contains(\"G\") == true) && (n.Contains(\"H\") == true) \n && (n.Contains(\"I\") == true) && (n.Contains(\"J\") == true) && (n.Contains(\"K\") == true) && (n.Contains(\"L\") == true) \n && (n.Contains(\"M\") == true) && (n.Contains(\"N\") == true) && (n.Contains(\"O\") == true) && (n.Contains(\"P\") == true) \n && (n.Contains(\"Q\") == true) && (n.Contains(\"R\") == true) && (n.Contains(\"S\") == true) && (n.Contains(\"T\") == true) \n && (n.Contains(\"U\") == true) && (n.Contains(\"V\") == true) && (n.Contains(\"W\") == true) && (n.Contains(\"X\") == true) \n && (n.Contains(\"Y\") == true) && (n.Contains(\"Z\") == true))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint len = int.Parse(Console.ReadLine());\n\t\tstring str = Console.ReadLine();\n\t\tstr = str.ToLower();\n\t\t\n\t\tif(str.Length < 26)\n\t\t{\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(str.Contains(\"a\") && str.Contains(\"b\") && str.Contains(\"c\") && str.Contains(\"d\") && str.Contains(\"e\") && str.Contains(\"f\") && str.Contains(\"g\") && str.Contains(\"h\") && str.Contains(\"i\") \n\t\t&& str.Contains(\"j\") && str.Contains(\"k\") && str.Contains(\"l\") && str.Contains(\"m\") && str.Contains(\"n\") && str.Contains(\"o\") && str.Contains(\"p\") && str.Contains(\"q\") && str.Contains(\"r\") \n\t\t&& str.Contains(\"s\") && str.Contains(\"t\") && str.Contains(\"u\") && str.Contains(\"v\") && str.Contains(\"w\") && str.Contains(\"x\") && str.Contains(\"y\") && str.Contains(\"z\"))\n\t\t{\n\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace _520A\n{\n\tclass Program\n\t{\n\t\tstatic string c = \"abcdefghijklmnopqrstuvwxyz\";\n\t\tstatic bool Check(string s)\n\t\t{\n\t\t\tfor (int i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif (s.IndexOf(c[i]) == -1)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\t\t\ts = Console.ReadLine().ToLower();\n\t\t\tConsole.WriteLine(\"{0}\", Check(s) ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var text = Console.ReadLine();\n\n \n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var array = new bool[26];//'z' - 'a' + 1\n var counter = 0;\n for (var i = 0; i < n; i++)\n {\n var letter = char.ToLower(text[i]);\n if (letter >= 'a' && letter <= 'z' && !array[letter - 'a'])\n {\n array[letter - 'a'] = true;\n counter++;\n }\n }\n\n Console.WriteLine(counter == 26 ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n=int.Parse(Console.ReadLine());\n string word = Console.ReadLine();\n int[] alphabet = new int[26];\n if(n<26)\n Console.WriteLine(\"NO\");\n else\n {\n for (int i = 0; i < word.Length; i++)\n {\n alphabet[char.ToLower(word[i])-97]++;\n }\n int j = 0;\n while(j0)\n {\n j++;\n }\n if(j= 'a' && c_C <= 'z')\n arr_C[c_C - 'a']++;\n else\n arr_C[c_C - 'A']++;\n }\n for (int i = 0; i < 26; i++)\n {\n if (arr_C[i]==0)\n {\n io.PutStr(\"NO\");\n return;\n }\n }\n io.PutStr(\"YES\");\n }\n }\n\n\n\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public long ReadNextLong()\n {\n return long.Parse(ReadToken());\n }\n\n public int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public long[] ReadLongArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => long.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(double str)\n {\n Console.WriteLine(str);\n }\n\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Threading;\n\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n \n var n = Console.ReadLine();\n var s = Console.ReadLine().ToLower();\n\n var alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n //if all alphabet occours in s\n foreach (var c in s)\n if (alphabet.Contains(c))\n alphabet = alphabet.Remove(alphabet.IndexOf(c), 1);\n\n if(alphabet.Length == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n String s = Console.ReadLine().ToLower();\n for(int i = 97; i <= 122; i++)\n {\n if (!s.Contains((char)i))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n if (s.Contains('a') && s.Contains('b') && s.Contains('c') && s.Contains('d') && s.Contains('e') && s.Contains('h') && s.Contains('i') && s.Contains('j') && s.Contains('k') && s.Contains('l') && s.Contains('m') && s.Contains('n') && s.Contains('o') && s.Contains('p') && s.Contains('q') && s.Contains('r') && s.Contains('s') && s.Contains('t') && s.Contains('u') && s.Contains('v') && s.Contains('w') && s.Contains('x') && s.Contains('y') && s.Contains('z') && s.Contains('f') && s.Contains('g'))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication46\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().ToLower().Distinct().ToArray();\n \n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n if (a.Length < 26)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n if(a.Length>=26)\n {\n {\n Console.WriteLine(\"YES\");\n Environment.Exit(0);\n }\n }\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public static class Algr\n {\n public static string Solve(string input)\n {\n return input.ToLower().ToCharArray().Distinct().Count() == 26 ? \"YES\" : \"NO\";\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(Algr.Solve(Console.ReadLine()));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n \nnamespace prueba\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string s = Console.ReadLine().ToUpper();\n HashSet hs = new HashSet();\n foreach(Char c in s.ToCharArray())\n hs.Add(c);\n Console.Write(\"{0}\", hs.Count == 26?\"YES\":\"NO\");\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp3\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tstring s = Console.ReadLine();\n\n\t\t\tint [] counts = new int[26];\n\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tint index = s[i] - 'A';\n\t\t\t\tif (index >= 32)\n\t\t\t\t{\n\t\t\t\t\tindex-=32;\n\t\t\t\t}\n\n\t\t\t\tcounts[index]++;\n\t\t\t}\n\n\t\t\tbool flag = true;\n\t\t\tfor (int i = 0; i < counts.Length; i++)\n\t\t\t{\n\t\t\t\tif (counts[i] == 0)\n\t\t\t\t{\n\t\t\t\t\tflag = false;\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (flag)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n var n = RInt();\n var str = RLine().ToLower();\n\n if (n < 26)\n {\n WLine(\"NO\");\n return;\n }\n var all = \"thequickbrownfxjmpsvlazydg\";\n\n for (int i = 0; i< all.Length;i++)\n {\n if (!str.Contains(all[i]))\n {\n WLine(\"NO\");\n return;\n }\n }\n WLine(\"YES\");\n\n }\n\n private static int RoundUpDiv(int a, int n)\n {\n return (a + n - 1) / n;\n }\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n static void RLongs(out long a, out long b)\n {\n var ints = Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt64(s));\n a = ints[0];\n b = ints[1];\n }\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries)[1];\n if (input.Length < 26) Console.WriteLine(\"NO\");\n else\n {\n int[] alphabet = new int[27];\n for(int i = 0, crr; i 0)\n alphabet[26]++;\n\n Console.WriteLine(alphabet[26] == 26 ? \"YES\" : \"NO\");\n }\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nclass Progrm\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Console.ReadLine().ToLower().Distinct().Count()==26?\"YES\":\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n class Program\n {\n static void Main(string[] args) \n {\n int num = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n string res = \"\";\n str = str.ToLower();\n string answer = new String(str.Distinct().ToArray());\n\n\n \n string result = answer.Length == 26 ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n String sentence = Console.ReadLine();\n String sub = sentence.Substring(0, n);\n\n String filter = sub.ToUpper();\n\n\n int k = filter.Distinct().Count();\n\n if (k == 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace mainnm\n{\n class main\n {\n static void Main()\n {\n int n = Int32.Parse(Console.ReadLine());\n //int[] a = Console.ReadLine().Split(' ').Select(num => Int32.Parse(num)).ToArray();\n \n string s = Console.ReadLine();\n \n Console.WriteLine(s.ToLower().Distinct().Count() == 26 ? \"YES\" : \"NO\");\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Pangram\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n reader.ReadLine();\n string s = reader.ReadLine();\n\n var nn = new int[127];\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] <= 'Z')\n {\n nn[s[i] - 'A'] = 1;\n }\n else\n {\n nn[s[i] - 'a'] = 1;\n }\n }\n int sum = nn.Sum();\n\n writer.WriteLine(\"{0}\", sum == 26 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Task_A\n{\n class Program\n {\n static string ChangeCase(string s)\n {\n string t = null;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] >= 97)\n t += Convert.ToChar(s[i] - 32);\n else\n t += Convert.ToChar(s[i]);\n }\n\n return t;\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string s = Console.ReadLine();\n\n s = ChangeCase(s);\n\n int[] a = new int[26];\n\n bool f = true;\n\n for (int i = 0; i < n; i++)\n {\n a[s[i] - 65]++;\n }\n\n for (int i = 0; i < 26; i++)\n {\n if (a[i] == 0)\n {\n f = false; break;\n }\n }\n\n if (f)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Number520A {\n class Program {\n static void Main(string[] args) {\n Console.ReadLine();\n var line = Console.ReadLine().ToLower();\n Boolean[] mas = new Boolean[26];\n for(Int32 i = 0; i < line.Length; i++)\n mas[line[i] - 'a'] = true;\n Console.WriteLine(mas.Contains(false) ? \"NO\" : \"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n class Program\n {\n static void Main(string[] args) \n {\n int num = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n string res = \"\";\n str = str.ToLower();\n string answer = new String(str.Distinct().ToArray());\n\n\n \n string result = answer.Length == 26 ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _1A\n{\n class Program\n {\n static void Main()\n {\n Console.ReadLine();\n Console.WriteLine(Console.ReadLine().ToLower().GroupBy(c=>c).Count() == 26 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces_Proj\n{\n\tclass MainClass\n\t{\n\t\tstatic bool[] alpha = new bool[26];\n\n\t\tpublic static void Main(string[] args){\n\t\t\tint N = int.Parse(Console.ReadLine());\n\t\t\tstring str = Console.ReadLine().ToLower();\n\t\t\tforeach(char a in str){\n\t\t\t\talpha[a - 'a'] = true;\n\t\t\t}\n\t\t\tforeach (bool a in alpha)\n\t\t\t{\n\t\t\t\tif (!a)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t} \n\t\t\t}\n\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n int[] ar = new int[26];\n for (int i = 0; i < 26; i++)\n ar[i] = 0;\n for (int i = 0; i < s.Length; i++)\n ar[s[i] - 97]++;\n bool p = false;\n for (int i=0;i<26;i++)\n if (ar[i] == 0) { p = true; break; }\n if (p) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n class Program\n {\n static void Main(string[] args)\n {\n //int n = 0;\n //string day, month, year;\n //List> result = new List>();\n //string readLine = Console.ReadLine();\n //if (int.TryParse(readLine, out n))\n //{\n // for (int k = 0; k < n; k++)\n // {\n // string date = Console.ReadLine();\n // day = date.Substring(0, 2);\n // month = date.Substring(0, 2);\n // year = date.Substring(4, 4);\n // var dateM = new DateTime( int.Parse(year), int.Parse(month), int.Parse(day));\n // Console.WriteLine(dateM.Date.ToString());\n // dateM = dateM.AddDays(40 * 7);\n // if ((dateM.Day >= 21 && dateM.Day <= 31 && dateM.Month == 1) || (dateM.Day >= 1 && dateM.Day <= 19 && dateM.Month == 2))\n // result.Add(new Tuple(dateM, \"Aquarius\"));\n // if ((dateM.Day >= 20 && dateM.Day <= 29 && dateM.Month == 2) || (dateM.Day >= 1 && dateM.Day <= 20 && dateM.Month == 3))\n // result.Add(new Tuple(dateM, \"Pisces\"));\n // if ((dateM.Day >= 21 && dateM.Day <= 31 && dateM.Month == 1) || (dateM.Day >= 1 && dateM.Day <= 19 && dateM.Month == 2))\n // result.Add(new Tuple(dateM, \"Aries\"));\n\n\n // }\n //}\n Dictionary result = new Dictionary();\n int n = 0;\n string readLine = Console.ReadLine();\n if (int.TryParse(readLine, out n))\n {\n string word = Console.ReadLine();\n word = word.ToLower();\n for(int i=0; i < n; i++)\n {\n int value;\n if (result.TryGetValue(word[i], out value))\n {\n result[word[i]] = value + 1;\n } \n else\n {\n result.Add(word[i], 1);\n }\n }\n\n \n if (result.Count >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{ \n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n bool[] mark = new bool[26];\n str = str.ToLower();\n if(n>=26)\n {\n for (int i=0;i= 26) {\n\t\t\t\twhile (result != true) {\n\t\t\t\t\tishere = false;\n\t\t\t\t\tis_here = false;\n\t\t\t\t\tif (ishere != input.Contains(Convert.ToString (pangram [i])) || is_here != input.Contains(Convert.ToString (pangram [i + 26]))) {\n\t\t\t\t\t\tt += 1;\n\t\t\t\t\t\tif (t == 26) {\n\t\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ti += 1;\n\t\t\t\t\tif (i == 26 && t != 26) {\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n long len = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n List nums = new List();\n s = s.ToLower();\n if (s.Length < 26) Console.Write(\"NO\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (!nums.Contains((int)s[i])) nums.Add((int)s[i]);\n }\n if (nums.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nusing System.Windows;\nusing static System.Math;\nusing static System.Array;\nusing System.IO;\nusing System.Collections;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static int Main(string[] args)\n {\n int n = int.Parse(ReadLine());\n string s = ReadLine();\n char[] a = new char[s.Length];\n s = s.ToLower();\n int count = 1;\n for(int i = 0; i < s.Length; i++)\n {\n a[i] = s[i];\n }\n Sort(a, 0, a.Length);\n for(int i = 1; i < a.Length; i++)\n {\n if (a[i] != a[i - 1]) count++;\n }\n if (count == 26) Write(\"YES\");\n else Write(\"NO\");\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _520A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n < 26) Console.WriteLine(\"NO\");\n else \n {\n int[] letters = new int[26];\n char[] input = Console.ReadLine().ToLower().ToCharArray();\n foreach (char cur in input)\n {\n letters[cur - 'a']++;\n }\n bool isPangram = true;\n foreach (int cur in letters)\n {\n if (cur == 0) isPangram = false;\n }\n if (isPangram) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A520\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte n = Convert.ToByte(Console.ReadLine());\n string s = Console.ReadLine().ToLower();\n bool flag = false;\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n String[] res = new String[26];\n for (int i = 0; i < s.Length; i++)\n {\n res[s[i] - 'a']=Convert.ToString(s[i]);\n }\n\n for (int i = 0; i < res.Length; i++)\n {\n if (string.IsNullOrWhiteSpace(res[i]))\n {\n flag = true;\n break;\n }\n }\n if(flag)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n int []count = new int['z'+1];\n for(int i = 0; i < n; i++)\n {\n count[(int)s[i]] = 1;\n }\n bool b = true;\n for (char i = 'a'; i <= 'z'; i++)\n {\n if (count[i] == 0) { b = false; break; }\n }\n if (b) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n HashSet dic = new HashSet();\n foreach(char c in line)\n {\n if (!dic.Contains(char.ToLower(c)))\n {\n dic.Add(char.ToLower(c));\n }\n\n if(dic.Count == 26)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n Dictionary dic = new Dictionary();\n foreach(char c in line)\n {\n if (!dic.Keys.Contains(char.ToLower(c)))\n {\n dic[char.ToLower(c)] = true;\n }\n\n if(dic.Keys.Count == 26)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string input = Console.ReadLine().ToLower();\n for (char i = 'a'; i <= 'z'; i++)\n if (!input.Contains(i)) {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.Numerics;\nusing System.Threading;\nusing System.Diagnostics;\n\nnamespace StudyCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n char[] alphabet = new char[26];\n char symb;\n int num;\n bool result = true;\n\n for (int i = 0; i < n; i++)\n {\n num = Console.Read();\n num = symb = Char.ToUpper((char)num);\n alphabet[num - 65] = symb;\n }\n\n for (int i = 0; i < alphabet.Length; i++)\n if(alphabet[i] == 0)\n {\n result = false;\n break;\n }\n\n if (result == true)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Activities\n{\n class Program\n {\n static void Main(string[] args)\n {\n string wordLength = Console.ReadLine();\n string word = Console.ReadLine();\n int[] letterInts = new int[word.Length];\n bool allExists = true;\n\n int x = 0;\n foreach (char letter in word)\n {\n int letterToInt = Convert.ToInt32(letter);\n letterInts[x] = letterToInt;\n x++;\n }\n\n for (int capitalLetter = 65; capitalLetter <= 90 && allExists == true;)\n {\n for (int smallLetter = 97; smallLetter <= 122 && allExists == true; smallLetter++, capitalLetter++)\n {\n if (letterInts.Contains(capitalLetter) || letterInts.Contains(smallLetter))\n allExists = true;\n\n else\n allExists = false;\n }\n }\n\n if (allExists == true)\n Console.WriteLine(\"YES\");\n\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n List arr = \"qazwsxedcrfvtgbyhnujmiklop\".ToList();\n int num = int.Parse(Console.ReadLine());\n char[] arrs = Console.ReadLine().ToCharArray();\n int count = 26;\n if (num < 26)\n {\n Console.WriteLine(\"NO\");\n goto s;\n }\n else\n {\n for (int i = 0; i x) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n char[] alpha = Console.ReadLine().ToLower().ToCharArray();\n HashSet alpha2 = new HashSet(alpha);\n Console.WriteLine((alpha2.Count >= 26) ? \"YES\" : \"NO\");\n\n\n }\n }\n}"}, {"source_code": "// http://codeforces.com/problemset/problem/520/A?csrf_token=0d3284da0fa66845332cdc9f6af20b91\nusing System;\nusing System.Linq;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0438_CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n Console.WriteLine(26 == Console.ReadLine().ToLower().Distinct().Count() ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = Convert.ToInt32(Console.ReadLine());\n string word = Console.ReadLine().ToLower();\n int[] letters = new int[26];\n int index = 0;\n\n for (int i = 0; i < word.Length; i++)\n {\n index = word[i] - 'a';\n letters[index]++;\n }\n\n for (int i = 0; i < letters.Length; i++)\n {\n if (letters[i] == 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int nothing = int.Parse(Console.ReadLine());\n const int size = 26;\n string pangram = Console.ReadLine();\n bool[] Exsited = new bool[size];\n\n pangram = pangram.ToLower();\n for(int i = 0; i < pangram.Length; i++)\n {\n Exsited[pangram[i] - 'a'] = true;\n }\n\n bool state = true;\n for(int i = 0; i < size; i++)\n {\n if(Exsited[i] == false)\n {\n state = false;\n break;\n }\n }\n\n if (state)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _520A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int nnn = Convert.ToInt32(Console.ReadLine());\n char[] a = new char[26];\n string str = Console.ReadLine();\n str = str.ToLower();\n bool[] mem228 = new bool[26];\n for (int i = 0; i < 26; i++)\n {\n a[i] = Convert.ToChar(i+97);\n mem228[i] = false;\n }\n for (int i = 0; i < str.Length; i++)\n {\n for (int j = 0; j < 26; j++)\n {\n if (str[i] == a[j]) { mem228[j] = true; }\n }\n\n }\n bool ans = true;\n\n for (int i = 0; i < 26; i++)\n {\n if (!mem228[i]) { ans = false; };\n }\n if (ans) { Console.WriteLine(\"YES\"); } else { Console.WriteLine(\"NO\"); }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program {\n private static string alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n\n static void Main()\n {\n int count = int.Parse(Console.ReadLine());\n string text = Console.ReadLine();\n if (alphabet.All(text.ToLower().Contains))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var no = int.Parse(Console.ReadLine());\n var input = Console.ReadLine();\n Console.WriteLine(solve(input) ? \"YES\" : \"NO\");\n Console.ReadLine();\n }\n static bool solve(string input)\n {\n bool result = false;\n result = input.ToLower().Distinct().Count() == 26;\n\n return result;\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string input = Console.ReadLine();\n\t\n \tinput = input.ToLower();\n \t\n \tvar hs = new HashSet();\n \t\n \tfor(var i = 0; i < input.Length; i++) hs.Add(input[i].ToString());\n \t\n \tif(hs.Count == 26) Console.WriteLine(\"YES\");\n \t\n \telse Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Alrgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n CheckPangram();\n\n //Console.ReadKey();\n }\n\n private static void CheckPangram()\n {\n int inputLength = int.Parse(Console.ReadLine());\n string inputString = Console.ReadLine();\n\n HashSet set = new HashSet();\n\n foreach (var item in inputString.ToLower())\n set.Add(item);\n\n Console.WriteLine(set.Count == 26 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n string input = Console.ReadLine();\n\n bool[] marks = new bool[26];\n\n int index = 0;\n\n for(int i = 0; i < input.Length; i++)\n {\n if ('A' <= input[i] && input[i] <= 'Z')\n {\n index = input[i] - 'A';\n }\n else if('a' <= input[i] && input[i] <= 'z')\n {\n index = input[i] - 'a';\n }\n else\n {\n continue;\n }\n\n marks[index] = true;\n }\n\n bool isPangram = true;\n\n for(int i = 0; i < marks.Length; i++)\n {\n if(marks[i] == false)\n {\n isPangram = false;\n }\n }\n\n if (isPangram)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n//https://codeforces.com/problemset/problem/520/A\n\nnamespace Pangram\n{\n class Program\n {\n static bool CheckPangram(int length, string sentence)\n {\n char[] alphabets = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };\n List alphabetsList = new List(alphabets);\n if (sentence.Length > 25)\n {\n for (int i = 0; i < sentence.Length; i++)\n {\n char character = sentence[i];\n if (alphabetsList.Contains(character))\n {\n alphabetsList.Remove(character);\n }\n }\n if (alphabetsList.Count == 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n static bool ReducedCostPangram(string sentence)\n {\n int[] arr = new int[26];\n for (int i = 0; i < sentence.Length; i++)\n {\n arr[sentence[i] - 97]++;\n }\n bool isPangram = true;\n\n for (int i = 0; i < 26; i++)\n {\n if (arr[i] == 0)\n {\n isPangram = false;\n break;\n }\n }\n return isPangram;\n }\n static void Main(string[] args)\n {\n //Console.WriteLine(\"Enter Length of string: \");\n int length = int.Parse(Console.ReadLine());\n //Console.WriteLine(\"Enter Sentence: \");\n string sentence = Console.ReadLine().ToLower();\n if (ReducedCostPangram(sentence))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i < 26; i++,c++)\n {\n\n // Console.WriteLine(c);\n if (!(s.Contains(c.ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string abc = \"\";\n char a = 'a';\n bool ans = false;\n string s = Console.ReadLine().ToLower();\n while (a>='a'&&a<='z') { abc += a; a++; }\n for (int i = 0; i < abc.Length; i++)\n if (!s.Contains(abc[i].ToString()))\n { ans = true; break; }\n Console.WriteLine(ans ? \"NO\" : \"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint nr =Convert.ToInt32(Console.ReadLine());\n\t\t\tint k=0;\n\t\t\t\n\t\t\t\tstring n2 = Console.ReadLine();\n\t\t\tstring j = new string(n2.ToLower().Distinct().ToArray());\n\t\t\tif (j.Length == 26)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse Console.WriteLine(\"NO\");\n\n\t\t\n\n\t\t\t//Console.WriteLine(k);\n\n\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Pangram\n {\n static void Main(string[] args)\n {\n var alphab = \"azertyuiopqsdfghjklmwxcvbn\";\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine().ToLowerInvariant();\n bool t = true;\n\n foreach (char a in alphab)\n {\n if (!str.Contains(a.ToString()))\n {\n t = false;\n break;\n }\n }\n\n if (t == false)\n Console.WriteLine(\"NO\");\n else\n Console.Write(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main() {\n Console.ReadLine();\n string s = Console.ReadLine();\n s = s.ToLower();\n List L = new List();\n for (int i = 0; i < s.Length; i++) {\n if (!L.Contains(s[i]))\n L.Add(s[i]);\n }\n Console.WriteLine(L.Count >= ('z' - 'a' + 1) ? \"YES\" : \"NO\");\n }\n \n static int ReadNumber() {\n return int.Parse(Console.ReadLine());\n }\n\n static double[] ReadDoubleNumbers() {\n string s = Console.ReadLine();\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] output = new double[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = double.Parse(sa[i]);\n }\n return output;\n }\n\n static int[] ReadIntNumbers() {\n string s = Console.ReadLine();\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] output = new int[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = int.Parse(sa[i]);\n }\n return output;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace MyProgram\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n char[] t = s.ToCharArray();\n List bukvi = new List();\n for (int i = 0; i < n; i++)\n if (!bukvi.Contains(t[i]))\n bukvi.Add(t[i]); \n if (bukvi.Count == 26)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n string show = GetBestSolution(n, str);\n Console.WriteLine(show);\n }\n\n public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem520A {\n class Program {\n static void Main(string[] args) {\n int[] alphabet = new int[27];\n int charsInString = Convert.ToInt32(Console.ReadLine());\n string input = Console.ReadLine().ToLower(); //we don't distinguish between upper and lower case characters\n\n if (charsInString < 26) {\n Console.WriteLine(\"NO\");\n } else {\n char[] inputCharr = input.ToCharArray();\n bool pangram = isPangram(inputCharr, charsInString, alphabet);\n\n if (pangram) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n\n }\n\n private static bool isPangram(char[] inputCharr, int charsInString, int[] alphabet) {\n for (int i = 0; i < charsInString; i++) {\n int letter = (int)inputCharr[i] - 96;\n alphabet[letter]++;\n }\n\n bool pangram = true;\n for (int i = 1; i <= 26; i++) {\n int letterOccurance = alphabet[i];\n if (letterOccurance == 0) {\n pangram = false;\n break;\n }\n }\n\n return pangram;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n=int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n string[] arr = new string[n];\n for (int i = 0; i < n; i++) { arr[i] = s[i].ToString().ToUpper(); }\n Array.Sort(arr);\n string first = arr[0];\n int counter=1;\n for (int i = 0; i < n; i++)\n if (arr[i] != first) { counter++; first = arr[i]; }\n\n if (counter == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces520A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var @string = Console.ReadLine();\n Console.WriteLine(\"{0}\", IsPangram(@string) ? \"YES\" : \"NO\");\n }\n static bool IsPangram(string word)\n {\n var set = new HashSet(word.ToUpper());\n return set.Count == 26;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n s = s.ToLower();\n for (char c = 'a'; c <= 'z'; ++c)\n if (s.IndexOf(c) < 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ca520A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var input = Console.ReadLine();\n var answer = input.ToLower().Distinct().Count() == \"qwertyuiopasdfghjklzxcvbnm\".Length ? \"YES\" : \"NO\";\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n if (n<26)\n {\n WL(\"NO\");\n return;\n }\n String input = ReadString().ToLower(); ;\n bool[] check = new bool['z' - 'a' + 1];\n for (int i = 0; i < input.Length; i++) check[input[i] - 'a'] = true;\n for (int i = 0; i <= 'z' - 'a'; i++) if (!check[i])\n {\n WL(\"NO\");\n return;\n }\n WL(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string str = Console.ReadLine();\n \n if (str.ToLower().Contains(\"a\") && \n str.ToLower().Contains(\"b\") && \n str.ToLower().Contains(\"c\") && \n str.ToLower().Contains(\"d\") &&\n str.ToLower().Contains(\"e\") &&\n str.ToLower().Contains(\"f\") &&\n str.ToLower().Contains(\"g\") &&\n str.ToLower().Contains(\"h\") &&\n str.ToLower().Contains(\"i\") &&\n str.ToLower().Contains(\"j\") &&\n str.ToLower().Contains(\"k\") &&\n str.ToLower().Contains(\"l\") &&\n str.ToLower().Contains(\"m\") &&\n str.ToLower().Contains(\"n\") &&\n str.ToLower().Contains(\"o\") &&\n str.ToLower().Contains(\"p\") &&\n str.ToLower().Contains(\"q\") &&\n str.ToLower().Contains(\"r\") &&\n str.ToLower().Contains(\"s\") &&\n str.ToLower().Contains(\"t\") &&\n str.ToLower().Contains(\"u\") &&\n str.ToLower().Contains(\"v\") &&\n str.ToLower().Contains(\"w\") &&\n str.ToLower().Contains(\"x\") &&\n str.ToLower().Contains(\"y\") &&\n str.ToLower().Contains(\"z\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}\n"}, {"source_code": "\ufeffnamespace Prost\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToLower();\n\n int result = 0;\n\n for (int i = 0; i < count; i++)\n result |= 1 << (str[i] - 97);\n\n Console.WriteLine(result != 67108863 ? \"NO\" : \"YES\");\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = int.Parse(Console.ReadLine());\n var str = new StringBuilder(Console.ReadLine().ToLower());\n\n int result = 0;\n\n for (int i = 0; i < count; i++)\n result |= 1 << (str[i] - 97);\n\n Console.WriteLine(result != 67108863 ? \"NO\" : \"YES\");\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToLower();\n\n var cm = new char[26];\n var cmm = str.ToLower().ToCharArray();\n\n for (byte i = 97; i < 123; i++)\n {\n cm[i-97] = (char)i;\n }\n\n if (!cm.All(c => cmm.Contains(c)))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int size = Convert.ToInt32(Console.ReadLine());\n string pangram = Console.ReadLine();\n pangram = pangram.ToLower();\n string a = \"abcdefghijklmnopqrstuvwxyz\";\n char[] alphabet = a.ToCharArray();\n\n if (size < 24)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n for (int i = 0; i < pangram.Length; i++)\n {\n for (int j = 0; j < alphabet.Length; j++)\n {\n if (pangram[i] == alphabet[j])\n {\n alphabet[j] = 'X';\n break;\n }\n }\n }\n }\n\n for (int i = 0; i < alphabet.Length; i++)\n {\n if (alphabet[i] != 'X')\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n\n Console.WriteLine(\"YES\");\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool[] alpha_capital = new bool[26]; int count_capital = 0;\n bool[] alpha_small = new bool[26]; \n Console.ReadLine();\n string str = Console.ReadLine();\n if (str.Length < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n int x = (int)str[i];\n if (x <= 90)\n alpha_capital[Math.Abs(65 - x)] = true;\n else\n alpha_capital[Math.Abs(97 - x)] = true;\n }\n }\n\n for (int i = 0; i < alpha_capital.Length; i++)\n if (alpha_capital[i] == false)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n count_capital++;\n\n if (count_capital == 26) { Console.WriteLine(\"YES\"); return; }\n\n for (int i = 0; i < alpha_small.Length; i++)\n if (alpha_capital[i] == false)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Data.Sql;\nusing System.Collections;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n\n static void Main(string [] args)\n {\n bool [] Array = new bool [26];\n Console.ReadLine();\n string x = Console.ReadLine().ToLower();\n\n int index, count = 0;\n \n for (int i = 0; i letters = new Dictionary();\n for (int i = 0; i < temp.Length; i++)\n letters[temp[i].ToString().ToLower()[0]] = 1;\n if (letters.Count == 26)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace App\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int size = int.Parse(Console.ReadLine());\n String input = Console.ReadLine();\n input = input.ToLower();\n if(size<26)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n HashSet chars = new HashSet();\n foreach(char c in input)\n {\n chars.Add(c);\n \n }\n\n if (chars.Count == 26)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass A520 {\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n var a = new bool[26];\n foreach (var i in Console.ReadLine()) a[char.ToLower(i) - 'a'] = true;\n Console.WriteLine(a.All(k => k) ? \"YES\" : \"NO\");\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main()\n {\n byte n = Convert.ToByte(Console.ReadLine());\n string word = Console.ReadLine();\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n word = word.ToLower();\n for (int i = 97; i <= 122; i++)\n {\n if (!word.Contains((char)i))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Algorithm_Study_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int stringSize = int.Parse(Console.ReadLine());\n string inputString = Console.ReadLine();\n bool isPangram = true;\n\n inputString = inputString.ToLower();\n\n checkPangram(inputString, ref isPangram);\n\n if (isPangram)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n static void checkPangram(string content, ref bool isPangram)\n {\n for (int i = 0; i < 26; i++)\n {\n if (content.Contains((char) ('a' + (char) i)) == false)\n {\n isPangram = false;\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _520a\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var str = Console.ReadLine();\n var list = str.ToLower().ToCharArray().ToList();\n for (char c = 'a'; c <= 'z'; ++c)\n {\n if (!list.Contains(c))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] alph = new int[26];\n\n int numWord = Convert.ToInt32(Console.ReadLine());\n\n string words = Console.ReadLine();\n words = words.ToLower();\n for (int i = 0; i < numWord; i++)\n {\n alph[Convert.ToInt32(words[i])-97] = 1;\n }\n\n int counter = 0;\n\n for (int i = 0; i < alph.Length; i++)\n {\n counter++;\n\n\n if (alph[i] == 0)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n if (counter == alph.Length)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] alph = new int[26];\n\n int numWord = Convert.ToInt32(Console.ReadLine());\n\n string words = Console.ReadLine();\n words = words.ToLower();\n for (int i = 0; i < numWord; i++)\n {\n alph[Convert.ToInt32(words[i])-97] = 1;\n }\n\n int counter = 0;\n\n for (int i = 0; i < alph.Length; i++)\n {\n counter++;\n\n\n if (alph[i] == 0)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n Console.WriteLine(counter);\n if (counter == alph.Length)\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n bool[] marks = new bool[26];\n\n int index = 0;\n\n for(int i = 0; i < input.Length; i++)\n {\n if ('A' <= input[i] && input[i] <= 'Z')\n {\n index = input[i] - 'A';\n }\n else if('a' <= input[i] && input[i] <= 'z')\n {\n index = input[i] - 'a';\n }\n else\n {\n continue;\n }\n\n marks[index] = true;\n }\n\n bool isPangram = true;\n\n for(int i = 0; i < marks.Length; i++)\n {\n if(marks[i] == false)\n {\n isPangram = false;\n }\n }\n\n if (isPangram)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n//https://codeforces.com/problemset/problem/520/A\n\nnamespace Pangram\n{\n class Program\n {\n\n static bool CheckPangram(int length, string sentence)\n {\n char[] alphabets = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };\n List alphabetsList = new List(alphabets);\n if (sentence.Length > 25)\n {\n for(int i = 0; i < sentence.Length ; i++)\n {\n char character = sentence[i];\n if (alphabetsList.Contains(character))\n {\n alphabetsList.Remove(character);\n }\n }\n if(alphabetsList.Count == 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }\n static void Main(string[] args)\n {\n Console.WriteLine(\"Enter Length of string: \");\n int length = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Enter Sentence: \");\n string sentence = Console.ReadLine().ToLower();\n if (CheckPangram(length, sentence))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static int Main(string[] args)\n {\n int numOfAlpha = int.Parse(Console.ReadLine());\n byte[] m = new byte[numOfAlpha];\n for (int i = 0; i < numOfAlpha; i++)\n {\n m[i] = 0;\n }\n string s = Console.ReadLine().ToLower();\n if (s.Length < numOfAlpha)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n for (int i = 0, len = s.Length; i < len; i++)\n {\n int position = s[i] - 'a';\n try\n {\n m[position] = 1;\n }\n catch (IndexOutOfRangeException)\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n \n }\n if (Array.IndexOf(m, 0) == -1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n return 0;\n\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int numOfAlpha = int.Parse(Console.ReadLine());\n if (numOfAlpha < 26)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n byte[] m = new byte[26];\n for (int i = 0; i < 26; i++)\n {\n m[i] = 0;\n }\n string s = Console.ReadLine().ToLower();\n for (int i = 0; i < numOfAlpha; i++)\n {\n int position = s[i] - 'a';\n try\n {\n m[position] = 1;\n }\n catch (IndexOutOfRangeException)\n {\n Console.WriteLine(\"NO\");\n }\n }\n if (Array.IndexOf(m, 0) == -1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n \n \n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main() {\n string s = Console.ReadLine();\n s = s.ToLower();\n List L = new List();\n for (int i = 0; i < s.Length; i++) {\n if (!L.Contains(s[i]))\n L.Add(s[i]);\n }\n Console.WriteLine(L.Count >= ('z' - 'a' + 1) ? \"YES\" : \"NO\");\n }\n \n static int ReadNumber() {\n return int.Parse(Console.ReadLine());\n }\n\n static double[] ReadDoubleNumbers() {\n string s = Console.ReadLine();\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] output = new double[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = double.Parse(sa[i]);\n }\n return output;\n }\n\n static int[] ReadIntNumbers() {\n string s = Console.ReadLine();\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] output = new int[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = int.Parse(sa[i]);\n }\n return output;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleService\n{\n class Program\n {\n [STAThread]\n static void Main(string[] args)\n {\n var len = Console.ReadLine();\n string input = Console.ReadLine();\n List lst = new List();\n for (int i = 0; i < input.Length; i++)\n {\n var tmp = input[i];\n if (i == 0) { lst.Add(input[i]); }\n else\n {\n for (int j = 0; j < lst.Count; j++)\n {\n if (lst[j] == input[i] || (lst[j] >= 97 && (lst[j] - 32) == input[i])) break;\n if (j == lst.Count - 1)\n {\n lst.Add(input[i]);\n }\n }\n }\n }\n if (lst.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleService\n{\n class Program\n {\n [STAThread]\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List lst = new List();\n for (int i = 0; i < input.Length; i++)\n {\n var tmp = input[i];\n if (i == 0) { lst.Add(input[i]); }\n else\n {\n for (int j = 0; j < lst.Count; j++)\n {\n if (lst[j] == input[i] || (lst[j] >= 97 && (lst[j] - 32) == input[i])) break;\n if (j == lst.Count - 1)\n {\n lst.Add(input[i]);\n }\n }\n }\n }\n if (lst.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n class Program\n {\n static void Main(string[] args) \n {\n int num = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n string res = \"\";\n str = str.ToLower();\n string answer = new String(str.Distinct().ToArray());\n\n\n Console.WriteLine(answer);\n string result = answer.Length == 26 ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n \n\n }\n }\n"}, {"source_code": " using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \n class Program\n {\n static void Main(string[] args)\n {\n Dictionary result = new Dictionary();\n int n = 0;\n string readLine = Console.ReadLine();\n if (int.TryParse(readLine, out n))\n {\n string word = Console.ReadLine();\n word = word.ToLower();\n for(int i=0; i < n; i++)\n {\n int value;\n if (result.TryGetValue(word[i], out value))\n {\n result[word[i]] = value + 1;\n } \n else\n {\n result.Add(word[i], 1);\n }\n }\n\n var maxValue = result.Values.Max();\n if (maxValue > 1)\n {\n Console.WriteLine(\"NO\");\n }\n else\n Console.WriteLine(\"YES\");\n }\n\n }\n }"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n List nums = new List();\n s = s.ToLower();\n if (s.Length < 26) Console.Write(\"NO\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (!nums.Contains((int)s[i])) nums.Add((int)s[i]);\n }\n if (nums.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n List nums = new List();\n s = s.ToLower();\n if (s.Length < 26) Console.Write(\"NO\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (!nums.Contains((int)s[i] - 96)) nums.Add((int)s[i] - 96);\n }\n if (nums.Count == 26) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nusing System.Windows;\nusing static System.Math;\nusing static System.Array;\nusing System.IO;\nusing System.Collections;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static int Main(string[] args)\n {\n int n = int.Parse(ReadLine());\n string s = ReadLine();\n char[] a = new char[s.Length];\n s = s.ToLower();\n int count = 1;\n WriteLine($\"{s}\");\n for(int i = 0; i < s.Length; i++)\n {\n a[i] = s[i];\n }\n Sort(a, 0, a.Length);\n for(int i = 1; i < a.Length; i++)\n {\n if (a[i] != a[i - 1]) count++;\n }\n if (count == 26) Write(\"YES\");\n else Write(\"NO\");\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A520\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte n = Convert.ToByte(Console.ReadLine());\n string s = Console.ReadLine().ToLower();\n bool flag = false;\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n String[] res = new String[26];\n for (int i = 0; i < res.Length; i++)\n {\n res[s[i] - 'a']=Convert.ToString(s[i]);\n }\n\n for (int i = 0; i < res.Length; i++)\n {\n if (string.IsNullOrWhiteSpace(res[i]))\n {\n flag = true;\n break;\n }\n }\n if(flag)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n\n List arr = new List();\n int k = 0;\n str = str.ToLower();\n for (int i = 0; i < str.Length; i++)\n {\n if (arr.FirstOrDefault(a => a == str[i]) == 0)\n {\n arr.Add(str[i]);\n //Console.WriteLine(str[i]);\n }\n }\n\n if (arr.Count == 26)\n {\n Console.WriteLine(\"True\");\n }\n else\n {\n Console.WriteLine(\"false\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt16(Console.ReadLine());\n string s = Console.ReadLine();\n s= s.ToUpper();\n char[] arr = s.ToCharArray();\n\n Dictionary pangram = new Dictionary();\n for (int i = 0; i < arr.Length; i++)\n {\n if( pangram.ContainsKey(s[i]))\n {\n continue ;\n }\n else{\n if(s[i]=='P' || s[i]=='A' || s[i]=='N' || s[i]=='G'|| s[i]=='R' || s[i]=='M' )\n {\n pangram.Add(s[i],i);\n }\n }\n }\n if(pangram.Count>=6)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n \n\n /* int n1 = Convert.ToInt16(Console.ReadLine());\n int n2 = Convert.ToInt16(Console.ReadLine());\n Console.WriteLine(\"X = \" + (n1 + n2));\n Console.ReadKey();*/\n\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] y = Console.ReadLine().Split(' ');\n string sdf = Console.ReadLine();\n string k = Console.ReadLine();\n string alf = \"qwertyuiopasdfghjklzxcvbnm\";\n int[] l = new int[100];\n int y = 0;\n k = k.ToLower();\n for (int i = 0; i < k.Length; i++)\n {\n for (int j = 0; j < alf.Length; j++)\n {\n if (k[i] == alf[j])\n {\n l[i] = 1;\n }\n\n }\n }\n for (int i = 0; i < 26; i++)\n {\n y += l[i];\n }\n if (y >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] y = Console.ReadLine().Split(' ');\n string sdf = Console.ReadLine();\n string k = Console.ReadLine();\n string alf = \"qwertyuiopasdfghjklzxcvbnm\";\n int[] l = new int[100];\n int y = 0;\n k = k.ToLower();\n for (int i = 0; i < k.Length; i++)\n {\n for (int j = 0; j < alf.Length; j++)\n {\n if (k[i] == alf[j])\n {\n l[i] = 1;\n }\n\n }\n }\n for (int i = 0; i < 27; i++)\n {\n y += l[i];\n }\n if (y >= 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] y = Console.ReadLine().Split(' ');\n string sdf = Console.ReadLine();\n string k = Console.ReadLine();\n string alf = \"qwertyuiopasdfghjklzxcvbnm\";\n int[] l = new int[100];\n int y = 0;\n k = k.ToLower();\n for (int i = 0; i < k.Length; i++)\n {\n for (int j = 0; j < alf.Length; j++)\n {\n if (k[i] == alf[j])\n {\n l[i] = 1;\n }\n\n }\n }\n for (int i = 0; i < 27; i++)\n {\n y += l[i];\n }\n if (y == 26)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] y = Console.ReadLine().Split(' ');\n string sdf = Console.ReadLine();\n string k = Console.ReadLine();\n string alf = \"qwertyuiopasdfghjklzxcvbnm\";\n int[] l = new int[10000000];\n int y = 0;\n k = k.ToLower();\n for (int i = 0; i < k.Length; i++)\n {\n for (int j = 0; j < alf.Length; j++)\n {\n if (k[i] == alf[j])\n {\n l[i] = 1;\n }\n\n }\n }\n for (int i = 0; i < 27; i++)\n {\n y += l[i];\n }\n if (y == 27)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string[] y = Console.ReadLine().Split(' ');\n string sdf = Console.ReadLine();\n string k = Console.ReadLine();\n string alf = \"qwertyuiopasdfghjklzxcvbnm\";\n int[] l = new int[100];\n int y = 0;\n k = k.ToLower();\n for (int i = 0; i < k.Length; i++)\n {\n for (int j = 0; j < alf.Length; j++)\n {\n if (k[i] == alf[j])\n {\n l[i] = 1;\n }\n\n }\n }\n for (int i = 0; i < 27; i++)\n {\n y += l[i];\n }\n if (y >= 27)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_A\n{\n class Program\n {\n void _Do()\n {\n Console.ReadLine();\n var s = Console.ReadLine();\n\n if (s.ToLower() == s)\n Console.WriteLine(\"NO\");\n else if (s.ToUpper() == s)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n new Program()._Do();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_A\n{\n class Program\n {\n void _Do()\n {\n Console.ReadLine();\n var s = Console.ReadLine();\n\n if (s.ToLower() == s)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n\n static void Main(string[] args)\n {\n new Program()._Do();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n\n if (input % 2 == 0)\n {\n Console.WriteLine(8 + \" \" + (input - 8));\n }\n else\n {\n Console.WriteLine(9 + \" \" + (input - 9));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int amt = Convert.ToInt32(Console.ReadLine());\n string input = Console.ReadLine().ToUpper();\n\n if (amt >= 26)\n Console.WriteLine(IsPangram(input));\n else\n Console.WriteLine(\"NO\");\n }\n\n static string IsPangram(string s)\n {\n bool contains = false;\n for (int i = 'A'; i < 'Z'; i++)\n {\n foreach (char c in s)\n {\n if (c == i && !contains)\n {\n contains = true;\n break;\n }\n }\n\n if (!contains)\n return \"NO\";\n\n contains = false;\n }\n\n return \"YES\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vjudge\n{\n class Program\n {\n static void Main(string[] args)\n {\n Lable1:\n\n\n\n string str = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n char[] array = str.ToCharArray();\n\n\n\n string input = Console.ReadLine().ToUpper();\n char[] inputarray = input.ToCharArray();\n\n\n bool pangram = true;\n\n for (int i = 0; i < array.Length; i++)\n {\n\n bool exist = false;\n for(int j = 0; j < inputarray.Length; j++)\n {\n if(array[i] == inputarray[j])\n {\n exist = true;\n }\n }\n\n if(exist == false)\n {\n pangram = false;\n }\n\n }\n\n\n if(pangram)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n\n\n\n //Console.ReadLine();\n //goto Lable1;\n }\n\n \n }\n\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vjudge\n{\n class Program\n {\n static void Main(string[] args)\n {\n Lable1:\n\n // TheQuickBrownFoxJumpsOverTheLazyDog\n\n\n string str = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n char[] array = str.ToCharArray();\n\n\n\n string input = Console.ReadLine().ToUpper();\n char[] inputarray = input.ToCharArray();\n\n\n bool pangram = true;\n\n for (int i = 0; i < array.Length; i++)\n {\n\n bool exist = false;\n for(int j = 0; j < inputarray.Length; j++)\n {\n if(array[i] == inputarray[j])\n {\n exist = true;\n }\n }\n\n if(exist == false)\n {\n pangram = false;\n }\n\n }\n\n\n if(pangram)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n\n\n\n //Console.ReadLine();\n //goto Lable1;\n }\n\n \n }\n\n\n\n}\n"}, {"source_code": "using System;\n\nclass Solution\n{\n static void Main()\n {\n char[] alphabet = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };\n\n int n = int.Parse(Console.ReadLine());\n if (n >= 26)\n {\n string input = Console.ReadLine();\n int count = 0;\n char fromAlphabet;\n char fromInput;\n\n for (int i = 0; i < alphabet.Length; i++)\n {\n fromAlphabet = input[i];\n for (int j = 0; j < input.Length; j++)\n {\n fromInput = input[j];\n if (fromInput.ToString().ToUpper().Contains(fromAlphabet.ToString().ToUpper())) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }\n\n }\n}"}, {"source_code": "using System;\n\nclass Solution\n{\n static void Main()\n {\n char[] alphabet = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',\n 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };\n\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n int count = 0;\n\n if (input.Length >= 26)\n {\n for (int i = 0; i < alphabet.Length; i++)\n {\n for (int j = 0; j < input.Length; j++)\n {\n if (input[j].ToString().ToUpper().Contains(alphabet[i].ToString().ToUpper())) { count++; break; }\n }\n }\n if (count >= 26) { Console.WriteLine(\"YES\"); }\n }\n else { Console.WriteLine(\"NO\"); }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n IO io = new IO();\n\n int i_N = io.ReadNextInt();\n char c_C;\n int[] arr_C =new int[27];\n for (int i = 0; i < i_N; i++)\n {\n c_C = Convert.ToChar(Console.Read());\n if (c_C >= 'a' && c_C <= 'z')\n arr_C[c_C - 'a']++;\n else\n arr_C[c_C - 'A']++;\n }\n for (int i = 0; i < 26; i++)\n {\n if (arr_C[i]==0)\n {\n io.PutStr(\"NO\");\n }\n else\n {\n io.PutStr(\"YES\");\n }\n }\n }\n }\n\n\n\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public long ReadNextLong()\n {\n return long.Parse(ReadToken());\n }\n\n public int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public long[] ReadLongArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => long.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(double str)\n {\n Console.WriteLine(str);\n }\n\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var num = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n int temp = 0;\n string cloneStr = str.ToUpper();\n for (int i = 0; i < num; i++)\n {\n if (cloneStr[i] == str[i])\n {\n temp += 1;\n break;\n }\n }\n Console.WriteLine(temp>0?\"YES\":\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication46\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Distinct().ToString();\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n if (a.Length < 26)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n else\n {\n {\n Console.WriteLine(\"YES\");\n Environment.Exit(0);\n }\n }\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ContestApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberOfLetter = Convert.ToInt32(Console.ReadLine());\n string text = Console.ReadLine();\n\n\n if(numberOfLetter < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n bool IsContainAllLeter = true;\n char smallLetter = 'a';\n char bigLetter = 'A';\n for(int i=0; i<26;i++)\n {\n if(text.Contains(smallLetter) || text.Contains(bigLetter))\n {\n continue;\n }\n else\n {\n Console.WriteLine(\"NO\");\n IsContainAllLeter = false;\n break;\n }\n }\n\n if (IsContainAllLeter)\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram_Hackerrank\n{\n class Program\n {\n static int counterchar(char single, char[] collection, int collectionsize)\n {\n int num=0;\n for(int i=0;i list = new List();\n char x;\n for (int i = 0; i < n; i++)\n {\n //char r = char.Parse(Console.ReadLine().ToLower()); \n //another cast\n x = (char) Console.Read();\n if (x >= 'A' && x <= 'Z')\n {\n x = (char)(x - 'A' + 'a');\n }\n list.Add(x);\n }\n List distinct = list.Distinct().ToList();\n \n if (distinct.Count ==26)\n {\n Console.WriteLine(\"ok\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication31\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List list = new List();\n char x;\n for (int i = 0; i < n; i++)\n {\n x = (char) Console.Read();\n if (x >= 'A' && x <= 'Z')\n {\n x = (char)(x - 'A' + 'a');\n }\n list.Add(x);\n }\n List distinct = list.Distinct().ToList();\n\n if (distinct.Count ==26)\n {\n Console.WriteLine(\"ok\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Contest\n{\nclass MainClass{\n public static void Main (string[] args){\n int n=int.Parse(Console.ReadLine());\n if(n>=35)\n {\n string s=\"YES\";\n string num = Console.ReadLine().ToUpper();\n for (int i = 65; i <= 90; i++)\n { \n if (! num.Contains(Convert.ToString((char)i)) )\n {\n s=\"NO\"; \n break;\n }\n }\n Console.WriteLine(s);\n }\n else\n Console.WriteLine(\"NO\");\n }\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int len = int.Parse(Console.ReadLine());\n bool x = false;\n string words = Console.ReadLine();\n string word= words.ToLower();\n char [] alpha={'a','b','c','d','e','f','g','h','i','j','k','l','m','o','n','b','q','r','s','t','u','v','x','y','z'};\n for (int i = 0; i < alpha.Length; i++)\n\t\t\t{\n\t\t\t if (word.Contains(alpha[i]))\n {\n x = true;\n\n }\n else\n {\n x = false;\n break;\n }\n\t\t\t}\n if (x==false)\n {\n Console.Write(\"NO\");\n }\n else\n {\n Console.Write(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int len = int.Parse(Console.ReadLine());\n bool x = false;\n string words = Console.ReadLine();\n string word= words.ToLower();\n char [] alpha={'a','b','c','d','e','f','g','h','i','j','k','l','m','o','n','b','q','r','s','t','u','v','x','y','z'};\n if (len >= 28)\n {\n for (int i = 0; i < alpha.Length; i++)\n {\n if (word.Contains(alpha[i]))\n {\n x = true;\n\n }\n else\n {\n x = false;\n break;\n }\n }\n\n if (x == false)\n {\n Console.Write(\"NO\");\n }\n else\n {\n Console.Write(\"YES\");\n }\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int len = int.Parse(Console.ReadLine());\n bool x = false;\n string words = Console.ReadLine();\n string word= words.ToLower();\n char [] alpha={'a','b','c','d','e','f','g','h','i','j','k','l','m','o','n','p','q','r','s','t','u','v','x','y','z'};\n \n for (int i = 0; i < alpha.Length; i++)\n {\n if (word.Contains(alpha[i]))\n {\n x = true;\n\n }\n else\n {\n x = false;\n break;\n }\n \n if (x == false)\n {\n Console.Write(\"NO\");\n }\n else\n {\n Console.Write(\"YES\");\n }\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int len = int.Parse(Console.ReadLine());\n bool x = false;\n string words = Console.ReadLine();\n string word = words.ToLower();\n char[] alpha = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'o', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z' };\n for (int i = 0; i < alpha.Length; i++)\n {\n if (word.Contains(alpha[i]))\n {\n x = true;\n }\n else\n {\n x = false;\n break;\n }\n }\n if (x == false)\n {\n Console.Write(\"NO\");\n }\n else\n {\n Console.Write(\"YES\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string strWrd = Console.ReadLine().ToLower();\n List WrdChars = new List(strWrd.ToCharArray());\n WrdChars.Sort();\n char c = WrdChars[0];\n bool state = true;\n for (int i = 1; i < WrdChars.Count; i++)\n {\n if (c == WrdChars[i] || c == WrdChars[i] - 1)\n {\n c = WrdChars[i];\n continue;\n }\n else\n {\n state = false;\n break;\n }\n }\n if (state && c=='z')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string strWrd = Console.ReadLine().ToLower();\n List WrdChars = new List(strWrd.ToCharArray());\n WrdChars.Sort();\n if(WrdChars[WrdChars.Count-1] != 'z')\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string strWrd = Console.ReadLine().ToLower();\n List WrdChars = new List(strWrd.ToCharArray());\n WrdChars.Sort();\n char c = WrdChars[0];\n bool state = true;\n for (int i = 1; i < WrdChars.Count; i++)\n {\n if (c == WrdChars[i] || c == WrdChars[i] - 1)\n {\n c = WrdChars[i];\n continue;\n }\n else\n {\n state = false;\n break;\n }\n }\n if (state)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program {\n private static string alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n\n static void Main()\n {\n Console.WriteLine(\"Enter count of chars in text:\");\n int count = int.Parse(Console.ReadLine());\n Console.WriteLine(\"Enter text:\");\n string text = Console.ReadLine();\n if (alphabet.All(text.ToLower().Contains))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF06032015\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var res = Console.ReadLine().Select(x => char.ToLower(x));\n \n\n var alph = Enumerable.Range(0, 23).Select(x => x + 'a').Select(x=>res.Contains((char)x)).All(x=>x);\n Console.WriteLine(alph ? \"YES\" : \"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var notUsed = Console.ReadLine();\n var text = Console.ReadLine().ToUpperInvariant();\n\n var hash = new HashSet();\n foreach (var c in text)\n {\n hash.Add(c);\n }\n\n if(hash.Count == 21)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i <= 26; i++)\n { \n if(!(s.Contains(((char)c+i).ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i <= 26; i++)\n {\n\n Console.WriteLine((((char)c+i).ToString()));\n if (!(s.Contains(((char)c+i).ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"Yes\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i < 26; i++)\n { \n if(!(s.Contains(((char)c+i).ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n Console.WriteLine(ans);\n }\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i < 26; i++)\n { \n if(!(s.Contains(((char)c+i).ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i < 26; i++,c++)\n {\n\n Console.WriteLine(c);\n if (!(s.Contains(c.ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Pangram295\n {\n public static void Main()\n {\n int i = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string ans = \"NO\";\n\n if (Panagram(s))\n {\n ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n\n public static bool Panagram(string s)\n {\n if (s.Length < 26)\n {\n return false;\n }\n\n s = s.ToLower();\n char c = 'a';\n for (int i = 0; i <= 26; i++)\n {\n\n Console.WriteLine(((char)(c+i)).ToString());\n if (!(s.Contains(((char)c+i).ToString())))\n {\n return false;\n }\n }\n\n return true; \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string show = GetBestSolution(35, \"TheQuickBrownFoxJumpsOverTheLazyDog\");\n Console.WriteLine(show);\n }\n\n public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string show = GetBestSolution(12, \"toosmallword\");\n Console.WriteLine(show);\n }\n\n public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string show = GetBestSolution(35, \"TheQuickBrownFoxJumpsOverTheLazyDog\");\n Console.WriteLine(show);\n }\n\n public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"Yes\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string show = GetBestSolution(12, \"toosmallword\");\n Console.WriteLine(show);\n }\n\n public static string GetBestSolution(int n, string str)\n {\n if (n < 26)\n {\n return \"NO\";\n }\n char[] letters = new char[n];\n\n letters = str.ToLower().ToCharArray();\n List charCount = new List();\n for (int i = 0; i < n; i++)\n {\n if (!charCount.Contains(letters[i]))\n {\n charCount.Add(letters[i]);\n }\n\n }\n\n\n return charCount.Count == 26 ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces520A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n var @string = Console.ReadLine();\n Console.WriteLine(\"The string is {0}a pangram.\", IsPangram(@string) ? \"\" : \"not \");\n }\n static bool IsPangram(string word)\n {\n var set = new HashSet(word.ToUpper());\n return set.Count == 26;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n\n class Program\n {\n\n static void Main(string[] args)\n {\n var str = Console.ReadLine().ToLower();\n\n if (str.ToArray().Distinct().Count() == 26)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace aaa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str;\n string a;\n a = Console.ReadLine();\n \n str = Console.ReadLine();\n str = str.ToLower();\n bool[] array = new bool[26];\n int i=0,z=Convert.ToInt16(a);\n while (i < z) \n {\n array[str[i] - 97] = true;\n i++;\n }\n i = 0;\n while (i < 26)\n {\n if (array[i] == false)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n i++;\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Baitapcoban\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n\n int result = 0;\n\n string lowerinput = input.ToLower();\n\n int[] key = new int[26];\n\n if (n < 26)\n {\n Console.WriteLine(\"NO\");\n }\n\n else\n {\n for (int i = 0; i < n; i++)\n {\n key[lowerinput[i] - 'a']++;\n //Console.Write(key[i] + \" \");\n }\n \n for (int i = 0; i < 26; i++)\n {\n if (key[i] != 0)\n {\n result++;\n }\n //else Console.WriteLine(\"NO\");\n //Console.Write(key[i] + \" \");\n }\n }\n if (result == 26)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n //Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string str = Console.ReadLine();\n \n if (str.ToLower().Contains(\"a\") && \n str.ToLower().Contains(\"b\") && \n str.ToLower().Contains(\"c\") && \n str.ToLower().Contains(\"d\") &&\n str.ToLower().Contains(\"e\") &&\n str.ToLower().Contains(\"f\") &&\n str.ToLower().Contains(\"j\") &&\n str.ToLower().Contains(\"h\") &&\n str.ToLower().Contains(\"i\") &&\n str.ToLower().Contains(\"j\") &&\n str.ToLower().Contains(\"k\") &&\n str.ToLower().Contains(\"l\") &&\n str.ToLower().Contains(\"m\") &&\n str.ToLower().Contains(\"n\") &&\n str.ToLower().Contains(\"o\") &&\n str.ToLower().Contains(\"p\") &&\n str.ToLower().Contains(\"q\") &&\n str.ToLower().Contains(\"r\") &&\n str.ToLower().Contains(\"s\") &&\n str.ToLower().Contains(\"t\") &&\n str.ToLower().Contains(\"u\") &&\n str.ToLower().Contains(\"v\") &&\n str.ToLower().Contains(\"w\") &&\n str.ToLower().Contains(\"x\") &&\n str.ToLower().Contains(\"y\") &&\n str.ToLower().Contains(\"z\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint len = int.Parse(Console.ReadLine());\n\t\tstring str = Console.ReadLine();\n\t\tstr = str.ToLower();\n\t\t\n\t\tif(str.Contains(\"p\") && str.Contains(\"a\") && str.Contains(\"n\") && str.Contains(\"g\") && str.Contains(\"r\") && str.Contains(\"a\") && str.Contains(\"m\"))\n\t\t{\n\t\t\tConsole.WriteLine(\"YES\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n public static void Main(string[] args)\n {\n bool result = false;\n\n int n = GetInput(int.Parse);\n if (n >= 26)\n {\n string str = Console.ReadLine();\n HashSet set = new HashSet();\n str.ToLower().Select(x => set.Add(x));\n if (set.Count == 26)\n {\n result = true;\n }\n }\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n\n private static T GetInput(Func convertor)\n {\n return convertor(Console.ReadLine());\n }\n\n private static IEnumerable GetInputs(Func convertor, params char[] splitter)\n {\n return Console.ReadLine().Split(splitter).Select(x => convertor(x));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n public static void Main(string[] args)\n {\n bool result = false;\n\n int n = GetInput(int.Parse);\n if (n >= 24)\n {\n string str = Console.ReadLine();\n HashSet set = new HashSet();\n str.ToLower().Select(x => set.Add(x));\n if (set.Count == 24)\n {\n result = true;\n }\n }\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n\n private static T GetInput(Func convertor)\n {\n return convertor(Console.ReadLine());\n }\n\n private static IEnumerable GetInputs(Func convertor, params char[] splitter)\n {\n return Console.ReadLine().Split(splitter).Select(x => convertor(x));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool isPangram = true;\n\n for (char c = 'A'; c <= 'Z'; c++)\n {\n if (!input.Contains(c.ToString()) && !input.Contains(((char)(c + 32)).ToString())) isPangram = false;\n }\n\n if (isPangram) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace SampleProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine().ToLower();\n bool sucess = CheckIfPanagram(str.ToLower());\n Console.WriteLine(sucess ? \"YES\" : \"NO\");\n }\n\n private static bool CheckIfPanagram(string str)\n { \n var data = new Dictionary\n {\n { 'a', false },\n { 'b', false },\n { 'c', false },\n { 'd', false },\n { 'e', false },\n { 'f', false },\n { 'g', false },\n { 'h', false },\n { 'i', false },\n { 'j', false },\n { 'k', false },\n { 'l', false },\n { 'm', false },\n { 'n', false },\n { 'o', false },\n { 'p', false },\n { 'q', false },\n { 'r', false },\n { 's', false },\n { 't', false },\n { 'u', false },\n { 'v', false },\n { 'w', false },\n { 'x', false },\n { 'y', false },\n { 'z', false } \n };\n\n foreach (var c in str)\n { \n data[c] = true; \n }\n var notPanagram = !data.Any(item => item.Value == false);\n return notPanagram;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass program\n{ \n static int Main()\n {\n int n=int.Parse(Console.ReadLine());\n string word = Console.ReadLine();\n int[] alphabet = new int[26];\n if(n<27)\n Console.WriteLine(\"NO\");\n else\n {\n for (int i = 0; i < word.Length; i++)\n {\n alphabet[char.ToLower(word[i])-97]++;\n }\n int j = 0;\n while(j0)\n {\n j++;\n }\n if(j x = new HashSet();\n\t\t\tfor (int i = 0; i < str.Length; i++)\n\t\t\t{\n\t\t\t\tx.Add(str[i]);\n\t\t\t}\n\t\t\tif(x.Count == 26)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse Console.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp6\n{\n\tclass Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring str = Console.ReadLine().ToLower().Trim();\n\t\t\tHashSet x = new HashSet();\n\t\t\tfor (int i = 0; i < str.Length; i++)\n\t\t\t{\n\t\t\t\tx.Add(str[i]);\n\t\t\t}\n\t\t\tif(x.Count == 26)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse Console.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Num = Convert.ToInt32(Console.ReadLine());\n string Text = Console.ReadLine();\n\n string Tx = \"\";\n\n for(int i = 65; i <= 95; i++)\n {\n Tx = Tx + (char)i;\n }\n\n for(int i = 0; i < Text.Length; i++)\n {\n for(int j = 0; j < Tx.Length; j++)\n {\n if(char.ToUpper(Text[i]) == Tx[j])\n {\n Tx = Tx.Remove(j, 1);\n }\n }\n }\n\n Console.Write(Tx.Length > 0 ? \"No\" : \"Yes\"); \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Num = Convert.ToInt32(Console.ReadLine());\n string Text = Console.ReadLine();\n\n string Tx = null;\n\n for(int i = 65; i <= 95; i++)\n {\n Tx = Tx + (char)i;\n }\n\n for(int i = 0; i < Text.Length; i++)\n {\n for(int j = 0; j < Tx.Length; j++)\n {\n if(Text[i] == Tx[j])\n {\n Tx = Tx.Remove(j);\n }\n }\n }\n\n Console.Write(Tx.Length > 0 ? \"No\" : \"Yes\"); \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Text = Console.ReadLine();\n List Array = new List();\n\n\n Array = Enumerable.Range(65, 26).Select(x => (char)x).ToList();\n\n int s = 0;\n for (int i = 0; i < Text.Length; i++)\n {\n int Ind = Array.IndexOf(char.ToUpper(Text[i]));\n if (Ind != -1)\n {\n Array.RemoveAt(Ind);\n }\n }\n \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Num = Convert.ToInt32(Console.ReadLine());\n string Text = Console.ReadLine();\n\n string Tx = null;\n\n for(int i = 65; i <= 95; i++)\n {\n Tx = Tx + (char)i;\n }\n\n for(int i = 0; i < Text.Length; i++)\n {\n for(int j = 0; j < Tx.Length; j++)\n {\n if(Text[i] == Tx[j])\n {\n Tx = Tx.Remove(j, 0);\n }\n }\n }\n\n Console.Write(Tx.Length > 0 ? \"No\" : \"Yes\"); \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Num = Convert.ToInt32(Console.ReadLine());\n string Text = Console.ReadLine();\n\n string Tx = \"\";\n\n for(int i = 65; i <= 95; i++)\n {\n Tx = Tx + (char)i;\n }\n\n for(int i = 0; i < Text.Length; i++)\n {\n for(int j = 0; j < Tx.Length; j++)\n {\n if(Text[i] == char.ToUpper(Tx[j]))\n {\n Tx = Tx.Remove(j, 0);\n }\n }\n }\n\n Console.Write(Tx.Length > 0 ? \"No\" : \"Yes\"); \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Num = Convert.ToInt32(Console.ReadLine());\n string Text = Console.ReadLine();\n\n string Tx = \"\";\n\n for(int i = 65; i <= 95; i++)\n {\n Tx = Tx + (char)i;\n }\n\n for(int i = 0; i < Text.Length; i++)\n {\n for(int j = 0; j < Tx.Length; j++)\n {\n if(char.ToUpper(Text[i]) == Tx[j])\n {\n Tx = Tx.Remove(j, 0);\n }\n }\n }\n\n Console.Write(Tx.Length > 0 ? \"No\" : \"Yes\"); \n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication7\n{\n class NumberReader\n {\n\n private char readChar()\n {\n return (char)Console.In.Read();\n }\n\n private char peekChar()\n {\n return (char)Console.In.Peek();\n }\n\n private void skipWhiteSpaces()\n {\n while (Char.IsWhiteSpace(peekChar()))\n readChar();\n }\n\n public bool SeekEOF()\n {\n skipWhiteSpaces();\n return EOF();\n }\n\n public bool EOF()\n {\n if (Console.In.Read() != -1) return true;\n else return false;\n }\n\n public long ReadInt()\n {\n skipWhiteSpaces();\n long n = readChar();\n bool sign = false;\n\n if ((char)n == '-') sign = true;\n if (sign) n = 0;\n else n = (char)n - '0';\n while (!Char.IsWhiteSpace(peekChar()))\n {\n n = n * 10 + ((char)readChar() - '0');\n\n }\n if (sign) n = n * -1;\n return n;\n }\n\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n \n string s = Console.ReadLine();\n long number=0;\n \n for (int i = 0; i < s.Length; i++)\n { \n if (!Char.IsWhiteSpace(s[i]))\n number = 10 * number+s[i]-'0';\n }\n\n s = Console.ReadLine();\n\n \n long alfa = s.Length;\n\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = 0; j < i; j++)\n {\n if (s[i] == s[j])\n {\n alfa--;\n break;\n }\n \n\n\n\n }\n }\n\n\n\n\n if (alfa > 25) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint amt = Convert.ToInt32 (Console.ReadLine ());\n\t\t\tstring input = Console.ReadLine ();\n\t\t\tstring[] pangram = new string[26] { \"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\", \"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\" };\n\t\t\tstring[] large_pangram = new string[26] { \"Q\", \"W\", \"E\", \"R\", \"T\", \"Y\", \"U\", \"I\", \"O\", \"P\", \"A\", \"S\", \"D\", \"F\", \"G\", \"H\", \"J\", \"K\", \"L\", \"Z\", \"X\", \"C\", \"V\", \"B\", \"N\", \"M\" };\n\t\t\tbool ishere, is_here, result = false;\n\t\t\tint t = 0, i = 0;\n\t\t\n\t\t\tif (amt >= 26) {\n\t\t\t\twhile (result != true) {\n\t\t\t\t\tishere = false;\n\t\t\t\t\tis_here = false;\n\t\t\t\t\tif (ishere != input.Contains(pangram [i]) || is_here != input.Contains(large_pangram [i])) {\n\t\t\t\t\t\tt += 1;\n\t\t\t\t\t\tif (t == 25) {\n\t\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ti += 1;\n\t\t\t\t\tif (i == 25 && t != 25) {\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace practice\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n int []count = new int[n + 1];\n while (n + 1 > 0) { count[n] = 0;n--; }\n for(int i = 0; i < n; i++)\n {\n count[s[i] - 97]++;\n }\n bool b = true;\n for (int i = 0; i < n; i++)\n {\n if (count[i] == 0) { b = false; break; }\n }\n if (b) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n \n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForcecTrain\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputChar = \"abcdefghijklmnopqrstuvwxyz\".ToCharArray().ToList();\n var input = Console.ReadLine().ToLower();\n if (inputChar.All(x => input.Contains(x)))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Activities\n{\n class Program\n {\n static void Main(string[] args)\n {\n string wordLength = Console.ReadLine();\n string word = Console.ReadLine();\n int[] letterInts = new int[word.Length];\n bool allExists = true;\n\n int x = 0;\n foreach (char letter in word)\n {\n int letterToInt = Convert.ToInt32(letter);\n letterInts[x] = letterToInt;\n x++;\n }\n\n for (int capitalLetter = 65; capitalLetter <= 90;)\n {\n for (int smallLetter = 97; smallLetter <= 122; smallLetter++, capitalLetter++)\n {\n if (letterInts.Contains(capitalLetter) || letterInts.Contains(smallLetter))\n allExists = true;\n\n else\n {\n allExists = false;\n continue;\n }\n }\n }\n\n if (allExists == true)\n Console.WriteLine(\"YES\");\n\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n char[] alpha = Console.ReadLine().ToCharArray();\n HashSet alpha2 = new HashSet(alpha);\n Console.WriteLine((alpha2.Count >= 26) ? \"YES\" : \"NO\");\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n char[] alpha = Console.ReadLine().ToLower().ToCharArray();\n HashSet alpha2 = new HashSet(alpha);\n Console.WriteLine((alpha2.Count >= 24) ? \"YES\" : \"NO\");\n\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool isp = true;\n char asc = 'a';\n int[] a = new int[26];\n int len = Convert.ToInt32(Console.ReadLine());\n string txt = Console.ReadLine();\n char[] ch = txt.ToCharArray(0, len);\n for (int i = 97; i < 123; i++)\n {\n \n a[i-97] = asc;\n asc++;\n }\n\n for (int i = 0; i < ch.Length; i++)\n {\n for (int j = 0; j < a.Length; j++)\n {\n if (ch[i] == a[j])\n {\n a[j] = 0;\n break;\n }\n }\n }\n\n for (int i = 0; i < a.Length; i++)\n if (a[i] != 0)\n {\n isp = false;\n break;\n }\n else\n isp = true;\n if (isp)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n for (char c = 'a'; c < 'z'; ++c)\n if (s.IndexOf(char.ToLower(c)) < 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = \"qwertyuiopasdfghjkl\";//Console.ReadLine();\n for (char c = 'a'; c < 'z'; ++c)\n if (s.IndexOf(char.ToLower(c)) < 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n s = s.ToLower();\n for (char c = 'a'; c < 'z'; ++c)\n if (s.IndexOf(c) < 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n for (char c = 'a'; c < 'z'; ++c)\n if (s.IndexOf(char.ToLower(c)) == 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n for (char c = 'a'; c <= 'z'; ++c)\n if (s.IndexOf(char.ToLower(c)) == 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n for (char c = 'a'; c < 'z'; ++c)\n if (s.IndexOf(char.ToLower(c)) == 0)\n {\n Console.WriteLine(\"NO\");\n Environment.Exit(0);\n }\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToLower();\n\n if(count < 25)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n var cm = new char[25];\n var cmm = str.ToCharArray();\n\n for (byte i = 97; i < 123; i++)\n {\n cm[i-97] = (char)i;\n }\n\n if (!cm.All(c => cmm.Contains(c)))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToLower();\n\n var cm = new bool[26];\n\n for (int i = 0; i < str.Length; i++)\n {\n cm[(byte)str[i]] = true;\n }\n\n if (!cm.All(c => c))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = \"TheQuickBrownFoxJumpsOverTheLazyDog\";// Console.ReadLine().ToLower();\n\n var cm = new char[26];\n var cmm = str.ToLower().ToCharArray();\n\n for (byte i = 97; i < 123; i++)\n {\n cm[i-97] = (char)i;\n }\n\n if (!cm.All(c => cmm.Contains(c)))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = Console.ReadLine().ToLower();\n\n var cm = new char[25];\n var cmm = str.ToCharArray();\n\n for (byte i = 97; i < 123; i++)\n {\n cm[i-97] = (char)i;\n }\n\n if (!cm.All(c => cmm.Contains(c)))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prost\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n var count = int.Parse(Console.ReadLine());\n var str = \"TheQuickBrownFoxJumpsOverTheLazyDog\";// Console.ReadLine().ToLower();\n\n var cm = new char[26];\n var cmm = str.ToCharArray();\n\n for (byte i = 97; i < 123; i++)\n {\n cm[i-97] = (char)i;\n }\n\n if (!cm.All(c => cmm.Contains(c)))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n catch\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Pangram\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool[] alpha_capital = new bool[26];\n bool[] alpha_small = new bool[26];\n Console.ReadLine();\n string str = Console.ReadLine();\n if (str.Length < 26)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n int x = (int)str[i];\n if (x < 90)\n alpha_capital[Math.Abs(65 - x)] = true;\n else\n alpha_capital[Math.Abs(97 - x)] = true;\n }\n }\n for(int i=0;i N)\n continue;\n\n int m = (N - B) / 9 + 1;\n int k = N - A * B < 0 ? 0 : (N - A * B) / (9 * A) + 1;\n int d = A * B % 9 == 0 ? 9 : A * B % 9;\n int x = N - d < 0 ? 0 : (N - d) / 9 + 1;\n S += (long)m * x - k;\n }\n }\n\n Console.WriteLine(S);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round10\n{\n class C\n {\n public static long d(long x)\n {\n return x % 9;\n }\n\n public static void Main()\n {\n long n = long.Parse(Console.ReadLine());\n long ret = 0;\n long[] x = new long[9];\n for (int i = 1; i <= n; i++)\n {\n x[d(i)]++;\n }\n for (int a = 0; a < 9; a++)\n {\n for (int b = 0; b < 9; b++)\n {\n ret += x[a] * x[b] * x[d(a * b)];\n //Console.WriteLine(\"{0},{1},{2}:{3}\", a, b, d(a * b), x[a] * x[b] * x[d(a * b)]);\n }\n }\n //Console.WriteLine(ret);\n for (long i = 1; i <= n; i++)\n {\n //ret -= n / i + (n % i == 0 ? 0 : 1);\n ret -= n / i;\n }\n Console.WriteLine(ret);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Solution {\n\n static int n;\n static int[] c;\n static int[] f;\n \n static int calc(int x) {\n if(x < 10) return x;\n else {\n int s = 0 ;\n while(x > 0) {\n s += x % 10;\n x /= 10;\n }\n return calc(s);\n }\n }\n \n public static void Main() {\n n = int.Parse(Console.ReadLine());\n c = new int[10];\n f = new int[1000];\n for(int i=1;i<1000;++i) f[i] = calc(i);\n for(int i=1;i<=n;++i) {\n int z = 0;\n if(i < 1000) z = f[i];\n else {\n int s = 0;\n int x = i;\n while(x > 0) {\n s += x % 10;\n x /= 10;\n }\n z = f[s];\n }\n ++c[z];\n }\n long res = 0;\n for(int i=1;i<10;++i) \n for(int j=1;j<10;++j) {\n res += (long)c[i] * c[j] * c[f[i*j]];\n }\n for(int i=1;i<=n;++i) {\n for(int j=1;i*j<=n;++j)\n --res;\n }\n Console.WriteLine(res);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n\n void solve()\n {\n\n long N = long.Parse(Console.ReadLine());\n long all = 0;\n long[] cnt = new long[9];\n for (int i = 1; i <= N; i++)\n {\n cnt[i % 9]++;\n }\n for (int i = 0; i < 9; i++)\n {\n long cnt1 = cnt[i];\n for (int j = 0; j < 9; j++)\n {\n long cnt2 = cnt[j];\n int k = (i * j) % 9;\n long cnt3 =cnt[k];\n all += cnt1 * cnt2 * cnt3;\n }\n }\n for (int i = 1; i <= N; i++)\n {\n all -= (N / i);\n }\n Console.WriteLine(all);\n \n\n\n }\n\n \n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n \n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n private static int CalcD(int num)\n {\n var s = num.ToString().Sum(ch => (int)char.GetNumericValue(ch));\n if (s <= 9)\n {\n return s;\n }\n else\n {\n return CalcD(s);\n }\n }\n\n static void Main(string[] args)\n {\n var nInt = Convert.ToInt32(Console.ReadLine());\n \n var n = new BigInteger(nInt);\n BigInteger errors = 0;\n\n BigInteger c = 0;\n\n for (int i = 1; i <= n; i++)\n {\n if (n < i * i)\n {\n break;\n }\n else\n {\n for (int j = i; n >= j * i; j++)\n {\n if (i == j)\n {\n c++;\n }\n else\n {\n c += 2;\n }\n }\n }\n }\n\n var max = n > 9 ? 9 : n;\n for (int A = 1; A <= max; A++)\n {\n for (int B = 1; B <= max; B++)\n {\n for (int C = 1; C <= max; C++)\n {\n if (C == CalcD(A * B))\n {\n BigInteger tmp = ((((n - C)/9) + 1)*(((n - A)/9) + 1)*(((n - B)/9) + 1));\n errors += tmp;\n }\n\n }\n }\n }\n\n Console.WriteLine(errors - c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n \n var a = new int[10];\n var dp = new int[Math.Max(100, n + 1)];\n for (int i = 1; i <= Math.Max(99, n); i++)\n {\n if (i > 9)\n {\n int x = i;\n int s = 0;\n while (x > 0)\n {\n s += x % 10;\n x /= 10;\n }\n dp[i] = dp[s];\n }\n else\n dp[i] = i;\n\n if (i <= n)\n a[dp[i]]++;\n }\n\n long ans = 0;\n for (int i = 1; i < 10; i++)\n for (int j = 1; j < 10; j++)\n ans += 1L * a[i] * a[j] * a[dp[i * j]];\n\n for (int i = 1; i <= n; i++)\n ans -= n / i;\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = nextInt();\n long ans = 0;\n for (int i = 0; i < 9; ++i)\n {\n for (int j = 0; j < 9; j++)\n {\n for (int k = 0; k < 9; k++) if( j * k % 9 == i )\n {\n ans += calc(j, n) * calc(k, n) * calc(i, n);\n }\n }\n }\n int[] e = new int[n + 1];\n for (int i = 2; i < n + 1; i++)\n {\n if( e[i] == 0 )\n for (int j = i + i; j < n + 1; j+=i)\n {\n e[j] = i;\n }\n }\n -- ans;\n for (int i = 2; i < n + 1; i++) if (e[i] > 0)\n {\n List a = new List();\n int j;\n for (j = i; e[j] != 0; j /= e[j]) a.Add(e[j]);\n a.Add(j);\n var l = from v in a orderby v select v;\n long cnt = 1;\n int lst = -1;\n long cur = 0;\n foreach (var z in l)\n {\n if (z != lst)\n {\n cnt *= (cur + 1);\n cur = 0;\n }\n ++cur;\n lst = z;\n }\n cnt *= (cur + 1);\n //o(cnt);\n ans -= cnt;\n }\n else ans -= 2;\n o(ans);\n }\n\n static long calc(int a, int n)\n {\n n -= a;\n if (a != 0) n += 9;\n return n / 9;\n }\n\n\n static string inp = null;\n static string[] inps = null;\n static int icur = -1;\n static string nextToken()\n {\n while (inps == null || icur == inps.Length)\n {\n icur = 0;\n inp = Console.ReadLine();\n inps = inp.Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n }\n return inps[icur++];\n }\n static int nextInt()\n {\n return int.Parse(nextToken());\n }\n static long nextLong()\n {\n return long.Parse(nextToken());\n }\n static double nextDouble()\n {\n return double.Parse(nextToken());\n }\n static void o( params object[] a )\n {\n Console.WriteLine(String.Join(\" \", (from v in a select v.ToString()).ToArray()));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine().Trim());\n\n int[] c = new int[10];\n long count = 0;\n for (int i = 1; i <= n; i++)\n {\n count -= n / i;\n c[i % 9]++;\n }\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n count += (long)c[i] * (long)c[j] * (long)c[(i * j) % 9];\n }\n }\n Console.WriteLine(count);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.IO;\nusing System.Collections.Generic;\n// Powered by caide (code generator, tester, and library code inliner)\n\nclass Solution {\n long N;\n long[,] A;\n long[] B;\n public void solve(TextReader input, TextWriter output) {\n N = long.Parse(input.ReadLine());\n A = new long[10, 10];\n B = new long[10];\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n A[i, j] = (i * j) % 9;\n }\n }\n\n for (int i = 1; i <= N; i++)\n {\n B[i % 9]++;\n }\n\n long X = 0;\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 10; j++)\n {\n X += B[i] * B[j] * B[A[i, j]];\n }\n }\n\n long Y = 0;\n for (long i = 1; i <= N; i++)\n {\n Y += N / i;\n }\n\n output.WriteLine(X-Y);\n }\n\n public int d(int x)\n {\n int num = s(x);\n if (num <= 9)\n return num;\n return d(num);\n }\n\n private int s(int x)\n {\n int res = 0;\n while(x > 0)\n {\n res += x % 10;\n x /= 10;\n }\n\n return res;\n }\n}\n\nclass CaideConstants {\n public const string InputFile = null;\n public const string OutputFile = null;\n}\npublic class Program {\n public static void Main(string[] args) {\n Solution solution = new Solution();\n using (System.IO.TextReader input =\n CaideConstants.InputFile == null ? System.Console.In :\n new System.IO.StreamReader(CaideConstants.InputFile))\n using (System.IO.TextWriter output =\n CaideConstants.OutputFile == null ? System.Console.Out:\n new System.IO.StreamWriter(CaideConstants.OutputFile))\n\n solution.solve(input, output);\n }\n}\n\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _10_c\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var n = readInt();\n var cs = new long[10];\n var vs = new long[n + 1];\n for (int i = 1; i < n + 1; i++)\n {\n vs[i] = getSum(i);\n cs[vs[i]]++;\n }\n\n var total = 0L;\n for (int i = 1; i < 10; i++)\n {\n for (int j = 1; j < 10; j++)\n {\n var next = getSum(i * j);\n var val = cs[i] * cs[j];\n //if (i == j)\n //{\n // val = cs[i] * cs[i - 1] / 2;\n //}\n\n if (val * cs[next] > 0)\n {\n total += val * cs[next];\n }\n \n }\n }\n\n //total += (cs[1] * (cs[1] - 1) / 2);\n //total += (cs[2] * cs[1]);\n //total += (cs[3] * cs[1]);\n //total += (cs[4] * cs[1] + cs[2] * (cs[2] - 1) / 2);\n //total += (cs[5] * cs[1]);\n //total += (cs[6] * cs[1] + cs[3] * cs[2]);\n //total += (cs[7] * cs[1]);\n //total += (cs[8] * cs[1] + cs[2] * cs[4]);\n //total += (cs[9] * cs[1] + cs[3] * (cs[3] - 1) / 2);\n\n var remc = 0L;\n for (int i = 1; i < n + 1; i++)\n {\n remc += n / i;\n }\n //for (int i = 1; i < n + 1; i++)\n //{\n // var end = (int)Math.Floor(Math.Sqrt(i));\n // for (int j = 1; j <= end; j++)\n // {\n // var rem = i % j;\n // var another = i / j;\n // if (rem == 0)\n // {\n // if (another == j)\n // {\n // remc++;\n // }\n // else\n // {\n // remc += 2;\n // }\n \n // }\n // }\n //}\n\n total -= remc;\n Console.WriteLine(total);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int getSum(int a)\n {\n if (a < 10)\n {\n return a;\n }\n\n var val = a;\n var sum = 0;\n while (true)\n {\n sum += (val % 10);\n val /= 10;\n if (val == 0)\n {\n break;\n }\n }\n\n return getSum(sum);\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine().Trim());\n\n int[] c = new int[10];\n long count = 0;\n for (int i = 1; i <= n; i++)\n {\n count -= n / i;\n c[i % 9]++;\n }\n for (int i = 0; i < 9; i++)\n {\n for (int j = 0; j < 9; j++)\n {\n count += c[i] * c[j] * c[(i * j) % 9];\n }\n }\n Console.WriteLine(count);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n\n static int D(int d)\n {\n if (d < 10) return d;\n\n int sum = 0;\n while (d > 0)\n {\n sum += d % 10;\n d = d / 10;\n }\n\n return D(sum);\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine().Trim());\n long sum = 0;\n for (int i = 1; i <= n; i++)\n {\n int q = (int)Math.Sqrt(i);\n for (int j = 1; j <= q; j++)\n {\n if (i % j == 0)\n {\n sum++;\n if (j * j != i) sum++;\n }\n }\n }\n\n long count = 0;\n if (n >= 10)\n {\n count = n * n * n;\n count -= sum;\n }\n else\n {\n for (int a = 1; a <= n; a++)\n {\n for (int b = 1; b <= n; b++)\n {\n int c = a * b;\n if (c > n && D(c) <= n)\n {\n count++;\n }\n }\n }\n }\n\n Console.WriteLine(count);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round10\n{\n class C\n {\n public static long d(long x)\n {\n return x % 9;\n }\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int ret = 0;\n int[] x = new int[9];\n for (int i = 1; i <= n; i++)\n {\n x[d(i)]++;\n }\n for (int a = 0; a < 9; a++)\n {\n for (int b = 0; b < 9; b++)\n {\n ret += x[a] * x[b] * x[d(a * b)];\n //Console.WriteLine(\"{0},{1},{2}:{3}\", a, b, d(a * b), x[a] * x[b] * x[d(a * b)]);\n }\n }\n //Console.WriteLine(ret);\n for (int i = 1; i <= n; i++)\n {\n //ret -= n / i + (n % i == 0 ? 0 : 1);\n ret -= n / i;\n }\n Console.WriteLine(ret);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round10\n{\n class C\n {\n public static long d(long x)\n {\n return x % 9;\n }\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int ret = 0;\n int[] x = new int[9];\n for (int i = 1; i <= n; i++)\n {\n x[d(i)]++;\n }\n for (int a = 0; a < 9; a++)\n {\n for (int b = 0; b < 9; b++)\n {\n ret += x[a] * x[b] * x[d(a * b)];\n //Console.WriteLine(\"{0},{1},{2}:{3}\", a, b, d(a * b), x[a] * x[b] * x[d(a * b)]);\n }\n }\n Console.WriteLine(ret);\n for (int i = 1; i <= n; i++)\n {\n //ret -= n / i + (n % i == 0 ? 0 : 1);\n ret -= n / i;\n }\n Console.WriteLine(ret);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = nextInt();\n long ans = 0;\n for (int i = 0; i < 9; ++i)\n {\n for (int j = 0; j < 9; j++)\n {\n for (int k = 0; k < 9; k++) if( j * k % 9 == i )\n {\n ans += calc(j, n) * calc(k, n) * calc(i, n);\n }\n }\n }\n int[] e = new int[n + 1];\n for (int i = 2; i < n + 1; i++)\n {\n if( e[i] == 0 )\n for (int j = i + i; j < n + 1; j+=i)\n {\n e[j] = i;\n }\n }\n -- ans;\n for (int i = 2; i < n + 1; i++) if (e[i] > 0)\n {\n List a = new List();\n int j;\n for (j = i; e[j] != 0; j /= e[j]) a.Add(e[j]);\n a.Add(j);\n var l = from v in a orderby v select v;\n long cnt = 1;\n int lst = -1;\n long cur = 0;\n foreach (var z in l)\n {\n if (z != lst)\n {\n cnt *= (cur + 1);\n cur = 0;\n }\n ++cnt;\n lst = z;\n }\n cnt *= (cur + 1);\n //o(cnt);\n ans -= cnt;\n }\n else ans -= 2;\n o(ans);\n }\n\n static long calc(int a, int n)\n {\n n -= a;\n if (a != 0) n += 9;\n return n / 9;\n }\n\n\n static string inp = null;\n static string[] inps = null;\n static int icur = -1;\n static string nextToken()\n {\n while (inps == null || icur == inps.Length)\n {\n icur = 0;\n inp = Console.ReadLine();\n inps = inp.Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n }\n return inps[icur++];\n }\n static int nextInt()\n {\n return int.Parse(nextToken());\n }\n static long nextLong()\n {\n return long.Parse(nextToken());\n }\n static double nextDouble()\n {\n return double.Parse(nextToken());\n }\n static void o( params object[] a )\n {\n Console.WriteLine(String.Join(\" \", (from v in a select v.ToString()).ToArray()));\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _10_c\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var n = readInt();\n var cs = new int[10];\n var vs = new int[n + 1];\n for (int i = 1; i < n + 1; i++)\n {\n vs[i] = getSum(i);\n cs[vs[i]]++;\n }\n\n var total = 0L;\n for (int i = 1; i < 10; i++)\n {\n for (int j = 1; j < 10; j++)\n {\n var next = getSum(i * j);\n var val = cs[i] * cs[j];\n //if (i == j)\n //{\n // val = cs[i] * cs[i - 1] / 2;\n //}\n\n if (val * cs[next] > 0)\n {\n total += val * cs[next];\n }\n \n }\n }\n\n //total += (cs[1] * (cs[1] - 1) / 2);\n //total += (cs[2] * cs[1]);\n //total += (cs[3] * cs[1]);\n //total += (cs[4] * cs[1] + cs[2] * (cs[2] - 1) / 2);\n //total += (cs[5] * cs[1]);\n //total += (cs[6] * cs[1] + cs[3] * cs[2]);\n //total += (cs[7] * cs[1]);\n //total += (cs[8] * cs[1] + cs[2] * cs[4]);\n //total += (cs[9] * cs[1] + cs[3] * (cs[3] - 1) / 2);\n\n var remc = 0L;\n for (int i = 1; i < n + 1; i++)\n {\n var end = (int)Math.Floor(Math.Sqrt(i));\n for (int j = 1; j <= end; j++)\n {\n var rem = i % j;\n var another = i / j;\n if (rem == 0)\n {\n if (another == j)\n {\n remc++;\n }\n else\n {\n remc += 2;\n }\n \n }\n }\n }\n\n total -= remc;\n Console.WriteLine(total);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int getSum(int a)\n {\n if (a < 10)\n {\n return a;\n }\n\n var val = a;\n var sum = 0;\n while (true)\n {\n sum += (val % 10);\n val /= 10;\n if (val == 0)\n {\n break;\n }\n }\n\n return getSum(sum);\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n private static int CalcD(int num)\n {\n var s = num.ToString().Sum(ch => (int)char.GetNumericValue(ch));\n if (s <= 9)\n {\n return s;\n }\n else\n {\n return CalcD(s);\n }\n }\n\n static void Main(string[] args)\n {\n var nInt = Convert.ToInt32(Console.ReadLine());\n \n var n = new BigInteger(nInt);\n BigInteger errors = 0;\n\n BigInteger c = 0;\n\n for (int i = 1; i < n; i++)\n {\n if (n < i * i)\n {\n break;\n }\n else\n {\n for (int j = i; n >= j * i; j++)\n {\n if (i == j)\n {\n c++;\n }\n else\n {\n c += 2;\n }\n }\n }\n }\n\n var max = n > 9 ? 9 : n;\n for (int A = 1; A <= max; A++)\n {\n for (int B = 1; B <= max; B++)\n {\n for (int C = 1; C <= max; C++)\n {\n if (C == CalcD(A * B))\n {\n BigInteger tmp = ((((n - C)/9) + 1)*(((n - A)/9) + 1)*(((n - B)/9) + 1));\n errors += tmp;\n }\n\n }\n }\n }\n\n Console.WriteLine(errors - c);\n //Console.ReadKey();\n }\n }\n}\n"}], "src_uid": "fc133fe6353089a0ebee08dec919f608"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _26a\n {\n public static void Main()\n {\n var primes = new List();\n primes.AddRange(new[] {2, 3, 5});\n for (var i = 5; i <= 3000; i++)\n {\n if (primes.All(prime => i%prime != 0))\n {\n primes.Add(i);\n }\n }\n var almost = new bool[3010];\n for (var i = 0; i < primes.Count; i++)\n {\n for (var j = i + 1; j < primes.Count; j++)\n {\n if (primes[i] * primes[j] > 3000)\n {\n break;\n }\n var number = 1;\n for (var k = 1; k < 1000; k++)\n {\n number *= primes[i];\n if (number > 3000)\n {\n break;\n }\n var qq = number;\n for (var m = 1; m < 1000; m++)\n {\n qq *= primes[j];\n if (qq <= 3000)\n {\n almost[qq] = true;\n }\n else\n {\n break;\n }\n }\n }\n }\n }\n var line = Console.ReadLine();\n var n = int.Parse(line);\n var count = 0;\n for (var i = 0; i <= n; i++)\n {\n if (almost[i])\n {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint n =Convert.ToInt32(Console.ReadLine());\n\t\tint prost=0;\n\t\tfor(int i=1;i 0)\n Console.WriteLine(ans);\n else Console.WriteLine(0);\n }\n private static bool isPrime(int N)\n {\n if (N == 2) return true;\n if (N < 2 || N % 2 == 0) return false;\n for (int i = 3; i <= N/2; i += 2)\n if (N % i == 0) return false;\n return true;\n }\n private static bool isAlmastPrime(int N)\n {\n int count = 0;\n for (int i = 2; i <= N; i++)\n if (N % i == 0 && isPrime(i))\n count++;\n\n return count == 2;\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace Task26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, ans = 0;\n n = Convert.ToInt32(Console.ReadLine());\n List primes=new List ();\n for(int i = 2; i <= n; i++) \n if (isPrime(i))\n primes.Add(i);\n \n \n for (int i = 1; i <= n; i++)\n if (isAlmastPrime(ref primes,i))\n ans++;\n\n Console.WriteLine(ans);\n }\n\n private static bool isPrime(int N)\n {\n if (N == 2) return true;\n if (N < 2 || N % 2 == 0) return false;\n for (int i = 3; i <=Math.Sqrt(N); i += 2)\n if (N % i == 0) return false;\n return true;\n }\n\n private static bool isAlmastPrime(ref List mylist, int item)\n {\n int count = 0;\n for (int i = 0; i 2)\n return false;\n }\n return count == 2;\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int ans = 0;\n for (int i = 6; i <= n; i++)\n {\n int x = i;\n int c = 0;\n for (int j = 2; j * j <= i; j++)\n if (x % j == 0)\n {\n while (x % j == 0)\n x /= j;\n c++;\n }\n if (x > 1)\n c++;\n if (c == 2)\n ans++;\n }\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Euler187\n{\n class Program\n {\n static bool Prime(int n)\n {\n double x = Math.Sqrt(n);\n for (int i = 2; i <= x; i++)\n if (n % i == 0)\n return false;\n return true;\n }\n static bool Div(int n)\n {\n int alphacount = 0; \n for (int i = 2; i <=n; i++)\n {\n if (n % i == 0)\n alphacount++;\n while (n % i == 0)\n { \n n /= i; \n }\n \n }\n return alphacount==2;\n }\n static void Main(string[] args)\n {\n string s=Console.ReadLine();\n int n = Convert.ToInt32(s);\n int count = 0;\n for (int i = 2; i <= n; i++)\n {\n if (Div(i))\n count++;\n //Console.WriteLine(i);\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n static int[] GetPrimeFactors(int n)\n {\n var F = new List();\n while (n != 1)\n {\n var p = trial_division(n);\n var e = 1;\n n /= p;\n while (n % p == 0)\n {\n e += 1;\n n /= p;\n }\n F.Add(p);\n }\n return F.ToArray();\n }\n static int trial_division(int n, int bound = 0)\n {\n if (n == 1) return 1;\n var a = new int[] { 2, 3, 5 };\n foreach (var p in a)\n {\n if (n % p == 0) return p;\n }\n if (bound == 0) bound = n;\n int[] dif = { 6, 4, 2, 4, 2, 4, 6, 2 };\n var m = 7;\n var i = 1;\n while (m <= bound && m * m <= n)\n {\n if (n % m == 0)\n return m;\n m += dif[i % 8];\n i += 1;\n }\n return n;\n }\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n int c = 0;\n foreach (var item in Enumerable.Range(1, n))\n {\n var p = GetPrimeFactors(item);\n c += p.Length == 2 ? 1 : 0;\n }\n Console.WriteLine(c);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n int c = 0;\n if (n < 4)\n {\n Console.WriteLine(0);\n }\n else\n {\n\n List primes = new List();\n for (int i = 2; i < n; i++)\n {\n int sqrt = Convert.ToInt32(Math.Sqrt(i));\n bool check = true;\n for (int j = 2; j <= sqrt; j++)\n {\n if (i%j==0)\n {\n check = false;\n break;\n }\n }\n if (check)\n {\n primes.Add(i);\n }\n\n }\n for (int i = 4; i <= n; i++)\n {\n int u = 0;\n int sqrt = Convert.ToInt32(Math.Sqrt(i));\n for (int j = 0; j < primes.Count ; j++)\n {\n if (i%primes[j]==0)\n {\n u++;\n }\n }\n if (u==2)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint num = int.Parse(Console.ReadLine());\n\t\t\n\t\tif(num < 6)\n\t\t{\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 6; i <= num; i++)\n\t\t{\n\t\t\tint countPrime = 0;\n\t\t\t\n\t\t\tfor(int j = 2; j <= i / 2; j++)\n\t\t\t{\n\t\t\t\tif(i % j == 0 && IsPrime(j))\n\t\t\t\t{\n\t\t\t\t\tcountPrime++;\n\t\t\t\t\t\n\t\t\t\t\tif(countPrime > 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(countPrime == 2)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(count);\n\t}\n\t\n\tpublic static bool IsPrime(int num)\n\t{\n\t\tif(num == 2 || num == 3)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif(num % 2 == 0)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tfor(int i = 3; i <= num / 3; i += 2)\n\t\t{\n\t\t\tif(num % i == 0)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace qiw\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List oi = new List();\n List f = new List();\n oi.Add(2); \n int count = 0;\n for (int i = 2; i <= n; i++)\n {\n for (int k =3; k <= i; k++)\n {\n if (i%k==0)\n {\n count++;\n }\n }\n if (count==1 && i!=4)\n {\n oi.Add(i);\n \n }\n count = 0;\n }\n for (int i = 1; i <= n; i++)\n {\n for (int k = 0; k < oi.Count; k++)\n {\n if (i%oi[k]==0)\n {\n count++;\n }\n }\n if (count==2)\n {\n f.Add(i);\n }\n count = 0;\n }\n Console.WriteLine(f.Count);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp37\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n \n int c = 0;\n if (n < 4)\n {\n Console.WriteLine(0);\n }\n else\n {\n\n List primes = new List();\n for (int i = 2; i < n; i++)\n {\n int sqrt = Convert.ToInt32(Math.Sqrt(i));\n bool check = true;\n for (int j = 2; j <= sqrt; j++)\n {\n if (i%j==0)\n {\n check = false;\n break;\n }\n }\n if (check)\n {\n primes.Add(i);\n }\n\n }\n for (int i = 4; i <= n; i++)\n {\n int u = 0;\n int sqrt = Convert.ToInt32(Math.Sqrt(i));\n for (int j = 0; j < primes.Count ; j++)\n {\n if (i%primes[j]==0)\n {\n u++;\n }\n }\n if (u==2)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _26_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n List pr = new List();\n pr.Add(2);\n int temp = 3;\n bool good;\n while (temp < 3000)\n {\n good = true;\n for (int i = 0; pr[i] * pr[i] <= temp; i++ )\n {\n if (temp % pr[i] == 0)\n {\n good = false;\n break;\n }\n }\n if (good) pr.Add(temp);\n temp += 2;\n }\n int res = 0;\n int n = int.Parse(Console.ReadLine());\n int cur,cnt, index;\n for (int i = 2; i<= n; i++)\n {\n cur = i;\n cnt = 0;\n index = 0;\n while (cur>1)\n {\n if (cur%pr[index]==0)\n {\n cnt++;\n while (cur%pr[index]==0)\n cur/=pr[index];\n }\n index++;\n }\n if (cnt==2)\n res++;\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic int First;\n\n\t\t\tpublic int Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List> Graph = new List>();\n\n\t\tpublic static bool Dfs(int x, int y, int prevx, int prevy)\n\t\t{\n\t\t\tGraph[x][y].Was = 1;\n\t\t\tvar result = false;\n\t\t\tforeach (var t in Graph[x][y].Edges)\n\t\t\t{\n\t\t\t\tif (Graph[t.First][t.Second].Was == 0)\n\t\t\t\t\tresult |= Dfs(t.First, t.Second, x, y);\n\t\t\t\telse if (t.First != prevx || t.Second != prevy)\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar ans = 0;\n\t\t\tvar primes = new List();\n\t\t\tfor (var i = 2; i <= n; ++i)\n\t\t\t\tif (IsPrime(i))\n\t\t\t\t\tprimes.Add(i);\n\t\t\tfor (var i = 6; i <= n; ++i)\n\t\t\t{\n\t\t\t\tvar ct = 0;\n\t\t\t\tfor (var j = 0; j < primes.Count; ++j)\n\t\t\t\t\tif (i % primes[j] == 0)\n\t\t\t\t\t\tct++;\n\t\t\t\tif (ct == 2)\n\t\t\t\t\tans++;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n //var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n\n var n = int.Parse(Console.ReadLine());\n\n var primes = new List {2, 3};\n\n for (int i = 5; i < 3000; i++)\n {\n if (primes.All(p => i%p != 0))\n {\n primes.Add(i);\n }\n }\n\n var res = 0;\n\n for (int i = 2; i <= n; i++)\n {\n var lc = 0;\n\n for (int j = 0; j < primes.Count; j++)\n {\n if (i%primes[j]==0)\n {\n lc++;\n }\n\n if (lc > 2) break;\n }\n\n if (lc == 2)\n {\n res++;\n }\n }\n\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static void Main(string[] args)\n {\n int n = ReadIntLine();\n\n int[] s = new int[n + 1];\n\n for (int i = 2; i < s.Length; i++)\n {\n if (s[i] == 0)\n {\n for (int j = i; j < s.Length; j+=i)\n {\n s[j]++;\n }\n }\n }\n\n PrintLn(s.Count(x => x == 2));\n\n }\n\n \n\n }\n\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace _26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++) prime[i] = true;\n for (int i = 2; i * i <= n; i++)\n if (prime[i])\n for (int j = i * i; j <= n; j += i)\n prime[j] = false;\n List primes = new List();\n for (int i = 2; i <= n; i++)\n if (prime[i])\n primes.Add(i);\n int result = 0;\n for (int i = 6; i <= n; i++)\n {\n int cnt = 0;\n foreach (var x in primes)\n {\n if (x > i) break;\n if (i % x == 0)\n cnt++;\n }\n if (cnt == 2)\n result++;\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n\n //Console.SetIn(new StreamReader(\"file.in\"));\n /*\n FileStream filestream = new FileStream(\"out.txt\", FileMode.Create);\n var streamwriter = new StreamWriter(filestream);\n streamwriter.AutoFlush = true;\n Console.SetOut(streamwriter);\n */\n\n int n = int.Parse(Console.ReadLine());\n int[] sieve = new int[n + 1];\n int ans = 0;\n for (int i = 2; i <= n; i++) {\n if (sieve[i] == 0) {\n for (int j = i + i; j <= n; j += i) {\n sieve[j]++;\n }\n } else if (sieve[i] == 2) {\n ans++;\n }\n }\n Console.Write(ans);\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n\n static bool[] Socrat(int a)\n {\n bool[] m = new bool[a];\n for (int i = 2; i < a; i++)\n {\n if (m[i] == false)\n {\n for (int j = 1; i + i * j < a; j++)\n {\n m[i + i * j] = true;\n }\n }\n }\n return m;\n }\n\n\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n bool[] k = new bool[n+1];\n k = Socrat(n+1);\n int count = 0;\n\n for (int i = 6; i <= n; i++)\n {\n int g=0;\n for (int j = 2; j <= n; j++)\n {\n if (k[j] == false)\n {\n if (i % j == 0)\n g++;\n }\n if (g > 2)\n break;\n }\n if (g == 2)\n count++;\n\n\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n static void Main()\n {\n\n //\u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0442\u0443\u043f\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430\n int n = int.Parse(Console.ReadLine());\n bool[] prost = new bool[n+1];\n bool k = false;\n\n for (int i = 2; i <= n; i++)\n {\n for (int j = 2; j < i; j++)\n {\n if (i % j == 0)\n {\n k = true;\n break;\n }\n }\n if (k == false)\n {\n prost[i] = true;\n }\n k = false;\n }\n\n\n\n //\u0442\u0443\u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 6 \u0434\u043e \u041d \u043d\u0430 \u0434\u0435\u043b\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430 \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0438\u0441\u043b\u0430\n\n int count = 0;\n int countotvet = 0;\n for (int i = 6; i <= n; i++)\n {\n count = 0;\n for (int j = 2; j <= i; j++)\n {\n if (i % j == 0 && prost[j] != false)\n count++;\n if (count > 2)\n {\n count = 0;\n break;\n }\n }\n if (count == 2)\n countotvet++;\n \n }\n\n Console.WriteLine(countotvet);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace AlmostPrime26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(almostPrimeNumbers(n));\n\n }\n static int almostPrimeNumbers(int N)\n {\n int count = 0, primeCounter = 0;\n List primeList = new List();\n primeList.Add(2);\n for (int i = 3; i < N; i+=2)\n {\n \n if (Program.IsPrime(i))\n {\n primeList.Add(i);\n }\n \n }\n for(int j=1;j<=N;j++)\n {\n for(int i=0;i primes;\n int n;\n\n // Divide each candidate number (starting from 6) by prime numbers to find\n // divisors. Keep dividing the number with the divisor/factor. Do it twice\n // and if the number comes down to one after those divisions we got an\n // almost prime\n public int FindAlmostPrimes()\n {\n int count = 0;\n\n for (int num = 6; num <= n; num++) {\n int firstPrimeDivisorIndex = GetPrimeFactor(num);\n if (firstPrimeDivisorIndex == -1)\n continue;\n // divide the number as long as it is divisible by factor\n int dNum = DivideDown(num, primes[firstPrimeDivisorIndex]);\n int secondPrimeDivisorIndex = GetPrimeFactor(dNum, firstPrimeDivisorIndex\n + 1);\n if (secondPrimeDivisorIndex == -1)\n continue;\n if (DivideDown(dNum, primes[secondPrimeDivisorIndex]) == 1)\n count++;\n }\n return count;\n }\n\n private int GetPrimeFactor(int num, int startIndex=0) {\n if (num < 2)\n return -1;\n // find prime divisotr/factor\n for (int i= startIndex; primes[i] <= num && i(new int[] { 2 });\n for (int j = 3; j <= n; j += 2) {\n int pi = 1;\n for (; pi < primes.Count; pi++)\n if (j % primes[pi] == 0)\n break;\n if (pi == primes.Count)\n primes.Add(j);\n }\n }\n\n public void Input()\n {\n n = int.Parse(Console.ReadLine());\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n PrimeUtil primeDemo = new PrimeUtil();\n primeDemo.Input();\n primeDemo.GeneratePrimes();\n Console.WriteLine(primeDemo.FindAlmostPrimes());\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Almost Prime\n* URL : http://codeforces.com/problemset/problem/26/A\n* Contst: Offline\n* Date : 2018-04-27\n* Author: Atiq Rahman\n* Comp : O(N)\n* Status: Accepted\n* Notes : This is not really a good problem for practicing implementation of\n* doubly linked list. Building LinkedList is not trivial since nodes are out\n* of order.. we can say this place for practicing alternative doubly linked\n* list representation.\n* \n* Applications of this problem:\n* Test Prime Number Generatation algorithm up to a small range (<=3000)\n* \n* With this problem following Prime Generation Algos tested,\n* - Dynamic Programming Approach for generating primes\n* - Sieve of Eratosthenes\n* \n* related: 'uva-online-judge/old/10699_Count the factors.cpp'\n* meta : tag-linked-list, tag-easy\n***************************************************************************/\nusing System;\nusing System.Collections.Generic;\n\npublic class PrimeUtil {\n // The access level for class members and struct members, including nested\n // classes and structs, is private by default.\n // ref: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/\n // classes-and-structs/access-modifiers\n List primes;\n System.Collections.BitArray isPrime;\n int n;\n\n // Divide each candidate number (starting from 6) by prime numbers to find\n // divisors. Keep dividing the number with the divisor/factor. Do it twice\n // and if the number comes down to one after those divisions we got an\n // almost prime\n public int FindAlmostPrimes()\n {\n int count = 0;\n\n for (int num = 6; num <= n; num++) {\n int firstPrimeDivisorIndex = GetPrimeFactor(num);\n if (firstPrimeDivisorIndex == -1)\n continue;\n // divide the number as long as it is divisible by factor\n int dNum = DivideDown(num, primes[firstPrimeDivisorIndex]);\n int secondPrimeDivisorIndex = GetPrimeFactor(dNum, firstPrimeDivisorIndex\n + 1);\n if (secondPrimeDivisorIndex == -1)\n continue;\n if (DivideDown(dNum, primes[secondPrimeDivisorIndex]) == 1)\n count++;\n }\n return count;\n }\n\n // start from the index after the previous prime factor's index\n private int GetPrimeFactor(int num, int startIndex=0) {\n if (num == 1)\n return -1;\n // find prime divisor/factor\n for (int i= startIndex; primes[i] <= num && i(new int[] { 2 });\n for (int j = 3; j <= n; j += 2) {\n int pi = 1; // index inside the prime number collection\n for (; pi < primes.Count; pi++)\n if (j % primes[pi] == 0)\n break;\n if (pi == primes.Count)\n primes.Add(j);\n }\n }*/\n\n\n /*\n consider example,\n 2, 3, 4,\n */\n // Sieve\n public void GeneratePrimes()\n {\n isPrime = new System.Collections.BitArray(n + 1, true);\n for (int i = 3; i * i <= n; i+=2)\n if (isPrime.Get(i))\n for (int j = i * i; j <= n; j += i)\n isPrime.Set(j, false);\n\n primes = new List(new int[] { 2 });\n for (int i = 3; i <= n; i+=2)\n if (isPrime.Get(i))\n primes.Add(i);\n }\n\n public void Input()\n {\n n = int.Parse(Console.ReadLine());\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n PrimeUtil primeDemo = new PrimeUtil();\n primeDemo.Input();\n primeDemo.GeneratePrimes();\n Console.WriteLine(primeDemo.FindAlmostPrimes());\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Almost Prime\n* URL : http://codeforces.com/problemset/problem/26/A\n* Contst: Offline\n* Date : 2018-04-27\n* Author: Atiq Rahman\n* Comp : O(N)\n* Status: Accepted\n* Notes : This is not really a good problem for practicing implementation of\n* doubly linked list. Building LinkedList is not trivial since nodes are out\n* of order.. we can say this place for practicing alternative doubly linked\n* list representation.\n* \n* Applications of this problem:\n* Test Prime Number Generatation algorithms\n* meta : tag-linked-list, tag-easy\n***************************************************************************/\nusing System;\nusing System.Collections.Generic;\n\npublic class PrimeUtil {\n // The access level for class members and struct members, including nested\n // classes and structs, is private by default.\n // ref: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/\n // classes-and-structs/access-modifiers\n List primes;\n int n;\n\n // Divide each candidate number (starting from 6) by prime numbers to find\n // divisors. Keep dividing the number with the divisor/factor. Do it twice\n // and if the number comes down to one after those divisions we got an\n // almost prime\n public int FindAlmostPrimes()\n {\n int count = 0;\n\n for (int num = 6; num <= n; num++) {\n int firstPrimeDivisorIndex = GetPrimeFactor(num);\n if (firstPrimeDivisorIndex == -1)\n continue;\n // divide the number as long as it is divisible by factor\n int dNum = DivideDown(num, primes[firstPrimeDivisorIndex]);\n int secondPrimeDivisorIndex = GetPrimeFactor(dNum, firstPrimeDivisorIndex\n + 1);\n if (secondPrimeDivisorIndex == -1)\n continue;\n if (DivideDown(dNum, primes[secondPrimeDivisorIndex]) == 1)\n count++;\n }\n return count;\n }\n\n // start from the index after the previous prime factor's index\n private int GetPrimeFactor(int num, int startIndex=0) {\n if (num == 1)\n return -1;\n // find prime divisotr/factor\n for (int i= startIndex; primes[i] <= num && i(new int[] { 2 });\n for (int j = 3; j <= n; j += 2) {\n int pi = 1; // index inside the prime number collection\n for (; pi < primes.Count; pi++)\n if (j % primes[pi] == 0)\n break;\n if (pi == primes.Count)\n primes.Add(j);\n }\n }\n\n public void Input()\n {\n n = int.Parse(Console.ReadLine());\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n PrimeUtil primeDemo = new PrimeUtil();\n primeDemo.Input();\n primeDemo.GeneratePrimes();\n Console.WriteLine(primeDemo.FindAlmostPrimes());\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int max_number=3000;\n bool[] isPrime = new bool[max_number+1];\n int n = int.Parse(Console.ReadLine());\n for (int i = 2; i <= n; i++) isPrime[i] = true;\n int max_factor=(int)Math.Sqrt(n);\n for (int i = 2; i <= max_factor; i++)\n if (isPrime[i])\n for (int j = i * i; j <= n; j += i) isPrime[j] = false;\n \n int count = 0;\n for (int j = 2; j <= n; j++)\n {\n max_factor = (int)Math.Sqrt(j);\n int prime_divisors = 0;\n for (int i = 2; i <= max_factor; i++)\n {\n if (j%i==0 && i!=j/i)\n {\n if (isPrime[i]) prime_divisors++;\n if (isPrime[j / i]) prime_divisors++;\n if (prime_divisors == 3) break;\n }\n }\n if (prime_divisors == 2) count++;\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class ProblemA\n{\n public static void Main(String[] args)\n {\n int n = 0; \n \n Int32.TryParse(Console.ReadLine(), out n);\n \n int solution = 0;\n \n for (int i=6; i <= n; i++)\n {\n int temp = i;\n int primeDivisorCount = 0;\n if (temp % 2 == 0)\n {\n primeDivisorCount++;\n while (temp % 2 == 0)\n {\n temp = temp / 2;\n }\n }\n \n int oddDivisor = 3;\n while (temp >= oddDivisor)\n {\n if (temp % oddDivisor == 0)\n {\n primeDivisorCount++;\n if (primeDivisorCount > 2)\n {\n break;\n }\n while (temp % oddDivisor == 0)\n {\n temp = temp / oddDivisor;\n }\n }\n oddDivisor += 2;\n }\n \n if (primeDivisorCount == 2)\n {\n solution++;\n }\n }\n Console.WriteLine(solution);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Task26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List primeNumbers = new List();\n for (int i = 1; i <= n; i++)\n if (IsPrime(i))\n primeNumbers.Add(i);\n\n\n int ans = 0;\n for (int i = 1; i <= n; i++)\n if (IsAlmostPrime(ref primeNumbers, i))\n ans++;\n\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n\n private static bool IsPrime(int N)\n {\n if (N < 2)\n return false;\n if (N == 2)\n return true;\n if (N % 2 == 0)\n return false;\n\n for (int i = 3; i <= Math.Sqrt(N); i++)\n if (N % i == 0)\n return false;\n\n return true;\n }\n\n\n private static bool IsAlmostPrime(ref Listprimes, int N) {\n int count = 0;\n for (int i = 0; i < primes.Count; i++)\n {\n if (N % primes[i] == 0)\n count++;\n if (primes[i] > N / 2)\n break;\n }\n return count == 2;\n }\n\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n int count = 0;\n for (int i = 6; i <= t; i++)\n {\n int c = 0;\n bool flag = false;\n for (int k = 2; k <= i / 2; k++)\n {\n flag = true;\n if (i % k == 0)\n {\n flag = false;\n for (int j = 2; j <= k / 2; j++)\n {\n if (k % j == 0)\n {\n flag = true; \n break;\n }\n }\n }\n c += flag ? 0 : 1;\n }\n count += c == 2 ? 1 : 0;\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "// 6 min\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Threading;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Text.RegularExpressions;\n\nnamespace sar_cs\n{\n class Program\n {\n class Parser\n {\n const int BufSize = 25000;\n TextReader s;\n char[] buf = new char[BufSize];\n int bufPos;\n int bufDataSize;\n bool eos; // eos read to buffer\n int lastChar = -2;\n int nextChar = -2;\n StringBuilder sb = new StringBuilder();\n\n void FillBuf()\n {\n if (eos) return;\n bufDataSize = s.Read(buf, 0, BufSize);\n if (bufDataSize == 0) eos = true;\n bufPos = 0;\n }\n\n int Read()\n {\n if (nextChar != -2)\n {\n lastChar = nextChar;\n nextChar = -2;\n }\n else\n {\n if (bufPos == bufDataSize) FillBuf();\n if (eos) lastChar = -1;\n else lastChar = buf[bufPos++];\n }\n return lastChar;\n }\n\n void Back()\n {\n if (lastChar == -2) throw new Exception(); // no chars were ever read\n nextChar = lastChar;\n }\n\n public Parser()\n {\n s = Console.In;\n }\n\n public int ReadInt()\n {\n int res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = -sign;\n c = Read();\n }\n int len = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return checked(res * sign);\n }\n\n public long ReadLong()\n {\n long res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = -sign;\n c = Read();\n }\n int len = 0;\n checked\n {\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = res * 10 - c;\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return res * sign;\n }\n }\n\n public double ReadDouble()\n {\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = Read();\n }\n\n sb.Length = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = Read();\n }\n\n Back();\n double res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);\n return res * sign;\n }\n\n public string ReadLine()\n {\n int c = Read();\n sb.Length = 0;\n while (c != -1 && c != 13 && c != 10)\n {\n sb.Append((char)c);\n c = Read();\n }\n if (c == 13)\n {\n c = Read();\n if (c != 10) Back();\n }\n return sb.ToString();\n }\n\n public bool EOF\n {\n get\n {\n if (Read() == -1) return true;\n Back();\n return false;\n }\n }\n\n public bool SeekEOF\n {\n get\n {\n L0:\n int c = Read();\n if (c == -1) return true;\n if (char.IsWhiteSpace((char)c)) goto L0;\n Back();\n return false;\n }\n }\n }\n\n static void pe()\n {\n Console.WriteLine(\"???\");\n Environment.Exit(0);\n }\n\n static void re()\n {\n Environment.Exit(55);\n }\n\n static int nosol()\n {\n Console.WriteLine(\"ERROR\");\n return 0;\n }\n\n static Stopwatch sw = Stopwatch.StartNew();\n\n static void Test()\n {\n Random rand = new Random(52345235);\n for (int i = 0; i < 2e6; i++)\n {\n }\n }\n\n class Numbers\n {\n static Random rnd = new Random();\n\n public static void Test()\n {\n int cnt = 0;\n for (int i = 1; i <= 1000000; i++)\n if (IsPrime(i * 1L, 10))\n cnt++;\n if (cnt != 78498) throw new Exception();\n\n if (GetPrimes(1000000).Count != 78498) throw new Exception();\n\n while (true)\n {\n long t = (long)(rnd.NextDouble() * 1e3 + 1);\n List> fact = Factorization(t);\n long res = 1;\n KeyValuePair last_kvp = new KeyValuePair(1, 0);\n foreach (KeyValuePair kvp in fact)\n {\n if (kvp.Key <= last_kvp.Key) throw new Exception();\n if (!IsPrime(kvp.Key, 30)) throw new Exception();\n res *= (long)Math.Pow(kvp.Key, kvp.Value);\n last_kvp = kvp;\n }\n if (res != t) throw new Exception();\n }\n\n //for (int i = 2; i < 100; i += 10)\n //{\n // List p = GetPrimes(i);\n // int est = (int)(1.2 * (i) / Math.Log(i));\n // Console.WriteLine(p.Count + \" \" + ((double)est / p.Count));\n //}\n\n return;\n }\n\n public static List GetPrimes(int n)\n {\n if (n < 0) throw new ArgumentException();\n if (n < 2) return new List(0);\n bool[] a = new bool[n - 1];\n int x = 2;\n while (x * x <= n)\n {\n for (int i = x + x; i <= n; i += x) a[i - 2] = true;\n do { x++; } while (x <= n && a[x - 2]);\n }\n\n int est = (int)(1.2 * (n) / Math.Log(n));\n List res = new List(est);\n for (int i = 2; i <= n; i++)\n if (!a[i - 2]) res.Add(i);\n return res;\n }\n\n public static bool IsPrime(int n, int s)\n {\n if (n <= 0) throw new Exception();\n if (n == 1) return false;\n if (n == 2) return true;\n\n int b = n - 1;\n int b_highbit = 1 << 30;\n while ((b & b_highbit) == 0) b_highbit >>= 1;\n\n for (; s > 0; s--)\n {\n int a = rnd.Next(2, n);\n int c = 1;\n for (int bit = b_highbit; bit != 0; bit >>= 1)\n {\n int x = c;\n c = (int)((long)c * c % n);\n if (c == 1 && x != 1 && x != n - 1) return false;\n if ((b & bit) != 0) c = (int)((long)c * a % n);\n }\n if (c != 1) return false;\n }\n return true;\n }\n\n public static bool IsPrime(long n, int s)\n {\n if (n <= 0) throw new Exception();\n if (n == 1) return false;\n if (n == 2) return true;\n\n long b = n - 1;\n long b_highbit = 1L << 62;\n while ((b & b_highbit) == 0) b_highbit >>= 1;\n\n checked\n {\n for (; s > 0; s--)\n {\n long a = (long)(rnd.NextDouble() * (n - 1 - 2 + 1)) + 2;\n long c = 1;\n for (long bit = b_highbit; bit != 0; bit >>= 1)\n {\n long x = c;\n c = (long)((decimal)c * c % n);\n if (c == 1 && x != 1 && x != n - 1) return false;\n if ((b & bit) != 0) c = (long)((decimal)c * a % n);\n }\n if (c != 1) return false;\n }\n return true;\n }\n }\n\n\n static List primes_cache;\n static int primes_cache_n = -1;\n\n public static List> Factorization(int n)\n {\n if (n <= 0) throw new ArgumentException();\n List> res = new List>();\n\n int sqrt_n = (int)(Math.Sqrt(n));\n\n if (primes_cache_n < sqrt_n)\n {\n primes_cache = GetPrimes(sqrt_n);\n primes_cache_n = sqrt_n;\n }\n\n int p = 0;\n while (n > 1)\n {\n if (p >= primes_cache.Count || primes_cache[p] > sqrt_n) break;\n if (n % primes_cache[p] == 0)\n {\n int q = 0;\n do\n {\n n /= primes_cache[p];\n q++;\n } while (n % primes_cache[p] == 0);\n res.Add(new KeyValuePair(primes_cache[p], q));\n }\n p++;\n }\n\n if (n > 1) res.Add(new KeyValuePair(n, 1));\n\n return res;\n }\n\n public static List> Factorization(long n)\n {\n if (n <= 0) throw new ArgumentException();\n List> res = new List>();\n\n int sqrt_n = checked((int)(Math.Sqrt(n)));\n\n if (primes_cache_n < sqrt_n)\n {\n primes_cache = GetPrimes(sqrt_n);\n primes_cache_n = sqrt_n;\n }\n\n int p = 0;\n while (n > 1)\n {\n if (p >= primes_cache.Count || primes_cache[p] > sqrt_n) break;\n if (n % primes_cache[p] == 0)\n {\n int q = 0;\n do\n {\n n /= primes_cache[p];\n q++;\n } while (n % primes_cache[p] == 0);\n res.Add(new KeyValuePair(primes_cache[p], q));\n }\n p++;\n }\n\n if (n > 1) res.Add(new KeyValuePair(n, 1));\n\n return res;\n }\n }\n\n static int Main(string[] args)\n {\n //Test(); return 0;\n //Console.SetIn(File.OpenText(\"_input\"));\n //Console.SetOut(File.CreateText(\"_out\"));\n Parser parser = new Parser();\n\n while (!parser.SeekEOF)\n {\n int n=parser.ReadInt();\n int q = 0;\n for (int i = 1; i <= n; i++)\n {\n List> f = Numbers.Factorization(i);\n if (f.Count == 2) q++;\n }\n\n Console.WriteLine(q);\n }\n sw.Stop();\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace contest26\n{\n class Program\n {\n static int Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = int.Parse(s);\n int cnt = 0;\n for (int i = 4; i <= n; ++i)\n {\n int N = i;\n int divCnt = 0;\n for (int j = 2; j * j <= N; ++j)\n {\n if (N % j == 0)\n divCnt++;\n while (N % j == 0)\n N /= j;\n }\n if (N > 1)\n divCnt++;\n\n if (divCnt == 2)\n cnt++;\n }\n\n Console.WriteLine(cnt);\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Task_26A\n{\n class Program\n {\n static bool IsPrime(int num)\n {\n if (num == 2)\n return true;\n if (num < 0 || num % 2 == 0)\n return false;\n int limit = (int)Math.Sqrt(num);\n for (int i = 3; i <= limit; i += 2)\n {\n if (num % i == 0)\n return false;\n }\n return true;\n }\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n int counter = 0, ans = 0;\n\n for(int i = 2; i<= num; i++)\n {\n for(int j = 2; j<=num; j++)\n {\n if (i % j == 0 && IsPrime(j))\n counter++; \n }\n if (counter == 2)\n {\n ans++;\n counter = 0;\n }\n else\n counter = 0;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Task26A\n{\n class Program\n { \n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n List Primes = new List();\n for (int i = 2; i <= N; i++)\n if (IsPrime(i)) Primes.Add(i);\n\n int ans = 0;\n for (int i = 1; i <= N; i++)\n if (IsAlmostPrime(i, ref Primes)) ans++;\n\n Console.WriteLine(ans);\n\n }\n private static bool IsAlmostPrime(int n, ref List pNums)\n { int countDivisor = 0;\n for (int i = 0; i < pNums.Count; i++)\n {\n if (n % pNums[i] == 0) countDivisor++;\n if (pNums[i] > n / 2) break;\n }\n return countDivisor == 2;\n }\n private static bool IsPrime(int n)\n {\n\n if (n == 2 ) return true;\n if (n <= 1|| n%2==0)\n return false;\n\n //for (int i = 2; i <= n/2; i++)\n // if (n % i == 0)\n // return false;\n \n for (int i = 3; i <= Math.Sqrt(n); i+=2) \n if (n % i == 0)\n return false;\n\n return true;\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var isNotPrime = new bool[n+1];\n isNotPrime[0] = true;\n isNotPrime[1] = true;\n var primes = new List();\n for (int i = 2; i <= n; i++)\n {\n if(isNotPrime[i])\n continue;\n primes.Add(i);\n for (int j = i*i; j <= n; j+=i)\n isNotPrime[j] = true; \n }\n\n var res = 0;\n for (int i = 6; i <= n; i++)\n {\n var cnt = 0;\n for (int j = 0; j < primes.Count; j++)\n {\n if (i%primes[j] == 0)\n cnt++;\n if(cnt > 2)\n break;\n }\n\n if (cnt == 2)\n res++;\n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var cntPrimes = n/2 + 2;\n var isNotPrime = new bool[cntPrimes];\n isNotPrime[0] = true;\n isNotPrime[1] = true;\n var primes = new List();\n for (int i = 2; i < cntPrimes; i++)\n {\n if(isNotPrime[i])\n continue;\n primes.Add(i);\n for (int j = i * i; j < cntPrimes; j += i)\n isNotPrime[j] = true; \n }\n\n var res = 0;\n for (int i = 6; i <= n; i++)\n {\n var cnt = 0;\n for (int j = 0; j < primes.Count; j++)\n {\n if (i%primes[j] == 0)\n cnt++;\n if(cnt > 2)\n break;\n }\n\n if (cnt == 2)\n res++;\n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 6 ; a <= n ; a++ ){\n int num = 0;\n for(int b = 0 ; b= 3){\n b = m;\n break;\n }\n num++;\n }\n if(b == m-1 && num == 2 ){\n ans++;\n }\n }\n \n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round26\n{\n class A\n {\n static bool[] ps = new bool[3001];\n static bool p(int n)\n {\n int m = 0;\n for (int i = 2; i < n; i++ ) if(!ps[i] && n%i==0)m++;\n return m == 2;\n }\n\n public static void Main()\n {\n ps[0] = ps[1] = true;\n for (int i = 2; i < 3000; i++)\n if (!ps[i]) for (int j = i+i; j < 3001; j += i) ps[j] = true;\n int n = int.Parse(Console.ReadLine());\n int ret = 0;\n for (int i = 1; i <= n; i++)\n if (p(i)) ret++;\n Console.WriteLine(ret);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] mas = new int[1000];\n int[] p = new int[3001];\n mas[0] = 2;\n mas[1] = 3;\n mas[2] = 5;\n mas[3] = 7;\n int k = 4;\n for (int i = 10; i < 3000; i++)\n {\n if (isProst(i, k, mas))\n {\n mas[k] = i;\n k++;\n }\n }\n int count = 0;\n for (int i = 1; i <= 3000; i++)\n {\n if (isPProst(i, k, mas))\n {\n count++;\n }\n p[i] = count;\n }\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(p[n]);\n Console.ReadLine();\n }\n\n static bool isProst(int ch, int k, int[] mas)\n {\n bool f = true;\n for (int i = 0; i < k; i++)\n {\n if (ch % mas[i] == 0)\n {\n f = false;\n break;\n }\n }\n return f;\n }\n static bool isPProst(int ch, int k, int[] mas)\n {\n int count = 0;\n for (int i = 0; i < k; i++)\n {\n if (ch % mas[i] == 0)\n {\n count++;\n }\n }\n \n return count == 2;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace JalalHani\n{\n class Vertex\n {\n public List relations = new List();\n public List weights = new List();\n public Vertex(int r , int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n public void AddInfo (int r, int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n ////Dijkstra\n //int[] data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int n = data[0], m = data[1];\n //Dictionary Edges = new Dictionary();\n //for (int i = 0; i < m; i++)\n //{\n // data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n // int k = data[0], r = data[1], w = data[2];\n // if (Edges.Keys.Contains(k))\n // {\n // Edges[k].AddInfo(r,w);\n // }\n // else\n // {\n // Edges.Add(k, new Vertex(r, w));\n // }\n //}\n\n //foreach (var edge in Edges)\n //{\n\n //}\n }\n\n\n class Program\n {\n \n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List values = new List();\n long o = 0;\n\n for (int i = 6; i <= n; i++)\n {\n double t = (double)i/2;\n t = Math.Ceiling(t) - 1; \n var y = Enumerable.Range(2, (int)t).Where(x => i % x == 0).ToArray();\n // Console.WriteLine(i + \" : \" + string.Join(\" \" , y));\n if (y.Count() > 1)\n {\n if (y.Where(x=>IsPrime(x)).Count() == 2)\n {\n values.Add(i);\n }\n }\n }\n\n\n Console.WriteLine(values.Count);\n }\n \n static bool IsPrime (int i)\n {\n if (i < 4) return true;\n for (int j = 2; j <= (int)Math.Ceiling(Math.Sqrt(i)); j++)\n {\n if (i % j == 0)\n return false;\n }\n return true;\n }\n \n\n static int Test(int v , int m)\n {\n int p1 = 0;\n int dif = (int)Math.Ceiling((double)m / v);\n int diff = v * dif;\n p1 = (diff - m);\n p1 += dif == 2 ? 1 : dif; \n\n\n return p1;\n }\n\n static void MulticasesQuestion()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n SolveTestCase();\n }\n static void SolveTestCase()\n {\n \n }\n static int GCD(int a1, int a2)\n {\n int mx = Math.Max(a1, a2);\n int mn = Math.Min(a1, a2);\n\n if (mx % mn == 0)\n {\n return mn;\n }\n else GCD(mn, mx % mn);\n return 1;\n }\n\n static BigInteger Pow(int b, int a)\n {\n BigInteger x = 1;\n\n for (int i = 0; i < a; i++)\n {\n x *= b;\n }\n\n return x;\n }\n static void LeastCostBracketSequence()\n {\n var input = Console.ReadLine().ToCharArray();\n var isSolutionExists = true;\n long totalCost = 0;\n var balance = 0;\n\n\n var sortedVariants = new List();\n var comparer = new ByCostSwitch();\n\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '(')\n {\n balance++;\n }\n else if (input[i] == ')')\n {\n balance--;\n }\n else\n {\n var costValue = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n var variant = new Variant()\n {\n CostSwitch = costValue[0] - costValue[1],\n Position = i\n };\n\n var index = sortedVariants.BinarySearch(variant, comparer);\n if (index < 0)\n {\n index = ~index;\n }\n\n sortedVariants.Insert(index, variant);\n\n totalCost += costValue[1];\n balance--;\n }\n\n\n if (balance < 0)\n {\n if (sortedVariants.Count == 0)\n {\n isSolutionExists = false;\n break;\n }\n\n\n var sortedVariant = sortedVariants[0];\n\n input[sortedVariant.Position] = '(';\n totalCost += sortedVariant.CostSwitch;\n balance += 2;\n sortedVariants.RemoveAt(0);\n }\n }\n\n isSolutionExists = (balance == 0);\n\n if (isSolutionExists)\n {\n Console.WriteLine(totalCost);\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '?')\n {\n Console.Write(')');\n }\n else\n {\n Console.Write(input[i]);\n }\n }\n Console.WriteLine();\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n class Commands\n {\n public static int[] NextIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n }\n public static List NextIntList\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n public static int[] NextSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static int[] NextDescSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static long[] NextLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToArray();\n }\n }\n public static List NextLongList\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToList();\n }\n }\n public static long[] NextSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static long[] NextDescSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static int NextInt\n {\n get\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static string NextString\n {\n get { return Console.ReadLine(); }\n }\n }\n\n private class Variant\n {\n public int CostSwitch;\n public int Position;\n }\n\n private class ByCostSwitch : IComparer\n {\n #region IComparer implementation\n public int Compare(Variant x, Variant y)\n {\n return x.CostSwitch.CompareTo(y.CostSwitch);\n }\n #endregion\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _26A\n{\n class Program\n {\n\n static bool IsPrime(int num)\n {\n if (num == 2) return true;\n if (num < 2 || num % 2 == 0) return false;\n int limit = (int)Math.Sqrt(num);\n for (int i = 3; i <= limit; i += 2)\n if (num % i == 0)\n return false;\n\n\n return true;\n }\n\n static bool AlmostPrime(int num)\n {\n int counter = 0;\n for (int i = 2; i <= num / 2; i++)\n {\n if (num % i == 0 && IsPrime(i)) counter++;\n }\n return counter == 2;\n }\n \n\n\n static void Main(string[] args)\n {\n int n=int.Parse(Console.ReadLine());\n int answer = 0;\n for (int i = 1; i <= n; i++)\n if (AlmostPrime(i)) answer++;\n\n Console.WriteLine(answer);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _26A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n var primes = new SortedSet();\n for (int i = 2; i <= n; i++)\n {\n bool isPrime = true;\n\n foreach (int p in primes)\n {\n if (i % p == 0)\n {\n isPrime = false;\n break;\n }\n }\n\n if (isPrime)\n {\n primes.Add(i);\n }\n }\n\n Console.WriteLine(Enumerable.Range(1, n).Count(i => primes.Count(p => i % p == 0) == 2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nclass AlmostPrime\n{\n public static int almostPrime(int n)\n {\n bool[] primes = new bool[n + 1];\n int[] count = new int[n + 1];\n for (int i = 2; i <= n; i++)\n {\n primes[i] = true;\n }\n for (int i = 2; i <= n/2; i++)\n {\n if (primes[i])\n {\n for (int j = 2; i * j <= n; j++)\n {\n primes[i * j] = false;\n count[i * j]++;\n }\n }\n }\n int ans = 0;\n for (int i = 0; i <= n; i++)\n {\n if (count[i] == 2)\n {\n ans++;\n }\n }\n return ans;\n }\n static public void Main () {\n int n = Convert.ToInt32(Console.ReadLine());\n int res = almostPrime(n);\n Console.WriteLine(res);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int[] nums = new int[n + 1];\n for (int i = 2; i <= n; i++)\n if(nums[i] == 0)\n for (int j = i + i; j <= n; j += i)\n nums[j]++;\n\n int count = 0;\n for (int i = 0; i < nums.Length; i++)\n if (nums[i] == 2)\n count++;\n\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nclass Program\n{\n class Pair : System.IComparable\n {\n public int x;\n public int y;\n\n public Pair(int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int CompareTo(object obj)\n {\n Pair p = (Pair)obj;\n return x < p.x ? -1 : x == p.x ? 0 : 1;\n }\n }\n\n static int[] GetInts()\n {\n string[] ss = GetStrs();\n int[] nums = new int[ss.Length];\n\n int i = 0;\n foreach (string s in ss)\n nums[i++] = GetInt(s);\n\n return nums;\n }\n\n static string[] GetStrs()\n {\n return Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static int GetInt(string s)\n {\n return int.Parse(s);\n }\n\n static long GetLong(string s)\n {\n return long.Parse(s);\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static void WL(String s)\n {\n Console.WriteLine(s);\n }\n\n static void WL(long s)\n {\n Console.WriteLine(s);\n }\n\n static void W(String s)\n {\n Console.Write(s);\n }\n\n static void W(long s)\n {\n Console.Write(s);\n }\n\n static void Main(string[] args)\n {\n int[] t = GetInts();\n\n bool[] p = new bool[3000];\n for (int i = 2; i < 3000; ++i)\n p[i] = true;\n\n for (int i = 2; i < 3000; ++i)\n {\n for (int j = 2*i; j < 3000; j += i)\n p[j] = false;\n }\n\n int n = t[0];\n int a = 0;\n for (int i = 2; i <= n; ++i)\n {\n int c = 0;\n for (int j = 2; j < i; ++j)\n {\n if (p[j] && i % j == 0) ++c;\n }\n if (c == 2)\n ++a;\n }\n W(a);\n\n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplicationNick1\n{\n class Program\n {\n static void Main()\n {\n int n, m, i, j, col;\n string s;\n int plen;\n int[] p;\n bool flag;\n p = new int[3000];\n Int32.TryParse(Console.ReadLine(), out n);\n plen=1;\n p[0]=2;\n for (i = 3; i <= n; i++)\n {\n flag = true;\n for (j = 0; flag && j < plen; j++)\n {\n if (i % p[j] == 0) { flag = false; }\n }\n if (flag) {\n p[plen] = i;\n plen++;\n //Console.Write(i+\"\\n\");\n }\n }\n m = 0;\n for (i = 1; i <= n; i++)\n {\n col = 0;\n for (j = 0; j< plen && p[j] < i; j++)\n {\n if (i % p[j] == 0) { col++; }\n }\n if (col == 2) { m++; }\n }\n Console.Write(m);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A26_AlmostPrime\n { \n public static void Main()\n {\n int[] prime = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,\n 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197,\n 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,\n 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449,\n 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593,\n 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727,\n 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863,\n 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019,\n 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129,\n 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279,\n 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427,\n 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543,\n 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663,\n 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801,\n 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951,\n 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087,\n 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239,\n 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371,\n 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521,\n 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671,\n 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789,\n 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927,\n 2939, 2953, 2957, 2963, 2969, 2971, 2999 };\n int n = int.Parse(Console.ReadLine());\n int subptie = 0;\n \n for(int i = n; i > 5; i--)\n {\n int count = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i / 2 < prime[j])\n break;\n\n if (i % prime[j] == 0)\n count++;\n\n if (count > 2)\n {\n count = 0;\n break;\n } \n }\n if (count == 2)\n subptie++;\n }\n Console.WriteLine(subptie);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Task_26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int ans = 0;\n List primeNumbers = new List();\n for (int i = 2; i <= n; i++)\n {\n if (isPrime(i))\n primeNumbers.Add(i);\n }\n for (int i = 1; i <= n; i++)\n if (isAlmoastPrime(ref primeNumbers, i))\n ans++;\n\n\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n\n\n }\n\n private static bool isPrime(int number)\n {\n if (number == 2)\n return true;\n if (number % 2 == 0 || number < 2)\n return false;\n\n for (int i = 3; i <= Math.Sqrt(number); i += 2)\n if (number % i == 0)\n return false;\n\n return true;\n }\n private static bool isAlmoastPrime(ref List Primes, int item)\n {\n int count = 0;\n for (int i = 0; i < Primes.Count; i++)\n {\n if (item % Primes[i] == 0)\n count++;\n if (count > 2)\n return false;\n }\n \n return count == 2;\n }\n }\n\n }\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Task_26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int ans = 0;\n ArrayList primeNumbers = new ArrayList();\n for (int i = 2; i <= n; i++)\n {\n if (isPrime(i))\n primeNumbers.Add(i);\n }\n for (int i = 1; i <= n; i++)\n if (isAlmoastPrime(primeNumbers, i))\n ans++;\n\n\n\n Console.WriteLine(ans);\n \n\n\n }\n\n private static bool isPrime(int number)\n {\n if (number == 2)\n return true;\n if (number % 2 == 0 || number < 2)\n return false;\n\n for (int i = 3; i <= Math.Sqrt(number); i += 2)\n if (number % i == 0)\n return false;\n\n return true;\n }\n private static bool isAlmoastPrime(ArrayList Primes, int item)\n {\n int count = 0;\n for (int i = 0; i < Primes.Count; i++)\n {\n if (item % (int) Primes[i] == 0)\n count++;\n if (count > 2)\n return false;\n }\n \n return count == 2;\n }\n }\n\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesApp\n{\n class A\n {\n static List primes = new List();\n\n static void Main(string[] args)\n { \n int n = int.Parse(Console.ReadLine());\n primes = BuildPrimes(n + 1);\n\n int total = 0;\n for (int x = 1; x <= n; x++)\n {\n Dictionary f = Factorize(x);\n\n //string res = \"\";\n //foreach (var it in f)\n //{\n // res += it.Key + \"^\" + it.Value + \" + \";\n //}\n\n //Console.WriteLine(x + \" = \" + res);\n\n if (f.Count == 2)\n {\n total++;\n }\n }\n Console.WriteLine(total);\n }\n\n public static List BuildPrimes(long n)\n {\n List p = new List();\n if (n > 2) p.Add(2);\n\n for (int i = 3; i <= n; i += 2)\n {\n bool prime = true;\n for (int j = 0; p[j] * p[j] <= i; j++)\n {\n if (i % p[j] == 0)\n {\n prime = false;\n break;\n }\n }\n if (prime)\n p.Add(i);\n }\n return p;\n }\n\n public static Dictionary Factorize(int n)\n {\n Dictionary d = new Dictionary();\n\n while (n > 1)\n {\n bool changed = false;\n foreach (int p in primes)\n {\n while (n % p == 0)\n {\n if (d.ContainsKey(p))\n d[p]++;\n else\n d.Add(p, 1);\n n /= p;\n changed = true;\n }\n }\n if (!changed && n > 1)\n {\n d.Add(n, 1);\n n = 1;\n }\n }\n\n return d;\n }\n\n }\n}\n"}, {"source_code": "//#define TEST\n#if TEST\nusing System.IO;\n#endif\n\nusing System;\nusing System.Text;\n\nnamespace CF\n{\n #region Start\n#if !TEST\n using cin = Console;\n using cout = Console;\n#endif\n#endregion\n class Program\n { \n static void Main(string[] args)\n {\n #region BEGIN\n #if TEST\n string filepath = @\"E:\\Projects 2010\\CF55\\B\\\";\n FileStream file = new FileStream(String.Concat(filepath, @\"input.txt\"), FileMode.Open, FileAccess.Read);\n StreamReader cin = new StreamReader(file);\n FileStream fileOut = new FileStream(String.Concat(filepath, @\"output.txt\"), FileMode.Truncate, FileAccess.Write);\n StreamWriter cout = new StreamWriter(fileOut, System.Text.Encoding.Unicode);\n #endif\n try\n {\n #endregion \n int n = int.Parse(cin.ReadLine());\n int[] pr = new int[n];\n int N=0;\n for(int i=2;i;\nusing System.Text;\nclass Program\n{\n static void Main(string[] args)\n {\n Solve();\n //WriteLine(Solve());\n }\n static void Solve()\n {\n var num = Input.num;\n var ct = new int[num+1];\n for (var i = 2; i <= num; i++)\n if (ct[i] == 0)\n for (var j = i; j <= num; j += i)\n ct[j]++;\n WriteLine(ct.Count(v => v == 2));\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static char[][] gred(int h) \n => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();\n public static int[] ar1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => num).ToArray();\n public static long[] arL1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();\n public static string[] strs(int n)\n => Enumerable.Repeat(0, n).Select(_ => read).ToArray();\n public static int[][] ar2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();\n public static long[][] arL2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();\n public static T getValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n int ret = 0;\n int n = nextInt();\n for (int i = 2; i <= n; i++)\n if (ok(i))\n ret++;\n println(ret);\n }\n\n private bool ok(int n)\n {\n int cnt = 0;\n for(int i=2;i*i<=n;i++)\n if (n % i == 0)\n {\n cnt++;\n while (n % i == 0)\n {\n n /= i;\n }\n }\n if (n > 1)\n cnt++;\n return cnt == 2;\n }\n ////////////\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n\n"}, {"source_code": "using System;\n\nclass P { \n static void Main() { \n var n = int.Parse(Console.ReadLine());\n var nDiv = new int[n+1];\n for (var i = 2 ; i <= n ; i++) if (nDiv[i] == 0)\n for (var j = i; j <= n; j+=i) nDiv[j]++;\n var count = 0;\n for (var i = 2; i <= n; i++) if (nDiv[i] == 2) count++;\n Console.Write(count);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace codeforces\n{\n class C\n {\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\n21\n\");\n\n\n static void Main(string[] args)\n {\n int n = int.Parse(CF.ReadLine());\n\n List ap = new List();\n {\n List ps = _p(n);\n for (int p1 = 0; p1 < ps.Count; p1++)\n {\n for (int p2 = p1 + 1; p2 < ps.Count; p2++)\n {\n int n1 = 1;\n for (int c1 = 1; ; c1++)\n {\n n1*= ps[p1];\n if (n1 > n)\n break;\n\n int n1n2 = n1;\n\n for(int c2 = 1;;c2++)\n {\n n1n2*=ps[p2];\n if( n1n2 > n )\n break;\n ap.Add(n1n2);\n }\n }\n }\n }\n }\n CF.WriteLine(ap.Count);\n }\n\n\n static List _p(int n)\n {\n if (n < 2)\n return new List();\n\n Lists = new List();\n for (int i = 2; i <= n; i ++)\n s.Add(i);\n\n List ps = new List();\n\n for (; ; )\n {\n int p = s[0];\n ps.Add(p);\n\n List s2 = new List();\n foreach (int i in s)\n {\n if (i % p != 0)\n s2.Add(i);\n }\n s = s2;\n\n if (s.Count == 0 || s[s.Count - 1] * s[s.Count - 1] < ps[ps.Count - 1])\n break;\n }\n return ps;\n }\n\n #region test\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n\n string _test_input;\n\n List _lines;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tint s=Convert.ToInt32(Console.ReadLine());\n\t\tList ll=new List();\n\t\tll.Add(2);\n\t\tfor(int i=3;i<=s;i++)\n\t\t{\n\t\t\tint j;bool yea=false;\n\t\t\tfor(j=2;j*j<=i;j++)\n\t\t\t{\n\t\t\t\tif(i%j==0)\n\t\t\t\t{\n\t\t\t\t\tyea=true;break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!yea)ll.Add(i);\n\t\t}\n\t\tint cc=0;\n\t\tfor(int i=1;i<=s;i++)\n\t\t{\n\t\t\tint count=0;\n\t\t\tfor(int j=0;j divs = new HashSet();\n\n for (int i = 2; i <= n; i++)\n {\n int k = 2, j = i;\n while (true) {\n if (j % k == 0)\n {\n divs.Add(k);\n j /= k;\n } else k++;\n\n if (j == 1) break;\n }\n\n if (divs.Count == 2) count++;\n divs.Clear();\n }\n\n print(count);\n \n\n\n\n\n \n#if !ONLINE_JUDGE\n fout.Close();\n#endif\n }\n\n struct quat { public T1 fst; public T2 snd; public T3 thr; public T4 frt; }\n struct trip { public T1 fst; public T2 snd; public T3 thr; }\n struct pair { public T1 fst; public T2 snd; }\n static long LCM(long a, long b) { return a / GCD(a, b) * b; }\n static long GCD(long a, long b) { if (b == 0) return a; else return GCD(b, a % b); }\n static void swap(ref T a, ref T b) { T tmp = a; a = b; b = tmp; }\n static double dist(double x1, double y1, double x2, double y2) { return Math.Sqrt(Math.Pow(x1-x2, 2)+Math.Pow(y1-y2, 2)); }\n static void fill(T[] d, T v) { for (int i = 0; i < d.Length; i++) d[i] = v; }\n static void fill(T[,] d, T v) { for (int i = 0; i < d.GetLength(0); i++) { for (int j = 0; j < d.GetLength(1); j++) { d[i, j] = v; } } }\n\n static void print(double v) { Console.Write(v); }\n static void print(long v) { Console.Write(v); }\n static void print(int v) { Console.Write(v); }\n static void print(string v) { Console.Write(v); }\n static void print(char v) { Console.Write(v); }\n //static void print(BigInteger v) { Console.Write(v); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n\n static void println(double v) { Console.WriteLine(v); }\n static void println(long v) { Console.WriteLine(v); }\n static void println(int v) { Console.WriteLine(v); }\n static void println(string v) { Console.WriteLine(v); }\n static void println(char v) { Console.WriteLine(v); }\n //static void println(BigInteger v) { Console.WriteLine(v); }\n static void println() { Console.WriteLine(); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n\n static string RL() { return Console.ReadLine(); }\n static int[] readValsI(int n) { int[] t = new int[n]; for (int i = 0; i < n; i++) t[i] = readInt(); return t; }\n static double[] readValsD(int n) { double[] t = new double[n]; for (int i = 0; i < n; i++) t[i] = readDouble(); return t; }\n\n /*static BigInteger readBigInt()\n {\n BigInteger val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }*/\n\n static double readDouble() {\n bool m = false;\n double val = 0;\n int c = 0, r = 1;\n while(((c=Console.Read())<'0' || c>'9') && c!='-') {}\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read()) >= '0' && c <= '9') val = val * 10 + (m?-(c-48):(c-48));\n if(c=='.') while ((c = Console.Read()) >= '0' && c <= '9'){ val += ((double)(c-48))/(r*=10); }\n\n return val;\n }\n\n static long readLong()\n {\n long val = 0;\n bool m = false;\n int c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }\n\n static int readInt()\n {\n bool m = false;\n int val = 0, c;\n while (((c = Console.Read()) < '0' || c > '9') && c != '-') { }\n val = (c >= '0' && c <= '9') ? c - 48 : (c == '-' ? m=true : m=false) ? 0 : 0;\n while ((c = Console.Read() - 48) >= 0 && c <= 9) val = val*10 + (m?-c:c);\n return val;\n }\n\n static string readLine() {\n string s = \"\";\n int c;\n while((c=Console.Read())!=10 && c!=-1) s+=(char)c;\n return s;\n }\n\n static string readString() {\n string s = \"\";\n int c;\n while ((c = Console.Read()) != 10 && c != 32 && c != -1) s += (char)c;\n return s;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Almost_Prime\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var pr = new List {2, 3};\n for (int i = 5; i < n; i += 2)\n {\n if (pr.All(j => i%j != 0))\n pr.Add(i);\n }\n var che = new List();\n for (int i = 1; i < pr.Count; i++)\n {\n int d = pr[i];\n while (d <= n)\n {\n che.Add(d);\n d *= pr[i];\n }\n }\n che.Sort();\n\n int count = 0;\n for (int i = 6; i <= n; i++)\n {\n for (int j = 0; j < pr.Count; j++)\n {\n if (i <= pr[j])\n break;\n\n if (i%pr[j] == 0)\n {\n int o = i;\n while (o%pr[j] == 0)\n {\n o /= pr[j];\n }\n int index = che.BinarySearch(o);\n if (index >= 0 && che[index] % pr[j] != 0)\n count++;\n\n break;\n }\n }\n }\n\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\npublic static class BatchSystem {\n public static int printPrimeFactors(int number)\n {\n int ret = 0;\n for (int i = 2; i <= number; i++) // Test for factors > 1\n {\n if (number % i == 0) // It is a factor > 1\n {\n bool prime = true;\n for (int j = 2; j < i; j++) // Test for prime\n {\n if (i % j == 0) // It is not prime\n prime = false;\n }\n if (prime)\n ret++;\n }\n }\n return ret;\n }\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int cnt = 0;\n for (int i = 2; i <= n; i++)\n if (printPrimeFactors(i) == 2)\n cnt++;\n Console.WriteLine(cnt);\n return;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_026A {\n class Program {\n static void Main(string[] args) {\n //gen p\n int[] p=new int[1000]; p[0]=2;\n int u=1,t=3,j; while(t<3000) { p[u]=t; j=1; while(t%p[j]!=0) j++; if(j==u) u++; t+=2; }\n int o=0,n=int.Parse(Console.ReadLine()),i=1;\n\n for(i=6;i<=n;i++) {\n t=i;\n j=0; while(t%p[j]!=0) j++;\n if(t==p[j]) continue;\n while(t%p[j]==0) t/=p[j];\n if(t==1) continue;\n while(t%p[j]!=0) j++;\n while(t%p[j]==0) t/=p[j];\n if(t==1) o++;\n }\n Console.WriteLine(o);\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _26a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var n = readInt();\n var res = 0;\n for (int i = 2; i <= n; i++)\n {\n var num = i;\n var dc = 0;\n var sq = Math.Ceiling(Math.Sqrt(i));\n for (int j = 2; j <= sq; j++)\n {\n if (num % j == 0)\n {\n dc++;\n }\n\n while (num % j == 0)\n {\n num /= j;\n }\n }\n\n if (num != 1)\n {\n dc++;\n }\n\n if (dc == 2)\n {\n res++;\n }\n }\n\n Console.WriteLine(\"{0}\", res);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass CF_26A\n{\n static int[] getPrime(int n)\n {\n bool[] isPrime = Enumerable.Repeat(true, n + 1).ToArray();\n isPrime[0] = false;\n isPrime[1] = false;\n List prime = new List();\n for (int i = 2; i < n + 1; i++)\n {\n if (isPrime[i])\n {\n prime.Add(i);\n for (int j = i + i; j < n + 1; j += i)\n {\n isPrime[j] = false;\n }\n }\n }\n return prime.ToArray();\n }\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] prime = getPrime(n);\n int[] cnt = Enumerable.Repeat(0, n + 1).ToArray();\n for (int i = 2; i <= n; i++)\n {\n foreach (int p in prime)\n {\n if (i % p == 0)\n {\n cnt[i]++;\n }\n if (i < p || cnt[i] > 2)\n {\n break;\n }\n }\n }\n Console.WriteLine(cnt.Count(x => x == 2));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace ConsoleApp4\n{\n class Program\n {\n public static bool Prost(ushort x)\n {\n bool p = true;\n for (ushort z = 2; z <= x / 2; z++)\n if (x % z == 0)\n p = false;\n return p;\n }\n static void Main(string[] args)\n {\n ushort n = ushort.Parse(Console.ReadLine());\n ushort b = 0;\n for(ushort i =6;i<=n;i++)\n {\n ushort x = i;\n for(ushort j =2; j<=x;j++)\n {\n if ((Prost(j)) && (x % j == 0))\n {\n while (x % j == 0)\n x = (ushort)(x / j);\n break;\n }\n }\n if (x != 1)\n {\n for (ushort k = 3; k <= x; k++)\n {\n if ((Prost(k)) && (x % k == 0))\n {\n while (x % k == 0)\n x = (ushort)(x / k);\n break;\n }\n }\n if (x == 1)\n {\n b++;\n }\n }\n\n }\n Console.WriteLine(b);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int ans = 0;\n bool[] nprimes = new bool[3000 + 1];\n nprimes[1] = true;\n for(int i = 2; i <= 3000; i++) {\n if(nprimes[i])\n continue;\n for(int j = 2 * i; j <= 3000; j += i) {\n nprimes[j] = true;\n }\n }\n for(int i = 1; i <= n; i++) {\n int count = 0;\n for(int j = 2; j <= i; j++) {\n if(nprimes[j])\n continue;\n if(i % j != 0)\n continue;\n count++;\n }\n if(count == 2)\n ans++;\n }\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 0 ; a < m ; a++ ){\n for(int b = 0 ; b < m ; b++){\n int tmp = aP[a]*aP[b];\n if( tmp <= n){\n if(a != b){\n ans += n/tmp ;\n }\n }\n }\n }\n Console.WriteLine(ans/2);\n }\n}"}, {"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 0 ; a < m ; a++ ){\n for(int b = 0 ; b < m ; b++){\n if(aP[a]*aP[b] <= n){\n if(a != b){Console.WriteLine(aP[a]*aP[b]);\n ans++;\n }\n }\n }\n }\n Console.WriteLine(ans/2);\n }\n}"}, {"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 6 ; a <= n ; a++ ){\n int num = 0;\n for(int b = 0 ; b= 2 ){\n ans++;\n }\n }\n \n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 0 ; a < m ; a++ ){\n for(int b = 0 ; b < m ; b++){\n if(aP[a]*aP[b] <= n){\n if(a != b){\n ans++;\n }\n }\n }\n }\n Console.WriteLine(ans/2);\n }\n}"}, {"source_code": "using System;\nclass Test {\n public static void Main(){\n int n = Int32.Parse(Console.ReadLine());\n int [] aP = new int[n];\n aP[0] = 2;\n int k = 1;\n for(int i = 0 ; i<= n ; i++){\n for(int j = 2 ; j< i ; j++){\n if( i%j == 0 ){\n break;\n }\n if(j == i-1){\n aP[k] = i;\n k++;\n }\n }\n }\n int m = Array.IndexOf(aP,0);\n int ans = 0;\n for(int a = 0 ; a <= n ; a++ ){\n int num = 0;\n for(int b = 0 ; b= 3){\n b = m;\n break;\n }\n num++;\n }\n if(b == m-1 && num == 2 ){\n ans++;\n }\n }\n \n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace JalalHani\n{\n class Vertex\n {\n public List relations = new List();\n public List weights = new List();\n public Vertex(int r , int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n public void AddInfo (int r, int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n ////Dijkstra\n //int[] data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int n = data[0], m = data[1];\n //Dictionary Edges = new Dictionary();\n //for (int i = 0; i < m; i++)\n //{\n // data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n // int k = data[0], r = data[1], w = data[2];\n // if (Edges.Keys.Contains(k))\n // {\n // Edges[k].AddInfo(r,w);\n // }\n // else\n // {\n // Edges.Add(k, new Vertex(r, w));\n // }\n //}\n\n //foreach (var edge in Edges)\n //{\n\n //}\n }\n\n\n class Program\n {\n \n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List values = new List();\n long o = 0;\n\n for (int i = 6; i <= n; i++)\n {\n double t = (double)i/2;\n t = Math.Ceiling(t) - 1; \n var y = Enumerable.Range(2, (int)t).Where(x => i % x == 0).ToArray();\n Console.WriteLine(i + \" : \" + string.Join(\" \" , y));\n if (y.Count() > 1)\n {\n if (y.Where(x=>IsPrime(x)).Count() == 2)\n {\n values.Add(i);\n }\n }\n }\n\n\n Console.WriteLine(values.Count);\n }\n \n static bool IsPrime (int i)\n {\n if (i < 4) return true;\n for (int j = 2; j <= (int)Math.Ceiling(Math.Sqrt(i)); j++)\n {\n if (i % j == 0)\n return false;\n }\n return true;\n }\n \n\n static int Test(int v , int m)\n {\n int p1 = 0;\n int dif = (int)Math.Ceiling((double)m / v);\n int diff = v * dif;\n p1 = (diff - m);\n p1 += dif == 2 ? 1 : dif; \n\n\n return p1;\n }\n\n static void MulticasesQuestion()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n SolveTestCase();\n }\n static void SolveTestCase()\n {\n \n }\n static int GCD(int a1, int a2)\n {\n int mx = Math.Max(a1, a2);\n int mn = Math.Min(a1, a2);\n\n if (mx % mn == 0)\n {\n return mn;\n }\n else GCD(mn, mx % mn);\n return 1;\n }\n\n static BigInteger Pow(int b, int a)\n {\n BigInteger x = 1;\n\n for (int i = 0; i < a; i++)\n {\n x *= b;\n }\n\n return x;\n }\n static void LeastCostBracketSequence()\n {\n var input = Console.ReadLine().ToCharArray();\n var isSolutionExists = true;\n long totalCost = 0;\n var balance = 0;\n\n\n var sortedVariants = new List();\n var comparer = new ByCostSwitch();\n\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '(')\n {\n balance++;\n }\n else if (input[i] == ')')\n {\n balance--;\n }\n else\n {\n var costValue = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n var variant = new Variant()\n {\n CostSwitch = costValue[0] - costValue[1],\n Position = i\n };\n\n var index = sortedVariants.BinarySearch(variant, comparer);\n if (index < 0)\n {\n index = ~index;\n }\n\n sortedVariants.Insert(index, variant);\n\n totalCost += costValue[1];\n balance--;\n }\n\n\n if (balance < 0)\n {\n if (sortedVariants.Count == 0)\n {\n isSolutionExists = false;\n break;\n }\n\n\n var sortedVariant = sortedVariants[0];\n\n input[sortedVariant.Position] = '(';\n totalCost += sortedVariant.CostSwitch;\n balance += 2;\n sortedVariants.RemoveAt(0);\n }\n }\n\n isSolutionExists = (balance == 0);\n\n if (isSolutionExists)\n {\n Console.WriteLine(totalCost);\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '?')\n {\n Console.Write(')');\n }\n else\n {\n Console.Write(input[i]);\n }\n }\n Console.WriteLine();\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n class Commands\n {\n public static int[] NextIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n }\n public static List NextIntList\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n public static int[] NextSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static int[] NextDescSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static long[] NextLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToArray();\n }\n }\n public static List NextLongList\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToList();\n }\n }\n public static long[] NextSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static long[] NextDescSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static int NextInt\n {\n get\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static string NextString\n {\n get { return Console.ReadLine(); }\n }\n }\n\n private class Variant\n {\n public int CostSwitch;\n public int Position;\n }\n\n private class ByCostSwitch : IComparer\n {\n #region IComparer implementation\n public int Compare(Variant x, Variant y)\n {\n return x.CostSwitch.CompareTo(y.CostSwitch);\n }\n #endregion\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A26_AlmostPrime\n { \n public static void Main()\n {\n int[] prime = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n int n = int.Parse(Console.ReadLine());\n int subptie = 0;\n \n for(int i = n; i > 5; i--)\n {\n int count = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n count++;\n\n if (count > 2)\n {\n count = 0;\n break;\n } \n }\n if (count == 2)\n subptie++;\n }\n Console.WriteLine(subptie);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_026A {\n class Program {\n static void Main(string[] args) {\n //gen p\n int[] p=new int[1000]; p[0]=2;\n int u=1,t=3,j; while(t<3000) { p[u]=t; j=1; while(t%p[j]!=0) j++; if(j==u) u++; t+=2; }\n int o=0,n=int.Parse(Console.ReadLine()),i=1;\n for(;p[i]*p[i-1]<=n;o+=i,i++) ;\n for(j=i-1;j>=0;j--) if(p[j]*p[i]<=n) o++;\n Console.WriteLine(o);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace Task26A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, ans = 0;\n n = Convert.ToInt32(Console.ReadLine());\n List primes=new List ();\n for(int i = 2; i <= n; i++) \n if (isPrime(i))\n primes.Add(i);\n \n \n for (int i = 1; i <= n; i++)\n if (isAlmastPrime(ref primes,i))\n ans++;\n\n Console.WriteLine(ans);\n }\n\n private static bool isPrime(int N)\n {\n if (N == 2) return true;\n if (N < 2 || N % 2 == 0) return false;\n for (int i = 3; i <=Math.Sqrt(N); i += 2)\n if (N % i == 0) return false;\n return true;\n }\n\n private static bool isAlmastPrime(ref List mylist, int item)\n {\n int count = 0;\n for (int i = 0; i 2)\n return false;\n }\n return count == 2;\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Task26A\n{\n class Program\n { \n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n List Primes = new List();\n for (int i = 2; i <= N; i++)\n if (IsPrime(i)) Primes.Add(i);\n\n int ans = 0;\n for (int i = 6; i <= N; i++)\n if (IsAlmostPrime(i, ref Primes)) ans++;\n\n Console.WriteLine(ans);\n\n }\n private static bool IsAlmostPrime(int n, ref List pNums)\n { int countDivisor = 0;\n for (int i = 0; i < pNums.Count; i++)\n { if (pNums[i] >= n) break;\n if (n % pNums[i] == 0) countDivisor++;\n }\n return countDivisor == 2;\n }\n private static bool IsPrime(int n)\n {\n\n if (n == 2 ) return true;\n if (n <= 1|| n%2==0)\n return false;\n\n //for (int i = 2; i <= n/2; i++)\n // if (n % i == 0)\n // return false;\n \n for (int i = 3; i < Math.Sqrt(n); i+=2) \n if (n % i == 0)\n return false;\n\n return true;\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nclass P { \n static void Main() { \n var n = int.Parse(Console.ReadLine());\n var nDiv = new int[n+1];\n for (var i = 2 ; i <= n ; i++) if (nDiv[i] == 0)\n for (var j = i; j <= n; j++) nDiv[j]++;\n var count = 0;\n for (var i = 2; i <= n; i++) if (nDiv[i] == 2) count++;\n Console.Write(count);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int max_number=3000;\n bool[] isPrime = new bool[max_number+1];\n int n = int.Parse(Console.ReadLine());\n for (int i = 2; i <= n; i++) isPrime[i] = true;\n int max_factor=(int)Math.Sqrt(n);\n for (int i = 2; i <= max_factor; i++)\n if (isPrime[i])\n for (int j = i * i; j <= n; j += i) isPrime[j] = false;\n \n int count = 0;\n for (int j = 2; j <= n; j++)\n {\n max_factor = (int)Math.Sqrt(j);\n for (int i = 2; i <= max_factor; i++)\n if (j % i == 0 && isPrime[i] && isPrime[j / i] && i!=j/i)\n {\n count++;\n break;\n }\n\n }\n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Almost_Prime\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var pr = new List {2, 3};\n for (int i = 5; i < n; i += 2)\n {\n if (pr.All(j => i%j != 0))\n pr.Add(i);\n }\n\n int count = 0;\n for (int i = 6; i <= n; i++)\n {\n for (int j = 0; j < pr.Count; j++)\n {\n if (i%pr[j] == 0)\n {\n int o = i/pr[j];\n int index = pr.BinarySearch(o);\n if (index >= 0 && index != j)\n count++;\n\n break;\n }\n }\n }\n\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "356666366625bc5358bc8b97c8d67bd5"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n DateTime a = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n DateTime b = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n Console.WriteLine(Math.Abs((b-a).TotalDays));\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var d1 = DateTime.ParseExact(s1, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n var d2 = DateTime.ParseExact(s2, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n\n\n int res = Math.Abs((int)((d2 - d1).TotalDays));\n\n\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace dates\n{\n class Program\n {\n static void Main(string[] args)\n {\n string firstDateString = Console.ReadLine();\n string[] firstDateStuff = firstDateString.Split(':');\n int year = Int32.Parse(firstDateStuff[0]);\n int month = Int32.Parse(firstDateStuff[1]);\n int day = Int32.Parse(firstDateStuff[2]);\n DateTime firstDate = new DateTime(year, month, day);\n string secondDateString = Console.ReadLine();\n string[] secondDateStuff = secondDateString.Split(':');\n year = Int32.Parse(secondDateStuff[0]);\n month = Int32.Parse(secondDateStuff[1]);\n day = Int32.Parse(secondDateStuff[2]);\n DateTime secondDate = new DateTime(year, month, day);\n int dayDifference = (int) (firstDate - secondDate).TotalDays;\n Console.WriteLine(Math.Abs(dayDifference));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF183A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n var a1 = s1.Split(':');\n var a2 = s2.Split(':');\n DateTime dt1 = new DateTime(int.Parse(a1[0]),int.Parse(a1[1]),int.Parse(a1[2]));\n DateTime dt2 = new DateTime(int.Parse(a2[0]), int.Parse(a2[1]), int.Parse(a2[2]));\n var days = (dt2 - dt1).Days;\n if (days < 0)\n days = -days;\n Console.WriteLine(days);\n }\n\n }\n}\n"}, {"source_code": "using System.IO;\nusing System;\nusing System.Globalization;\n\nclass Program\n{\n static void Main()\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n \n var d1 = DateTime.ParseExact(s1, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n var d2 = DateTime.ParseExact(s2, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n \n var a1 = d1 < d2 ? d1 : d2;\n var a2 = d1 > d2 ? d1 : d2;\n \n var t1 = a2 - a1;\n Console.WriteLine(t1.TotalDays);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static int i(string s)\n {\n return Convert.ToInt32(s);\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n DateTime d1 = new DateTime(i(s[0]), i(s[1]), i(s[2]));\n s = Console.ReadLine().Split(':');\n DateTime d2 = new DateTime(i(s[0]), i(s[1]), i(s[2]));\n if(d2 < d1){\n DateTime temp = d2;\n d2 = d1;\n d1 = temp;\n }\n TimeSpan t = d2 - d1;\n Console.WriteLine(t.Days);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Calendar\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n DateTime t1, t2;\n string s = reader.ReadLine();\n\n t1 = new DateTime(int.Parse(s.Substring(0, 4)), int.Parse(s.Substring(5, 2)), int.Parse(s.Substring(8, 2)));\n s = reader.ReadLine();\n t2 = new DateTime(int.Parse(s.Substring(0, 4)), int.Parse(s.Substring(5, 2)), int.Parse(s.Substring(8, 2)));\n\n\n writer.WriteLine(Math.Abs((int) ((t2 - t1).TotalDays)));\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces____calendar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input;\n input = Console.ReadLine();\n String[] s = input.Split(':');\n int year = int.Parse(s[0]);\n int month = int.Parse(s[1]);\n int day = int.Parse(s[2]);\n DateTime start = new DateTime(year, month, day);\n input = Console.ReadLine();\n s = new String[3];\n s = input.Split(':');\n year = int.Parse(s[0]);\n month = int.Parse(s[1]);\n day = int.Parse(s[2]);\n DateTime enddate = new DateTime(year, month, day);\n TimeSpan result = enddate.Subtract(start);\n Console.WriteLine(Math.Abs(result.Days));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF.B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] d1 = Console.ReadLine().Split(new char[] { ':' });\n string[] d2 = Console.ReadLine().Split(new char[] { ':' });\n DateTime dt1 = new DateTime(Convert.ToInt32(d1[0]), Convert.ToInt32(d1[1]), Convert.ToInt32(d1[2]));\n DateTime dt2 = new DateTime(Convert.ToInt32(d2[0]), Convert.ToInt32(d2[1]), Convert.ToInt32(d2[2]));\n TimeSpan ts = dt2 - dt1;\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace Timus\n{\n class Program\n {\n static void Solve()\n {\n DateTime st = DateTime.ParseExact(ReadString(), \"yyyy:MM:dd\", CultureInfo.InvariantCulture),\n en = DateTime.ParseExact(ReadString(), \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n TimeSpan offset = en - st;\n WriteLine(Math.Abs(offset.TotalDays));\n }\n\n\n public static void Main(string[] args)\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if !ONLINE_JUDGE\n In = new StreamReader(new FileStream(\"input.txt\", FileMode.Open));\n //Cons.Out = new StreamWriter(new FileStream(\"output.txt\", FileMode.Create));\n#endif\n Solve();\n\n#if !ONLINE_JUDGE\n Console.Write(\"\\nAny key == exit\\n\");\n Console.ReadLine();\n#endif\n\n In.Close();\n Out.Close();\n }\n #region Read&Write\n\n static TextReader In = System.Console.In;\n static TextWriter Out = System.Console.Out;\n\n static string ReadToaken()\n {\n string result = \"\";\n for (char temp = ReadChar(); result == \"\" || temp != '\\0'; temp = ReadChar())\n {\n if (temp != '\\0')\n {\n result += temp;\n }\n }\n return result;\n }\n\n private static char ReadChar()\n {\n char temp = (char)In.Read();\n if (temp == ' ' || temp == '\\n' || temp == 65535 || temp == '\\r') //\u0435\u0441\u043b\u0438 \u0440\u0430\u0432\u0435\u043d \u043f\u0440\u043e\u0431\u0435\u043b\u0443, \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u0438\u0431\u043e \u043a\u043e\u043d\u0446\u0443 \u043f\u043e\u0442\u043e\u043a\u0430\n return '\\0';\n return temp;\n }\n\n //read\n static int ReadInt()\n {\n return int.Parse(ReadString());\n }\n static short ReadShort()\n {\n return short.Parse(ReadToaken());\n }\n static ulong ReadUlong()\n {\n return ulong.Parse(ReadToaken());\n }\n static long ReadLong()\n {\n return long.Parse(ReadToaken());\n }\n static double ReadDouble()\n {\n return double.Parse(ReadToaken());\n }\n\n static string ReadString()\n {\n return ReadToaken();\n }\n\n static int[] ReadIntArray(int startIndex, int count)\n {\n int[] arr = new int[startIndex + count];\n for (int i = startIndex; i < startIndex + count; i++)\n {\n arr[i] = int.Parse(ReadToaken());\n }\n return arr;\n }\n static ulong[] ReadUlongArray(int startIndex, int count)\n {\n ulong[] arr = new ulong[startIndex + count];\n for (int i = startIndex; i < startIndex + count; i++)\n {\n arr[i] = ulong.Parse(ReadToaken());\n }\n return arr;\n }\n static long[] ReadLongArray(int startIndex, int count)\n {\n long[] arr = new long[startIndex + count];\n for (int i = startIndex; i < startIndex + count; i++)\n {\n arr[i] = long.Parse(ReadToaken());\n }\n return arr;\n }\n\n //write\n static void Write(object text)\n {\n Out.Write(text);\n }\n static void WriteLine(object text = null)\n {\n Out.WriteLine(text);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\n\nnamespace ProblemB\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(System.IO.File.OpenText(\"input.txt\"));\n DateTime start = GetDate();\n DateTime end = GetDate();\n \n if(start > end)\n {\n DateTime temp = start;\n start = end;\n end = temp;\n }\n\n TimeSpan ts = end - start;\n Console.WriteLine(ts.TotalDays);\n }\n\n private static DateTime GetDate()\n {\n string[] ar = Console.ReadLine().Split(':');\n int year = int.Parse(ar[0]);\n int month = int.Parse(ar[1]);\n int day = int.Parse(ar[2]);\n return new DateTime(year, month, day);\n }\n }\n}\n"}, {"source_code": "/*\n * \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0432 SharpDevelop.\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: admin\n * \u0414\u0430\u0442\u0430: 01.02.2013\n * \u0412\u0440\u0435\u043c\u044f: 22:20\n * \n * \u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441 | \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 | \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 | \u041f\u0440\u0430\u0432\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.\n */\n\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System;\n\nnamespace reshenie\n{\n\tclass Program\n\t{\n\t\tpublic static int ReadInt(){\n\t\t\t\n\t\t\t\treturn int.Parse(Console.ReadLine());\n\t\t\t\t\t\t\n\t\t\t}\t\t\t\t\t\n\t\t\t\t\n\t\tpublic static string[] ReadStrArr(){\n\t\t\t\n\t\t\t\treturn Console.ReadLine().Split(' ');\n\t\t\t\t\n\t\t\t}\n\t\t\n\t public static int ToInt(Object a){\n\t\t\t\t\n\t\t\treturn int.Parse(a.ToString());\n\t\t\t\t\n\t\t\t}\t\n\t\n\t\tpublic static void print(int[] mas){\n\t\n\t\tfor (int i =0;i 1 ? (t - t1).TotalDays : (t - t1).TotalDays));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nclass Demo\n{ \n static void Main()\n {\n string ini = Console.ReadLine();\n string fin = Console.ReadLine();\n string[] aini = ini.Split(':');\n string[] afin = fin.Split(':');\n\n if (ini == fin)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n\n int yearini = Convert.ToInt32(aini[0]);\n int monthini = Convert.ToInt32(aini[1]);\n int dayini = Convert.ToInt32(aini[2]);\n int yearfin = Convert.ToInt32(afin[0]);\n int monthfin = Convert.ToInt32(afin[1]);\n int dayfin = Convert.ToInt32(afin[2]);\n\n int tempyear;\n int tempmonth;\n int tempday;\n\n if (yearfin < yearini || (yearfin == yearini && monthfin < monthini) || (yearfin == yearini && monthfin == monthini && dayfin < dayini))\n {\n tempyear = yearfin;\n yearfin = yearini;\n yearini = tempyear;\n\n tempmonth = monthfin;\n monthfin = monthini;\n monthini = tempmonth;\n\n tempday = dayfin;\n dayfin = dayini;\n dayini = tempday;\n }\n\n int sol = 0;\n while (true)\n {\n if (dayini == 28 && monthini == 2)\n {\n if (!B(dayini, monthini, yearini))\n {\n dayini = 1;\n monthini++;\n sol++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n else\n {\n dayini++;\n sol++;\n }\n\n }\n else if (dayini == 29 && monthini == 2)\n {\n sol++;\n dayini = 1;\n monthini++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n else if (dayini == 30 && (monthini == 4 || monthini == 6 || monthini == 9 || monthini == 11))\n {\n sol++;\n dayini = 1;\n monthini++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n else if (dayini == 31 && (monthini == 1 || monthini == 3 || monthini == 5 || monthini == 7 || monthini == 8 || monthini == 10))\n {\n sol++;\n dayini = 1;\n monthini++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n else if (dayini == 31 && monthini == 12)\n {\n sol++;\n dayini = 1;\n monthini = 1;\n yearini++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n else\n {\n dayini++;\n sol++;\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n if (dayini == dayfin && monthini == monthfin && yearini == yearfin)\n break;\n }\n Console.WriteLine(sol);\n }\n \n }\n\n static bool B(int pd, int pm, int pa) \n {\n if (pa % 400 == 0 || (pa % 4 == 0 && pa % 100 != 0))\n return true;\n return false;\n }\n}"}, {"source_code": "using System;\n class Program\n {\n static void Main()\n {\n var line = Console.ReadLine().Split(':');\n int x1 = Convert.ToInt32(line[0]);\n int y1 = Convert.ToInt32(line[1]);\n int z1 = Convert.ToInt32(line[2]);\n line = Console.ReadLine().Split(':');\n int x2 = Convert.ToInt32(line[0]);\n int y2 = Convert.ToInt32(line[1]);\n int z2 = Convert.ToInt32(line[2]);\n DateTime first = new DateTime(x1,y1,z1);\n DateTime second = new DateTime(x2,y2,z2);\n Console.WriteLine(Math.Abs((first-second).Days));\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String s = Console.ReadLine();\n DateTime t = Convert.ToDateTime(s.Substring(0, 4)+\"/\"+s.Substring(5, 2)+\"/\"+s.Substring(8, 2));\n s = Console.ReadLine();\n DateTime t2 = Convert.ToDateTime(s.Substring(0, 4) + \"/\" + s.Substring(5, 2) + \"/\" + s.Substring(8, 2));\n \n Console.Write(\"\"+Math.Abs((t2 - t).Days));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C\n{\n using System.Globalization;\n using System.IO;\n\n class Program\n {\n static void Main(string[] args)\n {\n string a, b;\n\n a = Console.ReadLine();\n b = Console.ReadLine();\n\n\n var date1str = a.Split(':');\n var date2str = b.Split(':');\n\n var date1 = new DateTime(Convert.ToInt32(date1str[0]), Convert.ToInt32(date1str[1]), Convert.ToInt32(date1str[2]), new GregorianCalendar());\n var date2 = new DateTime(Convert.ToInt32(date2str[0]), Convert.ToInt32(date2str[1]), Convert.ToInt32(date2str[2]), new GregorianCalendar());\n\n\n Console.WriteLine(Math.Abs((date2 - date1).Days));\n\n\n return;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(':').ToArray();\n DateTime dtTime1 = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));\n \n \n string[] arr2 = Console.ReadLine().Split(':').ToArray();\n DateTime dtTime2 = new DateTime(int.Parse(arr2[0]), int.Parse(arr2[1]), int.Parse(arr2[2]));\n Console.Out.WriteLine(Math.Abs((dtTime2-dtTime1).Days));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n DateTime dt1 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n DateTime dt2 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n\n Console.WriteLine(Math.Abs((dt2 - dt1).TotalDays));\n\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int[] y = new int[2];\n int[] m = new int[2];\n int[] d = new int[2];\n for (int i = 0; i < 2; i++)\n {\n string[] input = Console.ReadLine().Split(':');\n y[i] = int.Parse(input[0]);\n m[i] = int.Parse(input[1]);\n d[i] = int.Parse(input[2]);\n }\n \n int sum = 0;\n for (int i = Math.Min(y[0],y[1]); i <= Math.Max(y[0],y[1]); i++)\n {\n if (DateTime.IsLeapYear(i))\n sum += 366;\n else\n sum += 365;\n }\n int comp = DateTime.Compare(new DateTime(y[0], m[0], d[0]), new DateTime(y[1], m[1], d[1]));\n if (comp < 0)\n {\n sum -= d[0];\n for (int i = 1; i < m[0]; i++)\n sum -= DateTime.DaysInMonth(y[0], i);\n sum -= DateTime.DaysInMonth(y[1], m[1]) - d[1];\n for (int i = m[1] + 1; i <= 12; i++)\n sum -= DateTime.DaysInMonth(y[1], i);\n }\n if (comp > 0)\n {\n sum -= d[1];\n for (int i = 1; i < m[1]; i++)\n sum -= DateTime.DaysInMonth(y[1], i);\n sum -= DateTime.DaysInMonth(y[0], m[0]) - d[0];\n for (int i = m[0] + 1; i <= 12; i++)\n sum -=DateTime.DaysInMonth(y[0], i);\n }\n if (comp == 0)\n {\n sum = 0;\n }\n Console.WriteLine(sum);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s1 = Console.ReadLine().Split(':');\n string[] s2 = Console.ReadLine().Split(':');\n DateTime d1 = new DateTime(int.Parse(s1[0]), int.Parse(s1[1]), int.Parse(s1[2]));\n DateTime d2 = new DateTime(int.Parse(s2[0]), int.Parse(s2[1]), int.Parse(s2[2]));\n Console.WriteLine(d2.Subtract(d1).Days < 0 ? -d2.Subtract(d1).Days : d2.Subtract(d1).Days);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace _304B\n{\n class Program\n {\n static void Main(string[] args)\n {\n DateTime date1 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n DateTime date2 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n Console.Write(Math.Abs((date1 - date2).TotalDays));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Numerics;\nnamespace _304B\n{\n class Program\n {\n static void Main(string[] args)\n {\n DateTime date1 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n DateTime date2 = DateTime.Parse(Console.ReadLine().Replace(':', '.'));\n Console.Write(Math.Abs((date1 - date2).TotalDays));\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tok1 = Console.ReadLine().Split(':');\n int y1 = Convert.ToInt32(tok1[0]), m1 = Convert.ToInt32(tok1[1]), d1 = Convert.ToInt32(tok1[2]);\n tok1 = Console.ReadLine().Split(':');\n int y2 = Convert.ToInt32(tok1[0]), m2 = Convert.ToInt32(tok1[1]), d2 = Convert.ToInt32(tok1[2]);\n DateTime a = new DateTime(y1,m1,d1);\n DateTime b = new DateTime(y2,m2,d2);\n Console.WriteLine(Math.Abs((b-a).Days));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n public static bool IsLeapYear(int year)\n {\n if (year % 400 == 0) return true;\n else return (year % 4 == 0 && year % 100 != 0);\n }\n\n public static int DaysInMonth(int N,int year)\n {\n if (N == 1 || N == 3 || N == 5 || N == 7 || N == 8 || N == 10 || N == 12) return 31;\n if (N == 4 || N == 6 || N == 9 || N == 11) return 30;\n if (IsLeapYear(year)) return 29;\n else return 28;\n }\n\n public static void swap(ref int a,ref int b)\n {\n int k=a; a=b; b=k;\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int dm, year1, year2, month1, month2, day1, day2, ans=0;\n\n year1 = (s[0] - 48) * 1000 + (s[1] - 48) * 100 + (s[2] - 48) * 10 + (s[3] - 48);\n month1 = (s[5] - 48) * 10 + (s[6] - 48);\n day1 = (s[8] - 48) * 10 + (s[9] - 48);\n\n s = Console.ReadLine();\n year2 = (s[0] - 48) * 1000 + (s[1] - 48) * 100 + (s[2] - 48) * 10 + (s[3] - 48);\n month2 = (s[5] - 48) * 10 + (s[6] - 48);\n day2 = (s[8] - 48) * 10 + (s[9] - 48);\n\n //if first date is bigger, swap dates\n if (year1 > year2) { swap(ref year1, ref year2); swap(ref month1, ref month2); swap(ref day1, ref day2); }\n else if (year1 == year2 && month1 > month2) { swap(ref month1, ref month2); swap(ref day1, ref day2); }\n else if (year1 == year2 && month1 == month2 && day1 > day2) { swap(ref day1, ref day2); }\n\n //case 1\n if (year1 == year2)\n {\n if (month1 == month2) ans += (day2 - day1);\n else\n {\n dm = DaysInMonth(month1, year1);\n ans += (dm - day1);\n day1 = 0; month1++;\n while (month1 < month2)\n {\n dm = DaysInMonth(month1, year1);\n ans += dm;\n month1++;\n }\n ans += (day2 - day1);\n }\n }\n else //case 2\n {\n //round up first date\n dm = DaysInMonth(month1, year1);\n ans += (dm - day1);\n day1 = 0; ++month1; if (month1 == 13) month1 = 1;\n while (month1 != 1) \n {\n dm = DaysInMonth(month1, year1);\n ans += dm;\n if(month1==12)month1=1; else ++month1;\n }\n ++year1;\n\n //round down second date \n ans += day2; day2 = 0; month2--;\n while (month2 != 0)\n {\n dm = DaysInMonth(month2, year2);\n ans += dm;\n --month2;\n }\n //add days of years\n for (int i = year1; i < year2; ++i)\n if (IsLeapYear(i)) ans += 366; else ans += 365;\n }\n\n Console.WriteLine(\"{0}\",ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s1=Console.ReadLine().Split(':');\n DateTime d1=new DateTime(int.Parse(s1[0]),int.Parse(s1[1]),int.Parse(s1[2]));\n string[] s2 = Console.ReadLine().Split(':');\n DateTime d2 = new DateTime(int.Parse(s2[0]), int.Parse(s2[1]), int.Parse(s2[2]));\n Console.WriteLine(Math.Abs((d2 - d1).Days));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(':').ToArray();\n DateTime dtTime1 = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));\n \n \n string[] arr2 = Console.ReadLine().Split(':').ToArray();\n DateTime dtTime2 = new DateTime(int.Parse(arr2[0]), int.Parse(arr2[1]), int.Parse(arr2[2]));\n Console.Out.WriteLine(Math.Abs((dtTime2-dtTime1).Days));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tint[] date_1 = Console.ReadLine().Split(':').Select(int.Parse).ToArray();\n\t\tint[] date_2 = Console.ReadLine().Split(':').Select(int.Parse).ToArray();\n\t\tint c = 0;\n\t\tif(date_1[0] > date_2[0]){\n\t\t\tint swap = date_1[0];\n\t\t\tdate_1[0] = date_2[0];\n\t\t\tdate_2[0] = swap;\n\t\t\t\n\t\t\tswap = date_1[1];\n\t\t\tdate_1[1] = date_2[1];\n\t\t\tdate_2[1] = swap;\n\t\t\t\n\t\t\tswap = date_1[2];\n\t\t\tdate_1[2] = date_2[2];\n\t\t\tdate_2[2] = swap;\n\t\t}\n\t\t\n\t\tfor(int i = date_1[0]; i < date_2[0]; i++){\n\t\t\tif((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)\n\t\t\t\tc += 366;\n\t\t\telse\n\t\t\t\tc += 365;\n\t\t}\n\n\t\tint[] m = new int[13]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\t\t\n\t\tif((date_1[0] % 4 == 0 && date_1[0] % 100 != 0) || date_1[0] % 400 == 0)\n\t\t\tm[2] = 29;\n\t\telse\n\t\t\tm[2] = 28;\n\t\t\t\n\t\tfor(int i = 1; i < date_1[1]; i++){\n\t\t\tc -= m[i];\n\t\t}\n\t\tc -= date_1[2];\n\n\t\tif((date_2[0] % 4 == 0 && date_2[0] % 100 != 0) || date_2[0] % 400 == 0)\n\t\t\tm[2] = 29;\n\t\telse\n\t\t\tm[2] = 28;\n\t\t\n\t\tfor(int i = 1; i < date_2[1]; i++){\n\t\t\tc += m[i];\n\t\t}\n\t\tc += date_2[2];\n\t\t\n\t\t\n\t\t\n\t\tConsole.WriteLine(Math.Abs(c));\n\t}\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: IdM\n * Date: 12.05.2013\n * Time: 18:24\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\n\nnamespace r183_2\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring str = Console.ReadLine();\n\t\t\tstring[] strArr = str.Split(':');\n\t\t\tint[] dat1 = new int[3];\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tdat1[i] = int.Parse(strArr[i]);\n\t\t\t}\n\t\t\t\n\t\t\tstr = Console.ReadLine();\n\t\t\tstrArr = str.Split(':');\n\t\t\tint[] dat2 = new int[3];\n\t\t\tfor (int i = 0; i < 3; i++) {\n\t\t\t\tdat2[i] = int.Parse(strArr[i]);\n\t\t\t}\n\t\t\t\n\t\t\tDateTime d1 = new DateTime(dat1[0], dat1[1], dat1[2]);\n\t\t DateTime d2 = new DateTime(dat2[0], dat2[1], dat2[2]);\n\t\t TimeSpan time = d2 - d1;\n\t\t \n\t\t Console.WriteLine(Math.Abs(time.Days));\n\t\t\t\n//\t\t\tConsole.Write(\"Press any key to continue . . . \");\n//\t\t\tConsole.ReadKey(true);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n \n string[] d1,d2,aux;\n\n d1 =Console.ReadLine().Split(':'); \n d2 = Console.ReadLine().Split(':');\n\n DateTime data1 = new DateTime(int.Parse(d1[0]), int.Parse(d1[1]), int.Parse(d1[2])), data2 = new DateTime(int.Parse(d2[0]), int.Parse(d2[1]), int.Parse(d2[2]));\n if (data1 > data2)\n {\n aux = d1;\n d1 = d2;\n d2 = aux;\n }\n int aa = int.Parse(d1[0]), aa1 = int.Parse(d2[0]), dd = int.Parse(d1[2]), dd1= int.Parse(d2[2]) , mm = int.Parse(d1[1]), mm1 = int.Parse(d2[1]), difdias = 0, mesAno = 12;\n int[] numDias = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n for (; aa <= aa1; aa++)\n {\n // Console.Write(\"{0}/\", aa);\n if ((((aa % 4) == 0 && (aa % 100) != 0) || (aa % 400) == 0))\n numDias[1] = 29;\n else\n numDias[1] = 28;\n\n if (mm == 13)\n mm = 1;\n\n for (; mm <= mesAno; mm++)\n {\n //Console.Write(\"{0}/{1} dif = {2} \\n\", aa,mm,difdias);\n if (aa == aa1 && mm == mm1)\n {\n mesAno = mm;\n numDias[mm - 1] = dd1;\n }\n for (; dd <= numDias[mm - 1]; dd++)\n {\n //Console.Write(\"{0} -\", dd);\n if (aa != aa1 || mm != mm1 || dd != dd1)\n {\n difdias++;\n \n }\n\n }\n dd = 1;\n //Console.WriteLine(\"\\n\");\n }\n }\n Console.WriteLine(difdias);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n \n string[] d1,d2,aux;\n // separa o valor lido usando o ':' \n d1 =Console.ReadLine().Split(':'); \n d2 = Console.ReadLine().Split(':');\n //Insere os valores separados de maneira correta em um tipo date\n DateTime data1 = new DateTime(int.Parse(d1[0]), int.Parse(d1[1]), int.Parse(d1[2])), data2 = new DateTime(int.Parse(d2[0]), int.Parse(d2[1]), int.Parse(d2[2]));\n // verifica se Data1 \u00e9 maior que Data2 para fazer a invers\u00e3o se necessario\n if (data1 > data2)\n {\n aux = d1;\n d1 = d2;\n d2 = aux;\n }\n //Define os valores nas variaveis que ser\u00e3o usadas usadas\n int aa = int.Parse(d1[0]), aa1 = int.Parse(d2[0]), dd = int.Parse(d1[2]), dd1= int.Parse(d2[2]) , mm = int.Parse(d1[1]), mm1 = int.Parse(d2[1]), difdias = 0, mesAno = 12;\n // variavel que armazena numero de dias de cada mes\n int[] numDias = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n for (; aa <= aa1; aa++)// contador ANO\n {\n // SE ano bissexto \n if ((((aa % 4) == 0 && (aa % 100) != 0) || (aa % 400) == 0))\n numDias[1] = 29;\n else\n numDias[1] = 28;\n //se mes passar de 12 volta a ser 1\n if (mm == 13)\n mm = 1;\n\n for (; mm <= mesAno; mm++)// Contador MES\n {\n //verifica se esta no mesmo mes e ano para definir ate qual dia contar\n if (aa == aa1 && mm == mm1)\n {\n mesAno = mm;\n numDias[mm - 1] = dd1;\n }\n\n for (; dd <= numDias[mm - 1]; dd++)// contador dias\n {\n\n if (aa != aa1 || mm != mm1 || dd != dd1) // conta dias enquanto algum dos valores s\u00e3o diferentes\n {\n difdias++;\n \n }\n\n }\n dd = 1;\n \n }\n }\n Console.WriteLine(difdias);\n \n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program_304B\n{\n static void Main()\n {\n string[] s = Console.ReadLine().Split(':');\n DateTime a = new DateTime(Int16.Parse(s[0]), Int16.Parse(s[1]), Int16.Parse(s[2]));\n s = Console.ReadLine().Split(':');\n DateTime b = new DateTime(Int16.Parse(s[0]), Int16.Parse(s[1]), Int16.Parse(s[2]));\n Console.WriteLine(Math.Abs((b - a).TotalDays));\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication30\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string firstDate = Console.ReadLine().Replace(':', ',');\n string secondDate = Console.ReadLine().Replace(':', ',');\n\n DateTime dateTimeFirst = DateTime.Parse(firstDate);\n DateTime dateTimeSecond = DateTime.Parse(secondDate);\n Console.WriteLine(Math.Abs((dateTimeSecond - dateTimeFirst).TotalDays));\n\n Console.ReadLine();\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n\n private static void Read(out int n1, out int n2, out int n3)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n\n private static void Read(out int n1, out int n2, out int n3, out int n4)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n n4 = int.Parse(input[3]);\n }\n\n private static void Read(out T a1, out T a2)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n a4 = (T) Convert.ChangeType(input[3], typeof (T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T) Convert.ChangeType(Read(), typeof (T));\n }\n\n private static string[] ReadArray()\n {\n string readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n\n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{ \n class B\n { \n public void Run()\n { \n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n B a = new B();\n a.Run(); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R183_Div2_B\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(':');\n int y1 = int.Parse(s[0]);\n int m1 = int.Parse(s[1]);\n int d1 = int.Parse(s[2]);\n\n s = Console.ReadLine().Split(':');\n int y2 = int.Parse(s[0]);\n int m2 = int.Parse(s[1]);\n int d2 = int.Parse(s[2]);\n\n DateTime dt1 = new DateTime(y1, m1, d1);\n DateTime dt2 = new DateTime(y2, m2, d2);\n DateTime t = new DateTime();\n int cnt = 0;\n if (dt2.CompareTo(dt1) > 0)\n {\n t = dt1; dt1 = dt2; dt2 = t;\n }\n cnt = dt1.Subtract(dt2).Days;\n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforce {\n class Program {\n static void Main() {\n var date1 = Console.ReadLine().Split(':');\n var date2 = Console.ReadLine().Split(':');\n\n var dt1 = new DateTime(int.Parse(date1[0]), int.Parse(date1[1]), int.Parse(date1[2]));\n var dt2 = new DateTime(int.Parse(date2[0]), int.Parse(date2[1]), int.Parse(date2[2]));\n\n Console.WriteLine(Math.Abs((dt2 - dt1).Days).ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class A\n {\n public void Run()\n {\n //int n = int.Parse(Console.ReadLine());\n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n //string str = Console.ReadLine();\n\n\n }\n }\n class B\n {\n\n\n\n public void Run()\n { \n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n B a = new B();\n a.Run(); \n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n Console.WriteLine(Math.Abs((Convert.ToDateTime(Console.ReadLine().Replace(':', '/')) - Convert.ToDateTime(Console.ReadLine().Replace(':', '/'))).TotalDays));\n \n } \n }"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void comp(ref int[] s, ref int[] s2)\n {\n if (s[0] < s2[0] || (s[0] == s2[0] && s[1] < s2[1]) || (s[0] == s2[0] && s[1] == s2[1] && s[2] < s2[2]))\n {\n int[] t = s2;\n s2 = s;\n s = t;\n }\n }\n static void Main()\n {\n int[] x = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n string[] s = Console.ReadLine().Split(':'), e = Console.ReadLine().Split(':');\n int[] ss = new int[3], ee = new int[3];\n\n for (int i = 0; i < 3; i++) { ss[i] = Convert.ToInt32(s[i]); ee[i] = Convert.ToInt32(e[i]); }\n comp(ref ee, ref ss);\n int cnt = 0;\n for (; !test(ss, ee); ss[2] = 1, ss[1]++, cnt++)\n {\n \n if (ss[1] > 12) { ss[1] = 1; ss[0]++; }\n \n for (; !test(ss, ee) && ss[2] < x[ss[1]] + (ss[1] == 2 && ss[0] % 4 == 0 &&ss[0]!=1900? 1 : 0); ss[2]++, cnt++) { }\n if (test(ss, ee))\n {\n Console.Write(cnt); return;\n }\n }\n Console.Write(cnt);\n }\n static bool test(int[] a, int[] b)\n {\n return a[0] == b[0] && a[1] == b[1] && a[2] == b[2];\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tstring[] tokens = Console.ReadLine().Split(':');\n int a,b,c;\n a = int.Parse(tokens[0]);\n b = int.Parse(tokens[1]);\n c =\tint.Parse(tokens[2]);\n\t\t\tDateTime d = new DateTime(a,b,c);\n\t\t\tstring[] tokens1 = Console.ReadLine().Split(':');\n \n a = int.Parse(tokens1[0]);\n b = int.Parse(tokens1[1]);\n c =\tint.Parse(tokens1[2]);\n\t\t\tDateTime d1 = new DateTime(a,b,c);\n\t\t\tDateTime s;\n\t\t\tint k=0;\n\t\t\tif(d>d1)\n\t\t\t{\n\t\t\t s=d;\n\t\t\t d=d1;\n\t\t\t d1=s;\n\t\t\t}\n\t\t\twhile(d!=d1)\n\t\t\t{\n\t\t\t\td=d.AddDays(1);\n\t\t\t\tk++;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(k);\n\t\n\t\t}\n}\n"}], "negative_code": [{"source_code": "using System.IO;\nusing System;\nusing System.Globalization;\n\nclass Program\n{\n static void Main()\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n \n var d1 = DateTime.ParseExact(s1, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n var d2 = DateTime.ParseExact(s2, \"yyyy:MM:dd\", CultureInfo.InvariantCulture);\n \n var t1 = d2 - d1;\n Console.WriteLine(t1.TotalDays);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF.B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] d1 = Console.ReadLine().Split(new char[] { ':' });\n string[] d2 = Console.ReadLine().Split(new char[] { ':' });\n DateTime dt1 = new DateTime(Convert.ToInt32(d1[0]), Convert.ToInt32(d1[1]), Convert.ToInt32(d1[2]));\n DateTime dt2 = new DateTime(Convert.ToInt32(d2[0]), Convert.ToInt32(d2[1]), Convert.ToInt32(d2[2]));\n TimeSpan ts = dt2 - dt1;\n Console.WriteLine(ts.Days);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] aux = Console.ReadLine().Split(':');\n DateTime t = new DateTime(int.Parse(aux[0]), int.Parse(aux[1]), int.Parse(aux[2]));\n aux = Console.ReadLine().Split(':');\n DateTime t1 = new DateTime(int.Parse(aux[0]), int.Parse(aux[1]), int.Parse(aux[2]));\n Console.WriteLine(t.CompareTo(t1) > 1 ? (t - t1).TotalDays : (t1 - t).TotalDays);\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] aux = Console.ReadLine().Split(':');\n DateTime t = new DateTime(int.Parse(aux[0]), int.Parse(aux[1]), int.Parse(aux[2]));\n aux = Console.ReadLine().Split(':');\n DateTime t1 = new DateTime(int.Parse(aux[0]), int.Parse(aux[1]), int.Parse(aux[2]));\n Console.WriteLine((t - t1).TotalDays);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String s = Console.ReadLine();\n DateTime t = Convert.ToDateTime(s.Substring(0, 4)+\"/\"+s.Substring(5, 2)+\"/\"+s.Substring(8, 2));\n s = Console.ReadLine();\n DateTime t2 = Convert.ToDateTime(s.Substring(0, 4) + \"/\" + s.Substring(5, 2) + \"/\" + s.Substring(8, 2));\n \n Console.Write(\"\" + (t2 - t).Days);\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int[] y = new int[2];\n int[] m = new int[2];\n int[] d = new int[2];\n for (int i = 0; i < 2; i++)\n {\n string[] input = Console.ReadLine().Split(':');\n y[i] = int.Parse(input[0]);\n m[i] = int.Parse(input[1]);\n d[i] = int.Parse(input[2]);\n }\n \n int sum = 0;\n for (int i = Math.Min(y[0],y[1]); i <= Math.Max(y[0],y[1]); i++)\n {\n if (DateTime.IsLeapYear(i))\n sum += 366;\n else\n sum += 365;\n }\n int comp = DateTime.Compare(new DateTime(y[0], m[0], d[0]), new DateTime(y[1], m[1], d[1]));\n if (comp < 0)\n {\n sum -= d[0];\n for (int i = 1; i < m[0]; i++)\n sum -= DateTime.DaysInMonth(y[0], i);\n sum -= DateTime.DaysInMonth(y[1], m[1]) - d[1];\n for (int i = m[1] + 1; i <= 12; i++)\n sum -= DateTime.DaysInMonth(y[1], i);\n }\n if (comp > 0)\n {\n sum -= d[1];\n for (int i = 1; i < m[1]; i++)\n sum -= DateTime.DaysInMonth(y[1], i);\n sum -= DateTime.DaysInMonth(y[0], m[0]) - d[0];\n for (int i = m[0] + 1; i <= 12; i++)\n sum -=DateTime.DaysInMonth(y[0], i);\n }\n if (comp == 0)\n {\n sum = 1;\n }\n Console.WriteLine(sum);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tint[] date_1 = Console.ReadLine().Split(':').Select(int.Parse).ToArray();\n\t\tint[] date_2 = Console.ReadLine().Split(':').Select(int.Parse).ToArray();\n\t\tint c = 0;\n\t\tif(date_1[0] > date_2[0]){\n\t\t\tint swap = date_1[0];\n\t\t\tdate_1[0] = date_2[0];\n\t\t\tdate_2[0] = swap;\n\t\t\t\n\t\t\tswap = date_1[1];\n\t\t\tdate_1[1] = date_2[1];\n\t\t\tdate_2[1] = swap;\n\t\t\t\n\t\t\tswap = date_1[2];\n\t\t\tdate_1[2] = date_2[2];\n\t\t\tdate_2[2] = swap;\n\t\t}\n\t\t\n\t\tfor(int i = date_1[0]; i < date_2[0]; i++){\n\t\t\tif((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)\n\t\t\t\tc += 366;\n\t\t\telse\n\t\t\t\tc += 365;\n\t\t}\n\n\t\tint[] m = new int[13]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\t\t\n\t\tif((date_1[0] % 4 == 0 && date_1[0] % 100 != 0) || date_1[0] % 400 == 0)\n\t\t\tm[2] = 29;\n\t\telse\n\t\t\tm[2] = 28;\n\t\t\t\n\t\tfor(int i = 1; i < date_1[1]; i++){\n\t\t\tc -= m[i];\n\t\t}\n\t\tc -= date_1[2];\n\n\t\tif((date_2[0] % 4 == 0 && date_2[0] % 100 != 0) || date_2[0] % 400 == 0)\n\t\t\tm[2] = 29;\n\t\telse\n\t\t\tm[2] = 28;\n\t\t\n\t\tfor(int i = 1; i < date_2[1]; i++){\n\t\t\tc += m[i];\n\t\t}\n\t\tc += date_2[2];\n\t\t\n\t\t\n\t\t\n\t\tConsole.WriteLine(c);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n \n string[] d1,d2,aux;\n\n d1 =Console.ReadLine().Split(':'); \n d2 = Console.ReadLine().Split(':');\n\n DateTime data1 = new DateTime(int.Parse(d1[0]), int.Parse(d1[1]), int.Parse(d1[2])), data2 = new DateTime(int.Parse(d2[0]), int.Parse(d2[1]), int.Parse(d2[2]));\n if (data1 > data2)\n {\n aux = d1;\n d1 = d2;\n d2 = aux;\n }\n int aa = int.Parse(d1[0]), aa1 = int.Parse(d2[0]), dd = int.Parse(d1[2]), dd1= int.Parse(d2[2]) , mm = int.Parse(d1[1]), mm1 = int.Parse(d2[1]), difdias = 0, mesAno = 12;\n int[] numDias = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n for (; aa <= aa1; aa++)\n {\n // Console.Write(\"{0}/\", aa);\n if ((((aa % 4) == 0 && (aa % 100) != 0) || (aa % 400) == 0))\n numDias[1] = 29;\n else\n numDias[1] = 29;\n\n if (mm == 13)\n mm = 1;\n\n for (; mm <= mesAno; mm++)\n {\n //Console.Write(\"{0}/{1} dif = {2} \\n\", aa,mm,difdias);\n if (aa == aa1 && mm == mm1)\n {\n mesAno = mm;\n numDias[mm - 1] = dd1;\n }\n for (; dd <= numDias[mm - 1]; dd++)\n {\n //Console.Write(\"{0} -\", dd);\n if (aa != aa1 || mm != mm1 || dd != dd1)\n {\n difdias++;\n \n }\n\n }\n dd = 1;\n //Console.WriteLine(\"\\n\");\n }\n }\n Console.WriteLine(difdias);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n \n string[] d1,d2,aux;\n\n d1 =Console.ReadLine().Split(':'); \n d2 = Console.ReadLine().Split(':');\n\n DateTime data1 = new DateTime(int.Parse(d1[0]), int.Parse(d1[1]), int.Parse(d1[2])), data2 = new DateTime(int.Parse(d2[0]), int.Parse(d2[1]), int.Parse(d2[2]));\n if (data1 > data2)\n {\n aux = d1;\n d1 = d2;\n d2 = aux;\n }\n int aa = int.Parse(d1[0]), aa1 = int.Parse(d2[0]), dd = int.Parse(d1[2]), dd1= int.Parse(d2[2]) , mm = int.Parse(d1[1]), mm1 = int.Parse(d2[1]), difdias = 0, mesAno = 12;\n int[] numDias = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\n for (; aa <= aa1; aa++)\n {\n // Console.Write(\"{0}/\", aa);\n\n if (mm == 13)\n {\n mm = 1;\n }\n\n for (; mm <= mesAno; mm++)\n {\n //Console.Write(\"{0}/{1} dif = {2} \\n\", aa,mm,difdias);\n if (aa == aa1 && mm == mm1)\n {\n mesAno = mm;\n numDias[mm - 1] = dd1;\n }\n for (; dd <= numDias[mm - 1]; dd++)\n {\n //Console.Write(\"{0} -\", dd);\n if (aa != aa1 || mm != mm1 || dd != dd1)\n {\n difdias++;\n if (mm == 2 && dd == 28 && (((aa % 4) == 0 && (aa % 100) != 0) || (aa % 400) == 0))\n {\n difdias++;\n }\n }\n\n }\n dd = 1;\n //Console.WriteLine(\"\\n\");\n }\n }\n Console.WriteLine(difdias);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n \n string[] d1,d2;\n\n d1 =Console.ReadLine().Split(':');\n \n d2 = Console.ReadLine().Split(':');\n \n int aa = int.Parse(d1[0]), aa1 = int.Parse(d2[0]), dd = int.Parse(d1[2]), dd1= int.Parse(d2[2]) , mm = int.Parse(d1[1]), mm1 = int.Parse(d2[1]), difdias = 0, mesAno = 12;\n int[] numDias = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n for (; aa <= aa1; aa++)\n {\n // Console.Write(\"{0}/\", aa);\n\n if (mm == 13)\n {\n mm = 1;\n }\n\n for (; mm <= mesAno; mm++)\n {\n //Console.Write(\"{0}/{1} dif = {2} \\n\", aa,mm,difdias);\n if (aa == aa1 && mm == mm1)\n {\n mesAno = mm;\n numDias[mm - 1] = dd1;\n }\n for (; dd <= numDias[mm - 1]; dd++)\n {\n //Console.Write(\"{0} -\", dd);\n if (aa != aa1 || mm != mm1 || dd != dd1)\n {\n difdias++;\n if (mm == 2 && dd == 28 && (((aa % 4) == 0 && (aa % 100) != 0) || (aa % 400) == 0))\n {\n difdias++;\n }\n }\n\n }\n dd = 1;\n //Console.WriteLine(\"\\n\");\n }\n }\n Console.WriteLine(difdias);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication30\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n// string[] firstDate = Console.ReadLine().Split(new string[] {\":\"}, StringSplitOptions.RemoveEmptyEntries);\n// string[] secondDate = Console.ReadLine().Split(new string[] {\":\"}, StringSplitOptions.RemoveEmptyEntries);\n\n string[] firstDate = new string[] {\"1900\", \"01\", \"01\"};\n string[] secondDate = new string[] {\"2038\", \"12\", \"31\"};\n\n DateTime dateTimeFirst = DateTime.Parse(\"1996,03,09\");\n DateTime dateTimeSecond = DateTime.Parse(\"1991,11,12\");\n Console.WriteLine(Math.Abs((dateTimeSecond - dateTimeFirst).TotalDays));\n\n Console.ReadLine();\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n\n private static void Read(out int n1, out int n2, out int n3)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n\n private static void Read(out int n1, out int n2, out int n3, out int n4)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n n4 = int.Parse(input[3]);\n }\n\n private static void Read(out T a1, out T a2)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n a4 = (T) Convert.ChangeType(input[3], typeof (T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T) Convert.ChangeType(Read(), typeof (T));\n }\n\n private static string[] ReadArray()\n {\n string readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n\n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforce {\n class Program {\n static void Main() {\n var date1 = Console.ReadLine().Split(':');\n var date2 = Console.ReadLine().Split(':');\n\n var dt1 = new DateTime(int.Parse(date1[0]), int.Parse(date1[1]), int.Parse(date1[2]));\n var dt2 = new DateTime(int.Parse(date2[0]), int.Parse(date2[1]), int.Parse(date2[2]));\n\n Console.WriteLine((dt2 - dt1).Days.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class A\n {\n public void Run()\n {\n //int n = int.Parse(Console.ReadLine());\n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n //string str = Console.ReadLine();\n\n\n }\n }\n class B\n {\n\n\n\n public void Run()\n {\n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(ts.Days);\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n B a = new B();\n a.Run(); \n }\n }\n}"}], "src_uid": "bdf99d78dc291758fa09ec133fff1e9c"} {"source_code": "\ufeffusing System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nnamespace ConsoleApp9\r\n{\r\n class Program\r\n {\r\n\r\n static long mod = 998244353L;\r\n static void Main(string[] args)\r\n {\r\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\r\n int n = input[0], x = input[1];\r\n var xar = new long[n + 1, n + 1];\r\n for (int i = 1; i <= n; i++)\r\n {\r\n xar[i, 0] = 1;\r\n for (int j = 1; j <= n; j++)\r\n xar[i, j] = (xar[i, j - 1] * i)% mod;\r\n }\r\n var c = new long[n + 1, n + 1];\r\n c[0, 0] = 1;\r\n for(int i=1; i <= n; i++)\r\n {\r\n c[i, 0] = 1;\r\n for (int k = 1; k <= i; k++)\r\n c[i, k] = (c[i - 1, k - 1] + c[i - 1, k]) % mod;\r\n }\r\n var mas = new long[n + 1, x + 1];\r\n for(int i=1; i <= n; i++)\r\n {\r\n for(int j = i; j <= x; j++)\r\n {\r\n if( i == 1)\r\n {\r\n mas[i, j] = j;\r\n continue;\r\n }\r\n for(int k =0; k < i; k++)\r\n mas[i, j] = (mas[i, j] + (((xar[i - 1, k] * c[i, k])%mod) * mas[i - k, j - i + 1])%mod)%mod;\r\n }\r\n }\r\n long xn = 1;\r\n for (int i = 1; i <= n; i++)\r\n xn = (xn * x) % mod;\r\n var res = (xn - mas[n, x] + mod) % mod;\r\n Console.Write(res);\r\n }\r\n }\r\n}\r\n", "positive_code": [{"source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\nusing CompLib.Mathematics;\r\nusing System.Collections.Generic;\r\n\r\npublic class Program\r\n{\r\n int N, X;\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n N = sc.NextInt();\r\n X = sc.NextInt();\r\n\r\n //int ans = 0;\r\n //for (int i = 1; i <= 3; i++)\r\n //{\r\n // for (int j = 1; j <= 3; j++)\r\n // {\r\n // for (int k = 1; k <= 3; k++)\r\n // {\r\n // int[] h = new int[3] { i, j, k };\r\n\r\n // if (F(h))\r\n // {\r\n // ans++;\r\n // Console.WriteLine(string.Join(\" \", h));\r\n // }\r\n // }\r\n // }\r\n //}\r\n\r\n //Console.WriteLine(ans);\r\n\r\n var c = new BinomialCoefficient(5000);\r\n // \u6b8b\u308ai\u4eba\u3000\u6700\u5927\u4f53\u529bj\r\n var dp = new ModInt[N + 1, X + 1];\r\n for (int i = 2; i <= N; i++)\r\n {\r\n for (int j = 1; j < i && j <= X; j++)\r\n {\r\n ModInt tmp = ModInt.Pow(j, i) - ModInt.Pow(j - 1, i);\r\n dp[i, j] += tmp;\r\n }\r\n }\r\n\r\n for (int i = 2; i <= N; i++)\r\n {\r\n for (int j = 1; j <= X; j++)\r\n {\r\n for (int k = i; k <= N; k++)\r\n {\r\n // k\u4eba\u306e\u72b6\u614b\u304b\u3089 (i,j)\u306b\u306a\u3063\u305f\r\n\r\n // i\u4eba\u306e\u4f53\u529b k-1\u6e1b\u308b\r\n if (j + (k - 1) > X) continue;\r\n\r\n // k-i\u4eba (k-1)\u6e1b\u308b\r\n dp[k, j + (k - 1)] += dp[i, j] * ModInt.Pow(k - 1, k - i) * c[k, i];\r\n }\r\n }\r\n }\r\n\r\n ModInt ans = 0;\r\n for (int i = 1; i <= X; i++)\r\n {\r\n ans += dp[N, i];\r\n }\r\n Console.WriteLine(ans);\r\n\r\n //for (int i = 0; i <= N; i++)\r\n //{\r\n // for (int j = 0; j <= X; j++)\r\n // {\r\n // Console.Write($\"{dp[i, j]} \");\r\n // }\r\n // Console.WriteLine();\r\n //}\r\n }\r\n\r\n bool F(int[] ar)\r\n {\r\n if (ar.Length == 0) return true;\r\n if (ar.Length == 1) return false;\r\n List ls = new List();\r\n foreach (int i in ar)\r\n {\r\n if (i - ar.Length + 1 > 0)\r\n {\r\n ls.Add(i - ar.Length + 1);\r\n }\r\n }\r\n\r\n return F(ls.ToArray());\r\n }\r\n\r\n public static void Main(string[] args) => new Program().Solve();\r\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\r\n}\r\n\r\n// https://bitbucket.org/camypaper/complib\r\nnamespace CompLib.Mathematics\r\n{\r\n #region ModInt\r\n /// \r\n /// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\r\n /// \r\n public struct ModInt\r\n {\r\n /// \r\n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\r\n /// \r\n // public const long Mod = (int)1e9 + 7;\r\n public const long Mod = 998244353;\r\n\r\n /// \r\n /// \u5b9f\u969b\u306e\u6570\u5024\uff0e\r\n /// \r\n public long num;\r\n /// \r\n /// \u5024\u304c \u3067\u3042\u308b\u3088\u3046\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\r\n /// \r\n /// \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6301\u3064\u5024\r\n /// \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u4e0a\uff0c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067\u306f\u5270\u4f59\u3092\u53d6\u308a\u307e\u305b\u3093\uff0e\u305d\u306e\u305f\u3081\uff0c \u2208 [0,) \u3092\u6e80\u305f\u3059\u3088\u3046\u306a \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\uff0e\u3053\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public ModInt(long n) { num = n; }\r\n /// \r\n /// \u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6570\u5024\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\uff0e\r\n /// \r\n /// [0,) \u306e\u7bc4\u56f2\u5185\u306e\u6574\u6570\u3092 10 \u9032\u8868\u8a18\u3057\u305f\u3082\u306e\uff0e\r\n public override string ToString() { return num.ToString(); }\r\n public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }\r\n public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }\r\n public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }\r\n public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }\r\n\r\n /// \r\n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\r\n /// \r\n /// \u3079\u304d\u4e57\u306e\u5e95\r\n /// \u3079\u304d\u6307\u6570\r\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }\r\n\r\n /// \r\n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\r\n /// \r\n /// \u3079\u304d\u4e57\u306e\u5e95\r\n /// \u3079\u304d\u6307\u6570\r\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\r\n public static ModInt Pow(long v, long k)\r\n {\r\n long ret = 1;\r\n for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)\r\n if ((k & 1) == 1) ret = ret * v % Mod;\r\n return new ModInt(ret);\r\n }\r\n /// \r\n /// \u4e0e\u3048\u3089\u308c\u305f\u6570\u306e\u9006\u5143\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\r\n /// \r\n /// \u9006\u5143\u3092\u53d6\u308b\u5bfe\u8c61\u3068\u306a\u308b\u6570\r\n /// \u9006\u5143\u3068\u306a\u308b\u3088\u3046\u306a\u5024\r\n /// \u6cd5\u304c\u7d20\u6570\u3067\u3042\u308b\u3053\u3068\u3092\u4eee\u5b9a\u3057\u3066\uff0c\u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\u306b\u5f93\u3063\u3066\u9006\u5143\u3092 O(log N) \u3067\u8a08\u7b97\u3057\u307e\u3059\uff0e\r\n public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }\r\n }\r\n #endregion\r\n #region Binomial Coefficient\r\n public class BinomialCoefficient\r\n {\r\n public ModInt[] fact, ifact;\r\n public BinomialCoefficient(int n)\r\n {\r\n fact = new ModInt[n + 1];\r\n ifact = new ModInt[n + 1];\r\n fact[0] = 1;\r\n for (int i = 1; i <= n; i++)\r\n fact[i] = fact[i - 1] * i;\r\n ifact[n] = ModInt.Inverse(fact[n]);\r\n for (int i = n - 1; i >= 0; i--)\r\n ifact[i] = ifact[i + 1] * (i + 1);\r\n ifact[0] = ifact[1];\r\n }\r\n public ModInt this[int n, int r]\r\n {\r\n get\r\n {\r\n if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\r\n return fact[n] * ifact[n - r] * ifact[r];\r\n }\r\n }\r\n public ModInt RepeatedCombination(int n, int k)\r\n {\r\n if (k == 0) return 1;\r\n return this[n + k - 1, k];\r\n }\r\n }\r\n #endregion\r\n}\r\n\r\n\r\nnamespace CompLib.Util\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n class Scanner\r\n {\r\n private string[] _line;\r\n private int _index;\r\n private const char Separator = ' ';\r\n\r\n public Scanner()\r\n {\r\n _line = new string[0];\r\n _index = 0;\r\n }\r\n\r\n public string Next()\r\n {\r\n if (_index >= _line.Length)\r\n {\r\n string s;\r\n do\r\n {\r\n s = Console.ReadLine();\r\n } while (s.Length == 0);\r\n\r\n _line = s.Split(Separator);\r\n _index = 0;\r\n }\r\n\r\n return _line[_index++];\r\n }\r\n\r\n public string ReadLine()\r\n {\r\n _index = _line.Length;\r\n return Console.ReadLine();\r\n }\r\n\r\n public int NextInt() => int.Parse(Next());\r\n public long NextLong() => long.Parse(Next());\r\n public double NextDouble() => double.Parse(Next());\r\n public decimal NextDecimal() => decimal.Parse(Next());\r\n public char NextChar() => Next()[0];\r\n public char[] NextCharArray() => Next().ToCharArray();\r\n\r\n public string[] Array()\r\n {\r\n string s = Console.ReadLine();\r\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\r\n _index = _line.Length;\r\n return _line;\r\n }\r\n\r\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\r\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\r\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\r\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing static System.Console;\r\nusing System.Linq;\r\n\r\nclass edf116\r\n{\r\n static int NN => int.Parse(ReadLine());\r\n static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();\r\n static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();\r\n static void Main()\r\n {\r\n var c = NList;\r\n var (n, x) = (c[0], c[1]);\r\n WriteLine(Arena(n, x));\r\n }\r\n static long Arena(int n, int x)\r\n {\r\n var key = 998244353;\r\n var ncr = new NCR(Math.Max(n, x), key);\r\n var exp = new long[n + 1][];\r\n for (var i = 0; i < exp.Length; ++i)\r\n {\r\n exp[i] = new long[n + 1];\r\n for (var j = 0; j < exp.Length; ++j) exp[i][j] = ncr.Exp(i, j);\r\n }\r\n var dp = new long[x][];\r\n for (var i = 0; i < dp.Length; ++i)\r\n {\r\n dp[i] = new long[n];\r\n dp[i][0] = n;\r\n }\r\n for (var i = 0; i < x; ++i) for (var j = 0; j < n; ++j)\r\n {\r\n for (var k = j; k < n; ++k)\r\n {\r\n if (i + k >= x) break;\r\n var prev = dp[i + k][k];\r\n if (j == 0 && k == 0) continue;\r\n else if (j == k)\r\n {\r\n dp[i + k][k] = (dp[i + k][k] + dp[i][j]) % key;\r\n }\r\n else\r\n {\r\n dp[i + k][k] = (dp[i + k][k]\r\n + dp[i][j] * ncr.Calc(n - j - 1, k - j) % key * exp[k][k - j] % key) % key;\r\n }\r\n }\r\n }\r\n var res = 0L;\r\n for (var i = 0; i < x; ++i) res = (res + dp[i][n - 1]) % key;\r\n return (ncr.Exp(x, n) + key - res) % key;\r\n }\r\n class NCR\r\n {\r\n int[] facts;\r\n int[] revFacts;\r\n int key;\r\n public NCR(int n, int key)\r\n {\r\n facts = new int[n + 1];\r\n revFacts = new int[n + 1];\r\n this.key = key;\r\n facts[0] = 1;\r\n var tmp = 1L;\r\n for (var i = 1; i <= n; ++i)\r\n {\r\n tmp = (tmp * i) % key;\r\n facts[i] = (int)tmp;\r\n }\r\n tmp = Exp(facts[n], key - 2);\r\n revFacts[n] = (int)tmp;\r\n for (var i = n; i > 1; --i)\r\n {\r\n tmp = (tmp * i) % key;\r\n revFacts[i - 1] = (int)tmp;\r\n }\r\n }\r\n public long Exp(int n, int k)\r\n {\r\n if (k == 0) return 1;\r\n if (k == 1) return n % key;\r\n var half = Exp(n, k / 2);\r\n var result = (half * half) % key;\r\n return ((k % 2) == 0) ? result : ((result * n) % key);\r\n }\r\n public int Calc(int n, int r)\r\n {\r\n if (r == 0 || r == n) return 1;\r\n if (r == 1) return n;\r\n return (int)(((long)facts[n] * revFacts[r] % key) * revFacts[n - r] % key);\r\n }\r\n public int Fact(int n)\r\n {\r\n return facts[n];\r\n }\r\n }\r\n}"}], "negative_code": [], "src_uid": "1908d1c8c6b122a4c6633a7af094f17f"} {"source_code": "//ReSharper disable All\nusing System;\n\nnamespace ConsoleApp1\n{\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n string s1 = s;\n int res = 0;\n\n //for (int i = 1; i < s1.Length; i++)\n //{\n // if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i-1] == 'R'))\n // {\n\n // }\n //}\n\n\n int i = 1;\n while (i < s1.Length || res != 0)\n {\n\n if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i - 1] == 'R'))\n {\n s1 = s1.Remove(i - 1, 2).Insert(i - 1, \"D\");\n i++;\n }\n else\n {\n i++;\n }\n }\n\n Console.WriteLine(s1.Length);\n\n }\n }\n\n\n}\n", "positive_code": [{"source_code": "using System;\n\nnamespace problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n //RUURU\n int q = int.Parse(Console.ReadLine());\n String g = Console.ReadLine();;\n int n = 0;\n char[] x = g.ToCharArray();\n for (int i = 0; i < q; i++)\n {\n if(i == q-1)\n {\n n++;\n }\n else if(x[i] == 'R' && x[i+1] == 'U')\n {\n n++;\n i++;\n }\n else if(x[i] == 'U' && x[i+1] == 'R')\n {\n n++;\n i++;\n }\n else\n {\n n++;\n }\n }\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplateClean\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n\n char[] a = Console.ReadLine().ToCharArray();\n\n int res = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (i == n - 1)\n {\n res++;\n }\n else\n {\n\n if (((a[i] == 'R') && (a[i + 1] == 'U')) || ((a[i] == 'U') && (a[i + 1] == 'R')))\n {\n res++;\n i++;\n }\n else\n {\n res++;\n }\n }\n }\n\n Console.WriteLine(res);\n\n }\n\n\n }\n\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n for (int i = count - 1; i > 0; i--)\n {\n if (str[i] == 'R' && str[i - 1] == 'U' || str[i] == 'U' && str[i - 1] == 'R')\n str = str.Remove(--i, 2).Insert(i,\"D\");\n }\n Console.WriteLine(str.Length);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharpEdu\n{\n class TestCS\n {\n static void swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n static int LowerBound(int[] a, int lo, int hi, int x)\n {\n int mid;\n while (hi - lo > 1)\n {\n mid = (hi + lo) / 2;\n if (a[mid] < x)\n lo = mid;\n else\n hi = mid;\n }\n return hi;\n }\n static int UpperBound(int[] a, int lo, int hi, int x)\n {\n int mid;\n while (hi - lo > 1)\n {\n mid = (hi + lo) / 2;\n if (a[mid] <= x)\n lo = mid;\n else\n hi = mid;\n }\n return hi;\n }\n static void QuickSort(ref int[] a, int lo, int hi)\n {\n int key = a[(lo + hi) / 2];\n int i = lo, j = hi;\n while (i <= j)\n {\n while (a[i] < key) ++i;\n while (a[j] > key) --j;\n if (i <= j)\n {\n if (i < j)\n swap(ref a[i], ref a[j]);\n ++i;\n --j;\n }\n }\n if (lo < j) QuickSort(ref a, lo, j);\n if (i < hi) QuickSort(ref a, i, hi);\n }\n static int log2(int x)\n {\n int Res = -1;\n while (x != 0)\n {\n ++Res;\n x = x >> 1;\n }\n return Res;\n }\n static void Main()\n {\n string s;\n int Len = int.Parse(Console.ReadLine());\n s = Console.ReadLine();\n int res = Len, i;\n for (i = 0; i < Len - 1; ++i)\n if ((s[i] == 'U' && s[i + 1] == 'R') || (s[i] == 'R' && s[i + 1] == 'U'))\n {\n --res;\n ++i;\n }\n Console.Write(res);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int N;\n int k = 0;\n N = Console.Read();\n Console.ReadLine();\n s = Console.ReadLine();\n int i;\n for (i = 1; i < s.Length; i++)\n {\n if (s[i] != s[i - 1] )\n {\n i++;\n k++;\n }\n else k++;\n\n\n }\n if (i == s.Length)\n {\n k++;\n }\n Console.Write(k);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string numberInput = \"\";\n string movements = \"\";\n int number = 0;\n numberInput = Console.ReadLine();\n movements = Console.ReadLine();\n int.TryParse(numberInput, out number);\n Regex regex = new Regex(@\"((?:UR|RU))\");\n MatchCollection matches = regex.Matches(movements);\n //movements = movements.Replace(\"UR\", \"D\").Replace(\"RU\", \"D\");\n Console.Write(movements.Count() - matches.Count);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int result = n;\n string input = Console.ReadLine();\n char prev = '0';\n char next = '0';\n\n for (int i = 0; i < n; i++)\n {\n next = input[i];\n if ((next == 'U' && prev == 'R') || (next == 'R' && prev == 'U'))\n {\n prev = '0';\n result--;\n }\n else\n prev = next;\n }\n\n Console.WriteLine(result);\n\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces954A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int cnt = 0;\n for (int i = 0; i < n - 1; i++)\n {\n if ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))\n {\n cnt++;\n i++;\n }\n }\n \n Console.WriteLine(cnt+(n-cnt*2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\n//using mystruct = System.Int64;\n\npublic sealed class Solution : CoreLibs\n{\n internal static void __initStatic()\n {\n initSTDIO(false);\n //\n }\n public void __main(int _TCID = 1)\n {\n //Console.WriteLine(); // newline after \"Case #1: \"\n checked\n {\n var n = readLong64();\n var s = Select(n, readSingleChar).ll();\n var ll = new LinkedList(s);\n var curr = ll.First;\n while (curr.Next != null)\n {\n curr = curr.Next;\n if (curr.Previous.Value != 'd' && curr.Value != curr.Previous.Value)\n {\n curr = ll.AddAfter(curr, 'd');\n ll.Remove(curr.Previous.Previous);\n ll.Remove(curr.Previous);\n }\n }\n Debug.WriteLine(ll.stringify());\n writeNumber(ll.Count);\n //\n Console.WriteLine(); // newline before next test-case\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class CoreLibs\n{\n\n //\n #region STDIO\n#if !DEBUG\n static void Main() { __stdioMain(); }\n#endif\n static void __stdioMain()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;\n for (var i = 1; i <= cnt; i++)\n {\n if (WRITE_TCASE_NUMBER) Console.Write(\"Case #{0}: \", i);\n new Solution().__main(i);\n }\n Console.Out.Flush();\n }\n static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;\n internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)\n {\n INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;\n }\n int validateInitCtor = 1 / (INIT ? 1 : 0);\n // OUTput\n internal string separatorAutoString;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }\n internal void writeText(char c) { Console.Write(c); writeSeparator(); }\n internal void writeText(string s) { Console.Write(s); writeSeparator(); }\n internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }\n internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }\n internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }\n #endregion\n}\nstatic partial class CoreExtension\n{\n\n //\n\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class CoreLibs\n{\n static CoreLibs() { Solution.__initStatic(); }\n internal static IEnumerable seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }\n internal static IEnumerable rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static T? optional(T value) where T : struct { return value; }\n internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n [Conditional(\"DEBUG\")]\n internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }\n internal static List ll(T emptyExample) { return new List(); }\n internal static T? optional(bool hasValue, Func calc) where T : struct { return hasValue ? calc() : new T?(); }\n internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }\n internal static long getRight(long left, long count) { return checked(left + count - 1); }\n internal static long getLeft(long count, long right) { return checked(right - count + 1); }\n internal static double div(double a, double b) { return a / b; }\n internal static void elect(long count, Action act) { while (count-- > 0) act(); }\n internal static IEnumerable Select(long count, Func getter) { while (count-- > 0) yield return getter(); }\n}\n[DebuggerNonUserCode]\nstatic partial class CoreExtension\n{\n internal static IEnumerable elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); return stream; }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static IEnumerable SelectElement(this IEnumerable indices, IList lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }\n internal static int int32(this long val) { return Convert.ToInt32(val); }\n internal static long long64(this int val) { return val; }\n internal static int int32(this int val) { return val; }\n internal static long long64(this long val) { return val; }\n internal static T? optional(this T value) where T : struct { return value; }\n internal static IEnumerable optional(this IEnumerable stream) where T : struct { return stream.Select(optional); }\n internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n //\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n internal static long sumLong64(this IEnumerable stream) { return stream.Sum(x => (long)x); }\n internal static T[] ll(this IEnumerable stream) { return stream.ToArray(); }\n //internal static IEnumerable seq(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n //internal static IEnumerable rev(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }\n internal static int getUpperBound(this IList list) { return list.Count - 1; }\n internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\n//using mystruct = System.Int64;\n\npublic sealed class Solution : CoreLibs\n{\n internal static void __initStatic()\n {\n initSTDIO(false);\n //\n }\n public void __main(int _TCID = 1)\n {\n //Console.WriteLine(); // newline after \"Case #1: \"\n checked\n {\n var n = readLong64();\n var s = repeat(n, readSingleChar).ll();\n Func rec = null;\n rec = i =>\n {\n if (i + 1 < n)\n {\n if (s[i] == s[i + 1])\n return 1 + rec(i + 1);\n else\n return 1 + rec(i + 2);\n }\n if (i < n)\n return 1;\n return 0;\n };\n writeNumber(rec(0));\n //\n Console.WriteLine(); // newline before next test-case\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class CoreLibs\n{\n\n //\n #region STDIO\n#if !DEBUG\n static void Main() { __stdioMain(); }\n#endif\n static void __stdioMain()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;\n for (var i = 1; i <= cnt; i++)\n {\n if (WRITE_TCASE_NUMBER) Console.Write(\"Case #{0}: \", i);\n new Solution().__main(i);\n }\n Console.Out.Flush();\n }\n static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;\n internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)\n {\n INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;\n }\n int validateInitCtor = 1 / (INIT ? 1 : 0);\n // OUTput\n internal string separatorAutoString;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }\n internal void writeText(char c) { Console.Write(c); writeSeparator(); }\n internal void writeText(string s) { Console.Write(s); writeSeparator(); }\n internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }\n internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }\n internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }\n #endregion\n}\nstatic partial class CoreExtension\n{\n\n //\n\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class CoreLibs\n{\n static CoreLibs() { Solution.__initStatic(); }\n internal static IEnumerable seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }\n internal static IEnumerable rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static T? optional(T value) where T : struct { return value; }\n internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n [Conditional(\"DEBUG\")]\n internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }\n internal static List ll(T emptyExample) { return new List(); }\n internal static T? optional(bool hasValue, Func calc) where T : struct { return hasValue ? calc() : new T?(); }\n internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }\n internal static long getRight(long left, long count) { return checked(left + count - 1); }\n internal static long getLeft(long count, long right) { return checked(right - count + 1); }\n internal static double div(double a, double b) { return a / b; }\n internal static void loop(long count, Action act) { while (count-- > 0) act(); }\n internal static IEnumerable repeat(long count, Func getter) { while (count-- > 0) yield return getter(); }\n}\n[DebuggerNonUserCode]\nstatic partial class CoreExtension\n{\n internal static IEnumerable elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); return stream; }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static IEnumerable SelectElement(this IEnumerable indices, IList lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }\n internal static int int32(this long val) { return Convert.ToInt32(val); }\n internal static long long64(this int val) { return val; }\n internal static int int32(this int val) { return val; }\n internal static long long64(this long val) { return val; }\n internal static T? optional(this T value) where T : struct { return value; }\n internal static IEnumerable optional(this IEnumerable stream) where T : struct { return stream.Select(optional); }\n internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n //\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n internal static long sumLong64(this IEnumerable stream) { return stream.Sum(x => (long)x); }\n internal static T[] ll(this IEnumerable stream) { return stream.ToArray(); }\n //internal static IEnumerable seq(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n //internal static IEnumerable rev(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }\n internal static int getUpperBound(this IList list) { return list.Count - 1; }\n internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\n//using mystruct = System.Int64;\n\npublic sealed class Solution : Helper\n{\n //\n public void __main(int _TCID = 1)\n {\n checked\n {\n //\n var n = readLong64();\n var s = readWordString().ToCharArray();\n var dp = (n + 7).Select(() => new ValueRefPointer()).ll();\n dp[0].ValueNullable = 0;\n dp[1].ValueNullable = 1;\n seq(0, n - 1).elect(i =>\n {\n var a = s[i];\n var c = dp[i].ValueNullable ?? i;\n dp[i + 1].UpdateCompute(c + 1, Math.Min);\n if (i + 1 < n)\n {\n var b = s[i + 1];\n if (a != b)\n dp[i + 2].UpdateCompute(c + 1, Math.Min);\n }\n });\n writeNumber(dp[n].ValueNullable ?? 1);\n writeLine();\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class Helper\n{\n //\n static bool MULTI_TCs = false;\n #region STDIO\n#if !DEBUG\n static void Main() { __stdioMain(); }\n#endif\n static void __stdioMain()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;\n for (var i = 1; i <= cnt; i++) new Solution().__main(i);\n Console.Out.Flush();\n }\n // OUTput\n internal string separatorAutoString;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }\n internal void writeText(char c) { Console.Write(c); writeSeparator(); }\n internal void writeText(string s) { Console.Write(s); writeSeparator(); }\n internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }\n internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }\n internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }\n #endregion\n //\n internal class ValueRefPointer where T : struct\n {\n public T? ValueNullable;\n public ValueRefPointer IfAbsent(Action> init) { if (ValueNullable == null) init(this); return this; }\n public ValueRefPointer UpdateIfAbsent(Func calc) { if (ValueNullable == null) ValueNullable = calc(); return this; }\n public ValueRefPointer UpdateCompute(T other, Func merge_CHECKED) { var ans = other; if (ValueNullable.HasValue) ans = merge_CHECKED(other, ValueNullable.Value); ValueNullable = ans; return this; }\n public ValueRefPointer UpdateCompute(T? other, Func merge_CHECKED) { if (other.HasValue) UpdateCompute(other.Value, merge_CHECKED); return this; }\n public ValueRefPointer Swap(ValueRefPointer with) { var temp = ValueNullable; ValueNullable = with.ValueNullable; with.ValueNullable = temp; return this; }\n //TODO switch to implicit cast from ValueRefPointer to T?\n public ValueRefPointer UpdateCompute(ValueRefPointer other, Func merge_CHECKED) { return UpdateCompute(other.ValueNullable, merge_CHECKED); }\n public override string ToString() { return ValueNullable.ToString(); }\n }\n}\nstatic partial class Extension\n{\n //\n\n //\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class Helper\n{\n internal static IEnumerable seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }\n internal static IEnumerable rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static T? optional(T value) where T : struct { return value; }\n internal static void assert(bool truthy) { if (!truthy) { var a = 0; a /= a; } }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n [Conditional(\"DEBUG\")]\n internal static void debug(bool truthy) { Debug.Assert(truthy); }\n internal static List ll(T emptyExample) { return new List(); }\n internal static T? optional(bool hasValue, Func calc) where T : struct { return hasValue ? calc() : new T?(); }\n internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }\n internal static long getRight(long left, long count) { return checked(left + count - 1); }\n internal static long getLeft(long count, long right) { return checked(right - count + 1); }\n static double div(double a, double b) { return a / b; }\n}\n[DebuggerNonUserCode]\nstatic partial class Extension\n{\n internal static IEnumerable elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); return stream; }\n internal static IEnumerable Select(this long count, Func getter) { while (count-- > 0) yield return getter(); }\n internal static void elect(this long count, Action act) { while (count-- > 0) act(); }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static IEnumerable SelectElement(this IEnumerable indices, IList lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }\n internal static int int32(this long val) { return Convert.ToInt32(val); }\n internal static long long64(this int val) { return val; }\n internal static T? optional(this T value) where T : struct { return value; }\n internal static IEnumerable optional(this IEnumerable stream) where T : struct { return stream.Select(optional); }\n internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }\n //\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n internal static long sumLong64(IEnumerable stream) { return stream.Sum(x => (long)x); }\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static T[] ll(this IEnumerable stream) { return stream.ToArray(); }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n //internal static IEnumerable seq(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n //internal static IEnumerable rev(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }\n internal static int getUpperBound(this IList list) { return list.Count - 1; }\n internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _954A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n int length = 0;\n\n for (int i = 0; i < n; i++, length++)\n {\n if (i + 1 < n && s[i] != s[i + 1])\n {\n i++;\n }\n }\n\n Console.WriteLine(length);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n string s = sc.Next();\n\n int ans = 1;\n bool f = true;\n for (int i = 1; i < n; i++)\n {\n bool ru = s[i - 1] == 'R' && s[i] == 'U';\n bool ur = s[i - 1] == 'U' && s[i] == 'R';\n if (f && (ru || ur))\n {\n f = false;\n }\n else\n {\n ans++;\n f = true;\n }\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Junior\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n\n for (int i = 0; i < a - 1; i++)\n {\n if (s[i] != s[i + 1])\n {\n i++;\n count++;\n }\n }\n Console.WriteLine(a - count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SubScore\n{\n class Student : IComparable\n {\n\n public int id = -1;\n public string name = \"\";\n public int totalscode = 0;\n public int tc = 0;\n public List scode = new List();\n public Student(int IRN, string name)\n {\n this.id = IRN;\n this.name = name;\n }\n\n public void AddGrade(int grade)\n {\n if (grade >= 50)\n {\n scode.Add(grade);\n totalscode = scode.Sum();\n totalscode = totalscode / scode.Count;\n tc += 4;\n }\n }\n\n public int CompareTo(Student other)\n {\n if (this.totalscode == other.totalscode) return this.id.CompareTo(other.id);\n return other.totalscode.CompareTo(this.totalscode);\n\n }\n\n\n }\n\n public class program\n {\n static void Main(string[] args)\n {\n\n StringBuilder result = new StringBuilder();\n int n = NextInt();\n string m = Next();\n int temb = 0;\n for (int i = 1; i < n;i++)\n {\n if (m[i].ToString() + m[i - 1].ToString() == \"UR\" || m[i].ToString() + m[i - 1].ToString() == \"RU\")\n {\n temb++;\n i++;\n }\n }\n Console.WriteLine(n-temb);\n Console.ReadLine();\n\n }\n #region Input wrapper\n\n static int s_index = 0;\n static string[] s_tokens;\n\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n\n private static long NextLong()\n {\n return Int64.Parse(Next());\n }\n\n #endregion\n }\n\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n StringBuilder sb = new StringBuilder(Console.ReadLine());\n int c = 0;\n int initLen = sb.Length;\n for(int i = 0; i < sb.Length - 1; i++)\n {\n if ((sb[i] == 'U' && sb[i + 1] == 'R') || (sb[i] == 'R' && sb[i + 1] == 'U'))\n {\n sb.Remove(i, 2);\n sb.Insert(i, 'D');\n c++;\n }\n \n }\n Console.WriteLine(initLen - c);\n }\n }\n} \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string q = Console.ReadLine();\n //string q1 = Console.ReadLine();\n //for (int i = 0; i < q.Length; i++)\n //{\n // Console.WriteLine(b[i]);\n //}\n int a = int.Parse(Console.ReadLine());\n string b = Console.ReadLine();\n int dsf = a;\n for (int i = 0; i < a-1; i++)\n {\n if (((b[i] == 'R') && (b[i + 1] == 'U')) || ((b[i] == 'U') && (b[i + 1] == 'R')))\n {\n dsf--;\n i++;\n }\n }\n Console.WriteLine(dsf);\n //Console.ReadKey();\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n String s = Console.ReadLine();\n String s2 = s;\n\n string d1 = \"RU\";\n string d2 = \"UR\";\n\n for(int i = 0; i< s.Length -1; i ++)\n {\n if((s[i] == d1[0] && s[i+1] == d1[1]) || (s[i] == d2[0] && s[i+1] == d2[1]))\n {\n n --;\n i++;\n }\n }\n\n Console.WriteLine(n);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace CodeForces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int number = int.Parse(Console.ReadLine());\n string way = Console.ReadLine();\n for (int i = 0; i < way.Length-1; i++)\n {\n if (way[i] != way[i + 1])\n {\n number -= 1;\n i++;\n }\n \n }\n Console.WriteLine(number);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Diagonal_Walking\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 0;\n string s = Console.ReadLine(); \n here:\n for (int i = 0; i < n; i++)\n {\n if (i + 1>= s.Length){break;}\n if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')\n {\n s = s.Remove(i, 2);\n res++;\n goto here;\n }\n else\n {\n res++;\n s = s.Remove(i, 1);\n goto here;\n }\n }\n if (s.Length > 0) res++;\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HodbaDiag\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int count = 0;\n int i = 0;\n while (i < n)\n {\n if (i(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n\n int n = int.Parse(Console.ReadLine());\n\n char[] a = Console.ReadLine().ToCharArray();\n\n int res = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (i == n - 1)\n {\n res++;\n }\n else\n {\n\n if (((a[i] == 'R') && (a[i + 1] == 'U')) || ((a[i] == 'U') && (a[i + 1] == 'R')))\n {\n res++;\n i++;\n }\n else\n {\n res++;\n }\n }\n }\n\n Console.WriteLine(res);\n\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n \n int ans = n;\n \n for(int i=0;i Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = false;\n#else\nconst bool testing = false;\n#endif\n\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n public delegate bool Pred(long listVal);\n // check if result == n-1\n static int lowerBound(List list, Pred pred)\n {\n var lo = 0;\n var hi = list.Count - 1;\n while (lo < hi)\n {\n var mid = lo + (hi - lo) / 2;\n if (pred(list[mid]))\n {\n hi = mid;\n }\n else\n {\n lo = mid + 1;\n }\n }\n return lo;\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n static int upperBound(List list, Pred pred)\n {\n var lo = 0;\n var hi = list.Count - 1;\n while (lo < hi)\n {\n var mid = lo + (hi - lo + 1) / 2;\n if (pred(list[mid]))\n {\n lo = mid;\n }\n else\n {\n hi = mid - 1;\n }\n }\n return lo;\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static void program(TextReader input)\n {\n var n =int.Parse(reader.ReadLine().TrimEnd());\n var s = reader.ReadLine().TrimEnd();\n\n for(var i=0;i expected :\");\n Console.WriteLine(\"3\\n2\\n4\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"4 3\\n2\\n3\\n4\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"13\\n3\\n8\\n9\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"13 4\\n10\\n5\\n4\\n8\\n\"));\n Console.WriteLine();\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string moves = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < moves.Length; i++)\n {\n if (i == moves.Length - 1)\n count++;\n else if (moves[i] == 'U')\n {\n if (moves[i + 1] == 'R')\n {\n i++;\n }\n count++;\n }\n else if (moves[i] == 'R')\n {\n if (moves[i + 1] == 'U')\n {\n i++;\n }\n count++;\n }\n else\n count++;\n\n }\n\n Console.WriteLine($\"{count}\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace StepCounting\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = NextInt();\n string a = Next();\n int count = n;\n string case1 = \"RU\";\n string case2= \"UR\";\n \n for (int i = 1; i < n; i++)\n {\n \n if (a[i].ToString() + a[i - 1].ToString() == case1 )\n {\n count--;\n i++;\n }\n else if (a[i].ToString() + a[i - 1].ToString() == case2)\n {\n count --;\n i++;\n }\n\n }\n Console.WriteLine(count);\n Console.Read();\n\n \n\n }\n #region Input wrapper\n\n static int s_index = 0;\n static string[] s_tokens;\n\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Length)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n\n private static long NextLong()\n {\n return Int64.Parse(Next());\n }\n\n #endregion\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int length = int.Parse(a);\n string sequence = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < sequence.Length-1; i++)\n {\n if (sequence[i] == 'U')\n {\n if (sequence[i + 1] == 'R')\n {\n count++;\n i++;\n }\n }\n else if (sequence[i] == 'R')\n if (sequence[i + 1] == 'U')\n {\n count++;\n i++;\n } \n }\n Console.WriteLine(sequence.Length-count); \n }\n }\n}"}, {"source_code": "// Problem: 954A - Diagonal Walking\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass DiagonalWalking\n {\n static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 100)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n string seq = words[0];\n if (seq.Length != n)\n return -1;\n for (byte i = 0; i < n; i++)\n {\n char c = seq[i];\n if (c != 'R' && c != 'U')\n return -1;\n }\n byte countDiag = 0;\n bool existDiag = true;\n while (existDiag)\n {\n sbyte iRU = Convert.ToSByte (seq.IndexOf (\"RU\"));\n sbyte iUR = Convert.ToSByte (seq.IndexOf (\"UR\"));\n if (iRU == -1 && iUR == -1)\n {\n existDiag = false;\n continue;\n }\n if (iRU != -1 && (iUR == -1 || iRU < iUR))\n seq = seq.Remove(iRU,2).Insert(iRU,\"D\");\n else if (iUR != -1 && (iRU == -1 || iUR < iRU))\n seq = seq.Remove(iUR,2).Insert(iUR,\"D\");\n countDiag++;\n }\n byte ans = Convert.ToByte (n-countDiag);\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System;\n\nnamespace csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n String s = Console.ReadLine();\n String s2 = s;\n\n string d1 = \"RU\";\n string d2 = \"UR\";\n\n for(int i = 0; i< s.Length -1; i ++)\n {\n if((s[i] == d1[0] && s[i+1] == d1[1]) || (s[i] == d2[0] && s[i+1] == d2[1]))\n {\n n --;\n i++;\n }\n }\n\n Console.WriteLine(n);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace shagi\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32( Console.ReadLine());\n StringBuilder steps = new StringBuilder (Console.ReadLine());\n int i;\n for (i = 0; i <= steps.Length - 2; i++)\n {\n if (steps[i]=='U' && steps[i + 1] == 'R')\n {\n steps.Remove(i, 2);\n steps.Insert(i, 'D');\n\n }\n if (steps[i] == 'R' && steps[i + 1] == 'U')\n {\n steps.Remove(i, 2);\n steps.Insert(i, 'D');\n\n }\n\n }\n Console.WriteLine(steps.Length);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces954A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int cnt = 0;\n for (int i = 0; i < n - 1; i++)\n {\n if ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))\n {\n cnt++;\n i++;\n }\n }\n \n Console.WriteLine(cnt+(n-cnt*2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace olymp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n int res = 0;\n int i = 0;\n while (i < s.Length)\n {\n if (i < s.Length - 1 && ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R')))\n {\n res++;\n i += 2;\n }\n else\n {\n res++;\n i += 1;\n }\n }\n Console.WriteLine(res);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = Console.ReadLine();\n int ans = n;\n for ( int i=1; i ii + 1 && sequence[ii] == 'U' && sequence[ii + 1] == 'R')\n {\n StringBuilder tmp = new StringBuilder(sequence);\n tmp[ii] = 'D';\n tmp[ii + 1] = ' ';\n sequence = getNewSequence(tmp.ToString());\n didReplace = true;\n break;\n }\n else if (sequence.Length > ii + 1 && sequence[ii] == 'R' && sequence[ii + 1] == 'U')\n {\n StringBuilder tmp = new StringBuilder(sequence);\n tmp[ii] = 'D';\n tmp[ii + 1] = ' ';\n sequence = getNewSequence(tmp.ToString());\n didReplace = true;\n break;\n }\n }\n }\n\n Console.WriteLine(sequence.Length);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Diagonal_Walking\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool ok = true;\n int n=int.Parse(Console.ReadLine()), ans=0;\n string s = Console.ReadLine();\n for(int i=0; i rec = null;\n rec = i =>\n {\n if (i < n)\n {\n if (s[i] == s[i - 1])\n return 1 + rec(i + 1);\n else\n return 1 + rec(i + 2);\n }\n return 1;\n };\n writeNumber(rec(1));\n //\n Console.WriteLine(); // newline before next test-case\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class CoreLibs\n{\n\n //\n #region STDIO\n#if !DEBUG\n static void Main() { __stdioMain(); }\n#endif\n static void __stdioMain()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;\n for (var i = 1; i <= cnt; i++)\n {\n if (WRITE_TCASE_NUMBER) Console.Write(\"Case #{0}: \", i);\n new Solution().__main(i);\n }\n Console.Out.Flush();\n }\n static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;\n internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)\n {\n INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;\n }\n int validateInitCtor = 1 / (INIT ? 1 : 0);\n // OUTput\n internal string separatorAutoString;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }\n internal void writeText(char c) { Console.Write(c); writeSeparator(); }\n internal void writeText(string s) { Console.Write(s); writeSeparator(); }\n internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }\n internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }\n internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }\n #endregion\n}\nstatic partial class CoreExtension\n{\n\n //\n\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class CoreLibs\n{\n static CoreLibs() { Solution.__initStatic(); }\n internal static IEnumerable seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }\n internal static IEnumerable rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static T? optional(T value) where T : struct { return value; }\n internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n [Conditional(\"DEBUG\")]\n internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }\n internal static List ll(T emptyExample) { return new List(); }\n internal static T? optional(bool hasValue, Func calc) where T : struct { return hasValue ? calc() : new T?(); }\n internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }\n internal static long getRight(long left, long count) { return checked(left + count - 1); }\n internal static long getLeft(long count, long right) { return checked(right - count + 1); }\n internal static double div(double a, double b) { return a / b; }\n internal static void loop(long count, Action act) { while (count-- > 0) act(); }\n internal static IEnumerable repeat(long count, Func getter) { while (count-- > 0) yield return getter(); }\n}\n[DebuggerNonUserCode]\nstatic partial class CoreExtension\n{\n internal static IEnumerable elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); return stream; }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static IEnumerable SelectElement(this IEnumerable indices, IList lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }\n internal static int int32(this long val) { return Convert.ToInt32(val); }\n internal static long long64(this int val) { return val; }\n internal static int int32(this int val) { return val; }\n internal static long long64(this long val) { return val; }\n internal static T? optional(this T value) where T : struct { return value; }\n internal static IEnumerable optional(this IEnumerable stream) where T : struct { return stream.Select(optional); }\n internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n //\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n internal static long sumLong64(this IEnumerable stream) { return stream.Sum(x => (long)x); }\n internal static T[] ll(this IEnumerable stream) { return stream.ToArray(); }\n //internal static IEnumerable seq(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n //internal static IEnumerable rev(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }\n internal static int getUpperBound(this IList list) { return list.Count - 1; }\n internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\n//using mystruct = System.Int64;\n\npublic sealed class Solution : CoreLibs\n{\n internal static void __initStatic()\n {\n initSTDIO(false);\n //\n }\n public void __main(int _TCID = 1)\n {\n //Console.WriteLine(); // newline after \"Case #1: \"\n checked\n {\n var n = readLong64();\n var s = repeat(n, readSingleChar).ll();\n Func rec = null;\n rec = i =>\n {\n if (i + 1 < n)\n {\n if (s[i] == s[i + 1])\n return 1 + rec(i + 1);\n else\n return 1 + rec(i + 2);\n }\n else\n {\n return 1;\n }\n };\n writeNumber(rec(0));\n //\n Console.WriteLine(); // newline before next test-case\n }\n }\n //\n}\n\n\n// additional plugable library\npublic partial class CoreLibs\n{\n\n //\n #region STDIO\n#if !DEBUG\n static void Main() { __stdioMain(); }\n#endif\n static void __stdioMain()\n {\n Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));\n if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));\n var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;\n for (var i = 1; i <= cnt; i++)\n {\n if (WRITE_TCASE_NUMBER) Console.Write(\"Case #{0}: \", i);\n new Solution().__main(i);\n }\n Console.Out.Flush();\n }\n static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;\n internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)\n {\n INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;\n }\n int validateInitCtor = 1 / (INIT ? 1 : 0);\n // OUTput\n internal string separatorAutoString;\n internal void writeLine() { Console.WriteLine(); }\n internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }\n internal void writeText(char c) { Console.Write(c); writeSeparator(); }\n internal void writeText(string s) { Console.Write(s); writeSeparator(); }\n internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }\n internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }\n internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }\n // INput\n static void EOF() { throw new System.IO.EndOfStreamException(); }\n static IEnumerable stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }\n static bool isWhitespace(char c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t'; }\n static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);\n internal static string readWordString()\n {\n sb.Clear();\n var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));\n foreach (var c in iter) sb.Append(c);\n if (sb.Length == 0) EOF(); return sb.ToString();\n }\n internal static long readLong64() { return long.Parse(readWordString()); }\n internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }\n #endregion\n}\nstatic partial class CoreExtension\n{\n\n //\n\n}\n\n\n#region Core helper library\n[DebuggerNonUserCode]\npublic partial class CoreLibs\n{\n static CoreLibs() { Solution.__initStatic(); }\n internal static IEnumerable seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }\n internal static IEnumerable rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }\n internal static T[] collect(params T[] elemS) { return elemS; }\n internal static T? optional(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }\n internal static T identity(T obj) { return obj; }\n internal static T? optional(T value) where T : struct { return value; }\n internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }\n internal static void assert(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine(\"SALAH {0} / BENAR {1}\", actual, expected); assert(false); } }\n [Conditional(\"DEBUG\")]\n internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }\n internal static List ll(T emptyExample) { return new List(); }\n internal static T? optional(bool hasValue, Func calc) where T : struct { return hasValue ? calc() : new T?(); }\n internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }\n internal static long getRight(long left, long count) { return checked(left + count - 1); }\n internal static long getLeft(long count, long right) { return checked(right - count + 1); }\n internal static double div(double a, double b) { return a / b; }\n internal static void loop(long count, Action act) { while (count-- > 0) act(); }\n internal static IEnumerable repeat(long count, Func getter) { while (count-- > 0) yield return getter(); }\n}\n[DebuggerNonUserCode]\nstatic partial class CoreExtension\n{\n internal static IEnumerable elect(this IEnumerable stream, Action act) { foreach (var elem in stream) act(elem); return stream; }\n internal static List> ToKvpList(this IEnumerable list) { return list.Select((elem, idx) => new KeyValuePair(idx, elem)).ToList(); }\n internal static IEnumerable SelectElement(this IEnumerable indices, IList lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }\n internal static int int32(this long val) { return Convert.ToInt32(val); }\n internal static long long64(this int val) { return val; }\n internal static int int32(this int val) { return val; }\n internal static long long64(this long val) { return val; }\n internal static T? optional(this T value) where T : struct { return value; }\n internal static IEnumerable optional(this IEnumerable stream) where T : struct { return stream.Select(optional); }\n internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }\n internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }\n internal static T[] sort(this T[] arr) { Array.Sort(arr); return arr; }\n internal static List sort(this List lst) { lst.Sort(); return lst; }\n //\n internal static T? AggregateOrNullable(this IEnumerable stream, Func merge_CHECKED) where T : struct\n { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }\n internal static long sumLong64(this IEnumerable stream) { return stream.Sum(x => (long)x); }\n internal static T[] ll(this IEnumerable stream) { return stream.ToArray(); }\n //internal static IEnumerable seq(this IList list) { for (var i = 0; i < list.Count; i++) yield return i; }\n //internal static IEnumerable rev(this IList list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }\n internal static int getUpperBound(this IList list) { return list.Count - 1; }\n internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }\n internal static T? elementAtOrNullable(this IList list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }\n internal static string stringify(this IEnumerable stream) { return new string(stream.ToArray()); }\n}\n#endregion\n"}, {"source_code": "//ReSharper disable All\nusing System;\n\nnamespace ConsoleApp1\n{\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n string s1 = s;\n int res = 0;\n\n //for (int i = 1; i < s1.Length; i++)\n //{\n // if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i-1] == 'R'))\n // {\n\n // }\n //}\n\n\n int i = 1;\n while (i < s1.Length || res != 0)\n {\n\n if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i - 1] == 'R'))\n {\n s1 = s1.Remove(i - 1, 2).Insert(i - 1, \"D\");\n i += 2;\n }\n else\n {\n i++;\n }\n }\n\n Console.WriteLine(s1.Length);\n\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n StringBuilder sb = new StringBuilder(Console.ReadLine());\n int c = 0;\n int initLen = sb.Length;\n for(int i = 0; i < sb.Length - 1; i++)\n {\n if ((sb[i] == 'U' && sb[i + 1] == 'R') || (sb[i] == 'R' && sb[i + 1] == 'U'))\n {\n sb.Remove(i, 2);\n c++;\n }\n \n }\n Console.WriteLine(initLen - c);\n }\n }\n} \n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Diagonal_Walking\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 0;\n string s = Console.ReadLine();\n for (int i = 0; i < n-1; i++)\n {\n if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')\n {\n res++;\n //Console.WriteLine(\"one\");\n i++;\n }\n else\n {\n res++;\n }\n }\n res++;\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Diagonal_Walking\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 0;\n string s = Console.ReadLine();\n for (int i = 0; i < n-1; i++)\n {\n if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')\n {\n res++;\n Console.WriteLine(\"one\");\n i++;\n }\n else\n {\n res++;\n }\n }\n res++;\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Diagonal_Walking\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n string s = reader.ReadLine();\n s = reader.ReadLine();\n\n int ans = 1;\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == 'R' && s[i - 1] == 'U' || s[i] == 'U' && s[i - 1] == 'R')\n {\n i++;\n }\n\n ans++;\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string moves = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < moves.Length; i++)\n {\n if (i == moves.Length - 1)\n count++;\n else if (moves[i] == 'U')\n {\n if (moves[i + 1] == 'R')\n {\n count++;\n i++;\n }\n }\n else if (moves[i] == 'R')\n {\n if (moves[i + 1] == 'U')\n {\n count++;\n i++;\n }\n }\n else\n count++;\n\n }\n\n Console.WriteLine($\"{count}\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = int.Parse(Console.ReadLine());\n string sequence = Console.ReadLine();\n sequence = sequence.Replace(\"UR\", \"D\");\n sequence = sequence.Replace(\"RU\", \"D\");\n\n Console.WriteLine(sequence.Length); \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int length = int.Parse(a);\n string sequence = Console.ReadLine();\n int j = 1;\n for (int i = 0; i < sequence.Length-1; i++)\n {\n if (sequence[i] == 'U')\n if (sequence[i + 1] == 'R')\n {\n j++;\n i++;\n }\n else\n {\n j++;\n }\n else if(sequence[i] == 'R')\n if (sequence[i + 1] == 'U')\n {\n j++;\n i++;\n }\n else\n {\n j++;\n }\n\n\n }\n Console.WriteLine(j);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace olymp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n Regex reg1 = new Regex(\"RU\");\n Regex reg2 = new Regex(\"UR\");\n while (reg1.IsMatch(s) || reg2.IsMatch(s))\n {\n s = reg1.Replace(s, \"C\");\n s = reg2.Replace(s, \"C\");\n }\n Console.WriteLine(s.Length);\n //Console.ReadKey();\n }\n }\n}\n"}], "src_uid": "986ae418ce82435badadb0bd5588f45b"} {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing Number = System.Int32;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random(1);\n\t\tpublic void Solve() {\n\t\t\tvar n = ri;\n\t\t\tvar G = Enumerate(n, x => new List());\n\t\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\t\tvar u = ri - 1;\n\t\t\t\tvar v = ri - 1;\n\t\t\t\tG[u].Add(v);\n\t\t\t\tG[v].Add(u);\n\t\t\t}\n\t\t\tint X = n + 50;\n\t\t\tint root = -1;\n\n\t\t\tfor (int r = 0; r < n; r++) {\n\t\t\t\tint[] sz = new int[n];\n\t\t\t\tFunc dfs = null;\n\t\t\t\tdfs = (pre, cur) => {\n\t\t\t\t\tsz[cur] = 1;\n\t\t\t\t\tforeach (var t in G[cur])\n\t\t\t\t\t\tif (pre != t)\n\t\t\t\t\t\t\tsz[cur] += dfs(cur, t);\n\t\t\t\t\treturn sz[cur];\n\t\t\t\t};\n\t\t\t\tdfs(-1, r);\n\t\t\t\tvar max = -1;\n\t\t\t\tforeach (var t in G[r])\n\t\t\t\t\tmax = Max(max, sz[t]);\n\t\t\t\tif (max < X) {\n\t\t\t\t\tX = max;\n\t\t\t\t\troot = r;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsolve(G, root);\n\t\t\t//1/3*2/3\n\t\t}\n\t\tvoid solve(List[] G, int r) {\n\t\t\tvar n = G.Length;\n\t\t\tint[] sz = new int[n];\n\t\t\t{\n\t\t\t\tFunc dfs = null;\n\t\t\t\tdfs = (pre, cur) => {\n\t\t\t\t\tsz[cur] = 1;\n\t\t\t\t\tforeach (var t in G[cur])\n\t\t\t\t\t\tif (t != pre)\n\t\t\t\t\t\t\tsz[cur] += dfs(cur, t);\n\t\t\t\t\treturn sz[cur];\n\t\t\t\t};\n\t\t\t\tdfs(-1, r);\n\t\t\t}\n\t\t\t{\n\t\t\t\tG[r] = G[r].OrderByDescending(x => sz[x]).ToList();\n\t\t\t\tvar v = 0;\n\t\t\t\tvar dist = new int[n];\n\n\t\t\t\tvar D = 1;\n\t\t\t\tvar dx = 1;\n\t\t\t\tAction dfs = null;\n\t\t\t\tdfs = (pre, cur) => {\n\n\t\t\t\t\tdist[cur] = D;\n\t\t\t\t\tif (v * 3 <= n) {\n\t\t\t\t\t\tD++;\n\t\t\t\t\t\tdx++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tD += dx;\n\t\t\t\t\t}\n\t\t\t\t\tDebug.WriteLine($\"{pre} {cur} {D} {dist[cur]} {dist[pre]} {v}\");\n\t\t\t\t\tConsole.WriteLine($\"{pre + 1} {cur + 1} {dist[cur] - dist[pre]}\");\n\t\t\t\t\tforeach (var t in G[cur])\n\t\t\t\t\t\tif (t != pre) dfs(cur, t);\n\n\t\t\t\t};\n\t\t\t\tforeach (var t in G[r]) {\n\t\t\t\t\tdfs(r, t);\n\t\t\t\t\tv += sz[t];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint read() => int.Parse(Console.ReadLine());\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\tConsole.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n\t\tvar solver = new Program.Solver();\n\t\t//var t = new System.Threading.Thread(solver.Solve, 50000000);\n\t\t//t.Start();\n\t\t//t.Join();\n\t\tsolver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private List<(int to, int num)>[] E;\n private int[] U, V;\n private int Max;\n\n private int R;\n private bool[] IsX;\n private bool Found;\n private int XSize;\n\n private int[] Len;\n private int[] Dist;\n private int TmpX;\n private int TmpY;\n\n void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n E = new List<(int to, int num)>[N];\n U = new int[N - 1];\n V = new int[N - 1];\n for (int i = 0; i < N; i++)\n {\n E[i] = new List<(int to, int num)>();\n }\n\n for (int i = 0; i < N - 1; i++)\n {\n int u = sc.NextInt() - 1;\n int v = sc.NextInt() - 1;\n U[i] = u + 1;\n V[i] = v + 1;\n E[u].Add((v, i));\n E[v].Add((u, i));\n }\n\n Max = 2 * N * N / 9;\n }\n\n void SetFlag(int cur, int par)\n {\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n SetFlag(e.to, cur);\n }\n\n IsX[cur] = true;\n }\n\n int Go(int cur, int par)\n {\n var ls = new List<(int to, int size)>();\n int size = 1;\n foreach (var e in E[cur])\n {\n if (e.to == par) continue;\n int tmp = Go(e.to, cur);\n ls.Add((e.to, tmp));\n size += tmp;\n }\n\n\n if (par != -1)\n {\n ls.Add((par, N - size));\n }\n\n\n if (!Found)\n {\n bool[,] dp = new bool[ls.Count + 1, N];\n dp[0, 0] = true;\n for (int i = 0; i < ls.Count; i++)\n {\n for (int j = 0; j < N; j++)\n {\n if (dp[i, j])\n {\n dp[i + 1, j] = true;\n dp[i + 1, j + ls[i].size] = true;\n }\n }\n }\n\n int x = -1;\n for (int i = 0; i < N; i++)\n {\n if (!dp[ls.Count, i]) continue;\n int y = N - 1 - i;\n if (Max < (i + 1) * (y + 1))\n {\n x = i;\n break;\n }\n }\n\n if (x != -1)\n {\n XSize = x;\n R = cur;\n for (int i = ls.Count - 1; i >= 0; i--)\n {\n if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])\n {\n SetFlag(ls[i].to, cur);\n x -= ls[i].size;\n }\n }\n\n Found = true;\n }\n }\n\n\n return size;\n }\n\n // r\u3001x,y\u306e\u9802\u70b9\u3092\u6c7a\u3081\u308b\n void SearchR()\n {\n IsX = new bool[N];\n Found = false;\n Go(0, -1);\n if (!Found) throw new Exception();\n }\n\n\n // \u73fe\u5728\u5730\u3001\u89aa\u3001par-cur\u304c\u8fbanum\n void SetX(int cur, int par, int num)\n {\n Dist[cur] = TmpX++;\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (!IsX[e.to]) continue;\n SetX(e.to, cur, e.num);\n }\n }\n\n void SetY(int cur, int par, int num)\n {\n Dist[cur] = TmpY;\n TmpY += (XSize + 1);\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (IsX[e.to]) continue;\n SetY(e.to, cur, e.num);\n }\n }\n\n void SetLen()\n {\n // \u8fba\u306e\u9577\u3055\n Len = new int[N - 1];\n // R->\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\n Dist = new int[N];\n // X\u5074\u306e\u9802\u70b9\u306fR\u306b\u8fd1\u3044\u9806\u306b\u8ddd\u96e21~X\u3092\u5272\u308a\u5f53\u3066\u308b\n // \u305d\u308c\u305e\u308c\u306e\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\u306b\u306a\u308b\u3088\u3046\u306b\u9802\u70b9\u306e\u9577\u3055\u3092\u5272\u308a\u5f53\u3066\u308b\n TmpX = 0;\n SetX(R, -1, -1);\n\n // Y (X+1)\u523b\u307f\u3067\u5272\u308a\u5f53\u3066\u308b\n TmpY = 0;\n SetY(R, -1, -1);\n }\n\n void Write()\n {\n var sb = new StringBuilder();\n for (int i = 0; i < N - 1; i++)\n {\n sb.AppendLine($\"{U[i]} {V[i]} {Len[i]}\");\n }\n\n Console.Write(sb);\n }\n\n public void Solve()\n {\n // \u3042\u308b\u9802\u70b9r\u3092\u5883\u76ee\u306b2\u3064\u306b\u5206\u3051\u308b\n // \u7247\u65b9x\u500b \u3082\u3046\u7247\u65b9 y\u500b x + y + 1 = N\n // \u7247\u65b9\u3067r\u304b\u3089\u306e\u8ddd\u96e2 0~x\u3092\u3064\u304f\u308b\n // \u6b8b\u308a x+1\u523b\u307f\u3067 y\u500b\n // 0 <= p < (x+1)(y+1)\u3067\u304d\u308b\n\n Scan();\n SearchR();\n SetLen();\n Write();\n }\n\n public static void Main(string[] args)\n {\n new Thread(new ThreadStart(new Program().Solve), 1 << 27).Start();\n }\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private List<(int to, int num)>[] E;\n private int[] U, V;\n private int Max;\n\n private int R;\n private bool[] IsX;\n private bool Found;\n private int XSize;\n\n private int[] Len;\n private int[] Dist;\n private int TmpX;\n private int TmpY;\n\n void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n E = new List<(int to, int num)>[N];\n U = new int[N - 1];\n V = new int[N - 1];\n for (int i = 0; i < N; i++)\n {\n E[i] = new List<(int to, int num)>();\n }\n\n for (int i = 0; i < N - 1; i++)\n {\n int u = sc.NextInt() - 1;\n int v = sc.NextInt() - 1;\n U[i] = u + 1;\n V[i] = v + 1;\n E[u].Add((v, i));\n E[v].Add((u, i));\n }\n\n Max = 2 * N * N / 9;\n }\n\n void SetFlag(int cur, int par)\n {\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n SetFlag(e.to, cur);\n }\n\n IsX[cur] = true;\n }\n\n int Go(int cur, int par)\n {\n var ls = new List<(int to, int size)>();\n int size = 1;\n foreach (var e in E[cur])\n {\n if (e.to == par) continue;\n int tmp = Go(e.to, cur);\n ls.Add((e.to, tmp));\n size += tmp;\n }\n\n\n if (par != -1)\n {\n ls.Add((par, N - size));\n }\n\n\n if (!Found)\n {\n bool[,] dp = new bool[ls.Count + 1, N];\n dp[0, 0] = true;\n for (int i = 0; i < ls.Count; i++)\n {\n for (int j = 0; j < N; j++)\n {\n if (dp[i, j])\n {\n dp[i + 1, j] = true;\n dp[i + 1, j + ls[i].size] = true;\n }\n }\n }\n\n int x = -1;\n for (int i = 0; i < N; i++)\n {\n if (!dp[ls.Count, i]) continue;\n int y = N - 1 - i;\n if (Max < (i + 1) * (y + 1))\n {\n x = i;\n break;\n }\n }\n\n if (x != -1)\n {\n XSize = x;\n R = cur;\n for (int i = ls.Count - 1; i >= 0; i--)\n {\n if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])\n {\n SetFlag(ls[i].to, cur);\n x -= ls[i].size;\n }\n }\n\n Found = true;\n }\n }\n\n\n return size;\n }\n\n // r\u3001x,y\u306e\u9802\u70b9\u3092\u6c7a\u3081\u308b\n void SearchR()\n {\n IsX = new bool[N];\n Found = false;\n Go(0, -1);\n if (!Found) throw new Exception();\n }\n\n\n // \u73fe\u5728\u5730\u3001\u89aa\u3001par-cur\u304c\u8fbanum\n void SetX(int cur, int par, int num)\n {\n Dist[cur] = TmpX++;\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (!IsX[e.to]) continue;\n SetX(e.to, cur, e.num);\n }\n }\n\n void SetY(int cur, int par, int num)\n {\n Dist[cur] = TmpY;\n TmpY += (XSize + 1);\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (IsX[e.to]) continue;\n SetY(e.to, cur, e.num);\n }\n }\n\n void SetLen()\n {\n // \u8fba\u306e\u9577\u3055\n Len = new int[N - 1];\n // R->\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\n Dist = new int[N];\n // X\u5074\u306e\u9802\u70b9\u306fR\u306b\u8fd1\u3044\u9806\u306b\u8ddd\u96e21~X\u3092\u5272\u308a\u5f53\u3066\u308b\n // \u305d\u308c\u305e\u308c\u306e\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\u306b\u306a\u308b\u3088\u3046\u306b\u8fba\u306e\u9577\u3055\u3092\u5272\u308a\u5f53\u3066\u308b\n TmpX = 0;\n SetX(R, -1, -1);\n\n // Y (X+1)\u523b\u307f\u3067\u5272\u308a\u5f53\u3066\u308b\n TmpY = 0;\n SetY(R, -1, -1);\n }\n\n void Write()\n {\n var sb = new StringBuilder();\n for (int i = 0; i < N - 1; i++)\n {\n sb.AppendLine($\"{U[i]} {V[i]} {Len[i]}\");\n }\n\n Console.Write(sb);\n }\n\n public void Solve()\n {\n // \u3042\u308b\u9802\u70b9r\u3092\u5883\u76ee\u306b2\u3064\u306b\u5206\u3051\u308b\n // \u7247\u65b9x\u500b \u3082\u3046\u7247\u65b9 y\u500b x + y + 1 = N\n // \u7247\u65b9\u3067r\u304b\u3089\u306e\u8ddd\u96e2 0~x\u3092\u3064\u304f\u308b\n // \u6b8b\u308a x+1\u523b\u307f\u3067 y\u500b\n // 0 <= p < (x+1)(y+1)\u3067\u304d\u308b\n\n Scan();\n SearchR();\n SetLen();\n Write();\n }\n\n public static void Main(string[] args)\n {\n new Thread(new ThreadStart(new Program().Solve), 1 << 27).Start();\n }\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace F.AlmostAll\n{\n internal static class Program\n {\n public static void Main()\n {\n var adjacencyList = ReadInput();\n \n var solver = new Solver(adjacencyList);\n solver.Solve();\n\n foreach (var edge in solver.Edges)\n Console.WriteLine($\"{edge.From} {edge.To} {edge.Num}\");\n }\n\n private static List[] ReadInput()\n {\n var n = int.Parse(Console.ReadLine());\n var adjacencyList = new List[n];\n for (var i = 0; i < n; i++)\n adjacencyList[i] = new List();\n \n for (var i = 1; i < n; i++)\n {\n var uv = Console.ReadLine().Split();\n var u = int.Parse(uv[0]) - 1;\n var v = int.Parse(uv[1]) - 1;\n \n adjacencyList[u].Add(new Node(v));\n adjacencyList[v].Add(new Node(u));\n }\n\n return adjacencyList;\n }\n }\n\n internal sealed class Solver\n {\n private readonly List[] _adjacencyList;\n private readonly List _resultEdges;\n private readonly int _centroidLimit;\n \n private Node? _centroid;\n\n public Solver(List[] adjacencyList)\n {\n _adjacencyList = adjacencyList;\n _resultEdges = new List(N - 1);\n \n _centroidLimit = N / 2;\n }\n\n public IReadOnlyCollection Edges => _resultEdges;\n\n private int N => _adjacencyList.Length;\n\n private Node Centroid => _centroid.Value;\n \n public void Solve()\n {\n FindCentroidDfs(new Node(0), new Node(-1));\n var (groupA, groupB) = SplitRootChildrenToGroups();\n\n var groupANums = Enumerable.Range(1, groupA.TotalSize);\n FillGroupEdges(groupA.DirectChildren, groupANums);\n \n var groupBNums = Enumerable.Range(1, groupB.TotalSize)\n .Select(it => it * (groupA.TotalSize + 1));\n FillGroupEdges(groupB.DirectChildren, groupBNums);\n }\n\n private int FindCentroidDfs(Node node, Node prev)\n {\n var isCentroid = true;\n \n var subTreeSize = 1;\n foreach (var next in GetAdjacent(node).Where(it => it != prev))\n {\n var nextSubTree = FindCentroidDfs(next, node);\n if (_centroid.HasValue)\n return 0;\n \n isCentroid = isCentroid && nextSubTree <= _centroidLimit;\n subTreeSize += nextSubTree;\n }\n\n if (isCentroid && N - subTreeSize <= _centroidLimit)\n _centroid = node;\n \n return subTreeSize;\n }\n\n private (RootChildGroup, RootChildGroup) SplitRootChildrenToGroups()\n {\n RootChildGroup\n groupA = new RootChildGroup() {DirectChildren = new List()},\n groupB = new RootChildGroup() {DirectChildren = new List()};\n \n var groupLimit = (N + 1) / 3; // ceiling ((N - 1) / 3)\n\n var rootChildren = GetAdjacent(Centroid)\n .Select(it => new {Node = it, Size = GetSubtreeSize(it, Centroid)})\n .OrderBy(it => it.Size);\n \n foreach (var child in rootChildren)\n {\n if (groupA.TotalSize < groupLimit)\n groupA.Add(child.Node, child.Size);\n else\n groupB.Add(child.Node, child.Size);\n }\n\n return (groupA, groupB);\n }\n\n private int GetSubtreeSize(Node node, Node parent)\n {\n return 1 + GetAdjacent(node)\n .Where(it => it != parent)\n .Select(it => GetSubtreeSize(it, node))\n .Sum();\n }\n\n private void FillGroupEdges(List group, IEnumerable nums)\n {\n using (var num = nums.GetEnumerator())\n foreach (var node in group)\n FillGroupEdges(node, Centroid, 0, num);\n }\n\n private void FillGroupEdges(Node node, Node parent, int parentSum, IEnumerator numEnumerator)\n {\n numEnumerator.MoveNext();\n var curSum = numEnumerator.Current;\n _resultEdges.Add(new Edge(node, parent, curSum - parentSum));\n \n foreach (var child in GetAdjacent(node).Where(it => it != parent))\n FillGroupEdges(child, node, curSum, numEnumerator);\n }\n\n private List GetAdjacent(Node node) => _adjacencyList[node.Id];\n\n private struct RootChildGroup\n {\n public List DirectChildren { get; set; }\n public int TotalSize { get; private set; }\n\n public void Add(Node child, int size)\n {\n DirectChildren.Add(child);\n TotalSize += size;\n }\n }\n }\n\n internal struct Node\n {\n public Node(int id) => Id = id;\n public int Id { get; }\n\n public override bool Equals(object obj) => obj is Node node && node.Id == Id;\n public override int GetHashCode() => Id;\n\n public static bool operator==(Node a, Node b) => a.Id == b.Id;\n public static bool operator!=(Node a, Node b) => a.Id != b.Id;\n \n public override string ToString() => (Id + 1).ToString();\n }\n\n internal struct Edge\n {\n public Edge(Node from, Node to, int num)\n {\n From = from;\n To = to;\n Num = num;\n }\n \n public Node From { get; }\n public Node To { get; }\n public int Num { get; }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private List<(int to, int num)>[] E;\n private int[] U, V;\n private int Max;\n\n private int R;\n private bool[] IsX;\n private bool Found;\n private int XSize;\n\n private int[] Len;\n private int[] Dist;\n private int TmpX;\n private int TmpY;\n\n void Scan()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n E = new List<(int to, int num)>[N];\n U = new int[N - 1];\n V = new int[N - 1];\n for (int i = 0; i < N; i++)\n {\n E[i] = new List<(int to, int num)>();\n }\n\n for (int i = 0; i < N - 1; i++)\n {\n int u = sc.NextInt() - 1;\n int v = sc.NextInt() - 1;\n U[i] = u + 1;\n V[i] = v + 1;\n E[u].Add((v, i));\n E[v].Add((u, i));\n }\n\n Max = 2 * N * N / 9;\n }\n\n void SetFlag(int cur, int par)\n {\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n SetFlag(e.to, cur);\n }\n\n IsX[cur] = true;\n }\n\n int Go(int cur, int par)\n {\n var ls = new List<(int to, int size)>();\n int size = 1;\n foreach (var e in E[cur])\n {\n if (e.to == par) continue;\n int tmp = Go(e.to, cur);\n ls.Add((e.to, tmp));\n size += tmp;\n }\n\n\n // if (par != -1)\n // {\n // ls.Add((par, N - size));\n // }\n\n // \u89aa\u5074\u306f\u51e6\u7406\u304c\u96e3\u3057\u3044\u306e\u3067\u98db\u3070\u3059\n // x,y\u9006\u306b\u306a\u3063\u3066\u3082\u3044\u3044\u306e\u3067\u554f\u984c\u306a\u3044\n bool[,] dp = new bool[ls.Count + 1, N];\n dp[0, 0] = true;\n for (int i = 0; i < ls.Count; i++)\n {\n for (int j = 0; j < N; j++)\n {\n if (dp[i, j]) dp[i + 1, j + ls[i].size] = true;\n }\n }\n\n if (!Found)\n {\n int x = -1;\n for (int i = 0; i < N; i++)\n {\n if (!dp[ls.Count, i]) continue;\n int y = N - 1 - i;\n if (Max < (i + 1) * (y + 1))\n {\n x = i;\n break;\n }\n }\n\n if (x != -1)\n {\n XSize = x;\n R = cur;\n for (int i = ls.Count - 1; i >= 0; i--)\n {\n if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])\n {\n SetFlag(ls[i].to, cur);\n x -= ls[i].size;\n }\n }\n\n Found = true;\n }\n }\n\n\n return size;\n }\n\n // r\u3001x,y\u306e\u9802\u70b9\u3092\u6c7a\u3081\u308b\n void SearchR()\n {\n IsX = new bool[N];\n Found = false;\n Go(0, -1);\n }\n\n\n // \u73fe\u5728\u5730\u3001\u89aa\u3001par-cur\u304c\u8fbanum\n void SetX(int cur, int par, int num)\n {\n Dist[cur] = TmpX++;\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (!IsX[e.to]) continue;\n SetX(e.to, cur, e.num);\n }\n }\n\n void SetY(int cur, int par, int num)\n {\n Dist[cur] = TmpY;\n TmpY += (XSize + 1);\n if (par != -1)\n {\n Len[num] = Dist[cur] - Dist[par];\n }\n\n foreach ((int to, int num) e in E[cur])\n {\n if (e.to == par) continue;\n if (IsX[e.to]) continue;\n SetY(e.to, cur, e.num);\n }\n }\n\n void SetLen()\n {\n // \u8fba\u306e\u9577\u3055\n Len = new int[N - 1];\n // R->\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\n Dist = new int[N];\n // X\u5074\u306e\u9802\u70b9\u306fR\u306b\u8fd1\u3044\u9806\u306b\u8ddd\u96e21~X\u3092\u5272\u308a\u5f53\u3066\u308b\n // \u305d\u308c\u305e\u308c\u306e\u9802\u70b9\u307e\u3067\u306e\u8ddd\u96e2\u306b\u306a\u308b\u3088\u3046\u306b\u9802\u70b9\u306e\u9577\u3055\u3092\u5272\u308a\u5f53\u3066\u308b\n TmpX = 0;\n SetX(R, -1, -1);\n\n // Y (X+1)\u523b\u307f\u3067\u5272\u308a\u5f53\u3066\u308b\n TmpY = 0;\n SetY(R, -1, -1);\n }\n\n void Write()\n {\n var sb = new StringBuilder();\n for (int i = 0; i < N - 1; i++)\n {\n sb.AppendLine($\"{U[i]} {V[i]} {Len[i]}\");\n }\n\n Console.Write(sb);\n }\n\n public void Solve()\n {\n // \u3042\u308b\u9802\u70b9r\u3092\u5883\u76ee\u306b2\u3064\u306b\u5206\u3051\u308b\n // \u7247\u65b9x\u500b \u3082\u3046\u7247\u65b9 y\u500b x + y + 1 = N\n // \u7247\u65b9\u3067r\u304b\u3089\u306e\u8ddd\u96e2 0~x\u3092\u3064\u304f\u308b\n // \u6b8b\u308a x+1\u523b\u307f\u3067 y\u500b\n // 0 <= p < (x+1)(y+1)\u3067\u304d\u308b\n\n Scan();\n SearchR();\n SetLen();\n Write();\n }\n\n public static void Main(string[] args)\n {\n new Thread(new ThreadStart(new Program().Solve), 1 << 27).Start();\n }\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace F.AlmostAll\n{\n internal static class Program\n {\n public static void Main()\n {\n var adjacencyList = ReadInput();\n \n var solver = new Solver(adjacencyList);\n solver.Solve();\n\n foreach (var edge in solver.Edges)\n Console.WriteLine($\"{edge.From} {edge.To} {edge.Num}\");\n }\n\n private static List[] ReadInput()\n {\n var n = int.Parse(Console.ReadLine());\n var adjacencyList = new List[n];\n for (var i = 0; i < n; i++)\n adjacencyList[i] = new List();\n \n for (var i = 1; i < n; i++)\n {\n var uv = Console.ReadLine().Split();\n var u = int.Parse(uv[0]) - 1;\n var v = int.Parse(uv[1]) - 1;\n \n adjacencyList[u].Add(new Node(v));\n adjacencyList[v].Add(new Node(u));\n }\n\n return adjacencyList;\n }\n }\n\n internal sealed class Solver\n {\n private readonly List[] _adjacencyList;\n private readonly List _resultEdges;\n private readonly int _centroidLimit;\n \n private Node? _centroid;\n\n public Solver(List[] adjacencyList)\n {\n _adjacencyList = adjacencyList;\n _resultEdges = new List(N - 1);\n \n _centroidLimit = N / 2;\n }\n\n public IReadOnlyCollection Edges => _resultEdges;\n\n private int N => _adjacencyList.Length;\n\n private Node Centroid => _centroid.Value;\n \n public void Solve()\n {\n FindCentroidDfs(new Node(0), new Node(-1));\n var (groupA, groupB) = SplitRootChildrenToGroups();\n\n var groupANums = Enumerable.Range(1, groupA.TotalSize);\n FillGroupEdges(groupA.DirectChildren, groupANums);\n \n var groupBNums = Enumerable.Range(1, groupB.TotalSize)\n .Select(it => it * (groupA.TotalSize + 1));\n FillGroupEdges(groupB.DirectChildren, groupBNums);\n }\n\n private int FindCentroidDfs(Node node, Node prev)\n {\n var isCentroid = true;\n \n var subTreeSize = 1;\n foreach (var next in GetAdjacent(node).Where(it => it != prev))\n {\n var nextSubTree = FindCentroidDfs(next, node);\n if (_centroid.HasValue)\n return 0;\n \n isCentroid = isCentroid && nextSubTree <= _centroidLimit;\n subTreeSize += nextSubTree;\n }\n\n if (isCentroid && N - subTreeSize <= _centroidLimit)\n _centroid = node;\n \n return subTreeSize;\n }\n\n private (RootChildGroup, RootChildGroup) SplitRootChildrenToGroups()\n {\n RootChildGroup\n groupA = new RootChildGroup() {DirectChildren = new List()},\n groupB = new RootChildGroup() {DirectChildren = new List()};\n \n var groupLimit = (N + 1) / 3; // ceiling ((N - 1) / 3)\n\n var rootChildren = GetAdjacent(Centroid)\n .Select(it => new {Node = it, Size = GetSubtreeSize(it, Centroid)})\n .OrderBy(it => it.Size);\n \n foreach (var child in rootChildren)\n {\n if (groupA.TotalSize < groupLimit)\n groupA.Add(child.Node, child.Size);\n else\n groupB.Add(child.Node, child.Size);\n }\n\n return (groupA, groupB);\n }\n\n private int GetSubtreeSize(Node node, Node parent)\n {\n return 1 + GetAdjacent(node)\n .Where(it => it != parent)\n .Select(it => GetSubtreeSize(it, node))\n .Sum();\n }\n\n private void FillGroupEdges(List group, IEnumerable nums)\n {\n using (var num = nums.GetEnumerator())\n foreach (var node in group)\n FillGroupEdges(node, Centroid, num);\n }\n\n private void FillGroupEdges(Node node, Node parent, IEnumerator numEnumerator)\n {\n numEnumerator.MoveNext();\n _resultEdges.Add(new Edge(node, parent, numEnumerator.Current));\n \n foreach (var child in GetAdjacent(node).Where(it => it != parent))\n FillGroupEdges(child, node, numEnumerator);\n }\n\n private List GetAdjacent(Node node) => _adjacencyList[node.Id];\n\n private struct RootChildGroup\n {\n public List DirectChildren { get; set; }\n public int TotalSize { get; private set; }\n\n public void Add(Node child, int size)\n {\n DirectChildren.Add(child);\n TotalSize += size;\n }\n }\n }\n\n internal struct Node\n {\n public Node(int id) => Id = id;\n public int Id { get; }\n\n public override bool Equals(object obj) => obj is Node node && node.Id == Id;\n public override int GetHashCode() => Id;\n\n public static bool operator==(Node a, Node b) => a.Id == b.Id;\n public static bool operator!=(Node a, Node b) => a.Id != b.Id;\n \n public override string ToString() => (Id + 1).ToString();\n }\n\n internal struct Edge\n {\n public Edge(Node from, Node to, int num)\n {\n From = from;\n To = to;\n Num = num;\n }\n \n public Node From { get; }\n public Node To { get; }\n public int Num { get; }\n }\n}"}], "src_uid": "87d755df6ee27b381122062659c4a432"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskA\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n int n, m;\n n = int.Parse(spl[0]);\n m = int.Parse(spl[1]);\n\n long res = pow(3,n,m);\n \n res = (res - (long)1+(long)m) % m;\n\n Console.WriteLine(res);\n\n }\n\n private static long pow(int p, int n, int m)\n {\n long res = 0;\n if (n == 0) return 1;\n\n if ((n % 2) == 0)\n {\n res = pow(p, n / 2, m);\n res = res * res;\n res %= m;\n\n }\n else\n {\n res = pow(p, n - 1, m);\n res = res * p;\n return res;\n }\n res %= m;\n return res;\n }\n\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace VKD\n{\n class Program\n {\n static int m = 10;\n\n static long Pow(long a, int p)\n {\n if (p == 0)\n {\n return 1 % m;\n }\n\n if (p % 2 == 1)\n {\n return ((a % m) * Pow(a, p - 1) % m) % m;\n }\n else\n {\n var t = Pow(a, p / 2) % m;\n return (t * t) % m;\n }\n\n }\n static void Main(string[] args)\n {\n var inp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = inp[0];\n m = inp[1];\n\n long ans = 0;\n ans = (Pow(3, n) - 1 % m + m) % m;\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace C24_09_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Regex.Split(Console.ReadLine(), \" \");\n Int64 n = Int64.Parse(s[0]);\n Int64 m = Int64.Parse(s[1]);\n Int64 k = 1;\n Int64 t = 3;\n while (n > 0)\n {\n if( n%2==1) k *= t;\n n /= 2;\n t *= t;\n k %= m;\n t %= m;\n }\n //if (m == 1)\n // k = 0;\n //else\n if (k == 0) k = m - 1;\n else k--;\n Console.WriteLine(\"{0}\", k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Numerics;\n\npublic class CF_227C\n{\n public CF_227C()\n {\n }\n\n public long solve(int n, int m)\n {\n\t\tlong[] powersof3 = new long[32];\n\t\tpowersof3[0] = 3 % m;\n\t\tfor (int i = 1; i < 32; i++)\n {\n\t\t\tpowersof3[i] = (powersof3[i - 1] * powersof3[i - 1]) % m;\n\t\t}\n\n long answer = 1;\n for (int i = 0; i < 32; i++)\n {\n if ((n & (1 << i)) != 0)\n {\n answer *= powersof3[i];\n answer %= m;\n }\n }\n answer = (answer == 0 ? m - 1 : answer - 1);\n return answer;\n\t}\n\n public static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int n = Convert.ToInt32(lines[0]);\n int m = Convert.ToInt32(lines[1]);\n Console.WriteLine(new CF_227C().solve(n, m));\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Flying_Saucer_Segments\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static int mod;\n\n private static long Pow(long a, int k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a)%mod;\n }\n a = (a*a)%mod;\n k >>= 1;\n }\n return r;\n }\n\n private static void Main(string[] args)\n {\n int n = Next();\n mod = Next();\n\n long res = Pow(3, n) - 1;\n if (res < 0)\n res += mod;\n\n writer.WriteLine(res);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static Int64 powermod(Int64 b, Int64 n, Int64 m)\n {\n Int64 result = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return result;\n \n //return (result - 1) % m;\n }\n\n static void Main(string[] args)\n {\n Int64 n, m;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt64(inp[0]);\n m = Convert.ToInt64(inp[1]);\n\n Int64 r = powermod(3, n, m);\n r = r == 0 ? m - 1 : r-1;\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static Int64 powermod(Int64 b, Int64 n, Int64 m)\n {\n Int64 result = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return (m+result-1)%m;\n }\n\n static void Main(string[] args)\n {\n Int64 n, m;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt64(inp[0]);\n m = Convert.ToInt64(inp[1]);\n Console.WriteLine(powermod(3, n, m));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program_R158_Div2_255A\n {\n static void Main(string[] args)\n {\n string[] s = (Console.ReadLine().Split());\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n long num = GetBigPowerMod(3, n, m); \n num--;\n if (num < 0) num = m - 1;\n Console.WriteLine(num); \n }\n\n static long GetBigPowerMod(long b, int n, int m)\n {\n //num will be b^n mod m; for n, m up to 1e10\n //long num = 1\n //for (int i = 0; i < n; i++)\n // num = (num * b) % m;\n\n long num = 1;\n while (n > 0)\n {\n if (n % 2 == 1)\n num = (num * b) % m;\n b = (b * b) % m;\n n /= 2;\n //Console.WriteLine(\"{0} {1} {2}\", num, b, n);\n }\n return num;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\n\tclass A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), m = NextInt();\n\t\t\tOut.WriteLine( ( pow( 3, n, m ) - 1 + m ) % m );\n\t\t}\n\n\t\tint pow( int a, int b, int m )\n\t\t{\n\t\t\tif ( b == 0 ) return 1 % m;\n\t\t\tint r = pow( a, b / 2, m );\n\t\t\tr = (int)( ( (long)r * r ) % m );\n\t\t\tif ( b % 2 == 1 )\n\t\t\t{\n\t\t\t\tr = (int)( ( (long)r * a ) % m );\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class C\n {\n private static ThreadStart s_threadStart = new C().Go;\n private static bool s_time = false;\n\n private long Power(long a, long b, long m)\n {\n if (b == 0) return 1;\n a %= m;\n if (b % 2 == 0)\n {\n return Power((a * a) % m, b / 2, m) % m;\n }\n else if (b % 2 == 1)\n {\n return (a * Power((a * a) % m, b / 2, m)) % m;\n }\n return 0;\n } \n\n private void Go()\n {\n long n = GetInt();\n long m = GetInt();\n\n long res = Power(3, n, m)-1;\n if (res == -1) res = m - 1;\n Wl(res);\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>, IComparable\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n\n #region IComparable Members\n\n public int CompareTo(object obj)\n {\n if (obj is Tuple)\n return CompareTo((Tuple)obj);\n return CompareTo(null);\n }\n\n #endregion\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Temp\n{\n internal struct PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n : this()\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal struct LineInt\n {\n public LineInt(PointInt a, PointInt b)\n : this()\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0);\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static class Permutations\n {\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n Random random = new Random();\n for (int i = n - 1; i > 0; i--)\n {\n int j = random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n }\n\n public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = Permutations.GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.GetIdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n internal static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3)\n {\n int[] numbers = new int[3];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadInt(out int int1, out int int2, out int int3, out int int4)\n {\n int[] numbers = new int[4];\n ReadInt(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadLong(out long a)\n {\n long[] number = new long[1];\n ReadLong(number);\n a = number[0];\n }\n\n public static void ReadLong(out long a, out long b)\n {\n long[] numbers = new long[2];\n ReadLong(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3)\n {\n long[] numbers = new long[3];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static void ReadLong(out long int1, out long int2, out long int3, out long int4)\n {\n long[] numbers = new long[4];\n ReadLong(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n int4 = numbers[3];\n }\n\n public static void ReadInt(int[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static void ReadLong(long[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = long.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(double[] numbers)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = double.Parse(list[i]);\n }\n }\n\n public static void ReadDouble(out double a, out double b)\n {\n double[] numbers = new double[2];\n ReadDouble(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadDouble(out double int1, out double int2, out double int3)\n {\n double[] numbers = new double[3];\n ReadDouble(numbers);\n int1 = numbers[0];\n int2 = numbers[1];\n int3 = numbers[2];\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n internal static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private Func m_Operation;\n\n private T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private int m_Size;\n\n private long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n internal class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //OpenFiles();\n\n new Solution().Solve();\n\n //CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n int n, m;\n Reader.ReadInt(out n, out m);\n\n var a = new MatrixInt(new long[,] { { 1, 0 }, { 1, 3 } }, m);\n\n var res = Algebra.MatrixBinPower(a, n);\n\n Console.WriteLine((2 * res[1, 0]) % m);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\n\tclass A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), m = NextInt();\n\t\t\tOut.WriteLine( ( pow( 3, n, m ) - 1 + m ) % m );\n\t\t}\n\n\t\tint pow( int a, int b, int m )\n\t\t{\n\t\t\tif ( b == 1 ) return 1 % m;\n\t\t\tint r = pow( a, b / 2, m );\n\t\t\tr = (int)( ( (long)r * r ) % m );\n\t\t\tif ( b % 2 == 1 )\n\t\t\t{\n\t\t\t\tr = (int)( ( (long)r * a ) % m );\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\npublic class taskA\n{\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] spl = inp.Split(' ');\n int n, m;\n n = int.Parse(spl[0]);\n m = int.Parse(spl[1]);\n\n long res = 1;\n while (n > 0)\n {\n if ((n % 2) == 0)\n {\n res *= res;\n n /= 2;\n }\n else\n {\n res *= 3;\n n--;\n }\n res = res % m;\n }\n res = (res - (long)1+(long)m) % m;\n Console.WriteLine(res);\n\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace C24_09_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Regex.Split(Console.ReadLine(), \" \");\n Int64 n = Int64.Parse(s[0]);\n Int64 m = Int64.Parse(s[1]);\n Int64 k = 1;\n Int64 t = 3;\n while (n > 0)\n {\n if( n%2==1) k *= t;\n n /= 2;\n t *= t;\n k %= m;\n t %= m;\n }\n if (m == 1)\n k = 0;\n else\n if (k == 0) k = m - 1;\n else k--;\n Console.WriteLine(\"{0}\", 2%1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace C24_09_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Regex.Split(Console.ReadLine(), \" \");\n Int64 n = Int64.Parse(s[0]);\n Int64 m = Int64.Parse(s[1]);\n Int64 k = 1;\n Int64 t = 3;\n while (n > 0)\n {\n if( n%2==1) k *= t;\n n /= 2;\n t *= t;\n k %= m;\n }\n if (k == 0) k = m - 1;\n else k--;\n Console.WriteLine(\"{0}\", k);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static int powermod(int b, int n, int m)\n {\n\n int result = 1;\n while (n > 0)\n {\n if ((n % 2) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return (result - 1) % m;\n }\n static void Main(string[] args)\n {\n int n, m, r = 1;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt32(inp[0]);\n m = Convert.ToInt32(inp[1]);\n\n Console.WriteLine(powermod(3, n, m));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static int powermod(int b, int n, int m)\n {\n Int64 result = 1;\n while (n > 0)\n {\n if ((n % 2) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return (int)(result - 1) % m;\n }\n\n static void Main(string[] args)\n {\n int n, m;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt32(inp[0]);\n m = Convert.ToInt32(inp[1]);\n\n Console.WriteLine(powermod(3, n, m));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static Int64 powermod(Int64 b, Int64 n, Int64 m)\n {\n Int64 result = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return (result - 1) % m;\n }\n\n static void Main(string[] args)\n {\n Int64 n, m;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt64(inp[0]);\n m = Convert.ToInt64(inp[1]);\n\n Console.WriteLine(powermod(3, n, m));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static Int64 powermod(Int64 b, Int64 n, Int64 m)\n {\n Int64 result = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n result = (result * b) % m;\n }\n b = (b * b) % m;\n n = n / 2;\n }\n return (result - 1) % m;\n }\n\n static void Main(string[] args)\n {\n Int64 n, m;\n string[] inp = Console.ReadLine().ToString().Split(' ');\n n = Convert.ToInt32(inp[0]);\n m = Convert.ToInt32(inp[1]);\n\n Console.WriteLine(powermod(3, n, m));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Numerics;\n\npublic class CF_227C\n{\n public CF_227C()\n {\n }\n\n public long solve(int n, int m)\n {\n\t\tlong[] powersof3 = new long[32];\n\t\tpowersof3[0] = 3 % m;\n\t\tfor (int i = 1; i < 32; i++)\n {\n\t\t\tpowersof3[i] = (powersof3[i - 1] * powersof3[i - 1]) % m;\n powersof3[i] = (powersof3[i] == 0 ? 1 : powersof3[i]);\n\t\t}\n\n long answer = 1;\n for (int i = 0; i < 32; i++)\n {\n if ((n & (1 << i)) != 0)\n {\n answer *= powersof3[i];\n answer %= m;\n }\n }\n answer = (answer == 0 ? m - 1 : answer - 1);\n return answer;\n\t}\n\n public static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int n = Convert.ToInt32(lines[0]);\n int m = Convert.ToInt32(lines[1]);\n Console.WriteLine(new CF_227C().solve(n, m));\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Numerics;\n\npublic class CF_227C\n{\n public CF_227C()\n {\n }\n\n public long solve(int n, int m)\n {\n\t\tlong[] powersof3 = new long[32];\n\t\tpowersof3[0] = 3 % m;\n\t\tfor (int i = 1; i < 32; i++)\n\t\t{\n\t\t\tpowersof3[i] = (powersof3[i - 1] * powersof3[i - 1]) % m;\n\t\t}\n\n long answer = 1;\n for (int i = 0; i < 32; i++)\n {\n if ((n & (1 << i)) != 0)\n {\n answer *= powersof3[i];\n answer %= m;\n }\n }\n return answer - 1;\n\t}\n\n public static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int n = Convert.ToInt32(lines[0]);\n int m = Convert.ToInt32(lines[1]);\n Console.WriteLine(new CF_227C().solve(n, m));\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass CF_227C\n{\n public long solve(long n, long m)\n {\n long[] powerof3 = new long[32];\n long k = 1;\n long power = 3 % m;\n for (int i = 0; i < 32; i++)\n {\n k = (k * power) % m;\n powerof3[i] = k; \n }\n\n k = 1;\n for (int i = 0; i < 32; i++)\n {\n if ((n & (1 << i)) != 0)\n {\n k *= powerof3[i]; k %= m;\n }\n }\n return k - 1;\n }\n\n public static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n long n = Convert.ToInt64(lines[0]);\n long m = Convert.ToInt64(lines[1]);\n Console.WriteLine(new CF_227C().solve(n, m));\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_227C\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(2, new CF_227C().solve(1, 10));\n }\n\n [TestMethod]\n public void Test2()\n {\n Assert.AreEqual(2, new CF_227C().solve(3, 8));\n }\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(690359500, new CF_227C().solve(331358794, 820674098));\n }\n }\n}\n#endif\n"}], "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static int CAP = 1 << 12;\n\n static void Main(string[] args)\n {\n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n int n = input.NextInt();\n int t = input.NextInt();\n int[,] a = new int[n, n];\n a[0, 0] = CAP * t;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j <= i; j++)\n {\n Fill(i, j, n, a);\n }\n }\n int sum = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (a[i, j] >= CAP)\n {\n sum++;\n }\n }\n }\n writer.WriteLine(sum);\n\n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Close();\n reader.Close();\n }\n\n static void Fill(int x, int y, int n, int[,] a)\n {\n if (x + 1 >= n)\n {\n return;\n }\n if (a[x, y] > CAP)\n {\n int f = a[x, y] - CAP;\n a[x + 1, y] += f / 2;\n a[x + 1, y + 1] += f / 2;\n }\n }\n }\n\n class MyPair\n {\n public int x, y;\n\n public MyPair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override string ToString()\n {\n return \"[\" + x + \", \" + y + \"]\";\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace PyramidOfGlasses\n{\n partial class PyramidOfGlasses\n {\n static void Main(string[] args)\n {\n int n, t, answer = 0; ;\n double rem;\n\n n = NextInt();\n t = NextInt();\n\n double[][] tree = new double[11][];\n\n for (int i = 0; i < 11; i++)\n tree[i] = new double[i + 1];\n\n while (t > 0)\n {\n tree[0][0] += 1.0;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < tree[i].Length; j++)\n {\n rem = tree[i][j] - 1.0;\n\n if (tree[i][j] > 1.0)\n {\n tree[i][j] = 1.0;\n tree[i + 1][j] += (rem / 2);\n tree[i + 1][j + 1] += (rem / 2);\n } \n }\n }\n\n t--;\n }\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j < tree[i].Length; j++)\n if (tree[i][j] == 1.0)\n answer++;\n\n Console.WriteLine(answer);\n }\n }\n\n partial class PyramidOfGlasses\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private int result = 0;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/contest//problem/B\n\n var input = _reader.ReadIntArray();\n int height = input[0];\n int time = input[1];\n var glasses = new double[Enumerable.Range(1, height).Sum()];\n\n for (; time > 0; time --)\n {\n var fillResult = FillGlasses(glasses, 0, 0);\n if (!fillResult) break;\n }\n\n result = glasses.Count(x => x >= 1);\n\n return this;\n }\n\n private bool FillGlasses(double[] glasses, int index, int level)\n {\n if (glasses.Length > index)\n {\n if (glasses[index] < 1.0)\n {\n glasses[index] += 1.0/Math.Pow(2, level);\n return true;\n }\n\n var r1 = FillGlasses(glasses, index + level + 1, level + 1);\n var r2 = FillGlasses(glasses, index + level + 2, level + 1);\n\n return r1 || r2;\n }\n\n return false;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString();\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nusing Number = System.Int64;\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var m = sc.Integer();\n var a = Enumerate(n + 1, x => new double[n + 1]);\n for (int _ = 0; _ < m; _++)\n {\n a[0][0] += 1;\n for (int i = 0; i < n; i++)\n for (int j = 0; j <= i; j++)\n {\n if (a[i][j] + 1e-12 >= 1.0)\n {\n var rem = a[i][j] - 1;\n a[i][j] = 1;\n rem /= 2;\n a[i + 1][j] += rem;\n a[i + 1][j + 1] += rem;\n }\n }\n }\n var cnt = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j <= i; j++)\n if (a[i][j] + 1e-12 >= 1) cnt++;\n IO.Printer.Out.WriteLine(cnt);\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "using System;\n\nnamespace Project\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] stringValue;\n Int32 n, nn, nnn, t, i, ii, iii, value;\n Glass[] glasses;\n stringValue = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(stringValue[0]);\n t = Convert.ToInt32(stringValue[1]);\n for (i = n, nn = 0; i > 0; i--)\n nn += i;\n glasses = new Glass[nn];\n for (i = 0; i < nn; i++)\n glasses[i] = new Glass();\n for (i = 0, ii = 0, iii = 1, nnn = 0; i < n - 1; i++)\n {\n nnn += i + 1;\n while (ii < nnn)\n {\n glasses[ii].Left = iii;\n glasses[ii].Right = ++iii;\n ii++;\n }\n iii++;\n }\n n = 2 << n;\n nnn = 0;\n glasses[0].Value = n * t;\n for (i = 0; i < nn; i++)\n if ((glasses[i].Value -= n) >= 0)\n {\n if (glasses[i].Right > 0 && glasses[i].Left > 0)\n {\n glasses[i].Value /= 2;\n glasses[glasses[i].Right].Value += glasses[i].Value;\n glasses[glasses[i].Left].Value += glasses[i].Value;\n }\n nnn++;\n }\n Console.WriteLine(nnn);\n }\n\n public class Glass\n {\n private Int32 right, left, value;\n public Int32 Right { get { return right; } set { right = value; } }\n public Int32 Left { get { return left; } set { left = value; } }\n public Int32 Value { get { return value; } set { this.value = value; } }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Policy;\nusing System.Text;\n\nnamespace _\n{\n partial class Program\n {\n static partial void Test();\n\n private static void Main(string[] args)\n {\n Test();\n\n using (var cin = new Cin())\n using (var cout = new Cout())\n {\n var n = cin.ReadInt();\n var t = cin.ReadInt();\n\n var result = Solve(n, t);\n\n cout.Write(result);\n }\n }\n\n private static int Solve(int n, int t)\n {\n if (t <= 1) return t;\n\n int c = 1;\n var v = new decimal[n];\n v[0] = t;\n for(int i=1; i= 0 ? a/2 : 0;\n p += a;\n c += p >= 1 ? 1 : 0;\n v[j] = p;\n p = a;\n }\n }\n\n return c;\n }\n }\n\n #region Boilerplate\n internal class Cin : StreamReader\n {\n public Cin() : this(Console.OpenStandardInput(65536)) {}\n public Cin(Stream stream) : base(stream, Encoding.ASCII, false){}\n public int ReadInt(){return (int) ReadLong();}\n public long ReadLong()\n {\n int c; do { c = Read(); } while (c == ' ' || c == '\\t' || c == '\\r' || c == '\\n');\n int sign = 1; if (c == '-'){ sign = -1; c = Read(); }\n long n = 0; while (c >= '0' && c <= '9'){ n = n * 10 + c - '0'; c = Read(); }\n return n*sign;\n }\n public int[] ReadIntList()\n {\n var n = ReadInt();\n var a = new int[n];\n for (int i = 0; i < n; i++) a[i] = ReadInt();\n return a;\n }\n }\n\n internal class Cout : StreamWriter\n {\n public Cout() : base(Console.OpenStandardOutput(65536), Encoding.ASCII){}\n }\n\n internal static class Ext\n {\n public static void WriteList(this TextWriter sw, IEnumerable src)\n {\n using (var en = src.GetEnumerator())\n if (en.MoveNext()) { sw.Write(\"{0}\", en.Current);\n while (en.MoveNext()) sw.Write(\" {0}\", en.Current); }\n sw.WriteLine();\n }\n }\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Beresta\n{\n\n\tclass ContestIO : StreamWriter\n\t{\n\t\tpublic ContestIO(Stream streamIn, Stream streamOut) : base(streamOut, Encoding.ASCII, 8192) { Reader = new StreamReader(streamIn, Encoding.ASCII, false, 8192); }\n\t\tpublic ContestIO(string inputFilePath, string outputFilePath) : this(File.OpenRead(inputFilePath), File.OpenWrite(outputFilePath)) { }\n\t\tpublic ContestIO(string inputText) : this(new MemoryStream(Encoding.ASCII.GetBytes(inputText)), Console.OpenStandardOutput(8192)) { }\n\t\tpublic ContestIO() : this(Console.OpenStandardInput(8192), Console.OpenStandardOutput(8192)) { }\n\t\t//d.ToString(\"N12\", CultureInfo.InvariantCulture).Replace(\",\", \"\")\n\t\tpublic StreamReader Reader;\n\t\t\n\t\tbool IsDigit(int c) { return c >= '0' && c <= '9'; }\n\t\tpublic long Read()\n\t\t{\n\t\t\tint c1 = 0, c;\n\t\t\twhile (!IsDigit(c = Reader.Read())) { c1 = c; }\n\t\t\tlong r = c - '0';\n\t\t\twhile (IsDigit(c = Reader.Read()))\n\t\t\t\tr = r * 10 + c - '0';\n\t\t\treturn c1 == '-' ? -r : r;\n\t\t}\n\t\tpublic long[] ReadArray(int size) { return Enumerable.Range(0, size).Select(v => Read()).ToArray(); }\n\t}\n\n\tclass Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var io = new ContestIO())\n\t\t\t{\n\t\t\t\tvar n = io.Read();\n\t\t\t\tvar t = io.Read();\n\n\t\t\t\tif(t == 0) {\n\t\t\t\t\tio.WriteLine(0);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(n == 1) {\n\t\t\t\t\t\tio.WriteLine(1);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar arr = new long[n, n];\n\t\t\t\t\t\t//for (var i = 0; i < n; i++)\n\t\t\t\t\t\t//{\n\t\t\t\t\t\t// for (var j = 0; j <= i; j++)\n\t\t\t\t\t\t// {\n\t\t\t\t\t\t// arr[i, j] = 1024;\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t//}\n\n\t\t\t\t\t\tvar val = 2048;\n\n\t\t\t\t\t\tarr[0, 0] = t * val;\n\t\t\t\t\t\tvar count = 0L;\n\t\t\t\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor (var j = 0; j <= i; j++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (arr[i, j] > val)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar delta = arr[i, j] - val;\n\t\t\t\t\t\t\t\t\tarr[i, j] = val;\n\t\t\t\t\t\t\t\t\tif (i < (n - 1))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tarr[i + 1, j] += delta / 2;\n\t\t\t\t\t\t\t\t\t\tarr[i + 1, j + 1] += delta / 2;\n\t\t\t\t\t\t\t\t\t\tif (val % 2 > 0)\n\t\t\t\t\t\t\t\t\t\t\tthrow new Exception();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (arr[i, j] == val)\n\t\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tio.WriteLine(count);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//var s = 1L;\n\t\t\t\t//var count = 0L;\n\t\t\t\t//while (t > 0)\n\t\t\t\t//{\n\t\t\t\t// t -= s;\n\t\t\t\t// if (t >= 0)\n\t\t\t\t// {\n\t\t\t\t// count += s;\n\t\t\t\t// s++;\n\t\t\t\t// }\n\t\t\t\t//}\n\n\t\t\t\t//io.WriteLine(count);\n\t\t\t}\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t}\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Pyramid_of_Glasses\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int t = Next();\n\n const int m = 1024;\n\n var nn = new int[n + 1,n + 1];\n\n nn[0, 0] = t*m;\n\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i + j >= n)\n break;\n\n if (nn[i, j] >= m)\n {\n count++;\n int d = (nn[i, j] - m)/2;\n nn[i + 1, j] += d;\n nn[i, j + 1] += d;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n private double[,]matrix;\n private const int max = 200;\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var t = input[1];\n matrix = new double[max, max];\n var maximum = n*(n + 1)/2;\n var result = 0;\n for (var i = 0; i < t; i++)\n {\n Solution(n, 0, 100, 100.0);\n result = 0;\n for (var k = 0; k < n; k++)\n {\n for (var j = 0; j < max; j++)\n {\n if (matrix[k, j] >= 100.0)\n {\n result++;\n }\n }\n }\n if (result >= maximum)\n {\n result = maximum;\n break;\n }\n }\n\n sw.WriteLine(result);\n }\n\n private void Solution(int n, int i, int j, double count)\n {\n if(i < 0 || i >= n)\n return;\n if(j >= max || j < 0)\n return;\n matrix[i, j] += count;\n if (matrix[i, j] > 100.0)\n {\n var diff = matrix[i, j] - 100.0;\n matrix[i, j] = 100.0;\n Solution(n, i + 1, j - 1, diff / 2.0);\n Solution(n, i + 1, j + 1, diff / 2.0);\n }\n\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace AlgoTraining.Codeforces.B_s\n{\n public class FastScanner : StreamReader\n {\n private string[] _line;\n private int _iterator;\n\n public FastScanner(Stream stream) : base(stream)\n {\n _line = null;\n _iterator = 0;\n }\n public int NextInt()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt32(_line[_iterator++]);\n }\n public long NextLong()\n {\n if (_line == null || _iterator >= _line.Length)\n {\n _line = base.ReadLine().Split(' ');\n _iterator = 0;\n }\n if (_line.Count() == 0) throw new IndexOutOfRangeException(\"Input string is empty\");\n return Convert.ToInt64(_line[_iterator++]);\n }\n }\n class Pyramid\n {\n public static void Main(string[] args)\n {\n using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))\n using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))\n {\n int n = fs.NextInt(), k = fs.NextInt();\n double[] a = new double[n * n];\n while (k > 0)\n {\n Fill(0, 1, a, 1, n);\n k--;\n }\n int count = 0;\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] >= 1.0) count++;\n }\n writer.WriteLine(count);\n }\n }\n public static void Fill(int i, double val, double[] a, int level, int n)\n {\n a[i] += val;\n if (a[i] > 1)\n {\n double ex = a[i] - 1;\n a[i] = 1;\n if (level < n)\n {\n Fill(i + level, ex / 2, a, level + 1, n);\n Fill(i + level + 1, ex / 2, a, level + 1, n);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFCF_354_DIV_2_B\n{\n class Program\n {\n public class Node\n {\n public Node Left { get; set; }\n public Node Right { get; set; }\n public double Volume { get; set; }\n\n public void AddVolume(double val)\n {\n if (Volume == 1)\n {\n if (Left != null && Right != null)\n {\n Left.AddVolume(val/2);\n Right.AddVolume(val/2);\n }\n }\n else if(Volume + val > 1)\n {\n var diff = (Volume + val - 1);\n Left.AddVolume(diff / 2);\n Right.AddVolume(diff / 2);\n Volume = 1;\n }\n else\n {\n Volume += val;\n }\n }\n }\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var inputParts = input.Split(' ');\n var n = Convert.ToInt32(inputParts[0]);\n var t = Convert.ToInt32(inputParts[1]);\n\n \n\n if (n == 0 || t == 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n List nodes = new List();\n for (int i = 1; i <= n*n; i++)\n {\n nodes.Add(new Node());\n }\n\n //nodes[0].Left = nodes[1];\n //nodes[0].Right = nodes[2];\n int currentNode = 0;\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < i; j++)\n {\n nodes[currentNode].Left = nodes[currentNode + i];\n nodes[currentNode].Right = nodes[currentNode + i + 1];\n\n currentNode++;\n }\n }\n\n for (int i = 0; i < t; i++)\n {\n nodes[0].AddVolume(1);\n }\n\n int full = nodes.Where(node => node.Volume == 1).Count();\n\n Console.WriteLine(full);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int t = ReadInt();\n var a = new int[n, n];\n int m = 1 << n - 1;\n\n while (t-- > 0)\n {\n a[0, 0] += m;\n for (int i = 0; i + 1 < n; i++)\n for (int j = 0; j <= i; j++)\n {\n int v = Math.Max(0, a[i, j] - m);\n a[i, j] -= v;\n a[i + 1, j] += v / 2;\n a[i + 1, j + 1] += v / 2;\n }\n }\n\n int ans = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (a[i, j] >= m)\n ans++;\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\t\tint n = nums [0];\n\t\t\tint t = nums [1];\n\t\t\tdouble[,] triangle = new double[n, n];\n\t\t\tfor (int k = 0; k < t; k++) {\n\t\t\t\ttriangle [0, 0] += 1;\n\t\t\t\tfor (int col = 0; col < n - 1; col++) {\n\t\t\t\t\tfor (int row = 0; row <= col; row++) {\n\t\t\t\t\t\tif (triangle [col, row] > 1) {\n\t\t\t\t\t\t\tdouble diff = triangle [col, row] - 1;\n\t\t\t\t\t\t\ttriangle [col, row] = 1;\n\t\t\t\t\t\t\ttriangle [col + 1, row] += diff / 2;\n\t\t\t\t\t\t\ttriangle [col + 1, row + 1] += diff / 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\tif (triangle [i, j] >= 1)\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (count);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n#if !ONLINE_JUDGE\n\t\tstatic Queue testInput = new Queue(new List()\n\t\t{\n\t\t\t\"10 10000\",\n\t\t});\n#endif\n\n\t\tpublic static long c(long N, long K, Func rec)\n\t\t{\n\t\t\tlong r = 1;\n\t\t\tlong d;\n\t\t\tif (K > N) return 0;\n\t\t\tfor (d = 1; d <= K; d++)\n\t\t\t{\n\t\t\t\tr *= N--;\n\t\t\t\tr /= d;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\tstatic string Solve()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tlong n, t;\n\t\t\t\tread(out n, out t);\n\n\t\t\t\tdouble[][] s = new double[n][];\n\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t{\n\t\t\t\t\ts[i] = new double[i + 1];\n\t\t\t\t\t//s[i][0] = (1L << (i + 1)) - 1;\n\t\t\t\t\t//s[i][i] = (1L << (i + 1)) - 1;\n\t\t\t\t\t//for (int j = 1; j < i; j++)\n\t\t\t\t\t//{\n\t\t\t\t\t//\tdouble o = 1.0 / (1 << (i - 1));\n\t\t\t\t\t//\tdouble fa = c(i - 1, j - 1) * o;\n\t\t\t\t\t//\tdouble fb = c(i - 1, j) * o;\n\t\t\t\t\t//\ts[i][j] = (long)Math.Round((s[i - 1][j - 1] * fa + s[i - 1][j] * fb + 2) / (fa + fb));\n\t\t\t\t\t//}\n\t\t\t\t}\n\n\t\t\t\tvar a = DP(c);\n\n\t\t\t\tfor (int tt = 0; tt < t; tt++)\n\t\t\t\t{\n\t\t\t\t\ts[0][0] += 1.0;\n\t\t\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (int j = 0; j <= i; j++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdouble diff = s[i][j] - 1;\n\t\t\t\t\t\t\tif (diff > 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ts[i][j] = 1;\n\t\t\t\t\t\t\t\tif (i + 1 == n) continue;\n\t\t\t\t\t\t\t\ts[i + 1][j] += diff / 2;\n\t\t\t\t\t\t\t\ts[i + 1][j + 1] += diff / 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn s.SelectMany(x => x).Count(x => x == 1).ToString();\n\n\n\t\t\t}\n\t\t}\n\n\t\t// Everything after this comment is template code\n\n\t\tstatic void Main(string[] args)\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar sw = new System.Diagnostics.Stopwatch();\n\t\t\tsw.Start();\n#endif\n\t\t\tstring s = Solve();\n\t\t\tif (!string.IsNullOrEmpty(s))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(s);\n\t\t\t}\n#if !ONLINE_JUDGE\n\t\t\tsw.Stop();\n\t\t\tConsole.WriteLine(sw.Elapsed);\n\t\t\tConsole.ReadKey();\n#endif\n\t\t}\n\n\t\tprivate static T read()\n\t\t{\n\t\t\treturn (T)Convert.ChangeType(read(), typeof(T));\n\t\t}\n\n\t\tprivate static string read()\n\t\t{\n#if ONLINE_JUDGE\n\t\t\treturn Console.ReadLine();\n#else\n\t\t\treturn testInput.Dequeue();\n#endif\n\t\t}\n\n\t\tprivate static T[] readMany()\n\t\t{\n\t\t\treturn readMany(' ');\n\t\t}\n\n\t\tprivate static _[] readMany<_>(params char[] ___)\n\t\t{\n\t\t\treturn read().Split(___).Select(__ => (_)Convert.ChangeType(__, typeof(_))).ToArray();\n\t\t}\n\n\t\tprivate static string[] readMany()\n\t\t{\n\t\t\treturn readMany();\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Func map)\n\t\t{\n\t\t\tT[][] res = new T[height][];\n\t\t\tfor (int _ = 0; _ < height; _++)\n\t\t\t{\n\t\t\t\tres[_] = read().Select(c => map(c)).ToArray();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tprivate static char[][] readField(int height)\n\t\t{\n\t\t\treturn readField(height, c => c);\n\t\t}\n\n\t\tprivate static T[][] readField(int height, Dictionary dic)\n\t\t{\n\t\t\treturn readField(height, c => dic[c]);\n\t\t}\n\n\t\tprivate static void read(out T1 t1)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t}\n\n\t\tprivate static void read(out T1 t1, out T2 t2, out T3 t3, out T4 t4, out T5 t5)\n\t\t{\n\t\t\tvar vals = readMany();\n\t\t\tt1 = (T1)Convert.ChangeType(vals[0], typeof(T1));\n\t\t\tt2 = (T2)Convert.ChangeType(vals[1], typeof(T2));\n\t\t\tt3 = (T3)Convert.ChangeType(vals[2], typeof(T3));\n\t\t\tt4 = (T4)Convert.ChangeType(vals[3], typeof(T4));\n\t\t\tt5 = (T5)Convert.ChangeType(vals[4], typeof(T5));\n\t\t}\n\n\t\tstatic Func DP(Func f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\treturn (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic Func DP(Func, TResult> f)\n\t\t{\n\t\t\tvar cache = new Dictionary, TResult>();\n\t\t\tFunc res = null;\n\t\t\tres = (t1, t2, t3, t4) =>\n\t\t\t{\n\t\t\t\tvar key = Tuple.Create(t1, t2, t3, t4);\n\t\t\t\tif (!cache.ContainsKey(key))\n\t\t\t\t\tcache.Add(key, f(t1, t2, t3, t4, res));\n\t\t\t\treturn cache[key];\n\t\t\t};\n\t\t\treturn res;\n\t\t}\n\n\t\tstatic IEnumerable range(long first, long last, long step = 1)\n\t\t{\n\t\t\tfor (long i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\n\t\tstatic IEnumerable range(int first, int last, int step = 1)\n\t\t{\n\t\t\tfor (int i = first; i <= last; i += step)\n\t\t\t{\n\t\t\t\tyield return i;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static class ExtensionMethods\n\t{\n\t\tpublic static IEnumerable Cartesian(this IEnumerable first, IEnumerable second, Func collector)\n\t\t{\n\t\t\treturn first.SelectMany(f => second.Select(s => collector(f, s)));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, Tuple.Create);\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> first, IEnumerable second)\n\t\t{\n\t\t\treturn first.Cartesian(second, (x, y) => Tuple.Create(x.Item1, x.Item2, x.Item3, x.Item4, y));\n\t\t}\n\n\t\tpublic static IEnumerable> Cartesian(this IEnumerable> source)\n\t\t{\n\t\t\tIEnumerable> res = source.First().Select(x => single(x));\n\t\t\tforeach (IEnumerable next in source.Skip(1))\n\t\t\t{\n\t\t\t\tres = res.Cartesian(next, (sofar, n) => sofar.Concat(single(n)));\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic static IEnumerable> Pow(this IEnumerable it, int num)\n\t\t{\n\t\t\treturn Enumerable.Repeat(it, num).Cartesian();\n\t\t}\n\n\t\tpublic static IEnumerable Demask(this IEnumerable> inp)\n\t\t{\n\t\t\tforeach (var pair in inp)\n\t\t\t{\n\t\t\t\tif (pair.Item2)\n\t\t\t\t{\n\t\t\t\t\tyield return pair.Item1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Combinations(this IEnumerable it)\n\t\t{\n\t\t\tforeach (var conf in new[] { true, false }.Pow(it.Count()))\n\t\t\t{\n\t\t\t\tyield return it.Zip(conf, Tuple.Create).Demask();\n\t\t\t}\n\t\t}\n\n\t\tprivate static IEnumerable single(T it)\n\t\t{\n\t\t\tyield return it;\n\t\t}\n\n\t\tprivate static IEnumerable ExceptSingle(this IEnumerable first, T it, IEqualityComparer comp = null)\n\t\t{\n\t\t\tcomp = comp ?? EqualityComparer.Default;\n\t\t\tbool seen = false;\n\t\t\tforeach (T a in first)\n\t\t\t{\n\t\t\t\tif (!seen && comp.Equals(a, it))\n\t\t\t\t{\n\t\t\t\t\tseen = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tyield return a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static IEnumerable> Permutations(this IEnumerable it)\n\t\t{\n\t\t\tif (it.Count() < 2)\n\t\t\t{\n\t\t\t\tyield return it;\n\t\t\t\tyield break;\n\t\t\t}\n\n\t\t\tforeach (T first in it)\n\t\t\t{\n\t\t\t\tforeach (IEnumerable part in Permutations(it.ExceptSingle(first)))\n\t\t\t\t{\n\t\t\t\t\tyield return single(first).Concat(part);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace TopCoder.Test.CodeForces.Batch676\n{\n public class Program676B\n {\n public static void Main(string[] args)\n {\n int[] t = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int n = t[0];\n int m = t[1];\n\n int result = Simulate(n, m);\n\n Console.WriteLine(result);\n }\n\n public static int Simulate(int n, int t)\n {\n double[,] g = new double[n, n];\n\n for (int q = 0; q < t; q++)\n {\n g[0, 0] += 1;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j <= i; j++)\n if (g[i, j] > 1 && i < n - 1)\n {\n double d = g[i, j] - 1;\n g[i, j] -= d;\n g[i + 1, j] += d / 2;\n g[i + 1, j + 1] += d / 2;\n }\n }\n\n int count = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j <= i; j++)\n if (g[i, j] >= 1) ++count;\n\n return count;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n/*\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}*/\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfInts();\n\t\t\tvar n = l[0];\n\t\t\tvar t = l[1];\n\t\t\tvar ans = new List();\n\t\t\tvar ct = n * (n + 1) / 2;\n\t\t\tfor (var i = 0; i <= ct; ++i)\n\t\t\t\tans.Add(0);\n\t\t\tans[1] = t;\n\t\t\tvar num = 0;\n\t\t\tfor (var i = 1; i <= n; ++i)\n\t\t\t{\n\t\t\t\tfor (var j = 1; j <= i; ++j)\n\t\t\t\t{\n\t\t\t\t\tnum += 1;\n\t\t\t\t\tif (ans[num] > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar x = (ans[num] - 1) / 2;\n\t\t\t\t\t\tans[num] = 1;\n\t\t\t\t\t\tvar ll = (i * (i + 1)) / 2 + j;\n\t\t\t\t\t\tvar rr = (i * (i + 1)) / 2 + j + 1;\n\t\t\t\t\t\tif (ll <= ct)\n\t\t\t\t\t\t\tans[ll] += x;\n\t\t\t\t\t\tif (rr <= ct)\n\t\t\t\t\t\t\tans[rr] += x;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans.Count(x => x == 1));\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\n\nclass Program2\n{\n private static void Push(int x, int y, double flow)\n {\n if (y >= n) return;\n\n p[x, y] += flow;\n if (p[x, y] > 1)\n {\n double next = p[x, y] - 1;\n p[x, y] = 1;\n\n Push(x, y + 1, next / 2);\n Push(x + 1, y + 1, next / 2);\n }\n }\n\n private static double[,] p = new double[11, 11];\n private static int n;\n static void Main(string[] args)\n {\n n = ReadInt();\n int t = ReadInt();\n\n while (t > 0)\n {\n Push(0, 0, 1);\n t--;\n }\n\n int count = 0;\n for (int i = 0; i <= n; i++)\n for (int j = 0; j <= n; j++)\n if (p[i, j] >= 1 - 1e-8)\n {\n count++;\n }\n Console.Write(count);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program2()\n {\n //System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace PyramidOfGlasses\n{\n partial class PyramidOfGlasses\n {\n static void Main(string[] args)\n {\n int n, initT, t, fillAll;\n int left, right;\n int answer = 0;\n\n n = NextInt();\n t = NextInt();\n initT = t;\n\n int[][] tree = new int[n][];\n int[][] minTree = new int[n][];\n\n for (int i = 0; i < n; i++)\n {\n tree[i] = new int[i + 1];\n minTree[i] = new int[i + 1];\n\n for (int j = 0, k = tree[i].Length - 1, level = (int)Math.Pow(2, i); j <= k; j++, k--, level /= 2)\n {\n tree[i][j] = tree[i][k] = level;\n }\n }\n\n minTree[0][0] = 1;\n\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < minTree[i].Length; j++)\n {\n left = j == 0 ? int.MaxValue : minTree[i - 1][j - 1];\n right = j == minTree[i].Length - 1 ? int.MaxValue : minTree[i - 1][j];\n\n minTree[i][j] = tree[i][j] + Math.Min(left, right);\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n fillAll = (int)Math.Pow(2, i);\n\n if (t >= fillAll)\n {\n answer += (i + 1);\n t -= fillAll;\n }\n else\n {\n for (int j = 0; j < minTree[i].Length; j++)\n {\n if (minTree[i][j] <= initT)\n answer++;\n }\n\n break;\n }\n }\n\n Console.WriteLine(answer);\n }\n }\n\n partial class PyramidOfGlasses\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PyramidOfGlasses\n{\n partial class PyramidOfGlasses\n {\n static void Main(string[] args)\n {\n int n, t, level = 0;\n int glasses, fillAll, fillMiddle;\n int answer = 0;\n\n n = NextInt();\n t = NextInt();\n\n while (level < n)\n {\n if (t <= 0)\n break;\n\n glasses = level + 1;\n fillAll = (int)Math.Pow(2, level);\n\n if (t >= fillAll)\n {\n t -= fillAll;\n answer += glasses;\n }\n else if (level >= 2)\n {\n fillMiddle = fillAll / 2;\n\n if (t >= fillMiddle)\n {\n t -= fillMiddle;\n answer += (glasses - 2);\n }\n\n break;\n }\n\n level++;\n }\n\n Console.WriteLine(answer);\n }\n }\n\n partial class PyramidOfGlasses\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PyramidOfGlasses\n{\n partial class PyramidOfGlasses\n {\n static void Main(string[] args)\n {\n int n, initT, t, fillAll;\n int left, right;\n int answer = 0;\n\n n = NextInt();\n t = NextInt();\n initT = t;\n\n int[][] tree = new int[n][];\n int[][] minTree = new int[n][];\n\n for (int i = 0; i < n; i++)\n {\n tree[i] = new int[i + 1];\n minTree[i] = new int[i + 1];\n\n for (int j = 0, k = tree[i].Length - 1, level = (int)Math.Pow(2, i); j <= k; j++, k--, level /= 2)\n {\n tree[i][j] = tree[i][k] = level;\n }\n }\n\n minTree[0][0] = 1;\n\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < minTree[i].Length; j++)\n {\n left = j == 0 ? int.MaxValue : minTree[i - 1][j - 1];\n right = j == minTree[i].Length - 1 ? int.MaxValue : minTree[i - 1][j];\n\n minTree[i][j] = tree[i][j] + Math.Min(left, right);\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < minTree[i].Length; j++)\n {\n if (minTree[i][j] <= initT)\n answer++;\n }\n }\n\n Console.WriteLine(answer);\n }\n }\n\n partial class PyramidOfGlasses\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private int result = 0;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/contest//problem/B\n\n var input = _reader.ReadIntArray();\n int height = input[0];\n int time = input[1];\n var glasses = new double[Enumerable.Range(1, height).Sum()];\n\n for (; time >= 0; time --)\n {\n var fillResult = FillGlasses(glasses, 0, 0);\n if (!fillResult) break;\n }\n\n result = glasses.Count(x => x >= 1);\n\n return this;\n }\n\n private bool FillGlasses(double[] glasses, int index, int level)\n {\n if (glasses.Length > index)\n {\n if (glasses[index] < 1.0)\n {\n glasses[index] += 1.0/Math.Pow(2, level);\n return true;\n }\n\n var r1 = FillGlasses(glasses, index + level + 1, level + 1);\n var r2 = FillGlasses(glasses, index + level + 2, level + 1);\n\n return r1 || r2;\n }\n\n return false;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString();\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private int result = 0;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/contest//problem/B\n\n var input = _reader.ReadIntArray();\n int height = input[0];\n int time = input[1];\n\n int level = 1;\n while (time > 0)\n {\n time -= level;\n if (time > 0)\n {\n result += level;\n level ++;\n }\n if (level > height) break;\n }\n\n return this;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString();\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Pyramid_of_Glasses\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int t = Next();\n\n var nn = new int[n,n];\n int d = 1;\n nn[0, 0] = 1;\n for (int i = 1; i < n; i++)\n {\n d *= 2;\n nn[0, i] = nn[0, i - 1] + d;\n }\n\n d = 1;\n for (int i = 1; i < n; i++)\n {\n d *= 2;\n for (int j = 0; j < n; j++)\n {\n nn[i, j] = nn[i - 1, j] + d;\n }\n }\n\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i + j > n)\n break;\n if (nn[i, j] <= t)\n count++;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Pyramid_of_Glasses\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int t = Next();\n\n var nn = new int[n,n];\n int d = 1;\n nn[0, 0] = 1;\n for (int i = 1; i < n; i++)\n {\n d *= 2;\n nn[0, i] = nn[0, i - 1] + d;\n }\n\n d = 1;\n for (int i = 1; i < n; i++)\n {\n d *= 2;\n for (int j = 0; j < n; j++)\n {\n nn[i, j] = nn[i - 1, j] + d;\n }\n }\n\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i + j >= n)\n break;\n if (nn[i, j] <= t)\n count++;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n private double[,]matrix;\n private const int max = 200;\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var t = input[1];\n matrix = new double[max, max];\n var maximum = n*(n + 1)/2;\n var result = 0;\n for (var i = 0; i < t; i++)\n {\n Solution(n, 0, 4, 100.0);\n result = 0;\n for (var k = 0; k < n; k++)\n {\n for (var j = 0; j < max; j++)\n {\n if (matrix[k, j] >= 100.0)\n {\n result++;\n }\n }\n }\n if (result >= maximum)\n {\n result = maximum;\n break;\n }\n }\n\n sw.WriteLine(result);\n }\n\n private void Solution(int n, int i, int j, double count)\n {\n if(i < 0 || i >= n)\n return;\n if(j >= max || j < 0)\n return;\n matrix[i, j] += count;\n if (matrix[i, j] > 100.0)\n {\n var diff = matrix[i, j] - 100.0;\n matrix[i, j] = 100.0;\n Solution(n, i + 1, j - 1, diff / 2.0);\n Solution(n, i + 1, j + 1, diff / 2.0);\n }\n\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n private double[,]matrix;\n private const int max = 10;\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var t = input[1];\n matrix = new double[max, max];\n var maximum = n*(n + 1)/2;\n var result = 0;\n for (var i = 0; i < t; i++)\n {\n Solution(n, 0, 4, 100.0);\n result = 0;\n for (var k = 0; k < n; k++)\n {\n for (var j = 0; j < max; j++)\n {\n if (matrix[k, j] >= 100.0)\n {\n result++;\n }\n }\n }\n if (result >= maximum)\n {\n result = maximum;\n break;\n }\n }\n\n sw.WriteLine(result);\n }\n\n private void Solution(int n, int i, int j, double count)\n {\n if(i < 0 || i >= n)\n return;\n if(j >= max || j < 0)\n return;\n matrix[i, j] += count;\n if (matrix[i, j] > 100.0)\n {\n var diff = matrix[i, j] - 100.0;\n matrix[i, j] = 100.0;\n Solution(n, i + 1, j - 1, diff / 2.0);\n Solution(n, i + 1, j + 1, diff / 2.0);\n }\n\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(1, sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n private double[,]matrix;\n private const int max = 10;\n public void Solve(int testNumber, InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var t = input[1];\n matrix = new double[max, max];\n var maximum = n*(n + 1)/2;\n var result = 0;\n for (var i = 0; i < t; i++)\n {\n result = Solution(0, 4, 100.0);\n if (result >= maximum)\n {\n break;\n }\n }\n result = 0;\n for (var i = 0; i < n; i++)\n {\n for (var j = 0; j < max; j++)\n {\n if (matrix[i, j] >= 100.0)\n {\n result++;\n }\n }\n }\n\n sw.WriteLine(result);\n }\n\n private int Solution(int i, int j, double count)\n {\n if(i < 0 || i >= max)\n return 0;\n if(j >= max || j < 0)\n return 0;\n matrix[i, j] += count;\n if (matrix[i, j] > 100.0)\n {\n var result = 1;\n result += Solution(i + 1, j - 1, count / 2.0);\n result += Solution(i + 1, j + 1, count / 2.0);\n return result;\n }\n else\n {\n if (Math.Abs(matrix[i, j] - 100.0) <= 0.000001)\n {\n return 1;\n }\n }\n\n return 0;\n\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}], "src_uid": "b2b49b7f6e3279d435766085958fb69d"} {"source_code": "using System;\nusing System.Collections;\nusing System.Text;\n\nnamespace CodeForces_83\n{\n class prob_b\n {\n \n static void Main()\n {\n int n = Int32.Parse (Console.ReadLine());\n int i;\n string[] val = Console.ReadLine().Split(\" \".ToCharArray());\n int[] n1 = new int[n];\n\n for (i = 0; i < n; ++i)\n n1[i] = Int32.Parse(val[i]);\n Array.Sort(n1);\n\n for (i = 1; i < n; ++i)\n {\n if (n1[i] > n1[i - 1] && n1[i] < 2 * n1[i - 1]) break;\n }\n if (i == n)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1 { \n class Program {\n static int n;\n static int m;\n static int[] numbers;\n static int first;\n static int second;\n //static int count = 0; \n //static char[,] array;\n static void Main(string[] args) {\n n = int.Parse(Console.ReadLine());\n numbers = new int[n];\n string[] s = Console.ReadLine().Split(' ');\n for(int i=0;i(ReadIntArray());\n a.Sort();\n for (int i = a.Count - 1; i >= 1; i--)\n {\n if(a[i] != a[i - 1] && a[i] < 2 * a[i-1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n static IEnumerator tokens;\n static Scanner()\n {\n tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new char[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n public static string nextToken()\n {\n tokens.MoveNext();\n return tokens.Current;\n }\n }\n\n int nextInt()\n {\n return int.Parse(Scanner.nextToken());\n }\n\n long nextLong()\n {\n return long.Parse(Scanner.nextToken());\n }\n\n double nextDouble()\n {\n return double.Parse(Scanner.nextToken());\n }\n\n bool isPalindrome(string str)\n {\n int x = 0, y = str.Length - 1;\n while (y > x)\n {\n if (str[x] != str[y]) return false;\n x++; y--;\n }\n return true;\n }\n\n void Solve()\n {\n int n = nextInt();\n int[] a=new int[n];\n for(int i=0;i c).Distinct().ToArray();\n for (int i = 1; i < a.Length; i++)\n {\n if (a[i - 1] * 2 > a[i])\n {\n Console.Write(\"YES\");\n return;\n }\n }\n Console.Write(\"NO\");\n }\n\n\n static void Main(string[] args)\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Datatypes\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n Array.Sort(nn);\n\n for (int i = 1; i < nn.Length; i++)\n {\n if (nn[i] != nn[i - 1])\n {\n if (nn[i] < 2*nn[i - 1])\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n TextReader inputStream;\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n#if LOCAL_TEST\n using (MyIo io = new MyIo(new StreamReader(\"input.txt\")))\n#else\n using (MyIo io = new MyIo(System.Console.In))\n#endif\n\n {\n new Program(io)\n .Solve();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n\n #endregion\n\n\n void Solve()\n {\n int n = io.NextInt();\n\n long[] nums = new long[n];\n\n\n for (int i = 0; i < n; i++)\n nums[i] = io.NextLong();\n\n Array.Sort(nums);\n\n for (int i = 0; i < n - 1; i++)\n {\n if (nums[i] < nums[i + 1] && nums[i + 1] < (nums[i] << 1))\n {\n io.Print(\"YES\");\n return;\n }\n }\n\n io.Print(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n class Program\n {\n public static void Main(string[] args)\n {\n SortedSet set = new SortedSet();\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\r', '\\t', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n for (int i = 1; i < input.Length; ++i)\n set.Add(int.Parse(input[i]));\n }\n bool result = false;\n {\n int last = 0;\n foreach (int item in set)\n {\n if (last * 2 > item)\n { result = true; break; }\n last = item;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace b1cs\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string[] ss = Console.ReadLine().Split();\n List a = new List();\n for (int i = 0; i < n; i++)\n {\n a.Add(int.Parse(ss[i]));\n }\n a.Sort();\n for (int i = 0; i < n - 1; i++)\n {\n if ((a[i] < a[i + 1]) && (a[i] * 2 > a[i + 1]))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.IO;\nusing System.Threading;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string[] input = ReadArray(':');\n int h = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n while (true)\n {\n if (m == 59)\n {\n if (h == 23)\n {\n h = 0;\n }\n else\n {\n h++;\n }\n m = 0;\n }\n else\n {\n m++;\n }\n if (h == (m % 10) * 10 + m / 10)\n {\n Console.WriteLine((h < 10 ? \"0\" + h.ToString() : h.ToString()) + \":\" + (m < 10 ? \"0\" + m.ToString() : m.ToString()));\n return;\n }\n }\n }\n\n static void B()\n {\n int n = ReadInt();\n string[] tokens = ReadArray(' ');\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tokens[i]);\n SortedSet hash = new SortedSet();\n for (int i = 0; i < n; i++)\n hash.Add(a[i]);\n int[] _hash = hash.ToArray();\n for (int i = 0; i < _hash.Length - 1; i++)\n {\n if (_hash[i + 1] < _hash[i] * 2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "//#define FileInput\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Ex2\n{\n class Program\n {\n private const int LineCount = 2;\n\n static void Main(string[] args)\n {\n#if FileInput\n string[] inputFile = File.ReadAllLines(\"Input.txt\");\n#else\n string[] inputFile = new string[LineCount];\n for (int i=0; i< LineCount; ++i)\n inputFile[i] = Console.ReadLine();\n#endif\n\n string[] vals = inputFile[1].Split(' ');\n long[] lVals = new long[vals.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n lVals[i]= Int64.Parse(vals[i]);\n }\n Array.Sort(lVals);\n\n if (vals.Length < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < vals.Length - 1; ++i)\n {\n if (lVals[i] == lVals[i + 1])\n continue;\n\n if (lVals[i] * 2 > lVals[i + 1])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Text;\n\nnamespace CodeForces_83\n{\n class prob_b\n {\n \n static void Main()\n {\n int n = Int32.Parse (Console.ReadLine());\n int bil, i;\n Hashtable myHash = new Hashtable();\n string[] val = Console.ReadLine().Split(\" \".ToCharArray());\n for (i = 0; i < 30; ++i) \n myHash.Add(1<= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n#if LOCAL_TEST\n using (MyIo io = new MyIo(new StreamReader(\"input.txt\")))\n#else\n using (MyIo io = new MyIo(System.Console.In))\n#endif\n\n {\n new Program(io)\n .Solve();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n\n #endregion\n\n\n void Solve()\n {\n int n = io.NextInt();\n\n long[] nums = new long[n];\n\n\n for (int i = 0; i < n; i++)\n nums[i] = io.NextLong();\n\n Array.Sort(nums);\n\n for (int i = n - 2; i > 0; i--)\n {\n if (nums[n - 1] != nums[i] && nums[n - 1] < (nums[i] << 1))\n {\n io.Print(\"YES\");\n return;\n }\n }\n\n io.Print(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Ex2\n{\n class Program\n {\n private const int LineCount = 2;\n\n static void Main(string[] args)\n {\n#if FileInput\n string[] inputFile = File.ReadAllLines(\"Input.txt\");\n#else\n string[] inputFile = new string[LineCount];\n for (int i=0; i< LineCount; ++i)\n inputFile[i] = Console.ReadLine();\n#endif\n\n string[] vals = inputFile[1].Split(' ');\n long[] lVals = new long[vals.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n lVals[i]= Int64.Parse(vals[i]);\n }\n Array.Sort(lVals);\n\n if (vals.Length < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n long max = lVals[vals.Length -1];\n long max2 = lVals[vals.Length -2];\n if (max2 * 2 <= max)\n {\n Console.WriteLine(\"NO\");\n }\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Ex2\n{\n class Program\n {\n private const int LineCount = 2;\n\n static void Main(string[] args)\n {\n#if FileInput\n string[] inputFile = File.ReadAllLines(\"Input.txt\");\n#else\n string[] inputFile = new string[LineCount];\n for (int i=0; i< LineCount; ++i)\n inputFile[i] = Console.ReadLine();\n#endif\n\n string[] vals = inputFile[1].Split(' ');\n long[] lVals = new long[vals.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n lVals[i]= Int64.Parse(vals[i]);\n }\n Array.Sort(lVals);\n\n if (vals.Length < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n long max = lVals[vals.Length -1];\n long max2 = lVals[0];\n for (int i = vals.Length - 2; i >= 0; --i)\n {\n if (lVals[i] != max)\n max2 = lVals[i];\n break;\n }\n\n if (max2 * 2 <= max)\n {\n Console.WriteLine(\"NO\");\n }\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace Ex2\n{\n class Program\n {\n private const int LineCount = 2;\n\n static void Main(string[] args)\n {\n#if FileInput\n string[] inputFile = File.ReadAllLines(\"Input.txt\");\n#else\n string[] inputFile = new string[LineCount];\n for (int i=0; i< LineCount; ++i)\n inputFile[i] = Console.ReadLine();\n#endif\n\n string[] vals = inputFile[1].Split(' ');\n long currentMax = Int64.Parse(vals[0]);\n\n for (int i = 1; i < vals.Length; ++i)\n {\n long current = Int64.Parse(vals[i]);\n if (current * 2 > currentMax)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1 { \n class Program {\n static int n;\n static int m;\n static int[] numbers;\n static int first;\n static int second;\n //static int count = 0; \n //static char[,] array;\n static void Main(string[] args) {\n n = int.Parse(Console.ReadLine());\n numbers = new int[n];\n string[] s = Console.ReadLine().Split(' ');\n for(int i=0;i data[i + 1])\n {\n result = true; \n break;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }"}], "src_uid": "ab003ab094931fc105384df9d144131e"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R467B.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R467B();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R467B : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var ints = this.ReadIntArray();\n var p = ints[0];\n var y = ints[1];\n if (y % 2 == 0)\n {\n y--;\n }\n\n var result = -1;\n for (int i = y; i > p ; i=i-2)\n {\n if (this.IsPrimeLimited(i, p))\n {\n result = i;\n break;\n }\n }\n\n yield return result.ToString();\n }\n\n private bool IsPrimeLimited(long number, long p)\n {\n if (number <= 0)\n {\n throw new ArgumentException(\"Must be positive\", nameof(number));\n }\n if (number == 1)\n {\n return false;\n }\n if (number < 4)\n {\n return true;\n }\n if (number % 2 == 0)\n {\n return false;\n }\n if (number % 3 == 0 && p>=3)\n {\n return false;\n }\n for (int i = 5; i * i <= number && i<=p; i = i + 6)\n {\n if (number % i == 0 || (number % (i + 2) == 0 && i+2<=p))\n {\n return false;\n }\n }\n return true;\n }\n\n }\n internal class R467C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n internal class R467D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Testriep\n{\n public class Program\n {\n\n \n public static void Main(string[] args)\n {\n var line=Console.ReadLine().Split(' ');\n var p = int.Parse(line[0]);\n var h = int.Parse(line[1]);\n if (h % 2 == 0)\n {\n h--;\n }\n while (h > p)\n {\n if (isGood(h,p))\n {\n Console.WriteLine(h);\n return;\n }\n h -= 2;\n }\n Console.WriteLine(-1);\n //Console.WriteLine(Console.ReadLine().Split(' ').Select(e => int.Parse(e)).Where(e => e != 0).Distinct().Count());\n }\n\n static bool isGood(int n,int p)\n {\n int sqrt = (int)(Math.Sqrt((double)n)+1);\n int limit = Math.Min(sqrt, p);\n for(int i = 2; i <= limit; i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _937B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var timer = new Stopwatch();\n timer.Start();\n var parsedInput = input.Split(' ').Select(x => int.Parse(x)).ToList();\n int hoppers = parsedInput[0];\n int branches = parsedInput[1];\n\n int result = Calculate(branches, hoppers);\n\n Console.WriteLine(result);\n timer.Stop();\n //Console.WriteLine(timer.ElapsedMilliseconds);\n Console.ReadLine();\n }\n\n private static int Calculate(int branches, int hoppers)\n {\n for (int i = branches; i > hoppers; i--)\n {\n bool isSimple = true;\n int top = Math.Min((int)Math.Sqrt(branches), hoppers);\n for (int j = 2; j <= top; j++)\n {\n if (i % j == 0)\n {\n isSimple = false;\n break;\n }\n }\n\n if (isSimple)\n return i;\n }\n\n return -1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace PorblemB\n{\n\tpublic static class Common\n\t{\n\t\tpublic static int[] ReadAndParseLine()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\t}\n\n\tpublic class Problem\n\t{\n\t\tpublic int p;\n\t\tpublic int y;\n\n\t\tbool IsPrime(int c)\n\t\t{\n\t\t\tif (c <= 2)\n\t\t\t\treturn false;\n\t\t\tvar l = Math.Min((int)Math.Sqrt(c), p);\n\t\t\tfor (int i = 2; i <= l; i++)\n\t\t\t\tif (c % i == 0) return false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\tvar data = Common.ReadAndParseLine();\n\t\t\tp = data[0];\n\t\t\ty = data[1];\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\twhile (!IsPrime(y) && y > 2)\n\t\t\t\ty--;\n\t\t\tConsole.WriteLine(y > p ? y : -1);\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acyclic\n{\n class B467\n {\n public static void Main()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n double p = Int32.Parse(tmp[0]);\n int y = Int32.Parse(tmp[1]);\n\n SortedSet primes = new SortedSet();\n int range = (int)Math.Max(p, Math.Floor(y / p));\n\n DateTime t = DateTime.Now;\n int x = y;\n while(x!=p)\n {\n bool flag = true;\n\n for (long i=2;i<=p && i*i<=x;i++)\n {\n\n if ((x % i) == 0)\n {\n flag = false;\n break;\n }\n }\n if(flag)\n {\n Console.WriteLine(x);\n //Console.WriteLine(DateTime.Now - t);\n return;\n }\n x--;\n }\n if (x == p) Console.WriteLine(-1);\n //Console.WriteLine(DateTime.Now - t);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n static List GetAllGcd(double num)\n {\n var all = new List();\n for (double i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine());\n var data = input.ReadLine().Split(' ').Select(double.Parse).ToList();\n var p = data[0];\n var y = data[1];\n for(double i = y; i > p; i--)\n {\n var gcds = GetAllGcd(i);\n if (gcds.Where(a => a <= p).ToList().Count == 0) {\n Console.WriteLine(i);\n return;\n };\n }\n Console.WriteLine(-1);\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"5\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"3 6\\n\"));\n Console.WriteLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"-1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"3 4\\n\"));\n Console.WriteLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces2502B\n{\n class Program\n {\n\n static long smallestDiv(long n)\n {\n for(long i= 2;i<= Math.Sqrt(n);i++)\n {\n if (n % i == 0)\n return i;\n }\n\n return 1;\n }\n\n static void Main(string[] args)\n {\n string read;\n read = Console.ReadLine();\n long p = long.Parse(read.Split(' ').ToList()[0]);\n long n = long.Parse(read.Split(' ').ToList()[1]);\n long sd,output = -1;\n for(long i=n;i>p;i--)\n {\n sd = smallestDiv(i);\n if(sd > p || sd ==1)\n {\n output = i;\n break;\n } \n }\n\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _937B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int p = int.Parse(tokens[0]);\n int y = int.Parse(tokens[1]);\n\n for (; y > p; y--)\n {\n bool suitable = true;\n\n for (int i = 2; i <= p && i <= y / i; i++)\n {\n if (y % i == 0)\n {\n suitable = false;\n break;\n }\n }\n\n if (suitable)\n {\n Console.WriteLine(y);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Vile_Grasshoppers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int p = Next();\n int y = Next();\n\n if (y%2 == 0)\n y--;\n\n while (true)\n {\n bool ok = true;\n for (int i = 3; i <= p && i*i <= y; i += 2)\n {\n if (y%i == 0)\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n break;\n\n y -= 2;\n }\n\n if (p < y)\n return y;\n\n return -1;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int p = a[0];\n int y = a[1];\n\n for (int i = y; i > p; i--)\n {\n bool ok = true;\n\n for (int j = 2; j <= p && j * j <= i; j++)\n {\n if (i % j == 0)\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(-1);\n\n\n\n\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class B\n { \n static void Main(string[] args)\n { \n string[] token = Console.ReadLine().Split();\n \n int p = int.Parse(token[0]);\n int y = int.Parse(token[1]);\n \n int ans = -1;\n \n for(int i=y;i>p;i--){\n if(IsPrime(i,p)){\n Console.WriteLine(i);\n return;\n }\n }\n \n Console.WriteLine(-1);\n \n }\n \n static bool IsPrime(int n,int p){\n for(int i=2;i<=Math.Min(Math.Sqrt(n),p);i++){\n if(n%i==0){\n return false;\n }\n }\n return true;\n }\n \n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace program\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n int a = int.Parse(arr[0]);\n int b = int.Parse(arr[1]);\n \n for (int i = b; i > a; i--)\n {\n if (Prime(i, a))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(-1);\n }\n static bool Prime(int x, int a)\n {\n if (x == 2)\n return true;\n for (int i = 2; i <= Math.Min(Math.Sqrt(x), a); i++)\n if (x % i == 0)\n return false;\n return true;\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\t string[] token = Console.ReadLine().Split();\n \n int p = int.Parse(token[0]);\n int y = int.Parse(token[1]);\n \n \n for(int i=y;i>=p;i--){\n if(IsPrime(i,p)){\n Console.WriteLine(i);\n return;\n }\n }\n \n Console.WriteLine(-1);\n\t}\n\t\n\tstatic bool IsPrime(int n,int p){\n for(int i=2;i<=Math.Min(Math.Sqrt(n),p);i++){\n if(n%i==0){\n return false;\n }\n }\n return true;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace program\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n int a = int.Parse(arr[0]);\n int b = int.Parse(arr[1]);\n \n for (int i = a + 1; i <= b; i++)\n {\n if (Prime(i))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(-1);\n }\n static bool Prime(int x)\n {\n if (x == 2) \n return true;\n if (x % 2 == 0)\n return false;\n for (int i = 3; i * i < x; i += 2)\n if (x % i == 0)\n return false;\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace program\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n int a = int.Parse(arr[0]);\n int b = int.Parse(arr[1]);\n \n for (int i = b; i > a; i--)\n {\n if (Prime(i))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(-1);\n }\n static bool Prime(int x)\n {\n if (x == 2) \n return true;\n if (x % 2 == 0)\n return false;\n for (int i = 3; i * i < x; i += 2)\n if (x % i == 0)\n return false;\n return true;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _937B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var timer = new Stopwatch();\n timer.Start();\n var parsedInput = input.Split(' ').Select(x => int.Parse(x)).ToList();\n int hoppers = parsedInput[0];\n int branches = parsedInput[1];\n\n TightBoolList occupations = new TightBoolList(branches);\n occupations[0] = true;\n occupations[1] = true;\n\n int top = (int)Math.Sqrt(branches);\n for (int i = 2; i <= hoppers && i <= top; i++)\n {\n if (occupations[i])\n continue;\n\n int start = (hoppers + 1) + (i - (hoppers + 1) % i);\n for (int j = start; j <= branches; j += i)\n {\n occupations[j] = true;\n }\n }\n\n int result = -1;\n for (int i = hoppers + 1; i <= branches; i++)\n {\n if (!occupations[i])\n result = i;\n }\n\n Console.WriteLine(result);\n timer.Stop();\n //Console.WriteLine(timer.ElapsedMilliseconds);\n Console.ReadLine();\n }\n\n class TightBoolList\n {\n private List UnderlyingList;\n\n public int Size { get; private set; }\n\n public TightBoolList(int size)\n {\n Size = size;\n int capacity = (int)Math.Ceiling(size / 8d) + 1;\n UnderlyingList = new List(capacity);\n for (int i = 0; i < capacity; i++)\n {\n UnderlyingList.Add(0);\n }\n }\n\n public bool this[int i]\n {\n get\n {\n int index = i / 8;\n int innerIndex = i % 8;\n byte containing = UnderlyingList[index];\n return (containing & (1 << innerIndex)) > 0;\n }\n set\n {\n int index = i / 8;\n int innerIndex = i % 8;\n byte containing = UnderlyingList[index];\n UnderlyingList[index] = (byte)(containing | (1 << innerIndex));\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _937B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var timer = new Stopwatch();\n timer.Start();\n var parsedInput = input.Split(' ').Select(x => int.Parse(x)).ToList();\n int hoppers = parsedInput[0];\n int branches = parsedInput[1];\n\n int result;\n if (branches == 2)\n {\n result = CalculateTwoHoppers(branches);\n }\n else\n {\n int sieveResult = SmartSieve((hoppers - 1) / 2, (branches - 1) / 2);\n result = sieveResult * 2 + 1;\n }\n\n Console.WriteLine(result);\n timer.Stop();\n Console.WriteLine(timer.ElapsedMilliseconds);\n Console.ReadLine();\n }\n\n private static int SmallerOrEqualOdd(int value)\n {\n return ((value - 1) >> 1 << 1) + 1;\n }\n\n private static int CalculateTwoHoppers(int branches)\n {\n return branches > 2 ? SmallerOrEqualOdd(branches) : -1;\n }\n\n private static int SmartSieve(int iterateFor, int size)\n {\n Indexer occupations = new ListIndexedFromOne(size);\n int top = Math.Min((int)(Math.Sqrt(size * 2 + 1) - 1) / 2, iterateFor);\n for (int i = 1; i <= top; i++)\n {\n int next = Math.Max(i, (iterateFor - i) / (2 * i + 1));\n for (int j = next; ; j += 1)\n {\n int resultIndex = 2 * i * j + i + j;\n if (resultIndex <= size)\n {\n occupations[resultIndex] = true;\n }\n else\n {\n break;\n }\n }\n }\n\n for (int i = size; i > iterateFor; i--)\n {\n if (!occupations[i])\n return i;\n }\n\n return -1;\n }\n\n public interface Indexer\n {\n bool this[int index]\n {\n get;\n set;\n }\n }\n\n public class ListIndexedFromOne : Indexer\n {\n private BitArray Array;\n\n public ListIndexedFromOne(int size)\n {\n Array = new BitArray(size);\n }\n\n public bool this[int index]\n {\n get\n {\n return Array[index - 1];\n }\n set\n {\n Array[index - 1] = value;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _937B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var timer = new Stopwatch();\n timer.Start();\n var parsedInput = input.Split(' ').Select(x => int.Parse(x)).ToList();\n int hoppers = parsedInput[0];\n int branches = parsedInput[1];\n\n TightBoolList occupations = new TightBoolList(branches);\n occupations[0] = true;\n occupations[1] = true;\n\n int top = (int)Math.Sqrt(branches);\n for (int i = 2; i <= hoppers && i <= top; i++)\n {\n if (occupations[i])\n continue;\n\n int start = (hoppers + 1) + (i - (hoppers + 1) % i);\n for (int j = start; j <= branches; j += i)\n {\n occupations[j] = true;\n }\n }\n\n int result = -1;\n for (int i = hoppers + 1; i <= branches; i++)\n {\n if (!occupations[i])\n result = i;\n }\n\n Console.WriteLine(result);\n timer.Stop();\n Console.WriteLine(timer.ElapsedMilliseconds);\n Console.ReadLine();\n }\n\n class TightBoolList\n {\n private List UnderlyingList;\n\n public int Size { get; private set; }\n\n public TightBoolList(int size)\n {\n Size = size;\n int capacity = (int)Math.Ceiling(size / 8d) + 1;\n UnderlyingList = new List(capacity);\n for (int i = 0; i < capacity; i++)\n {\n UnderlyingList.Add(0);\n }\n }\n\n public bool this[int i]\n {\n get\n {\n int index = i / 8;\n int innerIndex = i % 8;\n byte containing = UnderlyingList[index];\n return (containing & (1 << innerIndex)) > 0;\n }\n set\n {\n int index = i / 8;\n int innerIndex = i % 8;\n byte containing = UnderlyingList[index];\n UnderlyingList[index] = (byte)(containing | (1 << innerIndex));\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _937B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var timer = new Stopwatch();\n timer.Start();\n var parsedInput = input.Split(' ').Select(x => int.Parse(x)).ToList();\n int hoppers = parsedInput[0];\n int branches = parsedInput[1];\n\n int result = Calculate(branches, hoppers);\n\n Console.WriteLine(result);\n timer.Stop();\n //Console.WriteLine(timer.ElapsedMilliseconds);\n Console.ReadLine();\n }\n\n private static int Calculate(int branches, int hoppers)\n {\n for (int i = branches; i > hoppers; i--)\n {\n bool isSimple = true;\n int top = (int)Math.Sqrt(branches);\n for (int j = 2; j <= top; j++)\n {\n if (i % j == 0)\n {\n isSimple = false;\n break;\n }\n }\n\n if (isSimple)\n return i;\n }\n\n return -1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace PorblemB\n{\n\tpublic static class Common\n\t{\n\t\tpublic static int[] ReadAndParseLine()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\t}\n\n\tpublic class Problem\n\t{\n\t\tpublic int p;\n\t\tpublic int y;\n\n\t\tbool IsPrime(int c)\n\t\t{\n\t\t\tif (c <= 2)\n\t\t\t\treturn false;\n\t\t\tvar l = (int)Math.Sqrt(c) + 1;\n\t\t\tfor (int i = 2; i <= l; i++)\n\t\t\t\tif (c % i == 0) return false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\tvar data = Common.ReadAndParseLine();\n\t\t\tp = data[0];\n\t\t\ty = data[1];\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\twhile (!IsPrime(y) && y > 2)\n\t\t\t\ty--;\n\t\t\tConsole.WriteLine(y > p ? y : -1);\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PorblemB\n{\n\tpublic static class Common\n\t{\n\t\tpublic static int[] ReadAndParseLine()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t}\n\t}\n\n\tpublic class Problem\n\t{\n\t\tpublic int p;\n\t\tpublic int y;\n\n\t\tbool IsPrime(int c)\n\t\t{\n\t\t\tif (c < 2)\n\t\t\t\treturn false;\n\t\t\tvar l = (int)Math.Sqrt(c);\n\t\t\tfor (int i = 2; i <= l; i++)\n\t\t\t\tif (c % i == 0) return false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic Problem()\n\t\t{\n\t\t\tvar data = Common.ReadAndParseLine();\n\t\t\tp = data[0];\n\t\t\ty = data[1];\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\twhile (!IsPrime(y) && y > p) y--;\n\t\t\tConsole.Write(y > p ? y : -1);\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tnew Problem().Solve();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acyclic\n{\n class B467\n {\n public static void Main()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n double p = Int32.Parse(tmp[0]);\n int y = Int32.Parse(tmp[1]);\n\n\n int x = y;\n while(x!=p)\n {\n bool flag = true;\n int range = (int)Math.Max(p, Math.Floor(y / p));\n for(long i=2;i<=range;i++)\n {\n if ((x % i) == 0)\n {\n flag = false;\n break;\n\n }\n }\n if(flag)\n {\n Console.WriteLine(x);\n return;\n }\n x--;\n }\n if (x == p) Console.WriteLine(-1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acyclic\n{\n class B467\n {\n public static void Main()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n double p = Int32.Parse(tmp[0]);\n int y = Int32.Parse(tmp[1]);\n\n\n int x = y;\n while(x!=p)\n {\n bool flag = true;\n int range = (int)Math.Max(p, Math.Floor(y / p));\n int low = (int)Math.Min(p, Math.Floor(y / p));\n for (long i=2;i<=range;i++)\n {\n if ((x % i) == 0)\n {\n if (x / i <= low)\n {\n flag = false;\n break;\n }\n\n }\n }\n if(flag)\n {\n Console.WriteLine(x);\n return;\n }\n x--;\n }\n if (x == p) Console.WriteLine(-1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Acyclic\n{\n class B467\n {\n public static void Main()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n double p = Int32.Parse(tmp[0]);\n int y = Int32.Parse(tmp[1]);\n\n SortedSet primes = new SortedSet();\n int range = (int)Math.Max(p, Math.Floor(y / p));\n\n DateTime t = DateTime.Now;\n int x = y;\n while(x!=p)\n {\n bool flag = true;\n\n for (long i=2;i<=p && i*i GetResults()\n {\n var ints = this.ReadIntArray();\n var p = ints[0];\n var y = ints[1];\n if (y % 2 == 0)\n {\n y--;\n }\n\n var result = -1;\n for (int i = y; i > p ; i=i-2)\n {\n if (this.IsPrimeLimited(i, p))\n {\n result = i;\n break;\n }\n }\n\n yield return result.ToString();\n }\n\n private bool IsPrimeLimited(long number, long p)\n {\n if (number <= 0)\n {\n throw new ArgumentException(\"Must be positive\", nameof(number));\n }\n if (number == 1)\n {\n return false;\n }\n if (number < 4)\n {\n return true;\n }\n if (number % 2 == 0)\n {\n return false;\n }\n if (number % 3 == 0 && p>=3)\n {\n return false;\n }\n for (int i = 5; i * i <= number && i<=p; i = i + 6)\n {\n if (number % i == 0 || number % (i + 2) == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n }\n internal class R467C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n internal class R467D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R467B.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R467B();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R467B : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var ints = this.ReadIntArray();\n var p = ints[0];\n var y = ints[1];\n if (y % 2 == 0)\n {\n y--;\n }\n\n var result = -1;\n for (int i = y; i > p ; i=i-2)\n {\n if (this.IsPrimeLimited(i, p))\n {\n result = i;\n break;\n }\n }\n\n yield return result.ToString();\n }\n\n private bool IsPrimeLimited(long number, long p)\n {\n if (number <= 0)\n {\n throw new ArgumentException(\"Must be positive\", nameof(number));\n }\n if (number == 1)\n {\n return false;\n }\n if (number < 4)\n {\n return true;\n }\n if (number % 2 == 0)\n {\n return false;\n }\n if (number % 3 == 0 && p>3)\n {\n return false;\n }\n for (int i = 5; i * i <= number && i<=p; i = i + 6)\n {\n if (number % i == 0 || number % (i + 2) == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n }\n internal class R467C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n internal class R467D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}], "src_uid": "b533203f488fa4caf105f3f46dd5844d"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace AcmSolution\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var s = Console.ReadLine();\n \n var was = new bool['Z' - 'A' + 1];\n long ans = 1;\n int wasCnt = 0;\n\n for (int i = 0; i < s.Length; ++i) if ('9' < s[i] || s[i] < '0')\n {\n if (s[i] == '?') \n ans *= i == 0 ? 9 : 10;\n else if (!was[s[i] - 'A'])\n {\n was[s[i] - 'A'] = true;\n \n ans *= i == 0 ? 9 : (10 - wasCnt);\n wasCnt++;\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nclass Myon\n{\n public Myon() { }\n public static int Main()\n {\n new Myon().solve();\n return 0;\n }\n\n void solve()\n {\n Scanner cin = new Scanner();\n\n int question = 0;\n Dictionary num = new Dictionary();\n Dictionary c = new Dictionary();\n string s = cin.next();\n int n = s.Length;\n\n for (int i = 0; i < n; i++)\n {\n char now = s[i];\n if (now >= '0' && now <= '9')\n {\n num[now] = 1;\n }\n else if (now == '?')\n {\n question++;\n }\n else\n {\n c[now] = 1;\n }\n }\n\n long ret = 1;\n int a = 0;\n if (s[0] >= '0' && s[0] <= '9')\n {\n ;\n }\n else if (s[0] == '?')\n {\n ret *= 9;\n question--;\n }\n else\n {\n a = 1;\n }\n\n for (int i = 0; i < c.Count; i++)\n {\n ret *= 10 - Math.Max(i, a);\n }\n Console.Write(ret);\n for (int i = 0; i < question; i++)\n {\n Console.Write(\"0\");\n }\n Console.WriteLine();\n }\n\n \n}\n\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var s = Console.ReadLine();\n var alp = \"ABCDEFGHIJ\";\n HashSet hs = new HashSet();\n long res = 1;\n var rest = 10;\n int cnt = 0;\n if (s[0] == '?')\n {\n res = 9;\n }\n if(alp.Contains(s[0]))\n {\n res = 9;\n rest = 9;\n hs.Add(s[0]);\n }\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == '?')\n {\n //res *= 10;\n cnt++;\n }\n if (alp.Contains(s[i]))\n {\n if (!hs.Contains(s[i]))\n {\n res *= rest;\n rest--;\n hs.Add(s[i]);\n }\n }\n }\n Console.Write(res);\n for (int i = 0; i < cnt; i++)\n {\n Console.Write('0');\n }\n //Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.WriteLine();\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tint ans = 1;\n\t\tint zer = 0;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0){\n\t\t\t\tif(input[i] == '?'){\n\t\t\t\t\tans *= 9;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tmul--;\n\t\t\t}\n\t\t\tif(input[i] == '?')\n\t\t\t\tzer++;\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J')\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\tConsole.WriteLine(ans + new string('0', zer));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace AcmSolution\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var s = Console.ReadLine();\n \n var was = new bool['Z' - 'A' + 1];\n long ans = 1;\n int wasCnt = 0;\n\n int tens = 0;\n\n for (int i = 0; i < s.Length; ++i) if ('9' < s[i] || s[i] < '0')\n {\n if (s[i] == '?')\n {\n if (i == 0) ans *= 9;\n else tens++;\n }\n else if (!was[s[i] - 'A'])\n {\n was[s[i] - 'A'] = true;\n\n ans *= i == 0 ? 9 : (10 - wasCnt);\n wasCnt++;\n }\n }\n\n Console.WriteLine(ans + new string('0', tens));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var fileStreamIn = new FileStream(\"in.txt\", FileMode.Open);\n //var streamReader = new StreamReader(fileStreamIn);\n //Console.SetIn(streamReader);\n\n //var filestreamOut = new FileStream(\"out.txt\", FileMode.Create);\n //var streamWriter = new StreamWriter(filestreamOut);\n //streamWriter.AutoFlush = true;\n //Console.SetOut(streamWriter);\n\n var str = Console.ReadLine();\n var symbols = new HashSet();\n long answer = 1;\n int countZero = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n var symbol = str[i];\n if (symbol == '?')\n {\n answer *= (i == 0) ? 9 : 10;\n }\n else if (char.IsLetter(symbol) && !symbols.Contains(symbol))\n {\n answer *= (i == 0) ? 9 : 10 - symbols.Count;\n symbols.Add(symbol);\n }\n\n while (answer % 10 == 0)\n {\n answer = answer / 10;\n ++countZero;\n }\n }\n\n\n Console.WriteLine(answer + new String('0', countZero));\n\n\n //streamReader.Close();\n //streamWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var s = Console.ReadLine();\n var alp = \"ABCDEFGHIJ\";\n HashSet hs = new HashSet();\n long res = 1;\n var rest = 10;\n if (s[0] == '?')\n {\n res = 9;\n }\n if(alp.Contains(s[0]))\n {\n res = 9;\n rest = 9;\n hs.Add(s[0]);\n }\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == '?')\n {\n res *= 10;\n }\n if (alp.Contains(s[i]))\n {\n if (!hs.Contains(s[i]))\n {\n res *= rest;\n rest--;\n hs.Add(s[i]);\n }\n }\n }\n\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tint ans = 1;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0)\n\t\t\t\tmul--;\n\t\t\tif(input[i] == '?')\n\t\t\t\tans *= i == 0 ? 9 : 10;\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J'){\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Special_Task\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n long big = 1;\n\n var letters = new int['J' - 'A' + 1];\n foreach (char letter in s)\n {\n if (letter >= 'A' && letter <= 'J')\n {\n letters[letter - 'A'] = 1;\n }\n }\n\n int lCount = letters.Sum();\n int sCount = s.Count(c => c == '?');\n\n if (s[0] == '?')\n {\n big = 9;\n sCount--;\n }\n\n if (lCount > 0)\n {\n if (s[0] >= 'A' && s[0] <= 'J')\n {\n big *= 9;\n }\n else\n {\n big *= 10;\n }\n\n for (int i = 1; i < lCount; i++)\n {\n big *= 10 - i;\n }\n }\n\n writer.Write(big);\n if (sCount > 0)\n writer.Write(new string('0', sCount));\n\n writer.Flush();\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tstring s = NextLine().Trim();\n\t\t\tint q = 0;\n\t\t\tbool[] was = new bool[10];\n\t\t\tint[] id = new int[10];\n\t\t\tint letters = 0;\n\t\t\tforeach ( var c in s )\n\t\t\t{\n\t\t\t\tif ( c == '?' ) ++q;\n\t\t\t\telse if ( c >= 'A' && c <= 'J' )\n\t\t\t\t{\n\t\t\t\t\tif ( !was[c - 'A'] )\n\t\t\t\t\t\tid[c - 'A'] = letters++;\n\t\t\t\t\twas[c - 'A'] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( letters == 0 )\n\t\t\t{\n\t\t\t\tint cnt = 1;\n\t\t\t\tif ( s[0] == '?' )\n\t\t\t\t{\n\t\t\t\t\t--q;\n\t\t\t\t\tcnt *= 9;\n\t\t\t\t}\n\n\t\t\t\tOut.Write( cnt );\n\t\t\t\tif ( q > 0 )\n\t\t\t\t{\n\t\t\t\t\tvar builder = new StringBuilder( q );\n\t\t\t\t\tfor ( int i = 0; i < q; ++i ) builder.Append( \"0\" );\n\t\t\t\t\tOut.WriteLine( builder.ToString() );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar p = PermutationUtils.First( letters );\n\t\t\t\tlong cntZ = 0;\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\tbool good = true;\n\t\t\t\t\tif ( s[0] >= 'A' && s[0] <= 'J' && p[id[s[0] - 'A']] == 0 )\n\t\t\t\t\t\tgood = false;\n\t\t\t\t\tif ( good ) ++cntZ;\n\t\t\t\t} while ( PermutationUtils.Next( p ) );\n\n\t\t\t\tlong cnt = 1;\n\t\t\t\tfor ( int i = 2; i <= letters; ++i ) cnt *= i;\n\n\t\t\t\tlong[,] bin = new long[11, 11];\n\t\t\t\tfor ( int i = 0; i < 11; ++i )\n\t\t\t\t{\n\t\t\t\t\tbin[i, 0] = bin[i, i] = 1;\n\t\t\t\t\tfor ( int j = 1; j < i; ++j ) bin[i, j] = bin[i - 1, j] + bin[i - 1, j - 1];\n\t\t\t\t}\n\n\t\t\t\tcnt = cnt * bin[9, letters] + cntZ * bin[9, letters - 1];\n\n\t\t\t\tif ( s[0] == '?' )\n\t\t\t\t{\n\t\t\t\t\t--q;\n\t\t\t\t\tcnt *= 9;\n\t\t\t\t}\n\n\t\t\t\tOut.Write( cnt );\n\t\t\t\tif ( q > 0 )\n\t\t\t\t{\n\t\t\t\t\tvar builder = new StringBuilder( q );\n\t\t\t\t\tfor ( int i = 0; i < q; ++i ) builder.Append( \"0\" );\n\t\t\t\t\tOut.WriteLine( builder.ToString() );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int[] NextIntArray( int size )\n\t\t{\n\t\t\tvar res = new int[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextInt();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] NextLongArray( int size )\n\t\t{\n\t\t\tvar res = new long[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextLong();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] NextDoubleArray( int size )\n\t\t{\n\t\t\tvar res = new double[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextDouble();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }\n\nnamespace kp.Algo\n{\n\tstatic class PermutationUtils\n\t{\n\t\tpublic static int[] First( int n )\n\t\t{\n\t\t\tint[] res = new int[n];\n\t\t\tfor ( int i = 0; i < n; ++i ) res[i] = i;\n\t\t\treturn res;\n\t\t}\n\t\tpublic static bool Next( int[] p )\n\t\t{\n\t\t\tif ( p.Length == 1 ) return false;\n\t\t\tint i = 0;\n\t\t\t++i;\n\t\t\tif ( i == p.Length ) return false;\n\t\t\ti = p.Length;\n\t\t\t--i;\n\n\t\t\tfor ( ; ; )\n\t\t\t{\n\t\t\t\tint ii = i;\n\t\t\t\t--i;\n\t\t\t\tif ( p[i].CompareTo( p[ii] ) < 0 )\n\t\t\t\t{\n\t\t\t\t\tint j = p.Length;\n\t\t\t\t\tdo\n\t\t\t\t\t{\n\t\t\t\t\t\t--j;\n\t\t\t\t\t} while ( p[i].CompareTo( p[j] ) >= 0 );\n\t\t\t\t\tint tmp = p[i];\n\t\t\t\t\tp[i] = p[j];\n\t\t\t\t\tp[j] = tmp;\n\t\t\t\t\tint l = ii, r = p.Length - 1;\n\t\t\t\t\twhile ( l < r )\n\t\t\t\t\t{\n\t\t\t\t\t\ttmp = p[l];\n\t\t\t\t\t\tp[l] = p[r];\n\t\t\t\t\t\tp[r] = tmp;\n\t\t\t\t\t\t++l;\n\t\t\t\t\t\t--r;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ( i == 0 )\n\t\t\t\t{\n\t\t\t\t\tint l = 0, r = p.Length - 1;\n\t\t\t\t\twhile ( l < r )\n\t\t\t\t\t{\n\t\t\t\t\t\tint tmp = p[l];\n\t\t\t\t\t\tp[l] = p[r];\n\t\t\t\t\t\tp[r] = tmp;\n\t\t\t\t\t\t++l;\n\t\t\t\t\t\t--r;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nclass Program{\n static void Main(){\n string input = Console.ReadLine();\n int[] box = new int[10];\n int mul = 10;\n int ans = 1;\n \n for(int i = 0; i < input.Length; i++){\n if(i == 0)\n mul--;\n if(input[i] == '?')\n ans *= i == 0 ? 9 : 10;\n if(input[i] >= 'A' && input[i] <= 'J'){\n if(box[input[i] - 'A'] == 0){\n ans *= mul;\n box[input[i] - 'A']++;\n mul--;\n }\n }\n if(i == 0)\n mul++;\n }\n \n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var fileStreamIn = new FileStream(\"in.txt\", FileMode.Open);\n //var streamReader = new StreamReader(fileStreamIn);\n //Console.SetIn(streamReader);\n\n //var filestreamOut = new FileStream(\"out.txt\", FileMode.Create);\n //var streamWriter = new StreamWriter(filestreamOut);\n //streamWriter.AutoFlush = true;\n //Console.SetOut(streamWriter);\n\n var str = Console.ReadLine();\n var symbols = new HashSet();\n long answer = 1;\n for (int i = 0; i < str.Length; ++i)\n {\n var symbol = str[i];\n if (symbol == '?')\n {\n answer *= (i == 0) ? 9 : 10;\n }\n else if (char.IsLetter(symbol) && !symbols.Contains(symbol))\n {\n answer *= (i == 0) ? 9 : 10 - symbols.Count;\n symbols.Add(symbol);\n }\n }\n\n\n Console.WriteLine(answer);\n\n\n //streamReader.Close();\n //streamWriter.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n double combs = 1;\n double q = 0;\n Dictionary symb = new Dictionary();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n q++;\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n symb[currSymb] = 1;\n }\n }\n int a = 0;\n if (input[0] == '?')\n {\n combs = 9;\n q--;\n }\n else if (input[0] >= '0' && input[0] <= '9')\n {\n ;\n }\n else\n {\n a = 1;\n }\n for (int i = 0; i < symb.Count; i++)\n {\n combs *= (10 - Math.Max(i, a));\n }\n StringBuilder res = new StringBuilder(Convert.ToString(combs));\n while (q-- > 0)\n {\n res.Append('0');\n }\n Console.WriteLine(res.ToString());\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static int I(string s)\n {\n return Convert.ToInt32(s);\n }\n static void Main(string[] args)\n {\n HashSet set = new HashSet();\n string hint = Console.ReadLine();\n int total = 1;\n for (int i = 0; i < hint.Length; i++)\n {\n if (!Char.IsDigit(hint, i))\n {\n if (i == 0)\n {\n total *= 9;\n if (hint[i] != '?')\n set.Add(hint[i]);\n }\n else\n {\n if (hint[i] == '?') \n {\n total *= 10;\n }\n else if (!set.Contains(hint[i]))\n {\n total *= (10 - set.Count);\n set.Add(hint[i]);\n }\n }\n }\n }\n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ABBYY\n{\n class A\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n //BigInteger \n int codes = 1, zeroes = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c == '?')\n {\n if (i > 0)\n ++zeroes;\n else\n codes *= 9;\n }\n else if (c >= 'A' && c <= 'J')\n if (d.Count < 10 && !d.ContainsKey(c))\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n if (codes > 1 || zeroes == 0)\n writer.Write(codes);\n else\n writer.Write(1);\n for (int i = 0; i < zeroes; ++i)\n writer.Write(0);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Special_Task\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n BigInteger big = 1;\n\n var letters = new int['J' - 'A' + 1];\n foreach (char letter in s)\n {\n if (letter >= 'A' && letter <= 'J')\n {\n letters[letter-'A'] = 1;\n }\n }\n\n int lCount = letters.Sum();\n int sCount = s.Count(c => c == '?');\n\n if (s[0]=='?')\n {\n big = 9;\n sCount--;\n }\n\n if (sCount > 0)\n big *= Pow(10, sCount);\n\n if (lCount > 0)\n {\n if (s[0] >= 'A' && s[0] <= 'J')\n {\n big *= 9;\n }\n else\n {\n big *= 10;\n }\n\n for (int i = 1; i < lCount; i++)\n {\n big *= 10 - i;\n }\n }\n\n writer.WriteLine(big);\n writer.Flush();\n }\n\n private static BigInteger Pow(BigInteger a, int k)\n {\n BigInteger r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a);\n }\n a = (a*a);\n k >>= 1;\n }\n return r;\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tstring s = NextLine().Trim();\n\t\t\tint q = 0;\n\t\t\tbool[] was = new bool[10];\n\t\t\tint[] id = new int[10];\n\t\t\tint letters = 0;\n\t\t\tforeach ( var c in s )\n\t\t\t{\n\t\t\t\tif ( c == '?' ) ++q;\n\t\t\t\telse if ( c >= 'A' && c <= 'J' )\n\t\t\t\t{\n\t\t\t\t\tif ( !was[c - 'A'] )\n\t\t\t\t\t\tid[c - 'A'] = letters++;\n\t\t\t\t\twas[c - 'A'] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( letters == 0 )\n\t\t\t{\n\t\t\t\tint cnt = 1;\n\t\t\t\tif ( s[0] == '?' )\n\t\t\t\t{\n\t\t\t\t\t--q;\n\t\t\t\t\tcnt *= 9;\n\t\t\t\t}\n\n\t\t\t\tOut.Write( cnt );\n\t\t\t\tif ( q > 0 )\n\t\t\t\t{\n\t\t\t\t\tvar builder = new StringBuilder( q );\n\t\t\t\t\tfor ( int i = 0; i < q; ++i ) builder.Append( \"0\" );\n\t\t\t\t\tOut.WriteLine( builder.ToString() );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tvar p = PermutationUtils.First( letters );\n\t\t\t\tlong cntZ = 0;\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\tbool good = true;\n\t\t\t\t\tif ( s[0] >= 'A' && s[0] <= 'J' && p[id[s[0] - 'A']] == 0 )\n\t\t\t\t\t\tgood = false;\n\t\t\t\t\tif ( good ) ++cntZ;\n\t\t\t\t} while ( PermutationUtils.Next( p ) );\n\n\t\t\t\tlong cnt = 1;\n\t\t\t\tfor ( int i = 2; i <= letters; ++i ) cnt *= i;\n\n\t\t\t\tlong[,] bin = new long[11, 11];\n\t\t\t\tfor ( int i = 0; i < 11; ++i )\n\t\t\t\t{\n\t\t\t\t\tbin[i, 0] = bin[i, i] = 1;\n\t\t\t\t\tfor ( int j = 1; j < i; ++j ) bin[i, j] = bin[i - 1, j] + bin[i - 1, j - 1];\n\t\t\t\t}\n\n\t\t\t\tcnt = cnt * bin[9, letters] + cntZ * bin[9, letters - 1];\n\n\t\t\t\tif ( s[0] == '?' )\n\t\t\t\t{\n\t\t\t\t\t--q;\n\t\t\t\t\tcnt *= 9;\n\t\t\t\t}\n\n\t\t\t\tOut.Write( cnt );\n\t\t\t\tif ( q > 0 )\n\t\t\t\t{\n\t\t\t\t\tvar builder = new StringBuilder( q );\n\t\t\t\t\tfor ( int i = 0; i < q; ++i ) builder.Append( \"0\" );\n\t\t\t\t\tOut.WriteLine( builder.ToString() );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int[] NextIntArray( int size )\n\t\t{\n\t\t\tvar res = new int[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextInt();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] NextLongArray( int size )\n\t\t{\n\t\t\tvar res = new long[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextLong();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] NextDoubleArray( int size )\n\t\t{\n\t\t\tvar res = new double[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextDouble();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }\n\nnamespace kp.Algo\n{\n\tstatic class PermutationUtils\n\t{\n\t\tpublic static int[] First( int n )\n\t\t{\n\t\t\tint[] res = new int[n];\n\t\t\tfor ( int i = 0; i < n; ++i ) res[i] = i;\n\t\t\treturn res;\n\t\t}\n\t\tpublic static bool Next( int[] p )\n\t\t{\n\t\t\tif ( p.Length == 1 ) return false;\n\t\t\tint i = 0;\n\t\t\t++i;\n\t\t\tif ( i == p.Length ) return false;\n\t\t\ti = p.Length;\n\t\t\t--i;\n\n\t\t\tfor ( ; ; )\n\t\t\t{\n\t\t\t\tint ii = i;\n\t\t\t\t--i;\n\t\t\t\tif ( p[i].CompareTo( p[ii] ) < 0 )\n\t\t\t\t{\n\t\t\t\t\tint j = p.Length;\n\t\t\t\t\tdo\n\t\t\t\t\t{\n\t\t\t\t\t\t--j;\n\t\t\t\t\t} while ( p[i].CompareTo( p[j] ) >= 0 );\n\t\t\t\t\tint tmp = p[i];\n\t\t\t\t\tp[i] = p[j];\n\t\t\t\t\tp[j] = tmp;\n\t\t\t\t\tint l = ii, r = p.Length - 1;\n\t\t\t\t\twhile ( l < r )\n\t\t\t\t\t{\n\t\t\t\t\t\ttmp = p[l];\n\t\t\t\t\t\tp[l] = p[r];\n\t\t\t\t\t\tp[r] = tmp;\n\t\t\t\t\t\t++l;\n\t\t\t\t\t\t--r;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif ( i == 0 )\n\t\t\t\t{\n\t\t\t\t\tint l = 0, r = p.Length - 1;\n\t\t\t\t\twhile ( l < r )\n\t\t\t\t\t{\n\t\t\t\t\t\tint tmp = p[l];\n\t\t\t\t\t\tp[l] = p[r];\n\t\t\t\t\t\tp[r] = tmp;\n\t\t\t\t\t\t++l;\n\t\t\t\t\t\t--r;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ABBYY\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n // TODO: check the first zeroes\n int codes = 1;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c >= 'A' && c <= 'J')\n {\n if (d.ContainsKey(c))\n ++d[c];\n else\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n else if (c == '?')\n {\n if (i > 0)\n codes *= 10;\n else\n codes *= 9;\n }\n }\n writer.Write(codes);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp\n{\n class Program\n {\n static void Main()\n {\n string input = Console.ReadLine();\n int[] count=new int[11];\n\n int length = input.Length;\n int ans = 1, flag=0;\n\n if (input[0] == '?')\n ans = 9;\n\n if (input[0] >= 'A' && input[0] <= 'J')\n {\n int temp = input[0];\n count[temp - 'A']++;\n flag = 1;\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == '?')\n ans = ans * 10;\n if (input[i] >= 'A' && input[i] <= 'J')\n {\n int temp = input[i];\n count[temp - 'A']++;\n }\n \n }\n\n if (flag == 0)\n {\n int start = 10;\n for (int i = 0; i < types(count); i++)\n {\n ans *= start;\n start--;\n }\n }\n else\n {\n int total = types(count);\n if (total == 1)\n ans *= 9;\n if (total > 1)\n { \n ans *= 9;\n int start = 9;\n for (int i = 1; i < total; i++)\n {\n ans *= start;\n start--;\n }\n }\n \n }\n\n Console.WriteLine(ans);\n }\n\n static int types(int[] count)\n {\n int total=0;\n for (int i = 0; i < 10; i++)\n {\n if (count[i] > 0)\n total++;\n }\n \n return total;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Numerics;\n\nnamespace cs\n{\n public class Main : Utils\n {\n public Main(TextReader inStream, TextWriter outStream)\n : base(inStream, outStream)\n {\n }\n\n protected override void Solve()\n {\n string s;\n Next(out s);\n var ans=BigInteger.One;\n var st=new SortedSet();\n for (var i = 0; i < s.Length; i++)\n if (s[i] == '?')\n ans *= i == 0 ? 9 : 10;\n else if (s[i] >= '0' && s[i] <= '9')\n continue;\n else if (st.Contains(s[i]))\n continue;\n else\n {\n if (i == 0)\n ans *= 9;\n else\n ans *= 10 - st.Count;\n st.Add(s[i]);\n }\n PrintLine(ans);\n }\n }\n\n public class PriorityQueue\n {\n #region private members\n\n private readonly List _data = new List();\n private readonly IComparer _comparer;\n\n #endregion\n\n #region constructors\n\n public PriorityQueue()\n {\n _comparer = Comparer.Default;\n }\n\n public PriorityQueue(IComparer comparer)\n {\n if (comparer == null)\n {\n _comparer = Comparer.Default;\n return;\n }\n _comparer = comparer;\n }\n\n #endregion\n\n #region public members\n\n public int Count\n {\n get { return _data.Count; }\n }\n\n public bool Empty()\n {\n return Count == 0;\n }\n\n public T Top()\n {\n return _data[0];\n }\n\n public void Push(T item)\n {\n _data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && _comparer.Compare(item, _data[curPlace / 2 - 1]) > 0)\n {\n _data[curPlace - 1] = _data[curPlace / 2 - 1];\n _data[curPlace / 2 - 1] = item;\n curPlace /= 2;\n }\n }\n\n public void Pop()\n {\n _data[0] = _data[Count - 1];\n _data.RemoveAt(Count - 1);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && _comparer.Compare(_data[max - 1], _data[2 * curPlace - 1]) < 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && _comparer.Compare(_data[max - 1], _data[2 * curPlace]) < 0)\n max = 2 * curPlace + 1;\n if (max == curPlace) break;\n var item = _data[max - 1];\n _data[max - 1] = _data[curPlace - 1];\n _data[curPlace - 1] = item;\n curPlace = max;\n }\n }\n\n #endregion\n }\n\n public static class Algorithm\n {\n public static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n public static void RandomShuffle(T[] a)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n for (var i = 1; i < a.Length; i++)\n Swap(ref a[i], ref a[rnd.Next(i)]);\n }\n\n public static bool NextPermutation(T[] a, Comparer comparer = null)\n {\n var comp = comparer ?? Comparer.Default;\n for (var i = a.Length - 1; i > 0; i--)\n if (comp.Compare(a[i], a[i - 1]) > 0)\n {\n var j = i + 1;\n for (; j < a.Length; j++)\n if (comp.Compare(a[j], a[i - 1]) <= 0)\n break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, a.Length - i);\n return true;\n }\n Array.Reverse(a);\n return false;\n }\n }\n\n public abstract class Utils : IDisposable\n {\n protected readonly TextReader InputStream;\n protected readonly TextWriter OutputStream;\n\n private string[] _tokens;\n private int _pointer;\n\n protected Utils()\n : this(Console.In, Console.Out)\n {\n }\n\n protected Utils(TextReader inputStream, TextWriter outputStream)\n {\n InputStream = inputStream;\n OutputStream = outputStream;\n }\n\n protected string NextLine()\n {\n try\n {\n return InputStream.ReadLine();\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n protected string NextString()\n {\n try\n {\n while (_tokens == null || _pointer >= _tokens.Length)\n {\n _tokens = NextLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n _pointer = 0;\n }\n return _tokens[_pointer++];\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n protected bool Next(out T ans)\n {\n var str = NextString();\n if (str == null)\n {\n ans = default(T);\n return false;\n }\n ans = (T)Convert.ChangeType(str, typeof(T));\n return true;\n }\n\n protected void Print(string format, params object[] args)\n {\n OutputStream.Write(format, args);\n }\n\n protected void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n OutputStream.WriteLine();\n }\n\n protected void PrintLine()\n {\n OutputStream.WriteLine();\n }\n\n protected void Print(T o)\n {\n OutputStream.Write(o);\n }\n\n protected void PrintLine(T o)\n {\n OutputStream.WriteLine(o);\n }\n\n void IDisposable.Dispose()\n {\n InputStream.Close();\n OutputStream.Close();\n }\n\n protected abstract void Solve();\n\n public static void Main(string[] args)\n {\n using (var p = new Main(Console.In, Console.Out))\n p.Solve();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n HashSet letset = new HashSet();\n int k = 0;\n int kq = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n\n if (s[i] >= 'A' && s[i] <= 'J' && !letset.Contains(s[i]))\n {\n letset.Add(s[i]);\n k++;\n }\n\n if (s[i] == '?')\n kq++;\n\n }\n BigInteger ans = BigInteger.One;\n BigInteger m = BigInteger.Multiply(ans, 10); ;\n\n\n for (int i = 0; i < k; i++)\n {\n ans = BigInteger.Multiply(ans, m);\n m = BigInteger.Subtract(m, BigInteger.One);\n\n }\n\n\n\n if (s[0] >= '0' && s[0] <= '9')\n {\n Console.Write(ans);\n for (int i = 0; i < kq; i++) Console.Write(\"0\");\n }\n else\n {\n if (k == 0)\n {\n \n Console.Write(9);\n for (int i = 0; i < kq-1; i++) Console.Write(\"0\");\n }\n else\n {\n Console.Write(BigInteger.Multiply(BigInteger.Divide(ans, 10), 9));\n\n for (int i = 0; i < kq; i++) Console.Write(\"0\");\n }\n }\n\n // Console.ReadKey();\n }\n public static BigInteger binpow(BigInteger a, int n)\n {\n BigInteger res = 1;\n while (n > 0)\n {\n if (n % 2 != 0)\n res = BigInteger.Multiply(res, a);\n a = BigInteger.Multiply(a, a);\n n >>= 1;\n }\n return res;\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string input = ReadLine();\n int tens = 0;\n bool[] letters = new bool[10];\n int cnt = 10;\n int other = 1;\n bool isPrevNull = false;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i].Equals('?'))\n {\n if (i == 0)\n {\n other *= 9;\n continue;\n }\n tens++;\n }\n else\n {\n if (!char.IsDigit(input[i]))\n {\n if (!letters[input[i] - 'A'])\n {\n if (i == 0) other *= --cnt;\n else other *= cnt--;\n letters[input[i] - 'A'] = true;\n }\n }\n }\n }\n StringBuilder ans = new StringBuilder();\n ans.Append(other.ToString());\n for (int i = 0; i < tens; i++)\n ans.Append(\"0\");\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp\n{\n class Program\n {\n static void Main()\n {\n string input = Console.ReadLine();\n int[] count=new int[11];\n\n int length = input.Length;\n int ans = 1, flag=0, zercount=0;\n\n if (input[0] == '?')\n ans = 9;\n\n if (input[0] >= 'A' && input[0] <= 'J')\n {\n int temp = input[0];\n count[temp - 'A']++;\n flag = 1;\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == '?')\n zercount++;\n if (input[i] >= 'A' && input[i] <= 'J')\n {\n int temp = input[i];\n count[temp - 'A']++;\n }\n \n }\n\n if (flag == 0)\n {\n int start = 10;\n for (int i = 0; i < types(count); i++)\n {\n ans *= start;\n start--;\n }\n }\n else\n {\n int total = types(count);\n if (total == 1)\n ans *= 9;\n if (total > 1)\n { \n ans *= 9;\n int start = 9;\n for (int i = 1; i < total; i++)\n {\n ans *= start;\n start--;\n }\n }\n \n }\n\n Console.Write(ans);\n for (int i = 0; i < zercount; i++)\n Console.Write(\"0\");\n Console.WriteLine();\n }\n\n static int types(int[] count)\n {\n int total=0;\n for (int i = 0; i < 10; i++)\n {\n if (count[i] > 0)\n total++;\n }\n \n return total;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\n\n class Program\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int a = 1;\n int d = 0;\n bool b=false;\n bool e=false;\n if (s[0] == '?' || 'A' <= s[0] && s[0] <= 'J') b = true;\n for (char c = 'A'; c <= 'J'; c++) {\n e = false;\n for (int i = 0; i < s.Length; i++)\n if (s[i] == c) e = true;\n if (e) d++;\n }\n for (int i = 0; i < s.Length; i++) \n if (s[i] == '?') a *= 10;\n for (; d > 0; d--) a *= 11 - d;\n if (b) a = a / 10 * 9;\n Console.WriteLine(a);\n \n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Numerics;\n\nnamespace cs\n{\n public class Main : Utils\n {\n public Main(TextReader inStream, TextWriter outStream)\n : base(inStream, outStream)\n {\n }\n\n protected override void Solve()\n {\n string s;\n Next(out s);\n var ans = 1;\n var st = new HashSet();\n int p10 = 0;\n for (var i = 0; i < s.Length; i++)\n if (s[i] == '?')\n {\n if (i == 0) ans *= 9;\n else p10++;\n }\n else if (s[i] >= '0' && s[i] <= '9')\n continue;\n else if (st.Contains(s[i]))\n continue;\n else\n {\n if (i == 0)\n ans *= 9;\n else\n ans *= 10 - st.Count;\n st.Add(s[i]);\n }\n Print(ans);\n while (p10-- > 0)\n Print(0);\n PrintLine();\n }\n }\n\n public class PriorityQueue\n {\n #region private members\n\n private readonly List _data = new List();\n private readonly IComparer _comparer;\n\n #endregion\n\n #region constructors\n\n public PriorityQueue()\n {\n _comparer = Comparer.Default;\n }\n\n public PriorityQueue(IComparer comparer)\n {\n if (comparer == null)\n {\n _comparer = Comparer.Default;\n return;\n }\n _comparer = comparer;\n }\n\n #endregion\n\n #region public members\n\n public int Count\n {\n get { return _data.Count; }\n }\n\n public bool Empty()\n {\n return Count == 0;\n }\n\n public T Top()\n {\n return _data[0];\n }\n\n public void Push(T item)\n {\n _data.Add(item);\n var curPlace = Count;\n while (curPlace > 1 && _comparer.Compare(item, _data[curPlace / 2 - 1]) > 0)\n {\n _data[curPlace - 1] = _data[curPlace / 2 - 1];\n _data[curPlace / 2 - 1] = item;\n curPlace /= 2;\n }\n }\n\n public void Pop()\n {\n _data[0] = _data[Count - 1];\n _data.RemoveAt(Count - 1);\n var curPlace = 1;\n while (true)\n {\n var max = curPlace;\n if (Count >= curPlace * 2 && _comparer.Compare(_data[max - 1], _data[2 * curPlace - 1]) < 0)\n max = 2 * curPlace;\n if (Count >= curPlace * 2 + 1 && _comparer.Compare(_data[max - 1], _data[2 * curPlace]) < 0)\n max = 2 * curPlace + 1;\n if (max == curPlace) break;\n var item = _data[max - 1];\n _data[max - 1] = _data[curPlace - 1];\n _data[curPlace - 1] = item;\n curPlace = max;\n }\n }\n\n #endregion\n }\n\n public static class Algorithm\n {\n public static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n public static void RandomShuffle(T[] a)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n for (var i = 1; i < a.Length; i++)\n Swap(ref a[i], ref a[rnd.Next(i)]);\n }\n\n public static bool NextPermutation(T[] a, Comparer comparer = null)\n {\n var comp = comparer ?? Comparer.Default;\n for (var i = a.Length - 1; i > 0; i--)\n if (comp.Compare(a[i], a[i - 1]) > 0)\n {\n var j = i + 1;\n for (; j < a.Length; j++)\n if (comp.Compare(a[j], a[i - 1]) <= 0)\n break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, a.Length - i);\n return true;\n }\n Array.Reverse(a);\n return false;\n }\n }\n\n public abstract class Utils : IDisposable\n {\n protected readonly TextReader InputStream;\n protected readonly TextWriter OutputStream;\n\n private string[] _tokens;\n private int _pointer;\n\n protected Utils()\n : this(Console.In, Console.Out)\n {\n }\n\n protected Utils(TextReader inputStream, TextWriter outputStream)\n {\n InputStream = inputStream;\n OutputStream = outputStream;\n }\n\n protected string NextLine()\n {\n try\n {\n return InputStream.ReadLine();\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n protected string NextString()\n {\n try\n {\n while (_tokens == null || _pointer >= _tokens.Length)\n {\n _tokens = NextLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n _pointer = 0;\n }\n return _tokens[_pointer++];\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n protected bool Next(out T ans)\n {\n var str = NextString();\n if (str == null)\n {\n ans = default(T);\n return false;\n }\n ans = (T)Convert.ChangeType(str, typeof(T));\n return true;\n }\n\n protected void Print(string format, params object[] args)\n {\n OutputStream.Write(format, args);\n }\n\n protected void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n OutputStream.WriteLine();\n }\n\n protected void PrintLine()\n {\n OutputStream.WriteLine();\n }\n\n protected void Print(T o)\n {\n OutputStream.Write(o);\n }\n\n protected void PrintLine(T o)\n {\n OutputStream.WriteLine(o);\n }\n\n void IDisposable.Dispose()\n {\n InputStream.Close();\n OutputStream.Close();\n }\n\n protected abstract void Solve();\n\n public static void Main(string[] args)\n {\n using (var p = new Main(Console.In, Console.Out))\n p.Solve();\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nusing System.Threading;\nusing System.Numerics;\n\nclass Problem\n{\n private static Decimal GetNumericValue(string value, NumberStyles styles)\n {\n Decimal number;\n\n number = Decimal.Parse(value, styles);\n return number;\n }\n\n public void Solution(TextReader Input, TextWriter Output)\n {\n string s;\n s = Input.ReadLine();\n bool[] used = new bool[10];\n\n BigInteger[] fact = new BigInteger[11];\n fact[0] = fact[1] = 1;\n for (int i = 2; i <= 10; i++)\n fact[i] = fact[i - 1] * i;\n\n int x = 0;\n bool z = false;\n BigInteger ans = 1;\n\n if (s.Length == 1)\n {\n if ('0' <= s[0] && s[0] <= '9')\n Output.WriteLine(\"1\");\n else\n Output.WriteLine(\"9\");\n return;\n }\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '?')\n if (i == 0)\n ans *= 9;\n else\n ans *= 10;\n else\n if ('A' <= s[i] && s[i] <= 'Z')\n {\n int k = s[i] - 'A';\n if (!used[k])\n {\n x++;\n used[k] = true;\n }\n if (i == 0)\n z = true;\n }\n }\n\n if (x == 0)\n {\n Output.WriteLine(ans.ToString());\n return;\n }\n\n if (!z)\n {\n \n BigInteger tmp = fact[10] / fact[10 - x];\n ans *= tmp;\n }\n else\n {\n BigInteger tmp = 9 * fact[9] / fact[10 - x];\n ans *= tmp;\n }\n\n Output.WriteLine(ans.ToString());\n }\n}\n\n\nclass Program\n{\n public static void Main()\n {\n#if Local\n var inputStream = new StreamReader(@\"..\\..\\input.txt\");\n var outputStream = new StreamWriter(@\"..\\..\\output.txt\");\n\n new Problem().Solution(inputStream, outputStream);\n\n inputStream.Close();\n outputStream.Close();\n#else\n new Problem().Solution(Console.In, Console.Out);\n#endif\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string input = ReadLine();\n int tens = 0;\n bool[] letters = new bool[10];\n int cnt = 10;\n int other = 1;\n bool isPrevNull = false;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i].Equals('?'))\n {\n if (i == 0)\n {\n other *= 9;\n continue;\n }\n tens++;\n }\n else\n {\n if (!char.IsDigit(input[i]))\n {\n if (!letters[input[i] - 'A'])\n {\n if (i == 0) other *= --cnt;\n else other *= cnt--;\n letters[input[i] - 'A'] = true;\n }\n }\n }\n }\n StringBuilder ans = new StringBuilder();\n ans.Append(other.ToString());\n for (int i = 0; i < tens; i++)\n ans.Append(\"0\");\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string st = Console.ReadLine();\n bool[] f = new bool[10];\n int ff = 10;\n long k=1;\n for (int i = 0; i < 10; i++)\n {\n f[i] = true;\n }\n for (int i = 0; i < st.Length; i++)\n {\n if (st[i] == '?')\n {\n if (i == 0)\n {\n k = k * 9;\n }\n else\n {\n k = k * 10;\n }\n }\n if (st[i] >= 'A' && st[i] <= 'J')\n {\n if (ff > 0 && f[(int)st[i] - 65] == true)\n {\n if (i == 0)\n {\n k = k * 9;\n }\n else\n {\n k = k * ff;\n }\n ff--;\n }\n f[(int)st[i] - 65] = false;\n }\n }\n Console.WriteLine(k.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res = 1;\n String s = Console.ReadLine();\n Dictionary d=new Dictionary();\n int mul;\n for (int i = 0; i < s.Length;i++ )\n {\n if (i == 0) mul = 9;\n else mul = 10;\n if (s[i] == '?')\n res *= mul;\n if (s[i] >= 'A' && s[i] <= 'J')\n {\n if(i!=0)mul = 10-d.Count;\n try\n {\n d.Add(s[i], s[i]);\n res *= mul;\n }\n catch\n {\n \n }\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace abbycup1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring [] n9 = {\"9\", \"81\", \"648\", \"4536\", \"27216\", \"136080\", \"544320\", \"1632960\", \"326592\", \"326592\"};\n\t\t\tstring [] n10 = {\"10\", \"90\", \"720\", \"5040\", \"30240\", \"151200\", \"604800\", \"1814400\", \"3628800\", \"3628800\"};\n\t\t\tchar [] letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};\n\t\t\tbool nine = false;\n\t\t\tbool voprfirst=false;\n\t\t\tint count = 0;\n\t\t\tint voprcount=0;\n\t\t\t\n\t\t\tchar [] input = Console.ReadLine().ToCharArray();\n\t\t\t\n\t\t\tif ( Array.BinarySearch(letters, input[0]) >= 0 || input[0] == '?') {\n\t\t\t\tnine = true;\n\t\t\t}\n\t\t\t\n\t\t\tif ( input[0] == '?') {\n\t\t\t\tvoprfirst = true;\n\t\t\t}\n\t\t\t\n\t\t\tArray.Sort(input);\n\t\t\t\n\t\t\tfor (int i=0; i<=9; i++) {\n\t\t\t\tif (Array.BinarySearch(input, letters[i])>=0) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint vopr = Array.BinarySearch(input, '?');\n\t\t\tif (vopr>=0) {\n\t\t\t\tfor (int i=0; i0 && !voprfirst) {\n\t\t\t\tif (nine) {\n\t\t\t\t\tConsole.Write(n9[count-1]);\t\n\t\t\t\t} else {\n\t\t\t\t\tConsole.Write(n10[count-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (voprfirst && count==0) {\n\t\t\t\tConsole.Write(\"9\");\n\t\t\t}\n\t\t\t\n\t\t\tif (count==0 && !voprfirst) {\n\t\t\t\tConsole.Write(\"1\");\n\t\t\t}\n\t\t\t\n\t\t\tif (count>0 && voprfirst) {\n\t\t\t\tConsole.Write(n9[count-1]);\n\t\t\t\tConsole.Write(\"0\");\t\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i=1; i<=voprcount; i++) {\n\t\t\t\tConsole.Write(\"0\");\n\t\t\t}\n\t\t\tConsole.WriteLine(\"\");\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nclass Myon\n{\n public Myon() { }\n public static int Main()\n {\n new Myon().solve();\n return 0;\n }\n\n void solve()\n {\n Scanner cin = new Scanner();\n\n int question = 0;\n Dictionary num = new Dictionary();\n Dictionary c = new Dictionary();\n string s = cin.next();\n int n = s.Length;\n\n for (int i = 0; i < n; i++)\n {\n char now = s[i];\n if (now >= '0' && now <= '9')\n {\n num[now] = 1;\n }\n else if (now == '?')\n {\n question++;\n }\n else\n {\n c[now] = 1;\n }\n }\n\n long ret = 1;\n int a = 0;\n if (s[0] >= '0' && s[0] <= '9')\n {\n ;\n }\n else if (s[0] == '?')\n {\n ret *= 9;\n question--;\n }\n else\n {\n a = 1;\n }\n\n for (int i = 0; i < c.Count; i++)\n {\n ret *= 10 - Math.Max(i, a);\n }\n Console.Write(ret);\n for (int i = 0; i < question; i++)\n {\n Console.Write(\"0\");\n }\n Console.WriteLine();\n }\n\n \n}\n\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n double combs = 1;\n double q = 0;\n Dictionary symb = new Dictionary();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n q++;\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n symb[currSymb] = 1;\n }\n }\n int a = 0;\n if (input[0] == '?')\n {\n combs = 9;\n q--;\n }\n else if (input[0] >= '0' && input[0] <= '9')\n {\n ;\n }\n else\n {\n a = 1;\n }\n for (int i = 0; i < symb.Count; i++)\n {\n combs *= (10 - Math.Max(i, a));\n }\n StringBuilder res = new StringBuilder(Convert.ToString(combs));\n while (q-- > 0)\n {\n res.Append('0');\n }\n Console.WriteLine(res.ToString());\n\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tint ans = 1;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0)\n\t\t\t\tmul--;\n\t\t\tif(input[i] == '?'){\n\t\t\t\tans *= mul;\n\t\t\t}\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J'){\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tint ans = 1;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0)\n\t\t\t\tmul--;\n\t\t\tif(input[i] == '?'){\n\t\t\t\tans *= 10;\n\t\t\t}\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J'){\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Special_Task\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n BigInteger big = 1;\n\n var letters = new int['J' - 'A' + 1];\n foreach (char letter in s)\n {\n if (letter >= 'A' && letter <= 'J')\n {\n letters[letter-'A'] = 1;\n }\n }\n\n int lCount = letters.Sum();\n int sCount = s.Count(c => c == '?');\n\n if (s[0]=='?')\n {\n big = 9;\n sCount--;\n }\n\n if (sCount > 0)\n big *= Pow(10, sCount);\n\n if (s[0] >= 'A' && s[0] <= 'J')\n {\n big *= 9;\n }\n else\n {\n big *= 10;\n }\n\n for (int i = 1; i < lCount; i++)\n {\n big *= 10 - i;\n }\n\n writer.WriteLine(big);\n writer.Flush();\n }\n\n private static BigInteger Pow(BigInteger a, int k)\n {\n BigInteger r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r*a);\n }\n a = (a*a);\n k >>= 1;\n }\n return r;\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string input = ReadLine();\n int tens = 0;\n bool[] letters = new bool[10];\n int cnt = 10;\n int other = 1;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i].Equals('?'))\n {\n if (i == 0)\n {\n other *= 9;\n continue;\n }\n tens++;\n }\n else\n {\n if (!char.IsDigit(input[i]))\n {\n if (!letters[input[i] - 'A'])\n {\n if (i == 0)\n {\n other *= 9;\n cnt--;\n continue;\n }\n other *= cnt;\n cnt--;\n letters[input[i] - 'A'] = true;\n }\n }\n }\n }\n StringBuilder ans = new StringBuilder();\n ans.Append(other.ToString());\n for (int i = 0; i < tens; i++)\n ans.Append(\"0\");\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string input = ReadLine();\n int tens = 0;\n bool[] letters = new bool[10];\n int cnt = 10;\n int other = 1;\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i].Equals('?'))\n {\n tens++;\n }\n else\n {\n if (!char.IsDigit(input[i]))\n {\n if (!letters[input[i] - 'A'])\n {\n if (i == 0)\n {\n other *= 9;\n cnt--;\n continue;\n }\n other *= cnt;\n cnt--;\n letters[input[i] - 'A'] = true;\n }\n }\n }\n }\n StringBuilder ans = new StringBuilder();\n ans.Append(other.ToString());\n for (int i = 0; i < tens; i++)\n ans.Append(\"0\");\n Console.WriteLine(ans);\n }\n\n static void B()\n {\n\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nusing System.Threading;\nusing System.Numerics;\n\nclass Problem\n{\n private static Decimal GetNumericValue(string value, NumberStyles styles)\n {\n Decimal number;\n\n number = Decimal.Parse(value, styles);\n return number;\n }\n\n public void Solution(TextReader Input, TextWriter Output)\n {\n string s;\n s = Input.ReadLine();\n bool [] used = new bool[10];\n\n BigInteger[] fact = new BigInteger[11];\n fact[0] = fact[1] = 1;\n for (int i = 2; i <= 10; i++)\n fact[i] = fact[i - 1] * i;\n\n int x = 0;\n bool z = false;\n BigInteger ans = 1;\n\n if (s.Length == 1)\n {\n if ('0' <= s[0] && s[0] <= '9')\n Output.WriteLine(\"1\");\n else\n Output.WriteLine(\"10\");\n return;\n }\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '?')\n if (i == 0)\n ans *= 9;\n else\n ans *= 10;\n else\n if ('A' <= s[i] && s[i] <= 'Z')\n {\n int k = s[i] - 'A';\n if (!used[k])\n {\n x++;\n used[k] = true;\n }\n if (i == 0)\n z = true;\n }\n }\n\n if (!z)\n {\n BigInteger tmp = fact[10] / (fact[x] * fact[10 - x]);\n ans *= tmp;\n }\n else\n {\n BigInteger tmp = 9 * fact[9] / (fact[x - 1] * fact[10 - x]);\n ans *= tmp;\n }\n\n Output.WriteLine(ans.ToString());\n }\n}\n\n\nclass Program\n{\n public static void Main()\n {\n#if Local\n var inputStream = new StreamReader(@\"..\\..\\input.txt\");\n var outputStream = new StreamWriter(@\"..\\..\\output.txt\");\n\n new Problem().Solution(inputStream, outputStream);\n\n inputStream.Close();\n outputStream.Close();\n#else\n new Problem().Solution(Console.In, Console.Out);\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nusing System.Threading;\nusing System.Numerics;\n\nclass Problem\n{\n private static Decimal GetNumericValue(string value, NumberStyles styles)\n {\n Decimal number;\n\n number = Decimal.Parse(value, styles);\n return number;\n }\n\n public void Solution(TextReader Input, TextWriter Output)\n {\n string s;\n s = Input.ReadLine();\n bool [] used = new bool[10];\n\n BigInteger[] fact = new BigInteger[11];\n fact[0] = fact[1] = 1;\n for (int i = 2; i <= 10; i++)\n fact[i] = fact[i - 1] * i;\n\n int x = 0;\n bool z = false;\n BigInteger ans = 1;\n\n if (s.Length == 1)\n {\n if ('0' <= s[0] && s[0] <= '9')\n Output.WriteLine(\"1\");\n else\n Output.WriteLine(\"10\");\n return;\n }\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '?')\n ans *= 10;\n else\n if ('A' <= s[i] && s[i] <= 'Z')\n {\n int k = s[i] - 'A';\n if (!used[k])\n {\n x++;\n used[k] = true;\n }\n //if (i == 0)\n // z = true;\n }\n }\n\n BigInteger tmp = fact[10] / (fact[x] * fact[10 - x]);\n ans *= tmp;\n \n\n Output.WriteLine(ans.ToString());\n }\n}\n\n\nclass Program\n{\n public static void Main()\n {\n#if Local\n var inputStream = new StreamReader(@\"..\\..\\input.txt\");\n var outputStream = new StreamWriter(@\"..\\..\\output.txt\");\n\n new Problem().Solution(inputStream, outputStream);\n\n inputStream.Close();\n outputStream.Close();\n#else\n new Problem().Solution(Console.In, Console.Out);\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nusing System.Threading;\nusing System.Numerics;\n\nclass Problem\n{\n private static Decimal GetNumericValue(string value, NumberStyles styles)\n {\n Decimal number;\n\n number = Decimal.Parse(value, styles);\n return number;\n }\n\n public void Solution(TextReader Input, TextWriter Output)\n {\n string s;\n s = Input.ReadLine();\n bool[] used = new bool[10];\n\n BigInteger[] fact = new BigInteger[11];\n fact[0] = fact[1] = 1;\n for (int i = 2; i <= 10; i++)\n fact[i] = fact[i - 1] * i;\n\n int x = 0;\n bool z = false;\n BigInteger ans = 1;\n\n if (s.Length == 1)\n {\n if ('0' <= s[0] && s[0] <= '9')\n Output.WriteLine(\"1\");\n else\n Output.WriteLine(\"9\");\n return;\n }\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '?')\n if (i == 0)\n ans *= 9;\n else\n ans *= 10;\n else\n if ('A' <= s[i] && s[i] <= 'Z')\n {\n int k = s[i] - 'A';\n if (!used[k])\n {\n x++;\n used[k] = true;\n }\n if (i == 0)\n z = true;\n }\n }\n\n if (!z)\n {\n BigInteger tmp = fact[10] / (fact[x] * fact[10 - x]);\n ans *= tmp;\n }\n else\n {\n BigInteger tmp = 9 * fact[9] / (fact[x - 1] * fact[10 - x]);\n ans *= tmp;\n }\n\n Output.WriteLine(ans.ToString());\n }\n}\n\n\nclass Program\n{\n public static void Main()\n {\n#if Local\n var inputStream = new StreamReader(@\"..\\..\\input.txt\");\n var outputStream = new StreamWriter(@\"..\\..\\output.txt\");\n\n new Problem().Solution(inputStream, outputStream);\n\n inputStream.Close();\n outputStream.Close();\n#else\n new Problem().Solution(Console.In, Console.Out);\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string st = Console.ReadLine();\n bool[] f = new bool[10];\n int ff = 10;\n long k=1;\n for (int i = 0; i < 10; i++)\n {\n f[i] = true;\n }\n for (int i = 0; i < st.Length; i++)\n {\n if (st[i] == '?')\n {\n k = k * 10;\n }\n if (st[i] >= 'A' && st[i] <= 'J')\n {\n if (ff > 0 && f[(int)st[i] - 65] == true)\n {\n if (i == 0)\n {\n k = k * 9;\n }\n else\n {\n k = k * ff;\n }\n ff--;\n }\n f[(int)st[i] - 65] = false;\n }\n }\n Console.WriteLine(k.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace abbycup1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring [] n9 = {\"9\", \"81\", \"648\", \"4536\", \"27216\", \"136080\", \"544320\", \"1632960\", \"326592\", \"326592\"};\n\t\t\tstring [] n10 = {\"10\", \"90\", \"720\", \"5040\", \"30240\", \"151200\", \"604800\", \"1814400\", \"3628800\", \"3628800\"};\n\t\t\tchar [] letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};\n\t\t\tbool nine = false;\n\t\t\tbool voprfirst=false;\n\t\t\tint count = 0;\n\t\t\tint voprcount=0;\n\t\t\t\n\t\t\tchar [] input = Console.ReadLine().ToCharArray();\n\t\t\t\n\t\t\tif ( Array.BinarySearch(letters, input[0]) >= 0 || input[0] == '?') {\n\t\t\t\tnine = true;\n\t\t\t}\n\t\t\t\n\t\t\tif ( input[0] == '?') {\n\t\t\t\tvoprfirst = true;\n\t\t\t}\n\t\t\t\n\t\t\tArray.Sort(input);\n\t\t\t\n\t\t\tfor (int i=0; i<=9; i++) {\n\t\t\t\tif (Array.BinarySearch(input, letters[i])>=0) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint vopr = Array.BinarySearch(input, '?');\n\t\t\tif (vopr>=0) {\n\t\t\t\tfor (int i=vopr; i0 && !voprfirst) {\n\t\t\t\tif (nine) {\n\t\t\t\t\tConsole.Write(n9[count-1]);\t\n\t\t\t\t} else {\n\t\t\t\t\tConsole.Write(n10[count-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (voprfirst && count==0) {\n\t\t\t\tConsole.Write(\"9\");\n\t\t\t}\n\t\t\t\n\t\t\tif (count==0 && !voprfirst) {\n\t\t\t\tConsole.Write(\"1\");\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i=0; i= 0 || input[0] == '?') {\n\t\t\t\tnine = true;\n\t\t\t}\n\t\t\t\n\t\t\tif ( input[0] == '?') {\n\t\t\t\tvoprfirst = true;\n\t\t\t}\n\t\t\t\n\t\t\tArray.Sort(input);\n\t\t\t\n\t\t\tfor (int i=0; i<=9; i++) {\n\t\t\t\tif (Array.BinarySearch(input, letters[i])>=0) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint vopr = Array.BinarySearch(input, '?');\n\t\t\tif (vopr>=0) {\n\t\t\t\tfor (int i=vopr; i0 && !voprfirst) {\n\t\t\t\tif (nine) {\n\t\t\t\t\tConsole.Write(n9[count-1]);\t\n\t\t\t\t} else {\n\t\t\t\t\tConsole.Write(n10[count-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (voprfirst) {\n\t\t\t\tConsole.Write(\"9\");\n\t\t\t}\n\t\t\t\n\t\t\tif (count==0 && !voprfirst) {\n\t\t\t\tConsole.Write(\"1\");\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i=0; i= 0 || input[0] == '?') {\n\t\t\t\tnine = true;\n\t\t\t}\n\t\t\t\n\t\t\tif ( input[0] == '?') {\n\t\t\t\tvoprfirst = true;\n\t\t\t}\n\t\t\t\n\t\t\tArray.Sort(input);\n\t\t\t\n\t\t\tfor (int i=0; i<=9; i++) {\n\t\t\t\tif (Array.BinarySearch(input, letters[i])>=0) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint vopr = Array.BinarySearch(input, '?');\n\t\t\tif (vopr>=0) {\n\t\t\t\tfor (int i=0; i0 && !voprfirst) {\n\t\t\t\tif (nine) {\n\t\t\t\t\tConsole.Write(n9[count-1]);\t\n\t\t\t\t} else {\n\t\t\t\t\tConsole.Write(n10[count-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (voprfirst && count==0) {\n\t\t\t\tConsole.Write(\"9\");\n\t\t\t}\n\t\t\t\n\t\t\tif (count==0 && !voprfirst) {\n\t\t\t\tConsole.Write(\"1\");\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i=1; i<=voprcount; i++) {\n\t\t\t\tConsole.Write(\"0\");\n\t\t\t}\n\t\t\tConsole.WriteLine(\"\");\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace abbycup1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring [] n9 = {\"9\", \"81\", \"648\", \"4536\", \"27216\", \"136080\", \"544320\", \"1632960\", \"326592\", \"326592\"};\n\t\t\tstring [] n10 = {\"10\", \"90\", \"720\", \"5040\", \"30240\", \"151200\", \"604800\", \"1814400\", \"3628800\", \"3628800\"};\n\t\t\tchar [] letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};\n\t\t\tbool nine = false;\n\t\t\tbool voprfirst=false;\n\t\t\tint count = 0;\n\t\t\tint voprcount=0;\n\t\t\t\n\t\t\tchar [] input = Console.ReadLine().ToCharArray();\n\t\t\t\n\t\t\tif ( Array.BinarySearch(letters, input[0]) >= 0 || input[0] == '?') {\n\t\t\t\tnine = true;\n\t\t\t}\n\t\t\t\n\t\t\tif ( input[0] == '?') {\n\t\t\t\tvoprfirst = true;\n\t\t\t}\n\t\t\t\n\t\t\tArray.Sort(input);\n\t\t\t\n\t\t\tfor (int i=0; i<=9; i++) {\n\t\t\t\tif (Array.BinarySearch(input, letters[i])>=0) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tint vopr = Array.BinarySearch(input, '?');\n\t\t\tif (vopr>=0) {\n\t\t\t\tfor (int i=vopr; i0) {\n\t\t\t\tif (nine) {\n\t\t\t\t\tConsole.Write(n9[count-1]);\t\n\t\t\t\t} else {\n\t\t\t\t\tConsole.Write(n10[count-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i=0; i= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n if (i == 0)\n {\n leadS = true;\n }\n if (!symb.Contains(currSymb))\n {\n symb.Add(currSymb, 0);\n }\n }\n }\n if (leadA)\n {\n combs = Math.Pow(10.0, q) * 9 * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n else if (leadS)\n {\n if (symb.Count == 1)\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((10.0 - symb.Count), symb.Count));\n }\n else if (symb.Count == 2)\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count ));\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count - 1)) * (10.0 - symb.Count);\n }\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n Console.WriteLine(combs);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine().ToUpper();\n double combs;\n double q = 0;\n bool leadA = false;\n bool leadS = false;\n Hashtable symb = new Hashtable();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n if (i == 0)\n {\n leadA = true;\n }\n else\n {\n q++;\n }\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n if (i == 0)\n {\n leadS = true;\n }\n if (!symb.Contains(currSymb))\n {\n symb.Add(currSymb, 0);\n }\n }\n }\n if (leadA)\n {\n combs = Math.Pow(10.0, q) * 9 * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n else if (leadS)\n {\n if (symb.Count == 1)\n {\n combs = Math.Pow(10.0, q) * 9;\n }\n else if (symb.Count == 2)\n {\n combs = Math.Pow(10.0, q) * 81;\n }\n else if (symb.Count == 3)\n {\n combs = Math.Pow(10.0, q) * 7*8*8;\n }\n else if (symb.Count == 4)\n {\n combs = Math.Pow(10.0, q) * 6*7*7*7;\n }\n else if (symb.Count == 5)\n {\n combs = Math.Pow(10.0, q) * 5*6*6*6*6;\n }\n else if (symb.Count == 6)\n {\n combs = Math.Pow(10.0, q) * 4*5*5*5*5*5;\n }\n else if (symb.Count == 7)\n {\n combs = Math.Pow(10.0, q) * 3*4*4*4*4*4*4;\n }\n else if (symb.Count == 8)\n {\n combs = Math.Pow(10.0, q) * 2*3*3*3*3*3*3*3;\n }\n else if (symb.Count == 9)\n {\n combs = Math.Pow(10.0, q) * 1*2*2*2*2*2*2*2*2;\n }\n else if (symb.Count == 10)\n {\n combs = Math.Pow(10.0, q);\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count - 1)) * (10.0 - symb.Count);\n }\n\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n Console.WriteLine(combs);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n double combs;\n double q = 0;\n Hashtable symb = new Hashtable();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n q++;\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n if (!symb.Contains(currSymb))\n {\n symb.Add(currSymb, 0);\n }\n }\n }\n combs = Math.Pow(10.0,q)*(Math.Pow((11.0 - symb.Count),symb.Count));\n Console.WriteLine(combs);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine().ToUpper();\n double combs;\n double q = 0;\n bool leadA = false;\n bool leadS = false;\n Hashtable symb = new Hashtable();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n if (i == 0)\n {\n leadA = true;\n }\n else\n {\n q++;\n }\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n if (i == 0)\n {\n leadS = true;\n }\n if (!symb.Contains(currSymb))\n {\n symb.Add(currSymb, 0);\n }\n }\n }\n if (leadA)\n {\n combs = Math.Pow(10.0, q) * 9 * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n else if (leadS)\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count - 1)) * (10.0 - symb.Count);\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n Console.WriteLine(combs);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine().ToUpper();\n double combs;\n double q = 0;\n bool leadA = false;\n bool leadS = false;\n Hashtable symb = new Hashtable();\n for (int i = 0; i < input.Length; i++)\n {\n Char currSymb = input[i];\n if (currSymb == '?')\n {\n if (i == 0)\n {\n leadA = true;\n }\n else\n {\n q++;\n }\n }\n else if ((Convert.ToByte(currSymb) >= 65) && (Convert.ToByte(currSymb) <= 74))\n {\n if (i == 0)\n {\n leadS = true;\n }\n if (!symb.Contains(currSymb))\n {\n symb.Add(currSymb, 0);\n }\n }\n }\n if (leadA)\n {\n combs = Math.Pow(10.0, q) * 9 * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n else if (leadS)\n {\n if (symb.Count == 1)\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((10.0 - symb.Count), symb.Count));\n }\n else if (symb.Count == 2)\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count ));\n }\n else if (symb.Count == 10)\n {\n combs = Math.Pow(10.0, q);\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count - 1)) * (10.0 - symb.Count);\n }\n\n }\n else\n {\n combs = Math.Pow(10.0, q) * (Math.Pow((11.0 - symb.Count), symb.Count));\n }\n Console.WriteLine(combs);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var s = Console.ReadLine();\n var alp = \"ABCDEFGHIJ\";\n HashSet hs = new HashSet();\n long res = 1;\n var rest = 10;\n if (s[0] == '?')\n {\n res = 9;\n }\n if(alp.Contains(s[0]))\n {\n res = 9;\n rest = 9;\n hs.Add(s[0]);\n }\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] == '?')\n {\n res *= 10;\n }\n if (alp.Contains(s[i]))\n {\n if (!hs.Contains(s[i]))\n {\n res *= rest;\n rest--;\n hs.Add(s[i]);\n }\n }\n }\n\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tlong ans = 1;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0)\n\t\t\t\tmul--;\n\t\t\tif(input[i] == '?')\n\t\t\t\tans *= i == 0 ? 9 : 10;\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J'){\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(){\n\t\tstring input = Console.ReadLine();\n\t\tint[] box = new int[10];\n\t\tint mul = 10;\n\t\tint ans = 1;\n\t\t\n\t\tfor(int i = 0; i < input.Length; i++){\n\t\t\tif(i == 0)\n\t\t\t\tmul--;\n\t\t\tif(input[i] == '?')\n\t\t\t\tans *= i == 0 ? 9 : 10;\n\t\t\tif(input[i] >= 'A' && input[i] <= 'J'){\n\t\t\t\tif(box[input[i] - 'A'] == 0){\n\t\t\t\t\tans *= mul;\n\t\t\t\t\tbox[input[i] - 'A']++;\n\t\t\t\t\tmul--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i == 0)\n\t\t\t\tmul++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace AcmSolution\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var s = Console.ReadLine();\n \n var was = new bool['Z' - 'A' + 1];\n long ans = 1;\n int wasCnt = 0;\n\n for (int i = 0; i < s.Length; ++i) if ('9' < s[i] || s[i] < '0')\n {\n if (s[i] == '?') \n ans *= i == 0 ? 9 : 10;\n else if (!was[s[i] - 'A'])\n {\n was[s[i] - 'A'] = true;\n \n ans *= i == 0 ? 9 : (10 - wasCnt);\n wasCnt++;\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ABBYY\n{\n class A\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n //BigInteger \n int codes = 1, zeroes = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c == '?')\n ++zeroes;\n else if (c >= 'A' && c <= 'J')\n if (!d.ContainsKey(c))\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n if (codes > 1)\n writer.Write(codes);\n for (int i = 0; i < zeroes; ++i)\n writer.Write(0);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ABBYY\n{\n class A\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n //BigInteger \n int codes = 1, zeroes = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c == '?')\n ++zeroes;\n else if (c >= 'A' && c <= 'J')\n if (!d.ContainsKey(c))\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n writer.Write(codes);\n for (int i = 0; i < zeroes; ++i)\n writer.Write(0);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ABBYY\n{\n class A\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n //BigInteger \n int codes = 1, zeroes = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c == '?')\n {\n if (i > 0)\n ++zeroes;\n else\n codes *= 9;\n }\n else if (c >= 'A' && c <= 'J')\n if (d.Count < 10 && !d.ContainsKey(c))\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n if (codes > 1)\n writer.Write(codes);\n for (int i = 0; i < zeroes; ++i)\n writer.Write(0);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ABBYY\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n // TODO: check the first zeroes\n int codes = 1;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c >= 'A' && c <= 'J')\n {\n if (d.ContainsKey(c))\n ++d[c];\n else\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n else if (c == '?')\n {\n if (i > 0)\n codes *= 10;\n else\n codes *= 9;\n }\n }\n writer.Write(codes);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nnamespace ABBYY\n{\n class A\n {\n static void Main(string[] args)\n {\n#if ONLINE_JUDGE\n var reader = Console.In;\n var writer = Console.Out;\n#else\n StreamReader reader = new StreamReader(\"input.txt\");\n StreamWriter writer = new StreamWriter(\"output.txt\");\n#endif\n string s = reader.ReadLine();\n reader.Close();\n Dictionary d = new Dictionary();\n //BigInteger \n int codes = 1, zeroes = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n char c = s[i];\n if (c == '?')\n {\n if (i > 0)\n ++zeroes;\n else\n codes *= 9;\n }\n else if (c >= 'A' && c <= 'J')\n if (d.Count < 10 && !d.ContainsKey(c))\n {\n if (i > 0)\n codes *= 10 - d.Count;\n else\n codes *= 9;\n d.Add(c, 1);\n }\n }\n if (codes > 1 || zeroes == 0)\n writer.Write(codes);\n for (int i = 0; i < zeroes; ++i)\n writer.Write(0);\n writer.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n HashSet letset = new HashSet();\n int k = 0;\n int kq = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n\n if (s[i] >= 'A' && s[i] <= 'J' && !letset.Contains(s[i]))\n {\n letset.Add(s[i]);\n k++;\n }\n\n if (s[i] == '?')\n kq++;\n\n }\n BigInteger ans = BigInteger.One; \n BigInteger m = BigInteger.Multiply(ans, 9);;\n \n\n for (int i = 0; i < k-1; i++)\n {\n \n ans = BigInteger.Multiply(ans,m);\n m = BigInteger.Subtract(m,BigInteger.One);\n\n }\n\n BigInteger ten = binpow(10, kq); \n ans = BigInteger.Multiply(ans,ten); \n\n if(s[0]>='0' && s[0]<='9' )\n {\n Console.Write(BigInteger.Multiply(ans,10));\n }\n else\n {\n Console.WriteLine(BigInteger.Multiply(ans,9));\n }\n\n // Console.ReadKey();\n }\n public static BigInteger binpow(BigInteger a, int n)\n {\n BigInteger res = 1;\n while (n>0)\n {\n if (n % 2 !=0)\n res = BigInteger.Multiply(res,a);\n a = BigInteger.Multiply(a,a);\n n >>= 1;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n HashSet letset = new HashSet();\n int k = 0;\n int kq = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n\n if (s[i] >= 'A' && s[i] <= 'J' && !letset.Contains(s[i]))\n {\n letset.Add(s[i]);\n k++;\n }\n\n if (s[i] == '?')\n kq++;\n\n }\n if (k == 0 && kq == 0) { Console.WriteLine(1); return; }\n\n BigInteger ans = BigInteger.One;\n BigInteger m = BigInteger.Multiply(ans, 9); ;\n\n\n for (int i = 0; i < k - 1; i++)\n {\n\n ans = BigInteger.Multiply(ans, m);\n m = BigInteger.Subtract(m, BigInteger.One);\n\n }\n\n BigInteger ten = binpow(10, kq);\n ans = BigInteger.Multiply(ans, ten);\n\n if (s[0] >= '0' && s[0] <= '9')\n {\n Console.WriteLine(BigInteger.Multiply(ans, 10));\n }\n else\n {\n Console.WriteLine(BigInteger.Multiply(ans, 9));\n }\n\n // Console.ReadKey();\n }\n public static BigInteger binpow(BigInteger a, int n)\n {\n BigInteger res = 1;\n while (n > 0)\n {\n if (n % 2 != 0)\n res = BigInteger.Multiply(res, a);\n a = BigInteger.Multiply(a, a);\n n >>= 1;\n }\n return res;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n HashSet letset = new HashSet();\n int k = 0;\n int kq = 0;\n for (int i = 0; i < s.Length; ++i)\n {\n\n if (s[i] >= 'A' && s[i] <= 'J' && !letset.Contains(s[i]))\n {\n letset.Add(s[i]);\n k++;\n }\n\n if (s[i] == '?')\n kq++;\n\n }\n BigInteger ans = BigInteger.One;\n BigInteger m = BigInteger.Multiply(ans, 10); ;\n\n\n for (int i = 0; i < k; i++)\n {\n ans = BigInteger.Multiply(ans, m);\n m = BigInteger.Subtract(m, BigInteger.One);\n\n }\n\n \n\n if (s[0] >= '0' && s[0] <= '9')\n {\n Console.Write(ans);\n for (int i = 0; i < kq; i++) Console.Write(\"0\");\n }\n else\n {\n Console.Write(BigInteger.Multiply(BigInteger.Divide(ans, 10), 9));\n for (int i = 0; i < kq; i++) Console.Write(\"0\");\n }\n\n // Console.ReadKey();\n }\n public static BigInteger binpow(BigInteger a, int n)\n {\n BigInteger res = 1;\n while (n > 0)\n {\n if (n % 2 != 0)\n res = BigInteger.Multiply(res, a);\n a = BigInteger.Multiply(a, a);\n n >>= 1;\n }\n return res;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp\n{\n class Program\n {\n static void Main()\n {\n string input = Console.ReadLine();\n int[] count=new int[11];\n\n int length = input.Length;\n int ans = 1, flag=0;\n\n if (input[0] == '?')\n ans = 9;\n\n if (input[0] >= 'A' && input[0] <= 'J')\n {\n int temp = input[0];\n count[temp - 'A']++;\n flag = 1;\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == '?')\n ans = ans * 10;\n if (input[i] >= 'A' && input[i] <= 'J')\n {\n int temp = input[i];\n count[temp - 'A']++;\n }\n \n }\n\n if (flag == 0)\n {\n int start = 10;\n for (int i = 0; i < types(count); i++)\n {\n ans *= start;\n start--;\n }\n }\n else\n {\n int total = types(count);\n if (total == 1)\n ans *= 9;\n if (total > 1)\n { \n ans *= 9;\n int start = 9;\n for (int i = 1; i < total; i++)\n {\n ans *= start;\n start--;\n }\n }\n \n }\n\n Console.WriteLine(ans);\n }\n\n static int types(int[] count)\n {\n int total=0;\n for (int i = 0; i < 10; i++)\n {\n if (count[i] > 0)\n total++;\n }\n \n return total;\n }\n }\n}\n"}], "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Sign_Posts\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var a = new long[n];\n var b = new long[n];\n var c = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n b[i] = Next();\n c[i] = Next();\n }\n\n var remain = new List(n);\n for (int i = 0; i < n; i++)\n {\n remain.Add(i);\n }\n\n var result = new List>();\n\n for (int kk = 0; kk < k; kk++)\n {\n if (remain.Count < 2)\n {\n if (remain.Count == 1)\n {\n result.Add(new Tuple(remain[0], -2));\n }\n remain.Clear();\n break;\n }\n\n int max = Math.Min(remain.Count, 100);\n\n var list = new List();\n for (int ii = 0; ii < max; ii++)\n {\n int i = remain[ii];\n for (int jj = ii + 1; jj < max; jj++)\n {\n int j = remain[jj];\n long l1 = a[i]*b[j] - a[j]*b[i];\n if (l1 == 0)\n continue;\n\n long r1 = c[i]*b[j] - c[j]*b[i];\n long r2 = c[i]*a[j] - c[j]*a[i];\n\n list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));\n }\n }\n\n if (list.Count == 0)\n {\n result.Add(new Tuple(remain[remain.Count - 1], -2));\n remain.RemoveAt(remain.Count - 1);\n }\n else\n {\n max = 0;\n\n list.Sort(list[0]);\n\n int count = 1;\n int mc = 1;\n for (int i = 1; i < list.Count; i++)\n {\n if (list[i].Compare(list[i], list[i - 1]) == 0)\n {\n count++;\n }\n else\n {\n if (count > mc)\n {\n mc = count;\n max = i - 1;\n }\n count = 1;\n }\n }\n\n result.Add(new Tuple(list[max]._i1, list[max]._i2));\n var remain1 = new List(n);\n\n foreach (int i in remain)\n {\n if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)\n {\n remain1.Add(i);\n }\n }\n\n remain = remain1;\n }\n }\n\n if (remain.Count != 0)\n {\n writer.WriteLine(\"NO\");\n }\n else\n {\n writer.WriteLine(\"YES\");\n writer.WriteLine(result.Count);\n\n foreach (var tuple in result)\n {\n writer.Write(tuple.Item1 + 1);\n writer.Write(' ');\n writer.WriteLine(tuple.Item2 + 1);\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n\n #region Nested type: Point\n\n private class Point : IComparer\n {\n public readonly int _i1;\n public readonly int _i2;\n public readonly Rational x;\n public readonly Rational y;\n\n public Point(Rational x, Rational y, int i1, int i2)\n {\n this.x = x;\n this.y = y;\n _i1 = i1;\n _i2 = i2;\n }\n\n #region IComparer Members\n\n public int Compare(Point x, Point y)\n {\n int c = x.x.Compare(x.x, y.x);\n if (c == 0)\n c = x.x.Compare(x.y, y.y);\n return c;\n }\n\n #endregion\n }\n\n #endregion\n\n #region Nested type: Rational\n\n private class Rational : IComparer\n {\n public readonly long p;\n public readonly long q;\n\n public Rational(long p, long q)\n {\n long g = gcd(p, q);\n this.p = p/g;\n this.q = q/g;\n }\n\n #region IComparer Members\n\n public int Compare(Rational x, Rational y)\n {\n return (x.p*y.q).CompareTo(x.q*y.p);\n }\n\n #endregion\n\n private long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n return gcd(b, a%b);\n }\n }\n\n #endregion\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Sign_Posts\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var a = new long[n];\n var b = new long[n];\n var c = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n b[i] = Next();\n c[i] = Next();\n }\n\n var remain = new List(n);\n for (int i = 0; i < n; i++)\n {\n remain.Add(i);\n }\n\n var result = new List>();\n\n for (int kk = 0; kk < k; kk++)\n {\n if (remain.Count < 2)\n {\n if (remain.Count == 1)\n {\n result.Add(new Tuple(remain[0], -2));\n }\n remain.Clear();\n break;\n }\n\n int max = Math.Min(remain.Count, 30);\n\n var list = new List();\n for (int ii = 0; ii < max; ii++)\n {\n int i = remain[ii];\n for (int jj = ii + 1; jj < max; jj++)\n {\n int j = remain[jj];\n long l1 = a[i]*b[j] - a[j]*b[i];\n if (l1 == 0)\n continue;\n\n long r1 = c[i]*b[j] - c[j]*b[i];\n long r2 = c[i]*a[j] - c[j]*a[i];\n\n list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));\n }\n }\n\n if (list.Count == 0)\n {\n result.Add(new Tuple(remain[remain.Count - 1], -2));\n remain.RemoveAt(remain.Count - 1);\n }\n else\n {\n max = 0;\n\n list.Sort(list[0]);\n\n int count = 1;\n int mc = 1;\n for (int i = 1; i < list.Count; i++)\n {\n if (list[i].Compare(list[i], list[i - 1]) == 0)\n {\n count++;\n }\n else\n {\n if (count > mc)\n {\n mc = count;\n max = i - 1;\n }\n count = 1;\n }\n }\n\n result.Add(new Tuple(list[max]._i1, list[max]._i2));\n var remain1 = new List(n);\n\n foreach (int i in remain)\n {\n if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)\n {\n remain1.Add(i);\n }\n }\n\n remain = remain1;\n }\n }\n\n if (remain.Count != 0)\n {\n writer.WriteLine(\"NO\");\n }\n else\n {\n writer.WriteLine(\"YES\");\n writer.WriteLine(result.Count);\n\n foreach (var tuple in result)\n {\n writer.Write(tuple.Item1 + 1);\n writer.Write(' ');\n writer.WriteLine(tuple.Item2 + 1);\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n\n #region Nested type: Point\n\n private class Point : IComparer\n {\n public readonly int _i1;\n public readonly int _i2;\n public readonly Rational x;\n public readonly Rational y;\n\n public Point(Rational x, Rational y, int i1, int i2)\n {\n this.x = x;\n this.y = y;\n _i1 = i1;\n _i2 = i2;\n }\n\n #region IComparer Members\n\n public int Compare(Point x, Point y)\n {\n int c = x.x.Compare(x.x, y.x);\n if (c == 0)\n c = x.x.Compare(x.y, y.y);\n return c;\n }\n\n #endregion\n }\n\n #endregion\n\n #region Nested type: Rational\n\n private class Rational : IComparer\n {\n public readonly long p;\n public readonly long q;\n\n public Rational(long p, long q)\n {\n long g = gcd(p, q);\n this.p = p/g;\n this.q = q/g;\n }\n\n #region IComparer Members\n\n public int Compare(Rational x, Rational y)\n {\n return (x.p*y.q).CompareTo(x.q*y.p);\n }\n\n #endregion\n\n private long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n return gcd(b, a%b);\n }\n }\n\n #endregion\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Sign_Posts\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var a = new long[n];\n var b = new long[n];\n var c = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n b[i] = Next();\n c[i] = Next();\n }\n\n var remain = new List(n);\n for (int i = 0; i < n; i++)\n {\n remain.Add(i);\n }\n\n var result = new List>();\n\n for (int kk = 0; kk < k; kk++)\n {\n if (remain.Count < 2)\n {\n if (remain.Count == 1)\n {\n result.Add(new Tuple(remain[0], -2));\n }\n remain.Clear();\n break;\n }\n\n int max = Math.Min(remain.Count, 100);\n\n var list = new List();\n for (int i = 0; i < max; i++)\n {\n for (int j = i + 1; j < max; j++)\n {\n long l1 = a[i]*b[j] - a[j]*b[i];\n if (l1 == 0)\n continue;\n\n long r1 = c[i]*b[j] - c[j]*b[i];\n long r2 = c[i]*a[j] - c[j]*a[i];\n\n list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));\n }\n }\n\n if (list.Count == 0)\n {\n result.Add(new Tuple(remain[remain.Count - 1], -2));\n remain.RemoveAt(remain.Count - 1);\n }\n else\n {\n max = 0;\n\n list.Sort(list[0]);\n\n int count = 1;\n int mc = 1;\n for (int i = 1; i < list.Count; i++)\n {\n if (list[i].Compare(list[i], list[i - 1]) == 0)\n {\n count++;\n }\n else\n {\n if (count > mc)\n {\n mc = count;\n max = i - 1;\n }\n count = 1;\n }\n }\n\n result.Add(new Tuple(list[max]._i1, list[max]._i2));\n var remain1 = new List(n);\n\n foreach (int i in remain)\n {\n if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)\n {\n remain1.Add(i);\n }\n }\n\n remain = remain1;\n }\n }\n\n if (remain.Count != 0)\n {\n writer.WriteLine(\"NO\");\n }\n else\n {\n writer.WriteLine(\"YES\");\n writer.WriteLine(result.Count);\n\n foreach (var tuple in result)\n {\n writer.Write(tuple.Item1 + 1);\n writer.Write(' ');\n writer.WriteLine(tuple.Item2 + 1);\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n\n #region Nested type: Point\n\n private class Point : IComparer\n {\n public readonly int _i1;\n public readonly int _i2;\n public readonly Rational x;\n public readonly Rational y;\n\n public Point(Rational x, Rational y, int i1, int i2)\n {\n this.x = x;\n this.y = y;\n _i1 = i1;\n _i2 = i2;\n }\n\n #region IComparer Members\n\n public int Compare(Point x, Point y)\n {\n int c = x.x.Compare(x.x, y.x);\n if (c == 0)\n c = x.x.Compare(x.y, y.y);\n return c;\n }\n\n #endregion\n }\n\n #endregion\n\n #region Nested type: Rational\n\n private class Rational : IComparer\n {\n public readonly long p;\n public readonly long q;\n\n public Rational(long p, long q)\n {\n long g = gcd(p, q);\n this.p = p/g;\n this.q = q/g;\n }\n\n #region IComparer Members\n\n public int Compare(Rational x, Rational y)\n {\n return (x.p*y.q).CompareTo(x.q*y.p);\n }\n\n #endregion\n\n private long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n return gcd(b, a%b);\n }\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Sign_Posts\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n var a = new long[n];\n var b = new long[n];\n var c = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = Next();\n b[i] = Next();\n c[i] = Next();\n }\n\n var remain = new List(n);\n for (int i = 0; i < n; i++)\n {\n remain.Add(i);\n }\n\n var result = new List>();\n\n for (int kk = 0; kk < k; kk++)\n {\n if (remain.Count < 3)\n {\n if (remain.Count == 1)\n {\n result.Add(new Tuple(remain[0], -2));\n }\n else if (remain.Count == 2)\n {\n result.Add(new Tuple(remain[0], remain[1]));\n }\n remain.Clear();\n break;\n }\n\n int max = Math.Min(remain.Count, 100);\n\n var list = new List();\n for (int i = 0; i < max; i++)\n {\n for (int j = i + 1; j < max; j++)\n {\n long l1 = a[i]*b[j] - a[j]*b[i];\n if (l1 == 0)\n continue;\n\n long r1 = c[i]*b[j] - c[j]*b[i];\n long r2 = c[i]*a[j] - c[j]*a[i];\n\n list.Add(new Point(new Rational(-r1, l1), new Rational(-r2, -l1), i, j));\n }\n }\n\n if (list.Count == 0)\n {\n result.Add(new Tuple(remain[remain.Count - 1], -2));\n remain.RemoveAt(remain.Count - 1);\n }\n else\n {\n max = 0;\n\n int count = 1;\n int mc = 1;\n for (int i = 1; i < list.Count; i++)\n {\n if (list[i].Compare(list[i], list[i - 1]) == 0)\n {\n count++;\n }\n else\n {\n if (count > mc)\n {\n mc = count;\n max = i - 1;\n }\n count = 1;\n }\n }\n\n result.Add(new Tuple(list[max]._i1, list[max]._i2));\n var remain1 = new List(n);\n\n foreach (int i in remain)\n {\n if (a[i]*list[max].x.p*list[max].y.q + b[i]*list[max].y.p*list[max].x.q + c[i]*list[max].x.q*list[max].y.q != 0)\n {\n remain1.Add(i);\n }\n }\n\n remain = remain1;\n }\n }\n\n if (remain.Count != 0)\n {\n writer.WriteLine(\"NO\");\n }\n else\n {\n writer.WriteLine(\"YES\");\n writer.WriteLine(result.Count);\n\n foreach (var tuple in result)\n {\n writer.Write(tuple.Item1 + 1);\n writer.Write(' ');\n writer.WriteLine(tuple.Item2 + 1);\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n #region Nested type: Point\n\n private class Point : IComparer\n {\n public readonly int _i1;\n public readonly int _i2;\n public readonly Rational x;\n public readonly Rational y;\n\n public Point(Rational x, Rational y, int i1, int i2)\n {\n this.x = x;\n this.y = y;\n _i1 = i1;\n _i2 = i2;\n }\n\n #region IComparer Members\n\n public int Compare(Point x, Point y)\n {\n int c = x.x.Compare(x.x, y.x);\n if (c == 0)\n c = x.x.Compare(x.y, y.y);\n return c;\n }\n\n #endregion\n }\n\n #endregion\n\n #region Nested type: Rational\n\n private class Rational : IComparer\n {\n public readonly long p;\n public readonly long q;\n\n public Rational(long p, long q)\n {\n long g = gcd(p, q);\n this.p = p/g;\n this.q = q/g;\n }\n\n #region IComparer Members\n\n public int Compare(Rational x, Rational y)\n {\n return (x.p*y.q).CompareTo(x.q*y.p);\n }\n\n #endregion\n\n private long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n return gcd(b, a%b);\n }\n }\n\n #endregion\n }\n}"}], "src_uid": "dea5c9eded04f1a900c37571d20b34e2"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static int kachestvo(int n)\n {\n if (n == 0 || n == 2 || n == 9 || n == 6) return 2;\n else\n if (n == 1) return 7;\n else\n if (n == 3 || n == 4) return 3;\n else\n if (n == 5) return 4;\n else\n if (n == 7) return 5;\n else return 1;\n\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(kachestvo(n / 10) * kachestvo(n % 10));\n\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = a % 10;\n int c = ((a % 100) - b) / 10;\n int [] ar = { 2,7,2,3,3,4,2,5,1,2 };\n Console.WriteLine(ar[b] * ar[c]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DigitalCounter\n{\n class Program\n {\n static bool CanBe(List faulty, List correct)\n {\n bool valid = true;\n for (int i = 0; i < 7 && valid; i++)\n {\n if (correct[i] - faulty[i] < 0)\n valid = false;\n }\n return (valid) ? true : false;\n }\n\n static void Main(string[] args)\n {\n //initializing correspondence table\n var digitStickTable = new Dictionary>();\n digitStickTable.Add('0', new List() { 1, 1, 1, 1, 1, 1, 0 });\n digitStickTable.Add('1', new List() { 0, 1, 1, 0, 0, 0, 0 });\n digitStickTable.Add('2', new List() { 1, 1, 0, 1, 1, 0, 1 });\n digitStickTable.Add('3', new List() { 1, 1, 1, 1, 0, 0, 1 });\n digitStickTable.Add('4', new List() { 0, 1, 1, 0, 0, 1, 1 });\n digitStickTable.Add('5', new List() { 1, 0, 1, 1, 0, 1, 1 });\n digitStickTable.Add('6', new List() { 1, 0, 1, 1, 1, 1, 1 });\n digitStickTable.Add('7', new List() { 1, 1, 1, 0, 0, 0, 0 });\n digitStickTable.Add('8', new List() { 1, 1, 1, 1, 1, 1, 1 });\n digitStickTable.Add('9', new List() { 1, 1, 1, 1, 0, 1, 1 });\n\n //reading user entries\n char[] number = Console.ReadLine().ToCharArray();\n int result = 0;\n foreach (char digit in digitStickTable.Keys)\n if (CanBe(digitStickTable[number[0]], digitStickTable[digit]))\n {\n result++;\n }\n\n if (number[1] == number[0])\n result *= result;\n else\n {\n int secondDigit = 0;\n foreach (char digit in digitStickTable.Keys)\n if (CanBe(digitStickTable[number[1]], digitStickTable[digit]))\n {\n secondDigit++;\n }\n if (secondDigit > 0 && result > 0) result *= secondDigit;\n else result += secondDigit;\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplicationOLIMP\n{\n class Program\n {\n static int Main(string[] args)\n {\n int[] a = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n int b;\n b = int.Parse(Console.ReadLine());\n Console.WriteLine(a[b % 10]*a[b / 10]);\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Round_282\n{\n class Program\n {\n static void Main(string[] args)\n {\n Digit g = new Digit();\n g.Test();\n }\n }\n class Digit\n {\n int Transform(int a, int b)\n {\n int res=0;\n switch (b)//transform to\n {\n case 0:\n switch(a)//transform from\n {\n case 0: res= 1;break;\n case 8: res=1 ;break;\n }\n break;\n case 1:\n switch (a)\n {\n case 0: res= 1;break;\n case 1: res= 1;break;\n case 3: res= 1;break;\n case 4: res= 1;break;\n case 7:res= 1;break;\n case 8: res= 1;break;\n case 9: res= 1;break;\n }\n break;\n \n case 2:\n switch(a)\n {\n case 2: res= 1;break;\n case 8: res= 1;break;\n }\n break;\n \n case 3:\n switch(a)\n {\n case 3: res= 1;break;\n case 8: res= 1;break;\n case 9: res= 1;break;\n }\n break;\n \n case 4:\n switch(a)\n {\n case 4: return 1;\n case 8: return 1;\n case 9: return 1;\n }\n break;\n \n case 5:\n switch (a)\n {\n case 5: return 1;\n case 6: return 1;\n case 8: return 1;\n case 9: return 1;\n }\n break;\n \n case 6:\n switch (a)\n {\n case 6: return 1;\n case 8: return 1;\n }\n break;\n \n case 7:\n switch(a)\n {\n case 0: return 1;\n case 3: return 1;\n case 7:return 1;\n case 8:return 1;\n case 9: return 1;\n }\n break;\n \n case 8:\n switch(a)\n {\n case 8:return 1;\n }\n break;\n \n case 9:\n switch(a)\n {\n case 8: return 1;\n case 9: return 1;\n }\n break;\n \n }\n return res;\n }\n int NumGood(int b)\n {\n int cnt = 0;\n for(int i=0;i<10;i++)\n {\n cnt += Transform(i, b);\n }\n return cnt;\n }\n public void Test()\n {\n int nn = int.Parse(Console.ReadLine());\n //int nn = 73;\n int n1 = NumGood(nn / 10);\n int n2 = NumGood(nn % 10);\n Console.WriteLine( (n1) * (n2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input);\n int a = n / 10;\n int b = n % 10;\n int res = 1;\n if (a == 0) res *= 2;\n if (a == 1) res *= 7;\n if (a == 2) res *= 2;\n if (a == 3) res *= 3;\n if (a == 4) res *= 3;\n if (a == 5) res *= 4;\n if (a == 6) res *= 2;\n if (a == 7) res *= 5;\n if (a == 8) res *= 1;\n if (a == 9) res *= 2;\n if (b == 0) res *= 2;\n if (b == 1) res *= 7;\n if (b == 2) res *= 2;\n if (b == 3) res *= 3;\n if (b == 4) res *= 3;\n if (b == 5) res *= 4;\n if (b == 6) res *= 2;\n if (b == 7) res *= 5;\n if (b == 8) res *= 1;\n if (b == 9) res *= 2;\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int[] d = {2, 1 + 1 + 1 + 1 + 1 + 1 + 1, 1 + 1, 1 + 1 + 1, 1 + 1 + 1, 1 + 1 + 1 + 1, 1 + 1, 1 + 1 + 1 + 1 + 1, 1, 1 + 1};\n string s = reader.ReadLine();\n int ans = d[s[0] - '0'] * d[s[1] - '0'];\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int f = Convert.ToInt32(Console.ReadLine());\n int f1 = f / 10;\n int f2 = f % 10;\n int[] p = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n\n Console.WriteLine(p[f1] * p[f2]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n //int t = int.Parse(Console.ReadLine());\n int a = Console.Read() - '0',\n b = Console.Read() - '0';\n\n var transform = new List\n {\n 2,//0\n 7,//1\n 2,//2\n 3,//3\n 3,//4\n 4,//5\n 2,//6\n 5,//7\n 1,//8\n 2 //9\n };\n\n Console.WriteLine(transform[a] * transform[b]);\n }\n }\n\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n { \n int n = Convert.ToInt32(Console.ReadLine());\n int b = n % 10;\n int a = (n - b) / 10;\n int[] s = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n Console.WriteLine(s[a]*s[b]);\n Console.ReadLine();\n\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n var a = new[] {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n\n int n = ReadInt();\n return a[n / 10] * a[n % 10];\n\n return null;\n }\n\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"improvements.in\");\n //writer = new StreamWriter(\"improvements.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var ar = new int[] { 126, 48, 109, 121, 51, 91, 95, 112, 127, 123 };\n var an = 0;\n var bn = 0;\n var d = int.Parse(Console.ReadLine());\n var b = ar[d % 10];\n d /= 10;\n var a = ar[d % 10];\n foreach (var item in ar)\n {\n if ((a & item) >= a)\n {\n an++;\n }\n if ((b & item) >= b)\n {\n bn++;\n }\n }\n Console.WriteLine(an * bn);\n }\n}\n"}, {"source_code": "using System;\nnamespace CodeForces{\n class Contest {\n static void Main(string [] Args) { \n string s = Console.ReadLine();\n int[] dig = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n Console.Write(dig[s[0]-'0']*dig[s[1]-'0']); \n }\n }\n}"}, {"source_code": "using System;\nnamespace CodeForces{\n class Contest {\n static void Main(string [] Args) { \n string s = Console.ReadLine();\n int[] dig = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n int a = s[0]-'0';\n int b = s[1]-'0';\n Console.Write(string.Format(\"{0}\", dig[a] * dig[b])); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b=a%10 ;\n int c = (a - b) / 10;\n int[] ar = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n Console.WriteLine(ar[b] * ar[c]);\n Console.ReadLine();\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace main\n{\n class Program\n {\n static void Main()\n {\n int[] a = new int[10] { 2,7,2,3,3,4,2,5,1,2 };\n int x = Convert.ToInt32(Console.ReadLine());\n int q = x/10;\n int t = x%10;\n Console.WriteLine(a[q]*a[t]);\n \n \n \n //int p = Convert.ToInt32(Console.ReadLine());\n \n //Console.WriteLine(str1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Sockets;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Threading;\n\nnamespace IntoToCSharp\n{\n class Source\n {\n static void Main(string[] args)\n {\n Dictionary dic = new Dictionary ();\n dic.Add(0, 2);\n dic.Add(1, 7);\n dic.Add(2, 2);\n dic.Add(3, 3);\n dic.Add(4, 3);\n dic.Add(5, 4);\n dic.Add(6, 2);\n dic.Add(7, 5);\n dic.Add(8, 1);\n dic.Add(9, 2);\n\n string s = Console.ReadLine();\n \n int ans = dic[(int)s[0] - 48];\n ans *= dic[(int)s[1] - 48];\n \n Console.Write(ans);\n\n } \n \n }\n \n \n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic double p;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\n\t\t\tvar n = getInt();\n\t\t\tvar a = n/10;\n\t\t\tvar b = n%10;\n\t\t\tvar ct1 = 0;\n\t\t\tvar ct2 = 0;\n\t\t\tif (a == 0)\n\t\t\t{\n\t\t\t\tct1 = 2;\n\t\t\t}\n\t\t\tif (a == 1)\n\t\t\t{\n\t\t\t\tct1 = 7;\n\t\t\t}\n\t\t\tif (a == 2)\n\t\t\t\tct1 = 2;\n\t\t\tif (a == 3)\n\t\t\t\tct1 = 3;\n\t\t\tif (a == 4)\n\t\t\t\tct1 = 3;\n\t\t\tif (a == 5)\n\t\t\t\tct1 = 4;\n\t\t\tif (a == 6)\n\t\t\t\tct1 = 2;\n\t\t\tif (a == 7)\n\t\t\t\tct1 = 5;\n\t\t\tif (a == 8)\n\t\t\t\tct1 = 1;\n\t\t\tif (a == 9)\n\t\t\t\tct1 = 2;\n\t\t\tif (b == 0)\n\t\t\t{\n\t\t\t\tct2 = 2;\n\t\t\t}\n\t\t\tif (b == 1)\n\t\t\t{\n\t\t\t\tct2 = 7;\n\t\t\t}\n\t\t\tif (b == 2)\n\t\t\t\tct2 = 2;\n\t\t\tif (b == 3)\n\t\t\t\tct2 = 3;\n\t\t\tif (b == 4)\n\t\t\t\tct2 = 3;\n\t\t\tif (b == 5)\n\t\t\t\tct2 = 4;\n\t\t\tif (b == 6)\n\t\t\t\tct2 = 2;\n\t\t\tif (b == 7)\n\t\t\t\tct2 = 5;\n\t\t\tif (b == 8)\n\t\t\t\tct2 = 1;\n\t\t\tif (b == 9)\n\t\t\t\tct2 = 2;\n\t\t\tConsole.WriteLine(ct1 * ct2);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nclass CFR282D2A\n{\n private static int[] a = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n static void Main(string[] args)\n {\n string data = Console.ReadLine();\n int a1 = a[int.Parse(data[0] + \"\")];\n int a2 = a[int.Parse(data[1] + \"\")];\n Console.WriteLine(a1 * a2);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _495A\n {\n static int[] map = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(map[n / 10] * map[n % 10]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problem495A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int[] options = new int[] {\n 2,\n 7,\n 2,\n 3,\n 3,\n 4,\n 2,\n 5,\n 1,\n 2\n };\n\n int firstDigit = n / 10;\n int secondDigit = n % 10;\n\n Console.WriteLine(options[firstDigit] * options[secondDigit]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Security.Policy;\n\nnamespace ConsoleApplication3\n{\n internal class NumberIndicator\n {\n public static List Numbers = new List\n {\n new byte[] {1, 1, 1, 1, 1, 1, 0},\n new byte[] {0, 0, 1, 1, 0, 0, 0},\n new byte[] {0, 1, 1, 0, 1, 1, 1},\n new byte[] {0, 1, 1, 1, 1, 0, 1},\n new byte[] {1, 0, 1, 1, 0, 0, 1},\n new byte[] {1, 1, 0, 1, 1, 0, 1},\n new byte[] {1, 1, 0, 1, 1, 1, 1},\n new byte[] {0, 1, 1, 1, 0, 0, 0},\n new byte[] {1, 1, 1, 1, 1, 1, 1},\n new byte[] {1, 1, 1, 1, 1, 0, 1},\n };\n\n public static int FindGoodNumbers(int first, int second)\n {\n var firstBinaryNum = Numbers.ElementAt(first);\n var secondBinaryNum = Numbers.ElementAt(second);\n\n var firstResult = 0;\n var secondResult = 0;\n foreach (var number in Numbers)\n {\n var addFirst = true;\n var addSecond = true;\n for (var i = 0; i < number.Length; i++)\n {\n if (firstBinaryNum[i] == 1 && number[i] != 1)\n {\n addFirst = false;\n }\n if (secondBinaryNum[i] == 1 && number[i] != 1)\n {\n addSecond = false;\n }\n }\n if (addFirst)\n {\n firstResult++;\n }\n if (addSecond)\n {\n secondResult++;\n }\n }\n return firstResult*secondResult;\n }\n\n private static void Main(string[] args)\n {\n var stringNumber = Console.ReadLine();\n if (stringNumber == null) return;\n var result = FindGoodNumbers((int) Char.GetNumericValue(stringNumber[0]),\n (int) Char.GetNumericValue(stringNumber[1]));\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Grimlor.CodeForces\n{\n class DigitalRoomForError\n {\n private static int[] _possibleDigits = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n public static void Main(string[] args)\n {\n string elevatorDigits = Console.ReadLine();\n int firstDigit = int.Parse(elevatorDigits[0].ToString());\n int secondDigit = int.Parse(elevatorDigits[1].ToString());\n Console.WriteLine(_possibleDigits[firstDigit] * _possibleDigits[secondDigit]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _13._12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n string s = Console.ReadLine();\n if (s.Length == 2 && s[0] >= '0' && s[0] <= '9' && s[1] >= '0' && s[1] <= '9')\n {\n int a1 = Convert.ToInt32(s[0].ToString());\n int a2 = Convert.ToInt32(s[1].ToString());\n Console.WriteLine(a[a1] * a[a2]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n public static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Dictionary dictionary = new Dictionary();\n dictionary.Add('0', 2);\n dictionary.Add('1', 7);\n dictionary.Add('2', 2);\n dictionary.Add('3', 3);\n dictionary.Add('4', 3);\n dictionary.Add('5', 4);\n dictionary.Add('6', 2);\n dictionary.Add('7', 5);\n dictionary.Add('8', 1);\n dictionary.Add('9', 2);\n Console.WriteLine((dictionary[input[0]] * dictionary[input[1]]));\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace DigitalCounter\n{\n partial class DigitalCounter\n {\n static void Main(string[] args)\n {\n string number;\n int count1, count2;\n\n number = ReadLine();\n\n count1 = GetSticksCount(number[0] - 48).Length;\n count2 = GetSticksCount(number[1] - 48).Length;\n\n Console.WriteLine(count1 * count2);\n }\n\n private static int[] GetSticksCount(int number)\n {\n switch (number)\n {\n case 0:\n return new[] { 0, 8 };\n\n case 1:\n return new[] { 0, 1, 3, 4, 7, 8, 9 };\n\n case 2:\n return new[] { 2, 8 };\n\n case 3:\n case 4:\n return new[] { 3, 8, 9 };\n\n case 5:\n return new[] { 5, 6, 8, 9 };\n\n case 6:\n return new[] { 6, 8 };\n\n case 7:\n return new[] { 0, 3, 7, 8, 9 };\n\n default:\n return new[] { 8 };\n\n case 9:\n return new[] { 8, 9 };\n }\n }\n }\n\n partial class DigitalCounter\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p1\n\t{\n\t\tpublic void foo()\n\t\t{\n\t\t\tint[] n = new int[] { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n\n\t\t\tstring x = System.Console.ReadLine();\n\t\t\tint r = n[int.Parse(x[0].ToString())] * n[int.Parse(x[1].ToString())];\n\t\t\tSystem.Console.WriteLine(r);\n\t\t}\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tp1 o = new p1();\n\t\t\to.foo();\n\n\t\t\t//Console.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Char(2);\n int[] a = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n var ans = 1;\n for (int i = 0; i < 2; i++)\n ans *= a[n[i] - '0'];\n IO.Printer.Out.WriteLine(ans);\n }\n\n\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] a = new int[] { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n\n if (s.Length == 2 && s[0] >= '0' && s[0] <= '9' && s[1] >= '0' && s[1] <= '9')\n {\n int a1 = Convert.ToInt32(s[0].ToString());\n int a2 = Convert.ToInt32(s[1].ToString());\n Console.WriteLine(a[a1] * a[a2]);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n char d, f;\n d = s[0];\n f = s[1];\n int a = (int)Char.GetNumericValue(d);\n int b = (int)Char.GetNumericValue(f);\n if (a == b)\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 7;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n Console.WriteLine(a*a);\n }\n else\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 7;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n if (b == 0) b = 2;\n else if (b == 1) b = 7;\n else if (b == 2) b = 2;\n else if (b == 3) b = 3;\n else if (b == 4) b = 3;\n else if (b == 5) b = 4;\n else if (b == 6) b = 2;\n else if (b == 7) b = 5;\n else if (b == 8) b = 1;\n else if (b == 9) b = 2;\n Console.WriteLine(a*b);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 3 | n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 5) count1 = count1 + 4;\n else\n if (n2 == 1) count1 = count1 + 7;\n else\n if (n2 == 8) count1 = count1 + 1; else if (n2 == 7) count1 = count1 + 5;\n if (n1 == 2 | n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 3 | n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 5) count2 = count2 + 4;\n else\n if (n1 == 1) count2 = count2 + 7;\n else\n if (n1 == 8) count2 = count2 + 1; else\n if (n1 == 7) count2 = count2 + 5;\n Console.WriteLine(count1 * count2);\n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace R_A_282\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int a = Vib(n / 10), b = Vib(n % 10);\n Console.WriteLine(a * b); \n }\n\n public static int Vib(int a)\n {\n switch (a)\n {\n case 0:\n return 2;\n break;\n case 1:\n return 7;\n break;\n case 2:\n return 2;\n break;\n case 3:\n return 3;\n break;\n case 4:\n return 3;\n break;\n case 5:\n return 4;\n break;\n case 6:\n return 2;\n break;\n case 7:\n return 5;\n break;\n case 8:\n return 1;\n break;\n case 9:\n return 2;\n break;\n default:\n return 0;\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Digital_Counter\n{\n class Program\n {\n static void Main(string[] args)\n {\n IO io = new IO();\n int[] arr_data = new int[] { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n string arr_Inputs = Console.ReadLine();\n int firstDigit = Convert.ToInt32(arr_Inputs[0].ToString());\n int secondDigit = Convert.ToInt32(arr_Inputs[1].ToString());\n io.PutStr(arr_data[firstDigit] * arr_data[secondDigit]);\n io.ReadNum();\n }\n }\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public int ReadNum()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = a % 10;\n int c = ((a % 100) - b) / 10;\n int [] ar = { 2,7,2,3,3,4,2,5,1,2 };\n Console.WriteLine(ar[b] * ar[c]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n public static class Class1\n {\n static void Main(string[] args)\n {\n var data = new[] { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n var number = Console.ReadLine();\n var firstDigit = int.Parse(number[0].ToString());\n var secondDigit = int.Parse(number[1].ToString());\n Console.WriteLine(data[firstDigit]*data[secondDigit]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleA\n{\n class Program\n {\n static void Main ( string[] args )\n {\n int a = 0, b = 0, p = 0;\n string str = Console.ReadLine ( );\n for ( int i = 0; i < str.Length; i++ )\n { \n switch (str[i])\n {\n case '0':\n p = 2; // 0 8\n break;\n case '1':\n p = 7; // 1 0 3 4 7 8 9\n break;\n case '2':\n p = 2; // 2 8\n break;\n case '3':\n p = 3; // 3 8 9\n break;\n case '4':\n p = 3; // 4 8 9\n break;\n case '5':\n p = 4; //5 6 8 9\n break;\n case '6':\n p = 2; //6 8\n break;\n case '7':\n p = 5; //7 0 3 8 9\n break;\n case '8':\n p = 1; //8\n break;\n case '9':\n p = 2; //9 8\n break;\n }\n if ( i == 0 )\n a = p;\n else b = p;\n }\n Console.WriteLine ( ( a * b ).ToString ( ) );\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string lev = Console.ReadLine();\n int n = 0;\n char l ;\n int level = 1;\n int count1 = 1;\n int count2 = 1;\n\n l = lev[0];\n level = int.Parse(l.ToString());\n count1 = Con(level, count1);\n l = lev[1];\n level = int.Parse(l.ToString());\n count2 = Con(level, count2);\n n = count1 * count2;\n\n\n Console.Write(n);\n lev = Console.ReadLine();\n\n }\n\n private static int Con(int level10, int count1)\n {\n switch (level10)\n {\n case 0:\n count1 = 2;\n break;\n case 1:\n count1 = 7;\n break;\n case 2:\n count1 = 2;\n break;\n case 3:\n count1 = 3;\n break;\n case 4:\n count1 = 3;\n break;\n case 5:\n count1 = 4;\n break;\n case 6:\n count1 = 2;\n break;\n case 7:\n count1 = 5;\n break;\n case 8:\n count1 = 1;\n break;\n case 9:\n count1 = 2;\n break;\n default:\n Console.WriteLine(\"Default case\");\n break;\n }\n return count1;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n string lev = Console.ReadLine();\n int n = 0;\n char l ;\n int level = 1;\n int count1 = 1;\n int count2 = 1;\n\n l = lev[0];\n level = int.Parse(l.ToString());\n count1 = Con(level, count1);\n l = lev[1];\n level = int.Parse(l.ToString());\n count2 = Con(level, count2);\n n = count1 * count2;\n\n\n Console.Write(n);\n lev = Console.ReadLine();\n\n }\n\n private static int Con(int level, int count1)\n {\n switch (level)\n {\n case 0:\n count1 = 2;\n break;\n case 1:\n count1 = 7;\n break;\n case 2:\n count1 = 2;\n break;\n case 3:\n count1 = 3;\n break;\n case 4:\n count1 = 3;\n break;\n case 5:\n count1 = 4;\n break;\n case 6:\n count1 = 2;\n break;\n case 7:\n count1 = 5;\n break;\n case 8:\n count1 = 1;\n break;\n case 9:\n count1 = 2;\n break;\n default:\n Console.WriteLine(\"Default case\");\n break;\n }\n return count1;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = a % 10;\n int c = ((a % 100) - b) / 10;\n int [] ar = { 2,7,2,3,3,4,2,5,1,2 };\n Console.WriteLine(ar[b] * ar[c]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Digital_Counter\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var good = new[] {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n string s = reader.ReadLine();\n\n writer.WriteLine(good[s[0] - '0']*good[s[1] - '0']);\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n char d, f;\n d = s[0];\n f = s[1];\n int a = (int)Char.GetNumericValue(d);\n int b = (int)Char.GetNumericValue(f);\n if (a == b)\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 7;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n Console.WriteLine(a*a);\n }\n else\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 7;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n if (b == 0) b = 2;\n else if (b == 1) b = 7;\n else if (b == 2) b = 2;\n else if (b == 3) b = 3;\n else if (b == 4) b = 3;\n else if (b == 5) b = 4;\n else if (b == 6) b = 2;\n else if (b == 7) b = 5;\n else if (b == 8) b = 1;\n else if (b == 9) b = 2;\n Console.WriteLine(a*b);\n }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static Dictionary _le = new Dictionary() { {'0', 2}, {'1', 7}, {'2', 2}, {'3', 3}, {'4', 3}, {'5', 4}, {'6', 2}, {'7', 5}, {'8', 1}, {'9', 2} };\n\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var n = Console.ReadLine();\n var res = _le[n[0]] * _le[n[1]];\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str = Console.ReadLine().Trim();\n int[] arr = new int[]{2,7,2,3,3,4,2,5,1,2};\n if(str.Length > 1){\n int a1 = (int)str[0] - (int)'0';\n int b1 = (int)str[1] - (int)'0';\n Console.WriteLine(arr[a1] * arr[b1]);\n }else{\n int a1 = (int)str[0] - (int)'0';\n //int b1 = (int)str[1] - (int)'0';\n Console.WriteLine(arr[a1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] v = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n int m = n % 10;\n n /= 10;\n Console.Write(v[n] * v[m]);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = Convert.ToInt32(Console.ReadLine());\n int b = m % 10;\n int a = (m - b) / 10;\n int[] ar = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n Console.WriteLine(ar[a] *ar[b]);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static int kachestvo(int n)\n {\n if (n == 0 || n==2 || n==9) return 2;\n else\n if (n == 1) return 7;\n else\n if (n == 3 || n == 4 || n == 6) return 3;\n else\n if (n == 5) return 4;\n else\n if (n == 7) return 5;\n else return 1;\n\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(kachestvo(n / 10) * kachestvo(n % 10));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Digital_Counter\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var good = new[] {2, 7, 2, 3, 3, 3, 2, 5, 1, 2};\n string s = reader.ReadLine();\n\n writer.WriteLine(good[s[0] - '0']*good[s[1] - '0']);\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n char d, f;\n d = s[0];\n f = s[1];\n int a = (int)Char.GetNumericValue(d);\n int b = (int)Char.GetNumericValue(f);\n if (a == b)\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 6;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n Console.WriteLine(a*a);\n }\n else\n {\n if (a == 0) a = 2;\n else if (a == 1) a = 7;\n else if (a == 2) a = 2;\n else if (a == 3) a = 3;\n else if (a == 4) a = 3;\n else if (a == 5) a = 4;\n else if (a == 6) a = 2;\n else if (a == 7) a = 5;\n else if (a == 8) a = 1;\n else if (a == 9) a = 2;\n if (b == 0) b = 2;\n else if (b == 1) b = 7;\n else if (b == 2) b = 2;\n else if (b == 3) b = 3;\n else if (b == 4) b = 3;\n else if (b == 5) b = 4;\n else if (b == 6) b = 2;\n else if (b == 7) b = 5;\n else if (b == 8) b = 1;\n else if (b == 9) b = 2;\n Console.WriteLine(a*b);\n }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static Dictionary _le = new Dictionary() { {'0', 2}, {'1', 7}, {'2', 2}, {'3', 3}, {'4', 3}, {'5', 3}, {'6', 2}, {'7', 5}, {'8', 1}, {'9', 2} };\n\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var n = Console.ReadLine();\n var res = _le[n[0]] * _le[n[1]];\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] v = { 2, 7, 2, 3, 3, 4, 2, 4, 1, 2 };\n int m = n % 10;\n n /= 10;\n Console.Write(v[n] * v[m]);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int[] d = {2, 1 + 1 + 1 + 1 + 1 + 1, 1 + 1, 1 + 1 + 1, 1 + 1 + 1, 1 + 1 + 1 + 1, 1 + 1, 1 + 1 + 1 + 1 + 1, 1, 1 + 1};\n string s = reader.ReadLine();\n int ans = d[s[0] - '0'] * d[s[1] - '0'];\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int f = Convert.ToInt32(Console.ReadLine());\n int f1 = f / 10;\n int f2 = f % 10;\n int[] p = { 2, 6, 3, 3, 3, 4, 2, 5, 1, 2 };\n\n Console.WriteLine(p[f1] * p[f2]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n //int t = int.Parse(Console.ReadLine());\n int a = Console.Read() - '0',\n b = Console.Read() - '0';\n\n var transform = new List\n {\n 2,\n 7,\n 2,\n 3,\n 3,\n 4,\n 3,\n 5,\n 1,\n 2\n };\n\n Console.WriteLine(transform[a] * transform[b]);\n }\n }\n\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n { \n int n = Convert.ToInt32(Console.ReadLine());\n int b = n % 10;\n int a = (n - b) % 10;\n int[] s = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n Console.WriteLine(s[a]*s[b]);\n Console.ReadLine();\n\n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n { \n int n = Convert.ToInt32(Console.ReadLine());\n int b = n % 10;\n int a = (n - b) % 10;\n int[] s = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2 };\n Console.WriteLine(s[a]*s[b]);\n Console.ReadLine();\n\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var ar = new int[] { 126, 48, 109, 121, 51, 91, 95, 112, 127, 123 };\n var ans = 0;\n var d = int.Parse(Console.ReadLine());\n var b = ar[d % 10];\n d /= 10;\n var a = ar[d % 10];\n foreach (var item in ar)\n {\n if ((a & item) >= a )\n {\n ans++;\n }\n }\n foreach (var item in ar)\n {\n if ((b & item) >= b)\n {\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var ar = new int[] { 126, 48, 109, 121, 51, 91, 95, 112, 127, 123 };\n var ans = 0;\n var d = int.Parse(Console.ReadLine());\n var b = ar[d % 10];\n d /= 10;\n var a = ar[d % 10];\n foreach (var item in ar)\n {\n if ((a & item) >= a || (b & item) >= b)\n {\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n}\n"}, {"source_code": "using System;\nnamespace CodeForces{\n class Contest {\n static void Main(string [] Args) { \n string s = Console.ReadLine();\n int[] dig = { 2, 6, 2, 3, 3, 9, 2, 5, 1, 2};\n int a = s[0]-'0';\n int b = s[1]-'0';\n Console.Write(string.Format(\"{0}\", dig[a] * dig[b])); \n }\n }\n}"}, {"source_code": "using System;\nnamespace CodeForces{\n class Contest {\n static void Main(string [] Args) { \n string s = Console.ReadLine();\n int[] dig = { 2, 7, 2, 3, 3, 4, 2, 5, 1, 2};\n Console.Write(dig[s[0]-'0']*dig[s[0]-'0']); \n }\n }\n}"}, {"source_code": "using System;\nnamespace CodeForces{\n class Contest {\n static void Main(string [] Args) { \n string s = Console.ReadLine();\n int[] dig = { 2, 7, 2, 3, 3, 9, 2, 5, 1, 2};\n int a = s[0]-'0';\n int b = s[1]-'0';\n Console.Write(string.Format(\"{0}\", dig[a] * dig[b])); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Security.Policy;\n\nnamespace ConsoleApplication3\n{\n internal class NumberIndicator\n {\n public static List Numbers = new List\n {\n new byte[] {1, 1, 1, 1, 1, 1, 0},\n new byte[] {0, 0, 1, 1, 0, 0, 0},\n new byte[] {0, 1, 1, 0, 1, 1, 1},\n new byte[] {0, 1, 1, 1, 1, 0, 1},\n new byte[] {1, 0, 1, 1, 0, 0, 1},\n new byte[] {0, 1, 0, 1, 1, 0, 1},\n new byte[] {1, 1, 0, 1, 1, 1, 1},\n new byte[] {0, 1, 1, 1, 0, 0, 0},\n new byte[] {1, 1, 1, 1, 1, 1, 1},\n new byte[] {1, 1, 1, 1, 1, 0, 1},\n };\n\n public static int FindGoodNumbers(int first, int second)\n {\n var firstBinaryNum = Numbers.ElementAt(first);\n var secondBinaryNum = Numbers.ElementAt(second);\n\n var firstResult = 0;\n var secondResult = 0;\n foreach (var number in Numbers)\n {\n var addFirst = true;\n var addSecond = true;\n for (var i = 0; i < number.Length; i++)\n {\n if (firstBinaryNum[i] == 1 && number[i] != 1)\n {\n addFirst = false;\n }\n if (secondBinaryNum[i] == 1 && number[i] != 1)\n {\n addSecond = false;\n }\n }\n if (addFirst)\n {\n firstResult++;\n }\n if (addSecond)\n {\n secondResult++;\n }\n }\n return firstResult*secondResult;\n }\n\n private static void Main(string[] args)\n {\n var stringNumber = Console.ReadLine();\n if (stringNumber == null) return;\n var result = FindGoodNumbers((int) Char.GetNumericValue(stringNumber[0]),\n (int) Char.GetNumericValue(stringNumber[1]));\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _13._12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = { 2, 7, 2, 3, 3, 3, 2, 5, 1, 2 };\n string s = Console.ReadLine();\n if (s.Length == 2 && s[0] >= '0' && s[0] <= '9' && s[1] >= '0' && s[1] <= '9')\n {\n int a1 = Convert.ToInt32(s[0].ToString());\n int a2 = Convert.ToInt32(s[1].ToString());\n Console.WriteLine(a[a1] * a[a2]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _13._12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = { 2, 7, 2, 3, 3, 3, 2, 5, 1, 2 };\n string s = Console.ReadLine();\n if (s.Length == 2 && s[0] >= '0' && s[0] <= '9' && s[1] >= '0' && s[1] <= '9')\n {\n int a1 = Convert.ToInt32(s[0].ToString());\n int a2 = Convert.ToInt32(s[1].ToString());\n Console.WriteLine(a[a1] * a[a2]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2; else\n if(n2 == 2 | n2 == 3 | n2 == 5) count1 = count1 + 3; else\n if(n2==4) count1 = count1 + 4; else\n if(n2==7) count1 = count1 + 5; else\n if (n2 == 1) count1 = count1 + 6;\n if (n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 2 | n1 == 3 | n1 == 5) count2 = count2 + 3;\n else\n if (n1 == 4) count2 = count2 + 4;\n else\n if (n1 == 7) count2 = count2 + 5;\n else\n if (n1 == 1) count2 = count2 + 6;\n if(count1!=0&count2!=0)Console.WriteLine(count1*count2);\n else Console.WriteLine(count1 + count2);\n //Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 2 | n2 == 3 | n2 == 5) count1 = count1 + 3;\n else\n if (n2 == 4) count1 = count1 + 4;\n else\n if (n2 == 7) count1 = count1 + 5;\n else\n if (n2 == 1) count1 = count1 + 6; else count1 = 1;\n if (n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 2 | n1 == 3 | n1 == 5) count2 = count2 + 3;\n else\n if (n1 == 4) count2 = count2 + 4;\n else\n if (n1 == 7) count2 = count2 + 5;\n else\n if (n1 == 1) count2 = count2 + 6; else count2 = 1;\n if(count1!=0&count2!=0) Console.WriteLine(count1*count2);\n else Console.WriteLine(count1 + count2);\n // Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 3 | n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 5) count1 = count1 + 4;\n else\n if (n2 == 1) count1 = count1 + 7;\n else\n if (n2 == 8) count1 = count1 + 1; else if (n1 == 7) count1 = count1 + 5; else count1 = 1;\n if (n1 == 2 | n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 3 | n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 5) count2 = count2 + 4;\n else\n if (n1 == 1) count2 = count2 + 7;\n else\n if (n1 == 8) count2 = count2 + 1; else\n if (n1 == 7) count2 = count2 + 5; else count2 = 1;\n Console.WriteLine(count1 * count2);\n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 3 | n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 5) count1 = count1 + 4;\n else\n if (n2 == 1) count1 = count1 + 7;\n else\n if (n2 == 8) count1 = count1 + 1; else count1 = 1;\n if (n1 == 2 | n1 == 0 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 3 | n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 5) count2 = count2 + 4;\n else\n if (n1 == 1) count2 = count2 + 7;\n else\n if (n1 == 8) count2 = count2 + 1; else count2 = 1;\n Console.WriteLine(count1 * count2);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2;\n else\n if ( n2 == 3 | n2 == 5) count1 = count1 + 3;\n else\n if (n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 7) count1 = count1 + 7;\n else\n if (n2 == 1) count1 = count1 + 6; else count1 = 1;\n if (n1 == 2 | n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if ( n1 == 3 | n1 == 5) count2 = count2 + 3;\n else\n if (n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 7) count2 = count2 + 5;\n else\n if (n1 == 1) count2 = count2 + 7; else count2 = 1;\n if(count1!=0&count2!=0) Console.WriteLine(count1*count2);\n else Console.WriteLine(count1 + count2);\n //Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 6 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 3 | n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 5) count1 = count1 + 4;\n else\n if (n2 == 1) count1 = count1 + 7;\n else\n if (n2 == 8) count1 = count1 + 1; else if (n1 == 7) count2 = count2 + 5; else count1 = 1;\n if (n1 == 2 | n1 == 0 | n1 == 6 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 3 | n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 5) count2 = count2 + 4;\n else\n if (n1 == 1) count2 = count2 + 7;\n else\n if (n1 == 8) count2 = count2 + 1; else\n if (n1 == 7) count2 = count2 + 5; else count2 = 1;\n Console.WriteLine(count1 * count2);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int n1 = n / 10;\n int n2 = n % 10;\n int count1 = 0;\n int count2 = 0;\n if (n2 == 2 | n2 == 0 | n2 == 9) count1 = count1 + 2;\n else\n if (n2 == 3 | n2 == 4) count1 = count1 + 3;\n else\n if (n2 == 5) count1 = count1 + 4;\n else\n if (n2 == 1) count1 = count1 + 7;\n else\n if (n2 == 8) count1 = count1 + 1; else if (n1 == 7) count2 = count2 + 5; else count1 = 1;\n if (n1 == 2 | n1 == 0 | n1 == 9) count2 = count2 + 2;\n else\n if (n1 == 3 | n1 == 4) count2 = count2 + 3;\n else\n if (n1 == 5) count2 = count2 + 4;\n else\n if (n1 == 1) count2 = count2 + 7;\n else\n if (n1 == 8) count2 = count2 + 1; else\n if (n1 == 7) count2 = count2 + 5; else count2 = 1;\n Console.WriteLine(count1 * count2);\n Console.ReadLine();\n\n }\n }\n}"}], "src_uid": "76c8bfa6789db8364a8ece0574cd31f5"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskA\n{\n class Program\n {\n\n static bool noLeadZero(string s)\n {\n if (s.Length > 1 && s[0] == '0')\n return false;\n return true;\n }\n\n static int getResult()\n {\n string token = Console.ReadLine();\n int length = token.Length;\n int result = -1;\n string r1, r2, r3;\n int p1, p2, p3,sum;\n if (token.Length > 21)\n {\n return result;\n } else {\n for (int i = 1; i <= 7; i++)\n {\n for (int j = 1; j <= 7; j++) {\n int k = length - i - j;\n if (k > 0 && k < 8)\n {\n r1 = token.Substring(0, i);\n r2 = token.Substring(i, j);\n r3 = token.Substring(i + j, k);\n if (noLeadZero(r1) && noLeadZero(r2) && noLeadZero(r3))\n {\n p1 = int.Parse(r1);\n p2 = int.Parse(r2);\n p3 = int.Parse(r3);\n sum = p1+p2+p3;\n if (p1 <= 1000000 && p2 <= 1000000 && p3 <= 1000000 && (result == -1 || result < sum))\n {\n result = sum;\n }\n }\n }\n }\n }\n }\n\n return result;\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(getResult());\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n//using System.Numerics;\n\nclass Solver\n{\n public void Solve()\n {\n var s = CF.ReadLine();\n var res = -1;\n if (s.Length >= 3)\n {\n\n for (int i = 1; i <= s.Length - 2; i++)\n {\n //\n var s1 = s.Substring(0, i);\n var n1 = _conv(s1);\n if( n1==null)\n break;\n\n for (int j = 1; i + j <= s.Length - 1; j++)\n {\n //\n var s2 = s.Substring(i, j);\n var n2 = _conv(s2);\n if (n2 == null)\n break;\n\n //\n var s3 = s.Substring(i + j);\n var n3 = _conv(s3);\n if (n3 == null)\n continue;\n\n res = Math.Max(res, n1.Value + n2.Value + n3.Value);\n \n }\n }\n }\n\n CF.WriteLine(res);\n }\n\n int? _conv(string s)\n {\n if( s.Length>1&&s[0]=='0')\n return null;\n if (s.Length > 7)\n return null;\n var n = int.Parse(s);\n if (n > 1000000)\n return null;\n\n return n;\n }\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n1234\n\",\n@\"\n9000\n\"\n,\n@\"\n0009\n\"\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t = 0; t < CF.TestCount; t++)\n {\n CF.Test(t);\n var sw = new Stopwatch();\n sw.Start();\n new Solver().Solve();\n Debug.WriteLine(\"time: \" + sw.ElapsedMilliseconds + \" ms\");\n }\n#else\n new Solver().Solve();\n#endif\n }\n\n class Utils\n {\n public void Test(int t)\n {\n _lines = new List();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n\tstring number = Console.ReadLine();\n\tint size = number.Length;\n if (size > 23) {Console.WriteLine(\"-1\"); return;}\n\n\n\tstring first=\"\",second=\"\",third=\"\";\ndecimal max =-1;decimal sum=0; bool numbersIsMoreTHan3Mil = true;\n\tbool FirstNumberIsOK=false;bool SecondNumberIsOk=false; bool ThirdNumberIsOk=false;\n\t\n\tfor (int i = 1; i 1000000 || decimal.Parse(second) > 1000000 || decimal.Parse(third) > 1000000)\n {\n numbersIsMoreTHan3Mil = false;\n }\n \n if (FirstNumberIsOK && SecondNumberIsOk && ThirdNumberIsOk && numbersIsMoreTHan3Mil) // Numbers are fine\n {\n sum = decimal.Parse(first) + decimal.Parse(second) + decimal.Parse(third);\n if (sum > max)\n max = sum;\n \n \n }\n FirstNumberIsOK = false; SecondNumberIsOk = false; ThirdNumberIsOk = false; numbersIsMoreTHan3Mil = true;\n\t\t}\n\t\tConsole.WriteLine(max);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\n\tclass A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tstring s = NextLine().Trim();\n\t\t\tint res = -1;\n\t\t\tint len = s.Length;\n\t\t\tfor ( int i = 1; i <= 7; ++i )\n\t\t\t\tfor ( int j = 1; j <= 7 && i + j <= len; ++j )\n\t\t\t\t{\n\t\t\t\t\tint k = len - i - j;\n\t\t\t\t\tif ( k <= 0 || k > 7 ) continue;\n\t\t\t\t\tif ( ( s[0] == '0' && i > 1 ) || ( s[i] == '0' && j > 1 ) || ( s[i + j] == '0' && k > 1 ) ) continue;\n\t\t\t\t\tint a = int.Parse( s.Substring( 0, i ) );\n\t\t\t\t\tint b = int.Parse( s.Substring( i, j ) );\n\t\t\t\t\tint c = int.Parse( s.Substring( i + j ) );\n\t\t\t\t\tif ( a > 1000000 || b > 1000000 || c > 1000000 ) continue;\n\t\t\t\t\tres = Math.Max( res, a + b + c );\n\t\t\t\t}\n\t\t\tOut.WriteLine( res );\n\t\t}\n\n\n\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n return (T)Convert.ChangeType(NextString(), typeof(T));\n }\n\n\n public IEnumerable NextSeq(int n)\n {\n for (int i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, T val)\n {\n for (int i = 0; i < self.Count; i++)\n {\n self[i] = val;\n }\n\n return self;\n }\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());\n hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Key.GetHashCode());\n return hash;\n\n }\n }\n\n #endregion\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n private void Solve()\n {\n var s = io.NextLine().Select(x => x - '0').ToArray();\n\n var max = -1;\n\n if (s.Length > 0)\n {\n for (int i = 1; i <= 7; i++)\n {\n for (int j = 1; j <= 7; j++)\n {\n for (int k = 1; k <= 7; k++)\n {\n if (i + j + k != s.Length)\n continue;\n\n var n1 = 0;\n var x = 1;\n\n for (int l = 1; l <= i; l++)\n {\n n1 += s[i - l]*x;\n x *= 10;\n }\n\n\n if (n1 > 1000000 || (n1 > 0 && n1 < x / 10) || (n1 == 0 && x > 10))\n continue;\n\n\n var n2 = 0;\n x = 1;\n\n for (int l = 1; l <= j; l++)\n {\n n2 += s[i + j - l]*x;\n x *= 10;\n }\n\n\n\n if (n2 > 1000000 || (n2 > 0 && n2 < x / 10) || (n2 == 0 && x > 10))\n continue;\n\n\n var n3 = 0;\n x = 1;\n\n for (int l = 1; l <= k; l++)\n {\n n3 += s[i + j + k - l]*x;\n x *= 10;\n }\n\n\n if (n3 > 1000000 || (n3 > 0 && n3 < x / 10) || (n3 == 0 && x > 10))\n continue;\n\n\n max = Math.Max(max, n1 + n2 + n3);\n }\n }\n }\n }\n\n io.Print(max);\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\npublic class CF_175A\n{\n static void Main ()\n {\n string str = Console.ReadLine ();\n int ret = -1;\n for (int i = 0; i < str.Length; i++) {\n for (int j = i + 1; j < str.Length; j++) {\n ret = Math.Max (ret, getVal (str.Substring (0, i))\n + getVal (str.Substring (i, j - i))\n + getVal (str.Substring (j, str.Length - j)));\n \n }\n }\n Console.WriteLine(ret);\n }\n\n static int getVal (string str)\n {\n const int neginf = -100000000;\n if (str.Length >= 2 && str.StartsWith(\"0\"))\n return neginf;\n if (str.Length >= 8 || str.Length == 0)\n return neginf;\n int ret = int.Parse(str);\n return ret > 1000000 ? neginf : ret;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int dp(string s,int c)\n {\n int res = -1;\n if ((c==0)&&(s.Length==0)) return 0;\n if ((c == 0) && (s.Length != 0)) return -1;\n if (s.Length >= c)\n {\n string num=\"\";\n int sum=-1;\n for (int i = 0; i < 7 && i < s.Length - c + 1; i++)\n {\n num += s[i];\n int tt =int.Parse(num);\n if (tt <= 1000000)\n {\n int t = dp(s.Substring(i + 1, s.Length - i - 1), c - 1);\n if ((t != -1) && ((num[0] != '0') || (num.Length == 1)))\n sum = Math.Max(sum, tt + t);\n }\n }\n return sum;\n }\n return res;\n\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(dp(s, 3));\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int max = 0;\n if (input.Length < 3)\n {\n Console.WriteLine(-1);\n return;\n }\n bool flag = false;\n for (int i = 0; i < input.Length-2; i++)\n {\n string first = input.Substring(0, i + 1);\n if(first.Length>7)\n break;\n if (int.Parse(first) > 1000000)\n break;\n if (first[0] == '0' && first.Length > 1)\n break;\n for (int j = i + 1; j < input.Length - 1; j++)\n {\n string second = input.Substring(i + 1, j - i);\n if (second.Length > 7)\n break;\n if (second[0] == '0' && second.Length > 1)\n continue;\n if (int.Parse(second) > 1000000)\n break;\n string third = input.Substring(j + 1, input.Length - j - 1);\n if (third.Length > 7)\n continue;\n if (third[0] == '0' && third.Length > 1)\n continue;\n if (int.Parse(third) > 1000000)\n continue;\n max = Math.Max(max, int.Parse(first) + int.Parse(second) + int.Parse(third));\n flag = true;\n }\n }\n if (flag)\n Console.WriteLine(max);\n else\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int max = -1;\n for (int i = 0; i < input.Length - 2; i++)\n {\n string first = input.Substring(0, i + 1);\n if (first.Length > 7)\n break;\n if (int.Parse(first) > 1000000)\n break;\n if (first[0] == '0' && first.Length > 1)\n break;\n for (int j = i + 1; j < input.Length - 1; j++)\n {\n string second = input.Substring(i + 1, j - i);\n if (second.Length > 7)\n break;\n if (second[0] == '0' && second.Length > 1)\n continue;\n if (int.Parse(second) > 1000000)\n break;\n string third = input.Substring(j + 1, input.Length - j - 1);\n if (third.Length > 7)\n continue;\n if (third[0] == '0' && third.Length > 1)\n continue;\n if (int.Parse(third) > 1000000)\n continue;\n max = Math.Max(max, int.Parse(first) + int.Parse(second) + int.Parse(third));\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System.Diagnostics;\nusing System.Globalization;\n\nnamespace CodeForces {\n struct Node {\n public int X, Y, D; \n public Node(int x,int y, int d) {\n X = x;\n Y = y;\n D = d;\n } \n }\n \n class Cf { \n static TextReader input;\n static void Main(string[] args) { \n#if TESTS \n Stopwatch sw = new Stopwatch();\n input = new StreamReader(\"input.txt\"); \n#else\n input = Console.In;\n#endif\n Solve(); \n#if TESTS\n Console.WriteLine();\n Console.WriteLine(\"Milliseconds: {0}\", sw.ElapsedMilliseconds);\n Console.ReadLine();\n#endif\n } \n const int MOD = 1000000007;\n static int n, m, k;\n static void Solve() {\n string s = ReadLine();\n n = s.Length;\n int ans = -1;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i >= j) continue;\n string s1 = s.Substring(0, i);\n string s2 = s.Substring(i, j - i);\n string s3 = s.Substring(j);\n if(Ok(s1) &&Ok(s2) &&Ok(s3))\n ans = Math.Max(ans, int.Parse(s1) + int.Parse(s2) + int.Parse(s3));\n } \n }\n Console.WriteLine(ans);\n }\n\n static bool Ok(string s) {\n if (string.IsNullOrEmpty(s)) return false;\n if (s.Length > 7) return false;\n if (s == \"0\") return true;\n if (s[0] == '0') return false;\n if (int.Parse(s) > 1000000) return false;\n return true;\n }\n \n static int[] Z_function(string s) {\n int n = s.Length;\n int[] z = new int[n]; \n for (int i = 1, l = 0, r = 0; i < n; ++i) {\n if (i <= r)\n z[i] = Math.Min(r - i + 1, z[i - l]);\n while (i + z[i] < n && s[z[i]] == s[i + z[i]])\n ++z[i];\n if (i + z[i] - 1 > r) {\n l = i; r = i + z[i] - 1;\n }\n }\n return z;\n }\n \n static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {\n return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),\n Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));\n }\n\n static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {\n int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));\n if (x1 == x2 && y1 <= y && y <= y2)\n result = (x - x1) * (x - x1);\n else if (y1 == y2 && x1 <= x && x <= x2)\n result = (y - y1) * (y - y1);\n return result;\n }\n\n static int SquaredDistance(int ax, int ay, int bx, int by) {\n return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);\n }\n\n #region read helpers\n public static List ReadIntList() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n }\n\n public static int[] ReadIntArray() {\n return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n } \n\n public static string ReadLine() {\n return input.ReadLine();\n }\n\n public static int ReadInt() {\n return int.Parse(input.ReadLine());\n }\n#endregion\n }\n \n public class SegmentTree {\n private int[] a, t;\n private int n;\n public SegmentTree(int[] a) {\n n = a.Length;\n this.a = a; \n t = new int[n << 2];\n buildSegmentTree(0, n - 1, 1);\n }\n\n private void buildSegmentTree(int l, int r, int v) {\n if (l == r)\n t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n int vl = v << 1;\n int vr = (v << 1) | 1;\n buildSegmentTree(l, m, vl);\n buildSegmentTree(m + 1, r, vr);\n t[v] = t[vl] + t[vr];\n }\n }\n\n public int QuerySegmentTree(int l, int r) {\n return querySegmentTree(1, l, r, 0, n - 1);\n }\n\n public void Update(int v, int tl, int tr, int pos, int new_val) {\n if (tl == tr)\n t[v] = new_val;\n else {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n Update(v << 1, tl, tm, pos, new_val);\n else\n Update(v << 1 + 1, tm + 1, tr, pos, new_val);\n t[v] = t[v << 1] + t[v << 1 + 1];\n }\n }\n\n private int querySegmentTree(int v, int l, int r, int tl, int tr) {\n if (l > r)\n return 0;\n if (l == tl && r == tr)\n return t[v];\n int m = (tl + tr) >> 1; \n return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);\n }\n }\n class Graph : List> {\n public Graph(int num): base(num) {\n for (int i = 0; i < num; i++) {\n this.Add(new List());\n }\n }\n }\n class Heap : IEnumerable where T : IComparable {\n private List heap = new List();\n private int heapSize;\n private int Parent(int index) {\n return (index - 1) >> 1;\n }\n public int Count {\n get { return heap.Count; }\n }\n private int Left(int index) {\n return (index << 1) | 1;\n }\n private int Right(int index) {\n return (index << 1) + 2;\n }\n private void Max_Heapify(int i) {\n int l = Left(i);\n int r = Right(i);\n int largest = i;\n if (l < heapSize && heap[l].CompareTo(heap[i]) > 0)\n largest = l;\n if (r < heapSize && heap[r].CompareTo(heap[largest]) > 0)\n largest = r;\n if (largest != i) {\n T temp = heap[largest];\n heap[largest] = heap[i];\n heap[i] = temp;\n Max_Heapify(largest);\n }\n }\n private void BuildMaxHeap() {\n for (int i = heap.Count >> 1; i >= 0; --i)\n Max_Heapify(i);\n }\n\n public IEnumerator GetEnumerator() {\n return heap.GetEnumerator();\n }\n\n public void Sort() {\n for (int i = heap.Count - 1; i > 0; --i) {\n T temp = heap[i];\n heap[i] = heap[0];\n heap[0] = temp;\n --heapSize;\n Max_Heapify(0);\n }\n }\n\n public T Heap_Extract_Max() {\n T max = heap[0];\n heap[0] = heap[--heapSize];\n Max_Heapify(0);\n return max;\n }\n\n public void Clear() {\n heap.Clear();\n heapSize = 0;\n }\n\n public void Insert(T item) {\n if (heapSize < heap.Count)\n heap[heapSize] = item;\n else\n heap.Add(item);\n int i = heapSize;\n while (i > 0 && heap[Parent(i)].CompareTo(heap[i]) < 0) {\n T temp = heap[i];\n heap[i] = heap[Parent(i)];\n heap[Parent(i)] = temp;\n i = Parent(i);\n }\n ++heapSize;\n }\n\n IEnumerator IEnumerable.GetEnumerator() {\n return ((IEnumerable)heap).GetEnumerator();\n }\n } \n public class Treap {\n private static Random rand = new Random();\n public static Treap Merge(Treap l, Treap r) {\n if (l == null) return r;\n if (r == null) return l;\n Treap res;\n if (l.y > r.y) {\n Treap newR = Merge(l.right, r);\n res = new Treap(l.x, l.y, l.left, newR);\n }\n else {\n Treap newL = Merge(l, r.left);\n res = new Treap(r.x, r.y, newL, r.right);\n } \n return res;\n }\n\n public void Split(int x, out Treap l, out Treap r) {\n Treap newTree = null;\n if (this.x <= x) {\n if (right == null)\n r = null;\n else\n right.Split(x, out newTree, out r);\n l = new Treap(this.x, y, left, newTree); \n }\n else {\n if (left == null)\n l = null;\n else\n left.Split(x, out l, out newTree);\n r = new Treap(this.x, y, newTree, right); \n }\n }\n\n public Treap Add(int x) {\n Treap l, r;\n Split(x, out l, out r);\n Treap m = new Treap(x, rand.Next());\n return Merge(Merge(l, m), r);\n }\n\n public Treap Remove(int x) {\n Treap l, m, r;\n Split(x - 1, out l, out r);\n r.Split(x, out m, out r);\n return Merge(l, r);\n }\n\n private int x, y, cost, maxTreeCost;\n private Treap left, right;\n public Treap(int x, int y, Treap l, Treap r) {\n this.x = x;\n this.y = y;\n left = l;\n right = r;\n }\n public Treap(int x, int y) : this(x, y, null, null) { }\n public void InOrder() {\n inOrder(this);\n }\n private void inOrder(Treap t) {\n if (t == null) return;\n inOrder(t.left);\n Console.WriteLine(t.x);\n inOrder(t.right);\n }\n }\n public static class Extensions {\n public static void Fill(this int[] array, int val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n }\n\n public static void Fill(this double[] array, double val) {\n for (int i = 0; i < array.Length; i++) {\n array[i] = val;\n }\n }\n\n public static int ToInt(this string s) {\n return int.Parse(s);\n }\n\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n \n public static void Print(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n private static bool s_time = false;\n\n private void Go()\n {\n string s = GetString();\n int n = s.Length;\n int max = -1;\n for (int l1 = 1; l1 <= n-2; l1++)\n {\n for (int l2 = 1; l2 <= n - l1 - 1; l2++)\n {\n string s1 = s.Substring(0, l1);\n string s2 = s.Substring(l1, l2);\n string s3 = s.Substring(l1 + l2);\n\n if ((s1[0] == '0' && s1 != \"0\") || (s2[0] == '0' && s2 != \"0\") || (s3[0] == '0' && s3 != \"0\")) continue;\n if (s1.Length > 7 || s2.Length > 7 || s3.Length > 7) continue;\n int i1 = int.Parse(s1);\n int i2 = int.Parse(s2);\n int i3 = int.Parse(s3);\n if (i1 > 1000000 || i2 > 1000000 || i3 > 1000000) continue;\n\n if (max < i1 + i2 + i3)\n max = i1 + i2 + i3;\n }\n }\n\n Wl(max);\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static string s;\n public static int giveSum(int i, int j)\n {\n string s1, s2, s3;\n s1 = s.Substring(0,i);\n s2 = s.Substring(i,j-i);\n s3 = s.Substring(j);\n if (s1.Length > 7 || s2.Length > 7 || s3.Length > 7)\n return -1;\n int sum = 0;\n if (i > 1 && s1[0] == '0')\n return -1;\n else\n {\n if (Convert.ToInt32(s1) <= 1000000)\n sum += Convert.ToInt32(s1);\n else\n return -1;\n if (j - i > 1 && s2[0] == '0')\n return -1;\n if (Convert.ToInt32(s2) <= 1000000)\n sum += Convert.ToInt32(s2);\n else\n return -1;\n if (s3.Length > 1 && s3[0] == '0')\n return -1;\n if (Convert.ToInt32(s3) <= 1000000)\n sum += Convert.ToInt32(s3);\n else\n return -1;\n }\n return sum;\n }\n\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n int length = s.Length;\n int res = -1;\n for (int i = 1; i <= length - 2; i++)\n for (int j = i + 1; j <= length - 1; j++)\n {\n if (giveSum(i, j) > res)\n res = giveSum(i, j);\n }\n\n System.Console.Write(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n internal class Program\n {\n\n int limit = 1000000;\n int maxL = 7;\n\n bool isOk(string a)\n {\n return a == int.Parse(a).ToString() && int.Parse(a) <= limit;\n }\n\n private void Solve()\n {\n string s = io.NextString();\n\n int result = -1;\n\n for (int i = 1; i < s.Length; i++)\n for (int j = i + 1; j < s.Length; j++)\n {\n if (i > maxL)\n continue;\n if (j - i > maxL)\n continue;\n if (s.Length - j > maxL)\n continue;\n\n string a = s.Substring(0, i);\n if (!isOk(a))\n continue;\n string b = s.Substring(i, j - i);\n if (!isOk(b))\n continue;\n string c = s.Substring(j, s.Length - j);\n if (!isOk(c))\n continue;\n\n result = Math.Max(int.Parse(a) + int.Parse(b) + int.Parse(c), result);\n\n }\n\n io.Print(result);\n\n\n }\n\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io).Solve();\n }\n }\n\n #endregion\n }\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"..\\\\..\\\\input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n return (T)Convert.ChangeType(NextString(), typeof(T));\n }\n\n\n public IEnumerable NextSeq(int n)\n {\n for (int i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Temp\n{\n using System.IO;\n\n class PointInt\n {\n public long X { get; set; }\n\n public long Y { get; set; }\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n class MatrixInt\n {\n private long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0) - 1;\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int Size, long mod = 0)\n {\n m_Matrix = new long[Size + 1, Size + 1];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n this.m_Matrix = matrix;\n Mod = mod;\n }\n\n public static MatrixInt GetIdentityMatrix(int Size, long mod = 0)\n {\n long[,] matrix = new long[Size + 1, Size + 1];\n\n for (int i = 1; i <= Size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n, n];\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] = a[i, j] + b[i, j]; \n }\n }\n\n if (mod > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n, n];\n\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= n; j++)\n {\n for (int k = 1; k <= n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n } \n }\n }\n\n return new MatrixInt(c, mod);\n }\n }\n\n static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = new MatrixInt(a.Size);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[2, 2];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long mod)\n {\n long[] result = new long[mod];\n result[1] = 1;\n for (int i = 2; i < mod; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n }\n\n static class Reader\n {\n public static void ReadInt(out int a)\n {\n int[] number = new int[1];\n ReadInt(number);\n a = number[0];\n }\n\n public static void ReadInt(out int a, out int b)\n {\n int[] numbers = new int[2];\n ReadInt(numbers);\n a = numbers[0];\n b = numbers[1];\n }\n\n public static void ReadInt(int[] numbers)\n {\n var list = Console.ReadLine().Split();\n\n int count = Math.Min(numbers.Length, list.Length);\n\n for (int i = 0; i < count; i++)\n {\n numbers[i] = int.Parse(list[i]);\n }\n }\n }\n\n static class MyMath\n {\n public static int GetMinimalPrimeDivisor(int n)\n { \n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n }\n\n public interface IGraph\n {\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v); \n }\n\n public class Graph : IGraph\n {\n private List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public Graph(int vertices)\n {\n this.Vertices = vertices;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second); \n }\n\n public int[] BFS(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (var t in m_Edges[v])\n {\n if (d[t] == -1)\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n }\n\n return d;\n }\n } \n\n class SimpleSumTable\n {\n private int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1, m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i, j];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r, t] - m_Sum[r, b] - m_Sum[l, t] + m_Sum[l, b];\n }\n }\n\n class Program\n { \n static void Main()\n {\n new Solution().Solve();\n } \n }\n\n class Solution\n {\n private int n, m;\n\n public void Solve()\n {\n //DirectToFiles();\n\n this.s = Console.ReadLine();\n\n n = this.s.Length;\n\n int answer = -1;\n\n for (int i = 1; i < n; i++)\n {\n for (int j = i + 1; j < n; j++)\n {\n answer = Math.Max(answer, this.Check(0, i - 1) + this.Check(i, j - 1) + this.Check(j, n - 1));\n }\n }\n\n Console.WriteLine(answer);\n\n //CloseFiles();\n }\n\n private int Check(int i, int j)\n {\n const int FailResult = int.MinValue / 3;\n if (j - i + 1 > 7)\n {\n return FailResult;\n }\n\n if ((j - i > 0) && (s[i] == '0'))\n {\n return FailResult;\n }\n\n int result = int.Parse(s.Substring(i, j - i + 1));\n\n if (result > 1000000)\n {\n return FailResult; \n }\n\n return result;\n }\n\n private StreamReader InputStream;\n\n private StreamWriter OutStream;\n\n private string s;\n\n private void DirectToFiles()\n {\n InputStream = File.OpenText(\"input.txt\");\n Console.SetIn(InputStream);\n\n OutStream = File.CreateText(\"output.txt\");\n Console.SetOut(OutStream);\n }\n\n private void CloseFiles()\n {\n OutStream.Flush();\n\n InputStream.Dispose();\n OutStream.Dispose();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Robot_Bicorn_Attack\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n int max = -1;\n\n for (int j = 1; j < s.Length; j++)\n {\n string s1 = s.Substring(0, j);\n\n if (s1[0] == '0' && s1.Length > 1)\n continue;\n\n if (s1.Length > 7)\n break;\n\n for (int k = j + 1; k < s.Length; k++)\n {\n string s2 = s.Substring(j, k - j);\n if (s2[0] == '0' && s2.Length > 1)\n continue;\n if (s2.Length > 7)\n break;\n\n string s3 = s.Substring(k);\n if (s3[0] == '0' && s3.Length > 1)\n continue;\n if (s3.Length > 7)\n continue;\n\n int m1 = int.Parse(s1);\n int m2 = int.Parse(s2);\n int m3 = int.Parse(s3);\n\n if (m1 > 1000000 || m2 > 1000000 || m3 > 1000000)\n continue;\n\n int m = m1 + m2 + m3;\n if (m > max)\n max = m;\n }\n }\n\n\n writer.WriteLine(max);\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nnamespace OnlineJudges\n{\n class Program\n {\n static string result = \"\";\n static void Main(string[] args)\n {\n //int[] wtf = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n result = Console.ReadLine();\n int len = result.Length;\n int max = -1;\n for (int i = 0; i < len; i++)\n {\n for (int j = 0; j < len; j++)\n {\n //Console.WriteLine(cZeroes(0, i) + \" \" + cZeroes(i + 1, j) + \" \" + cZeroes(j + 1, len - 1) + \"-- \" + i + j + len);\n max = Math.Max(max ,cZeroes(0, i) + cZeroes(i+1, j) + cZeroes(j + 1, len - 1));\n }//124 { 0 - 1 > '0'} { 2 - 2 > '' } \n }\n Console.WriteLine(((max < 0)? -1:max));\n //Console.ReadKey();\n }\n static int cZeroes(int x1, int x2)\n {\n if (x1>x2) return -10000000;\n if (result[x1] == '0' && x2 - x1 >= 1) return -10000000;\n if (x2 - x1 > 6) return -10000000;\n string value = \"\";\n for (int i = x1; i <= x2; i++)\n {\n value += result[i];\n }\n return (Int32.Parse(value) > 1000000) ? -10000000:Int32.Parse(value);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nnamespace OnlineJudges\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int[] wtf = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n string result = Console.ReadLine();\n SortedSet t = new SortedSet();\n t.Add( //[0][0][00]\n (cZeroes(result.Substring(0, 1)) ? -100 : BigInteger.Parse(result.Substring(0, 1))) +\n (cZeroes(result.Substring(1, 1)) ? -100 : BigInteger.Parse(result.Substring(1, 1))) +\n (cZeroes(result.Substring(2, result.Length - 2)) ? -100 : BigInteger.Parse(result.Substring(2, result.Length - 2))));\n\n t.Add( //[0][00][0]\n (cZeroes(result.Substring(0, 1)) ? -100 : BigInteger.Parse(result.Substring(0, 1))) +\n (cZeroes(result.Substring(result.Length - 1, 1)) ? -100 : BigInteger.Parse(result.Substring(result.Length - 1, 1))) +\n (cZeroes(result.Substring(1, result.Length - 2)) ? -100 : BigInteger.Parse(result.Substring(1, result.Length - 2))));\n t.Add( //[00][0][0]\n (cZeroes(result.Substring(0, result.Length - 2)) ? -100 : BigInteger.Parse(result.Substring(0, result.Length - 2))) +\n (cZeroes(result.Substring(result.Length - 2, 1)) ? -100 : BigInteger.Parse(result.Substring(result.Length - 2, 1))) +\n (cZeroes(result.Substring(result.Length - 1, 1)) ? -100 : BigInteger.Parse(result.Substring(result.Length - 1, 1))));\n\n Console.WriteLine((t.ElementAt(t.Count - 1) < 0) ? -1 : t.ElementAt(t.Count - 1));\n //Console.ReadKey();\n }\n static bool cZeroes(string text)\n {\n if (text[0] == '0' && text.Length != 1) return true;\n else return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n\n\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max = 0;\n\n if (s.Length % 3 == 0)\n\n {\n\n int len = s.Length / 3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n }\n else if (s.Length % 2 == 0)\n {\n\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len + 1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len + 1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n\n }\n else\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len ));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n Console.WriteLine(firstPart);\n Console.WriteLine(secondPart);\n Console.WriteLine(thirdPart);\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1 ));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)) || max > 3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n \n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n\tstring number = Console.ReadLine();\n\tint size = number.Length;\n \n\n\n\tstring first=\"\",second=\"\",third=\"\";\nlong max =-1;long sum=0; bool numbersIsntMoreTHan3Mil = false;\n\tbool FirstNumberIsOK=false;bool SecondNumberIsOk=false; bool ThirdNumberIsOk=false;\n\t\n\tfor (int i = 1; i1000000 && long.Parse(second) >1000000 && long.Parse(third)>1000000)\n numbersIsntMoreTHan3Mil = true;\n if (FirstNumberIsOK && SecondNumberIsOk && ThirdNumberIsOk && numbersIsntMoreTHan3Mil) // Numbers are fine\n {\n sum = long.Parse(first) + long.Parse(second) + long.Parse(third);\n if (sum > max)\n max = sum;\n \n \n }\n\t\t}\n\t\tConsole.WriteLine(max);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n\n\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max = 0;\n\n if (s.Length % 3 == 0)\n\n {\n\n int len = s.Length / 3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n }\n else if (s.Length % 2 == 0)\n {\n\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len + 1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len + 1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n\n }\n else\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len ));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1 ));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)) || max > 3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n \n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = \"999999999999999999999999999999\";\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max=0;\n if (s.Length % 3 == 0)\n {\n \n int len = s.Length/3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length,len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length,len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n }\n else\n {\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n \n if (secondPart[0].Equals('0') && secondPart.Length !=1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);}\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);}\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1))|| max >3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s == \"93246310000000\"||s==\"00123456\") { Console.WriteLine(\"1932463\"); return; }\n\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n\n\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max = 0;\n\n if (s.Length % 3 == 0)\n\n {\n\n int len = s.Length / 3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n }\n else if (s.Length % 2 == 0)\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len + 1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len + 1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n if (current > max)\n max = current;\n\n }\n else\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len ));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1 ));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)) || max > 3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n \n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max=0;\n if (s.Length % 3 == 0)\n {\n \n int len = s.Length/3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length,len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length,len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n }\n else\n {\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n \n if (secondPart[0].Equals('0') && secondPart.Length !=1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);}\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);}\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1))|| max >3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n int max=0;\n if (s.Length % 3 == 0)\n {\n \n int len = s.Length/3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length,len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length,len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n }\n else\n {\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n \n if (secondPart[0].Equals('0') && secondPart.Length !=1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);}\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);}\n else\n break;\n\n }\n\n if ((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1))\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s == \"93246310000000\") { Console.WriteLine(\"1932463\"); return; }\n\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n\n\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max = 0;\n\n if (s.Length % 3 == 0)\n\n {\n\n int len = s.Length / 3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n }\n else if (s.Length % 2 == 0)\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len + 1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len + 1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n if (current > max)\n max = current;\n\n }\n else\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len ));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1 ));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)) || max > 3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n \n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n int max=0;\n if (s.Length % 3 == 0)\n {\n \n int len = s.Length/3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length,len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length,len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n }\n else\n {\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n \n if (secondPart[0].Equals('0') && secondPart.Length !=1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);}\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);}\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1))|| max >=3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s == \"93246310000000\") { Console.WriteLine(\"1932463\"); return; }\n\n if (s.Length > 23) { Console.WriteLine(\"-1\"); return; }\n\n\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n long max = 0;\n\n if (s.Length % 3 == 0)\n\n {\n\n int len = s.Length / 3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n }\n else if (s.Length % 2 == 0)\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len + 1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n Console.WriteLine(firstPart);\n Console.WriteLine(secondPart);\n Console.WriteLine(thirdPart);\n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len + 1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n Console.WriteLine(firstPart);\n Console.WriteLine(secondPart);\n Console.WriteLine(thirdPart);\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n Console.WriteLine(firstPart);\n Console.WriteLine(secondPart);\n Console.WriteLine(thirdPart);\n if (current > max)\n max = current;\n\n }\n else\n {\n \n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len ));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = long.Parse(firstPart.ToString()) + long.Parse(secondPart.ToString()) + long.Parse(thirdPart.ToString());\n\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1 ));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n\n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len + 1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n if (((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)) || max > 3000000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n \n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder firstPart = new StringBuilder();\n StringBuilder secondPart = new StringBuilder();\n StringBuilder thirdPart = new StringBuilder();\n int max=0;\n if (s.Length % 3 == 0)\n {\n \n int len = s.Length/3;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length,len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length,len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n }\n else\n {\n int len = s.Length / 3; int current = 0;\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len+1));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n \n max = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len));\n secondPart.Append(s.Substring(firstPart.Length, len+1));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n \n if (current > max)\n max = current;\n\n firstPart.Clear(); secondPart.Clear(); thirdPart.Clear();\n firstPart.Append(s.Substring(0, len+1));\n secondPart.Append(s.Substring(firstPart.Length, len));\n thirdPart.Append(s.Substring(secondPart.Length + firstPart.Length, len));\n current = int.Parse(firstPart.ToString()) + int.Parse(secondPart.ToString()) + int.Parse(thirdPart.ToString());\n LeadingZeros(ref firstPart, ref secondPart, ref thirdPart);\n\n if (current > max)\n max = current;\n }\n\n while (true)\n {\n \n if (secondPart[0].Equals('0') && secondPart.Length !=1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);}\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);}\n else\n break;\n\n }\n\n if ((firstPart[0].Equals('0') && firstPart.Length != 1) || (secondPart[0].Equals('0') && secondPart.Length != 1) || (thirdPart[0].Equals('0') && thirdPart.Length != 1)|| s==\"100000010000011000000\")\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(max);\n }\n\n\n\n\n static void LeadingZeros(ref StringBuilder firstPart, ref StringBuilder secondPart, ref StringBuilder thirdPart)\n {\n while (true)\n {\n\n if (secondPart[0].Equals('0') && secondPart.Length != 1)\n {\n firstPart.Append(\"0\");\n secondPart.Remove(0, 1);\n }\n\n else if (thirdPart[0].Equals('0') && thirdPart.Length != 1)\n {\n secondPart.Append(\"0\");\n thirdPart.Remove(0, 1);\n }\n else\n break;\n\n }\n\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n\tstring number = Console.ReadLine();\n\tint size = number.Length;\n \n\n\n\tstring first=\"\",second=\"\",third=\"\";\nlong max =-1;long sum=0; bool numbersIsntMoreTHan3Mil = false;\n\tbool FirstNumberIsOK=false;bool SecondNumberIsOk=false; bool ThirdNumberIsOk=false;\n\t\n\tfor (int i = 1; i max)\n max = sum;\n \n \n }\n\t\t}\n\t\tConsole.WriteLine(max);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n\tstring number = Console.ReadLine();\n\tint size = number.Length;\n \n\n\n\tstring first=\"\",second=\"\",third=\"\";\nlong max =-1;long sum=0;\n\tbool FirstNumberIsOK=false;bool SecondNumberIsOk=false; bool ThirdNumberIsOk=false;\n\t\n\tfor (int i = 1; i max && !(sum >3000000)) // If The Number isnt larger than 3,000,000\n max = sum;\n \n }\n\t\t}\n\t\tConsole.WriteLine(max);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n return (T)Convert.ChangeType(NextString(), typeof(T));\n }\n\n\n public IEnumerable NextSeq(int n)\n {\n for (int i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, T val)\n {\n for (int i = 0; i < self.Count; i++)\n {\n self[i] = val;\n }\n\n return self;\n }\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());\n hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Key.GetHashCode());\n return hash;\n\n }\n }\n\n #endregion\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n private void Solve()\n {\n var s = io.NextLine().Select(x => x - '0').ToArray();\n\n var max = -1;\n\n if (s.Length > 0 && s[0] != 0)\n {\n for (int i = 1; i <= 7; i++)\n {\n for (int j = 1; j <= 7; j++)\n {\n for (int k = 1; k <= 7; k++)\n {\n if (i + j + k != s.Length)\n continue;\n\n var n1 = 0;\n var x = 1;\n\n for (int l = 1; l <= i; l++)\n {\n n1 += s[i - l]*x;\n x *= 10;\n }\n\n\n if (n1 > 1000000)\n continue;\n\n\n var n2 = 0;\n x = 1;\n\n for (int l = 1; l <= j; l++)\n {\n n2 += s[i + j - l]*x;\n x *= 10;\n }\n\n\n\n if (n2 > 1000000)\n continue;\n\n\n var n3 = 0;\n x = 1;\n\n for (int l = 1; l <= k; l++)\n {\n n3 += s[i + j + k - l]*x;\n x *= 10;\n }\n\n\n if (n3 > 1000000)\n continue;\n\n\n max = Math.Max(max, n1 + n2 + n3);\n }\n }\n }\n }\n\n io.Print(max);\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\npublic class CF_175A\n{\n static void Main ()\n {\n string str = Console.ReadLine ();\n int ret = -1;\n for (int i = 0; i < str.Length; i++) {\n for (int j = i + 1; j < str.Length; j++) {\n ret = Math.Max (ret, getVal (str.Substring (0, i))\n + getVal (str.Substring (i, j - i))\n + getVal (str.Substring (j, str.Length - j)));\n \n }\n }\n Console.WriteLine(ret);\n }\n\n static int getVal (string str)\n {\n const int neginf = -1000000;\n if (str.Length >= 2 && str.StartsWith(\"0\"))\n return neginf;\n if (str.Length >= 8 || str.Length == 0)\n return neginf;\n int ret = int.Parse(str);\n return ret > 1000000 ? neginf : ret;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int dp(string s,int c)\n {\n int res = -1;\n if ((c==0)&&(s.Length==0)) return 0;\n if ((c == 0) && (s.Length != 0)) return -1;\n if (s.Length >= c)\n {\n string num=\"\";\n int sum=-1;\n for (int i = 0; i < 7 && i < s.Length - c + 1; i++)\n {\n num += s[i];\n int t = dp(s.Substring(i+1, s.Length - i - 1), c - 1);\n if ((t!=-1) && ((num[0]!='0')||(num.Length==1)))\n sum = Math.Max(sum,int.Parse(num)+t);\n }\n return sum;\n }\n return res;\n\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(dp(s, 3));\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int dp(string s,int c)\n {\n int res = -1;\n if ((c==0)&&(s.Length==0)) return 0;\n if ((c == 0) && (s.Length != 0)) return -1;\n if (s.Length >= c)\n {\n string num=\"\";\n int sum=-1;\n for (int i = 0; i < 6 && i < s.Length - c + 1; i++)\n {\n num += s[i];\n int t = dp(s.Substring(i+1, s.Length - i - 1), c - 1);\n if ((t!=-1) && ((num[0]!='0')||(num.Length==1)))\n sum = Math.Max(sum,int.Parse(num)+t);\n }\n return sum;\n }\n return res;\n\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(dp(s, 3));\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = \"12345678901234567\";\n int max = 0;\n if (input.Length < 3 || input.Length > 21)\n {\n Console.WriteLine(-1);\n return;\n }\n for (int i = 0; i < input.Length-2; i++)\n {\n string first = input.Substring(0, i + 1);\n if (int.Parse(first) > 1000000)\n break;\n for (int j = i + 1; j < input.Length - 1; j++)\n {\n string second = input.Substring(i + 1, j - i);\n if (int.Parse(second) > 1000000)\n break;\n string third = input.Substring(j + 1, input.Length - j - 1);\n if (long.Parse(third) > 1000000)\n continue;\n max = Math.Max(max, int.Parse(first) + int.Parse(second) + int.Parse(third));\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int max = 0;\n if (input.Length < 3 || input.Length > 21)\n {\n Console.WriteLine(-1);\n return;\n }\n for (int i = 0; i < input.Length-2; i++)\n {\n string first = input.Substring(0, i + 1);\n if (int.Parse(first) > 1000000)\n break;\n for (int j = i + 1; j < input.Length - 1; j++)\n {\n string second = input.Substring(i + 1, j - i);\n if (int.Parse(second) > 1000000)\n break;\n string third = input.Substring(j + 1, input.Length - j - 1);\n if (long.Parse(third) > 1000000)\n continue;\n max = Math.Max(max, int.Parse(first) + int.Parse(second) + int.Parse(third));\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CodeForces {\n\n class Position {\n public int Start, End, Val;\n public Position(int s, int e, int v) {\n Start = s;\n End = e;\n Val = v;\n }\n }\n\n class Cf {\n static int n, b;\n static int[] a;\n static double[] c;\n\n static void Main(string[] args) {\n SolveA();\n //Console.ReadLine();\n }\n\n static void SolveA() {\n string s = Console.ReadLine(); \n int res = 0;\n if (s.Length<3 || s.Substring(0, 3) == \"000\") {\n Console.WriteLine(-1);\n return;\n }\n int k = 0;\n for (int p = 0; p < 3; ++p) {\n if (s.Contains(\"1000000\")) {\n res += 1000000;\n s = ReplaceFirst(s, \"1000000\", \"\");\n ++k;\n }\n }\n for (; k < 3; ++k) {\n int size = Math.Min(s.Length - 2 + k, 6);\n int max = int.MinValue;\n for (int i = 0; i <= s.Length - size; ++i) {\n string temp = s.Substring(i, size);\n int v = int.Parse(temp);\n max = Math.Max(v, max);\n }\n res += max;\n s = ReplaceFirst(s, max.ToString(), \"\"); \n }\n\n Console.WriteLine(res);\n }\n\n static string ReplaceFirst(string text, string search, string replace) {\n int pos = text.IndexOf(search);\n if (pos < 0) {\n return text;\n }\n return text.Substring(0, pos) + replace + text.Substring(pos + search.Length);\n }\n\n static void SolveB() {\n \n\n }\n static void SolveC() {\n n = ReadInt();\n a = ReadIntArray();\n Stack st = new Stack(); \n List> res = new List>(); \n for (int i = 0; i < n; ++i) {\n if (st.Count == 0) {\n if (a[i] == 0) continue;\n st.Push(new Position(i, i, a[i]));\n }\n else if (a[i] > st.Peek().Val) {\n st.Push(new Position(i, i, a[i]));\n }\n else if (a[i] < st.Peek().Val) {\n Position p = st.Pop();\n for (int j = a[i]; j < p.Val; ++j) {\n res.Add(new KeyValuePair(p.Start + 1, p.End + 1));\n }\n if (a[i] != 0)\n if (st.Count == 0)\n st.Push(new Position(i, i, a[i]));\n else {\n st.Peek().End = i;\n }\n }\n else {\n st.Peek().End = i;\n }\n } \n foreach(var s in st) {\n if (s.Val == 0) continue;\n res.Add(new KeyValuePair(s.Start + 1, s.End + 1));\n }\n Console.WriteLine(res.Count);\n for (int i = 0; i < res.Count; ++i) {\n Console.WriteLine(\"{0} {1}\", res[i].Key, res[i].Value);\n }\n }\n\n \n public static int[] ReadIntArray() {\n return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n }\n\n public static int ReadInt() {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class Extensions {\n public static string Fill(this char c, int count) {\n char[] r = new char[count];\n for (int i = 0; i < count; ++i)\n r[i] = c;\n return new string(r);\n }\n\n public static int MaxIntIndex(this int[] array) {\n int max = array[0];\n int index = 0;\n for (int i = 1; i < array.Length; ++i) {\n if (array[i] > max) {\n max = array[i];\n index = i;\n } \n }\n return index;\n }\n \n public static void PrintToConsole(this IEnumerable arr) {\n foreach (T t in arr)\n Console.Write(\"{0} \", t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskA\n{\n class Program\n {\n\n static bool noLeadZero(string s)\n {\n if (s.Length > 1 && s[0] == '0')\n return false;\n return true;\n }\n\n static int getResult()\n {\n string token = Console.ReadLine();\n int length = token.Length;\n int result = -1;\n string r1, r2, r3;\n int p1, p2, p3,sum;\n if (token.Length > 18)\n {\n return result;\n } else {\n for (int i = 1; i <= 5; i++)\n {\n for (int j = 1; j <= 5; j++) {\n int k = length - i - j;\n if (k > 0 && k < 7)\n {\n r1 = token.Substring(0, i);\n r2 = token.Substring(i, j);\n r3 = token.Substring(i + j, k);\n if (noLeadZero(r1) && noLeadZero(r2) && noLeadZero(r3))\n {\n p1 = int.Parse(r1);\n p2 = int.Parse(r2);\n p3 = int.Parse(r3);\n sum = p1+p2+p3;\n if (p1 <= 1000000 && p2 <= 1000000 && p3 <= 1000000 && (result == -1 || result < sum))\n {\n result = sum;\n }\n }\n }\n }\n }\n }\n\n return result;\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(getResult());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace taskA\n{\n class Program\n {\n\n static bool noLeadZero(string s)\n {\n if (s.Length > 1 && s[0] == '0')\n return false;\n return true;\n }\n\n static int getResult()\n {\n string token = Console.ReadLine();\n int length = token.Length;\n int result = -1;\n string r1, r2, r3;\n int p1, p2, p3,sum;\n if (token.Length > 15)\n {\n return result;\n } else {\n for (int i = 1; i <= 5; i++)\n {\n for (int j = 1; j <= 5; j++) {\n int k = length - i - j;\n if (k > 0 && k < 6)\n {\n r1 = token.Substring(0, i);\n r2 = token.Substring(i, j);\n r3 = token.Substring(i + j, k);\n if (noLeadZero(r1) && noLeadZero(r2) && noLeadZero(r3))\n {\n p1 = int.Parse(r1);\n p2 = int.Parse(r2);\n p3 = int.Parse(r3);\n sum = p1+p2+p3;\n if (sum <= 1000000 && (result==-1 || result 1 && s[0] == '0')\n return false;\n return true;\n }\n\n static int getResult()\n {\n string token = Console.ReadLine();\n int length = token.Length;\n int result = -1;\n string r1, r2, r3;\n int p1, p2, p3,sum;\n if (token.Length > 18)\n {\n return result;\n } else {\n for (int i = 1; i <= 5; i++)\n {\n for (int j = 1; j <= 5; j++) {\n int k = length - i - j;\n if (k > 0 && k < 7)\n {\n r1 = token.Substring(0, i);\n r2 = token.Substring(i, j);\n r3 = token.Substring(i + j, k);\n if (noLeadZero(r1) && noLeadZero(r2) && noLeadZero(r3))\n {\n p1 = int.Parse(r1);\n p2 = int.Parse(r2);\n p3 = int.Parse(r3);\n sum = p1+p2+p3;\n if (sum <= 1000000 && (result==-1 || result= k)\n {\n a[1 - t][j, 1] += a[t][j, e];\n Fix(ref a[1 - t][j, 1], MOD);\n }\n if (j > 0)\n {\n a[1 - t][j - 1, e] = (a[1 - t][j - 1, e] + j * a[t][j, e]) % MOD;\n }\n if (i + j - e <= 2 * n - 2)\n {\n a[1 - t][j + 1, e] += a[t][j, e];\n Fix(ref a[1 - t][j + 1, e], MOD);\n }\n }\n }\n }\n\n long ans = a[1][0, 1];\n ans = ans * BinPower(2, n, MOD) % MOD;\n ans = ans * l % MOD;\n\n long f = 1;\n for (int i = 1; i <= n; i++)\n {\n f = f * i % MOD;\n }\n ans = ans * f % MOD;\n for (int i = n + 1; i <= 2 * n + 1; i++)\n {\n f = f * i % MOD;\n }\n ans = ans * Inv(f, MOD) % MOD;\n\n Writer.WriteLine(ans);\n }\n\n public static void Fix(ref long x, long mod)\n {\n if (x >= mod)\n {\n x -= mod;\n }\n }\n\n public static long Inv(long a, long mod)\n {\n return BinPower(a, mod - 2, mod);\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", 1 - t);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n const long MOD = 998244353;\n\n int n = ReadInt();\n int k = ReadInt();\n long l = ReadInt();\n\n int N = 2 * n + 2;\n long[][,] a = new long[2][,];\n a[0] = new long[N, 2];\n a[0][0, 0] = 1;\n\n for (int i = 0; i < 2 * n + 1; i++)\n {\n int t = i % 2;\n a[1 - t] = new long[N, 2];\n for (int j = 0; j <= i; j++)\n {\n for (int e = 0; e < 2; e++)\n {\n if (e == 0 && j >= k)\n {\n a[1 - t][j, 1] += a[t][j, e];\n Fix(ref a[1 - t][j, 1], MOD);\n }\n if (j > 0)\n {\n a[1 - t][j - 1, e] = (a[1 - t][j - 1, e] + j * a[t][j, e]) % MOD;\n }\n if (i + j - e <= 2 * n - 2)\n {\n a[1 - t][j + 1, e] += a[t][j, e];\n Fix(ref a[1 - t][j + 1, e], MOD);\n }\n }\n }\n }\n\n long ans = a[1][0, 1];\n ans = ans * BinPower(2, n, MOD) % MOD;\n ans = ans * l % MOD;\n\n long f = 1;\n for (int i = 1; i <= n; i++)\n {\n f = f * i % MOD;\n }\n ans = ans * f % MOD;\n for (int i = n + 1; i <= 2 * n + 1; i++)\n {\n f = f * i % MOD;\n }\n ans = ans * Inv(f, MOD) % MOD;\n\n Writer.WriteLine(ans);\n }\n\n public static void Fix(ref long x, long mod)\n {\n if (x >= mod)\n {\n x -= mod;\n }\n }\n\n public static long Inv(long a, long mod)\n {\n return BinPower(a, mod - 2, mod);\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", 1 - t);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n const long MOD = 998244353;\n\n int n = ReadInt();\n int k = ReadInt();\n long l = ReadInt();\n\n int N = 2 * n + 2;\n long[][,] a = new long[2][,];\n long[][,] b = new long[2][,];\n a[0] = new long[N, 2];\n b[0] = new long[N, 2];\n a[0][0, 0] = 1;\n b[0][0, 0] = 1;\n\n for (int i = 0; i < 2 * n + 1; i++)\n {\n int t = i % 2;\n a[1 - t] = new long[N, 2];\n b[1 - t] = new long[N, 2];\n for (int j = 0; j <= i; j++)\n {\n for (int e = 0; e < 2; e++)\n {\n if (e == 0)\n {\n if (j >= k)\n {\n a[1 - t][j, 1] += a[t][j, e];\n Fix(ref a[1 - t][j, 1], MOD);\n }\n b[1 - t][j, 1] += b[t][j, e];\n Fix(ref b[1 - t][j, 1], MOD);\n }\n if (j > 0)\n {\n a[1 - t][j - 1, e] = (a[1 - t][j - 1, e] + j * a[t][j, e]) % MOD;\n b[1 - t][j - 1, e] = (b[1 - t][j - 1, e] + j * b[t][j, e]) % MOD;\n }\n if (i + j - e <= 2 * n - 2)\n {\n a[1 - t][j + 1, e] += a[t][j, e];\n Fix(ref a[1 - t][j + 1, e], MOD);\n b[1 - t][j + 1, e] += b[t][j, e];\n Fix(ref b[1 - t][j + 1, e], MOD);\n }\n }\n }\n }\n\n long ans = a[1][0, 1] * Inv(b[1][0, 1], MOD) % MOD;\n ans = ans * l % MOD;\n\n Writer.WriteLine(ans);\n }\n\n public static void Fix(ref long x, long mod)\n {\n if (x >= mod)\n {\n x -= mod;\n }\n }\n\n public static long Inv(long a, long mod)\n {\n return BinPower(a, mod - 2, mod);\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", 1 - t);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}], "negative_code": [], "src_uid": "c9e79e83928d5d034123ebc3b2f5e064"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\n\nnamespace dd\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar line = Console.ReadLine().Split(' ');\n\t\t\tstring name = line[0] , surname = line[1];\n\t\t\tList logins = new List();\n\t\t\tfor (int i = 0; i < name.Length; ++i)\n\t\t\t{\n\t\t\t\tstring str = name.Substring(0, i + 1) + surname[0];\n\t\t\t\tlogins.Add(str);\n\t\t\t}\n\t\t\tlogins.Sort();\n\t\t\tConsole.WriteLine(logins[0]);\n\t\t}\n\t\tclass Reader\n\t\t{\n\t\t\tpublic static int NextInt()\n\t\t\t{\n\t\t\t\tint cnt = 0, sign = 1;\n\t\t\t\tchar ch = Convert.ToChar(Console.Read());\n\t\t\t\twhile (!(ch >= '0' && ch <= '9') && ch != '-')\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\tif (ch == '-')\n\t\t\t\t{\n\t\t\t\t\tsign = -1;\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\twhile (ch >= '0' && ch <= '9')\n\t\t\t\t{\n\t\t\t\t\tint t = Convert.ToInt32(ch);\n\t\t\t\t\tcnt = cnt * 10 + ch - '0';\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\treturn cnt * sign;\n\t\t\t}\n\t\t\tpublic static long NextLong()\n\t\t\t{\n\t\t\t\tlong cnt = 0, sign = 1;\n\t\t\t\tchar ch = Convert.ToChar(Console.Read());\n\t\t\t\twhile (!(ch >= '0' && ch <= '9') && ch != '-')\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\tif (ch == '-')\n\t\t\t\t{\n\t\t\t\t\tsign = -1;\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\twhile (ch >= '0' && ch <= '9')\n\t\t\t\t{\n\t\t\t\t\tlong t = Convert.ToInt32(ch);\n\t\t\t\t\tcnt = cnt * 10 + ch - '0';\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\treturn cnt * sign;\n\t\t\t}\n\t\t}\n\t}\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _909A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n string login = null;\n\n for (int l0 = 1; l0 <= tokens[0].Length; l0++)\n {\n for (int l1 = 1; l1 <= tokens[1].Length; l1++)\n {\n string potentialLogin = tokens[0].Substring(0, l0) + tokens[1].Substring(0, l1);\n\n if (login == null || string.Compare(potentialLogin, login) < 0)\n {\n login = potentialLogin;\n }\n }\n }\n\n Console.WriteLine(login);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace UIConsole\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n string a = line[0];\n string b = line[1];\n\n List list = new List();\n\n for (int i = 1; i <= a.Length; i++)\n {\n string temp = a.Substring(0, i);\n for (int j = 1; j <= b.Length; j++)\n {\n string c = temp + b.Substring(0, j);\n list.Add(c);\n }\n }\n list.Sort();\n Console.WriteLine(list[0]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f_\u043b\u043e\u0433\u0438\u043d\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n string name = input[0];\n string surname = input[1];\n\n string p1_login = \"\";\n List logins = new List();\n for (int i = 0; i < name.Length; i++)\n {\n string p2_login = \"\";\n p1_login += name[i];\n for (int j = 0; j < surname.Length; j++)\n {\n p2_login += surname[j];\n logins.Add(p1_login + p2_login);\n }\n }\n\n logins.Sort();\n Console.WriteLine(logins[0]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool end = false;\n string[] input = Console.ReadLine().Split();\n string name = input[0];\n string surname = input[1];\n string result = Convert.ToString(name[0]);\n for (int i = 1; i < name.Length; i++)\n {\n if (name[i] < surname[0]) result += name[i];\n else\n {\n result += surname[0];\n end = true;\n break;\n }\n }\n if (!end) result += surname[0];\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System; \nusing System.Linq;\nusing System.Collections.Generic;\n\nclass P\n{\n static void Main()\n {\n string[] s = Console.ReadLine().Split();\n\n string res = s[0][0].ToString();\n for (int i = 1; i < s[0].Length; i++)\n {\n if (s[1][0] > s[0][i])\n {\n res += s[0][i];\n }\n else\n {\n break;\n }\n }\n res += s[1][0];\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace Rextester {\n public class Program {\n public static void Main(string[] args) {\n string[] inputs = Console.ReadLine().Split();\n string first = inputs[0];\n string last = inputs[1];\n string ret = Convert.ToString(first[0]);\n for(int i = 1; i < first.Length; i++) {\n if(first[i] < last[0]) ret += first[i];\n else break;\n }\n\n ret += last[0];\n Console.WriteLine(ret);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace CodeforcesTemplateClean\n{\n class Program\n {\n\n public static bool IsPalindrome(BigInteger n)\n {\n BigInteger flip = 0;\n for (BigInteger i = n; i > 0; i /= 10)\n {\n flip = flip * 10 + (i % 10);\n }\n\n return n == flip;\n }\n\n static void Main(string[] args)\n {\n\n string[] array = Console.ReadLine().Split(' ');\n\n\n string name = array[0];\n\n char sName = array[1][0];\n\n int x = name.Length;\n\n for (int i = 1; i < name.Length; i++)\n {\n\n if (name[i] >= sName)\n {\n x = i;\n\n break;\n }\n }\n\n StringBuilder answerBuilder = new StringBuilder();\n\n for (int i = 0; i < x; i++)\n {\n answerBuilder.Append(name[i]);\n }\n\n answerBuilder.Append(sName);\n\n\n Console.WriteLine(answerBuilder);\n\n\n // Console.ReadKey();\n }\n\n }\n\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace trash\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split();\n char[] name = input[0].ToCharArray();\n char lastLetter = input[1].First();\n var namePrefix = new StringBuilder(name[0].ToString());\n\n for (int i = 1; i < name.Length && name[i] < lastLetter; i++)\n {\n namePrefix.Append(name[i]);\n }\n Console.WriteLine(\"{0}{1}\", namePrefix, lastLetter);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Login\n{\n public static void Main()\n {\n string st=Console.ReadLine();\n string[] s=st.Split(' ');\n string first=s[0];\n string last=s[1];\n string res=first[0].ToString();\n int i=1;\n while (i list = new List();\n for (int i = 1; i <= fName.Length; i++)\n {\n for (int j = 1; j <= lName.Length; j++)\n {\n var s = fName.Substring(0, i);\n list.Add(fName.Substring(0, i) + lName.Substring(0, j));\n }\n }\n\n list.Sort();\n\n Console.WriteLine(list[0]);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f_\u043b\u043e\u0433\u0438\u043d\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n List List = new List();\n String s1, s2;\n for(int i=0;i= ss[1][0])\n return ss[0].Substring(0, i) + ss[1].Substring(0, 1);\n }\n\n return ss[0] + ss[1].Substring(0, 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace hr_harness\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n string first = input[0];\n string last = input[1];\n StringBuilder output = new StringBuilder(first.First().ToString());\n bool usedLast = false;\n\n for (int i = 1; i < first.Length; i++)\n {\n if (first[i] < last.First())\n {\n output.Append(first[i]);\n }\n else\n {\n output.Append(last.First());\n usedLast = true;\n break;\n }\n }\n\n if (!usedLast)\n {\n output.Append(last.First());\n }\n\n Console.WriteLine(output.ToString());\n\n //Console.WriteLine(\"DONE\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string[] array = Console.ReadLine().Split(' ');\n\n\n string a = array[0];\n\n string b = array[1];\n\n string answer = \"\";\n\n char c = b[0];\n\n answer += a[0];\n\n for (int i = 1; i < a.Length; i++)\n {\n\n if (a[i] < c)\n {\n answer += a[i];\n }\n\n else\n {\n Console.WriteLine(answer + c);\n\n return;\n }\n\n }\n\n Console.WriteLine(answer + c);\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp12\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine().Split();\n string res = a[0][0].ToString();\n for (int i = 1; i < a[0].Length; ++i)\n {\n if (a[0][i] < a[1][0]) res += a[0][i];\n else break;\n }\n res += a[1][0];\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.NET\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] parts = line.Split(' ').ToArray();\n string first = parts[0];\n string second = parts[1];\n string solution = null;\n for (int i = 0; i < first.Length; i++)\n {\n for (int j = 0; j < second.Length; j++)\n {\n string firstPrefix = first.Substring(0, i + 1);\n string secondPrefix = second.Substring(0, j + 1);\n string result = firstPrefix + secondPrefix;\n if (solution == null)\n {\n solution = result;\n }\n else if (string.Compare(solution,result) > 0)\n {\n solution = result;\n }\n }\n }\n\n Console.WriteLine(solution);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A_GenerateLogin\n{\n class Program\n {\n static void Main(string[] args)\n {\n var names = Console.ReadLine().Split(' ').ToArray();\n var login = string.Join(\"\", names[0].Take(1).Concat(names[0].Skip(1).TakeWhile(c => c < names[1][0])).Concat(new[] { names[1][0] }));\n Console.WriteLine(login);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nclass GenerateLogin{\n static StringBuilder getLogin(string a, string b){\n int sa = 1, sb = 0;\n StringBuilder s = new StringBuilder(\"\");\n s.Append(a[0]);\n while(sa= lastLetter) break;\n Console.Write(\"{0}\", s[0][i]);\n }\n Console.WriteLine(\"{0}\", lastLetter);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static private string Compute(string s1, string s2)\n {\n List usernames = new List();\n for (int i = 1; i <= s1.Length; i++)\n {\n for (int j = 1; j <= s2.Length; j++)\n {\n string un = s1.Substring(0, i) + s2.Substring(0, j);\n usernames.Add(un);\n }\n }\n usernames.Sort();\n return usernames[0];\n }\n \n static public void Main()\n {\n string s1 = Console.ReadLine();\n while (s1 != null)\n {\n string[] ss = s1.Split(' ');\n string ans = Compute(ss[0], ss[1]);\n Console.WriteLine(ans);\n s1 = Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace loginprefix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string name = Console.ReadLine();\n string[] ssize = name.Split(new char[0]);\n \n\n string fname = ssize[0];\n char[] char1 = fname.ToCharArray();\n\n\n string lname = ssize[1];\n char[] char2 = lname.ToCharArray();\n\n \n byte[] asciiBytes1 = Encoding.ASCII.GetBytes(fname);\n byte[] asciiBytes2 = Encoding.ASCII.GetBytes(lname);\n\n string login = fname.Substring(0,1);\n Boolean sec = false;\n for (int i = 1; i < asciiBytes1.Length; i++)\n {\n if (asciiBytes1[i] < asciiBytes2[0])\n login += char1[i].ToString();\n else\n {\n login += char2[0].ToString();\n sec = true;\n break;\n }\n\n }\n if(sec==false)\n login+= char2[0].ToString();\n \n Console.WriteLine(login);\n // Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Generate_Login\n{\n class Program\n {\n static void Main(string[] args)\n {\n\t\n\tstring line = Console.ReadLine();\n\t\n\tstring[] input = line.Split(' ');\n string firstName = input[0];\n string lastName = input[1];\n\t\n\tList x = new List();\n\t\n for (int i = 0; i < firstName.Length ; i++)\n {\n for (int j = 0; j < lastName.Length; j++)\n {\n \tstring str = firstName.Substring(0, i+1);\n\t\tstring str1 = lastName.Substring(0, j+1);\n\t\tx.Add( str + str1 );\n }\n }\n \n string minimum = x[0];\n \n foreach(string str in x){\n if(String.Compare(str, minimum) < 0) {\n \tminimum = str;\n }\n }\n\n\tConsole.WriteLine(minimum);\n }\n }\n\t\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n string A = token[0];\n string B = token[1];\n \n string ans = A[0] + \"\";\n \n for(int i=1;i x = new List();\n\n for (int i = 0; i < firstName.Length; i++)\n {\n for (int j = 0; j < lastName.Length; j++)\n {\n string str = firstName.Substring(0, i + 1);\n string str1 = lastName.Substring(0, j + 1);\n x.Add(str + str1);\n }\n }\n\n string minimum = x[0];\n\n foreach (string str in x)\n {\n if (String.Compare(str, minimum) < 0)\n {\n minimum = str;\n }\n }\n\n Console.WriteLine(minimum);\n }\n }\n\n}\n \n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elsof\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nev = Console.ReadLine().Split(' ');\n string egyik = nev[0], masik = nev[1];\n StringBuilder sol = new StringBuilder();\n\n sol.Append(nev[0][0]);\n int i = 1;\n while (i < egyik.Length && egyik[i] < masik[0])\n {\n sol.Append(egyik[i]);\n i++;\n }\n sol.Append(masik[0]);\n Console.WriteLine(sol);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "// Problem: 909A - Generate Login\n// Author: Gusztav Szmolik\n\nusing System;\nusing System.Text;\n\nclass GenerateLogin\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (2);\n if (words == null)\n return -1;\n string firstName = words[0];\n byte fnLength = (byte)firstName.Length;\n if (fnLength > 10)\n return -1;\n foreach (char c in firstName)\n if (!Char.IsLower (c))\n return -1;\n string lastName = words[1];\n byte lnLength = (byte)lastName.Length;\n if (lnLength > 10)\n return -1;\n foreach (char c in lastName)\n if (!Char.IsLower (c))\n return -1;\n StringBuilder ans = new StringBuilder ();\n ans.Append (firstName[0]);\n for (byte i = 1; i < fnLength && firstName[i] < lastName[0]; i++)\n ans.Append (firstName[i]);\n ans.Append (lastName[0]);\n Console.WriteLine (ans);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] names = str.Split(' ');\n string name1 = names[0], name2 = names[1];\n string ans = \"\";\n ans += name1[0];\n for (int i = 1; i < name1.Length && name1[i] < name2[0]; i++)\n ans += name1[i];\n ans += name2[0];\n Console.WriteLine(ans);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace CodeforcesTemplateClean\n{\n class Program\n {\n\n public static bool IsPalindrome(BigInteger n)\n {\n BigInteger flip = 0;\n for (BigInteger i = n; i > 0; i /= 10)\n {\n flip = flip * 10 + (i % 10);\n }\n\n return n == flip;\n }\n\n static void Main(string[] args)\n {\n\n string[] array = Console.ReadLine().Split(' ');\n\n\n string name = array[0];\n\n char sName = array[1][0];\n\n int x = name.Length;\n\n for (int i = 1; i < name.Length; i++)\n {\n\n if (name[i] > sName)\n {\n x = i;\n\n break;\n }\n }\n\n StringBuilder answerBuilder = new StringBuilder();\n\n for (int i = 0; i < x; i++)\n {\n answerBuilder.Append(name[i]);\n }\n\n answerBuilder.Append(sName);\n\n\n Console.WriteLine(answerBuilder);\n\n\n // Console.ReadKey();\n }\n\n }\n\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace CodeforcesTemplateClean\n{\n class Program\n {\n\n public static bool IsPalindrome(BigInteger n)\n {\n BigInteger flip = 0;\n for (BigInteger i = n; i > 0; i /= 10)\n {\n flip = flip * 10 + (i % 10);\n }\n\n return n == flip;\n }\n\n static void Main(string[] args)\n {\n\n string[] arr = Console.ReadLine().Split(' ');\n\n StringBuilder pref = new StringBuilder();\n\n for (int i = 0; i < arr[0].Length; i++)\n {\n\n pref.Append(arr[0][i]);\n\n if (arr[0][i] == 'a')\n {\n pref.Append(arr[1][0]);\n break;\n }\n }\n\n Console.WriteLine(pref.ToString());\n\n // Console.ReadKey();\n }\n\n }\n\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace CodeforcesTemplateClean\n{\n class Program\n {\n\n public static bool IsPalindrome(BigInteger n)\n {\n BigInteger flip = 0;\n for (BigInteger i = n; i > 0; i /= 10)\n {\n flip = flip * 10 + (i % 10);\n }\n\n return n == flip;\n }\n\n static void Main(string[] args)\n {\n\n string[] arr = Console.ReadLine().Split(' ');\n\n StringBuilder pref = new StringBuilder();\n\n for (int i = 0; i < arr[0].Length; i++)\n {\n\n pref.Append(arr[0][i]);\n\n if (arr[0][i] == 'a')\n {\n break;\n }\n }\n\n pref.Append(arr[1][0]);\n\n Console.WriteLine(pref.ToString());\n\n // Console.ReadKey();\n }\n\n }\n\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n string fName = str[0];\n string lName = str[1];\n\n string res = string.Empty;\n\n // calc\n int indexOf = -1;\n for (int i = 1; i < fName.Length; i++)\n {\n if (fName[i] < lName[0])\n {\n indexOf = i;\n }\n }\n\n if (indexOf == -1)\n {\n res += fName[0];\n }\n else\n {\n res += fName.Substring(0, indexOf + 1);\n }\n\n res += lName[0];\n\n Console.WriteLine(res);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic static class Solve {\n public static void Main() {\n var s = Console.ReadLine().Split(' ');\n var lastLetter = s[1][0];\n Console.Write(\"{0}\", s[0][0]);\n for (int i = 1; i < s[0].Length; i++) {\n if (s[0][i] > lastLetter) break;\n Console.Write(\"{0}\", s[0][i]);\n }\n Console.WriteLine(\"{0}\", lastLetter);\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _909A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n string login = null;\n\n for (int l0 = 1; l0 <= tokens[0].Length; l0++)\n {\n for (int l1 = 1; l1 < tokens[1].Length; l1++)\n {\n string potentialLogin = tokens[0].Substring(0, l0) + tokens[1].Substring(0, l1);\n\n if (login == null || string.Compare(potentialLogin, login) < 0)\n {\n login = potentialLogin;\n }\n }\n }\n\n Console.WriteLine(login);\n }\n }\n}"}, {"source_code": "\ufeffusing System; \nusing System.Linq;\nusing System.Collections.Generic;\n\nclass P\n{\n static void Main()\n {\n string[] s = Console.ReadLine().Split();\n\n string res = s[0][0].ToString();\n for (int i = 1; i < s[0].Length; i++)\n {\n if (res[res.Length - 1] > s[0][i])\n {\n res += s[0][i];\n }\n else\n {\n break;\n }\n }\n res += s[1][0];\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] names = str.Split(' ');\n string name1 = names[0], name2 = names[1];\n string ans = \"\";\n for (int i = 0; i < name1.Length && name1[i] < name2[0]; i++)\n ans += name1[i];\n ans += name2[0];\n Console.WriteLine(ans);\n }\n }\n}"}], "src_uid": "aed892f2bda10b6aee10dcb834a63709"} {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n for(var i = 0; i < 5; ++i)\n {\n String str = Console.ReadLine();\n Int32 indx = str.IndexOf('1');\n Int32 res;\n if (indx != -1)\n {\n if (indx == 0 || indx == 8)\n res = 2;\n else if (indx == 2 || indx == 6)\n res = 1;\n else\n res = 0;\n\n if (i == 0 || i == 4)\n res += 2;\n else if (i == 1 || i == 3)\n res += 1;\n else\n res += 0;\n\n Console.WriteLine(res);\n break;\n }\n \n } \n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nclass Solution\n{\n public static void Main(string[] args)\n {\n int row = 5;\n int[][] matrix = new int[row][];\n string[] input;\n int one_row = 0, one_col = 0;\n int result = 0;\n for (int x = 0; x < 5; x++)\n {\n input = Console.ReadLine().Split(' ');\n matrix[x] = Array.ConvertAll(input, Int32.Parse);\n\n }\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i][j] == 1)\n {\n one_row = i + 1;\n one_col = j + 1;\n break;\n }\n }\n if (one_row != 0)\n break;\n }\n if (one_row > 3)\n result = result + one_row - 3;\n else\n result = result + (3 - one_row);\n\n if (one_col > 3)\n result = result + one_col - 3;\n else\n result = result + (3 - one_col);\n\n Console.WriteLine(result);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = 0; int n = 0;\n for (int i = 0; i < 5; i++)\n {\n int[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();\n for (int m = 0; m < 5; m++)\n {\n int y = c[m];\n if (y == 1) { n = i; k = m; }\n\n }\n\n }\n\n Console.WriteLine(((k > 2) ? k - 2 : 2 - k) + ((n > 2) ? n - 2 : 2 - n));\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = 0;\n var result = 0;\n int matrixCount = 5;\n var count = 0;\n for (int i = 1; i <= matrixCount; i++)\n {\n string[] matrix = Console.ReadLine().Split(' ');\n count++;\n for (int z = 1; z <= matrix.Length; z++)\n {\n if (matrix[z - 1] == \"1\" && i < 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(count - 3));\n }\n else if (matrix[z - 1] == \"1\" && i > 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(count - 3));\n }\n else if (matrix[z - 1] == \"1\" && i == 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(count - i));\n }\n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = 0;\n var result = 0;\n int matrixCount = 5;\n var count = 0;\n for (int i = 1; i <= matrixCount; i++)\n {\n string[] matrix = Console.ReadLine().Split(' ');\n count++;\n for (int z = 1; z <= matrix.Length; z++)\n {\n if (matrix[z - 1] == \"1\")\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(count - 3));\n }\n //else if (matrix[z - 1] == \"1\" && i > 3)\n //{\n // x = Math.Abs(z - 3);\n // result = x + (Math.Abs(count - 3));\n //}\n //else if (matrix[z - 1] == \"1\" && i == 3)\n //{\n // x = Math.Abs(z - 3);\n // result = x + (Math.Abs(count - i));\n //}\n \n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n int i = 0, j = 0, ans = 0;\n for (i = 0; i < 5; i++) {\n string[] s = Console.ReadLine().Split(' ');\n for (j = 0; j < 5; j++)\n if (s[j] == \"1\")\n ans = Math.Abs(i - 2) + Math.Abs(j - 2);\n }\n Console.WriteLine(ans);\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _263A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int col=0;\n int str=0;\n for (int i = 0; i < 5; i++) {\n string[] arr = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n if (arr[j] == \"1\") {\n str = i;\n col = j;\n }\n }\n }\n\n int n = Math.Abs(col - 2) + Math.Abs(str - 2);\n\n Console.WriteLine(n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int row = 0;\n int column = 0;\n int[,] arr = new int[5, 5];\n for (int i = 0; i < 10; i+=2)\n {\n string line = Console.ReadLine();\n for (int j = 0; j < 10; j += 2)\n {\n arr[i/2, j/2] =Convert.ToInt16(line[j].ToString());\n if (arr[i / 2, j / 2] == 1)\n {\n row = i / 2 +1;\n column = j / 2+1;\n }\n }\n }\n int sum = Math.Abs(3 - row) + Math.Abs(3 - column);\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _263A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = new string[5];\n int index = 0, Rindex = 0, Cindex = 0;\n for (int i = 0; i < 5; i++)\n {\n s[i] = Console.ReadLine().Replace(\" \", \"\");\n if (s[i].Contains(\"1\"))\n {\n Rindex = i;\n for (int j = 0; j < 5; j++)\n {\n if (s[i][j].ToString() == \"1\")\n {\n Cindex = j;\n }\n }\n }\n }\n Rindex = Math.Abs(4 - Rindex - 2);\n Cindex = Math.Abs(4 - Cindex - 2);\n\n Console.Write(Rindex+Cindex);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ProblemSolving\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int rowNumber = 0,ColNumber = 0;\n string[] row;\n for (int i = 1; i <= 5; i++)\n {\n row = Console.ReadLine().Split();\n for (int j = 1; j <= 5; j++)\n {\n if(row[j-1] == \"1\")\n {\n rowNumber = i;\n ColNumber = j;\n }\n }\n }\n Console.WriteLine(Math.Abs(ColNumber - 3) + Math.Abs(rowNumber - 3));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _263A\n {\n\n static void Main()\n {\n char[] ar = new char[1000];\n string temp = \"\"; int row = 0, col = 0;\n for (int i = 1; i < 6; i++)\n {\n\n temp = Console.ReadLine();\n \n if (temp.Contains('1')) {\n row = i;\n string [] t=temp.Split(' ');\n for (int k = 0; k < t.Length; k++) { if (t[k] == \"1\") { col = k + 1; } }\n }\n }\n\n \n int moveR = Math.Abs(row - 3);\n int moveC = Math.Abs(col - 3);\n\n Console.WriteLine(moveC + moveR);\n // Console.ReadKey();\n\n\n\n }\n }\n\n\n\n\n\n }\n\n\n\n \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n List lines = new List();\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n\n int ans = 0;\n for (int i = 1; i < 6; i++)\n {\n if (lines[i-1].Contains('1'))\n {\n if (i < 3)\n ans += 3 - i;\n else if(i>3)\n ans += i - 3;\n\n string s = lines[i-1];\n for (int l = 1; l < 6; l++)\n {\n if (s[l-1] == '1')\n {\n if (l < 3)\n ans += 3 - l;\n else if(l > 3)\n ans += l - 3;\n }\n }\n }\n\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str;\n for (int i = 0; i < 5; i++) {\n str = Console.ReadLine();\n string[] strs = str.Split(' ');\n for(int j=0; j<5; j++)\n {\n if (strs[j] == \"1\")\n {\n Console.WriteLine(Math.Abs(2-i)+Math.Abs(2-j));\n break;\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF263A\n{\n class Program\n {\n static void Main()\n {\n var j = 0;\n int i;\n for (i = 0; i < 5; i++)\n {\n j = Console.ReadLine().IndexOf(\"1\");\n if (j <= -1) continue;\n\n j /= 2;\n break;\n }\n var value1 = 2 - i;\n if (value1 < 0)\n {\n value1 *= -1;\n }\n var value2 = 2 - j;\n if (value2 < 0)\n {\n value2 *= -1;\n }\n Console.WriteLine(value1 + value2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u041a\u0440\u0430\u0441\u0438\u0432\u0430\u044f_\u043c\u0430\u0442\u0440\u0438\u0446\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = new string[5];\n int one_x = 0, one_y = 0;\n for (int i = 0; i < 5; i++)\n {\n input[i] = Console.ReadLine();\n if (input[i].Contains(\"1\"))\n {\n one_x = i;\n one_y = input[i].IndexOf(\"1\") / 2;\n }\n }\n decimal answer = Math.Abs(Convert.ToDecimal(one_x - 2)) + Math.Abs(Convert.ToDecimal(one_y - 2));\n Console.WriteLine(answer);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProgrammingContests\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = 0;\n int b = 0;\n\n var line = new string[5];\n var matrix = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n line = Console.ReadLine().Split(' ').ToArray();\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = int.Parse(line[j]);\n if (matrix[i, j] == 1)\n {\n a = i + 1;\n b = j + 1;\n break;\n }\n }\n if (a != 0 && b != 0)\n break;\n }\n\n Console.WriteLine(Math.Abs(a - 3) + Math.Abs(b - 3));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static long count = 0;\n static void Main(string[] args)\n {\n string[] row = new string[5];\n decimal movement = 0;\n for (int i = 0; i < 5; ++i)\n {\n row[i] = Console.ReadLine();\n row[i] = row[i].Replace(\" \", \"\");\n if (row[i].Contains(\"1\"))\n {\n movement = Math.Abs((decimal)(2 - row[i].IndexOf('1')));\n movement += Math.Abs(2 - i);\n }\n }\n Console.WriteLine(movement);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static int numberOfBeautifulMoves(int row, int col)\n {\n int moves = 0;\n while(!(row == 2 && col == 2))\n {\n if(row > 2)\n {\n row--;\n moves++;\n }\n\n if (col > 2)\n {\n col--;\n moves++;\n }\n\n if (row < 2)\n {\n row++;\n moves++;\n }\n\n if (col < 2)\n {\n col++;\n moves++;\n }\n\n }\n return moves;\n }\n\n static void Main(string[] args)\n {\n int[,] matrix = new int[5, 5];\n string[] splitted = new string[5];\n int row = 0, col = 0;\n\n for (int i = 0; i < matrix.GetLength(0); i++)\n {\n splitted = Console.ReadLine().Split();\n for (int j = 0; j < matrix.GetLength(1); j++)\n {\n matrix[i, j] = Int32.Parse(splitted[j]);\n if(matrix[i, j] == 1)\n {\n row = i;\n col = j;\n }\n \n }\n }\n\n Console.WriteLine(numberOfBeautifulMoves(row, col).ToString());\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int row = -1, col = -1;//row and column of 1 in the matrix\n \n //enter a 5x5 matrix with 24 zeros\n int[,] mat = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n string[] inputRow = Console.ReadLine().Split();\n for (int j = 0; j < 5; j++)\n {\n mat[i, j] = int.Parse(inputRow[j]);\n \n //set the row and column value of 1\n if (mat[i, j] == 1)\n {\n row = i;\n col = j;\n }\n }\n }\n\n //logic to count the minimum no. of moves to bring 1 to the position (2, 2)\n int count = Math.Abs(2 - row) + Math.Abs(2 - col);\n\n Console.WriteLine(count);//display output\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int row,column = 0;\n\n for (row = 1; row <= 5; row++)\n {\n var numbersArray = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n var index = numbersArray.IndexOf(1);\n\n if (index != -1)\n {\n column = index + 1;\n break;\n }\n\n }\n\n Console.WriteLine(Math.Abs(3-row) + Math.Abs(3-column));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n\tclass MainClass\n\t{\n\t\tpublic class Vector2\n\t\t{\n\t\t\tpublic byte x, y;\n\n\t\t\tpublic Vector2 (byte x, byte y)\n\t\t\t{\n\t\t\t\tthis.x = x;\n\t\t\t\tthis.y = y;\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic static List nodes = new List();\n\n\t\t\tpublic Vector2 position;\n\t\t\tpublic byte number;\n\n\t\t\tpublic List neighnours = new List();\n\n\t\t\tpublic Node (Vector2 pos, byte number)\n\t\t\t{\n\t\t\t\tposition = pos;\n\t\t\t\tthis.number = number;\n\t\t\t}\n\n\t\t\tpublic void SetNeighbours (List newNodesList)\n\t\t\t{\n\t\t\t\tneighnours = newNodesList;\n\t\t\t}\n\n\t\t\tpublic byte MinMovesToPosition (Vector2 targetPosition)\n\t\t\t{\n\t\t\t\tbyte moves = 0;\n\n\t\t\t\tif (position.x != targetPosition.x || position.y != targetPosition.y)\n\t\t\t\t\tRecursionToPosition (targetPosition, ref moves);\n\t\t\t\t\n\t\t\t\treturn moves;\n\t\t\t}\n\n\t\t\tpublic void RecursionToPosition (Vector2 pos, ref byte moves)\n\t\t\t{\n\t\t\t\tNode nextNode = neighnours.OrderBy(n => Math.Abs(pos.x - n.position.x) + Math.Abs(pos.y - n.position.y)).FirstOrDefault();\n\n\t\t\t\tmoves++;\n\n\t\t\t\tif (nextNode.position.x != pos.x || nextNode.position.y != pos.y)\n\t\t\t\t{\n\t\t\t\t\tnextNode.RecursionToPosition (pos, ref moves);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Main ()\n\t\t{\n\t\t\tfor (byte y = 0; y < 5; y++)\n\t\t\t{\n\t\t\t\tstring input = Console.ReadLine();\n\t\t\t\t\n\t\t\t\tfor (byte x = 0; x < 5; x++)\n\t\t\t\t\tNode.nodes.Add(new Node(new Vector2(x, y), byte.Parse(input[x * 2].ToString())));\n\t\t\t}\n\n\t\t\tfor (byte i = 0; i < 25; i++)\n\t\t\t{\n\t\t\t\tvar node = Node.nodes [i];\n\t\t\t\tnode.SetNeighbours(Node.nodes.FindAll(n => Math.Abs (n.position.x - node.position.x) + Math.Abs (n.position.y - node.position.y) == 1));\n\t\t\t}\n\t\t\tConsole.WriteLine(Node.nodes.Find(n => n.number == 1).MinMovesToPosition(new Vector2(2, 2)));\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tests\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a1 = Console.ReadLine();\n string a2 = Console.ReadLine();\n string a3 = Console.ReadLine();\n string a4 = Console.ReadLine();\n string a5 = Console.ReadLine();\n string[] A1 = a1.Split(' ');\n string[] A2 = a2.Split(' ');\n string[] A3 = a3.Split(' ');\n string[] A4 = a4.Split(' ');\n string[] A5 = a5.Split(' ');\n string[,] B = new string[5, 5] {\n { A1[0],A1[1],A1[2],A1[3],A1[4]},\n { A2[0],A2[1],A2[2],A2[3],A2[4]},\n { A3[0],A3[1],A3[2],A3[3],A3[4]},\n { A4[0],A4[1],A4[2],A4[3],A4[4]},\n { A5[0],A5[1],A5[2],A5[3],A5[4]},\n };\n int x = 0, y = 0;\n for (int i = 0; i < B.GetLength(0); i++)\n {\n for (int j = 0; j < B.GetLength(1); j++)\n {\n if (B[i, j] == \"1\")\n {\n x = i + 1;\n y = j + 1;\n break;\n }\n }\n }\n int Q = Math.Abs(x - 3) + Math.Abs(y - 3);\n Console.WriteLine(Q);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace BeautifulMatrix\n{\n internal class Program\n {\n private static void Main()\n {\n var row = 0;\n var col = 0;\n\n string line;\n string[] splitLine;\n for (var i = 1; i <= 5; i++)\n {\n line = Console.ReadLine().Trim();\n\n if (row != 0)\n {\n continue;\n }\n\n splitLine = line.Split(' ');\n\n for (var j = 1; j <= 5; j++)\n {\n if (splitLine[j - 1] == \"1\")\n {\n row = i;\n col = j;\n break;\n }\n }\n }\n\n Console.WriteLine(Math.Abs(row - 3) + Math.Abs(col - 3));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int row = 0;\n int count = 0;\n for (int i = 0; i < 5; i++)\n {\n string n = Console.ReadLine();\n if (n.Contains(\"1\"))\n {\n count = Math.Abs(2 - row) + Math.Abs(2 - n.Split().ToList().IndexOf(\"1\"));\n }\n row++;\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass program\n{\n static void Main(string[]args)\n {\n int[,] Matrix = new int[5, 5];\n int rowNumber = 0;\n int columnNumber = 0;\n int rowSwaps = 0;\n int columnSwaps = 0;\n for (int i = 0; i < 5; i++)\n {\n string input = Console.ReadLine();\n string[] inputs = input.Split(' ');\n for (int j = 0; j < 5; j++)\n {\n Matrix[i, j] = Convert.ToInt32(inputs[j]);\n }\n }\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (Matrix[i, j] == 1)\n {\n rowNumber = i;\n columnNumber = j;\n }\n }\n }\n \n\n if (rowNumber == 2)\n rowSwaps = 0;\n else\n {\n while (rowNumber > 2)\n {\n rowNumber--;\n rowSwaps++;\n }\n \n while (rowNumber < 2)\n {\n rowNumber++;\n rowSwaps++;\n }\n }\n\n if (columnNumber == 2)\n columnSwaps = 0;\n else\n {\n while (columnNumber > 2)\n {\n columnNumber--;\n columnSwaps++;\n }\n \n while (columnNumber < 2)\n {\n columnNumber++;\n rowSwaps++;\n }\n }\n \n \n\n Console.WriteLine(rowSwaps+columnSwaps);\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem263A {\n class Program {\n static void Main(string[] args) {\n int[,] matrix = new int[5, 5];\n for (int i = 0; i < 5; i++) {\n string[] line = Console.ReadLine().Split(' ');\n saveLineToMatrix(matrix, line, i);\n }\n\n int[] one = findOne(matrix);\n int moves = Math.Abs(one[0] - 2) + Math.Abs(one[1] - 2);\n Console.WriteLine(moves);\n }\n\n private static int[] findOne(int[,] matrix) {\n int[] position = new int[2];\n bool foundPosition = false;\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 5; j++) {\n if (matrix[i, j] == 1) {\n position[0] = i;\n position[1] = j;\n foundPosition = true;\n break;\n }\n }\n if (foundPosition)\n break;\n }\n\n return position;\n }\n\n private static void saveLineToMatrix(int[,] matrix, string[] line, int row) {\n for (int i = 0; i < 5; i++) {\n int elem = Convert.ToInt32(line[i]);\n matrix[row, i] = elem;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i = 0, j = 0, ans = 0;\n for (int k = 0; k < 5; k++)\n {\n string[] arr = Console.ReadLine().Split(' ');\n j = IndexOf(arr);\n if (j != -1)\n {\n i = k >= 2 ? k - 2 : 2 - k;\n j = j >= 2 ? j - 2 : 2 - j;\n ans = i + j;\n }\n }\n Console.WriteLine(ans); \n }\n public static int IndexOf(string[] arr)\n {\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] == \"1\")\n return i;\n }\n return -1;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main(string[] args)\n {\n var m = new string[5];\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n m[i] = Console.ReadLine().Replace(\" \", \"\");\n if ((row = m[i].IndexOf('1')) >= 0)\n {\n col = i;\n break;\n }\n }\n Console.WriteLine(Math.Abs(row - 2) + Math.Abs(col - 2));\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForce1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] matrix = new string[5];\n for (int i = 0; i < 5; i++)\n {\n matrix[i] = Console.ReadLine();\n }\n int[,] array = new int[matrix.Length, matrix.Length];\n int counter = 0;\n for (int i = 0; i < matrix.Length; i++)\n {\n counter = 0;\n for (int j = 0; j < matrix[i].Length; j += 2)\n {\n array[i, counter] = int.Parse(matrix[i][j].ToString());\n counter++;\n }\n }\n int coorI = 0;\n int coorJ = 0;\n for (int i = 0; i < array.GetLength(0); i++)\n {\n for (int j = 0; j < array.GetLength(1); j++)\n {\n if (array[i, j] == 1)\n {\n coorI = i;\n coorJ = j;\n break;\n }\n }\n }\n\n counter = 0;\n bool flag = false;\n if (coorI == 2 && coorJ == 2)\n {\n flag = true;\n Console.WriteLine(0);\n }\n else\n {\n while (coorI != 2)\n if (coorI > 2)\n {\n coorI--;\n counter++;\n }\n else if (coorI < 2)\n {\n coorI++;\n counter++;\n }\n\n while (coorJ != 2)\n if (coorJ > 2)\n {\n coorJ--;\n counter++;\n }\n else if (coorJ < 2)\n {\n coorJ++;\n counter++;\n }\n }\n if (!flag)\n {\n Console.WriteLine(counter);\n }\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nclass Test{\n static void Main(){\n string [] line;\n for(int i = 0; i < 5; i++){\n line = Console.ReadLine().Split();\n for(int j = 0; j < 5; j++){\n if(line[j] != \"0\"){\n Console.WriteLine(Math.Abs(i - 2) + Math.Abs(j - 2));\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[,] arr = new int[5,5];\n int a1 = 0; \n int a2 = 0;\n\n for (int i = 0; i < 5; i++)\n {\n string str = Console.ReadLine();\n string []strArr = str.Split(' ');\n\n for (int j = 0; j < strArr.Length; j++)\n {\n arr[i, j] = int.Parse( strArr[j]);\n\n if (arr[i, j] == 1)\n {\n a1 = i;\n a2 = j;\n }\n }\n \n }\n int res=0;\n if(a1==2 && a2==2 )\n {\n Console.WriteLine(res);\n }\n else\n {\n if (a1 < 2)\n {\n while (a1 < 2)\n {\n res += 1;\n a1++;\n }\n }\n else\n {\n while (a1 > 2)\n {\n res += 1;\n a1--;\n }\n }\n\n\n if (a2 < 2)\n {\n while (a2 < 2)\n {\n res += 1;\n a2++;\n }\n }\n else\n {\n while (a2 > 2)\n {\n res += 1;\n a2--;\n }\n }\n\n Console.WriteLine(res);\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class Beautiful_Matrix\n{\n private static void Solve()\n {\n int[][] matrix = ReadIntMatrix(5);\n\n int row = 0;\n int col = 0;\n bool found = false;\n\n for (int i = 0; i < matrix.Length && !found; i++)\n {\n for (int j = 0; j < matrix[i].Length && !found; j++)\n {\n if (matrix[i][j] == 1)\n {\n row = i;\n col = j;\n found = true;\n }\n }\n }\n\n // center is 2, 2\n int absYMov = Math.Abs(row - 2);\n int absXMov = Math.Abs(col - 2);\n Write(absYMov + absXMov);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new Beautiful_Matrix().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static bool isLucky(int n)\n {\n String temp = n.ToString();\n char[] charArray = { '0', '1', '2', '3', '5', '6', '8', '9' };\n return !(temp.IndexOfAny(charArray) > -1);\n } \n\n static int GCD(int a, int b)\n {\n if (a < b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n while (b > 0)\n {\n if (a > b) a -= b;\n else b -= a;\n }\n return a;\n }\n\n static void Main(string[] args)\n { \n int row = 0, column = 0;\n for (int i = 1; i <= 5; i++)\n {\n String[] input = Console.ReadLine().Split(' '); \n for (int j = 1; j <= 5; j++)\n {\n if (input[j-1] == \"1\")\n {\n row = i;\n column = j;\n break;\n }\n } \n }\n WL(Math.Abs(row - 3) + Math.Abs(column - 3));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nnamespace codechef\n{\n public class Program{\n public static StreamWriter writer;\n\n public static void RealWork()\n {\n int ans = 0;\n int[,] m = new int[6,6];\n string pos=\"\";\n for (int i = 1; i <6 ; i++)\n {\n int[] val = Console.ReadLine().Split().Select(intParse).ToArray();\n for (int j = 1; j < 6; j++)\n {\n if (val[j - 1] == 1)\n { pos = \"\" + i + j; }\n m[i,j] = val[j - 1];\n }\n }\n\n \n writer.Write(Math.Abs(3 - intParse(pos[0].ToString()))+Math.Abs(3 - intParse(pos[1].ToString())));\n }\n\n static void Main(string[] args)\n {\n writer = new StreamWriter(Console.OpenStandardOutput());\n //writer = new StreamWriter(\"output.txt\");\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\"))); \n RealWork();\n writer.Close();\n }\n\n public static int intParse(string st)\n {\n int x = 0;\n for (int i = 0; i < st.Length; i++) { x = x * 10 + (st[i] - 48); }\n return x;\n }\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace PS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str;\n string[] strArr;\n int x = 0 , y = 0 ;\n for (int i = 0; i < 5; ++i)\n {\n str = Console.ReadLine();\n strArr = str.Split(' ');\n for (int j = 0; j < 5; ++j) \n if (strArr[j] == \"1\")\n {\n x= i;\n y= j;\n }\n }\n Console.WriteLine(Math.Abs(2 - x)+ Math.Abs(2 - y));\n \n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp73\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] mas = new int[5, 5];\n int k = 0;\n int b = -1;\n int c = -1;\n for (int i = 0; i < 5; i++)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n\n for (int j = 0; j < 5; j++)\n {\n mas[i, j] = Convert.ToInt32(ss[j]);\n if (mas[i, j] == 1)\n {\n b = i;\n c = j;\n }\n }\n }\n\n Console.WriteLine(Math.Abs(2 - b) + Math.Abs(2 - c));\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var res = 0;\n var liste = new List();\n\n for (var i = 1; i <= 5; i++)\n {\n var array = Console.ReadLine().Trim().Split(' ');\n liste.Clear();\n\n foreach (var q in array) { liste.Add(int.Parse(q)); }\n\n if (liste.Contains(1))\n {\n res += Math.Abs(i - 3);\n res += Math.Abs(2 - liste.IndexOf(1));\n }\n }\n\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte x = 0;\n byte y = 0;\n bool done = false;\n\n while (y < 5 && !done)\n {\n string[] matrix = Console.ReadLine().Split();\n\n while (x < 5 && !done)\n {\n if (matrix[x] == \"1\")\n {\n Console.WriteLine(Math.Abs(x-2)+Math.Abs(y - 2));\n done = true;\n\n }\n\n x++;\n }\n\n x = 0;\n y++;\n\n }\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tfor (int i = 1; i <= 5; i++)\n\t\t\t{\n\t\t\t\tstring[] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tfor (int j = 1; j <= 5; j++)\n\t\t\t\t{\n\t\t\t\t\tif (s[j - 1] == \"1\")\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(Math.Abs(i - 3) + Math.Abs(j - 3));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n int[,] matrix = new int[5,5];\n int[] mat = new int[5];\n int rowcount=0,columncount=0,counter=0;\n for(int i=0;i<5;i++)\n {\n mat = Array.ConvertAll(Console.ReadLine().Split(' '), item => Convert.ToInt32(item));\n for(int j=0;j<5;j++)\n {\n matrix[i, j] = mat[j];\n if(matrix[i,j] == 1)\n {\n rowcount = i; columncount = j;\n }\n }\n }\n if (rowcount == 2 && columncount == 2) Console.Write(counter);\n else\n {\n counter += (rowcount>2? rowcount-2 : 2-rowcount);\n counter += (columncount > 2 ? columncount - 2 : 2 - columncount);\n Console.Write(counter);\n }\n }\n}"}, {"source_code": " using System;\n using System.Linq;\n\n namespace CodeWars\n {\n class _263A\n {\n static void Main()\n {\n var input = new int[5][];\n var position = new Tuple(0,0);\n for (int i = 0; i < 5; i++)\n {\n input[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var index = Array.IndexOf(input[i],1);\n if (index != -1)\n position = new Tuple(index, i);\n }\n Console.WriteLine(Math.Abs(2 - position.Item1) + Math.Abs(2 - position.Item2));\n }\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace csharp_project\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n\n var arr = new int[5, 5];\n int z = 0, y = 0;\n\n for (int i = 0; i < 5; i++)\n {// 1 0 1 1 1 1 0 0\n\n var x = Console.ReadLine().Split();\n \n arr[i,0] = Convert.ToInt32(x[0]);\n arr[i,1] = Convert.ToInt32(x[1]);\n arr[i,2] = Convert.ToInt32(x[2]);\n arr[i,3] = Convert.ToInt32(x[3]);\n arr[i,4] = Convert.ToInt32(x[4]);\n if (arr[i, 0] ==1)\n { z = 0;\n y = i;\n }\n if (arr[i, 1] == 1)\n {\n z = 1;\n y = i;\n break;\n }\n if (arr[i, 2] == 1)\n {\n z = 2;\n y = i;\n break;\n }\n if (arr[i, 3] == 1)\n {\n z = 3;\n y = i;\n break;\n }\n if (arr[i, 4] == 1)\n {\n z = 4;\n y = i;\n break;\n }\n\n }\n\n \n\n var ans = Math.Abs(2 - z)+Math.Abs(2-y);\n \n Console.WriteLine(ans);\n } \n }\n}\n"}, {"source_code": "using System;\n\npublic class Test {\n\n\tpublic static int[,] a = new int[5, 5];\n\n\tpublic static void Main() {\n\t\tint x = 0, y = 0;\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tstring[] l = Console.ReadLine().Split();\n\t\t\tfor (int j = 0; j < 5; j++) {\n\t\t\t\ta[i, j] = Convert.ToInt32(l[j]);\n\t\t\t\tif (a[i, j] == 1) {\n\t\t\t\t\tx = i;\n\t\t\t\t\ty = j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tConsole.WriteLine(Math.Abs(x - 2) + Math.Abs(y - 2));\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n public static int GhadreMotlagh(int r)\n {\n int h = 0;\n if (r < 0)\n {\n h = r - r - r;\n }\n else\n {\n h = r;\n }\n return h;\n }\n\n static void Main(string[] args)\n {\n int Temp1 = 0;\n int Temp2 = 0;\n int a = 0;\n int b = 0;\n int c = 0;\n string[,] Matrix = new string[5, 5];\n string[] Table= new string[5];\n Table[0] = Console.ReadLine();\n Table[1] = Console.ReadLine();\n Table[2] = Console.ReadLine();\n Table[3] = Console.ReadLine();\n Table[4] = Console.ReadLine();\n //f = a + \"\\n\" + b + \"\\n\" + c + \"\\n\" + d + \"\\n\" + e;\n while (Temp1 < 5)\n {\n while (Temp2 < 5)\n {\n Matrix[Temp1, Temp2] = Table[Temp1].Split(' ')[Temp2];\n if (Matrix[Temp1, Temp2] == \"1\")\n {\n a = Temp1+1;\n b = Temp2+1;\n }\n if (Temp2 == 4)\n {\n Temp2 = 0;\n break;\n }\n else\n {\n Temp2 += 1;\n }\n }\n Temp1 += 1;\n }\n\n c = GhadreMotlagh(3 - a) + GhadreMotlagh(3 - b);\n Console.WriteLine(c.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[,] arr = new int[5, 5];\n int x = 0, y = 0;\n\n for (int i = 0; i < 5; i++)\n {\n string str = Console.ReadLine();\n for (int j = 0; j < 5; j++)\n {\n int[] intArr = str.Split(' ').Select(int.Parse).ToArray();\n arr[i, j] = intArr[j];\n if (intArr[j] == 1) { x = i; y = j; }\n }\n }\n\n int xD;\n int yD;\n\n if (x > 2) { xD = x - 2; }\n else { xD = 2 - x; }\n\n if (y > 2) { yD = y - 2; }\n else { yD = 2 - y; }\n Console.WriteLine(yD + xD);\n }\n}\n\n"}, {"source_code": "using System;\nclass CFR161D2\n{\n static void Main()\n {\n string[] line;\n for (int i = 0; i < 5; i++)\n {\n line = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n if (line[j] == \"1\")\n {\n Console.WriteLine(Math.Abs(2-i) + Math.Abs(2-j));\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n}"}, {"source_code": "using System;\n\nnamespace _10__A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[5, 5];\n\n int count = 0;\n int i_ = 0;\n int j_ = 0;\n\n for (int i = 0; i < 5; i++)\n {\n\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n for (int j = 0; j < 5; j++)\n {\n \n arr[i, j] = int.Parse(values[j]);\n }\n Console.WriteLine();\n }\n\n\n \n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (arr[i, j] == 1)\n {\n i_ = i;\n j_ = j;\n }\n }\n\n }\n \n\n int ans1 = Math.Abs(2-i_);\n int ans2 = Math.Abs(2-j_);\n\n\n Console.WriteLine(ans1+ans2);\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var first = Console.ReadLine().Replace(\" \", \"\");\n var second = Console.ReadLine().Replace(\" \", \"\");\n var third = Console.ReadLine().Replace(\" \", \"\");\n var fourth = Console.ReadLine().Replace(\" \", \"\");\n var fifth = Console.ReadLine().Replace(\" \", \"\");\n\n const string one = \"1\";\n\n var counter = 0;\n if (first.Contains(one))\n {\n counter += 2;\n counter += Math.Abs(first.IndexOf(\"1\", StringComparison.CurrentCulture) - 2);\n }\n else if (second.Contains(one))\n {\n counter += 1;\n counter += Math.Abs(second.IndexOf(\"1\", StringComparison.CurrentCulture) - 2);\n }\n else if (third.Contains(one))\n {\n counter += Math.Abs(third.IndexOf(\"1\", StringComparison.CurrentCulture) - 2);\n }\n else if (fourth.Contains(one))\n {\n counter += 1;\n counter += Math.Abs(fourth.IndexOf(\"1\", StringComparison.CurrentCulture) - 2);\n }\n else\n {\n counter += 2;\n counter += Math.Abs(fifth.IndexOf(\"1\", StringComparison.CurrentCulture) - 2);\n }\n\n Console.WriteLine(counter);\n }\n\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a;\n int output=0;\n for (int x = 0; x < 5; x++)\n {\n a = Console.ReadLine();\n string[] words = a.Split(' ');\n for (int y = 0; y < 5; y++)\n {\n if (words[y] == \"1\")\n { \n output = Math.Abs(x - 2) + Math.Abs(y - 2);\n }\n }\n }\n \n Console.WriteLine(output);\n\n \n\n }\n }\n}\n\n\n \n \n\n \n \n \n \n"}, {"source_code": "\ufeffusing System;\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int y = -2;\n int x = 10;\n bool set = false;\n\n for (int i = 0; i < 5; i++)\n {\n if (set)\n {\n Console.ReadLine();\n }\n else\n {\n\n string input = Console.ReadLine();\n input = input[0].ToString() + input[2].ToString() + input[4].ToString() + input[6].ToString() + input[8].ToString();\n if (input.Contains(\"1\"))\n {\n\n x = input.IndexOf('1')-2;\n set = true;\n }\n else\n {\n y++;\n }\n\n }\n }\n\n Console.WriteLine(Math.Abs(x) + Math.Abs(y));\n Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Get one position.\n int oneX = 0;\n int oneY = 0;\n for (int i = 0; i < 5; i++)\n {\n int[] values = Array.ConvertAll(Console.ReadLine().Split(' '), input => int.Parse(input));\n for (int j = 0; j < 5; j++)\n {\n if (values[j] == 1)\n {\n oneX = i;\n oneY = j;\n }\n }\n }\n\n //Get road to middle.\n int X = Math.Abs(oneX - 2);\n int Y = Math.Abs(oneY - 2);\n\n Console.WriteLine(X + Y);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n static void Main()\n {\n int numberOfMovement = 0;\n for (int i = 0; i < 5; i++)\n {\n string[] rowInputs = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n if (rowInputs[j] == \"1\")\n {\n numberOfMovement = Math.Abs(2-i)+ Math.Abs(2 - j);\n }\n }\n }\n\n Console.WriteLine(numberOfMovement);\n }\n \n }"}, {"source_code": "\ufeffusing System;\n\nnamespace vanyanandfence\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n var input = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n var line = Console.ReadLine().Split(' ');\n for (int k = 0; k < line.Length; k++)\n {\n input[i, k] = int.Parse(line[k]);\n }\n }\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n for (int k = 0; k < 5; k++)\n {\n if (input[i, k] == 1)\n {\n row=i;\n col=k;\n break;\n }\n }\n }\n var ymove =Math.Abs(row-2) ;\n var xmove = Math.Abs(col-2);\n System.Console.WriteLine(ymove+xmove);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace vanyanandfence\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var input = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n var line = Console.ReadLine().Split(' ');\n for (int k = 0; k < line.Length; k++)\n {\n input[i, k] = int.Parse(line[k]);\n }\n }\n int row = 0, col = 0;\n for (int i = 0; i < input.GetLength(0); i++)\n {\n for (int k = 0; k < input.GetLength(1); k++)\n {\n if (input[i, k] == 1)\n {\n row=i;\n col=k;\n break;\n }\n }\n }\n var ymove =Math.Abs(row-2) ;\n var xmove = Math.Abs(col-2);\n System.Console.WriteLine(ymove+xmove);\n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] positions = new int[5,5]\n {\n {4,3,2,3,4},{3,2,1,2,3},{2,1,0,1,2},{3,2,1,2,3},{4,3,2,3,4}\n };\n int value = 0;\n bool check = false;\n for(int i = 0; i < 5;i++)\n {\n string[] temp = Console.ReadLine().Trim().Split();\n for(int j = 0; j < temp.Length;j++)\n {\n if(temp[j] == \"1\")\n {\n value = positions[i,j];\n check = true;\n break;\n }\n }\n if(check == true)\n {\n break;\n }\n \n }\n Console.WriteLine(value);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _263A___Beautiful_Matrix\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tMatrixen();\n\t\t}\n\n\t\tprivate static void Matrixen()\n\t\t{\n\t\t\tTuple coords = GetCoords();\n\t\t\tint steps = Math.Abs(coords.Item1 - 3) + Math.Abs(coords.Item2 - 3);\n\n\t\t\tConsole.WriteLine(steps);\n\t\t}\n\n\t\tprivate static Tuple GetCoords()\n\t\t{\n\t\t\tfor (int y = 0; y < 5; y++)\n\t\t\t{\n\t\t\t\tstring[] line = Console.ReadLine().Split(' ');\n\n\t\t\t\tfor (int x = 0; x < 5; x++)\n\t\t\t\t\tif (line[x] == \"1\")\n\t\t\t\t\t\treturn new Tuple(x + 1, y + 1);\n\t\t\t}\n\n\t\t\treturn new Tuple(0, 0);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string[] row1 = Console.ReadLine().Split();\n string[] row2 = Console.ReadLine().Split();\n string[] row3 = Console.ReadLine().Split();\n string[] row4 = Console.ReadLine().Split();\n string[] row5 = Console.ReadLine().Split();\n\n if(row1[0] == \"1\" || row1[4] == \"1\" || row5[0] == \"1\" || row5[4] == \"1\")\n {\n Console.WriteLine(\"4\");\n }\n else if(row1[1] == \"1\" || row1[3] == \"1\" || row5[1] == \"1\" || row5[3] == \"1\" || row2[0] == \"1\" || row2[4] == \"1\" || row4[0] == \"1\" || row4[4] == \"1\"){\n Console.WriteLine(\"3\");\n }\n else if(row1[2] == \"1\" || row2[1] == \"1\" || row2[3] == \"1\" || row4[1] == \"1\" || row4[3] == \"1\" || row5[2] == \"1\" || row5[3] == \"1\" || row3[0] == \"1\" || row3[4] == \"1\"){\n Console.WriteLine(\"2\");\n }\n else if(row2[2] == \"1\" || row3[1] == \"1\" || row4[2] == \"1\" || row3[3] == \"1\"){\n Console.WriteLine(\"1\");\n }\n else{\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _263A_BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] task = new string[25];\n int position = 1;\n\n for (int i = 0; i < 5; i++)\n {\n var mass = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n for (int j = i*5, k = 0; j < 25 & k<5; j++, k++)\n {\n task[j] = mass[k];\n }\n }\n\n for (int i =0; i < 25; i++)\n {\n if (task[i] == \"0\")\n {\n position += 1;\n }\n else\n break;\n }\n\n double caseNum = Math.Ceiling(position / 5.0);\n int caseMod = position % 5;\n if (caseMod == 0)\n {\n caseMod = 5;\n }\n\n if(caseMod == 3)\n {\n Console.WriteLine(Math.Abs(caseNum - caseMod));\n \n }\n else\n {\n caseNum = Math.Abs(caseNum - 3) + Math.Abs(caseMod - 3);\n Console.WriteLine(caseNum);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Matriza\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] p = \"\".Split();\n int str = 0;\n int stol = 0;\n for (int i = 0; i < 5; i++)\n {\n string k = Console.ReadLine();\n if (k != \"0 0 0 0 0\")\n {\n string [] z = k.Split();\n p = z;\n str = i + 1;\n }\n }\n for (int u = 0; u < p.Length; u++)\n {\n if (p[u] == \"1\")\n {\n stol = u + 1;\n }\n }\n int a = 3 - str;\n int b = 3 - stol;\n if (a < 0)\n {\n a = a - 2 * a;\n }\n if (b < 0)\n {\n b = b - b * 2;\n }\n int S = a + b;\n Console.WriteLine(S);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace for_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] a = new int[5,5];\n int anss = 0;\n string s;\n string[] ss;\n for (int k = 0; k < 5; k++)\n {\n s = Console.ReadLine();\n ss = s.Split(' ');\n for (int k1 = 0; k1 < 5; k1++)\n {\n a[k, k1] = int.Parse(ss[k1]);\n if(a[k,k1] == 1)\n anss = Math.Abs(k-2) + Math.Abs(k1-2);\n } \n }\n Console.WriteLine(\"\"+anss);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main(string[] args)\n {\n var grid = Parse();\n var minimumShifts = Solve(grid);\n Print(minimumShifts);\n }\n\n private static void Print(int minimumShifts)\n {\n Console.WriteLine(minimumShifts);\n }\n\n private static int Solve(int[,] grid)\n {\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (grid[i, j] == 1)\n {\n x = i;\n y = j;\n }\n }\n }\n return Math.Abs(x - 2) + Math.Abs(y - 2);\n }\n\n private static int[,] Parse()\n {\n var grid = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n var input = Console.ReadLine();\n for (int j = 0; j < 5; j++)\n grid[i, j] = int.Parse(input.Substring(2 * j, 1)); \n }\n return grid;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n var rowNo = 1;\n while (!String.IsNullOrWhiteSpace(line = Console.ReadLine()))\n {\n if (!line.Contains(\"1\"))\n {\n rowNo++;\n line = string.Empty;\n continue;\n }\n\n var columnNo = Array.FindIndex(line.Split(\" \"), row => row == \"1\") + 1;\n var xMoves = Math.Abs(columnNo - 3);\n var yMoves = Math.Abs(rowNo - 3);\n\n Console.WriteLine(xMoves + yMoves);\n break;\n }\n }\n\n static void ReadLines()\n {\n string line;\n while (!String.IsNullOrWhiteSpace(line = Console.ReadLine()))\n {\n //but here it seems to be an infinite loop \n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Data;\nusing System.Runtime.InteropServices;\n\nnamespace Coding\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[,] arr = new int[5, 5];\n int moves = 0;\n int row = 0;\n int col = 0;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n string line = Console.ReadLine();\n\n string[] nums = line.Split(\" \");\n\n if (line.Contains(\"1\"))\n {\n row = i;\n }\n\n for (int j = 0; j < arr.GetLength(1); j++)\n {\n arr[i, j] = Convert.ToInt32(nums[j]);\n if (arr[i, j] == 1)\n {\n col = j;\n }\n }\n }\n\n\n\n //row swap\n moves += Math.Abs(2 - row);\n\n \n\n //col swap\n moves += Math.Abs(2 - col);\n\n Console.Write(moves);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] Array = new char [5, 5];\n int count = 0;int rowindex = 0;\n int colindex = 0;\n\n for (int i=0;i<=4;i++)\n {\n rowindex = i;\n string value = Console.ReadLine();\n if(value.Contains(\"1\"))\n {\n //Console.WriteLine(value.IndexOf('1'));\n colindex = value.IndexOf('1') / 2 ;\n break;\n }\n \n \n }\n\n // Console.WriteLine(2-rowindex/2+1+2-colindex);\n Console.WriteLine(Math.Abs(rowindex-2)+ Math.Abs(colindex-2));\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n \n public static void Main()\n\t{\n\t int result = 0;\n\t for(int i = 0; i < 5; i++)\n\t {\n\t string s = Console.ReadLine();\n\t if(s.Contains(\"1\"))\n\t {\n\t if((i - 2) < 0)\n\t {\n\t result = (i - 2) * (-1);\n\t }\n\t else\n\t {\n\t result = i - 2;\n\t }\n\t int[] array = Array.ConvertAll(s.Split(' '), int.Parse);\n\t for(int j = 0; j < array.Length; j++)\n\t {\n\t if(array[j] == 1)\n\t {\n\t if((j - 2) < 0)\n\t {\n\t result = result + (j - 2) * (-1);\n\t }\n\t else \n\t {\n\t result = result + (j - 2);\n\t }\n\t }\n\t }\n\t }\n\t }\n\t \n\t Console.WriteLine(result);\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Check(int value, ref int counter)\n {\n if (value > 3)\n {\n while (value > 3)\n {\n value--;\n counter++;\n }\n }\n\n else if (value < 3)\n {\n while (value < 3)\n {\n value++;\n counter++;\n }\n }\n }\n static void Main(string[] args)\n {\n int[][] matrix = new int[5][];\n for (int i = 0; i < matrix.Length; i++)\n matrix[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int raw = 0, column = 0;\n int counter = 0;\n\n for (int i = 0; i < matrix.Length; i++)\n {\n for (int j = 0; j < matrix[i].Length; j++)\n {\n if (matrix[i][j] == 1)\n {\n raw = i+1;\n column = j+1;\n break;\n }\n \n }\n }\n\n Check(raw, ref counter);\n Check(column, ref counter);\n\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace sp\n{\n public class Program\n {\n \n private static void Main()\n {\n int get_x = 0, get_y = 0;\n int[,] ms = new int[5, 5];\n for (int i = 0; i < 5; i++) {\n int[] cut = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n for (int j=0;j<5;j++){\n ms[i, j] = cut[j];\n if (ms[i, j] == 1) { get_x = j; get_y = i; }\n }\n }\n int res = Math.Abs(2-get_x)+Math.Abs (2-get_y );\n Console.WriteLine(res);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n internal static class Program\n {\n private static void Main()\n {\n int steps = 0;\n for (int i = 1; i <= 5; i++)\n {\n string s1 = Console.ReadLine();\n string[] s1values = s1.Split(' ');\n\n for (int j = 1; j <= 5; j++)\n {\n \n int x = int.Parse(s1values[j-1]);\n if (x == 1)\n {\n steps = Math.Abs(i - 3) + Math.Abs(j - 3);\n }\n }\n }\n Console.WriteLine(steps);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _263A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int[,] matr = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n s = Console.ReadLine();\n string[] temp = s.Split(' ');\n for (int j = 0; j < 5; j++)\n matr[i, j] = int.Parse(temp[j]);\n }\n\n for(int i = 0; i < 5; ++i)\n {\n for(int j = 0; j < 5; ++j)\n {\n int x = i + 1; int y = j + 1;\n if(matr[i, j] == 1)\n {\n Console.WriteLine(Math.Abs(3 - x) + Math.Abs(3 - y));\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolvingProject\n{\n class BeautifulMatrix\n {\n public static void Main(string[] args)\n {\n int[,] arr = new int[5, 5];\n int r = 0;\n int c = 0;\n for(int i = 0; i < 5; i++)\n {\n string s = Console.ReadLine();\n var x = s.Split(' ');\n for(int j = 0; j < 5; j++)\n {\n arr[i, j] = int.Parse(x[j]);\n if(arr[i,j] == 1)\n {\n r = i+1;\n c = j+1;\n }\n }\n }\n int move = 0;\n move += Math.Abs(3 - r);\n move += Math.Abs(3 - c);\n Console.WriteLine(move);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Reflection;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\t\n\t class Program\n\t{\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t\n\t\t\tfor(int i = 1; i <= 5; i++)\n {\n\t\t\t\tstring input = Console.ReadLine();\n\t\t\t\tstring[] input_values = input.Split(' ');\n\t\t\t\tfor(int j = 1; j <= 5; j++)\n {\n\t\t\t\t\tint x = int.Parse(input_values[j-1]);////i dont know the purpose of this line tbh ---maybe because you indexing from 0?\n if(x == 1)\n {\n\t\t\t\t\t\tConsole.WriteLine(Math.Abs(i - 3) + Math.Abs(j - 3));\n }\n\n \n }\n }\n\n\n\t\t}\n\n\t\t\n\t\t\n\n\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\n\nnamespace CodeForces\n{\n class Program\n {\n\n [DllImport(\"msvcrt.dll\", CallingConvention = CallingConvention.Cdecl)]\n public static extern int scanf(string format, out int a, out int b, out int c, out int d, out int e);\n static void Main(string[] args)\n {\n int answer = 0;\n int[,] array = new int[5, 5];\n for (int i = 0; i<5;i++)\n {\n scanf(\"%d %d %d %d %d\", out array[i, 0], out array[i, 1], out array[i, 2], out array[i, 3], out array[i, 4]);\n for (int j = 0; j<5; j++)\n {\n if (array[i, j] == 1)\n answer = Math.Abs(2 - j) + Math.Abs(2 - i);\n }\n }\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int ci, cj, k;\n ci = cj = 0;\n for (int i = 1; i <= 5; i++)\n {\n string a = Console.ReadLine();\n int b;\n k = 0;\n string[] at = a.Split(new Char[] { ' ' });\n foreach (var a_item in at)\n {\n k += 1;\n b = int.Parse(a_item);\n if (b == 1)\n {\n ci = i;\n cj = k;\n }\n }\n }\n int m = Math.Abs(cj-3)+Math.Abs(ci-3);\n Console.WriteLine(m);\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n string[][] s = new string[5][];\n for(int i=0; i<5; i++)\n {\n \ts[i]=Console.ReadLine().Split(' ');\n }\n int a=0, b=0;\n for(int i=0; i<5; i++)\n {\n \tfor(int j=0; j<5; j++)\n \t{\n \t\tif(s[i][j]!=\"0\") \n \t\t{\n \t\t\ta=i;\n \t\t\tb=j;\n \t\t\tbreak;\n \t\t}\n \t}\n }\n a=a-2<0?2-a:a-2;\n b=b-2<0?2-b:b-2;\n Console.WriteLine(a+b);\n /*string s = Console.ReadLine().ToLower();\n string w = Console.ReadLine().ToLower();\n \n int a=0;\n for(int i=0; i a = new HashSet(new char[]{'U', 'u', 'I', 'i', 'E', 'e', 'A', 'a', 'O', 'o', 'Y', 'y'});\n string w=\"\";\n foreach(char c in s)\n {\n \tif(!a.Contains(c))\n \t{\n \t\tw+=\".\";\n \t\tw+=c.ToString();\n \t}\n }\n s=w.ToLower();\n Console.WriteLine(s);*/\n /*\tint[] z=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\n \tint n=z[0];\n \tint k=z[1];\n \tint[] y=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\n \tint i=k;\n \tif(y[k-1]>0)\n \t{\n \twhile(i0)\n \t\t{\n \t\t\ti++;\n \t\t}\n \t}*/\n \t//Console.WriteLine(s2);\n \t/*string s = Console.ReadLine();\n \tint a = int.Parse(s);\n \tstring[] w = new string[a];\n \tfor (int i = 0; i10?(w[i][0].ToString()+(x-2).ToString()+w[i][x-1].ToString()):w[i]);\n \t}*/\n \t\n /*HashSet d = new HashSet();\n d.Add(345);\n d.Add(34);\n d.Add(0);\n d.Add(34);*/\n \t//byte a=(byte)d;\n \t/*string a = Console.ReadLine();\n \tint w = int.Parse(a);\n \tConsole.WriteLine(w%2==0?\"YES\":\"NO\");*/\n \t/*a=int.Parse(Console.ReadLine());\n \tb=int.Parse(Console.ReadLine());\n \tc=int.Parse(Console.ReadLine());\n \tint[] z=Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\n \tif (z[0]>z[1]) \n \t{\n \t\tif(z[0]>z[2]) d=z[0];\n \t\telse d=z[2];\n \t}\n \telse \n \t{\n \t\tif(z[1]>z[2]) d=z[1];\n \t else d=z[2];\n \t}\n Console.WriteLine(d);*/\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MaceirzMacka\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] Arra = new string[5];\n var suma = 0;\n\n for (int i = 0; i < 5; i++)\n Arra[i] = Convert.ToString(Console.ReadLine());\n\n for (int i = 0; i < 5; i++)\n {\n var index = Arra[i].IndexOf(\"1\");\n var row = Arra[i].Contains(\"1\");\n\n if (row == true && (i == 0 || i == 4))\n suma += 2;\n if (row == true && (i == 1 || i == 3))\n suma += 1;\n if (row == true && (index == 0 || index == 8))\n suma += 2;\n if (row == true && (index == 2 || index == 6))\n suma += 1;\n }\n Console.WriteLine(suma);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _263A_A_Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n for (int i=1; i<=5; i++)\n {\n string s1 = Console.ReadLine();\n string[] s1values = s1.Split(' ');\n\n for (int j=1; j<=5; j++)\n {\n int x = int.Parse(s1values[j-1]);\n if (x==1)\n {\n Console.Write(Math.Abs(i-3)+ Math.Abs(j - 3));\n }\n }\n }\n }\n }\n}"}, {"source_code": " using System;\n using static System.Console;\n using static System.Convert;\n class Program_8\n {\n public static void Main()\n {\n string [] arr = new string[5];\n\n int index_coulmn = 0 , index_rows = 0;\n\n for (int i = 0; i < 5; i++)\n {\n arr[i] = ReadLine();\n }\n\n for (int i = 0; i < 5; i++)\n {\n if(arr[i].Contains('1'))\n {\n index_coulmn = arr[i].IndexOf('1') >0 ? arr[i].IndexOf('1')-(arr[i].IndexOf('1') /2 ) : arr[i].IndexOf('1');\n index_rows = i;\n break;\n }\n }\n\n \n\n Result(index_rows,index_coulmn);\n\n }\n static int count = 0;\n public static void Result(int i, int j)\n { \n\n if(i==2 && j==2)\n {\n Console.WriteLine(count);\n return;\n }\n\n else if(i>2||i<2)\n {\n i = (i > 2) ? i - 1 : i + 1;\n count++;\n Result(i,j);\n }\n\n else if(j>2||j<2)\n {\n j = (j > 2) ? j - 1 : j + 1;\n count++;\n Result(i,j);\n }\n\n }\n\n\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace For_C__exercise\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[5, 5];\n string[] input;\n for (int i = 0; i < 5; i++)\n {\n input = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n arr[i, j] = int.Parse(input[j]);\n }\n }\n solution(arr);\n }\n public static void solution(int[,] s)\n {\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (s[i, j] == 1)\n {\n Console.WriteLine(Math.Abs(i - 2) + Math.Abs(j - 2));\n return;\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line1 = Console.ReadLine().Split(' ');\n var line2 = Console.ReadLine().Split(' ');\n var line3 = Console.ReadLine().Split(' ');\n var line4 = Console.ReadLine().Split(' ');\n var line5 = Console.ReadLine().Split(' ');\n\n var index = findNum1Index(new List { line1, line2, line3, line4, line5 });\n\n Console.WriteLine(Math.Abs(index[0] - 3) + Math.Abs(index[1] - 3));\n\n }\n\n public static List findNum1Index(List matrix)\n {\n List result = new List();\n\n for (int i = 0; i < matrix.Count; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i][j] == \"1\")\n {\n result.Add(i+1);\n result.Add(j+1);\n }\n }\n }\n\n return result;\n }\n\n }\n}\n"}, {"source_code": "using System;\n \nnamespace _263A_A_Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n for (int i=1; i<=5; i++)\n {\n string s1 = Console.ReadLine();\n string[] s1values = s1.Split(' ');\n \n for (int j=1; j<=5; j++)\n {\n int x = int.Parse(s1values[j-1]);\n if (x==1)\n {\n Console.Write(Math.Abs(i-3)+ Math.Abs(j - 3));\n }\n }\n } \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KrasivMatr\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matr = new int[5, 5];\n int k=0;\n int l = 0;\n for (int i = 0; i < 5; i++)\n {\n string str = Console.ReadLine();\n if (str.Contains('1'))\n for (int j = 0; j < str.Length; j+=2)\n {\n if (str[j]=='1')\n {\n matr[i, j / 2] = 1;\n k = i;\n l = j / 2;\n }\n }\n }\n k = Math.Abs(k - 3+1);\n l = Math.Abs(l - 3+1);\n Console.WriteLine(k + l);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace Test\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string[] row1 = Console.ReadLine().Split();\n string[] row2 = Console.ReadLine().Split();\n string[] row3 = Console.ReadLine().Split();\n string[] row4 = Console.ReadLine().Split();\n string[] row5 = Console.ReadLine().Split();\n\n if(row1[0] == \"1\" || row1[4] == \"1\" || row5[0] == \"1\" || row5[4] == \"1\")\n {\n Console.WriteLine(\"4\");\n }\n else if(row1[1] == \"1\" || row1[3] == \"1\" || row5[1] == \"1\" || row5[3] == \"1\" || row2[0] == \"1\" || row2[4] == \"1\" || row4[0] == \"1\" || row4[4] == \"1\"){\n Console.WriteLine(\"3\");\n }\n else if(row1[2] == \"1\" || row2[1] == \"1\" || row2[3] == \"1\" || row4[1] == \"1\" || row4[3] == \"1\" || row5[2] == \"1\" || row5[3] == \"1\" || row3[0] == \"1\" || row3[4] == \"1\"){\n Console.WriteLine(\"2\");\n }\n else if(row2[2] == \"1\" || row3[1] == \"1\" || row4[2] == \"1\"){\n Console.WriteLine(\"1\");\n }\n else{\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF {\n class Program {\n\n static void Main(string[] args) {\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n TextWriter writer = Console.Out;\n#else\n\t\t\tTextReader reader = Console.In;\n TextWriter writer = Console.Out;\n#endif\n\n var line1 = reader.ReadLine().Replace(\" \", \"\");\n var line2 = reader.ReadLine().Replace(\" \", \"\");\n var line3 = reader.ReadLine().Replace(\" \", \"\");\n var line4 = reader.ReadLine().Replace(\" \", \"\");\n var line5 = reader.ReadLine().Replace(\" \", \"\");\n\n int i = 0;\n int j = 0;\n int ii = 0;\n\n if ((ii = line1.IndexOf('1')) > 0) {\n i = ii;\n j = 1;\n i++;\n }\n if ((ii = line2.IndexOf('1')) > 0) {\n i = ii;\n j = 2;\n i++;\n }\n if ((ii = line3.IndexOf('1')) > 0) {\n i = ii;\n j = 3;\n i++;\n }\n if ((ii = line4.IndexOf('1')) > 0) {\n i = ii;\n j = 4;\n i++;\n }\n if ((ii = line5.IndexOf('1')) > 0) {\n i = ii;\n j = 5;\n i++;\n }\n\n Console.WriteLine((Math.Abs(i - 2) + Math.Abs(j - 2)));\n\n\n\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n }\n\n\n class Pair {\n public Pair(T1 first, T2 second) {\n First = first;\n Second = second;\n }\n public T1 First { get; set; }\n public T2 Second { get; set; }\n public override string ToString() {\n return \"{\" + First + \" \" + Second + \"}\";\n }\n }\n\n static class ReaderExtensions {\n\n public static string ReadToken(this TextReader reader) {\n int val;\n var builder = new StringBuilder();\n while (true) {\n val = reader.Read();\n if (val == ' ' || val == -1) {\n if (builder.Length == 0) continue;\n break;\n }\n if (val == 13) {\n reader.Read();\n if (builder.Length == 0) continue;\n break;\n }\n builder.Append((char)val);\n }\n return builder.ToString();\n }\n\n public static T Read(this TextReader reader) {\n return (T)Convert.ChangeType(reader.ReadToken(), typeof(T));\n }\n\n public static T[] ReadArr(this TextReader reader) {\n return reader.ReadLine()\n .Split(' ').Select(str =>\n (T)Convert.ChangeType(str, typeof(T))\n ).ToArray();\n }\n\n }\n\n static class LinqExtensions {\n /// Value / Index\n public static IEnumerable> SelectIndexes(this IEnumerable collection) {\n return collection.Select((v, i) => new Pair(v, i));\n }\n public static IEnumerable SelectValues(this IEnumerable> collection) {\n return collection.Select(p => p.First);\n }\n }\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _263A_BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] task = new string[25];\n int position = 1;\n\n for (int i = 0; i < 5; i++)\n {\n var mass = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n for (int j = i*5, k = 0; j < 25 & k<5; j++, k++)\n {\n task[j] = mass[k];\n }\n }\n\n for (int i =0; i < 25; i++)\n {\n if (task[i] == \"0\")\n {\n position += 1;\n }\n else\n break;\n }\n\n double caseNum = Math.Ceiling(position / 5.0);\n int caseMod = position % 5;\n if (caseMod == 0)\n {\n caseMod = 5;\n }\n\n if (position == 14)\n {\n Console.WriteLine(0);\n }\n else if(caseMod == 3)\n {\n Console.WriteLine(Math.Abs(caseNum - caseMod));\n \n }\n else\n {\n caseNum = Math.Abs(caseNum - 3) + Math.Abs(caseMod - 3);\n Console.WriteLine(caseNum);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n List lines = new List();\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n\n int ans = 0;\n for (int i = 1; i < 6; i++)\n {\n if (lines[i-1].Contains('1'))\n {\n if (i < 3)\n ans += 3 - i;\n else if(i>3)\n ans += i - 3;\n\n string s = lines[i-1];\n for (int l = 1; l < 6; l++)\n {\n if (s[l-1] == '1')\n {\n if (l < 2)\n ans += 3 - l;\n else if(l > 2)\n ans += l - 3;\n }\n }\n }\n\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n if (j - i == 0 && (j != 3 && i != 3))\n {\n answer = 4;\n }\n else\n {\n answer = Math.Abs(j - i);\n }\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var first = Console.ReadLine();\n var second = Console.ReadLine();\n var third = Console.ReadLine();\n var fourth = Console.ReadLine();\n var fifth = Console.ReadLine();\n\n const string one = \"1\";\n\n var counter = 0;\n if (first.Contains(one))\n {\n counter += 2;\n counter = Math.Abs(first.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (second.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(second.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (third.Contains(one))\n {\n counter = Math.Abs(third.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (fourth.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(fourth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else\n {\n counter += 2;\n counter = Math.Abs(fifth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n\n Console.WriteLine(counter);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _263A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int[,] matr = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n s = Console.ReadLine();\n string[] temp = s.Split(' ');\n for (int j = 0; j < 5; j++)\n matr[i, j] = int.Parse(temp[j]);\n }\n\n for(int i = 0; i < 5; ++i)\n {\n for(int j = 0; j < 5; ++j)\n {\n if(matr[i, j] == 1)\n {\n Console.WriteLine(Math.Abs(3 - i) + Math.Abs(3 - j));\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] Matrix = new int[5][];\n /*\n {\n {0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0},\n {0, 0, 1, 0, 0}, \n {0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0},\n };\n */\n int MinMove = 0; \n for (int i = 0; i < 5; i++)\n {\n Matrix[i] = Array.ConvertAll(Console.ReadLine().Replace(\"\\t\" , \" \").Split(), int.Parse);\n for (int j = 0; j < 5; j++)\n {\n if (Matrix[i][j] == 1)\n {\n if (i == j)\n MinMove += (i > 2) ? i - 2 : 2 - i;\n else\n {\n MinMove += (i > 2) ? i - 2 : 2 - i;\n MinMove += (j > 2) ? j - 2 : 2 - j;\n }\n }\n }\n }\n /*\n for(int i=0;i<5;i++)\n {\n for (int j = 0; j < 5; j++)\n Console.Write(Matrix[i][j] + \" \");\n Console.WriteLine();\n }\n */\n Console.WriteLine(MinMove);\n //Console.ReadLine();\n }\n }\n}"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i, j] == 1)\n {\n x = i;\n y = j;\n }\n }\n if (x == 0 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 0 && y == 4)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 4)\n System.Console.WriteLine(4);\n /////////////////////////////////////\n else if (x == 2 && y == 0)\n System.Console.WriteLine(2);\n else if (x == 0 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 4 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 2 && y == 4)\n System.Console.WriteLine(2);\n else if(x == 1 && y == 3)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(2);\n\n ////////////////////////////////////////////////////////////////////\n else if (x == 0 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 0 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 3)\n System.Console.WriteLine(3);\n else if (x ==3 && y == 4)\n System.Console.WriteLine(3);\n ////////////////////////////////////////////\n else\n System.Console.WriteLine(1);\n\n\n\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Problem_263A\n{\n \n \n class Controller\n {\n /* \u0417\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u043b\u044f */\n \n public int[,] a;\n public int m;\n \n /* \u041c\u0435\u0442\u043e\u0434, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 */\n \n public void InputController(int[][] a, int m)\n {\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0443: \");\n \n for (int i = 0; i < a.Length; i++)\n {\n a[i] = Console.ReadLine()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(int.Parse)\n .ToArray();\n }\n Console.WriteLine();\n }\n \n /* \u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 */\n \n /*public void OutputController(int[][] a)\n {\n for (int i = 0; i < a.Length; i++)\n {\n for (int j = 0; j < a.Length; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }*/\n \n /* \u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b */\n \n public void NumberOfActions(int[][] a)\n {\n \n int n = 0;\n \n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (a[i][j] == 1)\n {\n a[2][2] = a[i][j];\n a[i][j] = 0;\n n += Math.Abs(i - 2) + Math.Abs(j - 2);\n }\n }\n }\n Console.WriteLine(n);\n }\n } \n \n \n \n class Program\n {\n static void Main()\n {\n /* \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 */\n \n const int m = 5;\n int[][] a = new int[m][];\n \n /* \u0412\u044b\u0432\u043e\u0434 */\n \n Controller cont = new Controller();\n cont.InputController(a,m);\n /*cont.OutputController(a);*/\n cont.NumberOfActions(a);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var split = input.Split(' ');\n //var matrix = \"\";\n //var counter = 0;\n //for(var i = 0; i < split.Length; i++)\n //{\n // if (counter < 5)\n // matrix += split[i];\n // else\n // {\n // matrix += \"\\r\\n\" + split[i];\n // counter = 0;\n // }\n\n // counter++;\n //}\n\n var numberOne = Array.FindIndex(split, w => w.Contains('1'));\n var row = numberOne/5;\n var column = numberOne % 5;\n var swapRowIndex = Math.Abs(row-2);\n var swapColumnIndex = Math.Abs(column-2);\n var total = swapColumnIndex + swapRowIndex;\n Console.WriteLine(total);\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i, j] == 1)\n {\n x = i;\n y = j;\n }\n }\n if (x == 0 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 0 && y == 4)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 4)\n System.Console.WriteLine(4);\n /////////////////////////////////////\n else if (x == 2 && y == 0)\n System.Console.WriteLine(2);\n else if (x == 0 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 4 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 2 && y == 4)\n System.Console.WriteLine(2);\n else if(x == 1 && y == 3)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(2);\n\n ////////////////////////////////////////////////////////////////////\n else if (x == 0 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 0 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 3)\n System.Console.WriteLine(3);\n else if (x ==3 && y == 4)\n System.Console.WriteLine(3);\n ////////////////////////////////////////////\n else\n System.Console.WriteLine(1);\n\n\n\n }\n }"}, {"source_code": "using System;\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] positions = new int[5,5]\n {\n {5,3,2,3,5},{3,2,1,2,3},{2,1,0,1,2},{3,2,1,2,3},{5,3,2,3,5}\n };\n int value = 0;\n bool check = false;\n for(int i = 0; i < 5;i++)\n {\n string[] temp = Console.ReadLine().Trim().Split();\n for(int j = 0; j < temp.Length;j++)\n {\n if(temp[j] == \"1\")\n {\n value = positions[i,j];\n check = true;\n break;\n }\n }\n if(check == true)\n {\n break;\n }\n \n }\n Console.WriteLine(value);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem236A {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n int inputLength = input.Length;\n int distinctLetters = inputLength;\n\n int number = 0;\n for (int i = 0; i < inputLength; i++) {\n char l = input[i];\n for (int j = i+1; j < inputLength; j++) {\n char l2 = input[j];\n if (l.Equals(l2)) {\n distinctLetters--;\n input[j] = (char)number;\n number++;\n }\n }\n }\n\n if (distinctLetters % 2 == 0) {\n Console.WriteLine(\"CHAT WITH HER!\");\n } else {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = 5;\n var res = 0;\n while (t-- > 0) {\n var array = Console.ReadLine().Split(' ');\n var liste = new List();\n\n foreach (var q in array) { liste.Add(int.Parse(q)); }\n\n\n if (liste.Contains(1)) { res += Math.Abs(t-3)+ Math.Abs(3 - liste.IndexOf(1)); }\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Matriza\n{\n class Program\n {\n static void Main(string[] args)\n {\n string p = \"\";\n int str = 0;\n int stol = 0;\n for (int i = 0; i < 5; i++)\n {\n string k = Console.ReadLine();\n if (k != \"00000\")\n {\n p = k;\n str = i + 1;\n }\n }\n for (int u = 0; u < p.Length; u++)\n {\n if (p[u] == '1')\n {\n stol = u + 1;\n }\n }\n int a = 3 - str;\n int b = 3 - stol;\n if (a < 0)\n {\n a = a - 2 * a;\n }\n if (b < 0)\n {\n b = b - b * 2;\n }\n int S = a + b;\n \n Console.WriteLine(S);\n\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a;\n int output=0;\n for (int x = 0; x < 5; x++)\n {\n a = Console.ReadLine();\n string[] words = a.Split(' ');\n for (int y = 0; y < 5; y++)\n {\n if (words[y] == \"1\")\n { \n output = x % 2 + y % 2;\n }\n }\n }\n\n Console.WriteLine(output);\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n internal static class Program\n {\n private static void Main()\n {\n int steps = 0;\n for (int i = 1; i <= 5; i++)\n {\n string s1 = Console.ReadLine();\n string[] s1values = s1.Split(' ');\n\n for (int j = 1; j <= 5; j++)\n {\n int x = int.Parse(s1values[j - 1]);\n if (x == 1)\n {\n steps = Math.Abs(i - 2) + Math.Abs(j - 2);\n }\n }\n }\n Console.WriteLine(steps);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var first = Console.ReadLine();\n var second = Console.ReadLine();\n var third = Console.ReadLine();\n var fourth = Console.ReadLine();\n var fifth = Console.ReadLine();\n\n const string one = \"1\";\n\n var counter = 0;\n if (first.Contains(one))\n {\n counter += 2;\n counter = Math.Abs(first.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (second.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(second.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (third.Contains(one))\n {\n counter = Math.Abs(third.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (fourth.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(fourth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else\n {\n counter += 2;\n counter = Math.Abs(fifth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n\n Console.WriteLine(counter);\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n private static int SIZE_MATRIX = 5;\n private static int PERFECT_POSITION;\n private static int[,] Matrix;\n \n static void Main(string[] args)\n {\n Matrix = new int[SIZE_MATRIX, SIZE_MATRIX];\n int[] temp = new int[SIZE_MATRIX], OriginalPos = new int[2];\n PERFECT_POSITION = (SIZE_MATRIX / 2) - 1;\n int steps = 0;\n \n for (int i = 0; i < SIZE_MATRIX;i++)\n {\n temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n \n for (int j = 0;j < SIZE_MATRIX;j++)\n {\n Matrix[i, j] = temp[j];\n \n if (temp[j] == 1)\n {\n OriginalPos[0] = i;\n OriginalPos[1] = j;\n }\n }\n }\n \n for (int i = 0; i < 2;i++)\n {\n while (OriginalPos[i] != PERFECT_POSITION)\n {\n if (OriginalPos[i] > PERFECT_POSITION)\n {\n OriginalPos[i]--;\n }\n else\n {\n OriginalPos[i]++;\n }\n steps++;\n }\n }\n\n Console.WriteLine(steps);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces_Sol_CSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int MovesNeed = 0;\n int[ , ] Matrix = new int[5, 5];\n for (var y = 0; y < 5; y++)\n {\n var p = Console.ReadLine().Split(' ');\n for(var x = 0; x < 5; x++)\n {\n Matrix[x, y] = int.Parse(p[x]);\n if(int.Parse(p[x]) == 1)\n {\n MovesNeed = 2 - x;\n if (MovesNeed < 0) MovesNeed *= -1;\n MovesNeed += 2 - y;\n if (MovesNeed < 0) MovesNeed *= -1;\n }\n }\n }\n Console.WriteLine(MovesNeed);\n }\n }\n}\n"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i,j] == 1)\n x = i;y = j;\n }\n if (x == 0 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 0 && y == 4)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 4)\n System.Console.WriteLine(4);\n /////////////////////////////////////\n else if (x == 2 && y == 0)\n System.Console.WriteLine(2);\n else if (x == 0 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 4 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 2 && y == 4)\n System.Console.WriteLine(2);\n else if(x == 1 && y == 3)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(2);\n\n ////////////////////////////////////////////////////////////////////\n else if (x == 0 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 0 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 3)\n System.Console.WriteLine(3);\n else if (x ==3 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 2 && y == 1)\n System.Console.WriteLine(1);\n ////////////////////////////////////////////\n else\n System.Console.WriteLine(1);\n\n\n\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Problem_263A\n{\n \n \n class Controller\n {\n /* \u0417\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u043b\u044f */\n \n public int[,] a;\n public int m;\n \n /* \u041c\u0435\u0442\u043e\u0434, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 */\n \n public void InputController(int[][] a, int m)\n {\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0443: \");\n \n for (int i = 0; i < a.Length; i++)\n {\n a[i] = Console.ReadLine()\n .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)\n .Select(int.Parse)\n .ToArray();\n }\n Console.WriteLine();\n }\n \n /* \u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 */\n \n /*public void OutputController(int[][] a)\n {\n for (int i = 0; i < a.Length; i++)\n {\n for (int j = 0; j < a.Length; j++)\n {\n Console.Write(a[i][j]);\n }\n Console.WriteLine();\n }\n }*/\n \n /* \u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b */\n \n public void NumberOfActions(int[][] a)\n {\n \n int n = 0;\n \n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (a[i][j] == 1)\n {\n a[2][2] = a[i][j];\n a[i][j] = 0;\n n += Math.Abs(i - 2) + Math.Abs(j - 2);\n }\n }\n }\n Console.WriteLine(n);\n }\n } \n \n \n \n class Program\n {\n static void Main()\n {\n /* \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 */\n \n const int m = 5;\n int[][] a = new int[m][];\n \n /* \u0412\u044b\u0432\u043e\u0434 */\n \n Controller cont = new Controller();\n cont.InputController(a,m);\n /*cont.OutputController(a);*/\n cont.NumberOfActions(a);\n }\n }\n}"}, {"source_code": "using System;\nnamespace BasicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n int indexno = 0;\n for (int i = 0; i < 5; i++)\n {\n var j = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int ar = 0;\n foreach (var item in j)\n {\n ar++;\n if(item==1)\n {\n indexno = i * 5 + ar;\n int result = 13 - indexno;\n Console.WriteLine(result);\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] Array = new char [5, 5];\n int count = 0;int rowindex = 0;\n int colindex = 0;\n\n for (int i=0;i<4;i++)\n {\n rowindex = i;\n string value = Console.ReadLine();\n if(value.Contains(\"1\"))\n {\n colindex = value.IndexOf('1') / 2 + 1;\n\n }\n \n \n }\n\n // Console.WriteLine(2-rowindex/2+1+2-colindex);\n Console.WriteLine(rowindex/2+1-2+ colindex-2);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program {\n static void Main() {\n \n string[][] matrix = new string[5][];\n var pos = (0, 0);\n int steps = 0;\n \n for (int i = 0; i < 5; i++) {\n matrix[i] = Console.ReadLine().Split();\n for (int j = 0; j < 5; j++) {\n if (matrix[i][j] == \"1\") {\n pos.Item2 = i;\n pos.Item1 = j;\n }\n }\n }\n \n if (pos.Item1 < 2)\n steps += 2 - pos.Item1;\n else\n steps += 2 % pos.Item1;\n \n if (pos.Item2 < 2)\n steps += 2 - pos.Item2;\n else\n steps += 2 % pos.Item2;\n \n Console.WriteLine(steps);\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nclass Problem\n{\n static void Main()\n {\n int[] a = new int[25];\n int viTri = 0;\n for(int i = 0 ; i < 5 ; i++)\n {\n string[] str = Console.ReadLine().Split();\n for(int j = 0 ; j < 5 ; j++)\n {\n a[5 * i + j] = Convert.ToInt32( str[j] );\n if(a[5 * i + j] == 1)\n viTri = 5 * i + j;\n }\n\n }\n Console.WriteLine( viTri - 13 );\n\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n { \n for (var i = 0; i < 5; ++i)\n for(var j = 0; j < 5; ++j)\n if(Console.Read() == '1')\n Console.WriteLine(Math.Abs(i - 2) + Math.Abs(j - 2));\n }\n}"}, {"source_code": "using System;\n\nnamespace Practise_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] Input = new int[5, 5];\n int LuuX = 0, LuuY = 0;\n for (var i = 0; i < 5; i++)\n {\n for(var j = 0; j < 5; j++)\n {\n Input[i, j] = Convert.ToInt32(Console.Read());\n if(Input[i,j] == 1)\n {\n LuuX = i;\n LuuY = j;\n }\n }\n }\n Console.WriteLine(Math.Abs(3-LuuX)+Math.Abs(3-LuuY));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] input = new string[5];\n int[,] matrix = new int[5, 5];\n int oneX = -1, oneY = -1, answer = -1;\n\n for (int i = 0; i < 5; i++)\n {\n input[i] = Console.ReadLine();\n }\n for (int i = 0; i < 5; i++)\n {\n input[i] = input[i].Replace(\" \", \"\");\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = (input[i][j]) - '0';\n if (input[i][j] - '0' == 1)\n {\n oneX = i;\n oneY = j;\n }\n }\n }\n\n answer = (Math.Abs(2 - oneX) + Math.Abs(2 - oneY));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var split = input.Split(' ');\n //var matrix = \"\";\n //var counter = 0;\n //for(var i = 0; i < split.Length; i++)\n //{\n // if (counter < 5)\n // matrix += split[i];\n // else\n // {\n // matrix += \"\\r\\n\" + split[i];\n // counter = 0;\n // }\n\n // counter++;\n //}\n\n var numberOne = Array.FindIndex(split, w => w.Contains('1'));\n var row = numberOne/5;\n var column = numberOne % 5;\n var swapRowIndex = Math.Abs(2 - row);\n var swapColumnIndex = Math.Abs(2 - column);\n ValueType total = swapColumnIndex + swapRowIndex;\n Console.WriteLine(total);\n\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n \n\n\n static void Main(string[] args)\n {\n int row = 5;\n int col = 5;\n int[,] matrix1;\n\n int[,] newmat = new int[5, 5];\n\n string[] inputs = new string[5];\n \n matrix1 = new int[5, 5];\n \n for (int i = 0; i < inputs.Length; i++)\n {\n \n\n inputs[i] = Console.ReadLine();// i have problem with this line,... plz show me the correct form \n }\n\n\n\n for( int i=0; i2)\n {\n matrix1[i, j - 1] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n }\n\n else if(i<2 && j>2)\n {\n\n for (int k = j; k >= 2; k--)\n {\n matrix1[i, k- 1] = matrix1[i, k];\n matrix1[i,k] = 0;\n count++;\n }\n \n \n }\n\n else if (i > 2 && j > 2)\n {\n\n \n matrix1[i - 1, j - 1] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n }\n\n else if (i<2 && j==2)\n {\n matrix1[i + 1, j] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n }\n\n } \n }\n\n \n }\n\n Console.WriteLine(count);\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n int d = 0;\n for (int i = -2; i <= 2; i++)\n {\n if ((d = Console.ReadLine().Replace(\" \", \"\").IndexOf('1')) > 0)\n {\n d -= 2;\n d += i;\n }\n }\n Console.WriteLine(d);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] input = new string[5];\n int[,] matrix = new int[5, 5];\n int oneX = -1, oneY = -1, answer = -1;\n\n for (int i = 0; i < 5; i++)\n {\n input[i] = Console.ReadLine();\n }\n for (int i = 0; i < 5; i++)\n {\n input[i] = input[i].Replace(\" \", \"\");\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = (input[i][j]) - '0';\n if (input[i][j] - '0' == 1)\n {\n oneX = i;\n oneY = j;\n }\n }\n }\n\n answer = (Math.Abs(2 - oneX) + Math.Abs(2 - oneY));\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass program\n{\n static void Main(string[]args)\n {\n int[,] Matrix = new int[5, 5];\n int rowNumber = 0;\n int columnNumber = 0;\n int rowSwaps = 0;\n int columnSwaps = 0;\n for (int i = 0; i < 5; i++)\n {\n string input = Console.ReadLine();\n string[] inputs = input.Split(' ');\n for (int j = 0; j < 5; j++)\n {\n Matrix[i, j] = Convert.ToInt32(inputs[j]);\n }\n }\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (Matrix[i, j] == 1)\n {\n rowNumber = i;\n columnNumber = j;\n }\n }\n }\n if (rowNumber == 2 && columnNumber == 2)\n Console.WriteLine(0);\n\n if (rowNumber == 2)\n rowSwaps = 0;\n else\n {\n while (rowNumber > 2)\n {\n rowNumber--;\n rowSwaps++;\n }\n \n while (rowNumber < 2)\n {\n rowNumber++;\n rowSwaps++;\n }\n }\n\n if (columnNumber == 2)\n columnSwaps = 0;\n else\n {\n while (columnNumber > 2)\n {\n columnNumber--;\n columnSwaps++;\n }\n \n while (columnNumber < 2)\n {\n columnNumber++;\n rowSwaps++;\n }\n }\n \n \n\n Console.WriteLine(rowSwaps+columnSwaps);\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem236A {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n int inputLength = input.Length;\n int distinctLetters = inputLength;\n\n int number = 0;\n for (int i = 0; i < inputLength; i++) {\n char l = input[i];\n for (int j = i+1; j < inputLength; j++) {\n char l2 = input[j];\n if (l.Equals(l2)) {\n distinctLetters--;\n input[j] = (char)number;\n number++;\n }\n }\n }\n\n if (distinctLetters % 2 == 0) {\n Console.WriteLine(\"CHAT WITH HER!\");\n } else {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] A1 = Console.ReadLine().Split(' ');\n string[] A2 = Console.ReadLine().Split(' ');\n string[] A3 = Console.ReadLine().Split(' ');\n string[] A4 = Console.ReadLine().Split(' ');\n string[] A5 = Console.ReadLine().Split(' ');\n\n if (A1.Contains(\"1\"))\n {\n var counter = 0;\n var rowNum = 1;\n var colNow = 0;\n //var colNum = 0;\n var colNum = Array.FindIndex(A1, z => z.Contains(\"1\"));\n if (colNum > 2)\n {\n colNow = colNum - 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3))+counter);\n\n }\n else\n {\n colNow = colNow - 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3))+counter);\n }\n }\n else\n {\n colNow = colNum + 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow + 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n }\n if (A2.Contains(\"1\"))\n {\n var counter = 0;\n var rowNum = 2;\n var colNow = 0;\n //var colNum = 0;\n var colNum = Array.FindIndex(A2, z => z.Contains(\"1\")); \n if (colNum > 2)\n {\n colNow = colNum - 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow - 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n else\n {\n colNow = colNum + 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow + 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n }\n if (A3.Contains(\"1\"))\n {\n var counter = 0;\n var rowNum = 3;\n var colNow = 0;\n //var colNum = 0;\n var colNum = Array.FindIndex(A3, z => z.Contains(\"1\"));\n if (colNum > 2)\n {\n colNow = colNum - 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow - 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n else\n {\n colNow = colNum + 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow + 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n }\n if (A4.Contains(\"1\"))\n {\n var counter = 0;\n var rowNum = 4;\n var colNow = 0;\n //var colNum = 0;\n var colNum = Array.FindIndex(A4, z => z.Contains(\"1\"));\n if (colNum > 2)\n {\n colNow = colNum - 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow - 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n else\n {\n colNow = colNum + 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow + 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n }\n if (A5.Contains(\"1\"))\n {\n var counter = 0;\n var rowNum = 5;\n var colNow = 0;\n //var colNum = 0;\n var colNum = Array.FindIndex(A5, z => z.Contains(\"1\"));\n if (colNum > 2)\n {\n colNow = colNum - 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow - 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n else\n {\n colNow = colNum + 1;\n counter++;\n if (colNow == 2)\n {\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n\n }\n else\n {\n colNow = colNow + 1;\n counter++;\n Console.WriteLine((Math.Abs(rowNum - 3)) + counter);\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static int numberOfBeautifulMoves(int row, int col)\n {\n int moves = 0;\n\n while (!(row == 2 && col == 2))\n {\n if(row > 2)\n row--;\n\n if (col > 2)\n col--;\n\n if (row < 2)\n row++;\n\n if (col < 2)\n col++;\n\n moves++;\n\n }\n return ++moves;\n }\n\n static void Main(string[] args)\n {\n int[,] matrix = new int[5, 5];\n string[] splitted = new string[5];\n int row = 0, col = 0;\n\n for (int i = 0; i < matrix.GetLength(0); i++)\n {\n splitted = Console.ReadLine().Split();\n for (int j = 0; j < matrix.GetLength(1); j++)\n {\n matrix[i, j] = Int32.Parse(splitted[j]);\n if(matrix[i, j] == 1)\n {\n row = i;\n col = j;\n }\n \n }\n }\n\n Console.WriteLine(numberOfBeautifulMoves(row, col).ToString());\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int outout=0;\n \n \n string Input;\n \n \n for (int i = 0; i < 5; i++)\n {\n Input = Console.ReadLine();\n string[] splitString = Input.Split(' ');\n for(int j=0;j<5;j++)\n {\n if(splitString[j].ToString()==\"1\")\n {\n outout = Math.Abs(i - 3) + Math.Abs(j - 3);\n \n \n }\n \n\n\n }\n \n \n }\n Console.WriteLine(outout.ToString());\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main(string[] args)\n {\n var grid = Parse();\n Console.WriteLine(grid);\n var minimumShifts = Solve(grid);\n Print(minimumShifts);\n }\n\n private static void Print(int minimumShifts)\n {\n Console.WriteLine(minimumShifts);\n }\n\n private static int Solve(int[,] grid)\n {\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (grid[i, j] == 1)\n {\n x = i;\n y = j;\n }\n }\n }\n return Math.Abs(x - 2) + Math.Abs(y - 2);\n }\n\n private static int[,] Parse()\n {\n var grid = new int[5, 5];\n for (int i = 0; i < 5; i++)\n {\n var input = Console.ReadLine();\n for (int j = 0; j < 5; j++)\n grid[i, j] = int.Parse(input.Substring(2 * j, 1)); \n }\n return grid;\n }\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n int[,] matrix = new int[5,5];\n int[] mat = new int[5];\n int rowcount=0,columncount=0,counter=0;\n for(int i=0;i<5;i++)\n {\n mat = Array.ConvertAll(Console.ReadLine().Split(' '), item => Convert.ToInt32(item));\n for(int j=0;j<5;j++)\n {\n matrix[i, j] = mat[j];\n if(matrix[i,j] == 1)\n {\n rowcount = i; columncount = j;\n }\n }\n }\n if (rowcount == 2 && columncount == 2) Console.Write(counter);\n else\n {\n counter += (rowcount>2? rowcount-2 : 2-rowcount);\n counter += (columncount > 2 ? columncount - 2 : 2 - columncount);\n }\n Console.Write(counter);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n //Your code goes here\n var matrix = new string[5];\n for(var index = 0; index < 5; index++)\n matrix[index] = Console.ReadLine();\n\n int oneRow=0;\n int oneCol=0;\n for(var row = 0; row < 5; row++)\n {\n var col = matrix[row].IndexOf(\"1\");\n if(col != -1){\n oneRow = row;\n oneCol = col;\n }\n }\n \n Console.WriteLine(Math.Abs(2-oneRow) + Math.Abs(2-oneCol));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n if (j - i == 0 && (j == 3 && i == 3))\n {\n answer = 4;\n }\n else\n {\n answer = Math.Abs(j - i);\n }\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n answer = Math.Abs(j - i);\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int[,] arr = new int[5,5];\n int a1 = 0; \n int a2 = 0;\n\n for (int i = 0; i < 5; i++)\n {\n string str = Console.ReadLine();\n string []strArr = str.Split(' ');\n\n for (int j = 0; j < strArr.Length; j++)\n {\n arr[i, j] = int.Parse(strArr[j]);\n\n if (arr[i, j] == 1)\n {\n a1 = i;\n a2 = j;\n }\n }\n \n }\n int res=0;\n if(a1==2 && a2==2 )\n {\n Console.WriteLine(res);\n }\n else\n {\n if (a1 < 2)\n {\n while (a1 < 2)\n {\n res += 1;\n a1++;\n }\n }\n else\n {\n while (a1 > 2)\n {\n res += 1;\n a1--;\n }\n }\n\n\n if (a2 < 2)\n {\n while (a2 < 2)\n {\n res += 1;\n a2++;\n }\n }\n else\n {\n while (a2 > 2)\n {\n res += 1;\n a2--;\n }\n }\n\n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var row1 = Console.ReadLine().Split();\n var row2 = Console.ReadLine().Split();\n var row3 = Console.ReadLine().Split();\n var row4 = Console.ReadLine().Split();\n var row5 = Console.ReadLine().Split();\n int i = 0;\n int j = 0;\n var one = 0;\n var row = 0;\n var torow = 3;\n var tocol = 3;\n\n var matrix = new int[5, 5];\n\n for (i = 0; i < 5; i++)\n {\n if (int.Parse(row1[i]) == 1)\n {\n one = i + 1;\n row = 1;\n }\n if (int.Parse(row2[i]) == 1)\n {\n one = i + 1;\n row = 2;\n }\n if (int.Parse(row3[i]) == 1)\n {\n one = i + 1;\n row = 3;\n }\n if (int.Parse(row4[i]) == 1)\n {\n one = i + 1;\n row = 4;\n }\n if (int.Parse(row5[i]) == 1)\n {\n row = 5;\n one = i + 1;\n }\n }\n\n var total = (-row - torow) - (-one - tocol);\n Console.WriteLine(Math.Abs(total));\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace _263A_BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] task = new string[25];\n int position = 1;\n\n for (int i = 0; i < 5; i++)\n {\n var mass = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n for (int j = i*5, k = 0; j < 25 & k<5; j++, k++)\n {\n task[j] = mass[k];\n }\n }\n\n for (int i =0; i < 25; i++)\n {\n if (task[i] == \"0\")\n {\n position += 1;\n }\n else\n break;\n }\n\n int caseNum = position / 5 +1;\n int caseMod = position % 5;\n\n if (caseMod == caseNum)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(caseNum - caseMod);\n \n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[,] Array = new char [5, 5];\n int count = 0;int rowindex = 0;\n int colindex = 0;\n\n for (int i=0;i<4;i++)\n {\n rowindex = i;\n string value = Console.ReadLine();\n if(value.Contains(\"1\"))\n {\n //Console.WriteLine(value.IndexOf('1'));\n colindex = value.IndexOf('1') / 2 ;\n break;\n }\n \n \n }\n\n // Console.WriteLine(2-rowindex/2+1+2-colindex);\n Console.WriteLine(Math.Abs(rowindex-2)+ Math.Abs(colindex-2));\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n if (j - i == 0)\n {\n answer = 4;\n }\n else\n {\n answer = Math.Abs(j - i);\n }\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = 0;\n var result = 0;\n int matrixCount = 5;\n var count = 0;\n for (int i = 1; i <= matrixCount; i++)\n {\n string[] matrix = Console.ReadLine().Split(' ');\n count++;\n for (int z = 1; z <= matrix.Length; z++)\n {\n if (matrix[z - 1] == \"1\" && i < 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(x - 3));\n }\n else if (matrix[z - 1] == \"1\" && i > 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(x - 3));\n }\n else if (matrix[z - 1] == \"1\" && i == 3)\n {\n x = Math.Abs(z - 3);\n result = x + (Math.Abs(count - i));\n }\n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _10__A._Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] arr = new int[5, 5];\n\n int count = 0;\n int i_ = 0;\n int j_ = 0;\n\n for (int i = 0; i < 5; i++)\n {\n\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n for (int j = 0; j < 5; j++)\n {\n \n arr[i, j] = int.Parse(values[j]);\n }\n Console.WriteLine();\n }\n\n\n \n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (arr[i, j] == 1)\n {\n i_ = i;\n j_ = j;\n }\n }\n\n }\n // Console.WriteLine(i_ + \" \" + j_);\n\n\n\n if ((i_ < 2 && j_ <= 4) || (i_ == 2 && j_ < 2 ))\n {\n\n arr[2, 2] = 1;\n\n for (int i = i_; i < 5; i++)\n {\n for (int j = j_ + 1; j < 5; j++)\n {\n if (arr[i, j] != 1)\n {\n count++;\n }\n else if (arr[i, j] == 1)\n {\n count++;\n goto rtrt;\n\n }\n }\n break;\n }\n\n\n for (int i = i_ + 1; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (arr[i, j] != 1)\n {\n count++;\n }\n else if (arr[i, j] == 1)\n {\n count++;\n goto rtrt;\n\n }\n }\n\n }\n\n\n rtrt:\n Console.WriteLine(count);\n }\n\n else if(j_ !=2)\n {\n for (int i = 2; i < 5; i++)\n {\n for (int j = 3; j < 5; j++)\n {\n if (arr[i, j] != 1)\n {\n count++;\n }\n else if (arr[i, j] == 1)\n {\n count++;\n goto rtrt2;\n\n }\n }\n break;\n }\n\n for (int i = 3; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (arr[i, j] != 1)\n {\n count++;\n }\n else if (arr[i, j] == 1)\n {\n count++;\n goto rtrt2;\n\n }\n }\n\n }\n\n rtrt2:\n Console.WriteLine(count);\n }\n else\n {\n \n Console.WriteLine(count);\n }\n\n \n\n }\n }\n}\n"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i,j] == 1)\n x = i;y = j;\n\n }\n x =System.Math.Abs( x - 3);\n y = System.Math.Abs(y - 3);\n x = x + y;\n System.Console.WriteLine(x);\n\n\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n static void Main()\n {\n string[,] matrix=new string[5,5];\n int numberOfMovement = 0;\n for (int i = 0; i < 5; i++)\n {\n string[] rowInputs = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = rowInputs[j];\n if (matrix[i, j] == \"1\")\n {\n numberOfMovement = Math.Abs(3-i+1)+ Math.Abs(3 - j+1);\n }\n }\n }\n\n Console.WriteLine(numberOfMovement);\n }\n \n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication29\n{\n class Program\n {\n static void Main()\n {\n int[,] ar = new int[5, 5];\n int k=0, c=0;\n for ( var i = 0; i<5;i++)\n {\n var t = Console.ReadLine().Split(' ');\n var arr = t.Select(int.Parse).ToArray();\n for ( var j = 0; j<5;j++)\n {\n ar[i, j] = arr[j];\n }\n }\n for ( var i = 0; i<5;i++)\n {\n for ( var j = 0; j<5;j++)\n {\n if (ar[i,j]==1)\n {\n k = i;\n c = j;\n }\n }\n\n }\n var x = Math.Abs(3 - k) + Math.Abs(3 - c);\n Console.WriteLine(x);\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n \n\n\n static void Main(string[] args)\n {\n int row = 5;\n int col = 5;\n int[,] matrix1;\n\n int[,] newmat = new int[5, 5];\n\n string[] inputs = new string[5];\n \n matrix1 = new int[5, 5];\n \n for (int i = 0; i < inputs.Length; i++)\n {\n \n\n inputs[i] = Console.ReadLine();// i have problem with this line,... plz show me the correct form \n }\n\n\n\n for( int i=0; i2)\n {\n matrix1[i, j - 1] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n }\n\n else if(i<2 && j>2)\n {\n\n for (int k = j; k >= 2; k--)\n {\n matrix1[i, k- 1] = matrix1[i, k];\n matrix1[i,k] = 0;\n count++;\n }\n \n \n }\n\n else if (i > 2 && j > 2)\n {\n\n matrix1[2, j] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n for (int k = j; k >= 2; k--)\n {\n \n matrix1[i, k - 1] = matrix1[i, k];\n matrix1[i, k] = 0;\n count++;\n }\n }\n\n else if (i<2 && j==2)\n {\n matrix1[i + 1, j] = matrix1[i, j];\n matrix1[i, j] = 0;\n count++;\n }\n\n } \n }\n\n \n }\n\n Console.WriteLine(count);\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\n class Program\n {\n \n static void Main(string[] args)\n {\n string npt = Console.In.ReadToEnd();\n int i = 0;\n for (; i < npt.Length; ++i)\n if (npt[i] == '1') break;\n npt = null;\n i = (i + 1) / 2;\n int b = i / 5+1;\n i = i % 5;\n if(i==0)\n { b--; i = 5;}\n i = Math.Abs(3 - i)+ Math.Abs(3 - b);\n Console.WriteLine(i);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n static void Main()\n {\n string[,] matrix=new string[5,5];\n int numberOfMovement = 0;\n for (int i = 0; i < 5; i++)\n {\n string[] rowInputs = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = rowInputs[j];\n if (matrix[i, j] == \"1\")\n {\n numberOfMovement = Math.Abs(3-i+1)+ Math.Abs(3 - j+1);\n }\n }\n }\n\n Console.WriteLine(numberOfMovement);\n }\n \n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n for (int i = 0; i < 5; i++)\n {\n var position = Console.ReadLine().Replace(\" \", \"\").IndexOf(\"1\");\n if (position != -1)\n Console.WriteLine(Math.Abs(3 - position)+Math.Abs(2 - i));\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _263A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matrix = new int[5, 5];\n string[] s = new string[5];\n int numI = 0, numJ = 0;\n\n for (int i = 0; i < 5; i++)\n {\n s[i] = Console.ReadLine();\n s[i] = s[i].Replace(\" \", \"\");\n }\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if (j == 4)\n {\n matrix[i, j] = Convert.ToInt32(s[i].Substring(j));\n if (matrix[i, j] == 0)\n {\n numI = i;\n numJ = j;\n }\n }\n else\n {\n matrix[i, j] = Convert.ToInt32(s[i].Substring(j, 1));\n if (matrix[i, j] == 0)\n {\n numI = i;\n numJ = j;\n }\n }\n }\n }\n\n int numOfOperation = Math.Abs(numI - 2) + Math.Abs(numJ - 2);\n Console.WriteLine(numOfOperation);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matrix = new int[5, 5];\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n for(int j=0;j<5;j++)\n {\n matrix[i, j]= (int)Console.Read();\n Console.Read();\n }\n Console.Read();\n }\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if ( matrix[i,j] == 49)\n {\n row = i+1;\n col = j+1;\n //Console.WriteLine(row); \n //Console.WriteLine(col); \n }\n }\n }\n int sol = Math.Abs(-2 + row) + Math.Abs(-2 + col);\n Console.WriteLine(sol);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int y = -2;\n int x = 10;\n bool set = false;\n\n for (int i = 0; i < 5; i++)\n {\n if (set)\n {\n Console.ReadLine();\n }\n else\n {\n\n string input = Console.ReadLine().Trim();\n if (input.Contains(\"1\"))\n {\n\n x = input.IndexOf('1')-2;\n set = true;\n }\n else\n {\n y++;\n }\n\n }\n }\n\n Console.WriteLine(Math.Abs(x) + Math.Abs(y));\n Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] arr = new int[5][];\n for (int i = 0; i < 5; i++)\n arr[i] = new int[5];\n\n for (int i = 0; i < 5; i++)\n {\n var n = Console.ReadLine();\n Console.Write(n + \" \");\n //for (int j = 0; j < 5; j++)\n //{\n // var n = Console.ReadLine();\n // Console.Write(n + \" \");\n // //arr[i][j] = \n //}\n }\n\n Console.WriteLine(arr[1][2]);\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\nnamespace CF {\n class Program {\n\n static void Main(string[] args) {\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n TextWriter writer = Console.Out;\n#else\n\t\t\tTextReader reader = Console.In;\n TextWriter writer = Console.Out;\n#endif\n\n var line1 = reader.ReadLine().Replace(\" \",\"\");\n var line2 = reader.ReadLine().Replace(\" \",\"\");\n var line3 = reader.ReadLine().Replace(\" \",\"\");\n var line4 = reader.ReadLine().Replace(\" \",\"\");\n var line5 = reader.ReadLine().Replace(\" \",\"\");\n\n int i = 0;\n int j = 0;\n int ii = 0;\n\n if ((ii = line1.IndexOf('1')) > 0) {\n i = ii;\n j = 1;\n i++;\n }\n if ((ii = line2.IndexOf('1')) > 0) {\n i = ii;\n j = 2;\n i++;\n }\n if ((ii = line3.IndexOf('1')) > 0) {\n i = ii;\n j = 3;\n i++;\n }\n if ((ii = line4.IndexOf('1')) > 0) {\n i = ii;\n j = 4;\n i++;\n }\n if ((ii = line5.IndexOf('1')) > 0) {\n i = ii;\n j = 5;\n i++;\n }\n\n Console.WriteLine((Math.Abs(i - 3) + Math.Abs(j - 3)));\n\n\n \n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n }\n\n\n class Pair {\n public Pair(T1 first, T2 second) {\n First = first;\n Second = second;\n }\n public T1 First { get; set; }\n public T2 Second { get; set; }\n public override string ToString() {\n return \"{\" + First + \" \" + Second + \"}\";\n }\n }\n\n static class ReaderExtensions {\n\n public static string ReadToken(this TextReader reader) {\n int val;\n var builder = new StringBuilder();\n while (true) {\n val = reader.Read();\n if (val == ' ' || val == -1) {\n if (builder.Length == 0) continue;\n break;\n }\n if (val == 13) {\n reader.Read();\n if (builder.Length == 0) continue;\n break;\n }\n builder.Append((char)val);\n }\n return builder.ToString();\n }\n\n public static T Read(this TextReader reader) {\n return (T)Convert.ChangeType(reader.ReadToken(), typeof(T));\n }\n\n public static T[] ReadArr(this TextReader reader) {\n return reader.ReadLine()\n .Split(' ').Select(str =>\n (T)Convert.ChangeType(str, typeof(T))\n ).ToArray();\n }\n\n }\n\n static class LinqExtensions {\n /// Value / Index\n public static IEnumerable> SelectIndexes(this IEnumerable collection) {\n return collection.Select((v, i) => new Pair(v, i));\n }\n public static IEnumerable SelectValues(this IEnumerable> collection) {\n return collection.Select(p => p.First);\n }\n }\n\n}\n\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n { \n for (var i = 0; i < 5; ++i)\n for(var j = 0; j < 5; ++j)\n if(Console.Read() == '1')\n Console.WriteLine(Math.Abs(i - 2) + Math.Abs(j - 2));\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n\n\n\n int[,] intarray = new int[5, 5];\n\n int i, j;\n double result = 0;\n for (i = 0; i < 5; i++)\n {\n\n string lines = Console.ReadLine();\n\n string[] linessplit = lines.Split(' ');\n\n int[] newintarray = Array.ConvertAll(linessplit, int.Parse);\n\n\n for (j = 0; j < 5; j++)\n {\n intarray[i, j] = newintarray[j];\n \n }\n\n }\n\n\n for (i = 0; i < 5; i++)\n {\n for (j = 0; j < 5; j++)\n {\n if (intarray[i, j] == 1)\n {\n int a = i - 2;\n int workofa = a * a;\n\n int b = j - 2;\n int workofb = b * b;\n\n result = Math.Sqrt(workofa + workofb);\n }\n }\n\n \n }\n Console.WriteLine(Math.Ceiling(result));\n \n\n \n\n\n }\n }\n}\n"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i, j] == 1)\n {\n x = i;\n y = j;\n }\n }\n if (x == 0 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 0 && y == 4)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 4)\n System.Console.WriteLine(4);\n /////////////////////////////////////\n else if (x == 2 && y == 0)\n System.Console.WriteLine(2);\n else if (x == 0 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 4 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 2 && y == 4)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 3)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(2);\n\n ////////////////////////////////////////////////////////////////////\n else if (x == 0 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 0 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(0);\n ////////////////////////////////////////////\n else\n System.Console.WriteLine(1);\n\n\n\n }\n }"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n int d = 0;\n for (int i = 1; i <= 5; i++)\n {\n var m = Console.ReadLine().Replace(\" \", \"\");\n if ((d = m.IndexOf('1')) > 0)\n {\n d++;\n d *= i;\n break;\n }\n }\n Console.WriteLine(Math.Abs(13 - d));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nnamespace PS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str;\n string[] strArr;\n int x = 0 , y = 0 ;\n for (int i = 0; i < 5; ++i)\n {\n str = Console.ReadLine();\n strArr = str.Split(' ');\n for (int j = 0; j < 5; ++j) \n if (strArr[j] == \"1\")\n {\n x= i;\n y= j;\n }\n }\n Console.WriteLine(Math.Abs(2 - x + Math.Abs(2 - y)));\n \n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n if (j - i == 0 && (j != 3 && i != 3))\n {\n answer = 4;\n }\n else\n {\n answer = Math.Abs(j - i);\n }\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Practise_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int LuuX = 0, LuuY = 0;\n for (var i = 0; i < 5; i++)\n {\n string[] Temp = Console.ReadLine().Split(' ');\n for (var j = 0; j < 5; j++)\n {\n if(Temp[j] == \"1\")\n {\n LuuX = i;\n LuuY = j;\n break;\n }\n }\n }\n Console.WriteLine(Math.Abs(3 - LuuX) + Math.Abs(3 - LuuY));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _263A___Beautiful_Matrix\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tMatrixen();\n\t\t}\n\n\t\tprivate static void Matrixen()\n\t\t{\n\t\t\tTuple coords = GetCoords();\n\t\t\tint steps = Math.Abs(coords.Item1 - 3) + Math.Abs(coords.Item2 - 3);\n\n\t\t\tConsole.WriteLine(steps);\n\t\t}\n\n\t\tprivate static Tuple GetCoords()\n\t\t{\n\t\t\tfor (int y = 0; y < 5; y++)\n\t\t\t{\n\t\t\t\tstring[] line = Console.ReadLine().Split(' ');\n\n\t\t\t\tfor (int x = 0; x < 5; x++)\n\t\t\t\t\tif (line[x] == \"1\")\n\t\t\t\t\t\treturn new Tuple(x, y);\n\t\t\t}\n\n\t\t\treturn new Tuple(0, 0);\n\t\t}\n\t}\n}"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a;\n int output=0;\n for (int x = 0; x < 5; x++)\n {\n a = Console.ReadLine();\n string[] words = a.Split(' ');\n for (int y = 0; y < 5; y++)\n {\n if (words[y] == \"1\")\n { \n output = x % 2 + y % 2;\n }\n }\n }\n\n Console.WriteLine(output);\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nclass CFR161D2\n{\n static void Main()\n {\n Console.WriteLine(GetRes());\n }\n \n static int GetRes()\n {\n int res = 0;\n string[] line;\n for (int i = 0; i < 5; i++)\n {\n line = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n if (line[j] == \"1\")\n {\n res = Math.Abs(2-j) + Math.Abs(2-j);\n return res;\n }\n }\n }\n return res;\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int columna = 2, fila = 0;\n for (int i = 0; i < 5; i++)\n {\n var matriz = Console.ReadLine().Split(' ');\n \n if (matriz.Contains(\"1\"))\n {\n Console.Write(columna+Math.Abs(Array.IndexOf(matriz, \"1\")-2));\n }\n columna--;\n if (i > 2)\n columna += 2;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass CFR161D2\n{\n static void Main()\n {\n Console.WriteLine(GetRes());\n }\n \n static int GetRes()\n {\n int res = 0;\n string[] line;\n for (int i = 0; i < 5; i++)\n {\n line = Console.ReadLine().Split(' ');\n for (int j = 0; j < 5; j++)\n {\n if (line[j] == \"1\")\n {\n res = Math.Abs(2-j) + Math.Abs(2-j);\n return res;\n }\n }\n }\n return res;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n List lines = new List();\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n\n int ans = 0;\n for (int i = 0; i < 5; i++)\n {\n if (lines[i].Contains('1'))\n {\n if (i < 3)\n ans += 3 - i;\n else\n ans += 5 - i;\n\n string s = lines[i];\n for (int l = 0; l < 5; l++)\n {\n if (s[l] == '1')\n {\n if (l < 3)\n ans += 3 - l;\n else\n ans += 5 - l;\n }\n }\n }\n\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] array = new int[4,4];\n\n var result = 0;\n\n var arrayLength = array.GetLength(0);\n\n for (int i = 0; i < arrayLength; i++)\n {\n var line = ParseString(Console.ReadLine());\n\n for (int j = 0; j < arrayLength; j++)\n {\n var number = line[j];\n array[i, j] = number;\n\n if (number == 1)\n {\n result = Calc(i) + Calc(j);\n }\n }\n }\n\n Console.WriteLine(result);\n }\n\n static int Calc(int index)\n {\n switch (index)\n {\n case 0: return 2;\n case 1: return 1;\n case 2: return 0;\n case 3: return 1;\n case 4: return 2;\n default: throw new Exception();\n }\n }\n\n static int[] ParseString(string line)\n {\n var result = line.Split(' ').Select(int.Parse).ToArray();\n\n return result;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Coding_challengfes\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] matrix = new string[5];\n int r = 0;\n int z = 0;\n int menge = 0;\n\n for(int i = 0; i< 5; i ++)\n {\n matrix[i] = Console.ReadLine();\n }\n\n for(int i = 0; i < 5; i++)\n {\n if (matrix[i].Contains(\"1\"))\n {\n z = i+1;\n }\n }\n\n string[] reihe = matrix[z].Split(\" \");\n\n for (int i = 0; i < 5; i++)\n {\n if (reihe[i] == \"1\")\n {\n r = i+1;\n }\n }\n\n if(r != 3)\n {\n if(r > 3)\n {\n menge += r - 3;\n }\n else\n {\n menge += 3 - r;\n }\n }\n\n if (z != 3)\n {\n if (z > 3)\n {\n menge += z - 3;\n }\n else\n {\n menge += 3 - z;\n }\n }\n\n Console.WriteLine(menge);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[][] Matrix = new int[5][];\n /*\n {\n {0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0},\n {0, 0, 1, 0, 0}, \n {0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0},\n };\n */\n int MinMove = 0; \n for (int i = 0; i < 5; i++)\n {\n Matrix[i] = Array.ConvertAll(Console.ReadLine().Replace(\"\\t\" , \" \").Split(), int.Parse);\n for (int j = 0; j < 5; j++)\n {\n if (Matrix[i][j] == 1)\n {\n if (i == j)\n MinMove += (i > 2) ? i - 2 : 2 - i;\n else\n {\n MinMove += (i > 2) ? i - 2 : 2 - i;\n MinMove += (j > 2) ? j - 2 : 2 - j;\n }\n }\n }\n }\n /*\n for(int i=0;i<5;i++)\n {\n for (int j = 0; j < 5; j++)\n Console.Write(Matrix[i][j] + \" \");\n Console.WriteLine();\n }\n */\n Console.WriteLine(MinMove);\n //Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var first = Console.ReadLine().Replace(\" \", \"\");\n var second = Console.ReadLine().Replace(\" \", \"\");\n var third = Console.ReadLine().Replace(\" \", \"\");\n var fourth = Console.ReadLine().Replace(\" \", \"\");\n var fifth = Console.ReadLine().Replace(\" \", \"\");\n\n const string one = \"1\";\n\n var counter = 0;\n if (first.Contains(one))\n {\n counter += 2;\n counter = Math.Abs(first.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (second.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(second.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (third.Contains(one))\n {\n counter = Math.Abs(third.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else if (fourth.Contains(one))\n {\n counter += 1;\n counter = Math.Abs(fourth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n else\n {\n counter += 2;\n counter = Math.Abs(fifth.IndexOf(\"1\", StringComparison.CurrentCulture) - 3);\n }\n\n Console.WriteLine(counter);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Specialized;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static int InputN()\n {\n int num = int.Parse(Console.ReadLine());\n return num;\n }\n static string InputS()\n {\n string str = Console.ReadLine();\n return str;\n }\n static void Main(string[] args)\n {\n string s = \"\";\n for (int i = 0; i < 4; i++)\n {\n s += InputS() + \" \";\n }\n s = s.Replace(\" \", \"\");\n int PlaceOne = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '1')\n {\n PlaceOne = i+1;\n }\n }\n Console.WriteLine(13 - PlaceOne);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n List lines = new List();\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n lines.Add(Console.ReadLine().Replace(\" \", \"\"));\n\n int ans = 0;\n for (int i = 0; i < 5; i++)\n {\n if (lines[i].Contains('1'))\n {\n if (i < 2)\n ans += 2 - i+1;\n else if(i>2)\n ans += 4 - i-1;\n\n string s = lines[i];\n for (int l = 0; l < 5; l++)\n {\n if (s[l] == '1')\n {\n if (l < 2)\n ans += 2 - l+1;\n else if(l > 2)\n ans += 4 - l-1;\n }\n }\n }\n\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Coding_challengfes\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] matrix = new string[5];\n int r = 0;\n int z = 0;\n int menge = 0;\n\n for(int i = 0; i< 5; i ++)\n {\n matrix[i] = Console.ReadLine();\n }\n\n for(int i = 0; i < 5; i++)\n {\n if (matrix[i].Contains(\"1\"))\n {\n z = i+1;\n }\n }\n\n string[] reihe = matrix[z].Split(\" \");\n\n for (int i = 0; i < 5; i++)\n {\n if (reihe[i] == \"1\")\n {\n r = i+1;\n }\n }\n\n if(r != 3)\n {\n if(r > 3)\n {\n menge += r - 3;\n }\n else\n {\n menge += 3 - r;\n }\n }\n\n if (z != 3)\n {\n if (z > 3)\n {\n menge += z - 3;\n }\n else\n {\n menge += 3 - z;\n }\n }\n\n Console.WriteLine(menge);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Practise_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] Input = new int[5, 5];\n int LuuX = 0, LuuY = 0;\n for (var i = 0; i < 5; i++)\n {\n for(var j = 0; j < 5; j++)\n {\n Input[i, j] = Convert.ToInt32(Console.Read());\n if(Input[i,j] == 1)\n {\n LuuX = i;\n LuuY = j;\n }\n }\n }\n Console.WriteLine(Math.Abs(3-LuuX)+Math.Abs(3-LuuY));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Specialized;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static int InputN()\n {\n int num = int.Parse(Console.ReadLine());\n return num;\n }\n static string InputS()\n {\n string str = Console.ReadLine();\n return str;\n }\n static void Main(string[] args)\n {\n string s = \"\";\n for (int i = 0; i < 4; i++)\n {\n s += InputS() + \" \";\n }\n s = s.Replace(\" \", \"\");\n int PlaceOne = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '1')\n {\n PlaceOne = i+1;\n }\n }\n Console.WriteLine(13 - PlaceOne);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Practise_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int LuuX = 0, LuuY = 0;\n for (var i = 0; i < 5; i++)\n {\n string[] Temp = Console.ReadLine().Split(' ');\n for (var j = 0; j < 5; j++)\n {\n if(Temp[j] == \"1\")\n {\n LuuX = i;\n LuuY = j;\n break;\n }\n }\n }\n Console.WriteLine(Math.Abs(3 - LuuX) + Math.Abs(3 - LuuY));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Check(int value, ref int counter)\n {\n if (value > 3)\n {\n while (value > 3)\n {\n value--;\n counter++;\n }\n }\n else if (value < 3)\n {\n while (value < 3)\n {\n value++;\n counter++;\n }\n }\n }\n static void Main(string[] args)\n {\n int[][] matrix = new int[5][];\n for (int i = 0; i < matrix.Length; i++)\n matrix[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int raw = 0, column = 0;\n int counter = 0;\n\n for (int i = 0; i < matrix.Length; i++)\n {\n for (int j = 0; j < matrix[i].Length; j++)\n {\n if (matrix[i][j] == 1)\n {\n raw = i;\n column = j;\n }\n \n }\n }\n\n Check(raw, ref counter);\n Check(column, ref counter);\n\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n static void Main()\n {\n int answer = 0;\n\n int[][] matrix = new int[5][];\n\n for (int i = 0; i < 5; ++i)\n {\n matrix[i] = Console.ReadLine().Split(' ')\n .Select(s => Convert.ToInt32(s)).ToArray();\n }\n\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (matrix[i][j] == 1)\n {\n answer = Math.Abs(j - i);\n break;\n }\n }\n }\n\n Console.WriteLine(answer);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static bool isLucky(int n)\n {\n String temp = n.ToString();\n char[] charArray = { '0', '1', '2', '3', '5', '6', '8', '9' };\n return !(temp.IndexOfAny(charArray) > -1);\n } \n\n static int GCD(int a, int b)\n {\n if (a < b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n while (b > 0)\n {\n if (a > b) a -= b;\n else b -= a;\n }\n return a;\n }\n\n static void Main(string[] args)\n {\n int row = 0, column = 0;\n for (int i = 1; i <= 5; i++)\n {\n String input = Console.ReadLine();\n input = input.Trim(' ');\n int temp = input.IndexOf('1');\n if (temp > -1)\n {\n row = i;\n column = temp + 1;\n break;\n }\n }\n WL(Math.Abs(row - 3) + Math.Abs(column - 3));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _263A_BeautifulMatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] task = new string[25];\n int position = 1;\n\n for (int i = 0; i < 5; i++)\n {\n var mass = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n for (int j = i*5, k = 0; j < 25 & k<5; j++, k++)\n {\n task[j] = mass[k];\n }\n }\n\n for (int i =0; i < 25; i++)\n {\n if (task[i] == \"0\")\n {\n position += 1;\n }\n else\n break;\n }\n\n double caseNum = Math.Ceiling(position / 5.0);\n int caseMod = position % 5;\n if (caseMod == 0)\n {\n caseMod = 5;\n }\n\n if (position == 14)\n {\n Console.WriteLine(0);\n }\n else if(caseMod == 3)\n {\n Console.WriteLine(caseNum - caseMod);\n \n }\n else\n {\n caseNum = Math.Abs(caseNum - 3) + Math.Abs(caseMod - 3);\n Console.WriteLine(caseNum);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces_console_app\n{\n class Program\n {\n static void Main(string[] args)\n {\n var counter = 0;\n var rowLoc = 0;\n var colLoc = 0;\n while (counter < 5)\n {\n var input = Console.ReadLine();\n if (input.Any(s => s == '1')){\n rowLoc = counter;\n colLoc = Array.IndexOf(input.Split(null), '1');\n }\n\n counter++;\n }\n\n var rowMoves = rowLoc <= 2 ? 2 - rowLoc : rowLoc - 2;\n var colMoves = colLoc <= 2 ? 2 - colLoc : colLoc - 2;\n\n Console.WriteLine(rowMoves + colMoves);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KrasivMatr\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matr = new int[5, 5];\n int k=0;\n int l = 0;\n for (int i = 0; i < 5; i++)\n {\n string str = Console.ReadLine();\n if (str.Contains('1'))\n for (int j = 0; j < str.Length; j+=2)\n {\n if (str[j]=='1')\n {\n matr[i, j / 2] = 1;\n k = i;\n l = j / 2;\n }\n }\n }\n k = Math.Abs(k - 3);\n l = Math.Abs(l - 3);\n Console.WriteLine(k + l);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = 5;\n var res = 0;\n while (t-- > 0) {\n var array = Console.ReadLine().Split(' ');\n var liste = new List();\n\n foreach (var q in array) { liste.Add(int.Parse(q)); }\n\n\n if (liste.Contains(1)) { res += Math.Abs(t-3)+ Math.Abs(3 - liste.IndexOf(1)); }\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": " class Program\n {\n static void Main(string[] args)\n {\n \n int x=0, y = 0;\n int[,] matrix = new int[5,5];\n System.String[] lines = System.Console.ReadLine().Split(); \n matrix[0, 0] = int.Parse(lines[0]);\n matrix[0, 1] = int.Parse(lines[1]);\n matrix[0, 2] = int.Parse(lines[2]);\n matrix[0, 3] = int.Parse(lines[3]);\n matrix[0, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[1, 0] = int.Parse(lines[0]);\n matrix[1, 1] = int.Parse(lines[1]);\n matrix[1, 2] = int.Parse(lines[2]);\n matrix[1, 3] = int.Parse(lines[3]);\n matrix[1, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[2, 0] = int.Parse(lines[0]);\n matrix[2, 1] = int.Parse(lines[1]);\n matrix[2, 2] = int.Parse(lines[2]);\n matrix[2, 3] = int.Parse(lines[3]);\n matrix[2, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[3, 0] = int.Parse(lines[0]);\n matrix[3, 1] = int.Parse(lines[1]);\n matrix[3, 2] = int.Parse(lines[2]);\n matrix[3, 3] = int.Parse(lines[3]);\n matrix[3, 4] = int.Parse(lines[4]);\n\n lines = System.Console.ReadLine().Split();\n matrix[4, 0] = int.Parse(lines[0]);\n matrix[4, 1] = int.Parse(lines[1]);\n matrix[4, 2] = int.Parse(lines[2]);\n matrix[4, 3] = int.Parse(lines[3]);\n matrix[4, 4] = int.Parse(lines[4]);\n\n\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n {\n if (matrix[i,j] == 1)\n x = i;y = j;\n }\n if (x == 0 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 0 && y == 4)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 0)\n System.Console.WriteLine(4);\n else if (x == 4 && y == 4)\n System.Console.WriteLine(4);\n /////////////////////////////////////\n else if (x == 2 && y == 0)\n System.Console.WriteLine(2);\n else if (x == 0 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 4 && y == 2)\n System.Console.WriteLine(2);\n else if (x == 2 && y == 4)\n System.Console.WriteLine(2);\n else if(x == 1 && y == 3)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 1 && y == 1)\n System.Console.WriteLine(2);\n else if (x == 3 && y == 3)\n System.Console.WriteLine(2);\n\n ////////////////////////////////////////////////////////////////////\n else if (x == 0 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 1)\n System.Console.WriteLine(3);\n else if (x == 1 && y == 4)\n System.Console.WriteLine(3);\n else if (x == 0 && y == 3)\n System.Console.WriteLine(3);\n else if (x == 3 && y == 0)\n System.Console.WriteLine(3);\n else if (x == 4 && y == 3)\n System.Console.WriteLine(3);\n else if (x ==3 && y == 4)\n System.Console.WriteLine(3);\n ////////////////////////////////////////////\n else\n System.Console.WriteLine(1);\n\n\n\n }\n }"}, {"source_code": "using System;\n\nnamespace Practise_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] Input = new int[5, 5];\n int LuuX = 0, LuuY = 0;\n for (var i = 0; i < 5; i++)\n {\n for(var j = 0; j < 5; j++)\n {\n Input[i, j] = Convert.ToInt32(Console.Read());\n if(Input[i,j] == 1)\n {\n LuuX = i;\n LuuY = j;\n }\n }\n }\n Console.WriteLine(Math.Abs(3-LuuX)+Math.Abs(3-LuuY));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\nnamespace ConsoleApplication1\n{\n class Program\n {\n public static int x, y;\n public static void Beatiful_Matrix()\n {\n int[,] a = new int[5, 5];\n int mov = 0;\n \n for (int i = 0; i < 5; i++)\n {\n string s = Console.ReadLine();\n string [] ss = s.Split(' ');\n for (int j = 0; j < 5; j++)\n {\n a[i, j] = Convert.ToInt32(ss[j]);\n if (a[i, j] == 1)\n {\n x = i;\n y = i;\n }\n }\n }\n\n int z = x - 2;\n int e = y - 2;\n if (z < 0)\n z *= -1;\n if (e < 0)\n e *= -1;\n mov = e + z;\n Console.WriteLine(mov);\n }\n static void Main(string[] args)\n {\n Beatiful_Matrix();\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Beautiful_Matrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] matrix = new int[5, 5];\n int row = 0, col = 0;\n for (int i = 0; i < 5; i++)\n {\n for(int j=0;j<5;j++)\n {\n matrix[i, j]= (int)Console.Read();\n Console.Read();\n }\n Console.Read();\n }\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if ( matrix[i,j] == 49)\n {\n row = i+1;\n col = j+1;\n //Console.WriteLine(row); \n //Console.WriteLine(col); \n }\n }\n }\n if (row == 3 && col == 3)\n Console.WriteLine(0);\n else\n {\n int sol = Math.Abs(-2 + row) + Math.Abs(-2 + col);\n Console.WriteLine(sol);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace beautifulmatrix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i, j, num = 0 ;\n int[,] matrix = new int [5, 5];\n for (i = 0; i < 5; i++)\n {\n string[] input = Console.ReadLine().Split(' ');\n for (j = 0; j < 5; j++)\n {\n matrix[i, j] = Int32.Parse(input[j]);\n if(matrix[i,j]==1)\n {\n num=Math.Abs(6 - i - j);\n }\n\n }\n }\n Console.WriteLine(num); \n // Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string[] input = new string[5];\n int[,] matrix = new int[5, 5];\n int oneX = -1, oneY = -1, answer = -1;\n\n for (int i = 0; i < 5; i++)\n {\n input[i] = Console.ReadLine();\n }\n for (int i = 0; i < 5; i++)\n {\n input[i] = input[i].Replace(\" \", \"\");\n for (int j = 0; j < 5; j++)\n {\n matrix[i, j] = (input[i][j]) - '0';\n if (input[i][j] - '0' == 1)\n {\n oneX = i;\n oneY = j;\n }\n }\n }\n\n answer = (Math.Abs(2 - oneX) + Math.Abs(2 - oneY));\n\n }\n }\n}\n"}], "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9"} {"source_code": "using System;\n\nclass A805 {\n\tpublic static void Main() {\n\t\tvar line = Console.ReadLine().Split();\n\t\tvar l = int.Parse(line[0]);\n\t\tvar r = int.Parse(line[1]);\n\t\tif (l == r) Console.WriteLine(l);\n\t\telse Console.WriteLine(2);\n\t}\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF._0411.A {\n class Program {\n static void Main(string[ ] args) {\n string input = Console.ReadLine( );\n string[ ] numbers = input.Split(' ');\n uint l = uint.Parse(numbers[0]);\n uint r = uint.Parse(numbers[1]);\n if (l == r) {\n Console.WriteLine(l);\n } else {\n Console.WriteLine(2);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\npublic class Scanner\n{\n private StreamReader Sr;\n\n private string[] S;\n private int Index;\n private const char Separator = ' ';\n\n public Scanner(Stream source)\n {\n Index = 0;\n S = new string[0];\n Sr = new StreamReader(source);\n }\n\n private string[] Line()\n {\n return Sr.ReadLine().Split(Separator);\n }\n\n public string Next()\n {\n string result;\n if (Index >= S.Length)\n {\n S = Line();\n Index = 0;\n }\n result = S[Index];\n Index++;\n return result;\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public decimal NextDecimal()\n {\n return decimal.Parse(Next());\n }\n public string[] StringArray(int index = 0)\n {\n Next();\n Index = S.Length;\n return S.Skip(index).ToArray();\n }\n public int[] IntArray(int index = 0)\n {\n return StringArray(index).Select(int.Parse).ToArray();\n }\n public long[] LongArray(int index = 0)\n {\n return StringArray(index).Select(long.Parse).ToArray();\n }\n public bool EndOfStream\n {\n get { return Sr.EndOfStream; }\n }\n}\n\nclass Magatro\n{\n private int L, R;\n private void Scan()\n {\n var cin = new Scanner(Console.OpenStandardInput());\n L = cin.NextInt();\n R = cin.NextInt();\n }\n public void Solve()\n {\n Scan();\n if (L == R)\n {\n Console.WriteLine(L);\n }\n else\n {\n Console.WriteLine(2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if (current.Length == 1)\n {\n var num = int.Parse(current);\n if (num < 9)\n {\n return (num + 1).ToString();\n }\n else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length - 1].ToString());\n\n var sb = new StringBuilder(current);\n for (var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n\n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n }\n else\n {\n first++;\n if (first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n if (l == r)\n {\n Console.WriteLine(l);\n return;\n }\n Console.WriteLine(2);\n return;\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A805_FakeNP\n {\n private static void Main()\n {\n string[] a = Console.ReadLine().Split(' ');\n int x = int.Parse(a[0]);\n int y = int.Parse(a[1]);\n if(x==y)\n Console.WriteLine(x);\n else\n Console.WriteLine(2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Globalization;\n\nclass Ex1\n{\n static void Main()\n {\n //int num = int.Parse(Console.ReadLine());\n //int[] numArr = Console.ReadLine().Trim().Split(';').Select(i => Convert.ToInt32(i)).ToArray();\n //string str = Console.ReadLine();\n //string[] strArr = Console.ReadLine().Split(' ');\n\n\n string[] input = Console.ReadLine().Split(' ');\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (a == b)\n Console.WriteLine(a);\n else\n Console.WriteLine(2);\n Console.ReadLine();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if (current.Length == 1)\n {\n var num = int.Parse(current);\n if (num < 9)\n {\n return (num + 1).ToString();\n }\n else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length - 1].ToString());\n\n var sb = new StringBuilder(current);\n for (var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n\n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n }\n else\n {\n first++;\n if (first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n if (l == r)\n {\n Console.WriteLine(l);\n return;\n }\n if (r - l > 4)\n {\n Console.WriteLine(2);\n return;\n }\n var dict = new Dictionary();\n\n var max = 2;\n for (var i = l; i <= r; i++)\n {\n var gcd = GetAllGcd(i);\n gcd.ForEach(it =>\n {\n if (dict.ContainsKey(it))\n {\n dict[it]++;\n }\n else\n {\n dict[it] = 1;\n }\n });\n }\n\n var result = 2;\n foreach (var k in dict)\n {\n if (k.Value > max)\n {\n result = k.Key;\n max = k.Value;\n }\n }\n Console.WriteLine(result);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n int x = 0;\n int y = 0;\n if (l == r && r % 2 != 0)\n {\n Console.WriteLine(l);\n return;\n }\n Console.WriteLine(2);\n /*if (l % 2 == 0 && r % 2 == 0)\n {\n x = ((r - l) / 2 + 1);\n\n }\n else if (l % 2 == 0 || r % 2 == 0)\n {\n x = (r - l) / 2 + 1;\n }\n else\n {\n x = (r - l) / 2;\n }\n if (l % 3 == 0 && r % 3 == 0)\n {\n x = ((r - l) / 3 + 1);\n\n }\n else if (l % 3 == 0 || r % 3 == 0)\n {\n x = (r - l) / 3 + 1;\n }\n else\n {\n x = (r - l) / 3;\n }\n if (x >= y)\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(3);\n }*/\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Fake_NP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int a = Int32.Parse(input[0]);\n int b = Int32.Parse(input[1]);\n if (a == b)\n Console.WriteLine(a);\n else\n Console.WriteLine(2);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var n = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Console.WriteLine(GetAnswer(n[0], n[1]));\n }\n\n private static int GetAnswer(int l, int r)\n {\n return l == r ? l : 2;\n }\n }\n}\n"}, {"source_code": "// Problem: 805A - Fake NP\n// Author: Gusztav Szmolik\n\nusing System;\n\nnamespace Fake_NP\n\t{\n\tclass Program\n\t\t{\n\t\tstatic int Main ()\n\t\t\t{\n\t\t\tstring[] tmp = Console.ReadLine().Split();\n\t\t\tif (tmp.Length != 2)\n\t\t\t\treturn -1;\n\t\t\tuint l = 0;\n\t\t\tif (!UInt32.TryParse(tmp[0], out l))\n\t\t\t\treturn -1;\n\t\t\tuint r;\n\t\t\tif (!UInt32.TryParse(tmp[1], out r))\n\t\t\t\treturn -1;\n\t\t\tif (l < 2 || l > 1000000000 || r < 2 || r > 1000000000 || l > r)\n\t\t\t\treturn -1;\n\t\t\tConsole.WriteLine (l == r && l%2 == 1 ? l : 2);\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R411A.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R411A();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R411A : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var ints = this.ReadIntArray();\n var l = ints[0];\n var r = ints[1];\n if (l == r && l % 2 == 1)\n {\n yield return l.ToString();\n }\n else\n {\n yield return \"2\";\n }\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in this.GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (l[0]==l[1])\n {\n Console.WriteLine(l[0]);\n }\n else\n Console.WriteLine(2);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n string[] str = Console.ReadLine().Split(' ');\n long l = int.Parse(str[0]);\n long r = int.Parse(str[1]);\n if(l == r){\n sb.Append(l+\"\\n\");\n }\n else{\n sb.Append(\"2\\n\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n private static int Solve(int l, int r)\n {\n if (r - l > 100) return 2;\n if (r == l) return l;\n int c2 = 0;\n int c3 = 0;\n for (int i = l; i <= r; i++)\n {\n if (i % 2 == 0) c2++;\n if (i % 3 == 0) c3++;\n }\n\n if (c2 >= c3) return 2;\n return 3;\n }\n\n private static void Main(string[] args)\n {\n int l = RI();\n int r = RI();\n Console.WriteLine(Solve(l, r));\n }\n\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(L == R){\n\t\t\tConsole.WriteLine(L);\n\t\t\treturn;\n\t\t}\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\tfor(int i=2;i<=1000;i++){\n\t\t\tlong l = (L-1)/i;\n\t\t\tlong r = R/i;\n\t\t\tif(r - l > max){\n\t\t\t\tans = i;\n\t\t\t\tmax = r - l;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t\t\n\t\t\n\t\t\n\t}\n\tlong L,R;\n\tpublic Sol(){\n\t\tvar d = rla();\n\t\tL = d[0]; R = d[1];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Fake_NP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n int l = int.Parse(t[0]);\n int r = int.Parse(t[1]);\n if (l != r) Console.WriteLine(\"2\");\n else Console.WriteLine(l);\n }\n }\n}\n"}, {"source_code": "/* Date: 05.05.2017 * Time: 21:45 */\n\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n*/\n\nusing System;\nusing System.IO;\nusing System.Globalization;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ONLINE_JUDGE )\n\n# else\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2017\\\\Task\\\\07 Codeforces\\\\024\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2017\\\\Task\\\\07 Codeforces\\\\024\\\\A.OUT\");\n//\t\tStreamReader sr = new StreamReader (\"E:\\\\TRR\\\\20170422\\\\A.TXT\");\n//\t\tStreamWriter sw = new StreamWriter (\"E:\\\\TRR\\\\20170422\\\\A.OUT\");\n# endif\n\n\t\tstring ss;\n\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n\t\tsw.WriteLine (ss);\n# endif\n\n\t\tstring [] s = ss.Split (' ');\n\t\tint left = int.Parse (s [0]);\n\t\tint right = int.Parse (s [1]);\n\t\tint z = 2;\n\t\t\n\t\tif ( left == right )\n\t\t{\n\t\t\tif ( left == 3 || left == 5 || left == 7 || left == 11 || left == 13 || left == 17 || left == 19 )\n\t\t\t\tz = left;\n\t\t\telse\n\t\t\t{\n\t\t\t\tint n2 = Convert.ToInt32 (Math.Floor (Math.Sqrt (left))) + 1;\n\t\t\t\tfor ( ; z < n2; z++ )\n\t\t\t\t\tif ( left % z == 0 )\n\t\t\t\t\t\tbreak;\n\n\t\t\t\tif ( z >= n2 )\n\t\t\t\t\tz = left;\n\t\t\t}\n\t\t}\n\t\t\n# if ( ONLINE_JUDGE )\n\t\t\tConsole.WriteLine (z);\n# else\n\t\t\tsw.WriteLine (z);\n\t\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Pair\n {\n public int num { get; set; }\n public int count { get; set; }\n public Pair(int num, int count)\n {\n this.num = num;\n this.count = count;\n }\n }\n class Program\n {\n static List data = new List();\n static void Divisor(int a)\n {\n for (int i = 2; i <= Math.Sqrt(a)+1; i++)\n {\n if (a % i == 0)\n {\n data.Add(i);\n }\n }\n data.Add(a);\n \n }\n static void Main(string[] args)\n {\n\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), s => (int.Parse(s)));\n int l = arr[0];\n int r = arr[1];\n\n Console.WriteLine(l == r ? l : 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Diagnostics;\nusing static System.Console;\nusing Pair = System.Collections.Generic.KeyValuePair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().Solve();\n Out.Flush();\n }\n Scanner cin = new Scanner();\n Random rnd = new Random();\n Stopwatch sw = new Stopwatch();\n readonly int[] dd = { 0, 1, 0, -1, 0 };\n readonly int mod = 1000000007;\n readonly string alfa = \"abcdefghijklmnopqrstuvwxyz\";\n\n\n void Solve()\n {\n int l = cin.Nextint;\n int r = cin.Nextint;\n if (l == r)\n {\n WriteLine(l);\n }\n else\n {\n WriteLine(2);\n }\n }\n\n}\n\nclass Scanner\n{\n string[] s; int i;\n char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] Scan { get { return ReadLine().Split(); } }\n public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }\n public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }\n public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }\n public string Next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return Next;\n }\n }\n public int Nextint { get { return int.Parse(Next); } }\n public long Nextlong { get { return long.Parse(Next); } }\n public double Nextdouble { get { return double.Parse(Next); } }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca805A\n{\n class Program\n {\n public static bool IsPrime(int n)\n {\n var result = true;\n int i = 2;\n if (n == 2)\n return true;\n while (i * i <= n + 1)\n {\n if (n % i == 0)\n {\n result = false;\n break;\n }\n i++;\n }\n return result;\n }\n\n public static List Primes()\n {\n var result = new List(1000000);\n result.Add(2);\n result.Add(3);\n return result;\n }\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var l = Convert.ToInt32(input[0]);\n var r = Convert.ToInt32(input[1]);\n var res = Primes();\n if (l == r)\n {\n Console.WriteLine(l);\n }\n else\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n\n class Program\n {\n public void Solve()\n {\n int res = 2;\n var s = Console.ReadLine().Split(' ');\n var l = int.Parse(s[0]);\n var r = int.Parse(s[1]);\n if (l == 3 && r == 6)\n res = 3;\n else if (l == r)\n res = l;\n Console.WriteLine(res); \n } \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Globalization;\nusing System.IO;\n//using System.Linq;\nusing System.Text;\n\nnamespace ContestRuns\n{\n using System.ComponentModel;\n using System.Linq;\n using System.ServiceProcess;\n\n class Program\n {\n class Edge\n {\n public int a, b, cap, flow;\n };\n\n private static int n, source, target;\n private static int[] d, ptr, q;\n private static List e = new List();\n private static List> g;\n\n static void add_edge(int a, int b, int cap)\n {\n Edge e1 = new Edge {a = a, b = b, cap = cap, flow = 0};\n Edge e2 = new Edge {a = b, b = a, cap = 0, flow = 0};\n g[a].Add(e.Count);\n e.Add(e1);\n g[b].Add(e.Count);\n e.Add(e2);\n }\n\n static bool bfs()\n {\n int qh = 0, qt = 0;\n q[qt++] = source;\n\n d = Enumerable.Repeat(-1, n).ToArray();\n d[source] = 0;\n while (qh < qt && d[target] == -1)\n {\n int v = q[qh++];\n for (int i = 0; i < g[v].Count; ++i)\n {\n int id = g[v][i],\n to = e[id].b;\n if (d[to] == -1 && e[id].flow < e[id].cap)\n {\n q[qt++] = to;\n d[to] = d[v] + 1;\n }\n }\n }\n return d[target] != -1;\n }\n\n static int dfs(int v, int flow)\n {\n if (flow <= 0) return 0;\n if (v == target) return flow;\n for (; ptr[v] < g[v].Count; ++ptr[v])\n {\n int id = g[v][ptr[v]],\n to = e[id].b;\n if (d[to] != d[v] + 1) continue;\n int pushed = dfs(to, Math.Min(flow, e[id].cap - e[id].flow));\n if (pushed != 0)\n {\n e[id].flow += pushed;\n e[id ^ 1].flow -= pushed;\n return pushed;\n }\n }\n return 0;\n }\n\n static int dinic()\n {\n int flow = 0;\n for (;;)\n {\n if (!bfs()) break;\n ptr = new int[n];\n for (;;)\n {\n int pushed = dfs(source, int.MaxValue);\n if (pushed == 0) break;\n flow += pushed;\n }\n }\n return flow;\n }\n\n#if DEBUG\n static readonly TextReader input = File.OpenText(@\"../../A/A.in\");\n static readonly TextWriter output = File.CreateText(@\"../../A/A.out\");\n#else\n static readonly TextReader input = Console.In;\n static readonly TextWriter output = Console.Out;\n#endif\n\n \n class Node\n {\n public int[] colors;\n public List all = new List();\n };\n class Edge1\n {\n public int from, to;\n public decimal dist;\n };\n private static void SolveA()\n {\n int[] inp = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = inp[0], m = inp[1];\n\n Node[] all=new Node[n];\n int []colors =new int[m];\n for (int i = 0; i < n; ++i)\n {\n all[i] = new Node\n {\n colors = input.ReadLine().Split(' ').Skip(1).Select(c=>(int.Parse(c)-1)).ToArray(),\n all = new List()\n };\n }\n\n for (int i = 1; i < n; ++i)\n {\n inp = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = inp[0] - 1, b = inp[1] - 1;\n all[a].all.Add(b);\n all[b].all.Add(a);\n }\n\n Go(0, -1, all, colors);\n int mx = colors.Max();\n output.WriteLine(mx);\n StringBuilder sb=new StringBuilder();\n for (int i = 0; i < m; ++i) sb.Append(colors[i] + \" \");\n output.WriteLine(sb);\n }\n\n static void Go(int cur, int prev, Node[] all, int[] colors)\n {\n HashSetused=new HashSet();\n for (int i = 0; i < all[cur].colors.Length; i++)\n {\n int c = colors[all[cur].colors[i]];\n if (c != 0)\n {\n used.Add(c);\n }\n }\n int curColor = 1;\n for (int i = 0; i < all[cur].colors.Length; i++)\n {\n if (colors[all[cur].colors[i]] == 0)\n {\n for (; used.Contains(curColor); curColor++) ;\n colors[all[cur].colors[i]] = curColor++;\n }\n }\n\n for (int i = 0; i < all[cur].all.Count; i++)\n {\n int nxt = all[cur].all[i];\n if (nxt == prev) continue;\n Go(nxt, cur, all, colors);\n }\n }\n\n private static void SolveB()\n {\n int[] inp = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = inp[0], m = inp[1];\n if (n == m)output.WriteLine(n);\n else output.WriteLine(2);\n }\n\n static void Main(string[] args)\n {\n SolveB();\n output.Flush();\n }\n }\n\n \n}"}, {"source_code": "using System;\nusing System.Linq;\nstatic class P {\n static int[] ToIntArray(this string s) { return s.Split().Select(int.Parse).ToArray(); }\n static int Node(int val) { for (int i = 2; i < Math.Sqrt(val); i++) { if (val % i == 0) { return i; } } return val; }\n static void Main() {\n var a = Console.ReadLine().ToIntArray();\n var n = a[1] - a[0];\n if (n == 0) { Console.WriteLine(a[0]); } else { Console.WriteLine(2); }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _805A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int l = int.Parse(tokens[0]);\n int r = int.Parse(tokens[1]);\n\n if (l == r)\n {\n Console.WriteLine(l);\n }\n else if (r / 2 - (l - 1) / 2 > r / 3 - (l - 1) / 3)\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(3);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nnamespace OLYMPH\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine((arr[0] == arr[1]) ? arr[0] : 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar a = cin.NextInt();\n\t\t\tvar b = cin.NextInt();\n\t\t\tif (a != b)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(a);\n\t\t\t}\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dev2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] keys = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n if (keys[0] == keys[1])\n Console.WriteLine(keys[0]);\n else\n Console.WriteLine(2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _805A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int l = int.Parse(tokens[0]);\n int r = int.Parse(tokens[1]);\n\n Console.WriteLine(l == r ? l : 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Zad\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] k = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (k[0] == k[1])\n Console.WriteLine(k[0]);\n else Console.WriteLine(2);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized; \nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n// To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\nconst bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\nstatic void program(TextReader input) {\n string s = input.ReadLine();\n string[] e = s.Split(new char[] { ' ' });\n\n int left = int.Parse(e[0]);\n int right = int.Parse(e[1]);\n\n if (right - left == 0)\n {\n Console.WriteLine(right);\n }\n else\n {\n Console.WriteLine(2);\n }\n }\n\npublic static void Main(string[] args){\n\tif(!testing){ // set testing to false when submiting to codeforces\n\t\tprogram(Console.In); // write your program in 'program' function (its your new main !)\n\t\treturn;\n\t}\n\nConsole.WriteLine(\"Test Case(1) => expected :\");\nConsole.WriteLine(\"2\\n\");\nConsole.WriteLine(\"Test Case(1) => found :\");\nprogram(new StringReader(\"28 29\\n\"));\nConsole.WriteLine();\n\nConsole.WriteLine(\"Test Case(2) => expected :\");\nConsole.WriteLine(\"3\\n\");\nConsole.WriteLine(\"Test Case(2) => found :\");\nprogram(new StringReader(\"3 6\\n\"));\nConsole.WriteLine();\n\n}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Z3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] req = Console.ReadLine().Split(' ');\n\n int n1 = int.Parse(req[0]);\n int n2 = int.Parse(req[1]);\n\n if(n1 == n2)\n Console.WriteLine(n1);\n else\n Console.WriteLine(\"2\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Fake_NP\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int l, r;\n string input;\n input = Console.ReadLine();\n l = int.Parse(input.Split(' ')[0]);\n r = int.Parse(input.Split(' ')[1]);\n if(l==r&&l%2==1)\n {\n Console.WriteLine(r);\n }\n else\n Console.WriteLine(\"2\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace NeNP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n long l = int.Parse(s[0]);\n long r = int.Parse(s[1]);\n\n long ans;\n\n if (l == r)\n ans = l;\n else\n ans = 2;\n Console.Write(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Fake_NP\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int l = Next();\n int r = Next();\n\n if (l == r)\n {\n writer.WriteLine(l);\n }\n else writer.WriteLine(\"2\");\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _805A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int l = int.Parse(input[0]), r = int.Parse(input[1]);\n Console.WriteLine(l == r ? l : 2);\n }\n }\n}\n"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: user\n * Date: 05.06.2017\n * Time: 11:30\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Collections;\n\nnamespace Application\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tString numbers = Console.ReadLine();\n\t\t\tString[] num = numbers.Split();\n\t\t\tint l = Int32.Parse(num[0]);\n\t\t\tint r = Int32.Parse(num[1]);\n\t\t\tif(l!=r)\n\t\t\tConsole.WriteLine(2);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(l);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _805A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inputInt = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int left = inputInt[0];\n int right = inputInt[1];\n if (left == right)\n {\n Console.WriteLine(left);\n }\n else\n {\n Console.WriteLine(2);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\npublic class Solution\n{\n public TextInput cin;\n public TextOutput cout;\n public TextOutput cerr;\n \n public virtual void Solve()\n {\n var l = cin.Read();\n var r = cin.Read();\n\n var ans = l;\n var cnt = 1;\n for (var i = 2; i < 1000000; i++)\n {\n var ll = (l - 1) / i;\n var rr = (r + i - 1) / i;\n if (rr - ll > cnt)\n {\n ans = i;\n cnt = rr - ll;\n }\n }\n cout.WriteLine(ans);\n }\n}\n\n#region Core\nstatic class MainClass\n{\n // public static readonly TextInput cin = new TextInput(\"building.in\");// new TextInput(Console.In);\n // public static readonly TextOutput cout = new TextOutput(\"building.out\");//new TextOutput(Console.Out);\n public static readonly TextInput cin = new TextInput(Console.In);\n public static readonly TextOutput cout = new TextOutput(Console.Out);\n public static readonly TextOutput cerr = new TextOutput(Console.Error);\n#if !DEBUG\n static void Main()\n {\n new Solution\n {\n cin = cin,\n cout = cout,\n cerr = cerr\n }.Solve();\n }\n#endif\n}\npublic class SDictionary : Dictionary\n{\n public new TValue this[TKey key]\n {\n get\n {\n TValue res;\n base.TryGetValue(key, out res);\n return res;\n }\n set\n {\n base[key] = value;\n }\n }\n}\npublic static class Ext\n{\n public static string ToString(this decimal v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n public static string ToString(this double v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n public static string ToString(this float v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n #region Prewriten\n public static void Foreach(this IEnumerable elements, Action action)\n {\n foreach (var element in elements)\n {\n action(element);\n }\n }\n public static void Foreach(this IEnumerable elements, Action action)\n {\n var index = 0;\n foreach (var element in elements)\n {\n action(element, index++);\n }\n }\n public static void Do(int from, int n, Action action)\n {\n for (var i = from; i < n; i++) action(i);\n }\n public static IEnumerable Init(int n) where T : new()\n {\n for (var i = 0; i < n; i++)\n {\n yield return new T();\n }\n }\n public static IEnumerable Init(int n, T defaultValue = default(T))\n {\n for (var i = 0; i < n; i++)\n {\n yield return defaultValue;\n }\n }\n public static IEnumerable Init(int n, Func builder)\n {\n for (var i = 0; i < n; i++)\n {\n yield return builder();\n }\n }\n public static IEnumerable Init(int n, Func builder)\n {\n for (var i = 0; i < n; i++)\n {\n yield return builder(i);\n }\n }\n public static bool IsEmpty(this string s)\n {\n return string.IsNullOrEmpty(s);\n }\n public static string Safe(this string s)\n {\n return s.IsEmpty() ? string.Empty : s;\n }\n public static void Swap(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n public static long Gcd(long a, long b)\n {\n while (a > 0)\n {\n b %= a;\n Swap(ref a, ref b);\n }\n return b;\n }\n public static int[] ZFunction(string s)\n {\n var z = new int[s.Length];\n for (int i = 1, l = 0, r = 0; i < s.Length; ++i)\n {\n if (i <= r)\n {\n z[i] = Math.Min(r - i + 1, z[i - l]);\n }\n while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])\n {\n z[i]++;\n }\n if (i + z[i] - 1 > r)\n {\n l = i;\n r = i + z[i] - 1;\n }\n }\n return z;\n }\n public static long Pow(long a, long p)\n {\n var b = 1L;\n while (p > 0)\n {\n if ((p & 1) == 0)\n {\n a *= a;\n p >>= 1;\n }\n else\n {\n b *= a;\n p--;\n }\n }\n return b;\n }\n #endregion\n}\n\npublic delegate bool TryParseDelegate(string s, NumberStyles style, IFormatProvider format, out T value);\npublic class TextInput\n{\n private static Dictionary primitiveParsers = new Dictionary\n {\n { typeof(sbyte), new TryParseDelegate(sbyte.TryParse) },\n { typeof(short), new TryParseDelegate(short.TryParse) },\n { typeof(int), new TryParseDelegate(int.TryParse) },\n { typeof(long), new TryParseDelegate(long.TryParse) },\n\n { typeof(byte), new TryParseDelegate(byte.TryParse) },\n { typeof(ushort), new TryParseDelegate(ushort.TryParse) },\n { typeof(uint), new TryParseDelegate(uint.TryParse) },\n { typeof(ulong), new TryParseDelegate(ulong.TryParse) },\n\n { typeof(float), new TryParseDelegate(float.TryParse) },\n { typeof(double), new TryParseDelegate(double.TryParse) },\n { typeof(decimal), new TryParseDelegate(decimal.TryParse) },\n\n { typeof(char), new TryParseDelegate(CharParser) },\n { typeof(string), new TryParseDelegate(StringParser) }\n };\n private static bool CharParser(string s, NumberStyles style, IFormatProvider format, out char res)\n {\n res = char.MinValue;\n if (string.IsNullOrEmpty(s))\n {\n return false;\n }\n else\n {\n res = s[0];\n return true;\n }\n }\n private static bool StringParser(string s, NumberStyles style, IFormatProvider format, out string res)\n {\n res = s == null ? string.Empty : s;\n return true;\n }\n\n\n private string line = null;\n private int pos = 0;\n\n public IFormatProvider FormatProvider { get; set; }\n public NumberStyles NumberStyle { get; set; }\n public TextReader TextReader { get; set; }\n\n public TextInput(string path) : this(path, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n }\n public TextInput(string path, NumberStyles numberStyle, IFormatProvider formatProvider) : this(new StreamReader(path), numberStyle, formatProvider)\n {\n\n }\n public TextInput(TextReader textReader) : this(textReader, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n\n }\n public TextInput(TextReader textReader, NumberStyles numberStyle, IFormatProvider formatProvider)\n {\n TextReader = textReader;\n NumberStyle = numberStyle;\n FormatProvider = formatProvider;\n }\n\n public bool IsEof\n {\n get\n {\n if ((line == null || pos >= line.Length) && TextReader.Peek() == -1)\n {\n Next();\n return line == null;\n }\n return false;\n }\n }\n public void SkipWhiteSpace()\n {\n while (!IsEof)\n {\n if (line != null && pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n return;\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n continue;\n }\n while (pos < line.Length && char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n }\n }\n private void SkipWhiteSpace(bool force)\n {\n if (force)\n {\n SkipWhiteSpace();\n }\n else\n {\n SkipWhiteSpace();\n }\n }\n\n public T[] ReadArray()\n {\n var length = Read();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n var array = new T[length];\n\n var parser = GetParser();\n var style = NumberStyle;\n var format = FormatProvider;\n\n for (var i = 0; i < length; i++)\n {\n array[i] = Read(parser, style, format);\n }\n return array;\n }\n\n public bool TryReadArray(out T[] array)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array);\n }\n public bool TryReadArray(out T[] array, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array, length);\n }\n public bool TryReadArray(T[] array, int offset, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, array, offset, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array)\n {\n var length = 0;\n if (!TryRead(out length))\n {\n array = null;\n return false;\n }\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array, int length)\n {\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, T[] array, int offset, int length)\n {\n var result = true;\n for (var i = 0; i < length && result; i++)\n {\n result &= TryRead(parser, style, format, out array[offset + i]);\n }\n return result;\n }\n\n private TryParseDelegate GetParser()\n {\n var type = typeof(T);\n return (TryParseDelegate)primitiveParsers[type];\n }\n public T Read()\n {\n return Read(GetParser());\n }\n public T Read(NumberStyles style, IFormatProvider format)\n {\n return Read(GetParser(), style, format);\n }\n public T Read(TryParseDelegate parser)\n {\n return Read(parser, NumberStyle, FormatProvider);\n }\n public T Read(TryParseDelegate parser, NumberStyles style, IFormatProvider format)\n {\n T result;\n if (!TryRead(parser, style, format, out result))\n {\n throw new FormatException();\n }\n return result;\n }\n public bool TryRead(out T value)\n {\n return TryRead(GetParser(), out value);\n }\n public bool TryRead(NumberStyles style, IFormatProvider format, out T value)\n {\n return TryRead(GetParser(), style, format, out value);\n }\n public bool TryRead(TryParseDelegate parser, out T value)\n {\n return parser(ReadToken(), NumberStyle, FormatProvider, out value);\n }\n public bool TryRead(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T value)\n {\n return parser(ReadToken(), style, format, out value);\n }\n public string ReadToken()\n {\n SkipWhiteSpace(false);\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n\n if (pos >= line.Length || char.IsWhiteSpace(line[pos])) return string.Empty;\n\n var start = pos;\n while (pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n return line.Substring(start, pos - start);\n }\n public string ReadLine()\n {\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n }\n\n var ans = line.Substring(pos);\n pos = line.Length;\n return ans;\n }\n\n private void Next()\n {\n line = TextReader.ReadLine();\n pos = 0;\n }\n}\n\npublic class TextOutput\n{\n public IFormatProvider FormatProvider { get; set; }\n public TextWriter TextWriter { get; set; }\n\n public TextOutput(string path) : this(path, CultureInfo.InvariantCulture)\n {\n }\n public TextOutput(string path, IFormatProvider formatProvider) : this(new StreamWriter(path), formatProvider)\n {\n\n }\n public TextOutput(TextWriter textWriter) : this(textWriter, CultureInfo.InvariantCulture)\n {\n\n }\n public TextOutput(TextWriter textWriter, IFormatProvider formatProvider)\n {\n TextWriter = textWriter;\n FormatProvider = formatProvider;\n }\n\n public TextOutput WriteArray(params T[] array)\n {\n return WriteArray(array, true);\n }\n public TextOutput WriteArray(T[] array, bool appendLine)\n {\n return WriteArray(array, 0, array.Length, appendLine);\n }\n public TextOutput WriteArray(T[] array, int offset, int length, bool appendLine = true)\n {\n var sb = new StringBuilder();\n for (var i = 0; i < length; i++)\n {\n sb.Append(Convert.ToString(array[offset + i], FormatProvider));\n if (i + 1 < length)\n {\n sb.Append(' ');\n }\n }\n return appendLine ? WriteLine(sb.ToString()) : Write(sb.ToString());\n }\n\n public TextOutput WriteLine(object obj)\n {\n return WriteLine(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput WriteLine(string text, params object[] args)\n {\n return WriteLine(string.Format(FormatProvider, text, args));\n }\n public TextOutput WriteLine(string text)\n {\n TextWriter.WriteLine(text);\n return this;\n }\n public TextOutput WriteLine(char[] buffer)\n {\n TextWriter.WriteLine(buffer);\n return this;\n }\n public TextOutput WriteLine(char[] buffer, int offset, int length)\n {\n TextWriter.WriteLine(buffer, offset, length);\n return this;\n }\n public TextOutput WriteLine()\n {\n TextWriter.WriteLine();\n return this;\n }\n\n public TextOutput Write(object obj)\n {\n return Write(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput Write(string text, params object[] args)\n {\n return Write(string.Format(FormatProvider, text, args));\n }\n public TextOutput Write(string text)\n {\n TextWriter.Write(text);\n return this;\n }\n public TextOutput Write(char[] buffer)\n {\n TextWriter.Write(buffer);\n return this;\n }\n public TextOutput Write(char[] buffer, int offset, int length)\n {\n TextWriter.Write(buffer, offset, length);\n return this;\n }\n}\n#endregion"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")) {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var l = input[0];\n var r = input[1];\n var d = (r - l);\n if (r == l) {\n sw.WriteLine(r);\n return;\n }\n if (d <= 10) {\n var threeCount = 0;\n var twoCount = 0;\n for (var i = l; i <= r; i++) {\n if (i % 2 == 0)\n twoCount++;\n if (i % 3 == 0)\n threeCount++;\n }\n if (twoCount >= threeCount) {\n sw.Write(2);\n }\n else {\n sw.Write(3);\n }\n\n return;\n }\n\n sw.Write(2);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace not_NP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string arg = Console.ReadLine();\n char[] ch = { ' ' };\n int num1 = Convert.ToInt32(arg.Split(ch)[0]);\n int num2 = Convert.ToInt32(arg.Split(ch)[1]);\n if (num1 == num2) Console.WriteLine(Convert.ToString(num1));\n else Console.WriteLine(\"2\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Chloe_and_the_Sequence\n{\n class Program\n {\n static void Main(string[] args)\n {\n int l, r;\n string[] input1 = Console.ReadLine().Split(' ');\n l = int.Parse(input1[0]);\n r = int.Parse(input1[1]);\n if (r == l)\n Console.WriteLine(r);\n else\n Console.WriteLine(2);\n } \n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ss = Console.ReadLine();\n if(ss.Split()[0]==ss.Split()[1]&&Convert.ToInt32(ss.Split()[0])%2==1)\n Console.WriteLine(ss.Split()[0]);\n else\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader reader = new StreamReader(\"input.txt\"); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n int[] temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n int l = temp[0];\n int r = temp[1];\n //reader.Close(); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n\n int ans = 0;\n if (l == r)\n {\n ans = l;\n }\n else\n {\n ans = 2;\n }\n\n Console.WriteLine(ans);\n //Console.ReadKey(); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication1A\n{\n class ProgramAAA\n {\n\n\n\n\n static void Main()\n {\n \n string[] tk = Console.ReadLine().Split(' ');\n int l = Convert.ToInt32(tk[0]);\n int r = Convert.ToInt32(tk[1]);\n if (r == l)\n {\n Console.WriteLine(r);\n return;\n }\n\n Console.WriteLine(2);\n\n }\n\n }\n}"}, {"source_code": "using System;\n\nclass program\n{\n static int g(long c)\n {\n if(c==0)\n return 0;\n else\n return 1;\n }\n static void Main()\n {\n var inp =Console.ReadLine().Split(' ');\n long l =Convert.ToInt64(inp[0]);\n long r =Convert.ToInt64(inp[1]);\n if(l==r)\n {\n Console.Write(l);\n return;\n }\n Console.Write(2);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf411\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf411A();\n }\n public static void solve_cf411C()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n \n int i = 2;\n int j = n;\n int min = 0;\n while (i < j)\n {\n min += (i + j) % (n + 1);\n i++;\n j--;\n }\n\n Console.WriteLine(min);\n //Maybe formula does not exists\n //Console.WriteLine(n < 2 ? 0 : (n + 2) / 3);\n }\n\n public static void solve_cf411B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 2;\n int s = 1;\n List ans = new List();\n for (int i = 0; i < n; i++)\n {\n if (k <= i)\n {\n k += 2;\n s = s == 1 ? 2 : 1;\n }\n\n if (s == 1)\n {\n ans.Add('a');\n }\n else\n {\n ans.Add('b');\n }\n }\n\n Console.WriteLine(new String(ans.ToArray()));\n }\n\n public static void solve_cf411A()\n {\n int[] lr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int l = lr[0];\n int r = lr[1];\n \n if (r - l > 1)\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(l);\n }\n }\n }\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FakeNP\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64[] fir = Console.ReadLine().Split().Select(Int64.Parse).ToArray();\n \n if (fir[0]==fir[1])\n {\n Console.WriteLine(fir[0]); \n }\nelse if (fir[0] > Math.Pow(10, 4) || fir[1] > Math.Pow(10, 4))\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(2);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace FakeNP\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64[] fir = Console.ReadLine().Split().Select(Int64.Parse).ToArray();\n List divi = new List();\n List ans = new List();\n int sum = 0;\n if (fir[0]==fir[1])\n {\n Console.WriteLine(fir[0]); \n }\nelse if (fir[0] > Math.Pow(10, 4) || fir[1] > Math.Pow(10, 4))\n {\n Console.WriteLine(2);\n }\n else\n {\n for (int k = 2; k < 10; k++)\n {\n for (Int64 i = fir[0]; i <= fir[1]; i++)\n {\n if (i % k == 0)\n {\n divi.Add(k);\n }\n }\n }\n\n List oi = divi.Distinct().ToList();\n\n for (int i = 0; i < divi.Count - 1; i++)\n {\n if (divi[i] == divi[i + 1])\n {\n sum++;\n }\n else\n {\n sum++;\n ans.Add(sum);\n sum = 0;\n }\n }\n\n int ma = ans.Max();\n int m = ans.IndexOf(ma);\n int ggg = oi[m];\n Console.WriteLine(ggg);\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: user\n * Date: 05.06.2017\n * Time: 11:30\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Collections;\n\nnamespace Application\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tString numbers = Console.ReadLine();\n\t\t\tString[] num = numbers.Split();\n\t\t\tint l = Int32.Parse(num[0]);\n\t\t\tint r = Int32.Parse(num[1]);\n\t\t\t\n\t\t\tConsole.WriteLine(2);\n\t\t\t\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\n\nclass Programm\n{\n static void Main(string[] args){\n Console.Write(\"2\");\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ss = Console.ReadLine();\n Console.WriteLine(2);\n }\n }\n}"}, {"source_code": "using System;\n\nclass program\n{\n static int g(long c)\n {\n if(c==0)\n return 0;\n else\n return 1;\n }\n static void Main()\n {\n var inp =Console.ReadLine().Split(' ');\n long l =Convert.ToInt64(inp[0]);\n long r =Convert.ToInt64(inp[1]);\n if(l==r)\n {\n Console.Write(l);\n return;\n }\n Console.Write(r/2 - l/2 - g(l%2));\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if(current.Length == 1)\n {\n var num = int.Parse(current);\n if(num < 9)\n {\n return (num + 1).ToString();\n } else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length-1].ToString());\n\n var sb = new StringBuilder(current);\n for(var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n \n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n } else\n {\n first++;\n if(first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n\n if(r - l > 4)\n {\n Console.WriteLine(2);\n return;\n }\n var dict = new Dictionary();\n\n var max = 0;\n for(var i=l; i <= r; i++)\n {\n var gcd = GetAllGcd(i);\n gcd.ForEach(it =>\n {\n if (dict.ContainsKey(it))\n {\n dict[it]++;\n }\n else\n {\n dict[it] = 1;\n }\n });\n }\n\n var result = 2;\n foreach(var k in dict)\n {\n if(k.Value > max)\n {\n result = k.Key;\n max = k.Value;\n }\n }\n Console.WriteLine(result);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if (current.Length == 1)\n {\n var num = int.Parse(current);\n if (num < 9)\n {\n return (num + 1).ToString();\n }\n else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length - 1].ToString());\n\n var sb = new StringBuilder(current);\n for (var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n\n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n }\n else\n {\n first++;\n if (first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 1; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n\n if (r - l > 4)\n {\n Console.WriteLine(2);\n return;\n }\n var dict = new Dictionary();\n\n var max = 0;\n for (var i = l; i <= r; i++)\n {\n var gcd = GetAllGcd(i);\n gcd.ForEach(it =>\n {\n if (dict.ContainsKey(it))\n {\n dict[it]++;\n }\n else\n {\n dict[it] = 1;\n }\n });\n }\n\n var result = 2;\n foreach (var k in dict)\n {\n if (k.Value > max)\n {\n result = k.Key;\n max = k.Value;\n }\n }\n Console.WriteLine(result);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if (current.Length == 1)\n {\n var num = int.Parse(current);\n if (num < 9)\n {\n return (num + 1).ToString();\n }\n else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length - 1].ToString());\n\n var sb = new StringBuilder(current);\n for (var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n\n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n }\n else\n {\n first++;\n if (first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 1; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n\n if (r - l > 4)\n {\n Console.WriteLine(2);\n return;\n }\n var dict = new Dictionary();\n\n var max = 2;\n for (var i = l; i <= r; i++)\n {\n var gcd = GetAllGcd(i);\n gcd.ForEach(it =>\n {\n if (dict.ContainsKey(it))\n {\n dict[it]++;\n }\n else\n {\n dict[it] = 1;\n }\n });\n }\n\n var result = 2;\n foreach (var k in dict)\n {\n if (k.Value > max)\n {\n result = k.Key;\n max = k.Value;\n }\n }\n Console.WriteLine(result);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if(current.Length == 1)\n {\n var num = int.Parse(current);\n if(num < 9)\n {\n return (num + 1).ToString();\n } else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length-1].ToString());\n\n var sb = new StringBuilder(current);\n for(var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n \n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n } else\n {\n first++;\n if(first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var line = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var l = line[0];\n var r = line[1];\n\n if(r - l > 4)\n {\n writer.WriteLine(2);\n writer.Flush();\n }\n var dict = new Dictionary();\n\n var max = 0;\n for(var i=l; i <= r; i++)\n {\n var gcd = GetAllGcd(i);\n gcd.ForEach(it =>\n {\n if (dict.ContainsKey(it))\n {\n dict[it]++;\n }\n else\n {\n dict[it] = 1;\n }\n });\n }\n\n var result = 2;\n foreach(var k in dict)\n {\n if(k.Value > max)\n {\n result = k.Key;\n max = k.Value;\n }\n }\n Console.WriteLine(result);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n int x = 0;\n int y = 0;\n if (l % 2 == 0 && r % 2 == 0)\n {\n x = ((r - l) / 2 + 1);\n\n }\n else if (l % 2 == 0 || r % 2 == 0)\n {\n x = (r - l) / 2 + 1;\n }\n else\n {\n x = (r - l) / 2;\n }\n if (l % 3 == 0 && r % 3 == 0)\n {\n x = ((r - l) / 3 + 1);\n\n }\n else if (l % 3 == 0 || r % 3 == 0)\n {\n x = (r - l) / 3 + 1;\n }\n else\n {\n x = (r - l) / 3;\n }\n if (x >= y)\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(3);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int l = int.Parse(ss[0]);\n int r = int.Parse(ss[1]);\n int x = 0;\n int y = 0;\n Console.WriteLine(2);\n /*if (l % 2 == 0 && r % 2 == 0)\n {\n x = ((r - l) / 2 + 1);\n\n }\n else if (l % 2 == 0 || r % 2 == 0)\n {\n x = (r - l) / 2 + 1;\n }\n else\n {\n x = (r - l) / 2;\n }\n if (l % 3 == 0 && r % 3 == 0)\n {\n x = ((r - l) / 3 + 1);\n\n }\n else if (l % 3 == 0 || r % 3 == 0)\n {\n x = (r - l) / 3 + 1;\n }\n else\n {\n x = (r - l) / 3;\n }\n if (x >= y)\n {\n Console.WriteLine(2);\n }\n else\n {\n Console.WriteLine(3);\n }*/\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n Console.WriteLine(2);\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A805_FakeNP\n {\n private static void Main()\n {\n Console.ReadLine();\n Console.WriteLine(2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Fake_NP\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n //int a = Int32.Parse(input[0]);\n //int b = Int32.Parse(input[1]);\n Console.WriteLine(2);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca805A\n{\n class Program\n {\n public static List Primes()\n {\n var result = new List(2);\n result.Add(2);\n result.Add(3);;\n return result;\n }\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var l = Convert.ToInt32(input[0]);\n var r = Convert.ToInt32(input[1]);\n var res = Primes();\n var dict = new Dictionary();\n /*for (int j = 0; j < res.Count; j++)\n {\n for (int i = l; i <= r; i++)\n {\n if (!dict.ContainsKey(res[j]))\n dict[res[j]] = 0;\n if (i % res[j] == 0)\n dict[res[j]]++;\n }\n }\n var maxValue = dict.Values.Max();\n var answer = (from p in dict\n where p.Value == maxValue\n select p.Key).First();*/\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca805A\n{\n class Program\n {\n public static bool IsPrime(int n)\n {\n var result = true;\n int i = 2;\n if (n == 2)\n return true;\n while (i * i <= n)\n {\n if (n % i == 0)\n {\n result = false;\n break;\n }\n i++;\n }\n return result;\n }\n\n public static List Primes()\n {\n var result = new List(1000000);\n result.Add(2);\n result.Add(3);;\n return result;\n }\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var l = Convert.ToInt32(input[0]);\n var r = Convert.ToInt32(input[1]);\n var res = Primes();\n if (l == r && IsPrime(l))\n {\n Console.WriteLine(l);\n }\n else\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca805A\n{\n class Program\n {\n public static bool IsPrime(int n)\n {\n var result = true;\n int i = 2;\n if (n == 2)\n return true;\n while (i * i <= n + 1)\n {\n if (n % i == 0)\n {\n result = false;\n break;\n }\n i++;\n }\n return result;\n }\n\n public static List Primes()\n {\n var result = new List(1000000);\n result.Add(2);\n result.Add(3);\n return result;\n }\n\n static void Main(string[] args)\n {\n Console.WriteLine(IsPrime(331900277));\n var input = Console.ReadLine().Split(' ');\n var l = Convert.ToInt32(input[0]);\n var r = Convert.ToInt32(input[1]);\n var res = Primes();\n if (l == r)\n {\n Console.WriteLine(l);\n }\n else\n Console.WriteLine(2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n\n class Program\n {\n public void Solve()\n {\n int res = 2;\n var s = Console.ReadLine().Split(' ');\n var l = int.Parse(s[0]);\n var r = int.Parse(s[1]);\n if (l == 3 && r == 6)\n res = 3;\n Console.WriteLine(res); \n } \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Fake_NP\n{\n class Program\n {\n static int remain(int a,int b,int c)\n {\n int re=0 ;\n while(a<=b)\n {\n if(a%c==0)\n {\n re++;\n }\n a++;\n }\n return re;\n }\n static void Main(string[] args)\n {\n int l, r,truth=0,result=0;\n string input;\n input = Console.ReadLine();\n int[,] list = new int[8,2];\n l = int.Parse(input.Split(' ')[0]);\n r = int.Parse(input.Split(' ')[1]);\n if (l == r)\n {\n for (int div = 2; div <= 4; div++)\n {\n\n list[div - 2, 0] = div;\n list[div - 2, 1] = remain(l, r, div);\n if (list[div - 2, 1] > truth)\n {\n truth = list[div - 2, 1];\n result = list[div - 2, 0];\n }\n\n }\n Console.WriteLine(result);\n }\n Console.WriteLine(\"2\");\n }\n }\n}\n"}], "src_uid": "a8d992ab26a528f0be327c93fb499c15"} {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n var numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var changesToPerform = numbers[1];\n var queue = Console.ReadLine().ToCharArray().Select(x => x == 'G' ? 1 : 0).ToArray();\n\n for (int i = 1; i <= changesToPerform; i++)\n {\n for (int j = 0; j < queue.Length - 1; j++)\n {\n if (queue[j] == 0 && queue[j + 1] == 1)\n {\n queue[j] = 1;\n queue[j + 1] = 0;\n j ++;\n }\n }\n }\n\n Console.WriteLine(string.Join(string.Empty,queue.Select(x => x == 0 ? \"B\" : \"G\")));\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Linq;\n\nnamespace TmpApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(input[0]);\n int t = Convert.ToInt32(input[1]);\n string queueString = Console.ReadLine();\n char[] queue = queueString.ToCharArray();\n for (int i = 0; i < t; ++i)\n {\n bool flag = false;\n for (int j = 0; j < n - 1; ++j)\n {\n if (flag)\n {\n flag = false;\n continue;\n }\n if (queue[j] == 'B' && queue[j + 1] == 'G' && !flag)\n {\n queue[j] = 'G';\n queue[j + 1] = 'B';\n flag = true;\n }\n }\n }\n Console.WriteLine(queue);\n }\n }\n}"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split();\n var n = int.Parse(arr[0]);\n var t = int.Parse(arr[1]);\n var str = Console.ReadLine();\n var sb = new StringBuilder(str);\n var temp = ' ';\n\n while (t >= 1)\n {\n for (int i = 0; i < n - 1; i++)\n {\n if (sb[i] == 'B' && sb[i + 1] == 'G')\n {\n temp = sb[i];\n sb[i] = sb[i + 1];\n sb[i + 1] = temp;\n i++;\n }\n }\n\n t--;\n }\n for (int i = 0; i < n; i++)\n {\n Console.Write(sb[i]);\n }\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces266B_Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = num[0];\n int t = num[1];\n string str = Console.ReadLine();\n char[] ch = str.ToCharArray();\n //char[] output = new char[n];\n\n for (int i=0;i< t;i++)\n {\n for(int j=0;j< n-1;j++)\n {\n if (ch[j] == 'B' && ch[j + 1] == 'G')\n {\n ch[j] = 'G';\n ch[j + 1] = 'B';\n j++;\n }\n \n }\n \n }\n Console.WriteLine(ch);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Globalization;\n\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar a=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tstring s=Console.ReadLine();\n\t\t\n\t\tfor(int i=0; i indexes = new List();\n\n for (int i = 0; i < n-1; i++) {\n if (line[i] == 'B' && line[i + 1] == 'G') {\n indexes.Add(i);\n }\n }\n\n for (int i = 0; i < indexes.Count; i++)\n {\n line = line.Remove(indexes[i], 2).Insert(indexes[i],\"GB\");\n }\n\n }\n WLine(line);\n\n\n\n }\n\n static void Main(string[] args)\n {\n\n#if !HOME\n MyMain();\n#else\n Secret.MyMain();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static string[] RLine(string separator)\n {\n return Console.ReadLine().Split(new string[] { separator }, StringSplitOptions.None);\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n public static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Runtime.InteropServices;\n\nnamespace ConsoleApplication1\n{\n //internal class Exams : IComparable\n //{\n // public int s, r;\n\n // public Exams(int a, int b)\n // {\n // s = a;\n\n // r = b;\n // }\n\n // int IComparable.CompareTo(Exams other)\n // {\n // return this.r.CompareTo(other.r);\n // }\n //}\n\n internal class Program\n {\n //private static string s = \"\";\n\n private static void Main(string[] args)\n {\n //var t = Console.ReadLine().Split(' ');\n\n //int theNumberOfExams = int.Parse(t[0]),\n // theMaxScore = int.Parse(t[1]),\n // theAverageScore = int.Parse(t[2]);\n\n //long theSumOfScores = 0,\n // answer = 0,\n // k;\n\n //Exams[] scores = new Exams[theNumberOfExams];\n\n //for (int i = 0; i < theNumberOfExams; i++)\n //{\n // t = Console.ReadLine().Split(' ');\n\n // scores[i] = new Exams(int.Parse(t[0]), int.Parse(t[1]));\n\n // theSumOfScores += scores[i].s;\n //}\n\n //if (theSumOfScores/theNumberOfExams >= theAverageScore)\n //{\n // Console.WriteLine(0);\n //}\n //else\n //{\n // Array.Sort(scores);\n\n // for (int i = 0; i < theSumOfScores; i++)\n // {\n // if (scores[i].s < theMaxScore)\n // {\n // k = Math.Min(theAverageScore*theNumberOfExams - theSumOfScores,\n // theMaxScore - scores[i].s);\n\n // theSumOfScores += Math.Min(theAverageScore*theNumberOfExams - theSumOfScores,\n // theMaxScore - scores[i].s);\n\n // answer += scores[i].r*k;\n\n // if (theSumOfScores / theNumberOfExams >= theAverageScore)\n // {\n // break;\n // }\n // } \n // }\n\n // Console.WriteLine(answer);\n //}\n\n var x = Console.ReadLine().Split(' ');\n\n Int16 n = Int16.Parse(x[0]),\n t = Int16.Parse(x[1]),\n k = 0;\n\n StringBuilder s = new StringBuilder(Console.ReadLine());\n\n while (k != t)\n {\n for (int i = 0; i < s.Length-1; i++)\n {\n if (s[i] == 'B' && s[i + 1] == 'G')\n {\n s[i] = 'G';\n s[i + 1] = 'B';\n\n i++;\n }\n }\n\n k++;\n }\n\n Console.WriteLine(s);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ContestsConsoleLab\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chNum = 0, secNum = 0;\n string queue;\n var numssArr =Console.ReadLine();\n\n chNum =int.Parse(numssArr.Split(' ')[0]);\n secNum=int.Parse(numssArr.Split(' ')[1]);\n\n queue = Console.ReadLine();\n var quArr=queue.ToCharArray();\n for (int i = 0; i < secNum; i++)\n {\n for (int j = 0; j < chNum-1; j++)\n {\n if (quArr[j] == 'B' && quArr[j + 1] == 'G')\n {\n quArr[j] = 'G';\n quArr[j + 1] = 'B';\n j++;\n }\n }\n }\n Console.WriteLine(quArr);\n }\n }\n}\n"}, {"source_code": "#define ASD\n#if (Debug)\n#define Trace\n#endif\n#if (ASD)\nusing DS.Common;\nusing DS.Dictionaries;\nusing DS.Graphs;\nusing DS.Heaps;\nusing DS.Lists;\nusing DS.Trees;\nusing DS;\nusing AL;\nusing AL.Common;\nusing AL.Graphs;\nusing AL.Numeric;\nusing AL.Sorting;\n#endif\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing GenericArithmetic;\nusing System.Reflection;\nusing System.Windows;\nusing System.Text.RegularExpressions;\nusing csConsoleforStudy;\nusing System.Resources;\nusing System.Runtime.Serialization;\n\nnamespace csConsoleforStudy\n{\n class Program\n {\n const double MemoryLimit = 2.56;\n const double TimeLimit = 4000;\n static Stream fsr;\n static FileStream fsw;\n static TextReader tr;\n static TextWriter tw;\n static Thread t;\n static Thread mainThread = Thread.CurrentThread;\n static Stopwatch sw = new Stopwatch();\n static DefaultTraceListener Logger;\n static long maxUsedMemory = 0;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CloseStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CheckMemory()\n {\n#if (Debug)\n#endif\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n var l1 = ria();\n var n = l1[0];\n var t = l1[1];\n var l2 = Console.ReadLine();\n char[] State = l2.ToCharArray();\n List pos = new List();\n for (int i = 0; i < State.Length; i++)\n {\n if (State[i] == 'B')\n pos.Add(i);\n }\n\n for (int round = 0; round < t; round++)\n {\n for (int i = 0; i < pos.Count; i++)\n {\n if (i == pos.Count - 1)\n {\n pos[i] += 1;\n }\n else if (pos[i] < State.Length && pos[i + 1] != pos[i] + 1)\n {\n pos[i] += 1;\n }\n\n if (pos[i] == State.Length)\n pos[i] -= 1;\n }\n }\n\n StringBuilder sb = new StringBuilder(State.Length);\n for (int i = 0; i < State.Length; i++)\n {\n if (pos.Contains(i))\n {\n sb.Append('B');\n }\n else\n {\n sb.Append('G');\n }\n }\n\n Console.WriteLine(sb.ToString());\n }\n\n public char[] swap(char[] str, int a, int b)\n {\n Tuple chars = new Tuple(str[a], str[b]);\n str[a] = chars.Item2;\n str[b] = chars.Item1;\n return str;\n }\n\n#region SolverUtils\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new AE(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n }\n\n static class MyExtensions\n {\n public static string Reverse(this string str)\n {\n StringBuilder sb = new StringBuilder(str.Length);\n for (int i = str.Length - 1; i >= 0; i--)\n {\n sb.Append(str[i]);\n }\n\n return sb.ToString();\n }\n }\n\n#endregion\n struct Pair\n {\n public long X, Y;\n public Pair(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n struct Bit\n {\n bool state;\n public Bit(bool state)\n {\n this.state = state;\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public override string ToString()\n {\n return state.ToString();\n }\n\n public override bool Equals(object other)\n {\n if (other is Bit)\n {\n return state == ((Bit)other).state;\n }\n else\n {\n if ((int)other == 1 && state == true)\n return true;\n else if ((int)other == 0 && state == false)\n return true;\n else\n return base.Equals(other);\n }\n }\n\n public static implicit operator bool (Bit a)\n {\n return a.state;\n }\n\n public static implicit operator Bit(bool a)\n {\n return new Bit(a);\n }\n\n public static implicit operator Bit(int a)\n {\n if (a == 0)\n return new Bit(false);\n return new Bit(true);\n }\n\n public static bool operator ==(Bit a, Bit b)\n {\n return a.state == b.state;\n }\n\n public static bool operator !=(Bit a, Bit b)\n {\n return a.state != b.state;\n }\n\n public static Bit operator !(Bit a)\n {\n return new Bit(!a.state);\n }\n\n public static Bit operator +(Bit a, Bit b)\n {\n return new Bit(a.state || b.state);\n }\n\n public static Bit operator *(Bit a, Bit b)\n {\n return new Bit(a.state && b.state);\n }\n\n public static Bit operator ^(Bit a, Bit b)\n {\n return new Bit(a.state ^ b.state);\n }\n }\n\n#if (MS)\n#endif\n#region Exceptions\n [Serializable]\n internal class IOE : InvalidOperationException\n {\n public IOE()\n {\n }\n\n public IOE(string message): base (message)\n {\n }\n\n public IOE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected IOE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n\n [Serializable]\n internal class AE : ArgumentException\n {\n public AE()\n {\n }\n\n public AE(string message): base (message)\n {\n }\n\n public AE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected AE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n#endregion\n}\n\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n#if (ASD)\n Map.Populate(W, H, defaultValue);\n#endif\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n\n#if (ASD)\n#region DataStructures\nnamespace DS.Common\n{\n public static class Comparers\n {\n public static bool IsNumber(this T value)\n {\n if (value is sbyte)\n return true;\n if (value is byte)\n return true;\n if (value is short)\n return true;\n if (value is ushort)\n return true;\n if (value is int)\n return true;\n if (value is uint)\n return true;\n if (value is long)\n return true;\n if (value is ulong)\n return true;\n if (value is float)\n return true;\n if (value is double)\n return true;\n if (value is decimal)\n return true;\n return false;\n }\n\n public static bool IsEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.Equals(secondValue);\n }\n\n public static bool IsGreaterThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) > 0;\n }\n\n public static bool IsLessThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) < 0;\n }\n\n public static bool IsGreaterThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));\n }\n\n public static bool IsLessThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));\n }\n }\n\n public static class Helpers\n {\n public static void Swap(this IList list, int firstIndex, int secondIndex)\n {\n if (list.Count < 2 || firstIndex == secondIndex)\n return;\n var temp = list[firstIndex];\n list[firstIndex] = list[secondIndex];\n list[secondIndex] = temp;\n }\n\n public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')\n {\n if (string.IsNullOrEmpty(text))\n return text;\n int length = text.Length;\n int cTP = newW - length;\n if (cTP < 0)\n throw new AE(\"New w must be greater than string length.\");\n int pL = cTP / 2 + cTP % 2;\n int pR = cTP / 2;\n StringBuilder rB = new StringBuilder(newW);\n for (int i = 0; i < pL; i++)\n rB.Insert(i, fillerCharacter);\n for (int i = 0; i < length; i++)\n rB.Insert(i + pL, text[i]);\n for (int i = newW - pR; i < newW; i++)\n rB.Insert(i, fillerCharacter);\n return rB.ToString();\n }\n\n public static void Populate(this T[, ] array, int rows, int columns, T defaultValue = default (T))\n {\n for (int i = 0; i < rows; ++i)\n {\n for (int j = 0; j < columns; ++j)\n {\n array[i, j] = defaultValue;\n }\n }\n }\n }\n}\n\nnamespace DS.Dictionaries\n{\n}\n\nnamespace DS.Graphs\n{\n}\n\nnamespace DS.Hashing\n{\n}\n\nnamespace DS.Heaps\n{\n public interface IMaxHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMax();\n T ExtractMax();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMinHeap ToMinHeap();\n }\n\n public interface IMinHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMin();\n T ExtractMin();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMaxHeap ToMaxHeap();\n }\n}\n\nnamespace DS.Lists\n{\n public class ArrayList : IEnumerable\n {\n bool DefaultMaxCapacityIsX64 = true;\n bool IsMaximumCapacityReached = false;\n public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;\n public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;\n private readonly T[] _emptyArray = new T[0];\n private const int _defaultCapacity = 8;\n private T[] _collection;\n private int _size\n {\n get;\n set;\n }\n\n public ArrayList(): this (capacity: 0)\n {\n }\n\n public ArrayList(int capacity)\n {\n if (capacity < 0)\n {\n throw new ArgumentOutOfRangeException();\n }\n else if (capacity == 0)\n {\n _collection = _emptyArray;\n }\n else\n {\n _collection = new T[capacity];\n }\n\n _size = 0;\n }\n\n private void _ensureCapacity(int minCapacity)\n {\n if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)\n {\n int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);\n int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);\n if (newCapacity < minCapacity)\n newCapacity = minCapacity;\n if (newCapacity >= maxCapacity)\n {\n newCapacity = maxCapacity - 1;\n IsMaximumCapacityReached = true;\n }\n\n this._resizeCapacity(newCapacity);\n }\n }\n\n private void _resizeCapacity(int newCapacity)\n {\n if (newCapacity != _collection.Length && newCapacity > _size)\n {\n try\n {\n Array.Resize(ref _collection, newCapacity);\n }\n catch (OutOfMemoryException)\n {\n if (DefaultMaxCapacityIsX64 == true)\n {\n DefaultMaxCapacityIsX64 = false;\n _ensureCapacity(newCapacity);\n }\n\n throw;\n }\n }\n }\n\n public int Count\n {\n get\n {\n return _size;\n }\n }\n\n public int Capacity\n {\n get\n {\n return _collection.Length;\n }\n }\n\n public bool IsEmpty\n {\n get\n {\n return (Count == 0);\n }\n }\n\n public T First\n {\n get\n {\n return _collection[0];\n }\n }\n\n public T Last\n {\n get\n {\n return _collection[Count - 1];\n }\n }\n\n public T this[int index]\n {\n get\n {\n return _collection[index];\n }\n\n set\n {\n _collection[index] = value;\n }\n }\n\n public void Add(T dataItem)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n _collection[_size++] = dataItem;\n }\n\n public void AddRange(IEnumerable elements)\n {\n if (elements == null)\n throw new ArgumentNullException();\n if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (elements.Any())\n {\n _ensureCapacity(_size + elements.Count());\n foreach (var element in elements)\n this.Add(element);\n }\n }\n\n public void AddRepeatedly(T value, int count)\n {\n if (count < 0)\n throw new ArgumentOutOfRangeException();\n if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (count > 0)\n {\n _ensureCapacity(_size + count);\n for (int i = 0; i < count; i++)\n this.Add(value);\n }\n }\n\n public void InsertAt(T dataItem, int index)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n if (index < _size)\n {\n Array.Copy(_collection, index, _collection, index + 1, (_size - index));\n }\n\n _collection[index] = dataItem;\n _size++;\n }\n\n public bool Remove(T dataItem)\n {\n int index = IndexOf(dataItem);\n if (index >= 0)\n {\n RemoveAt(index);\n return true;\n }\n\n return false;\n }\n\n public void RemoveAt(int index)\n {\n _size--;\n if (index < _size)\n {\n Array.Copy(_collection, index + 1, _collection, index, (_size - index));\n }\n\n _collection[_size] = default (T);\n }\n\n public void Clear()\n {\n if (_size > 0)\n {\n _size = 0;\n Array.Clear(_collection, 0, _size);\n _collection = _emptyArray;\n }\n }\n\n public void Resize(int newSize)\n {\n Resize(newSize, default (T));\n }\n\n public void Resize(int newSize, T defaultValue)\n {\n int currentSize = this.Count;\n if (newSize < currentSize)\n {\n this._ensureCapacity(newSize);\n }\n else if (newSize > currentSize)\n {\n if (newSize > this._collection.Length)\n this._ensureCapacity(newSize + 1);\n this.AddRange(Enumerable.Repeat(defaultValue, newSize - currentSize));\n }\n }\n\n public void Reverse()\n {\n Reverse(0, _size);\n }\n\n public void Reverse(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n Array.Reverse(_collection, startIndex, count);\n }\n\n public void ForEach(Action action)\n {\n if (action == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n action(_collection[i]);\n }\n }\n\n public bool Contains(T dataItem)\n {\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n EqualityComparer comparer = EqualityComparer.Default;\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Contains(T dataItem, IEqualityComparer comparer)\n {\n if (comparer == null)\n {\n throw new ArgumentNullException();\n }\n\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Exists(Predicate searchMatch)\n {\n return (FindIndex(searchMatch) != -1);\n }\n\n public int FindIndex(Predicate searchMatch)\n {\n return FindIndex(0, _size, searchMatch);\n }\n\n public int FindIndex(int startIndex, Predicate searchMatch)\n {\n return FindIndex(startIndex, (_size - startIndex), searchMatch);\n }\n\n public int FindIndex(int startIndex, int count, Predicate searchMatch)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n int endIndex = startIndex + count;\n for (int index = startIndex; index < endIndex; ++index)\n {\n if (searchMatch(_collection[index]) == true)\n return index;\n }\n\n return -1;\n }\n\n public int IndexOf(T dataItem)\n {\n return IndexOf(dataItem, 0, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex)\n {\n return IndexOf(dataItem, startIndex, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n return Array.IndexOf(_collection, dataItem, startIndex, count);\n }\n\n public T Find(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n return _collection[i];\n }\n }\n\n return default (T);\n }\n\n public ArrayList FindAll(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n ArrayList matchedElements = new ArrayList();\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n matchedElements.Add(_collection[i]);\n }\n }\n\n return matchedElements;\n }\n\n public ArrayList GetRange(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n var newArrayList = new ArrayList(count);\n Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);\n newArrayList._size = count;\n return newArrayList;\n }\n\n public T[] ToArray()\n {\n T[] newArray = new T[Count];\n if (Count > 0)\n {\n Array.Copy(_collection, 0, newArray, 0, Count);\n }\n\n return newArray;\n }\n\n public List ToList()\n {\n var newList = new List(this.Count);\n if (this.Count > 0)\n {\n for (int i = 0; i < this.Count; ++i)\n {\n newList.Add(_collection[i]);\n }\n }\n\n return newList;\n }\n\n public string ToHumanReadable(bool addHeader = false)\n {\n int i = 0;\n string listAsString = string.Empty;\n string preLineIndent = (addHeader == false ? \"\" : \"\\t\");\n for (i = 0; i < Count; ++i)\n {\n listAsString = String.Format(\"{0}{1}[{2}] => {3}\\r\\n\", listAsString, preLineIndent, i, _collection[i]);\n }\n\n if (addHeader == true)\n {\n listAsString = String.Format(\"ArrayList of count: {0}.\\r\\n(\\r\\n{1})\", Count, listAsString);\n }\n\n return listAsString;\n }\n\n public IEnumerator GetEnumerator()\n {\n for (int i = 0; i < Count; i++)\n {\n yield return _collection[i];\n }\n }\n\n System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\n {\n return this.GetEnumerator();\n }\n }\n}\n\nnamespace DS.Trees\n{\n}\n\n#endregion\n#region Algorithms\nnamespace AL.Common\n{\n}\n\nnamespace AL.Graphs\n{\n}\n\nnamespace AL.Numeric\n{\n}\n\nnamespace AL.Sorting\n{\n public static class QuickSorter\n {\n public static void QuickSort(this IList collection, Comparer comparer = null)\n {\n int startIndex = 0;\n int endIndex = collection.Count - 1;\n comparer = comparer ?? Comparer.Default;\n collection.InternalQuickSort(startIndex, endIndex, comparer);\n }\n\n private static void InternalQuickSort(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n if (leftmostIndex < rightmostIndex)\n {\n int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);\n collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);\n collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);\n }\n }\n\n private static int InternalPartition(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n int wallIndex, pivotIndex;\n pivotIndex = rightmostIndex;\n T pivotValue = collection[pivotIndex];\n wallIndex = leftmostIndex;\n for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)\n {\n if (comparer.Compare(collection[i], pivotValue) <= 0)\n {\n collection.Swap(i, wallIndex);\n wallIndex++;\n }\n }\n\n collection.Swap(wallIndex, pivotIndex);\n return wallIndex;\n }\n }\n}\n#endregion\n#endif\n"}, {"source_code": "using System;\nclass P\n{\n static void Main(string[] args)\n {\n string[] i = Console.ReadLine().Split(' ');\n int a = int.Parse(i[0]);\n int b = int.Parse(i[1]);\n string c = Console.ReadLine();\n char[] d = c.ToCharArray();\n for (int j = 0; j < b; j++)\n {\n for (int k = 0; k < d.Length - 1; k++)\n {\n if (d[k].Equals('B') && d[k + 1].Equals('G'))\n {\n d[k] = 'G';\n d[k + 1] = 'B';\n k++;\n }\n }\n }\n Console.WriteLine(d);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Zada4ki\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine().Split(' ')[1]);\n string s = Console.ReadLine();\n for (int i = 0; i < t; i++) s = s.Replace(\"BG\", \"GB\");\n Console.WriteLine(s);\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication42\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] m = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int n = m[0];\n int t = m[1];\n string str = Console.ReadLine();\n char[] ch = str.ToCharArray();\n for(int i = 0; i int.Parse(x)).ToArray();\n }\n\n static int ReadInt ()\n {\n return int.Parse(Console.ReadLine());\n }\n\n \n }\n \n public static class NumConverter\n {\n public static int ToOne (int num)\n { return num == 0 ? 0 : 1; }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Swap(ref T a, ref T b)\n\t\t{\n\t\t\tT t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar t = int.Parse(Console.ReadLine().Split(' ')[1]);\n\t\t\tvar q = Console.ReadLine().ToCharArray();\n\n\t\t\twhile (t > 0)\n\t\t\t{\n\t\t\t\tfor (int i = 1; i < q.Length; i++)\n\t\t\t\t{\n\t\t\t\t\tif (q[i - 1] == 'B' && q[i] == 'G')\n\t\t\t\t\t{\n\t\t\t\t\t\tSwap(ref q[i - 1], ref q[i]);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tt--;\n\t\t\t}\n\t\t\tConsole.WriteLine(string.Concat(q.Select(p => p.ToString()).ToArray()));\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1A\n{\n class Program266B\n {\n static void Main(string[] args)\n {\n string[] tk = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(tk[1]);\n string s = Console.ReadLine();\n char[] ca = s.ToCharArray();\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < s.Length - 1; j++)\n {\n if (ca[j] == 'B' && ca[j + 1] == 'G')\n {\n ca[j] = 'G'; \n ca[j + 1] = 'B';\n j++;\n }\n }\n }\n\n foreach (char c in ca)\n Console.Write(c);\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program {\n static void Main(string[] args) {\n\n string[] firstLine = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(firstLine[0]);\n int t = Convert.ToInt32(firstLine[1]);\n\n string strQueue = Console.ReadLine();\n char[] queue = strQueue.ToCharArray();\n\n for (int k = 0; k < t; k++) {\n for (int i = 0; i < n - 1; i++) {\n if (queue[i] == 'B' && queue[i + 1] == 'G') {\n queue[i + 1] = 'B';\n queue[i] = 'G';\n i++;\n }\n }\n }\n\n for (int i = 0; i < n; i++) {\n Console.Write(queue[i]);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace QueueSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n var input = Console.ReadLine().ToCharArray();\n\n int num = data[0] - 2;\n int count = 1;\n char temp = 'A';\n\n while (count <= data[1])\n {\n for (int i = 0; i <= num;)\n {\n if (input[i] == 'B' && input[i + 1] == 'G')\n {\n temp = input[i + 1];\n input[i + 1] = input[i];\n input[i] = temp;\n i += 2;\n }\n else\n {\n i++;\n }\n }\n count++;\n }\n Console.WriteLine(new string(input));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u041e\u0447\u0435\u0440\u0435\u0434\u044c_\u0432_\u0448\u043a\u043e\u043b\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] values = input.Split(' ');\n int n = Convert.ToInt32(values[0]);\n int t = Convert.ToInt32(values[1]);\n string que = Console.ReadLine();\n for (int i = 0; i < t; i++)\n {\n que = que.Replace(\"BG\", \"GB\");\n }\n Console.WriteLine(que);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace QueueattheSchool\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\t\tvar str = Console.ReadLine ().Split (' ');\n\t\t\t\tint n = int.Parse (str [0]);\n\t\t\t\tint t = int.Parse (str [1]);\n\n\t\t\t\tstring input = Console.ReadLine ();\n\n\t\t\t\tvar s = input.ToCharArray ();\n\n\t\t\t\tfor (int i = 0; i < t; i++) {\n\t\t\t\t\tfor (int j = 0; j < n - 1; j++) {\t\n\t\t\t\t\t\tif (s [j] == 'B' && s [j + 1] == 'G') {\n\t\t\t\t\t\t\ts[j] = 'G'; s[j + 1] = 'B';\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar output = \"\";\n\t\t\t\ts.ToList ().ForEach (c=> output+=c);\n\t\t\t\tConsole.WriteLine (output);\n\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass m\n{\n static void Main()\n {\n string[] cin = Console.ReadLine().Split();\n int count = Convert.ToInt32(cin[0]),\n time = Convert.ToInt32(cin[1]);\n char[] seq = Console.ReadLine().ToArray();\n for (int t = 0; t < time; t++)\n for (int pos = 0; pos < count - 1; pos++)\n if (seq[pos] == 'B' && seq[pos+1] == 'G')\n {\n seq[pos] = 'G';\n seq[pos + 1] = 'B';\n pos++;\n }\n Console.WriteLine(seq);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Queue\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int t = int.Parse(input[1]);\n string s = Console.ReadLine();\n char[] output = new char[n];\n int k = 0;\n foreach (char c in s)\n {\n output[k] = c;\n k++;\n }\n for (int i = 0, x = 0; i < t; i++)\n {\n for (int j = x + 1; j < output.Length; j = x + 1)\n {\n if (output[x] == 'B' && output[j] == 'G')\n {\n output[x] = 'G';\n output[j] = 'B';\n x = j + 1;\n }\n else\n {\n x = x + 1;\n }\n }\n x = 0;\n }\n foreach (char c in output)\n {\n Console.Write(c);\n }\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n char[] line;\n int timeOffset;\n int length;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\n', '\\r', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n line = input[2].ToCharArray();\n timeOffset = int.Parse(input[1]);\n length = int.Parse(input[0]);\n }\n {\n char temp;\n for (int i = 0; i < timeOffset; ++i)\n {\n for (int j = length - 1; j > 0; --j)\n {\n if (line[j] == 'G' && line[j - 1] == 'B')\n { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; --j; }\n }\n }\n }\n Console.WriteLine(new string(line));\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var amount = init[0];\n var iter = init[1];\n\n var children = Console.ReadLine();\n char[] child = children.ToArray();\n\n\n for (int i = 0; i < iter; i++)\n {\n for (int j = 1; j < children.Length; j++)\n {\n if (child[j - 1] == 'B' && child[j] == 'G')\n {\n char temp = child[j - 1];\n child[j - 1] = child[j];\n child[j] = temp;\n j++;\n }\n }\n }\n\n children = String.Join(\"\", child);\n Console.WriteLine(children);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _266B\n{\n class Program\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(arr[0]);\n int t = Convert.ToInt32(arr[1]);\n var position = Console.ReadLine().ToCharArray();\n for (int i = 0; i < t; i++)\n {\n for (int j = 1; j < position.Length; j++)\n {\n if (position[j]=='G' && position[j - 1] == 'B')\n {\n position[j] = 'B';\n position[j - 1] = 'G';\n j++;\n\n }\n }\n }\n for (int i = 0; i < position.Length; i++)\n {\n Console.Write(position[i]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n string s = Console.ReadLine();\n for (int i = 0; i < n[1]; i++)\n {\n s = s.Replace(\"BG\", \"GB\");\n }\n Console.WriteLine(s);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class QueueAtTheSchool\n{\n private static void Main()\n {\n \tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \tvar n = input[0];\n\t\tvar t = input[1];\n\t\tvar queue = Console.ReadLine().ToCharArray();\n\t\t\n\t\tfor (int i = 0; i < t; i++)\n\t\t{\n\t\t\tvar j = 0;\n\t\t\twhile(j < n - 1)\n\t\t\t{\n\t\t\t\tif(queue[j] == 'B' && queue[j + 1] == 'G')\n\t\t\t\t{\n\t\t\t\t\tSwap(queue, j, j + 1);\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n \n \tConsole.WriteLine(string.Join(\"\", queue)); \n }\n\t\n\tprivate static void Swap(char[] input, int a, int b)\n\t{\n\t\tvar temp = input[a];\n\t\tinput[a] = input[b];\n\t\tinput[b] = temp;\n\t}\n}"}, {"source_code": "using System;\n\nclass B266 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var t = int.Parse(line[1]);\n var s = Console.ReadLine().ToCharArray();\n for (int i = 0; i < t; ++i)\n for (int j = 0; j < n - 1; ++j)\n if (s[j] < s[j + 1]) {\n var sj = s[j];\n s[j] = s[j + 1];\n s[j + 1] = sj;\n ++j;\n }\n Console.WriteLine(new string(s));\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte time = Console.ReadLine().Split(' ').Select(n => Convert.ToByte(n)).ToArray()[1];\n StringBuilder queue = new StringBuilder(Console.ReadLine());\n\n\n for (int j = 0; j < time; j++)\n {\n for (int i = 1; i < queue.Length; i++)\n {\n if (queue[i] == 'G' && queue[i - 1] == 'B')\n {\n queue[i] = 'B';\n queue[i - 1] = 'G';\n i++;\n }\n }\n }\n\n Console.WriteLine(queue);\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem266B {\n class Program {\n static void Main(string[] args) {\n string[] inputInfo = Console.ReadLine().Split(' ');\n int childrens = Convert.ToInt32(inputInfo[0]);\n int time = Convert.ToInt32(inputInfo[1]);\n char[] queue = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < time; i++) {\n swapPositions(queue, childrens);\n }\n\n for (int i = 0; i < childrens; i++) {\n Console.Write(queue[i]);\n }\n Console.Write(Environment.NewLine);\n }\n\n private static void swapPositions(char[] queue, int childrens) {\n List positions = positionsToSwap(queue, childrens);\n int positionsCount = positions.Count;\n\n for (int i = 0; i < positionsCount; i++) {\n int Gposition = positions[i];\n queue[Gposition - 1] = 'G';\n queue[Gposition] = 'B';\n }\n }\n\n private static List positionsToSwap(char[] queue, int childrens) {\n List positions = new List();\n for (int i = 1; i < childrens; i++) {\n if (queue[i].Equals('G') && queue[i - 1].Equals('B')) {\n positions.Add(i); //add position of G\n }\n }\n return positions;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcePreparing\n{\n class Programm\n {\n static void Main(string[] args)\n {\n string[] input_vals = Console.ReadLine().Split(' ');\n char[] input_array = Console.ReadLine().ToCharArray();\n char change;\n for (int i = 0; i < Convert.ToInt32(input_vals[1]); i++)\n {\n for (int k = 0; k < input_array.Length - 1; k++)\n {\n if (input_array[k + 1] == 'G' && input_array[k] == 'B')\n {\n change = input_array[k];\n input_array[k] = input_array[k + 1];\n input_array[k + 1] = change;\n k++;\n }\n }\n }\n for (int i = 0; i < input_array.Length; i++)\n Console.Write(input_array[i]);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class _266B_Queue_At_The_School\n {\n static void Main()\n {\n int loopCount = int.Parse(Console.ReadLine().Split(' ')[1]);\n char[] charInputs = Console.ReadLine().ToCharArray();\n\n SortBNG(ref charInputs, loopCount);\n }\n\n static void SortBNG(ref char[] input, int loopCount)\n {\n if(loopCount == 0)\n {\n foreach(char c in input)\n {\n Console.Write(c);\n }\n Console.WriteLine();\n return;\n }\n\n for(int i = 0; i < input.Length - 1; i++)\n {\n if(input[i] == 'B' && input[i+1] == 'G')\n {\n input[i] ^= input[i + 1];\n input[i + 1] ^= input[i];\n input[i] ^= input[i + 1];\n i++;\n }\n }\n\n SortBNG(ref input, --loopCount);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n string s = Console.ReadLine();\n for (int i = 0; i < Arr[1]; i++)\n s = s.Replace(\"BG\",\"GB\");\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n public static void Swap(ref T a, ref T b)\n {\n T temp = a;\n a = b;\n b = temp;\n }\n static void Main()\n {\n var nt = Console.ReadLine().Split(' ').Select(int.Parse);\n var n = nt.First();\n var t = nt.Last();\n var s = Console.ReadLine();\n var sa = s.ToCharArray();\n int i, j;\n for (i = 0; i < t; i++)\n {\n j = 0;\n while (j < s.Length)\n {\n var newS = new string(sa);\n j = newS.IndexOf(\"BG\", j);\n if (j >= 0)\n {\n Swap(ref sa[j], ref sa[j + 1]);\n }\n else\n {\n break;\n }\n j += 2;\n }\n }\n Console.WriteLine(sa);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace C0deforces\n{\n class QueueAtTheSchool\n {\n static void Main(string[] args)\n {\n int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);\n char[] s = Console.ReadLine().Trim().ToCharArray();\n while (NandT[1]-- > 0)\n {\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] == 'B' && s[i + 1] == 'G') { s[i + 1] = 'B'; s[i] = 'G'; i++; }\n }\n }\n Console.WriteLine(string.Join(\"\",s));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n const int BufferSize = (1 << 10) * 10;\n\n static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);\n\n static void Main(string[] args)\n {\n var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};\n thread.Start();\n //Solve();\n \n //Console.ReadKey();\n }\n\n static void Solve()\n {\n var n = NextNumber();\n var t = NextNumber();\n\n var queue = new List();\n for (var i = 0; i < n; )\n {\n var symbol = (char) Reader.Read();\n\n if (char.IsLetter(symbol))\n {\n queue.Add(symbol);\n i++;\n }\n }\n\n for (var i = 0; i < t; i++)\n {\n for (var j = 0; j < n - 1; j++)\n {\n if (queue[j] == 'B' && queue[j + 1] == 'G')\n {\n Swap(queue, j, j + 1);\n j++;\n }\n }\n }\n\n Writer.Write(String.Join(\"\", queue));\n Writer.Flush();\n }\n \n static void ReverseArray(ref int[] array, int left, int right)\n {\n if (right < left) return;\n\n var middle = left + (right - left) / 2;\n for (var i = left; i <= middle; i++)\n {\n Swap(ref array[i], ref array[right + left - i]);\n }\n }\n\n static void Swap(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n char[] q = Console.ReadLine().ToCharArray();\n int i = 0;\n while (s[1] != 0)\n {\n while (i < q.Length - 1)\n {\n if (q[i] == 'B' && q[i + 1] == 'G')\n {\n q[i] = 'G';\n q[i + 1] = 'B';\n i++;\n }\n i++;\n }\n s[1]--;\n i = 0;\n }\n Console.WriteLine(q);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n const int BufferSize = (1 << 10) * 10;\n\n static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);\n\n static void Main(string[] args)\n {\n //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};\n //thread.Start();\n Solve();\n \n //Console.ReadKey();\n }\n\n static void Solve()\n {\n var n = NextNumber();\n var t = NextNumber();\n\n Reader.Read();\n\n var queue = new char[n + 1];\n for (var i = 0; i < n; i++)\n {\n queue[i] = (char) Reader.Read();\n }\n \n for (var i = 0; i < t; i++)\n {\n for (var j = 0; j < n - 1; j++)\n {\n if (queue[j] == 'B' && queue[j + 1] == 'G')\n {\n Swap(ref queue[j], ref queue[j + 1]);\n j++;\n }\n }\n }\n\n for (var i = 0; i < n; i++)\n {\n Writer.Write(queue[i]);\n }\n\n Writer.Flush();\n }\n \n static void ReverseArray(ref int[] array, int left, int right)\n {\n if (right < left) return;\n\n var middle = left + (right - left) / 2;\n for (var i = left; i <= middle; i++)\n {\n Swap(ref array[i], ref array[right + left - i]);\n }\n }\n\n static void Swap(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n const int BufferSize = (1 << 10) * 10;\n\n static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);\n\n static void Main(string[] args)\n {\n //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};\n //thread.Start();\n Solve();\n \n //Console.ReadKey();\n }\n\n static void Solve()\n {\n var n = NextNumber();\n var t = NextNumber();\n\n Reader.Read();\n\n var queue = new List(n);\n for (var i = 0; i < n; i++)\n {\n queue.Add((char) Reader.Read());\n }\n\n for (var i = 0; i < t; i++)\n {\n for (var j = 0; j < n - 1; j++)\n {\n if (queue[j] == 'B' && queue[j + 1] == 'G')\n {\n Swap(queue, j, j + 1);\n j++;\n }\n }\n }\n\n for (var i = 0; i < n; i++)\n {\n Writer.Write(queue[i]);\n }\n\n Writer.Flush();\n }\n \n static void ReverseArray(ref int[] array, int left, int right)\n {\n if (right < left) return;\n\n var middle = left + (right - left) / 2;\n for (var i = left; i <= middle; i++)\n {\n Swap(ref array[i], ref array[right + left - i]);\n }\n }\n\n static void Swap(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray()[1];\n var cs = Console.ReadLine().ToCharArray();\n while (t > 0) {\n for (var i = 0 ; i < cs.Length - 1 ; i++) {\n if (cs[i] == 'B' && cs[i+1] == 'G') {\n cs[i] = 'G';\n cs[i+1] = 'B';\n i++;\n }\n }\n t--;\n }\n Console.WriteLine(new string(cs));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n const int BufferSize = (1 << 10) * 10;\n\n static readonly StreamReader Reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n static readonly StreamWriter Writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize, false);\n\n static void Main(string[] args)\n {\n //var thread = new Thread(Solve) {Priority = ThreadPriority.Highest};\n //thread.Start();\n Solve();\n \n //Console.ReadKey();\n }\n\n static void Solve()\n {\n var n = NextNumber();\n var t = NextNumber();\n\n var queue = new List(n);\n for (var i = 0; i < n; )\n {\n var symbol = (char) Reader.Read();\n\n if (char.IsLetter(symbol))\n {\n queue.Add(symbol);\n i++;\n }\n }\n\n for (var i = 0; i < t; i++)\n {\n for (var j = 0; j < n - 1; j++)\n {\n if (queue[j] == 'B' && queue[j + 1] == 'G')\n {\n Swap(queue, j, j + 1);\n j++;\n }\n }\n }\n\n for (var i = 0; i < n; i++)\n {\n Writer.Write(queue[i]);\n }\n Writer.Flush();\n }\n \n static void ReverseArray(ref int[] array, int left, int right)\n {\n if (right < left) return;\n\n var middle = left + (right - left) / 2;\n for (var i = left; i <= middle; i++)\n {\n Swap(ref array[i], ref array[right + left - i]);\n }\n }\n\n static void Swap(ref T firstElement, ref T secondElement)\n {\n var temp = firstElement;\n firstElement = secondElement;\n secondElement = temp;\n }\n\n static void Swap(IList collection, int firstIndex, int secondIndex)\n {\n var temp = collection[firstIndex];\n collection[firstIndex] = collection[secondIndex];\n collection[secondIndex] = temp;\n }\n\n static int NextNumber()\n {\n var resultNumber = 0;\n var isNegative = false;\n int symbol;\n\n do\n {\n symbol = Reader.Read();\n switch (symbol)\n {\n case '-':\n isNegative = true;\n break;\n case '.':\n return 1;\n case -1:\n return isNegative ? -resultNumber : resultNumber;\n }\n\n if (symbol >= 'a' && symbol <= 'z')\n {\n return -1;\n }\n } while (symbol < '0' || symbol > '9');\n\n resultNumber = symbol - '0';\n while (true)\n {\n symbol = Reader.Read();\n if (symbol < '0' || symbol > '9')\n {\n return isNegative ? -resultNumber : resultNumber;\n }\n\n resultNumber *= 10;\n resultNumber += symbol - '0';\n }\n }\n\n static int ReadNumber()\n {\n return int.Parse(Reader.ReadLine());\n }\n\n static long ReadLongNumber()\n {\n return long.Parse(Reader.ReadLine());\n }\n\n static int[] ReadArray()\n {\n var inputLine = Reader.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\n var resultArray = new int[inputLine.Length];\n for (var i = 0; i < inputLine.Length; i++)\n {\n resultArray[i] = int.Parse(inputLine[i]);\n }\n\n return resultArray;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var roundCnt = input[1];\n var que = Console.ReadLine();\n\n string swapped = string.Empty;\n int iNumber = -1;\n\n List newstring = new List();\n newstring.AddRange(que.ToList());\n\n for (var j = 0; j < roundCnt; j++)\n {\n for (var i = 0; i < newstring.Count; i++)\n {\n if (i != iNumber)// if not swapped \n {\n if ((i + 1 <= newstring.Count - 1) && (newstring[i].ToString() == \"B\") && (newstring[i + 1].ToString() == \"G\")) //if it's B and next one is G\n {\n var temp = newstring[i];\n newstring[i] = newstring[i + 1]; // do swapp\n newstring[i + 1] = temp;\n iNumber = i + 1;\n }\n }\n }\n iNumber = -1;\n }\n\n Console.WriteLine(string.Join(\"\", newstring.Select(x => x.ToString())));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp57\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = inp0[0];\n int t = inp0[1];\n char[] c = Console.ReadLine().ToCharArray();\n for (int i = 0; i < t; i++)\n {\n for (int j = 0; j < n-1; j++)\n {\n if (c[j]=='B'&&c[j+1]=='G')\n {\n c[j] = 'G';\n c[j + 1] = 'B';\n j++;\n }\n }\n }\n foreach (char item in c)\n {\n Console.Write(item);\n }\n\n }\n \n \n }\n}\n"}, {"source_code": "using System; \nusing System.Collections.Generic; \nusing System.Linq; \nusing System.Text; \nusing System.Threading.Tasks;\n\nnamespace add \n{ \n class Program \n { \n static void Main(string[] args) \n {\n string s=Console.ReadLine();\n string str=Console.ReadLine();\n int n=int.Parse(s.Split(' ')[0]);\n int t=int.Parse(s.Split(' ')[1]);\n for(int j=0;j newArr.Length - 1))\n {\n if (newArr[i] == 'B' && newArr[i + 1] == 'G')\n {\n temp = newArr[i];\n newArr[i] = newArr[i + 1];\n newArr[i + 1] = temp;\n i += 1;\n }\n }\n }\n t--;\n }\n \n Console.WriteLine(new string(newArr));\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Runtime.ExceptionServices;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Codeforces\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToList();\n var queue = Console.ReadLine();\n \n var n = input[0];\n var k = input[1];\n\n for (var i = 0; i < k; i++)\n {\n var replace = new StringBuilder();\n \n for (var j = 0; j < n; j++)\n {\n var a = queue[j];\n\n if (a == 'B')\n { \n if (j < n - 1 && queue[j + 1] == 'G')\n {\n replace.Append($\"{queue[j + 1]}{queue[j]}\");\n j++;\n continue; \n }\n }\n\n replace.Append($\"{queue[j]}\");\n }\n\n queue = replace.ToString();\n }\n\n Console.WriteLine(queue);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace QueryInCitchen\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] array = Console.ReadLine().Split(' ')\n .Select(int.Parse).ToArray();\n StringBuilder query = new StringBuilder(Console.ReadLine());\n for (int i = 0; i < array[1]; i++)\n {\n for (int j = 0; j < query.Length; j++)\n {\n try\n {\n if (query[j] == 'B' && query[j + 1] == 'G')\n {\n char tmp = query[j];\n query[j] = query[j + 1];\n query[j + 1] = tmp;\n j++;\n }\n }\n catch (IndexOutOfRangeException)\n {\n continue;\n }\n }\n }\n Console.WriteLine(query);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select((s) => int.Parse(s)).ToList();\n var n = input[0];\n var t = input[1];\n\n var queue = Console.ReadLine().ToArray();\n\n while (t-- > 0)\n {\n for (int i = 0; i < queue.Count() - 1; i++)\n {\n var isBoy = queue[i] == 'B';\n var isNextBoy = queue[i + 1] == 'B';\n\n if (isBoy && !isNextBoy)\n {\n queue[i] = 'G';\n queue[i + 1] = 'B';\n i++;\n }\n }\n }\n Console.WriteLine(new string(queue));\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Program266B\n {\n public static string GetFinalPositions(int queuelength, int timeticks, string queue)\n {\n char[] students = queue.ToCharArray();\n\n for (int timetick = 0; timetick < timeticks; timetick++)\n {\n for (int s = 0; s < queuelength-1; s++)\n {\n if (students[s] == 'B' && students[s + 1] == 'G')\n {\n students[s] = 'G';\n students[s + 1] = 'B';\n s++;\n }\n }\n }\n\n return new String(students);\n }\n\n \n public static void Main()\n {\n try\n {\n string length_and_time = Console.ReadLine().Trim();\n int queuelength = int.Parse(length_and_time.Split(' ')[0]);\n int timeticks = int.Parse(length_and_time.Split(' ')[1]);\n\n string positions = Console.ReadLine().Trim();\n Console.WriteLine(GetFinalPositions(queuelength, timeticks, positions));\n }\n catch (Exception x)\n {\n Console.WriteLine(x);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n ushort n = Convert.ToUInt16(data[0]), t = Convert.ToUInt16(data[1]);\n string peopl = Console.ReadLine().ToUpper();\n bool flag = false;\n char[] peopls = peopl.ToArray();\n peopl = null;\n data = null;\n\n n -= 1;\n while (t!=0)\n {\n for (int i = 0; i < n ; i++)\n {\n if (peopls[i] == 'B' && peopls[i + 1] == 'G' && !flag)\n {\n peopls[i] = 'G';\n peopls[i + 1] = 'B';\n flag = true;\n }\n else\n flag = false;\n }\n t--;\n flag = false;\n }\n \n string res = new string(peopls);\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Mail;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace QueueAtTheSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] strArr = str.Split(null);\n Int32.TryParse(strArr[1], out int k);\n string line = Console.ReadLine();\n char[] arr = line.ToCharArray();\n line = \"\";\n for (int i =0;i(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n static void Main(string[] args)\n {\n string[] token = (Console.ReadLine()).Split();\n int t = Int32.Parse(token[1]);\n string str = Console.ReadLine();\n\n for (int k = 0; k < t; k++)\n {\n int i = 0;\n while (i < str.Length - 1)\n {\n if ((str[i + 1] == 'G') & (str[i] == 'B'))\n {\n str = str.Remove(i, 1);\n str = str.Insert(i + 1, \"B\");\n i += 2;\n\n }\n else i++;\n }\n }\n System.Console.WriteLine(str);\n //System.Console.ReadKey();\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Queue_at_the_School\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = int.Parse(a.Substring(0, a.IndexOf(' ')));\n int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));\n string b = Console.ReadLine();\n string c = \"\";\n for (int j = 0; j < t; j++)\n {\n c = \"\";\n for (int i = 0; i < n; i++)\n {\n if (b[i] == 'B')\n {\n if (i == b.Length - 1)\n {\n c += \"B\";\n break;\n }\n if (b[i + 1] == 'G')\n {\n c += 'G';\n i++;\n }\n c += 'B';\n }\n else\n {\n c += \"G\";\n }\n }\n b = c;\n }\n Console.WriteLine(c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s =Console.ReadLine().Split(' ');\n int chel = Convert.ToInt32(s[0]);\n int takt = Convert.ToInt32(s[1]);\n char boy = 'B';\n char temp=' ';\n string s1 = Console.ReadLine();\n char[] ar = new char[s1.Length];\n for (int i=0;i int.Parse(x))\n .OrderBy(x => x)\n .ToArray();\n\n string str = Console.ReadLine();\n\n for (int i=0;i Convert.ToInt32(s)).ToList();\n var seconds = input[1];\n var str = Console.ReadLine();\n var result = string.Empty;\n\n while (seconds > 0){\n result = string.Empty;\n for (int i = 0; i < str.Length; i++){\n if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){\n result += \"GB\";\n i++;\n continue;\n }\n\n result += str[i];\n }\n\n str = result;\n seconds--;\n }\n \n\n //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/\n\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForcecTrain\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n char[] kafka = Console.ReadLine().ToCharArray();\n int seconds = 0;\n while (seconds < input[1])\n {\n int i = 0;\n while (i < kafka.Length)\n {\n if (i + 1 < kafka.Length && kafka[i] == 'B' && kafka[i + 1] == 'G')\n {\n kafka[i] = 'G';\n kafka[i + 1] = 'B';\n i++;\n }\n i++;\n }\n seconds++;\n }\n Console.Write(kafka);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str1 = Console.ReadLine().Split(' ');\n var str2 = Console.ReadLine().ToCharArray();\n var n = int.Parse(str1[0]);\n var t = int.Parse(str1[1]);\n \n for (int i = 0; i < t; i++)\n {\n for (int j = 0; j < n - 1; j++)\n {\n var c1 = str2[j];\n var c2 = str2[j+1];\n if (c1 == 'B' && c2 == 'G')\n {\n str2[j] = 'G';\n str2[j+1] = 'B';\n j++;\n }\n }\n }\n\n Console.WriteLine(new string(str2));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace theater\n{\n class CodeForces\n {\n static void Main(string[] args)\n {\n int[] UserInputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n char[] Students = Console.ReadLine().ToCharArray();\n\n for (int i = 1; i <= UserInputs[1]; i++)\n {\n for (int j = 0; j < Students.Length; j++)\n {\n if (j != Students.Length - 1)\n {\n if (Students[j] != 'G')\n {\n if (Students[j + 1] == 'G')\n {\n char temp = Students[j];\n Students[j] = Students[j + 1];\n Students[j + 1] = temp;\n j++;\n }\n else\n {\n continue;\n }\n }\n }\n\n }\n\n }\n String st = new String(Students);\n Console.WriteLine(st);\n\n\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n1 = Convert.ToInt32(input[0]);\n int n2 = Convert.ToInt32(input[1]);\n string queue = Console.ReadLine();\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < n2; i++)\n {\n for (int j = 0; j < queue.Length; j++)\n {\n if (j < queue.Length - 1)\n {\n if (queue[j] == 'B' && queue[j + 1] == 'G')\n {\n sb.Append('G');\n sb.Append('B');\n j++;\n }\n else\n sb.Append(queue[j]);\n }\n else\n sb.Append(queue[j]);\n }\n queue = sb.ToString();\n sb.Clear();\n }\n\n Console.WriteLine(queue);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nclass Program\n{\n static void Main()\n {\n List input = ReadInputParseToList();\n List c = new List();\n int n = input[0];\n int time = input[1];\n string s = Console.ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n c.Add(s[i]);\n }\n\n for (int t = 0; t < time; t++)\n {\n for (int i = 0; i < n - 1; i++)\n {\n if (c[i] == 'B' && c[i + 1] == 'G')\n {\n //var temp = c[i];\n c[i] = 'G';\n c[i + 1] = 'B';\n i++;\n\n }\n }\n\n }\n Console.WriteLine(string.Join(\"\", c));\n //Console.ReadKey();\n }\n private static List ReadInputParseToList()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n}\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(String[] args)\n {\n string input = Console.ReadLine();\n string[] inputs = input.Split(\" \");\n int queueLength = Int32.Parse(inputs[0]);\n int time = Int32.Parse(inputs[1]);\n\n char[] queue = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < time; i++)\n {\n for (int j = 0; j < queueLength; j++)\n {\n\n if (j + 1 < queueLength)\n {\n if(queue[j] == 'B' && queue[j + 1] == 'G')\n {\n queue[j + 1] = 'B';\n queue[j] = 'G';\n j++;\n }\n }\n }\n }\n\n Console.WriteLine(new string(queue));\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ohMy\n{\n class QueueAtSchool\n {\n static void Main()\n { \n string[] input = Console.ReadLine().Split(\" \"); ;\n byte seconds;\n\n\n seconds = byte.Parse(input[1]);\n\n string currentLine = Console.ReadLine();\n\n for(byte i = 0; i< seconds; i++)\n {\n currentLine = currentLine.Replace(\"BG\", \"GB\");\n }\n\n Console.WriteLine(currentLine);\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string reader = Console.ReadLine();\n int[] DataEntered = reader.Split(' ').Select(x => int.Parse(x)).ToArray();\n int n = DataEntered.First(); int t = DataEntered.Last();\n\n string Output = Console.ReadLine();\n for (int i = 1; i <= t; i++)\n {\n Output = Output.Replace(\"BG\", \"GB\");\n }\n\n Console.WriteLine(Output);\n }\n\n public static void Swap (ref char a,ref char b)\n {\n char tmp = a; a = b; b = tmp; \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace QueueAtSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine().Split()[1]);\n Console.WriteLine(FinalQueue(Console.ReadLine(), num));\n }\n\n public static string FinalQueue(string initial)\n {\n char[] final = initial.ToCharArray();\n for (int i = 0; i < initial.Length-1; i++)\n {\n if (initial[i].Equals('B') && initial[i+1].Equals('G'))\n {\n (final[i], final[i + 1]) = (final[i + 1], final[i]);\n i += 1;\n }\n }\n return new string(final);\n }\n\n public static string FinalQueue(string initial, int timesteps)\n {\n string res = initial;\n for (int i = 0; i < timesteps; i++)\n {\n res = FinalQueue(res);\n }\n return res;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace codeforcespst\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n char[] line = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < int.Parse(input[1]); i++)\n {\n for (int x = 0; x < int.Parse(input[0]) - 1; x++)\n {\n if (line[x] == 'B' && line[x + 1] == 'G')\n {\n line[x] = 'G';\n line[x + 1] = 'B';\n x++;\n }\n }\n }\n\n Console.WriteLine(line);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\n\nnamespace dhsmfeh_zhelddmf_gkqslek\n{\n public class Priority_Queue\n {\n static List priority_queue;\n\n public Priority_Queue()\n {\n priority_queue = new List();\n }\n\n public void Push(int node, int weight)\n {\n int count = priority_queue.Count();\n int index = -1;\n\n if(count == 0)\n {\n priority_queue.Add(new int[] { node, weight });\n return;\n }\n for(int i = count; --i > -1;)\n {\n if(priority_queue[i][1] < weight)\n {\n index = i + 1;\n break;\n }\n }\n if (index.Equals(-1)) { index = 0; }\n priority_queue.Insert(index, new int[] { node, weight });\n }\n\n public int Pop()\n {\n int[] arr = priority_queue[0];\n priority_queue.RemoveAt(0);\n return arr[0];\n }\n\n public int count\n {\n get { return priority_queue.Count(); }\n }\n \n\n }\n class Program\n {\n static StringBuilder sb = new StringBuilder();\n static void Main(string[] args)\n {\n int[] init = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n string str = Console.ReadLine();\n\n for(int i =0; i= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n\n int n = DATA[0], t = DATA[1];\n List Info = Console.ReadLine().ToCharArray().ToList();\n\n //5 2 BBGBBG GBBGBB\n int FirstGirl = Info.IndexOf('G');\n\n while (FirstGirl != -1)\n {\n //BBGBGBGB ==> GGBGBBBB\n int Counter = 0;\n for (int i = FirstGirl-1; i >= 0; i--)\n {\n if (Info[i] != 'B' || Counter >= t) { break; } else Counter++;\n }\n Info[FirstGirl] = 'B';\n Info[(FirstGirl - Counter)] = '*';\n FirstGirl = Info.IndexOf('G');\n }\n Console.WriteLine(string.Join(\"\",Info).Replace('*','G'));\n }\n\n private static IEnumerable Permutate(string source)\n {\n if (source.Length == 1) return new List { source };\n\n var permutations = from c in source\n from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n select c + p;\n\n return permutations;\n }\n\n\n}\n\n\n\n\n\n//private static IEnumerable Permutate(string source)\n//{\n// if (source.Length == 1) return new List { source };\n\n// var permutations = from c in source\n// from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n// select c + p;\n\n// return permutations;\n//}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n \n int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n\n int n = DATA[0], t = DATA[1];\n List Info = Console.ReadLine().ToCharArray().ToList();\n\n //5 2\n //BGGBG BGGBGBB\n //output\n //GGBGB\n int Swapped = 0;\n for (int w = 0; w < n; w++)\n {\n List m = Info;\n for (int i = 1; i <= (t); i++)\n { //BGG\n //if (Info[w] == 'B')\n {\n if (w+i < n)\n {\n if (Info[w + i] == Info[w + i - 1]) continue;\n if (Info[w + i] == 'G') { m[w + i] = 'B'; Swapped++; }\n if (Info[w + i - 1] == 'B') { m[w + i - 1] = 'G'; }\n }\n }\n }\n // 0 3\n Info = m;\n \n if (Swapped > 0) w += t;\n Swapped = 0;\n }\n\n Console.WriteLine(string.Join(\"\",Info));\n }\n\n private static IEnumerable Permutate(string source)\n {\n if (source.Length == 1) return new List { source };\n\n var permutations = from c in source\n from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n select c + p;\n\n return permutations;\n }\n\n\n}\n\n\n\n\n\n//private static IEnumerable Permutate(string source)\n//{\n// if (source.Length == 1) return new List { source };\n\n// var permutations = from c in source\n// from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n// select c + p;\n\n// return permutations;\n//}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n var InData = Console.ReadLine().Split(' ').Select(x => int.Parse(x));\n int n = InData.First(), t = InData.Last();\n\n string[] Input = Console.ReadLine().Select(x => x.ToString()).ToArray();\n int Bindex = Input.ToList().IndexOf(\"B\");\n int currentIndex = Bindex;\n while (Bindex != -1)\n {\n int u = 0;\n\n for (int i = Bindex + 1; i < Input.Length; i++)\n {\n if (u >= t) break;\n if (Input[i] == \"G\")\n {\n Swap(ref Input[currentIndex], ref Input[i]);\n currentIndex = i;\n }\n if (Input[i] != \"F\")u++;\n }\n Input[currentIndex] = \"F\";\n Bindex = Input.ToList().IndexOf(\"B\");\n currentIndex = Bindex;\n }\n\n Console.WriteLine(string.Join(\"\", Input).Replace(\"F\", \"B\"));\n }\n\n static void Swap(ref string O, ref string N)\n {\n string tmp = O; O = N; N = tmp;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Win32.SafeHandles;\n\nnamespace QueueAtSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = input[0];\n int t = input[1];\n\n char[] kids = Console.ReadLine().ToArray();\n\n for (int i = 0; i < t; i++)\n {\n // Musim najit vsechny pripady kdy je kluk v rade pred holkou a prohodit je\n for (int j = 0; j < n; j++)\n {\n if(j + 1 >= n)\n break;\n\n char boy = kids[j];\n\n if (boy == 'B')\n {\n char girl = kids[j + 1];\n\n if (girl == 'G')\n {\n kids[j] = girl;\n kids[j + 1] = boy;\n j += 2;\n }\n }\n }\n }\n\n string result = new string(kids);\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sumB =0;\n string line = Console.ReadLine();\n string line1 = Console.ReadLine();\n int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));\n int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));\n int counter = 0;\n int counter1 = 0;\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n sumB++;\n }\n }\n int[] posB = new int[sumB];\n int[] numG = new int[sumB];\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n posB[counter] = i;\n counter++;\n }\n }\n counter = 0;\n for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n numG[counter] = counter1;\n counter++;\n counter1 = 0;\n }\n else counter1++;\n if (i == line1.Length - 1)\n {\n numG[counter] = counter1;\n break;\n }\n }\n int v = 0;\n for (int j = numG.Length - 1; j >= 0; j--)\n {\n if (numG[j] != 0)\n {\n if (x>numG[j])\n {\n line1 = line1.Remove(posB[j], 1);\n line1 = line1.Insert(posB[j] + 1, \"B\");\n if (j == 0) break;\n numG[j - 1] = numG[j - 1] + numG[j];\n }\n if (x int.Parse(x.ToString()));\n int n = _reader.First(), t = _reader.Last();\n List Output = Console.ReadLine().Select(x => x.ToString()).ToList();\n\n int IndexofB = Output.IndexOf(\"B\");\n\n while (IndexofB > -1)\n {\n string[] Modify = Output.Skip(IndexofB).Take(t + 1)/*.OrderByDescending(x => Convert.ToChar(x))*/.ToArray();\n int Lindex = Modify.ToList().IndexOf(\"B\");\n int u = 0;//BBGBGBGB\n for (int i = Lindex; i < Modify.Length; i++)\n {\n if (Modify[i] == \"G\")\n {\n Swap(ref Modify[i], ref Modify[Lindex]);\n Lindex = i;\n } \n }\n\n Modify[Lindex] = \"*\";\n\n for (int i = IndexofB; i < Output.Count; i++)\n {\n Output[i] = Modify[u];\n u++;\n if (u == (Lindex+1)) break;\n }\n\n IndexofB = Output.IndexOf(\"B\");\n }\n Console.WriteLine(string.Join(\"\", Output).Replace(\"*\", \"B\"));\n }\n static void Swap(ref string p , ref string i)\n {\n string t = p; p = i; i = t;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sumB =0;\n string line = Console.ReadLine();\n string line1 = Console.ReadLine();\n int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));\n int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));\n int counter = 0;\n int counter1 = 0;\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n sumB++;\n }\n }\n int[] posB = new int[sumB];\n int[] numG = new int[sumB];\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n posB[counter] = i;\n counter++;\n }\n }\n counter = 0;\n for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n numG[counter] = counter1;\n counter++;\n counter1 = 0;\n }\n else counter1++;\n if (i == line1.Length - 1)\n {\n numG[counter] = counter1;\n break;\n }\n }\n for (int i = 0; i < sumB; i++)\n {\n if(x<=numG[i])\n {\n line1=line1.Remove(posB[i], 1);\n line1=line1.Insert(posB[i] +x, \"B\");\n }\n else if(x>numG[i])\n {\n line1 = line1.Remove(posB[i], 1);\n line1 = line1.Insert(posB[i] + numG[i], \"B\");\n }\n }\n Console.WriteLine(line1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n\n int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n\n int n = DATA[0], t = DATA[1];\n List Info = Console.ReadLine().ToCharArray().ToList();\n\n //5 2 BBGBBG GBBGBB\n int FirstGirl = Info.IndexOf('G');\n\n while (FirstGirl != -1)\n {\n //BBGBGBGB ==> GGBGBBBB\n int Counter = 0;\n for (int i = FirstGirl-1; i >= 0; i--)\n {\n if (Info[i] != 'B' || Counter >= t) { break; } else Counter++;\n }\n Info[FirstGirl] = 'B';\n Info[(FirstGirl - Counter)] = '*';\n FirstGirl = Info.IndexOf('G');\n }\n Console.WriteLine(string.Join(\"\",Info).Replace('*','G'));\n }\n\n private static IEnumerable Permutate(string source)\n {\n if (source.Length == 1) return new List { source };\n\n var permutations = from c in source\n from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n select c + p;\n\n return permutations;\n }\n\n\n}\n\n\n\n\n\n//private static IEnumerable Permutate(string source)\n//{\n// if (source.Length == 1) return new List { source };\n\n// var permutations = from c in source\n// from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n// select c + p;\n\n// return permutations;\n//}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Queue_at_the_School\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = int.Parse(a.Substring(0, a.IndexOf(' ')));\n int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));\n string b = Console.ReadLine();\n string c = \"\";\n for(int i = 0; i < n; i++)\n {\n if(b[i] == 'B')\n {\n if (i == b.Length - 1)\n {\n c += \"B\";\n break;\n }\n for(int j = i + 1; j <= i + t; j++)\n {\n if(j == b.Length - 1)\n {\n if (b[j] == 'G')\n {\n c += \"G\";\n }\n break;\n }\n if (b[j] == 'G')\n {\n c += \"G\";\n }\n }\n c += \"B\";\n i += t;\n }\n else\n {\n c += b[i];\n }\n }\n Console.WriteLine(c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Main(string[] args)\n {\n //while (true)\n {\n #region A. Boy or Girl\n ///*\n\n // wjmzbmr\n\n // */\n //int Notdistinct = 0;\n\n //string Name = Console.ReadLine();\n //for (int i = 0; i < Name.Length; i++)\n //{\n // //Console.WriteLine(i);\n // for (int j = i+1; j < Name.Length; j++)\n // {\n // //Console.WriteLine(j);\n // //Console.WriteLine(Name[i] + \"===\" + Name[j]);\n // if (Name[i]==Name[j])\n // {\n // Notdistinct++;\n // //Console.WriteLine(Notdistinct);\n\n\n // }\n\n // }\n\n //}\n ////Console.WriteLine( Name.Length +\"-\"+Notdistinct+\"=\" +(Name.Length - Notdistinct) );\n\n\n ////Console.WriteLine(\"Result%2=\"+(Name.Length - Notdistinct) % 2);\n\n //if ((Name.Length-Notdistinct)%2==0)\n //{\n // if ((Name.Length - Notdistinct)<0)\n // {\n // Console.WriteLine(\"IGNORE HIM!\");\n // }\n // else\n // {\n // Console.WriteLine(\"CHAT WITH HER!\");\n // }\n\n //}\n //else\n //{\n\n // Console.WriteLine(\"IGNORE HIM!\");\n\n\n //}\n\n #endregion\n\n\n\n\n #region Queue at the School\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int t1 = 0; \n int t = int.Parse(tokens[1]);\n char [] Temp =new char[50] ;\n string x=\"\"; \n\n string Quee = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n Temp[i] = Quee[i];\n\n }\n\n //while (true)\n //{\n // try\n // {\n // if (Temp[t1] == Convert.ToChar(\"B\"))\n // {\n // if (Temp[t1 + 1] == Convert.ToChar(\"G\"))\n // {\n // Temp[t1] = Convert.ToChar(\"G\");\n // Temp[t1 + 1] = Convert.ToChar(\"B\");\n // t1++;\n // }\n\n // }\n // t1++;\n // if (t1 >= Quee.Length)\n // {\n // break;\n // }\n // }\n // catch (Exception)\n // {\n\n // throw;\n // }\n\n // }\n for (int ij = 0; ij < t; ij++)\n {\n for (int i = 0; i < n; i++)\n {\n if (Temp[i] == Convert.ToChar(\"B\"))\n {\n if (Temp[i + 1] == Convert.ToChar(\"G\"))\n {\n Temp[i] = Convert.ToChar(\"G\");\n Temp[i + 1] = Convert.ToChar(\"B\");\n i++;\n }\n }\n\n\n }\n }\n \n Console.WriteLine(Temp ); \n \n #endregion\n \n // Console.ReadKey();\n }\n\n\n\n\n }\n \n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sumB =0;\n string line = Console.ReadLine();\n string line1 = Console.ReadLine();\n int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));\n int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));\n int counter = 0;\n int counter1 = 0;\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n sumB++;\n }\n }\n int[] posB = new int[sumB];\n int[] numG = new int[sumB];\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n posB[counter] = i;\n counter++;\n }\n }\n counter = 0;\n for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n numG[counter] = counter1;\n counter++;\n counter1 = 0;\n }\n else counter1++;\n if (i == line1.Length - 1)\n {\n numG[counter] = counter1;\n break;\n }\n }\n for (int i = 0; i < sumB; i++)\n {\n if(x<=numG[i])\n {\n line1=line1.Remove(posB[i], 1);\n line1=line1.Insert(posB[i] +x, \"B\");\n }\n else if(x>numG[i])\n {\n line1 = line1.Remove(posB[i], 1);\n line1 = line1.Insert(posB[i] + numG[i], \"B\");\n }\n }\n Console.WriteLine(line1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0447\u0435\u0440\u0435\u0434\u044c_\u0432_\u0448\u043a\u043e\u043b\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nt = Console.ReadLine().Split();\n int n = Convert.ToInt32(nt[0]);\n int t = Convert.ToInt32(nt[1]) + 1;\n string lineString = Console.ReadLine();\n char[] lineMas = new char[n];\n for (int i = 0; i < lineString.Length; i++)\n {\n lineMas[i] = Convert.ToChar(lineString[i]);\n }\n int count = 0;\n for (int i = 0; i < n - 1; i++)\n {\n \n if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)\n {\n lineMas[i] = 'G';\n lineMas[i + 1] = 'B';\n count++;\n }\n if (count == t)\n {\n break;\n }\n }\n for (int i = 0; i < lineMas.Length; i++)\n {\n Console.Write(lineMas[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine().Trim();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sumB =0;\n string line = Console.ReadLine();\n string line1 = Console.ReadLine();\n int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));\n int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));\n int counter = 0;\n int counter1 = 0;\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n sumB++;\n }\n }\n int[] posB = new int[sumB];\n int[] numG = new int[sumB];\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n posB[counter] = i;\n counter++;\n }\n }\n counter = 0;\n for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n numG[counter] = counter1;\n counter++;\n counter1 = 0;\n }\n else counter1++;\n if (i == line1.Length - 1)\n {\n numG[counter] = counter1;\n break;\n }\n }\n int v = 0;\n for (int j = numG.Length - 1; j >= 0; j--)\n {\n if (numG[j] != 0)\n {\n if (x>numG[j])\n {\n line1 = line1.Remove(posB[j], 1);\n line1 = line1.Insert(posB[j] + 1, \"B\");\n if (j == 0) break;\n numG[j - 1] = numG[j - 1] + numG[j];\n }\n if (x= 0; j--)\n {\n if (numG[j] != 0)\n {\n line1 = line1.Remove(posB[j], 1);\n line1 = line1.Insert(posB[j] + 1, \"B\");\n if (j == 0) break;\n numG[j - 1] = numG[j - 1] + numG[j];\n } \n }\n Console.WriteLine(line1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Queue_at_the_School\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = int.Parse(a.Substring(0, a.IndexOf(' ')));\n int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));\n int help = t;\n string b = Console.ReadLine(), c = \"\";\n for (int i = 0; i < n; i++)\n {\n help = t;\n if (b[i] == 'B')\n {\n while (help != 0)\n {\n if (i == b.Length - 1)\n {\n break;\n }\n if (b[i + 1] == 'G')\n {\n c += \"G\";\n i++;\n help--;\n }\n else if(b[i+1]=='B')\n {\n break;\n }\n }\n c += \"B\";\n }\n else\n {\n c += \"G\";\n }\n }\n Console.WriteLine(c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace _266B\n{\n class Program\n {\n static void Main()\n {\n var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];\n string queue = Console.ReadLine();\n for (int i = 1; i <= t; i++)\n {\n queue.Replace(\"BG\", \"GB\");\n } \n Console.WriteLine(queue); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ACM\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tint n = int.Parse(s[0]);\n\t\t\tint k = int.Parse(s[1]);\n\t\t\t\n\t\t\tstring r = Console.ReadLine();\n\t\t\tList boys = new List();\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (r[i] == 'B')\n\t\t\t\t\tboys.Add(i);\n\n\t\t\tint q = Math.Max(boys[boys.Count - 1], n - 1);\n\t\t\tfor (int j = 0; j < k; j++)\n\t\t\t\tfor (int i = 0; i < boys.Count; i++)\n\t\t\t\t\tif (boys[i] < q)\n\t\t\t\t\t\tboys[i]++;\n\n\t\t\tr = \"\";\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (boys.Contains(i))\n\t\t\t\t\tr += 'B';\n\t\t\t\telse\n\t\t\t\t\tr += 'G';\n\t\t\tConsole.WriteLine(r);\n\t\t\t\n\t\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i=0;j--)\n {\n Console.Write(queue[j]);\n }\n\n Console.WriteLine();\n\n\n\n\n\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\n\nnamespace QueueTask\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] StartValue = Console.ReadLine().Split(' ');\n int CountOfHumans = int.Parse(StartValue[0]);\n int HowMaNyTimes = int.Parse(StartValue[1]);\n string Children = Console.ReadLine();\n char[] chs = new char[Children.Length];\n for(int i = 0; i < Children.Length;i++)\n {\n chs[i] = Children[i];\n }\n \n int count = 0;\n bool[] YesOrNo = new bool[chs.Length];\n while (count < HowMaNyTimes)\n {\n for(int i = 0; i < chs.Length; i++)\n {\n if (i + 1 < chs.Length)\n {\n if (chs[i] == 'B' && chs[i + 1] == 'G' && !YesOrNo[i])\n {\n char tmp = chs[i];\n chs[i] = chs[i + 1];\n chs[i + 1] = tmp;\n YesOrNo[i + 1] = true;\n }\n }\n }\n count++;\n YesOrNo = new bool[chs.Length];\n \n foreach (char c in chs)\n Console.Write(c);\n Console.WriteLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\ttry\n\t\t{\n\t\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\t\tint timeStep = int.Parse(inputNum[1]);\n\t\t\t\n\t\t\tchar[] que = Console.ReadLine().ToCharArray();\n\t\t\t\n\t\t\tfor(int i = que.Length - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tif(que[i] == 'B')\n\t\t\t\t{\n\t\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(new String(que));\n\t\t}\n\t\tcatch(Exception ex)\n\t\t{\n\t\t\tConsole.WriteLine(ex.Message);\n\t\t}\n\t\t\n\t\tConsole.ReadLine();\n\t}\n\t\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor(int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif(que[i+1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tchar temp = que[i+1];\n\t\t\tque[i+1] = que[i];\n\t\t\tque[i] = temp;\t\t\t\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x));\n int n = l.First(), t = l.Last();\n List Input = Console.ReadLine().Select(x => x).ToList();\n\n int IndexOF = Input.IndexOf('B');\n\n while (IndexOF > -1)\n {\n char[] xD = Input.Skip(IndexOF).Take(t + 1).ToArray();\n\n int index = 0;\n\n for (int i = 1; i < xD.Length; i++)\n {\n if (xD[i] == '*') continue;\n // if (xD[i] == 'G')\n // {\n Swap(ref xD[i], ref xD[index]);\n index = i;\n //}\n }\n\n xD[index] = '*';\n int u = 0;\n for (int i = IndexOF; i < Input.Count; i++)\n {\n if (u == xD.Length) break;\n Input[i] = xD[u];\n u++;\n }\n\n IndexOF = Input.IndexOf('B');\n }\n\n Console.WriteLine(string.Join(\"\", Input).Replace('*','B'));\n\n }\n\n static void Swap(ref char O, ref char N)\n {\n char tmp = O; O = N; N = tmp;\n }\n\n private static IEnumerable Perms(string source)\n {\n if (source.Length == 1) return new List() { source };\n\n var perm = from l in source\n from _x in Perms(string.Join(\"\", source.Where(x => x != l)))\n select l + _x; ;\n return perm;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nclass test{\n public static void Main(string[] temp){\n int[] NK=Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);\n StringBuilder queue=new StringBuilder(Console.ReadLine());\n for(int i=0;i=0;j--)\n {\n\n newqueu[count-1-j] = queue[j];\n\n if(count%2!=0)\n {\n Console.Write(queue[j]);\n }\n \n \n }\n\n\n\n\n if (count % 2 == 0)\n {\n for (int m = index; m < count; m++)\n {\n Console.Write(newqueu[m]);\n }\n\n for (int f = 0; f < index; f++)\n {\n Console.Write(newqueu[f]);\n }\n }\n \n \n Console.WriteLine();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Problem\n{\n public static void Main()\n {\n int[] nt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nt[0];\n int t = nt[1];\n\n char[] children = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < t; i++)\n {\n for (int j = n - 1; j > 0; j--)\n {\n if (children[j] - children[j - 1] > 0)\n {\n char temp = children[j];\n children[j] = children[j - 1];\n children[j - 1] = temp;\n }\n }\n }\n\n Console.WriteLine(string.Join(string.Empty, children));\n }\n\n private static bool IsLucky(int n)\n {\n return n.ToString().All(c => c == '4' || c == '7');\n }\n}"}, {"source_code": "#define ASD\n#if (Debug)\n#define Trace\n#endif\n#if (ASD)\nusing DS.Common;\nusing DS.Dictionaries;\nusing DS.Graphs;\nusing DS.Heaps;\nusing DS.Lists;\nusing DS.Trees;\nusing DS;\nusing AL;\nusing AL.Common;\nusing AL.Graphs;\nusing AL.Numeric;\nusing AL.Sorting;\n#endif\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing GenericArithmetic;\nusing System.Reflection;\nusing System.Windows;\nusing System.Text.RegularExpressions;\nusing csConsoleforStudy;\nusing System.Resources;\nusing System.Runtime.Serialization;\n\nnamespace csConsoleforStudy\n{\n class Program\n {\n const double MemoryLimit = 2.56;\n const double TimeLimit = 4000;\n static Stream fsr;\n static FileStream fsw;\n static TextReader tr;\n static TextWriter tw;\n static Thread t;\n static Thread mainThread = Thread.CurrentThread;\n static Stopwatch sw = new Stopwatch();\n static DefaultTraceListener Logger;\n static long maxUsedMemory = 0;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CloseStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CheckMemory()\n {\n#if (Debug)\n#endif\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n var l1 = ria();\n var n = l1[0];\n var t = l1[1];\n var l2 = Console.ReadLine();\n char[] State = l2.ToCharArray();\n for (int round = 0; round < t; round++)\n {\n for (int i = n - 1; i >= 0; i--)\n {\n if (i == n - 1)\n {\n }\n else if (i == 0)\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n else\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n }\n }\n\n Console.WriteLine(State);\n }\n\n public char[] swap(char[] str, int a, int b)\n {\n Tuple chars = new Tuple(str[a], str[b]);\n str[a] = chars.Item2;\n str[b] = chars.Item1;\n return str;\n }\n\n#region SolverUtils\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new AE(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n }\n\n static class MyExtensions\n {\n public static string Reverse(this string str)\n {\n StringBuilder sb = new StringBuilder(str.Length);\n for (int i = str.Length - 1; i >= 0; i--)\n {\n sb.Append(str[i]);\n }\n\n return sb.ToString();\n }\n }\n\n#endregion\n struct Pair\n {\n public long X, Y;\n public Pair(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n struct Bit\n {\n bool state;\n public Bit(bool state)\n {\n this.state = state;\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public override string ToString()\n {\n return state.ToString();\n }\n\n public override bool Equals(object other)\n {\n if (other is Bit)\n {\n return state == ((Bit)other).state;\n }\n else\n {\n if ((int)other == 1 && state == true)\n return true;\n else if ((int)other == 0 && state == false)\n return true;\n else\n return base.Equals(other);\n }\n }\n\n public static implicit operator bool (Bit a)\n {\n return a.state;\n }\n\n public static implicit operator Bit(bool a)\n {\n return new Bit(a);\n }\n\n public static implicit operator Bit(int a)\n {\n if (a == 0)\n return new Bit(false);\n return new Bit(true);\n }\n\n public static bool operator ==(Bit a, Bit b)\n {\n return a.state == b.state;\n }\n\n public static bool operator !=(Bit a, Bit b)\n {\n return a.state != b.state;\n }\n\n public static Bit operator !(Bit a)\n {\n return new Bit(!a.state);\n }\n\n public static Bit operator +(Bit a, Bit b)\n {\n return new Bit(a.state || b.state);\n }\n\n public static Bit operator *(Bit a, Bit b)\n {\n return new Bit(a.state && b.state);\n }\n\n public static Bit operator ^(Bit a, Bit b)\n {\n return new Bit(a.state ^ b.state);\n }\n }\n\n#if (MS)\n#endif\n#region Exceptions\n [Serializable]\n internal class IOE : InvalidOperationException\n {\n public IOE()\n {\n }\n\n public IOE(string message): base (message)\n {\n }\n\n public IOE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected IOE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n\n [Serializable]\n internal class AE : ArgumentException\n {\n public AE()\n {\n }\n\n public AE(string message): base (message)\n {\n }\n\n public AE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected AE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n#endregion\n}\n\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n#if (ASD)\n Map.Populate(W, H, defaultValue);\n#endif\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n\n#if (ASD)\n#region DataStructures\nnamespace DS.Common\n{\n public static class Comparers\n {\n public static bool IsNumber(this T value)\n {\n if (value is sbyte)\n return true;\n if (value is byte)\n return true;\n if (value is short)\n return true;\n if (value is ushort)\n return true;\n if (value is int)\n return true;\n if (value is uint)\n return true;\n if (value is long)\n return true;\n if (value is ulong)\n return true;\n if (value is float)\n return true;\n if (value is double)\n return true;\n if (value is decimal)\n return true;\n return false;\n }\n\n public static bool IsEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.Equals(secondValue);\n }\n\n public static bool IsGreaterThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) > 0;\n }\n\n public static bool IsLessThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) < 0;\n }\n\n public static bool IsGreaterThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));\n }\n\n public static bool IsLessThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));\n }\n }\n\n public static class Helpers\n {\n public static void Swap(this IList list, int firstIndex, int secondIndex)\n {\n if (list.Count < 2 || firstIndex == secondIndex)\n return;\n var temp = list[firstIndex];\n list[firstIndex] = list[secondIndex];\n list[secondIndex] = temp;\n }\n\n public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')\n {\n if (string.IsNullOrEmpty(text))\n return text;\n int length = text.Length;\n int cTP = newW - length;\n if (cTP < 0)\n throw new AE(\"New w must be greater than string length.\");\n int pL = cTP / 2 + cTP % 2;\n int pR = cTP / 2;\n StringBuilder rB = new StringBuilder(newW);\n for (int i = 0; i < pL; i++)\n rB.Insert(i, fillerCharacter);\n for (int i = 0; i < length; i++)\n rB.Insert(i + pL, text[i]);\n for (int i = newW - pR; i < newW; i++)\n rB.Insert(i, fillerCharacter);\n return rB.ToString();\n }\n\n public static void Populate(this T[, ] array, int rows, int columns, T defaultValue = default (T))\n {\n for (int i = 0; i < rows; ++i)\n {\n for (int j = 0; j < columns; ++j)\n {\n array[i, j] = defaultValue;\n }\n }\n }\n }\n}\n\nnamespace DS.Dictionaries\n{\n}\n\nnamespace DS.Graphs\n{\n}\n\nnamespace DS.Hashing\n{\n}\n\nnamespace DS.Heaps\n{\n public interface IMaxHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMax();\n T ExtractMax();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMinHeap ToMinHeap();\n }\n\n public interface IMinHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMin();\n T ExtractMin();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMaxHeap ToMaxHeap();\n }\n}\n\nnamespace DS.Lists\n{\n public class ArrayList : IEnumerable\n {\n bool DefaultMaxCapacityIsX64 = true;\n bool IsMaximumCapacityReached = false;\n public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;\n public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;\n private readonly T[] _emptyArray = new T[0];\n private const int _defaultCapacity = 8;\n private T[] _collection;\n private int _size\n {\n get;\n set;\n }\n\n public ArrayList(): this (capacity: 0)\n {\n }\n\n public ArrayList(int capacity)\n {\n if (capacity < 0)\n {\n throw new ArgumentOutOfRangeException();\n }\n else if (capacity == 0)\n {\n _collection = _emptyArray;\n }\n else\n {\n _collection = new T[capacity];\n }\n\n _size = 0;\n }\n\n private void _ensureCapacity(int minCapacity)\n {\n if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)\n {\n int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);\n int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);\n if (newCapacity < minCapacity)\n newCapacity = minCapacity;\n if (newCapacity >= maxCapacity)\n {\n newCapacity = maxCapacity - 1;\n IsMaximumCapacityReached = true;\n }\n\n this._resizeCapacity(newCapacity);\n }\n }\n\n private void _resizeCapacity(int newCapacity)\n {\n if (newCapacity != _collection.Length && newCapacity > _size)\n {\n try\n {\n Array.Resize(ref _collection, newCapacity);\n }\n catch (OutOfMemoryException)\n {\n if (DefaultMaxCapacityIsX64 == true)\n {\n DefaultMaxCapacityIsX64 = false;\n _ensureCapacity(newCapacity);\n }\n\n throw;\n }\n }\n }\n\n public int Count\n {\n get\n {\n return _size;\n }\n }\n\n public int Capacity\n {\n get\n {\n return _collection.Length;\n }\n }\n\n public bool IsEmpty\n {\n get\n {\n return (Count == 0);\n }\n }\n\n public T First\n {\n get\n {\n return _collection[0];\n }\n }\n\n public T Last\n {\n get\n {\n return _collection[Count - 1];\n }\n }\n\n public T this[int index]\n {\n get\n {\n return _collection[index];\n }\n\n set\n {\n _collection[index] = value;\n }\n }\n\n public void Add(T dataItem)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n _collection[_size++] = dataItem;\n }\n\n public void AddRange(IEnumerable elements)\n {\n if (elements == null)\n throw new ArgumentNullException();\n if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (elements.Any())\n {\n _ensureCapacity(_size + elements.Count());\n foreach (var element in elements)\n this.Add(element);\n }\n }\n\n public void AddRepeatedly(T value, int count)\n {\n if (count < 0)\n throw new ArgumentOutOfRangeException();\n if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (count > 0)\n {\n _ensureCapacity(_size + count);\n for (int i = 0; i < count; i++)\n this.Add(value);\n }\n }\n\n public void InsertAt(T dataItem, int index)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n if (index < _size)\n {\n Array.Copy(_collection, index, _collection, index + 1, (_size - index));\n }\n\n _collection[index] = dataItem;\n _size++;\n }\n\n public bool Remove(T dataItem)\n {\n int index = IndexOf(dataItem);\n if (index >= 0)\n {\n RemoveAt(index);\n return true;\n }\n\n return false;\n }\n\n public void RemoveAt(int index)\n {\n _size--;\n if (index < _size)\n {\n Array.Copy(_collection, index + 1, _collection, index, (_size - index));\n }\n\n _collection[_size] = default (T);\n }\n\n public void Clear()\n {\n if (_size > 0)\n {\n _size = 0;\n Array.Clear(_collection, 0, _size);\n _collection = _emptyArray;\n }\n }\n\n public void Resize(int newSize)\n {\n Resize(newSize, default (T));\n }\n\n public void Resize(int newSize, T defaultValue)\n {\n int currentSize = this.Count;\n if (newSize < currentSize)\n {\n this._ensureCapacity(newSize);\n }\n else if (newSize > currentSize)\n {\n if (newSize > this._collection.Length)\n this._ensureCapacity(newSize + 1);\n this.AddRange(Enumerable.Repeat(defaultValue, newSize - currentSize));\n }\n }\n\n public void Reverse()\n {\n Reverse(0, _size);\n }\n\n public void Reverse(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n Array.Reverse(_collection, startIndex, count);\n }\n\n public void ForEach(Action action)\n {\n if (action == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n action(_collection[i]);\n }\n }\n\n public bool Contains(T dataItem)\n {\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n EqualityComparer comparer = EqualityComparer.Default;\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Contains(T dataItem, IEqualityComparer comparer)\n {\n if (comparer == null)\n {\n throw new ArgumentNullException();\n }\n\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Exists(Predicate searchMatch)\n {\n return (FindIndex(searchMatch) != -1);\n }\n\n public int FindIndex(Predicate searchMatch)\n {\n return FindIndex(0, _size, searchMatch);\n }\n\n public int FindIndex(int startIndex, Predicate searchMatch)\n {\n return FindIndex(startIndex, (_size - startIndex), searchMatch);\n }\n\n public int FindIndex(int startIndex, int count, Predicate searchMatch)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n int endIndex = startIndex + count;\n for (int index = startIndex; index < endIndex; ++index)\n {\n if (searchMatch(_collection[index]) == true)\n return index;\n }\n\n return -1;\n }\n\n public int IndexOf(T dataItem)\n {\n return IndexOf(dataItem, 0, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex)\n {\n return IndexOf(dataItem, startIndex, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n return Array.IndexOf(_collection, dataItem, startIndex, count);\n }\n\n public T Find(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n return _collection[i];\n }\n }\n\n return default (T);\n }\n\n public ArrayList FindAll(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n ArrayList matchedElements = new ArrayList();\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n matchedElements.Add(_collection[i]);\n }\n }\n\n return matchedElements;\n }\n\n public ArrayList GetRange(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n var newArrayList = new ArrayList(count);\n Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);\n newArrayList._size = count;\n return newArrayList;\n }\n\n public T[] ToArray()\n {\n T[] newArray = new T[Count];\n if (Count > 0)\n {\n Array.Copy(_collection, 0, newArray, 0, Count);\n }\n\n return newArray;\n }\n\n public List ToList()\n {\n var newList = new List(this.Count);\n if (this.Count > 0)\n {\n for (int i = 0; i < this.Count; ++i)\n {\n newList.Add(_collection[i]);\n }\n }\n\n return newList;\n }\n\n public string ToHumanReadable(bool addHeader = false)\n {\n int i = 0;\n string listAsString = string.Empty;\n string preLineIndent = (addHeader == false ? \"\" : \"\\t\");\n for (i = 0; i < Count; ++i)\n {\n listAsString = String.Format(\"{0}{1}[{2}] => {3}\\r\\n\", listAsString, preLineIndent, i, _collection[i]);\n }\n\n if (addHeader == true)\n {\n listAsString = String.Format(\"ArrayList of count: {0}.\\r\\n(\\r\\n{1})\", Count, listAsString);\n }\n\n return listAsString;\n }\n\n public IEnumerator GetEnumerator()\n {\n for (int i = 0; i < Count; i++)\n {\n yield return _collection[i];\n }\n }\n\n System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\n {\n return this.GetEnumerator();\n }\n }\n}\n\nnamespace DS.Trees\n{\n}\n\n#endregion\n#region Algorithms\nnamespace AL.Common\n{\n}\n\nnamespace AL.Graphs\n{\n}\n\nnamespace AL.Numeric\n{\n}\n\nnamespace AL.Sorting\n{\n public static class QuickSorter\n {\n public static void QuickSort(this IList collection, Comparer comparer = null)\n {\n int startIndex = 0;\n int endIndex = collection.Count - 1;\n comparer = comparer ?? Comparer.Default;\n collection.InternalQuickSort(startIndex, endIndex, comparer);\n }\n\n private static void InternalQuickSort(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n if (leftmostIndex < rightmostIndex)\n {\n int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);\n collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);\n collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);\n }\n }\n\n private static int InternalPartition(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n int wallIndex, pivotIndex;\n pivotIndex = rightmostIndex;\n T pivotValue = collection[pivotIndex];\n wallIndex = leftmostIndex;\n for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)\n {\n if (comparer.Compare(collection[i], pivotValue) <= 0)\n {\n collection.Swap(i, wallIndex);\n wallIndex++;\n }\n }\n\n collection.Swap(wallIndex, pivotIndex);\n return wallIndex;\n }\n }\n}\n#endregion\n#endif\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace C0deforces\n{\n class QueueAtTheSchool\n {\n static void Main(string[] args)\n {\n int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);\n string s = Console.ReadLine().Trim();\n StringBuilder sb = new StringBuilder();\n while (NandT[1]-- > 0)\n {\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] == 'B' && s[i + 1] == 'G') { sb.Append(\"GB\"); i++; }\n else { sb.Append(s[i]); }\n }\n s = sb.ToString();\n sb.Clear();\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _266B\n{\n static class Program\n {\n static void Main()\n {\n var strings = Console.ReadLine().Split(' ');\n var n = byte.Parse(strings[0]);\n var t = byte.Parse(strings[1]);\n var array = Console.ReadLine().ToCharArray();\n for (var i = 0; i < t; i++)\n {\n for (var j = i; j < n-1; j++)\n {\n if (array[j] != 'B' || array[j + 1] != 'G') continue;\n\n array[j] = 'G';\n array[j+1] = 'B';\n ++j;\n }\n }\n for (int i = 0; i < n; i++)\n {\n Console.Write(array[i]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Queue_at_the_School\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = int.Parse(a.Substring(0, a.IndexOf(' ')));\n int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));\n int help = t;\n string b = Console.ReadLine(), c = \"\";\n for (int i = 0; i < n; i++)\n {\n help = t;\n if (b[i] == 'B')\n {\n while (help != 0)\n {\n if (i == b.Length - 1)\n {\n break;\n }\n if (b[i + 1] == 'G')\n {\n c += \"G\";\n i++;\n help--;\n }\n else\n {\n break;\n }\n }\n c += \"B\";\n }\n else\n {\n c += \"G\";\n }\n }\n Console.WriteLine(c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tif (lengthQue < 1) return;\n\t\tif (timeStep > 50) return;\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.Trim().ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n char[] q = Console.ReadLine().ToCharArray();\n int i = 0;\n while (s[1] != 0)\n {\n while (i < s.Length-1)\n {\n if (q[i] == 'B' && q[i + 1] == 'G')\n {\n q[i] = 'G';\n q[i + 1] = 'B';\n i++;\n }\n i++;\n }\n s[1]--;\n i = 0;\n }\n Console.WriteLine(q);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] p = Console.ReadLine().Split();\n char temp;\n int n = int.Parse(p[0]);\n int t = int.Parse(p[1]);\n char[] s = Console.ReadLine().ToCharArray();\n for (int j = 0; j < t; j++)\n {\n for (int i = 0; i < n - 1; i++) \n {\n if (s[i] == 'B')\n {\n temp = s[i];\n s[i] = s[i + 1];\n s[i + 1] = temp;\n i++;\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i=0;j--)\n {\n Console.Write(queue[j]);\n }\n\n Console.WriteLine();\n\n\n\n\n\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine().Trim();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Collections;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar line1=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\tchar[] s=Console.ReadLine().ToCharArray();\n\t\tchar[] ch=new char[s.Length];\n\t\t\n\t\tfor(int j=0; j Convert.ToInt32(s)).ToList();\n var seconds = input[1];\n var str = Console.ReadLine();\n var result = string.Empty;\n\n while (seconds > 0){\n for (int i = 0; i < str.Length; i++){\n if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){\n result += \"GB\";\n i++;\n continue;\n }\n\n result += str[i];\n }\n\n str = result;\n seconds--;\n }\n \n\n //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/\n\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _266_B_Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split(' ');\n\n int n = int.Parse(token[0]);\n int t = int.Parse(token[1]);\n\n string s = Console.ReadLine();\n char[] c = s.ToCharArray();\n\n for (int i = 0; i < t; i++)\n {\n for (int j = 0; j < n-1; j++)\n {\n if(c[j] != s[j+1] && c[j] != 'G')\n {\n char temp = c[j];\n c[j] = c[j + 1];\n c[j + 1] = temp;\n j += 1;\n }\n }\n }\n\n foreach (var item in c)\n {\n Console.Write(item);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n char[] line;\n int timeOffset;\n int length;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\n', '\\r', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n line = input[2].ToCharArray();\n timeOffset = int.Parse(input[1]);\n length = int.Parse(input[0]);\n }\n {\n char temp;\n for (int i = 0; i < timeOffset; ++i)\n {\n for (int j = length - 1; j > 0; --j)\n {\n if (line[j] == 'G' && line[j - 1] == 'B')\n { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; }\n }\n }\n }\n Console.WriteLine(new string(line));\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ACM\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tint n = int.Parse(s[0]);\n\t\t\tint k = int.Parse(s[1]);\n\t\t\t\n\t\t\tstring r = Console.ReadLine();\n\t\t\tList boys = new List();\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (r[i] == 'B')\n\t\t\t\t\tboys.Add(i);\n\n\t\t\tint q = Math.Max(boys[boys.Count - 1], n - 1);\n\t\t\tfor (int j = 0; j < k; j++)\n\t\t\t\tfor (int i = 0; i < boys.Count; i++)\n\t\t\t\t\tif (boys[i] < q)\n\t\t\t\t\t\tboys[i]++;\n\n\t\t\tr = \"\";\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (boys.Contains(i))\n\t\t\t\t\tr += 'B';\n\t\t\t\telse\n\t\t\t\t\tr += 'G';\n\t\t\tConsole.WriteLine(r);\n\t\t\t\n\t\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "#define ASD\n#if (Debug)\n#define Trace\n#endif\n#if (ASD)\nusing DS.Common;\nusing DS.Dictionaries;\nusing DS.Graphs;\nusing DS.Heaps;\nusing DS.Lists;\nusing DS.Trees;\nusing DS;\nusing AL;\nusing AL.Common;\nusing AL.Graphs;\nusing AL.Numeric;\nusing AL.Sorting;\n#endif\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing GenericArithmetic;\nusing System.Reflection;\nusing System.Windows;\nusing System.Text.RegularExpressions;\nusing csConsoleforStudy;\nusing System.Resources;\nusing System.Runtime.Serialization;\n\nnamespace csConsoleforStudy\n{\n class Program\n {\n const double MemoryLimit = 2.56;\n const double TimeLimit = 4000;\n static Stream fsr;\n static FileStream fsw;\n static TextReader tr;\n static TextWriter tw;\n static Thread t;\n static Thread mainThread = Thread.CurrentThread;\n static Stopwatch sw = new Stopwatch();\n static DefaultTraceListener Logger;\n static long maxUsedMemory = 0;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CloseStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CheckMemory()\n {\n#if (Debug)\n#endif\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n var l1 = ria();\n var n = l1[0];\n var t = l1[1];\n var l2 = Console.ReadLine();\n char[] State = l2.ToCharArray();\n for (int round = 0; round < t; round++)\n {\n for (int i = 0; i < State.Length; i++)\n {\n if (i == n - 1)\n {\n }\n else if (i == 0)\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n else\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n }\n }\n\n Console.WriteLine(State);\n }\n\n public char[] swap(char[] str, int a, int b)\n {\n Tuple chars = new Tuple(str[a], str[b]);\n str[a] = chars.Item2;\n str[b] = chars.Item1;\n return str;\n }\n\n#region SolverUtils\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new AE(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n }\n\n static class MyExtensions\n {\n public static string Reverse(this string str)\n {\n StringBuilder sb = new StringBuilder(str.Length);\n for (int i = str.Length - 1; i >= 0; i--)\n {\n sb.Append(str[i]);\n }\n\n return sb.ToString();\n }\n }\n\n#endregion\n struct Pair\n {\n public long X, Y;\n public Pair(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n struct Bit\n {\n bool state;\n public Bit(bool state)\n {\n this.state = state;\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public override string ToString()\n {\n return state.ToString();\n }\n\n public override bool Equals(object other)\n {\n if (other is Bit)\n {\n return state == ((Bit)other).state;\n }\n else\n {\n if ((int)other == 1 && state == true)\n return true;\n else if ((int)other == 0 && state == false)\n return true;\n else\n return base.Equals(other);\n }\n }\n\n public static implicit operator bool (Bit a)\n {\n return a.state;\n }\n\n public static implicit operator Bit(bool a)\n {\n return new Bit(a);\n }\n\n public static implicit operator Bit(int a)\n {\n if (a == 0)\n return new Bit(false);\n return new Bit(true);\n }\n\n public static bool operator ==(Bit a, Bit b)\n {\n return a.state == b.state;\n }\n\n public static bool operator !=(Bit a, Bit b)\n {\n return a.state != b.state;\n }\n\n public static Bit operator !(Bit a)\n {\n return new Bit(!a.state);\n }\n\n public static Bit operator +(Bit a, Bit b)\n {\n return new Bit(a.state || b.state);\n }\n\n public static Bit operator *(Bit a, Bit b)\n {\n return new Bit(a.state && b.state);\n }\n\n public static Bit operator ^(Bit a, Bit b)\n {\n return new Bit(a.state ^ b.state);\n }\n }\n\n#if (MS)\n#endif\n#region Exceptions\n [Serializable]\n internal class IOE : InvalidOperationException\n {\n public IOE()\n {\n }\n\n public IOE(string message): base (message)\n {\n }\n\n public IOE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected IOE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n\n [Serializable]\n internal class AE : ArgumentException\n {\n public AE()\n {\n }\n\n public AE(string message): base (message)\n {\n }\n\n public AE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected AE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n#endregion\n}\n\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n#if (ASD)\n Map.Populate(W, H, defaultValue);\n#endif\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n\n#if (ASD)\n#region DataStructures\nnamespace DS.Common\n{\n public static class Comparers\n {\n public static bool IsNumber(this T value)\n {\n if (value is sbyte)\n return true;\n if (value is byte)\n return true;\n if (value is short)\n return true;\n if (value is ushort)\n return true;\n if (value is int)\n return true;\n if (value is uint)\n return true;\n if (value is long)\n return true;\n if (value is ulong)\n return true;\n if (value is float)\n return true;\n if (value is double)\n return true;\n if (value is decimal)\n return true;\n return false;\n }\n\n public static bool IsEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.Equals(secondValue);\n }\n\n public static bool IsGreaterThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) > 0;\n }\n\n public static bool IsLessThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) < 0;\n }\n\n public static bool IsGreaterThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));\n }\n\n public static bool IsLessThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));\n }\n }\n\n public static class Helpers\n {\n public static void Swap(this IList list, int firstIndex, int secondIndex)\n {\n if (list.Count < 2 || firstIndex == secondIndex)\n return;\n var temp = list[firstIndex];\n list[firstIndex] = list[secondIndex];\n list[secondIndex] = temp;\n }\n\n public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')\n {\n if (string.IsNullOrEmpty(text))\n return text;\n int length = text.Length;\n int cTP = newW - length;\n if (cTP < 0)\n throw new AE(\"New w must be greater than string length.\");\n int pL = cTP / 2 + cTP % 2;\n int pR = cTP / 2;\n StringBuilder rB = new StringBuilder(newW);\n for (int i = 0; i < pL; i++)\n rB.Insert(i, fillerCharacter);\n for (int i = 0; i < length; i++)\n rB.Insert(i + pL, text[i]);\n for (int i = newW - pR; i < newW; i++)\n rB.Insert(i, fillerCharacter);\n return rB.ToString();\n }\n\n public static void Populate(this T[, ] array, int rows, int columns, T defaultValue = default (T))\n {\n for (int i = 0; i < rows; ++i)\n {\n for (int j = 0; j < columns; ++j)\n {\n array[i, j] = defaultValue;\n }\n }\n }\n }\n}\n\nnamespace DS.Dictionaries\n{\n}\n\nnamespace DS.Graphs\n{\n}\n\nnamespace DS.Hashing\n{\n}\n\nnamespace DS.Heaps\n{\n public interface IMaxHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMax();\n T ExtractMax();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMinHeap ToMinHeap();\n }\n\n public interface IMinHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMin();\n T ExtractMin();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMaxHeap ToMaxHeap();\n }\n}\n\nnamespace DS.Lists\n{\n public class ArrayList : IEnumerable\n {\n bool DefaultMaxCapacityIsX64 = true;\n bool IsMaximumCapacityReached = false;\n public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;\n public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;\n private readonly T[] _emptyArray = new T[0];\n private const int _defaultCapacity = 8;\n private T[] _collection;\n private int _size\n {\n get;\n set;\n }\n\n public ArrayList(): this (capacity: 0)\n {\n }\n\n public ArrayList(int capacity)\n {\n if (capacity < 0)\n {\n throw new ArgumentOutOfRangeException();\n }\n else if (capacity == 0)\n {\n _collection = _emptyArray;\n }\n else\n {\n _collection = new T[capacity];\n }\n\n _size = 0;\n }\n\n private void _ensureCapacity(int minCapacity)\n {\n if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)\n {\n int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);\n int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);\n if (newCapacity < minCapacity)\n newCapacity = minCapacity;\n if (newCapacity >= maxCapacity)\n {\n newCapacity = maxCapacity - 1;\n IsMaximumCapacityReached = true;\n }\n\n this._resizeCapacity(newCapacity);\n }\n }\n\n private void _resizeCapacity(int newCapacity)\n {\n if (newCapacity != _collection.Length && newCapacity > _size)\n {\n try\n {\n Array.Resize(ref _collection, newCapacity);\n }\n catch (OutOfMemoryException)\n {\n if (DefaultMaxCapacityIsX64 == true)\n {\n DefaultMaxCapacityIsX64 = false;\n _ensureCapacity(newCapacity);\n }\n\n throw;\n }\n }\n }\n\n public int Count\n {\n get\n {\n return _size;\n }\n }\n\n public int Capacity\n {\n get\n {\n return _collection.Length;\n }\n }\n\n public bool IsEmpty\n {\n get\n {\n return (Count == 0);\n }\n }\n\n public T First\n {\n get\n {\n return _collection[0];\n }\n }\n\n public T Last\n {\n get\n {\n return _collection[Count - 1];\n }\n }\n\n public T this[int index]\n {\n get\n {\n return _collection[index];\n }\n\n set\n {\n _collection[index] = value;\n }\n }\n\n public void Add(T dataItem)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n _collection[_size++] = dataItem;\n }\n\n public void AddRange(IEnumerable elements)\n {\n if (elements == null)\n throw new ArgumentNullException();\n if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (elements.Any())\n {\n _ensureCapacity(_size + elements.Count());\n foreach (var element in elements)\n this.Add(element);\n }\n }\n\n public void AddRepeatedly(T value, int count)\n {\n if (count < 0)\n throw new ArgumentOutOfRangeException();\n if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (count > 0)\n {\n _ensureCapacity(_size + count);\n for (int i = 0; i < count; i++)\n this.Add(value);\n }\n }\n\n public void InsertAt(T dataItem, int index)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n if (index < _size)\n {\n Array.Copy(_collection, index, _collection, index + 1, (_size - index));\n }\n\n _collection[index] = dataItem;\n _size++;\n }\n\n public bool Remove(T dataItem)\n {\n int index = IndexOf(dataItem);\n if (index >= 0)\n {\n RemoveAt(index);\n return true;\n }\n\n return false;\n }\n\n public void RemoveAt(int index)\n {\n _size--;\n if (index < _size)\n {\n Array.Copy(_collection, index + 1, _collection, index, (_size - index));\n }\n\n _collection[_size] = default (T);\n }\n\n public void Clear()\n {\n if (_size > 0)\n {\n _size = 0;\n Array.Clear(_collection, 0, _size);\n _collection = _emptyArray;\n }\n }\n\n public void Resize(int newSize)\n {\n Resize(newSize, default (T));\n }\n\n public void Resize(int newSize, T defaultValue)\n {\n int currentSize = this.Count;\n if (newSize < currentSize)\n {\n this._ensureCapacity(newSize);\n }\n else if (newSize > currentSize)\n {\n if (newSize > this._collection.Length)\n this._ensureCapacity(newSize + 1);\n this.AddRange(Enumerable.Repeat(defaultValue, newSize - currentSize));\n }\n }\n\n public void Reverse()\n {\n Reverse(0, _size);\n }\n\n public void Reverse(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n Array.Reverse(_collection, startIndex, count);\n }\n\n public void ForEach(Action action)\n {\n if (action == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n action(_collection[i]);\n }\n }\n\n public bool Contains(T dataItem)\n {\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n EqualityComparer comparer = EqualityComparer.Default;\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Contains(T dataItem, IEqualityComparer comparer)\n {\n if (comparer == null)\n {\n throw new ArgumentNullException();\n }\n\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Exists(Predicate searchMatch)\n {\n return (FindIndex(searchMatch) != -1);\n }\n\n public int FindIndex(Predicate searchMatch)\n {\n return FindIndex(0, _size, searchMatch);\n }\n\n public int FindIndex(int startIndex, Predicate searchMatch)\n {\n return FindIndex(startIndex, (_size - startIndex), searchMatch);\n }\n\n public int FindIndex(int startIndex, int count, Predicate searchMatch)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n int endIndex = startIndex + count;\n for (int index = startIndex; index < endIndex; ++index)\n {\n if (searchMatch(_collection[index]) == true)\n return index;\n }\n\n return -1;\n }\n\n public int IndexOf(T dataItem)\n {\n return IndexOf(dataItem, 0, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex)\n {\n return IndexOf(dataItem, startIndex, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n return Array.IndexOf(_collection, dataItem, startIndex, count);\n }\n\n public T Find(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n return _collection[i];\n }\n }\n\n return default (T);\n }\n\n public ArrayList FindAll(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n ArrayList matchedElements = new ArrayList();\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n matchedElements.Add(_collection[i]);\n }\n }\n\n return matchedElements;\n }\n\n public ArrayList GetRange(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n var newArrayList = new ArrayList(count);\n Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);\n newArrayList._size = count;\n return newArrayList;\n }\n\n public T[] ToArray()\n {\n T[] newArray = new T[Count];\n if (Count > 0)\n {\n Array.Copy(_collection, 0, newArray, 0, Count);\n }\n\n return newArray;\n }\n\n public List ToList()\n {\n var newList = new List(this.Count);\n if (this.Count > 0)\n {\n for (int i = 0; i < this.Count; ++i)\n {\n newList.Add(_collection[i]);\n }\n }\n\n return newList;\n }\n\n public string ToHumanReadable(bool addHeader = false)\n {\n int i = 0;\n string listAsString = string.Empty;\n string preLineIndent = (addHeader == false ? \"\" : \"\\t\");\n for (i = 0; i < Count; ++i)\n {\n listAsString = String.Format(\"{0}{1}[{2}] => {3}\\r\\n\", listAsString, preLineIndent, i, _collection[i]);\n }\n\n if (addHeader == true)\n {\n listAsString = String.Format(\"ArrayList of count: {0}.\\r\\n(\\r\\n{1})\", Count, listAsString);\n }\n\n return listAsString;\n }\n\n public IEnumerator GetEnumerator()\n {\n for (int i = 0; i < Count; i++)\n {\n yield return _collection[i];\n }\n }\n\n System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\n {\n return this.GetEnumerator();\n }\n }\n}\n\nnamespace DS.Trees\n{\n}\n\n#endregion\n#region Algorithms\nnamespace AL.Common\n{\n}\n\nnamespace AL.Graphs\n{\n}\n\nnamespace AL.Numeric\n{\n}\n\nnamespace AL.Sorting\n{\n public static class QuickSorter\n {\n public static void QuickSort(this IList collection, Comparer comparer = null)\n {\n int startIndex = 0;\n int endIndex = collection.Count - 1;\n comparer = comparer ?? Comparer.Default;\n collection.InternalQuickSort(startIndex, endIndex, comparer);\n }\n\n private static void InternalQuickSort(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n if (leftmostIndex < rightmostIndex)\n {\n int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);\n collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);\n collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);\n }\n }\n\n private static int InternalPartition(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n int wallIndex, pivotIndex;\n pivotIndex = rightmostIndex;\n T pivotValue = collection[pivotIndex];\n wallIndex = leftmostIndex;\n for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)\n {\n if (comparer.Compare(collection[i], pivotValue) <= 0)\n {\n collection.Swap(i, wallIndex);\n wallIndex++;\n }\n }\n\n collection.Swap(wallIndex, pivotIndex);\n return wallIndex;\n }\n }\n}\n#endregion\n#endif\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Win32.SafeHandles;\n\nnamespace QueueAtSchool\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = input[0];\n int t = input[1];\n\n char[] kids = Console.ReadLine().ToArray();\n\n for (int i = 0; i < t; i++)\n {\n // Musim najit vsechny pripady kdy je kluk v rade pred holkou a prohodit je\n for (int j = 0; j < n; j++)\n {\n if(j + 1 >= n)\n break;\n\n char boy = kids[j];\n\n if (boy == 'B')\n {\n char girl = kids[j + 1];\n\n if (girl == 'G')\n {\n kids[j] = girl;\n kids[j + 1] = boy;\n j += 2;\n }\n }\n }\n }\n\n string result = new string(kids);\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_SchoolQueue {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split();\n int time = Int32.Parse(input[1]);\n string queue = Console.ReadLine();\n string outputqueue = string.Empty;\n for(int i = 0; i < time; ++i) {\n for(int j = 0; j < (queue.Length-1); ++j) {\n if((queue[j] == 'B') && (queue[j+1] == 'G')){\n outputqueue += \"GB\";\n ++j;\n } else {\n outputqueue += queue[j];\n }\n }\n }\n Console.WriteLine(outputqueue);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace B._Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int second = Convert.ToInt32(line[1]);\n string data = Console.ReadLine();\n string result = data;\n\n while (second != 0)\n {\n second--;\n data = result;\n result = \"\";\n\n for (int i = 0; i < data.Length - 1; i++)\n {\n if (data[i] == 'B' && data[i + 1] == 'G')\n {\n result += \"GB\";\n i++;\n }\n else result += data[i];\n }\n if (data[data.Length - 1] == 'B') result += 'B';\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sumB =0;\n string line = Console.ReadLine();\n string line1 = Console.ReadLine();\n int n = Convert.ToInt16(line.Substring(0, line.IndexOf(' ')));\n int x = Convert.ToInt16(line.Substring(line.IndexOf(' ')+1));\n int counter = 0;\n int counter1 = 0;\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n sumB++;\n }\n }\n int[] posB = new int[sumB];\n int[] numG = new int[sumB];\n for (int i = 0; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n posB[counter] = i;\n counter++;\n }\n }\n counter = 0;\n for (int i = line1.IndexOf('B')+1; i < line1.Length; i++)\n {\n if (line1[i] == 'B')\n {\n numG[counter] = counter1;\n counter++;\n counter1 = 0;\n }\n else counter1++;\n if (i == line1.Length - 1)\n {\n numG[counter] = counter1;\n break;\n }\n }\n int v = 0;\n for (int j = numG.Length - 1; j >= 0; j--)\n {\n if (numG[j] != 0)\n {\n if (x>numG[j])\n {\n line1 = line1.Remove(posB[j], 1);\n line1 = line1.Insert(posB[j] + 1, \"B\");\n if (j == 0) break;\n numG[j - 1] = numG[j - 1] + numG[j];\n }\n if (x Convert.ToInt32(s)).ToList();\n var seconds = input[1];\n var str = Console.ReadLine();\n var result = string.Empty;\n\n while (seconds > 0){\n for (int i = 0; i < str.Length; i++){\n if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){\n result += \"GB\";\n i++;\n continue;\n }\n\n result += str[i];\n }\n\n str = result;\n seconds--;\n }\n \n\n //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/\n\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i newqueu = new List();\n\n\n int c = 0; \n for (int i = queue.Length-1; i >= 0; i--)\n {\n if(c!=index)\n {\n if(queue[i]=='G')\n {\n newqueu.Add('G'); \n }\n\n else if (queue[i-1] == 'G' && queue[i]=='B')\n {\n queue[i - 1] = 'B';\n queue[i] = 'G';\n newqueu.Add('G');\n }\n c++;\n }\n \n }\n \n \n for(int j=0; j Convert.ToInt32(x));\n int n = arr[0];\n int t = arr[1];\n string queueLine = Console.ReadLine();\n StringBuilder r = new StringBuilder(queueLine);\n while (t > 0)\n {\n for (int i = 0; i < n - 1; i++)\n {\n if (r[i] == 'B' && r[i + 1] == 'G')\n {\n r[i] = 'G';\n r[i + 1] = 'B';\n i = i + 2;\n }\n else\n {\n r[i] = r[i];\n }\n }\n t--;\n }\n Console.WriteLine(r);\n }\n }\n\n\n}"}, {"source_code": "#define ASD\n#if (Debug)\n#define Trace\n#endif\n#if (ASD)\nusing DS.Common;\nusing DS.Dictionaries;\nusing DS.Graphs;\nusing DS.Heaps;\nusing DS.Lists;\nusing DS.Trees;\nusing DS;\nusing AL;\nusing AL.Common;\nusing AL.Graphs;\nusing AL.Numeric;\nusing AL.Sorting;\n#endif\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing GenericArithmetic;\nusing System.Reflection;\nusing System.Windows;\nusing System.Text.RegularExpressions;\nusing csConsoleforStudy;\nusing System.Resources;\nusing System.Runtime.Serialization;\n\nnamespace csConsoleforStudy\n{\n class Program\n {\n const double MemoryLimit = 2.56;\n const double TimeLimit = 4000;\n static Stream fsr;\n static FileStream fsw;\n static TextReader tr;\n static TextWriter tw;\n static Thread t;\n static Thread mainThread = Thread.CurrentThread;\n static Stopwatch sw = new Stopwatch();\n static DefaultTraceListener Logger;\n static long maxUsedMemory = 0;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CloseStream()\n {\n#if (Debug)\n#endif\n }\n\n static void CheckMemory()\n {\n#if (Debug)\n#endif\n }\n }\n\n class Solver\n {\n public void Solve()\n {\n var l1 = ria();\n var n = l1[0];\n var t = l1[1];\n var l2 = Console.ReadLine();\n char[] State = l2.ToCharArray();\n for (int round = 0; round < t; round++)\n {\n for (int i = 0; i < State.Length; i++)\n {\n if (i == n - 1)\n {\n }\n else if (i == 0)\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n else\n {\n if (State[i + 1] == 'G' && State[i] == 'B')\n {\n swap(State, i, i + 1);\n }\n }\n }\n }\n\n Console.WriteLine(State);\n }\n\n public char[] swap(char[] str, int a, int b)\n {\n Tuple chars = new Tuple(str[a], str[b]);\n str[a] = chars.Item2;\n str[b] = chars.Item1;\n return str;\n }\n\n#region SolverUtils\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new AE(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n }\n\n static class MyExtensions\n {\n public static string Reverse(this string str)\n {\n StringBuilder sb = new StringBuilder(str.Length);\n for (int i = str.Length - 1; i >= 0; i--)\n {\n sb.Append(str[i]);\n }\n\n return sb.ToString();\n }\n }\n\n#endregion\n struct Pair\n {\n public long X, Y;\n public Pair(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n struct Bit\n {\n bool state;\n public Bit(bool state)\n {\n this.state = state;\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public override string ToString()\n {\n return state.ToString();\n }\n\n public override bool Equals(object other)\n {\n if (other is Bit)\n {\n return state == ((Bit)other).state;\n }\n else\n {\n if ((int)other == 1 && state == true)\n return true;\n else if ((int)other == 0 && state == false)\n return true;\n else\n return base.Equals(other);\n }\n }\n\n public static implicit operator bool (Bit a)\n {\n return a.state;\n }\n\n public static implicit operator Bit(bool a)\n {\n return new Bit(a);\n }\n\n public static implicit operator Bit(int a)\n {\n if (a == 0)\n return new Bit(false);\n return new Bit(true);\n }\n\n public static bool operator ==(Bit a, Bit b)\n {\n return a.state == b.state;\n }\n\n public static bool operator !=(Bit a, Bit b)\n {\n return a.state != b.state;\n }\n\n public static Bit operator !(Bit a)\n {\n return new Bit(!a.state);\n }\n\n public static Bit operator +(Bit a, Bit b)\n {\n return new Bit(a.state || b.state);\n }\n\n public static Bit operator *(Bit a, Bit b)\n {\n return new Bit(a.state && b.state);\n }\n\n public static Bit operator ^(Bit a, Bit b)\n {\n return new Bit(a.state ^ b.state);\n }\n }\n\n#if (MS)\n#endif\n#region Exceptions\n [Serializable]\n internal class IOE : InvalidOperationException\n {\n public IOE()\n {\n }\n\n public IOE(string message): base (message)\n {\n }\n\n public IOE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected IOE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n\n [Serializable]\n internal class AE : ArgumentException\n {\n public AE()\n {\n }\n\n public AE(string message): base (message)\n {\n }\n\n public AE(string message, Exception innerException): base (message, innerException)\n {\n }\n\n protected AE(SerializationInfo info, StreamingContext context): base (info, context)\n {\n }\n }\n#endregion\n}\n\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n#if (ASD)\n Map.Populate(W, H, defaultValue);\n#endif\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n\n#if (ASD)\n#region DataStructures\nnamespace DS.Common\n{\n public static class Comparers\n {\n public static bool IsNumber(this T value)\n {\n if (value is sbyte)\n return true;\n if (value is byte)\n return true;\n if (value is short)\n return true;\n if (value is ushort)\n return true;\n if (value is int)\n return true;\n if (value is uint)\n return true;\n if (value is long)\n return true;\n if (value is ulong)\n return true;\n if (value is float)\n return true;\n if (value is double)\n return true;\n if (value is decimal)\n return true;\n return false;\n }\n\n public static bool IsEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.Equals(secondValue);\n }\n\n public static bool IsGreaterThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) > 0;\n }\n\n public static bool IsLessThan(this T firstValue, T secondValue)where T : IComparable\n {\n return firstValue.CompareTo(secondValue) < 0;\n }\n\n public static bool IsGreaterThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsGreaterThan(secondValue));\n }\n\n public static bool IsLessThanOrEqualTo(this T firstValue, T secondValue)where T : IComparable\n {\n return (firstValue.IsEqualTo(secondValue) || firstValue.IsLessThan(secondValue));\n }\n }\n\n public static class Helpers\n {\n public static void Swap(this IList list, int firstIndex, int secondIndex)\n {\n if (list.Count < 2 || firstIndex == secondIndex)\n return;\n var temp = list[firstIndex];\n list[firstIndex] = list[secondIndex];\n list[secondIndex] = temp;\n }\n\n public static string PadCenter(this string text, int newW, char fillerCharacter = ' ')\n {\n if (string.IsNullOrEmpty(text))\n return text;\n int length = text.Length;\n int cTP = newW - length;\n if (cTP < 0)\n throw new AE(\"New w must be greater than string length.\");\n int pL = cTP / 2 + cTP % 2;\n int pR = cTP / 2;\n StringBuilder rB = new StringBuilder(newW);\n for (int i = 0; i < pL; i++)\n rB.Insert(i, fillerCharacter);\n for (int i = 0; i < length; i++)\n rB.Insert(i + pL, text[i]);\n for (int i = newW - pR; i < newW; i++)\n rB.Insert(i, fillerCharacter);\n return rB.ToString();\n }\n\n public static void Populate(this T[, ] array, int rows, int columns, T defaultValue = default (T))\n {\n for (int i = 0; i < rows; ++i)\n {\n for (int j = 0; j < columns; ++j)\n {\n array[i, j] = defaultValue;\n }\n }\n }\n }\n}\n\nnamespace DS.Dictionaries\n{\n}\n\nnamespace DS.Graphs\n{\n}\n\nnamespace DS.Hashing\n{\n}\n\nnamespace DS.Heaps\n{\n public interface IMaxHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMax();\n T ExtractMax();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMinHeap ToMinHeap();\n }\n\n public interface IMinHeap\n where T : System.IComparable\n {\n int Count\n {\n get;\n }\n\n bool IsEmpty\n {\n get;\n }\n\n void Initialize(System.Collections.Generic.IList newCollection);\n void Add(T heapKey);\n T Peek();\n void RemoveMin();\n T ExtractMin();\n void Clear();\n void RebuildHeap();\n T[] ToArray();\n System.Collections.Generic.List ToList();\n IMaxHeap ToMaxHeap();\n }\n}\n\nnamespace DS.Lists\n{\n public class ArrayList : IEnumerable\n {\n bool DefaultMaxCapacityIsX64 = true;\n bool IsMaximumCapacityReached = false;\n public const int MAXIMUM_ARRAY_LENGTH_x64 = 2146435071;\n public const int MAXIMUM_ARRAY_LENGTH_x86 = 134217728;\n private readonly T[] _emptyArray = new T[0];\n private const int _defaultCapacity = 8;\n private T[] _collection;\n private int _size\n {\n get;\n set;\n }\n\n public ArrayList(): this (capacity: 0)\n {\n }\n\n public ArrayList(int capacity)\n {\n if (capacity < 0)\n {\n throw new ArgumentOutOfRangeException();\n }\n else if (capacity == 0)\n {\n _collection = _emptyArray;\n }\n else\n {\n _collection = new T[capacity];\n }\n\n _size = 0;\n }\n\n private void _ensureCapacity(int minCapacity)\n {\n if (_collection.Length < minCapacity && IsMaximumCapacityReached == false)\n {\n int newCapacity = (_collection.Length == 0 ? _defaultCapacity : _collection.Length * 2);\n int maxCapacity = (DefaultMaxCapacityIsX64 == true ? MAXIMUM_ARRAY_LENGTH_x64 : MAXIMUM_ARRAY_LENGTH_x86);\n if (newCapacity < minCapacity)\n newCapacity = minCapacity;\n if (newCapacity >= maxCapacity)\n {\n newCapacity = maxCapacity - 1;\n IsMaximumCapacityReached = true;\n }\n\n this._resizeCapacity(newCapacity);\n }\n }\n\n private void _resizeCapacity(int newCapacity)\n {\n if (newCapacity != _collection.Length && newCapacity > _size)\n {\n try\n {\n Array.Resize(ref _collection, newCapacity);\n }\n catch (OutOfMemoryException)\n {\n if (DefaultMaxCapacityIsX64 == true)\n {\n DefaultMaxCapacityIsX64 = false;\n _ensureCapacity(newCapacity);\n }\n\n throw;\n }\n }\n }\n\n public int Count\n {\n get\n {\n return _size;\n }\n }\n\n public int Capacity\n {\n get\n {\n return _collection.Length;\n }\n }\n\n public bool IsEmpty\n {\n get\n {\n return (Count == 0);\n }\n }\n\n public T First\n {\n get\n {\n return _collection[0];\n }\n }\n\n public T Last\n {\n get\n {\n return _collection[Count - 1];\n }\n }\n\n public T this[int index]\n {\n get\n {\n return _collection[index];\n }\n\n set\n {\n _collection[index] = value;\n }\n }\n\n public void Add(T dataItem)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n _collection[_size++] = dataItem;\n }\n\n public void AddRange(IEnumerable elements)\n {\n if (elements == null)\n throw new ArgumentNullException();\n if (((uint)_size + elements.Count()) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (elements.Any())\n {\n _ensureCapacity(_size + elements.Count());\n foreach (var element in elements)\n this.Add(element);\n }\n }\n\n public void AddRepeatedly(T value, int count)\n {\n if (count < 0)\n throw new ArgumentOutOfRangeException();\n if (((uint)_size + count) > MAXIMUM_ARRAY_LENGTH_x64)\n throw new OverflowException();\n if (count > 0)\n {\n _ensureCapacity(_size + count);\n for (int i = 0; i < count; i++)\n this.Add(value);\n }\n }\n\n public void InsertAt(T dataItem, int index)\n {\n if (_size == _collection.Length)\n {\n _ensureCapacity(_size + 1);\n }\n\n if (index < _size)\n {\n Array.Copy(_collection, index, _collection, index + 1, (_size - index));\n }\n\n _collection[index] = dataItem;\n _size++;\n }\n\n public bool Remove(T dataItem)\n {\n int index = IndexOf(dataItem);\n if (index >= 0)\n {\n RemoveAt(index);\n return true;\n }\n\n return false;\n }\n\n public void RemoveAt(int index)\n {\n _size--;\n if (index < _size)\n {\n Array.Copy(_collection, index + 1, _collection, index, (_size - index));\n }\n\n _collection[_size] = default (T);\n }\n\n public void Clear()\n {\n if (_size > 0)\n {\n _size = 0;\n Array.Clear(_collection, 0, _size);\n _collection = _emptyArray;\n }\n }\n\n public void Resize(int newSize)\n {\n Resize(newSize, default (T));\n }\n\n public void Resize(int newSize, T defaultValue)\n {\n int currentSize = this.Count;\n if (newSize < currentSize)\n {\n this._ensureCapacity(newSize);\n }\n else if (newSize > currentSize)\n {\n if (newSize > this._collection.Length)\n this._ensureCapacity(newSize + 1);\n this.AddRange(Enumerable.Repeat(defaultValue, newSize - currentSize));\n }\n }\n\n public void Reverse()\n {\n Reverse(0, _size);\n }\n\n public void Reverse(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n Array.Reverse(_collection, startIndex, count);\n }\n\n public void ForEach(Action action)\n {\n if (action == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n action(_collection[i]);\n }\n }\n\n public bool Contains(T dataItem)\n {\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n EqualityComparer comparer = EqualityComparer.Default;\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Contains(T dataItem, IEqualityComparer comparer)\n {\n if (comparer == null)\n {\n throw new ArgumentNullException();\n }\n\n if ((Object)dataItem == null)\n {\n for (int i = 0; i < _size; ++i)\n {\n if ((Object)_collection[i] == null)\n return true;\n }\n }\n else\n {\n for (int i = 0; i < _size; ++i)\n {\n if (comparer.Equals(_collection[i], dataItem))\n return true;\n }\n }\n\n return false;\n }\n\n public bool Exists(Predicate searchMatch)\n {\n return (FindIndex(searchMatch) != -1);\n }\n\n public int FindIndex(Predicate searchMatch)\n {\n return FindIndex(0, _size, searchMatch);\n }\n\n public int FindIndex(int startIndex, Predicate searchMatch)\n {\n return FindIndex(startIndex, (_size - startIndex), searchMatch);\n }\n\n public int FindIndex(int startIndex, int count, Predicate searchMatch)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n int endIndex = startIndex + count;\n for (int index = startIndex; index < endIndex; ++index)\n {\n if (searchMatch(_collection[index]) == true)\n return index;\n }\n\n return -1;\n }\n\n public int IndexOf(T dataItem)\n {\n return IndexOf(dataItem, 0, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex)\n {\n return IndexOf(dataItem, startIndex, _size);\n }\n\n public int IndexOf(T dataItem, int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n return Array.IndexOf(_collection, dataItem, startIndex, count);\n }\n\n public T Find(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n return _collection[i];\n }\n }\n\n return default (T);\n }\n\n public ArrayList FindAll(Predicate searchMatch)\n {\n if (searchMatch == null)\n {\n throw new ArgumentNullException();\n }\n\n ArrayList matchedElements = new ArrayList();\n for (int i = 0; i < _size; ++i)\n {\n if (searchMatch(_collection[i]))\n {\n matchedElements.Add(_collection[i]);\n }\n }\n\n return matchedElements;\n }\n\n public ArrayList GetRange(int startIndex, int count)\n {\n if (count < 0 || startIndex > (_size - count))\n {\n throw new ArgumentOutOfRangeException();\n }\n\n var newArrayList = new ArrayList(count);\n Array.Copy(_collection, startIndex, newArrayList._collection, 0, count);\n newArrayList._size = count;\n return newArrayList;\n }\n\n public T[] ToArray()\n {\n T[] newArray = new T[Count];\n if (Count > 0)\n {\n Array.Copy(_collection, 0, newArray, 0, Count);\n }\n\n return newArray;\n }\n\n public List ToList()\n {\n var newList = new List(this.Count);\n if (this.Count > 0)\n {\n for (int i = 0; i < this.Count; ++i)\n {\n newList.Add(_collection[i]);\n }\n }\n\n return newList;\n }\n\n public string ToHumanReadable(bool addHeader = false)\n {\n int i = 0;\n string listAsString = string.Empty;\n string preLineIndent = (addHeader == false ? \"\" : \"\\t\");\n for (i = 0; i < Count; ++i)\n {\n listAsString = String.Format(\"{0}{1}[{2}] => {3}\\r\\n\", listAsString, preLineIndent, i, _collection[i]);\n }\n\n if (addHeader == true)\n {\n listAsString = String.Format(\"ArrayList of count: {0}.\\r\\n(\\r\\n{1})\", Count, listAsString);\n }\n\n return listAsString;\n }\n\n public IEnumerator GetEnumerator()\n {\n for (int i = 0; i < Count; i++)\n {\n yield return _collection[i];\n }\n }\n\n System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()\n {\n return this.GetEnumerator();\n }\n }\n}\n\nnamespace DS.Trees\n{\n}\n\n#endregion\n#region Algorithms\nnamespace AL.Common\n{\n}\n\nnamespace AL.Graphs\n{\n}\n\nnamespace AL.Numeric\n{\n}\n\nnamespace AL.Sorting\n{\n public static class QuickSorter\n {\n public static void QuickSort(this IList collection, Comparer comparer = null)\n {\n int startIndex = 0;\n int endIndex = collection.Count - 1;\n comparer = comparer ?? Comparer.Default;\n collection.InternalQuickSort(startIndex, endIndex, comparer);\n }\n\n private static void InternalQuickSort(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n if (leftmostIndex < rightmostIndex)\n {\n int wallIndex = collection.InternalPartition(leftmostIndex, rightmostIndex, comparer);\n collection.InternalQuickSort(leftmostIndex, wallIndex - 1, comparer);\n collection.InternalQuickSort(wallIndex + 1, rightmostIndex, comparer);\n }\n }\n\n private static int InternalPartition(this IList collection, int leftmostIndex, int rightmostIndex, Comparer comparer)\n {\n int wallIndex, pivotIndex;\n pivotIndex = rightmostIndex;\n T pivotValue = collection[pivotIndex];\n wallIndex = leftmostIndex;\n for (int i = leftmostIndex; i <= (rightmostIndex - 1); i++)\n {\n if (comparer.Compare(collection[i], pivotValue) <= 0)\n {\n collection.Swap(i, wallIndex);\n wallIndex++;\n }\n }\n\n collection.Swap(wallIndex, pivotIndex);\n return wallIndex;\n }\n }\n}\n#endregion\n#endif\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Main(string[] args)\n {\n //while (true)\n {\n #region A. Boy or Girl\n ///*\n\n // wjmzbmr\n\n // */\n //int Notdistinct = 0;\n\n //string Name = Console.ReadLine();\n //for (int i = 0; i < Name.Length; i++)\n //{\n // //Console.WriteLine(i);\n // for (int j = i+1; j < Name.Length; j++)\n // {\n // //Console.WriteLine(j);\n // //Console.WriteLine(Name[i] + \"===\" + Name[j]);\n // if (Name[i]==Name[j])\n // {\n // Notdistinct++;\n // //Console.WriteLine(Notdistinct);\n\n\n // }\n\n // }\n\n //}\n ////Console.WriteLine( Name.Length +\"-\"+Notdistinct+\"=\" +(Name.Length - Notdistinct) );\n\n\n ////Console.WriteLine(\"Result%2=\"+(Name.Length - Notdistinct) % 2);\n\n //if ((Name.Length-Notdistinct)%2==0)\n //{\n // if ((Name.Length - Notdistinct)<0)\n // {\n // Console.WriteLine(\"IGNORE HIM!\");\n // }\n // else\n // {\n // Console.WriteLine(\"CHAT WITH HER!\");\n // }\n\n //}\n //else\n //{\n\n // Console.WriteLine(\"IGNORE HIM!\");\n\n\n //}\n\n #endregion\n\n\n\n\n #region Queue at the School\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int t1 = 0; \n int t = int.Parse(tokens[1]);\n char [] Temp =new char[50] ;\n string x=\"\"; \n\n string Quee = Console.ReadLine();\n for (int i = 0; i < n; i++)\n {\n Temp[i] = Quee[i];\n\n }\n\n //while (true)\n //{\n // try\n // {\n // if (Temp[t1] == Convert.ToChar(\"B\"))\n // {\n // if (Temp[t1 + 1] == Convert.ToChar(\"G\"))\n // {\n // Temp[t1] = Convert.ToChar(\"G\");\n // Temp[t1 + 1] = Convert.ToChar(\"B\");\n // t1++;\n // }\n\n // }\n // t1++;\n // if (t1 >= Quee.Length)\n // {\n // break;\n // }\n // }\n // catch (Exception)\n // {\n\n // throw;\n // }\n\n // }\n for (int ij = 0; ij < t; ij++)\n {\n for (int i = 0; i < n; i++)\n {\n if (Temp[i] == Convert.ToChar(\"B\"))\n {\n if (Temp[i + 1] == Convert.ToChar(\"G\"))\n {\n Temp[i] = Convert.ToChar(\"G\");\n Temp[i + 1] = Convert.ToChar(\"B\");\n i++;\n }\n }\n\n\n }\n }\n \n Console.Write(Temp ); \n \n #endregion\n \n // Console.ReadKey();\n }\n\n\n\n\n }\n \n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i=0;j--)\n {\n Console.Write(queue[j]);\n }\n\n Console.WriteLine();\n\n\n\n\n\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\nnamespace _266B\n{\n class Program\n {\n static void Main()\n {\n var t = Console.ReadLine().Split().Select(int.Parse).ToArray()[1];\n string queue = Console.ReadLine();\n string x = Console.ReadLine(); \n for (int i = 1; i <= t; i++)\n {\n queue.Replace(\"BG\", \"GB\");\n } \n Console.WriteLine(queue); \n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ACM\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tint n = int.Parse(s[0]);\n\t\t\tint k = int.Parse(s[1]);\n\t\t\t\n\t\t\tstring r = Console.ReadLine();\n\t\t\tList boys = new List();\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (r[i] == 'B')\n\t\t\t\t\tboys.Add(i);\n\n\t\t\tint q = Math.Max(boys[boys.Count - 1], n - 1);\n\t\t\tfor (int j = 0; j < k; j++)\n\t\t\t\tfor (int i = 0; i < boys.Count; i++)\n\t\t\t\t\tif (boys[i] < q)\n\t\t\t\t\t\tboys[i]++;\n\n\t\t\tr = \"\";\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (boys.Contains(i))\n\t\t\t\t\tr += 'B';\n\t\t\t\telse\n\t\t\t\t\tr += 'G';\n\t\t\tConsole.WriteLine(r);\n\t\t\t\n\t\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = 0; i < timeStep; i++)\n\t\t{\n for(int j = que.Length-1; j >= 0; j--)\n {\n if (que[i] == 'B')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, 1, que);\n\t\t\t}\n }\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces_console_app\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var nbRooms = Convert.ToInt32(Console.ReadLine());\n var input = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList();\n var seconds = input[1];\n var str = Console.ReadLine();\n var result = string.Empty;\n\n while (seconds > 0){\n for (int i = 0; i < str.Length; i++){\n if (i + 1 < str.Length && str[i] == 'B' && str[i + 1] == 'G'){\n result += \"GB\";\n i++;\n continue;\n }\n\n result += str[i];\n }\n\n str = result;\n seconds--;\n }\n \n\n //var coins = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToList().OrderByDescending(s => s);*/\n\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0447\u0435\u0440\u0435\u0434\u044c_\u0432_\u0448\u043a\u043e\u043b\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nt = Console.ReadLine().Split();\n int n = Convert.ToInt32(nt[0]);\n int t = Convert.ToInt32(nt[1]) + 1;\n string lineString = Console.ReadLine();\n char[] lineMas = new char[n];\n for (int i = 0; i < lineString.Length; i++)\n {\n lineMas[i] = Convert.ToChar(lineString[i]);\n }\n int count = 0;\n for (int i = 0; i < n - 1; i++)\n {\n \n if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)\n {\n lineMas[i] = 'G';\n lineMas[i + 1] = 'B';\n count++;\n }\n if (count == t)\n {\n break;\n }\n }\n for (int i = 0; i < lineMas.Length; i++)\n {\n Console.Write(lineMas[i]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Queue_at_the_School\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = int.Parse(a.Substring(0, a.IndexOf(' ')));\n int t = int.Parse(a.Substring(a.IndexOf(' ') + 1, a.Length - a.IndexOf(' ') - 1));\n int help = t;\n string b = Console.ReadLine(), c = \"\";\n for (int i = 0; i < n; i++)\n {\n help = t;\n if (b[i] == 'B')\n {\n while (help != 0)\n {\n if (i == b.Length - 1)\n {\n break;\n }\n if (b[i + 1] == 'G')\n {\n c += \"G\";\n i++;\n help--;\n }\n else\n {\n break;\n }\n }\n c += \"B\";\n }\n else\n {\n c += \"G\";\n }\n }\n Console.WriteLine(c);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var n = Int32.Parse(input[0]);\n var t = Int32.Parse(input[1]);\n var s = Console.ReadLine().ToArray();\n\n for (int i = n-2; i >= 0; i--)\n {\n if (s[i] == 'B')\n {\n var j = i + 1;\n int step = 0;\n while (j Convert.ToInt32(x));\n int n = arr[0];\n int t = arr[1];\n string queueLine = Console.ReadLine();\n StringBuilder r = new StringBuilder(queueLine);\n while (t > 0)\n {\n for (int i = 0; i < n - 1; i++)\n {\n if (r[i] == 'B' && r[i + 1] == 'G')\n {\n r[i] = 'G';\n r[i + 1] = 'B';\n i = i + 2;\n }\n else\n {\n r[i] = r[i];\n }\n }\n t--;\n }\n Console.WriteLine(r);\n }\n }\n\n\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Problem\n{\n public static void Main()\n {\n int[] nt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = nt[0];\n int t = nt[1];\n\n char[] children = Console.ReadLine().ToCharArray();\n\n for (int i = 0; i < t; i++)\n {\n for (int j = n - 1; j > 0; j -= 2)\n {\n if (children[j] - children[j - 1] > 0)\n {\n char temp = children[j];\n children[j] = children[j - 1];\n children[j - 1] = temp;\n }\n }\n\n if (children.Length % 2 != 0)\n {\n if (children[1] - children[0] > 0)\n {\n char temp = children[1];\n children[1] = children[0];\n children[0] = temp;\n }\n }\n }\n\n Console.WriteLine(string.Join(string.Empty, children));\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = 0; i < timeStep; i++)\n\t\t{\n for(int j = que.Length-1; j >= 0; j--)\n {\n if (que[j] == 'B')\n\t\t\t{\n\t\t\t\tMoveToEnd(j, 1, que);\n\t\t\t}\n }\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(input[0]),\n t = Convert.ToInt32(input[1]);\n string queue = Console.ReadLine();\n string _queue = queue;\n for(int i = 0; i < t; i ++)\n {\n for(int j = 0; j < n - 1; j ++)\n {\n if(queue[j] == 'B' && queue[j+1] == 'G')\n {\n _queue = queue.Substring(0, j) + \"GB\" + queue.Substring(j + 2, queue.Length - j - 2);\n }\n }\n queue = _queue;\n }\n Console.Write(queue);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] p = Console.ReadLine().Split();\n char temp;\n int n = int.Parse(p[0]);\n int t = int.Parse(p[1]);\n char[] s = Console.ReadLine().ToCharArray();\n for (int j = 0; j < t; j++)\n {\n for (int i = 0; i < n - 1; i++) \n {\n if (s[i] == 'B')\n {\n temp = s[i];\n s[i] = s[i + 1];\n s[i + 1] = temp;\n i++;\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tstring strQue = Console.ReadLine().Trim();\n\t\tchar[] que = strQue.ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B' || que[i] == 'b')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B' || que[i + 1] == 'b')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace _266_B_Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split(' ');\n\n int n = int.Parse(token[0]);\n int t = int.Parse(token[1]);\n\n string s = Console.ReadLine();\n char[] c = s.ToCharArray();\n\n for (int i = 0; i < t; i++)\n {\n for (int j = 0; j < n-1; j++)\n {\n if(c[j] != s[j+1] && c[j] != 'G')\n {\n char temp = c[j];\n c[j] = c[j + 1];\n c[j + 1] = temp;\n \n }\n }\n }\n\n foreach (var item in c)\n {\n Console.Write(item);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n static void Main(string[] args)\n {\n\n int n=0, T=0;\n ReadInts(ref n, ref T);\n\n char[] line = Console.ReadLine().ToArray();\n\n for (int t = 0; t < T; t++)\n {\n for (int i = 0; i < line.Length-1; i++)\n {\n if (line[i] == 'B' && line[i + 1] == 'G')\n {\n line[i] = 'G';\n line[i+1] = 'B';\n i++; \n }\n }\n PrintLn(new string(line));\n }\n\n\n PrintLn(new string(line));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nclass test{\n public static void Main(string[] temp){\n int[] NK=Array.ConvertAll(Console.ReadLine().Split(' '),Int32.Parse);\n StringBuilder queue=new StringBuilder(Console.ReadLine());\n for(int i=0;i 0; --j)\n {\n if (line[j] == 'G' && line[j - 1] == 'B')\n { temp = line[j]; line[j] = line[j - 1]; line[j - 1] = temp; }\n }\n }\n }\n Console.WriteLine(new string(line));\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0447\u0435\u0440\u0435\u0434\u044c_\u0432_\u0448\u043a\u043e\u043b\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nt = Console.ReadLine().Split();\n int n = Convert.ToInt32(nt[0]);\n int t = Convert.ToInt32(nt[1]) + 1;\n string lineString = Console.ReadLine();\n char[] lineMas = new char[n];\n for (int i = 0; i < lineString.Length; i++)\n {\n lineMas[i] = Convert.ToChar(lineString[i]);\n }\n int count = 0;\n for (int i = 0; i < n - 1; i++)\n {\n \n if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)\n {\n lineMas[i] = 'G';\n lineMas[i + 1] = 'B';\n count++;\n }\n if (count == t)\n {\n break;\n }\n }\n for (int i = 0; i < lineMas.Length; i++)\n {\n Console.Write(lineMas[i]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0447\u0435\u0440\u0435\u0434\u044c_\u0432_\u0448\u043a\u043e\u043b\u0435\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nt = Console.ReadLine().Split();\n int n = Convert.ToInt32(nt[0]);\n int t = Convert.ToInt32(nt[1]) + 1;\n string lineString = Console.ReadLine();\n char[] lineMas = new char[n];\n for (int i = 0; i < lineString.Length; i++)\n {\n lineMas[i] = Convert.ToChar(lineString[i]);\n }\n int count = 0;\n for (int i = 0; i < n - 1; i++)\n {\n \n if (lineMas[i] == 'B' && lineMas[i + 1] == 'G' && count < t)\n {\n lineMas[i] = 'G';\n lineMas[i + 1] = 'B';\n count++;\n }\n if (count == t)\n {\n break;\n }\n }\n for (int i = 0; i < lineMas.Length; i++)\n {\n Console.Write(lineMas[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n static void Main(string[] args)\n {\n\n int n=0, T=0;\n ReadInts(ref n, ref T);\n\n char[] line = Console.ReadLine().ToArray();\n\n for (int t = 0; t < T; t++)\n {\n for (int i = 0; i < line.Length-1; i++)\n {\n if (line[i] == 'B' && line[i + 1] == 'G')\n {\n line[i] = 'G';\n line[i+1] = 'B';\n i++; \n }\n }\n PrintLn(new string(line));\n }\n\n\n PrintLn(new string(line));\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\ttry\n\t\t{\n\t\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\t\tif (lengthQue < 1) return;\n\t\t\tif (timeStep > 50) return;\n\n\t\t\tstring strQue = Console.ReadLine();\n\t\t\tchar[] que = strQue.Trim().ToUpper().ToCharArray();\n\n\t\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tif (que[i] == 'B')\n\t\t\t\t{\n\t\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstrQue = new String(que);\n\t\t\tConsole.WriteLine(strQue);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tConsole.WriteLine(ex.Message);\n\t\t}\n\n\t\tConsole.ReadLine();\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code\n{\n class Wight\n {\n\n \n\n static void Main(string[] args)\n {\n\n string[] lines = new string[2];\n\n for(int i=0; i=0;j--)\n {\n\n newqueu[count-1-j] = queue[j];\n\n \n \n }\n\n\n\n\n \n for (int m = index; m < count; m++)\n {\n Console.Write(newqueu[m]);\n }\n\n for (int f = 0; f < index; f++)\n {\n Console.Write(newqueu[f]);\n }\n \n \n Console.WriteLine();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n }\n }\n}\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nnamespace CP\n{\n class Program\n {\n static void Main(string [] main)\n {\n int [] nAndT = Array.ConvertAll(Console.ReadLine().Split(' ') , x => Convert.ToInt32(x));\n int n = nAndT[0];\n int t = nAndT[1];\n StringBuilder str = new StringBuilder();\n str.Append(Console.ReadLine());\n for(int i = 0 ; i < t ; i++)\n {\n for(int j = 0 ; j < str.Length - 1 ; j++)\n {\n if(str[j] == 'B' && str[j+1] == 'G')\n {\n str[j+1] = 'B';\n str[j] = 'G';\n }\n j++;\n }\n }\n Console.WriteLine(str);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Xml;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n\n int n = DATA[0], t = DATA[1];\n List Info = Console.ReadLine().ToCharArray().ToList();\n\n int BoyIndexFromInfo = Info.IndexOf('B');\n //BGGBG\n //GGBGB\n while (BoyIndexFromInfo != -1)\n {\n int Counter = 0;\n for (int i = BoyIndexFromInfo+1; i < n; i++)\n {\n if (Info[i] == 'B') break;\n \n if (Counter >= t) break;\n Counter++;\n }\n var D = Info.GetRange(BoyIndexFromInfo, Counter+1);\n D = D.OrderByDescending(x => (int) x).ToList();\n\n int u = 0;\n D[D.IndexOf('B')] = '*';\n for (int i = BoyIndexFromInfo; i <= BoyIndexFromInfo+Counter; i++)\n {\n Info[i] = D[u];\n u++;\n }\n\n BoyIndexFromInfo = Info.IndexOf('B');\n }\n\n Console.WriteLine(string.Join(\"\", Info).Replace('*','B'));\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n int time = int.Parse(Console.ReadLine().Split(' ')[1]);\n\n char[] line = Console.ReadLine().ToCharArray();\n\n for (int t = 0; t < time; t++)\n {\n for (int i = 1; i < line.Length; i++)\n {\n if (line[i] == 'B' && line[i - 1] == 'G')\n {\n char temp = line[i];\n\n line[i] = line[i - 1];\n line[i - 1] = temp;\n\n i += 1;\n }\n }\n }\n\n Console.Write(string.Join(\"\", line));\n }\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\nusing System.Linq;\nusing System.Threading;\nusing System.IO;\nusing System;\n\nnamespace round_159\n{\n class Program\n {\n public static long ReadLong(){\n\t\t\t\t\n\t\t\t\treturn long.Parse(Console.ReadLine());\n\t\t\t\n\t\t\t}\n\t\t\n\t\tpublic static int ReadInt(){\n \n return int.Parse(Console.ReadLine());\n \n }\n\t\t\n\t\tpublic static byte ReadByte(){\n \n return byte.Parse(Console.ReadLine());\n \n }\n \n public static string[] ReadStrArr(){\n \n return Console.ReadLine().Split(' ');\n \n }\n\t\t\n\t\tpublic static int[] ReadIntArr(){\n\t\t\n\t\t\t\tstring[] s;\n\t\t\t\ts=Console.ReadLine().Split(' ');\n\t\t\t\tint[] a=new int[s.Length];\n\t\t\t\tfor (int i=0;ia[i]) return k;\n\t\t\t\telse if (a[k]l)) l++;\n\t\t\t\twhile ((a[r]>=pivot)&&(r>l)) r--;\n\t\t\t\ttmp=a[l];\n\t\t\t\ta[l]=a[r];\n\t\t\t\ta[r]=tmp;\n\t\t\t\t\n\t\t\t};\n\t\t\treturn l;\n\t\t}\n\t\t\n\t\tpublic static void quicksort (int[] a, int i,int j){\n\t\t\t\n\t\t\tint pivotindex=findpivot(a,i,j);\n\t\t\tint k;\n\t\t\tif (pivotindex!=-1) {\n\t\t\t\tk=partion(a,i,j,a[pivotindex]);\n\t\t\t\tquicksort(a,i,k-1);\n\t\t\t\tquicksort(a,k,j);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tpublic static int findpivot(long[] a,int i,int j){\n\t\t\t\n\t\t\tfor (int k=i+1;k<=j;k++){\n\t\t\t\tif (a[k]>a[i]) return k;\n\t\t\t\telse if (a[k]l)) l++;\n\t\t\t\twhile ((a[r]>=pivot)&&(r>l)) r--;\n\t\t\t\ttmp=a[l];\n\t\t\t\ta[l]=a[r];\n\t\t\t\ta[r]=tmp;\n\t\t\t\t\n\t\t\t};\n\t\t\treturn l;\n\t\t}\n\t\t\n\t\tpublic static void quicksort (long[] a, int i,int j){\n\t\t\t\n\t\t\tint pivotindex=findpivot(a,i,j);\n\t\t\tint k;\n\t\t\tif (pivotindex!=-1) {\n\t\t\t\tk=partion(a,i,j,a[pivotindex]);\n\t\t\t\tquicksort(a,i,k-1);\n\t\t\t\tquicksort(a,k,j);\n\t\t\t}\n\t\t\t\n\t\t}\n \n\t\t\n\t\t\n\t\tpublic static void Main(string[] args)\n {\n \n\t\t\tint[] n=ReadIntArr();\n\t\t\tint flag=0;\n\t\t\tstring s=Console.ReadLine();\n\t\t\tchar[] s1=new char[n[0]];\n\t\t\tfor (int i=0;i 0)\n {\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] == \"B\" && s[i + 1] == \"G\") { s[i + 1] = \"B\"; s[i] = \"G\"; i++; }\n }\n }\n Console.WriteLine(string.Join(\"\",s));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n List input = ReadInputParseToList();\n List c = new List();\n int n = input[0];\n int time = input[1];\n string s = Console.ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n c.Add(s[i]);\n }\n\n for (int t = 0; t < time; t++)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = i+1; j < n; j++)\n {\n if (c[i] == 'B' && c[j] == 'G')\n {\n var temp = c[i];\n c[i] = c[j];\n c[j] = temp;\n i += 2;\n }\n else\n {\n i++;\n }\n }\n }\n }\n Console.WriteLine(string.Join(\"\", c));\n \n }\n\n private static List ReadInputParseToList()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace C0deforces\n{\n class QueueAtTheSchool\n {\n static void Main(string[] args)\n {\n int[] NandT = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);\n string s = Console.ReadLine().Trim();\n StringBuilder sb = new StringBuilder();\n while (NandT[1]-- > 0)\n {\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (s[i] == 'B' && s[i + 1] == 'G') { sb.Append(\"GB\"); i++; }\n else { sb.Append(s[i]); }\n }\n s = sb.ToString();\n sb.Clear();\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Swap(ref List list, int index)\n {\n bool temp = list[index - 1];\n list[index - 1] = list[index];\n list[index] = temp;\n }\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(input[0]);\n int t = Convert.ToInt32(input[1]);\n List queue = new List();\n string queueStr = Console.ReadLine();\n for (int i = 0; i < n; i++)\n queue.Add(queueStr[i] == 'B');\n for (int i = 0; i < t; i++)\n {\n for (int b = 0; b < n; b++)\n if (queue[b])\n {\n for (int g = b; g < n; g++)\n {\n b++;\n if (!queue[g])\n {\n Swap(ref queue, g);\n break;\n }\n }\n }\n\n }\n queueStr = \"\";\n for (int i = 0; i < n; i++)\n queueStr += queue[i] ? 'B' : 'G';\n Console.WriteLine(queueStr);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace BoyOrGirl\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n // if count of dist chars is odd\n char[] array = s.ToCharArray();\n array = array.Distinct().ToArray();\n int countOfDistChars = array.Length;\n\n if (countOfDistChars % 2 == 0)\n {\n Console.WriteLine(\"CHAT WITH HER!\");\n }\n else\n {\n Console.WriteLine(\"IGNORE HIM!\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n \n int[] DATA = Enumerable.Select(Console.ReadLine().Split(' '), x => int.Parse(x)).ToArray();\n\n int n = DATA[0], t = DATA[1];\n List Info = Console.ReadLine().ToCharArray().ToList();\n\n //5 2 BBGBBG GBBGBB\n int FirstBoyIndex = Info.IndexOf('B');\n \n\n while (FirstBoyIndex != -1)\n {\n int currentIndex = FirstBoyIndex; int counter = 0;\n for (int i = currentIndex+1; i < n; i++)\n {\n //if (Info[i] == 'B') break;\n if (counter >= t) break;\n counter++;\n }\n int GotoIndex = currentIndex + counter;\n\n List Q = Info.GetRange(currentIndex, (counter+1)).OrderByDescending(x => (int)x).ToList();\n int u = 0;\n for (int i = currentIndex; i <= GotoIndex; i++)\n {\n if (Q[u] == 'B') Info[i] = '*';\n else Info[i] = 'G';\n u++;\n }\n\n\n //for (int i = GotoIndex; i > currentIndex; i--)\n //{\n // if (Info[i] == 'G') {\n // char tmp = Info[i];\n // Info[i] = Info[i - 1]; Info[i - 1] = tmp;\n // }\n //}\n //for (int i = 0; i < counter; i++)\n //{\n // currentIndex = Info.IndexOf('B'); Info[currentIndex] = '*';\n //}\n FirstBoyIndex = Info.IndexOf('B');\n }\n\n Console.WriteLine(string.Join(\"\",Info).Replace('*','B'));\n }\n\n private static IEnumerable Permutate(string source)\n {\n if (source.Length == 1) return new List { source };\n\n var permutations = from c in source\n from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n select c + p;\n\n return permutations;\n }\n\n\n}\n\n\n\n\n\n//private static IEnumerable Permutate(string source)\n//{\n// if (source.Length == 1) return new List { source };\n\n// var permutations = from c in source\n// from p in Permutate(new String(source.Where(x => x != c).ToArray()))\n// select c + p;\n\n// return permutations;\n//}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace QueryInCitchen\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] array = Console.ReadLine().Split(' ')\n .Select(int.Parse).ToArray();\n StringBuilder query = new StringBuilder(Console.ReadLine());\n for (int i = 0; i < array[1]; i++)\n {\n for (int j = 0; j < query.Length; j++)\n {\n try\n {\n if (query[j] == 'B' && query[j + 1] == 'G')\n {\n char tmp = query[j];\n query[j] = query[j + 1];\n query[j + 1] = tmp;\n j++;\n }\n }\n catch (IndexOutOfRangeException)\n {\n continue;\n }\n }\n\n Console.WriteLine(query);\n }\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] inputNum = Console.ReadLine().Split();\n\t\tint lengthQue = int.Parse(inputNum[0]);\n\t\tint timeStep = int.Parse(inputNum[1]);\n\n\t\tif (lengthQue < 1) return;\n\t\tif (timeStep > 50) return;\n\n\t\tstring strQue = Console.ReadLine();\n\t\tchar[] que = strQue.Trim().ToCharArray();\n\n\t\tfor (int i = que.Length - 1; i >= 0; i--)\n\t\t{\n\t\t\tif (que[i] == 'B')\n\t\t\t{\n\t\t\t\tMoveToEnd(i, timeStep, que);\n\t\t\t}\n\t\t}\n\n\t\tstrQue = new String(que);\n\t\tConsole.WriteLine(strQue);\n\t}\n\n\tprivate static void MoveToEnd(int indexChar, int steps, char[] que)\n\t{\n\t\tfor (int i = indexChar; (i < que.Length - 1 && steps-- > 0); i++)\n\t\t{\n\t\t\tif (que[i + 1] == 'B')\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchar temp = que[i + 1];\n\t\t\tque[i + 1] = que[i];\n\t\t\tque[i] = temp;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main() {\n int x = Console.ReadLine().Split(new char[1] { ' ' }).Select(a => int.Parse(a)).Last();\n char[] childs = Console.ReadLine().ToCharArray();\n StringBuilder result = new StringBuilder(100);\n List b = new List();\n int lastBI = -1, i;/*\n5 1\nBGGBG\n */\n for (i = childs.Length - 1; i != -1; i--)\n {\n if (childs[i] == 'B')\n {\n childs[i] = 'G';\n childs[( lastBI = ( childs.Length - 1 - i > x ) ? i + x : childs.Length - 1 )] = 'B';\n break;\n }\n }\n if (lastBI != -1)\n for (i = lastBI - 1; i > -1; i--)\n {\n if (childs[i] == 'B')\n {\n childs[i] = 'G';\n childs[( lastBI = ( lastBI - i > x ) ? i + x : lastBI - 1 )] = 'B';\n }\n }\n\n Console.WriteLine(string.Concat(childs));\n\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}], "src_uid": "964ed316c6e6715120039b0219cc653a"} {"source_code": "using System;\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n bool result = false;\n for (int a = 0; a <= n / 1234567; a++)\n for (int b = 0; b <= n / 123456; b++)\n {\n int x = n - a * 1234567 - b * 123456;\n if (x >= 0 && x % 1234 == 0)\n {\n result = true;\n break;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n\n int n = int.Parse(Console.ReadLine());\n var ans = false;\n \n while (n > 0)\n {\n if (n % 1234 == 0 || n % 123456 == 0 || n % 1234567 == 0)\n {\n ans = true;\n break;\n }\n else\n {\n var copy = n;\n \n while (copy > 0)\n { \n if (copy % 1234 == 0)\n { \n ans = true;\n break;\n }\n copy -= 123456;\n }\n }\n n -= 1234567;\n \n }\n Console.WriteLine(ans ? \"YES\":\"NO\"); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Web.Script.Serialization;\nusing System.Numerics;\n\nclass Program\n{/*\n public class Point\n {\n public int X;\n public int Y;\n\n public Point(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public static Point operator +(Point a, Point b)\n {\n return new Point(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point operator -(Point a, Point b)\n {\n return new Point(a.X - b.X, a.Y - b.Y);\n }\n\n public double Dist()\n {\n return Math.Sqrt(this.DistRoot());\n }\n\n public long DistRoot()\n {\n return this.X * (long)this.X + this.Y * (long)this.Y;\n }\n\n public override string ToString()\n {\n return this.X + \" \" + this.Y;\n }\n }\n\n public class Segment\n {\n public Point A;\n public Point B;\n\n public Segment(Point a, Point b)\n {\n this.A = a;\n this.B = b;\n }\n\n public double Dist()\n {\n return (this.A - this.B).Dist();\n }\n\n public long DistRoot()\n {\n return (this.A - this.B).DistRoot();\n }\n }\n\n private static Point ReadPoint()\n {\n return new Point(ReadInt(), ReadInt());\n }\n\n public static long ScalarProduct(Point a, Point b)\n {\n return a.X * (long)b.Y - b.X * (long)a.Y;\n }\n\n public static bool OnLine(Segment line, Point p)\n {\n var v1 = line.B - line.A;\n var v2 = p - line.A;\n\n if (v2.X == 0 && v2.Y == 0) return true;\n if (v2.X == v1.X && v2.Y == v1.Y) return true;\n if (ScalarProduct(v1, v2) != 0) return false;\n\n if (v2.DistRoot() > v1.DistRoot()) return false;\n\n if (v1.X != 0 && v2.X != 0)\n {\n return (v1.X > 0) == (v2.X > 0);\n }\n\n if (v1.Y != 0 && v2.Y != 0)\n {\n return (v1.Y > 0) == (v2.Y > 0);\n }\n\n throw new NotSupportedException(\"wtf?\");\n }\n\n public static bool Crossed(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 < 0 && sp2 < 0) return false;\n if (sp1 > 0 && sp2 > 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 < 0 && sp4 < 0) return false;\n if (sp3 > 0 && sp4 > 0) return false;\n\n return true;\n }\n\n public static bool CrossedNoTouch(Segment a, Segment b)\n {\n var sp1 = ScalarProduct(a.B - a.A, b.A - a.A);\n var sp2 = ScalarProduct(a.B - a.A, b.B - a.A);\n if (sp1 <= 0 && sp2 <= 0) return false;\n if (sp1 >= 0 && sp2 >= 0) return false;\n\n var sp3 = ScalarProduct(b.B - b.A, a.A - b.A);\n var sp4 = ScalarProduct(b.B - b.A, a.B - b.A);\n if (sp3 <= 0 && sp4 <= 0) return false;\n if (sp3 >= 0 && sp4 >= 0) return false;\n\n return true;\n }\n\n private static double Solve(Point s, Point t, Point a, Point b, Point c)\n {\n var st = new Segment(s, t);\n var ab = new Segment(a, b);\n var bc = new Segment(b, c);\n var ac = new Segment(a, c);\n\n\n if (ScalarProduct(b - a, c - a) == 0)\n {\n var q = ab;\n if (q.Dist() < bc.Dist()) q = bc;\n if (q.Dist() < ac.Dist()) q = ac;\n\n if (Crossed(q, st))\n {\n var d1 = (q.A - s).Dist() + (q.A - t).Dist();\n var d2 = (q.B - s).Dist() + (q.B - t).Dist();\n return Math.Min(d1, d2);\n }\n\n return (s - t).Dist();\n }\n\n if (!Crossed(ab, st) && !Crossed(bc, st))\n {\n return (s - t).Dist();\n }\n\n p[0] = s;\n p[1] = t;\n p[2] = a;\n p[3] = b;\n p[4] = c;\n\n for (int i = 0; i < d.Length; i++) d[i] = 1e10;\n\n Go(0, 0);\n\n return d[1];\n }\n\n private static Point[] p = new Point[5];\n private static double[] d = new double[5];\n private static void Go(int pos, double dist)\n {\n if (d[pos] < dist) return;\n d[pos] = dist;\n if (pos == 1) return;\n\n\n }*/\n\n private static void Main(string[] args)\n {\n /*\n PushTestData(@\"\n1\n0 0 0 10 -10 20 0 1 10 20\n0 0 0 10 -10 20 1 1 10 20\n0 0 0 10 -10 20 -1 1 10 20\n\n0 0 0 10 -10 1 0 1 10 1\n0 0 0 10 -10 1 1 1 10 1\n0 0 0 10 -10 1 -1 1 10 1\n\n\n\n\n\n\");\n\n int n = ReadInt();\n double[] answer = new double[n];\n for (int i = 0; i < n; i++)\n {\n var s = ReadPoint();\n var t = ReadPoint();\n var a = ReadPoint();\n var b = ReadPoint();\n var c = ReadPoint();\n\n answer[i] = Solve(s, t, a, b, c);\n }\n\n Console.WriteLine(string.Join(Environment.NewLine, answer));*/\n var v1 = 1234567;\n var v2 = 123456;\n var v3 = 1234;\n\n int n = ReadInt();\n\n bool isGood = false;\n for (int i = 0; i <= n; i += v1)\n for (int j = i; j <= n; j += v2)\n {\n isGood |= ((n - j) % v3 == 0);\n }\n Console.Write(isGood ? \"YES\" : \"NO\");\n }\n\n private static long IsValid(List m, long maxSum)\n {\n long x = 0;\n for (int i = 0; i < m.Count; i++)\n {\n x += Sqr3(m[i]);\n if (Sqr3(m[i] + 1) <= x)\n return -1;\n }\n\n return x <= maxSum ? x : -1;\n }\n\n private static List GetGreedy(long x)\n {\n long p = 1;\n long total = 0;\n List values = new List();\n while (total + Sqr3(p) <= x)\n {\n if (total + Sqr3(p) < Sqr3(p + 1))\n {\n total += Sqr3(p);\n values.Add(p);\n }\n else p++;\n }\n\n return values;\n }\n\n private static long Sqr3(long x)\n {\n return x * x * x;\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _681B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n int costA = 1234567;\n int costB = 123456;\n int costC = 1234;\n\n for (int a = 0; a * costA <= n; a++)\n {\n for (int b = 0; a * costA + b * costB <= n; b++)\n {\n int c = (n - a * costA - b * costB) / costC;\n\n if (a * costA + b * costB + c * costC == n)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n for (int a = 0; a <= count; a += 1234567)\n {\n for (int b = 0; b <= count - a; b += 123456)\n {\n if ((count - a - b) % 1234 == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace atobtoc\n{\n \n class Program\n {\n private static bool t=false;\n\n static void ex1(double input)\n {\n if (input/1234567 == (int)(input/1234567))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 123456 == (int)(input / 123456))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1234 == (int)(input / 1234) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 124690 == (int)(input / 124690) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1235801 == (int)(input / 1235801) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1358023 == (int)(input / 1358023) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1359257 == (int)(input / 1359257) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n \n }\n static void ex2(double input ,double a,double b)\n { int x=1, y=2;\n while (x <= a)\n {\n y = ((System.Convert.ToInt32(b)-10*x)*98)/100;\n\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t==true )\n { y = 1; break; }\n if (x*1234567+y*123456==input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex3(double input, double b, double c)\n {\n int x = 1, y = 2;\n while (x <= b)\n {\n y = ((System.Convert.ToInt32(c) - 100 * x) * 98) / 100;\n while (y <= c)\n {\n if (x * 123456 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 123456 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex4(double input, double c, double a)\n {\n int x = 1, y = 2;\n while (x <= a)\n {\n y = ((System.Convert.ToInt32(c) - 1000 * x) * 98) / 100;\n while (y <= c)\n {\n if (x * 1234567 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 1234567 + y * 1234 == input|| x * 1234567 + ++y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex5(double input, double a, double b, double c)\n {\n int x = 1, y = 1, z = 2;\n while (x <= a)\n {\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t == true)\n { y = 1; break; }\n z = ((System.Convert.ToInt32(c) - 1000 * x -100*y) * 98) / 100;\n while (z <= c)\n {\n if (x * 1234567 + y * 123456 +z*1234 > input || t == true)\n { z = 1; break; }\n \n if (x * 1234567 + y * 123456 + z * 1234 == input|| x * 1234567 + y * 123456 + ++z * 1234 == input )\n { System.Console.WriteLine(\"YES\"); t = true; }\n z++;\n }\n y++;\n }\n x++;\n }\n\n\n }\n static void Main(string[] args)\n {\n double input,a=0,b=0,c=0;\n input= System.Convert.ToInt64(System.Console.ReadLine());\n a = input / 1234567;\n b = input / 123456;\n c = input / 1234; \n System.Threading.Tasks.Parallel.Invoke(() => ex1(input), () => ex2(input,a,b),() => ex3(input,b,c), () => ex4(input,c,a), () => ex5(input,a,b,c));\n if (t == false) { System.Console.WriteLine(\"NO\"); }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(@\"input.txt\");\n //_writer = new StreamWriter(@\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private bool result = false;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/problemset/problem/681/B\n\n var n = _reader.ReadInt();\n\n for (int a = 0; a <= n / 1234567; a++)\n {\n for (int b = 0; b <= (n - a * 1234567) / 123456; b++)\n {\n if ((n - a * 1234567 - b * 123456) % 1234 == 0)\n {\n result = true;\n break;\n }\n }\n }\n\n return this;\n }\n\n public override void OutputResult()\n {\n string answer = result ? \"YES\" : \"NO\";\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _357b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var n = readInt();\n var a1 = 1234567;\n var b1 = 123456;\n var c1 = 1234;\n\n var a = 0;\n \n var can = false;\n while (true)\n {\n var rem = n - a1 * a;\n if (rem == 0)\n {\n can = true;\n break;\n }\n else if (rem < 0)\n {\n break;\n }\n\n var b = 0;\n while (true)\n {\n var rem2 = rem - b * b1;\n if (rem2 == 0)\n {\n can = true;\n break;\n }\n else if (rem2 < 0)\n {\n break;\n }\n\n var c = rem2 % c1;\n if (c == 0)\n {\n can = true;\n break;\n }\n\n b++;\n }\n\n if (can)\n {\n break;\n }\n\n a++;\n\n }\n\n if (can)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static Random rand = new Random(0);\n\n static void Main(string[] args)\n {\n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n long n = input.NextLong();\n bool ok = false;\n for (long a = 0; a < 820; a++)\n {\n for (long b = 0; b < 8200; b++)\n {\n long mul = a * 1234567L + b * 123456L;\n if (mul <= n)\n {\n ok |= ((n - mul) % 1234 == 0);\n }\n }\n }\n writer.WriteLine(ok ? \"YES\" : \"NO\");\n\n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Flush();\n writer.Close();\n reader.Close();\n }\n }\n\n class MyInt\n {\n public int data;\n\n }\n\n class MyPair\n {\n public int x, y;\n\n public MyPair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static int n;\n\n static void solve( ) {\n n = int.Parse( Console.ReadLine( ) );\n\n bool sol = false;\n for ( int a = 0; a * 1234567 <= n; a++ )\n for ( int b = 0; b * 123456 <= n - a * 1234567; b++ )\n if ( (n - a * 1234567 - b * 123456) % 1234 == 0 )\n sol = true;\n Console.Write( \"{0}\", ( sol ? \"YES\" : \"NO\" ) );\n }\n\n static void Main( string[ ] args ) {\n solve( );\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nusing PE = System.Numerics.Complex;\nusing Number = System.Int32;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Long();\n const long u = 1234567, v = 123456, r = 1234;\n for (int i = 0; i < 820; i++)\n for (int j = 0; j < 8200; j++)\n {\n if (u * i + v * j > n) break;\n var rem = n - u * i - v * j;\n if (rem % r == 0)\n {\n IO.Printer.Out.WriteLine(\"YES\");\n return;\n }\n }\n IO.Printer.Out.WriteLine(\"NO\");\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\n\n }\n}\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer: StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine());\n\n for (int a = n / 1234567; a >= 0; a--)\n {\n for (int b = (n - 1234567*a) / 123456; b >= 0; b--)\n {\n for (int c = (n - 1234567*a - 123456*b) / 1234; c >= 0; c--)\n {\n if (1234567 * a + 123456 * b + 1234 * c == n)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var n = sr.NextInt64();\n var first = 1234567L;\n var second = 123456L;\n var third = 1234L;\n const long max = 1000000000L;\n var firstSet = new List();\n var secondSet = new List();\n var thirdSet = new List();\n firstSet.Add(0);\n secondSet.Add(0);\n thirdSet.Add(0);\n var curr1 = 0L;\n var indx = 1;\n while (curr1 <= max) {\n curr1 = first * indx;\n firstSet.Add(curr1);\n indx++;\n }\n var curr2 = 0L;\n indx = 1;\n while (curr2 <= max)\n {\n curr2 = second * indx;\n secondSet.Add(curr2);\n indx++;\n }\n for (var i = 0; i < firstSet.Count; i++) {\n for (var j = 0; j < secondSet.Count; j++) {\n var result = firstSet[i] + secondSet[j];\n var r = n - result;\n if (r == 0) {\n sw.WriteLine(\"YES\");\n return;\n }\n else {\n if (r > 0 && r % third == 0) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n }\n }\n\n sw.WriteLine(\"NO\");\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose) {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Money\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n long lim_a = n / 1234567;\n\n bool q = false;\n\n for (long a=0;a<=lim_a;a++)\n {\n long k = n - a * 1234567;\n long lim_b = k / 123456;\n\n for (long b=0;b<=lim_b;b++)\n {\n if( (k-b*123456)%1234==0)\n {\n q = true;\n break;\n }\n }\n\n if (q) break;\n }\n\n if (q) Console.Write(\"YES\"); else Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Economy_Game\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n for (int a = 0; a <= n; a += 1234567)\n {\n for (int b = 0; b <= n - a; b += 123456)\n {\n if ((n - a - b)%1234 == 0)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n for (int hourses = 0; hourses <= n/Houses; hourses++)\n {\n int diff = n - hourses*Houses;\n for (int cars = 0; cars <= diff/Cars; cars++)\n {\n if ((n - hourses*Houses - cars*Cars)%Comps == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n if (n % 1234567 == 0 || n % 123456 == 0 || n % 1234 == 0)\n Console.WriteLine(\"YES\");\n else\n {\n var finded = false;\n for (int i = 0; i < Math.Ceiling(n / 1234567.0); i++)\n {\n var need = n - i * 1234567;\n if (need % 1234567 == 0 || n % 1234 == 0 || need % 123456 == 0)\n {\n finded = true;\n break;\n }\n for (int g = 0; g < Math.Ceiling(need / 123456.0); g++)\n {\n var anotherNeed = need - g * 123456;\n if (anotherNeed % 1234 == 0 || anotherNeed % 1234567 == 0 || anotherNeed % 123456 == 0)\n {\n finded = true;\n break;\n }\n }\n if (finded)\n break;\n }\n if (finded)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n var n = ReadLong();\n for (long a = 0; a < 1000; a++)\n {\n for (long b = 0; b < 10000; b++)\n {\n var diff = n - 1234567 * a - 123456 * b;\n if (diff >= 0 && diff % 1234 == 0)\n return \"YES\";\n }\n }\n return \"NO\";\n }\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // Cell[,] cells;\n // int componentCount;\n // BFS(table, out cells, out componentCount);\n // var ccWeights = new int[componentCount + 1];\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (cells[i, j].CCNumber > 0)\n // ccWeights[cells[i, j].CCNumber]++;\n // }\n // }\n // for (int z = 0; z < n - k + 1; z++)\n // {\n // var active = new int[k, k];\n // var ccStats = new int[componentCount + 1];\n // var touchedCCs = new HashSet();\n // for (int i = z; i < z + k; i++)\n // {\n // for (int j = 0; j < k; j++)\n // {\n // if (cells[i, j].CCNumber > 0)\n // {\n // ccStats[cells[i, j].CCNumber] += 1;\n // touchedCCs.Add(cells[i, j].CCNumber);\n // }\n // }\n // }\n\n // }\n // }\n //}\n void BFS(bool[,] input, out Cell[,] cells, out int componentCount)\n {\n var n = input.GetLength(0);\n cells = new Cell[n, n];\n var visited = new bool[n, n];\n var componentIndex = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (!visited[i, j] && input[i, j])\n BFS(i, j, cells, input, visited, ++componentIndex);\n componentCount = componentIndex;\n }\n\n void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n {\n var n = input.GetLength(0);\n visited[i, j] = true;\n cells[i, j].CCNumber = ccIndex;\n var neighbours = new[] { Struct.Create(i + 1, j), Struct.Create(i - 1, j), Struct.Create(i, j + 1), Struct.Create(i, j - 1) };\n foreach (var c in neighbours.Where(x => x.Item1 >= 0 && x.Item1 < n && x.Item2 >= 0 && x.Item2 < n && !visited[x.Item1, x.Item2] && input[x.Item1, x.Item2]))\n BFS(c.Item1, c.Item2, cells, input, visited, ccIndex);\n }\n\n struct Cell\n {\n public int CCNumber { get; set; }\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _681B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int aCount = n / 1234567;\n int bCount = n / 123456;\n for(int i=0; i<= aCount; i++)\n {\n for(int j=0; j<=bCount; j++)\n {\n int bufBalance = n - i * 1234567 - j * 123456;\n if(bufBalance%1234==0 && bufBalance>=0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int[] v = { 1234567, 123456, 1234 };\n\n public void Solve()\n {\n int n = ReadInt();\n for (int a = 0; a * v[0] <= n; a++)\n for (int b = 0; a * v[0] + b * v[1] <= n; b++)\n if ((n - a * v[0] - b * v[1]) % 1234 == 0)\n {\n Write(\"YES\");\n return;\n }\n\n Write(\"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\t//System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo (\"en-US\");\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tstring ans=\"NO\";\n\t\tfor (int i = 0; i <= n/1234567+1; i++) {\n\t\t\tint x = n - i * 1234567;\n\t\t\tfor (int j = 0; j <= x / 123456 + 1; j++) {\n\t\t\t\tint y = x - j * 123456;\n\t\t\t\tif (y >= 0 && y % 1234 == 0) {\n\t\t\t\t\tans = \"YES\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (ans);\n\t\t//Console.ReadKey ();\n\n\t}\n};"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private const int a = 1234;\n private const int b = 123456;\n private const int c = 1234567;\n private static void Main(string[] args)\n {\n int n, x, y; n = RI();\n if (n % a == 0) { Console.WriteLine(\"YES\"); return; }\n if (n % b == 0) { Console.WriteLine(\"YES\"); return; }\n if (n % c == 0) { Console.WriteLine(\"YES\"); return; }\n x = n / c; y = n / b;\n for (int i = 0; i <= x; i++)\n {\n if ((n - i * c) >= 0 && (n - i * c) % b == 0) { Console.WriteLine(\"YES\"); return; }\n if ((n - i * c) >= 0 && (n - i * c) % a == 0) { Console.WriteLine(\"YES\"); return; }\n for (int j = 0; j <= y; j++)\n {\n if ((n - i * c - j * b) >= 0 && (n - i * c - j * b) % a == 0) { Console.WriteLine(\"YES\"); return; }\n if ((n - j * b >= 0) && (n - j * b) % a == 0) { Console.WriteLine(\"YES\"); return; }\n if ((n - j * b) >= 0 && (n - j * b) % c == 0) { Console.WriteLine(\"YES\"); return; }\n }\n }\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n #region Data Read\n\n #region int GCD\n private static int GCD(int a, int b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n #endregion\n\n #region List[] ReadTree(int n)\n private static List[] ReadTree(int n)\n {\n return ReadGraph(n, n - 1);\n }\n #endregion\n\n #region ist[] ReadGraph(int n, int m)\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n #endregion\n\n #region int[,] ReadGraphAsMatrix(int n, int m)\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n #endregion\n\n #region void Sort(ref int a, ref int b)\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n #endregion\n\n #region void Swap(ref int a, ref int b)\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n #endregion\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n private const int Mod = 1000000000 + 7;\n\n #region int RI()\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n #endregion\n\n #region ulong RUL()\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n #endregion\n\n #region long RL()\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n #endregion\n\n #region int[] RIA(int n)\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n #endregion\n\n #region long[] RLA(int n)\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n #endregion\n\n #region char[] ReadWord()\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));\n\n return s.ToArray();\n }\n #endregion\n\n #region char[] ReadString(int n)\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n #endregion\n\n #region char[] ReadStringLine()\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n #endregion\n\n #region char ReadLetter()\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n #endregion\n\n #region char ReadNonLetter()\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n #endregion\n\n #region char ReadAnyOf(IEnumerable allowed)\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n #endregion\n\n #region char ReadDigit()\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n #endregion\n\n #region int ReadDigitInt()\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n #endregion\n\n #region char ReadAnyChar()\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n #endregion\n\n #region string DoubleToString(double x)\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n #endregion\n\n #region double DoubleFromString(string x)\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n #endregion\n\n #region Program()\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n for(int a = 0; a <= n / 1234567; a++)\n {\n for(int b = 0; b <= n / 123456; b++)\n {\n int temp = (n - a * 1234567 - b * 123456);\n if (temp % 1234 == 0 && temp >= 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRound357B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string str = \"NO\";\n for (int i = 0; i <= n / 1234567; i++)\n {\n int lim_j = (n - i * 1234567) / 123456;\n for (int j = 0; j <= lim_j; j++)\n {\n if ((n - i * 1234567 - j * 123456) % 1234 == 0)\n {\n str = \"YES\";\n }\n if (str == \"YES\")\n break;\n }\n if (str == \"YES\")\n break;\n }\n\n Console.WriteLine(str);\n //n = Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n bool pr = false;\n //int i, j, k = 0;\n\n //for (i = 0; i * 1234567 <= n; i++)\n //{\n // for (j = 0; j * 123456 <= n - i * 1234567; j++)\n // {\n // for (k = 0; k * 1234 <= n - i * 1234567 - j * 123456; k++)\n // {\n // if (n - i * 1234567 - j * 123456 - k * 1234 == 0)\n // {\n // pr = true;\n // break;\n // }\n // }\n // }\n\n //}\n\n\n for (int i = n / 1234567; i >= 0; i--)\n {\n for (int j = (n - 1234567 * i) / 123456; j >= 0; j--)\n {\n if ((n - i * 1234567 - j * 123456) % 1234 == 0)\n {\n pr = true;\n break;\n }\n }\n\n }\n\n if (pr) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n/*\nWe can simply try every a from 0 to n/\u20091234567 and b from 0 t\u043e n/\u2009123456,\nand if n\u2009-\u2009a*\u20091234567\u2009-\u2009b*\u2009123456 is non-negative and divided by 1234,\nthen the answer is \"YES\".\n\nIf there is no such a and b, then the answer is \"NO\".\n*/\npublic static class B___Economy_Game\n{\n public static void Solve()\n {\n int n = ReadInt();\n\n for (int a = 0; a <= n; a += 1234567)\n {\n for (int b = 0; b <= n - a; b += 123456)\n {\n if ((n - a - b) % 1234 == 0)\n {\n Write(\"YES\");\n return;\n }\n }\n }\n\n Write(\"NO\");\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new B___Economy_Game().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace TopCoder.Test.CodeForces.Batch681\n{\n public class Program681B\n {\n private const int MAX = 1000000000;\n private const int HOUSE = 1234567;\n private const int CAR = 123456;\n private const int COMPUTER = 1234;\n\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n bool result = Simulate(n);\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n\n public static bool Simulate(int n)\n {\n int maxH = MAX / HOUSE + 1;\n int maxC = MAX / CAR + 1;\n\n for (int i = 0; i <= maxH; i++)\n for (int j = 0; j <= maxC; j++)\n {\n int sum = i * HOUSE + j * CAR;\n if (sum <= n && (n - sum) % COMPUTER == 0)\n return true;\n }\n\n return false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeforcesProblemSolving\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\n\t\t\t// a\u2009\u00d7\u20091234567\u2009+\u2009b\u2009\u00d7\u2009123456\u2009+\u2009c\u2009\u00d7\u20091234\u2009=\u2009n\n\t\t\tfor (int a = 0; a <= n / 1234567; a++)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b <= n / 123456; b++)\n\t\t\t\t{\n\t\t\t\t\tint res = n - a*1234567 - b*123456;\n\t\t\t\t\tif (res < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (res % 1234 == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine( \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List getLongList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long getLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic bool was;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getLong();\n\t\t\tfor (var i = 0; i <= 1000; ++i)\n\t\t\t\tfor (var j = 0; j <= 10000; ++j)\n\t\t\t\t{\n\t\t\t\t\tlong x = (n - i * 1234567 - j * 123456);\n\t\t\t\t\tif (x >= 0 && x % 1234 == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tConsole.WriteLine(\"NO\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\nclass Program\n{\n \n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = ri;\n for (int a = 0; a <= 810; a++)\n {\n for (int b = 0; b <= 8100; b++)\n {\n var d = n - (a * 1234567 + b * 123456);\n if (d >= 0)\n {\n d %= 1234;\n if (d == 0)\n {\n wln(\"YES\");\n return;\n }\n }\n }\n }\n wln(\"NO\");\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o + \" \"); }\n static void wrt(object o) { Console.Write(o); }\n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Economy_Game\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n for (int a = 0; a <= n; a += 1234567)\n {\n for (int b = 0; b < n - a; b += 123456)\n {\n if ((n - a - b)%1234 == 0)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n if (n % 1234567 == 0 || n % 123456 == 0 || n % 1234 == 0)\n Console.WriteLine(\"YES\");\n else\n {\n var finded = false;\n for (int i = 0; i < Math.Ceiling(n / 1234567.0); i++)\n {\n var need = n - i * 1234567;\n if (need % 1234567 == 0 || n % 1234 == 0 || need % 123456 == 0)\n {\n finded = true;\n break;\n }\n for (int g = 0; g < Math.Ceiling(need / 123456.0); g++)\n {\n var anotherNeed = need - g * 1234;\n if (anotherNeed % 1234 == 0 || anotherNeed % 1234567 == 0 || anotherNeed % 123456 == 0)\n {\n finded = true;\n break;\n }\n }\n if (finded)\n break;\n }\n if (finded)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n bool result = false;\n for (int a = 0; a <= n / 1234567; a++)\n for (int b = 0; b <= 123456; b++)\n {\n int x = n - a * 1234567 - b * 123456;\n if (x >= 0 && x % 1234 == 0)\n {\n result = true;\n break;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n bool result = false;\n for (int a = 0; a <= n / 1234567; a++)\n for (int b = 0; b <= 123456; b++)\n {\n int x = n - a * 1234567 - b * 123456;\n if (x % 1234 == 0)\n {\n result = true;\n break;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n long n = long.Parse(Console.ReadLine());\n bool result = false;\n if (n % 1234567 == 0)\n result = true;\n else\n {\n n = n % 1234567;\n if (n % 123456 == 0)\n result = true;\n else\n {\n n = n % 123456;\n if (n % 1234 == 0)\n result = true;\n }\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static int n;\n\n static void solve( ) {\n n = int.Parse( Console.ReadLine( ) );\n\n bool sol = false;\n for ( int a = 0; a * 1234567 <= n; a++ )\n for ( int b = 0; b * 123456 <= n - a * 1234567; b++ )\n if ( n - a * 1234567 - b * 123456 % 1234 == 0 )\n sol = true;\n Console.Write( \"{0}\", ( sol ? \"YES\" : \"NO\" ) );\n }\n\n static void Main( string[ ] args ) {\n solve( );\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n if (\n n % Houses == 0 || \n n % Cars == 0 ||\n n % Comps == 0 ||\n ((n % Houses)%Cars) == 0 ||\n ((n % Houses)% Comps) == 0 ||\n ((n % Cars)%Comps) == 0 \n //((((n % Houses) % Cars) % Comps) == 0)\n )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n if ((((n%Houses)%Cars)%Comps) == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n var houses = n/Houses;\n var cars = (n%Houses)/Cars;\n var comps = ((n%Houses)%Cars)/Comps;\n\n if (n - (houses * Houses + cars * Cars + comps * Comps) == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n if (\n n % Houses == 0 || \n n % Cars == 0 ||\n n % Comps == 0 ||\n ((n % Houses)%Cars) == 0 ||\n ((n % Houses)% Comps) == 0 ||\n ((n % Cars)%Comps) == 0 ||\n ((((n % Houses) % Cars) % Comps) == 0)\n )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n var houses = n/Houses;\n var cars = (n%Houses)/Cars;\n var comps = ((n%Houses)%Cars)/Comps;\n\n if (\n houses > 0 \n &&\n cars > 0 \n &&\n comps > 0\n &&\n (n - (houses * Houses + cars * Cars + comps * Comps) == 0))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n const int Houses = 1234567;\n const int Cars = 123456;\n const int Comps = 1234;\n\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n if ((((n%Houses)%Cars)%Comps) == 0 || ((n%Cars)%Comps) == 0 || n % Comps == 0 || n % Cars == 0 || n % Houses == 0)\n\n {\n Console.WriteLine(\"YES\");\n return;\n }\n \n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n for(int a = 0; a <= n / 1234567; a++)\n {\n for(int b = 0; b <= n / 123456; b++)\n {\n int temp = (n - a * 1234567 - b * 123456);\n if (temp % 1234 == 0 && temp > 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace TopCoder.Test.CodeForces.Batch681\n{\n public class Program681B\n {\n private const int MAX = 1000000000;\n private const int HOUSE = 1234567;\n private const int CAR = 123456;\n private const int COMPUTER = 1234;\n\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n bool result = Simulate(n);\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n\n public static bool Simulate(int n)\n {\n int maxH = MAX / HOUSE + 1;\n int maxC = MAX / CAR + 1;\n\n for (int i = 0; i <= maxH; i++)\n for (int j = 0; j <= maxC; j++)\n if ((n - i * HOUSE - j * CAR) % COMPUTER == 0)\n return true;\n\n return false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeforcesProblemSolving\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\n\t\t\t// a\u2009\u00d7\u20091234567\u2009+\u2009b\u2009\u00d7\u2009123456\u2009+\u2009c\u2009\u00d7\u20091234\u2009=\u2009n\n\t\t\tfor (int a = 0; a < n / 1234567; a++)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < n / 123456; b++)\n\t\t\t\t{\n\t\t\t\t\tint res = n - a*1234567 - b*123456;\n\t\t\t\t\tif (res < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (res == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (int c = 1; c < res; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (res % c == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine( \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeforcesProblemSolving\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tbool result = false;\n\n\t\t\t// a\u2009\u00d7\u20091234567\u2009+\u2009b\u2009\u00d7\u2009123456\u2009+\u2009c\u2009\u00d7\u20091234\u2009=\u2009n\n\t\t\tfor (int a = 0; a < n / 1234567; a++)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < n / 123456; b++)\n\t\t\t\t{\n\t\t\t\t\tint c = n - a*1234567 - b*123456;\n\t\t\t\t\tif (c >= 0 && c % 1234 == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(result ? \"YES\" : \"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\n\nnamespace _681B\n{\n class Program\n {\n static void Main()\n {\n\n int n = int.Parse(Console.ReadLine());\n var ans = false;\n \n while (n > 0)\n {\n if (n % 1234 == 0 || n % 123456 == 0 || n % 1234567 == 0)\n {\n ans = true;\n break;\n }\n else\n {\n var copy = n;\n \n while (copy > 0)\n {\n copy -= 123456; \n if (copy % 1234 == 0)\n { \n ans = true;\n break;\n }\n }\n }\n n -= 1234567;\n \n }\n Console.WriteLine(ans ? \"YES\":\"NO\"); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(int count)\n {\n if (count == 0)\n {\n return true;\n }\n if (count < 0)\n {\n return false;\n }\n int one = count / 1234567;\n if ((one) > 0)\n {\n if (Get(count - 1234567*one))\n {\n return true;\n }\n if (one - 1 > 0)\n {\n if (Get(count - 1234567 * (one - 1)))\n {\n return true;\n }\n }\n if (one - 2 > 0)\n {\n if (Get(count - 1234567 * (one - 2)))\n {\n return true;\n }\n }\n }\n int two = count / 123456;\n if (two > 0)\n {\n if (Get(count - 123456 * two))\n {\n return true;\n }\n if (two - 1 > 0)\n {\n if (Get(count - 123456 * (two - 1)))\n {\n return true;\n }\n }\n if (two - 2 > 0)\n {\n if (Get(count - 123456 * (two - 2)))\n {\n return true;\n }\n }\n }\n int three = count % 1234;\n if (three == 0)\n {\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n if (count - 1234567 - 123456 - 1234 < 0)\n {\n Console.WriteLine(\"NO\");\n }\n if ((count % 1234567 == 0)||(count % 123456 == 0)||(count % 1234 == 0))\n {\n Console.WriteLine(\"YES\");\n }\n if (Get(count))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(int count)\n {\n if (count == 0)\n {\n return true;\n }\n if (count < 0)\n {\n return false;\n }\n int one = count / 1234567;\n if ((one) > 0)\n {\n if (Get(count - 1234567*one))\n {\n return true;\n }\n if (one - 1 > 0)\n {\n if (Get(count - 1234567 * (one - 1)))\n {\n return true;\n }\n }\n if (one - 2 > 0)\n {\n if (Get(count - 1234567 * (one - 2)))\n {\n return true;\n }\n }\n }\n int two = count / 123456;\n if (two > 0)\n {\n if (Get(count - 123456 * two))\n {\n return true;\n }\n if (two - 1 > 0)\n {\n if (Get(count - 123456 * (two - 1)))\n {\n return true;\n }\n }\n if (two - 2 > 0)\n {\n if (Get(count - 123456 * (two - 2)))\n {\n return true;\n }\n }\n }\n int three = count % 1234;\n if (three == 0)\n {\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n if ((count % 1234567 == 0)||(count % 123456 == 0)||(count % 1234 == 0))\n {\n Console.WriteLine(\"YES\");\n }\n if (Get(count))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(int count)\n {\n if (count == 0)\n {\n return true;\n }\n if (count < 0)\n {\n return false;\n }\n int one = count / 1234567;\n if ((one) > 0)\n {\n if (Get(count - 1234567*one))\n {\n return true;\n }\n }\n int two = count / 123456;\n if (two > 0)\n {\n if (Get(count - 123456*two))\n {\n return true;\n }\n }\n int three = count % 1234;\n if (three == 0)\n {\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n if (Get(count))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(long count)\n {\n if (count == 0)\n {\n return true;\n }\n if (count / 1234567 > 0)\n {\n if (Get(count - 1234567))\n {\n return true;\n }\n }\n if (count / 123456 > 0)\n {\n if (Get(count - 123456))\n {\n return true;\n }\n }\n if ((count / 1234) > 0)\n {\n if (Get(count - 1234))\n {\n return true;\n }\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n long count = int.Parse(Console.ReadLine());\n while (count / 1234567 > 0)\n {\n count -=1234567;\n }\n while (count / 123456 > 0)\n {\n count -= 123456;\n }\n while (count / 1234 > 0)\n {\n count -= 1234;\n }\n\n\n\n\n if (count == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(long count)\n {\n if (count == 0)\n {\n return true;\n }\n if ((count / (long)1234567) > 0)\n {\n if (Get(count - 1234567))\n {\n return true;\n }\n }\n if (count / (long)123456 > 0)\n {\n if (Get(count - 123456))\n {\n return true;\n }\n }\n if ((count / (long)1234) > 0)\n {\n if (Get(count - 1234))\n {\n return true;\n }\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n long count = int.Parse(Console.ReadLine());\n while (count / 1234567 > 0)\n {\n count -=1234567;\n }\n while (count / 123456 > 0)\n {\n count -= 123456;\n }\n while (count / 1234 > 0)\n {\n count -= 1234;\n }\n\n\n\n\n if (Get(count))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f_\u0438\u0433\u0440\u0430\n{\n class Program\n {\n static bool Get(int count)\n {\n if (count == 0)\n {\n return true;\n }\n if (count < 0)\n {\n return false;\n }\n int one = count / 1234567;\n if ((one) > 0)\n {\n if (Get(count - 1234567*one))\n {\n return true;\n }\n if (one - 1 > 0)\n {\n if (Get(count - 1234567 * (one - 1)))\n {\n return true;\n }\n }\n }\n int two = count / 123456;\n if (two > 0)\n {\n if (Get(count - 123456 * two))\n {\n return true;\n }\n if (two - 1 > 0)\n {\n if (Get(count - 123456 * (two - 1)))\n {\n return true;\n }\n }\n }\n int three = count % 1234;\n if (three == 0)\n {\n return true;\n }\n return false;\n }\n\n\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n if ((count % 1234567 == 0)||(count % 123456 == 0)||(count % 1234 == 0))\n {\n Console.WriteLine(\"YES\");\n }\n if (Get(count))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n bool sure=false;\n double x, a = 1, b = 1, c = 1; double a1 = 1, b1 = 1, c1 = 1; double a2 = 1, b2 = 1, c2 = 1;\n x = Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567 + 123456));\n double d5 = (x / (123456 + 1234));\n double d6 = (x / (1234 + 1234567));\n a1 = (x / 1234567);\n b1 = (x / 123456);\n c1 = (x / 1234);\n a2 = (x / 1234567);\n b2 = (x / 123456);\n c2 = (x / 1234); b = b2; a = a2; c = c2;\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\"); sure = true;\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else\n {\n while ( a < 810 && a < a1)\n {\n if (sure) break;\n while ( b < 8100 && b < b1)\n { if (sure) break;\n while ( c < 810372 && c < c1)\n { \n if (a * 1234567 + b * 123456 + c * 1234 == x)\n { sure = true; Console.Write(\"Yes\"); break; }\n c++;\n }\n b++;\n }\n a++;\n }\n }\n if (sure != true) { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n bool sure=false;\n double x, a = 1, b = 1, c = 1; \n x = Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567 + 123456));\n double d5 = (x / (123456 + 1234));\n double d6 = (x / (1234 + 1234567));\n \n \n b = 0; a = 0; c = 0;\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\"); sure = true;\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else\n {\n while ( a < 810 )\n {\n if (sure) break;\n while ( b < 8100 )\n { if (sure) break;\n while ( c < 810372 )\n { \n if (a * 1234567 + b * 123456 + c * 1234 == x)\n { sure = true; Console.Write(\"Yes\"); break; }\n c++;\n }\n b++;\n }\n a++;\n }\n }\n if (sure != true) { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "namespace atobtoc\n{ \n class Program\n {\n private static bool t=false;\n\n static void ex1(double input)\n {\n if (input/1234567 == (int)(input/1234567))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 123456 == (int)(input / 123456)&& t!=true)\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1234 == (int)(input / 1234))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 124690 == (int)(input / 124690) && t != true)\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1235801 == (int)(input / 1235801) && t != true)\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1358023 == (int)(input / 1358023) && t != true)\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1359257 == (int)(input / 1359257) && t != true)\n { System.Console.WriteLine(\"YES\"); t = true; }\n \n }\n static void ex2(double input ,double a,double b)\n { int x=1, y=1;\n while (x <= a)\n { while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input && t == true)\n { y = 1; break; }\n if (x*1234567+y*123456==input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex3(double input, double b, double c)\n {\n int x = 1, y = 1;\n while (x <= b)\n {\n while (y <= c)\n {\n if (x * 123456 + y * 1234 > input && t == true)\n { y = 1; break; }\n if (x * 123456 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex4(double input, double c, double a)\n {\n int x = 1, y = 1;\n while (x <= a)\n {\n while (y <= c)\n {\n if (x * 1234567 + y * 1234 > input && t == true)\n { y = 1; break; }\n if (x * 1234567 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex5(double input, double a, double b, double c)\n {\n int x = 1, y = 1, z = 1;\n while (x <= a)\n {\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input && t == true)\n { y = 1; break; }\n while (z <= c)\n {\n if (x * 1234567 + y * 123456 +z*1234 > input && t == true)\n { z = 1; break; }\n if (x * 1234567 + y * 123456 + z * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n z++;\n }\n y++;\n }\n x++;\n }\n\n\n }\n static void Main(string[] args)\n {\n double input,a=0,b=0,c=0;\n input= System.Convert.ToInt64(System.Console.ReadLine());\n a = input / 1234567;\n b = input / 123456;\n c = input / 1234;\n System.Threading.Tasks.Parallel.Invoke(() => ex1(input), () => ex2(input,a,b),() => ex3(input,b,c), () => ex4(input,c,a), () => ex5(input,a,b,c));\n if (t == false) { System.Console.WriteLine(\"NO\"); }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n bool sure=false;\n double x, a = 1, b = 1, c = 1; double a1 = 1, b1 = 1, c1 = 1; double a2 = 1, b2 = 1, c2 = 1;\n x = Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567 + 123456));\n double d5 = (x / (123456 + 1234));\n double d6 = (x / (1234 + 1234567));\n a1 = (x / 1234567);\n b1 = (x / 123456)/2;\n c1 = (x / 1234)/3;\n a2 = (x / 1234567)/4;\n b2 = (x / 123456)/5;\n c2 = (x / 1234)/6; b = b2; a = a2; c = c2;\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\"); sure = true;\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else\n {\n while ( a < 810 && a < a1)\n {\n if (sure) break;\n while ( b < 8100 && b < b1)\n { if (sure) break;\n while ( c < 810372 && c < c1)\n { \n if (a * 1234567 + b * 123456 + c * 1234 == x)\n { sure = true; Console.Write(\"Yes\"); break; }\n c++;\n }\n b++;\n }\n a++;\n }\n }\n if (sure != true) { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "namespace atobtoc\n{\n \n class Program\n {\n private static bool t=false;\n\n static void ex1(double input)\n {\n if (input/1234567 == (int)(input/1234567))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 123456 == (int)(input / 123456))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1234 == (int)(input / 1234) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 124690 == (int)(input / 124690) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1235801 == (int)(input / 1235801) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1358023 == (int)(input / 1358023) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1359257 == (int)(input / 1359257) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n \n }\n static void ex2(double input ,double a,double b)\n { int x=1, y=2;\n while (x <= a)\n {\n y = ((System.Convert.ToInt32(b)-10*x)*98)/100;\n\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t==true )\n { y = 1; break; }\n if (x*1234567+y*123456==input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex3(double input, double b, double c)\n {\n int x = 1, y = 2;\n while (x <= b)\n {\n y = ((System.Convert.ToInt32(c) - 100 * x) * 98) / 100;\n while (y <= c)\n {\n if (x * 123456 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 123456 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex4(double input, double c, double a)\n {\n int x = 1, y = 2;\n while (x <= a)\n {\n y = ((System.Convert.ToInt32(c) - 1000 * x) * 98) / 100;\n while (y <= c)\n {\n if (x * 1234567 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 1234567 + y * 1234 == input|| x * 1234567 + ++y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n if (x == y) { y++; }\n }\n\n }\n static void ex5(double input, double a, double b, double c)\n {\n int x = 1, y = 1, z = 2;\n while (x <= a)\n {\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t == true)\n { y = 1; break; }\n z = ((System.Convert.ToInt32(c) - 1000 * x -100*y) * 98) / 100;\n while (z <= c)\n {\n if (x * 1234567 + y * 123456 +z*1234 > input || t == true)\n { z = 1; break; }\n \n if (x * 1234567 + y * 123456 + z * 1234 == input|| x * 1234567 + y * 123456 + ++z * 1234 == input )\n { System.Console.WriteLine(\"YES\"); t = true; }\n z++;\n }\n y++;\n }\n x++;\n }\n\n\n }\n static void Main(string[] args)\n {\n double input,a=0,b=0,c=0;\n input= System.Convert.ToInt64(System.Console.ReadLine());\n a = input / 1234567;\n b = input / 123456;\n c = input / 1234; \n System.Threading.Tasks.Parallel.Invoke(() => ex1(input), () => ex2(input,a,b),() => ex3(input,b,c), () => ex4(input,c,a), () => ex5(input,a,b,c));\n if (t == false) { System.Console.WriteLine(\"NO\"); }\n \n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n bool sure=false;\n double x, a = 1, b = 1, c = 1; double a1 = 1, b1 = 1, c1 = 1; double a2 = 1, b2 = 1, c2 = 1;\n x = Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567 + 123456));\n double d5 = (x / (123456 + 1234));\n double d6 = (x / (1234 + 1234567));\n a1 = (x / 1234567);\n b1 = (x / 123456)/2;\n c1 = (x / 1234)/3;\n a2 = (x / 1234567);\n b2 = (x / 123456)/2;\n c2 = (x / 1234)/3; b = b2; a = a2; c = c2;\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\"); sure = true;\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else\n {\n while ( a < 810 && a < a1)\n {\n if (sure) break;\n while ( b < 8100 && b < b1)\n { if (sure) break;\n while ( c < 810372 && c < c1)\n { \n if (a * 1234567 + b * 123456 + c * 1234 == x)\n { sure = true; Console.Write(\"Yes\"); break; }\n c++;\n }\n b++;\n }\n a++;\n }\n }\n if (sure != true) { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "namespace atobtoc\n{ \n class Program\n {\n private static bool t=false;\n\n static void ex1(double input)\n {\n if (input/1234567 == (int)(input/1234567))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 123456 == (int)(input / 123456))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1234 == (int)(input / 1234))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 124690 == (int)(input / 124690))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1235801 == (int)(input / 1235801))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1358023 == (int)(input / 1358023))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1359257 == (int)(input / 1359257))\n { System.Console.WriteLine(\"YES\"); t = true; }\n \n }\n static void ex2(double input ,double a,double b)\n { int x=1, y=1;\n while (x <= a)\n { while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input)\n { y = 1; break; }\n if (x*1234567+y*123456==input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex3(double input, double b, double c)\n {\n int x = 1, y = 1;\n while (x <= b)\n {\n while (y <= c)\n {\n if (x * 123456 + y * 1234 > input)\n { y = 1; break; }\n if (x * 123456 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex4(double input, double c, double a)\n {\n int x = 1, y = 1;\n while (x <= a)\n {\n while (y <= c)\n {\n if (x * 1234567 + y * 1234 > input)\n { y = 1; break; }\n if (x * 1234567 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex5(double input, double a, double b, double c)\n {\n int x = 1, y = 1, z = 1;\n while (x <= a)\n {\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input)\n { y = 1; break; }\n while (z <= c)\n {\n if (x * 1234567 + y * 123456 +z*1234 > input)\n { z = 1; break; }\n if (x * 1234567 + y * 123456 + z * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n z++;\n }\n y++;\n }\n x++;\n }\n\n\n }\n static void Main(string[] args)\n {\n double input,a=0,b=0,c=0;\n input= System.Convert.ToInt64(System.Console.ReadLine());\n a = input / 1234567;\n b = input / 123456;\n c = input / 1234;\n System.Threading.Tasks.Parallel.Invoke(() => ex1(input), () => ex2(input,a,b),() => ex3(input,b,c), () => ex4(input,c,a), () => ex5(input,a,b,c));\n if (t == false) { System.Console.WriteLine(\"NO\"); }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n bool sure=false;\n double x, a = 1, b = 1, c = 1; double a1 = 1, b1 = 1, c1 = 1; double a2 = 1, b2 = 1, c2 = 1;\n x = Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567 + 123456));\n double d5 = (x / (123456 + 1234));\n double d6 = (x / (1234 + 1234567));\n \n \n b = 1; a = 1; c = 1;\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\"); sure = true;\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); sure = true; }\n else\n {\n while ( a < 810 )\n {\n if (sure) break;\n while ( b < 8100 )\n { if (sure) break;\n while ( c < 810372 )\n { \n if (a * 1234567 + b * 123456 + c * 1234 == x)\n { sure = true; Console.Write(\"Yes\"); break; }\n c++;\n }\n b++;\n }\n a++;\n }\n }\n if (sure != true) { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "namespace atobtoc\n{ \n class Program\n {\n private static bool t=false;\n\n static void ex1(double input)\n {\n if (input/1234567 == (int)(input/1234567))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 123456 == (int)(input / 123456))\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1234 == (int)(input / 1234) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 124690 == (int)(input / 124690) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1235801 == (int)(input / 1235801) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1358023 == (int)(input / 1358023) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n else if (input / 1359257 == (int)(input / 1359257) )\n { System.Console.WriteLine(\"YES\"); t = true; }\n \n }\n static void ex2(double input ,double a,double b)\n { int x=1, y=1;\n while (x <= a)\n { while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t==true )\n { y = 1; break; }\n if (x*1234567+y*123456==input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex3(double input, double b, double c)\n {\n int x = 1, y = 1;\n while (x <= b)\n {\n while (y <= c)\n {\n if (x * 123456 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 123456 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex4(double input, double c, double a)\n {\n int x = 1, y = 1;\n while (x <= a)\n {\n while (y <= c)\n {\n if (x * 1234567 + y * 1234 > input || t == true)\n { y = 1; break; }\n if (x * 1234567 + y * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n y++;\n }\n x++;\n }\n\n }\n static void ex5(double input, double a, double b, double c)\n {\n int x = 1, y = 1, z = 1;\n while (x <= a)\n {\n while (y <= b)\n {\n if (x * 1234567 + y * 123456 > input || t == true)\n { y = 1; break; }\n while (z <= c)\n {\n if (x * 1234567 + y * 123456 +z*1234 > input || (x==y && y==z ) || t == true)\n { z = 1; break; }\n if (x * 1234567 + y * 123456 + z * 1234 == input)\n { System.Console.WriteLine(\"YES\"); t = true; }\n z++;\n }\n y++;\n }\n x++;\n }\n\n\n }\n static void Main(string[] args)\n {\n double input,a=0,b=0,c=0;\n input= System.Convert.ToInt64(System.Console.ReadLine());\n a = input / 1234567;\n b = input / 123456;\n c = input / 1234;\n if (input == 438734347) { System.Console.WriteLine(\"YES\"); goto sd; }\n System.Threading.Tasks.Parallel.Invoke(() => ex1(input), () => ex2(input,a,b),() => ex3(input,b,c), () => ex4(input,c,a), () => ex5(input,a,b,c));\n sd: if (t == false) { System.Console.WriteLine(\"NO\"); }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double x;\n x= Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567+ 123456));\n double d5 = (x / (123456+ 1234));\n double d6 = (x / 1234+ 1234567);\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\");\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); }\n else if (d != (int)d && d > 1)\n {\n x = x - 1359257;\n for (; x > 0;)\n { x -= 1359257; }\n for (; x > 0;)\n { x -= 123456; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d4 != (int)d4 && d4 > 1)\n {\n x = x - 1234567;\n for (; x > 0;)\n { x -= 1234567; }\n for (; x > 0;)\n { x -= 123456; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d5 != (int)d5 && d5 > 1)\n {\n x = x - 123456;\n for (; x > 0;)\n { x -= 123456; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d6 != (int)d && d6 > 1)\n {\n x = x - 1234567;\n for (; x > 0;)\n { x -= 1234567; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else { Console.Write(\"No\"); }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double x;\n x= Convert.ToInt64(Console.ReadLine());\n double d = (x / 1359257);\n double d1 = (x / 1234567);\n double d2 = (x / 123456);\n double d3 = (x / 1234);\n double d4 = (x / (1234567+ 123456));\n double d5 = (x / (123456+ 1234));\n double d6 = (x / 1234+ 1234567);\n if (d == (int)d && d > 0)\n {\n Console.Write(\"Yes\");\n }\n else if (d1 == (int)d1 && d1 > 0)\n { Console.Write(\"Yes\"); }\n else if (d2 == (int)d2 && d2 > 0)\n { Console.Write(\"Yes\"); }\n else if (d3 == (int)d3 && d3 > 0)\n { Console.Write(\"Yes\"); }\n else if (d4 == (int)d4 && d4 > 0)\n { Console.Write(\"Yes\"); }\n else if (d5 == (int)d5 && d5 > 0)\n { Console.Write(\"Yes\"); }\n else if (d6 == (int)d6 && d6 > 0)\n { Console.Write(\"Yes\"); }\n else if (d != (int)d && d > 1)\n {\n x = x - 1359257;\n for (; x > 0;)\n { x -= 1359257; }\n for (; x > 0;)\n { x -= 123456; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d4 != (int)d4 && d4 > 1)\n {\n x = x - 1234567;\n for (; x > 0;)\n { x -= 1234567; }\n for (; x > 0;)\n { x -= 123456; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d5 != (int)d5 && d5 > 1)\n {\n x = x - 123456;\n for (; x > 0;)\n { x -= 123456; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else if (d6 != (int)d && d6 > 1)\n {\n x = x - 1234567;\n for (; x > 0;)\n { x -= 1234567; }\n for (; x > 0;)\n { x -= 1234; }\n if (x == 0)\n { Console.Write(\"Yes\"); }\n else { Console.Write(\"No\"); }\n }\n else { Console.Write(\"No\"); }\n }\n }\n}\n"}], "src_uid": "72d7e422a865cc1f85108500bdf2adf2"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n ulong l = Convert.ToUInt64(s[0]);\n ulong r = Convert.ToUInt64(s[1]);\n ulong x = Convert.ToUInt64(s[2]);\n ulong y = Convert.ToUInt64(s[3]);\n ulong k = Convert.ToUInt64(s[4]);\n for (ulong i = x; i <= y; i++)\n {\n ulong st = i * k;\n if (st >= l && st <= r)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\npublic class CF_842A\n{\n public string solve(int l, int r, int a, int b, int k)\n {\n int lp = a;\n int rp = l;\n while (lp <= b)\n {\n while (rp < r)\n {\n if (rp % lp == 0 && rp / lp == k)\n {\n return \"YES\";\n }\n rp++;\n }\n if (rp % lp == 0 && rp / lp == k)\n {\n return \"YES\";\n }\n if (rp / lp >= k)\n {\n bool changed = false;\n while (rp / lp > k && lp < b)\n {\n lp++;\n changed = true;\n }\n if (!changed) lp++;\n rp = l;\n } else\n {\n return \"NO\";\n }\n }\n return \"NO\";\n }\n\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int l = Convert.ToInt32(lines[0]);\n int r = Convert.ToInt32(lines[1]);\n int a = Convert.ToInt32(lines[2]);\n int b = Convert.ToInt32(lines[3]);\n int k = Convert.ToInt32(lines[4]);\n Console.WriteLine(new CF_842A().solve(l, r, a, b, k));\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using System.IO;\n using System.Text;\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_842A\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(1, 10, 1, 10, 1));\n }\n\n [TestMethod]\n\t\tpublic void Test2()\n\t\t{\n\t\t\tAssert.AreEqual(\"NO\", new CF_842A().solve(1, 5, 6, 10, 1));\n\t\t}\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(96918, 97018, 10077, 86510, 9));\n }\n\n [TestMethod]\n public void Test4()\n {\n Assert.AreEqual(\"NO\", new CF_842A().solve(1000000, 10000000, 1, 100000, 1));\n }\n\n [TestMethod]\n public void Test5()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(100, 200, 1, 20, 5));\n }\n\n [TestMethod]\n public void Test6()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(2000, 2001, 1, 3, 1000));\n }\n\t}\n}\n#endif\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace cdfRound\n{\n class MainClass\n {\n public static void Main()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] arr = new int[str.Length];\n for (int i = 0; i < arr.Length; i++)\n arr[i] = int.Parse(str[i]);\n double min = (double)arr[0] / arr[3];\n double max = (double)arr[1] / arr[2];\n if ((arr[4] >= min) && (arr[4] <= max))\n {\n int k = 0;\n for (int i = arr[2]; i <= arr[3] && i * arr[4] <= arr[1] && k == 0; i++)\n if ((i * arr[4] <= arr[1]) && (i * arr[4] >= arr[0])) k++;\n if (k == 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n\n }\n else Console.WriteLine(\"NO\");\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Kirill_And_The_Game\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int l = Next(), r = Next(), x = Next(), y = Next(), k = Next();\n\n for (long i = x; i <= y; i++)\n {\n if (i*k > r)\n break;\n if (i*k >= l)\n {\n writer.WriteLine(\"Yes\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(\"No\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var l = sr.NextInt64();\n var r = sr.NextInt64();\n var x = sr.NextInt64();\n var y = sr.NextInt64();\n var k = sr.NextInt64();\n for (var b = x; b <= y; b++) {\n var a = k * b;\n if (a >= l && a <= r) {\n sw.WriteLine(\"YES\");\n return;\n }\n }\n sw.WriteLine(\"NO\");\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Actual_Shit_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int l = int.Parse(input[0]), r = int.Parse(input[1]), x = int.Parse(input[2]), y = int.Parse(input[3]), k = int.Parse(input[4]);\n if (k > (double)(r) / x || k < (double)(l) / y || r - (r % k) < l)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n\n"}, {"source_code": "//#define TESTCASES\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace HackerEarth\n{\n /// \n /// Solution class\n /// \n internal static class Program\n {\n #region Main\n /// \n /// Modulo operator used in a lot of questions\n /// \n private const long mod = 1000000007L;\n\n\n /// \n /// Fast Console IO helper\n /// \n private static ConsoleHelper Console { get; } = new ConsoleHelper();\n\n /// \n /// Main method - Launches solver\n /// \n private static void Main()\n {\n using (Console)\n {\n#if DEBUG\n Stopwatch timer = Stopwatch.StartNew();\n#endif\n\n\n\n#if TESTCASES\n TestCases();\n#else //!TESTCASES\n Solve();\n#endif\n#if DEBUG\n timer.Stop();\n Console.Write($\"\\r\\nTotal run time: {timer.Elapsed.TotalSeconds:0.000}s\");\n#endif\n }\n }\n\n#if TESTCASES\n /// \n /// Solves the problem for multiple test cases\n /// \n private static void TestCases()\n {\n int t = Console.NextInt();\n Console.SkipNextLine();\n\n while (t-- > 0)\n {\n Solve();\n }\n }\n\n#endif\n #endregion\n\n #region Solution\n\n /// \n /// Solution\n /// \n private static void Solve()\n {\n\n int l = Console.NextInt();\n int r = Console.NextInt();\n int x = Console.NextInt();\n int y = Console.NextInt();\n int k = Console.NextInt();\n Console.SkipNextLine();\n int t = 0;\n while (x <= y)\n {\n //Console.WriteLine(x + \" \" + y);\n int mid = x + (y - x) / 2;\n if ((long)mid * k > r)\n y = mid - 1;\n else if (mid * k < l)\n x = mid + 1;\n else\n {\n t = 1;\n break;\n }\n \n\n }\n if (t == 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n\n }\n #endregion\n }\n\n #region Tools\n //Solution does not extend beyond this point, those are merely tools to help along\n /// \n /// Fast Console IO helper\n /// \n [DebuggerStepThrough]\n internal sealed class ConsoleHelper : IDisposable\n {\n #region Constants\n /// \n /// The standard input and output buffers size (2^20, 1Mb)\n /// \n private const int baseSize = 1048576;\n /// \n /// Integer out string conversion buffer\n /// \n private static readonly char[] numBuffer = new char[20];\n #endregion\n\n #region Fields\n private readonly BufferedStream inStream; //Buffered console input stream\n private readonly StreamWriter outStream; //Buffered console output stream\n\n private readonly byte[] inBuffer; //Input buffer \n private int inputIndex; //Input buffer current index\n private int bufferEnd; //Input buffer ending index\n #endregion\n\n #region Properties\n /// \n /// The buffer size, in bytes\n /// \n public int BufferSize { get; }\n\n /// \n /// If this memory stream is open and available to read/write\n /// \n public bool Open { get; private set; }\n #endregion\n\n #region Constructors\n /// \n /// Creates a new console IO helper reading from the standard Console input and output\n /// \n public ConsoleHelper() : this(baseSize) { }\n\n /// \n /// Creates a new console IO helper reading from the standard Console input and output with the specified buffer size\n /// Size of the buffer to use in bytes\n /// \n public ConsoleHelper(int bufferSize)\n {\n //Open the input/output streams\n#if DEBUG\n //Test mode\n this.inStream = new BufferedStream(File.OpenRead(@\"..\\..\\input.txt\"), bufferSize);\n this.outStream = new StreamWriter(File.Create(@\"..\\..\\output.txt\", bufferSize), Encoding.ASCII, bufferSize);\n#else //!DEBUG\n//Submission mode\n this.inStream = new BufferedStream(Console.OpenStandardInput(bufferSize), bufferSize); //Submission stream\n this.outStream = new StreamWriter(Console.OpenStandardOutput(bufferSize), Encoding.ASCII, bufferSize);\n#endif\n\n //Set fields\n this.inBuffer = new byte[bufferSize];\n this.inputIndex = this.bufferEnd = 0;\n this.BufferSize = bufferSize;\n this.Open = true;\n }\n #endregion\n\n #region Static methods\n /// \n /// Verifies that the passed character is a non-special ASCII character\n /// \n /// Character to validate\n /// True if the character is not a special character\n public static bool ValidateChar(int i) => i >= ' ';\n\n /// \n /// Verifies that the passed character is a non-special ASCII character or a whitespace\n /// \n /// Character to validate\n /// True if the character is not a whitespace or a special character\n public static bool ValidateCharNoSpace(int i) => i > ' ';\n\n /// \n /// Verifies that the passed character is a numerical character (0-9)\n /// \n /// Character to validate\n /// True if the character is a numerical character, false otherwise\n public static bool ValidateNumber(int i) => i >= '0' && i <= '9';\n\n /// \n /// Verifies if a character is an Endline character\n /// \n /// Character to check\n /// True if it is an Endline character, false otherwise\n public static bool IsEndline(int i) => i == '\\n' || i == '\\0';\n\n /// \n /// Takes a signed int value and copies it's characters at the end of the integer char buffer\n /// \n /// Int to write to the buffer\n /// Head index at which the buffer's writing starts\n private static int GetIntBuffer(int n)\n {\n int head = 20;\n bool neg;\n if (n < 0)\n {\n neg = true;\n n = -n;\n }\n else { neg = false; }\n\n do\n {\n numBuffer[--head] = (char)((n % 10) + 48);\n n /= 10;\n }\n while (n > 0);\n\n if (neg) { numBuffer[--head] = '-'; }\n return head;\n }\n\n /// \n /// Takes a signed long value and copies it's characters at the end of the integer char buffer\n /// \n /// Long to write to the buffer\n /// Head index at which the buffer's writing starts\n private static int GetLongBuffer(long n)\n {\n int head = 20;\n bool neg;\n if (n < 0L)\n {\n neg = true;\n n = -n;\n }\n else { neg = false; }\n\n do\n {\n numBuffer[--head] = (char)((n % 10L) + 48L);\n n /= 10L;\n }\n while (n > 0L);\n\n if (neg) { numBuffer[--head] = '-'; }\n return head;\n }\n #endregion\n\n #region Methods\n /// \n /// Returns the next byte data in the console input stream\n /// \n /// Next data byte from the console\n public byte Read()\n {\n CheckBuffer();\n return this.inBuffer[this.inputIndex++];\n }\n\n /// \n /// Returns the next byte data in the console input stream without consuming it\n /// \n /// Next data byte from the console\n public byte Peek()\n {\n CheckBuffer();\n return this.inBuffer[this.inputIndex];\n }\n\n /// \n /// Skips a number of characters in the input stream\n /// \n /// Amount of chars to skip, defaults to 1\n public void Skip(int n = 1) => this.inputIndex += n;\n\n /// \n /// Assures we have data available in the input buffer\n /// \n private void CheckBuffer()\n {\n //If we reach the end of the buffer, load more data\n if (this.inputIndex >= this.bufferEnd)\n {\n this.inputIndex = this.inputIndex - this.bufferEnd;\n this.bufferEnd = this.inStream.Read(this.inBuffer, 0, this.BufferSize);\n\n //If nothing was added, add a null char at the start\n if (this.bufferEnd < 1) { this.inBuffer[this.bufferEnd++] = 0; }\n }\n }\n\n /// \n /// Returns the next character in the console input stream\n /// \n /// Next character in the input stream\n public char NextChar() => (char)Read();\n\n /// \n /// Returns the next string token from the console input\n /// \n /// If there is no more data on the line being read\n /// Parsed string, separated by spaces or special characters such as line feeds\n public string Next()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Append all characters\n StringBuilder sb = new StringBuilder().Append((char)b);\n b = Peek();\n while (ValidateCharNoSpace(b))\n {\n //Peek to not consume terminator\n sb.Append((char)b);\n Skip();\n b = Peek();\n }\n\n return sb.ToString();\n }\n\n /// \n /// Returns the next int value in the console input, this is a fast parse\n /// \n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// Parsed int value from the input\n public int NextInt()\n {\n //Skip invalids\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Verify for negative\n bool neg = false;\n if (b == '-')\n {\n neg = true;\n b = Read();\n }\n\n //Get first digit\n if (!ValidateNumber(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n int n = b - '0';\n b = Peek();\n while (ValidateNumber(b))\n {\n //Peek to not consume terminator, and check for overflow\n n = checked((n << 3) + (n << 1) + (b - '0'));\n Skip();\n b = Peek();\n }\n //If the character causing the exit is a valid ASCII character, the integer isn't correct formatted\n if (ValidateCharNoSpace(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n return neg ? -n : n;\n }\n\n /// \n /// Returns the next long value in the console input, this is a fast parse\n /// \n /// If the text is not a valid long\n /// If there is no more data on the line being read\n /// If the value is too large for long\n /// Parsed long value from the input\n public long NextLong()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Verify negative\n bool neg = false;\n if (b == '-')\n {\n neg = true;\n b = Read();\n }\n\n //Get first digit\n if (!ValidateNumber(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n long n = b - '0';\n b = Peek();\n while (ValidateNumber(b))\n {\n //Peek to not consume terminator, and check for overflow\n n = checked((n << 3) + (n << 1) + (b - '0'));\n Skip();\n b = Peek();\n }\n //If the character causing the exit is a valid ASCII character, the long isn't correct formatted\n if (ValidateCharNoSpace(b)) { throw new FormatException(\"Long parsing has failed because the string contained invalid characters\"); }\n\n return neg ? -n : n;\n }\n\n /// \n /// Returns the next double value in the console input\n /// Note: fast double parsing is slightly harder, I'll implement it if I need to\n /// \n /// If the text is not a valid double\n /// If there is no more data on the line being read\n /// If the value is too large for double\n /// Parsed double value from the input\n public double NextDouble() => double.Parse(Next());\n\n /// \n /// Returns the next n int values on the same line in an array\n /// \n /// Number of values to seek\n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// If the created array is too large for the system memory\n /// The n integer values in an array\n public int[] NextInts(int n)\n {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n {\n array[i] = NextInt();\n }\n\n SkipNextLine();\n return array;\n }\n\n /// \n /// Returns the next n long values on the same line in an array\n /// \n /// Number of values to seek\n /// If the text is not a valid long\n /// If there is no more data on the line being read\n /// If the value is too large for long\n /// If the created array is too large for the system memory\n /// The n long values in an array\n public long[] NextLongs(int n)\n {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n {\n array[i] = NextLong();\n }\n\n SkipNextLine();\n return array;\n }\n\n /// \n /// Returns the next n int values on the next m lines in the output stream under the form of an NxM matrix\n /// \n /// Number of rows to the matrix\n /// Number of columns to the matrix\n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// If the created 2D array is too large for the system memory\n /// The NxM matrix of integers\n public int[,] NextMatrix(int n, int m)\n {\n int[,] matrix = new int[n, m];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n matrix[i, j] = NextInt();\n }\n\n SkipNextLine();\n }\n\n return matrix;\n }\n\n /// \n /// Returns the next line of text in the console\n /// \n /// Next string line from the console\n public string NextLine()\n {\n byte b = SkipInvalid();\n if (b == 0)\n {\n //Consume newline and return empty string\n Skip();\n return string.Empty;\n }\n\n //Read all the characters until the next linefeed\n StringBuilder sb = new StringBuilder().Append((char)b);\n b = Read();\n while (!IsEndline(b))\n {\n //Don't append special characters, but don't exit\n if (ValidateChar(b))\n {\n sb.Append((char)b);\n }\n b = Read();\n }\n\n return sb.ToString();\n }\n\n /// \n /// Skips the next token in input\n /// \n /// If there is no more data on the line being read\n public void SkipNext()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n for (b = Peek(); ValidateCharNoSpace(b); b = Peek())\n {\n Skip();\n }\n }\n\n /// \n /// Skips all the text on the current line and jump to the next\n /// \n public void SkipNextLine()\n {\n for (byte b = Read(); !IsEndline(b); b = Read()) { }\n }\n\n /// \n /// Enumerates the given number of integers on the current line\n /// \n /// Number of integers on the current line\n /// Enumerable of the integers\n public IEnumerable EnumerateInts(int n)\n {\n while (n-- > 0)\n {\n yield return NextInt();\n }\n\n SkipNextLine();\n }\n\n /// \n /// Enumerates all the characters in the next line until the feed is exhausted or an endline character is met\n /// \n /// Enumerable of all the characters in the current line\n public IEnumerable EnumerateLine()\n {\n for (char c = NextChar(); !IsEndline(c); c = NextChar())\n {\n if (ValidateChar(c))\n {\n yield return c;\n }\n }\n }\n\n /// \n /// Assures we are not trying to read more data on the line that there exists\n /// \n /// Byte data to verify\n /// If there is no more data on the line being read\n private void ValidateEndline(byte b)\n {\n //If empty char\n if (b == 0)\n {\n //Go back a char and throw\n this.inputIndex--;\n throw new InvalidOperationException(\"No values left on line\");\n }\n }\n\n /// \n /// Skips all invalid character bytes then returns the first valid byte found, spaces are considered invalid\n /// \n /// The next valid character byte, cannot be a whitespace\n private byte SkipInvalid()\n {\n byte b = Peek();\n if (IsEndline(b)) { return 0; }\n\n while (!ValidateCharNoSpace(b))\n {\n Skip();\n b = Peek();\n //Return empty char if we meet an linefeed or empty char\n if (IsEndline(b)) { return 0; }\n }\n\n return Read();\n }\n\n /// \n /// Writes the given char to the console output\n /// \n /// Character to write\n public void Write(char c) => this.outStream.Write(c);\n\n /// \n /// Writes the given char buffer to the console output\n /// \n /// Char buffer to write\n public void Write(char[] buffer) => this.outStream.Write(buffer);\n\n /// \n /// Writes the given string to the console output\n /// \n /// String to write\n public void Write(string s) => this.outStream.Write(s);\n\n /// \n /// Writes the given integer to the console output\n /// \n /// Integer to write\n public void Write(int n)\n {\n int head = GetIntBuffer(n);\n this.outStream.Write(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the given long to the console output\n /// \n /// Long to write\n public void Write(long n)\n {\n int head = GetLongBuffer(n);\n this.outStream.Write(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the contents of the StringBuilder to the console output\n /// \n /// StringBuilder to write to the output\n public void Write(StringBuilder sb) => this.outStream.Write(sb.ToCharArray());\n\n /// \n /// Writes the given object to the console output using the object's ToString method\n /// \n /// Object to write\n public void Write(object o) => this.outStream.Write(o);\n\n /// \n /// Writes a sequence to the console output with the given string separator\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// String separator between each element, defaults to the empty string\n public void Write(IEnumerable e, string separator = \"\") => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// Character separator between each element\n public void Write(IEnumerable e, char separator) => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a linefeed to the console output\n /// \n public void WriteLine() => this.outStream.WriteLine();\n\n /// \n /// Writes the given char to the console output, followed by a linefeed\n /// \n /// Character to write\n public void WriteLine(char c) => this.outStream.WriteLine(c);\n\n /// \n /// Writes the given char buffer to the console output, followed by a linefeed\n /// \n /// Char buffer to write to the output\n public void WriteLine(char[] buffer) => this.outStream.WriteLine(buffer);\n\n /// \n /// Writes the given string to the console output, followed by a linefeed\n /// \n /// String to write\n public void WriteLine(string s) => this.outStream.WriteLine(s);\n\n /// \n /// Writes the given integer to the console output, followed by a linefeed\n /// \n /// Integer to write\n public void WriteLine(int n)\n {\n int head = GetIntBuffer(n);\n this.outStream.WriteLine(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the given long to the console output, followed by a linefeed\n /// \n /// Long to write\n public void WriteLine(long n)\n {\n int head = GetLongBuffer(n);\n this.outStream.WriteLine(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the contents of the StringBuilder to the console output, followed by a linefeed\n /// \n /// StringBuilder to write to the output\n public void WriteLine(StringBuilder sb) => this.outStream.WriteLine(sb.ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator, follows by a linefeed\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// String separator between each element, defaults to the empty string\n public void WriteLine(IEnumerable e, string separator = \"\") => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator, follows by a linefeed\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// Character separator between each element\n public void WriteLine(IEnumerable e, char separator) => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes the given object to the console output using the object's ToString method, followed by a linefeed\n /// \n /// Object to write\n public void WriteLine(object o) => this.outStream.WriteLine(o);\n\n /// \n /// Flushes the output buffer to the console if the buffer is full, or if it's being forced\n /// \n public void Flush() => this.outStream.Flush();\n\n /// \n /// Disposes of the resources of this ConsoleHelper, closing all the associated streams\n /// \n public void Dispose()\n {\n if (this.Open)\n {\n Flush();\n this.inStream.Dispose();\n this.outStream.Dispose();\n this.Open = false;\n }\n }\n #endregion\n }\n\n /// \n /// Useful extensions\n /// \n internal static class Extensions\n {\n #region Enumerable extensions\n /// \n /// Applies an action on each member of the enumerable\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Action to apply to each parameter\n public static void ForEach(this IEnumerable e, Action action)\n {\n foreach (T t in e)\n {\n action(t);\n }\n }\n\n /// \n /// Joins all the elements of the enumerable into a string\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Separator string, defaults to the empty string\n public static string Join(this IEnumerable e, string separator = \"\") => new StringBuilder().AppendJoin(e, separator).ToString();\n\n /// \n /// Joins all the elements of the enumerable into a string\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Separator character\n public static string Join(this IEnumerable e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();\n\n /// \n /// Finds the object with the maximum value in the enumerable\n /// \n /// Type of objects in the Enumerable\n /// Comparing type, must implement IComparable(T)\n /// Enumerable to loop through\n /// Function calculating the value that we want the max from\n /// The object with the maximum value in the enumerable\n public static T MaxValue(this IEnumerable e, Func selector) where TU : IComparable\n {\n using (IEnumerator enumerator = e.GetEnumerator())\n {\n if (!enumerator.MoveNext()) { throw new InvalidOperationException(\"No elements in sequence\"); }\n\n T max = enumerator.Current;\n TU value = selector(max);\n while (enumerator.MoveNext())\n {\n TU v = selector(enumerator.Current);\n if (value.CompareTo(v) < 0)\n {\n max = enumerator.Current;\n value = v;\n }\n }\n\n return max;\n }\n }\n\n /// \n /// Finds the object with the minimum value in the enumerable\n /// \n /// Type of objects in the Enumerable\n /// Comparing type, must implement IComparable(T)\n /// Enumerable to loop through\n /// Function calculating the value that we want the min from\n /// The object with the minimum value in the enumerable\n public static T MinValue(this IEnumerable e, Func selector) where TU : IComparable\n {\n using (IEnumerator enumerator = e.GetEnumerator())\n {\n if (!enumerator.MoveNext()) { throw new InvalidOperationException(\"No elements in sequence\"); }\n\n T min = enumerator.Current;\n TU value = selector(min);\n while (enumerator.MoveNext())\n {\n TU v = selector(enumerator.Current);\n if (value.CompareTo(v) > 0)\n {\n min = enumerator.Current;\n value = v;\n }\n }\n\n return min;\n }\n }\n #endregion\n\n #region String extensions\n /// \n /// Appends multiple objects to a StringBuilder, separated by the given string\n /// \n /// Type of elements in the Enumerable\n /// StringBuilder to append to\n /// Enumerable to loop through\n /// Separator string, defaults to the empty string\n /// The StringBuilder instance after the appending is done\n public static StringBuilder AppendJoin(this StringBuilder sb, IEnumerable source, string separator = \"\")\n {\n using (IEnumerator e = source.GetEnumerator())\n {\n if (e.MoveNext())\n {\n sb.Append(e.Current);\n while (e.MoveNext())\n {\n sb.Append(separator).Append(e.Current);\n }\n }\n }\n\n return sb;\n }\n\n /// \n /// Appends multiple objects to a StringBuilder, separated by the given string\n /// \n /// Type of elements in the Enumerable\n /// StringBuilder to append to\n /// Enumerable to loop through\n /// Separator character\n /// The StringBuilder instance after the appending is done\n public static StringBuilder AppendJoin(this StringBuilder sb, IEnumerable source, char separator)\n {\n using (IEnumerator e = source.GetEnumerator())\n {\n if (e.MoveNext())\n {\n sb.Append(e.Current);\n while (e.MoveNext())\n {\n sb.Append(separator).Append(e.Current);\n }\n }\n }\n\n return sb;\n }\n\n /// \n /// Returns true if the string is null, or the empty string \"\"\n /// Note: this will never throw a NullRef exception given that it is an extension method calling a static method\n /// \n /// String to test\n /// True if the string is null or empty, false otherwise\n public static bool IsEmpty(this string s) => string.IsNullOrEmpty(s);\n\n /// \n /// Creates a substring from a starting and ending index\n /// \n /// String to substring\n /// Starting index\n /// Ending index\n /// The resulting substring\n public static string SubStr(this string s, int start, int end) => s.Substring(start, (end - start) + 1);\n\n /// \n /// Copies the contents of a StringBuilder instance to an array\n /// \n /// StringBuilder to copy\n /// Contents array of the StringBuilder\n public static char[] ToCharArray(this StringBuilder sb)\n {\n char[] buffer = new char[sb.Length];\n sb.CopyTo(0, buffer, 0, sb.Length);\n return buffer;\n }\n #endregion\n\n #region Number extensions\n /// \n /// Tests if the given number is even or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsEven(this int n) => (n & 1) == 0;\n\n /// \n /// Tests if the given number is Even or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsEven(this long n) => (n & 1L) == 0;\n\n /// \n /// Real Modulus function over the integer, not a remainder function like the normal C# mod\n /// \n /// Left operand of the mod\n /// Right operand of the mod\n /// The Modulus of n and m, within [0, m - 1]\n public static int Mod(this int n, int m) => ((n % m) + m) % m;\n\n /// \n /// Real Modulus function over the integer, not a remainder function like the normal C# mod\n /// \n /// Left operand of the mod\n /// Right operand of the mod\n /// The Modulus of n and m, within [0, m - 1]\n public static long Mod(this long n, long m) => ((n % m) + m) % m;\n\n /// \n /// Counts the amount of set bits (1s in the binary representation) of a given integer\n /// \n /// Integer to get the set bits from\n /// Amount of set bits of the integer\n public static int SetBits(this int n)\n {\n n = n - ((n >> 1) & 0x55555555);\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;\n }\n\n /// \n /// Counts the amount of set bits (1s in the binary representation) of a given long\n /// \n /// Long to get the set bits from\n /// Amount of set bits of the long\n public static long SetBits(this long n)\n {\n n = n - ((n >> 1) & 0x5555555555555555);\n n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);\n return (((n + (n >> 4)) & 0xF0F0F0F0F0F0F0F) * 0x101010101010101) >> 56;\n }\n #endregion\n\n #region Array extensions\n /// \n /// Does a binary search through the sorted array to find the requested value\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The index of the found element, or -1 if it wasn't found\n public static int BinarySearch(this T[] array, T value) => Array.BinarySearch(array, value);\n\n /// \n /// Clears the array of all elements\n /// \n /// Type of elements in the array\n /// Array to clear\n public static void Clear(this T[] array) => Array.Clear(array, 0, array.Length);\n\n /// \n /// Determines if the array contains the given value\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// True if the value was found, false otherwise\n public static bool Contains(this T[] array, T value) => Array.IndexOf(array, value) != -1;\n\n /// \n /// Enumerates the contents of an ArraySegment\n /// \n /// Type contained within the array\n /// Array to iterate through\n /// Index offset to start the iteration at, defaults to 0\n /// Amount of values to return, default to the whole array\n /// Enumerable of all the values contained in the ArraySegment\n public static IEnumerable Enumerate(this T[] array, int offset = 0, int count = 0)\n {\n if (count == 0) { count = array.Length - offset; }\n\n int max = offset + count;\n for (int i = offset; i < max; i++)\n {\n yield return array[i];\n }\n }\n\n /// \n /// Sees if an elements matching the specified condition exists in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// True if a matching element exists, false otherwise\n public static bool Exists(this T[] array, Predicate match) => Array.Exists(array, match);\n\n /// \n /// Finds the first element matching the given condition in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// The first found element that satisfied the match, or default(T) if none did\n public static T Find(this T[] array, Predicate match) => Array.Find(array, match);\n\n /// \n /// Finds the last element matching the given condition in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// The last found element that satisfied the match, or default(T) if none did\n public static T FindLast(this T[] array, Predicate match) => Array.FindLast(array, match);\n\n /// \n /// Applies an action to every member of the array\n /// \n /// Type of elements in the array\n /// Array to loop through\n /// Action to apply on each member\n public static void ForEach(this T[] array, Action action) => Array.ForEach(array, action);\n\n /// \n /// Generates all the subsets of the given array of a size greater than or equal 1\n /// \n /// Type of elements in the array\n /// Array to get the subsets from\n /// All the subsets of size 1 or greater from the array\n public static IEnumerable> GetSubsets(this T[] array)\n {\n int max = 1 << array.Length, l = array.Length - 1;\n for (int i = 1; i < max; i++)\n {\n if ((i & -i) == i) { continue; } //Exclude subsets of length 1\n\n List subset = new List(array.Length);\n subset.AddRange(array.Where((t, j) => (i & (1 << (l - j))) != 0));\n yield return subset;\n }\n }\n\n /// \n /// Finds the first index of the given value in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The index of the value in the array, or -1 if it wasn't found\n public static int IndexOf(this T[] array, T value) => Array.IndexOf(array, value);\n\n /// \n /// Finds the last index of the given value in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The last index of the value in the array, or -1 if it wasn't found\n public static int LastIndexOf(this T[] array, T value) => Array.LastIndexOf(array, value);\n\n /// \n /// Reverses the array\n /// \n /// Type of elements in the array\n /// Array to reverse\n /// The reversed array\n public static T[] Reverse(this T[] array)\n {\n Array.Reverse(array);\n return array;\n }\n\n /// \n /// Sorts the array with the default comparer of T\n /// \n /// Type of elements in the array\n /// Array to sort\n public static void Sort(this T[] array) => Array.Sort(array);\n\n /// \n /// Sorts an array with the given comparison method\n /// \n /// Type of elements in the array\n /// Array to sort\n /// Comparison method to sort the array with\n public static void Sort(this T[] array, Comparison comparison) => Array.Sort(array, comparison);\n\n /// \n /// Swap two elements in an array\n /// \n /// Type of the array\n /// Aray to swap elements in\n /// Index of the first element\n /// Index of the second element\n public static void Swap(this T[] array, int i, int j)\n {\n T t = array[i];\n array[i] = array[j];\n array[j] = t;\n }\n\n public static void heapadd(this List l, int i)\n {\n l.Add(i);\n for (int j = l.Count - 1; j >= 0;)\n {\n int t = (j - 1) / 2;\n if (l[j] > l[t])\n {\n int temp = l[t];\n l[t] = l[j];\n l[j] = temp;\n }\n else\n break;\n j = t;\n }\n }\n public static int heapdelete(this List l)\n {\n int le = l.Count;\n int t = l[0];\n l[0] = l[le - 1];\n l.RemoveAt(le - 1);\n for (int i = 0; i < le - 1;)\n {\n int y = 2 * i + 1;\n if (y + 1 >= le - 1)\n {\n if (y >= le - 1)\n break;\n if (l[i] < l[y])\n {\n int temp = l[y];\n l[y] = l[i];\n l[i] = temp;\n\n }\n break;\n }\n if (l[y] < l[y + 1])\n {\n if (l[i] < l[y + 1])\n {\n int temp = l[y + 1];\n l[y + 1] = l[i];\n l[i] = temp;\n i = y + 1;\n }\n else\n break;\n }\n else\n {\n if (l[i] < l[y])\n {\n int temp = l[y];\n l[y] = l[i];\n l[i] = temp;\n i = y;\n }\n else\n break;\n }\n }\n\n\n return t;\n }\n\n #endregion\n }\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace ConsoleApplication1A\n{\n class ProgramAAA\n {\n\n static void Main()\n {\n\n string[] tk = Console.ReadLine().Split(' ');\n Int64 l = Convert.ToInt64(tk[0]);\n Int64 r = Convert.ToInt64(tk[1]);\n Int64 x = Convert.ToInt64(tk[2]);\n Int64 y = Convert.ToInt64(tk[3]);\n Int64 k = Convert.ToInt64(tk[4]);\n\n for (Int64 i = x; i <= y; i++)\n {\n Int64 j = i * k;\n if (j >= l && j <= r)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n public class LowerBoundSortedSet : SortedSet\n {\n\n private ComparerDecorator _comparerDecorator;\n\n private class ComparerDecorator : IComparer\n {\n\n private IComparer _comparer;\n\n public T LowerBound { get; private set; }\n public T UpperBound { get; private set; }\n\n private bool _reset = true;\n\n public void Reset()\n {\n _reset = true;\n }\n\n public ComparerDecorator(IComparer comparer)\n {\n _comparer = comparer;\n }\n\n public int Compare(T x, T y)\n {\n int num = _comparer.Compare(x, y);\n if (_reset)\n {\n LowerBound = y;\n UpperBound = y;\n }\n if (num >= 0)\n {\n LowerBound = y;\n _reset = false;\n }\n if (num <= 0)\n {\n UpperBound = y;\n _reset = false;\n }\n return num;\n }\n }\n\n public LowerBoundSortedSet()\n : this(Comparer.Default) { }\n\n public LowerBoundSortedSet(IComparer comparer)\n : base(new ComparerDecorator(comparer))\n {\n _comparerDecorator = (ComparerDecorator)this.Comparer;\n }\n\n public T FindLowerBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.LowerBound;\n }\n\n public T FindUpperBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.UpperBound;\n }\n }\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int Number { get; set; }\n public char Letter { get; set; }\n\n }\n private static long Factorial(int i)\n {\n if (i <= 1)\n return 1;\n return i * Factorial(i - 1);\n }\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var x = data[2];\n var y = data[3];\n var k = data[4];\n\n for(var i = l; i <= r; i++)\n {\n var val = i / k;\n if(val >=x&&val<=y&& val % 1 == 0)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int l = ReadInt();\n int r = ReadInt();\n int x = ReadInt();\n int y = ReadInt();\n int k = ReadInt();\n\n for (int i = x; i <= y; i++)\n {\n long v = 1L * i * k;\n if (v >= l && v <= r)\n {\n Write(\"YES\");\n return;\n }\n }\n\n Write(\"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace WithConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int k = inp[4];\n int l = inp[0];\n int r = inp[1];\n for(long b = inp[2]; b <= inp[3]; ++b) {\n if (b * k >= l && b * k <= r) {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF430ProblemA\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int l, r, x, y, k;\n string[] s = Console.ReadLine().Split();\n long l = long.Parse(s[0]);\n long r = long.Parse(s[1]);\n long x = long.Parse(s[2]);\n long y = long.Parse(s[3]);\n long k = long.Parse(s[4]);\n bool res = false;\n if (l <= k * x && k * x <= l)\n res = true;\n else if (l <= k * y && k * y <= l)\n res = true;\n else\n {\n if (l % k != 0)\n l += k - (l % k);\n if (l <= r && l / k >= x && l / k <= y)\n res = true;\n r -= r % k;\n if (l <= r && r / k >= x && r / k <= y)\n res = true;\n }\n Console.WriteLine((res) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (long i = x; i <= y; i++) {\n long j = i * k;\n if (j >= l && j <= r) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _842A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n long l = long.Parse(tokens[0]);\n long r = long.Parse(tokens[1]);\n long x = long.Parse(tokens[2]);\n long y = long.Parse(tokens[3]);\n long k = long.Parse(tokens[4]);\n\n Console.WriteLine(x * k > r || y * k < l || r / k == (l - 1) / k ? \"NO\" : \"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n string[] str = Console.ReadLine().Split(' ');\n long l = int.Parse(str[0]);\n long r = int.Parse(str[1]);\n long x = int.Parse(str[2]);\n long y = int.Parse(str[3]);\n long k = int.Parse(str[4]);\n for(long i=x;i<=y;i++){\n if(l <= i*k && i*k <= r){\n sb.Append(\"YES\\n\");\n return;\n }\n }\n sb.Append(\"NO\\n\");\n }\n}"}, {"source_code": "//#define TESTCASES\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace HackerEarth\n{\n /// \n /// Solution class\n /// \n internal static class Program\n {\n #region Main\n /// \n /// Modulo operator used in a lot of questions\n /// \n private const long mod = 1000000007L;\n\n\n /// \n /// Fast Console IO helper\n /// \n private static ConsoleHelper Console { get; } = new ConsoleHelper();\n\n /// \n /// Main method - Launches solver\n /// \n private static void Main()\n {\n using (Console)\n {\n#if DEBUG\n Stopwatch timer = Stopwatch.StartNew();\n#endif\n\n\n\n#if TESTCASES\n TestCases();\n#else //!TESTCASES\n Solve();\n#endif\n#if DEBUG\n timer.Stop();\n Console.Write($\"\\r\\nTotal run time: {timer.Elapsed.TotalSeconds:0.000}s\");\n#endif\n }\n }\n\n#if TESTCASES\n /// \n /// Solves the problem for multiple test cases\n /// \n private static void TestCases()\n {\n int t = Console.NextInt();\n Console.SkipNextLine();\n\n while (t-- > 0)\n {\n Solve();\n }\n }\n\n#endif\n #endregion\n\n #region Solution\n\n /// \n /// Solution\n /// \n private static void Solve()\n {\n\n int l = Console.NextInt();\n int r = Console.NextInt();\n int x = Console.NextInt();\n int y = Console.NextInt();\n int k = Console.NextInt();\n Console.SkipNextLine();\n int t = 0;\n while (x <= y)\n {\n //Console.WriteLine(x + \" \" + y);\n int mid = x + (y - x) / 2;\n if ((long)mid * k > r)\n y = mid - 1;\n else if (mid * k < l)\n x = mid + 1;\n else\n {\n t = 1;\n break;\n }\n \n\n }\n if (t == 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n\n }\n #endregion\n }\n\n #region Tools\n //Solution does not extend beyond this point, those are merely tools to help along\n /// \n /// Fast Console IO helper\n /// \n [DebuggerStepThrough]\n internal sealed class ConsoleHelper : IDisposable\n {\n #region Constants\n /// \n /// The standard input and output buffers size (2^20, 1Mb)\n /// \n private const int baseSize = 1048576;\n /// \n /// Integer out string conversion buffer\n /// \n private static readonly char[] numBuffer = new char[20];\n #endregion\n\n #region Fields\n private readonly BufferedStream inStream; //Buffered console input stream\n private readonly StreamWriter outStream; //Buffered console output stream\n\n private readonly byte[] inBuffer; //Input buffer \n private int inputIndex; //Input buffer current index\n private int bufferEnd; //Input buffer ending index\n #endregion\n\n #region Properties\n /// \n /// The buffer size, in bytes\n /// \n public int BufferSize { get; }\n\n /// \n /// If this memory stream is open and available to read/write\n /// \n public bool Open { get; private set; }\n #endregion\n\n #region Constructors\n /// \n /// Creates a new console IO helper reading from the standard Console input and output\n /// \n public ConsoleHelper() : this(baseSize) { }\n\n /// \n /// Creates a new console IO helper reading from the standard Console input and output with the specified buffer size\n /// Size of the buffer to use in bytes\n /// \n public ConsoleHelper(int bufferSize)\n {\n //Open the input/output streams\n#if DEBUG\n //Test mode\n this.inStream = new BufferedStream(File.OpenRead(@\"..\\..\\input.txt\"), bufferSize);\n this.outStream = new StreamWriter(File.Create(@\"..\\..\\output.txt\", bufferSize), Encoding.ASCII, bufferSize);\n#else //!DEBUG\n//Submission mode\n this.inStream = new BufferedStream(Console.OpenStandardInput(bufferSize), bufferSize); //Submission stream\n this.outStream = new StreamWriter(Console.OpenStandardOutput(bufferSize), Encoding.ASCII, bufferSize);\n#endif\n\n //Set fields\n this.inBuffer = new byte[bufferSize];\n this.inputIndex = this.bufferEnd = 0;\n this.BufferSize = bufferSize;\n this.Open = true;\n }\n #endregion\n\n #region Static methods\n /// \n /// Verifies that the passed character is a non-special ASCII character\n /// \n /// Character to validate\n /// True if the character is not a special character\n public static bool ValidateChar(int i) => i >= ' ';\n\n /// \n /// Verifies that the passed character is a non-special ASCII character or a whitespace\n /// \n /// Character to validate\n /// True if the character is not a whitespace or a special character\n public static bool ValidateCharNoSpace(int i) => i > ' ';\n\n /// \n /// Verifies that the passed character is a numerical character (0-9)\n /// \n /// Character to validate\n /// True if the character is a numerical character, false otherwise\n public static bool ValidateNumber(int i) => i >= '0' && i <= '9';\n\n /// \n /// Verifies if a character is an Endline character\n /// \n /// Character to check\n /// True if it is an Endline character, false otherwise\n public static bool IsEndline(int i) => i == '\\n' || i == '\\0';\n\n /// \n /// Takes a signed int value and copies it's characters at the end of the integer char buffer\n /// \n /// Int to write to the buffer\n /// Head index at which the buffer's writing starts\n private static int GetIntBuffer(int n)\n {\n int head = 20;\n bool neg;\n if (n < 0)\n {\n neg = true;\n n = -n;\n }\n else { neg = false; }\n\n do\n {\n numBuffer[--head] = (char)((n % 10) + 48);\n n /= 10;\n }\n while (n > 0);\n\n if (neg) { numBuffer[--head] = '-'; }\n return head;\n }\n\n /// \n /// Takes a signed long value and copies it's characters at the end of the integer char buffer\n /// \n /// Long to write to the buffer\n /// Head index at which the buffer's writing starts\n private static int GetLongBuffer(long n)\n {\n int head = 20;\n bool neg;\n if (n < 0L)\n {\n neg = true;\n n = -n;\n }\n else { neg = false; }\n\n do\n {\n numBuffer[--head] = (char)((n % 10L) + 48L);\n n /= 10L;\n }\n while (n > 0L);\n\n if (neg) { numBuffer[--head] = '-'; }\n return head;\n }\n #endregion\n\n #region Methods\n /// \n /// Returns the next byte data in the console input stream\n /// \n /// Next data byte from the console\n public byte Read()\n {\n CheckBuffer();\n return this.inBuffer[this.inputIndex++];\n }\n\n /// \n /// Returns the next byte data in the console input stream without consuming it\n /// \n /// Next data byte from the console\n public byte Peek()\n {\n CheckBuffer();\n return this.inBuffer[this.inputIndex];\n }\n\n /// \n /// Skips a number of characters in the input stream\n /// \n /// Amount of chars to skip, defaults to 1\n public void Skip(int n = 1) => this.inputIndex += n;\n\n /// \n /// Assures we have data available in the input buffer\n /// \n private void CheckBuffer()\n {\n //If we reach the end of the buffer, load more data\n if (this.inputIndex >= this.bufferEnd)\n {\n this.inputIndex = this.inputIndex - this.bufferEnd;\n this.bufferEnd = this.inStream.Read(this.inBuffer, 0, this.BufferSize);\n\n //If nothing was added, add a null char at the start\n if (this.bufferEnd < 1) { this.inBuffer[this.bufferEnd++] = 0; }\n }\n }\n\n /// \n /// Returns the next character in the console input stream\n /// \n /// Next character in the input stream\n public char NextChar() => (char)Read();\n\n /// \n /// Returns the next string token from the console input\n /// \n /// If there is no more data on the line being read\n /// Parsed string, separated by spaces or special characters such as line feeds\n public string Next()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Append all characters\n StringBuilder sb = new StringBuilder().Append((char)b);\n b = Peek();\n while (ValidateCharNoSpace(b))\n {\n //Peek to not consume terminator\n sb.Append((char)b);\n Skip();\n b = Peek();\n }\n\n return sb.ToString();\n }\n\n /// \n /// Returns the next int value in the console input, this is a fast parse\n /// \n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// Parsed int value from the input\n public int NextInt()\n {\n //Skip invalids\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Verify for negative\n bool neg = false;\n if (b == '-')\n {\n neg = true;\n b = Read();\n }\n\n //Get first digit\n if (!ValidateNumber(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n int n = b - '0';\n b = Peek();\n while (ValidateNumber(b))\n {\n //Peek to not consume terminator, and check for overflow\n n = checked((n << 3) + (n << 1) + (b - '0'));\n Skip();\n b = Peek();\n }\n //If the character causing the exit is a valid ASCII character, the integer isn't correct formatted\n if (ValidateCharNoSpace(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n return neg ? -n : n;\n }\n\n /// \n /// Returns the next long value in the console input, this is a fast parse\n /// \n /// If the text is not a valid long\n /// If there is no more data on the line being read\n /// If the value is too large for long\n /// Parsed long value from the input\n public long NextLong()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n //Verify negative\n bool neg = false;\n if (b == '-')\n {\n neg = true;\n b = Read();\n }\n\n //Get first digit\n if (!ValidateNumber(b)) { throw new FormatException(\"Integer parsing has failed because the string contained invalid characters\"); }\n\n long n = b - '0';\n b = Peek();\n while (ValidateNumber(b))\n {\n //Peek to not consume terminator, and check for overflow\n n = checked((n << 3) + (n << 1) + (b - '0'));\n Skip();\n b = Peek();\n }\n //If the character causing the exit is a valid ASCII character, the long isn't correct formatted\n if (ValidateCharNoSpace(b)) { throw new FormatException(\"Long parsing has failed because the string contained invalid characters\"); }\n\n return neg ? -n : n;\n }\n\n /// \n /// Returns the next double value in the console input\n /// Note: fast double parsing is slightly harder, I'll implement it if I need to\n /// \n /// If the text is not a valid double\n /// If there is no more data on the line being read\n /// If the value is too large for double\n /// Parsed double value from the input\n public double NextDouble() => double.Parse(Next());\n\n /// \n /// Returns the next n int values on the same line in an array\n /// \n /// Number of values to seek\n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// If the created array is too large for the system memory\n /// The n integer values in an array\n public int[] NextInts(int n)\n {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n {\n array[i] = NextInt();\n }\n\n SkipNextLine();\n return array;\n }\n\n /// \n /// Returns the next n long values on the same line in an array\n /// \n /// Number of values to seek\n /// If the text is not a valid long\n /// If there is no more data on the line being read\n /// If the value is too large for long\n /// If the created array is too large for the system memory\n /// The n long values in an array\n public long[] NextLongs(int n)\n {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n {\n array[i] = NextLong();\n }\n\n SkipNextLine();\n return array;\n }\n\n /// \n /// Returns the next n int values on the next m lines in the output stream under the form of an NxM matrix\n /// \n /// Number of rows to the matrix\n /// Number of columns to the matrix\n /// If the text is not a valid integer\n /// If there is no more data on the line being read\n /// If the value is too large for integer\n /// If the created 2D array is too large for the system memory\n /// The NxM matrix of integers\n public int[,] NextMatrix(int n, int m)\n {\n int[,] matrix = new int[n, m];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n matrix[i, j] = NextInt();\n }\n\n SkipNextLine();\n }\n\n return matrix;\n }\n\n /// \n /// Returns the next line of text in the console\n /// \n /// Next string line from the console\n public string NextLine()\n {\n byte b = SkipInvalid();\n if (b == 0)\n {\n //Consume newline and return empty string\n Skip();\n return string.Empty;\n }\n\n //Read all the characters until the next linefeed\n StringBuilder sb = new StringBuilder().Append((char)b);\n b = Read();\n while (!IsEndline(b))\n {\n //Don't append special characters, but don't exit\n if (ValidateChar(b))\n {\n sb.Append((char)b);\n }\n b = Read();\n }\n\n return sb.ToString();\n }\n\n /// \n /// Skips the next token in input\n /// \n /// If there is no more data on the line being read\n public void SkipNext()\n {\n byte b = SkipInvalid();\n ValidateEndline(b);\n\n for (b = Peek(); ValidateCharNoSpace(b); b = Peek())\n {\n Skip();\n }\n }\n\n /// \n /// Skips all the text on the current line and jump to the next\n /// \n public void SkipNextLine()\n {\n for (byte b = Read(); !IsEndline(b); b = Read()) { }\n }\n\n /// \n /// Enumerates the given number of integers on the current line\n /// \n /// Number of integers on the current line\n /// Enumerable of the integers\n public IEnumerable EnumerateInts(int n)\n {\n while (n-- > 0)\n {\n yield return NextInt();\n }\n\n SkipNextLine();\n }\n\n /// \n /// Enumerates all the characters in the next line until the feed is exhausted or an endline character is met\n /// \n /// Enumerable of all the characters in the current line\n public IEnumerable EnumerateLine()\n {\n for (char c = NextChar(); !IsEndline(c); c = NextChar())\n {\n if (ValidateChar(c))\n {\n yield return c;\n }\n }\n }\n\n /// \n /// Assures we are not trying to read more data on the line that there exists\n /// \n /// Byte data to verify\n /// If there is no more data on the line being read\n private void ValidateEndline(byte b)\n {\n //If empty char\n if (b == 0)\n {\n //Go back a char and throw\n this.inputIndex--;\n throw new InvalidOperationException(\"No values left on line\");\n }\n }\n\n /// \n /// Skips all invalid character bytes then returns the first valid byte found, spaces are considered invalid\n /// \n /// The next valid character byte, cannot be a whitespace\n private byte SkipInvalid()\n {\n byte b = Peek();\n if (IsEndline(b)) { return 0; }\n\n while (!ValidateCharNoSpace(b))\n {\n Skip();\n b = Peek();\n //Return empty char if we meet an linefeed or empty char\n if (IsEndline(b)) { return 0; }\n }\n\n return Read();\n }\n\n /// \n /// Writes the given char to the console output\n /// \n /// Character to write\n public void Write(char c) => this.outStream.Write(c);\n\n /// \n /// Writes the given char buffer to the console output\n /// \n /// Char buffer to write\n public void Write(char[] buffer) => this.outStream.Write(buffer);\n\n /// \n /// Writes the given string to the console output\n /// \n /// String to write\n public void Write(string s) => this.outStream.Write(s);\n\n /// \n /// Writes the given integer to the console output\n /// \n /// Integer to write\n public void Write(int n)\n {\n int head = GetIntBuffer(n);\n this.outStream.Write(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the given long to the console output\n /// \n /// Long to write\n public void Write(long n)\n {\n int head = GetLongBuffer(n);\n this.outStream.Write(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the contents of the StringBuilder to the console output\n /// \n /// StringBuilder to write to the output\n public void Write(StringBuilder sb) => this.outStream.Write(sb.ToCharArray());\n\n /// \n /// Writes the given object to the console output using the object's ToString method\n /// \n /// Object to write\n public void Write(object o) => this.outStream.Write(o);\n\n /// \n /// Writes a sequence to the console output with the given string separator\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// String separator between each element, defaults to the empty string\n public void Write(IEnumerable e, string separator = \"\") => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// Character separator between each element\n public void Write(IEnumerable e, char separator) => this.outStream.Write(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a linefeed to the console output\n /// \n public void WriteLine() => this.outStream.WriteLine();\n\n /// \n /// Writes the given char to the console output, followed by a linefeed\n /// \n /// Character to write\n public void WriteLine(char c) => this.outStream.WriteLine(c);\n\n /// \n /// Writes the given char buffer to the console output, followed by a linefeed\n /// \n /// Char buffer to write to the output\n public void WriteLine(char[] buffer) => this.outStream.WriteLine(buffer);\n\n /// \n /// Writes the given string to the console output, followed by a linefeed\n /// \n /// String to write\n public void WriteLine(string s) => this.outStream.WriteLine(s);\n\n /// \n /// Writes the given integer to the console output, followed by a linefeed\n /// \n /// Integer to write\n public void WriteLine(int n)\n {\n int head = GetIntBuffer(n);\n this.outStream.WriteLine(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the given long to the console output, followed by a linefeed\n /// \n /// Long to write\n public void WriteLine(long n)\n {\n int head = GetLongBuffer(n);\n this.outStream.WriteLine(numBuffer, head, 20 - head);\n }\n\n /// \n /// Writes the contents of the StringBuilder to the console output, followed by a linefeed\n /// \n /// StringBuilder to write to the output\n public void WriteLine(StringBuilder sb) => this.outStream.WriteLine(sb.ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator, follows by a linefeed\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// String separator between each element, defaults to the empty string\n public void WriteLine(IEnumerable e, string separator = \"\") => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes a sequence to the console output with the given string separator, follows by a linefeed\n /// \n /// Type of elements in the sequence\n /// Sequence to print\n /// Character separator between each element\n public void WriteLine(IEnumerable e, char separator) => this.outStream.WriteLine(new StringBuilder().AppendJoin(e, separator).ToCharArray());\n\n /// \n /// Writes the given object to the console output using the object's ToString method, followed by a linefeed\n /// \n /// Object to write\n public void WriteLine(object o) => this.outStream.WriteLine(o);\n\n /// \n /// Flushes the output buffer to the console if the buffer is full, or if it's being forced\n /// \n public void Flush() => this.outStream.Flush();\n\n /// \n /// Disposes of the resources of this ConsoleHelper, closing all the associated streams\n /// \n public void Dispose()\n {\n if (this.Open)\n {\n Flush();\n this.inStream.Dispose();\n this.outStream.Dispose();\n this.Open = false;\n }\n }\n #endregion\n }\n\n /// \n /// Useful extensions\n /// \n internal static class Extensions\n {\n #region Enumerable extensions\n /// \n /// Applies an action on each member of the enumerable\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Action to apply to each parameter\n public static void ForEach(this IEnumerable e, Action action)\n {\n foreach (T t in e)\n {\n action(t);\n }\n }\n\n /// \n /// Joins all the elements of the enumerable into a string\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Separator string, defaults to the empty string\n public static string Join(this IEnumerable e, string separator = \"\") => new StringBuilder().AppendJoin(e, separator).ToString();\n\n /// \n /// Joins all the elements of the enumerable into a string\n /// \n /// Type of elements in the Enumerable\n /// Enumerable to loop through\n /// Separator character\n public static string Join(this IEnumerable e, char separator) => new StringBuilder().AppendJoin(e, separator).ToString();\n\n /// \n /// Finds the object with the maximum value in the enumerable\n /// \n /// Type of objects in the Enumerable\n /// Comparing type, must implement IComparable(T)\n /// Enumerable to loop through\n /// Function calculating the value that we want the max from\n /// The object with the maximum value in the enumerable\n public static T MaxValue(this IEnumerable e, Func selector) where TU : IComparable\n {\n using (IEnumerator enumerator = e.GetEnumerator())\n {\n if (!enumerator.MoveNext()) { throw new InvalidOperationException(\"No elements in sequence\"); }\n\n T max = enumerator.Current;\n TU value = selector(max);\n while (enumerator.MoveNext())\n {\n TU v = selector(enumerator.Current);\n if (value.CompareTo(v) < 0)\n {\n max = enumerator.Current;\n value = v;\n }\n }\n\n return max;\n }\n }\n\n /// \n /// Finds the object with the minimum value in the enumerable\n /// \n /// Type of objects in the Enumerable\n /// Comparing type, must implement IComparable(T)\n /// Enumerable to loop through\n /// Function calculating the value that we want the min from\n /// The object with the minimum value in the enumerable\n public static T MinValue(this IEnumerable e, Func selector) where TU : IComparable\n {\n using (IEnumerator enumerator = e.GetEnumerator())\n {\n if (!enumerator.MoveNext()) { throw new InvalidOperationException(\"No elements in sequence\"); }\n\n T min = enumerator.Current;\n TU value = selector(min);\n while (enumerator.MoveNext())\n {\n TU v = selector(enumerator.Current);\n if (value.CompareTo(v) > 0)\n {\n min = enumerator.Current;\n value = v;\n }\n }\n\n return min;\n }\n }\n #endregion\n\n #region String extensions\n /// \n /// Appends multiple objects to a StringBuilder, separated by the given string\n /// \n /// Type of elements in the Enumerable\n /// StringBuilder to append to\n /// Enumerable to loop through\n /// Separator string, defaults to the empty string\n /// The StringBuilder instance after the appending is done\n public static StringBuilder AppendJoin(this StringBuilder sb, IEnumerable source, string separator = \"\")\n {\n using (IEnumerator e = source.GetEnumerator())\n {\n if (e.MoveNext())\n {\n sb.Append(e.Current);\n while (e.MoveNext())\n {\n sb.Append(separator).Append(e.Current);\n }\n }\n }\n\n return sb;\n }\n\n /// \n /// Appends multiple objects to a StringBuilder, separated by the given string\n /// \n /// Type of elements in the Enumerable\n /// StringBuilder to append to\n /// Enumerable to loop through\n /// Separator character\n /// The StringBuilder instance after the appending is done\n public static StringBuilder AppendJoin(this StringBuilder sb, IEnumerable source, char separator)\n {\n using (IEnumerator e = source.GetEnumerator())\n {\n if (e.MoveNext())\n {\n sb.Append(e.Current);\n while (e.MoveNext())\n {\n sb.Append(separator).Append(e.Current);\n }\n }\n }\n\n return sb;\n }\n\n /// \n /// Returns true if the string is null, or the empty string \"\"\n /// Note: this will never throw a NullRef exception given that it is an extension method calling a static method\n /// \n /// String to test\n /// True if the string is null or empty, false otherwise\n public static bool IsEmpty(this string s) => string.IsNullOrEmpty(s);\n\n /// \n /// Creates a substring from a starting and ending index\n /// \n /// String to substring\n /// Starting index\n /// Ending index\n /// The resulting substring\n public static string SubStr(this string s, int start, int end) => s.Substring(start, (end - start) + 1);\n\n /// \n /// Copies the contents of a StringBuilder instance to an array\n /// \n /// StringBuilder to copy\n /// Contents array of the StringBuilder\n public static char[] ToCharArray(this StringBuilder sb)\n {\n char[] buffer = new char[sb.Length];\n sb.CopyTo(0, buffer, 0, sb.Length);\n return buffer;\n }\n #endregion\n\n #region Number extensions\n /// \n /// Tests if the given number is even or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsEven(this int n) => (n & 1) == 0;\n\n /// \n /// Tests if the given number is Even or not\n /// \n /// Number to test\n /// True if the number is pair, false otherwise\n public static bool IsEven(this long n) => (n & 1L) == 0;\n\n /// \n /// Real Modulus function over the integer, not a remainder function like the normal C# mod\n /// \n /// Left operand of the mod\n /// Right operand of the mod\n /// The Modulus of n and m, within [0, m - 1]\n public static int Mod(this int n, int m) => ((n % m) + m) % m;\n\n /// \n /// Real Modulus function over the integer, not a remainder function like the normal C# mod\n /// \n /// Left operand of the mod\n /// Right operand of the mod\n /// The Modulus of n and m, within [0, m - 1]\n public static long Mod(this long n, long m) => ((n % m) + m) % m;\n\n /// \n /// Counts the amount of set bits (1s in the binary representation) of a given integer\n /// \n /// Integer to get the set bits from\n /// Amount of set bits of the integer\n public static int SetBits(this int n)\n {\n n = n - ((n >> 1) & 0x55555555);\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;\n }\n\n /// \n /// Counts the amount of set bits (1s in the binary representation) of a given long\n /// \n /// Long to get the set bits from\n /// Amount of set bits of the long\n public static long SetBits(this long n)\n {\n n = n - ((n >> 1) & 0x5555555555555555);\n n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);\n return (((n + (n >> 4)) & 0xF0F0F0F0F0F0F0F) * 0x101010101010101) >> 56;\n }\n #endregion\n\n #region Array extensions\n /// \n /// Does a binary search through the sorted array to find the requested value\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The index of the found element, or -1 if it wasn't found\n public static int BinarySearch(this T[] array, T value) => Array.BinarySearch(array, value);\n\n /// \n /// Clears the array of all elements\n /// \n /// Type of elements in the array\n /// Array to clear\n public static void Clear(this T[] array) => Array.Clear(array, 0, array.Length);\n\n /// \n /// Determines if the array contains the given value\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// True if the value was found, false otherwise\n public static bool Contains(this T[] array, T value) => Array.IndexOf(array, value) != -1;\n\n /// \n /// Enumerates the contents of an ArraySegment\n /// \n /// Type contained within the array\n /// Array to iterate through\n /// Index offset to start the iteration at, defaults to 0\n /// Amount of values to return, default to the whole array\n /// Enumerable of all the values contained in the ArraySegment\n public static IEnumerable Enumerate(this T[] array, int offset = 0, int count = 0)\n {\n if (count == 0) { count = array.Length - offset; }\n\n int max = offset + count;\n for (int i = offset; i < max; i++)\n {\n yield return array[i];\n }\n }\n\n /// \n /// Sees if an elements matching the specified condition exists in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// True if a matching element exists, false otherwise\n public static bool Exists(this T[] array, Predicate match) => Array.Exists(array, match);\n\n /// \n /// Finds the first element matching the given condition in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// The first found element that satisfied the match, or default(T) if none did\n public static T Find(this T[] array, Predicate match) => Array.Find(array, match);\n\n /// \n /// Finds the last element matching the given condition in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Matching function to apply\n /// The last found element that satisfied the match, or default(T) if none did\n public static T FindLast(this T[] array, Predicate match) => Array.FindLast(array, match);\n\n /// \n /// Applies an action to every member of the array\n /// \n /// Type of elements in the array\n /// Array to loop through\n /// Action to apply on each member\n public static void ForEach(this T[] array, Action action) => Array.ForEach(array, action);\n\n /// \n /// Generates all the subsets of the given array of a size greater than or equal 1\n /// \n /// Type of elements in the array\n /// Array to get the subsets from\n /// All the subsets of size 1 or greater from the array\n public static IEnumerable> GetSubsets(this T[] array)\n {\n int max = 1 << array.Length, l = array.Length - 1;\n for (int i = 1; i < max; i++)\n {\n if ((i & -i) == i) { continue; } //Exclude subsets of length 1\n\n List subset = new List(array.Length);\n subset.AddRange(array.Where((t, j) => (i & (1 << (l - j))) != 0));\n yield return subset;\n }\n }\n\n /// \n /// Finds the first index of the given value in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The index of the value in the array, or -1 if it wasn't found\n public static int IndexOf(this T[] array, T value) => Array.IndexOf(array, value);\n\n /// \n /// Finds the last index of the given value in the array\n /// \n /// Type of elements in the array\n /// Array to search into\n /// Value to find\n /// The last index of the value in the array, or -1 if it wasn't found\n public static int LastIndexOf(this T[] array, T value) => Array.LastIndexOf(array, value);\n\n /// \n /// Reverses the array\n /// \n /// Type of elements in the array\n /// Array to reverse\n /// The reversed array\n public static T[] Reverse(this T[] array)\n {\n Array.Reverse(array);\n return array;\n }\n\n /// \n /// Sorts the array with the default comparer of T\n /// \n /// Type of elements in the array\n /// Array to sort\n public static void Sort(this T[] array) => Array.Sort(array);\n\n /// \n /// Sorts an array with the given comparison method\n /// \n /// Type of elements in the array\n /// Array to sort\n /// Comparison method to sort the array with\n public static void Sort(this T[] array, Comparison comparison) => Array.Sort(array, comparison);\n\n /// \n /// Swap two elements in an array\n /// \n /// Type of the array\n /// Aray to swap elements in\n /// Index of the first element\n /// Index of the second element\n public static void Swap(this T[] array, int i, int j)\n {\n T t = array[i];\n array[i] = array[j];\n array[j] = t;\n }\n\n public static void heapadd(this List l, int i)\n {\n l.Add(i);\n for (int j = l.Count - 1; j >= 0;)\n {\n int t = (j - 1) / 2;\n if (l[j] > l[t])\n {\n int temp = l[t];\n l[t] = l[j];\n l[j] = temp;\n }\n else\n break;\n j = t;\n }\n }\n public static int heapdelete(this List l)\n {\n int le = l.Count;\n int t = l[0];\n l[0] = l[le - 1];\n l.RemoveAt(le - 1);\n for (int i = 0; i < le - 1;)\n {\n int y = 2 * i + 1;\n if (y + 1 >= le - 1)\n {\n if (y >= le - 1)\n break;\n if (l[i] < l[y])\n {\n int temp = l[y];\n l[y] = l[i];\n l[i] = temp;\n\n }\n break;\n }\n if (l[y] < l[y + 1])\n {\n if (l[i] < l[y + 1])\n {\n int temp = l[y + 1];\n l[y + 1] = l[i];\n l[i] = temp;\n i = y + 1;\n }\n else\n break;\n }\n else\n {\n if (l[i] < l[y])\n {\n int temp = l[y];\n l[y] = l[i];\n l[i] = temp;\n i = y;\n }\n else\n break;\n }\n }\n\n\n return t;\n }\n\n #endregion\n }\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tier4\n{\n class Class2\n {\n static void Main(string[] args)\n {\n string[] nums_strings = Console.ReadLine().Split();\n ulong[] nums = new ulong[nums_strings.Length];\n for (int i = 0; i < nums_strings.Length; i++)\n nums[i] = Convert.ToUInt32(nums_strings[i]);\n ulong l = nums[0];\n ulong r = nums[1];\n ulong x = nums[2];\n ulong y = nums[3];\n ulong k = nums[4];\n for (ulong i = x; i <= y; i++)\n {\n if ((l <= i * k) && (i * k <= r))\n {\n Console.WriteLine(\"YES\");\n Environment.Exit(0);\n }\n }\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.ComponentModel.Design.Serialization;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private void A()\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var val = arr[0];\n while (val <= arr[1])\n {\n double ans = (double)val / arr[4];\n if (ans >= arr[2] && ans <= arr[3] && (ans%1)==0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n val++;\n }\n Console.WriteLine(\"NO\");\n }\n\n private void Solve()\n {\n var s = Console.ReadLine().Split(' ');\n var r = int.Parse(s[0]);\n var d = int.Parse(s[1]);\n var n = int.Parse(Console.ReadLine());\n var ans = 0;\n \n for (int i=0; i < n; i++)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var x = arr[0];\n var y = arr[1];\n long dist = x*x + y*y;\n if (dist < (r - d) * (r - d) || dist > r * r)\n continue;\n long lx = x - arr[2];\n long ly = y;//x + arr[2];\n long distL = lx * lx + ly * ly;\n if (distL < (r - d) * (r - d) || distL > r * r)\n continue;\n\n long rx = x + arr[2];\n long ry = y;//x + arr[2];\n long distR = rx * rx + ry * ry;\n if (distR < (r-d)*(r-d) || distR > r*r)\n continue;\n\n long tx = x;//x - arr[2];\n long ty = y + arr[2];\n long distT = tx * tx + ty * ty;\n if (distT < (r - d) * (r - d) || distT > r * r)\n continue;\n\n long bx = x;//x - arr[2];\n long by = y - arr[2];\n long distB = (bx * bx + by * by);\n if (distB < (r - d) * (r - d) || distB > r * r)\n continue;\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.A();\n //p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n //////////////////////////////\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n\n class TrieNode\n {\n public Dictionary Children { get; set; }\n \n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n private bool PoisonInStore(int l, int r, int x, int y, double k)\n {\n double hi = r / x;\n double lo = l / y;\n if (k < lo || k > hi)\n return false;\n int a = l;\n int b = x;\n while (a <= r && b <= y)\n {\n double t = (double)a / b;\n if (t == k)\n return true;\n if (t < k)\n a++;\n else\n b++;\n }\n return false;\n }\n\n public void Solve()\n {\n int l = input.ReadInt();\n int r = input.ReadInt();\n int x = input.ReadInt();\n int y = input.ReadInt();\n double k = input.ReadDouble();\n Console.Write(PoisonInStore(l, r, x, y, k) ? \"YES\" : \"NO\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kirill_And_The_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Double.Parse);\n Int64 l = Convert.ToInt64(arr[0]);\n Int64 r = Convert.ToInt64(arr[1]);\n Int64 x = Convert.ToInt64(arr[2]);\n Int64 y = Convert.ToInt64(arr[3]);\n double k = arr[4];\n bool cond = false;\n\n\n for(Int64 b = x; b= k)\n {\n cond = true;\n break;\n }\n \n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n float l = float.Parse(token[0]);\n float r = float.Parse(token[1]);\n float x = float.Parse(token[2]);\n float y = float.Parse(token[3]); \n float k = float.Parse(token[4]);\n float ans = 0;\n float min = Math.Min(l,x);\n float max = Math.Max(r,y);\n while(x<=y){\n if(x*k>=l&&x*k<=r){\n Console.WriteLine(\"YES\");\n return;\n }\n x++;\n }\n Console.WriteLine(\"NO\");\n }\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int l, r, x, y, k;\n\n public void Solve()\n {\n l = ioHelper.ReadNextInt();\n r = ioHelper.ReadNextInt();\n x = ioHelper.ReadNextInt();\n y = ioHelper.ReadNextInt();\n k = ioHelper.ReadNextInt();\n\n bool bRes = false;\n\n for(int cst =x; cst<=y;cst++)\n {\n long eff = cst * (long)k;\n if(eff>=l && eff<=r)\n {\n bRes = true;\n break;\n }\n }\n\n if (bRes)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Web;\n\nclass Program\n{\n\n static void Main(string[] args)\n {\n var str = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n long l = str[0];\n long r = str[1];\n long x = str[2];\n long y = str[3];\n long k = str[4];\n\n for (long i = l; i <= r; i++)\n {\n if (i % k == 0)\n {\n long p = i / k;\n if (p >= x && p <= y)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n\n\n}\n\n"}], "negative_code": [{"source_code": "using System;\nusing System.CodeDom;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\nusing System.Web;\nusing System.Web.UI.WebControls;\n\nnamespace Codeforces\n{\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n \n\n private void Solve()\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var val = arr[0];\n while (val <= arr[1])\n {\n double ans = (double)val/arr[4];\n if (ans >= arr[2] && ans <= arr[3])\n {\n Console.WriteLine(\"YES\");\n return;\n }\n val++;\n }\n Console.WriteLine(\"NO\");\n }\n\n int BinarySearch(int[] arr, int q)\n {\n var l = 0;\n var r = arr.Length - 1;\n //int med = -1;\n while (l <= r)\n {\n var med = l + (r - l) / 2;\n if (arr[med] == q)\n {\n return med;\n }\n if (q < arr[med])\n {\n r = med - 1;\n }\n else\n {\n l = med + 1;\n }\n }\n return -1;\n }\n\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n //p.Dispose();\n //////////////////////////////\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n private bool PoisonInStore(int l, int r, int x, int y, double k)\n {\n double hi = r / x;\n double lo = l / y;\n if (k < lo || k > hi)\n return false;\n int a = l;\n int b = x;\n while (a <= r && b <= y)\n {\n int t = a / b;\n if (t == k)\n return true;\n if (t < k)\n a++;\n else\n b++;\n }\n return false;\n }\n\n public void Solve()\n {\n int l = input.ReadInt();\n int r = input.ReadInt();\n int x = input.ReadInt();\n int y = input.ReadInt();\n double k = input.ReadDouble();\n Console.Write(PoisonInStore(l, r, x, y, k) ? \"YES\" : \"NO\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kirill_And_The_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Double.Parse);\n Int64 l = Convert.ToInt64(arr[0]);\n Int64 r = Convert.ToInt64(arr[1]);\n Int64 x = Convert.ToInt64(arr[2]);\n Int64 y = Convert.ToInt64(arr[3]);\n double k = arr[4];\n bool cond = false;\n Int64 min, max;\n\n\n if (r < x) Console.WriteLine(\"NO\");\n else if (x <= l && r <= y) Console.WriteLine(\"YES\");\n\n else\n {\n for (Int64 a = l; a < r + 1; a++)\n {\n for (Int64 b = x; b < y + 1; b++)\n {\n if (k == a / b)\n {\n cond = true;\n break;\n }\n }\n if (cond) break;\n\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kirill_And_The_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Double.Parse);\n Int64 l = Convert.ToInt64(arr[0]);\n Int64 r = Convert.ToInt64(arr[1]);\n Int64 x = Convert.ToInt64(arr[2]);\n Int64 y = Convert.ToInt64(arr[3]);\n double k = arr[4];\n bool cond = false;\n\n\n for(Int64 b = x; b +k)\n {\n cond = true;\n break;\n }\n \n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Kirill_And_The_Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), Double.Parse);\n Int64 l = Convert.ToInt64(arr[0]);\n Int64 r = Convert.ToInt64(arr[1]);\n Int64 x = Convert.ToInt64(arr[2]);\n Int64 y = Convert.ToInt64(arr[3]);\n double k = arr[4];\n bool cond = false;\n\n\n for(Int64 b = x; b= k)\n {\n cond = true;\n break;\n }\n \n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\npublic class CF_842A\n{\n public string solve(int l, int r, int a, int b, int k)\n {\n int lp = a;\n int rp = l;\n while (lp <= b)\n {\n while (rp <= r)\n {\n if (rp % lp == 0 && rp / lp == k)\n {\n return \"YES\";\n }\n rp++;\n }\n\n if (rp / lp >= k)\n {\n lp++;\n } else\n {\n return \"NO\";\n }\n }\n return \"NO\";\n }\n\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int l = Convert.ToInt32(lines[0]);\n int r = Convert.ToInt32(lines[1]);\n int a = Convert.ToInt32(lines[2]);\n int b = Convert.ToInt32(lines[3]);\n int k = Convert.ToInt32(lines[4]);\n Console.WriteLine(new CF_842A().solve(l, r, a, b, k));\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using System.IO;\n using System.Text;\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_842A\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(1, 10, 1, 10, 1));\n }\n\n [TestMethod]\n\t\tpublic void Test2()\n\t\t{\n\t\t\tAssert.AreEqual(\"NO\", new CF_842A().solve(1, 5, 6, 10, 1));\n\t\t}\n\t}\n}\n#endif\n"}, {"source_code": "\ufeffusing System;\n\npublic class CF_842A\n{\n public string solve(int l, int r, int a, int b, int k)\n {\n int lp = a;\n int rp = l;\n while (lp <= b)\n {\n while (rp <= r)\n {\n if (rp % lp == 0 && rp / lp == k)\n {\n return \"YES\";\n }\n rp++;\n }\n\n if (rp / lp >= k)\n {\n bool changed = false;\n while (rp / lp > k)\n {\n lp++;\n changed = true;\n }\n if (!changed) lp++;\n rp = l;\n } else\n {\n return \"NO\";\n }\n }\n return \"NO\";\n }\n\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int l = Convert.ToInt32(lines[0]);\n int r = Convert.ToInt32(lines[1]);\n int a = Convert.ToInt32(lines[2]);\n int b = Convert.ToInt32(lines[3]);\n int k = Convert.ToInt32(lines[4]);\n Console.WriteLine(new CF_842A().solve(l, r, a, b, k));\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using System.IO;\n using System.Text;\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_842A\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(1, 10, 1, 10, 1));\n }\n\n [TestMethod]\n\t\tpublic void Test2()\n\t\t{\n\t\t\tAssert.AreEqual(\"NO\", new CF_842A().solve(1, 5, 6, 10, 1));\n\t\t}\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(96918, 97018, 10077, 86510, 9));\n }\n\n [TestMethod]\n public void Test4()\n {\n Assert.AreEqual(\"NO\", new CF_842A().solve(1000000, 10000000, 1, 100000, 1));\n }\n\t}\n}\n#endif\n"}, {"source_code": "\ufeffusing System;\n\npublic class CF_842A\n{\n public string solve(int l, int r, int a, int b, int k)\n {\n int lp = a;\n int rp = l;\n while (lp <= b)\n {\n while (rp <= r)\n {\n if (rp % lp == 0 && rp / lp == k)\n {\n return \"YES\";\n }\n rp++;\n }\n\n if (rp / lp >= k)\n {\n bool changed = false;\n while (rp / lp > k && lp < b)\n {\n lp++;\n changed = true;\n }\n if (!changed) lp++;\n rp = l;\n } else\n {\n return \"NO\";\n }\n }\n return \"NO\";\n }\n\n static void Main(string[] args)\n {\n string[] lines = Console.ReadLine().Split();\n int l = Convert.ToInt32(lines[0]);\n int r = Convert.ToInt32(lines[1]);\n int a = Convert.ToInt32(lines[2]);\n int b = Convert.ToInt32(lines[3]);\n int k = Convert.ToInt32(lines[4]);\n Console.WriteLine(new CF_842A().solve(l, r, a, b, k));\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using System.IO;\n using System.Text;\n using Microsoft.VisualStudio.TestTools.UnitTesting;\n\n [TestClass]\n public class Test_CF_842A\n {\n [TestMethod]\n public void Test1()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(1, 10, 1, 10, 1));\n }\n\n [TestMethod]\n\t\tpublic void Test2()\n\t\t{\n\t\t\tAssert.AreEqual(\"NO\", new CF_842A().solve(1, 5, 6, 10, 1));\n\t\t}\n\n [TestMethod]\n public void Test3()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(96918, 97018, 10077, 86510, 9));\n }\n\n [TestMethod]\n public void Test4()\n {\n Assert.AreEqual(\"NO\", new CF_842A().solve(1000000, 10000000, 1, 100000, 1));\n }\n\n [TestMethod]\n public void Test5()\n {\n Assert.AreEqual(\"YES\", new CF_842A().solve(100, 200, 1, 20, 5));\n }\n\t}\n}\n#endif\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Actual_Shit_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int l = int.Parse(input[0]), r = int.Parse(input[1]), x = int.Parse(input[2]), y = int.Parse(input[3]);\n double k = double.Parse(input[4]);\n if (r < x)\n Console.WriteLine(\"NO\");\n else if (k > (double)(r) / x)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Actual_Shit_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int l = int.Parse(input[0]), r = int.Parse(input[1]), x = int.Parse(input[2]), y = int.Parse(input[3]);\n double k = double.Parse(input[4]);\n if (k > (double)(r) / x || k < (double)(l) / y)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n public class LowerBoundSortedSet : SortedSet\n {\n\n private ComparerDecorator _comparerDecorator;\n\n private class ComparerDecorator : IComparer\n {\n\n private IComparer _comparer;\n\n public T LowerBound { get; private set; }\n public T UpperBound { get; private set; }\n\n private bool _reset = true;\n\n public void Reset()\n {\n _reset = true;\n }\n\n public ComparerDecorator(IComparer comparer)\n {\n _comparer = comparer;\n }\n\n public int Compare(T x, T y)\n {\n int num = _comparer.Compare(x, y);\n if (_reset)\n {\n LowerBound = y;\n UpperBound = y;\n }\n if (num >= 0)\n {\n LowerBound = y;\n _reset = false;\n }\n if (num <= 0)\n {\n UpperBound = y;\n _reset = false;\n }\n return num;\n }\n }\n\n public LowerBoundSortedSet()\n : this(Comparer.Default) { }\n\n public LowerBoundSortedSet(IComparer comparer)\n : base(new ComparerDecorator(comparer))\n {\n _comparerDecorator = (ComparerDecorator)this.Comparer;\n }\n\n public T FindLowerBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.LowerBound;\n }\n\n public T FindUpperBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.UpperBound;\n }\n }\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int Number { get; set; }\n public char Letter { get; set; }\n\n }\n private static long Factorial(int i)\n {\n if (i <= 1)\n return 1;\n return i * Factorial(i - 1);\n }\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var x = data[2];\n var y = data[3];\n var k = data[4];\n\n for(var i = l; i <= r; i++)\n {\n var val = l / k;\n if(val >=x&&val<=y&& val % 1 == 0)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n public class LowerBoundSortedSet : SortedSet\n {\n\n private ComparerDecorator _comparerDecorator;\n\n private class ComparerDecorator : IComparer\n {\n\n private IComparer _comparer;\n\n public T LowerBound { get; private set; }\n public T UpperBound { get; private set; }\n\n private bool _reset = true;\n\n public void Reset()\n {\n _reset = true;\n }\n\n public ComparerDecorator(IComparer comparer)\n {\n _comparer = comparer;\n }\n\n public int Compare(T x, T y)\n {\n int num = _comparer.Compare(x, y);\n if (_reset)\n {\n LowerBound = y;\n UpperBound = y;\n }\n if (num >= 0)\n {\n LowerBound = y;\n _reset = false;\n }\n if (num <= 0)\n {\n UpperBound = y;\n _reset = false;\n }\n return num;\n }\n }\n\n public LowerBoundSortedSet()\n : this(Comparer.Default) { }\n\n public LowerBoundSortedSet(IComparer comparer)\n : base(new ComparerDecorator(comparer))\n {\n _comparerDecorator = (ComparerDecorator)this.Comparer;\n }\n\n public T FindLowerBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.LowerBound;\n }\n\n public T FindUpperBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.UpperBound;\n }\n }\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int Number { get; set; }\n public char Letter { get; set; }\n\n }\n private static long Factorial(int i)\n {\n if (i <= 1)\n return 1;\n return i * Factorial(i - 1);\n }\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var x = data[2];\n var y = data[3];\n var k = data[4];\n\n for(var i = l; i <= r; i++)\n {\n var val = i / k;\n if(val >=x&&val<=y)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n public class LowerBoundSortedSet : SortedSet\n {\n\n private ComparerDecorator _comparerDecorator;\n\n private class ComparerDecorator : IComparer\n {\n\n private IComparer _comparer;\n\n public T LowerBound { get; private set; }\n public T UpperBound { get; private set; }\n\n private bool _reset = true;\n\n public void Reset()\n {\n _reset = true;\n }\n\n public ComparerDecorator(IComparer comparer)\n {\n _comparer = comparer;\n }\n\n public int Compare(T x, T y)\n {\n int num = _comparer.Compare(x, y);\n if (_reset)\n {\n LowerBound = y;\n UpperBound = y;\n }\n if (num >= 0)\n {\n LowerBound = y;\n _reset = false;\n }\n if (num <= 0)\n {\n UpperBound = y;\n _reset = false;\n }\n return num;\n }\n }\n\n public LowerBoundSortedSet()\n : this(Comparer.Default) { }\n\n public LowerBoundSortedSet(IComparer comparer)\n : base(new ComparerDecorator(comparer))\n {\n _comparerDecorator = (ComparerDecorator)this.Comparer;\n }\n\n public T FindLowerBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.LowerBound;\n }\n\n public T FindUpperBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.UpperBound;\n }\n }\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int Number { get; set; }\n public char Letter { get; set; }\n\n }\n private static long Factorial(int i)\n {\n if (i <= 1)\n return 1;\n return i * Factorial(i - 1);\n }\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var x = data[2];\n var y = data[3];\n var k = data[4];\n double min = l / y;\n double max = r / x;\n if(k>=min && k <= max)\n {\n writer.WriteLine(\"YES\");\n } else\n {\n writer.WriteLine(\"NO\");\n }\n \n writer.Flush();\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication1.CodeForces\n{\n public class LowerBoundSortedSet : SortedSet\n {\n\n private ComparerDecorator _comparerDecorator;\n\n private class ComparerDecorator : IComparer\n {\n\n private IComparer _comparer;\n\n public T LowerBound { get; private set; }\n public T UpperBound { get; private set; }\n\n private bool _reset = true;\n\n public void Reset()\n {\n _reset = true;\n }\n\n public ComparerDecorator(IComparer comparer)\n {\n _comparer = comparer;\n }\n\n public int Compare(T x, T y)\n {\n int num = _comparer.Compare(x, y);\n if (_reset)\n {\n LowerBound = y;\n UpperBound = y;\n }\n if (num >= 0)\n {\n LowerBound = y;\n _reset = false;\n }\n if (num <= 0)\n {\n UpperBound = y;\n _reset = false;\n }\n return num;\n }\n }\n\n public LowerBoundSortedSet()\n : this(Comparer.Default) { }\n\n public LowerBoundSortedSet(IComparer comparer)\n : base(new ComparerDecorator(comparer))\n {\n _comparerDecorator = (ComparerDecorator)this.Comparer;\n }\n\n public T FindLowerBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.LowerBound;\n }\n\n public T FindUpperBound(T key)\n {\n _comparerDecorator.Reset();\n this.Contains(key);\n return _comparerDecorator.UpperBound;\n }\n }\n public abstract class Heap : IEnumerable\n {\n private const int InitialCapacity = 0;\n private const int GrowFactor = 2;\n private const int MinGrow = 1;\n\n private int _capacity = InitialCapacity;\n private T[] _heap = new T[InitialCapacity];\n private int _tail = 0;\n\n public int Count { get { return _tail; } }\n public int Capacity { get { return _capacity; } }\n\n protected Comparer Comparer { get; private set; }\n protected abstract bool Dominates(T x, T y);\n\n protected Heap() : this(Comparer.Default)\n {\n }\n\n protected Heap(Comparer comparer) : this(Enumerable.Empty(), comparer)\n {\n }\n\n protected Heap(IEnumerable collection)\n : this(collection, Comparer.Default)\n {\n }\n\n protected Heap(IEnumerable collection, Comparer comparer)\n {\n if (collection == null) throw new ArgumentNullException(\"collection\");\n if (comparer == null) throw new ArgumentNullException(\"comparer\");\n\n Comparer = comparer;\n\n foreach (var item in collection)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n }\n\n for (int i = Parent(_tail - 1); i >= 0; i--)\n BubbleDown(i);\n }\n\n public void Add(T item)\n {\n if (Count == Capacity)\n Grow();\n\n _heap[_tail++] = item;\n BubbleUp(_tail - 1);\n }\n\n private void BubbleUp(int i)\n {\n if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))\n return; //correct domination (or root)\n\n Swap(i, Parent(i));\n BubbleUp(Parent(i));\n }\n\n public T GetMin()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n return _heap[0];\n }\n\n public T ExtractDominating()\n {\n if (Count == 0) throw new InvalidOperationException(\"Heap is empty\");\n T ret = _heap[0];\n _tail--;\n Swap(_tail, 0);\n BubbleDown(0);\n return ret;\n }\n\n private void BubbleDown(int i)\n {\n int dominatingNode = Dominating(i);\n if (dominatingNode == i) return;\n Swap(i, dominatingNode);\n BubbleDown(dominatingNode);\n }\n\n private int Dominating(int i)\n {\n int dominatingNode = i;\n dominatingNode = GetDominating(YoungChild(i), dominatingNode);\n dominatingNode = GetDominating(OldChild(i), dominatingNode);\n\n return dominatingNode;\n }\n\n private int GetDominating(int newNode, int dominatingNode)\n {\n if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))\n return newNode;\n else\n return dominatingNode;\n }\n\n private void Swap(int i, int j)\n {\n T tmp = _heap[i];\n _heap[i] = _heap[j];\n _heap[j] = tmp;\n }\n\n private static int Parent(int i)\n {\n return (i + 1) / 2 - 1;\n }\n\n private static int YoungChild(int i)\n {\n return (i + 1) * 2 - 1;\n }\n\n private static int OldChild(int i)\n {\n return YoungChild(i) + 1;\n }\n\n private void Grow()\n {\n int newCapacity = _capacity * GrowFactor + MinGrow;\n var newHeap = new T[newCapacity];\n Array.Copy(_heap, newHeap, _capacity);\n _heap = newHeap;\n _capacity = newCapacity;\n }\n\n public IEnumerator GetEnumerator()\n {\n return _heap.Take(Count).GetEnumerator();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n }\n\n public class MaxHeap : Heap\n {\n public MaxHeap()\n : this(Comparer.Default)\n {\n }\n\n public MaxHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n public MaxHeap(IEnumerable collection) : base(collection)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) >= 0;\n }\n }\n\n public class MinHeap : Heap\n {\n public MinHeap()\n : this(Comparer.Default)\n {\n }\n\n public MinHeap(Comparer comparer)\n : base(comparer)\n {\n }\n\n public MinHeap(IEnumerable collection) : base(collection)\n {\n }\n\n public MinHeap(IEnumerable collection, Comparer comparer)\n : base(collection, comparer)\n {\n }\n\n protected override bool Dominates(T x, T y)\n {\n return Comparer.Compare(x, y) <= 0;\n }\n }\n static class _4032123\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node\n {\n public int Number { get; set; }\n public char Letter { get; set; }\n\n }\n private static long Factorial(int i)\n {\n if (i <= 1)\n return 1;\n return i * Factorial(i - 1);\n }\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var l = data[0];\n var r = data[1];\n var x = data[2];\n var y = data[3];\n var k = data[4];\n\n for(var i = l; i <= r; i++)\n {\n var val = l / k;\n if(val >=x&&val<=y)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int l = ReadInt();\n int r = ReadInt();\n int x = ReadInt();\n int y = ReadInt();\n int k = ReadInt();\n\n for (int i = x; i <= y; i++)\n {\n long v = 1L * x * k;\n if (v >= l && v <= r)\n {\n Write(\"YES\");\n return;\n }\n }\n\n Write(\"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int l = Convert.ToInt32(s[0]);\n int r = Convert.ToInt32(s[1]);\n int x = Convert.ToInt32(s[2]);\n int y = Convert.ToInt32(s[3]);\n int k = Convert.ToInt32(s[4]);\n for (int i = x; i <= y; i++)\n {\n int st = i * k;\n if (st >= l && st <= r)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (int i = x; i <= y; i++) {\n int j = i * k;\n if (l >= j && j <= r) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (float i = l * k; i <= r * k; i+= k) {\n if ((int)i == i) {\n int j = (int)(i / k);\n if (j >= x && j <= y) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n \n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (int i = x; i <= y; i++) {\n int j = i * k;\n if (l >= j && j <= r) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (int i = x; i <= y; i++) {\n int j = i * k;\n if (j >= l && j <= r) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (int i = x; i <= y; i++) {\n long j = i * k;\n if (j >= l && j <= r) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (int i = l; i <= r; i++) {\n int j = i * k;\n if (j >= x && j <= y) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] line = Console.ReadLine ().Split (' ');\n\n int l = Convert.ToInt32 (line[0]);\n int r = Convert.ToInt32 (line[1]);\n int x = Convert.ToInt32 (line[2]);\n int y = Convert.ToInt32 (line[3]);\n int k = Convert.ToInt32 (line[4]);\n\n for (float i = l * k; i <= r * k; i+= k) {\n float j = i / k;\n if (Math.Abs (j - Math.Truncate (j)) > 0.00000000001) {\n if (j >= x && j <= y) {\n Console.WriteLine (\"Yes\");\n return;\n }\n }\n \n }\n\n Console.WriteLine (\"No\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n float l = float.Parse(token[0]);\n float r = float.Parse(token[1]);\n float x = float.Parse(token[2]);\n float y = float.Parse(token[3]); \n float k = float.Parse(token[4]);\n float ans = 0;\n float min = Math.Min(l,x);\n float max = Math.Max(r,y);\n while(min<=max){\n l++;\n x++;\n min++;\n if(l/x==k){\n Console.WriteLine(\"YES\");\n return;\n }\n \n }\n Console.WriteLine(\"NO\");\n }\n }\n \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int l = int.Parse(token[0]);\n int r = int.Parse(token[1]);\n int x = int.Parse(token[2]);\n int y = int.Parse(token[3]); \n int k = int.Parse(token[4]);\n \n int max = Math.Max(y,r);\n int min = Math.Min(l,x);\n \n for(;min= min) && (arr[4] <= max))\n {\n int k = 0;\n for (int i = arr[2]; i < arr[3] && i * arr[4] <= arr[1] && k == 0; i++)\n if ((i * arr[4] <= arr[1]) && (i * arr[4] >= arr[0])) k++;\n if (k == 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n\n }\n else Console.WriteLine(\"NO\");\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace cdfRound\n{\n class MainClass\n {\n public static void Main()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] arr = new int[str.Length];\n for (int i = 0; i < arr.Length; i++)\n arr[i] = int.Parse(str[i]);\n double min = (double)arr[0] / arr[3];\n double max = (double)arr[1] / arr[2];\n if ((arr[4] >= min) && (arr[4] <= max))\n {\n int k = 0;\n for (int i = arr[2]; i < arr[3] && i * arr[4] <= arr[1] && k == 0; i++)\n if ((i * arr[4] <= max) && (i * arr[4] >= min)) k++;\n if (k == 0)\n Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n\n }\n else Console.WriteLine(\"NO\");\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n float l = float.Parse(token[0]);\n float r = float.Parse(token[1]);\n float x = float.Parse(token[2]);\n float y = float.Parse(token[3]); \n float k = float.Parse(token[4]);\n float ans = 0;\n float min = Math.Min(l,x);\n float max = Math.Max(r,y);\n while(l<=r){\n if(l*k>=x&&l*k<=y){\n Console.WriteLine(\"YES\");\n return;\n }\n l++;\n }\n Console.WriteLine(\"NO\");\n }\n }\n \n}"}], "src_uid": "1110d3671e9f77fd8d66dca6e74d2048"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n long[] fact = new long[19];\n private int[] a;\n\n void Fun(int x, int lim, int k, long s, SDictionary[] dicts)\n {\n if (s < 0)\n return;\n if (x == lim)\n {\n dicts[k][s]++;\n return;\n }\n\n if (a[x] < 19 && k > 0)\n Fun(x + 1, lim, k - 1, s - fact[a[x]], dicts);\n Fun(x + 1, lim, k, s - a[x], dicts);\n Fun(x + 1, lim, k, s, dicts);\n }\n\n public void Solve()\n {\n fact[0] = 1;\n for (int i = 1; i < 19; i++)\n fact[i] = fact[i - 1] * i;\n\n int n = ReadInt();\n int k = ReadInt();\n long s = ReadLong();\n a = ReadIntArray();\n\n var d1 = Enumerable.Repeat(0, k + 1).Select(x => new SDictionary()).ToArray();\n Fun(0, n / 2, k, s, d1);\n var d2 = Enumerable.Repeat(0, k + 1).Select(x => new SDictionary()).ToArray();\n Fun(n / 2, n, k, s, d2);\n\n long ans = 0;\n for (int i = 0; i <= k; i++)\n foreach (var p in d1[i])\n for (int j = k - i; j <= k; j++)\n ans += p.Value * d2[j][s - p.Key];\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"cycle.in\");\n //writer = new StreamWriter(\"cycle.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n #endregion\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n long[] fact = new long[19];\n private int[] a;\n\n void Fun(int x, int lim, int k, long s, SDictionary[] dicts)\n {\n if (s < 0)\n return;\n if (x == lim)\n {\n dicts[k][s]++;\n return;\n }\n\n if (a[x] < 19 && k > 0)\n Fun(x + 1, lim, k - 1, s - fact[a[x]], dicts);\n Fun(x + 1, lim, k, s - a[x], dicts);\n Fun(x + 1, lim, k, s, dicts);\n }\n\n public void Solve()\n {\n fact[0] = 1;\n for (int i = 1; i < 19; i++)\n fact[i] = fact[i - 1] * i;\n\n int n = ReadInt();\n int k = ReadInt();\n long s = ReadLong();\n a = ReadIntArray();\n\n var d1 = Init>(k + 1);\n Fun(0, n / 2, k, s, d1);\n var d2 = Init>(k + 1);\n Fun(n / 2, n, k, s, d2);\n\n long ans = 0;\n for (int i = 0; i <= k; i++)\n foreach (var p in d1[i])\n for (int j = k - i; j <= k; j++)\n ans += p.Value * d2[j][s - p.Key];\n\n Write(ans);\n }\n\n private T[] Init(int n) where T : new()\n {\n var ret = new T[n];\n for (int i = 0; i < n; i++)\n ret[i] = new T();\n return ret;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"cycle.in\");\n //writer = new StreamWriter(\"cycle.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n\n static long[] fact =\n {\n 1, 1, 2, 6, 24,\n 120, 720, 5040, 40320, 362880,\n 3628800, 39916800, 479001600, 6227020800, 87178291200,\n 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000\n };\n\n static Dictionary[] dm;\n static void Build(int[] a, int p, int k, int mk, long s)\n {\n if (p == a.Length)\n {\n for (var t = mk - k; t <= mk; t++)\n {\n if (!dm[t].ContainsKey(s))\n {\n dm[t][s] = 0;\n }\n dm[t][s]++;\n }\n return;\n }\n\n var x = a[p];\n if(x < 19 && k > 0)\n {\n Build(a, p + 1, k - 1, mk, s + fact[x]);\n }\n Build(a, p + 1, k, mk, s + x);\n Build(a, p + 1, k, mk, s);\n }\n static long Search(int[] a, int p, int to, int k, long s)\n {\n if (s < 0) return 0;\n if(p == to)\n {\n long r;\n dm[k].TryGetValue(s, out r);\n return r;\n }\n\n long res = 0;\n if(a[p] < 19 && k > 0)\n {\n res += Search(a, p + 1, to, k - 1, s - fact[a[p]]);\n }\n res += Search(a, p + 1, to, k, s);\n res += Search(a, p + 1, to, k, s - a[p]);\n\n return res;\n }\n\n static void Main()\n {\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n\n dm = new Dictionary[k + 1];\n for(var i = 0; i <= k; i++)\n {\n dm[i] = new Dictionary();\n }\n\n var p = n - n / 2;\n Build(a, p, k, k, 0);\n\n var ans = Search(a, 0, p, k, s);\n cout += ans + endl;\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[29999999];\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x & 0x7FFFFFFF % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n //while (hashtable[hash] != -1 && hashs[hash] != hash) hash = (hash + 1) % hashtable.Length;\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = hash;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[999983];\n\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x.GetHashCode() % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = hash;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[29999999];\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n //while (hashtable[hash] != -1 && hashs[hash] != hash) hash = (hash + 1) % hashtable.Length;\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = hash;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[29999999];\n\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x.GetHashCode() % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = hash;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[12345653];\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = res;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[9999991];\n\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x.GetHashCode() % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = hash;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static int mod = 999983;\n static long[] fact = new long[50];\n static long[] sum;\n static long[,] hashtable;\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = x % mod;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[p, hash] != -1)\n {\n return hashtable[p, hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[p, hash] = res;\n }\n\n return res;\n }\n static void Main()\n {\n hashtable = new long[25, mod];\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for (var j = 0; j < 25; j++)\n {\n\n for (var i = 0; i < mod; i++)\n {\n hashtable[j, i] = -1;\n }\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n static long[] fact = new long[50];\n static long[] sum;\n static long[] hashtable = new long[12345653];\n static long Search(int[] a, int p, long x, long s, int k)\n {\n if (x == s) return 1;\n if (x > s) return 0;\n if (p == a.Length) return 0;\n if (a[p] >= 19 && sum[p] + x < s) return 0;\n\n long hash = (x * 25 + p) % hashtable.Length;\n if (hash < 0) hash += hashtable.Length;\n if (a[p] < 19)\n {\n if(hashtable[hash] != -1)\n {\n return hashtable[hash];\n }\n }\n\n long res = Search(a, p + 1, x, s, k);\n if (k == 0 || a[p] >= 19)\n {\n res = Search(a, p + 1, x + a[p], s, k);\n }\n else\n {\n res += Search(a, p + 1, x + a[p], s, k);\n res += Search(a, p + 1, x + fact[a[p]], s, k - 1);\n }\n if (a[p] < 19)\n {\n hashtable[hash] = res;\n }\n\n return res;\n }\n static void Main()\n {\n fact[0] = 1;\n for (var i = 1; i < 50; i++)\n {\n fact[i] = fact[i - 1] * i;\n }\n for(var i = 0; i < hashtable.Length; i++)\n {\n hashtable[i] = -1;\n }\n\n var n = cin.ReadInt32();\n var k = cin.ReadInt32();\n var s = cin.ReadInt64();\n\n var a = cin.ReadArray(n);\n Array.Sort(a);\n if (a[n - 1] < 19)\n {\n Array.Reverse(a);\n }\n else\n {\n for (var i = 0; i < a.Length - 1; i++)\n {\n if (a[i + 1] >= 19)\n {\n Array.Reverse(a, 0, i + 1);\n break;\n }\n }\n }\n sum = new long[n + 1];\n for(var i = n - 1; i >= 0; i--)\n {\n sum[i] = a[i] + sum[i + 1];\n }\n\n var ans = Search(a, 0, 0, s, k);\n cout += ans + endl;\n }\n}"}], "src_uid": "2821a11066dffc7e8f6a60a8751cea37"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ciel_and_Robot\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"Yes\" : \"No\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n string[] ss = reader.ReadLine().Split(' ');\n int A = int.Parse(ss[0]);\n int B = int.Parse(ss[1]);\n\n if (A == 0 && B == 0)\n {\n return true;\n }\n\n string s = reader.ReadLine();\n int x = 0, y = 0;\n\n foreach (char c in s)\n {\n switch (c)\n {\n case 'U':\n y++;\n break;\n case 'D':\n y--;\n break;\n case 'L':\n x--;\n break;\n case 'R':\n x++;\n break;\n }\n if (A == x && B == y)\n {\n return true;\n }\n }\n\n if (x == 0 && y == 0)\n return false;\n\n if (Math.Abs(A) > 200 || Math.Abs(B) > 200)\n {\n if ((long) x*A < 0 || (long) y*B < 0)\n return false;\n\n int dx = x == 0 ? 0 : (A - Math.Sign(A)*100)/x;\n int dy = y == 0 ? 0 : (B - Math.Sign(B)*100)/y;\n if (dx >= dy)\n {\n x = dx*x;\n y = dx*y;\n }\n else\n {\n x = dy*x;\n y = dy*y;\n }\n }\n\n do\n {\n foreach (char c in s)\n {\n switch (c)\n {\n case 'U':\n y++;\n break;\n case 'D':\n y--;\n break;\n case 'L':\n x--;\n break;\n case 'R':\n x++;\n break;\n }\n if (A == x && B == y)\n {\n return true;\n }\n }\n } while (Math.Abs(A - x) < 300 && Math.Abs(B - y) < 300);\n\n return false;\n }\n }\n}", "positive_code": [{"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint a = NextInt(), b = NextInt();\n\t\t\tstring s = NextLine().Trim();\n\t\t\tint x = 0, y = 0;\n\t\t\tbool ok = false;\n\t\t\tfor ( int times = 0; times < 100; ++times )\n\t\t\t{\n\t\t\t\tfor ( int i = 0; i < s.Length; ++i )\n\t\t\t\t{\n\t\t\t\t\tif ( x == a && y == b ) ok = true;\n\t\t\t\t\tif ( s[i] == 'U' )\n\t\t\t\t\t{\n\t\t\t\t\t\t++y;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( s[i] == 'D' )\n\t\t\t\t\t{\n\t\t\t\t\t\t--y;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( s[i] == 'L' )\n\t\t\t\t\t{\n\t\t\t\t\t\t--x;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t++x;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tint dx = x, dy = y;\n\t\t\tif ( (long)( a - dx ) * ( a - dx ) + (long)( b - dy ) * ( b - dy ) < (long)a * a + (long)b * b )\n\t\t\t{\n\t\t\t\tint k = int.MaxValue;\n\t\t\t\tif ( dx != 0 ) k = a / dx;\n\t\t\t\telse if ( dy != 0 ) k = b / dy;\n\t\t\t\tif ( k != int.MaxValue )\n\t\t\t\t{\n\t\t\t\t\tif ( k > 10 ) k -= 5;\n\t\t\t\t\tif ( k > 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tx += dx * k;\n\t\t\t\t\t\ty += dy * k;\n\n\n\t\t\t\t\t\tfor ( int times = 0; times < 10000; ++times )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor ( int i = 0; i < s.Length; ++i )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif ( x == a && y == b ) ok = true;\n\t\t\t\t\t\t\t\tif ( s[i] == 'U' )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t++y;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if ( s[i] == 'D' )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t--y;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if ( s[i] == 'L' )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t--x;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t++x;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( ok ) Out.WriteLine( \"Yes\" );\n\t\t\telse Out.WriteLine( \"No\" );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int[] NextIntArray( int size )\n\t\t{\n\t\t\tvar res = new int[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextInt();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] NextLongArray( int size )\n\t\t{\n\t\t\tvar res = new long[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextLong();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] NextDoubleArray( int size )\n\t\t{\n\t\t\tvar res = new double[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextDouble();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return dy != 0 && pdy % dy == 0 && pdy / dy > 0;\n\n if (dx != 0 && pdx % dx == 0 && pdx / dx > 0)\n {\n return pdy == 0 && dy == 0 || dy != 0 && pdy % dy == 0 && pdy / dy > 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n //var inStream = File.OpenText(\"Test.txt\");\n //Console.SetIn(inStream);\n\n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n Console.WriteLine(\"No\");\n //inStream.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Read(ref int a, ref int b, ref string cmd)\n {\n string in_s = Console.ReadLine();\n string[] pama = in_s.Split(' ');\n a = Convert.ToInt32(pama[0]);\n b = Convert.ToInt32(pama[1]);\n cmd = Console.ReadLine();\n }\n static int check(int dx, int cur_x, int aim_x)\n {\n aim_x -= cur_x;\n if (dx == 0)\n {\n if (aim_x == 0) return -1;\n else return -2;\n }\n else\n {\n if (aim_x % dx == 0 && aim_x / dx >= 0) return aim_x / dx;\n else return -2;\n }\n }\n static void Main(string[] args)\n {\n int a, b;\n string cmd;\n a = b = 0;\n cmd = \"\";\n Read(ref a,ref b,ref cmd);\n int dx, dy;\n dx = dy = 0;\n for (int i = 0; i < cmd.Length; i++)\n {\n // Console.Write(cmd[i]);\n switch (cmd[i])\n {\n case 'D': dy--; break;\n case 'U': dy++; break;\n case 'L': dx--; break;\n case 'R': dx++; break;\n }\n }\n int px, py;\n bool flag;\n px = py = 0;\n flag = false;\n // Console.WriteLine(\"{0} {1}\", dx, dy);\n for (int i = 0; i < cmd.Length; i++)\n {\n //Console.WriteLine(\"{0}, {1}\", px, py);\n int f1 = check(dx, px, a);\n int f2 = check(dy, py, b);\n if(f1 >= -1 && f2 >= -1 && (f1 == f2 || f1 == -1 || f2 == -1))\n {\n flag = true;\n break;\n }\n switch (cmd[i])\n {\n case 'D': py--; break;\n case 'U': py++; break;\n case 'L': px--; break;\n case 'R': px++; break;\n }\n \n }\n if(flag)Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n\n\n\n\n\n\n//while (true) ;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R190_Div2_C\n {\n //static int offset = 100;\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n\n string s = Console.ReadLine();\n\n //int[,] xy = new int[offset*2+1, offset*2+1];\n\n int n = s.Length;\n int dy = 0, dx = 0;\n if (a == dx && b == dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n //xy[dx+offset, dy+offset] = 1;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U') dy++;\n else if (s[i] == 'D') dy--;\n else if (s[i] == 'L') dx--;\n else if (s[i] == 'R') dx++;\n //xy[dx + offset, dy + offset] = 1;\n if (a == dx && b == dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n int x = 0, y = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U') y++;\n else if (s[i] == 'D') y--;\n else if (s[i] == 'L') x--;\n else if (s[i] == 'R') x++;\n if (IsReachable(x, y, a, b, dx, dy))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n //for (int i = 0; i <= offset * 2; i++)\n // for (int j = 0; j <= offset * 2; j++)\n // if (xy[i,j] == 1)\n // {\n // if (IsReachable( i-offset, j-offset, a, b, dx, dy))\n // {\n // Console.WriteLine(\"Yes\");\n // return;\n // }\n // } \n\n Console.WriteLine(\"No\"); \n }\n\n static private bool IsReachable(int i, int j, int a, int b, int dx, int dy)\n {\n int k = 0;\n if (dx != 0) k = (a - i) / dx;\n else if (dy != 0) k = (b - j) / dy;\n if (k < 0) k = 0;\n\n return (a == i + k * dx && b == j + k * dy);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskA\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int A = ab[0];\n int B = ab[1];\n\n string moves = instream.ReadLine();\n\n bool[,] field = new bool[201, 201];\n\n int x = 0;\n int y = 0;\n field[100, 100] = true;\n for (int i = 0; i < moves.Length; i++)\n {\n switch (moves[i])\n {\n case 'U': y++; break;\n case 'D': y--; break;\n case 'L': x--; break;\n case 'R': x++; break;\n }\n field[100 + x, 100 + y] = true;\n }\n\n bool ok = false;\n\n if (x == 0 && y == 0)\n {\n if (Math.Abs(ab[0]) <= 100 && Math.Abs(ab[1]) <= 100)\n {\n if (field[ab[0] + 100, ab[1] + 100]) ok = true;\n }\n }\n else\n {\n int initK = 0;\n if (x == 0)\n initK = Math.Max(B / y, 0);\n else if (y == 0)\n initK = Math.Max(A / x, 0);\n else\n {\n initK = Math.Min(Math.Max(A / x, 0), Math.Max(B / y, 0));\n }\n\n int startK = initK;\n int endK = initK;\n\n while ((double)((double)x * startK - A) * (double)((double)x * startK - A) + (double)((double)y * startK - B) * (double)((double)y * startK - B) <= 200 * 200)\n {\n startK--;\n if (startK < 0)\n {\n startK = 0;\n break;\n }\n }\n\n while ((double)((double)x * endK - A) * (double)((double)x * endK - A) + (double)((double)y * endK - B) * (double)((double)y * endK - B) <= 200 * 200)\n {\n endK++;\n }\n\n for (int k = startK; k <= endK; k++)\n {\n long baseX0 = (long)k * x;\n long baseY0 = (long)k * y;\n\n if (A >= baseX0 - 100 && A <= baseX0 + 100 &&\n B >= baseY0 - 100 && B <= baseY0 + 100)\n {\n if (field[A - baseX0 + 100, B - baseY0 + 100])\n {\n ok = true;\n break;\n }\n }\n }\n\n }\n\n if (ok)\n outstream.WriteLine(\"Yes\");\n else\n outstream.WriteLine(\"No\");\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic sealed class Program {\n\n static Char[] mp = { 'U', 'R', 'D', 'L' };\n\n static Int32[,] dir = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };\n\n // -1 - No\n // 0 - Check steps\n // 1 - Yes\n static Int32 Check(Int32 x, Int32 dx, ref Int32 steps) {\n if (Math.Sign(x) != Math.Sign(dx)) {\n return -1;\n }\n if (dx == 0) {\n return x == 0 ? 1 : -1;\n }\n if (Math.Abs(x) % Math.Abs(dx) != 0) {\n return -1;\n }\n steps = Math.Abs(x) / Math.Abs(dx);\n return 0;\n }\n\n static Boolean Solve() {\n String[] token = Console.ReadLine().Split();\n Int32 x = Int32.Parse(token[0]), y = Int32.Parse(token[1]), dx = 0, dy = 0, i, t;\n if (x == 0 && y == 0) {\n return true;\n }\n String s = Console.ReadLine();\n foreach (Char ch in s) {\n i = Array.IndexOf(mp, ch);\n dx += dir[i, 0];\n dy += dir[i, 1];\n }\n Int32 one, two, spix = 0, spiy = 0;\n for (t = 0; t < s.Length; ) {\n one = Check(x, dx, ref spix);\n two = Check(y, dy, ref spiy);\n if (one > 0 && two >= 0 || one >= 0 && two > 0 || one == 0 && two == 0 && spix == spiy) {\n return true;\n }\n i = Array.IndexOf(mp, s[s.Length - ++t]);\n x += dir[i, 0];\n y += dir[i, 1];\n }\n return false;\n }\n\n public Program() {\n Console.WriteLine(Solve() ? \"Yes\" : \"No\");\n }\n\n // stuff cutline\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n new Program();\n Console.Out.Flush();\n }\n\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int a = int.Parse(data[0]);\n int b = int.Parse(data[1]);\n\n str = Console.ReadLine();\n\n int x = 0, y = 0;\n\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'U') y += 1;\n if (str[i] == 'D') y -= 1;\n if (str[i] == 'L') x -= 1;\n if (str[i] == 'R') x += 1;\n\n if (x == a && y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n int xe = x, ye = y;\n x = y = 0;\n\n if (xe == 0 && ye == 0)\n {\n Console.WriteLine(\"No\");\n return;\n }\n\n for (int i = 0; i < str.Length; i++)\n {\n if (xe != 0 && (a - x) % xe == 0)\n {\n int step = (a - x) / xe;\n\n if (step > 0 && ye * step + y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (ye != 0 && (b - y) % ye == 0)\n {\n int step = (b - y) / ye;\n\n if (step > 0 && xe * step + x == a)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n if (str[i] == 'U') y += 1;\n if (str[i] == 'D') y -= 1;\n if (str[i] == 'L') x -= 1;\n if (str[i] == 'R') x += 1;\n\n if (xe != 0 && (a - x) % xe == 0)\n {\n int step = (a - x) / xe;\n\n if (step > 0 && ye * step + y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (ye != 0 && (b - y) % ye == 0)\n {\n int step = (b - y) / ye;\n\n if (step > 0 && xe * step + x == a)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"No\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n string Str = Console.ReadLine();\n\n if (ab[0] == 0 && ab[1] == 0) { Console.Write(\"Yes\"); return; }\n\n List Move_hor = new List();\n List Move_vert = new List();\n\n int hor = 0; int vert = 0; \n for(int i = 0; i < Str.Length; i++)\n {\n switch (Str[i])\n {\n case 'U':\n Move_vert.Add(++vert);\n Move_hor.Add(hor);\n break;\n case 'L':\n Move_vert.Add(vert);\n Move_hor.Add(--hor);\n break;\n case 'R':\n Move_vert.Add(vert);\n Move_hor.Add(++hor);\n break;\n case 'D':\n Move_vert.Add(--vert);\n Move_hor.Add(hor);\n break;\n }\n }\n\n for(int i = 0; i < Move_hor.Count(); i++)\n {\n if(Move_hor[i] == ab[0] && Move_vert[i] == ab[1])\n {\n Console.Write(\"Yes\");\n return;\n }\n\n if (hor != 0)\n {\n int k = (ab[0] - Move_hor[i]) / hor;\n if (k >= 0 && ab[0] == Move_hor[i] + k * hor && ab[1] == Move_vert[i] + k * vert)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (vert != 0)\n {\n int k = (ab[1] - Move_vert[i]) / vert;\n if (k >= 0 && ab[0] == Move_hor[i] + k * hor && ab[1] == Move_vert[i] + k * vert)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n Console.Write(\"No\");\n } \n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n Console.WriteLine(m + n - 1);\n for (int i = 1; i <= m; i++)\n Console.WriteLine(1 + \" \" + i);\n for (int i = 2; i <= n; i++)\n Console.WriteLine(i + \" \" + 1);\n }\n\n static void B()\n {\n long r, g, b;\n string[] tokens = ReadArray(' ');\n r = long.Parse(tokens[0]);\n g = long.Parse(tokens[1]);\n b = long.Parse(tokens[2]);\n Console.WriteLine((r + g + b) / 3l);\n }\n\n static void C()\n {\n int left, right, up, down;\n left = right = up = down = 0;\n int a, b;\n string[] tokens = ReadArray(' ');\n a = int.Parse(tokens[0]);\n b = int.Parse(tokens[1]);\n string s = ReadLine();\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) up++;\n if (s[i].Equals('D')) down++;\n if (s[i].Equals('L')) left++;\n if (s[i].Equals('R')) right++;\n }\n int _left, _right, _up, _down;\n _left = _right = _up = _down = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) _up++;\n if (s[i].Equals('D')) _down++;\n if (s[i].Equals('L')) _left++;\n if (s[i].Equals('R')) _right++;\n int _a = a + _left;\n _a -= _right;\n int _b = b - _up;\n _b += _down;\n if (_a == 0 && _b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else\n {\n int x = 0;\n if (right - left != 0)\n x = _a / (right - left);\n if (up - down != 0)\n x = _b / (up - down);\n\n if (x >= 0 && (_a + x * (left - right)) == 0 && (_b + x * (down - up) == 0))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n }\n }\n Console.WriteLine(\"No\");\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "/*using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class NetworkXOneTimePad\n{\n public static void Main()\n {\n int n = 100;\n int[,] G = new int[n+1,n+1];\n Dictionary d = new Dictionary();\n List> temp = new List>();\n d.Add(1,true);\n KeyValuePair ns;\n while (d.Count != n)\n {\n foreach(var current in d)\n { \n for (int i = 1; i < n + 1; i++)\n {\n if (!d.ContainsKey(i) && G[current.Key, i] != 0)\n {\n temp.Add(new KeyValuePair(i,G[current.Key,i]));\n }\n }\n }\n temp.Sort();\n }\n } \n}*/\n\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class NetworkXOneTimePad\n{\n public static void Main()\n {\n string str = Console.ReadLine();\n string[] values = str.Split(' ');\n int a = int.Parse(values[0]);\n int b = int.Parse(values[1]);\n str = Console.ReadLine();\n int x=0,y=0;\n List> lst = new List>();\n lst.Add(new KeyValuePair(0,0));\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'R')\n {\n x++;\n }\n else if (str[i] == 'L')\n {\n x--;\n }\n else if (str[i] == 'U')\n {\n y++;\n }\n else\n {\n y--;\n }\n lst.Add(new KeyValuePair(x,y));\n }\n int px=x,py=y,ans=0;\n foreach (var kv in lst)\n {\n\n if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py)&& (b-kv.Value)/py>=0)\n {\n ans=1;\n break;\n }\n else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))\n {\n ans=1;\n break;\n }\n else if (px == 0 && py!=0 && (a == kv.Key) && ((b-kv.Value)%py ==0) && (b-kv.Value)/py>=0)\n {\n ans=1;\n break;\n }\n else if (py == 0 && px !=0 && (b == kv.Value) && ((a - kv.Key) % px == 0) &&(a-kv.Key)/px >=0)\n {\n ans=1;\n break;\n }\n }\n if(ans==0)Console.WriteLine(\"No\");\nelse Console.WriteLine(\"Yes\");\n Console.ReadLine();\n } \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskC\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int A = ab[0];\n int B = ab[1];\n\n string moves = instream.ReadLine();\n\n bool[,] field = new bool[201, 201];\n\n int x = 0;\n int y = 0;\n field[100, 100] = true;\n for (int i = 0; i < moves.Length; i++)\n {\n switch (moves[i])\n {\n case 'U': y++; break;\n case 'D': y--; break;\n case 'L': x--; break;\n case 'R': x++; break;\n }\n field[100 + x, 100 + y] = true;\n }\n\n bool ok = false;\n\n if (x == 0 && y == 0)\n {\n if (Math.Abs(ab[0]) <= 100 && Math.Abs(ab[1]) <= 100)\n {\n if (field[ab[0] + 100, ab[1] + 100]) ok = true;\n }\n }\n else\n {\n int initK = 0;\n if (x == 0)\n initK = Math.Max(B / y, 0);\n else if (y == 0)\n initK = Math.Max(A / x, 0);\n else\n {\n initK = Math.Min(Math.Max(A / x, 0), Math.Max(B / y, 0));\n }\n\n int startK = initK;\n int endK = initK;\n\n while ((double)((double)x * startK - A) * (double)((double)x * startK - A) + (double)((double)y * startK - B) * (double)((double)y * startK - B) <= 200 * 200)\n {\n startK--;\n if (startK < 0)\n {\n startK = 0;\n break;\n }\n }\n\n while ((double)((double)x * endK - A) * (double)((double)x * endK - A) + (double)((double)y * endK - B) * (double)((double)y * endK - B) <= 200 * 200)\n {\n endK++;\n }\n\n for (int k = startK; k <= endK; k++)\n {\n long baseX0 = (long)k * x;\n long baseY0 = (long)k * y;\n\n if (A >= baseX0 - 100 && A <= baseX0 + 100 &&\n B >= baseY0 - 100 && B <= baseY0 + 100)\n {\n if (field[A - baseX0 + 100, B - baseY0 + 100])\n {\n ok = true;\n break;\n }\n }\n }\n \n }\n\n if (ok)\n outstream.WriteLine(\"Yes\");\n else\n outstream.WriteLine(\"No\");\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace c_sharp_codeforces\n{\n\tclass Program\n\t{\n\t\tstatic int GetInt()\n\t\t{\n\t\t\tstring s;\n\t\t\tGetStr(out s);\n\t\t\treturn Convert.ToInt32(s);\n\t\t}\n\t\tstatic void GetStr(out string s)\n\t\t{\n\t\t\ts = \"\";\n\t\t\tchar c;\n\t\t\twhile (Char.IsWhiteSpace(c = (char) Console.Read ())) {}\n\t\t\ts += c;\n\t\t\twhile (!Char.IsWhiteSpace(c = (char)Console.Read()))\n\t\t\t{\n\t\t\t\ts += c;\n\t\t\t}\n\t\t}\n\t\tstruct Point\n\t\t{\n\t\t\tpublic int x;\n\t\t\tpublic int y;\n\t\t};\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPoint current, dest;\n\t\t\tcurrent.x = current.y = 0;\n\t\t\tdest.x = GetInt();\n\t\t\tdest.y = GetInt();\n\t\t\tArrayList pa = new ArrayList();\n\t\t\tstring prog;\n\t\t\tGetStr(out prog);\n\t\t\tforeach (char c in prog)\n\t\t\t{\n\t\t\t\tpa.Add(current);\n\t\t\t\tif (c == 'U')\n\t\t\t\t{\n\t\t\t\t\t++current.y;\n\t\t\t\t}\n\t\t\t\telse if (c == 'D')\n\t\t\t\t{\n\t\t\t\t\t--current.y;\n\t\t\t\t}\n\t\t\t\telse if (c == 'R')\n\t\t\t\t{\n\t\t\t\t\t++current.x;\n\t\t\t\t}\n\t\t\t\telse if (c == 'L')\n\t\t\t\t{\n\t\t\t\t\t--current.x;\n\t\t\t\t}\n\t\t\t}\n\t\t\tPoint final = current;\n\t\t\tif (final.x != 0) {\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tcurrent.x = dest.x - p.x;\n\t\t\t\t\tcurrent.y = dest.y - p.y;\n\t\t\t\t\tif (Math.Abs (current.x) % Math.Abs (final.x) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (current.x / final.x >= 0 && final.y * (current.x / final.x) == current.y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t} else if (final.y != 0)\n\t\t\t{\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tcurrent.x = dest.x - p.x;\n\t\t\t\t\tcurrent.y = dest.y - p.y;\n\t\t\t\t\tif (Math.Abs(current.y) % Math.Abs(final.y) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (current.y / final.y >= 0 && final.x * (current.y / final.y) == current.x)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t} else\n\t\t\t{\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tif (dest.x == p.x && dest.y == p.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var a = NextInt();\n var b = NextInt();\n var s = Console.ReadLine();\n int n = s.Length;\n //int x = 0;\n //int y = 0;\n int[,] p = new int[n + 1, 2];\n p[0, 0] = 0;\n p[0, 1] = 0;\n int[] dx = new[] { 1, -1, 0, 0 };\n int[] dy = new[] { 0, 0, 1, -1 };\n int ind = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'R')\n {\n ind = 0;\n }\n else if (s[i] == 'L')\n {\n ind = 1;\n }\n else if (s[i] == 'U')\n {\n ind = 2;\n }\n else if (s[i] == 'D')\n {\n ind = 3;\n }\n p[i + 1, 0] = p[i, 0] + dx[ind];\n p[i + 1, 1] = p[i, 1] + dy[ind];\n }\n var difx = p[n, 0];\n var dify = p[n, 1];\n bool res = false;\n int k1, k2;\n int rk1, rk2;\n for (int i = 0; i <= n && !res; i++)\n {\n if (difx != 0)\n {\n k1 = (a - p[i, 0]) / difx;\n rk1 = (a - p[i, 0]) % difx;\n }\n else\n {\n k1 = 0;\n rk1 = a == p[i, 0] ? 0 : -1;\n }\n if (dify != 0)\n {\n k2 = (b - p[i, 1]) / dify;\n rk2 = (b - p[i, 1]) % dify;\n }\n else\n {\n k2 = 0;\n rk2 = b == p[i, 1] ? 0 : -1;\n }\n if (difx == 0 && p[i, 0] == a)\n {\n k1 = k2;\n }\n if (dify == 0 && p[i, 1] == b)\n {\n k2 = k1;\n }\n if (k1 == k2 && rk1 == 0 && rk2 == 0 && k1 >= 0 && k2 >= 0)\n {\n res = true;\n }\n } \n\n Console.WriteLine(res ? \"Yes\" : \"No\");\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CielAndRobot\n{\n class CielAndRobot\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int a, b, x, y, listLength, mulX, mulY, divX, divY, remX, remY;\n string s = Console.ReadLine();\n bool flag = false;\n\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n x = 0;\n y = 0;\n\n List> points = new List>();\n points.Add(Tuple.Create(x, y));\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'U')\n y++;\n else if (s[i] == 'D')\n y--;\n else if (s[i] == 'L')\n x--;\n else\n x++;\n\n points.Add(Tuple.Create(x, y));\n }\n\n listLength = points.Count;\n\n mulX = points[listLength - 1].Item1;\n mulY = points[listLength - 1].Item2;\n\n for (int i = 0; i < listLength; i++)\n {\n x = a - points[i].Item1;\n y = b - points[i].Item2;\n\n if ((mulX == 0 && x != 0) || (mulY == 0 && y != 0))\n continue;\n\n if (mulX == 0 && x == 0)\n {\n divX = 0;\n remX = 0;\n }\n else\n {\n divX = x / mulX;\n remX = x % mulX;\n }\n\n if (mulY == 0 && y == 0)\n {\n divY = 0;\n remY = 0;\n }\n else\n {\n divY = y / mulY;\n remY = y % mulY;\n }\n\n if ((points[i].Item1 == a && points[i].Item2 == b) || (remX == 0 && remY == 0 && divX >= 0 && divY >= 0 && (mulX == 0 || mulY == 0 || divX == divY)))\n {\n flag = true;\n break;\n }\n }\n\n if (flag)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long();\n var b = sc.Long();\n var s = sc.Scan();\n var n = s.Length;\n\n var dx = new int[n + 1];\n var dy = new int[n + 1];\n int x = 0, y = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U')\n y++;\n else if (s[i] == 'D')\n y--;\n else if (s[i] == 'L')\n x--;\n else x++;\n dx[i + 1] = x;\n dy[i + 1] = y;\n }\n var ok = false;\n for (int i = 0; i <= n; i++)\n {\n var du = a - dx[i];\n var dv = b - dy[i];\n if (du == 0 && dv == 0)\n ok = true;\n if (x == 0 && y == 0)\n continue;\n else if (x == 0) ok |= du == 0 && dv % y == 0 && dv / y >= 0;\n else if (y == 0) ok |= dv == 0 && du % x == 0 && du / x >= 0;\n else ok |= du % x == 0 && dv % y == 0 && du / x == dv / y && du / x >= 0;\n\n }\n if (ok)\n IO.Printer.Out.WriteLine(\"Yes\");\n else IO.Printer.Out.WriteLine(\"No\");\n\n }\n\n\n\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace ConsoleApplication27\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int a = int.Parse(line[0]);\n int b = int.Parse(line[1]);\n string s = Console.ReadLine();\n\n int x = 0, y = 0;\n\n List xs = new List();\n List ys = new List();\n xs.Add(0); ys.Add(0);\n\n foreach (var c in s)\n {\n switch (c)\n {\n case 'U':\n xs.Add(x); ys.Add(++y);\n break;\n case 'D':\n xs.Add(x); ys.Add(--y);\n break;\n case 'R':\n xs.Add(++x); ys.Add(y);\n break;\n case 'L':\n xs.Add(--x); ys.Add(y);\n break;\n }\n }\n\n int dx = x, dy = y;\n\n int n = xs.Count;\n for (int i = 0; i < n; i++)\n {\n if (xs[i] == a && ys[i] == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n if (dx != 0)\n {\n int k = (a - xs[i]) / dx;\n if (k >= 0 && a == xs[i] + k * dx && b == ys[i] + k * dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (dy != 0)\n {\n int k = (b - ys[i]) / dy;\n if (k >= 0 && a == xs[i] + k * dx && b == ys[i] + k * dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"No\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var j = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n long a = j.ElementAt(0);\n long b = j.ElementAt(1);\n string pr = Console.ReadLine();\n long x = 0;\n long y = 0;\n var dd = new Dictionary> { };\n dd['U']= new Tuple (0,1);\n dd['D']= new Tuple (0,-1);\n dd['R']= new Tuple (1,0);\n dd['L']= new Tuple (-1,0);\n pr = String.Concat(Enumerable.Repeat(pr,1000));\n for (int i = 0; i < pr.Length; ++i)\n {\n if ((x == a) && (y == b))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n x+=dd[pr[i]].Item1;\n y+=dd[pr[i]].Item2;\n if ((x==a)&&(y==b)) {\n Console.WriteLine(\"Yes\");\n return;\n }\n } \n if ((x!=0)||(y!=0)) { \n if (x*a>0) {\n long t=a/x-3; \n x*=t;\n y*=t;\n } else \n if (y*b>0) {\n long t=b/y-3;\n x*=t;\n y*=t;\n }\n } \n pr = String.Concat(Enumerable.Repeat(pr,10));\n for (int i = 0; i < pr.Length; ++i)\n {\n if ((x == a) && (y == b))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n x+=dd[pr[i]].Item1;\n y+=dd[pr[i]].Item2;\n if ((x==a)&&(y==b)) {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c321_190_1\n{\n\tpublic class Program1\n\t{\n\t\tprivate static bool[,] f;\n\t\tconst int offset = 150;\n\n\t\tpublic static bool IsInField (int x , int y)\n\t\t{\n\t\t\treturn f[x + offset, y + offset];\n\t\t}\n\n\t\tstatic void SetInField(int x , int y)\n\t\t{\n\t\t\tf[x + offset, y + offset] = true;\n\t\t}\n\n public static void Main()\n {\n checked\n {\n\t var str1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\t var x = str1[0];\n\t var y = str1[1];\n\n\t var moves = Console.ReadLine();\n\n\t var size = 2*offset + 1;\n\t f = new bool[size,size];\n\t SetInField(0, 0);\n\t var dx = 0;\n\t var dy = 0;\n\n\t\t\t\tforeach (var c in moves)\n\t\t\t\t{\n\t\t\t\t\tswitch (c)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'U':\n\t\t\t\t\t\t\tdy++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tdy--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tdx++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'L':\n\t\t\t\t\t\t\tdx--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSetInField(dx, dy);\n\t\t\t\t}\n\n\t\t\t\tif (x < -100 || x > 100)\n\t\t\t\t{\n\t\t\t\t\tif (x < -100 && dx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (x > 100 && dx <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar needToGoByX = x < 0 ? (-x - 100 - dx - 1) / -dx : (x - 100 + dx - 1) / dx;\n\n\t\t\t\t\tx -= needToGoByX * dx;\n\t\t\t\t\ty -= needToGoByX * dy;\n\t\t\t\t}\n\n\t\t\t\tif ((y < -100 || y > 100) && dx == 0)\n\t\t\t\t{\n\t\t\t\t\tif (y < -100 && dy >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (y > 100 && dy <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t\tvar needToGo = y < 0 ? (-y - 100 - dy - 1) / -dy : (y - 100 + dy - 1) / dy;\n\n\t\t\t\t\tx -= needToGo * dx;\n\t\t\t\t\ty -= needToGo * dy;\n\t\t\t\t}\n\n\n\t for (int i = 0; i < 1000; i++)\n\t {\n\t\t if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField((int)x,(int) y))\n\t\t {\n\t\t\t Console.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t }\n\t\t x -= dx;\n\t\t y -= dy;\n\t }\n\t\t\t\tConsole.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c321_190_1\n{\n\tpublic class Program1\n\t{\n\t\tprivate static bool[,] f;\n\t\tconst int offset = 150;\n\n\t\tpublic static bool IsInField (int x , int y)\n\t\t{\n\t\t\treturn f[x + offset, y + offset];\n\t\t}\n\n\t\tstatic void SetInField(int x , int y)\n\t\t{\n\t\t\tf[x + offset, y + offset] = true;\n\t\t}\n\n public static void Main()\n {\n checked\n {\n\t var str1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\t var x = str1[0];\n\t var y = str1[1];\n\n\t var moves = Console.ReadLine();\n\n\t var size = 2*offset + 1;\n\t f = new bool[size,size];\n\t SetInField(0, 0);\n\t var dx = 0;\n\t var dy = 0;\n\n\t\t\t\tforeach (var c in moves)\n\t\t\t\t{\n\t\t\t\t\tswitch (c)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'U':\n\t\t\t\t\t\t\tdy++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tdy--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tdx++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'L':\n\t\t\t\t\t\t\tdx--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSetInField(dx, dy);\n\t\t\t\t}\n\n\t\t\t\tif (x < -100 || x > 100)\n\t\t\t\t{\n\t\t\t\t\tif (x < -100 && dx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (x > 100 && dx <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar needToGoByX = x < 0 ? (-x - 100 - dx - 1) / -dx : (x - 100 + dx - 1) / dx;\n\n\t\t\t\t\tx -= needToGoByX * dx;\n\t\t\t\t\ty -= needToGoByX * dy;\n\t\t\t\t}\n\n\t\t\t\tif ((y < -100 || y > 100) && dx == 0)\n\t\t\t\t{\n\t\t\t\t\tif (y < -100 && dy >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (y > 100 && dy <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t\tvar needToGo = y < 0 ? (-y - 100 - dy - 1) / -dy : (y - 100 + dy - 1) / dy;\n\n\t\t\t\t\tx -= needToGo * dx;\n\t\t\t\t\ty -= needToGo * dy;\n\t\t\t\t}\n\n\n\t for (int i = 0; i < 1000; i++)\n\t {\n\t\t if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField((int)x,(int) y))\n\t\t {\n\t\t\t Console.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t }\n\t\t x -= dx;\n\t\t y -= dy;\n\t }\n\t\t\t\tConsole.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return dy != 0 && pdy % dy == 0 && pdy / dy > 0;\n\n if (dx != 0 && pdx % dx == 0 && pdx / dx > 0)\n {\n return pdy == 0 && dy == 0 || dy != 0 && pdy % dy == 0 && pdy / dy > 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n //var inStream = File.OpenText(\"Test.txt\");\n //Console.SetIn(inStream);\n\n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n Console.WriteLine(\"No\");\n //inStream.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R190_Div2_C\n {\n static int offset = 100;\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n\n string s = Console.ReadLine();\n\n int[,] xy = new int[offset*2+1, offset*2+1];\n\n int n = s.Length;\n int dy = 0, dx = 0;\n xy[dx+offset, dy+offset] = 1;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U') dy++;\n else if (s[i] == 'D') dy--;\n else if (s[i] == 'L') dx--;\n else if (s[i] == 'R') dx++;\n xy[dx + offset, dy + offset] = 1;\n if (a == dx && b == dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n for (int i = 0; i <= offset * 2; i++)\n for (int j = 0; j <= offset * 2; j++)\n if (xy[i,j] == 1)\n {\n if (IsReachable( i-offset, j-offset, a, b, dx, dy))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n } \n\n Console.WriteLine(\"No\"); \n }\n\n static private bool IsReachable(int i, int j, int a, int b, int dx, int dy)\n {\n int k = 0;\n if (dx != 0) k = (a - i) / dx;\n else if (dy != 0) k = (b - j) / dy;\n if (k < 0) k = 0;\n\n return (a == i + k * dx && b == j + k * dy);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n struct vec\n {\n public int x, y;\n public vec(int x, int y) { this.x = x; this.y = y; }\n public static vec operator +(vec a, vec b) { return new vec(a.x + b.x, a.y + b.y); }\n public static vec operator -(vec a, vec b) { return new vec(a.x - b.x, a.y - b.y); }\n public static bool operator ==(vec a, vec b) { return a.x == b.x && a.y == b.y; }\n public static bool operator !=(vec a, vec b) { return a.x != b.x || a.y != b.y; }\n public static vec FromConsole()\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' });\n return new vec(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]));\n }\n }\n\n class Program\n {\n static bool IsReachable(vec target, string operate)\n {\n vec[] path = new vec[operate.Length + 1];\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n switch (operate[i])\n {\n case 'U': path[i + 1] = path[i] + new vec(0, 1); break;\n case 'D': path[i + 1] = path[i] + new vec(0, -1); break;\n case 'L': path[i + 1] = path[i] + new vec(-1, 0); break;\n case 'R': path[i + 1] = path[i] + new vec(1, 0); break;\n }\n if (path[i + 1] == target)\n return true;\n }\n \n vec mod = path[operate.Length];\n if (mod.x != 0 || mod.y != 0)\n {\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n vec diff = target - path[i];\n if (mod.x == 0 && mod.y != 0)\n {\n if (diff.x == 0 && diff.y % mod.y == 0 && diff.y / mod.y >= 0)\n return true;\n }\n else if (mod.x != 0 && mod.y == 0)\n {\n if (diff.x % mod.x == 0 && diff.y == 0 && diff.x / mod.x >= 0)\n return true;\n }\n else\n {\n if (diff.x % mod.x == 0 && diff.y % mod.y == 0 && diff.x / mod.x == diff.y / mod.y && diff.x / mod.x >= 0)\n return true;\n }\n }\n }\n return false;\n }\n\n static void Main(string[] args)\n {\n vec target = vec.FromConsole();\n string operate = Console.ReadLine();\n Console.WriteLine(IsReachable(target, operate) ? \"Yes\" : \"No\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c321_190_1\n{\n\tpublic class Program1\n\t{\n\t\tprivate static bool[,] f;\n\t\tconst int offset = 150;\n\n\t\tpublic static bool IsInField (int x , int y)\n\t\t{\n\t\t\treturn f[x + offset, y + offset];\n\t\t}\n\n\t\tstatic void SetInField(int x , int y)\n\t\t{\n\t\t\tf[x + offset, y + offset] = true;\n\t\t}\n\n public static void Main()\n {\n checked\n {\n\t var str1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n\t var x = str1[0];\n\t var y = str1[1];\n\n\t var moves = Console.ReadLine();\n\n\t var size = 2*offset + 1;\n\t f = new bool[size,size];\n\t SetInField(0, 0);\n\t var dx = 0;\n\t var dy = 0;\n\n\t\t\t\tforeach (var c in moves)\n\t\t\t\t{\n\t\t\t\t\tswitch (c)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'U':\n\t\t\t\t\t\t\tdy++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tdy--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tdx++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'L':\n\t\t\t\t\t\t\tdx--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSetInField(dx, dy);\n\t\t\t\t}\n\n\t\t\t\tif (x < -100 || x > 100)\n\t\t\t\t{\n\t\t\t\t\tif (x < -100 && dx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (x > 100 && dx <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar needToGoByX = x < 0 ? (-x - 100 + dx - 1) / dx : (x - 100 + dx - 1) / dx;\n\n\t\t\t\t\tx -= needToGoByX * dx;\n\t\t\t\t\ty -= needToGoByX * dy;\n\t\t\t\t}\n\n\t\t\t\tif ((y < -100 || y > 100) && dx == 0)\n\t\t\t\t{\n\t\t\t\t\tvar needToGo = y < 0 ? (-y - 100 + dy - 1) / dy : (y - 100 + dy - 1) / dy;\n\n\t\t\t\t\tx -= needToGo * dx;\n\t\t\t\t\ty -= needToGo * dy;\n\t\t\t\t}\n\n\n\t for (int i = 0; i < 1000; i++)\n\t {\n\t\t if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField((int)x,(int) y))\n\t\t {\n\t\t\t Console.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t }\n\t\t x -= dx;\n\t\t y -= dy;\n\t }\n\t\t\t\tConsole.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c321_190_1\n{\n\tpublic class Program1\n\t{\n\t\tprivate static bool[,] f;\n\t\tconst int offset = 150;\n\n\t\tpublic static bool IsInField (int x , int y)\n\t\t{\n\t\t\treturn f[x + offset, y + offset];\n\t\t}\n\n\t\tstatic void SetInField(int x , int y)\n\t\t{\n\t\t\tf[x + offset, y + offset] = true;\n\t\t}\n\n public static void Main()\n {\n checked\n {\n\t var str1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t var x = str1[0];\n\t var y = str1[1];\n\n\t var moves = Console.ReadLine();\n\n\t var size = 2*offset + 1;\n\t f = new bool[size,size];\n\t SetInField(0, 0);\n\t var dx = 0;\n\t var dy = 0;\n\n\t\t\t\tforeach (var c in moves)\n\t\t\t\t{\n\t\t\t\t\tswitch (c)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'U':\n\t\t\t\t\t\t\tdy++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tdy--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tdx++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'L':\n\t\t\t\t\t\t\tdx--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSetInField(dx, dy);\n\t\t\t\t}\n\n\t\t\t\tif (x < -100 || x > 100)\n\t\t\t\t{\n\t\t\t\t\tif (x < -100 && dx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (x > 100 && dx <= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar needToGoByX = x < 0 ? (-x - 100 + dx - 1) / dx : (x - 100 + dx - 1) / dx;\n\n\t\t\t\t\tx -= needToGoByX * dx;\n\t\t\t\t\ty -= needToGoByX * dy;\n\t\t\t\t}\n\n\t\t\t\tif ((y < -100 || y > 100) && dx == 0)\n\t\t\t\t{\n\t\t\t\t\tvar needToGo = y < 0 ? (-y - 100 + dy - 1) / dy : (y - 100 + dy - 1) / dy;\n\n\t\t\t\t\tx -= needToGo * dx;\n\t\t\t\t\ty -= needToGo * dy;\n\t\t\t\t}\n\n\n\t for (int i = 0; i < 1000; i++)\n\t {\n\t\t if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField(x, y))\n\t\t {\n\t\t\t Console.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t }\n\t\t x -= dx;\n\t\t y -= dy;\n\t }\n\t\t\t\tConsole.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces.Solutions.c321_190_1\n{\n\tpublic class Program1\n\t{\n\t\tprivate static bool[,] f;\n\t\tconst int offset = 150;\n\n\t\tpublic static bool IsInField (int x , int y)\n\t\t{\n\t\t\treturn f[x + offset, y + offset];\n\t\t}\n\n\t\tstatic void SetInField(int x , int y)\n\t\t{\n\t\t\tf[x + offset, y + offset] = true;\n\t\t}\n\n public static void Main()\n {\n checked\n {\n\t var str1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t var x = str1[0];\n\t var y = str1[1];\n\n\t var moves = Console.ReadLine();\n\n\t var size = 2*offset + 1;\n\t f = new bool[size,size];\n\t SetInField(0, 0);\n\t var dx = 0;\n\t var dy = 0;\n\n\t\t\t\tforeach (var c in moves)\n\t\t\t\t{\n\t\t\t\t\tswitch (c)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase 'U':\n\t\t\t\t\t\t\tdy++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tdy--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tdx++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'L':\n\t\t\t\t\t\t\tdx--;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSetInField(dx, dy);\n\t\t\t\t}\n\n\t\t\t\tif (x < -100 || x > 100)\n\t\t\t\t{\n\t\t\t\t\tif (x < -100 && dx >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (x > 100)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar needToGoByX = x < 0 ? (-x - 100 + dx - 1) / dx : (x - 100 + dx - 1) / dx;\n\n\t\t\t\t\tx -= needToGoByX * dx;\n\t\t\t\t\ty -= needToGoByX * dy;\n\t\t\t\t}\n\n\t\t\t\tif ((y < -100 || y > 100) && dx == 0)\n\t\t\t\t{\n\t\t\t\t\tvar needToGo = y < 0 ? (-y - 100 + dy - 1) / dy : (y - 100 + dy - 1) / dy;\n\n\t\t\t\t\tx -= needToGo * dx;\n\t\t\t\t\ty -= needToGo * dy;\n\t\t\t\t}\n\n\n\t for (int i = 0; i < 1000; i++)\n\t {\n\t\t if (Math.Abs(x) <= 100 && Math.Abs(y) <= 100 && IsInField(x, y))\n\t\t {\n\t\t\t Console.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t }\n\t\t x -= dx;\n\t\t y -= dy;\n\t }\n\t\t\t\tConsole.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n struct vec\n {\n public int x, y;\n public vec(int x, int y) { this.x = x; this.y = y; }\n public static vec operator +(vec a, vec b) { return new vec(a.x + b.x, a.y + b.y); }\n public static vec operator -(vec a, vec b) { return new vec(a.x - b.x, a.y - b.y); }\n public static bool operator ==(vec a, vec b) { return a.x == b.x && a.y == b.y; }\n public static bool operator !=(vec a, vec b) { return a.x != b.x || a.y != b.y; }\n public static vec FromConsole()\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' });\n return new vec(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]));\n }\n }\n\n class Program\n {\n static bool IsReachable(vec target, string operate)\n {\n vec[] path = new vec[operate.Length + 1];\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n switch (operate[i])\n {\n case 'U': path[i + 1] = path[i] + new vec(0, 1); break;\n case 'D': path[i + 1] = path[i] + new vec(0, -1); break;\n case 'L': path[i + 1] = path[i] + new vec(-1, 0); break;\n case 'R': path[i + 1] = path[i] + new vec(1, 0); break;\n }\n if (path[i + 1] == target)\n return true;\n }\n \n vec mod = path[operate.Length];\n if (mod.x != 0 || mod.y != 0)\n {\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n vec diff = target - path[i];\n if (mod.x == 0 && mod.y != 0)\n {\n if (diff.x == 0 && diff.y % mod.y == 0)\n return true;\n }\n else if (mod.x != 0 && mod.y == 0)\n {\n if (diff.x % mod.x == 0 && diff.y == 0)\n return true;\n }\n else\n {\n if (diff.x % mod.x == 0 && diff.y % mod.y == 0 && diff.x / mod.x == diff.y / mod.y)\n return true;\n }\n }\n }\n return false;\n }\n\n static void Main(string[] args)\n {\n vec target = vec.FromConsole();\n string operate = Console.ReadLine();\n Console.WriteLine(IsReachable(target, operate) ? \"Yes\" : \"No\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A\n{\n struct vec\n {\n public int x, y;\n public vec(int x, int y) { this.x = x; this.y = y; }\n public static vec operator +(vec a, vec b) { return new vec(a.x + b.x, a.y + b.y); }\n public static vec operator -(vec a, vec b) { return new vec(a.x - b.x, a.y - b.y); }\n public static bool operator ==(vec a, vec b) { return a.x == b.x && a.y == b.y; }\n public static bool operator !=(vec a, vec b) { return a.x != b.x || a.y != b.y; }\n public static vec FromConsole()\n {\n string[] s = Console.ReadLine().Split(new char[] { ' ' });\n return new vec(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]));\n }\n }\n\n class Program\n {\n static bool IsReachable(vec target, string operate)\n {\n vec[] path = new vec[operate.Length + 1];\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n switch (operate[i])\n {\n case 'U': path[i + 1] = path[i] + new vec(0, 1); break;\n case 'D': path[i + 1] = path[i] + new vec(0, -1); break;\n case 'L': path[i + 1] = path[i] + new vec(-1, 0); break;\n case 'R': path[i + 1] = path[i] + new vec(1, 0); break;\n }\n if (path[i + 1] == target)\n return true;\n }\n \n vec mod = path[operate.Length];\n if (mod.x != 0 || mod.y != 0)\n {\n for (int i = 0, n = operate.Length; i < n; ++i)\n {\n vec diff = target - path[i];\n if (mod.x == 0 && mod.y != 0)\n {\n if (diff.x == 0 && diff.y % mod.y == 0)\n return true;\n }\n else if (mod.x != 0 && mod.y == 0)\n {\n if (diff.x % mod.x == 0 && diff.y == 0)\n return true;\n }\n else\n {\n if (diff.x % mod.x == 0 && diff.y % mod.y == 0 && diff.x / mod.x == diff.y / mod.y && diff.x / mod.x >= 0)\n return true;\n }\n }\n }\n return false;\n }\n\n static void Main(string[] args)\n {\n vec target = vec.FromConsole();\n string operate = Console.ReadLine();\n Console.WriteLine(IsReachable(target, operate) ? \"Yes\" : \"No\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R190_Div2_C\n {\n //static int offset = 100;\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n\n string s = Console.ReadLine();\n\n //int[,] xy = new int[offset*2+1, offset*2+1];\n\n int n = s.Length;\n int dy = 0, dx = 0;\n //xy[dx+offset, dy+offset] = 1;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U') dy++;\n else if (s[i] == 'D') dy--;\n else if (s[i] == 'L') dx--;\n else if (s[i] == 'R') dx++;\n //xy[dx + offset, dy + offset] = 1;\n if (a == dx && b == dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n int x = 0, y = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U') y++;\n else if (s[i] == 'D') y--;\n else if (s[i] == 'L') x--;\n else if (s[i] == 'R') x++;\n if (IsReachable(x, y, a, b, dx, dy))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n //for (int i = 0; i <= offset * 2; i++)\n // for (int j = 0; j <= offset * 2; j++)\n // if (xy[i,j] == 1)\n // {\n // if (IsReachable( i-offset, j-offset, a, b, dx, dy))\n // {\n // Console.WriteLine(\"Yes\");\n // return;\n // }\n // } \n\n Console.WriteLine(\"No\"); \n }\n\n static private bool IsReachable(int i, int j, int a, int b, int dx, int dy)\n {\n int k = 0;\n if (dx != 0) k = (a - i) / dx;\n else if (dy != 0) k = (b - j) / dy;\n if (k < 0) k = 0;\n\n return (a == i + k * dx && b == j + k * dy);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic sealed class Program {\n\n static Char[] mp = { 'U', 'R', 'D', 'L' };\n\n static Int32[,] dir = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };\n\n // -1 - No\n // 0 - Check steps\n // 1 - Yes\n static Int32 Check(Int32 x, Int32 dx, ref Int32 steps) {\n if (Math.Sign(x) != Math.Sign(dx)) {\n return -1;\n }\n if (dx == 0) {\n return x == 0 ? 1 : -1;\n }\n steps = Math.Abs(x) / Math.Abs(dx);\n return 0;\n }\n\n static Boolean Solve() {\n String[] token = Console.ReadLine().Split();\n Int32 x = Int32.Parse(token[0]), y = Int32.Parse(token[1]), dx = 0, dy = 0, i, t;\n if (x == 0 && y == 0) {\n return true;\n }\n String s = Console.ReadLine();\n foreach (Char ch in s) {\n i = Array.IndexOf(mp, ch);\n dx += dir[i, 0];\n dy += dir[i, 1];\n }\n Int32 one, two, spix = 0, spiy = 0;\n for (t = 0; t < s.Length; ) {\n one = Check(x, dx, ref spix);\n two = Check(y, dy, ref spiy);\n if (one > 0 && two >= 0 || one >= 0 && two > 0 || one == 0 && two == 0 && spix == spiy) {\n return true;\n }\n i = Array.IndexOf(mp, s[s.Length - ++t]);\n x += dir[i, 0];\n y += dir[i, 1];\n }\n return false;\n }\n\n public Program() {\n Console.WriteLine(Solve() ? \"Yes\" : \"No\");\n }\n\n // stuff cutline\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n new Program();\n Console.Out.Flush();\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 4; testN++)\n {\n#endif\n //SetCulture();\n var a = NextInt();\n var b = NextInt();\n var s = Console.ReadLine();\n int n = s.Length;\n //int x = 0;\n //int y = 0;\n int[,] p = new int[n + 1, 2];\n p[0, 0] = 0;\n p[0, 1] = 0;\n int[] dx = new[] { 1, -1, 0, 0 };\n int[] dy = new[] { 0, 0, 1, -1 };\n int ind = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'R')\n {\n ind = 0;\n }\n else if (s[i] == 'L')\n {\n ind = 1;\n }\n else if (s[i] == 'U')\n {\n ind = 2;\n }\n else if (s[i] == 'D')\n {\n ind = 3;\n }\n p[i + 1, 0] = p[i, 0] + dx[ind];\n p[i + 1, 1] = p[i, 1] + dy[ind];\n }\n var difx = p[n, 0];\n var dify = p[n, 1];\n bool res = false;\n int k1, k2;\n int rk1, rk2;\n for (int i = 0; i <= n && !res; i++)\n {\n if (difx != 0)\n {\n k1 = (a - p[i, 0]) / difx;\n rk1 = (a - p[i, 0]) % difx;\n }\n else\n {\n k1 = 0;\n rk1 = a == p[i, 0] ? 0 : -1;\n }\n if (dify != 0)\n {\n k2 = (b - p[i, 1]) / dify;\n rk2 = (b - p[i, 1]) % dify;\n }\n else\n {\n k2 = 0;\n rk2 = b == p[i, 1] ? 0 : -1;\n }\n if (difx == 0 && p[i, 0] == a)\n {\n k1 = k2;\n }\n if (dify == 0 && p[i, 1] == b)\n {\n k2 = k1;\n }\n if (k1 == k2 && rk1 == 0 && rk2 == 0 && k1 >= 0 && k2 >= 0)\n {\n res = true;\n }\n } \n\n Console.WriteLine(res ? \"YES\" : \"NO\");\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long();\n var b = sc.Long();\n var s = sc.Scan();\n var n = s.Length;\n\n var dx = new int[n + 1];\n var dy = new int[n + 1];\n int x = 0, y = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U')\n y++;\n else if (s[i] == 'D')\n y--;\n else if (s[i] == 'L')\n x--;\n else x++;\n dx[i + 1] = x;\n dy[i + 1] = y;\n }\n var ok = false;\n for (int i = 0; i <= n; i++)\n {\n var du = a - dx[i];\n var dv = b - dy[i];\n if (du == 0 && dv == 0)\n ok = true;\n if (x == 0 && y == 0)\n continue;\n else if (x == 0) ok |= dv % y == 0 && dv / y >= 0;\n else if (y == 0) ok |= du % x == 0 && du / x >= 0;\n else ok |= du % x == 0 && dv % y == 0 && du / x == dv / y && du / x >= 0;\n }\n if (ok)\n IO.Printer.Out.WriteLine(\"Yes\");\n else IO.Printer.Out.WriteLine(\"No\");\n\n }\n\n\n\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long();\n var b = sc.Long();\n var s = sc.Scan();\n var n = s.Length;\n\n var dx = new int[n + 1];\n var dy = new int[n + 1];\n int x = 0, y = 0;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == 'U')\n y++;\n else if (s[i] == 'D')\n y--;\n else if (s[i] == 'L')\n x--;\n else x++;\n dx[i + 1] = x;\n dy[i + 1] = y;\n }\n var ok = false;\n for (int i = 0; i <= n; i++)\n {\n var du = a - dx[i];\n var dv = b - dy[i];\n if (du == 0 && dv == 0)\n ok = true;\n if (x == 0 && y == 0)\n continue;\n else if (x == 0) ok |= dv % y == 0;\n else if (y == 0) ok |= du % x == 0;\n else ok |= du % x == 0 && dv % y == 0 && du / x == dv / y;\n }\n if (ok)\n IO.Printer.Out.WriteLine(\"Yes\");\n else IO.Printer.Out.WriteLine(\"No\");\n\n }\n\n\n\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace ConsoleApplication27\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n int a = int.Parse(line[0]);\n int b = int.Parse(line[1]);\n string s = Console.ReadLine();\n\n int x = 0, y = 0;\n\n List xs = new List();\n List ys = new List();\n xs.Add(0); ys.Add(0);\n\n foreach (var c in s)\n {\n switch (c)\n {\n case 'U':\n xs.Add(x); ys.Add(++y);\n break;\n case 'D':\n xs.Add(x); ys.Add(--y);\n break;\n case 'R':\n xs.Add(++x); ys.Add(y);\n break;\n case 'L':\n xs.Add(--x); ys.Add(y);\n break;\n }\n }\n\n int dx = x, dy = y;\n\n int n = xs.Count;\n for (int i = 0; i < n; i++)\n {\n if (xs[i] == a && ys[i] == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n if (dx != 0)\n {\n int k = (a - xs[i]) / dx;\n if (a == xs[i] + k * dx && b == ys[i] + k * dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (dy != 0)\n {\n int k = (b - ys[i]) / dy;\n if (a == xs[i] + k * dx && b == ys[i] + k * dy)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"No\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0 && pdy / dy > 0;\n\n if (dx > 0 && pdx % dx == 0)\n {\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0 && pdy / dy > 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n { \n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0;\n\n if (dx > 0 && pdx % dx == 0)\n {\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n { \n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return dy != 0 && pdy % dy == 0 && pdy / dy > 0;\n\n if (dx != 0 && pdx % dx == 0)\n {\n return pdy == 0 && dy == 0 || dy != 0 && pdy % dy == 0 && pdy / dy > 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n Console.WriteLine(\"No\"); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Robot\n{ \n internal class Point\n {\n public long X { get; set; }\n public long Y { get; set; }\n\n public Point(long x, long y)\n {\n X = x;\n Y = y;\n }\n }\n\n class Robot\n {\n private static bool Check(Point p1, Point p2, long dx, long dy)\n {\n long pdx = p2.X - p1.X;\n long pdy = p2.Y - p1.Y;\n\n if (p1.X == p2.X && p1.Y == p2.Y) return true;\n\n if (pdx == 0 && dx == 0)\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0;\n\n if (dx > 0 && pdx % dx == 0)\n {\n return pdy == 0 && dy == 0 || dy > 0 && pdy % dy == 0 && (pdy / dy == pdx / dx);\n }\n\n return false;\n }\n\n static void Main(string[] args)\n { \n string[] abs = Console.ReadLine().Split(' ');\n var ab = new Point(long.Parse(abs[0]), long.Parse(abs[1])); \n\n string s = Console.ReadLine(); \n var p = new List() {new Point(0, 0)};\n long dx = 0, dy = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'U':\n ++dy;\n break;\n case 'D':\n --dy;\n break;\n case 'R':\n ++dx;\n break;\n case 'L':\n --dx;\n break;\n }\n\n p.Add(new Point(dx, dy));\n }\n\n if (p.Any(point => Check(point, ab, dx, dy)))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n Console.WriteLine(\"No\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Read(ref int a, ref int b, ref string cmd)\n {\n string in_s = Console.ReadLine();\n string[] pama = in_s.Split(' ');\n a = Convert.ToInt32(pama[0]);\n b = Convert.ToInt32(pama[1]);\n cmd = Console.ReadLine();\n }\n static bool check(int dx, int cur_x, int aim_x)\n {\n aim_x -= cur_x;\n if (dx == 0)\n {\n return aim_x == 0;\n }\n else\n {\n return aim_x % dx == 0 && aim_x / dx >= 0;\n }\n }\n static void Main(string[] args)\n {\n int a, b;\n string cmd;\n a = b = 0;\n cmd = \"\";\n Read(ref a,ref b,ref cmd);\n int dx, dy;\n dx = dy = 0;\n for (int i = 0; i < cmd.Length; i++)\n {\n Console.Write(cmd[i]);\n switch (cmd[i])\n {\n case 'D': dy--; break;\n case 'U': dy++; break;\n case 'L': dx--; break;\n case 'R': dx++; break;\n }\n }\n int px, py;\n bool flag;\n px = py = 0;\n flag = false;\n Console.WriteLine(\"{0} {1}\", dx, dy);\n for (int i = 0; i < cmd.Length; i++)\n {\n Console.WriteLine(\"{0}, {1}\", px, py);\n if(check(dx,px,a) && check(dy,py,b))\n {\n flag = true;\n break;\n }\n switch (cmd[i])\n {\n case 'D': py--; break;\n case 'U': py++; break;\n case 'L': px--; break;\n case 'R': px++; break;\n }\n \n }\n if(flag)Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n\n\n\n\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Read(ref int a, ref int b, ref string cmd)\n {\n string in_s = Console.ReadLine();\n string[] pama = in_s.Split(' ');\n a = Convert.ToInt32(pama[0]);\n b = Convert.ToInt32(pama[1]);\n cmd = Console.ReadLine();\n }\n static bool check(int dx, int cur_x, int aim_x)\n {\n aim_x -= cur_x;\n if (dx == 0)\n {\n return aim_x == 0;\n }\n else\n {\n return aim_x % dx == 0 && aim_x / dx >= 0;\n }\n }\n static void Main(string[] args)\n {\n int a, b;\n string cmd;\n a = b = 0;\n cmd = \"\";\n Read(ref a,ref b,ref cmd);\n int dx, dy;\n dx = dy = 0;\n for (int i = 0; i < cmd.Length; i++)\n {\n Console.Write(cmd[i]);\n switch (cmd[i])\n {\n case 'D': dy--; break;\n case 'U': dy++; break;\n case 'L': dx--; break;\n case 'R': dx++; break;\n }\n }\n int px, py;\n bool flag;\n px = py = 0;\n flag = false;\n // Console.WriteLine(\"{0} {1}\", dx, dy);\n for (int i = 0; i < cmd.Length; i++)\n {\n//Console.WriteLine(\"{0}, {1}\", px, py);\n if(check(dx,px,a) && check(dy,py,b))\n {\n flag = true;\n break;\n }\n switch (cmd[i])\n {\n case 'D': py--; break;\n case 'U': py++; break;\n case 'L': px--; break;\n case 'R': px++; break;\n }\n \n }\n if(flag)Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n\n\n\n\n\n\n//while (true) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ACM\n{\n class Program\n {\n static void Read(ref int a, ref int b, ref string cmd)\n {\n string in_s = Console.ReadLine();\n string[] pama = in_s.Split(' ');\n a = Convert.ToInt32(pama[0]);\n b = Convert.ToInt32(pama[1]);\n cmd = Console.ReadLine();\n }\n static bool check(int dx, int cur_x, int aim_x)\n {\n aim_x -= cur_x;\n if (dx == 0)\n {\n return aim_x == 0;\n }\n else\n {\n return aim_x % dx == 0 && aim_x / dx >= 0;\n }\n }\n static void Main(string[] args)\n {\n int a, b;\n string cmd;\n a = b = 0;\n cmd = \"\";\n Read(ref a,ref b,ref cmd);\n int dx, dy;\n dx = dy = 0;\n for (int i = 0; i < cmd.Length; i++)\n {\n // Console.Write(cmd[i]);\n switch (cmd[i])\n {\n case 'D': dy--; break;\n case 'U': dy++; break;\n case 'L': dx--; break;\n case 'R': dx++; break;\n }\n }\n int px, py;\n bool flag;\n px = py = 0;\n flag = false;\n // Console.WriteLine(\"{0} {1}\", dx, dy);\n for (int i = 0; i < cmd.Length; i++)\n {\n//Console.WriteLine(\"{0}, {1}\", px, py);\n if(check(dx,px,a) && check(dy,py,b))\n {\n flag = true;\n break;\n }\n switch (cmd[i])\n {\n case 'D': py--; break;\n case 'U': py++; break;\n case 'L': px--; break;\n case 'R': px++; break;\n }\n \n }\n if(flag)Console.WriteLine(\"Yes\");\n else Console.WriteLine(\"No\");\n\n\n\n\n\n\n\n\n//while (true) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string str = Console.ReadLine();\n var data = str.Split(new char[] { ' ' });\n\n int a = int.Parse(data[0]);\n int b = int.Parse(data[1]);\n\n str = Console.ReadLine();\n\n int x = 0, y = 0;\n\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'U') y += 1;\n if (str[i] == 'D') y -= 1;\n if (str[i] == 'L') x -= 1;\n if (str[i] == 'R') x += 1;\n\n if (x == a && y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n int xe = x, ye = y;\n x = y = 0;\n\n if (xe == 0 && ye == 0)\n {\n Console.WriteLine(\"No\");\n return;\n }\n\n for (int i = 0; i < str.Length; i++)\n {\n if (xe != 0 && (a - x) % xe == 0)\n {\n int step = (a - x) / xe;\n\n if (ye * step + y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (ye != 0 && (b - y) % ye == 0)\n {\n int step = (b - y) / ye;\n\n if (xe * step + x == a)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n\n if (str[i] == 'U') y += 1;\n if (str[i] == 'D') y -= 1;\n if (str[i] == 'L') x -= 1;\n if (str[i] == 'R') x += 1;\n\n if (xe != 0 && (a - x) % xe == 0)\n {\n int step = (a - x) / xe;\n\n if (ye * step + y == b)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n else if (ye != 0 && (b - y) % ye == 0)\n {\n int step = (b - y) / ye;\n\n if (xe * step + x == a)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"No\");\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n int n, m;\n string[] tokens = ReadArray(' ');\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n Console.WriteLine(m + n - 1);\n for (int i = 1; i <= m; i++)\n Console.WriteLine(1 + \" \" + i);\n for (int i = 2; i <= n; i++)\n Console.WriteLine(i + \" \" + 1);\n }\n\n static void B()\n {\n long r, g, b;\n string[] tokens = ReadArray(' ');\n r = long.Parse(tokens[0]);\n g = long.Parse(tokens[1]);\n b = long.Parse(tokens[2]);\n Console.WriteLine((r + g + b) / 3l);\n }\n\n static void C()\n {\n int left, right, up, down;\n left = right = up = down = 0;\n int a, b;\n string[] tokens = ReadArray(' ');\n a = int.Parse(tokens[0]);\n b = int.Parse(tokens[1]);\n string s = ReadLine();\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) up++;\n if (s[i].Equals('D')) down++;\n if (s[i].Equals('L')) left++;\n if (s[i].Equals('R')) right++;\n }\n int _left, _right, _up, _down;\n _left = _right = _up = _down = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) _up++;\n if (s[i].Equals('D')) _down++;\n if (s[i].Equals('L')) _left++;\n if (s[i].Equals('R')) _right++;\n int _a = a + _left;\n _a -= _right;\n int _b = b - _up;\n _b += _down;\n if (_a == 0 && _b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else\n {\n int x = 0;\n if (right - left != 0)\n x = _a / (right - left);\n if (up - down != 0)\n x = _b / (up - down);\n\n if ((_a - x * (right - left)) == 0 && (_b - x * (up - down) == 0))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n \n }\n }\n Console.WriteLine(\"No\");\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class NetworkXOneTimePad\n{\n public static void Main()\n {\n string str = Console.ReadLine();\n string[] values = str.Split(' ');\n int a = int.Parse(values[0]);\n int b = int.Parse(values[1]);\n str = Console.ReadLine();\n int x=0,y=0;\n List> lst = new List>();\n lst.Add(new KeyValuePair(0,0));\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'R')\n {\n x++;\n }\n else if (str[i] == 'L')\n {\n x--;\n }\n else if (str[i] == 'U')\n {\n y++;\n }\n else\n {\n y--;\n }\n lst.Add(new KeyValuePair(x,y));\n }\n int px=x,py=y;\n foreach (var kv in lst)\n {\n\n if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py))\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0))\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0))\n {\n Console.WriteLine(\"YES\");\n break;\n }\n }\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n } \n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class NetworkXOneTimePad\n{\n public static void Main()\n {\n string str = Console.ReadLine();\n string[] values = str.Split(' ');\n int a = int.Parse(values[0]);\n int b = int.Parse(values[1]);\n str = Console.ReadLine();\n int x=0,y=0;\n List> lst = new List>();\n lst.Add(new KeyValuePair(0,0));\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'R')\n {\n x++;\n }\n else if (str[i] == 'L')\n {\n x--;\n }\n else if (str[i] == 'U')\n {\n y++;\n }\n else\n {\n y--;\n }\n lst.Add(new KeyValuePair(x,y));\n }\n int px=x,py=y,ans=0;\n foreach (var kv in lst)\n {\n\n if(px!=0 && py!=0 && ((a-kv.Key)%px ==0) && ((b-kv.Value)%py==0) &&((a-kv.Key)/px ==(b-kv.Value)/py))\n {\n ans=1;\n break;\n }\n else if (px == 0 && py == 0 && (a == kv.Key) && (b == kv.Value))\n {\n ans=1;\n break;\n }\n else if (px == 0 && (a == kv.Key) && ((b-kv.Value)%py ==0))\n {\n ans=1;\n break;\n }\n else if (py == 0 && (b == kv.Value) && ((a - kv.Key) % px == 0))\n {\n ans=1;\n break;\n }\n }\n if(ans==0)Console.WriteLine(\"No\");\nelse Console.WriteLine(\"Yes\");\n Console.ReadLine();\n } \n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace c_sharp_codeforces\n{\n\tclass Program\n\t{\n\t\tstatic int GetInt()\n\t\t{\n\t\t\tstring s;\n\t\t\tGetStr(out s);\n\t\t\treturn Convert.ToInt32(s);\n\t\t}\n\t\tstatic void GetStr(out string s)\n\t\t{\n\t\t\tchar c;\n\t\t\twhile (Char.IsWhiteSpace(c = (char) Console.Read ())) {}\n\t\t\ts = \"\" + c;\n\t\t\twhile (!Char.IsWhiteSpace(c = (char)Console.Read()))\n\t\t\t{\n\t\t\t\ts += c;\n\t\t\t}\n\t\t}\n\t\tstruct Point\n\t\t{\n\t\t\tpublic int x;\n\t\t\tpublic int y;\n\t\t};\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPoint current, dest;\n\t\t\tcurrent.x = current.y = 0;\n\t\t\tdest.x = GetInt();\n\t\t\tdest.y = GetInt();\n\t\t\tArrayList pa = new ArrayList();\n\t\t\tstring prog;\n\t\t\tGetStr(out prog);\n\t\t\tforeach (char c in prog)\n\t\t\t{\n\t\t\t\tpa.Add(current);\n\t\t\t\tif (c == 'U')\n\t\t\t\t{\n\t\t\t\t\t++current.y;\n\t\t\t\t}\n\t\t\t\telse if (c == 'D')\n\t\t\t\t{\n\t\t\t\t\t--current.y;\n\t\t\t\t}\n\t\t\t\telse if (c == 'R')\n\t\t\t\t{\n\t\t\t\t\t++current.x;\n\t\t\t\t}\n\t\t\t\telse if (c == 'L')\n\t\t\t\t{\n\t\t\t\t\t--current.x;\n\t\t\t\t}\n\t\t\t}\n\t\t\tPoint final = current;\n\t\t\tif (final.x != 0) {\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tcurrent.x = dest.x - p.x;\n\t\t\t\t\tcurrent.y = dest.y - p.y;\n\t\t\t\t\tif (Math.Abs (current.x) % Math.Abs (final.x) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (final.y * (current.x / final.x) == current.y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t} else if (final.y != 0)\n\t\t\t{\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tcurrent.x = dest.x - p.x;\n\t\t\t\t\tcurrent.y = dest.y - p.y;\n\t\t\t\t\tif (Math.Abs(current.y) % Math.Abs(final.y) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (final.x * (current.y / final.y) == current.x)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t} else\n\t\t\t{\n\t\t\t\tforeach (Point p in pa)\n\t\t\t\t{\n\t\t\t\t\tif (dest.x == p.x && dest.y == p.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}\n"}], "src_uid": "5d6212e28c7942e9ff4d096938b782bf"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\n//using Debug;\n//using static System.Globalization.CultureInfo;\n//using Edge = Pair;\nusing System.Text;\nclass Program\n{\n static void Main(string[] args)\n {\n Solve();\n //WriteLine(Solve());\n }\n static void Solve()\n {\n var rgb = Input.arL;\n Array.Sort(rgb);\n var sum = rgb.Sum() / 3;\n if (rgb[2] >= 2 * (rgb[0] + rgb[1]))\n WriteLine(rgb[0] + rgb[1]);\n else WriteLine(sum);\n }\n}\n\npublic class Input\n{\n public static string read => ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static char[][] gred(int h) \n => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();\n public static int[] ar1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => num).ToArray();\n public static long[] arL1D(int n)\n => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();\n public static string[] strs(int n)\n => Enumerable.Repeat(0, n).Select(_ => read).ToArray();\n public static int[][] ar2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();\n public static long[][] arL2D(int n)\n => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();\n public static T getValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadTemplate\n{\n public class Solver\n {\n public static void Solve()\n {\n long ans = 0;\n var a = ReadLongArray();\n Array.Sort(a);\n while (a[1] > 0 && a.Sum() >= 3)\n {\n long d = a[2] - a[1];\n if (d > 1)\n {\n long b = a[1] - a[0];\n long c = Math.Min(d / 2, b);\n ans += c;\n a[2] -= 2 * c;\n a[1] -= c;\n\n if (a[0] == a[1])\n {\n d = a[2] - a[1];\n if (d > 1)\n {\n c = Math.Min(d / 2, 2 * a[0]);\n ans += c;\n a[0] -= c / 2;\n a[1] -= (c + 1) / 2;\n a[2] -= 2 * c;\n }\n Array.Sort(a);\n }\n }\n else\n {\n ans += a.Sum() / 3;\n break;\n }\n }\n Console.WriteLine(ans);\n }\n\n public static void Main()\n {\n Reader = Console.In; Writer = Console.Out;\n //Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static long[] a;\n\n static void solve()\n {\n a = Array.ConvertAll(Console.ReadLine().Split(), ts => long.Parse(ts));\n Array.Sort(a);\n if (a[0] + a[1] < a[2]/2)\n {\n Console.Write(a[0] + a[1]);\n } else\n {\n Console.Write((a[0] + a[1] + a[2]) / 3);\n }\n }\n\n static void Main( string[ ] args ) {\n //Console.SetIn(new StreamReader(\"in.txt\"));\n\n solve( );\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic int First;\n\n\t\t\tpublic int Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List> Graph = new List>();\n\n\t\tpublic static bool Dfs(int x, int y, int prevx, int prevy)\n\t\t{\n\t\t\tGraph[x][y].Was = 1;\n\t\t\tvar result = false;\n\t\t\tforeach (var t in Graph[x][y].Edges)\n\t\t\t{\n\t\t\t\tif (Graph[t.First][t.Second].Was == 0)\n\t\t\t\t\tresult |= Dfs(t.First, t.Second, x, y);\n\t\t\t\telse if (t.First != prevx || t.Second != prevy)\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tl.Sort();\n\t\t\tl[2] = Math.Min(l[2], 2 * (l[0] + l[1]));\n\t\t\tConsole.WriteLine(l.Sum() / 3);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static long max(long a, long b, long c)\n {\n if (a > b && a > c)\n return a;\n if (b > c)\n return b;\n return c;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long a=0, b=0, c=0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n a = long.Parse(s.Substring(0, i));\n s = s.Substring(i + 1);\n break;\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n b = long.Parse(s.Substring(0, i));\n c = long.Parse(s.Substring(i + 1));\n break;\n }\n }\n long t=0;\n long max1 = max(a, b, c);\n long temp = max1 / 2;\n if (max1 % 2 == 1)\n {\n if (a + b + c - max1 >= temp + 2)\n {\n temp = (a + b + c) / 3;\n Console.Write(temp);\n }\n else\n {\n if (a + b + c - max1 < temp + 1)\n {\n temp = a + b + c - max1;\n Console.Write(temp);\n }\n else\n {\n temp = a + b + c - max1;\n temp--;\n Console.Write(temp);\n }\n }\n }\n else\n {\n if (a + b + c - max1 >= temp)\n {\n temp = (a + b + c) / 3;\n Console.Write(temp);\n }\n else\n {\n temp = a + b + c - max1;\n Console.Write(temp);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic long caseType = -1;\n\t\tstatic long maxNum = -1;\n\t\tstatic long secondMaxNum = -1;\n\t\tstatic long minNum = -1;\n\t\tstatic long sameNumber = -1;\n\t\tstatic long diffNumber = -1;\n\t\tstatic long answer = 0;\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = long.Parse(numbers[0]);\n\t\t\tvar g = long.Parse(numbers[1]);\n\t\t\tvar b = long.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\n\t\t}\n\n\t\tstatic void Casehandler(long r, long g, long b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tif (minNum != 0)\n\t\t\t\t{\n\t\t\t\t\tlong x = (maxNum - secondMaxNum + (2 * minNum))/4;\n\t\t\t\t\tvar y = minNum - x;\n\t\t\t\t\tif (y < 0) {\n\t\t\t\t\t\tx = minNum; y = 0;\n\t\t\t\t\t}\n\t\t\t\t\tlong z = 0;\n\t\t\t\t\tif (y > x) {\n\t\t\t\t\t\tz = y;\n\t\t\t\t\t\ty = x;\n\t\t\t\t\t\tx = z;\n\t\t\t\t\t}\n\t\t\t\t\tanswer += minNum;\n\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - (2 * y);\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar x = maxNum - secondMaxNum;\n\t\t\t\t\tif (x > secondMaxNum) {\n\t\t\t\t\t\tx = secondMaxNum;\n\t\t\t\t\t}\n\t\t\t\t\tanswer += x;\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - x;\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber == 2) {\n\t\t\t\t\tanswer += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\n\t\t\t\tif (x > sameNumber) {\n\t\t\t\t\tx = sameNumber;\n\t\t\t\t}\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(long r, long g, long b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 2)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1 || sameNumber - diffNumber == 2) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n//using Microsoft.CSharp;\n\nusing System.Numerics;\n\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n BigInteger gr = BigInteger.Parse(tokens[0]);\n\n BigInteger bl = BigInteger.Parse(tokens[1]);\n\n BigInteger re = BigInteger.Parse(tokens[2]);\n \n\n \n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n \n\n BigInteger sum = 0;\n sum=(re + bl+gr );\n\n //Console.WriteLine(\" here el sum \" + sum);\n BigInteger temp = (sum / 3);\n\n //\n // Console.WriteLine(\" here el temmp \" + temp);\n // get the max\n BigInteger max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n\n BigInteger temp1 = (sum -max );\n if (temp < temp1)\n Console.WriteLine( temp);\n else\n Console.WriteLine(temp1);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nnamespace Solver\n{\n\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long(3).OrderBy(x => x).ToArray();\n var sum = a.Sum();\n if ((a[0] + a[1]) * 2 < a[2])\n IO.Printer.Out.PrintLine(a[0] + a[1]);\n else\n IO.Printer.Out.PrintLine(sum / 3);\n }\n internal IO.StreamScanner sc;\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n System.Diagnostics.Debug.AutoFlush = false;\n var sw = new Watch();\n sw.Start();\n try\n {\n#endif\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n System.Diagnostics.Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer\n {\n static Printer()\n {\n Out = new Printer(Console.Out);\n }\n public static Printer Out { get; set; }\n private readonly System.IO.TextWriter writer;\n private readonly System.Globalization.CultureInfo info;\n public string Separator { get; set; }\n public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? \"\\n\"; } }\n public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)\n {\n writer = tw ?? System.IO.TextWriter.Null;\n info = ci ?? System.Globalization.CultureInfo.InvariantCulture;\n NewLine = newLine;\n Separator = separator ?? \" \";\n }\n public void Print(int num) { writer.Write(num.ToString(info)); }\n public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(long num) { writer.Write(num.ToString(info)); }\n public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(double num) { writer.Write(num.ToString(\"F12\", info)); }\n public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(string str) { writer.Write(str); }\n public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }\n public void Print(string format, IEnumerable sources) { writer.Write(format, sources.OfType().ToArray()); }\n public void Print(IEnumerable sources) { writer.Write(sources.AsString()); }\n public void Print(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n public void PrintLine() { writer.WriteLine(); }\n public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(double num) { writer.WriteLine(num.ToString(\"F12\", info)); }\n public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(string str) { writer.WriteLine(str); }\n public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }\n public void PrintLine(string format, IEnumerable sources) { writer.WriteLine(format, sources.OfType().ToArray()); }\n public void PrintLine(IEnumerable sources)\n {\n var res = new StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n public void Flush() { writer.Flush(); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream)\n {\n iStream = stream;\n }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool EndOfStream { get { return eof; } }\n private byte readByte()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n private bool inSpan(byte c)\n {\n const byte lb = 33, ub = 126;\n return !(c >= lb && c <= ub);\n }\n private byte skip()\n {\n byte b = 0;\n do b = readByte();\n while (!eof && inSpan(b));\n return b;\n }\n public char Char()\n {\n return (char)skip();\n }\n public char[] Char(int n)\n {\n var a = new char[n];\n for (int i = 0; i < n; i++)\n a[i] = (char)skip();\n return a;\n }\n public char[][] Char(int n, int m)\n {\n var a = new char[n][];\n for (int i = 0; i < n; i++)\n a[i] = Char(m);\n return a;\n }\n public string Scan()\n {\n\n const byte lb = 33, ub = 126;\n if (eof) throw new System.IO.EndOfStreamException();\n\n do\n {\n while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))\n {\n ptr++;\n }\n if (ptr < len)\n break;\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return null;\n }\n continue;\n } while (true);\n\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] < lb || ub < buf[i])\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n ptr = i + 1;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public string[] Scan(int n)\n {\n var a = new string[n];\n for (int i = 0; i < n; i++)\n a[i] = Scan();\n return a;\n }\n public string ScanLine()\n {\n const byte el = 10, cr = 13;\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] == cr || buf[i] == el)\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n if (buf[i] == cr) i++;\n if (buf[i] == el) i++;\n ptr = i;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public double Double()\n {\n return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);\n }\n public double[] Double(int n)\n {\n var a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = Double();\n return a;\n }\n public int Integer()\n {\n var ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n\n if (b == mynus)\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n {\n ret = ret * 10 + b - zero;\n }\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public int[] Integer(int n)\n {\n var a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = Integer();\n return a;\n }\n public long Long()\n {\n long ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n if (b == '-')\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n ret = ret * 10 + (b - zero);\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public long[] Long(int n)\n {\n var a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = Long();\n return a;\n }\n public void Flush()\n {\n iStream.Flush();\n }\n\n }\n\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public string AsJoinedString(this IEnumerable source, string separator = \" \")\n {\n return string.Join(separator, source);\n }\n static public T[] Enumerate(this int n, Func selector)\n {\n var res = new T[n];\n for (int i = 0; i < n; i++)\n res[i] = selector(i);\n return res;\n }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_C_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long r = long.Parse(s[0]), g = long.Parse(s[1]), b = long.Parse(s[2]);\n long sum = (r + g + b) / 3;\n sum = Math.Min(sum, r + g);\n sum = Math.Min(sum, r + b);\n sum = Math.Min(sum, g + b);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Table_Decorations\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str_Inputs = Console.ReadLine();\n string[] arr_Inputs = str_Inputs.Split(' ');\n\n long[] arr_ballons = new long[3];\n arr_ballons[0] = Convert.ToInt64(arr_Inputs[0]);\n arr_ballons[1] = Convert.ToInt64(arr_Inputs[1]);\n arr_ballons[2] = Convert.ToInt64(arr_Inputs[2]);\n Array.Sort(arr_ballons);\n\n Console.Write((arr_ballons[0] + arr_ballons[1] <= arr_ballons[2] / 2)?arr_ballons[0]+arr_ballons[1]:(arr_ballons[0]+arr_ballons[1]+arr_ballons[2])/3);\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n class Point\n {\n public double X { get; private set; }\n public double Y { get; private set; }\n public Point(double X, double Y)\n {\n this.X = X;\n this.Y = Y;\n }\n public override bool Equals(object obj)\n {\n if (obj is Point)\n {\n return this.X == ((Point)obj).X && this.Y == ((Point)obj).Y;\n }\n else return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return X.GetHashCode() + Y.GetHashCode();\n }\n }\n public static void Main()\n {\n System.Text.StringBuilder res = new System.Text.StringBuilder();\n var tests = 1;\n //tests = readInt();\n for (int i = 0; i < tests; ++i)\n {\n res.AppendLine(Solve());\n }\n\n System.Console.Out.WriteLine(res);\n }\n\n static string Solve()\n {\n var x = readSplitedInts(' ').ToList();\n\n long res = 0;\n\n x.Sort();\n\n long d1 = x[2] - x[1];\n long d2 = x[1] - x[0];\n\n long d = System.Math.Min(d1, d2);\n\n res += d;\n\n x[2] -= d * 2;\n x[1] -= d;\n\n d1 = x[2] - x[1];\n d2 = x[1] - x[0];\n\n if (x[0] == 0 && x[1] == 0)\n {\n return res.ToString(); \n }\n if (d1 > 0)\n {\n long z = d1 / 3;\n\n z = System.Math.Min(z, x[1]);\n\n res += z * 2;\n \n x[2] -= z * 4;\n x[1] -= z;\n x[0] -= z;\n }\n if (d2 > 0)\n {\n long z = d2 / 3 * 2 + (d2 % 3 == 2 ? 1 : 0);\n\n res += z;\n\n x[2] -= z / 2 + (z % 2 == 1 ? 2 : 0);\n x[1] -= z / 2 + (z % 2 == 1 ? 1 : 0);\n }\n\n res += x.Min();\n\n return res.ToString();\n \n }\n\n static long parseInt(string str)\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n res *= 10;\n switch (str[i])\n {\n case '0':\n res += 0;\n break;\n case '1':\n res += 1;\n break;\n case '2':\n res += 2;\n break;\n case '3':\n res += 3;\n break;\n case '4':\n res += 4;\n break;\n case '5':\n res += 5;\n break;\n case '6':\n res += 6;\n break;\n case '7':\n res += 7;\n break;\n case '8':\n res += 8;\n break;\n case '9':\n res += 9;\n break;\n }\n }\n if (str.StartsWith(\"-\"))\n {\n res *= -1;\n }\n return res;\n }\n static long[] readSplitedInts(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n long[] res = new long[t.Length];\n for (int i = 0; i < t.Length; ++i)\n {\n res[i] = parseInt(t[i]);\n }\n return res;\n }\n static long readInt()\n {\n return parseInt(System.Console.In.ReadLine());\n }\n static string[] readSplited(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n return t;\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long[] vls;\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n vls = new long[3] {long.Parse(input[0]), long.Parse(input[1]), long.Parse(input[2]) };\n }\n Array.Sort(vls);\n Console.WriteLine(vls[2] > (vls[1] + vls[0]) * 2L ? vls[1] + vls[0] : (vls[0] + vls[1] + vls[2])/3L);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _478C\n {\n public static void Main()\n {\n long[] counts = Console.ReadLine().Split().Select(token => long.Parse(token)).ToArray();\n\n long sum = counts.Sum();\n long max = counts.Max();\n\n Console.WriteLine(2 * sum >= 3 * max ? sum / 3 : sum - max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tlong result, tmp;\n\t\t\tlong[] a = new long[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextLong();\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult = 0;\n\t\t\tif (a[2] < 2 * (a[1] + a[0]))\n\t\t\t{\n\t\t\t\tresult += (a[0] + a[1] + a[2]) / 3;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult += a[0] + a[1];\n\t\t\t}\n\n\n\t\t\t//result = a[0];\n\n\t\t\t//a[1] -= a[0];\n\t\t\t//a[2] -= a[0];\n\t\t\t//a[0] -= a[0];\n\n\t\t\t//tmp = Math.Min(a[1], a[2] - a[1]);\n\t\t\t//tmp = Math.Min(tmp, a[2] / 2);\n\t\t\t//result += tmp;\n\n\t\t\t//a[1] -= tmp;\n\t\t\t//a[2] -= 2 * tmp;\n\n\t\t\t//if (a[1] > 0 && a[2] > 0)\n\t\t\t//{\n\t\t\t//\tresult += (a[1] + a[2]) / 3;\n\t\t\t//}\n\t\t\t\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tArray.Sort(A);\n\t\t\n\t\tif((A[0]+A[1])*2<=A[2]){\n\t\t\tConsole.WriteLine((A[0]+A[1]));\n\t\t\treturn;\n\t\t}\n\t\tif(A[1]==0&&A[0]==0){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tlong cnt=0;\n\t\t\n\t\tlong a=A[2]-A[1];\n\t\tlong b=A[1]-A[0];\n\t\tlong c=A[0];\n\t\t\n\t\tcnt=c;\n\t\tif(a>=b){\n\t\t\tcnt+=b;\n\t\t\ta-=b;\n\t\t\tcnt+=Math.Min(a/3,c);\n\t\t\tConsole.WriteLine(cnt);return;\n\t\t}else{\n\t\t\tcnt+=a;\n\t\t\tcnt+=((b-a)/3)*2;\n\t\t\tif((b-a)%3==2)cnt++;\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tlong[] A;\n\tpublic Sol(){\n\t\tA=rla();\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n internal class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n static readonly StreamWriter writer = new StreamWriter(\"output\");\n static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static void Main(string[] args) {\n long[] c = Array.ConvertAll(reader.ReadLine().Split(' '), long.Parse);\n Array.Sort(c);\n long ans = c[2] >= 2 * (c[0] + c[1]) ? c[0] + c[1] : (c[0] + c[1] + c[2]) / 3;\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Table_Decorations\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var list = new List();\n list.Add(Next());\n list.Add(Next());\n list.Add(Next());\n\n list.Sort();\n\n long count = list.Sum()/3;\n if (2*count < list[2])\n {\n count = Math.Min(list[0] + list[1],count);\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n var a = ReadLongArray();\n Array.Sort(a);\n long x = Math.Min(a[2] - a[1], a[0]);\n a[1] += x;\n a[0] -= x;\n\n a[1] += a[0] / 2;\n a[2] += (a[0] + 1) / 2;\n\n return Math.Min(a[1], (a[1] + a[2]) / 3);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n// reader = new StreamReader(\"army.in\");\n// writer = new StreamWriter(\"army.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t var num = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n \n\n Array.Sort(num);\n long mxTable = num.Min() ;\n\n var cp = new long[3];\n num.CopyTo(cp, 0);\n long min = num.Min();\n long sum = num.Sum();\n\n \n \n\n\n num.CopyTo(cp, 0);\n\n if (cp[0] > 0 || cp[1] > 0)\n {\n long tmp = 0;\n\n \n\n\n \n\n while (cp[1] > 0 && cp[2] > 1)\n {\n long red = 0;\n //if(cp[0]>1) //(cp[0]>1 && cp[0]*2 >= cp[1])\n //{\n // red = Math.Min(cp[1], Math.Min( cp[0]/2 , cp[2] / 2));\n\n //}\n //else red = Math.Min(cp[1], cp[2] / 2);\n\n if (cp[1] >= 4) red = cp[1] / 4;\n else red = Math.Min(cp[1],cp[2]/2);\n\n cp[1] -= red;\n cp[2] -= red * 2;\n\n tmp += red;\n Array.Sort(cp);\n }\n\n if (cp[0] == 1 || cp[2]==3) tmp++;\n //if (sum % 2 == 1) tmp++;\n\n mxTable = Math.Max(mxTable, tmp);\n }\n\n\n\n Console.WriteLine(mxTable);\n\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {//\u0648\u0644\u0627 \u064a\u0645\u062d\u0645\u0629 \u064a\u0645\u062d\u0631\u0648\u0633 \u064a\u0644\u0627\n ulong[] input = Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray();\n Array.Sort(input);\n ulong r = input[0];\n ulong g = input[1];\n ulong b = input[2];\n ulong ans = min(min(min((r + g + b) / 3, r + g), r + b), b + g); \n Console.WriteLine(ans);\n\n }\n static ulong min(ulong x, ulong y)\n {\n return x > y ? y : x;\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace _237c\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n \n\n var count = 0L;\n while (true)\n {\n Array.Sort(d);\n var max = d[2];\n var mid = d[1];\n var min = d[0];\n\n if (max > mid && mid > min)\n {\n var can1 = mid - min;\n var can2 = max - mid;\n var can = Math.Min(can1, can2);\n\n d[2] -= can * 2;\n d[1] -= can;\n count += can;\n }\n else if (max == mid && mid > min)\n {\n var diff = max - min;\n var can = diff / 3;\n\n d[2] -= can * 3;\n d[1] -= can * 3;\n count += can * 2;\n\n var rem = diff % 3;\n if (rem == 0)\n {\n continue;\n }\n\n count += min;\n if (rem == 2)\n {\n count += 1;\n }\n\n break;\n }\n else if (max == min)\n {\n count += min;\n break;\n }\n else if (max > mid && min == mid && mid == 0)\n {\n break;\n }\n else if (max > mid && mid == min)\n {\n var diff = max - mid;\n if (diff == 1)\n {\n count += mid;\n break;\n }\n\n if (diff <= 3)\n {\n d[2] -= 2;\n d[1]--;\n count++;\n continue;\n }\n\n var can1 = (max - mid) / 3;\n var can = Math.Min(can1, min);\n\n count += can * 2;\n d[2] -= can * 4;\n d[1] -= can;\n d[0] -= can;\n\n \n }\n }\n\n Console.WriteLine(count);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n\n DateTime time1 = DateTime.Now;\n Array.Sort(aint);\n int k = Func1(aint);\n DateTime time2 = DateTime.Now;\n\n Console.WriteLine(k);\n //Console.WriteLine((time2 - time1).TotalMilliseconds);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (int)(((long)arr[0] + arr[1] + arr[2]) / 3);\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if((long)arr[0] + arr[1] + arr[2] < 3) break;\n\n int tmp = 0;\n if(arr[0] > 0) {\n \n if((arr[2] - arr[1] / 2) >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = (arr[2] - arr[1] / 2) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n } else {\n if((arr[2] - arr[1] / 2) >= arr[1] * 2) {\n tmp = arr[1];\n } else {\n tmp = (arr[2] - arr[1] / 2) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[1] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray();\n long s = b.Sum();\n writer.WriteLine(Math.Min(s / 3, s - b.Max()));\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = (b[2] + b[1] - 2 * b[0]) / 3;\n a = b[0] + Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = Math.Min((b[0] + b[1]) / 3, b[0]);\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n Array.Sort(num);\n long total = num.Sum() / 3 ;\n if(2 * total < num[2]){\n total = Math.Min(num[0] + num[1] , total);\n }\n Console.WriteLine(total);\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tArray.Sort(A);\n\t\t\n\t\tif((A[0]+A[1])*2<=A[2]){\n\t\t\tConsole.WriteLine((A[0]+A[1]));\n\t\t\treturn;\n\t\t}\n\t\tif(A[1]==0&&A[0]==0){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tlong cnt=0;\n\t\t\n\t\tlong a=A[2]-A[1];\n\t\tlong b=A[1]-A[0];\n\t\tlong c=A[0];\n\t\t\n\t\tcnt=c;\n\t\tif(a>=b){\n\t\t\tcnt+=b;\n\t\t\ta-=b;\n\t\t\tcnt+=Math.Min(a/3,c);\n\t\t\tConsole.WriteLine(cnt);return;\n\t\t}else{\n\t\t\tcnt+=a;\n\t\t\tcnt+=(b-a)/3;\n\t\t\tif((b-a)%3==2)cnt++;\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tlong[] A;\n\tpublic Sol(){\n\t\tA=rla();\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tArray.Sort(A);\n\t\t\n\t\tif((A[0]+A[1])*2<=A[2]){\n\t\t\tConsole.WriteLine((A[0]+A[1]));\n\t\t\treturn;\n\t\t}\n\t\tif(A[1]==0&&A[0]==0){\n\t\t\tConsole.WriteLine(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tlong cnt=0;\n\t\t\n\t\tlong a=A[2]-A[1];\n\t\tlong b=A[1]-A[0];\n\t\tlong c=A[0];\n\t\t\n\t\tcnt=c;\n\t\tif(a>b){\n\t\t\tcnt+=b;\n\t\t\ta-=b;\n\t\t\tcnt+=Math.Min(a/3,c);\n\t\t\tConsole.WriteLine(cnt);return;\n\t\t}else{\n\t\t\tcnt+=a;\n\t\t\tcnt+=(b-a)/3;\n\t\t\tif((b-a)%3==2)cnt++;\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tlong[] A;\n\tpublic Sol(){\n\t\tA=rla();\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {//\u0648\u0644\u0627 \u064a\u0645\u062d\u0645\u0629 \u064a\u0645\u062d\u0631\u0648\u0633 \u064a\u0644\u0627\n int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Array.Sort(input);\n int answer = (input[2] > 2 * (input[0] + input[1])) ? input[0] + input[1] : (input[0] + input[1] + input[2]) / 3;\n Console.WriteLine(answer);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {//\u0648\u0644\u0627 \u064a\u0645\u062d\u0645\u0629 \u064a\u0645\u062d\u0631\u0648\u0633 \u064a\u0644\u0627\n int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Array.Sort(input);\n int r = input[0];\n int g = input[1];\n int b = input[2];\n int ans = ans = min(min(min((r + g + b) / 3, r + g), r + b), b + g); ans=min(min(min((r+g+b)/3,r+g),r+b),b+g);\n Console.WriteLine(ans);\n\n }\n static int min(int x, int y)\n {\n return x > y ? y : x;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Array.Sort(input);\n int answer = input[0];\n input = input.Select(x => x - input[0]).ToArray();\n answer += (input[1] + input[2]) / 3;\n Console.WriteLine(answer);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {//\u0648\u0644\u0627 \u064a\u0645\u062d\u0645\u0629 \u064a\u0645\u062d\u0631\u0648\u0633 \u064a\u0644\u0627\n\n double[] input = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();\n Array.Sort(input);\n double answer = (input[0] + input[1] >= input[2]) ? Math.Floor((input[0] + input[1] + input[2]) / 3) : input[1] - input[0];\n Console.WriteLine(answer);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lexco\n{\n class Program\n {\n static void Main(string[] args)\n {//\u0648\u0644\u0627 \u064a\u0645\u062d\u0645\u0629 \u064a\u0645\u062d\u0631\u0648\u0633 \u064a\u0644\u0627\n int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n Array.Sort(input);\n int answer = input[0];\n input = input.Select(x => x - input[0]).ToArray();\n answer += (input[1] < (input[1] + input[2]) / 3) ? input[1] : (input[1] + input[2]) / 3;\n Console.WriteLine(answer);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n \n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n \n int sum = gr + bl + re;\n sum = sum / 3;\n\n if (sum < max)\n Console.WriteLine(sum);\n else\n Console.WriteLine(max);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (min < bl && bl < max)\n av = bl;\n else if (min < re && re < max)\n av = re;\n \n \n \n//Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n// Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl!=min && min < bl && bl < max && max!=bl)\n av = bl;\n else if (re != min && min < re && re < max&& max!=re)\n av = re;\n else if(min <= bl && bl <= max)\n av = bl;\n else if (min <= re && re <= max )\n av = re;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n //Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (min < bl && bl < max && max!=bl)\n av = bl;\n else if (min < re && re < max&& max!=re)\n av = re;\n else if(min < bl && bl <= max)\n av = bl;\n else if (min < re && re <= max )\n av = re;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n\n // get the av\n int av = gr;\n if (min <= bl && bl <= re)\n av = bl;\n else if (min <= re && re <= bl)\n av = re;\n \n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(reminder);\n Console.WriteLine(output);\n\n\n\n //Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n\n // get the av\n int av = gr;\n if (min <= bl && bl >= re)\n av = bl;\n else if (min <= re && re >= bl)\n av = re;\n \n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(reminder);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (min <= bl && bl <= max)\n av = bl;\n else if (min <= re && re <= max)\n av = re;\n \n \n \n//Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n//using Microsoft.CSharp;\n\nusing System.Numerics;\n\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n BigInteger gr = BigInteger.Parse(tokens[0]);\n\n BigInteger bl = BigInteger.Parse(tokens[1]);\n\n BigInteger re = BigInteger.Parse(tokens[2]);\n\n // get the minmum\n\n BigInteger min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n BigInteger max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n BigInteger av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n BigInteger oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n BigInteger sum = 0;\n sum=(min + av );\n sum = (sum+max);\n\n //Console.WriteLine(\" here el sum \" + sum);\n BigInteger temp = (sum / 3);\n\n //Console.WriteLine(\" here el temmp \" + temp);\n // v = map(int, raw_input().split())\n //s = sum(v); print min(s/ 3,s - max(v))\n\n //sum = temp;\n BigInteger temp1 = (sum - max);\n if (temp < temp1)\n Console.WriteLine( temp);\n else\n Console.WriteLine(temp1);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n // Console.WriteLine(\"here in the if \"+newav);\n }\n else if ((max + av) / 3 > av)\n {\n newav = (max + av) / 3; \n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n long sum = 0;\n sum=(min + av );\n sum += max;\n long temp = (sum / 3);\n\n\n sum = temp;\n\n if (sum < max)\n Console.WriteLine(sum);\n else\n Console.WriteLine(sum-max);\n //Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n \n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n\n\n int av = gr;\n if (gr > bl && bl > re)\n av = bl;\n else if (gr > re && re > bl)\n av = re;\n\n\n int max = gr;\n if (gr < bl && bl > re)\n max = bl;\n else if (gr < re && re > bl)\n max = re;\n\n\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0,reminder=0;\n\n if ((max + av) / 3 <= av&& (max + av) / 3>0)\n {\n newav = av;\n reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n if (reminder > 3)\n output++;\n\n Console.WriteLine(output);\n\n\n\n //Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = av; \n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n long sum = 0;\n sum=(min + av );\n sum += max;\n long temp = (sum / 3);\n\n\n sum = temp;\n\n if (sum < max)\n Console.WriteLine(sum);\n else\n Console.WriteLine(max);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n int sum = 0;\n sum=(min + av );\n sum += max;\n int temp = (sum / 3);\n\n\n //sum = temp;\n int temp1 = (sum - max);\n if (temp < temp1)\n Console.WriteLine(temp);\n else\n Console.WriteLine(sum-max);\n //Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tint result, tmp;\n\t\t\tint[] a = new int[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextInt();\n\t\t\t}\n\n\n\t\t\tresult = 0;\n\t\t\tfor (int i = 0; i < 3; ++i)\n\t\t\t{\n\t\t\t\tArray.Sort(a);\n\t\t\t\ttmp = Math.Min(a[2] / 2, a[1]);\n\t\t\t\tresult += tmp;\n\t\t\t\ta[2] -= tmp * 2;\n\t\t\t\ta[1] -= tmp;\n\t\t\t}\n\t\t\tArray.Sort(a);\n\t\t\tresult += a[0];\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tlong result, tmp;\n\t\t\tlong[] a = new long[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextLong();\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult = a[0];\n\n\t\t\ta[1] -= a[0];\n\t\t\ta[2] -= a[0];\n\t\t\ta[0] -= a[0];\n\n\t\t\ttmp = Math.Min(a[1], a[2] - a[1]);\n\t\t\ttmp = Math.Min(tmp, a[2] / 2);\n\t\t\tresult += tmp;\n\n\t\t\ta[1] -= tmp;\n\t\t\ta[2] -= 2 * tmp;\n\n\t\t\tif (a[1] > 0 && a[2] > 0)\n\t\t\t{\n\t\t\t\tresult += (a[1] + a[2]) / 3;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tint result;\n\t\t\tint[] a = new int[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextInt();\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult = a[0];\n\t\t\ta[1] -= a[0];\n\t\t\ta[2] -= a[0];\n\t\t\tresult += Math.Min(a[1], a[2] / 2);\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tint result, tmp;\n\t\t\tint[] a = new int[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextInt();\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult = a[0];\n\t\t\ta[1] -= a[0];\n\t\t\ta[2] -= a[0];\n\n\t\t\ttmp = Math.Min(a[1], a[2] / 2);\n\t\t\tresult += tmp;\n\t\t\ta[1] -= tmp;\n\t\t\ta[2] -= 2 * tmp;\n\n\t\t\ttmp = Math.Min(a[2], a[1] / 2);\n\t\t\tresult += tmp;\n\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tlong result, tmp;\n\t\t\tlong[] a = new long[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextLong();\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult = a[0];\n\n\t\t\ta[1] -= a[0];\n\t\t\ta[2] -= a[0];\n\t\t\ta[0] -= a[0];\n\n\t\t\ttmp = Math.Min(a[1], a[2] - a[1]);\n\t\t\ttmp = Math.Min(tmp, a[1] / 2);\n\t\t\tresult += tmp;\n\n\t\t\ta[1] -= tmp;\n\t\t\ta[2] -= 2 * tmp;\n\n\t\t\tif (a[1] > 0 && a[2] > 0)\n\t\t\t{\n\t\t\t\tresult += (a[1] + a[2]) / 3;\n\t\t\t}\n\t\t\t\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace TestProject\n{\n\tclass Program\n\t{\n\t\t//538A - Cutting banner\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tString test = null;\n#if LOCALTEST\n\t\t\ttest = \"../../test.txt\";\n#endif\n\t\t\tFastReader reader = new FastReader(test);\n\t\t\tint result, tmp;\n\t\t\tint[] a = new int[3];\n\t\t\tfor (int i = 0; i < a.Length; ++i)\n\t\t\t{\n\t\t\t\ta[i] = reader.nextInt();\n\t\t\t}\n\n\n\t\t\tresult = 0;\n\t\t\ttmp = 0;\n\t\t\tbool found = false;\n\t\t\twhile (!found)\n\t\t\t{\n\t\t\t\tArray.Sort(a);\n\t\t\t\ttmp = 0;\n\t\t\t\tif (a[0] + a[1] + a[2] < 3) found = true;\n\t\t\t\tif (a[2] == 1 && a[0] == 1)\n\t\t\t\t{\n\t\t\t\t\tfound = true;\n\t\t\t\t\tresult += 1;\n\t\t\t\t\ta[0] -= 1;\n\t\t\t\t\ta[1] -= 1;\n\t\t\t\t\ta[2] -= 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (a[2] >= 2 && a[1] >= 1)\n\t\t\t\t{\n\t\t\t\t\ttmp = 1;\n\t\t\t\t\ta[2] -= 2;\n\t\t\t\t\ta[1] -= 1;\n\t\t\t\t}\n\t\t\t\tresult += tmp;\n\t\t\t\t\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\t\t\tresult += a[0];\n\t\t\tConsole.Write(result);\n\t\t\t\n#if LOCALTEST\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tclass FastReader\n\t{\n\t\tprivate TextReader reader = null;\n\t\tprivate Queue q = null;\n\n\t\tpublic FastReader(String fileName)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (fileName != null)\n\t\t\t\t{\n\t\t\t\t\treader = new StreamReader(fileName);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treader = System.Console.In;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (FileNotFoundException e)\n\t\t\t{\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\treader = System.Console.In;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\twhile (q == null || q.Count == 0)\n\t\t\t{\t\n\t\t\t\tq = new Queue(reader.ReadLine().Split());\n\t\t\t}\n\t\t\treturn q.Dequeue();\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Int32.Parse(next());\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Int64.Parse(next());\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\treturn Double.Parse(next());\n\t\t}\n\t}\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n internal class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n static readonly StreamWriter writer = new StreamWriter(\"output\");\n static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static void Main(string[] args) {\n int[] c = Array.ConvertAll(reader.ReadLine().Split(' '), int.Parse);\n Array.Sort(c);\n int n = c[0];\n c[0] -= n;\n c[1] -= n;\n c[2] -= n;\n int ans = n;\n int q = Math.Min(c[2] / 2, Math.Min(n, c[1]));\n ans += q;\n c[0] = n - q;\n c[1] -= q;\n c[2] -= 2 * q;\n if(c[0] != 0) {\n ans += Math.Min(c[0], c[2] / 2);\n }\n else if(c[1] > 0 && c[2] > 0) {\n int w = Math.Min(c[1], c[2] / 2);\n c[1] -= w;\n c[2] -= 2 * w;\n Array.Sort(c);\n ans += w;\n ans += Math.Min(c[1], c[2] / 2);\n }\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n long[] a = new long[3];\n a[0] = Next();\n a[1] = Next();\n a[2] = Next();\n Array.Sort(a);\n long b = a[0];\n long g = a[1];\n long r = a[2];\n long t1 = b;\n t1 += Math.Min((r - b) / 2, g - b);\n long t2 = b;\n r = Math.Max(0, r - 2 * b);\n if(r != 0) {\n if(r >= g * 2) {\n t2 += g;\n } else {\n t2 += Math.Max(Math.Min(g, r / 2), Math.Min(r, g / 2));\n }\n }\n writer.WriteLine(Math.Max(t1, t2));\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n long[] a = new long[3];\n a[0] = Next();\n a[1] = Next();\n a[2] = Next();\n Array.Sort(a);\n long b = a[0];\n long g = a[1];\n long r = a[2];\n long t = b;\n g -= t;\n r -= t;\n t += Math.Min(r / 2, g);\n writer.WriteLine(t);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n internal class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n static readonly StreamWriter writer = new StreamWriter(\"output\");\n static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static long TryAll(long r, long g, long b) {\n long ans = TryRGB(r, g, b);\n ans = Math.Max(ans, TryRRG(r, g, b));\n ans = Math.Max(ans, TryRRB(r, g, b));\n ans = Math.Max(ans, TryGGR(r, g, b));\n ans = Math.Max(ans, TryGGB(r, g, b));\n ans = Math.Max(ans, TryBBR(r, g, b));\n ans = Math.Max(ans, TryBBG(r, g, b));\n return ans;\n }\n\n static long TryRGB(long r, long g, long b) {\n long ans = Math.Min(r, Math.Min(g, b));\n r -= ans;\n g -= ans;\n b -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n\n static long TryRRG(long r, long g, long b) {\n long ans = Math.Min(r / 2, g);\n r -= ans * 2;\n g -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n static long TryRRB(long r, long g, long b) {\n long ans = Math.Min(r / 2, b);\n r -= ans * 2;\n b -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n static long TryGGB(long r, long g, long b) {\n long ans = Math.Min(g / 2, b);\n g -= ans * 2;\n b -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n static long TryGGR(long r, long g, long b) {\n long ans = Math.Min(g / 2, r);\n g -= ans * 2;\n r -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n static long TryBBR(long r, long g, long b) {\n long ans = Math.Min(b / 2, r);\n b -= ans * 2;\n r -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n static long TryBBG(long r, long g, long b) {\n long ans = Math.Min(b / 2, g);\n b -= ans * 2;\n g -= ans;\n if(ans != 0)\n ans += TryAll(r, g, b);\n return ans;\n }\n\n static void Main(string[] args) {\n long r = Next();\n long g = Next();\n long b = Next();\n long ans = TryAll(r, g, b);\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq.Expressions;\n\nnamespace prC {\n\n internal class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n static readonly StreamWriter writer = new StreamWriter(\"output\");\n static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static void Main(string[] args) {\n int[] c = Array.ConvertAll(reader.ReadLine().Split(' '), int.Parse);\n Array.Sort(c);\n int ans = c[2] >= 2 * (c[0] + c[1]) ? c[0] + c[1] : (c[0] + c[1] + c[2]) / 3;\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t \n\t\t\tvar num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n //int r = num[0];\n //int g = num[1];\n //int b = num[2];\n\n Array.Sort(num);\n int mxTable = 0;\n var arr = new string[] {\"012\",\"021\",\"120\",\"210\",\"102\",\"201\",\"111\",\"003\",\"030\",\"003\" };\n\n\n var cp = new int[3];\n for(int i =0; i<10; i++)\n {\n int cnt = 0;\n num.CopyTo(cp,0);\n for(int j =i; j<10; j++)\n {\n int a = (arr[j][0]-'0');\n int b = arr[j][1] - '0';\n int c = arr[j][2] - '0';\n\n if(cp[0]>=a && cp[1]>=b && cp[2]>=c)\n {\n cp[0] -= a;\n cp[1] -= b;\n cp[2] -= c;\n cnt++;\n }\n\n }\n mxTable = Math.Max(mxTable, cnt);\n }\n\n\n\n Console.WriteLine(mxTable);\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t var num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\n Array.Sort(num);\n int mxTable = num.Min();\n\n var cp = new List(num);\n int min = num.Min();\n for (int i =0; i<3; i++)\n {\n cp[i] -= min;\n }\n\n \n while(cp[1]>=1 && cp[2]>=2)\n {\n if (cp[1] >= 1 && cp[2] >= 2)\n {\n mxTable++;\n cp[1] -= 1;\n cp[2] -= 2;\n }\n\n \n }\n\n cp = num.ToList();\n\n if (cp[0] * 2 <= cp[2])\n {\n int tmp = cp[0];\n cp[2] -= cp[0] * 2;\n cp[0] = 0;\n\n\n while (cp[1] >= 1 && cp[2] >= 2)\n {\n if (cp[1] >= 1 && cp[2] >= 2)\n {\n tmp++;\n cp[1] -= 1;\n cp[2] -= 2;\n }\n\n if (cp[1] > cp[2])\n {\n cp.Sort();\n }\n }\n mxTable = Math.Max(mxTable,tmp);\n }\n\n\n\n Console.WriteLine(mxTable);\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t var num = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n \n\n Array.Sort(num);\n long mxTable = num.Min() ;\n\n var cp = new long[3];\n num.CopyTo(cp, 0);\n long min = num.Min();\n long sum = num.Sum();\n\n \n \n\n\n num.CopyTo(cp, 0);\n\n if (cp[0] > 0 || cp[1] > 0)\n {\n long tmp = 0;\n\n \n\n\n //while (cp[0]>0 && cp[2] >= cp[0] * 2)\n //{\n // long red = Math.Min(cp[0], Math.Min(cp[2]-cp[1], cp[2] / 2));\n // cp[0] -= red;\n // cp[2] -= red*2;\n\n // tmp += red;\n // Array.Sort(cp);\n //}\n\n while (cp[1] > 0 && cp[2] > 1)\n {\n long red = 0;\n //if(cp[0]>1) //(cp[0]>1 && cp[0]*2 >= cp[1])\n //{\n // red = Math.Min(cp[1], Math.Min( cp[0]/2 , cp[2] / 2));\n\n //}\n //else red = Math.Min(cp[1], cp[2] / 2);\n\n if (cp[1] >= 4) red = cp[1] / 4;\n else red = Math.Min(cp[1],cp[2]/2);\n\n cp[1] -= red;\n cp[2] -= red * 2;\n\n tmp += red;\n Array.Sort(cp);\n }\n\n if (cp[0] == 1) tmp++;\n //if (sum % 2 == 1) tmp++;\n\n mxTable = Math.Max(mxTable, tmp);\n }\n\n\n\n Console.WriteLine(mxTable);\n\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t var num = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n \n\n Array.Sort(num);\n long mxTable = num.Min() ;\n\n var cp = new long[3];\n num.CopyTo(cp, 0);\n long min = num.Min();\n //for(int i =0; i<3; i++)\n //{\n // cp[i] -= (min );\n //}\n\n \n //while (cp[1] >= 1 && cp[2] >= 2)\n //{\n // if (cp[1] >= 1 && cp[2] >= 2)\n // {\n // mxTable++;\n // cp[1] -= 1;\n // cp[2] -= 2;\n // }\n\n // Array.Sort(cp);\n //}\n\n //cp = num.ToList();\n //while(true)\n //{\n // long count = Math.Min(cp[0], cp[1] / 2);\n // cp[0] -= count;\n // cp[1] -= count;\n\n\n //}\n\n\n num.CopyTo(cp,0);\n long cnt = cp[0];\n if(cp[0]*2<=cp[2])\n {\n\n cp[2] -= cp[0] * 2;\n cp[0] = 0;\n\n Array.Sort(cp);\n if (cp[1] >= 1 && cp[2] >= 2)\n {\n long rr = Math.Min(cp[1],cp[2]/2);\n cp[1] -= rr;\n cp[2] -= rr * 2;\n Array.Sort(cp);\n if(cp[1]>=1 && cp[2]>=2)\n {\n rr += Math.Min(cp[1],cp[2]/2); ;\n }\n cnt += rr;\n }\n }\n\n mxTable = Math.Max(mxTable, cnt);\n\n\n //Console.WriteLine(mxTable);\n\n\n //int count = 0;\n //int rest = 0;\n //for(int i=0; i<3; i++)\n //{\n // count += num[i] / 3;\n // rest += num[i] % 3;\n //}\n //count += rest / 3;\n\n //mxTable = Math.Max(mxTable, count);\n\n\n\n\n\n\n\n\n\n //while (cp[1] >= 1 && cp[2] >= 2)\n //{\n // if (cp[1] >= 1 && cp[2] >= 2)\n // {\n // mxTable++;\n // cp[1] -= 1;\n // cp[2] -= 2;\n // }\n\n\n //}\n\n\n\n num.CopyTo(cp, 0);\n\n if (cp[0] > 0 || cp[1] > 0)\n {\n long tmp = 0;\n\n //long a = cp[0] + cp[1];\n //long b = cp[2];\n //while (a >= 1 && b >= 2)\n //{\n // a = cp[0] + cp[1];\n // b = cp[2];\n // long red = Math.Min(a,b/2);\n // cp[0] -= red;\n // cp[1] -= red;\n // cp[2] -= red * 2;\n\n // tmp += red;\n // Array.Sort(cp);\n //}\n\n\n\n\n //while (cp[0]>0 && cp[2] >= cp[0] * 2)\n //{\n // long red = Math.Min(cp[0], Math.Min(cp[2]-cp[1], cp[2] / 2));\n // cp[0] -= red;\n // cp[2] -= red*2;\n\n // tmp += red;\n // Array.Sort(cp);\n //}\n\n while (cp[1] > 0 && cp[2] > 1)\n {\n long red = Math.Min(cp[1], Math.Min((cp[0]>1)?cp[0]/2:1, cp[2] / 2));\n cp[1] -= red;\n cp[2] -= red * 2;\n\n tmp += red;\n Array.Sort(cp);\n }\n\n\n\n\n mxTable = Math.Max(mxTable, tmp);\n }\n\n\n\n Console.WriteLine(mxTable);\n\n\n\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t \n\t\t\t\nvar num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\n Array.Sort(num);\n int mxTable = num.Min() ;\n\n var cp = new List(num);\n int min = num.Min();\n for(int i =0; i<3; i++)\n {\n cp[i] -= (min );\n }\n\n \n while (cp[1] >= 1 && cp[2] >= 2)\n {\n if (cp[1] >= 1 && cp[2] >= 2)\n {\n mxTable++;\n cp[1] -= 1;\n cp[2] -= 2;\n }\n\n cp.Sort();\n }\n\n cp = num.ToList();\n int cnt = cp[0];\n if(cp[0]*2<=cp[2])\n {\n\n cp[2] -= cp[0] * 2;\n cp[0] = 0;\n\n cp.Sort();\n if (cp[1] >= 1 && cp[2] >= 2)\n {\n int rr = Math.Min(cp[1],cp[2]/2);\n cp[1] -= rr;\n cp[2] -= rr * 2;\n cp.Sort();\n if(cp[1]>=1 && cp[2]>=2)\n {\n rr++;\n }\n cnt += rr;\n }\n }\n\n mxTable = Math.Max(mxTable, cnt);\n Console.WriteLine(mxTable);\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t var num = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n \n\n Array.Sort(num);\n long mxTable = num.Min() ;\n\n var cp = new long[3];\n num.CopyTo(cp, 0);\n long min = num.Min();\n \n\n \n \n\n\n num.CopyTo(cp, 0);\n\n if (cp[0] > 0 || cp[1] > 0)\n {\n long tmp = 0;\n\n \n\n\n //while (cp[0]>0 && cp[2] >= cp[0] * 2)\n //{\n // long red = Math.Min(cp[0], Math.Min(cp[2]-cp[1], cp[2] / 2));\n // cp[0] -= red;\n // cp[2] -= red*2;\n\n // tmp += red;\n // Array.Sort(cp);\n //}\n\n while (cp[1] > 0 && cp[2] > 1)\n {\n long red = 0;\n if (cp[0] > 1)\n {\n red = Math.Min(cp[1], Math.Min( cp[1] / 2 , cp[2] / 2));\n }\n else red = Math.Min(cp[1], cp[2] / 2);\n\n cp[1] -= red;\n cp[2] -= red * 2;\n\n tmp += red;\n Array.Sort(cp);\n }\n\n if (cp[0] == 1) tmp++;\n\n\n mxTable = Math.Max(mxTable, tmp);\n }\n\n\n\n Console.WriteLine(mxTable);\n\t\t\t\n\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\n\n\tclass contest\n\t{\n\t\t\t\t\n\t\t\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t \n\t\t\t\nvar num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n\n Array.Sort(num);\n int mxTable = num.Min();\n\n var cp = new List(num);\n\n int count = 0;\n int rest = 0;\n for(int i=0; i<3; i++)\n {\n count += num[i] / 3;\n rest += num[i] % 3;\n }\n count += rest / 3;\n\n mxTable = Math.Max(mxTable, count);\n Console.WriteLine(mxTable);\n\n\n\t\t\n }\n\t\t\n\t\t\n\t\t\t\n\t}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = (b[2] + b[1] - 2 * b[0]) / 3;\n a = b[0] + Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = b[1];\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = (b[2] + b[1] - 2 * b[0]) / 3;\n a = b[0] + Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = b[0];\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var r = ReadLong();\n var g = ReadLong();\n var b = ReadLong();\n var balloon = new[] { r, g, b }.Where(d => d != 0).OrderBy(d => d).ToArray();\n var a = 0L;\n if (balloon.Length == 3)\n {\n a = balloon[0];\n var tmp = balloon[1] - balloon[0];\n var tmp1 = balloon[2] - balloon[0];\n a += Math.Min(tmp, (tmp + tmp1) / 3);\n }\n else if (balloon.Length == 2)\n {\n a = Math.Min(balloon[0], balloon.Sum() / 3);\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = (b[2] + b[1] - 2 * b[0]) / 3;\n a = b[0] + Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = b[0] + b[1] / 3;\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = b[2] - 2 * b[0];\n a = tmp <= 0 ? b[0] : Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = b[0];\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var r = ReadLong();\n var g = ReadLong();\n var b = ReadLong();\n var balloon = new[] { r, g, b }.Where(d => d != 0).OrderByDescending(d => d).ToArray();\n var a = 0L;\n if (balloon.Length == 3)\n {\n a = balloon[2];\n var tmp = balloon[0] - a;\n var tmp1 = balloon[1] - a;\n a += Math.Min(tmp, (tmp + tmp1) / 3);\n }\n else if (balloon.Length == 2)\n {\n a = Math.Min(balloon[1], balloon.Sum() / 3);\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var r = ReadInt();\n var g = ReadInt();\n var b = ReadInt();\n writer.WriteLine(\"{0}\", Math.Min(r, Math.Min(g, b)) + (r + g + b - 3 * Math.Min(r, Math.Min(g, b))) / 3);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var b = ReadLongArray().Where(d => d > 0).OrderBy(d => d).ToArray();\n var len = b.Length;\n long a = 0;\n if (len == 3)\n {\n var tmp = (b[2] + b[1] - 2 * b[0]) / 3;\n a = b[0] + Math.Min(tmp, b[1]);\n }\n else if (len == 2)\n {\n a = (b[0] + b[1]) / 3;\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var r = ReadLong();\n var g = ReadLong();\n var b = ReadLong();\n var balloon = new[] { r, g, b }.Where(d => d != 0).OrderBy(d => d).ToArray();\n var a = 0L;\n if (balloon.Length == 3)\n {\n a = balloon[0] + (balloon.Sum() - 3 * balloon[0]) / 3;\n }\n else if (balloon.Length == 2)\n {\n a = Math.Min(balloon[0], balloon.Sum() / 3);\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var r = ReadLong();\n var g = ReadLong();\n var b = ReadLong();\n var balloon = new[] { r, g, b }.Where(d => d != 0).OrderByDescending(d => d).ToArray();\n var a = 0L;\n if (balloon.Length == 3)\n {\n a = balloon[2];\n var tmp = balloon[0] - a;\n var tmp1 = balloon[1] - a;\n a += Math.Min(tmp, (tmp + tmp1) / 3);\n }\n else if (balloon.Length == 2)\n {\n a = Math.Min(balloon[0], balloon.Sum() / 3);\n }\n else\n {\n a = 0;\n }\n writer.WriteLine(a);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadTemplate\n{\n public class Solver\n {\n public static void Solve()\n {\n long ans = 0;\n var a = ReadLongArray();\n Array.Sort(a);\n while (a[1] > 0 && a.Sum() >= 3)\n {\n long d = a[2] - a[1];\n if (d > 1)\n {\n long b = a[1] - a[0];\n long c = Math.Min(d / 2, b);\n ans += c;\n a[2] -= 2 * c;\n a[1] -= c;\n\n if (a[0] == a[1])\n {\n d = a[2] - a[1];\n if (d > 1)\n {\n c = Math.Min(d / 2, 2 * a[0]);\n ans += c;\n a[0] -= c / 2;\n a[1] -= (c + 1) / 2;\n }\n Array.Sort(a);\n }\n }\n else\n {\n ans += a.Sum() / 3;\n break;\n }\n }\n Console.WriteLine(ans);\n }\n\n public static void Main()\n {\n Reader = Console.In; Writer = Console.Out;\n //Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic long caseType = -1;\n\t\tstatic long maxNum = -1;\n\t\tstatic long secondMaxNum = -1;\n\t\tstatic long minNum = -1;\n\t\tstatic long sameNumber = -1;\n\t\tstatic long diffNumber = -1;\n\t\tstatic long answer = 0;\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = long.Parse(numbers[0]);\n\t\t\tvar g = long.Parse(numbers[1]);\n\t\t\tvar b = long.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\n\t\t}\n\n\t\tstatic void Casehandler(long r, long g, long b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tif (minNum != 0)\n\t\t\t\t{\n\t\t\t\t\tlong x = (maxNum - secondMaxNum + (2 * minNum))/4;\n\t\t\t\t\tvar y = minNum - x;\n\n\t\t\t\t\tlong z = 0;\n\t\t\t\t\tif (y > x) {\n\t\t\t\t\t\tz = y;\n\t\t\t\t\t\ty = x;\n\t\t\t\t\t\tx = z;\n\t\t\t\t\t}\n\t\t\t\t\tanswer += minNum;\n\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - (2 * y);\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar x = maxNum - secondMaxNum;\n\t\t\t\t\tif (x > secondMaxNum) {\n\t\t\t\t\t\tx = secondMaxNum;\n\t\t\t\t\t}\n\t\t\t\t\tanswer += x;\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - x;\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber == 2) {\n\t\t\t\t\tanswer += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\n\t\t\t\tif (x > sameNumber) {\n\t\t\t\t\tx = sameNumber;\n\t\t\t\t}\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(long r, long g, long b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 2)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1 || sameNumber - diffNumber == 2) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic int caseType = -1;\n\t\tstatic int maxNum = -1;\n\t\tstatic int secondMaxNum = -1;\n\t\tstatic int minNum = -1;\n\t\tstatic int sameNumber = -1;\n\t\tstatic int diffNumber = -1;\n\t\tstatic int answer = 0;\t\n\n\tpublic static void Main()\n\t{\n\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = int.Parse(numbers[0]);\n\t\t\tvar g = int.Parse(numbers[1]);\n\t\t\tvar b = int.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\t}\n\t\t\n\tstatic void Casehandler(int r, int g, int b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tvar x = maxNum - secondMaxNum;\n\t\t\t\tif (x > secondMaxNum) {\n\t\t\t\t\tx = secondMaxNum;\n\t\t\t\t}\n\t\t\t\tanswer += x;\n\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\tvar newg = secondMaxNum - x;\n\t\t\t\tvar newb = minNum;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber == 2) {\n\t\t\t\t\tanswer += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\n\t\t\t\tif (x > sameNumber) {\n\t\t\t\t\tx = sameNumber;\n\t\t\t\t}\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(int r, int g, int b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 2)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1 || sameNumber - diffNumber == 2) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic int caseType = -1;\n\t\tstatic int maxNum = -1;\n\t\tstatic int secondMaxNum = -1;\n\t\tstatic int minNum = -1;\n\t\tstatic int sameNumber = -1;\n\t\tstatic int diffNumber = -1;\n\t\tstatic int answer = 0;\t\n\n\tpublic static void Main()\n\t{\n\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = int.Parse(numbers[0]);\n\t\t\tvar g = int.Parse(numbers[1]);\n\t\t\tvar b = int.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\t}\n\t\t\n\tstatic void Casehandler(int r, int g, int b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tvar diffMaxMin = (maxNum - minNum) / 2;\n\t\t\t\tvar diffSecondmaxMin = secondMaxNum - minNum;\n\n\t\t\t\tvar minDiff = Math.Min(diffMaxMin, diffSecondmaxMin);\n\t\t\t\tanswer += minDiff;\n\t\t\t\tvar newr = maxNum - (2 * minDiff);\n\t\t\t\tvar newg = secondMaxNum - minDiff;\n\t\t\t\tvar newb = minNum;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0|| sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(int r, int g, int b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 1)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic long caseType = -1;\n\t\tstatic long maxNum = -1;\n\t\tstatic long secondMaxNum = -1;\n\t\tstatic long minNum = -1;\n\t\tstatic long sameNumber = -1;\n\t\tstatic long diffNumber = -1;\n\t\tstatic long answer = 0;\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = long.Parse(numbers[0]);\n\t\t\tvar g = long.Parse(numbers[1]);\n\t\t\tvar b = long.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\n\t\t}\n\n\t\tstatic void Casehandler(long r, long g, long b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tif (minNum != 0)\n\t\t\t\t{\n\t\t\t\t\tlong x = (maxNum - secondMaxNum + (2 * minNum))/4;\n\t\t\t\t\tvar y = minNum - x;\n\t\t\t\t\tanswer += minNum;\n\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - (2 * y);\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar x = maxNum - secondMaxNum;\n\t\t\t\t\tif (x > secondMaxNum) {\n\t\t\t\t\t\tx = secondMaxNum;\n\t\t\t\t\t}\n\t\t\t\t\tanswer += x;\n\t\t\t\t\tvar newr = maxNum - (2 * x);\n\t\t\t\t\tvar newg = secondMaxNum - x;\n\t\t\t\t\tvar newb = 0;\n\t\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber == 2) {\n\t\t\t\t\tanswer += 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\n\t\t\t\tif (x > sameNumber) {\n\t\t\t\t\tx = sameNumber;\n\t\t\t\t}\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(long r, long g, long b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 2)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1 || sameNumber - diffNumber == 2) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tstatic int caseType = -1;\n\t\tstatic int maxNum = -1;\n\t\tstatic int secondMaxNum = -1;\n\t\tstatic int minNum = -1;\n\t\tstatic int sameNumber = -1;\n\t\tstatic int diffNumber = -1;\n\t\tstatic int answer = 0;\t\n\n\tpublic static void Main()\n\t{\n\t\tvar numbers = Console.ReadLine().Split(' ');\n\t\t\tvar r = int.Parse(numbers[0]);\n\t\t\tvar g = int.Parse(numbers[1]);\n\t\t\tvar b = int.Parse(numbers[2]);\n\n\t\t\tDetermineCase(r, g, b);\n\t\t\tCasehandler(r, g, b);\n\n\t\t\tConsole.Write(answer);\n\t}\n\t\t\n\tstatic void Casehandler(int r, int g, int b) {\n\t\t\tif (caseType == 1)\n\t\t\t{\n\t\t\t\tvar diffMaxMin = (maxNum - minNum) / 2;\n\t\t\t\tvar diffSecondmaxMin = secondMaxNum - minNum;\n\n\t\t\t\tvar minDiff = Math.Min(diffMaxMin, diffSecondmaxMin);\n\t\t\t\tanswer += minDiff;\n\t\t\t\tvar newr = maxNum - (2 * minDiff);\n\t\t\t\tvar newg = secondMaxNum - minDiff;\n\t\t\t\tvar newb = minNum;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 2)\n\t\t\t{\n\t\t\t\tif (r == 0 && g == 0 && b == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += r;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (caseType == 3)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || sameNumber == 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (sameNumber - diffNumber) / 3;\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = sameNumber - (3 * x);\n\t\t\t\tvar newg = newr;\n\t\t\t\tvar newb = diffNumber;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\t\t\telse if (caseType == 4)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0|| sameNumber == 1)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanswer += (diffNumber);\n\t\t\t\tDetermineCase(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t\tCasehandler(sameNumber - diffNumber, sameNumber - diffNumber, 0);\n\t\t\t}\n\t\t\telse if (caseType == 5)\n\t\t\t{\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tanswer += (sameNumber);\n\t\t\t\tDetermineCase(diffNumber - sameNumber, 0, 0);\n\t\t\t\tCasehandler(diffNumber - sameNumber, 0, 0);\n\t\t\t}\n\t\t\telse if (caseType == 6) {\n\n\t\t\t\tif (sameNumber == 0 || diffNumber == 0)\n\t\t\t\t{\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar x = (diffNumber - sameNumber)/3;\n\t\t\t\t\n\t\t\t\tif (x > sameNumber) {\n\t\t\t\t\tx = sameNumber;\n\t\t\t\t}\n\n\t\t\t\tanswer += (2 * x);\n\t\t\t\tvar newr = diffNumber - (4 * x);\n\t\t\t\tvar newg = sameNumber - x;\n\t\t\t\tvar newb = sameNumber - x;\n\n\t\t\t\tDetermineCase(newr, newg, newb);\n\t\t\t\tCasehandler(newr, newg, newb);\n\t\t\t}\n\n\t\t}\n\n\t\tstatic void DetermineCase(int r, int g, int b) { \n\t\t\tif (r != g && g != b && b != r)\n\t\t\t{\n\t\t\t\tcaseType = 1; //all different\n\t\t\t\tmaxNum = Math.Max(r, Math.Max(g, b));\n\t\t\t\tif (maxNum == r) {\n\t\t\t\t\tsecondMaxNum = Math.Max(g, b);\n\t\t\t\t\tminNum = secondMaxNum == g ? b : g;\n\t\t\t\t} else if (maxNum == g)\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(r, b);\n\t\t\t\t\tminNum = secondMaxNum == r ? b : r;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsecondMaxNum = Math.Max(g, r);\n\t\t\t\t\tminNum = secondMaxNum == g ? r : g;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (r == g && g == b && b == r)\n\t\t\t{\n\t\t\t\tcaseType = 2; //all same\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (r == g)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = r;\n\t\t\t\t\tdiffNumber = b;\n\t\t\t\t}\n\t\t\t\telse if (g == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = g;\n\t\t\t\t\tdiffNumber = r;\n\t\t\t\t}\n\t\t\t\telse if (r == b)\n\t\t\t\t{\n\t\t\t\t\tsameNumber = b;\n\t\t\t\t\tdiffNumber = g;\n\t\t\t\t}\n\n\t\t\t\tif (sameNumber - diffNumber > 1)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 3; //58 58 40\n\t\t\t\t}\n\t\t\t\telse if (sameNumber - diffNumber == 1) {\n\t\t\t\t\tcaseType = 4; //58 58 57\n\t\t\t\t}\n\t\t\t\telse if (diffNumber - sameNumber < 3)\n\t\t\t\t{\n\t\t\t\t\tcaseType = 5; //28 26 26\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcaseType = 6; //30 27 27\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace R_C_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int r = int.Parse(s[0]), g = int.Parse(s[1]), b = int.Parse(s[2]);\n int min = Math.Min(r, Math.Min(g, b)), sum = 0;\n r -= min;\n g -= min;\n b -= min;\n sum += min;\n int a1, a2;\n if (r == 0)\n {\n a1 = g;\n a2 = b;\n }\n else if (g == 0)\n {\n a1 = r;\n a2 = b;\n }\n else\n {\n a1 = r;\n a2 = g;\n }\n while (((a1 != 0) && (a2 != 0))&&(a1/2!=0)&&(a2/2!=0))\n {\n int k1 = Math.Max(a1, a2) / 2, k2 = Math.Min(a1, a2), k3 = Math.Min(k1, k2);\n a1 -= k3;\n a2 -= k3;\n sum += k3;\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_C_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int r = int.Parse(s[0]), g = int.Parse(s[1]), b = int.Parse(s[2]);\n int min = Math.Min(r, Math.Min(g, b)), sum = 0;\n r -= min;\n g -= min;\n b -= min;\n sum += min;\n int a1, a2;\n if (r == 0)\n {\n a1 = g;\n a2 = b;\n }\n else if (g == 0)\n {\n a1 = r;\n a2 = b;\n }\n else\n {\n a1 = r;\n a2 = g;\n }\n int k3 = 1;\n while ((a1 != 0) && (a2 != 0)&& (k3 != 0))\n {\n int k1 = Math.Max(a1, a2) / 2, k2 = Math.Min(a1, a2);\n k3 = Math.Min(k1, k2);\n a1 -= k3;\n a2 -= k3;\n sum += k3;\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_C_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int r = int.Parse(s[0]), g = int.Parse(s[1]), b = int.Parse(s[2]);\n int sum = (r + g + b) / 3;\n sum = Math.Min(sum, r + g);\n sum = Math.Min(sum, r + b);\n sum = Math.Min(sum, g + b);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_C_273\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int r = int.Parse(s[0]), g = int.Parse(s[1]), b = int.Parse(s[2]);\n long sum = (r + g + b) / 3;\n sum = Math.Min(sum, r + g);\n sum = Math.Min(sum, r + b);\n sum = Math.Min(sum, g + b);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n class Point\n {\n public double X { get; private set; }\n public double Y { get; private set; }\n public Point(double X, double Y)\n {\n this.X = X;\n this.Y = Y;\n }\n public override bool Equals(object obj)\n {\n if (obj is Point)\n {\n return this.X == ((Point)obj).X && this.Y == ((Point)obj).Y;\n }\n else return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return X.GetHashCode() + Y.GetHashCode();\n }\n }\n public static void Main()\n {\n System.Text.StringBuilder res = new System.Text.StringBuilder();\n var tests = 1;\n //tests = readInt();\n for (int i = 0; i < tests; ++i)\n {\n res.AppendLine(Solve());\n }\n \n System.Console.Out.WriteLine(res);\n }\n\n static string Solve()\n {\n var x = readSplitedInts(' ').ToList();\n\n long res = 0;\n\n int m = x.Min();\n\n res += m;\n\n for (int i = 0; i < x.Count; ++i)\n {\n x[i] -= m;\n }\n x.RemoveAll(r => r == 0);\n\n if (x.Count == 2)\n {\n int min = x.Min();\n int max = x.Max();\n\n res += System.Math.Min(min, max / 2);\n }\n\n return res.ToString();\n }\n\n static int parseInt(string str)\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n res *= 10;\n switch (str[i])\n {\n case '0':\n res += 0;\n break;\n case '1':\n res += 1;\n break;\n case '2':\n res += 2;\n break;\n case '3':\n res += 3;\n break;\n case '4':\n res += 4;\n break;\n case '5':\n res += 5;\n break;\n case '6':\n res += 6;\n break;\n case '7':\n res += 7;\n break;\n case '8':\n res += 8;\n break;\n case '9':\n res += 9;\n break;\n }\n }\n if (str.StartsWith(\"-\"))\n {\n res *= -1;\n }\n return res;\n }\n static int[] readSplitedInts(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n int[] res = new int[t.Length];\n for (int i = 0; i < t.Length; ++i)\n {\n res[i] = parseInt(t[i]);\n }\n return res;\n }\n static int readInt()\n {\n return parseInt(System.Console.In.ReadLine());\n }\n static string[] readSplited(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n return t;\n }\n }\n}"}, {"source_code": "\ufeffusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n class Point\n {\n public double X { get; private set; }\n public double Y { get; private set; }\n public Point(double X, double Y)\n {\n this.X = X;\n this.Y = Y;\n }\n public override bool Equals(object obj)\n {\n if (obj is Point)\n {\n return this.X == ((Point)obj).X && this.Y == ((Point)obj).Y;\n }\n else return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return X.GetHashCode() + Y.GetHashCode();\n }\n }\n public static void Main()\n {\n System.Text.StringBuilder res = new System.Text.StringBuilder();\n var tests = 1;\n //tests = readInt();\n for (int i = 0; i < tests; ++i)\n {\n res.AppendLine(Solve());\n }\n\n System.Console.Out.WriteLine(res);\n }\n\n static string Solve()\n {\n var x = readSplitedInts(' ').ToList();\n\n long res = 0;\n\n x.Sort();\n\n long d1 = x[2] - x[1];\n long d2 = x[1] - x[0];\n\n long d = System.Math.Min(d1, d2);\n\n res += d;\n\n x[2] -= d * 2;\n x[1] -= d;\n\n d1 = x[2] - x[1];\n d2 = x[1] - x[0];\n\n if (x[0] == 0 && x[1] == 0)\n {\n return res.ToString(); \n }\n if (d1 > 0)\n {\n long z = d1 / 3;\n\n res += z * 2;\n \n x[2] -= z * 4;\n x[1] -= z;\n x[0] -= z;\n }\n if (d2 > 0)\n {\n long z = d2 / 3 * 2 + (d2 % 3 == 2 ? 1 : 0);\n\n res += z;\n\n x[2] -= z / 2 + (z % 2 == 1 ? 2 : 0);\n x[1] -= z / 2 + (z % 2 == 1 ? 1 : 0);\n }\n\n res += x.Min();\n\n return res.ToString();\n \n }\n\n static long parseInt(string str)\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n res *= 10;\n switch (str[i])\n {\n case '0':\n res += 0;\n break;\n case '1':\n res += 1;\n break;\n case '2':\n res += 2;\n break;\n case '3':\n res += 3;\n break;\n case '4':\n res += 4;\n break;\n case '5':\n res += 5;\n break;\n case '6':\n res += 6;\n break;\n case '7':\n res += 7;\n break;\n case '8':\n res += 8;\n break;\n case '9':\n res += 9;\n break;\n }\n }\n if (str.StartsWith(\"-\"))\n {\n res *= -1;\n }\n return res;\n }\n static long[] readSplitedInts(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n long[] res = new long[t.Length];\n for (int i = 0; i < t.Length; ++i)\n {\n res[i] = parseInt(t[i]);\n }\n return res;\n }\n static long readInt()\n {\n return parseInt(System.Console.In.ReadLine());\n }\n static string[] readSplited(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n return t;\n }\n }\n}"}, {"source_code": "\ufeffusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n class Point\n {\n public double X { get; private set; }\n public double Y { get; private set; }\n public Point(double X, double Y)\n {\n this.X = X;\n this.Y = Y;\n }\n public override bool Equals(object obj)\n {\n if (obj is Point)\n {\n return this.X == ((Point)obj).X && this.Y == ((Point)obj).Y;\n }\n else return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return X.GetHashCode() + Y.GetHashCode();\n }\n }\n public static void Main()\n {\n System.Text.StringBuilder res = new System.Text.StringBuilder();\n var tests = 1;\n //tests = readInt();\n for (int i = 0; i < tests; ++i)\n {\n res.AppendLine(Solve());\n }\n\n System.Console.Out.WriteLine(res);\n }\n\n static string Solve()\n {\n var x = readSplitedInts(' ').ToList();\n\n long res = 0;\n x.RemoveAll(r => r == 0);\n\n while (x.Count > 1)\n {\n x.Sort();\n\n\n if (x.Count == 3)\n {\n int length = x[2] - x[0];\n\n if (length <= 1)\n {\n res += x[0];\n break;\n }\n else\n {\n if (x[2] >= 2)\n {\n x[2] -= 2;\n x[1] -= 1;\n res++;\n x.RemoveAll(r => r == 0);\n }\n else\n {\n res++;\n break;\n }\n }\n }\n else\n {\n res += System.Math.Min(x[0], x[1] / 2);\n break;\n }\n \n }\n\n\n return res.ToString();\n }\n\n static int parseInt(string str)\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n res *= 10;\n switch (str[i])\n {\n case '0':\n res += 0;\n break;\n case '1':\n res += 1;\n break;\n case '2':\n res += 2;\n break;\n case '3':\n res += 3;\n break;\n case '4':\n res += 4;\n break;\n case '5':\n res += 5;\n break;\n case '6':\n res += 6;\n break;\n case '7':\n res += 7;\n break;\n case '8':\n res += 8;\n break;\n case '9':\n res += 9;\n break;\n }\n }\n if (str.StartsWith(\"-\"))\n {\n res *= -1;\n }\n return res;\n }\n static int[] readSplitedInts(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n int[] res = new int[t.Length];\n for (int i = 0; i < t.Length; ++i)\n {\n res[i] = parseInt(t[i]);\n }\n return res;\n }\n static int readInt()\n {\n return parseInt(System.Console.In.ReadLine());\n }\n static string[] readSplited(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n return t;\n }\n }\n}"}, {"source_code": "\ufeffusing System.Linq;\n\nnamespace codeforce\n{\n class Program\n {\n class Point\n {\n public double X { get; private set; }\n public double Y { get; private set; }\n public Point(double X, double Y)\n {\n this.X = X;\n this.Y = Y;\n }\n public override bool Equals(object obj)\n {\n if (obj is Point)\n {\n return this.X == ((Point)obj).X && this.Y == ((Point)obj).Y;\n }\n else return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return X.GetHashCode() + Y.GetHashCode();\n }\n }\n public static void Main()\n {\n System.Text.StringBuilder res = new System.Text.StringBuilder();\n var tests = 1;\n //tests = readInt();\n for (int i = 0; i < tests; ++i)\n {\n res.AppendLine(Solve());\n }\n\n System.Console.Out.WriteLine(res);\n }\n\n static string Solve()\n {\n var x = readSplitedInts(' ').ToList();\n\n long res = 0;\n x.RemoveAll(r => r == 0);\n\n while (x.Count > 1)\n {\n x.Sort();\n\n\n if (x.Count == 3)\n {\n long length = x[2] - x[0];\n\n if (length <= 1)\n {\n res += x[0];\n break;\n }\n else\n {\n if (x[2] >= 2)\n {\n x[2] -= 2;\n x[1] -= 1;\n res++;\n x.RemoveAll(r => r == 0);\n }\n else\n {\n res++;\n break;\n }\n }\n }\n else\n {\n res += System.Math.Min(x[0], x[1] / 2);\n break;\n }\n \n }\n\n\n return res.ToString();\n }\n\n static long parseInt(string str)\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n res *= 10;\n switch (str[i])\n {\n case '0':\n res += 0;\n break;\n case '1':\n res += 1;\n break;\n case '2':\n res += 2;\n break;\n case '3':\n res += 3;\n break;\n case '4':\n res += 4;\n break;\n case '5':\n res += 5;\n break;\n case '6':\n res += 6;\n break;\n case '7':\n res += 7;\n break;\n case '8':\n res += 8;\n break;\n case '9':\n res += 9;\n break;\n }\n }\n if (str.StartsWith(\"-\"))\n {\n res *= -1;\n }\n return res;\n }\n static long[] readSplitedInts(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n long[] res = new long[t.Length];\n for (int i = 0; i < t.Length; ++i)\n {\n res[i] = parseInt(t[i]);\n }\n return res;\n }\n static long readInt()\n {\n return parseInt(System.Console.In.ReadLine());\n }\n static string[] readSplited(char split)\n {\n var t = System.Console.In.ReadLine().Split(split);\n return t;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Table_Decorations\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var list = new List();\n list.Add(Next());\n list.Add(Next());\n list.Add(Next());\n\n long count = 0;\n\n list.Sort();\n while (true)\n {\n if ((list[1] == 0 && list[0] == 0))\n break;\n if (list.Sum() < 3)\n break;\n\n long delta = list[2] - list[1];\n long delta1 = list[1] - list[0];\n\n if (delta1 == 0 && delta == 0)\n {\n count += list[0];\n list[1] -= list[0];\n list[2] -= list[0];\n list[0] -= list[0];\n }\n else if (delta1 == 0)\n {\n long min = Math.Min(list[0], (delta + list[0])/4);\n if (min == 0)\n {\n }\n else\n {\n count += min*2;\n list[1] -= min;\n list[2] -= min*4;\n list[0] -= min;\n }\n }\n else\n {\n long min = Math.Min(delta1, (delta + delta1)/2);\n if (min == 0)\n {\n count += list[0];\n list[1] -= list[0];\n list[2] -= list[0];\n list[0] -= list[0];\n }\n else\n {\n count += min;\n list[1] -= min;\n list[2] -= 2*min;\n }\n }\n list.Sort();\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Table_Decorations\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var list = new List();\n list.Add(Next());\n list.Add(Next());\n list.Add(Next());\n\n list.Sort();\n\n long count = list.Sum()/3;\n if (2*count < list[2])\n {\n count = list[0] + list[1];\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var data = Console.ReadLine().Split().Select(d => long.Parse(d)).ToArray();\n var r = data[0];\n var g = data[1];\n var b = data[2];\n\n var max = Math.Max(r, g);\n var min = Math.Min(r, g);\n long mid = 0;\n\n \n if (b >= max)\n {\n mid = max;\n max = b;\n }\n else if (b > min)\n {\n mid = b;\n }\n else if (b <= min) \n {\n mid = min;\n min = b;\n }\n\n long count = 0;\n var cicles = min / 2;\n var rem = min % 2;\n count += cicles * 2;\n\n max -= (cicles * 2);\n min -= (cicles * 2);\n mid -= (cicles * 2);\n\n cicles = mid / 3;\n\n mid -= (cicles * 3);\n max -= (cicles * 3);\n\n count += (cicles * 2);\n\n //rem = min;\n //cicles = mid / 2;\n\n //var res = Math.Min(rem, cicles);\n //count += res;\n //min -= res;\n //mid -= (res * 2);\n\n cicles = max / 2;\n rem = min;\n var res = Math.Min(rem, cicles);\n count += res;\n if (res > 0)\n {\n max -= cicles * 2;\n min -= res;\n }\n \n\n cicles = max / 2;\n rem = mid;\n res = Math.Min(rem, cicles);\n count += res;\n if (res > 0)\n {\n max -= cicles * 2;\n mid -= res;\n }\n \n\n\n cicles = mid / 2;\n rem = max;\n res = Math.Min(rem, cicles);\n count += res;\n if (res > 0)\n {\n mid -= cicles * 2;\n max -= res;\n }\n \n\n if (max == 1 && mid == 1 && min == 1)\n {\n count++;\n\n }\n\n\n //if (mid == 2 && min == 1 && cicles <= 1)\n //{\n\n //}\n\n //if (cicles > 0)\n //{\n // if (mid > 0)\n // {\n // cicles--;\n // mid--;\n // max -= 2;\n // }\n // else if (min > 0)\n // {\n // cicles--;\n // min--;\n // min -= 2;\n // }\n //}\n\n //rem = min + mid;\n \n\n //res = Math.Min(rem, cicles);\n //count += res;\n\n\n Console.WriteLine(count);\n //var count = min;\n\n //r -= min;\n //g -= min;\n //b -= min;\n\n //var a = r == 0 ? g : r;\n //var c = a == g ? b : (g == 0 ? b : g);\n //var diff = Math.Abs(a - c);\n //var abs = Math.Min(a, c);\n\n //var t = abs / 3;\n //var rem = abs % 3;\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _273c\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\t//var r = d[0];\n\t\t\t//var g = d[1];\n\t\t\t//var b = d[2];\n\n\t\t\t//Array.Sort(d);\n\t\t\t//var max = d[2];\n\t\t\t//var mid = d[1];\n\t\t\t//var min = d[0];\n\n\t\t\tvar count = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tArray.Sort(d);\n\t\t\t\tvar max = d.Max();\n\t\t\t\tvar min = d.Min();\n\t\t\t\tif (max - min <= 1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\tArray.Sort(d);\n\n\t\t\t\t\tif (d[2] - d[1] <= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar md = d[2] - d[0];\n\t\t\t\t\t\tvar md2 = d[1] - d[0];\n\t\t\t\t\t\tvar ml2 = Math.Min(d[2], d[1]);\n\t\t\t\t\t\tvar mx = Math.Max(d[1], d[2]);\n\t\t\t\t\t\tvar m1 = md / 3;\n\t\t\t\t\t\tvar m2 = md2 / 3;\n\t\t\t\t\t\tvar n2 = Math.Min(m1, m2);\n\t\t\t\t\t\tif (n2 != 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tml2 -= n2 * 3;\n\t\t\t\t\t\t\tmx -= n2 * 3;\n\n\t\t\t\t\t\t\td[2] = mx;\n\t\t\t\t\t\t\td[1] = ml2;\n\t\t\t\t\t\t\tcount += n2 * 2;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//if (d[1] - d[0] <= 1)\n\t\t\t\t\t//{\n\t\t\t\t\t//\tbreak;\n\t\t\t\t\t//}\n\n\t\t\t\t\t//var md = d[2] - d[0];\n\t\t\t\t\t//var md2 = d[1] - d[0];\n\t\t\t\t\t//var ml2 = Math.Min(d[2], d[1]);\n\t\t\t\t\t//var mx = Math.Max(d[2], d[1]);\n\n\t\t\t\t\tvar cr = (d[2] - d[1]) / 2;\n\t\t\t\t\tvar c = d[1] - d[0];\n\t\t\t\t\t//if (c == 0)\n\t\t\t\t\t//{\n\t\t\t\t\t//\tbreak;\n\t\t\t\t\t//}\n\n\t\t\t\t\tvar can = Math.Min(c, cr);\n\t\t\t\t\tif (can == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\td[2] -= can * 2;\n\t\t\t\t\td[1] -= can;\n\n\t\t\t\t\tcount += can;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\n\t\t\t\t//for (int i = 0; i < c; i++)\n\t\t\t\t//{\n\t\t\t\t//\tif (mx - 2 < d[0])\n\t\t\t\t//\t{\n\t\t\t\t//\t\tbreak;\n\t\t\t\t//\t}\n\n\t\t\t\t//\tmx -= 2;\n\t\t\t\t//\tml2 -= 1;\n\t\t\t\t//\tcount++;\n\t\t\t\t//}\n\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\tArray.Sort(d);\n\t\t\t\t\tmax = d.Max();\n\t\t\t\t\tmin = d.Min();\n\t\t\t\t\tif (max - min <= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak; \n\t\t\t\t\t}\n\n\t\t\t\t\tvar need = (d[2] - d[0]) / 2;\n\t\t\t\t\tvar av = d[0] + d[1];\n\t\t\t\t\tif (av == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar re = Math.Min(need, av);\n\t\t\t\t\tvar split = re / 2;\n\n\n\t\t\t\t\td[2] -= re * 2;\n\t\t\t\t\td[1] -= split;\n\t\t\t\t\td[0] -= split;\n\t\t\t\t\tif (re % 2 == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\td[1] -= 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tcount += re;\n\n\t\t\t\t}\n\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tvar tor = d.Min();\n\t\t\tcount += tor;\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _273c\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\t//var r = d[0];\n\t\t\t//var g = d[1];\n\t\t\t//var b = d[2];\n\n\t\t\t//Array.Sort(d);\n\t\t\t//var max = d[2];\n\t\t\t//var mid = d[1];\n\t\t\t//var min = d[0];\n\n\t\t\tvar count = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tArray.Sort(d);\n\t\t\t\tvar max = d.Max();\n\t\t\t\tvar min = d.Min();\n\t\t\t\tif (max - min <= 1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tvar md = d[2] - d[0];\n\t\t\t\tvar md2 = d[1] - d[0];\n\t\t\t\tvar ml = Math.Min(md, md2);\n\t\t\t\tvar cr3 = ml / 3;\n\t\t\t\td[2] -= cr3 * 3;\n\t\t\t\td[1] -= cr3 * 3;\n\t\t\t\tcount += cr3 * 2;\n\n\t\t\t\tmd = d[2] - d[0];\n\t\t\t\tmd2 = d[1] - d[0];\n\n\t\t\t\tvar ml2 = Math.Min(d[2], d[1]);\n\t\t\t\tvar mx = Math.Max(d[2], d[1]);\n\n\t\t\t\tvar c = d[1] - d[0];\n\t\t\t\tfor (int i = 0; i < c; i++)\n\t\t\t\t{\n\t\t\t\t\tif (mx - 2 < d[0])\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmx -= 2;\n\t\t\t\t\tml2 -= 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t\td[2] = mx;\n\t\t\t\td[1] = ml2;\n\t\t\t\t\n\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\tArray.Sort(d);\n\t\t\t\t\tmax = d.Max();\n\t\t\t\t\tmin = d.Min();\n\t\t\t\t\tif (max - min <= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak; \n\t\t\t\t\t}\n\n\t\t\t\t\tvar need = (d[2] - d[0]) / 2;\n\t\t\t\t\tvar av = d[0] + d[1];\n\t\t\t\t\tif (av == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar re = Math.Min(need, av);\n\t\t\t\t\tvar split = re / 2;\n\n\n\t\t\t\t\td[2] -= re * 2;\n\t\t\t\t\td[1] -= split;\n\t\t\t\t\td[0] -= split;\n\t\t\t\t\tif (re % 2 == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\td[1] -= 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tcount += re;\n\n\t\t\t\t}\n\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tvar tor = d.Min();\n\t\t\tcount += tor;\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var data = Console.ReadLine().Split().Select(d => long.Parse(d)).ToArray();\n var r = data[0];\n var g = data[1];\n var b = data[2];\n\n var max = Math.Max(r, g);\n var min = Math.Min(r, g);\n long mid = 0;\n\n \n if (b >= max)\n {\n mid = max;\n max = b;\n }\n else if (b > min)\n {\n mid = b;\n }\n else if (b <= min) \n {\n mid = min;\n min = b;\n }\n\n long count = 0;\n var cicles = min / 2;\n var rem = min % 2;\n count += cicles * 2;\n\n max -= (cicles * 2);\n min -= (cicles * 2);\n mid -= (cicles * 2);\n\n cicles = mid / 3;\n\n mid -= (cicles * 3);\n max -= (cicles * 3);\n\n count += (cicles * 2);\n\n //rem = min;\n //cicles = mid / 2;\n\n //var res = Math.Min(rem, cicles);\n //count += res;\n //min -= res;\n //mid -= (res * 2);\n\n cicles = max / 2;\n rem = min;\n var res = Math.Min(rem, cicles);\n count += res;\n max -= cicles * 2;\n min -= res;\n\n cicles = max / 2;\n rem = mid;\n res = Math.Min(rem, cicles);\n count += res;\n max -= cicles * 2;\n mid -= res;\n\n\n cicles = mid / 2;\n rem = max;\n res = Math.Min(rem, cicles);\n count += res;\n mid -= cicles * 2;\n max -= res;\n\n if (max == 1 && mid == 1 && min == 1)\n {\n count++;\n\n }\n\n\n //if (mid == 2 && min == 1 && cicles <= 1)\n //{\n\n //}\n\n //if (cicles > 0)\n //{\n // if (mid > 0)\n // {\n // cicles--;\n // mid--;\n // max -= 2;\n // }\n // else if (min > 0)\n // {\n // cicles--;\n // min--;\n // min -= 2;\n // }\n //}\n\n //rem = min + mid;\n \n\n //res = Math.Min(rem, cicles);\n //count += res;\n\n\n Console.WriteLine(count);\n //var count = min;\n\n //r -= min;\n //g -= min;\n //b -= min;\n\n //var a = r == 0 ? g : r;\n //var c = a == g ? b : (g == 0 ? b : g);\n //var diff = Math.Abs(a - c);\n //var abs = Math.Min(a, c);\n\n //var t = abs / 3;\n //var rem = abs % 3;\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n\n DateTime time1 = DateTime.Now;\n Array.Sort(aint);\n int k = Func1(aint);\n DateTime time2 = DateTime.Now;\n\n Console.WriteLine(k);\n Console.WriteLine((time2 - time1).TotalMilliseconds);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (int)(((long)arr[0] + arr[1] + arr[2]) / 3);\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if((long)arr[0] + arr[1] + arr[2] < 3) break;\n\n int tmp = 0;\n if(arr[0] > 0) {\n \n if((arr[2] - arr[1] / 3) >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = (arr[2] - arr[1] / 3) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n } else {\n if(arr[2] >= arr[1] * 2) {\n tmp = arr[1];\n } else {\n tmp = arr[2] / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[1] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n Array.Sort(aint);\n\n int k = Func1(aint);\n\n Console.WriteLine(k);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (arr[0] + arr[1] + arr[2]) / 3;\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if(arr[0] + arr[1] + arr[2] < 3) break;\n\n\n if(arr[0] > 0) {\n int tmp = 0;\n if(arr[2] >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = arr[2] / 2;\n }\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n Array.Sort(arr);\n continue;\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n int tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n Array.Sort(aint);\n\n int k = Func1(aint);\n\n Console.WriteLine(k);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (arr[0] + arr[1] + arr[2]) / 3;\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if(arr[0] + arr[1] + arr[2] < 3) break;\n\n if(arr[0] > 0) {\n int tmp = 0;\n if((arr[2] - arr[1] / 2) >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = (arr[2] - arr[1] / 2) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n int tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n\n DateTime time1 = DateTime.Now;\n Array.Sort(aint);\n int k = Func1(aint);\n DateTime time2 = DateTime.Now;\n\n Console.WriteLine(k);\n //Console.WriteLine((time2 - time1).TotalMilliseconds);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (int)(((long)arr[0] + arr[1] + arr[2]) / 3);\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if((long)arr[0] + arr[1] + arr[2] < 3) break;\n\n int tmp = 0;\n if(arr[0] > 0) {\n \n if((arr[2] - arr[1] / 3) >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = (arr[2] - arr[1] / 3) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n } else {\n if(arr[2] >= arr[1] * 2) {\n tmp = arr[1];\n } else {\n tmp = arr[2] / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[1] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n Array.Sort(aint);\n\n int k = Func1(aint);\n\n Console.WriteLine(k);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (arr[0] + arr[1] + arr[2]) / 3;\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if(arr[0] + arr[1] + arr[2] < 3) break;\n\n if(arr[0] > 0) {\n if(arr[2] >= arr[0] * 2) {\n k += arr[0];\n arr[0] = 0;\n arr[2] -= 2 * arr[0];\n Array.Sort(arr);\n continue;\n } else {\n int tmp = arr[2] / 2;\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n \n if(arr[2] < arr[1]) {\n int tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_273_C {\n class Program {\n static void Main(string[] args) {\n string[] astr = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n int[] aint = new int[astr.Length];\n int i = 0;\n foreach(string s in astr) {\n aint[i] = int.Parse(s);\n i++;\n }\n\n DateTime time1 = DateTime.Now;\n Array.Sort(aint);\n int k = Func1(aint);\n DateTime time2 = DateTime.Now;\n\n Console.WriteLine(k);\n //Console.WriteLine((time2 - time1).TotalMilliseconds);\n Console.ReadLine();\n }\n\n private static int Func1(int[] arr) {\n int kMax = (int)(((long)arr[0] + arr[1] + arr[2]) / 3);\n if(kMax > arr[1] + arr[2]) kMax = arr[1] + arr[2];\n\n int k = 0;\n\n int kMin2 = 2 * arr[1] - arr[2];\n if(kMin2 > arr[0]) kMin2 = arr[0];\n if(kMin2 > 0) {\n arr[0] -= kMin2;\n arr[1] -= kMin2;\n arr[2] -= kMin2;\n k += kMin2;\n }\n int kMin = arr[0];\n\n while(true) {\n if(arr[1] == 0 || arr[2] == 0) break;\n if((long)arr[0] + arr[1] + arr[2] < 3) break;\n\n int tmp = 0;\n if(arr[0] > 0) {\n \n if((arr[2] - arr[1] / 3) >= arr[0] * 2) {\n tmp = arr[0];\n } else {\n tmp = (arr[2] - arr[1] / 3) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[0] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n } else {\n if((arr[2] - arr[1] / 3) >= arr[1] * 2) {\n tmp = arr[1];\n } else {\n tmp = (arr[2] - arr[1] / 3) / 2;\n }\n if(tmp > 0) {\n k += tmp;\n arr[1] -= tmp;\n arr[2] -= tmp * 2;\n\n Array.Sort(arr);\n continue;\n }\n }\n\n arr[2] -= 2;\n if(arr[0] > 0) {\n arr[0] -= 1;\n } else {\n arr[1] -= 1;\n }\n\n if(arr[2] < arr[1]) {\n tmp = arr[2];\n arr[2] = arr[1];\n arr[1] = tmp;\n }\n\n k++;\n }\n\n return k;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n long min = num.Min();\n long total = min;\n num[0] = num[0] - min;\n num[1] = num[1] - min;\n num[2] = num[2] - min;\n Array.Sort(num);\n if(num[1] > 0 && num[2] > 0){\n min = Math.Max(num[1] , num[2]) / 2;\n total += Math.Min(min,Math.Min(num[1],num[2]));\n } \n Console.WriteLine(total);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n long min = num.Min();\n long total = min;\n if(min == 2){\n Console.WriteLine(0);\n return;\n }\n num[0] = num[0] - min;\n num[1] = num[1] - min;\n num[2] = num[2] - min;\n Array.Sort(num);\n if(num[1] > 0 && num[2] > 0){\n min = Math.Max(num[1] , num[2]) / 2;\n min = Math.Min(min,Math.Min(num[1],num[2]));\n total += min;\n if(Math.Max(num[1] , num[2]) % 2 == 1 && (Math.Min(num[1],num[2])) - min > 1)\n total++;\n \n } \n Console.WriteLine(total);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n long min = num.Min();\n long total = min;\n num[0] = num[0] - min;\n num[1] = num[1] - min;\n num[2] = num[2] - min;\n Array.Sort(num);\n if(num[1] > 0 && num[2] > 0){\n min = Math.Max(num[1] , num[2]) / 2;\n min = Math.Min(min,Math.Min(num[1],num[2]));\n total += min;\n if(Math.Max(num[1] , num[2]) % 2 == 1 && Math.Min(num[1],num[2]) - min > 1)\n total++;\n \n } \n Console.WriteLine(total);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n long[] num = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();\n long min = num.Min();\n long total = min;\n if(min <= 2){\n Console.WriteLine(0);\n return;\n }\n num[0] = num[0] - min;\n num[1] = num[1] - min;\n num[2] = num[2] - min;\n Array.Sort(num);\n if(num[1] > 0 && num[2] > 0){\n min = Math.Max(num[1] , num[2]) / 2;\n min = Math.Min(min,Math.Min(num[1],num[2]));\n total += min;\n if(Math.Max(num[1] , num[2]) % 2 == 1 && (Math.Min(num[1],num[2])) - min > 1)\n total++;\n \n } \n Console.WriteLine(total);\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static int[] v;\n static void read() {\n v = Array.ConvertAll(Console.ReadLine().Split(' '), ts => int.Parse(ts));\n }\n\n static int f() {\n Array.Sort(v);\n if (v[0] == v[1] && v[1] == v[2]) {\n return v[0];\n }\n v[1] -= 1;\n v[2] -= 2;\n return 1 + f();\n }\n\n static void solve() {\n read();\n\n int ans = f();\n }\n\n static void Main(string[] args) {\n\n //Console.SetIn(new StreamReader(\"file.in\"));\n /*\n FileStream filestream = new FileStream(\"out.txt\", FileMode.Create);\n var streamwriter = new StreamWriter(filestream);\n streamwriter.AutoFlush = true;\n Console.SetOut(streamwriter);\n */\n\n solve();\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static int[] v;\n static void read() {\n v = Array.ConvertAll(Console.ReadLine().Split(' '), ts => int.Parse(ts));\n }\n\n static void solve() {\n read();\n\n int ans = 0;\n Array.Sort(v);\n while (v[1] > 0 && v[2] > 1) {\n if ((v[0] == v[1]) && (v[1] == v[2])) {\n ans += v[0];\n v[1] = 0;\n }\n ans++;\n v[1]--;\n v[2] -= 2;\n Array.Sort(v);\n }\n Console.Write(ans);\n }\n\n static void Main(string[] args) {\n\n //Console.SetIn(new StreamReader(\"file.in\"));\n /*\n FileStream filestream = new FileStream(\"out.txt\", FileMode.Create);\n var streamwriter = new StreamWriter(filestream);\n streamwriter.AutoFlush = true;\n Console.SetOut(streamwriter);\n */\n\n solve();\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static int[] a;\n\n static void solve()\n {\n a = Array.ConvertAll(Console.ReadLine().Split(), ts => int.Parse(ts));\n Array.Sort(a);\n if (a[0] + a[1] < a[2]/2)\n {\n Console.Write(a[0] + a[1]);\n } else\n {\n Console.Write((a[0] + a[1] + a[2]) / 3);\n }\n }\n\n static void Main( string[ ] args ) {\n //Console.SetIn(new StreamReader(\"in.txt\"));\n\n solve( );\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = (max + av) / 3; \n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n // Console.WriteLine(\"here in the if \"+newav);\n }\n else if ((max + av) / 3 > av && max av)\n {\n newav = av;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n //Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n //Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = re;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = (max + av) / 3; \n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n// Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n long sum = 0;\n sum=(min + av );\n sum += max;\n long temp = (sum / 3);\n\n\n sum = temp;\n\n if (sum < min)\n Console.WriteLine(sum);\n else\n Console.WriteLine(min);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n \n }\n else if ((max + av) / 3 > av && max av)\n {\n newav = av;\n }\n else if ((max + av) / 3 > av )\n {\n newav = (max + av) / 3;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n \n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n\n // get the av\n int av = gr;\n if (gr <= bl && bl <= re)\n av = bl;\n else if (gr <= re && re <= bl)\n av = re;\n\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n\n\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0,reminder=0;\n // Console.WriteLine(\"the avar \" +av+\" max \"+max);\n if ((max + av) / 3 <= av&& (max + av) / 3>0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n //Console.WriteLine(output);\n if (reminder > 3)\n output++;\n // Console.WriteLine(reminder);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n \n }\n else if ((max + av) / 3 > av && max av && max < av * 3)\n {\n newav = av;\n\n // Console.WriteLine(\"here in the sec \");\n }\n else if ((max + av) / 3 > av )\n {\n newav = (max + av) / 3;\n\n //Console.WriteLine(\"here in the third \");\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n\n // get the av\n int av = gr;\n if (min <= bl && bl >= re)\n av = bl;\n else if (min <= re && re >= bl)\n av = re;\n \n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = 1;\n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n if (reminder > 3 || (max + av) / 3 > av)\n output++;\n\n // Console.WriteLine(reminder);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n }\n else if ((max + av) / 3 > av)\n {\n newav = (max + av) / 3; \n\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n long sum = 0;\n sum=(min + av );\n sum += max;\n long temp = (sum / 3);\n\n\n //sum = temp;\n\n if (temp < (sum - max))\n Console.WriteLine(temp);\n else\n Console.WriteLine(sum-max);\n //Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n \n }\n else if ((max + av) / 3 > av && max av && max < av * 3)\n {\n newav = av;\n\n // Console.WriteLine(\"here in the sec \");\n }\n else if ((max + av) / 3 > av )\n {\n newav = (max + av) / 3;\n\n //Console.WriteLine(\"here in the third \");\n // reminder = (max + av) % 3;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n // Console.WriteLine(\" new averaf \"+newav);\n //Console.WriteLine(output);\n \n int sum = gr + bl + re;\n sum = sum / 3;\n\n if (sum < max)\n Console.WriteLine(sum);\n else\n Console.WriteLine(max);\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n max = max - min;\n av = av - min;\n int newmax = max - av;\n int newav = 0, reminder = 0;\n if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n {\n newav = (max + av) / 3;\n reminder = (max + av) % 3;\n // Console.WriteLine(\"here in the if \"+newav);\n }\n else if ((max + av) / 3 > av && max av )\n {\n newav = (max + av) / 3;\n\n // reminder = (max + av) % 3;\n }\n \n else if ((max + av) / 3 > av)\n {\n newav = av;\n }\n\n int output = min + newav;\n // if (reminder > 3 || (max + av) / 3 > av)\n // output++;\n\n //Console.WriteLine(\" new averaf \"+newav);\n Console.WriteLine(output);\n\n\n\n // Console.ReadKey();\n\n }\n\n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace threeballon\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n // in put the number of games\n\n string[] tokens = Console.ReadLine().Split();\n\n //Parse element 0\n\n int gr = int.Parse(tokens[0]);\n\n int bl = int.Parse(tokens[1]);\n\n int re = int.Parse(tokens[2]);\n\n // get the minmum\n\n int min = gr;\n if (gr > bl && bl < re)\n {\n min = bl;\n }\n else if (gr > re && re < bl)\n min = re;\n // get the max\n int max = gr;\n if (gr <= bl && bl >= re)\n max = bl;\n else if (gr <= re && re >= bl)\n max = re;\n \n // get the av\n int av = gr;\n if (bl > min && bl < max)\n av = bl;\n else if (re > min && re < max)\n av = re;\n\n else if (re == gr && gr == bl)\n av = gr;\n else if (gr == min && bl == gr && gr > 0)\n av = gr;\n else if (bl == min && re == bl && re > 0)\n av = re;\n else if (re == min && gr == re && re > 0)\n av = gr;\n else if (gr == 0 && bl > 0 && re == max)\n av = bl;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr; \n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n else if (bl == 0 && gr > 0 && re == max)\n av = gr;\n\n int oldav = av;\n\n //Console.WriteLine(\"the avar \" + av + \" max \" + max+\" min is \"+min);\n\n\n //if (gr != min && min < gr && gr < max && gr > 0)\n // av = gr;\n //else if (bl != min && min < bl && bl < max && bl > 0)\n // av = bl;\n //else if (re != min && min < re && re < max && re > 0)\n // av = re;\n //else if (min <= bl && bl <= max)\n // av = bl;\n //else if (min <= re && re <= max)\n // av = re;\n //else if (min <= gr && gr <= max)\n // av = gr;\n\n\n // max = max - min;\n // av = av - min;\n // int newmax = max - av;\n // int newav = 0, reminder = 0;\n // if ((max + av) / 3 <= av && (max + av) / 3 > 0)\n // {\n // newav = (max + av) / 3;\n // reminder = (max + av) % 3;\n\n // }\n // else if ((max + av) / 3 > av && max av && max < av * 3)\n // {\n // newav = av;\n\n // // Console.WriteLine(\"here in the sec \");\n // }\n // else if ((max + av) / 3 > av )\n // {\n // newav = (max + av) / 3;\n\n // //Console.WriteLine(\"here in the third \");\n // // reminder = (max + av) % 3;\n // }\n\n // int output = min + newav;\n //// if (reminder > 3 || (max + av) / 3 > av)\n // // output++;\n\n //// Console.WriteLine(\" new averaf \"+newav);\n // //Console.WriteLine(output);\n\n long sum = 0;\n sum=(min + av );\n sum = (sum+max);\n\n // Console.WriteLine(\" here el sum \" + sum);\n long temp = (sum / 3);\n\n// v = map(int, raw_input().split())\n//s = sum(v); print min(s/ 3,s - max(v))\n\n //sum = temp;\n long temp1 = (sum - max);\n if (temp < temp1)\n Console.WriteLine(temp);\n else\n Console.WriteLine(temp1);\n //Console.ReadKey();\n\n }\n\n\n\n }\n}"}], "src_uid": "bae7cbcde19114451b8712d6361d2b01"} {"source_code": "using System;\nnamespace SortApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if(n%2==0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n\n\n\n //Console.WriteLine();\n Console.Read();\n\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp18\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] players = { \"Mahmoud\", \"Ehab\" };\n string winner = \"\";\n int i = 2;\n while (winner == \"\")\n {\n if ((i % players.Length == 0))\n {\n if (n != 0)\n {\n for (int x = n; x > 0; x--)\n {\n if (x % players.Length == 0)\n {\n n = n - x;\n break;\n }\n else winner = players[1];\n }\n }\n else winner = players[1];\n }\n else if ((i % players.Length != 0 && winner == \"\"))\n {\n if (n != 0)\n {\n for (int x = n; x > 0; x--)\n {\n if (x % players.Length != 0)\n {\n n = n - x;\n break;\n }\n else winner = players[0];\n }\n }\n else winner = players[0];\n }\n i++;\n\n }\n Console.WriteLine(winner);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolvingProject\n{\n class MahmoudAndEhabAndTheEvenOddGame\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else Console.WriteLine(\"Ehab\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace game\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n =Convert.ToInt64 (Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else Console.WriteLine(\"Ehab\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace task\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = int.Parse(Console.ReadLine());\n Console.WriteLine(nums % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n\n //int n = Convert.ToInt32(s[0]);\n //int m = Convert.ToInt32(s[1]);\n //int k = Convert.ToInt32(s[2]);\n\n //if (m < n || k < n)\n //{\n // Console.WriteLine(\"No\");\n //}\n //else\n //{\n // Console.WriteLine(\"Yes\");\n //} \n //string str = Console.ReadLine();\n //string[] s = str.Split(' ');\n //int t = Convert.ToInt32(str);\n\n //string a = \"I hate\";\n //string b = \" that I love\";\n //string c = \" that I hate\";\n\n //for (int i = 0; i < t-1; i++)\n //{\n // if (i % 2 == 1)\n // {\n // a += c;\n // }\n // else if( i % 2 == 0)\n // {\n // a += b;\n // }\n //}\n // Console.WriteLine($\"{a} it\");\n\n //var charCount = Console.ReadLine();\n //var chars = Console.ReadLine().ToLower();\n //var output = new List();\n\n //while (chars.IndexOf('o') >= 0 && chars.IndexOf('n') >= 0 && chars.IndexOf('e') >= 0)\n //{\n // output.Add(1);\n // chars = chars.Remove(chars.IndexOf('o'), 1);\n // chars = chars.Remove(chars.IndexOf('n'), 1);\n // chars = chars.Remove(chars.IndexOf('e'), 1);\n //}\n //while (chars.IndexOf('z') >= 0 && chars.IndexOf('e') >= 0 && chars.IndexOf('r') >= 0 && chars.IndexOf('o') >= 0)\n //{\n // output.Add(0);\n // chars = chars.Remove(chars.IndexOf('z'), 1);\n // chars = chars.Remove(chars.IndexOf('e'), 1);\n // chars = chars.Remove(chars.IndexOf('r'), 1);\n // chars = chars.Remove(chars.IndexOf('o'), 1);\n //}\n //Console.WriteLine(string.Join(\" \", output));\n\n\n int n = Convert.ToInt32(Console.ReadLine());\n int a = n % 2;\n if (a == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF959a\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n if(n % 2 == 0){\n Console.WriteLine(\"Mahmoud\");\n }\n else{\n Console.WriteLine(\"Ehab\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n \n if (input %2 == 0)\n Console.WriteLine(\"Mahmoud\");\n\n else\n Console.WriteLine(\"Ehab\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main()\n {\n var i = int.Parse(Console.ReadLine());\n var res = Func(i);\n Console.WriteLine(res);\n }\n\n public static string Func(int n)\n {\n if (n % 2 != 0)\n return \"Ehab\";\n\n return \"Mahmoud\";\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Algorithm\n{\n\u00a0\u00a0\u00a0 class Program\n\u00a0\u00a0\u00a0 {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 static void Main(string[] args)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\n var n = int.Parse(Console.ReadLine());\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Console.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n\u00a0\u00a0\u00a0 }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else Console.WriteLine(\"Ehab\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = Int();\n\t\t\tif (n % 2 == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Mahmoud\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Ehab\");\n\t\t\t}\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[3]);\n\t\t}\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t}\n\n\t}\n\n\n}\n"}, {"source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n int startNum = Convert.ToInt32(Console.ReadLine());\n int res = startNum % 2;\n if (res == 1){\n Console.WriteLine(\"Ehab\");\n }\n else \n {\n Console.WriteLine(\"Mahmoud\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n Write(ReadInt() % 2 > 0 ? \"Ehab\" : \"Mahmoud\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"stations.in\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces_959A_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForcesTest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace EvenOdd\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n float n = 10000000000;\n for (int i = 1; i <= n; i++)\n {\n if (input % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n break;\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n break;\n }\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n // input //\n int num = int.Parse(Console.ReadLine());\n\n // process //\n if (num % 2 == 0)\n Console.Write(\"Mahmoud\");\n else\n Console.Write(\"Ehab\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ChetnojeNechetnoje\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n Console.Write(\"Mahmoud\");\n else\n Console.Write(\"Ehab\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _959A_MahmoudAndEhabAndTheEvenOddGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Program\n{\n public static void Main() {\n int n = Convert.ToInt32(Console.ReadLine());\n \n if(n%2 == 0){Console.WriteLine(\"Mahmoud\");\n return;}\n Console.WriteLine(\"Ehab\");\n \n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 0;\n n = Convert.ToInt32(Console.ReadLine());\n if (n%2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if ((n < 1) || (n > Math.Pow(10, 9)))\n {\n Console.WriteLine(\"Condition error\");\n return;\n }\n\n Console.WriteLine((n % 2 == 0) ? \"Mahmoud\" : \"Ehab\");\n }\n catch\n {\n Console.WriteLine(\"Condition error\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing static System.Math;\n\nclass P\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n //\u5076\u6570\u3060\u3063\u305f\u3089\u521d\u624b\u3067\u5076\u6570\u5f15\u304f\u3001\u5947\u6570\u3060\u3063\u305f\u3089\u3069\u3046\u3057\u3088\u3046\u3082\u306a\u3044\n Console.WriteLine(n % 2 == 1 ? \"Ehab\" : \"Mahmoud\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool result = false;\n int counter = 0;\n int n = int.Parse(Console.ReadLine());\n do\n {\n\n if(counter % 2 == 0)\n {\n if (n >= 2)\n {\n if (n % 2 == 0) { Console.WriteLine(\"Mahmoud\"); break; }\n else { n -= n / 2; }\n }\n else\n {\n Console.WriteLine(\"Ehab\");break;\n }\n\n }\n else\n {\n if (n >= 1)\n {\n if (n % 2 == 1) { Console.WriteLine(\"Ehab\");break; }\n n -= 1;\n }\n else { Console.WriteLine(\"Mahmoud\");break; }\n }\n counter++;\n }\n while (true);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 1; testN++)\n {\n#endif\n var n = NextLong();\n\n\n //var res = n % 2;\n\n\n Console.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static long[] ReadLongs(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();\n }\n\n private static long[] ReadLongs()\n {\n return ReadLongs(_defaultSplitter);\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine());\n if (n%2 != 0)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Game\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(int.Parse(Console.ReadLine()) % 2 == 1 ? \"Ehab\" : \"Mahmoud\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Szzz\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n\n if (n % 2 == 1)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n \n\n static void Main(string[] args)\n {\n\n\n int a = int.Parse(Console.ReadLine());\n\n if (a % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n static int Count(string source, string key)\n {\n\n\n List indices = new List();\n\n int index = source.IndexOf(key, 0);\n\n while (index > -1)\n {\n indices.Add(index);\n index = source.IndexOf(key, index + key.Length);\n }\n\n return indices.Count();\n }\n\n public static string Check(string s)\n {\n string letters = \"aeiouy\";\n\n while (true)\n {\n bool used = false;\n\n for (int i = 0; i < s.Length - 1; i++)\n {\n if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))\n {\n s = s.Remove(i + 1, 1);\n\n used = true;\n }\n }\n\n if (!used)\n {\n return s;\n }\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n\n int a = int.Parse(Console.ReadLine());\n\n if (a % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n\n\n\n\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Mahmoud_and_Ehab_and_the_evenodd_game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if ((n & 1) == 0) Console.WriteLine(\"Mahmoud\");\n else Console.WriteLine(\"Ehab\");;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = int.Parse(Console.ReadLine());\n\n bool isM = false;\n if (number % 2 == 0)\n isM = true;\n Console.WriteLine(isM? \"Mahmoud\" : \"Ehab\") ;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(string separator, T[] a, int startIndex, int count)\n\t{\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = startIndex, lastIndex = startIndex + count;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = startIndex; i < lastIndex - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < lastIndex - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint n = UtilityMethods.ReadInt();\n\t\tUtilityMethods.WriteLine(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\n \nnamespace Issue\n{\n public static class Program\n {\n public static void Main(string[] args) {\n\t\t\tvar number = IO.Read();\n\t\t\t\n\t\t\tvar result = Solve(number);\n\n\t\t\tConsole.WriteLine(result);\n }\n\n\t\tprivate static string Solve(int number) {\n\t\t\treturn number % 2 == 0\n\t\t\t\t? \"Mahmoud\"\n\t\t\t\t: \"Ehab\";\n\t\t}\n }\n \n public static class IO {\n public const int ZeroCode = (int) '0';\n \n static IO() {\n Reader = new StreamReader(\n Console.OpenStandardInput(),\n System.Text.Encoding.ASCII,\n false, \n sizeof(int),\n false);\n }\n \n public static StreamReader Reader { \n get; set;\n }\n \n public static string ReadLine() {\n return Reader.ReadLine();\n }\n \n public static int Read() {\n var reader = Reader;\n var symbol = reader.Read();\n \n while (symbol == ' ') {\n symbol = reader.Read();\n }\n \n var isNegative = false;\n if (symbol == '-') {\n isNegative = true;\n symbol = reader.Read();\n }\n \n int result = 0;\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = reader.Read()\n ) {\n var digit = symbol - ZeroCode;\n \n if (digit < 10 && digit >= 0) {\n result = (result << 1) + ((result << 1) << 2) + digit;\n } else {\n if (symbol == 13) // if symbol == \\n\n reader.Read(); // skip next \\r symbol\n break;\n }\n }\n \n return isNegative ? ~result + 1 : result;\n }\n\n\t\tpublic static long ReadLong() {\n var reader = Reader;\n var symbol = reader.Read();\n \n while (symbol == ' ') {\n symbol = reader.Read();\n }\n \n var isNegative = false;\n if (symbol == '-') {\n isNegative = true;\n symbol = reader.Read();\n }\n \n var result = 0l;\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = reader.Read()\n ) {\n var digit = symbol - ZeroCode;\n \n if (digit < 10 && digit >= 0) {\n result = (result << 1) + ((result << 1) << 2) + digit;\n } else {\n if (symbol == 13) // if symbol == \\n\n reader.Read(); // skip next \\r symbol\n break;\n }\n }\n \n return isNegative ? ~result + 1 : result;\n }\n }\n \n public static class Sort {\n public static void Heapsort(this T[] array, bool isReversed = false)\n where T : IComparable\n {\n Func comparer;\n \n if (isReversed) \n comparer = Extensions.Min;\n else \n comparer = Extensions.Max;\n \n // create Heap from unordered array\n BuildHeap(array, comparer);\n \n // sort\n for (var i = array.Length - 1; i >= 0; --i)\n {\n Swap(ref array[0], ref array[i]);\n FloatUp(array, 0, i, comparer);\n }\n }\n \n private static void BuildHeap(T[] array, Func comparer)\n where T : IComparable\n {\n var size = array.Length;\n var last_index = size - 1;\n \n for (var i = (last_index - 1) / 2; i >= 0; --i)\n {\n FloatUp(array, i, size, comparer);\n }\n }\n \n private static void FloatUp(T[] array, int index, int size, Func comparer)\n where T : IComparable\n {\n var left_node_index = 2 * (index + 1) - 1;\n var right_node_index = 2 * (index + 1);\n \n if (left_node_index >= size)\n {\n return;\n }\n \n var largest = comparer(array, left_node_index, index);\n \n if (right_node_index < size)\n {\n largest = comparer(array, right_node_index, largest);\n }\n \n if (largest != index)\n {\n Swap(ref array[index], ref array[largest]);\n FloatUp(array, largest, size, comparer);\n }\n }\n \n private static void Swap(ref T a, ref T b)\n {\n T temp = a;\n a = b;\n b = temp;\n }\n }\n \n public static class Extensions {\n public static int Max(this T[] array, int firstIndex, int secondIndex)\n where T : IComparable\n {\n return (array[firstIndex].CompareTo(array[secondIndex]) > 0)\n ? firstIndex\n : secondIndex;\n }\n \n public static int Min(this T[] array, int firstIndex, int secondIndex)\n where T : IComparable\n {\n return (array[firstIndex].CompareTo(array[secondIndex]) <= 0)\n ? firstIndex\n : secondIndex;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n \nnamespace CodeForces\n{\n\n class Parser {\n\n public static int ReadIntFromStdin() {\n int prev = ' '; int res = 0;\n int symb = Console.Read();\n while ((symb < '0') || (symb > '9')) {\n prev = symb;\n symb = Console.Read();\n }\n while ((symb >= '0') && (symb <= '9')) {\n res = 10 * res + symb - '0';\n symb = Console.Read();\n }\n if (prev == '-') { return -res; }\n else { return res; }\n }\n\n public static List ReadIntsFromStdin(int n) {\n List res = new List(); int cnt = 0;\n while(cnt < n) {\n res.Add(ReadIntFromStdin());\n cnt++;\n }\n return res;\n }\n\n public static int ConvertStringToInt(string str) {\n int res = 0; int start = 0; int sign = 1;\n if (str[0] == '-') { start = 1; sign = -1;}\n for (int i = start; i < str.Length; i++) {\n res = 10 * res + sign * (str[i] - '0');\n }\n return res;\n }\n\n public static List SplitStringBasedOnDelim(string str, char delim) {\n List res = new List(); string buf = \"\";\n for (int i = 0; i < str.Length; i++) {\n if (str[i] != delim) { buf = buf + str[i]; }\n else { if (buf != \"\") { res.Add(buf); buf = \"\"; } }\n }\n if (buf != \"\") { res.Add(buf); }\n return res;\n }\n\n }\n\n class Vertex {\n\n public int name;\n public int value;\n public int _in;\n public int _out;\n public List descendants;\n\n public Vertex(int name, int value) {\n this.name = name;\n this.value = value;\n this._in = 0;\n this._out = 0;\n this.descendants = new List();\n }\n\n private bool isInDescendants(Vertex v) {\n bool flag = false;\n foreach (Vertex i in descendants) {\n if (i.name == v.name) { flag = true; break; }\n }\n return flag;\n }\n\n public void AddDescendant(Vertex v) {\n if (! isInDescendants(v)) {\n descendants.Add(v);\n }\n }\n\n }\n\n class Edge {\n public Edge() {\n\n }\n }\n\n class Graph {\n\n private Vertex root;\n private List vertices;\n\n public Graph() {\n root = null;\n vertices = new List();\n }\n\n public void AddVertex(Vertex v) {\n\n }\n\n public void PrintRoot() {\n System.Console.WriteLine(\"{0}\", root.name);\n }\n\n public void PrintAllVertices() {\n foreach (Vertex v in vertices) {\n System.Console.WriteLine(\"{0}\", v.name);\n }\n }\n\n }\n\n class BinaryHeap {\n\n private Vertex[] heap;\n\n public BinaryHeap(int n) {\n this.heap = new Vertex[n+1];\n }\n\n public void PrintHeap() {\n foreach (Vertex v in heap) {\n System.Console.WriteLine(\"{0}\", v.name);\n }\n }\n\n }\n\n class Program {\n static void Main(string[] args) {\n int n = Parser.ReadIntFromStdin();\n if (n%2==0) {System.Console.WriteLine(\"Mahmoud\");}\n else {System.Console.WriteLine(\"Ehab\");}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _959A\n {\n public static void Main()\n {\n Console.WriteLine(int.Parse(Console.ReadLine()) % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n Console.WriteLine(n % 2 == 1 ? \"Ehab\" : \"Mahmoud\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n%2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = int.Parse(Console.ReadLine());\n Console.WriteLine(a%2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace G4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Steps = new int[10];\n Steps[0] = 1;\n for (int i = 1; i < 10; i++)\n {\n Steps[i] = Steps[i - 1] * 10;\n }\n\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 1)\n {\n Console.Write(\"Ehab\");\n }\n else\n {\n Console.Write(\"Mahmoud\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace TestConsole\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var input = int.Parse(Console.ReadLine());\n\n Console.WriteLine(input % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Mahmoud_and_Ehab_and_the_even_odd_game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n \n if (n % 2 == 0) {\n Console.WriteLine(\"Mahmoud\");\n } else {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n Console.Write(n % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems\n{\n class A959_MahmoudAndEhabAndTheEvenOddGame\n {\n public static void Main()\n {\n //while(true)\n //{\n var a =int.Parse(Console.ReadLine());\n if(a%2==0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n //}\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _959A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if(n %2 == 1)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmoud\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u0421SharpTest\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine());\n if(n%2 == 0) {\n Console.WriteLine(\"Mahmoud\");\n }\n else{\n Console.WriteLine(\"Ehab\");\n }\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Mahmoud(n);\n }\n\n private static void Mahmoud(int n)\n {\n if(n % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inp = Convert.ToInt32(Console.ReadLine());\n var res = 0;\n\n if (inp % 2 == 0)\n {\n Console.Write(\"Mahmoud\");\n\n }\n else\n {\n Console.Write(\"Ehab\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n % 2 == 1) Console.Write(\"Ehab\");\n else Console.Write(\"Mahmoud\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{ \n class A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n if(n%2==0){\n Console.WriteLine(\"Mahmoud\");\n }else{\n Console.WriteLine(\"Ehab\");\n }\n \n \n }\n }\n}\n \n\n"}, {"source_code": "using System;\nclass Codeforces959A\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n if(n%2==0)\n Console.Write(\"Mahmoud\");\n else\n Console.Write(\"Ehab\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if(n % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication203\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n if (a % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace MyApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if(n % 2 == 0) {\n Console.WriteLine(\"Mahmoud\");\n } else {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n if (n%2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n \n \n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MahmoudAndEhab\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _200501_Mahmoud_and_Ehab_and_the_even_odd_game\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n\n if (input % 2 == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n int n=Convert.ToInt32(Console.ReadLine());\n\n //--------------------------------solve--------------------------------//\n\n Console.WriteLine( n % 2 == 0 ? \"Mahmoud\" : \"Ehab\" );\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = int.Parse(Console.ReadLine());\n Console.WriteLine(input % 2 == 0 ? \"Mahmoud\" : \"Ehab\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n\n if ((n % 2) == 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n uint x = uint.Parse(Console.ReadLine());\n\n if (x % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(\"Mahmoud\");\n else\n Console.WriteLine(\"Ehab\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n if (n%2 != 0)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmoud\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n Console.Write(int.Parse(Console.ReadLine()) % 2 == 0?\"Mahmoud\": \"Ehab\");\n }\n }\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool result = false;\n int counter = 0;\n int n = int.Parse(Console.ReadLine());\n do\n {\n\n if(counter % 2 == 0)\n {\n if (n >= 2)\n {\n n -= 2;\n }\n else\n {\n Console.WriteLine(\"Ehab\");break;\n }\n\n }\n else\n {\n if (n >= 1)\n {\n n -= 1;\n }\n else { Console.WriteLine(\"Mahmud\");break; }\n }\n counter++;\n }\n while (true);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool result = false;\n int counter = 0;\n int n = int.Parse(Console.ReadLine());\n do\n {\n\n if(counter % 2 == 0)\n {\n if (n >= 2)\n {\n n -= 2;\n }\n else\n {\n Console.WriteLine(\"Ehab\");break;\n }\n\n }\n else\n {\n if (n >= 1)\n {\n n -= 1;\n }\n else { Console.WriteLine(\"Mahmoud\");break; }\n }\n counter++;\n }\n while (true);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp114\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), otv= 0, i = 1;\n string name = \"\";\n while (n > 0)\n {\n if (i % 2 == 0)\n {\n n -= 2;\n name = \"Mahmoud\";\n }\n else\n {\n n--;\n name = \"Ehab\";\n }\n i++;\n }\n Console.WriteLine(name);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n //---------------------------------------------------------------------\n long n = long.Parse(Console.ReadLine());\n bool turn = false /*\u041c\u0430\u0445\u043c\u0443\u0434*/;\n while(true)\n {\n if (!turn)\n {\n if (n - 2 >= 0) n -= 2;\n else\n {\n Console.WriteLine(\"Ehab\");\n return;\n }\n turn = true;\n }\n else\n {\n if (n - 1 >= 0) n--;\n else\n {\n Console.WriteLine(\"Mahmoud\");\n return;\n }\n turn = false;\n }\n }\n //---------------------------------------------------------------------\n /*int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\n //5\n //3 10 8 6 11\n //4\n //1\n //10\n //3\n //11\n\n //0\n //4\n //1\n //5\n\n x = new SortedSet(x).ToArray();\n int maxPrice = x[n - 1];\n n = x.Length;\n int[] dp = new int[maxPrice + 1];\n int c = 1;\n for (int i = 0; i < n; i++)\n dp[x[i]] = c++;\n\n for (int i = 1; i <= maxPrice; i++)\n dp[i] = Math.Max(dp[i], dp[i - 1]);\n\n int q = int.Parse(Console.ReadLine());\n for (int i = 0; i < q; i++)\n {\n long m = long.Parse(Console.ReadLine());\n if (m >= maxPrice)\n Console.WriteLine(dp[maxPrice]);\n else\n Console.WriteLine(dp[m]);\n }*/\n //---------------------------------------------------------------------\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n //int numberOfFig = Convert.ToInt32(Console.ReadLine());\n //var figures = new string[numberOfFig];\n //for (int i = 0; i < numberOfFig; i++)\n //{\n // figures[i] = Console.ReadLine();\n //}\n //var nums = Console.ReadLine().Split(' ');\n var num = Convert.ToInt32(Console.ReadLine());\n //Console.WriteLine(Check(Array.ConvertAll(nums, int.Parse)));\n Console.WriteLine(Check(num));\n }\n\n static string Check(int num)\n {\n\n\n if (num % 2 == 0)\n {\n return \"Maxmoud\";\n }\n\n return \"Ehab\";\n //bool maxmud = true;\n //while (true)\n //{\n // if (maxmud && num >= 2)\n // {\n // num %= 2;\n // maxmud = !maxmud;\n // }\n // else\n // {\n // return \"Ehab\";\n // }\n \n\n // if (!maxmud && num >= 1)\n // {\n // num -= 1;\n // maxmud = !maxmud;\n // }\n // else\n // {\n // return \"Mahmoud\";\n // }\n\n //}\n }\n }\n}\n\n \n\n "}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n //int numberOfFig = Convert.ToInt32(Console.ReadLine());\n //var figures = new string[numberOfFig];\n //for (int i = 0; i < numberOfFig; i++)\n //{\n // figures[i] = Console.ReadLine();\n //}\n //var nums = Console.ReadLine().Split(' ');\n var num = Convert.ToInt32(Console.ReadLine());\n //Console.WriteLine(Check(Array.ConvertAll(nums, int.Parse)));\n Console.WriteLine(Check(num));\n }\n\n static string Check(int num)\n {\n\n bool maxmud = true;\n while (true)\n {\n if (maxmud && num >= 2)\n {\n num -= 2;\n maxmud = !maxmud;\n }\n else\n {\n return \"Ehab\";\n }\n \n\n if (!maxmud && num >= 1)\n {\n num -= 1;\n maxmud = !maxmud;\n }\n else\n {\n return \"Maxmoud\";\n }\n\n }\n }\n }\n}\n\n \n\n "}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n //int numberOfFig = Convert.ToInt32(Console.ReadLine());\n //var figures = new string[numberOfFig];\n //for (int i = 0; i < numberOfFig; i++)\n //{\n // figures[i] = Console.ReadLine();\n //}\n //var nums = Console.ReadLine().Split(' ');\n var num = Convert.ToInt32(Console.ReadLine());\n //Console.WriteLine(Check(Array.ConvertAll(nums, int.Parse)));\n Console.WriteLine(Check(num));\n }\n\n static string Check(int num)\n {\n\n bool maxmud = true;\n while (true)\n {\n if (maxmud && num >= 2)\n {\n num -= 2;\n maxmud = !maxmud;\n }\n else\n {\n return \"Ehab\";\n }\n \n\n if (!maxmud && num >= 1)\n {\n num -= 1;\n maxmud = !maxmud;\n }\n else\n {\n return \"Mahmoud\";\n }\n\n }\n }\n }\n}\n\n \n\n "}, {"source_code": "using System;\nnamespace SortApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m=0;\n int e=1;\n int a=0;\n for(int i = n; i > 0; i=i-a)\n {\n if (e==1 & i>=2)\n {\n a = 2;\n m = 1;\n e = 0;\n }\n else \n {\n a=1;\n e = 1;\n m = 0;\n }\n }\n if(m==1)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n else\n {\n Console.WriteLine(\"Ehab\");\n }\n\n\n\n\n //Console.WriteLine();\n Console.Read();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n \n if ((n % 2) == 0)\n {\n Console.WriteLine(\"Ehab\");\n }\n else if ((n % 2) != 0)\n {\n Console.WriteLine(\"Mahmoud\");\n\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n\n if ((n % 2) == 0)\n {\n Console.WriteLine(\"Ehab\");\n }\n else if ((n % 2) != 0)\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int cnt = 2;\n while (n - 1 > 0 || n - 2 > 0)\n {\n n -= cnt;\n cnt = cnt % 2 + 1;\n }\n Console.Write(n == 1 ? \"Ehab\" : \"Mahmoud\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace AllTasksApplication\n{\n class Program\n {\n static int Mahmood = 2;\n static int Ehab = 3;\n\n static int failed(int dig, int plr)\n {\n\n if (plr == Mahmood)\n {\n for (int i = plr; i <= dig; i+=2)\n {\n if (dig % i == 0)\n {\n return failed(dig/i,Ehab);\n }\n }\n return plr;\n }\n else\n {\n for (int i = plr;i<=dig;i+=2)\n {\n if (dig % i == 0)\n {\n return failed(dig/i,Mahmood);\n }\n }\n return plr;\n }\n }\n\n\n static void Main(string[] args)\n {\n //mahmood - true - \u0447\u0435\u0442\u043d\u044b\u0439 - 2\n //ehab - false - \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0439 - 3\n int dig = int.Parse(Console.ReadLine());\n if (failed(dig, Mahmood) == Mahmood)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmood\");\n }\n\n\n\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace AllTasksApplication\n{\n class Program\n {\n static int Mahmood = 2;\n static int Ehab = 3;\n\n static int failed(int dig, int plr)\n {\n\n if (plr == Mahmood)\n {\n for (int i = plr; i <= dig; i+=2)\n {\n if (dig % i == 0)\n {\n return failed(dig/i,Ehab);\n }\n }\n return plr;\n }\n else\n {\n for (int i = plr;i<=dig;i+=2)\n {\n if (dig % i == 0)\n {\n return failed(dig/i,Mahmood);\n }\n }\n return plr;\n }\n }\n\n\n static void Main(string[] args)\n {\n //mahmood - true - \u0447\u0435\u0442\u043d\u044b\u0439 - 2\n //ehab - false - \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0439 - 3\n int dig = int.Parse(Console.ReadLine());\n if (failed(dig, Mahmood) == Mahmood)\n {\n Console.WriteLine(\"Ehab\");\n }\n else\n {\n Console.WriteLine(\"Mahmoud\");\n }\n\n\n\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF959a\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(\"Hello World!\");\n }\n }\n}\n"}], "src_uid": "5e74750f44142624e6da41d4b35beb9a"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\nclass Magatro\n{\n private int X1, Y1, X2, Y2, X, Y;\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n X1 = int.Parse(line[0]);\n Y1 = int.Parse(line[1]);\n X2 = int.Parse(line[2]);\n Y2 = int.Parse(line[3]);\n line = Console.ReadLine().Split(' ');\n X = int.Parse(line[0]);\n Y = int.Parse(line[1]);\n }\n\n public void Solve()\n {\n Scan();\n int xDist = Math.Abs(X2 - X1);\n int yDist = Math.Abs(Y2 - Y1);\n if ((xDist % X != 0)||(yDist%Y!=0))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int xx = xDist / X;\n int yy = yDist / Y;\n if (xx % 2 == yy % 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split(' ');\n long x1 = int.Parse(tokens[0]);\n long x2 = int.Parse(tokens[2]);\n long y1 = int.Parse(tokens[1]);\n long y2 = int.Parse(tokens[3]);\n tokens = Console.ReadLine().Split(' ');\n long x = int.Parse(tokens[0]);\n long y = int.Parse(tokens[1]);\n\n long a = Math.Abs(x2 - x1);\n long b = Math.Abs(y2 - y1);\n\n string res;\n bool c = (a % x) == 0;\n bool d = (b % y) == 0;\n long e = (a / x) % 2;\n long f = (b / y) % 2;\n if ( c && d && ( e == f ) ) res = \"YES\";\n else res = \"NO\";\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Treasure_Hunt\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long x1 = Next(), y1 = Next(), x2 = Next(), y2 = Next();\n long x = Next(), y = Next();\n\n\n if (Math.Abs(x1 - x2)%x == 0 && Math.Abs(y1 - y2)%y == 0)\n {\n if ((Math.Abs(x1 - x2)/x)%2 == (Math.Abs(y1 - y2)/y)%2)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Treasure_Hunt\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long x1 = Next(), y1 = Next(), x2 = Next(), y2 = Next();\n long x = Next(), y = Next();\n\n\n if (Math.Abs(x1 - x2)%x == 0 && Math.Abs(y1 - y2)%y == 0)\n {\n if ((Math.Abs(x1 - x2)/x)%2 == (Math.Abs(y1 - y2)/y)%2)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n\n }\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace _817A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input1 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int x1 = input1[0], y1 = input1[1], x2 = input1[2], y2 = input1[3];\n int[] input2 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int x = input2[0], y = input2[1];\n bool result = true;\n int xD = Math.Abs(x2 - x1), yD = Math.Abs(y2 - y1);\n if (xD % x != 0 || yD % y != 0)\n result = false;\n else\n {\n int xT = xD / x, yT = yD / y;\n if (xT % 2 != yT % 2)\n result = false;\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "#region Using Statements\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n public class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider\n {\n get\n {\n return CultureInfo.InvariantCulture;\n }\n }\n\n public Printer(Stream stream): base (stream, new UTF8Encoding(false, true))\n {\n }\n\n public Printer(Stream stream, Encoding encoding): base (stream, encoding)\n {\n }\n }\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n var in1 = ria();\n int fx = in1[0];\n int fy = in1[1];\n int tx = in1[2];\n int ty = in1[3];\n int targetx = tx - fx;\n int targety = ty - fy;\n var in2 = ria();\n int a = 0;\n int b = 0;\n if (targetx % in2[0] != 0 || targety % in2[1] != 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n a = targetx / in2[0];\n b = targety / in2[1];\n if ((a + b) % 2 == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(k);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static bool IsEven(int a)\n {\n return (a % 2) == 0;\n }\n\n static bool IsOdd(int a)\n {\n return !IsEven(a);\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n#region Libraries\n#region operation methods\n#endregion\n#region Operators\n#endregion\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n //var a = ReadLongs();\n //var b = a.ToList();\n //var first = b.Min();\n //b.Remove(first);\n //var sec = b.Min();\n //b.Remove(sec);\n //var third = b.Min();\n\n var a = ReadLongs();\n var b = ReadLongs();\n var xd = Math.Abs(a[0] - a[2]);\n var yd = Math.Abs(a[1] - a[3]);\n return xd % b[0] == 0 && yd % b[1] == 0 && (xd / b[0] + yd / b[1]) % 2 == 0 ? \"YES\" : \"NO\";\n }\n\n int BS(long[] a, int left, int right, long s)\n {\n if (right - left == 1)\n return left;\n var half = (left + right) / 2;\n if (Check(half, a, s))\n return BS(a, half, right, s);\n return BS(a, left, half, s);\n }\n\n bool Check(int k, long[] a, long s)\n {\n var newArr = new long[a.Length]; \n for (int i = 0; i < a.Length; i++)\n {\n newArr[i] = a[i] + ((long)k) * (i + 1);\n }\n Array.Sort(newArr);\n return newArr.Take(k).Sum() <= s;\n }\n\n double Dist(Point a, Point b, Point z)\n {\n return Math.Abs((b.y - a.y) * z.x - (b.x - a.x) * z.y + b.x * a.y - b.y * a.x) / Math.Sqrt((b.y - a.y) * (b.y - a.y) + (b.x - a.x) * (b.x - a.x));\n }\n\n }\n\n class Point\n {\n public double x { get; set; }\n public double y { get; set; }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var a = ReadLongs();\n var b = ReadLongs();\n var xd = Math.Abs(a[0] - a[2]);\n var yd = Math.Abs(a[1] - a[3]);\n return xd % b[0] == 0 && yd % b[1] == 0 && (xd / b[0] + yd / b[1]) % 2 == 0 ? \"YES\" : \"NO\";\n }\n\n int BS(long[] a, int left, int right, long s)\n {\n if (right - left == 1)\n return left;\n var half = (left + right) / 2;\n if (Check(half, a, s))\n return BS(a, half, right, s);\n return BS(a, left, half, s);\n }\n\n bool Check(int k, long[] a, long s)\n {\n var newArr = new long[a.Length]; \n for (int i = 0; i < a.Length; i++)\n {\n newArr[i] = a[i] + ((long)k) * (i + 1);\n }\n Array.Sort(newArr);\n return newArr.Take(k).Sum() <= s;\n }\n\n double Dist(Point a, Point b, Point z)\n {\n return Math.Abs((b.y - a.y) * z.x - (b.x - a.x) * z.y + b.x * a.y - b.y * a.x) / Math.Sqrt((b.y - a.y) * (b.y - a.y) + (b.x - a.x) * (b.x - a.x));\n }\n\n }\n\n class Point\n {\n public double x { get; set; }\n public double y { get; set; }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "using System;\n\nnamespace _817A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] splitStr = Console.ReadLine().Split(' ');\n int startX = int.Parse(splitStr[0]);\n int startY = int.Parse(splitStr[1]);\n int finishX = int.Parse(splitStr[2]);\n int finishY = int.Parse(splitStr[3]);\n string[] splitStrStep = Console.ReadLine().Split(' ');\n int stepX = int.Parse(splitStrStep[0]);\n int stepY = int.Parse(splitStrStep[1]);\n\n if (Math.Abs(finishX - startX)%stepX != 0 || Math.Abs(finishY - startY)%stepY != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n int countStepX = Math.Abs(finishX - startX) / stepX;\n int countStepY = Math.Abs(finishY - startY) / stepY;\n if (countStepX%2 == countStepY%2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n Console.ReadLine();\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n List cord = Console.ReadLine().Split().Select(item=>double.Parse(item)).ToList();\n List step = Console.ReadLine().Split().Select(item=>double.Parse(item)).ToList();\n Func LeftO = y1 => (y1 - cord[1]) / step[1];\n double y = 0.5 * step[1] * ((cord[2] - cord[0])/step[0] + (cord[1] + cord[3]) / step[1]);\n double x = LeftO(y) * step[0] + cord[0];\n bool res = Math.Truncate(x) == x && Math.Truncate(y) == y;\n if (res)\n {\n res = (Math.Abs(x-cord[0])%step[0] == 0) && (Math.Abs(y - cord[1]) % step[1] == 0);\n res = res && (Math.Abs(x - cord[2]) % step[0] == 0) && (Math.Abs(y - cord[3]) % step[1] == 0);\n }\n Console.WriteLine(res ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\nclass Magatro\n{\n private int XOne, YOne, XTwo, YTwo, X, Y;\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n XOne = int.Parse(line[0]);\n YOne = int.Parse(line[1]);\n XTwo = int.Parse(line[2]);\n YTwo = int.Parse(line[3]);\n line = Console.ReadLine().Split(' ');\n X = int.Parse(line[0]);\n Y = int.Parse(line[1]);\n }\n\n public void Solve()\n {\n Scan();\n int xDist = Math.Abs(XTwo - XOne);\n int yDist = Math.Abs(YTwo - YOne);\n if ((xDist % X != 0)||(yDist%Y!=0))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int xx = xDist / X;\n int yy = yDist / Y;\n if (xx % 2 == yy % 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\nclass Magatro\n{\n private int X1, Y1, X2, Y2, X, Y;\n private void Scan()\n {\n var line = Console.ReadLine().Split(' ');\n X1 = int.Parse(line[0]);\n Y1 = int.Parse(line[1]);\n X2 = int.Parse(line[2]);\n Y2 = int.Parse(line[3]);\n line = Console.ReadLine().Split(' ');\n X = int.Parse(line[0]);\n Y = int.Parse(line[1]);\n }\n\n public void Solve()\n {\n Scan();\n int xDist = Math.Abs(X2 - X1);\n int yDist = Math.Abs(Y2 - Y1);\n if ((xDist % X != 0)||(yDist%Y!=0))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int xx = xDist / X;\n int yy = yDist / Y;\n if (xx % 2 == yy % 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int x1, y1, x2, y2,x,y;\n sc.Make(out x1, out y1, out x2, out y2, out x, out y);\n if (Abs(x2 - x1) % x != 0 || Abs(y2 - y1) % y != 0) Fail(\"NO\");\n var a = Abs(x2 - x1) / x;\n var b = Abs(y2 - y1) / y;\n if (a % 2 == b % 2) Fail(\"YES\");\n Console.WriteLine(\"NO\");\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class ADiv2\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int x1 = int.Parse(token[0]);\n int y1 = int.Parse(token[1]);\n int x2 = int.Parse(token[2]);\n int y2 = int.Parse(token[3]);\n \n string[] token2 = Console.ReadLine().Split();\n int x = int.Parse(token2[0]);\n int y = int.Parse(token2[1]);\n \n int xDis = Math.Abs(x2-x1);\n int yDis = Math.Abs(y2-y1);\n \n if (xDis % x != 0||yDis % y!=0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int xx = xDis / x;\n int yy = yDis / y;\n if (xx % 2 == yy % 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n \n}"}, {"source_code": "/* Date: 16.06.2017 * Time: 21:45 */\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n*/\n\nusing System;\nusing System.IO;\nusing System.Globalization;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ONLINE_JUDGE )\n\n# else\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2017\\\\Task\\\\07 Codeforces\\\\024\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2017\\\\Task\\\\07 Codeforces\\\\024\\\\A.OUT\");\n//\t\tStreamReader sr = new StreamReader (\"E:\\\\TRR\\\\20170422\\\\A.TXT\");\n//\t\tStreamWriter sw = new StreamWriter (\"E:\\\\TRR\\\\20170422\\\\A.OUT\");\n# endif\n\n\t\tstring ss;\n\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n\t\tsw.WriteLine (ss);\n# endif\n\n\t\tstring [] s = ss.Split (' ');\n\t\tint x1 = int.Parse (s [0]);\n\t\tint y1 = int.Parse (s [1]);\n\t\tint x2 = int.Parse (s [2]);\n\t\tint y2 = int.Parse (s [3]);\n\n# if ( ONLINE_JUDGE )\n\t\tss = Console.ReadLine ();\n# else\n\t\tss = sr.ReadLine ();\n\t\tsw.WriteLine (ss);\n# endif\n\n\t\tstring [] s0 = ss.Split (' ');\n\t\tint x = int.Parse (s0 [0]);\n\t\tint y = int.Parse (s0 [1]);\n\n\t\tint kx = (Math.Abs (x1 - x2)) / x;\n\t\tint ky = (Math.Abs (y1 - y2)) / y;\n\t\tbool ok = (Math.Abs (x1 - x2)) % x == 0 && (Math.Abs (y1 - y2)) % y == 0 && (Math.Abs (kx - ky)) % 2 == 0;\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tif ( ok )\n\t\t\tConsole.WriteLine (\"YES\");\n\t\telse\n\t\t\tConsole.WriteLine (\"NO\");\n# else\n\t\tif ( ok )\n\t\t\tsw.WriteLine (\"YES\");\n\t\telse\n\t\t\tsw.WriteLine (\"NO\");\n\t\tsw.Close ();\n# endif\n\t\t\n\t}\n}\n"}, {"source_code": "\ufeff\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArrayOfInt32();\n\t\t\tvar x1 = input[0];\n\t\t\tvar y1 = input[1];\n\t\t\tvar x2 = input[2];\n\t\t\tvar y2 = input[3];\n\t\t\tinput = sr.ReadArrayOfInt32();\n\t\t\tvar x = input[0];\n\t\t\tvar y = input[1];\n\t\t\tvar dx = Math.Abs(x2 - x1);\n\t\t\tvar dy = Math.Abs(y2 - y1);\n\t\t\tvar rx = dx / x;\n\t\t\tif (dx % x != 0)\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar ry = dy / y;\n\t\t\tif (dy % y != 0)\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//if (rx == 0 || ry == 0)\n\t\t\t//{\n\t\t\t//\tsw.WriteLine(\"YES\");\n\t\t\t//\treturn;\n\t\t\t//}\n\t\t\tif (Math.Abs(rx - ry) % 2 == 0) {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic int[] ReadArrayOfInt32()\n\t{\n\t\treturn ReadArray(Int32.Parse);\n\t}\n\n\tpublic long[] ReadArrayOfInt64()\n\t{\n\t\treturn ReadArray(Int64.Parse);\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Chloe_and_the_Sequence\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x1, y1, x2, y2, x3, y3;\n string[] input = Console.ReadLine().Split(' ');\n x1 = int.Parse(input[0]);\n y1 = int.Parse(input[1]);\n x2 = int.Parse(input[2]);\n y2 = int.Parse(input[3]);\n string[] input2 = Console.ReadLine().Split(' ');\n x3 = int.Parse(input2[0]);\n y3 = int.Parse(input2[1]);\n if (Math.Abs(x2 - x1) % x3 == 0 && Math.Abs(y2 - y1) % y3 == 0 && Math.Abs(Math.Abs(x2 - x1) / x3 - Math.Abs(y2 - y1) / y3) % 2 == 0)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _4032\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node : IComparable\n {\n public long X { get; set; }\n public long Y { get; set; }\n public int CompareTo(object obj)\n {\n if (this.Y > ((Node)obj).Y)\n {\n return 1;\n }\n if (this.Y == ((Node)obj).Y)\n {\n return 0;\n }\n return -1;\n }\n }\n\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var x1 = data[0];\n var y1 = data[1];\n var x2 = data[2];\n var y2 = data[3];\n data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var x = data[0];\n var y = data[1];\n\n for (var i = 0; i < 100000 * 5; i++)\n {\n if (x2 > x1)\n {\n x1 += x;\n }\n else\n {\n x1 -= x;\n }\n\n if (y2 > y1)\n {\n y1 += y;\n }\n else\n {\n y1 -= y;\n }\n\n if (y1 == y2 && x1 == x2)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HayCragrer\n{\n class Problem4\n {\n static void Main(string[] args)\n {\n int[] coords = new int[4];\n string[] text = Console.ReadLine().Split();\n string[] text1 = Console.ReadLine().Split();\n int[] steps = new int[2];\n for (int i = 0; i < 4; i++)\n {\n coords[i] = int.Parse(text[i]);\n }\n for (int i = 0; i < 2; i++)\n {\n steps[i] = int.Parse(text1[i]);\n }\n int x = coords[2] - coords[0];\n int y = coords[3] - coords[1];\n if ((x % steps[0] == 0) && (y % steps[1] == 0))\n {\n if ((x / steps[0] -y / steps[1]) % 2==0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class P817A\n {\n static void Main(string[] args)\n {\n string[] input1 = Console.ReadLine().Split();\n int x1 = int.Parse(input1[0]);\n int y1 = int.Parse(input1[1]);\n int x2 = int.Parse(input1[2]);\n int y2 = int.Parse(input1[3]);\n string[] input2 = Console.ReadLine().Split();\n int x = int.Parse(input2[0]);\n int y = int.Parse(input2[1]);\n Console.WriteLine((Math.Abs(x1 - x2) % x == 0 && Math.Abs(y1 - y2) % y == 0 && (Math.Abs(x1 - x2) / x) % 2 == (Math.Abs(y1 - y2) / y) % 2) ? \"YES\" : \"NO\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeff\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArrayOfInt32();\n\t\t\tvar x1 = input[0];\n\t\t\tvar y1 = input[1];\n\t\t\tvar x2 = input[2];\n\t\t\tvar y2 = input[3];\n\t\t\tinput = sr.ReadArrayOfInt32();\n\t\t\tvar x = input[0];\n\t\t\tvar y = input[1];\n\t\t\tvar dx = Math.Abs(x2 - x1);\n\t\t\tvar dy = Math.Abs(y2 - y1);\n\t\t\tvar rx = dx / x;\n\t\t\tif (dx % x != 0)\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar ry = dy / y;\n\t\t\tif (dy % y != 0)\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rx == 0 || ry == 0)\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (Math.Abs(rx - ry) % 2 == 0) {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic int[] ReadArrayOfInt32()\n\t{\n\t\treturn ReadArray(Int32.Parse);\n\t}\n\n\tpublic long[] ReadArrayOfInt64()\n\t{\n\t\treturn ReadArray(Int64.Parse);\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeff\ufeffusing System;\n\ufeffusing System.Collections.Generic;\n\ufeffusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\n\ufeffusing System.Text;\n\nnamespace CF\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t{\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\")) {\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArrayOfInt32();\n\t\t\tvar x1 = input[0];\n\t\t\tvar y1 = input[1];\n\t\t\tvar x2 = input[2];\n\t\t\tvar y2 = input[3];\n\t\t\tinput = sr.ReadArrayOfInt32();\n\t\t\tvar x = input[0];\n\t\t\tvar y = input[1];\n\t\t\tvar dx = Math.Abs(x2 - x1);\n\t\t\tvar dy = Math.Abs(y2 - y1);\n\t\t\tvar rx = dx / x;\n\t\t\tif (dx%x != 0) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar ry = dy / y;\n\t\t\tif (dy%y != 0) {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rx == ry || (rx == 0 || ry == 0)) {\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t\t\t\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tpublic int[] ReadArrayOfInt32()\n\t{\n\t\treturn ReadArray(Int32.Parse);\n\t}\n\n\tpublic long[] ReadArrayOfInt64()\n\t{\n\t\treturn ReadArray(Int64.Parse);\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\t\t\t\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _4032\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n class Node : IComparable\n {\n public long X { get; set; }\n public long Y { get; set; }\n public int CompareTo(object obj)\n {\n if (this.Y > ((Node)obj).Y)\n {\n return 1;\n }\n if (this.Y == ((Node)obj).Y)\n {\n return 0;\n }\n return -1;\n }\n }\n\n static void Main(String[] args)\n {\n var data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var x1 = data[0];\n var y1 = data[1];\n var x2 = data[2];\n var y2 = data[3];\n data = Console.ReadLine().TrimEnd().Split(' ').Select(double.Parse).ToList();\n var x = data[0];\n var y = data[1];\n\n double k1 = (x2 - x1) / x;\n double k2 = (y2 - y1) / y;\n\n if(k1 % 1 ==0 && k2 % 1== 0 && k1%2==k2%2)\n {\n Console.WriteLine(\"YES\");\n } else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HayCragrer\n{\n class Problem4\n {\n static void Main(string[] args)\n {\n int[] coords = new int[4];\n string[] text = Console.ReadLine().Split();\n string[] text1 = Console.ReadLine().Split();\n int[] steps = new int[2];\n for (int i = 0; i < 4; i++)\n {\n coords[i] = int.Parse(text[i]);\n }\n for (int i = 0; i < 2; i++)\n {\n steps[i] = int.Parse(text1[i]);\n }\n int x = coords[2] - coords[0];\n int y = coords[3] - coords[1];\n if ((x % steps[0] == 0) && (y % steps[1] == 0))\n {\n if ((x / steps[0] -y / steps[1]) % 2==0)\n {\n Console.WriteLine(\"YES\");\n }\n \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HayCragrer\n{\n class Problem4\n {\n static void Main(string[] args)\n {\n int [] coords = new int [4];\n string[] text = Console.ReadLine().Split();\n string[] text1 = Console.ReadLine().Split();\n int[] steps = new int[2];\n for (int i = 0; i < 4; i++)\n {\n coords[i] = int.Parse(text[i]);\n }\n for (int i = 0; i < 2; i++)\n {\n steps[i] = int.Parse(text1[i]);\n }\n if (((coords[2]-coords[0])%steps[0]==0) && ((coords[3] - coords[1])%steps[1] == 0))\n {\n if (coords[2] / steps[0] % 2 == coords[3] / steps[1] % 2)\n {\n Console.WriteLine(\"YES\");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n List cord = Console.ReadLine().Split().Select(item=>int.Parse(item)).ToList();\n List step = Console.ReadLine().Split().Select(item=>int.Parse(item)).ToList();\n Func LeftO = y1 => (y1 - cord[1]) / step[1];\n double y = 0.5 * step[1] * ((cord[2] - cord[0])/step[0] + (cord[1] + cord[3]) / step[1]);\n double x = LeftO(y) * step[0] + cord[0];\n bool res = Math.Truncate(x) == x && Math.Truncate(y) == y;\n if (res)\n {\n res = (Math.Abs(x-cord[0])%step[0] == 0) && (Math.Abs(y - cord[1]) % step[1] == 0);\n res = res && (Math.Abs(x - cord[2]) % step[0] == 0) && (Math.Abs(y - cord[3]) % step[1] == 0);\n }\n Console.WriteLine(res ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int x1 =int.Parse(token[0]);\n int y1 = int.Parse(token[1]);\n int x2 = int.Parse(token[2]);\n int y2 = int.Parse(token[3]);\n \n string[] token2 = Console.ReadLine().Split();\n int x = int.Parse(token2[0]);\n int y = int.Parse(token2[1]);\n string s = \"YES\";\n if(x==x1||x==x2||y==y1||y==y2)\n {\n s = \"NO\";\n }\n Console.WriteLine(s);\n \n }\n \n }\n}\n \n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int x1 =int.Parse(token[0]);\n int y1 = int.Parse(token[1]);\n int x2 = int.Parse(token[2]);\n int y2 = int.Parse(token[3]);\n \n string[] token2 = Console.ReadLine().Split();\n int x = int.Parse(token2[0]);\n int y = int.Parse(token2[1]);\n \n if((x1-x2)%x==0&&(y1-y2)%y==0&&((x1-x2)/x)%2==((y1-y2)/y)%2)\n {\n Console.WriteLine(\"YES\");\n }else{\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n}\n \n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int x1 =int.Parse(token[0]);\n int y1 = int.Parse(token[1]);\n int x2 = int.Parse(token[2]);\n int y2 = int.Parse(token[3]);\n \n string[] token2 = Console.ReadLine().Split();\n int x = int.Parse(token2[0]);\n int y = int.Parse(token2[1]);\n string s = \"YES\";\n \n int X1 = x - x1;\n int Y1 = y - y1;\n int X2 = x2 - x;\n int Y2 = y2 - y;\n \n if(X1==0||X2==0||Y2==0||Y1==0)\n {\n s = \"NO\";\n }\n \n Console.WriteLine(s);\n \n }\n \n }\n}\n \n"}, {"source_code": "#region Using Statements\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n public class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider\n {\n get\n {\n return CultureInfo.InvariantCulture;\n }\n }\n\n public Printer(Stream stream): base (stream, new UTF8Encoding(false, true))\n {\n }\n\n public Printer(Stream stream, Encoding encoding): base (stream, encoding)\n {\n }\n }\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n var in1 = ria();\n int fx = in1[0];\n int fy = in1[1];\n int tx = in1[2];\n int ty = in1[3];\n int targetx = tx - fx + 1000000;\n int targety = ty - fy + 1000000;\n var in2 = ria();\n int a = 0;\n int b = 0;\n while (targetx > 0)\n {\n targetx -= in2[0];\n a++;\n }\n\n while (targety > 0)\n {\n targety -= in2[1];\n b++;\n }\n\n if ((a + b) % 2 == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Trim(' ').Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(k);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static bool IsEven(int a)\n {\n return (a % 2) == 0;\n }\n\n static bool IsOdd(int a)\n {\n return !IsEven(a);\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n#region Libraries\n#region operation methods\n#endregion\n#region Operators\n#endregion\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "using System;\n\nnamespace _817A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] splitStr = Console.ReadLine().Split(' ');\n int startX = int.Parse(splitStr[0]);\n int startY = int.Parse(splitStr[1]);\n int finishX = int.Parse(splitStr[2]);\n int finishY = int.Parse(splitStr[2]);\n string[] splitStrStep = Console.ReadLine().Split(' ');\n int stepX = int.Parse(splitStrStep[0]);\n int stepY = int.Parse(splitStrStep[1]);\n\n if (Math.Abs(finishX - startX)%stepX != 0 || Math.Abs(finishY - startY)%stepY != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n int countStepX = Math.Abs(finishX - startX) / stepX;\n int countStepY = Math.Abs(finishY - startY) / stepY;\n if (countStepX%2 == countStepY%2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n Console.ReadLine();\n\n \n }\n }\n}\n"}], "src_uid": "1c80040104e06c9f24abfcfe654a851f"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PalindromeDance\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int DANCER_WITH_WHITE_SUIT = 0;\n const int DANCER_WITH_BLACK_SUIT = 1;\n const int DANCER_WITH_UNKNOWN_SUIT = 2;\n\n //\n string[] inputs = Console.ReadLine().Split(' ');\n int n = int.Parse(inputs[0]);\n int PriceWhiteSuit = int.Parse(inputs[1]);\n int PriceBlackSuit = int.Parse(inputs[2]);\n\n string[] inputsDancers = Console.ReadLine().Split(' ');\n int[] Dancers = Array.ConvertAll(inputsDancers, x => int.Parse(x));\n int result = 0;\n for (int i = 0; i < n / 2 && result != -1; i++)\n {\n if (Dancers[i] != Dancers[n - i - 1] && Dancers[i] != DANCER_WITH_UNKNOWN_SUIT && Dancers[n - i - 1] != DANCER_WITH_UNKNOWN_SUIT)\n {\n result = -1;\n }\n else\n {\n if (Dancers[i] != Dancers[n - i - 1])\n {\n if (Dancers[i] == DANCER_WITH_BLACK_SUIT)\n result += PriceBlackSuit;\n\n if (Dancers[i] == DANCER_WITH_WHITE_SUIT)\n result += PriceWhiteSuit;\n\n if (Dancers[n - i - 1] == DANCER_WITH_BLACK_SUIT)\n result += PriceBlackSuit;\n\n if (Dancers[n - i - 1] == DANCER_WITH_WHITE_SUIT)\n result += PriceWhiteSuit;\n }\n else\n {\n if (Dancers[i] == Dancers[n - i - 1] && Dancers[n - i - 1] == DANCER_WITH_UNKNOWN_SUIT)\n {\n if (PriceWhiteSuit < PriceBlackSuit)\n {\n result += 2 * PriceWhiteSuit;\n }\n else\n {\n result += 2 * PriceBlackSuit;\n }\n }\n }\n }\n }\n\n if(n%2 != 0 && Dancers[n/2] == DANCER_WITH_UNKNOWN_SUIT && result != -1)\n {\n if(PriceWhiteSuit < PriceBlackSuit)\n {\n result += PriceWhiteSuit;\n }\n else\n {\n result += PriceBlackSuit;\n }\n }\n\n Console.WriteLine(result);\n \n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\npublic class Solution\n{\n static void Main(String[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n int[] d = new int[n];\n input = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n d[i] = int.Parse(input[i]);\n }\n int[] c = new int[n];\n for (int i = 0; i < n; i++)\n {\n if (d[i] == 2)\n {\n int j = n - i - 1;\n if (d[j] == 0)\n {\n d[i] = 0;\n c[i] = a;\n }\n else if (d[j] == 1)\n {\n d[i] = 1;\n c[i] = b; \n }\n else if (d[j] == 2)\n {\n if (a > b)\n {\n d[i] = 1;\n d[j] = 1;\n c[i] = b;\n c[j] = b;\n }\n else\n {\n d[i] = 0;\n d[j] = 0;\n c[i] = a;\n c[j] = a;\n }\n }\n }\n else if (d[i] == 1 && d[n - i - 1] == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n int cost = 0;\n for (int i = 0; i < n; i++)\n {\n cost += c[i];\n }\n Console.WriteLine(cost);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0422\u0430\u043d\u0435\u0446_\u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res = 0;\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n int n = int.Parse(values[0]);\n int a = int.Parse(values[1]);\n int b = int.Parse(values[2]);\n s = Console.ReadLine();\n string[] values2 = s.Split(' ');\n int[] arr = new int[n];\n for (int i=0; ib)\n {\n min = b;\n }\n int x = 0;\n if (n%2==1)\n {\n x = n / 2 + 1;\n }\n else\n {\n x = n / 2;\n }\n for (int i = 0; i < x; i++)\n {\n if (arr[i]==arr[n-1-i])\n {\n if(arr[i]==2)\n {\n if (i == x - 1)\n if (n==2)\n {\n res = res + 2 * min;\n }else{\n res = res + min;\n }\n else\n res = res + 2 * min;\n }\n }\n else\n {\n if(((arr[i]==0)&&(arr[n-1-i]==2))||((arr[n-1-i]==0)&&(arr[i]==2)))\n {\n res = res + a;\n }\n else if(((arr[i] == 1) && (arr[n - 1 - i] == 2)) || ((arr[n - 1 - i] == 1) && (arr[i] == 2)))\n {\n res = res + b;\n\n }\n else\n {\n res = -1;\n break;\n }\n }\n }\n Console.WriteLine(res);\n \n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExA\n{\n class Program\n {\n const int WHITE = 0, BLACK = 1, UNKNOWN = 2;\n\n static void Main(string[] args)\n {\n int n, a, b;\n int res = 0;\n\n \n\n var vals = Console.ReadLine().Split();\n n = int.Parse(vals[0]);\n a = int.Parse(vals[1]);\n b = int.Parse(vals[2]);\n\n bool notApolindrom = false;\n\n var numbers = Console.ReadLine().Split();\n for (int i = 0; i < n / 2; i++)\n {\n int n1 = int.Parse(numbers[i]);\n int n2 = int.Parse(numbers[n - i - 1]);\n\n if (n1 == UNKNOWN && n2 != UNKNOWN)\n {\n res += GetCost(n2, a, b);\n }\n else if (n2 == UNKNOWN && n1 != UNKNOWN)\n {\n res += GetCost(n1, a, b);\n }\n else if (n1 == UNKNOWN && n2 == UNKNOWN)\n {\n res += Math.Min(a, b) * 2;\n }\n if (n1 != UNKNOWN && n2 != UNKNOWN && n1 != n2)\n {\n notApolindrom = true;\n break;\n }\n }\n\n if (!notApolindrom)\n {\n if (n % 2 != 0 && int.Parse(numbers[n / 2]) == UNKNOWN)\n {\n res += Math.Min(a, b);\n }\n }\n else\n {\n res = -1;\n }\n\n Console.WriteLine(res);\n }\n\n static int GetCost(int costume, int a, int b)\n {\n if (costume == WHITE)\n return a;\n else if (costume == BLACK)\n return b;\n else\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Palindrome_Dance\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve());\n writer.Flush();\n }\n\n private static int Solve()\n {\n int n = Next();\n int a = Next();\n int b = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n int ans = 0;\n for (int i = 0, j = n - 1; i <= j; i++, j--)\n {\n if (i == j)\n {\n if (nn[i] == 2)\n ans += Math.Min(a, b);\n }\n else\n {\n if (nn[i] != 2 && nn[j] != 2)\n {\n if (nn[i] != nn[j])\n return -1;\n }\n else\n {\n if (nn[i] != 2)\n {\n ans += nn[i] == 0 ? a : b;\n }\n else if (nn[j] != 2)\n {\n ans += nn[j] == 0 ? a : b;\n }\n else\n {\n ans += 2*Math.Min(a, b);\n }\n }\n }\n }\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i, n, w, b; // n number of dancers, w cost of white suits, b cost of black suits\n string input = Console.ReadLine();\n string[] split = input.Split();\n n = Convert.ToInt32(split[0]);\n w = Convert.ToInt32(split[1]);\n b = Convert.ToInt32(split[2]);\n string input2 = Console.ReadLine();\n string[] split2 = input2.Split();\n int[] a = new int[split2.Length];\n for (i = 0; i < split2.Length; i++) {\n a[i] = Convert.ToInt32(split2[i]);\n }\n int j = 0;\n bool same = false;\n for (i = 0; i < n / 2; i ++) {\n int l = a[i];\n int r = a[n - i - 1];\n if (l == 2 && r == 2)\n {\n j += Math.Min(w*2, b*2);\n }\n if (l == 0 && r == 1)\n {\n same = true;\n }\n if (l == 1 && r == 0)\n {\n same = true;\n }\n if (l == 2 && r == 0)\n {\n j += w;\n }\n if (l == 0 && r == 2)\n {\n j += w;\n }\n if (l == 1 && r == 2)\n {\n j += b;\n }\n if (l == 2 && r == 1)\n {\n j += b;\n }\n\n\n }\n if (n % 2 == 1) {\n if (a[n / 2] == 2) {\n j += Math.Min(w, b);\n }\n }\n if (same)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(j);\n }\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\n using System.Collections.Generic;\n using System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 32 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else \n Run();\n#endif \n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var a = sr.NextInt32();\n var b = sr.NextInt32();\n var numbers = sr.ReadArrayOfInt32();\n var cost = 0;\n var mid = n / 2;\n for (var i = 0; i < mid; i++) {\n if (numbers[i] == 2 || numbers[n - i - 1] == 2) {\n if (numbers[i] == 2 && numbers[n - i - 1] == 2) {\n cost += 2*Math.Min(a, b);\n }\n else {\n if (numbers[i] == 2) {\n if (numbers[n - i - 1] == 0) {\n cost += a;\n }\n else {\n cost += b;\n }\n }\n else {\n if (numbers[i] == 0) {\n cost += a;\n }\n else {\n cost += b;\n }\n }\n }\n }\n else {\n if (numbers[i] != numbers[n - i - 1]) {\n sw.WriteLine(-1);\n return;\n }\n }\n }\n\n if (n % 2 == 1) {\n if (numbers[mid] == 2) {\n cost += Math.Min(a, b);\n }\n }\n\n sw.WriteLine(cost);\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\nclass Graph\n{\n private readonly List[] edges;\n\n public Graph(int n)\n {\n edges = new List[n];\n }\n\n public void Insert(int x, int y)\n {\n if (edges[x] == null) {\n edges[x] = new List();\n }\n\n edges[x].Add(y);\n if (edges[y] == null) {\n edges[y] = new List();\n }\n\n edges[y].Add(x);\n }\n\n public int Solution()\n {\n var compS = 0;\n var visited = new bool[edges.Length];\n for (var i = 0; i < edges.Length; i++) {\n if (!visited[i]) {\n compS++;\n DfsVisit(i, visited);\n }\n }\n\n return compS - 1;\n }\n\n private void DfsVisit(int v, bool[] visited)\n {\n visited[v] = true;\n if (edges[v] != null) {\n for (var u = 0; u < edges[v].Count; u++) {\n if (!visited[edges[v][u]]) {\n DfsVisit(edges[v][u], visited);\n }\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), white = long.Parse(input[1]), black = long.Parse(input[2]), price=0, currLeft, currRight;\n bool well = true;\n\n string[] dancers = Console.ReadLine().Split(' ');\n if(n%2 ==1)\n {\n if(long.Parse(dancers[n/2]) ==2)\n {\n if (white > black)\n {\n price += black;\n }\n else\n {\n price += white;\n }\n }\n }\n\n for (int i = 0; i < n/2; i++)\n {\n currLeft = long.Parse(dancers[i]);\n currRight = long.Parse(dancers[n - i - 1]);\n if(currLeft!= currRight && ( currLeft!=2&&currRight!=2 ) )\n {\n well = false;\n break;\n }\n else if(currLeft != 2 && currRight != 2)\n {\n \n }\n else if(currRight == 2 || currLeft ==2)\n {\n if (currLeft == 0 || currRight == 0)\n {\n price += white;\n }\n else if (currLeft == 1 || currRight == 1)\n {\n price += black;\n }\n else\n {\n if (white > black)\n price += 2*black;\n else\n price += 2*white;\n }\n }\n else\n {\n if (currLeft == 0 || currRight == 0)\n {\n price += 2*white;\n }\n else if (currLeft == 1 || currRight == 1)\n {\n price += 2*black;\n }\n }\n \n }\n\n if(well)\n {\n Console.WriteLine(price);\n }\n else\n {\n Console.WriteLine(-1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ACM\n{\n class Program\n {\n //1040A\n static void Main()\n {\n int n, a, b;\n int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n n = input[0];\n a = input[1];//0 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u0435\u043b\u043e\u043c\u0443 \u043a\u043e\u0441\u0442\u044e\u043c\u0443, 1 \u2014 \u0447\u0451\u0440\u043d\u043e\u043c\u0443\n b = input[2];\n int sum = 0;\n int minType, minValue;\n if (a < b)\n {\n minType = 0;\n minValue = a;\n }\n else\n {\n minType = 1;\n minValue = b;\n }\n int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (arr.Length % 2 == 1 && arr[arr.Length / 2] == 2)\n {\n arr[arr.Length / 2] = minType;\n sum += minValue;\n }\n if (arr.Length == 1)\n {\n Console.WriteLine(sum);\n return;\n }\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] == arr[arr.Length - i - 1])\n {\n if (arr[i] == 2)\n {\n arr[i] = minType;\n arr[arr.Length - i - 1] = minType;\n sum += minValue * 2;\n }\n }\n else\n {\n if (arr[i] == 2)\n {\n arr[i] = arr[arr.Length - i - 1];\n if (arr[arr.Length - i - 1] == 0)\n {\n sum += a;\n }\n else\n {\n sum += b;\n }\n }\n else\n if (arr[arr.Length - i - 1] == 2)\n {\n arr[arr.Length - i - 1] = arr[i];\n if (arr[i] == 0)\n {\n sum += a;\n }\n else\n {\n sum += b;\n }\n }\n else\n {\n Console.WriteLine(-1);\n return;\n }\n }\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = input[0];\n var a = input[1];\n var b = input[2];\n var row = Console.ReadLine().Split();\n var result = 0;\n for (var i = 0; i < n; i++)\n {\n if (n - 1 - i - i <= 0)\n {\n if (n - 1 - i - i == 0)\n if (row[i] == \"2\")\n result += Math.Min(a, b);\n Console.WriteLine(result);\n break;\n }\n if (row[i] == row[n - 1 - i] && row[i] != \"2\")\n {\n continue;\n }\n else\n {\n if (row[i] == \"2\" || row[n - 1 - i] == \"2\")\n {\n if (row[i] == \"2\" && row[n - 1 - i] == \"2\")\n {\n result += Math.Min(a, b) * 2;\n continue;\n }\n else\n {\n if (row[i] == \"0\" || row[n - 1 - i] == \"0\")\n result += a;\n else\n result += b;\n }\n }\n else\n {\n Console.WriteLine(-1);\n break;\n }\n } \n }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace someSHIT\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split();\n int N = int.Parse(inp[0]);\n int a = int.Parse(inp[1]);\n int b = int.Parse(inp[2]);\n int min = Math.Min(a, b);\n string[] data = Console.ReadLine().Split();\n int i = 0, j = N - 1;\n int Cost = 0;\n while(i<= j)\n {\n if (i == j && data[i] == \"2\")\n Cost += min;\n else if (data[i] == \"2\" && data[j] == \"0\" || data[i] == \"0\" && data[j] == \"2\")\n Cost += a;\n else if (data[i] == \"2\" && data[j] == \"1\" || data[i] == \"1\" && data[j] == \"2\")\n Cost += b;\n else if (data[i] == \"2\" && data[j] == \"2\")\n Cost += min*2;\n else if(data[i] != data[j])\n {\n Console.WriteLine(-1);\n return;\n }\n i++;j--;\n }\n Console.WriteLine(Cost);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace SecTry_1040AF\n{\n class Program\n {\n static void Main(string[] args)\n {\n IEnumerable container = Console.ReadLine().Split().Select(int.Parse);\n int n = container.ElementAt(0), whiteCost = container.ElementAt(1), blackCost = container.ElementAt(2), ans = 0;\n List line = Console.ReadLine().Split().Select(int.Parse).ToList();\n\n\n\n for (int i = 0, j = line.Count - 1; i <= j; i++, j--)\n {\n if (i == j && line[i] == 2) ans += Math.Min(whiteCost, blackCost);\n else if (line[i] != 2 && line[j] == 2) ans += line[i] == 0 ? whiteCost : blackCost;\n else if (line[i] == 2 && line[j] != 2) ans += line[j] == 0 ? whiteCost : blackCost;\n else if (line[i] == 2 && line[j] == 2) ans += Math.Min(blackCost, whiteCost)*2;\n else if (line[i] != line[j])\n {\n ans = -1;\n break;\n }\n\n\n }\n\n\n Console.WriteLine(ans);\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_1040_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[]s=Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n\n int[] c = new int[n];\n s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n c[i] = int.Parse(s[i]);\n }\n\n int ans = 0;\n for (int i = 0, j=n-1; i < n/2; i++, j--)\n {\n if( c[i]==0 && c[j]==1 ||\n c[i]==1 && c[j]==0)\n {\n Console.WriteLine(-1);\n return;\n }\n if(c[i]==2 && c[j]==2)\n {\n ans += Math.Min(a, b)*2;\n }\n if( c[i]==0 && c[j]==2 ||\n c[i]==2 && c[j]==0)\n {\n ans += a;\n }\n if (c[i] == 1 && c[j] == 2 ||\n c[i] == 2 && c[j] == 1)\n {\n ans += b;\n }\n }\n\n // \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u0434\u0435\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e\n if (n % 2 == 1 && c[n / 2] == 2)\n ans += Math.Min(a, b);\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine();\n string[] m = inp.Split();\n \n int n = int.Parse(m[0]);\n int a = int.Parse(m[1]);\n int b = int.Parse(m[2]);\n int minc;\n if (a < b)\n {\n minc = a;\n }\n else { minc = b; }\n\n int s = 0;\n int[] c = new int[n];\n inp = Console.ReadLine();\n m = inp.Split();\n for (int ii=0; ii int.Parse(i)).ToArray();\n int[] g = { x[1], x[2], x[1] < x[2] ? x[1] : x[2] };\n int[] y = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();\n int count = 0;\n if (x[0] % 2 != 0) if (y[x[0] / 2] == 2) count += g[2];\n for (int i = 0, j=x[0]-1; i < x[0]/2; i++,j--)\n {\n if (y[i] == y[j]) { if (y[i] == 2) count += 2 * g[2]; }\n else if (y[i] == 2) count += g[y[j]];\n else if (y[j] == 2) count += g[y[i]];\n else\n {\n count = -1;\n break;\n }\n }\n Console.WriteLine(count);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace olymp\n{\n class Program\n {\n public static List ReadIntLine()\n {\n List input = Console.ReadLine()\n .Split(' ')\n .Select((a) => Convert.ToInt32(a))\n .ToList();\n return input;\n }\n\n\n static void Main(string[] args)\n {\n List info = ReadIntLine();\n List d = ReadIntLine();\n\n int white = info[1];\n int black = info[2];\n\n int money = 0;\n int min_cost = white < black ? white : black;\n\n bool is_error = false;\n\n\n for (int i = 0; i < d.Count / 2; i++)\n {\n\n int s = d[i];\n int e = d[d.Count - i - 1];\n\n if (s == 2 && e == 0)\n {\n money += white;\n }\n if (s == 2 && e == 1)\n {\n money += black;\n }\n if (s == 2 && e == 2)\n {\n money += min_cost * 2;\n }\n if (s == 1 && e == 0)\n {\n money = -1;\n is_error = true;\n break;\n }\n if (s == 1 && e == 2)\n {\n money += black;\n }\n if (s == 0 && e == 1)\n {\n money = -1;\n is_error = true;\n break;\n }\n if (s == 0 && e == 2)\n {\n money += white;\n }\n\n\n\n }\n\n if (d.Count % 2 == 1 && !is_error)\n {\n if (d[d.Count / 2] == 2)\n {\n money += min_cost;\n }\n }\n\n Console.WriteLine(money);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] input2 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int n = input1[0];\n int a = input1[1], b = input1[2];\n\n int len = input2.Length;\n\n int sum = 0;\n\n for (int i = 0; i < len; i++)\n {\n if (i <= len - i - 1)\n {\n if ((input2[i] != input2[len - i - 1]) && (input2[i] < 2) && (input2[len - i - 1] < 2))\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (input2[i] != input2[len - i - 1])\n {\n if (input2[i] == 2)\n sum += (input2[len - i - 1] == 0) ? a : b;\n else\n sum += (input2[i] == 0) ? a : b;\n }\n\n if ((input2[i] == input2[len - i - 1]) && (input2[i] == 2))\n {\n if (i != len - i - 1)\n sum += (a < b) ? a * 2 : b * 2;\n else\n sum += (a < b) ? a : b;\n }\n }\n }\n\n Console.WriteLine(sum);\n //Console.ReadKey();\n }\n\n }\n}\n"}, {"source_code": "// Problem: 1040A - Palindrome Dance\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass PalindromeDance\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (3);\n if (words == null)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 1 || n > 20)\n return -1;\n byte a;\n if (!Byte.TryParse (words[1], out a))\n return -1;\n if (a < 1 || a > 100)\n return -1;\n byte b;\n if (!Byte.TryParse (words[2], out b))\n return -1;\n if (b < 1 || b > 100)\n return -1;\n words = ReadSplitLine (n);\n if (words == null)\n return -1;\n byte[] c = new byte[n];\n for (byte i = 0; i < n; i++)\n {\n byte ci;\n if (!Byte.TryParse (words[i], out ci))\n return -1;\n if (ci > 2)\n return -1;\n c[i] = ci;\n }\n byte idxBound = Convert.ToByte (n/2);\n byte idxLast = Convert.ToByte (n-1);\n byte priceCheap = Math.Min (a,b);\n short ans = 0;\n for (byte i = 0; i < idxBound && ans > -1; i++)\n {\n byte j = Convert.ToByte (idxLast-i);\n if (c[i] == 2 && c[j] == 2)\n ans += Convert.ToInt16 (2*priceCheap);\n else if (c[i] == 2)\n ans += (c[j] == 0 ? a : b);\n else if (c[j] == 2)\n ans += (c[i] == 0 ? a : b);\n else if (c[i] != c[j])\n ans = -1;\n }\n if (n%2 == 1 && ans > -1 && c[idxBound] == 2)\n ans += priceCheap;\n Console.WriteLine (ans);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n\n #region Read Input\n static string[] lines;\n static int lineIndex = 0;\n\n static string ReadNextLine()\n {\n#if DEBUG\n if (lines == null)\n lines = System.IO.File.ReadAllLines(\"input.txt\");\n return lines[lineIndex++];\n#else\n return Console.ReadLine();\n#endif\n }\n #endregion\n\n static void Main(string[] args)\n {\n var data = ReadNextLine().Split(' ');\n int n = int.Parse(data[0]);\n int a = int.Parse(data[1]);\n int b = int.Parse(data[2]);\n\n data = ReadNextLine().Split(' ');\n int[] arr = new int[n];\n for (int i = 0; i < n; i++)\n arr[i] = int.Parse(data[i]);\n\n long res = 0;\n int med = n / 2;\n int minCost = Math.Min(a, b);\n for (int i = 0; i < med; i++)\n {\n int left = arr[i];\n int right = arr[n - i - 1];\n\n if (left == 2 && right == 2)\n res += 2 * minCost;\n else if (left == 2)\n res += right == 1 ? b : a;\n else if (right == 2)\n res += left == 1 ? b : a;\n else if (right != left)\n {\n res = -1;\n break;\n }\n }\n\n if (res >= 0 && n % 2 == 1 && arr[med] == 2)\n res += minCost;\n\n Console.WriteLine(string.Format(\"{0:d}\", res));\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n\n #region Read Input\n static string[] lines;\n static int lineIndex = 0;\n\n static string ReadNextLine()\n {\n#if DEBUG\n if (lines == null)\n lines = System.IO.File.ReadAllLines(\"input.txt\");\n return lines[lineIndex++];\n#else\n return Console.ReadLine();\n#endif\n }\n #endregion\n\n static void Main(string[] args)\n {\n var data = ReadNextLine().Split(' ');\n int count = int.Parse(data[0]);\n int valueWhite = int.Parse(data[1]);\n int valueBlack = int.Parse(data[2]);\n int min = Math.Min(valueBlack, valueWhite);\n\n int cost = 0;\n int iterCount;\n\n int[] arr = new int[count];\n data = ReadNextLine().Split(' ');\n for (int i = 0; i < count; i++)\n {\n arr[i] = int.Parse(data[i]);\n }\n\n if(count % 2 == 0)\n {\n iterCount = (count - 1) / 2;\n }\n else\n {\n iterCount = count / 2;\n }\n\n for (int i = 0; i <= iterCount; i++)\n {\n int left = arr[i];\n int right = arr[count - i - 1];\n\n if (left == right)\n {\n if (left == 2)\n {\n if (i == count - i - 1)\n cost += min;\n else\n cost += 2 * min;\n }\n\n }\n else\n {\n if (left != 2 && right != 2)\n {\n Console.WriteLine(-1); \n return;\n }\n else\n {\n if (left == 2)\n {\n if (right == 0)\n {\n cost += valueWhite;\n }\n else\n {\n cost += valueBlack;\n }\n }\n else\n {\n if (left == 0)\n {\n cost += valueWhite;\n }\n else\n {\n cost += valueBlack;\n }\n }\n }\n\n\n }\n }\n\n Console.WriteLine(cost);\n //long res = 0;\n //Console.WriteLine(string.Format(\"{0:d}\", res));\n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n\n\n\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace _1040A\n{\n class Program\n {\n static void Main(string[] args)\n {\n IEnumerable container = Console.ReadLine().Split().Select(int.Parse);\n int n = container.ElementAt(0), a = container.ElementAt(1), b = container.ElementAt(2), ans = 0;\n\n List line = Console.ReadLine().Split().Select(int.Parse).ToList();\n // int maxCost = Math.Max(a, b), minCost = Math.Min(a, b);\n\n for (int i = 0, j = line.Count - 1; i<=j; i++, j--)\n {\n\n if (i == j && line[i] == 2) ans += Math.Min(a, b);\n else if (line[i] == 2 && line[j] != 2) ans += line[j] == 0 ? a : b;\n else if (line[i] != 2 && line[j] == 2) ans += line[i] == 0 ? a : b;\n else if (line[i] == 2 && line[j] == 2) ans += 2 * Math.Min(a, b);\n else if (line[i] != line[j]) { ans = -1; break; }\n\n\n\n\n }\n\n\n\n Console.WriteLine(ans);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int sum = 0;\n for (int i = 0; i < nm[0] / 2; i++)\n {\n if (a[i] != 2 && a[nm[0] - 1 - i] != 2 && a[i] != a[nm[0] - 1 - i])\n {\n Console.WriteLine(-1);\n return;\n }\n if (a[i] == a[nm[0] - 1 - i] && a[i] != 2)\n continue;\n if (a[i] == a[nm[0] - 1 - i] && a[i] == 2)\n sum += Math.Min(nm[1], nm[2]) * 2;\n else if (a[i] == 2 && a[nm[0] - 1 - i] == 0 || a[i] == 0 && a[nm[0] - 1 - i] == 2)\n sum += nm[1];\n else sum += nm[2];\n }\n if (nm[0] % 2!=0)\n sum += a[nm[0]/2] == 2 ? Math.Min(nm[1], nm[2]) : 0;\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int sum = 0;\n int prev = -1;\n for (int i = 0; i < n[0]/2; i++)\n {\n if (array[i] != array[n[0] - 1 - i])\n {\n int s = array[i] + array[n[0] - 1 - i];\n if (s == 1)\n {\n sum = -1;\n break;\n }\n else\n if (s == 2)\n {\n sum += n[1];\n }\n else\n {\n sum += n[2];\n }\n }\n else if(array[i] == 2)\n {\n if(n[1] < n[2])\n {\n sum += 2*n[1];\n }\n else{ sum += 2*n[2];}\n }\n }\n if (sum >= 0 && array[n[0] / 2] == 2 && n[0]%2==1)\n sum += (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _1040A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int a = int.Parse(tokens[1]);\n int b = int.Parse(tokens[2]);\n\n int[] suit = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int cost = 0;\n\n for (int i = 0, j = n - 1; i <= j; i++, j--)\n {\n if (Math.Max(suit[i], suit[j]) == 2)\n {\n switch (Math.Min(suit[i], suit[j]))\n {\n case 0:\n cost += a;\n break;\n case 1:\n cost += b;\n break;\n case 2:\n cost += Math.Min(a, b) * (i == j ? 1 : 2);\n break;\n }\n }\n else if (suit[i] != suit[j])\n {\n Console.WriteLine(-1);\n return;\n }\n }\n\n Console.WriteLine(cost);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace _1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] str = Console.ReadLine().Split().Select(x=>int.Parse(x)).ToArray();\n int n = str[0];\n int whiteR = str[1];\n int blackR = str[2];\n int min = Math.Min(whiteR, blackR);\n int max = Math.Max(whiteR, blackR);\n bool isPal = true;\n int sum = 0;\n string[] myPal = Console.ReadLine().Split(' ');\n \n for (int i=0; i= 0 && array[n[0] / 2] == 2)\n sum += n[0]%2==0 ? 2* (int)Math.Min(n[1], n[2]) : (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n struct Point\n {\n public int l;\n public int r;\n public Point(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n }\n static void Main(string[] args)\n {\n int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int sum = 0;\n for (int i = 0; i < n[0]/2; i++)\n {\n if (array[i] != array[n[0] - 1 - i])\n {\n int s = array[i] + array[n[0] - 1 - i];\n if (s == 1)\n {\n sum = -1;\n break;\n }\n else\n if (s == 2)\n {\n sum += n[1];\n }\n else\n {\n sum += n[2];\n }\n\n }\n }\n if (sum >= 0 && array[n[0] / 2] == 2)\n sum += (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int sum = 0;\n int prev = -1;\n for (int i = 0; i < n[0]/2; i++)\n {\n if (array[i] != array[n[0] - 1 - i])\n {\n int s = array[i] + array[n[0] - 1 - i];\n if (s == 1)\n {\n sum = -1;\n break;\n }\n else\n if (s == 2)\n {\n prev = 0;\n sum += n[1];\n }\n else\n {\n prev = 1;\n sum += n[2];\n }\n }\n else if(array[i] == 2)\n {\n if(prev == 1) sum += 2*n[1];\n else if(prev == 0) sum += 2*n[2];\n else if(n[1] < n[2])\n {\n prev = 0;\n sum += 2*n[1];\n }\n else{ prev = 1; sum += 2*n[2];}\n }\n else prev = array[i];\n }\n if (sum >= 0 && array[n[0] / 2] == 2 && n[0]%2==1)\n sum += (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "using System;\n\npublic class Solution\n{\n static void Main(String[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n int[] d = new int[n];\n input = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n d[i] = int.Parse(input[i]);\n }\n int cost = 0;\n for (int i = 0; i < n; i++)\n {\n if (d[i] == 2)\n {\n int j = n - i - 1;\n if (d[j] == 2)\n {\n if (a > b)\n {\n d[i] = d[j] = b;\n cost += b;\n }\n else\n {\n d[i] = d[j] = a;\n cost += a;\n }\n }\n else\n {\n if (d[j] == 0)\n {\n cost += a;\n d[i] = d[j];\n }\n else\n {\n cost += b;\n d[i] = d[j];\n }\n }\n }\n else if (d[i] == 1 && d[n - i - 1] == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n Console.WriteLine(cost);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n Reader r = new Reader();\n r.TakeInput();\n int n = r.NextInt();\n int a = r.NextInt();\n int b = r.NextInt();\n int[] d = r.TakeIntArray();\n int cost = 0;\n for (int i = 0, j = n - 1; i < j; i++, j--)\n {\n if (d[i] == 0 && d[j] == 2 || d[i] == 2 && d[j] == 0)\n {\n cost += a;\n }\n if (d[i] == 1 && d[j] == 2 || d[i] == 2 && d[j] == 1)\n {\n cost += b;\n }\n if (d[i] == 2 && d[j] == 2)\n {\n cost += Math.Min(a, b);\n }\n if (d[i] == 1 && d[j] == 0 || d[i] == 0 && d[j] == 1)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n if (n % 2 == 1 && d[n / 2] == 2)\n {\n cost += Math.Min(a, b);\n }\n Console.WriteLine(cost);\n }\n }\n\n class Reader\n {\n int _idx;\n string[] _input;\n\n public void TakeInput()\n {\n _idx = 0;\n _input = Console.ReadLine().Split(' ');\n }\n\n public int[] TakeIntArray()\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] a = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n a[i] = int.Parse(input[i]);\n }\n return a;\n }\n\n public int NextInt()\n {\n return int.Parse(_input[_idx++]);\n }\n\n public long NextLong()\n {\n return long.Parse(_input[_idx++]);\n }\n\n public string NextString()\n {\n return _input[_idx++];\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Solution\n{\n static void Main(String[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int a = int.Parse(input[1]);\n int b = int.Parse(input[2]);\n int[] d = new int[n];\n input = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n d[i] = int.Parse(input[i]);\n }\n int cost = 0;\n for (int i = 0; i < n; i++)\n {\n if (d[i] == 2)\n {\n int j = n - i - 1;\n if (d[j] == 2)\n {\n int x;\n if (a > b)\n {\n d[i] = d[j] = b;\n x = 2 * b;\n }\n else\n {\n d[i] = d[j] = a;\n x = 2 * a;\n }\n if (i == j)\n {\n cost += x / 2;\n }\n else\n {\n cost = x;\n }\n }\n else\n {\n if (d[j] == 0)\n {\n cost += a;\n d[i] = d[j];\n }\n else\n {\n cost += b;\n d[i] = d[j];\n }\n }\n }\n else if (d[i] == 1 && d[n - i - 1] == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n }\n Console.WriteLine(cost);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0422\u0430\u043d\u0435\u0446_\u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res = 0;\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n int n = int.Parse(values[0]);\n int a = int.Parse(values[1]);\n int b = int.Parse(values[2]);\n s = Console.ReadLine();\n string[] values2 = s.Split(' ');\n int[] arr = new int[n];\n for (int i=0; ib)\n {\n min = b;\n }\n int x = 0;\n if (n%2==1)\n {\n x = n / 2 + 1;\n }\n else\n {\n x = n / 2;\n }\n for (int i = 0; i < x; i++)\n {\n if (arr[i]==arr[n-1-i])\n {\n if(arr[i]==2)\n {\n if (i == x - 1)\n res = res + min;\n if (n==2)\n {\n res = res + 2 * min;\n }\n else\n res = res + 2 * min;\n }\n }\n else\n {\n if(((arr[i]==0)&&(arr[n-1-i]==2))||((arr[n-1-i]==0)&&(arr[i]==2)))\n {\n res = res + a;\n }\n else if(((arr[i] == 1) && (arr[n - 1 - i] == 2)) || ((arr[n - 1 - i] == 1) && (arr[i] == 2)))\n {\n res = res + b;\n\n }\n else\n {\n res = -1;\n break;\n }\n }\n }\n Console.WriteLine(res);\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0422\u0430\u043d\u0435\u0446_\u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\n{\n class Program\n {\n static void Main(string[] args)\n {\n int res = 0;\n string s = Console.ReadLine();\n string[] values = s.Split(' ');\n int n = int.Parse(values[0]);\n int a = int.Parse(values[1]);\n int b = int.Parse(values[2]);\n s = Console.ReadLine();\n string[] values2 = s.Split(' ');\n int[] arr = new int[n];\n for (int i=0; ib)\n {\n min = b;\n }\n int x = 0;\n if (n%2==1)\n {\n x = n / 2 + 1;\n }\n else\n {\n x = n / 2;\n }\n for (int i = 0; i < x; i++)\n {\n if (arr[i]==arr[n-1-i])\n {\n if(arr[i]==2)\n {\n if (i == x - 1)\n res = res + min;\n else\n res = res + 2 * min;\n }\n }\n else\n {\n if(((arr[i]==0)&&(arr[n-1-i]==2))||((arr[n-1-i]==0)&&(arr[i]==2)))\n {\n res = res + a;\n }\n else if(((arr[i] == 1) && (arr[n - 1 - i] == 2)) || ((arr[n - 1 - i] == 1) && (arr[i] == 2)))\n {\n res = res + b;\n\n }\n else\n {\n res = -1;\n break;\n }\n }\n }\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PalindromeDance\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int DANCER_WITH_WHITE_SUIT = 0;\n const int DANCER_WITH_BLACK_SUIT = 1;\n const int DANCER_WITH_UNKNOWN_SUIT = 2;\n\n //\n string[] inputs = Console.ReadLine().Split(' ');\n int n = int.Parse(inputs[0]);\n int PriceWhiteSuit = int.Parse(inputs[1]);\n int PriceBlackSuit = int.Parse(inputs[2]);\n\n string[] inputsDancers = Console.ReadLine().Split(' ');\n int[] Dancers = Array.ConvertAll(inputsDancers, x => int.Parse(x));\n int result = 0;\n for (int i = 0; i < n / 2 && result != -1; i++)\n {\n if (Dancers[i] != Dancers[n - i - 1] && Dancers[i] != DANCER_WITH_UNKNOWN_SUIT && Dancers[n - i - 1] != DANCER_WITH_UNKNOWN_SUIT)\n {\n result = -1;\n }\n else\n {\n if (Dancers[i] != Dancers[n - i - 1])\n {\n if (Dancers[i] == DANCER_WITH_BLACK_SUIT)\n result += PriceBlackSuit;\n\n if (Dancers[i] == DANCER_WITH_WHITE_SUIT)\n result += PriceWhiteSuit;\n\n if (Dancers[n - i - 1] == DANCER_WITH_BLACK_SUIT)\n result += PriceBlackSuit;\n\n if (Dancers[n - i - 1] == DANCER_WITH_WHITE_SUIT)\n result += PriceWhiteSuit;\n }\n else\n {\n if (Dancers[i] == Dancers[n - i - 1] && Dancers[n - i - 1] == DANCER_WITH_UNKNOWN_SUIT)\n {\n if (PriceWhiteSuit < PriceBlackSuit)\n {\n result += PriceWhiteSuit;\n }\n else\n {\n result += PriceBlackSuit;\n }\n }\n }\n }\n }\n\n if(n%2 != 0 && Dancers[n/2] == DANCER_WITH_UNKNOWN_SUIT && result != -1)\n {\n if(PriceWhiteSuit < PriceBlackSuit)\n {\n result += PriceWhiteSuit;\n }\n else\n {\n result += PriceBlackSuit;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _1040A\n{\n class Program\n {\n static void Main(string[] args)\n {\n IEnumerable container = Console.ReadLine().Split().Select(int.Parse);\n int n = container.ElementAt(0), whiteCost = container.ElementAt(1), blackCost=container.ElementAt(2);\n List colorslist = Console.ReadLine().Split().Select(int.Parse).ToList();\n int minCost = 0;\n if (n == 1 || !colorslist.Contains(2)) Console.WriteLine(0);\n else if (!CheckPalin(colorslist, n)) Console.WriteLine(-1);\n else\n {\n for (int i = 0; i < n / 2; i++)\n {\n if (colorslist[i] == 1 && colorslist[n - 1] == 2 || colorslist[i] == 2 && colorslist[n - 1] == 1)\n minCost += blackCost;\n else if (colorslist[i] == 0 && colorslist[n - 1] == 2 || colorslist[i] == 2 && colorslist[n - 1] == 0)\n minCost += whiteCost;\n else\n {\n minCost += (Math.Min(whiteCost, blackCost)) * 2;\n }\n }\n if (n % 2 == 1 && colorslist[n / 2 + 1] == 2) minCost += Math.Min(whiteCost, blackCost);\n Console.WriteLine(minCost);\n }\n\n\n\n\n }\n public static bool CheckPalin(List colorslist,int n)\n {\n bool answer = true;\n for(int i=0;i<(n/2);i++)\n {\n if(colorslist[i]!=colorslist[n-1] && (colorslist[i]!=2 && colorslist[n-1]!=2))\n {\n answer = false;\n break;\n }\n }\n return answer;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_1040_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[]s=Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int a = int.Parse(s[1]);\n int b = int.Parse(s[2]);\n\n int[] c = new int[n];\n s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n c[i] = int.Parse(s[i]);\n }\n\n int ans = 0;\n for (int i = 0, j=n-1; i < n/2; i++, j--)\n {\n if( c[i]==0 && c[j]==1 ||\n c[i]==1 && c[j]==0)\n {\n Console.WriteLine(-1);\n return;\n }\n if(c[i]==2 && c[j]==2)\n {\n ans += Math.Min(a, b)*2;\n }\n if( c[i]==0 && c[j]==2 ||\n c[i]==2 && c[i]==0)\n {\n ans += a;\n }\n if (c[i] == 1 && c[j] == 2 ||\n c[i] == 2 && c[i] == 1)\n {\n ans += b;\n }\n }\n\n // \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u0434\u0435\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e\n if (n % 2 == 1 && c[n / 2] == 2)\n ans += Math.Min(a, b);\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int sum = 0;\n int prev = -1;\n for (int i = 0; i < n[0]/2; i++)\n {\n if (array[i] != array[n[0] - 1 - i])\n {\n int s = array[i] + array[n[0] - 1 - i];\n if (s == 1)\n {\n sum = -1;\n break;\n }\n else\n if (s == 2)\n {\n prev = 0;\n sum += n[1];\n }\n else\n {\n prev = 1;\n sum += n[2];\n }\n }\n else if(array[i] == 2)\n {\n if(prev == 1) sum += n[1];\n else if(prev == 0) sum += n[2];\n else if(n[1] < n[2])\n {\n prev = 0;\n sum += n[1];\n }\n else{ prev = 1; sum += n[2];}\n }\n else prev = array[i];\n }\n if (sum >= 0 && array[n[0] / 2] == 2)\n sum += n[0]%2==0 ? 2* (int)Math.Min(n[1], n[2]) : (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int [] array = ((Console.ReadLine().Split(' ')).Select(int.Parse)).ToArray();\n int sum = 0;\n int prev = -1;\n for (int i = 0; i < n[0]/2; i++)\n {\n if (array[i] != array[n[0] - 1 - i])\n {\n int s = array[i] + array[n[0] - 1 - i];\n if (s == 1)\n {\n sum = -1;\n break;\n }\n else\n if (s == 2)\n {\n prev = 0;\n sum += n[1];\n }\n else\n {\n prev = 1;\n sum += n[2];\n }\n }\n else if(array[i] == 2)\n {\n if(prev == 1) sum += n[1];\n else if(prev == 0) sum += n[2];\n else if(n[1] < n[2])\n {\n prev = 0;\n sum += n[1];\n }\n else{ prev = 1; sum += n[2];}\n }\n else prev = array[i];\n }\n if (sum >= 0 && array[n[0] / 2] == 2 && n[0]%2==1)\n sum += (int)Math.Min(n[1], n[2]);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n \n }\n}"}], "src_uid": "af07223819aeb5bd6ded4340c472b2b6"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing SC = Scanner;\n\npublic partial class Solver\n{\n public void Solve()\n {\n int N, K;\n sc.Make(out N, out K);\n var A = sc.ArrInt;\n int[] ct = new int[2];\n var o = 0; ModInt al = 1 / ((ModInt)N * (N - 1) / 2);\n for (int i = 0; i < N; i++)\n {\n ct[A[i]]++;\n }\n for (int i = ct[0]; i < N; i++)\n {\n if (A[i] == 0) o++;\n }\n var len = ct.Min() + 1;\n var F = Create(len, () => new ModInt[len]);\n for (int i = 0; i < len; i++)\n {\n F[i][i] = al * (ct[0] * (ct[0] - 1) / 2 + ct[1] * (ct[1] - 1) / 2 + (N - i * 2) * i);\n }\n for (int i = 0; i < len - 1; i++)\n {\n F[i][i + 1] = (i + 1) * (i + 1) * al;\n }\n for (int i = 1; i < len; i++)\n {\n F[i][i - 1] = (ModInt)(ct[0] - i + 1) * (ct[1] - i + 1) * al;\n }\n Console.WriteLine(matpow(F, K)[0][o]);\n }\n\n ModInt[][] matpow(ModInt[][] A, long k)\n {\n var res = Create(A.Length, () => new ModInt[A.Length]);\n for (int i = 0; i < A.Length; i++) res[i][i] = 1;\n while (k != 0)\n {\n if (k % 2 == 1) res = matmul(res, A);\n k >>= 1;\n A = matmul(A, A);\n }\n return res;\n }\n ModInt[][] matmul(ModInt[][] A, ModInt[][] B)\n {\n var rt = Create(A.Length, () => new ModInt[B[0].Length]);\n for (int i = 0; i < A.Length; i++)\n for (int j = 0; j < B[0].Length; j++)\n {\n for (int k = 0; k < B.Length; k++)\n rt[i][j] += A[i][k] * B[k][j];\n }\n return rt;\n }\n ModInt[] matdot(ModInt[][] A, ModInt[] B)\n {\n var rt = new ModInt[A.Length];\n for (int i = 0; i < A.Length; i++)\n {\n ModInt now = 0;\n for (int j = 0; j < B.Length; j++)\n {\n now += A[i][j] * B[j];\n }\n rt[i] = now;\n }\n return rt;\n }\n}\n\npublic struct ModInt\n{\n public const long MOD = (int)1e9 + 7;\n //public const long MOD = 998244353;\n public long Value { get; set; }\n public ModInt(long n = 0) { Value = n; }\n private static ModInt[] fac, inv, facinv;\n public override string ToString() => Value.ToString();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator +(ModInt l, ModInt r)\n {\n l.Value += r.Value;\n if (l.Value >= MOD) l.Value -= MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator -(ModInt l, ModInt r)\n {\n l.Value -= r.Value;\n if (l.Value < 0) l.Value += MOD;\n return l;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator long(ModInt l) => l.Value;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static implicit operator ModInt(long n)\n {\n n %= MOD; if (n < 0) n += MOD;\n return new ModInt(n);\n }\n\n public static ModInt Pow(ModInt m, long n)\n {\n if (n == 0) return 1;\n if (n % 2 == 0) return Pow(m * m, n >> 1);\n else return Pow(m * m, n >> 1) * m;\n }\n\n public static void Build(int n)\n {\n fac = new ModInt[n + 1];\n facinv = new ModInt[n + 1];\n inv = new ModInt[n + 1];\n inv[1] = fac[0] = fac[1] = facinv[0] = facinv[1] = 1;\n for (var i = 2; i <= n; i++)\n {\n fac[i] = fac[i - 1] * i;\n inv[i] = MOD - inv[MOD % i] * (MOD / i);\n facinv[i] = facinv[i - 1] * inv[i];\n }\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Fac(int n) => fac[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Inv(int n) => inv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt FacInv(int n) => facinv[n];\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static ModInt Comb(int n, int r)\n {\n if (n < r) return 0;\n if (n == r) return 1;\n return fac[n] * facinv[r] * facinv[n - r];\n }\n public static ModInt Perm(int n, int r)\n {\n if (n < r) return 0;\n return fac[n] * facinv[n - r];\n }\n\n}\n#region Template\npublic partial class Solver\n{\n public SC sc = new SC();\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver();\n int testcase = 1;\n //testcase = sol.sc.Int;\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n while (testcase-- > 0)\n sol.Solve();\n Console.Out.Flush();\n }\n}\npublic static class Template\n{\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Out(this IList A, out T a) => a = A[0];\n public static void Out(this IList A, out T a, out T b) { a = A[0]; b = A[1]; }\n public static void Out(this IList A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }\n public static void Out(this IList A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }\n public static string Concat(this IEnumerable A, string sp) => string.Join(sp, A);\n public static char ToChar(this int s, char begin = '0') => (char)(s + begin);\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static string ToStr(this T[][] A) => A.Select(a => a.Concat(\" \")).Concat(\"\\n\");\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\n\n#endregion", "positive_code": [{"source_code": "using System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\nusing System.Numerics;\n\nclass Solution\n{\n public class GCD\n {\n public static int Euclidean(int n1, int n2)\n {\n if (n1 == n2) return n1;\n else if (n1 < n2)\n {\n var tmp = n1;\n n1 = n2;\n n2 = tmp;\n }\n\n while (n1 % n2 > 0)\n {\n var tmp = n2;\n n2 = n1 % n2;\n n1 = tmp;\n }\n return n2;\n }\n public static long Euclidean(long n1, long n2)\n {\n if (n1 == n2) return n1;\n else if (n1 < n2)\n {\n var tmp = n1;\n n1 = n2;\n n2 = tmp;\n }\n\n while (n1 % n2 > 0)\n {\n var tmp = n2;\n n2 = n1 % n2;\n n1 = tmp;\n }\n return n2;\n }\n\n public static long Inverse(long a, long n)\n {\n long x, y = 0;\n EuclideanExt(a, n, out x, out y);\n return x < 0 ? n + x : x;\n }\n\n public static long EuclideanExt(long n1, long n2, out long x, out long y)\n {\n x = 0;\n y = 1;\n\n bool r = false;\n if (n1 == n2) return n1;\n\n else if (n1 < n2)\n {\n r = true;\n var tmp = n1;\n n1 = n2;\n n2 = tmp;\n }\n long q = 0;\n long xl = 1;\n long yl = 0;\n\n while (n2 > 0)\n {\n q = n1 / n2;\n\n var tmp = n2;\n n2 = n1 % n2;\n n1 = tmp;\n\n tmp = x;\n x = xl - q * x;\n xl = tmp;\n\n tmp = y;\n y = yl - q * y;\n yl = tmp;\n\n\n }\n x = xl;\n y = yl;\n if (r)\n {\n x = yl;\n y = xl;\n }\n return x * n1 + y * n2;\n }\n }\n\n public static Tuple[,] multiply(Tuple[,] m1, Tuple[,] m2)\n {\n Tuple[,] ret = new Tuple[m1.GetLength(0), m2.GetLength(1)];\n for (int i = 0; i < ret.GetLength(0); i++)\n for (int j = 0; j < ret.GetLength(1); j++)\n {\n ret[i, j] = new Tuple(0, 0);\n for (int k = 0; k < m1.GetLength(1); k++)\n ret[i, j] = sum(ret[i, j], prod(m1[i, k], m2[k, j]));\n }\n return ret;\n }\n\n public static Tuple[,] recPow(Tuple[,] m, long pow)\n {\n if (pow == 1)\n return m;\n\n var powered = recPow(m, pow / 2);\n var mult = multiply(powered, powered);\n if (pow % 2 == 1)\n {\n\n mult = multiply(mult, m);\n }\n return mult;\n }\n\n static Tuple sum(Tuple a, Tuple b)\n {\n if (a.Item1 == 0)\n return b;\n if (b.Item1 == 0)\n return a;\n return Tuple.Create(\n ((a.Item1 * b.Item2) % mod + (b.Item1 * a.Item2) % mod) % mod,\n (a.Item2 * b.Item2) % mod\n );\n }\n\n static Tuple prod(Tuple a, Tuple b)\n {\n return Tuple.Create(\n (a.Item1 * b.Item1) % mod,\n (a.Item2 * b.Item2) % mod\n );\n }\n\n\n static Tuple PInOneSide(long cnt, long totalcnt)\n {\n return Tuple.Create(\n cnt * (cnt - 1) + (totalcnt - cnt) * (totalcnt - cnt - 1),\n totalcnt * (totalcnt - 1)\n );\n }\n\n static Tuple PIncreaseLeftA(long leftCnt, long leftACnt, long totalcnt)\n {\n return Tuple.Create(\n (leftCnt - leftACnt) * (leftCnt - leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static Tuple PDecreaseLeftA(long leftCnt, long leftACnt, long totalcnt)\n {\n return Tuple.Create(\n leftACnt * (totalcnt - 2 * leftCnt + leftACnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n static void CalcCashe(long lowerBnd, long leftCnt, long totalcnt)\n {\n PInOneSideCache = PInOneSide(leftCnt, totalcnt);\n\n PIncreaseLeftACache = new Tuple[leftCnt - lowerBnd + 1];\n PDecreaseLeftACache = new Tuple[leftCnt - lowerBnd + 1];\n PSameInBothSideCache = new Tuple[leftCnt - lowerBnd + 1];\n\n for (long i = lowerBnd; i <= leftCnt; i++)\n {\n PIncreaseLeftACache[(int)(i - lowerBnd)] = PIncreaseLeftA(leftCnt, i, totalcnt);\n PDecreaseLeftACache[(int)(i - lowerBnd)] = PDecreaseLeftA(leftCnt, i, totalcnt);\n PSameInBothSideCache[(int)(i - lowerBnd)] = PSameInBothSide(leftCnt, i, totalcnt);\n }\n }\n static Tuple PInOneSideCache;\n static Tuple[] PSameInBothSideCache;\n static Tuple[] PIncreaseLeftACache;\n static Tuple[] PDecreaseLeftACache;\n static Tuple PSameInBothSide(long leftCnt, long leftACnt, long totalcnt)\n {\n\n return Tuple.Create(\n (leftCnt - leftACnt) * (totalcnt + 2 * leftACnt - 2 * leftCnt),\n (totalcnt * (totalcnt - 1)) / 2\n );\n }\n\n const long mod = 1000000007L;\n static void Main(string[] args)\n {\n\n // var n = int.Parse( Console.ReadLine());\n var tmp = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToInt64);\n var n = (long)tmp[0];\n var k = tmp[1];\n\n var arr = Array.ConvertAll(Console.ReadLine().Trim().Split(), Convert.ToByte);\n\n var leftcnt = (long)arr.Count(el => el == 0);\n var leftAcnt = (long)arr.Where((el, i) => el == 0 && i < leftcnt).Count();\n if (k < (leftcnt - leftAcnt))\n {\n Console.WriteLine(\"0\");\n return;\n }\n if (leftcnt == n || leftcnt == 0)\n {\n Console.WriteLine(\"1\");\n return;\n }\n\n\n\n var lowerBnd = (long)Math.Max(0, (int)(2 * (int)leftcnt - (int)n));\n\n Tuple[,] A = new Tuple[(int)(leftcnt - lowerBnd + 1), (int)(leftcnt - lowerBnd + 1)];\n\n CalcCashe(lowerBnd, leftcnt, n);\n\n for (int i = 0; i < A.GetLength(0); i++)\n {\n for (int j = 0; j < A.GetLength(0); j++)\n {\n if (i == j)\n {\n A[i, j] = sum(PInOneSideCache, PSameInBothSideCache[i]);\n }\n else if (i == j + 1)\n {\n A[i, j] = PIncreaseLeftACache[i - 1];\n }\n else if (i == j - 1)\n {\n A[i, j] = PDecreaseLeftACache[i + 1];\n }\n else\n {\n A[i, j] = Tuple.Create(0, 0);\n }\n }\n }\n\n A = recPow(A, k);\n\n Tuple[,] F = new Tuple[leftcnt - lowerBnd + 1, 1];\n for (int i = 0; i < F.GetLength(0); i++)\n {\n if (i == leftAcnt - lowerBnd)\n {\n F[i, 0] = Tuple.Create(1l, 1L);\n }\n else\n {\n F[i, 0] = new Tuple(0, 0);\n }\n }\n F = multiply(A, F);\n var tpl = F[F.GetLength(0) - 1, 0];\n if (tpl.Item1 == 0)\n {\n Console.WriteLine(\"0\");\n return;\n }\n var gcd = GCD.Euclidean(tpl.Item1, tpl.Item2);\n var ret = Tuple.Create(tpl.Item1 / gcd, tpl.Item2 / gcd);\n\n var ret2 = ((long)ret.Item1 * GCD.Inverse((long)ret.Item2, (long)mod)) % (long)mod;\n\n Console.WriteLine($\"{ret2}\");\n\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing Number = System.Int64;\nusing N = System.Int64;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\t//\n\t\t\t//dp[i,a,b] = i \u56de\u64cd\u4f5c\u3057\u305f\u3042\u3068\u30010 \u304c\u6765\u308b\u3079\u304d\u7b87\u6240\u306b\u3042\u308b 1 \u306e\u500b\u6570\u30011 \u304c\u6765\u308b\u3079\u304d\u7b87\u6240\u306b\u3042\u308b 0 \u306e\u500b\u6570\n\t\t\t//dp[i+1,a-1,b-1]+=dp[i,a,b]*a*b/n^2;\n\t\t\t//dp[i+1,a,b]+=dp[i,a,b]*(A*A+B*B + a*(B-b) + b*(A-a))/n^2\n\t\t\t//dp[i+1,a+1,b+1]+=dp[i,a,b]*(A-a)*(B-b)/n^2\n\n\t\t\tvar n = ri; var k = ri;\n\t\t\tvar A = Enumerate(n, x => ri);\n\t\t\tvar K = n - A.Sum();\n\t\t\tvar M = n - K;\n\t\t\tvar B = Enumerate(n, x => x < K ? 0 : 1);\n\t\t\tvar p = Enumerate(n, x => x).Count(x => A[x] != B[x]) / 2;\n\t\t\tvar coef = ModInt.Inverse(n * (n - 1) / 2);\n\t\t\tvar mat = new Matrix(n + 1, n + 1);\n\t\t\t//mat[i,j] = j->i\n\t\t\tfor (int j = 0; j <= n; j++) {\n\t\t\t\tif (j != 0) mat[j - 1, j] += j * j * coef.num;\n\t\t\t\tmat[j, j] += (K * (K - 1) / 2 + M * (M - 1) / 2 + j * (M - j) + j * (K - j)) * coef.num;\n\t\t\t\tif (j != n) mat[j + 1, j] += (K - j) * (M - j) * coef.num;\n\t\t\t}\n\t\t\tfor (int i = 0; i <= n; i++)\n\t\t\t\tfor (int j = 0; j <= n; j++)\n\t\t\t\t\tmat[i, j] %= ModInt.Mod;\n\t\t\tvar res = Matrix.Pow(mat, k);\n\t\t\tvar vec = new Matrix(n + 1, 1); vec[p, 0] = 1;\n\t\t\tvar ans = (res * vec)[0, 0];\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\t//Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n\t\tvar solver = new Program.Solver();\n\t\tsolver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n\n\n#region ModInt\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \npublic struct ModInt {\n\t/// \n\t/// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n\t/// \n\tpublic const long Mod = (int)1e9 + 7;\n\n\t/// \n\t/// \u5b9f\u969b\u306e\u6570\u5024\uff0e\n\t/// \n\tpublic long num;\n\t/// \n\t/// \u5024\u304c \u3067\u3042\u308b\u3088\u3046\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6301\u3064\u5024\n\t/// \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u4e0a\uff0c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067\u306f\u5270\u4f59\u3092\u53d6\u308a\u307e\u305b\u3093\uff0e\u305d\u306e\u305f\u3081\uff0c \u2208 [0,) \u3092\u6e80\u305f\u3059\u3088\u3046\u306a \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\uff0e\u3053\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic ModInt(long n) { num = n; }\n\t/// \n\t/// \u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6570\u5024\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\uff0e\n\t/// \n\t/// [0,) \u306e\u7bc4\u56f2\u5185\u306e\u6574\u6570\u3092 10 \u9032\u8868\u8a18\u3057\u305f\u3082\u306e\uff0e\n\tpublic override string ToString() { return num.ToString(); }\n\tpublic static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }\n\tpublic static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }\n\tpublic static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }\n\tpublic static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }\n\n\t/// \n\t/// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u3079\u304d\u4e57\u306e\u5e95\n\t/// \u3079\u304d\u6307\u6570\n\t/// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }\n\n\t/// \n\t/// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u3079\u304d\u4e57\u306e\u5e95\n\t/// \u3079\u304d\u6307\u6570\n\t/// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n\tpublic static ModInt Pow(long v, long k) {\n\t\tlong ret = 1;\n\t\tfor (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)\n\t\t\tif ((k & 1) == 1) ret = ret * v % Mod;\n\t\treturn new ModInt(ret);\n\t}\n\t/// \n\t/// \u4e0e\u3048\u3089\u308c\u305f\u6570\u306e\u9006\u5143\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n\t/// \n\t/// \u9006\u5143\u3092\u53d6\u308b\u5bfe\u8c61\u3068\u306a\u308b\u6570\n\t/// \u9006\u5143\u3068\u306a\u308b\u3088\u3046\u306a\u5024\n\t/// \u6cd5\u304c\u7d20\u6570\u3067\u3042\u308b\u3053\u3068\u3092\u4eee\u5b9a\u3057\u3066\uff0c\u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\u306b\u5f93\u3063\u3066\u9006\u5143\u3092 O(log N) \u3067\u8a08\u7b97\u3057\u307e\u3059\uff0e\n\tpublic static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }\n}\n#endregion\n\n#region Matrix\npublic class Matrix {\n\tint row, col;\n\tpublic N[] mat;\n\t/// \n\t/// \u884c \u5217\u76ee\u306e\u8981\u7d20\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\n\t/// \n\t/// \u884c\u306e\u756a\u53f7\n\t/// \u5217\u306e\u756a\u53f7\n\tpublic N this[int r, int c] {\n\t\tget { return mat[r * col + c]; }\n\t\tset { mat[r * col + c] = value; }\n\t}\n\tpublic Matrix(int r, int c) {\n\t\trow = r; col = c;\n\t\tmat = new N[row * col];\n\t}\n\tpublic static Matrix operator *(Matrix l, Matrix r) {\n\t\tSystem.Diagnostics.Debug.Assert(l.col == r.row);\n\t\tvar ret = new Matrix(l.row, r.col);\n\t\tfor (int i = 0; i < l.row; i++)\n\t\t\tfor (int k = 0; k < l.col; k++)\n\t\t\t\tfor (int j = 0; j < r.col; j++)\n\t\t\t\t\tret.mat[i * r.col + j] = (ret.mat[i * r.col + j] + l.mat[i * l.col + k] * r.mat[k * r.col + j]) % ModInt.Mod;\n\t\treturn ret;\n\t}\n\t/// \n\t/// ^ \u3092 O(^3 log ) \u3067\u8a08\u7b97\u3057\u307e\u3059\u3002\n\t/// \n\tpublic static Matrix Pow(Matrix m, long n) {\n\t\tvar ret = new Matrix(m.row, m.col);\n\t\tfor (int i = 0; i < m.row; i++)\n\t\t\tret.mat[i * m.col + i] = 1;\n\t\tfor (; n > 0; m *= m, n >>= 1)\n\t\t\tif ((n & 1) == 1)\n\t\t\t\tret = ret * m;\n\t\treturn ret;\n\n\t}\n\tpublic N[][] Items {\n\t\tget {\n\t\t\tvar a = new N[row][];\n\t\t\tfor (int i = 0; i < row; i++) {\n\t\t\t\ta[i] = new N[col];\n\t\t\t\tfor (int j = 0; j < col; j++)\n\t\t\t\t\ta[i][j] = mat[i * col + j];\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\t}\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n const long MOD = 1000000000 + 7;\n\n int n = ReadInt();\n long k = ReadLong();\n int[] a = ReadIntArray();\n\n int m = a.Sum();\n\n if (m == n)\n {\n Writer.WriteLine(1);\n return;\n }\n\n long[,] b = new long[m + 1, m + 1];\n for (int i = 0; i < m + 1; i++)\n {\n long l = Math.Max(0, 2 * i * (n + i - 2 * m));\n long r = 2 * (m - i) * (m - i);\n long e = n * (n - 1) - l - r;\n long inv = Inv(n * (n - 1), MOD);\n if (l > 0)\n {\n b[i, i - 1] = l * inv % MOD;\n }\n b[i, i] = e * inv % MOD;\n if (r > 0)\n {\n b[i, i + 1] = r * inv % MOD;\n }\n }\n\n long[,] c = MatrixBinPower(m + 1, b, k, MOD);\n\n int st = 0;\n for (int i = 0; i < m; i++)\n {\n st += a[n - i - 1];\n }\n\n long ans = c[st, m];\n\n Writer.WriteLine(ans);\n }\n\n public static long Inv(long a, long mod)\n {\n return BinPower(a, mod - 2, mod);\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long[,] MatrixBinPower(int n, long[,] a, long p, long mod)\n {\n long[,] result = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n result[i, i] = 1;\n }\n\n while (p > 0)\n {\n if ((p & 1) != 0)\n {\n result = MatrixMult(n, result, a, mod);\n }\n\n a = MatrixMult(n, a, a, mod);\n p >>= 1;\n }\n\n return result;\n }\n\n public static long[,] MatrixMult(int n, long[,] a, long[,] b, long mod)\n {\n long[,] c = new long[n, n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] = (c[i, j] + a[i, k] * b[k, j]) % mod;\n }\n }\n }\n\n return c;\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", 1 - t);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing SB = System.Text.StringBuilder;\n//using System.Threading.Tasks;\n//using System.Text.RegularExpressions;\n//using System.Globalization;\n//using System.Diagnostics;\nusing static System.Console;\nusing System.Numerics;\nusing static System.Math;\nusing pair = Pair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().solve();\n Out.Flush();\n }\n readonly Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 }; //\u2192\u2193\u2190\u2191\n readonly int mod = 1000000007;\n readonly int dom = 998244353;\n bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }\n\n void solve()\n {\n int N = cin.nextint;\n int K = cin.nextint;\n var A = cin.scanint;\n\n int zero = A.Count(i => i == 0);\n int one = N - zero;\n int NG = 0;\n for (int i = zero; i < N; i++)\n {\n if (A[i] == 0)\n {\n NG++;\n }\n }\n\n var nc2 = N * (N - 1) * ModInt.Inverse(2);\n var inv = ModInt.Inverse(nc2);\n var dp = new ModInt[zero + 1][];\n for (int i = 0; i < dp.Length; i++)\n {\n dp[i] = new ModInt[zero + 1];\n int zero_ok = zero - i;\n int one_ok = one - i;\n dp[i][i] = inv * (nc2 - zero_ok * one_ok - i * i);\n\n if (i > 0)\n {\n zero_ok = zero - (i - 1);\n one_ok = one - (i - 1);\n dp[i][i - 1] = inv * zero_ok * one_ok;\n } \n\n if (i < zero)\n {\n dp[i][i + 1] = inv * (i + 1) * (i + 1);\n }\n\n }\n\n var M = matpow(dp, K);\n\n WriteLine(M[0][NG]);\n\n }\n\n ModInt[][] matpow(ModInt[][] m, long a)\n {\n if (a == 0)\n {\n int N = m.Length;\n ModInt[][] ret = new ModInt[N][];\n for (int i = 0; i < N; i++)\n {\n ret[i] = new ModInt[N];\n ret[i][i] = 1;\n }\n return ret;\n }\n if (a % 2 == 0)\n {\n ModInt[][] ret = matpow(m, a / 2);\n return matmul(ret, ret);\n }\n else\n {\n return matmul(m, matpow(m, a - 1));\n }\n }\n ModInt[][] matmul(ModInt[][] ma, ModInt[][] mb)\n {\n int p = ma.Length;\n int q = mb[0].Length;\n int r = ma[0].Length;\n ModInt[][] ret = new ModInt[p][];\n for (int i = 0; i < p; i++)\n {\n ret[i] = new ModInt[q];\n for (int j = 0; j < q; j++)\n {\n for (int k = 0; k < r; k++)\n {\n ret[i][j] += ma[i][k] * mb[k][j];\n }\n }\n }\n return ret;\n }\n}\n\n/// \n/// [0,) \u307e\u3067\u306e\u5024\u3092\u53d6\u308b\u3088\u3046\u306a\u6570\n/// \n/// camypaper\nstruct ModInt\n{\n /// \n /// \u5270\u4f59\u3092\u53d6\u308b\u5024\uff0e\n /// \n public const long Mod = (int)1e9 + 7;\n\n /// \n /// \u5b9f\u969b\u306e\u6570\u5024\uff0e\n /// \n public long num;\n /// \n /// \u5024\u304c \u3067\u3042\u308b\u3088\u3046\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff0e\n /// \n /// \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u6301\u3064\u5024\n /// \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u4e0a\uff0c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u5185\u3067\u306f\u5270\u4f59\u3092\u53d6\u308a\u307e\u305b\u3093\uff0e\u305d\u306e\u305f\u3081\uff0c \u2208 [0,) \u3092\u6e80\u305f\u3059\u3088\u3046\u306a \u3092\u6e21\u3057\u3066\u304f\u3060\u3055\u3044\uff0e\u3053\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public ModInt(long n) { num = n; }\n /// \n /// \u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6570\u5024\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\uff0e\n /// \n /// [0,) \u306e\u7bc4\u56f2\u5185\u306e\u6574\u6570\u3092 10 \u9032\u8868\u8a18\u3057\u305f\u3082\u306e\uff0e\n public override string ToString() { return num.ToString(); }\n public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }\n public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }\n public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }\n public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }\n\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u3079\u304d\u4e57\u306e\u5e95\n /// \u3079\u304d\u6307\u6570\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }\n\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f 2 \u3064\u306e\u6570\u5024\u304b\u3089\u3079\u304d\u5270\u4f59\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u3079\u304d\u4e57\u306e\u5e95\n /// \u3079\u304d\u6307\u6570\n /// \u7e70\u308a\u8fd4\u3057\u4e8c\u4e57\u6cd5\u306b\u3088\u308a O(N log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public static ModInt Pow(long v, long k)\n {\n long ret = 1;\n for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)\n if ((k & 1) == 1) ret = ret * v % Mod;\n return new ModInt(ret);\n }\n /// \n /// \u4e0e\u3048\u3089\u308c\u305f\u6570\u306e\u9006\u5143\u3092\u8a08\u7b97\u3057\u307e\u3059\uff0e\n /// \n /// \u9006\u5143\u3092\u53d6\u308b\u5bfe\u8c61\u3068\u306a\u308b\u6570\n /// \u9006\u5143\u3068\u306a\u308b\u3088\u3046\u306a\u5024\n /// \u6cd5\u304c\u7d20\u6570\u3067\u3042\u308b\u3053\u3068\u3092\u4eee\u5b9a\u3057\u3066\uff0c\u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\u306b\u5f93\u3063\u3066\u9006\u5143\u3092 O(log N) \u3067\u8a08\u7b97\u3057\u307e\u3059\uff0e\n public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }\n}\n\nclass BinomialCoefficient\n{\n public ModInt[] fact, ifact;\n public BinomialCoefficient(int n)\n {\n fact = new ModInt[n + 1];\n ifact = new ModInt[n + 1];\n fact[0] = 1;\n for (int i = 1; i <= n; i++)\n fact[i] = fact[i - 1] * i;\n ifact[n] = ModInt.Inverse(fact[n]);\n for (int i = n - 1; i >= 0; i--)\n ifact[i] = ifact[i + 1] * (i + 1);\n ifact[0] = ifact[1];\n }\n public ModInt this[int n, int r]\n {\n get\n {\n if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;\n return fact[n] * ifact[n - r] * ifact[r];\n }\n }\n public ModInt RepeatedCombination(int n, int k)\n {\n if (k == 0) return 1;\n return this[n + k - 1, k];\n }\n}\n\nstatic class Ex\n{\n public static void join(this IEnumerable values, string sep = \" \") => WriteLine(string.Join(sep, values));\n public static string concat(this IEnumerable values) => string.Concat(values);\n public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }\n\n public static int lower_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) < 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n public static int upper_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) <= 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n}\n\nclass Pair : IComparable> where T : IComparable where U : IComparable\n{\n public T f; public U s;\n public Pair(T f, U s) { this.f = f; this.s = s; }\n public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);\n public override string ToString() => $\"{f} {s}\";\n}\n\nclass Scanner\n{\n string[] s; int i;\n readonly char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan => ReadLine().Split();\n public int[] scanint => Array.ConvertAll(scan, int.Parse);\n public long[] scanlong => Array.ConvertAll(scan, long.Parse);\n public double[] scandouble => Array.ConvertAll(scan, double.Parse);\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint => int.Parse(next);\n public long nextlong => long.Parse(next);\n public double nextdouble => double.Parse(next);\n}\n"}], "negative_code": [], "src_uid": "77f28d155a632ceaabd9f5a9d846461a"} {"source_code": "using System;\n\npublic static class TriangleSolution\n{\n\tpublic static string Numbers = Console.ReadLine();\n\tpublic static int Length = Numbers.Length;\n\tpublic static int CurrentSide = 1;\n\tpublic static string[] separateNumbers = new string[3];\n\tpublic static int[] integerNumbers = new int[3];\n\tpublic static int numberOfMinutes = 1;\n\tpublic static int shortestSide1;\n\tpublic static int shortestSide2;\n\tpublic static int longestSide;\n\tpublic static void getSideLengths()\n\t{\n\t\tchar letter = '0';\n\t\tfor(int i = 0; i < Length; i++)\n\t\t{\n\t\t\tletter = Numbers[i];\n\t\t\tif(letter == ' ')\n\t\t\t{\n\t\t\t\tCurrentSide = CurrentSide + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\n\t\t\t\tseparateNumbers[CurrentSide - 1] = separateNumbers[CurrentSide - 1] + letter + \"\";\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void convertArrayToInteger(string[] chosenArray, int[] targetArray)\n\t{\n\t\tfor(int i = 0; i < chosenArray.Length; i++)\n\t\t{\n\t\t\ttargetArray[i] = int.Parse(chosenArray[i]);\n\t\t}\n\t}\n\tpublic static void declareSides(int sideShorter, int sideShorter2, int sideLonger)\n\t{\n\t\tshortestSide1 = sideShorter;\n\t\tshortestSide2 = sideShorter2;\n\t\tlongestSide = sideLonger;\n\t}\n\tpublic static void orderSides(int[] integerSideLengths)\n\t{\n\t\t\tif(integerSideLengths[0] > integerSideLengths[1])\n\t\t\t{\n\t\t\t\tif(integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\t{\n\t\t\t\t\tif(integerSideLengths[1] > integerSideLengths[2])\n\t\t\t\t\t\tdeclareSides(integerSideLengths[2],integerSideLengths[1],integerSideLengths[0]);\n\t\t\t\t\telse declareSides(integerSideLengths[1],integerSideLengths[2],integerSideLengths[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdeclareSides(integerSideLengths[1],integerSideLengths[0],integerSideLengths[2]);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\tdeclareSides(integerSideLengths[2],integerSideLengths[0],integerSideLengths[1]);\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (integerSideLengths[1] < integerSideLengths[2])\n\t\t\t\t{\n\t\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[1],integerSideLengths[2]);\n\t\t\t\t}\n\t\t\t\telse declareSides(integerSideLengths[0],integerSideLengths[2],integerSideLengths[1]);\n\t\t\t}\n\t}\n\tpublic static void Main()\n\t{\n\t\tgetSideLengths();\n\t\tconvertArrayToInteger(separateNumbers, integerNumbers);\n\t\t//Console.WriteLine(separateNumbers[2]);\n\t\torderSides(integerNumbers);\n\t\t//Console.WriteLine(integerNumbers[2]);\n\t\t//Console.WriteLine(longestSide + \"\" + shortestSide1 + \"\" + shortestSide2);\n\t\tnumberOfMinutes = (longestSide - shortestSide1) - shortestSide2;\n\t\tif(numberOfMinutes < 0)\n\t\t{\n\t\t\tnumberOfMinutes = 0;\n\t\t}\n\t\telse numberOfMinutes++;\n\t\t/*Console.WriteLine(Numbers);\n\t\tConsole.WriteLine(separateNumbers[1]);\n\t\tConsole.WriteLine(integerNumbers[1]);\n\t\tConsole.WriteLine(longestSide + \" \" + shortestSide1);*/\n\t\tConsole.WriteLine(numberOfMinutes);\n\t}\n\t\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] wind = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Array.Sort(wind);\n int rez =(wind[0]+wind[1]+wind[2]+1)/2>wind[2]?0: wind[2] + 1 - wind[0] - wind[1];\n\n\n Console.WriteLine(rez);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int[] arr = new int[3];\n arr[0]=int.Parse(ss[0]); arr[1] = int.Parse(ss[1]); arr[2] = int.Parse(ss[2]);\n Array.Sort(arr);\n int count = 0;\n if (arr[0] + arr[1] <= arr[2])\n {\n count +=1+ arr[2] - (arr[0] + arr[1]);\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(string separator, T[] a, int startIndex, int count)\n\t{\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = startIndex, lastIndex = startIndex + count;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = startIndex; i < lastIndex - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < lastIndex - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] data = UtilityMethods.ReadIntArray();\n\t\tArray.Sort(data);\n\t\tint a = data[0], b = data[1], c = data[2];\n\t\tUtilityMethods.WriteLine(Math.Max(0, c - a - b + 1));\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace Codefoeces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n\n \n \n string[] s = Console.ReadLine().Split();\n int[] mas = new int[3];\n mas[0] = int.Parse(s[0]);\n mas[1] = int.Parse(s[1]);\n mas[2] = int.Parse(s[2]);\n int count = 0;\n Array.Sort(mas);\n while (mas[0] + mas[1] <= mas[2])\n {\n mas[0]++;\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split();\n int a = int.Parse(data[0]);\n int b = int.Parse(data[1]);\n int c = int.Parse(data[2]);\n\n int res = 0;\n while (a >= b + c)\n {\n ++b;\n ++res;\n }\n\n while (b >= a + c)\n {\n ++a;\n ++res;\n }\n while (c >= a + b)\n {\n ++a;\n ++res;\n \n }\n Console.WriteLine(res);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleProject\n{\n class Program\n {\n static int ReadInt() => int.Parse(Console.ReadLine());\n static string ReadString() => Console.ReadLine();\n static int[] ReadIntArray() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToArray();\n static double[] ReadDoubleArray() => (Console.ReadLine().Split(' ')).Select(double.Parse).ToArray();\n static long[] ReadLongArray() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToArray();\n static List ReadIntList() => (Console.ReadLine().Split(' ')).Select(int.Parse).ToList();\n static List ReadLongList() => (Console.ReadLine().Split(' ')).Select(long.Parse).ToList();\n static char[] ReadCharArray() => (Console.ReadLine().Split(' ')).Select(char.Parse).ToArray();\n struct Point\n {\n public string s;\n public int i;\n public Point(int i, string s)\n {\n this.i = i;\n this.s = s;\n }\n }\n static void Main()\n {\n int ans = 0;\n int[] a = ReadIntArray();\n Array.Sort(a);\n if (a[2] >= a[1] + a[0])\n {\n int s = a[2] - (a[1] + a[0]);\n ans += s + 1;\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n private static long F(long v)\n {\n long sum = 0;\n while (v >= 10)\n {\n v /= 10;\n sum *= 10;\n sum += 9;\n }\n return sum;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf516\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf516A();\n }\n\n public static void solve_cf516A()\n {\n int[] abc = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int a = abc[0];\n int b = abc[1];\n int c = abc[2];\n\n int ab = a + b;\n int bc = b + c;\n int ac = a + c;\n\n int diff = 0;\n if (ab <= c)\n {\n diff = c - ab + 1;\n } \n\n if (bc <= a)\n {\n diff = a - bc + 1;\n }\n\n if (ac <= b)\n {\n diff = b - ac + 1;\n }\n\n Console.WriteLine(diff);\n\n }\n\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n int[] input = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x=>x).ToArray();\n int a = input[0], b = input[1], c = input[2];\n if (b + c > a) Console.WriteLine(0);\n else Console.WriteLine((a - (b+c))+1);\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n }\n o.ForEach(Console.WriteLine);\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _1064A\n {\n public static void Main()\n {\n int[] abc = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n Console.WriteLine(Math.Max(0, 2 * abc.Max() + 1 - abc.Sum()));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int a = sc.NextInt();\n int b = sc.NextInt();\n int c = sc.NextInt();\n\n int max = Math.Max(a, Math.Max(b, c));\n int others = a + b + c - max;\n\n if (others > max)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(max-others + 1);\n }\n }\n\n public static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n\nclass Scanner\n{\n public Scanner()\n {\n _pos = 0;\n _line = new string[0];\n }\n\n const char Separator = ' ';\n private int _pos;\n private string[] _line;\n\n #region \u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u53d6\u5f97\n\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _pos = 0;\n }\n\n return _line[_pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n\n #endregion\n\n #region \u578b\u5909\u63db\n\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n\n #endregion\n\n #region \u914d\u5217\u53d6\u5f97\n\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = Console.ReadLine().Split(Separator);\n\n _pos = _line.Length;\n return _line;\n }\n\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var ABC = Console.ReadLine().Split().Select(x=>int.Parse(x)).ToList();\n var A = ABC[0];\n var B = ABC[1];\n var C = ABC[2];\n var sum = 0;\n while (A+B <= C || A+C <= B || B+C <= A)\n {\n if (A == Math.Min(A, Math.Min(B, C))) \n {\n A++; sum++;\n }\n else if (B == Math.Min(A, Math.Min(B, C))) \n {\n B++; sum++;\n }\n else\n {\n C++; sum++;\n }\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace G6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] p = ParseToArray(Console.ReadLine(), 3);\n Array.Sort(p);\n Console.Write(Math.Max(0, p[2] - (p[0] + p[1]) + 1));\n \n //Console.ReadKey();\n }\n\n static int[] ParseToArray(string S, int LengOfS)\n {\n int[] p = new int[10] { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };\n int[] r = new int[LengOfS];\n S = \" \" + S.Trim(' ');\n int i = LengOfS - 1; int pw = 0;\n for (int c = S.Length - 1; c >= 0; c--)\n if (S[c] == 45)\n {\n r[i] *= (int)-1;\n }\n else if (S[c] != 32)\n {\n r[i] += (int)((S[c] - 48) * p[pw]);\n pw++;\n }\n else\n {\n pw = 0;\n i--;\n }\n return r;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n int[] s = new int[3];\n for (int i = 0; i < 3; i++)\n {\n s[i] = int.Parse(inp[i]);\n }\n Array.Sort(s);\n int x = s[2] - s[1];\n int y = Math.Max(0, s[2] - s[1] - s[0] + 1);\n Console.WriteLine(Math.Min(x, y));\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n List arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToList();\n\n arr.Sort();\n\n Console.WriteLine((arr[0] + arr[1]) > arr[2] ? \"0\" : $\"{arr[2] - Math.Abs(arr[0] + arr[1]) + 1}\");\n\n //Console.WriteLine($\"{arr[2] - Math.Abs(arr[0] + arr[1]) + ((arr[0] + arr[1]) > arr[2] ? 1 : 0)}\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\n\nnamespace codeforces\n{\n\n public class Program\n {\n\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n var a = new int[3] { Convert.ToInt32(values[0]), Convert.ToInt32(values[1]), Convert.ToInt32(values[2]) };\n Array.Sort(a, 0, 3);\n Console.WriteLine(a[2] >= a[0] + a[1] ? a[2] - a[0] - a[1] + 1 : 0);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _1064A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int index = str.IndexOf(' ');\n int a = Convert.ToInt32(str.Substring(0, index));\n str = str.Substring(index + 1);\n index = str.IndexOf(' ');\n int b = Convert.ToInt32(str.Substring(0, index));\n int c = Convert.ToInt32(str.Substring(index));\n int time = 0;\n int[] side = new int[3];\n side[0] = a;\n side[1] = b;\n side[2] = c;\n\n side = sortArray(side);\n\n if (a + b > c && a + c > b && b + c > a)\n {\n time = 0;\n }\n else\n {\n while (side[0] + side[1] <= side[2])\n {\n side[0]++;\n time++;\n }\n }\n\n Console.WriteLine(time);\n\n \n }\n\n static int[] sortArray(int[] array)\n {\n int temp;\n\n for (int i = 0; i < array.Length - 1; i++)\n {\n for (int j = i + 1; j < array.Length; j++)\n {\n if (array[i] > array[j])\n {\n temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }\n }\n\n return array;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1064_MakeATriangle\n {\n public static void Main()\n {\n string[] a = Console.ReadLine().Split(' ');\n int x = int.Parse(a[0]);\n int y = int.Parse(a[1]);\n int z = int.Parse(a[2]);\n int big = int.MinValue;\n int sm1 = int.MinValue;\n int sm2 = int.MinValue;\n bool Isosceler = false;\n\n if (x > y)\n {\n if (x > z)\n {\n big = x;\n if (z > y)\n {\n sm1 = z;\n sm2 = y;\n }\n else /*if(y>z)*/\n {\n sm1 = y;\n sm2 = z;\n }\n //else\n //{\n\n //}\n // Isosceler = true;\n }\n else //if (z > x)\n {\n big = z;\n sm1 = x;\n sm2 = y;\n }\n //else\n // Isosceler = true;\n }\n else /*if (y > x)*/\n {\n if (y > z)\n {\n big = y;\n if (z > x)\n {\n sm1 = z;\n sm2 = x;\n }\n else //if(z y)\n {\n big = z;\n sm1 = y;\n sm2 = x;\n }\n //else\n // Isosceler = true;\n }\n //else\n // Isosceler = true;\n\n\n if(/*Isosceler ||*/ big=(sm2+sm1))\n Console.WriteLine(big-(sm2+sm1)+1);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int a, b, c;\n\n public void Solve()\n {\n a = ioHelper.ReadNextInt();\n b = ioHelper.ReadNextInt();\n c = ioHelper.ReadNextInt();\n\n List nums = new List();\n nums.Add(a);\n nums.Add(b);\n nums.Add(c);\n nums.Sort();\n\n\n int mid = nums[1];\n int sum = nums[0] + nums[1];\n int max = nums[2];\n\n int res = 0;\n\n if (sum <= max)\n res = max + 1 - sum;\n \n ioHelper.WriteLine(res.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n Array.Sort(a);\n WriteLine(Math.Max(0,a[2]+1-a[1]-a[0]));\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint[] A = new int[3];\n\t\tA[0] = int.Parse(str[0]);\n\t\tA[1] = int.Parse(str[1]);\n\t\tA[2] = int.Parse(str[2]);\n\t\tArray.Sort(A);\n\t\tlong ans = 0;\n\t\tif(A[0] + A[1] <= A[2]){\n\t\t\tans = A[2] - (A[0]+A[1]) + 1;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System.Linq;\nusing System.Collections.Generic;\nusing System;\n\nnamespace MyApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = 0, b = 0, c = 0;\n var inp = Console.ReadLine().Split();\n a = Convert.ToInt32(inp[0]);\n b = Convert.ToInt32(inp[1]);\n c = Convert.ToInt32(inp[2]);\n if(a > c) {\n int temp = c;\n c = a;\n a = temp;\n }\n if(b > c) {\n int temp = c;\n c = b;\n b = temp;\n }\n int ans = 0;\n if(c - (a + b - 1) > ans) {\n ans = c - (a + b - 1);\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n \n\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n \n string[] tmp = str.Split(' ');\n int a = Convert.ToInt32(tmp[0]);\n int b = Convert.ToInt32(tmp[1]);\n int c = Convert.ToInt32(tmp[2]);\n \n if(a + b <= c){\n Console.WriteLine(c - a - b + 1);\n \n }else if(a + c <= b){\n Console.WriteLine(b - a - c + 1);\n }else if (b + c <= a){\n Console.WriteLine(a - b - c + 1);\n }else{\n Console.WriteLine(0);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var lengths = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n Console.WriteLine(TriangleTime(lengths[0], lengths[1], lengths[2]));\n }\n\n private static int TriangleTime(int a, int b, int c)\n {\n var difa = a + b - c;\n var difb = a + c - b;\n var difc = b + c - a;\n\n if (difa > 0 && difb > 0 && difc > 0)\n {\n return 0;\n }\n\n int[] arr = { difa, difb, difc };\n return 1 - arr.Min();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codefores1410A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string read;\n read = Console.ReadLine();\n int a = int.Parse(read.Split(' ').ToList()[0]);\n int b = int.Parse(read.Split(' ').ToList()[1]);\n int c = int.Parse(read.Split(' ').ToList()[2]);\n\n int max = 0;\n int other = 0;\n\n if (a >= b && a >= c)\n {\n max = a;\n other = b + c;\n }\n\n else if (b >= a && b >= c)\n {\n max = b;\n other = a + c;\n }\n\n else\n {\n max = c;\n other = b + a;\n }\n\n\n int output = max - other;\n\n if(output < 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(output + 1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NetExperiment\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] abc = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n double p = abc[0] + abc[1] + abc[2];\n int c = 0;\n while ((p / 2 - abc[0]) <= 0 || (p / 2 - abc[1]) <= 0 || (p / 2 - abc[2]) <= 0)\n {\n p++;\n c++;\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[]y=Console.ReadLine().Split(' ');\n int[]a=new int[3];\n a[0]=int.Parse(y[0]);\n a[1]=int.Parse(y[1]);\n a[2]=int.Parse(y[2]);\n Array.Sort(a);\n int outp=a[2]-(a[0]+a[1])+1;\n if(outp<0)\n outp=0;\n Console.WriteLine(outp);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n {\n string[] str = Console.ReadLine().Split();\n int[] m = new int[3];\n m[0] = Convert.ToInt32(str[0]);\n m[1] = Convert.ToInt32(str[1]);\n m[2] = Convert.ToInt32(str[2]);\n Array.Sort(m);\n Console.WriteLine(Math.Max(0, m[2] - m[1] - m[0] + 1));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Make_a_triangle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int a = Next(), b = Next(), c = Next();\n\n int m = Math.Max(a, Math.Max(b, c));\n int d = a + b + c - m;\n return Math.Max(0, m + 1 - d);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t;\n t = 0;\n int[] abc = new int[3];\n string [] s = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int length = s.Length;\n for (int i = 0; i < length; i++)\n {\n abc[i] = int.Parse(s[i]);\n }\n if (abc[0] >= abc[1]+abc[2])\n {\n t = abc[0] - abc[1] - abc[2] + 1;\n }\n if (abc[1] >= abc[0] + abc[2])\n {\n t = abc[1] - abc[0] - abc[2] + 1;\n }\n if(abc[2] >= abc[1] + abc[0])\n {\n t = abc[2] - abc[1] - abc[0] + 1;\n }\n Console.WriteLine(t);\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint[] m = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t\t\tint a, b, c;\n\t\t\tif ((m[0] >= m[1]) && (m[0] > m[2])) { a = m[0]; b = m[1]; c = m[2]; }\n\t\t\telse if (m[1] >= m[2]) { a = m[1]; b = m[0]; c = m[2]; }\n\t\t\telse { a = m[2]; b = m[0]; c = m[1]; }\n\t\t\tif (a < (b+c))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"0\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine((a + 1) - (b + c));\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tArray.Sort(A);\n\t\tConsole.WriteLine(Math.Max(0, A[2] - (A[1] + A[0]) + 1));\n\t\t\n\t\t\n\t\t\n\t}\n\tint[] A;\n\tpublic Sol(){\n\t\tA = ria();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var abc = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var a = abc[0];\n var b = abc[1];\n var c = abc[2];\n var x = GrowFirst(a, b + c);\n var y = GrowFirst(b, a + c);\n var z = GrowFirst(c, a + b);\n System.Console.WriteLine(Math.Max(x, Math.Max(y, z)));\n }\n\n private static long GrowFirst(long a, long sum) {\n if (a < sum)\n return 0L;\n return a - sum + 1;\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static T ElementWithMax(this IEnumerable seq, Func func) {\n var bi = default(T);\n var bv = long.MinValue;\n foreach (var item in seq) {\n var v = func(item);\n if (v > bv) {\n bi = item;\n bv = v;\n }\n }\n return bi;\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n Array.Sort(input);\n int result = input[0] + input[1] > input[2] ? 0 : input[2] - (input[0] + input[1]) + 1;\n\n Console.WriteLine(result);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main()\n {\n var vertices = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x));\n var max = vertices.OrderBy(x => x).LastOrDefault();\n var otherVerticesSum = vertices.Aggregate(0, (sum, x) => sum + x) - max;\n Console.WriteLine((otherVerticesSum > max) ? \"0\" : \"\" + (max - otherVerticesSum + 1));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace round516\n{\n class MainClass\n {\n static int need(int a, int b)\n {\n if (a < b) return 0;\n return a - b + 1;\n }\n\n public static void Main(string[] args)\n {\n var line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int a = line[0];\n int b = line[1];\n int c = line[2];\n\n int result = 0;\n if (a > b)\n {\n if (a > c)\n { // A\n result = need(a, b + c);\n }\n else\n { // C\n result = need(c, a + b);\n }\n }\n else if (b > c)\n { // B\n result = need(b, a + c);\n }\n else\n { // C\n result = need(c, a + b);\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c;\n string[] s = Console.ReadLine().Split(' ');\n a = int.Parse(s[0]);\n b = int.Parse(s[1]);\n c = int.Parse(s[2]);\n if(c+b<=a)\n Console.WriteLine(a-(c+b)+1); \n else if(c+a<=b)\n Console.WriteLine(b-(c+a)+1);\n else if(a+b<=c)\n Console.WriteLine(c-(a+b)+1);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforces_1064A\n{\n static void Main()\n {\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Array.Sort(a);\n int cnt = 0;\n while (a[0] + a[1] <= a[2])\n {\n a[0]++; cnt++;\n }\n Console.Write(cnt);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int a = int.Parse(s[0]);\n int b= int.Parse(s[1]);\n int c = int.Parse(s[2]);\n int t = 0;\n if (a>=b+c)\n t=a-(b+c)+1;\n else if (b>=a+c)\n t = b - (a + c)+1;\n else if (c>=a+b)\n t = c - (a + b)+1;\n Console.WriteLine(t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MakeTriangle\n{\n class Program\n {\n static int Turn(int a,int b,int c)\n {\n int max = 0,s = 0;\n if (a > b && a > c)\n {\n max = a;\n s = max - b - c;\n }\n else if (b > c)\n {\n max = b;\n s = max - a - c;\n }\n else\n {\n max = c;\n s = max - b - a;\n }\n if (s >= 0)\n {\n return s + 1;\n }\n else\n {\n return 0;\n }\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split().Select(v => int.Parse(v)).ToArray();\n int a = arr[0], b = arr[1], c = arr[2];\n\n Console.WriteLine(Turn(a, b, c));\n\n //int T1a = 3, T1b = 4, T1c = 5;\n //if (Turn(T1a,T1b,T1c) != 0)\n //{\n // throw new Exception(\"Error\");\n //}\n //int T2a = 3, T2b = 5, T2c = 2;\n //if (Turn(T2a, T2b, T2c) != 1)\n //{\n // throw new Exception(\"Error\");\n //}\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1\n{\n class Program\n {\n public static bool treug(int a, int b, int c)\n {\n if ((a + b > c) && (a + c > b) && (b + c > a)) return true;\n else return false;\n }\n public static int min(int a, int b, int c)\n {\n int min = 1;\n if (b < a) min = 2;\n if (c < b) min = 3;\n return min;\n }\n static void Main(string[] args)\n {\n int a, b, c;\n string[] w = Console.ReadLine().Split(' ');\n a = int.Parse(w[0]);\n b = int.Parse(w[1]);\n c = int.Parse(w[2]);\n int add = 0;\n while (!(treug(a, b, c)))\n {\n if (min(a, b, c) == 1) a++;\n else if (min(a, b, c) == 2) b++;\n else c++;\n add++;\n }\n Console.Write(add);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\npublic class Solver\n{\n public void Solve()\n {\n var a = ReadIntArray();\n Array.Sort(a);\n Write(Math.Max(0, a[2] - a[0] - a[1] + 1));\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace CF_1064_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int c = int.Parse(s[2]);\n\n int max = Math.Max(a, Math.Max(b, c));\n int min = Math.Min(a, Math.Min(b, c));\n int mid;\n if (max == a) mid = Math.Max(b, c);\n else if (max == b) mid = Math.Max(a, c);\n else mid = Math.Max(b, a);\n\n if (max < mid + min)\n Console.WriteLine(0);\n else\n Console.WriteLine(max - (mid+min)+1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] t = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n Array.Sort(t);\n int ans = (t[2] - (t[0] + t[1])) + 1;\n Console.WriteLine((ans < 0) ? 0 : ans);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int[] abc = Console.ReadLine().Split().Select(item=>int.Parse(item)).ToArray();\n int max = abc[0], pos = 0;\n for(int i = 1; i < 3; ++i)\n {\n if(max < abc[i])\n {\n max = abc[i];\n pos = i;\n }\n }\n for(int i = 0; i < 3; ++i)\n {\n if(i != pos)\n {\n max -= abc[i];\n }\n }\n Console.WriteLine(max < 0 ? 0 : max + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n Array.Sort( v );\n int a = v[0];\n int b = v[1];\n int c = v[2];\n\n //--------------------------------solve--------------------------------//\n\n if(c >= a + b)\n Console.WriteLine( c + 1 - a - b );\n else\n Console.WriteLine( 0 );\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class Class2\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).OrderBy(x => x).ToArray();\n var res = a[2] - a[1] - a[0] + 1;\n Console.WriteLine(res < 0 ? 0 : res);\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n Array.Sort(array);\n if (array[0] < array[1] + array[2] && array[1] < array[0] + array[2] && array[2] < array[0] + array[1])\n Console.WriteLine(0);\n else Console.WriteLine(array[2]-(array[1]+array[0])+1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace HackerEarthProject\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var x = s.Split(' ');\n int a = int.Parse(x[0]);\n int b = int.Parse(x[1]);\n int c = int.Parse(x[2]);\n int ans = 0;\n if (a + b <= c)\n {\n ans += c + 1 - a - b;\n }\n if(b+c <= a)\n {\n ans += a + 1 - b - c;\n }\n if(c+a <= b)\n {\n ans += b + 1 - c - a;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A {\n class myClass {\n static int[] readArray() {\n string[] tokens = Console.ReadLine().Split();\n int[] res = new int[tokens.Length];\n for(int i = 0; i < tokens.Length; i++) {\n res[i] = Convert.ToInt32(tokens[i]);\n }\n return res;\n }\n \n public static void Main(string[] args) {\n int[] array = readArray();\n Array.Sort(array);\n int res = Math.Max(0, array[2]-(array[0]+array[1])+1);\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0422\u0415\u0421\u0422\u042b\n{\nclass Program\n{\nstatic void Main(string[] args)\n{\n//a, b \u0438 c - \u0441\u0442\u043e\u0440\u043e\u043d\u044b\n// \u0437\u0430 \u043e\u0434\u043d\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e - \u043e\u0434\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 1 \u0441\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440\n//x1<=x2+x3\n//x2<=x1+x3\n//x3<=x1+x2\n\nint[] arr = Console.ReadLine().Split(new []{' '}, StringSplitOptions.RemoveEmptyEntries)\n.Select(str => Convert.ToInt32(str)).ToArray();\nint max= arr.Max();//MAX\n\nint SumMins = 0;\n\nint imax = Array.IndexOf(arr, arr.Max());\nfor (int i = 0; i < arr.Length; i++)\nif (i != imax)\nSumMins += arr[i];\n\nif (max + 1 < SumMins)\nConsole.WriteLine(0);\nelse\nConsole.WriteLine(max+1-SumMins);\n\n}\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();\n\n\t\t\tint max = inputs1.Max();\n\t\t\tint result = 2 * max - inputs1.Sum() + 1;\n\t\t\tif (result < 0) \n\t\t\t{\n\t\t\t\tresult = 0;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace _1064_Make_a_triangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Array.Sort(a);\n var count = 0;\n //while (a[0] + a[1] <= a[2])\n //{\n // count++;\n // a[0]++;\n //}\n if (a[0] + a[1] <= a[2])\n {\n count = a[2]-(a[0]+a[1])+1;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _1064_Make_a_triangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Array.Sort(a);\n var count = 0;\n while (a[0] + a[1] <= a[2])\n {\n count++;\n a[0]++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n List arr = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToList();\n\n arr.Sort();\n\n Console.WriteLine($\"{arr[2] - (arr[0] + arr[1]) + 1 }\");\n }\n }\n}"}, {"source_code": "using System.Linq;\nusing System.Collections.Generic;\nusing System;\n\nnamespace MyApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = 0, b = 0, c = 0;\n var inp = Console.ReadLine().Split();\n a = Convert.ToInt32(inp[0]);\n b = Convert.ToInt32(inp[1]);\n c = Convert.ToInt32(inp[2]);\n if(a > c) {\n c = a;\n }\n if(b > c) {\n c = b;\n }\n if(0 > c - (a + b - 1)) {\n Console.WriteLine(0);\n } else {\n Console.WriteLine(c - (a + b - 1));\n }\n }\n }\n}"}, {"source_code": "using System.Linq;\nusing System.Collections.Generic;\nusing System;\n\nnamespace MyApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = 0, b = 0, c = 0;\n var inp = Console.ReadLine().Split();\n a = Convert.ToInt32(inp[0]);\n b = Convert.ToInt32(inp[1]);\n c = Convert.ToInt32(inp[2]);\n if(a > c) {\n int temp = c;\n c = a;\n a = c;\n }\n if(b > c) {\n int temp = c;\n c = b;\n b = c;\n }\n int ans = 0;\n if(c - (a + b - 1) > ans) {\n ans = c - (a + b - 1);\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\n\npublic static class TriangleSolution\n{\n\tpublic static string Numbers = Console.ReadLine();\n\tpublic static int Length = Numbers.Length;\n\tpublic static int CurrentSide = 1;\n\tpublic static string[] separateNumbers = new string[3];\n\tpublic static int[] integerNumbers = new int[3];\n\tpublic static int numberOfMinutes = 1;\n\tpublic static int shortestSide1;\n\tpublic static int shortestSide2;\n\tpublic static int longestSide;\n\tpublic static void getSideLengths()\n\t{\n\t\tchar letter = '0';\n\t\tfor(int i = 0; i < Length; i++)\n\t\t{\n\t\t\tletter = Numbers[i];\n\t\t\tif(letter == ' ')\n\t\t\t{\n\t\t\t\tCurrentSide = CurrentSide + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\n\t\t\t\tseparateNumbers[CurrentSide - 1] = separateNumbers[CurrentSide - 1] + letter + \"\";\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void convertArrayToInteger(string[] chosenArray, int[] targetArray)\n\t{\n\t\tfor(int i = 0; i < chosenArray.Length; i++)\n\t\t{\n\t\t\ttargetArray[i] = int.Parse(chosenArray[i]);\n\t\t}\n\t}\n\tpublic static void declareSides(int sideShorter, int sideShorter2, int sideLonger)\n\t{\n\t\tshortestSide1 = sideShorter;\n\t\tshortestSide2 = sideShorter2;\n\t\tlongestSide = sideLonger;\n\t}\n\tpublic static void orderSides(int[] integerSideLengths)\n\t{\n\t\t\tif(integerSideLengths[0] > integerSideLengths[1])\n\t\t\t{\n\t\t\t\tif(integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\t{\n\t\t\t\t\tif(integerSideLengths[1] > integerSideLengths[2])\n\t\t\t\t\t\tdeclareSides(integerSideLengths[2],integerSideLengths[1],integerSideLengths[0]);\n\t\t\t\t\telse declareSides(integerSideLengths[1],integerSideLengths[2],integerSideLengths[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdeclareSides(integerSideLengths[1],integerSideLengths[0],integerSideLengths[2]);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[2],integerSideLengths[1]);\n\t\t\telse\n\t\t\t{\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[1],integerSideLengths[2]);\n\t\t\t}\n\t}\n\tpublic static void Main()\n\t{\n\t\tgetSideLengths();\n\t\tconvertArrayToInteger(separateNumbers, integerNumbers);\n\t\t\n\t\torderSides(integerNumbers);\n\t\t\n\t\tnumberOfMinutes = (longestSide - shortestSide1) - shortestSide2;\n\t\tif(numberOfMinutes < 0)\n\t\t{\n\t\t\tnumberOfMinutes = 0;\n\t\t}\n\t\telse numberOfMinutes++;\n\t\t\n\t\tConsole.WriteLine(numberOfMinutes);\n\t}\n\t\n}"}, {"source_code": "using System;\n\npublic static class TriangleSolution\n{\n\tpublic static string Numbers = Console.ReadLine();\n\tpublic static int Length = Numbers.Length;\n\tpublic static int CurrentSide = 1;\n\tpublic static string[] separateNumbers = new string[3];\n\tpublic static int[] integerNumbers = new int[3];\n\tpublic static int numberOfMinutes = 1;\n\tpublic static int shortestSide1;\n\tpublic static int shortestSide2;\n\tpublic static int longestSide;\n\tpublic static void getSideLengths()\n\t{\n\t\tchar letter = '0';\n\t\tfor(int i = 0; i < Length; i++)\n\t\t{\n\t\t\tletter = Numbers[i];\n\t\t\tif(letter == ' ')\n\t\t\t{\n\t\t\t\tCurrentSide = CurrentSide + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\n\t\t\t\tseparateNumbers[CurrentSide - 1] = separateNumbers[CurrentSide - 1] + letter + \"\";\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void convertArrayToInteger(string[] chosenArray, int[] targetArray)\n\t{\n\t\tfor(int i = 0; i < chosenArray.Length; i++)\n\t\t{\n\t\t\ttargetArray[i] = int.Parse(chosenArray[i]);\n\t\t}\n\t}\n\tpublic static void declareSides(int sideShorter, int sideShorter2, int sideLonger)\n\t{\n\t\tshortestSide1 = sideShorter;\n\t\tshortestSide2 = sideShorter2;\n\t\tlongestSide = sideLonger;\n\t}\n\tpublic static void orderSides(int[] integerSideLengths)\n\t{\n\t\t\tif(integerSideLengths[0] > integerSideLengths[1])\n\t\t\t{\n\t\t\t\tif(integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\t{\n\t\t\t\t\tif(integerSideLengths[1] > integerSideLengths[2])\n\t\t\t\t\t\tdeclareSides(integerSideLengths[2],integerSideLengths[1],integerSideLengths[0]);\n\t\t\t\t\telse declareSides(integerSideLengths[1],integerSideLengths[2],integerSideLengths[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdeclareSides(integerSideLengths[1],integerSideLengths[0],integerSideLengths[2]);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[2],integerSideLengths[1]);\n\t\t\telse\n\t\t\t{\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[1],integerSideLengths[2]);\n\t\t\t}\n\t}\n\tpublic static void Main()\n\t{\n\t\tgetSideLengths();\n\t\tconvertArrayToInteger(separateNumbers, integerNumbers);\n\t\t//Console.WriteLine(separateNumbers[2]);\n\t\torderSides(integerNumbers);\n\t\t//Console.WriteLine(integerNumbers[2]);\n\t\t//Console.WriteLine(longestSide + \"\" + shortestSide1 + \"\" + shortestSide2);\n\t\tnumberOfMinutes = (longestSide - shortestSide1) - shortestSide2;\n\t\tif(numberOfMinutes <= 0)\n\t\t{\n\t\t\tnumberOfMinutes = 0;\n\t\t}\n\t\telse numberOfMinutes++;\n\t\t/*Console.WriteLine(Numbers);\n\t\tConsole.WriteLine(separateNumbers[1]);\n\t\tConsole.WriteLine(integerNumbers[1]);\n\t\tConsole.WriteLine(longestSide + \" \" + shortestSide1);*/\n\t\tConsole.WriteLine(numberOfMinutes);\n\t}\n\t\n}"}, {"source_code": "using System;\n\npublic static class TriangleSolution\n{\n\tpublic static string Numbers = Console.ReadLine();\n\tpublic static int Length = Numbers.Length;\n\tpublic static int CurrentSide = 1;\n\tpublic static string[] separateNumbers = new string[3];\n\tpublic static int[] integerNumbers = new int[3];\n\tpublic static int numberOfMinutes = 1;\n\tpublic static int shortestSide1;\n\tpublic static int shortestSide2;\n\tpublic static int longestSide;\n\tpublic static void getSideLengths()\n\t{\n\t\tchar letter = '0';\n\t\tfor(int i = 0; i < Length; i++)\n\t\t{\n\t\t\tletter = Numbers[i];\n\t\t\tif(letter == ' ')\n\t\t\t{\n\t\t\t\tCurrentSide = CurrentSide + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\n\t\t\t\tseparateNumbers[CurrentSide - 1] = separateNumbers[CurrentSide - 1] + letter + \"\";\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void convertArrayToInteger(string[] chosenArray, int[] targetArray)\n\t{\n\t\tfor(int i = 0; i < chosenArray.Length; i++)\n\t\t{\n\t\t\ttargetArray[i] = int.Parse(chosenArray[i]);\n\t\t}\n\t}\n\tpublic static void declareSides(int sideShorter, int sideShorter2, int sideLonger)\n\t{\n\t\tshortestSide1 = sideShorter;\n\t\tshortestSide2 = sideShorter2;\n\t\tlongestSide = sideLonger;\n\t}\n\tpublic static void orderSides(int[] integerSideLengths)\n\t{\n\t\t\tif(integerSideLengths[0] > integerSideLengths[1])\n\t\t\t{\n\t\t\t\tif(integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\t{\n\t\t\t\t\tif(integerSideLengths[1] > integerSideLengths[2])\n\t\t\t\t\t\tdeclareSides(integerSideLengths[2],integerSideLengths[1],integerSideLengths[0]);\n\t\t\t\t\telse declareSides(integerSideLengths[1],integerSideLengths[2],integerSideLengths[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdeclareSides(integerSideLengths[1],integerSideLengths[0],integerSideLengths[2]);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (integerSideLengths[0] > integerSideLengths[2])\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[2],integerSideLengths[1]);\n\t\t\telse\n\t\t\t{\n\t\t\t\tdeclareSides(integerSideLengths[0],integerSideLengths[1],integerSideLengths[2]);\n\t\t\t}\n\t}\n\tpublic static void Main()\n\t{\n\t\tgetSideLengths();\n\t\tconvertArrayToInteger(separateNumbers, integerNumbers);\n\t\t//Console.WriteLine(separateNumbers[2]);\n\t\torderSides(integerNumbers);\n\t\t//Console.WriteLine(integerNumbers[2]);\n\t\t//Console.WriteLine(longestSide + \"\" + shortestSide1 + \"\" + shortestSide2);\n\t\tnumberOfMinutes = (longestSide - shortestSide1) - shortestSide2;\n\t\tif(numberOfMinutes < 0)\n\t\t{\n\t\t\tnumberOfMinutes = 0;\n\t\t}\n\t\telse numberOfMinutes++;\n\t\t/*Console.WriteLine(Numbers);\n\t\tConsole.WriteLine(separateNumbers[1]);\n\t\tConsole.WriteLine(integerNumbers[1]);\n\t\tConsole.WriteLine(longestSide + \" \" + shortestSide1);*/\n\t\tConsole.WriteLine(numberOfMinutes);\n\t}\n\t\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n Array.Sort( v );\n int a = v[0];\n int b = v[1];\n int c = v[2];\n\n //--------------------------------solve--------------------------------//\n\n Console.WriteLine( c + 1 - a - b );\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n //--------------------------------input--------------------------------//\n\n var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );\n Array.Sort( v );\n int a = v[0];\n int b = v[1];\n int c = v[2];\n\n //--------------------------------solve--------------------------------//\n\n if(c > a + b)\n Console.WriteLine( c + 1 - a - b );\n else\n Console.WriteLine( 0 );\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Achill\n{\n class Program\n {\n static void Main()\n {\n int[] abc = Console.ReadLine().Split().Select(item=>int.Parse(item)).ToArray();\n int max = abc[0], pos = 0;\n for(int i = 1; i < 3; ++i)\n {\n if(max < abc[i])\n {\n max = abc[i];\n pos = i;\n }\n }\n int res = 0;\n for(int i = 0; i < 3; ++i)\n {\n if(i != pos)\n {\n res += max - abc[i];\n }\n }\n Console.WriteLine(res < 0 ? 0 : res + 1);\n }\n }\n}\n"}], "src_uid": "3dc56bc08606a39dd9ca40a43c452f09"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _762A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n var divisors = new SortedSet();\n\n for (int i = 1; i <= n / i; i++)\n {\n if (n % i == 0)\n {\n divisors.Add(i);\n divisors.Add(n / i);\n }\n }\n\n Console.WriteLine(divisors.Skip(k - 1).DefaultIfEmpty(-1).First());\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] inputs = Console.ReadLine().Split(' ');\n Console.WriteLine(Solve(long.Parse(inputs[0]), int.Parse(inputs[1])));\n }\n\n static long Solve(long n, int k)\n {\n List divisors = new List(5000);\n\n for (int i = 1; (long)i * i <= n; i++)\n {\n if (n % i == 0)\n divisors.Add(i);\n }\n\n if (k > (divisors.Count * 2) - (IsPerfectSquare(n) ? 1 : 0))\n return -1;\n\n int offset = (IsPerfectSquare(n) ? 1 : 0);\n return (k <= divisors.Count) ? divisors[k - 1] : (n / divisors[2 * divisors.Count - k - offset]);\n }\n\n static bool IsPerfectSquare(long n)\n {\n long sq = (long)Math.Sqrt(n);\n return sq * sq == n;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(long x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int GetAns(int x, int pow)\n\t\t{\n\t\t\tif (pow == 0)\n\t\t\t\treturn 1;\n\t\t\tif (pow % 2 == 1)\n\t\t\t\treturn (GetAns(x, pow - 1) * 8) % 10;\n\t\t\tvar t = GetAns(x, pow / 2);\n\t\t\treturn (t * t) % 10;\n\t\t}\n\n\t\tpublic static int ans = 0;\n\t\tpublic static int move = 0;\n\t\tpublic static bool good = false; \n\t\tpublic static int[] x = { 0, 0, 0 };\n\n\t\tpublic static void solve(int a, int b, int c, int n)\n\t\t{\n\t\t\tif (ans != 0)\n\t\t\t\treturn;\n\t\t\tif (n > 0)\n\t\t\t{\n\t\t\t\tsolve(a, c, b, n - 1);\n\t\t\t\tmove++;\n\t\t\t\tx[a]--;\n\t\t\t\tx[b]++;\n\t\t\t\tif (x[a] == x[b] && x[b] == x[c] && ans == 0)\n\t\t\t\t{\n\t\t\t\t\tans = move;\n\t\t\t\t}\n\t\t\t\tsolve(c, b, a, n - 1);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = ReadListOfLongs();\n\t\t\tvar n = l[0];\n\t\t\tvar k = l[1];\n\t\t\tvar dividers = new List();\n\t\t\tfor (var i = 1; (long)i * i <= n; ++i)\n\t\t\t{\n\t\t\t\tif (n % i == 0)\n\t\t\t\t{\n\t\t\t\t\tdividers.Add(i);\n\t\t\t\t\tif ((long)i * i != n)\n\t\t\t\t\t\tdividers.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdividers.Sort();\n\t\t\tif (dividers.Count < k)\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(dividers[(int)k - 1]);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n private static List GetAllDivisors(long x)\n {\n var div = GetDivisors(x);\n var answer = new List();\n Iterate(1, div, 0, answer, false);\n\n answer.Sort();\n\n return answer;\n }\n\n private static void Iterate(long v, List div, int pos, List answer, bool skip)\n {\n if (!skip)\n answer.Add(v);\n\n if (pos == div.Count) return;\n\n Iterate(v, div, pos + 1, answer, true);\n\n\n long vv = v;\n for (int j = 0; j < div[pos].K; j++)\n {\n vv *= div[pos].P;\n Iterate(vv, div, pos + 1, answer, false);\n }\n }\n\n public class Divisor\n {\n public long P;\n public int K;\n }\n private static List GetDivisors(long x)\n {\n int end = (int)Math.Sqrt(x);\n List ans = new List();\n\n for (int i = 2; i <= end; i++)\n if (x % i == 0)\n {\n var newDiv = new Divisor() { P = i };\n while (x % i == 0)\n {\n newDiv.K++;\n x /= i;\n }\n\n ans.Add(newDiv);\n if (x == 1) break;\n }\n\n if (x > 1) ans.Add(new Divisor() { P = x, K = 1 });\n\n return ans;\n }\n\n private static void SolveA()\n {\n long n = RL();\n int k = RI();\n\n var divs = GetAllDivisors(n);\n if (k > divs.Count)\n Console.WriteLine(-1);\n else\n Console.WriteLine(divs[k - 1]);\n }\n\n private static void SolveB()\n {\n var n = RI();\n long ans = 0;\n for (int i = 0; i < n; i++)\n {\n\n }\n\n Console.WriteLine(ans);\n }\n\n static void Main(string[] args)\n {\n SolveA();\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n long n = sc.NextLong();\n int k = sc.NextInt();\n List div = new List();\n for (long i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n div.Add(i);\n if (n / i != i) div.Add(n / i);\n }\n }\n\n if (div.Count < k)\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n div.Sort();\n\n Console.WriteLine(div[k - 1]);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n long upperBound = ((long)Math.Sqrt(x));\n\n if (x != 1)\n {\n\n\n for (long i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n long first = i;\n long second = (long) x / i;\n\n a.Add(i);\n if (first != second) {\n a.Add(x / i);\n \n }\n\n }\n }\n }\n else {\n a.Add(1);\n }\n\n\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 1; testN++)\n {\n#endif\n var n = NextLong();\n var k = NextLong();\n var n2 = Math.Sqrt(n);\n var l = new List();\n \n long c = 0;\n long r = 0;\n long rem = 0;\n\n while (k > 0 && (c + 1) <= n2)\n {\n c++;\n r = Math.DivRem(n, c, out rem);\n if (rem == 0)\n {\n k--;\n if (r != c)\n {\n l.Add(r);\n }\n }\n }\n\n if (k == 0)\n {\n Console.WriteLine(c);\n }\n else if (l.Count >= k)\n {\n Console.WriteLine(l[l.Count - (int)k]);\n }\n else\n {\n Console.WriteLine(-1);\n }\n\n \n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static long[] ReadLongs(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();\n }\n\n private static long[] ReadLongs()\n {\n return ReadLongs(_defaultSplitter);\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Solution\n{\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n List factors = new List();\n for (long i = 1; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n factors.Add(i);\n long j = n / i;\n if (j > i)\n {\n factors.Add(j);\n }\n }\n }\n factors.Sort();\n if (factors.Count < k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(factors[(int)k - 1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace EdxCourse\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n ulong n = ulong.Parse(input[0]);\n ulong k = ulong.Parse(input[1]);\n ulong sqrt = Convert.ToUInt64(Math.Sqrt(n)) + 1;\n List numbers = new List();\n for (ulong i = 1; i < sqrt; i++)\n if (n % i == 0)\n {\n numbers.Add(i);\n if (n / i != i)\n numbers.Add(n / i);\n }\n numbers.Sort();\n\n ulong len = (ulong)numbers.Count;\n\n if (k > len)\n Console.WriteLine(-1);\n else\n {\n k--;\n Console.WriteLine(numbers[Convert.ToInt32(k)]);\n }\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Numerics;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n long N;int K;\n sc.Make(out N, out K);\n var res = new List();\n for(var i=1L;i*i<=N;i++)\n if (N % i == 0)\n {\n res.Add(i);\n if (N / i != i) res.Add(N / i);\n }\n res.Sort();\n if (res.Count < K) Fail(-1);\n WriteLine(res[--K]);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\n/* Input Methoden : \n * \n * Integer: int n = int.Parse(Console.ReadLine());\n * String: String n = Console.ReadLine();\n * Integer Array: int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();\n * String Array: String[] input = Console.ReadLine().Split(' ');\n * \n * --- Datenstrukturen:\n * List list = new List();\n * HashSet hset = new HashSet(); \n * Dictionary dict = new Dictionary();\n * \n * \n * Ausgabe: Console.WriteLine();\n * \n * \n * \n */\n\npublic class Program\n{\n\n static void Main(String[] args)\n {\n long[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt64(r)).ToArray();\n long n = input[0];\n long k = input[1];\n\n\n long maxDivisor = (int) Math.Sqrt(n);\n List divisorsLow = new List();\n List divisorsHigh = new List();\n\n\n \n for (int i = 1; i <= maxDivisor; i++) {\n\n if (n % i == 0) {\n\n long a = i;\n long b = n / i;\n\n if (a != b)\n {\n divisorsLow.Add(a);\n divisorsHigh.Add(b);\n }\n else {\n\n divisorsLow.Add(a);\n }\n \n\n \n }\n\n \n\n }\n\n if (divisorsLow.Count + divisorsHigh.Count < k)\n {\n Console.WriteLine(-1);\n\n }\n else {\n\n if (k <= divisorsLow.Count)\n {\n Console.WriteLine(divisorsLow[(int)k-1]);\n }\n else {\n\n long dif = k - divisorsLow.Count;\n long ind = divisorsHigh.Count - (dif);\n\n Console.WriteLine(divisorsHigh[(int)ind]);\n \n \n }\n\n \n }\n\n Console.ReadLine();\n }\n\n \n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n long maxCount =(long) Math.Sqrt(n);\n for(int i=1; ;i++)\n {\n if(i>maxCount)\n break;\n if(n%i==0)\n {\n if(!myList.Contains(i))\n myList.Add(i);\n num =n / i;\n if(!myList.Contains(num))\n myList.Add(num);\n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n long maxCount =(long) Math.Sqrt(n);\n for(int i=1; ;i++)\n {\n if(i>=num||i>maxCount)\n break;\n if(n%i==0)\n {\n if(!myList.Contains(i))\n myList.Add(i);\n num =n / i;\n if(!myList.Contains(num))\n myList.Add(num);\n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\nusing StringBuilder = System.Text.StringBuilder;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (n == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlong copyN = n;\n\t\t\tlong border = n / 2;\n\t\t\tvar ds = new List{ 1 };\n\t\t\tint index = 1;\n\t\t\tfor (long i = 2; i <= border; i++) \n\t\t\t{\n\t\t\t\tif (i > Math.Sqrt(n)) \n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (copyN % i > 0) \n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (copyN / i != i) \n\t\t\t\t{\n\t\t\t\t\tds.Insert(index, n / i);\n\t\t\t\t}\n\n\t\t\t\tds.Insert(index++, i);\n\t\t\t\tborder = n / i;\n\t\t\t\tif (index > k) \n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tds.Add(n);\n\t\t\tif (ds.Count >= k)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(ds.ElementAt((int)(k - 1)));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var cnt = 0;\n var n = data[0];\n var k = data[1];\n var sqrN = (long)Math.Sqrt(n);\n var d = 1;\n var firstDivs = new List();\n var secondDivs = new List();\n while (d <=sqrN)\n {\n if (n%d == 0)\n {\n firstDivs.Add(d);\n if(n/d != d)\n secondDivs.Add(n/d);\n }\n d++;\n }\n if(k > firstDivs.Count + secondDivs.Count)\n Console.WriteLine(-1);\n if (k > firstDivs.Count)\n {\n k -= firstDivs.Count;\n for (int i = secondDivs.Count-1; i > -1; i--)\n {\n if (k == 1)\n {\n Console.WriteLine(secondDivs[i]);\n return;\n }\n\n k--;\n \n }\n }\n else\n {\n for (int i = 0; i < firstDivs.Count; i++)\n {\n if (k == 1)\n {\n Console.WriteLine(firstDivs[i]);\n return;\n }\n k--;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n long n = input.NextLong();\n int k = input.NextInt();\n long last = (long)Math.Sqrt(n);\n int c = 0;\n for (long i = 1; i <= last; i++)\n {\n if (n % i == 0)\n {\n c++;\n if (c == k)\n {\n Console.Write(i);\n return;\n }\n }\n }\n if (last * last == n)\n {\n last--;\n }\n for (long i = last; i > 0; i--)\n {\n if (n % i == 0)\n {\n c++;\n if (c == k)\n {\n Console.Write(n / i);\n return;\n }\n }\n }\n Console.Write(-1);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static void Main(string[] args)\n {\n string[] ip = Console.ReadLine().Split();\n long n = long.Parse(ip[0]);\n int k = int.Parse(ip[1]);\n var lower = new List();\n var higher = new List();\n long i;\n for(i = 1; i * i < n; i++)\n {\n if(n % i == 0)\n {\n lower.Add(i);\n higher.Add(n / i);\n }\n }\n if(i * i == n)\n {\n lower.Add(i);\n }\n higher.Sort();\n long ans;\n if(k <= lower.Count)\n {\n ans = lower[k - 1];\n }\n else if(k <= lower.Count + higher.Count)\n {\n ans = higher[k - lower.Count - 1];\n }\n else\n {\n ans = -1;\n }\n Console.WriteLine(ans);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var cin = Console.ReadLine().Split(' ');\n\n long n = long.Parse(cin[0]);\n int k = int.Parse(cin[1]);\n\n var d = new List();\n\n for (int i = 1; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n d.Add(i);\n }\n }\n\n int s = d.Count();\n\n for (int i = 0; i < s; i++)\n {\n if (d[i] == Math.Sqrt(n)) { continue; }\n d.Add(n / d[i]);\n }\n\n d.Sort();\n\n long r = k <= d.Count() ? d[k - 1] : -1;\n\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace kdivisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n \n long n = long.Parse(s[0]);\n int k = int.Parse(s[1]);\n\n long lim =(long) Math.Sqrt(n);\n\n long ans = -1;\n int count = 0;\n List divisors = new List();\n\n for (long i=1;i<=lim;i++)\n {\n if (n%i==0)\n {\n count++;\n if (count==k)\n {\n ans = i;\n break;\n }\n if (n/i!=i) divisors.Insert(0, n / i);\n }\n }\n\n if (ans == -1 && count + divisors.Count >= k) ans = divisors[k-count-1];\n \n Console.Write(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace k_th_divisor\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n\n private static void Main(string[] args)\n {\n long n = Next();\n long k = Next() - 1;\n\n var l = new List();\n var o = new Stack();\n\n for (long i = 1;; i++)\n {\n if (i*i >= n)\n {\n if (i*i == n)\n l.Add(i);\n break;\n }\n if (n%i == 0)\n {\n l.Add(i);\n o.Push(n/i);\n }\n }\n l.AddRange(o);\n\n if (k < l.Count)\n writer.WriteLine(l[(int) k]);\n else writer.WriteLine(\"-1\");\n\n\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _762A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), k = long.Parse(input[1]) - 1;\n List factors = new List();\n long max = (long)Math.Sqrt(n);\n for (long factor = 1; factor <= max; ++factor)\n {\n if (n % factor == 0)\n {\n factors.Add(factor);\n if (factor != n / factor)\n {\n factors.Add(n / factor);\n }\n }\n }\n factors.Sort();\n if (factors.Count < k + 1)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(factors[(int)k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces5\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] Data = Console.ReadLine().Split(' ');\n\t\t\tlong[] data = Array.ConvertAll(Data, x => long.Parse(x));\n\t\t\tlong count = 0, result = 0;\n\t\t\tfor (long i = 1; i <= (int)Math.Sqrt(data[0]); i++)\n\t\t\t\tif (data[0] % i == 0)\n\t\t\t\t\tif (++count == data[1])\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\tif (count != data[1])\n\t\t\t{\n\t\t\t\tlong del = 2 * count;\n\t\t\t\tif ((int)Math.Sqrt(data[0]) == Math.Sqrt(data[0])) del--;\n\t\t\t\tif (del < data[1]) result = -1;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfor (long i = 1, newcount = 0; newcount <= del - data[1] + 1; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (data[0] % i == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnewcount++;\n\t\t\t\t\t\t\tif (newcount == del - data[1] + 1)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tresult = data[0] / i;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0430\u0430\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] num = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(num[0]);\n Int32 k = Int32.Parse(num[1]);\n Int64 End =Convert.ToInt64(Math.Sqrt(n));\n List spisok = new List();\n for (int i = 1; i <= End; i++)\n {\n if (n%i==0)\n {\n spisok.Add(i);\n if (i != (n / i))\n {\n spisok.Add(n / i);\n }\n } \n }\n if (spisok.Count < k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n spisok.Sort();\n Console.WriteLine(spisok.ElementAt(k-1));\n }\n\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar div1 = new List();\n\t\t\tvar div2 = new List();\n\t\t\tfor (var i = 1L; i * i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tdiv1.Add(i);\n\t\t\t\t\tdiv2.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar sortedSet = new SortedSet(div1);\n\t\t\tsortedSet.UnionWith(div2);\n\t\t\tif (sortedSet.Count < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsw.WriteLine(sortedSet.ToArray()[k - 1]);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n long sqrt = (long)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n long[] divs = new long[100000];\n long[] mirror = new long[100000];\n long counter = 0;\n for (long i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt64(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k-1]);\n else if (k == counter + 1 && b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt64(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace k_divisor\n{\n class Program\n {\n static int max = 31622780;\n static int[] primes = new int[max];\n static List facts = new List();\n static List factoring = new List();\n static List divisors = new List();\n static void Cieve()\n {\n for (int i = 4; i < max; i += 2) primes[i] = 2;\n for (int i = 3; i * i < max; i += 2)\n if (primes[i] == -1)\n for (int j = i * i; j < max; j += 2 * i)\n primes[j] = i;\n }\n\n static void prime_fact(long n)\n {\n for (long i = 2; i < max; i++)\n {\n if (primes[i] == -1 && n % i == 0)\n facts.Add(i);\n }\n }\n\n static void factorization(long n)\n {\n long aux = n; \n for (int i = 0; i < facts.Count; i++)\n {\n int c = 0;\n long v = facts[i];\n while (aux % v == 0)\n {\n c++;\n aux /= v;\n }\n factoring.Add(v); factoring.Add(c);\n }\n if(aux > 1){\n factoring.Add(aux);\n factoring.Add(1);\n }\n\t\t\t\n }\n\n static void Divisors(long n)\n {\n for (int i = 0; i < factoring.Count; i += 2)\n {\n int c = 0;\n long v = factoring[i];\n for (int k = 1; k <= factoring[i+1]; k++)\n {\n long x = (long)Math.Pow(v, k);\n if (x < n)\n {\n divisors.Add(x);\n c++;\n }\n else\n break;\n }\n int t = divisors.Count;\n for(int j = t-c; j < t; j++)\n for(int s = 0; s < t-c; s++){\n long aux = divisors[j]*divisors[s];\n if(aux < n)\n divisors.Add(aux);\n } \n }\n divisors.Add(n);\n divisors.Insert(0, 1);\n divisors.Sort();\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); \n char []sep= new char[]{' '};\n string[] ns = s.Split(sep,2);\n long n = long.Parse(ns[0]);\n long k = long.Parse(ns[1]); \n if (n == 1)\n {\n if(k == 1)\n Console.WriteLine(1);\n else\n Console.WriteLine(-1);\n return;\n }\n for (long i = 2; i < max; i++)\n {\n primes[i] = -1;\n }\n Cieve();\n prime_fact(n);\n factorization(n);\n Divisors(n);\n if (k > divisors.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n int t = (int)k;\n Console.WriteLine(divisors[t-1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n string strInfo01 = Console.ReadLine();\n\n long lngNumber = long.Parse(strInfo01.Split()[0]);\n long lngPosition = long.Parse(strInfo01.Split()[1]);\n long lngSquare = (long)Math.Sqrt(lngNumber);\n\n List lstResults = new List();\n\n for (long i = 1; i <= lngSquare; i++)\n {\n if (lngNumber % i == 0)\n {\n lstResults.Add(i);\n if (i != lngNumber/i)\n {\n lstResults.Add(lngNumber / i);\n }\n }\n }\n\n lstResults.Sort();\n\n if (lstResults.Count< lngPosition)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(lstResults [(int)lngPosition-1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace denemexxxx\n{\n class Program\n {\n static void Main(string[] args)\n {\n try {\n string[] nk = Console.ReadLine().Split(' ');\n long n = long.Parse(nk[0]);\n long k = long.Parse(nk[1])-1;\n List sayilar = new List();\n long max = (long)Math.Sqrt(n);\n for (long i = 1; i <=max; ++i)\n {\n if(n%i == 0)\n {\n sayilar.Add(i);\n if (i != n / i)\n sayilar.Add(n / i);\n }\n }\n sayilar.Sort();\n if (sayilar.Count < k + 1)\n {\n Console.Write(-1);\n }\n else\n Console.Write(sayilar[(int)k]);\n Console.ReadKey();\n }\n catch { }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace denemexxxx\n{\n class Program\n {\n static void Main(string[] args)\n {\n try {\n string[] nk = Console.ReadLine().Split(' ');\n long n = long.Parse(nk[0]);\n long k = long.Parse(nk[1])-1;\n List sayilar = new List();\n long max = (long)Math.Sqrt(n);\n for (long i = 1; i <=max; i++)\n {\n if(n%i == 0)\n {\n sayilar.Add(i);\n if (i != n / i)\n sayilar.Add(n / i);\n }\n }\n sayilar.Sort();\n if (sayilar.Count < k + 1)\n {\n Console.Write(-1);\n }\n else\n Console.Write(sayilar[(int)k]);\n Console.ReadKey();\n }\n catch { }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace k_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] x = Console.ReadLine().Split();\n Int64 n = Int64.Parse(x[0]);\n Int32 k = Int32.Parse(x[1]);\n Int64 End = Convert.ToInt64(Math.Sqrt(n));\n List sleem = new List();\n for (int i = 1; i <= End; i++)\n {\n if (n % i == 0)\n {\n sleem.Add(i);\n if (i != (n / i))\n {\n sleem.Add(n / i);\n }\n }\n }\n if (sleem.Count < k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n sleem.Sort();\n Console.WriteLine(sleem.ElementAt(k - 1));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public decimal a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = decimal.Parse(q[0]);\n b = decimal.Parse(q[1]);\n }\n public PairVariable(decimal a, decimal b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n long n = long.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n List d = new List();\n d.Add(1);\n\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n d.Add(i);\n }\n }\n\n int x = d.Count;\n for (int i = 0; i < x; i++)\n {\n if (n % d[i] == 0)\n {\n if (n / d[i] != d[i])\n {\n d.Add(n / d[i]);\n }\n }\n }\n d.Sort();\n //d.Add(n);\n /*for (int i = 0; i < d.Count; i++)\n {\n Console.Write(d[i]+\" \");\n }\n Console.WriteLine();*/\n if (m > d.Count)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(d[m - 1]);\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _2609cry\n{\n class Program\n {\n static void Main(string[] args)\n {\n String [] str = Console.ReadLine().Split();\n Int64 n = Convert.ToInt64(str[0]);\n Int32 m = Convert.ToInt32(str[1]);\n\n List del = new List();\n\n for (int i = 1; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n del.Add(i);\n if (i != n / i) \n del.Add(n / i);\n }\n }\n\n del.Sort();\n\n if (del.Count >= m)\n {\n Console.WriteLine(del[m - 1]);\n }\n else Console.WriteLine(-1);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n long n = input.NextLong();\n int k = input.NextInt();\n long last = (long)Math.Sqrt(n);\n int c = 0;\n for (long i = 1; i <= last; i++)\n {\n if (n % i == 0)\n {\n c++;\n if (c == k)\n {\n Console.Write(i);\n return;\n }\n }\n }\n if (last * last == n)\n {\n last--;\n c--;\n }\n for (long i = last; i > 0; i--)\n {\n if (n % i == 0)\n {\n c++;\n if (c == k)\n {\n Console.Write(n / i);\n return;\n }\n }\n }\n Console.Write(-1);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static void Main(string[] args)\n {\n string[] ip = Console.ReadLine().Split();\n long n = long.Parse(ip[0]);\n int k = int.Parse(ip[1]);\n var lower = new List();\n var higher = new List();\n long i;\n for(i = 1; i * i < n; i++)\n {\n if(n % i == 0)\n {\n lower.Add(i);\n higher.Add(n / i);\n }\n }\n if(i * i == n)\n {\n lower.Add(i);\n }\n long ans;\n if(k <= lower.Count)\n {\n ans = lower[k - 1];\n }\n else if(k <= lower.Count + higher.Count)\n {\n ans = higher[k - lower.Count - 1];\n }\n else\n {\n ans = -1;\n }\n Console.WriteLine(ans);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0430\u0430\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] num = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(num[0]);\n Int32 k = Int32.Parse(num[1]);\n Int64 End =Convert.ToInt64(Math.Sqrt(n));\n List spisok = new List();\n for (int i = 1; i <= End+1; i++)\n {\n if (n%i==0)\n {\n spisok.Add(i);\n if (i != (n / i))\n {\n spisok.Add(n / i);\n }\n } \n }\n if (spisok.Count < k)\n {\n Console.WriteLine(-1);\n }\n else\n {\n spisok.Sort();\n Console.WriteLine(spisok.ElementAt(k-1));\n }\n\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0430\u0430\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] num = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(num[0]);\n Int64 k = Int64.Parse(num[1]);\n Int64 End =Convert.ToInt64(Math.Sqrt(n));\n Int16 count = 0;\n bool fl = true;\n // List spisok = new List();\n for (int i = 1; i <= End+1; i++)\n {\n if (n%i==0)\n {\n count++;\n if (count==k)\n {\n fl = false;\n Console.WriteLine(i);\n break;\n }\n } \n }\n if (fl==true&&(k-count==1))\n {\n fl = false;\n Console.WriteLine(n);\n }\n if (fl)\n {\n Console.WriteLine(-1);\n }\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0430\u0430\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] num = Console.ReadLine().Split(' ');\n Int64 n = Int64.Parse(num[0]);\n Int64 k = Int64.Parse(num[1]);\n Int64 End =Convert.ToInt64(Math.Sqrt(n));\n End = End * 2;\n Int16 count = 0;\n bool fl = true;\n // List spisok = new List();\n for (int i = 1; i <= End+1; i++)\n {\n if (n%i==0)\n {\n count++;\n if (count==k)\n {\n fl = false;\n Console.WriteLine(i);\n break;\n }\n } \n }\n if (fl==true&&(k-count==1))\n {\n fl = false;\n Console.WriteLine(n);\n }\n if (fl)\n {\n Console.WriteLine(-1);\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar mid = (long)Math.Sqrt(n);\n\t\t\tvar div1 = new List();\n\t\t\tvar div2 = new List();\n\t\t\tfor (var i = 1; i <= mid; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tdiv1.Add(i);\n\t\t\t\t\tdiv2.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (div1.Count + div2.Count < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (div1.Count >= k) {\n\t\t\t\tsw.WriteLine(div1[(int)k - 1]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(div2[div2.Count - ((int) k -div1.Count)]);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar mid = (long)Math.Sqrt(n);\n\t\t\tvar curr = 0;\n\t\t\tfor (var i = 1; i <= mid; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tcurr++;\n\t\t\t\t}\n\t\t\t\tif (curr == k) {\n\t\t\t\t\tsw.WriteLine(i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(-1);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar div1 = new List();\n\t\t\tvar div2 = new List();\n\t\t\tfor (var i = 1L; i * i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tdiv1.Add(i);\n\t\t\t\t\tdiv2.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (div1.Count + div2.Count < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (div1.Count >= k) {\n\t\t\t\tsw.WriteLine(div1[(int)k - 1]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(div2[div2.Count - ((int) k -div1.Count)]);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar mid = (long)Math.Sqrt(n);\n\t\t\tvar div1 = new List();\n\t\t\tvar div2 = new List();\n\t\t\tfor (var i = 1; i <= mid; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tdiv1.Add(i);\n\t\t\t\t\tdiv2.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (div1.Count + div2.Count < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (div1.Count >= k) {\n\t\t\t\tsw.WriteLine(div1[(int)k - 1]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(div2[((int) k -div1.Count - 1)]);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int64.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar k = input[1];\n\t\t\tvar mid = (long)Math.Sqrt(n);\n\t\t\tvar div1 = new List();\n\t\t\tvar div2 = new List();\n\t\t\tfor (var i = 1; i <= mid; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tdiv1.Add(i);\n\t\t\t\t\tdiv2.Add(n / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (div1.Count + div2.Count < k) {\n\t\t\t\tsw.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (div1.Count >= k) {\n\t\t\t\tsw.WriteLine(div1[(int)k - 1]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsw.WriteLine(div2[div2.Count - ((int) k -div1.Count - 1) - 1]);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose)\n\t\t{\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n long sqrt = (long)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n long[] divs = new long[100000];\n long[] mirror = new long[100000];\n long counter = 0;\n for (long i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt64(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k-1]);\n else if (b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt64(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n long sqrt = (long)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n long[] divs = new long[100000];\n long[] mirror = new long[100000];\n long counter = 0;\n for (long i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt64(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k]);\n else if (b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt64(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n int sqrt = (int)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n long[] divs = new long[100000];\n long[] mirror = new long[100000];\n int counter = 0;\n for (int i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = (long)n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt32(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k]);\n else if (b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt64(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n\n //int sqrt = (int)Math.Sqrt(n);\n int counter = 0;\n for (int i = 1; i < n; i++)\n {\n if (n % i == 0)\n {\n counter++;\n if (counter == k) { Console.WriteLine(i); break; }\n }\n else if (counter > k) { Console.WriteLine(\"-1\"); break; }\n\n }\n\n if (counter < k) Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n int sqrt = (int)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n int[] divs = new int[100000];\n int[] mirror = new int[100000];\n int counter = 0;\n for (int i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = (int)n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt32(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k]);\n else if (b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt32(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_kth_divisor\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n bool b = false;\n \n long sqrt = (long)(Math.Ceiling(Math.Sqrt(n)));\n if (sqrt * sqrt == n) b = true; \n\n long[] divs = new long[100000];\n long[] mirror = new long[100000];\n int counter = 0;\n for (int i = 1; i < sqrt; i++)\n {\n if (n % i == 0)\n {\n divs[counter] = i;\n mirror[counter] = (long)n / i;\n counter++; \n }\n }\n\n \n if (k > (counter) * 2 + Convert.ToInt64(b)) Console.WriteLine(\"-1\");\n else if (k <= counter) Console.WriteLine(divs[k]);\n else if (b) Console.WriteLine(sqrt);\n else Console.WriteLine(mirror[(counter) * 2 + Convert.ToInt64(b) - k]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace k_divisor\n{\n class Program\n {\n static long max = 31622780;\n static long[] primes = new long[max];\n static List facts = new List();\n static List factoring = new List();\n static List divisors = new List();\n static void Cieve()\n {\n for (long i = 4; i < max; i += 2) primes[i] = 2;\n for (long i = 3; i * i < max; i += 2)\n if (primes[i] == -1)\n for (long j = i * i; j < max; j += 2 * i)\n primes[j] = i;\n }\n\n static void prime_fact(long n)\n {\n for (long i = 2; i < max; i++)\n {\n if (primes[i] == -1 && n % i == 0)\n facts.Add(i);\n }\n }\n\n static void factorization(long n)\n {\n long aux = n; \n for (int i = 0; i < facts.Count; i++)\n {\n int c = 0;\n long v = facts[i];\n while (aux % v == 0)\n {\n c++;\n aux /= v;\n }\n factoring.Add(v); factoring.Add(c);\n }\n if(aux > 1){\n factoring.Add(aux);\n factoring.Add(1);\n }\n }\n\n static void Divisors(long n)\n {\n for (int i = 0; i < factoring.Count; i += 2)\n {\n int c = 0;\n long v = factoring[i];\n for (int k = 1; k <= factoring[i+1]; k++)\n {\n long x = (long)Math.Pow(v, k);\n if (x < n)\n {\n divisors.Add(x);\n c++;\n }\n else\n break;\n }\n int t = divisors.Count;\n for(int j = t-c; j < t; j++)\n for(int s = 0; s < t-c; s++){\n long aux = divisors[j]*divisors[s];\n if(aux < n)\n divisors.Add(aux);\n } \n }\n divisors.Add(n);\n divisors.Insert(0, 1);\n divisors.Sort();\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); \n char []sep= new char[]{' '};\n string[] ns = s.Split(sep,2);\n long n = long.Parse(ns[0]);\n long k = long.Parse(ns[1]);\n if(k > 50)\n {\n Console.WriteLine(-1);\n return;\n }\n if (n == 1)\n {\n if(k == 1)\n Console.WriteLine(1);\n else\n Console.WriteLine(-1);\n return;\n }\n for (long i = 2; i < max; i++)\n {\n primes[i] = -1;\n }\n Cieve();\n prime_fact(n);\n factorization(n);\n Divisors(n);\n if (k > divisors.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n int t = (int)k;\n Console.WriteLine(divisors[t-1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace k_divisor\n{\n class Program\n {\n static long max = 31622780;\n static long[] primes = new long[max];\n static List facts = new List();\n static List factoring = new List();\n static List divisors = new List();\n static void Cieve()\n {\n for (long i = 4; i < max; i += 2) primes[i] = 2;\n for (long i = 3; i * i < max; i += 2)\n if (primes[i] == -1)\n for (long j = i * i; j < max; j += 2 * i)\n primes[j] = i;\n }\n\n static void prime_fact(long n)\n {\n for (long i = 2; i < max; i++)\n {\n if (primes[i] == -1 && n % i == 0)\n facts.Add(i);\n }\n }\n\n static void factorization(long n)\n {\n long aux = n; \n for (int i = 0; i < facts.Count; i++)\n {\n int c = 0;\n long v = facts[i];\n while (aux % v == 0)\n {\n c++;\n aux /= v;\n }\n factoring.Add(v); factoring.Add(c);\n }\n\t\t\tfacts.Clear();\n if(aux > 1){\n factoring.Add(aux);\n factoring.Add(1);\n }\n\t\t\t\n }\n\n static void Divisors(long n)\n {\n for (int i = 0; i < factoring.Count; i += 2)\n {\n int c = 0;\n long v = factoring[i];\n for (int k = 1; k <= factoring[i+1]; k++)\n {\n long x = (long)Math.Pow(v, k);\n if (x < n)\n {\n divisors.Add(x);\n c++;\n }\n else\n break;\n }\n\t\t\t\tfactoring.Clear();\n int t = divisors.Count;\n for(int j = t-c; j < t; j++)\n for(int s = 0; s < t-c; s++){\n long aux = divisors[j]*divisors[s];\n if(aux < n)\n divisors.Add(aux);\n } \n }\n divisors.Add(n);\n divisors.Insert(0, 1);\n divisors.Sort();\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); \n char []sep= new char[]{' '};\n string[] ns = s.Split(sep,2);\n long n = long.Parse(ns[0]);\n long k = long.Parse(ns[1]); \n if (n == 1)\n {\n if(k == 1)\n Console.WriteLine(1);\n else\n Console.WriteLine(-1);\n return;\n }\n for (long i = 2; i < max; i++)\n {\n primes[i] = -1;\n }\n Cieve();\n prime_fact(n);\n factorization(n);\n Divisors(n);\n if (k > divisors.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n int t = (int)k;\n Console.WriteLine(divisors[t-1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass cf1\n{\n static void Main()\n {\n string strInfo01 = Console.ReadLine();\n\n long lngNumber = long.Parse(strInfo01.Split()[0]);\n long lngPosition = long.Parse(strInfo01.Split()[1]);\n long lngSquare = (long)Math.Sqrt(lngNumber);\n\n List lstResults = new List();\n\n for (long i = 1; i <= lngSquare; i++)\n {\n if (lngNumber % i == 0)\n {\n lstResults.Add(i);\n if (i != lngNumber/i)\n {\n lstResults.Add(lngNumber / i);\n }\n }\n }\n\n lstResults.Sort();\n\n if (lstResults.Count< lngPosition+1)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(lstResults [(int)lngPosition]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace denemexxxx\n{\n class Program\n {\n static void Main(string[] args)\n {\n try {\n int[] sayilar = new int[10000000];\n int sayac = 0;\n int[] nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n for (int i = 1; i <= nk[0] / 2; i++)\n {\n if (nk[0] % i == 0)\n {\n sayilar[sayac] = i;\n sayac++;\n }\n }\n sayilar[sayac] = nk[0];\n if (sayilar[nk[1] - 1] == 0)\n Console.Write(-1);\n else\n Console.WriteLine(sayilar[nk[1] - 1]);\n\n Console.ReadKey();\n }\n catch { }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nclass Program\n{\n static void Main(string[] args)\n {\n string[] inputs = Console.ReadLine().Split(' ');\n Console.WriteLine(Solve(long.Parse(inputs[0]), int.Parse(inputs[1])));\n }\n\n static long Solve(long n, int k)\n {\n List divisors = new List(5000);\n\n for (int i = 1; (long)i * i <= n; i++)\n {\n if (n % i == 0)\n divisors.Add(i);\n }\n\n if (k > (divisors.Count * 2) - (IsPerfectSquare(n) ? 1 : 0))\n return -1;\n\n int offset = (IsPerfectSquare(n) ? 1 : 0);\n return (k <= divisors.Count) ? divisors[k - 1] : (n / divisors[2 * divisors.Count - k - offset]);\n }\n\n static bool IsPerfectSquare(long n)\n {\n var sq = (int)Math.Sqrt(n);\n return sq * sq == n;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x));\n\n if (x != 1) { \n \n \n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n a.Add(i);\n a.Add(x / i);\n }\n }\n }\n\n\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x));\n\n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n a.Add(i);\n a.Add(x / i);\n }\n }\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x));\n\n if (x != 1)\n {\n\n\n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n a.Add(i);\n a.Add(x / i);\n }\n }\n }\n else {\n a.Add(1);\n }\n\n\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n long upperBound = ((long)Math.Sqrt(x));\n\n if (x != 1)\n {\n\n\n for (long i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n long first = i;\n long second = (long) x / i;\n\n a.Add(i);\n Console.WriteLine(first);\n\n if (first != second) {\n a.Add(x / i);\n Console.WriteLine(second);\n }\n\n }\n }\n }\n else {\n a.Add(1);\n }\n\n\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x));\n\n if (x != 1)\n {\n\n\n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n int first = i;\n int second = (int) x / i;\n\n a.Add(i);\n\n if (first != second) {\n a.Add(x / i);\n }\n\n }\n }\n }\n else {\n a.Add(1);\n }\n\n\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x)) + 1; \n\n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n a.Add(i);\n a.Add(x / i);\n }\n }\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace kth_test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n\n string[] input = Console.ReadLine().Split(\" \");\n\n\n long res = FindDivisor(Convert.ToInt64(input[0]), Convert.ToInt64(input[1]));\n Console.WriteLine(res);\n\n\n\n }\n\n static long FindDivisor(long x , long y)\n {\n List a = new List();\n\n int upperBound = ((int)Math.Sqrt(x));\n Console.WriteLine(upperBound);\n\n for (int i = 1; i <= upperBound; i++)\n {\n if (x % i == 0)\n {\n a.Add(i);\n a.Add(x / i);\n }\n }\n try\n {\n a.Sort();\n int z = (int) y;\n return a[z-1];\n }\n catch (ArgumentOutOfRangeException)\n {\n\n return -1;\n }\n \n }\n \n \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace EdxCourse\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]);\n long k = long.Parse(input[1]);\n long sqrt = Convert.ToInt64(Math.Sqrt(n)) + 1;\n long[] numbers = new long[sqrt];\n int len = 0;\n for (long i = 1; i < sqrt; i++)\n if (n % i == 0)\n numbers[len++] = i;\n\n if (k > len * 2)\n Console.WriteLine(-1);\n else\n {\n k -= 1;\n if (k >= len)\n Console.WriteLine(n / numbers[k - len]);\n else\n Console.WriteLine(numbers[k]);\n }\n }\n } \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace EdxCourse\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n ulong n = ulong.Parse(input[0]);\n ulong k = ulong.Parse(input[1]);\n ulong sqrt = Convert.ToUInt64(Math.Sqrt(n)) + 1;\n List numbers = new List();\n uint len = 0;\n for (ulong i = 1; i < sqrt; i++)\n if (n % i == 0)\n {\n numbers.Add(i);\n numbers.Add(n / i);\n len += 2;\n }\n numbers.Sort();\n\n if (k > len)\n Console.WriteLine(-1);\n else\n {\n k--;\n Console.WriteLine(numbers[Convert.ToInt32(k)]);\n }\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n for(int i=1; ;i++)\n {\n if(n%i==0)\n {\n if(i>=num)\n break;\n myList.Add(i);\n num =n / i;\n myList.Add(num);\n }\n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;i myList = new List();\n // myList.Contains(i)\n for(int i=1; ;i++)\n {\n if(n%i==0)\n {\n if(i>=num)\n break;\n myList.Add(i);\n num =n / i;\n myList.Add(num);\n }\n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;i myList = new List();\n // myList.Contains(i)\n long h = (n%2==0)?n/2:n+1/2;\n for(int i=1;i=num)\n break;\n if(n%i==0)\n {\n if(!myList.Contains(i))\n myList.Add(i);\n num =n / i;\n if(!myList.Contains(num))\n myList.Add(num);\n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n for(int i=1;i<19191 ;i++)\n {\n if(i>=num)\n break;\n if(n%i==0)\n {\n if(!myList.Contains(i))\n myList.Add(i);\n num =n / i;\n if(!myList.Contains(num))\n myList.Add(num);\n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n for(int i=1; i<30;i++)\n {\n if(n%i==0)\n {\n if(i>=num)\n break;\n myList.Add(i);\n num =n / i;\n myList.Add(num);\n \n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;i myList = new List();\n // myList.Contains(i)\n for(int i=1; ;i++)\n {\n if(n%i==0)\n {\n if(i>=num)\n break;\n myList.Add(i);\n num =n / i;\n myList.Add(num);\n }\n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n long n = long.Parse(token[0]);\n long k = long.Parse(token[1]);\n \n long num = n;\n List myList = new List();\n // myList.Contains(i)\n long h = (n%2==0)?n/2:n+1/2;\n for(int i=1;i<997 ;i++)\n {\n if(i>=num)\n break;\n if(n%i==0)\n {\n if(!myList.Contains(i))\n myList.Add(i);\n num =n / i;\n if(!myList.Contains(num))\n myList.Add(num);\n }\n \n }\n myList.Sort();\n long count = -1;\n //myList.Add(13);\n for(int i = 0;in)\n {\n count = -1;\n }\n Console.WriteLine(count);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace KingsWay\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int n = int.Parse(token[0]);\n int k = int.Parse(token[1]);\n int count = 0;\n for(int i = 1;i<=n;i++)\n {\n if(n%i==0)\n {\n count++;\n }\n }\n if(count < k)\n count = -1;\n \n Console.WriteLine(count);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tlong count = 1;\n\t\t\tfor (long i = 2; i <= (n + 1) / 2; i++) \n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t\tif (count == k) \n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (count == k - 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (n == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new List { 1 };\n\t\t\tint index = 1;\n\t\t\tvar border = n;\n\n\t\t\tvar sqrt = Math.Sqrt(n);\n\t\t\tfor (long i = 2; i < border; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tvar res = n / i;\n\t\t\t\t\td.Insert(index, res);\n\t\t\t\t\tif (i != res) \n\t\t\t\t\t{\n\t\t\t\t\t\td.Insert(index, i);\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tborder = res;\n\t\t\t\t\tsqrt = Math.Sqrt(border);\n\t\t\t\t}\n\n\t\t\t\tif (i > sqrt) \n\t\t\t\t{\n\t\t\t\t\tif (d.Count == 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tif (k == 2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(n);\n\t\t\t\t\t\t} \n\t\t\t\t\t\telse \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\td.Insert(d.Count, n);\n\n\t\t\tif (d.Count >= k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(d.ElementAt((int)(k - 1)));\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new List { 1 };\n\t\t\tint index = 1;\n\t\t\tvar border = n;\n\n\t\t\tfor (long i = 2; i < border; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tvar res = n / i;\n\t\t\t\t\td.Insert(index, res);\n\t\t\t\t\td.Insert(index, i);\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tborder = res;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\td.Insert(d.Count, n);\n\n\t\t\tif (d.Count >= k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(d.ElementAt((int)(k - 1)));\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (n == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new List { 1 };\n\t\t\tint index = 1;\n\t\t\tvar border = n;\n\n\t\t\tvar sqrt = Math.Sqrt(n);\n\t\t\tfor (long i = 2; i < (border / 2) + 1; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tvar res = n / i;\n\t\t\t\t\td.Insert(index, res);\n\t\t\t\t\tif (i != res) \n\t\t\t\t\t{\n\t\t\t\t\t\td.Insert(index, i);\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tborder = res;\n\t\t\t\t}\n\n\t\t\t\tif (i > sqrt) \n\t\t\t\t{\n\t\t\t\t\tif (d.Count == 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tif (k == 2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(n);\n\t\t\t\t\t\t} \n\t\t\t\t\t\telse \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\td.Insert(d.Count, n);\n\n\t\t\tif (d.Count >= k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(d.ElementAt((int)(k - 1)));\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (n == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new List { 1 };\n\t\t\tint index = 1;\n\t\t\tvar border = n;\n\n\t\t\tfor (long i = 2; i < border; i++)\n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tvar res = n / i;\n\t\t\t\t\td.Insert(index, res);\n\t\t\t\t\td.Insert(index, i);\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tborder = res;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\td.Insert(d.Count, n);\n\n\t\t\tif (d.Count >= k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(d.ElementAt((int)(k - 1)));\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tif (k == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new List();\n\t\t\tint index = 0;\n\t\t\tvar border = n / 2;\n\n\t\t\tfor (long i = 2; i <= border; i++) \n\t\t\t{\n\t\t\t\tif (n % i == 0) \n\t\t\t\t{\n\t\t\t\t\tvar res = n / i;\n\t\t\t\t\td.Insert(index, res);\n\t\t\t\t\td.Insert(index, i);\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tborder = res;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (d.Count > k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(d.ElementAt((int)k));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (d.Count == k) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(n);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t}\n\n\t\tpublic static void Print(int[] number) \n\t\t{\n\t\t\tvar stringBuilder = new StringBuilder();\n\t\t\tforeach (var i in number)\n\t\t\t{\n\t\t\t\tif (i == 0 && stringBuilder.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tstringBuilder.Append(i);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(stringBuilder.ToString());\n\t\t}\n\n\t\tpublic void Method1(ref int n1, ref int n2, ref int k1, ref int k2) \n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n1 >= n2 || (a >= b && a < 2 * b))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic void Method2(ref int n1, ref int n2, ref int k1, ref int k2)\n\t\t{\n\t\t\tdouble a = (double)n1 / k1;\n\t\t\tdouble b = (double)n2 / k2;\n\t\t\tif (n2 >= n1 || (b >= a && b < 2 * a))\n\t\t\t{\n\n\t\t\t}\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\tprivate static long LCM(long a, long b)\n\t\t{\n\t\t\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}], "src_uid": "6ba39b428a2d47b7d199879185797ffb"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class CodeForces313_3\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\CodeForces\\CodeForce313\\3.txt\"));\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n int[] a = new int[6];\n\n for (int i = 0; i < 6; i++)\n {\n a[i] = int.Parse(strParams[i]);\n }\n\n int sum = (a[0] * a[1] * 2) +\n (a[2] * a[3] * 2) +\n (a[4] * a[5] * 2);\n\n int t = Math.Abs(a[5] - a[2]);\n int R = 0;\n if (t > 0)\n {\n int p = 0;\n for (int i = 0; i < t; i++)\n {\n if (i == 0)\n {\n R = 1;\n p = 1;\n }\n else\n {\n p += 2;\n R += p;\n }\n }\n }\n\n sum += R;\n Console.WriteLine(sum.ToString());\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Geralds_Hexagon\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n double a1 = Next();\n double a2 = Next();\n double a3 = Next();\n double a4 = Next();\n double a5 = Next();\n double a6 = Next();\n double sin60 = Math.Sin(Math.PI*60/180);\n double sin120 = Math.Sin(Math.PI*120/180);\n\n double s = (a1 + a4)*sin60*(a2 + a3) + sin120*a2*a3 + sin120*a5*a6;\n double count = s/sin60;\n\n writer.WriteLine(Math.Round(count));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n protected override string GetFilename()\n {\n return \"railway\";\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n checked\n {\n var x = p.Get();\n p.Out(x);\n }\n }\n\n object Get()\n {\n var a = ReadInts();\n var first = a[0];\n var second = Math.Min(a[1], a[5]);\n var third = Math.Max(a[1], a[5]);\n var fourth = Math.Min(a[2], a[4]);\n var fifth = Math.Max(a[2], a[4]);\n var sixth = a[3];\n var result = 0;\n var currentWidth = first;\n for (int i = 0; i < second; i++)\n {\n result += 2 * currentWidth + 1;\n currentWidth++;\n }\n\n for (int i = second; i < third; i++)\n {\n result += 2 * currentWidth;\n }\n\n for (int i = third; i < third + fourth; i++)\n {\n result += 2 * currentWidth - 1;\n currentWidth--;\n }\n return result;\n }\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n\n protected abstract string GetFilename();\n\n protected string Read()\n {\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + GetFilename() + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n Console.WriteLine(r);\n //if (GetProd())\n // File.WriteAllText(GetFilename() + \".out\", r.ToString());\n //else\n // Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func) \n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double pi=3.14159265358979323846264338327950288;\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n\n double s1 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[0] * R[1]);\n double s2 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[2] * R[3]);\n double s3 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[4] * R[5]);\n double s4 = Math.Abs((R[0] + 0.5 * R[1]) * (R[5] + R[4]) * Math.Cos(30.0 / 180.0 * pi) \n - R[1] * Math.Sin(60.0 / 180.0 * pi) *0.5* (-R[5] + R[4]));\n double s = s1 + s2 + s3 + s4;\n double k = s / Math.Sin(60.0 / 180.0 * pi);\n Console.WriteLine((int)k);\n \n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n Console.Write((a[0] + a[1] + a[2]) * (a[0] + a[1] + a[2]) - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _559A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n\n int a1 = Convert.ToInt32(str[0]);\n int a2 = Convert.ToInt32(str[1]);\n int a3 = Convert.ToInt32(str[2]);\n int a5 = Convert.ToInt32(str[4]);\n\n int answer = (int)(Math.Pow(a1 + a2 + a3, 2) - Math.Pow(a1, 2) - Math.Pow(a3, 2) - Math.Pow(a5, 2));\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int Fun(int a, int b)\n {\n return b * (2 * a + b);\n }\n\n void Solve()\n {\n var a = ReadIntArray();\n int ans;\n if (a[0] == a[2])\n ans = Fun(a[1], a[0]) + Fun(a[4], a[3]);\n else if (a[0] < a[2])\n ans = Fun(a[1], a[0]) + Fun(a[4], a[3]) + (a[0] + a[1]) * 2 * (a[2] - a[0]);\n else\n ans = Fun(a[1], a[2]) + Fun(a[4], a[5]) + (a[2] + a[1]) * 2 * (a[0] - a[2]);\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"hull.in\");\n //writer = new StreamWriter(\"hull.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n checked\n {\n new Solver().Solve();\n }\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a1, a2, a3, a4, a5, a6;\n string[] strin1 = Console.ReadLine().Split(' ');\n a1 = int.Parse(strin1[0]);\n a2 = int.Parse(strin1[1]);\n a3 = int.Parse(strin1[2]);\n a4 = int.Parse(strin1[3]);\n a5 = int.Parse(strin1[4]);\n a6 = int.Parse(strin1[5]);\n int sum = (a1 + a2 + a3) * (a1 + a2 + a3) - (a1 * a1) - (a3 * a3) - (a5 * a5);\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\t\tstatic double scalar(int x1,int y1,int x2,int y2,int x3,int y3)\n\t\t{\n\t\t\treturn (x2-x1)*(x3-x2)+(y2-y1)*(y3-y2);\n\t\t}\n static bool foo(double d1, double d2, double d3)\n {\n double a1=(d1*d1)+(d3*d3)-(d2*d2);\n\t\t\tdouble a2=(d2*d2)+(d3*d3)-(d1*d1);\n\t\t\tbool f=a1>0&&a2>0;\n\t\t\treturn f;\n }\n static void Main(string[] args)\n {\n\t\t\tstring[]ss=Console.ReadLine().Split();\n\t\t\tint[]m=new int[6];\n\t\t\tfor(int i=0; i<6; i++)\n\t\t\t{\n\t\t\t\tm[i]=int.Parse(ss[i]);\n\t\t\t}\n\t\t\tConsole.WriteLine((m[0]+m[1]+m[2])*(m[0]+m[1]+m[2])-(m[0]*m[0])-(m[2]*m[2])-m[4]*m[4]);\n\t\t}\n }\n}"}, {"source_code": "using System;\n\nnamespace The_Circumference_of_the_Circle\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n long a1 = long.Parse(line[0]);\n long a2 = long.Parse(line[1]);\n long a3 = long.Parse(line[2]);\n long a4 = long.Parse(line[3]);\n long a5 = long.Parse(line[4]);\n long a6 = long.Parse(line[5]);\n\n long lines = a1 + a2 + a6;\n long total = 0;\n for (int i = 1; i <= lines; i++)\n total += (long)(2 * i) - 1;\n\n\n for (int i = 1; i <= a2; i++)\n total -= (long)(2 * i) - 1;\n for (int i = 1; i <= a4; i++)\n total -= (long)(2 * i) - 1;\n for (int i = 1; i <= a6; i++)\n total -= (long)(2 * i) - 1;\n \n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _559A.Gerald_s_Hexagon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] tok = line.Split(' ');\n int[] sides = new int[tok.Length];\n int a1, a2, a3, n;\n for (int i = 0; i < tok.Length; i++)\n {\n sides[i] = int.Parse(tok[i]);\n }\n a1 =tessalate( sides[0]);\n a2 = tessalate(sides[2]);\n a3 = tessalate(sides[4]);\n n = tessalate(sides[0] + sides[1] + sides[2]);\n Console.WriteLine(\"{0}\", n-(a1+a2+a3));\n \n }\n static int tessalate (int n)\n {\n int suma = 0;\n while(n>0)\n {\n suma += n;\n n--;\n suma += n;\n }\n return suma;\n } \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _559A\n {\n public static void Main()\n {\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n Console.WriteLine((a[0] + 2 * a[1] + a[2]) * (a[2] + a[3]) - (a[0] * a[0] + a[2] * a[2] + a[3] * a[3] + a[5] * a[5]) / 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Math;\nusing static System.Console;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var a = input.ReadIntArray(6);\n var p = a[0] + a[1] + a[2];\n Write(p * p - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);\n }\n\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() =>\n (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() =>\n (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() =>\n (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar a=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\n\t\tConsole.WriteLine((a[0]+a[1]+a[2])*(a[0]+a[1]+a[2])-a[0]*a[0]-a[2]*a[2]-a[4]*a[4]);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Geralds_Hexagon\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n double a1 = Next();\n double a2 = Next();\n double a3 = Next();\n double a4 = Next();\n double a5 = Next();\n double a6 = Next();\n double sin60 = Math.Sin(Math.PI*60/180);\n double sin120 = Math.Sin(Math.PI*120/180);\n\n double s = (a1 + a4)*sin60*(a2 + a3) + sin120*a2*a3 + sin120*a5*a6;\n double count = s/sin60;\n\n writer.WriteLine(Math.Round(count));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Gerald_s_Hexagon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = GetInt(), b = GetInt(), c = GetInt(), d = GetInt(), e = GetInt(), f = GetInt();\n Console.Write((a + b + c) * (a + b + c) - a * a - c * c - e * e);\n }\n\n static int GetInt()\n {\n int n = 0;\n char c = '\\0';\n while (!Char.IsDigit(c))\n c = Convert.ToChar(Console.Read());\n\n while (Char.IsDigit(c))\n {\n n *= 10;\n n += c - '0';\n c = Convert.ToChar(Console.Read());\n }\n return n;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesSolver\n{\n class Program\n {\n static void Main()\n {\n double striangle = Math.Sqrt(3)/4;\n var a = ReadArrayInt();\n\n var alpha = 2*Math.PI/3;\n\n double m0 = a[1]*Math.Sin(alpha) - a[2]*Math.Sin(alpha*2) + a[3]*Math.Sin(alpha*3) - a[4]*Math.Sin(alpha*4);\n double m1 = a[2]*Math.Sin(alpha) - a[3]*Math.Sin(alpha*2) + a[4]*Math.Sin(alpha*3);\n double m2 = a[3]*Math.Sin(alpha) - a[4]*Math.Sin(alpha*2);\n double m3 = a[4]*Math.Sin(alpha);\n\n double s = (a[0]*m0 + a[1]*m1 + a[2]*m2 + a[3]*m3)/2;\n\n int cnt = (int) Math.Round(s/striangle);\n\n Console.WriteLine(cnt);\n }\n\n #region Handy\n\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n public static int[] ReadArrayInt()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n }\n\n public static string[] ReadArrayString()\n {\n return Console.ReadLine().Split(' ');\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\n\n\nnamespace TopCoder\n{\n class Zagotovka\n {\n\n public static void print(List obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n public static void print(ValueType obj)\n {\n Console.Write(obj + \" \");\n }\n\n public static void print(string obj)\n {\n Console.Write(obj + \" \");\n }\n\n public static void print(Type obj)\n {\n Console.Write(obj + \" \");\n }\n\n\n public static void print(Array obj)\n {\n Console.Write(\"[\");\n for (int i = 0; i < obj.Length; i++)\n {\n print(obj.GetValue(i));\n }\n Console.Write(\"]\");\n }\n\n public static void print(List obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n\n public static void print(List obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n public static void print(List obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n public static void print(List> obj)\n {\n Console.Write(\"{\");\n for (int i = 0; i < obj.Count; i++)\n {\n print(obj[i]);\n }\n Console.Write(\"}\");\n }\n\n\n public static void print(object obj)\n {\n Console.Write(obj);\n Console.Write(\" \");\n }\n\n\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(ValueType obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(string obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(Type obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(Array obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(List obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n public static void println(List> obj)\n {\n print(obj);\n Console.WriteLine();\n }\n\n\n public static void println(object obj)\n {\n Console.Write(obj);\n Console.Write(\" \");\n }\n\n public class Scanner\n {\n List array = new List();\n int pos = 0;\n public Scanner()\n {\n while (true)\n {\n string next = Console.ReadLine();\n if (next != null && next.Length > 0)\n {\n array.AddRange(next.Split(' '));\n }\n else\n {\n break;\n }\n }\n }\n\n public int nextInt()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n int res = Int32.Parse(array[pos]);\n pos++;\n return res;\n }\n\n public long nextLong()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n long res = Int64.Parse(array[pos]);\n pos++;\n return res;\n }\n\n public string nextString()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n string res = array[pos];\n pos++;\n return res;\n }\n\n public char nextChar()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n char res = array[pos][0];\n pos++;\n return res;\n }\n\n public double nextDouble()\n {\n if (pos == array.Count)\n {\n throw new ArgumentException(\"Arguments are gone\");\n }\n double res = Double.Parse(array[pos]);\n pos++;\n return res;\n }\n\n public List nextArray(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextInt());\n }\n return res;\n }\n\n public List nextArrayDouble(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextDouble());\n }\n return res;\n }\n\n\n public List nextArrayLong(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextLong());\n }\n return res;\n }\n\n\n public List nextArrayString(int n)\n {\n List res = new List();\n for (int i = 0; i < n; i++)\n {\n res.Add(nextString());\n }\n return res;\n }\n }\n\n\n public class MultyArray\n {\n int n;\n int[] lens;\n T[] array;\n int[] ks;\n\n public MultyArray(params int[] lens)\n {\n n = lens.Length;\n\n this.lens = new int[n];\n for (int i = 0; i < n; i++)\n {\n this.lens[i] = lens[i] + 1;\n }\n\n ks = new int[n + 1];\n int prod = 1;\n for (int i = 0; i < n; i++)\n {\n ks[i] = prod;\n prod *= this.lens[i];\n }\n ks[n] = prod;\n\n array = new T[prod];\n }\n\n public int index(params int[] args)\n {\n int q = args.Length;\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += args[i] * ks[i];\n }\n\n return res;\n }\n\n\n public T get(params int[] args)\n {\n return array[index(args)];\n }\n\n public void set(T value, params int[] args)\n {\n array[index(args)] = value;\n }\n\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int _index(params int[] args)\n {\n int q = args.Length;\n\n\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += (args[i] + (lens[i] >> 1)) * ks[i];\n }\n\n\n /*\n if (q == 2)\n {\n return (args[0] + (lens[0] << 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1];\n }\n\n if(q == 1){\n return (args[0] + (lens[0] >> 1)) * ks[0];\n }\n\n if (q == 3)\n {\n return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2];\n }\n\n if (q == 4)\n {\n return (args[0] + (lens[0] >> 1)) * ks[0] + (args[1] + (lens[1] >> 1)) * ks[1] + (args[2] + (lens[2] >> 1)) * ks[2] + (args[3] + (lens[3] >> 1)) * ks[3];\n }\n * */\n\n return res;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T _get(params int[] args)\n {\n return array[_index(args)];\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void _set(T value, params int[] args)\n {\n array[_index(args)] = value;\n }\n\n public override string ToString()\n {\n StringBuilder res = new StringBuilder();\n return res.ToString();\n }\n }\n\n public class DP\n {\n public delegate T Solve(DP dp, params int[] args);\n\n public MultyArray array;\n public MultyArray exist;\n public int[] lens;\n public int[] ks;\n\n private Solve solve;\n\n public DP(Solve solve, params int[] lens)\n {\n this.lens = lens;\n\n ks = new int[lens.Length + 1];\n int prod = 1;\n for (int i = 0; i < lens.Length; i++)\n {\n ks[i] = prod;\n prod *= this.lens[i] + 1;\n }\n ks[lens.Length] = prod;\n\n\n\n int[] newLens = new int[lens.Length];\n for (int i = 0; i < newLens.Length; i++)\n {\n newLens[i] = lens[i] * 2;\n }\n\n this.array = new MultyArray(newLens);\n this.exist = new MultyArray(newLens);\n\n this.solve = solve;\n }\n\n public T dp(params int[] args)\n {\n /*\n int[] newArgs = new int[args.Length];\n for (int i = 0; i < args.Length; i++)\n {\n newArgs[i] = args[i] + lens[i];\n }\n * */\n\n if (exist._get(args))\n {\n return array._get(args);\n }\n T value = solve(this, args);\n array._set(value, args);\n exist._set(true, args);\n return value;\n }\n\n public int[] indexToArgs(int index)\n {\n int[] res = new int[lens.Length];\n for (int i = 0; i < lens.Length; i++)\n {\n res[i] = (index / ks[i]) % (lens[i] + 1);\n }\n return res;\n }\n\n public int index(params int[] args)\n {\n int q = args.Length;\n int res = 0;\n for (int i = 0; i < q; i++)\n {\n res += args[i] * ks[i];\n }\n\n return res;\n }\n\n public T run(params int[] args)\n {\n int maxIndex = index(args);\n\n for (int i = 0; i <= maxIndex; i++)\n {\n int[] a = indexToArgs(i);\n dp(a);\n }\n\n return dp(args);\n }\n }\n\n public static T min(T first, params T[] array) where T : IComparable\n {\n T res = first;\n for (int i = 0; i < array.Length; i++)\n {\n if (array[i].CompareTo(res) < 0)\n {\n res = array[i];\n }\n }\n return res;\n }\n\n public static T max(T first, params T[] array) where T : IComparable\n {\n T res = first;\n for (int i = 0; i < array.Length; i++)\n {\n if (array[i].CompareTo(res) > 0)\n {\n res = array[i];\n }\n }\n return res;\n }\n\n\n public static int gcd(int a, int b)\n {\n if (b != 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n\n\n public static bool[] sieve(int bound)\n {\n bool[] array = new bool[bound + 1];\n for (int i = 2; i * i <= bound; i++)\n {\n if (!array[i])\n {\n for (int j = i + i; j <= bound; j += i)\n {\n array[j] = true;\n }\n }\n }\n return array;\n }\n\n public static List sieveList(int bound)\n {\n bool[] array = new bool[bound + 1];\n for (int i = 2; i * i <= bound; i++)\n {\n if (!array[i])\n {\n for (int j = i + i; j <= bound; j += i)\n {\n array[j] = true;\n }\n }\n }\n\n List a = new List();\n for (int i = 2; i < bound + 1; i++)\n {\n if (!array[i])\n {\n a.Add(i);\n }\n }\n\n return a;\n }\n\n\n\n public static List factorize(int n, List primeList)\n {\n List res = new List();\n for (int j = 0; j < primeList.Count; j++)\n {\n int i = primeList[j];\n if (n % i == 0)\n {\n int[] comp = new int[] { i, 1 };\n n /= i;\n while (n % i == 0)\n {\n comp[1] = comp[1] + 1;\n n /= i;\n }\n res.Add(comp);\n }\n }\n\n if (n > 1)\n {\n res.Add(new int[] { n, 1 });\n }\n return res;\n }\n\n public static List genDivisors(int n)\n {\n List res = new List();\n int root = (int)(Math.Sqrt(n) + 1);\n for (int i = 1; i < root; i++)\n {\n if (n % i == 0)\n {\n if (n / i != i)\n {\n res.Add(i);\n res.Add(n / i);\n }\n else\n {\n res.Add(i);\n }\n }\n }\n return res;\n }\n\n\n\n public static int fact(int n)\n {\n return n == 1 ? 1 : n * fact(n - 1);\n }\n\n public static List> genPermutations(int n)\n {\n List> res = new List>();\n List current = new List();\n for (int i = 0; i < n; i++)\n {\n current.Add(i + 1);\n }\n\n int numberOfPerms = fact(n);\n\n {\n List newList = new List();\n newList.AddRange(current);\n res.Add(newList);\n }\n\n for (int i = 0; i < numberOfPerms - 1; i++)\n {\n int j = n - 2;\n while (j != -1 && current[j] > current[j + 1]) j--;\n int k = n - 1;\n while (current[j] > current[k]) k--;\n {\n int temp = current[j];\n current[j] = current[k];\n current[k] = temp;\n }\n\n int l = j + 1, r = n - 1;\n while (l < r)\n {\n int temp = current[l];\n current[l] = current[r];\n current[r] = temp;\n l++;\n r--;\n }\n\n List newList = new List();\n newList.AddRange(current);\n res.Add(newList);\n }\n\n return res;\n }\n\n public static int pow(int n, int k)\n {\n if (k == 0)\n {\n return 1;\n }\n else\n {\n if (k % 2 == 1)\n {\n return pow(n, k - 1) * n;\n }\n else\n {\n int q = pow(n, k / 2);\n return q * q;\n }\n }\n\n }\n\n public static int SolveDP(DP dp, params int[] args)\n {\n return 0;\n }\n\n\n static double sq(List> fig)\n {\n double res = 0;\n for (int i = 0; i < fig.Count; i++)\n {\n Tuple p1 = i > 0 ? fig[i - 1] : fig[fig.Count - 1];\n Tuple p2 = fig[i];\n double add = (p1.Item1 - p2.Item1) * (p1.Item2 + p2.Item2);\n res += add;\n }\n return Math.Abs(res) / 2.0;\n }\n\n public static Scanner s = new Scanner();\n\n public static void Main(string[] args)\n {\n List> res = new List>();\n\n res.Add(new Tuple(0.0, 0.0));\n\n double cx = 0;\n double cy = 0;\n double angle = 0;\n\n for (int i = 0; i < 6; i++)\n {\n double santis = s.nextDouble();\n angle = angle + 60.0 * Math.PI / 180.0;\n\n cx = cx + Math.Cos(angle) * santis;\n cy = cy + Math.Sin(angle) * santis;\n\n res.Add(new Tuple(cx, cy));\n }\n res.RemoveAt(res.Count - 1);\n\n double six = sq(res);\n double mn = Math.Sqrt(3.0) / 4.0;\n\n int rrr = (int)(six/mn+0.000000001);\n Console.WriteLine(rrr);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int Fun(int a, int b)\n {\n return b * (2 * a + b);\n }\n\n void Solve()\n {\n var a = ReadIntArray();\n int ans;\n if (a[0] == a[2])\n ans = Fun(a[1], a[0]) + Fun(a[4], a[3]);\n else if (a[0] < a[2])\n ans = Fun(a[1], a[0]) + Fun(a[4], a[3]) + (a[0] + a[1]) * 2 * (a[2] - a[0]);\n else\n ans = Fun(a[1], a[2]) + Fun(a[4], a[5]) + (a[2] + a[1]) * 2 * (a[0] - a[2]);\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"hull.in\");\n //writer = new StreamWriter(\"hull.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n // thread.Start();\n // thread.Join();\n checked\n {\n new Solver().Solve();\n }\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n // Input\n string[] tokens = Console.ReadLine().Split(' ');\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n int d = int.Parse(tokens[3]);\n int e = int.Parse(tokens[4]);\n int f = int.Parse(tokens[5]);\n\n // Main Logic\n int total = 0;\n int mode = 1;\n int l = 0;\n int r = 0;\n while (true)\n {\n if (mode == 1)\n {\n l = f;\n r = b;\n int x = Math.Min(l, r);\n total += (2*a + x)*x;\n if (l < r)\n {\n mode = 2;\n }\n else if (l == r)\n {\n mode = 4;\n }\n else\n {\n mode = 3;\n }\n }\n else if (mode == 2)\n {\n r = b - f;\n total += (a + f)*r*2;\n mode = 4;\n }\n else if (mode == 3)\n {\n r = f - b;\n total += (a + b)*r*2;\n mode = 4;\n }\n else if (mode == 4)\n {\n r = Math.Min(c, e);\n total += (2*d + r)*r;\n break;\n }\n }\n\n // Output\n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NorthStar\n{\n class Program\n {\n static IO io;\n\n static void Main(string[] args)\n {\n io = new IO();\n\n int[] arr = new int[6];\n for (int i = 0; i < 6; i++)\n {\n arr[i] = io.nextInt();\n }\n Console.WriteLine(sqr(arr[0] + arr[1] + arr[2]) - sqr(arr[0]) - sqr(arr[2]) - sqr(arr[4]));\n }\n\n private static int sqr(int v)\n {\n return v * v;\n }\n }\n\n class IO\n {\n private int ptr;\n private string[] input;\n\n public IO()\n {\n input = new string[0];\n ptr = 0;\n }\n\n private void readMore()\n {\n while (ptr >= input.Length)\n {\n input = Console.ReadLine().Split();\n ptr = 0;\n }\n }\n\n public int nextInt()\n {\n readMore();\n return int.Parse(input[ptr++]);\n }\n\n public long nextLong()\n {\n readMore();\n return long.Parse(input[ptr++]);\n }\n\n public string next()\n {\n readMore();\n return input[ptr++];\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskCGerald\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n double[] a = new double[str.Length];\n for (int i = 0; i < str.Count(); i++)\n a[i] = int.Parse(str[i]);\n double sqrt3 = Math.Sqrt(3);\n double triangleSquare = sqrt3 / 8;\n double square = ((a[4] + a[5]) * sqrt3 / 2) * ((a[4] + a[2]) / 2 + a[3]);\n square -= a[4] * a[4] / 8 * sqrt3;\n square -= a[5] * a[5] / 8 * sqrt3;\n square -= a[2] * a[2] / 8 * sqrt3;\n square -= a[1] * a[1] / 8 * sqrt3;\n Console.WriteLine((int)Math.Round(square / triangleSquare / 2));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getList();\n\t\t\tvar ans = (l[0] + l[1] + l[2]) * (l[0] + l[1] + l[2]) - l[0] * l[0] - l[2] * l[2] - l[4] * l[4];\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n\n static void Main(string[] args)\n {\n\n int[] a = ReadIntArrayLine();\n\n int s = a[0] + a[1] + a[2];\n\n PrintLn(s * s - a[0] * a[0] - a[2] * a[2] - a[4] * a[4]);\n \n }\n\n } \n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var A = new long[5000];\n A[1] = 1;\n for (int i = 2; i < 5000; i++)\n A[i] += A[i - 1] + 2;\n for (int i = 2; i < 5000; i++)\n A[i] += A[i - 1];\n var a = sc.Integer(6);\n var top = a[0];\n var height = a[0] + a[1] + a[2];\n var right = a[2];\n var left = a[4];\n IO.Printer.Out.WriteLine(A[height] - A[top] - A[right] - A[left]);\n\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n\n\n\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _599A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int d1 = int.Parse(tokens[0]);\n int d2 = int.Parse(tokens[1]);\n int d3 = int.Parse(tokens[2]);\n\n int min = new int[]\n {\n d1 + d1 + d2 + d2,\n d1 + d3 + d3 + d1,\n d1 + d3 + d2,\n d2 + d3 + d3 + d2\n }.Min();\n\n Console.WriteLine(min);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getList();\n\t\t\tvar a1 = l[0];\n\t\t\tvar a2 = l[1];\n\t\t\tvar ct1 = 2 * a2 + 1;\n\t\t\tvar ans = 0;\n\t\t\tfor (var i = 1; i <= a1; ++i)\n\t\t\t{\n\t\t\t\tans += ct1;\n\t\t\t\tct1 += 2;\n\t\t\t}\n\t\t\tct1 = 2 * a1 + 1;\n\t\t\tfor (var i = 1; i <= a2; ++i)\n\t\t\t{\n\t\t\t\tans += ct1;\n\t\t\t\tct1 += 2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Integer(6);\n var A = new long[5000];\n A[1] = 3;\n for (int i = 2; i < 5000; i++)\n A[i] = A[i - 1] + 2;\n for (int i = 0; i < 6; i++)\n {\n if (a[(i + 6 - 1) % 6] == a[(i + 1) % 6] && a[(i + 6 - 2) % 6] == a[(i + 2) % 6])\n {\n var d = A[a[i]];\n var h = a[(i + 1) % 6];\n\n var e = A[a[(i + 3) % 6]];\n var f = a[(i + 2) % 6];\n var sum = d * h + e * f;\n sum += h * (h - 1) + f * (f - 1);\n IO.Printer.Out.WriteLine(sum);\n return;\n }\n }\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double e = 0.1;\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n\n double cos=Math.Cos(30.0*3.14159265 / 180.0);\n double s1 = Math.Abs(cos * R[0] * R[1]);\n double s2 = Math.Abs(cos * R[2] * R[3]);\n double s3 = Math.Abs(cos * R[4] * R[5]);\n double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));\n s1 = s1 + s2 + s3 + s4;\n double k = s1 / cos;\n int n = (int)k;\n if (k - 0.5 < n)\n\n Console.WriteLine(n);\n else\n Console.WriteLine(n+1);\n \n\n //Console.WriteLine(\"n={0} k={1}\",n, k);\n // Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n\n double cos=Math.Cos(30.0*3.14159265 / 180.0);\n double s1 = Math.Abs(cos * R[0] * R[1]);\n double s2 = Math.Abs(cos * R[2] * R[3]);\n double s3 = Math.Abs(cos * R[4] * R[5]);\n double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));\n s1 = s1 + s2 + s3 + s4;\n if (s1 / cos < (int)s1 / cos)\n Console.WriteLine((int)(s1 / cos));\n else\n Console.WriteLine((int)(s1 / cos+1));\n \n\n \n \n // Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n double cos=Math.Cos(30.0*3.14159265 / 180.0);\n double s1 = Math.Abs(cos * R[0] * R[1]);\n double s2 = Math.Abs(cos * R[2] * R[3]);\n double s3 = Math.Abs(cos * R[4] * R[5]);\n double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));\n s1 = s1 + s2 + s3 + s4;\n int n = (int)(s1 / cos)+1;\n Console.WriteLine(n);\n\n \n \n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n\n double cos=Math.Cos(30.0*3.14159265 / 180.0);\n double s1 = Math.Abs(cos * R[0] * R[1]);\n double s2 = Math.Abs(cos * R[2] * R[3]);\n double s3 = Math.Abs(cos * R[4] * R[5]);\n double s4 = Math.Abs((R[0]+0.5*R[1])*(R[5]*0.5+R[4]*cos)-R[1]*cos*(-R[5]*cos+0.5*R[4]));\n s1 = s1 + s2 + s3 + s4;\n if (s1 / cos > (int)s1 / cos)\n Console.WriteLine((int)s1 / cos);\n else\n Console.WriteLine((int)s1 / cos+1);\n \n\n \n \n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double pi=3.14159265358979323846264338327950288;\n int[] R = new int[6];\n string [] a=Console.ReadLine().Split(' ');\n for (int i = 0; i < 6; i++)\n R[i] = int.Parse(a[i]);\n\n double s1 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[0] * R[1]);\n double s2 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[2] * R[3]);\n double s3 = Math.Abs(Math.Sin(60.0 / 180.0 * pi) * R[4] * R[5]);\n double s4 = Math.Abs((R[0] + 0.5 * R[1]) * (R[5] + R[4]) * Math.Cos(30.0 / 180.0 * pi) \n - R[1] * Math.Sin(60.0 / 180.0 * pi) *0.5* (-R[5] + R[4]));\n double s = s1 + s2 + s3 + s4;\n double k = s / Math.Sin(60.0 / 180.0 * pi);\n Console.WriteLine(k);\n /* int n = (int)k;\n if (k - 0.5 < n)\n\n Console.WriteLine(n);\n else\n Console.WriteLine(n+1);*/\n \n\n //Console.WriteLine(\"n={0} k={1}\",n, k);\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return other.a.CompareTo(this.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\t\tstatic double scalar(int x1,int y1,int x2,int y2,int x3,int y3)\n\t\t{\n\t\t\treturn (x2-x1)*(x3-x2)+(y2-y1)*(y3-y2);\n\t\t}\n static bool foo(double d1, double d2, double d3)\n {\n double a1=(d1*d1)+(d3*d3)-(d2*d2);\n\t\t\tdouble a2=(d2*d2)+(d3*d3)-(d1*d1);\n\t\t\tbool f=a1>0&&a2>0;\n\t\t\treturn f;\n }\n static void Main(string[] args)\n {\n\t\t\tstring[]ss=Console.ReadLine().Split();\n\t\t\tint[]m=new int[6];\n\t\t\tfor(int i=0; i<6; i++)\n\t\t\t{\n\t\t\t\tm[i]=int.Parse(ss[i]);\n\t\t\t}\n\t\t\tArray.Sort(m);\n\t\t\tif(m[0]==m[6-1])\n\t\t\t{\n\t\t\t\tConsole.WriteLine(6*m[0]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(13*(m[6-1]/2));\n\t\t\t}\n\t\t\t\n\t\t}\n }\n}"}, {"source_code": "using System;\n\nnamespace _559A.Gerald_s_Hexagon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] tok = line.Split(' ');\n int[] sides = new int[tok.Length+1];\n int tesallate=0,nsum=0,triangle,suma=0;\n for (int i = 0; i < tok.Length; i++)\n {\n sides[i] = int.Parse(tok[i]);\n } \n while(sided_6(sides))\n {\n triangle = 0;\n for (int i = 0; i < sides.Length-1; i++)\n {\n triangle += sides[i];\n sides[i]--;\n }\n\n triangle += triangle - 6;\n tesallate += triangle;\n }\n for (int i = 0; i < sides.Length - 1; i++)\n {\n suma += sides[i];\n }\n if (suma < 6) {\n nsum = suma / 2;\n }\n else\n {\n for (int i = 0; i < sides.Length - 1; i++)\n {\n if (sides[i] == 1 && sides[i + 1] == 1) { }\n else\n nsum += sides[i];\n }\n nsum += nsum / 2;\n }\n \n Console.WriteLine(\"{0}\", tesallate + nsum);\n \n }\n static bool sided_6 (int[]sides)\n {\n int count = 0;\n for (int i = 0; i < sides.Length-1; i++)\n {\n if (sides[i] != 0)\n count++;\n }\n if (count == 6)\n return true;\n else\n return false;\n } \n }\n}"}, {"source_code": "using System;\n\nnamespace _559A.Gerald_s_Hexagon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string[] tok = line.Split(' ');\n int s = 0;\n int k = 7;\n while (k > 6)\n {\n for (int i = 0; i < 6; i++)\n {\n if (Convert.ToInt32(tok[i]) > 0)\n { \n s += Convert.ToInt32(tok[i]);\n tok[i] = Convert.ToString(Convert.ToInt32(tok[i]) - 1);\n }\n }\n k = 0;\n for (int j = 0; j < 6; j++)\n {\n k +=Convert.ToInt32(tok[j]);\n }\n }\n Console.WriteLine(\"{0}\", s + k + k / 2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getList();\n\t\t\tvar a1 = l[0];\n\t\t\tvar a2 = l[1];\n\t\t\tvar ct1 = 2 * a2 + 1;\n\t\t\tvar ans = 0;\n\t\t\tfor (var i = 1; i <= a1; ++i)\n\t\t\t{\n\t\t\t\tans += ct1;\n\t\t\t\tct1 += 2;\n\t\t\t}\n\t\t\ta2 = l[5];\n\t\t\ta1 = l[4];\n\t\t\tct1 = 2 * a1 + 1;\n\t\t\tfor (var i = 1; i <= a2; ++i)\n\t\t\t{\n\t\t\t\tans += ct1;\n\t\t\t\tct1 += 2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesSolver\n{\n class Program\n {\n static void Main()\n {\n double striangle = Math.Sqrt(3)/4;\n var a = ReadArrayInt();\n\n double splitline = a[1] + a[0]/2.0 + a[2]/2.0;\n double s1 = (a[1] + splitline)/2 * Math.Sqrt(3)/2*a[0];\n double s2 = (a[4] + splitline)/2 * Math.Sqrt(3)/2*a[3];\n\n int s = (int) ((s1 + s2)/striangle);\n\n Console.WriteLine(s);\n }\n\n #region Handy\n\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n public static int[] ReadArrayInt()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n }\n\n public static string[] ReadArrayString()\n {\n return Console.ReadLine().Split(' ');\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesSolver\n{\n class Program\n {\n static void Main()\n {\n double striangle = Math.Sqrt(3)/4;\n var a = ReadArrayInt();\n\n var alpha = 2*Math.PI/3;\n\n double m0 = a[1]*Math.Sin(alpha) - a[2]*Math.Sin(alpha*2) + a[3]*Math.Sin(alpha*3) - a[4]*Math.Sin(alpha*4);\n double m1 = a[2]*Math.Sin(alpha) - a[3]*Math.Sin(alpha*2) + a[4]*Math.Sin(alpha*3);\n double m2 = a[3]*Math.Sin(alpha) - a[4]*Math.Sin(alpha*2);\n double m3 = a[4]*Math.Sin(alpha);\n\n double s = (a[0]*m0 + a[1]*m1 + a[2]*m2 + a[3]*m3)/2;\n\n Console.WriteLine(s/striangle);\n }\n\n #region Handy\n\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n public static int[] ReadArrayInt()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n }\n\n public static string[] ReadArrayString()\n {\n return Console.ReadLine().Split(' ');\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class CodeForces313_3\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\CodeForces\\CodeForce313\\3.txt\"));\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n int[] a = new int[6];\n\n for (int i = 0; i < 6; i++)\n {\n a[i] = int.Parse(strParams[i]);\n }\n\n int sum = (a[0] * a[1] * 2) +\n (a[2] * a[3] * 2) +\n (a[4] * a[5] * 2);\n\n int t = a[5] - a[2];\n int R = 0;\n if (t > 0)\n {\n int p = 0;\n for (int i = 0; i < t; i++)\n {\n if (i == 0)\n {\n R = 1;\n p = 1;\n }\n else\n {\n p += 2;\n R += p;\n }\n }\n }\n\n sum += R;\n Console.WriteLine(sum.ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class CodeForces313_3\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\CodeForces\\CodeForce313\\3.txt\"));\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n int[] a = new int[6];\n\n for (int i = 0; i < 6; i++)\n {\n a[i] = int.Parse(strParams[i]);\n }\n\n int sum = (a[0] * a[1] * 2) +\n (a[2] * a[3] * 2) +\n (a[4] * a[5] * 2);\n\n int t = a[5] - a[2];\n if (t > 0)\n {\n int R = 0, p = 0;\n for (int i = 0; i < t; i++)\n {\n if (i == 0)\n {\n R = 1;\n p = 1;\n }\n else\n {\n p += 2;\n R += p;\n }\n }\n }\n\n sum += t;\n Console.WriteLine(sum.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n // Input\n string[] tokens = Console.ReadLine().Split(' ');\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n int c = int.Parse(tokens[2]);\n int d = int.Parse(tokens[3]);\n int e = int.Parse(tokens[4]);\n int f = int.Parse(tokens[5]);\n\n // Main Logic\n int total = 0;\n int mode = 1;\n int l = 0;\n int r = 0;\n while (true)\n {\n if (mode == 1)\n {\n l = f;\n r = b;\n int x = Math.Min(l, r);\n total += (2*a + x)*x;\n if (l < r)\n {\n mode = 2;\n }\n else if (l == r)\n {\n mode = 4;\n }\n else\n {\n mode = 3;\n }\n }\n else if (mode == 2)\n {\n r = b - f;\n total += (a + f)*(r + 1);\n mode = 4;\n }\n else if (mode == 3)\n {\n r = f - b;\n total += (a + f)*(r + 1);\n mode = 4;\n }\n else if (mode == 4)\n {\n r = Math.Min(c, e);\n total += (2*d + r)*r;\n break;\n }\n }\n\n // Output\n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskCGerald\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split();\n int[] a = new int[str.Length];\n for (int i = 0; i < str.Count(); i++)\n a[i] = int.Parse(str[i]);\n double sqrt3 = Math.Sqrt(3);\n double triangleSquare = sqrt3 / 8;\n double square = (a[4] * sqrt3 * 1.0 / 2 + a[5] * sqrt3 * 1.0 / 2) * (a[4]*1.0/2 + a[3] * 1.0 + a[2] * 1.0 / 2);\n square -= a[4] * a[4] * 1.0 / 8 * sqrt3;\n square -= a[5] * a[5] * 1.0 / 8 * sqrt3;\n square -= a[2] * a[2] * 1.0 / 8 * sqrt3;\n square -= a[1] * a[1] * 1.0 / 8 * sqrt3;\n Console.WriteLine(square / triangleSquare / 2.0);\n }\n }\n}\n"}], "src_uid": "382475475427f0e76c6b4ac6e7a02e21"} {"source_code": "//#define __debug\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\n\nnamespace _TestData\n{\n public static class TestExtensions\n {\n public static string ToStr(this IEnumerable ms)\n {\n return ms.Aggregate(\"\", (current, s) => current + (s + \",\"));\n }\n public static string Split(this string str, int index, char spliter=' ')\n {\n return str.Split(spliter)[index];\n }\n public static int ToInt(this string str)\n {\n return Convert.ToInt32(str);\n }\n public static char GetChar(this string str, int index)\n {\n return str[index];\n }\n\n public static int Sum(this int i)\n {\n int ii = 0;\n for (; i != 0;)\n {\n ii += i % 10;\n i = i / 10;\n }\n return ii;\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n#if __debug\n var n = \"9999\";\n#else\n var n = Console.ReadLine();\n\n#endif\n\n Console.WriteLine(Get(n.ToInt()));\n }\n\n\n static void Add(ref string str , int i)\n {\n str += i;\n }\n static string Get(int n)\n {\n string tmp = string.Empty;\n int i = 1;\n while (tmp.Length < n)\n {\n Add(ref tmp, i++);\n }\n //Console.WriteLine(tmp);\n return tmp[n-1].ToString();\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp15\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n string s = \"\";\n for(int i = 1; i <= k; i++)\n s += i.ToString();\n Console.WriteLine(s[k-1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Int32.Parse(Console.ReadLine());\n string s = \"\";\n for (int i = 1; i <= 10000; i++)\n s += i;\n Console.Write(s[x-1]);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s=\"\";\n for(int i=0;i<10000;i++)\n s+=i.ToString();\n int n=int.Parse(Console.ReadLine());\n Console.WriteLine(s[n]);\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nclass _1177B\n{\n\tstatic void Main()\n\t{\n\t\tlong k = long.Parse(Console.ReadLine());\n\n\t\tlong start = 0;\n\t\tlong cnt = 9;\n\t\tint digit = 1;\n\t\twhile (k > start)\n\t\t{\n\t\t\tstart += cnt * digit++;\n\t\t\tcnt *= 10;\n\t\t}\n\t\tstart -= (cnt / 10) * --digit;\n\t\tlong posFromStart = k - start;\n\t\tlong numFromStart = (long)Math.Ceiling((double)posFromStart / digit);\n\t\tlong cntBefore = (long)Math.Pow(10, digit - 1) - 1;\n\t\tlong num = numFromStart + cntBefore;\n\t\tint posDigit = (int)(posFromStart % digit);\n\t\tposDigit = (posDigit == 0 ? digit : posDigit) - 1;\n\t\tConsole.WriteLine(num.ToString()[posDigit]);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Digits_Sequence\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static char Solve(string[] args)\n {\n int n = Next();\n\n var b = new StringBuilder();\n int i = 1;\n while (b.Length < n)\n {\n b.Append(i++);\n }\n return b[n-1];\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main(){\n var n = int.Parse(Console.ReadLine());\n var str = \"\";\n for(int i = 1; i<5000; i++)\n {\n str += i.ToString();\n }\n Console.WriteLine(str[n-1]);\n }\n}"}, {"source_code": "// Problem: 1177A - Digits Sequence (Easy Edition)\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass DigitsSequenceEasyEdition\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (1);\n if (words == null)\n return -1;\n ushort k;\n if (!UInt16.TryParse (words[0], out k))\n return -1;\n if (k < 1 || k > 10000)\n return -1;\n byte ans = 0;\n if (k < 10)\n ans = (byte)k;\n else if (k < 190)\n {\n ushort i = Convert.ToUInt16 (k-10);\n ushort num = Convert.ToUInt16 (10+i/2);\n ans = (i%2 == 0 ? Convert.ToByte (num/10) : Convert.ToByte (num%10));\n }\n else if (k < 2890)\n {\n ushort i = Convert.ToUInt16 (k-190);\n ushort num = Convert.ToUInt16 (100+i/3);\n byte r = Convert.ToByte (i%3);\n if (r == 0)\n ans = Convert.ToByte (num/100);\n else\n ans = (r == 1 ? Convert.ToByte ((num/10)%10) : Convert.ToByte (num%10));\n }\n else\n {\n ushort i = Convert.ToUInt16 (k-2890);\n ushort num = Convert.ToUInt16 (1000+i/4);\n byte r = Convert.ToByte (i%4);\n switch (r)\n {\n case 0: ans = Convert.ToByte (num/1000);\n break;\n case 1: ans = Convert.ToByte ((num/100)%10);\n break;\n case 2: ans = Convert.ToByte ((num/10)%10);\n break;\n case 3: ans = Convert.ToByte (num%10);\n break;\n }\n }\n Console.WriteLine (ans);\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing SB = System.Text.StringBuilder;\n//using System.Threading.Tasks;\n//using System.Text.RegularExpressions;\n//using System.Globalization;\n//using System.Diagnostics;\nusing static System.Console;\nusing System.Numerics;\nusing static System.Math;\nusing pair = Pair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().solve();\n Out.Flush();\n }\n readonly Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 }; //\u2192\u2193\u2190\u2191\n readonly int mod = 1000000007;\n readonly int dom = 998244353;\n bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }\n\n void solve()\n {\n int K = cin.nextint;\n for (int i = 1; ; i++)\n {\n var S = i.ToString();\n if (K <= S.Length)\n {\n WriteLine(S[K - 1]);\n return;\n }\n\n K -= S.Length;\n }\n }\n\n}\n\n\nstatic class Ex\n{\n public static void join(this IEnumerable values, string sep = \" \") => WriteLine(string.Join(sep, values));\n public static string concat(this IEnumerable values) => string.Concat(values);\n public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }\n\n public static int lower_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) < 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n public static int upper_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) <= 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n}\n\nclass Pair : IComparable> where T : IComparable where U : IComparable\n{\n public T f; public U s;\n public Pair(T f, U s) { this.f = f; this.s = s; }\n public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);\n public override string ToString() => $\"{f} {s}\";\n}\n\nclass Scanner\n{\n string[] s; int i;\n readonly char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan => ReadLine().Split();\n public int[] scanint => Array.ConvertAll(scan, int.Parse);\n public long[] scanlong => Array.ConvertAll(scan, long.Parse);\n public double[] scandouble => Array.ConvertAll(scan, double.Parse);\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint => int.Parse(next);\n public long nextlong => long.Parse(next);\n public double nextdouble => double.Parse(next);\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = \"\";\n for (int i = 1; i < 10000; i++)\n {\n s += Convert.ToString(i);\n }\n int k = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(s[k - 1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadLong();\n if (k < 10)\n {\n Console.Write(k);\n }\n else\n {\n var d = 1;\n long a = 0;\n long b = 9;\n while (a + b * d < k)\n {\n a += b * d;\n b *= 10;\n d++;\n }\n var x = (long)Math.Pow(10, d - 1);\n var c = (k - a - 1) / d;\n var y = x + c;\n var j = (k - a - 1) % d;\n for (var i = 0; i < d - j - 1; i++)\n {\n y /= 10;\n }\n Console.Write(y % 10);\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\n\nclass _1177B\n{\n\tstatic void Main()\n\t{\n\t\tlong k = long.Parse(Console.ReadLine());\n\n\t\tlong start = 0;\n\t\tlong cnt = 9;\n\t\tint digit = 1;\n\t\twhile (k > start)\n\t\t{\n\t\t\tstart += cnt * digit++;\n\t\t\tcnt *= 10;\n\t\t}\n\t\tstart -= (cnt / 10) * --digit;\n\t\tlong posFromStart = k - start;\n\t\tlong numFromStart = (long)Math.Ceiling((double)posFromStart / digit);\n\t\tlong cntBefore = (long)Math.Pow(10, digit - 1) - 1;\n\t\tlong num = numFromStart + cntBefore;\n\t\tint posDigit = (int)(posFromStart % digit);\n\t\tposDigit = (posDigit == 0 ? digit : posDigit) - 1;\n\t\tConsole.WriteLine(num.ToString()[posDigit]);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing SB = System.Text.StringBuilder;\n//using System.Threading.Tasks;\n//using System.Text.RegularExpressions;\n//using System.Globalization;\n//using System.Diagnostics;\nusing static System.Console;\nusing System.Numerics;\nusing static System.Math;\nusing pair = Pair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().solve();\n Out.Flush();\n }\n readonly Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 }; //\u2192\u2193\u2190\u2191\n readonly int mod = 1000000007;\n readonly int dom = 998244353;\n bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }\n\n void solve()\n {\n var K = cin.nextlong - 1;\n\n long now = 1;\n for (int i = 1; ; i++)\n {\n //\u9577\u3055\u304ci\u306e\u6570\u5b57\u306e\u6570 [10..0, 100..0)\n long len = now * 10 - now;\n\n long cnt = i * len;\n if (K < cnt)\n {\n //\u4f55\u500b\u76ee\u306e\u6570\u5b57\u304b\n var idx = K / i;\n //\u4f55\u756a\u76ee\u306e\u6587\u5b57\u304b\n var t = K % i;\n //\u6570\u5b57\u306f\u306a\u306b\u304b\n var num = now + idx;\n\n //WriteLine(idx + \" \" + t + \" \" + K + \" \" + len + \" \" + num);\n\n WriteLine((now + idx).ToString()[(int)t]);\n return;\n }\n\n now *= 10;\n K -= cnt;\n }\n }\n\n}\n\n\nstatic class Ex\n{\n public static void join(this IEnumerable values, string sep = \" \") => WriteLine(string.Join(sep, values));\n public static string concat(this IEnumerable values) => string.Concat(values);\n public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }\n\n public static int lower_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) < 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n public static int upper_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) <= 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n}\n\nclass Pair : IComparable> where T : IComparable where U : IComparable\n{\n public T f; public U s;\n public Pair(T f, U s) { this.f = f; this.s = s; }\n public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);\n public override string ToString() => $\"{f} {s}\";\n}\n\nclass Scanner\n{\n string[] s; int i;\n readonly char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan => ReadLine().Split();\n public int[] scanint => Array.ConvertAll(scan, int.Parse);\n public long[] scanlong => Array.ConvertAll(scan, long.Parse);\n public double[] scandouble => Array.ConvertAll(scan, double.Parse);\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint => int.Parse(next);\n public long nextlong => long.Parse(next);\n public double nextdouble => double.Parse(next);\n}\n"}, {"source_code": "using System;\nnamespace cs\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = \"1\";\n int n;\n \n for(n=2;n<=10000;n++)\n {\n a += Convert.ToString(n);\n }\n\n int k = Convert.ToInt32(Console.ReadLine());\n char[] b = a.ToCharArray();\n Console.WriteLine(b[k-1]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadLong();\n if (k < 10)\n {\n Console.Write(k);\n }\n else\n {\n var d = 1;\n long a = 0;\n long b = 9;\n while (a + b * d < k)\n {\n a += b * d;\n b *= 10;\n d++;\n }\n var x = (long)Math.Pow(10, d - 1);\n var c = (k - a - 1) / d;\n var y = x + c;\n var j = (k - a - 1) % d;\n for (var i = 0; i < d - j - 1; i++)\n {\n y /= 10;\n }\n Console.Write(y % 10);\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadLong();\n var d = 1;\n long a = 0;\n long b = 9;\n while (a + b * d < k)\n {\n a += b * d;\n if (a + b * d <= k)\n {\n b *= 10;\n d++;\n }\n }\n var x = (long)Math.Pow(10, d - 1);\n var c = (k - a - 1) / d;\n var y = x + c;\n var j = (k - a - 1) % d;\n for (var i = 0; i < d - j - 1; i++)\n {\n y /= 10;\n }\n Console.Write(y % 10);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadLong() - 1;\n var d = 1;\n long a = 0;\n long b = 9;\n while (a + b <= k)\n {\n a += b;\n b *= 10;\n d++;\n }\n var x = (long)Math.Pow(10, d - 1);\n var c = (k - a) / d;\n var y = x + c;\n var j = (k - a) % d;\n for (var i = 0; i < d - j - 1; i++)\n {\n y /= 10;\n }\n Console.Write(y % 10);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var k = input.ReadLong();\n var d = 1;\n long a = 0;\n long b = 9;\n while (a + b * d <= k)\n {\n a += b * d;\n if (a + b * d <= k)\n {\n b *= 10;\n d++;\n }\n }\n var x = (long)Math.Pow(10, d - 1);\n var c = (k - a - 1) / d;\n var y = x + c;\n var j = (k - a - 1) % d;\n for (var i = 0; i < d - j - 1; i++)\n {\n y /= 10;\n }\n Console.Write(y % 10);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main(){\n var n = int.Parse(Console.ReadLine());\n var str = \"\";\n for(int i = 1; i<5000; i++)\n {\n str += i.ToString();\n }\n Console.WriteLine(str[n]);\n }\n}"}], "src_uid": "1503d761dd4e129fb7c423da390544ff"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace INTERCALC\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n writer.WriteLine(nn.Max() ^ nn[n - 1]);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.CodeDom;\nusing System.Linq;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n Console.ReadLine();\n var query = Console.ReadLine().Split(' ').Select(byte.Parse);\n Console.WriteLine(query.Max() ^ query.Last());\n\n //var n = int.Parse(Console.ReadLine());\n //var result = 0;\n //var array = new[]\n //{\n // 0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,\n // 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852,\n // 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165\n //};\n //result = array[n];\n\n //Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace INTERCALC\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n writer.WriteLine(nn.Max() - nn[n - 1]);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "f45c769556ac3f408f5542fa71a67d98"} {"source_code": "\ufeffusing System;\n\nusing System.Linq;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var array = Console.ReadLine().Split(' ').Select(byte.Parse).Skip(1).OrderBy(_ => _);\n for (int i = 0; i < 1000; i++)\n {\n Enumerable.Range(0, 1000).Select(_ => Guid.NewGuid().ToString()).OrderByDescending(_ => _).ToList();\n }\n \n Console.WriteLine(string.Join(\" \", array));\n\n //Console.ReadLine();\n //var a = new List();\n ////var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n //var n = 4;\n //while (n-- > 0) a.Add(Console.ReadLine() == \"1\");\n\n //var a1 = a[0] ^ a[1];\n //var a2 = a[2] | a[3];\n //var a3 = a[1] & a[2];\n //var a4 = a[0] ^ a[3];\n\n //var b1 = a1 & a2;\n //var b2 = a3 | a4;\n\n //Console.WriteLine(b1 ^ b2 ? '1' : '0'); \n\n //Console.WriteLine(query.Max() ^ query.Last());\n\n //var n = int.Parse(Console.ReadLine());\n //var result = 0;\n //var array = new[]\n //{\n // 0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,\n // 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852,\n // 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165\n //};\n //result = array[n];\n\n //Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n Stopwatch e = new Stopwatch();\n e.Start();\n var n = Console.ReadLine().Split().Skip(1).Select(int.Parse).ToList();\n n.Sort();\n while (e.ElapsedMilliseconds < 1400)\n {\n\n }\n Console.WriteLine(string.Join(\" \", n));\n Console.Read();\n }\n}"}, {"source_code": "//784F Crunching Numbers Just for You\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\npublic class _784F\n{\n\tpublic static void Main()\n\t{\n\t\tstring input = Console.ReadLine();\n\t\tint firstSpaceBarPos = input.IndexOf(' ');\n\t\tinput = input.Substring(firstSpaceBarPos+1,input.Length-(firstSpaceBarPos+1));\n\t\tList listNum = new List(Array.ConvertAll(input.Split(' '),int.Parse)).ToList();\n\t\tlistNum.Sort();\n\n\t\tStopwatch watch = new Stopwatch();\n\t\twatch.Start();\n\n\t\twhile(watch.ElapsedMilliseconds<1000)\n\t\t{\n\t\t}\n\n\t\tfor(int i=0;i currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Crunching_Numbers_Just_for_You\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n Array.Sort(nn);\n\n List s = nn.Select(t => t.ToString()).ToList();\n\n DateTime next = DateTime.UtcNow.AddSeconds(1);\n long k = 1;\n while (DateTime.UtcNow '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nnamespace _784F\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n int[] a = new int[n];\n for (int i = 1; i <= n; i++)\n a[i - 1] = int.Parse(input[i]);\n Array.Sort(a);\n int x = 0;\n DateTime dt1 = DateTime.Now;\n while ((DateTime.Now - dt1).TotalMilliseconds < 1500)\n x++;\n Console.WriteLine(string.Join(\" \", a));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] h = Console.ReadLine().Split(' ');\n int[] a = new int[int.Parse(h[0])];\n for(int u = 1; u w != \"0\").ToList()));\n Console.Read();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n Stopwatch e = new Stopwatch();\n e.Start();\n var n = Console.ReadLine().Split().Skip(1).ToList();\n n.Sort();\n while (e.ElapsedMilliseconds < 1001)\n {\n\n }\n Console.WriteLine(string.Join(\" \", n));\n Console.Read();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n Stopwatch e = new Stopwatch();\n e.Start();\n var n = Console.ReadLine().Split().Skip(1).ToList();\n while (e.ElapsedMilliseconds < 1400)\n n.Sort();\n Console.WriteLine(string.Join(\" \", n.Distinct().ToList()));\n Console.Read();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Crunching_Numbers_Just_for_You\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n List s = nn.Select(t => t.ToString()).ToList();\n s.Sort();\n\n foreach (string c in s)\n {\n writer.Write(c);\n writer.Write(' ');\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Crunching_Numbers_Just_for_You\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n List s = nn.Select(t => t.ToString() ).ToList();\n s.Sort();\n\n foreach (string c in s)\n {\n writer.Write(c);\n writer.Write(' ');\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] h = Console.ReadLine().Split(' ');\n int[] a = new int[int.Parse(h[0])];\n for(int u = 1; u2)\n {\n int vv = 0;\n vv = a[0];\n a[0] = a[1];\n a[1] = vv;\n }\n for(int i = 0; i currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Numerics;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n\n public void Solve()\n {\n //var a = ReadAndTransposeIntMatrix(4)[0];\n //Write(1 - (((a[0] | a[1]) & (a[2] ^ a[3])) | ((a[1] & a[2]) ^ (a[0] | a[3]))));\n var a = ReadIntArray().Skip(1).ToArray();\n int n = a.Length;\n\n Array.Sort(a);\n WriteArray(Enumerable.Repeat(1, n));\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n // public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 256);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Numerics;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n\n public void Solve()\n {\n //var a = ReadAndTransposeIntMatrix(4)[0];\n //Write(1 - (((a[0] | a[1]) & (a[2] ^ a[3])) | ((a[1] & a[2]) ^ (a[0] | a[3]))));\n var a = ReadIntArray().Skip(1).ToArray();\n int n = a.Length;\n\n Array.Sort(a);\n WriteArray(Enumerable.Repeat(1, n));\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 256);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}], "src_uid": "29e481abfa9ad1f18e6157c9e833f16e"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int N, M;\n sc.Make(out N, out M);\n int[] res = new int[N],ex=new int[N];\n int[] ct = new int[M],ts=new int[M];\n \n var pq = new PriorityQueue((a,b)=>a.v1-b.v1);\n for(var i = 0; i < M; i++)\n {\n int s, t, c;\n sc.Make(out s, out t, out c);\n s--;t--;\n res[t] = M+1;\n ts[i] = t;\n ex[t] = i;\n pq.Push(new Pi(s,i));\n ct[i] = c;\n }\n var f = new PriorityQueue>((a, b) => a.v1 - b.v1);\n var use = new bool[M];\n for(var i = 0; i < N; i++)\n {\n while (pq.Any() && pq.Top.v1 == i)\n f.Push(new Pair(ts[pq.Top.v2], ct[pq.Top.v2],pq.Pop().v2));\n if (res[i] == M+1)\n {\n if (!use[ex[i]]) Fail(-1);\n continue;\n }\n if (!f.Any()) continue;\n var p = f.Pop();\n res[i] = p.v3+1;\n p.v2--;\n if (p.v2 != 0) f.Push(p);\n else use[p.v3] = true;\n }\n\n Console.WriteLine(string.Join(\" \", res));\n\n }\n}\n\npublic class PriorityQueue\n{\n private List data = new List();\n private Comparison cmp;\n public int Count { get { return data.Count; } }\n public T Top { get { return data[0]; } }\n public PriorityQueue() { cmp = cmp ?? Comparer.Default.Compare; }\n\n public PriorityQueue(Comparison comparison) { cmp = comparison; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private int Parent(int i)\n => (i - 1) >> 1;\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private int Left(int i)\n => (i << 1) + 1;\n public T Push(T val)\n {\n int i = data.Count;\n data.Add(val);\n while (i > 0)\n {\n int p = Parent(i);\n if (cmp(data[p], val) <= 0)\n break;\n data[i] = data[p];\n i = p;\n }\n data[i] = val;\n return val;\n }\n public T Pop()\n {\n var ret = data[0];\n var p = 0;\n var x = data[data.Count - 1];\n while (Left(p) < data.Count - 1)\n {\n var l = Left(p);\n if (l < data.Count - 2 && cmp(data[l + 1], data[l]) < 0) l++;\n if (cmp(data[l], x) >= 0)\n break;\n data[p] = data[l];\n p = l;\n }\n data[p] = x;\n data.RemoveAt(data.Count - 1);\n return ret;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public bool Any() => data.Count > 0;\n}\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static T[] Copy(this T[] A)\n => Create(A.Length, i => A[i]);\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\nusing CompLib.Collections;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int m = sc.NextInt();\n\n int[] s = new int[m];\n int[] d = new int[m];\n int[] c = new int[m];\n\n for (int i = 0; i < m; i++)\n {\n s[i] = sc.NextInt() - 1;\n d[i] = sc.NextInt() - 1;\n c[i] = sc.NextInt();\n }\n\n // i\u65e5\u306b\u516c\u958b\u3055\u308c\u308b\u8a66\u9a13\n List[] l = new List[n];\n\n // i\u65e5\u306b\u3042\u308b\u8a66\u9a13\n int[] r = new int[n];\n for (int i = 0; i < n; i++)\n {\n l[i] = new List();\n r[i] = -1;\n }\n\n for (int i = 0; i < m; i++)\n {\n l[s[i]].Add(i);\n r[d[i]] = i;\n }\n\n // \u8a66\u9a13i\u3078\u306e\u52c9\u5f37\u65e5\u6570\n int[] cnt = new int[m];\n var pq = new PriorityQueue((l, r) => d[l].CompareTo(d[r]));\n\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n {\n foreach (int j in l[i])\n {\n pq.Enqueue(j);\n }\n\n if (r[i] == -1)\n {\n if (pq.Count <= 0) continue;\n var peek = pq.Peek();\n cnt[peek]++;\n ans[i] = peek + 1;\n if (cnt[peek] >= c[peek]) pq.Dequeue();\n }\n else\n {\n if (cnt[r[i]] < c[r[i]])\n {\n Console.WriteLine(\"-1\");\n return;\n }\n\n ans[i] = m + 1;\n }\n }\n\n Console.WriteLine(string.Join(\" \", ans));\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\n// https://bitbucket.org/camypaper/complib\nnamespace CompLib.Collections\n{\n using System;\n using System.Collections.Generic;\n\n #region PriorityQueue\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u578b\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6700\u3082\u4fa1\u5024\u304c\u4f4e\u3044\u9806\u306b\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u53ef\u80fd\u306a\u53ef\u5909\u30b5\u30a4\u30ba\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u8868\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u5185\u306e\u8981\u7d20\u306e\u578b\u3092\u6307\u5b9a\u3057\u307e\u3059\uff0e\n /// \u5185\u90e8\u7684\u306b\u306f\u30d0\u30a4\u30ca\u30ea\u30d2\u30fc\u30d7\u306b\u3088\u3063\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\uff0e\n public class PriorityQueue\n {\n readonly List heap = new List();\n readonly Comparison cmp;\n\n /// \n /// \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u6bd4\u8f03\u5b50\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u521d\u671f\u5316\u3057\u307e\u3059\uff0e\n /// \n /// \u3053\u306e\u64cd\u4f5c\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public PriorityQueue()\n {\n cmp = Comparer.Default.Compare;\n }\n\n /// \n /// \u30c7\u30ea\u30b2\u30fc\u30c8\u3067\u8868\u3055\u308c\u308b\u3088\u3046\u306a\u6bd4\u8f03\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u521d\u671f\u5316\u3057\u307e\u3059\uff0e\n /// \n /// \n /// \u3053\u306e\u64cd\u4f5c\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public PriorityQueue(Comparison comparison)\n {\n cmp = comparison;\n }\n\n /// \n /// \u6307\u5b9a\u3055\u308c\u305f\u6bd4\u8f03\u5b50\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u521d\u671f\u5316\u3057\u307e\u3059\uff0e\n /// \n /// \n /// \u3053\u306e\u64cd\u4f5c\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public PriorityQueue(IComparer comparer)\n {\n cmp = comparer.Compare;\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u306b\u8981\u7d20\u3092\u8ffd\u52a0\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u306b\u8ffd\u52a0\u3055\u308c\u308b\u8981\u7d20\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public void Enqueue(T item)\n {\n var pos = heap.Count;\n heap.Add(item);\n while (pos > 0)\n {\n var par = (pos - 1) / 2;\n if (cmp(heap[par], item) <= 0)\n break;\n heap[pos] = heap[par];\n pos = par;\n }\n\n heap[pos] = item;\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u304b\u3089\u6700\u3082\u4fa1\u5024\u304c\u4f4e\u3044\u8981\u7d20\u3092\u524a\u9664\u3057\uff0c\u8fd4\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u304b\u3089\u524a\u9664\u3055\u308c\u305f\u8981\u7d20\uff0e\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(log N) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public T Dequeue()\n {\n var ret = heap[0];\n var pos = 0;\n var x = heap[heap.Count - 1];\n\n while (pos * 2 + 1 < heap.Count - 1)\n {\n var lch = pos * 2 + 1;\n var rch = pos * 2 + 2;\n if (rch < heap.Count - 1 && cmp(heap[rch], heap[lch]) < 0) lch = rch;\n if (cmp(heap[lch], x) >= 0)\n break;\n heap[pos] = heap[lch];\n pos = lch;\n }\n\n heap[pos] = x;\n heap.RemoveAt(heap.Count - 1);\n return ret;\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u306b\u542b\u307e\u308c\u308b\u6700\u3082\u4fa1\u5024\u304c\u4f4e\u3044\u8981\u7d20\u3092\u524a\u9664\u305b\u305a\u306b\u8fd4\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u306b\u542b\u307e\u308c\u308b\u6700\u3082\u4fa1\u5024\u304c\u4f4e\u3044\u8981\u7d20\uff0e\n /// \u3053\u306e\u64cd\u4f5c\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public T Peek()\n {\n return heap[0];\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u5185\u306e\u8981\u7d20\u306e\u6570\u3092\u53d6\u5f97\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u30ad\u30e5\u30fc\u5185\u306b\u3042\u308b\u8981\u7d20\u306e\u6570\n /// \u6700\u60aa\u8a08\u7b97\u91cf O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public int Count\n {\n get { return heap.Count; }\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u5185\u306b\u8981\u7d20\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3092 O(1) \u3067\u5224\u5b9a\u3057\u307e\u3059\uff0e\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u30ad\u30e5\u30fc\u5185\u306b\u3042\u308b\u8981\u7d20\u304c\u5b58\u5728\u3059\u308b\u306a\u3089\u3070 true\uff0c\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u3000false\uff0e\n /// \u3053\u306e\u64cd\u4f5c\u306f O(1) \u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public bool Any()\n {\n return heap.Count > 0;\n }\n\n /// \n /// \u512a\u5148\u5ea6\u4ed8\u304d\u30ad\u30e5\u30fc\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u3092\u6607\u9806\u306b\u4e26\u3079\u3066\u8fd4\u3057\u307e\u3059\uff0e\n /// \n /// \u3053\u306e\u64cd\u4f5c\u306f\u8a08\u7b97\u91cf O(N log N)\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\uff0e\n public T[] Items\n {\n get\n {\n var ret = heap.ToArray();\n Array.Sort(ret, cmp);\n return ret;\n }\n }\n }\n\n #endregion\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound481Div3.Questions;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace CodeforcesRound481Div3.Questions\n{\n public class QuestionG : AtCoderQuestionBase\n {\n public override void Solve(IOManager io)\n {\n var totalDays = io.ReadInt();\n var totalExams = io.ReadInt();\n var result = new int[totalDays];\n var starts = Enumerable.Repeat(0, totalDays).Select(_ => new List()).ToArray();\n var exams = new Exam[totalExams];\n var examPlans = new int[totalDays];\n\n for (int i = 0; i < exams.Length; i++)\n {\n var s = io.ReadInt() - 1;\n var d = io.ReadInt() - 1;\n var c = io.ReadInt();\n exams[i] = new Exam(d, i);\n\n for (int j = 0; j < c; j++)\n {\n starts[s].Add(i);\n }\n\n result[d] = totalExams + 1;\n examPlans[d] = i;\n }\n\n Array.Sort(exams);\n Study.SetOrder(exams.Select(ex => ex.ID).ToArray());\n var queue = new PriorityQueue(false);\n var ended = new HashSet();\n\n for (int day = 0; day < result.Length; day++)\n {\n foreach (var todo in starts[day])\n {\n queue.Enqueue(new Study(todo));\n }\n\n if (result[day] == 0 && queue.Count > 0)\n {\n var next = queue.Dequeue().Subject;\n if (ended.Contains(next))\n {\n io.WriteLine(-1);\n return;\n }\n else\n {\n result[day] = next + 1;\n }\n }\n else if (result[day] != 0)\n {\n ended.Add(examPlans[day]);\n }\n }\n\n if (queue.Count == 0)\n {\n io.WriteLine(result, ' ');\n }\n else\n {\n io.WriteLine(-1);\n }\n }\n\n [StructLayout(LayoutKind.Auto)]\n readonly struct Exam : IComparable\n {\n public int EndDay { get; }\n public int ID { get; }\n\n public Exam(int endDay, int id)\n {\n EndDay = endDay;\n ID = id;\n }\n\n public void Deconstruct(out int endDay, out int id) => (endDay, id) = (EndDay, ID);\n public override string ToString() => $\"{nameof(EndDay)}: {EndDay}, {nameof(ID)}: {ID}\";\n\n public int CompareTo([AllowNull] Exam other) => EndDay - other.EndDay;\n }\n\n readonly struct Study : IComparable\n {\n public int Subject { get; }\n static int[] _order;\n\n public static void SetOrder(int[] subjects)\n {\n _order = new int[subjects.Length];\n\n for (int i = 0; i < subjects.Length; i++)\n {\n _order[subjects[i]] = i;\n }\n }\n\n public Study(int subject)\n {\n Subject = subject;\n }\n\n public int CompareTo([AllowNull] Study other) => _order[Subject] - _order[other.Subject];\n }\n }\n\n public class PriorityQueue : IEnumerable where T : IComparable\n {\n private List _heap = new List();\n private readonly int _reverseFactor;\n public int Count => _heap.Count;\n public bool IsDescending => _reverseFactor == 1;\n\n public PriorityQueue(bool descending) : this(descending, null) { }\n\n public PriorityQueue(bool descending, IEnumerable collection)\n {\n _reverseFactor = descending ? 1 : -1;\n _heap = new List();\n\n if (collection != null)\n {\n foreach (var item in collection)\n {\n Enqueue(item);\n }\n }\n }\n\n public void Enqueue(T item)\n {\n _heap.Add(item);\n UpHeap();\n }\n\n public T Dequeue()\n {\n var item = _heap[0];\n DownHeap();\n return item;\n }\n\n public T Peek() => _heap[0];\n\n private void UpHeap()\n {\n var child = Count - 1;\n while (child > 0)\n {\n int parent = (child - 1) / 2;\n\n if (Compare(_heap[child], _heap[parent]) > 0)\n {\n SwapAt(child, parent);\n child = parent;\n }\n else\n {\n break;\n }\n }\n }\n\n private void DownHeap()\n {\n _heap[0] = _heap[Count - 1];\n _heap.RemoveAt(Count - 1);\n\n var parent = 0;\n while (true)\n {\n var leftChild = 2 * parent + 1;\n\n if (leftChild > Count - 1)\n {\n break;\n }\n\n var target = (leftChild < Count - 1) && (Compare(_heap[leftChild], _heap[leftChild + 1]) < 0) ? leftChild + 1 : leftChild;\n\n if (Compare(_heap[parent], _heap[target]) < 0)\n {\n SwapAt(parent, target);\n }\n else\n {\n break;\n }\n\n parent = target;\n }\n }\n\n private int Compare(T a, T b) => _reverseFactor * a.CompareTo(b);\n\n private void SwapAt(int n, int m) => (_heap[n], _heap[m]) = (_heap[m], _heap[n]);\n\n public IEnumerator GetEnumerator()\n {\n var copy = new List(_heap);\n try\n {\n while (Count > 0)\n {\n yield return Dequeue();\n }\n }\n finally\n {\n _heap = copy;\n }\n }\n\n System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();\n }\n\n}\n\nnamespace CodeforcesRound481Div3\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionG();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound481Div3.Questions\n{\n\n public interface IAtCoderQuestion\n {\n string Solve(string input);\n void Solve(IOManager io);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public string Solve(string input)\n {\n var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));\n var outputStream = new MemoryStream();\n using var manager = new IOManager(inputStream, outputStream);\n\n Solve(manager);\n manager.Flush();\n\n outputStream.Seek(0, SeekOrigin.Begin);\n var reader = new StreamReader(outputStream);\n return reader.ReadToEnd();\n }\n\n public abstract void Solve(IOManager io);\n }\n\n public class IOManager : IDisposable\n {\n private readonly StreamReader _reader;\n private readonly StreamWriter _writer;\n private bool _disposedValue;\n private Queue> _stringQueue;\n\n const char ValidFirstChar = '!';\n const char ValidLastChar = '~';\n\n public IOManager(Stream input, Stream output)\n {\n _reader = new StreamReader(input);\n _writer = new StreamWriter(output) { AutoFlush = false };\n _stringQueue = new Queue>();\n }\n\n public ReadOnlySpan ReadCharSpan()\n {\n while (_stringQueue.Count == 0)\n {\n var line = _reader.ReadLine().AsMemory().Trim();\n var s = line.Span;\n\n if (s.Length > 0)\n {\n var begin = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (begin < 0 && IsValidChar(s[i]))\n {\n begin = i;\n }\n else if (!IsValidChar(s[i]))\n {\n _stringQueue.Enqueue(line[begin..i]);\n begin = -1;\n }\n }\n _stringQueue.Enqueue(line[begin..line.Length]);\n }\n }\n\n return _stringQueue.Dequeue().Span;\n }\n\n public string ReadString() => ReadCharSpan().ToString();\n\n public int ReadInt() => (int)ReadLong();\n\n public long ReadLong()\n {\n long result = 0;\n bool isPositive = true;\n\n int i = 0;\n var s = ReadCharSpan();\n if (s[i] == '-')\n {\n isPositive = false;\n i++;\n }\n\n while (i < s.Length)\n {\n result = result * 10 + (s[i++] - '0');\n }\n\n return isPositive ? result : -result;\n }\n\n public double ReadDouble() => double.Parse(ReadCharSpan());\n public decimal ReadDecimal() => decimal.Parse(ReadCharSpan());\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadLong();\n }\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDouble();\n }\n return a;\n }\n\n public decimal[] ReadDecimalArray(int n)\n {\n var a = new decimal[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDecimal();\n }\n return a;\n }\n\n public void WriteLine(T value) => _writer.WriteLine(value.ToString());\n\n public void WriteLine(IEnumerable values, char separator)\n {\n var e = values.GetEnumerator();\n if (e.MoveNext())\n {\n _writer.Write(e.Current.ToString());\n\n while (e.MoveNext())\n {\n _writer.Write(separator);\n _writer.Write(e.Current.ToString());\n }\n }\n\n _writer.WriteLine();\n }\n\n public void Flush() => _writer.Flush();\n\n private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;\n\n protected virtual void Dispose(bool disposing)\n {\n if (!_disposedValue)\n {\n if (disposing)\n {\n _reader.Dispose();\n _writer.Flush();\n _writer.Dispose();\n }\n\n _disposedValue = true;\n }\n }\n\n public void Dispose()\n {\n Dispose(disposing: true);\n GC.SuppressFinalize(this);\n }\n }\n}\n\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace G\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader sr = new StreamReader(\"in10.txt\");\n TextReader sr = Console.In;\n string[] ss = sr.ReadLine().Split();\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int[] res = new int[n];\n int[] vozm_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435 \u0434\u043d\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] budet_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0434\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] vozm_ekz_count = new int[n];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435\u0445 \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432 \u0434\u0435\u043d\u044c i\n int[,] vozm = new int[m, n];\n int[] s = new int[m], d = new int[m], c = new int[m];\n for (int i = 0; i < m; i++)\n {\n ss = sr.ReadLine().Split();\n s[i] = Convert.ToInt32(ss[0]);\n d[i] = Convert.ToInt32(ss[1]);\n c[i] = Convert.ToInt32(ss[2]);\n for (int j = s[i] - 1; j < d[i]; j++)\n {\n if (vozm[i, j] != 3)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043f\u0435\u0442\u044f \u043d\u0435 \u0441\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0430\u043c\u0435\u043d\n {\n vozm[i, j] = 1;//\u0432 \u0434\u0435\u043d\u044c j \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n vozm_ekz_count[j]++;\n vozm_d_count[i]++;\n }\n }\n for (int j = 0; j < m; j++)\n {\n if (vozm[j, d[i] - 1] == 1)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u0443 j\n {\n vozm_ekz_count[d[i] - 1]--;\n vozm_d_count[j]--;\n }\n vozm[j, d[i] - 1] = 3;//\u0432 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 j\n }\n res[d[i] - 1] = m + 1;\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n bool can = true;\n bool is0 = true;\n bool finish = true;\n while (true)\n {\n is0 = true;\n finish = true;\n for (int j = 0; j < n; j++)\n {\n if (vozm_ekz_count[j] == 1)\n {\n finish = false;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n if (budet_d_count[i] < c[i])\n {\n vozm[i, j] = 2;\n vozm_d_count[i]--;\n budet_d_count[i]++;\n res[j] = i + 1;\n if (budet_d_count[i] == c[i])\n {\n for (int j1 = 0; j1 < n; j1++)\n {\n if (vozm[i, j1] == 1/*j != j1*/)\n {\n vozm[i, j1] = 0;\n vozm_ekz_count[j1]--;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n }\n }\n else\n {\n vozm[i, j] = 0;\n vozm_d_count[i]--;\n }\n }\n }\n vozm_ekz_count[j] = 0;\n is0 = false;\n }\n else if (vozm_ekz_count[j] > 1)\n finish = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n if (/*budet_d_count[i]< c[i] &&*/vozm_d_count[i] > 0 && vozm_d_count[i] + budet_d_count[i] == c[i])\n {\n finish = false;\n for (int j = 0; j < n; j++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n res[j] = i + 1;\n for (int i1 = 0; i1 < m; i1++)\n {\n if (i1 != i)\n {\n if (vozm[i1, j] == 2)\n {\n can = false;\n goto metka;\n }\n if (vozm[i1, j] == 1)\n {\n vozm[i1, j] = 0;\n vozm_d_count[i1]--;\n }\n }\n }\n vozm_ekz_count[j] = 0;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n is0 = false;\n }\n else\n {\n if (vozm_d_count[i] > 0)\n finish = false;\n if (vozm_d_count[i] + budet_d_count[i] < c[i])\n {\n can = false;\n goto metka;\n }\n }\n }\n\n\n //if (is0) break;\n if (finish) break;\n else if (is0)\n {\n //\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438\n for (int j = n - 1; j >= 0; j--)\n {\n if (vozm_ekz_count[j] > 1)\n {\n int iv = -1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n if (iv == -1) iv = i;\n else\n {\n if ((vozm_d_count[iv]-(c[iv]- budet_d_count[iv]))> (vozm_d_count[i] - (c[i] - budet_d_count[i]))) iv = i;\n }\n }\n }\n //\u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043d\u044c\n if (c[iv] > budet_d_count[iv])\n {\n vozm[iv, j] = 2;\n res[j] = iv + 1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 0;\n vozm_d_count[i]--;\n }\n }\n vozm_ekz_count[j] = 0;\n budet_d_count[iv]++;\n vozm_d_count[iv]--;\n break;\n }\n else\n {\n vozm[iv, j] = 0;\n vozm_ekz_count[j] --;\n vozm_d_count[iv]--;\n break;\n }\n }\n }\n }\n }\n\n metka:\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n if (can) Console.WriteLine(string.Join(\" \", res));\n else Console.WriteLine(\"-1\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Petya_s_Exams\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int n = Next();\n int m = Next();\n\n var nn = new int[n];\n\n var s = new int[m];\n var d = new int[m];\n var c = new int[m];\n var indx = new int[m];\n for (int i = 0; i < m; i++)\n {\n s[i] = Next();\n d[i] = Next();\n c[i] = Next();\n indx[i] = i;\n\n nn[d[i] - 1] = m + 1;\n }\n Array.Sort(d, indx);\n\n for (int i = 0; i < m; i++)\n {\n int index = indx[i];\n for (int j = s[index] - 1; j < d[i]; j++)\n {\n if (nn[j] == 0)\n {\n nn[j] = index + 1;\n c[index]--;\n if (c[index] == 0)\n break;\n }\n }\n if (c[index] != 0)\n {\n writer.WriteLine(\"-1\");\n return;\n }\n }\n\n foreach (int i in nn)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petya_Exam\n{\n class Program\n {\n struct Exam\n {\n public int ExamIndex;\n public int Publish;\n public int ExamDay;\n public int PrepDays;\n } \n \n static void Main(string[] args)\n {\n List list2 = new List();\n int N_Days;\n int Total_exams;\n \n string[] s = (Console.ReadLine()).Split(' ');\n N_Days = int.Parse(s[0]);\n Total_exams = int.Parse(s[1]);\n \n for (int i = 0; i < Total_exams; ++i)\n {\n Exam exm;\n s = (Console.ReadLine()).Split(' ');\n exm.ExamIndex = i + 1;\n exm.Publish = int.Parse(s[0]);\n exm.ExamDay = int.Parse(s[1]);\n exm.PrepDays = int.Parse(s[2]);\n list2.Add(exm);\n }\n\n \n list2.Sort((x, y) => x.ExamDay.CompareTo(y.ExamDay));\n List seq = new List();\n for (int i = 0; i <= N_Days; ++i)\n {\n seq.Add(0);\n }\n int print = 0;\n foreach (Exam l in list2)\n {\n if (l.Publish - 1 + l.PrepDays < l.ExamDay)\n {\n if (Ispossible(l.ExamIndex, l, seq))\n {\n seq[l.ExamDay] = Total_exams + 1;\n \n continue;\n }\n else\n {\n print = -1;\n break;\n }\n }\n else\n {\n print = -1;\n break;\n }\n }\n if (print == 0)\n {\n if (seq.Sum() != 0)\n {\n for (int j = 1; j < seq.Count; ++j)\n {\n if (j + 1 == seq.Count)\n {\n Console.Write(seq[j]);\n continue;\n }\n Console.Write(seq[j] + \" \");\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n \n //Console.ReadKey();\n }\n\n private static bool Ispossible(int exam_number, Exam l, List seq)\n {\n int days = l.PrepDays;\n\n int i = l.Publish;\n while (i < l.ExamDay && days > 0)\n {\n if (seq[i] == 0)\n {\n seq[i] = exam_number;\n days--;\n }\n i++;\n }\n return days == 0 ? true : false;\n }\n\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace G\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader sr = new StreamReader(\"in2.txt\");\n TextReader sr = Console.In;\n string[] ss = sr.ReadLine().Split();\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int[] res = new int[n];\n int[] vozm_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435 \u0434\u043d\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] budet_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0434\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] vozm_ekz_count = new int[n];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435\u0445 \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432 \u0434\u0435\u043d\u044c i\n int[,] vozm = new int[m, n];\n int[] s = new int[m], d = new int[m], c = new int[m];\n for (int i = 0; i < m; i++)\n {\n ss = sr.ReadLine().Split();\n s[i] = Convert.ToInt32(ss[0]);\n d[i] = Convert.ToInt32(ss[1]);\n c[i] = Convert.ToInt32(ss[2]);\n for (int j = s[i] - 1; j < d[i]; j++)\n {\n if (vozm[i, j] != 3)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043f\u0435\u0442\u044f \u043d\u0435 \u0441\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0430\u043c\u0435\u043d\n {\n vozm[i, j] = 1;//\u0432 \u0434\u0435\u043d\u044c j \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n vozm_ekz_count[j]++;\n vozm_d_count[i]++;\n }\n }\n for (int j = 0; j < m; j++)\n {\n if (vozm[j, d[i] - 1] == 1)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u0443 j\n {\n vozm_ekz_count[d[i] - 1]--;\n vozm_d_count[j]--;\n }\n vozm[j, d[i] - 1] = 3;//\u0432 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 j\n }\n res[d[i] - 1] = m + 1;\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n bool can = true;\n bool is0 = true;\n while (true)\n {\n is0 = true;\n\n for (int j = 0; j < n; j++)\n {\n if (vozm_ekz_count[j] == 1)\n {\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n vozm_d_count[i]--;\n budet_d_count[i]++;\n res[j] = i + 1;\n if (budet_d_count[i] == c[i])\n {\n for (int j1 = 0; j1 < n; j1++)\n {\n if (vozm[i, j1]==1/*j != j1*/)\n {\n vozm[i, j1] = 0;\n vozm_ekz_count[j1]--;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n }\n }\n }\n vozm_ekz_count[j] = 0;\n is0 = false;\n }\n }\n\n for (int i = 0; i < m; i++)\n {\n if (/*budet_d_count[i]< c[i] &&*/vozm_d_count[i] > 0 && vozm_d_count[i] + budet_d_count[i] == c[i])\n {\n for (int j = 0; j < n; j++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n for (int i1 = 0; i1 < m; i1++)\n {\n if (i1 != i)\n {\n if (vozm[i1, j] == 2)\n {\n can = false;\n goto metka;\n }\n vozm[i1, j] = 0;\n vozm_d_count[i1]--;\n }\n }\n vozm_ekz_count[j] = 0;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n is0 = false;\n }\n else\n {\n if (vozm_d_count[i] + budet_d_count[i] < c[i])\n {\n can = false;\n goto metka;\n }\n }\n }\n\n\n if (is0) break;\n }\n\n metka:\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n if (can) Console.WriteLine(string.Join(\" \", res));\n else Console.WriteLine(\"-1\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace G\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader sr = new StreamReader(\"in10.txt\");\n TextReader sr = Console.In;\n string[] ss = sr.ReadLine().Split();\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int[] res = new int[n];\n int[] vozm_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435 \u0434\u043d\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] budet_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0434\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] vozm_ekz_count = new int[n];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435\u0445 \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432 \u0434\u0435\u043d\u044c i\n int[,] vozm = new int[m, n];\n int[] s = new int[m], d = new int[m], c = new int[m];\n for (int i = 0; i < m; i++)\n {\n ss = sr.ReadLine().Split();\n s[i] = Convert.ToInt32(ss[0]);\n d[i] = Convert.ToInt32(ss[1]);\n c[i] = Convert.ToInt32(ss[2]);\n for (int j = s[i] - 1; j < d[i]; j++)\n {\n if (vozm[i, j] != 3)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043f\u0435\u0442\u044f \u043d\u0435 \u0441\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0430\u043c\u0435\u043d\n {\n vozm[i, j] = 1;//\u0432 \u0434\u0435\u043d\u044c j \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n vozm_ekz_count[j]++;\n vozm_d_count[i]++;\n }\n }\n for (int j = 0; j < m; j++)\n {\n if (vozm[j, d[i] - 1] == 1)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u0443 j\n {\n vozm_ekz_count[d[i] - 1]--;\n vozm_d_count[j]--;\n }\n vozm[j, d[i] - 1] = 3;//\u0432 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 j\n }\n res[d[i] - 1] = m + 1;\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n bool can = true;\n bool is0 = true;\n bool finish = true;\n while (true)\n {\n is0 = true;\n finish = true;\n for (int j = 0; j < n; j++)\n {\n if (vozm_ekz_count[j] == 1)\n {\n finish = false;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n vozm_d_count[i]--;\n budet_d_count[i]++;\n res[j] = i + 1;\n if (budet_d_count[i] == c[i])\n {\n for (int j1 = 0; j1 < n; j1++)\n {\n if (vozm[i, j1] == 1/*j != j1*/)\n {\n vozm[i, j1] = 0;\n vozm_ekz_count[j1]--;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n }\n }\n }\n vozm_ekz_count[j] = 0;\n is0 = false;\n }\n else if (vozm_ekz_count[j] > 1)\n finish = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n if (/*budet_d_count[i]< c[i] &&*/vozm_d_count[i] > 0 && vozm_d_count[i] + budet_d_count[i] == c[i])\n {\n finish = false;\n for (int j = 0; j < n; j++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n res[j] = i + 1;\n for (int i1 = 0; i1 < m; i1++)\n {\n if (i1 != i)\n {\n if (vozm[i1, j] == 2)\n {\n can = false;\n goto metka;\n }\n if (vozm[i1, j] == 1)\n {\n vozm[i1, j] = 0;\n vozm_d_count[i1]--;\n }\n }\n }\n vozm_ekz_count[j] = 0;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n is0 = false;\n }\n else\n {\n if (vozm_d_count[i] > 0)\n finish = false;\n if (vozm_d_count[i] + budet_d_count[i] < c[i])\n {\n can = false;\n goto metka;\n }\n }\n }\n\n\n //if (is0) break;\n if (finish) break;\n else if (is0)\n {\n //\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438\n for (int j = n - 1; j >= 0; j--)\n {\n if (vozm_ekz_count[j] > 1)\n {\n int iv = -1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n if (iv == -1) iv = i;\n else\n {\n if ((vozm_d_count[i]-(c[i]- budet_d_count[i]))> (vozm_d_count[i] - (c[i] - budet_d_count[i]))) iv = i;\n }\n }\n }\n //\u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043d\u044c\n vozm[iv, j] = 2;\n res[j] = iv + 1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 0;\n vozm_d_count[i]--;\n }\n }\n vozm_ekz_count[j] = 0;\n budet_d_count[iv]++;\n vozm_d_count[iv]--;\n break;\n }\n }\n }\n }\n\n metka:\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n if (can) Console.WriteLine(string.Join(\" \", res));\n else Console.WriteLine(\"-1\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace G\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader sr = new StreamReader(\"in3.txt\");\n TextReader sr = Console.In;\n string[] ss = sr.ReadLine().Split();\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int[] res = new int[n];\n int[] vozm_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435 \u0434\u043d\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] budet_d_count = new int[m];//\u043a\u043e\u043b-\u0432\u043e \u0434\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n int[] vozm_ekz_count = new int[n];//\u043a\u043e\u043b-\u0432\u043e \u0432\u043e\u0437\u043e\u043c\u0436\u043d\u044b\u0435\u0445 \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432 \u0434\u0435\u043d\u044c i\n int[,] vozm = new int[m, n];\n int[] s = new int[m], d = new int[m], c = new int[m];\n for (int i = 0; i < m; i++)\n {\n ss = sr.ReadLine().Split();\n s[i] = Convert.ToInt32(ss[0]);\n d[i] = Convert.ToInt32(ss[1]);\n c[i] = Convert.ToInt32(ss[2]);\n for (int j = s[i] - 1; j < d[i]; j++)\n {\n if (vozm[i, j] != 3)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c \u043f\u0435\u0442\u044f \u043d\u0435 \u0441\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0430\u043c\u0435\u043d\n {\n vozm[i, j] = 1;//\u0432 \u0434\u0435\u043d\u044c j \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 i\n vozm_ekz_count[j]++;\n vozm_d_count[i]++;\n }\n }\n for (int j = 0; j < m; j++)\n {\n if (vozm[j, d[i] - 1] == 1)//\u0432 \u044d\u0442\u043e\u0442 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043a \u044d\u043a\u0437\u043c\u0430\u0435\u043d\u0443 j\n {\n vozm_ekz_count[d[i] - 1]--;\n vozm_d_count[j]--;\n }\n vozm[j, d[i] - 1] = 3;//\u0432 \u0434\u0435\u043d\u044c d[i] \u043f\u0435\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u044f \u043a \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0443 j\n }\n res[d[i] - 1] = m + 1;\n }\n //\u0440\u0435\u0448\u0435\u043d\u0438\u0435\n bool can = true;\n bool is0 = true;\n bool finish = true;\n while (true)\n {\n is0 = true;\n finish = true;\n for (int j = 0; j < n; j++)\n {\n if (vozm_ekz_count[j] == 1)\n {\n finish = false;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n vozm_d_count[i]--;\n budet_d_count[i]++;\n res[j] = i + 1;\n if (budet_d_count[i] == c[i])\n {\n for (int j1 = 0; j1 < n; j1++)\n {\n if (vozm[i, j1] == 1/*j != j1*/)\n {\n vozm[i, j1] = 0;\n vozm_ekz_count[j1]--;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n }\n }\n }\n vozm_ekz_count[j] = 0;\n is0 = false;\n }\n else if (vozm_ekz_count[j] > 1)\n finish = false;\n }\n\n for (int i = 0; i < m; i++)\n {\n if (/*budet_d_count[i]< c[i] &&*/vozm_d_count[i] > 0 && vozm_d_count[i] + budet_d_count[i] == c[i])\n {\n finish = false;\n for (int j = 0; j < n; j++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 2;\n res[j] = i + 1;\n for (int i1 = 0; i1 < m; i1++)\n {\n if (i1 != i)\n {\n if (vozm[i1, j] == 2)\n {\n can = false;\n goto metka;\n }\n vozm[i1, j] = 0;\n vozm_d_count[i1]--;\n }\n }\n vozm_ekz_count[j] = 0;\n }\n }\n vozm_d_count[i] = 0;\n budet_d_count[i] = c[i];\n is0 = false;\n }\n else\n {\n if (vozm_d_count[i] > 0)\n finish = false;\n if (vozm_d_count[i] + budet_d_count[i] < c[i])\n {\n can = false;\n goto metka;\n }\n }\n }\n\n\n //if (is0) break;\n if (finish) break;\n else if (is0)\n {\n //\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438\n for (int j = n - 1; j >= 0; j--)\n {\n if (vozm_ekz_count[j] > 1)\n {\n int iv = -1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n if (iv == -1) iv = i;\n else\n {\n if ((vozm_d_count[i]-(c[i]- budet_d_count[i]))> (vozm_d_count[i] - (c[i] - budet_d_count[i]))) iv = i;\n }\n }\n }\n //\u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u043d\u044c\n vozm[iv, j] = 2;\n res[j] = iv + 1;\n for (int i = 0; i < m; i++)\n {\n if (vozm[i, j] == 1)\n {\n vozm[i, j] = 0;\n vozm_d_count[i]--;\n }\n }\n vozm_ekz_count[j] = 0;\n budet_d_count[iv]++;\n vozm_d_count[iv]--;\n break;\n }\n }\n }\n }\n\n metka:\n //\u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\n if (can) Console.WriteLine(string.Join(\" \", res));\n else Console.WriteLine(\"-1\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petya_Exam\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = (Console.ReadLine()).Split(' ');\n int N_Days = int.Parse(s[0]);\n int Total_exams = int.Parse(s[1]);\n List> list = new List>();\n for(int i=0; i ls = new List();\n ls.Add(int.Parse(s[0]));\n ls.Add(int.Parse(s[1]));\n ls.Add(int.Parse(s[2]));\n list.Add(ls);\n }\n list = list.OrderBy(ls => ls[1]).ToList();\n List seq = new List();\n for(int i=0; i<=N_Days;++i)\n {\n seq.Add(0);\n }\n int print =0;\n int exam_number = 1;\n foreach(List l in list)\n {\n //int n = l[0];\n if(l[0]-1+l[2] l, List seq)\n {\n int days = l[2];\n \n int i = l[0];\n while(i0)\n {\n if(seq[i]==0)\n {\n seq[i] = exam_number;\n days--;\n }\n i++;\n }\n return days==0?true:false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petya_Exam\n{\n class Program\n {\n struct Exam\n {\n public int ExamIndex;\n public int Publish;\n public int ExamDay;\n public int PrepDays;\n } \n \n static void Main(string[] args)\n {\n string[] s = (Console.ReadLine()).Split(' ');\n int N_Days = int.Parse(s[0]);\n int Total_exams = int.Parse(s[1]);\n List list2 = new List();\n for (int i = 0; i < Total_exams; ++i)\n {\n Exam exm;\n s = (Console.ReadLine()).Split(' ');\n exm.ExamIndex = i + 1;\n exm.Publish = int.Parse(s[0]);\n exm.ExamDay = int.Parse(s[1]);\n exm.PrepDays = int.Parse(s[2]);\n list2.Add(exm);\n }\n list2.Sort((x, y) => x.ExamDay.CompareTo(y.ExamDay));\n List seq = new List();\n for (int i = 0; i <= N_Days; ++i)\n {\n seq.Add(0);\n }\n int print = 0;\n foreach (Exam l in list2)\n {\n if (l.Publish - 1 + l.PrepDays < l.ExamDay)\n {\n if (Ispossible(l.ExamIndex, l, seq))\n {\n seq[l.ExamDay] = Total_exams + 1;\n \n continue;\n }\n else\n {\n print = -1;\n break;\n }\n }\n }\n if (print == 0)\n {\n if (seq.Sum() != 0)\n {\n for (int j = 1; j < seq.Count; ++j)\n {\n if (j + 1 == seq.Count)\n {\n Console.Write(seq[j]);\n continue;\n }\n Console.Write(seq[j] + \" \");\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n \n // Console.ReadKey();\n }\n\n private static bool Ispossible(int exam_number, Exam l, List seq)\n {\n int days = l.PrepDays;\n\n int i = l.Publish;\n while (i < l.ExamDay && days > 0)\n {\n if (seq[i] == 0)\n {\n seq[i] = exam_number;\n days--;\n }\n i++;\n }\n return days == 0 ? true : false;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Petya_Exam\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = (Console.ReadLine()).Split(' ');\n int N_Days = int.Parse(s[0]);\n int Total_exams = int.Parse(s[1]);\n List> list = new List>();\n for(int i=0; i ls = new List();\n ls.Add(int.Parse(s[0]));\n ls.Add(int.Parse(s[1]));\n ls.Add(int.Parse(s[2]));\n list.Add(ls);\n }\n List seq = new List();\n for(int i=0; i<=N_Days;++i)\n {\n seq.Add(0);\n }\n int print =0;\n int exam_number = 1;\n foreach(List l in list)\n {\n //int n = l[0];\n if(l[0]-1+l[2] l, List seq)\n {\n int days = l[2];\n // for(int i=l[0]; i0)\n {\n if(seq[i]==0)\n {\n seq[i] = exam_number;\n days--;\n }\n i++;\n }\n return days==0?true:false;\n }\n }\n}\n"}], "src_uid": "02d8d403eb60ae77756ff96f71b662d3"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.ToLower();\n int k = 0;\n bool flag = false;\n\n for(int i = 0; i < str.Length; i++)\n {\n if (k == 0 && str[i] == 'h')\n {\n k++;\n }\n else if (k == 1 && str[i] == 'e')\n {\n k++;\n }\n else if (k == 2 && str[i] == 'l')\n {\n k++;\n }\n else if (k == 3 && str[i] == 'l')\n {\n k++;\n }\n else if (k == 4 && str[i] == 'o')\n {\n k++;\n flag = true;\n break;\n }\n }\n\n Console.WriteLine(flag == true ? \"YES\" : \"NO\");\n } \n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n bool canHello = false;\n\n if (Contains(input, 'h'))\n {\n int index = IndexOf(input, 'h');\n string _input = Substring(input, index + 1);\n\n if (Contains(_input, 'e'))\n {\n index = IndexOf(_input, 'e');\n _input = Substring(_input, index + 1);\n\n if (Contains(_input, 'l'))\n {\n index = IndexOf(_input, 'l');\n _input = Substring(_input, index + 1);\n\n if (Contains(_input, 'l'))\n {\n index = IndexOf(_input, 'l');\n _input = Substring(_input, index + 1);\n\n if (Contains(_input, 'o'))\n {\n canHello = true;\n }\n }\n }\n }\n }\n\n if (canHello) System.Console.WriteLine(\"YES\");\n else System.Console.WriteLine(\"NO\");\n }\n\n static string Substring(string s, int index)\n {\n string output = \"\";\n\n for (int i = index; i < s.Length; i++)\n {\n output += s[i];\n }\n\n return output;\n }\n\n static int IndexOf(string s, char c)\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (c == s[i]) return i;\n }\n\n return -1;\n }\n\n static bool Contains(string s, char c)\n {\n foreach (char x in s)\n {\n if (x == c) return true;\n }\n\n return false;\n }\n\n static bool IsLuckyNumber(int number)\n {\n bool lucky = false;\n\n while (number != 0)\n {\n int lastDigit = LastDigit(number);\n number /= 10;\n\n if (lastDigit != 4 || lastDigit != 7) return false;\n else lucky = true;\n }\n\n if (lucky) return lucky;\n\n for (int i = number-1; i > 0; i--)\n {\n if (number % i == 0 && IsLuckyNumber(i))\n return true;\n }\n\n return false;\n }\n\n static int LastDigit(int number)\n {\n return 0;\n }\n\n static char ToLower(char c)\n {\n return (c >= 'A' && c <='Z') ? (char)(c + 32) : c;\n }\n\n static bool Contains(char[] arr, char c)\n {\n foreach (char x in arr)\n {\n if (x == c) return true;\n }\n\n return false;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n string text = Console.ReadLine();\n string res=Chat_Room(text);\n Console.WriteLine(res.Contains(\"hello\") ? \"YES\" : \"NO\");\n }\n static string Chat_Room(string text)\n {\n \n if (!Regex.IsMatch(text, @\"^[a-z]{1,100}$\")) return \"\";\n\n //string Result = \"\";\n Queue StackResult = new Queue();\n\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n\n foreach (char c in text)\n {\n\n if (word[position] == c)\n {\n //Result += c;\n StackResult.Enqueue(c);\n position++;\n if (position == word.Length) break;\n }\n else\n {\n //if (Result != \"\")\n if (StackResult.Count > 0)\n {\n if (StackResult.Peek() == c) continue;\n //if (Result[position - 1] == c) continue;\n //else break;\n }\n }\n\n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n //Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n return string.Join(\"\", StackResult.ToArray());\n\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine(); \n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums=strnumbers.Split(' ').Select(num=>int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n \n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\npublic class Program\n{\n public static void Main()\n {\n var input = Console.ReadLine();\n \n var r = new Regex(@\"h+.*e+.*l+.*l+.*o+\");\n var match = r.Match(input);\n \n if(match.Success)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n \n \n \n private static void Main(string[] args)\n {\n\n string vasylaHello = Console.ReadLine();\n\n \n string hi = \"hello\";\n\n int k = 0;\n \n for (int i = 0; i < vasylaHello.Length; i++)\n {\n if (k < 5)\n {\n if (vasylaHello[i] == hi[k])\n { \n k++;\n }\n }\n \n }\n if (k == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n Console.Write(Regex.IsMatch(Console.ReadLine(), @\"h\\w*e\\w*l\\w*l\\w*o\") ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n int size = s.Length;\n int count = 0;\n for(int i = 0; i < size; i++)\n {\n if (s[i] == 'h'&& count==0)\n count++;\n else if(s[i] == 'e' && count == 1)\n count++;\n else if (s[i] == 'l' && count == 2|| count == 3)\n count++;\n else if (s[i] == 'o' && count == 4)\n {\n count++;\n break;\n }\n }\n if (count == 5)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\"); \n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A_ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s == \"hello\")\n Console.WriteLine(\"YES\");\n else\n {\n\n\n int h, e, l, o;\n h = s.IndexOf('h');\n e = s.IndexOf('e', h + 1);\n l = s.IndexOf('l', e + 1);\n o = s.IndexOf('o', l + 1);\n\n if (h < 0 || e < 0 || l < 0 || o < 0 || (s.Length < 6))\n Console.WriteLine(\"NO\");\n else\n {\n int first_l, second_l;\n first_l = s.IndexOf(\"l\",h+1);\n second_l = s.IndexOf(\"l\", first_l + 1);\n\n if (second_l < 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing static System.Console;\n\n\nclass a\n{\n static void Main()\n {\n var s = ReadLine();\n var a = \"hello\";\n int j = 0;\n for (int i = 0; i < s.Length && j < 5; i++){ if (s[i] == a[j]) j++;}\n WriteLine(j > 4 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = \"hello\";\n string b = Console.ReadLine();\n int c = 0;\n for (int i = 0; i < b.Length; i++)\n {\n if (b[i] == a[c])\n {\n c++;\n }\n if (c == 5)\n {\n break;\n }\n }\n if (c == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n _58A.Solve();\n Console.ReadLine();\n }\n }\n\n public class _58A\n {\n public static void Solve()\n {\n string s = Console.ReadLine();\n if (Regex.IsMatch(s, @\"\\w*h\\w*e\\w*l\\w*l\\w*o\\w*\", RegexOptions.IgnoreCase))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class chat_room2\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine().ToLower(), b=\"\";\n for(int i = 0; i < a.Length; i++)\n {\n if(a[i] == 'h')\n {\n b += \"h\";\n for(int j = i; j < a.Length; j++)\n {\n if(a[j] == 'e')\n {\n b += \"e\";\n for(int k = j; k < a.Length; k++)\n {\n if(a[k] == 'l')\n {\n b += \"l\";\n k++;\n for(int l = k; l < a.Length; l++)\n {\n if (a[l] == 'l')\n {\n b += \"l\";\n for(int m = l; m < a.Length; m++)\n {\n if(a[m] == 'o')\n {\n b += \"o\";\n break;\n\n }\n }\n break;\n\n }\n }\n break;\n\n }\n }\n break;\n\n\n }\n }\n break;\n\n }\n }\n if (b == \"hello\")\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n var s = Console.ReadLine();\n int i = 0;\n foreach (var l in \"hello\")\n {\n if ((i = s.IndexOf(l, i)) < 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n i++;\n }\n Console.WriteLine(\"YES\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Chat_Room\n{\n class Program\n {\n static void Main(string[] args)\n {\n string S = Console.ReadLine(); \n char[] array = S.ToCharArray();\n List li = new List();\n for(int i=0;i\n {\n { 'h', 1 },\n { 'e', 1 },\n { 'l', 2 },\n { 'o', 1 }\n };\n\n var prev = new Dictionary\n {\n { 'e', 'h' },\n { 'l', 'e' },\n { 'o', 'l' }\n };\n\n string word = Console.ReadLine();\n\n for (int i = 0; i < word.Length; i++)\n {\n if (allowed.ContainsKey(word[i]))\n {\n if (word[i] == 'h')\n {\n allowed[word[i]]--;\n }\n else\n {\n if (word[i] == 'l')\n {\n if (allowed['l'] == 2)\n {\n if (allowed[prev['l']] <= 0)\n {\n allowed['l']--;\n }\n }\n else\n {\n allowed['l']--;\n }\n }\n else\n {\n if (allowed[prev[word[i]]] <= 0)\n {\n allowed[word[i]]--;\n }\n }\n }\n }\n }\n\n Console.WriteLine(allowed.All(x => x.Value <= 0) ? \"YES\" : \"NO\");\n //var letters = new LinkedList(Console.ReadLine().ToCharArray());\n\n //LinkedListNode current = letters.First;\n\n //while (current != null)\n //{\n // var next = current.Next;\n // if (!allowed.Contains(current.Value))\n // {\n // letters.Remove(current);\n // }\n // else if (current.Value == 'h')\n // {\n // if (current.Next != null && current.Next.Value != 'e')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // else if (current.Value == 'e')\n // {\n // if (current.Next != null && current.Next.Value != 'l')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // else if (current.Value == 'l')\n // {\n // if (current.Next != null)\n // {\n // if (current.Previous != null && current.Previous.Value == 'e' && current.Next.Value != 'l')\n // {\n // letters.Remove(current.Next);\n // }\n // else if (current.Previous != null && current.Previous.Value == 'l' && current.Next.Value != 'o')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // }\n // current = next;\n //}\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Hitrez\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int t=0;\n for (int i = 0; i < str.Length; i++)\n {\n if (t == 0)\n {\n if (str[i] == 'h') { t++; continue; }\n // else t = 0;\n }\n if (t==1) \n {\n if (str[i] == 'e') { t++; continue; }\n // if (str[i] != 'h') { t = 0; } \n }\n if (t==2) \n {\n if (str[i] == 'l') { t++; continue; }\n // if (str[i] != 'e') { t = 0; }\n } \n if (t==3) \n {\n if (str[i] == 'l') { t++; continue; }\n //else t = 0;\n }\n if (t == 4)\n {\n if (str[i] == 'o') { t++; continue; }\n // if (str[i] != 'l') { t = 0; }\n }\n \n }\n if (t == 5) { Console.Write(\"YES\"); }\n else Console.Write(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace Trainig_App\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n char[] helloWord = new char[] { 'h', 'e', 'l', 'l', 'o' };\n char[] inputArray = input.ToCharArray();\n int counter = 0;\n foreach(char c in inputArray)\n {\n if (c == helloWord[counter])\n counter++;\n\n if (counter > 4)\n break;\n }\n\n if (counter > 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Chat_room\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] table = { 'h', 'e', 'l', 'l', 'o' };\n string myText = Console.ReadLine();\n int k = 0;\n\n for (int i = 0; i < myText.Length; i++)\n {\n if (k > 4) break;\n if (myText[i] == table[k]) {\n k++;\n }\n \n \n \n\n }\n\n if (k == 5) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.ToLower();\n bool falg = false;\n int index = 0;\n for (; index < str.Length; index++)\n {\n if (str[index] == 'h')\n {\n ++index;\n break;\n }\n }\n for (; index < str.Length; index++)\n {\n if (str[index] == 'e')\n {\n ++index;\n break;\n }\n }\n for (; index < str.Length; index++)\n {\n if (str[index] == 'l')\n {\n ++index;\n break;\n }\n }\n for (; index < str.Length; index++)\n {\n if (str[index] == 'l')\n {\n ++index;\n break;\n }\n }\n for (; index < str.Length; index++)\n {\n if (str[index] == 'o')\n {\n ++index;\n falg = true;\n break;\n }\n }\n if (falg)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "using System.Text.RegularExpressions;\nusing System;\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Regex regex = new Regex(@\".*h.*e.*l.*l.*o.*\");\n Match match = regex.Match(input);\n if (match.Success)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Chat\n{\n\n class ChattyBoy\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Regex condfilter = new Regex(\"[a-z]*h+[a-z]*e+[a-z]*l+[a-z]*l+[a-z]*o+[a-z]*\");\n if (condfilter.IsMatch(s) == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcePreparing\n{\n class Programm\n {\n static void Main(string[] args)\n {\n int h = 0;\n int e = 0;\n int l = 0;\n int o = 0;\n char[] str = Console.ReadLine().ToCharArray();\n if (str.Length < 5)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (h != 1 && str[i] == 'h')\n h = 1;\n if (h == 1 && e != 1 && str[i] == 'e')\n e = 1;\n if (h == 1 && e == 1 && l != 2 && str[i] == 'l')\n l++;\n if (h == 1 && e == 1 && l == 2 && o != 1 && str[i] == 'o')\n o = 1;\n }\n if (h + e + l + o == 5)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n\n string s = Console.ReadLine();\n\n if (Regex.IsMatch(s, (@\"\\w*h\\w*e\\w*l\\w*l\\w*o\")))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace EO\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string op = \"hello\";\n int j = 0;\n int sum = 0;\n for (int i = 0; i < x.Length; i++)\n {\n if (sum == 5)\n {\n break;\n }\n else\n {\n if (x[i] == op[j])\n {\n j++;\n sum++;\n }\n }\n }\n if (sum==5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] symbols = { 'h', 'e', 'l', 'l', 'o' };\n string inputString = Console.ReadLine();\n\n int count = 0;\n\n foreach(char c in inputString)\n {\n if(count<5\n && c == symbols[count])\n {\n count++;\n }\n }\n\n Console.WriteLine(count == 5 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Team\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n string hello = \"hello\";\n int a = 0, b = 0;\n\n for(int i = 0; i < input.Length; i++)\n {\n if(input[i] == hello[a])\n {\n a++;\n b++;\n }\n if(a == 5)\n {\n break;\n }\n }\n\n if(b == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string A = Console.ReadLine();\n char[] Alf = { 'h', 'e', 'l', 'l', 'o' };\n string B = \"\";\n int k = 0;\n\n foreach (char el in A)\n {\n if (el == Alf[k])\n {\n B += el;\n k++;\n }\n\n if (B.Equals(\"hello\") == true)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n }\n\n if (B.Equals(\"hello\") != true) Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();//input word 1 <= s <= 100\n string chk = \"hello\";//checking string\n\n //process to check if the input string is \"hello\"\n int i = 0;\n int flag = 0;\n foreach (char letter in chk)\n {\n flag = 0;\n while (i < s.Length)\n {\n if (letter == s[i])\n {\n flag = 1;\n i++;\n break;\n }\n i++;\n }\n }\n\n //display output\n if (flag == 1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication75\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] a = new int[4];\n string ss = \" \";\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case 'h':\n {\n if (a[0] < 1)\n {\n a[0]++;\n ss += s[i];\n\n }\n break;\n }\n case 'e':\n {\n if (a[1] < 1&&ss.Last()=='h')\n {\n a[1]++;\n ss += s[i];\n }\n break;\n }\n case 'l':\n {\n if (a[2] < 2&&ss.Last()=='e'|| a[2] < 2 && ss.Last() == 'l')\n {\n a[2]++;\n ss += s[i];\n }break;\n }\n case 'o':\n {\n if (a[3] < 1&&ss.Last()=='l'&&a[2]==2)\n {\n a[3]++;\n ss += s[i];\n }break;\n }\n \n }\n }\n ss = ss.Remove(0, 1);\n if (ss == \"hello\") Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces_chechnevis\n{\n class Program\n {\n static void Main()\n {\n /* bool a=true;\n string s;\n s = Console.ReadLine();\n for (int i= 0; i < s.Length-4;i++)\n {\n if(s[i]=='h' && a)\n {\n if (i + 1 < s.Length)\n while (s[i+1]=='h')\n {\n i++;\n if (i + 1 >= s.Length)\n break;\n }\n if (i + 1 < s.Length)\n if (s[i+1]=='e')\n {\n if (i + 1 < s.Length)\n while (s[i + 1] == 'e')\n {\n i++;\n if (i + 1 >= s.Length)\n break;\n }\n if (i + 1 < s.Length)\n if (s[i + 1] == 'l')\n {\n i++;\n if (i + 1 < s.Length)\n if (s[i + 1] == 'l')\n {\n\n if (i + 1 < s.Length)\n while (s[i + 1] == 'l')\n {\n i++;\n if (i + 1 >= s.Length)\n break;\n\n }\n if (i + 1 < s.Length)\n if (s[i + 1] == 'o')\n {\n\n\n Console.WriteLine(\"YES\");\n a = false;\n\n }\n\n }\n }\n }\n }\n }\n if(a)\n {\n Console.WriteLine(\"NO\");\n }*/\n\n\n\n\n //---------------------------------------------------------------------------------------\n\n string s;\n s = Console.ReadLine();\n bool a = true;\n for (int i = 0; i < s.Length - 4; i++)\n {\n if(s[i]=='h' && a)\n {\n \n while(i+1 4)\n\n {\n break;\n }\n\n }\n \n if (final==\"hello\")\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n \n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int z = 0;\n for(int i = 0; i < s.Length; i++)\n {\n if(z == 0 && s[i] == 'h') z++;\n else if(z == 1 && s[i] == 'e') z++;\n else if(z == 2 && s[i] == 'l') z++;\n else if(z == 3 && s[i] == 'l') z++;\n else if(z == 4 && s[i] == 'o')\n {\n Console.WriteLine(\"YES\");\n Console.ReadLine();\n return;\n }\n }\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nclass Chat_room\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n char[] t = { 'h', 'e', 'l', 'l', 'o' };\n int loc = 0;\n for (int i = 0; i < s.Length; i++)\n { \n if(s[i] == t[loc])\n {\n loc++;\n }\n if (loc == 5)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n }\n if(loc < 5)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Text.RegularExpressions;\n\nnamespace Competitive.codeforces\n{\n class _58A\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n Console.WriteLine(Regex.IsMatch(s, \"h.*e.*l.*l.*o\") ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _4._2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool h = false, e = false, l1 = false, l2 = false, o = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (!h && s[i] == 'h')\n h = true;\n else if (h && !e && s[i] == 'e')\n e = true;\n else if (e && !l1 && s[i] == 'l')\n l1 = true;\n else if (l1 && !l2 && s[i] == 'l')\n l2 = true;\n else if (l2 && !o && s[i] == 'o')\n o = true;\n }\n\n if (h && e && l1 && l2 && o)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n List ind = new List();\n\n int sm = 0;\n\n ind.Add(s.IndexOf('h'));\n sm += s.IndexOf('h');\n s = s.Substring(s.IndexOf('h') + 1);\n\n ind.Add(s.IndexOf('e') + sm);\n sm += s.IndexOf('e');\n s = s.Substring(s.IndexOf('e') + 1);\n\n ind.Add(s.IndexOf('l') + sm);\n sm += s.IndexOf('l');\n s = s.Substring(s.IndexOf('l') + 1);\n\n ind.Add(s.IndexOf('l') + sm);\n sm += s.IndexOf('l');\n s = s.Substring(s.IndexOf('l') + 1);\n\n ind.Add(s.IndexOf('o') + sm);\n sm += s.IndexOf('o');\n s = s.Substring(s.IndexOf('o') + 1);\n\n\n List test = new List(ind);\n\n test.Sort();\n\n\n if (ind.SequenceEqual(test))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n\n }\n\n}"}, {"source_code": "using System;\n\nnamespace codePro\n{\n class Program\n {\n static void Main(string[] args)\n {\n string h = \"hello\", s=\"\", input = Console.ReadLine();\n int n = 0;\n\n foreach (char item in input)\n if (item == h[n]) { s += h[n]; n += 1; if (n == 5)break; }\n\n if (s == h) Console.Write(\"YES\");\n else Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text.RegularExpressions;\n\nnamespace _58A_Chat\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n Regex regex = new Regex(@\".*h.*e.*l.*l.*o.*\");\n MatchCollection matches = regex.Matches(str);\n if (matches.Count>0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Chat_room\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n bool check = false;\n string h = \"hello\";\n int j = 0;\n for (int i = 0; i < 5; ++i)\n {\n check = false;\n for (; j < a.Length; j++)\n {\n if (h[i] == a[j])\n {\n check = true;\n j++;\n break;\n }\n } \n }\n if (check)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string IN = Console.ReadLine();\n char[] InC = IN.ToCharArray();\n int c = 0;\n bool final = false;\n for (int i = InC.Length-1; i > 0; i--)\n {\n if(InC[i]=='o')\n {\n c++;\n for (int d = i-1; d > 0; d--)\n {\n if(InC[d]=='l')\n {\n c++;\n for (int j = d-1; j > 0; j--)\n {\n if(InC[j]=='l')\n {\n c++;\n for (int k = j-1; k >0; k--)\n {\n if(InC[k]=='e')\n {\n c++;\n for (int m = k-1; m >=0; m--)\n {\n if(InC[m]=='h')\n {\n c++; final = true;\n break;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n \n if(c>=5&&final)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace CsharpConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a = Console.ReadLine();\n int h = a.IndexOf('h');\n if (h == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int e = a.IndexOf('e', h);\n if (e == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int l = a.IndexOf('l', e);\n if (l == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int l2 = a.IndexOf('l', l + 1);\n if (l2 == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n int o = a.IndexOf('o', l2);\n if (o == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (h < e && e < l && l < l2 && l2 < o)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n ChatRoom hm = new ChatRoom();\n hm.IsHello();\n Console.ReadLine();\n }\n }\n public class ChatRoom\n {\n public void IsHello()\n {\n char[] input = Console.ReadLine().ToCharArray();\n char[] hello = new char[]\n {\n 'h','e','l','l','o'\n };\n int helloCount = 0;\n string result = \"NO\";\n foreach (char c in input)\n {\n if (c == hello[helloCount])\n {\n helloCount++;\n }\n if (helloCount == 5)\n {\n result = \"YES\";\n break;\n }\n }\n\n\n\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n //while (t > 0)\n {\n // t--;\n // var n = int.Parse(Console.ReadLine());\n //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n //var input = Console.ReadLine().Split();\n //var n = int.Parse(input[0]);\n //var m = int.Parse(input[1]);\n //var k = int.Parse(input[2]);\n // Split(n, arr);\n var str = Console.ReadLine();\n\n string ans = \"hello\";\n int k = 0;\n for(int i=0;i 4)\n {\n break;\n }\n\n }\n\n }\n\n if (j > 4)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace algo\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] s1 = s.ToCharArray();\n char[] hello = new char[5];\n hello[0] = 'h';\n hello[1] = 'e';\n hello[2] = 'l';\n hello[3] = 'l';\n hello[4] = 'o';\n\n int sum = 0;\n int x = 0;\n\n for (int i = 0; i < 5; i++) {\n for (int j = x; j < s.Length; j++) {\n x++;\n if(hello[i]==s1[j]){\n sum++;\n break;\n }\n }\n if (sum == 5) {\n break;\n }\n }\n if (sum == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\n\n\nnamespace CF_Hello {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n string example = \"hello\";\n string output = string.Empty;\n int i = 0;\n int deleted = 0;\n while ((deleted != 5) && (i < input.Length)) {\n if (input[i] == example[deleted]) {\n output += input[i];\n if (output == \"hello\") {\n Console.WriteLine(\"YES\");\n return;\n }\n ++deleted;\n }\n ++i;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace A58\n{\n class Program\n {\n static void Main(string[] args)\n {\n string vasya = Console.ReadLine().ToLower(), hello = \"hello\";\n int word = 0;\n\n for (int i = 0; i < vasya.Length ; i++)\n {\n if (vasya[i] == hello[word]) \n word++; \n if (word > 4)\n break;\n }\n\n Console.WriteLine(word > 4 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A._Chat_room\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List list = new List(input);\n string x = \"hello\";\n List listX = new List(x);\n for (int i = 0; i < list.Count; i++)\n {\n if (list[i] == listX[0])\n {\n listX.Remove(listX[0]);\n if (listX.Count <= 0) \n {\n break;\n }\n }\n }\n if (listX.Count > 0) { Console.WriteLine(\"NO\"); }\n else { Console.WriteLine(\"YES\"); }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] lettere = new char[] { 'h', 'e', 'l', 'l', 'o' };\n int pos = 0;\n for (int i = 0; i < s.Length&&pos -1 )\n {\n t = str2.IndexOf(str1[i], pos);\n pos = t+1;\n t1++;\n }\n \n }\n if (t1 == 5) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int index = -1, tindex = 0;\n bool flag = false, tflag = false;\n string target = \"hello\";\n while (!tflag)\n {\n flag = false;\n for (int i = index + 1; i < str.Length; i++)\n {\n if (str[i].ToString() == target[tindex].ToString())\n {\n tindex++;\n index = i;\n flag = true;\n break;\n }\n }\n if (!flag)\n {\n break;\n }\n if (tindex == 5)\n {\n break;\n }\n }\n \n \n if (flag)\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string hello = \"hello\";\n int j = 0;\n\n\n for(int i = 0; i < s.Length; i++)\n {\n if(s[i] == hello[j])\n {\n j++;\n if(j == 5)\n {\n break;\n }\n }\n }\n if(j == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int[] index = { 0, 0, 0, 0, 0 };\n \n string hello = \"hello\";\n for (int i = 0; i < 5; i++)\n {\n index[i] = input.IndexOf(hello[i], i==0 ? 0 : index[i-1]+1);\n }\n bool answer = true;\n for (int i = 0; i < 4; i++)\n {\n if(index[i] >= index[i+1])\n {\n answer = false;\n Console.WriteLine(\"NO\");\n break;\n }\n }\n \n if (answer == true)\n {\n Console.WriteLine(\"YES\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prog1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int n = int.Parse(Console.ReadLine());\n int x = 0;\n int y = 0;\n string s = Console.ReadLine();\n string t = \"hello\";\n //bool ans = false;\n //var a1 = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n for (int i=0; i(\"olleh\");\n\n foreach (char c in str) {\n if (helloChars.Count == 0)\n break;\n\n if (c == helloChars.Peek())\n helloChars.Pop();\n }\n\n if (helloChars.Count == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Chat_Room_58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var hello = \"hello\";\n \n for (int i=0; i<5; i++) {\n var index = s.IndexOf(hello[i]);\n if (index == -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n s = s.Substring(index + 1);\n }\n Console.WriteLine(\"YES\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hello2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var word1 = Console.ReadLine(); //hello\n var word2 = \"hello\"; \n var c = 0;\n\n foreach (var item in word1)\n {\n \n if (item == word2[c]) \n c++;\n if (c == 5)\n break; \n }\n if (c==5) \n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Dictionary\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n char[] m = new char[] { 'h', 'e', 'l', 'l', 'o' };\n string s = Console.ReadLine();\n int count = 0;\n foreach (char c in s)\n {\n if (count <5 && c == m[count]) count++;\n }\n Console.Write(count == 5 ? \"YES\" : \"NO\");\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine().ToString() ;\n String res = \"\";\n char[] table = new char[5] { 'h', 'e', 'l', 'l', 'o'};\n\n int model = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n \n if (s[i]==(table[model]))\n {\n res += table[model];\n model++;\n }\n\n if (res.Equals(\"hello\"))\n {\n break;\n }\n }\n Console.WriteLine(res.Equals(\"hello\") ? \"YES\" : \"NO\"); \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n string name = Console.ReadLine();\n string hello = \"hello\";\n int i1, i2 = 0;\n for(i1=0;i1 arr[length - 1])\n {\n\n return false;\n }\n\n return checkedIfSorted(arr, length - 1);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n\n \n StringBuilder word = new StringBuilder(Console.ReadLine());\n byte ResPointer =0;\n\n char c ;\n for (byte i = 0; i < word.Length ; i++)\n {\n c = word[i];\n switch(c)\n {\n case 'h':\n\n if(ResPointer==0)\n {\n ResPointer++;\n }\n \n break;\n case 'e':\n\n if (ResPointer == 1)\n {\n ResPointer++;\n }\n\n break;\n case 'l':\n\n if (ResPointer == 2 || ResPointer ==3)\n {\n ResPointer++;\n }\n\n break;\n case 'o':\n\n if (ResPointer ==4)\n {\n ResPointer++;\n }\n\n break;\n\n\n\n\n }\n \n \n }\n if (ResPointer == 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n \n }\n\n\n }\n}"}, {"source_code": "using System;\npublic class Hello{\n\tstatic void Main(){\n\t\tString s = Console.ReadLine();\n\t\tString x= \"hello\";\n\t\tint pos=0;\n\t\t// int cur=-1;\n\t\tfor(int i=0; i int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n\n\n static void Main(string[] args)\n {\n\n string a = Console.ReadLine();\n\n string h = \"hello\";\n\n int state = 0;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == h[state])\n state++;\n if (state == h.Length)\n break;\n }\n\n Console.WriteLine((state == h.Length)?\"YES\":\"NO\");\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string hello = \"hello\";\n bool matchFound = false;\n int five = 0;\n int index = 0;\n for (int i = 0; i < input.Length; i++) \n {\n if (input[i] == hello[index]) \n {\n five++;\n index++;\n if (five == 5) { matchFound = true; break; }\n }\n }\n\n Console.WriteLine(matchFound ? \"YES\" : \"NO\");\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\t string testingWord= Console.ReadLine();\n\t\tstring searchingRegex=\".*h.*e.*l.*l.*o.*\";\n\t\tRegex rgx = new Regex(searchingRegex);\n\t\tConsole.WriteLine(rgx.IsMatch(testingWord)?\"YES\":\"NO\");\n\t}\n}"}, {"source_code": "using System;\n\nnamespace CF58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool yes = false;\n int h = s.IndexOf(\"h\", 0);\n if (h != -1) {\n int e = s.IndexOf(\"e\", h + 1);\n if (e != -1) {\n int l1 = s.IndexOf(\"l\", e + 1);\n if (l1 != -1) {\n int l2 = s.IndexOf(\"l\", l1 + 1);\n if (l2 != -1) {\n int o = s.IndexOf(\"o\", l2 + 1);\n if(o != -1) yes = true;\n }\n }\n }\n }\n if (yes) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace acm\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n List ind = new List();\n\n int sm = 0;\n\n ind.Add(s.IndexOf('h'));\n sm += s.IndexOf('h');\n s = s.Substring(s.IndexOf('h') + 1);\n\n ind.Add(s.IndexOf('e') + sm);\n sm += s.IndexOf('e');\n s = s.Substring(s.IndexOf('e') + 1);\n\n ind.Add(s.IndexOf('l') + sm);\n sm += s.IndexOf('l');\n s = s.Substring(s.IndexOf('l') + 1);\n\n ind.Add(s.IndexOf('l') + sm);\n sm += s.IndexOf('l');\n s = s.Substring(s.IndexOf('l') + 1);\n\n ind.Add(s.IndexOf('o') + sm);\n sm += s.IndexOf('o');\n s = s.Substring(s.IndexOf('o') + 1);\n\n\n List test = new List(ind);\n\n test.Sort();\n\n\n if (ind.SequenceEqual(test))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n\n }\n\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\npublic class Program\n{\n private static void Main()\n {//hlelo\n var str = new string(Console.ReadLine().Where(c => \"helo\".Contains(c)).ToArray());\n str = str.Remove(0, str.IndexOf('h'));\n if (str.IndexOf(\"h\") < str.IndexOf(\"e\") && str.All(c => \"helo\".Contains(c)) && str.Count(c => c == 'l') > 1)\n {\n str = str.Remove(0, str.IndexOf('e'));\n if (str.IndexOf(\"e\") < str.IndexOf(\"l\"))\n {\n str = str.Remove(0, str.IndexOf('l')+1);\n if (str.IndexOf(\"l\") < str.IndexOf(\"o\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF85_D2_A_ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine().ToLower().Trim();\n line = new string(line.ToCharArray().Distinct().ToArray());\n\n if (line.Contains(\"helo\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\npublic class Program\n{\n private static void Main()\n {\n var str = Console.ReadLine();\n if (\"hello\".All(c => str.Contains(c)))\n {\n if (str.IndexOf(\"h\") < str.IndexOf(\"e\"))\n {\n str = str.Remove(0, str.IndexOf('e'));\n if (str.IndexOf(\"e\") < str.IndexOf(\"l\"))\n {\n str = str.Remove(0, str.IndexOf('l'));\n\n if (str.IndexOf(\"l\") < str.LastIndexOf(\"l\"))\n {\n str = str.Remove(0, str.LastIndexOf('l'));\n\n if (str.LastIndexOf(\"l\") < str.IndexOf(\"o\"))\n {\n Console.WriteLine(\"YES\");\n }\n }\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A_ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s == \"hello\")\n Console.WriteLine(\"YES\");\n else\n {\n\n\n int h, e, l, o;\n h = s.IndexOf('h');\n e = s.IndexOf('e', h + 1);\n l = s.IndexOf('l', e + 1);\n o = s.IndexOf('o', l + 1);\n\n if (h < 0 || e < 0 || l < 0 || o < 0 || (s.Length < 6))\n Console.WriteLine(\"NO\");\n else\n {\n int first_l, second_l;\n first_l = s.IndexOf(\"l\");\n second_l = s.IndexOf(\"l\", first_l + 1);\n\n if (second_l < 0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace CodeForces\n{\n class ChatRoom\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string hello = \"\";\n int counter = 0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'h')\n {\n counter++;\n if (hello.Contains('h') == false)\n {\n hello += input[i];\n }\n }\n else if (input[i] == 'e')\n {\n counter++;\n if (hello.Contains('e') == false && hello == \"h\")\n {\n hello += input[i];\n }\n }\n else if (input[i] == 'l')\n {\n counter++;\n if (hello.Contains('l') == true && hello == \"hel\")\n {\n hello += input[i];\n }\n if (hello.Contains('l') == false && hello == \"he\")\n {\n hello += input[i];\n }\n }\n else if (input[i] == 'o')\n {\n counter++;\n if (hello.Contains('o') == false && hello == \"hell\")\n {\n hello += input[i];\n }\n }\n }\n if (hello == \"hello\" && counter > 5)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n string line = Console.ReadLine();\n string tmp = \"\";\n line.ToLower();\n for (int i = 0 ; i < line.Length ; i++){\n if(i == 0){\n tmp += line[i];\n } else {\n if(line[i] == 'l' && line[i-1] != 'l'){\n tmp += line[i];\n }\n if(line[i] != line[i-1]){\n tmp += line[i];\n }\n }\n }Console.WriteLine(tmp);\n if(tmp.IndexOf(\"hello\") != -1){\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\n\n\n\nnamespace CF_Hello {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n string example = \"hello\";\n string output = string.Empty;\n int deleted = 0;\n for(int i=0;i chat = new HashSet(s);\n string word = string.Concat(chat);\n Console.WriteLine((word.Contains(\"helo\")) ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nnamespace CsharpConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a = Console.ReadLine();\n int h = a.IndexOf('h');\n int e = a.IndexOf('e');\n int l = a.IndexOf('l');\n int l2 = a.IndexOf('l', l + 1);\n int o = a.IndexOf('o');\n\n if (h < e && e < l && l < l2 && l2 < o)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for (int i=0;i c == 'l');\n if (Array.FindIndex(s.ToCharArray(), i + 1, c => c == 'l') > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication60\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if (a == \"ahhellllloou\")\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n int size = s.Length;\n int count = 0;\n for(int i = 0; i < size; i++)\n {\n if (s[i] == 'h'&& count==0)\n count++;\n else if(s[i] == 'e' && count == 1)\n count++;\n else if (s[i] == 'l' && count == 2|| count == 3)\n count++;\n else if (s[i] == '0' && count == 4)\n {\n count++;\n break;\n }\n }\n if (count == 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "using System;\nclass Codeforce\n{ \n static void Main()\n { \n string s= Console.ReadLine();\n string ans=\"\";\n string hello=\"hello\";\n int i=0;\n int j;\n int check;\n int end=0;\n char temp;\n int nub;\n for( i=0;i1 && s[i]=='l')\n ans+=s[i];\n }\n \n // Console.WriteLine(ans);\n for( i =0; i 100 || text.Length < 1) return;\n if (!Regex.IsMatch(text, @\"^[a-zA-Z]+$\")) return;\n\n string Result = \"\";\n foreach (char c in text.Distinct())\n {\n if(c == 'l')\n {\n Result += c;\n Result += c;\n }\n else\n Result += c;\n }\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine(); \n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums=strnumbers.Split(' ').Select(num=>int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n \n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Chat\n{\n\n class ChattyBoy\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Regex condfilter = new Regex(s);\n if (condfilter.IsMatch(\"[a-z]*(?:hello)*\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n _58A.Solve();\n }\n }\n\n public class _58A\n {\n public static void Solve()\n {\n string s = Console.ReadLine();\n if (Regex.IsMatch(s, @\"\\w*h\\w*e\\w*ll\\w*o\\w*\", RegexOptions.IgnoreCase))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n string line = Console.ReadLine();\n string tmp = \"\";\n line.ToLower();\n for (int i = 0 ; i < line.Length ; i++){\n if(i == 0){\n tmp += line[i];\n } else {\n if(line[i] == 'l' && line[i-1] != 'l'){\n tmp += line[i];\n }\n if(line[i] != line[i-1]){\n tmp += line[i];\n }\n }\n }\n if(tmp.IndexOf(\"hello\") != -1){\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n int size = s.Length;\n int count = 0;\n for(int i = 0; i < size; i++)\n {\n if (s[i] == 'h'&& count==0)\n count++;\n else if(s[i] == 'e' && count == 1)\n count++;\n else if (s[i] == 'l' && count <4)\n count++;\n else if (s[i] == '0' && count == 4)\n {\n count++;\n break;\n }\n }\n if (count == 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n // The code provided will print \u2018Hello World\u2019 to the console.\n // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.\n //Console.WriteLine(\"Hello World!\");\n //Console.ReadKey();\n var target = \"hello\";\n string testString;\n testString = Console.ReadLine();\n int index = 0;\n var res = \"\";\n var counter = 0;\n foreach (var character in target)\n {\n var x = testString.IndexOf(character , index);\n if (testString.IndexOf(character , index) >= index)\n {\n index = testString.IndexOf(character , index);\n counter++;\n\n }\n \n \n }\n if(counter == 5)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n\n \n\n\n \n \n // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF32ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int len = a.Length;\n for(int i=0;i ch.Contains(c)).ToArray());\n //line = new string(line.ToCharArray().Distinct().ToArray());\n char[] lineCH = line.ToCharArray();\n\n \n if (line.Contains(\"hel\")|| line.Contains(\"heol\")|| line.Contains(\"helo\"))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string finalName = \"hello\";\n char[] fc = finalName.ToCharArray(); \n int i = 0;\n\n string userText = Console.ReadLine();\n char[] userChars = userText.ToCharArray();\n\n foreach (char uc in userChars)\n {\n // Console.WriteLine(uc);\n if (uc == finalName[i])\n {\n // Console.WriteLine(i);\n if (i != 4)\n {\n i++;\n }\n }\n }\n\n if (i == 4)\n {\n Console.WriteLine(\"YES\");\n } else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ChatRoom\n{\n class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n bool result = false;\n string word = \"hello\";\n int start = 0;\n for (int i = 0; i < s.Length; i++){\n if (s[i] == word[start])\n {\n start += 1;\n }else if (start > 0 && s[i] == word[start-1]){\n continue;\n }else{\n start = 0;\n }\n if (start == word.Length ){\n result = true;\n break;\n }\n\n }\n Console.WriteLine(result ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication18\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i = 0;\n string h = \"hello \";\n List l = Console.ReadLine().ToList();\n foreach (char ch in l)\n {\n if (ch == h[i])\n {\n h = h.Remove(0, 1);\n }\n }\n Console.WriteLine(h);\n if(h.Length <= 1)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input;\n String hello = \"hello\";\n\n input = Console.ReadLine();\n\n for (int i = 0; i < input.Length-1; i++)\n {\n if (hello.Length == 0)\n {\n break;\n }\n if (hello[0] == input[i])\n {\n hello = hello.Substring(1);\n Console.WriteLine(hello);\n }\n\n }\n if (hello.Length > 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n\n }\n }\n\n\n\n}"}, {"source_code": "using System;\n\nnamespace CF_Hello {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n input = input.Replace(\"ll\", \"!\");\n for (int i = 1; i < input.Length; ++i) {\n if (input[i - 1] == input[i]) {\n input = input.Remove(i, 1);\n }\n }\n if (input.Contains(\"he!o\") || input.Contains(\"he!lo\")) {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n HashSet chat = new HashSet(s);\n string word = string.Concat(chat);\n Console.WriteLine((word.Contains(\"helo\")) ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem58A {\n class Program {\n static void Main(string[] args) {\n char[] word = Console.ReadLine().ToCharArray();\n int[] helloLetters = getOnlyHelloLetters(word);\n bool couldWrite = checkHello(helloLetters);\n\n if (couldWrite)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n private static bool checkHello(int[] helloLetters) {\n bool canWrite = true;\n int helloLength = helloLetters.Length;\n\n for (int i = 0; i < helloLength-1; i++) {\n int letter = helloLetters[i];\n int nextLetter = helloLetters[i + 1];\n\n if (nextLetter < letter) {\n canWrite = false;\n break;\n }\n }\n return canWrite;\n }\n\n private static int[] getOnlyHelloLetters(char[] word) {\n List list = new List();\n int wordLength = word.Length;\n for (int i = 0; i < wordLength; i++) {\n if (word[i].Equals('h') || word[i].Equals('e') || word[i].Equals('l') || word[i].Equals('o')) {\n list.Add(word[i]);\n }\n }\n\n int listLength = list.Count;\n int[] helloLetters = new int[listLength];\n for (int i = 0; i < listLength; i++) {\n int helloOrd = 0;\n if (list[i].Equals('h')) helloOrd = 1;\n if (list[i].Equals('e')) helloOrd = 2;\n if (list[i].Equals('l')) helloOrd = 3;\n if (list[i].Equals('o')) helloOrd = 4;\n\n helloLetters[i] = helloOrd;\n }\n return helloLetters;\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain() {\n\n string k = RLine();\n char[] c = k.Where(i => i == 'h' || i == 'e' || i == 'l' || i == 'o').ToArray();\n string n = new string(c);\n\n bool flag = false;\n int indexOfH = n.IndexOf('h');\n if (indexOfH >=0)\n {\n string stepE = n.Substring(indexOfH);\n int indexOfE = stepE.IndexOf('e');\n if (indexOfE >= 0)\n {\n string stepL1 = stepE.Substring(indexOfE);\n int indexOfL1 = stepE.IndexOf('l');\n if (indexOfL1 >= 0)\n {\n string stepL2 = stepL1.Substring(indexOfL1);\n int indexOfL2 = stepL2.IndexOf('l');\n if (indexOfL2 >= 0)\n {\n string stepO = stepL2.Substring(indexOfL2);\n int indexOfO = stepO.IndexOf('o');\n if (indexOfO >= 0)\n {\n flag = true;\n WLine(\"YES\");\n\n }\n }\n }\n }\n }\n\n if (flag == false) { \n WLine(\"NO\");\n }\n } \n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nnamespace codechef\n{\n public class Program{\n public static StreamWriter writer;\n\n public static void RealWork()\n {\n string input = Console.ReadLine();\n string match = \"hello\";\n int Ans = 0,pos=0;\n\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] == match[pos])\n {\n pos++;\n Ans++;\n if (Ans == 5)\n {\n writer.Write(\"Yes\");\n return;\n }\n }\n }\n writer.Write(\"NO\");\n }\n\n static void Main(string[] args)\n {\n writer = new StreamWriter(Console.OpenStandardOutput());\n // writer = new StreamWriter(\"output.txt\");\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\"))); \n RealWork();\n writer.Close();\n }\n\n public static int intParse(string st)\n {\n int x = 0;\n for (int i = 0; i < st.Length; i++) { x = x * 10 + (st[i] - 48); }\n return x;\n }\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A_ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int h, e, l, o;\n h = s.IndexOf('h') ;\n e = s.IndexOf('e',h+1) ;\n l = s.IndexOf('l',e+1) ;\n o = s.IndexOf('o',l+1) ;\n\n if (h<0 || e<0 || l<0 || o<0 || (s.Length < 6))\n Console.WriteLine(\"NO\");\n else\n {\n int first_l, second_l;\n first_l = s.IndexOf(\"l\");\n second_l = s.IndexOf(\"l\", first_l+1);\n \n if (second_l<0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String hellostr = \"hello\";\n String mstr = Console.ReadLine();\n int letter = 0;\n\n for (int i = 0; i < mstr.Length-1; i++)\n if (hellostr[letter] == mstr[i])\n if(letter != 4) letter++;\n Console.WriteLine(letter == 4 ? \"YES\" : \"NO:\");\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces_chechnevis\n{\n class Program\n {\n static void Main()\n {\n bool a=true;\n string s;\n s = Console.ReadLine();\n for (int i= 0; i < s.Length-4;i++)\n {\n if(s[i]=='h' && a)\n {\n while(s[i+1]=='h')\n {\n i++;\n }\n if(s[i+1]=='e')\n {\n while (s[i + 1] == 'e')\n {\n i++;\n }\n if (s[i + 1] == 'l')\n {\n i++;\n if (s[i + 1] == 'l')\n {\n while (s[i + 1] == 'l')\n {\n i++;\n }\n if (s[i + 1] == 'o')\n {\n\n\n Console.WriteLine(\"YES\");\n a = false;\n\n }\n }\n }\n }\n }\n }\n if(a)\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n // The code provided will print \u2018Hello World\u2019 to the console.\n // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.\n //Console.WriteLine(\"Hello World!\");\n //Console.ReadKey();\n var target = \"hello\";\n string testString;\n testString = Console.ReadLine();\n int index = 0;\n var res = \"\";\n var counter = 0;\n foreach (var character in target)\n {\n var x = testString.IndexOf(character , index);\n if (testString.IndexOf(character , index) >= index)\n {\n index = testString.IndexOf(character , index);\n counter++;\n\n }\n \n \n }\n if(counter == 5)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n\n \n\n\n \n \n // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] == 'h' && count == 0)\n {\n count++;\n continue;\n }\n if (word[i] == 'l' && count == 1)\n {\n count++;\n continue;\n }\n if (word[i] == 'l' && count == 2)\n {\n count++;\n continue;\n }\n if (word[i] == 'o' && count == 3)\n {\n count++;\n continue;\n }\n if (count == 4)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\"); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if(s.Contains(\"hello\"))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Chat\n{\n\n class ChattyBoy\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Regex condfilter = new Regex(s);\n if (condfilter.IsMatch(\"[a-z]*(?:hello)*\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace CodeForces\n{\n class ChatRoom\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List letters = new List();\n int counter = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (letters.Contains(input[i]) == false)\n {\n letters.Add(input[i]);\n counter++;\n }\n else if (letters.Contains('l') == true)\n {\n counter++;\n }\n }\n if (counter == 5) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\tstring s = new string(str.Distinct().ToArray());\n\t\tif(s.Contains(\"helo\")){\n\t\t\tConsole.WriteLine(\"YES\");\t\n\t\t}\n\t\telse{\n\t\t\tConsole.WriteLine(\"NO\");\t\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int[] index = new int[5];\n string hello = \"hello\";\n for (int i = 0; i < 5; i++)\n {\n index[i] = input.IndexOf(hello[i]);\n }\n bool answer = true;\n for (int i = 0; i < 4; i++)\n {\n if(index[i] > index[i+1])\n {\n answer = false;\n Console.WriteLine(\"NO\");\n break;\n }\n }\n if(answer == true)\n {\n Console.WriteLine(\"YES\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n int size = s.Length;\n int count = 0;\n for(int i = 0; i < size; i++)\n {\n if (s[i] == 'h'&& count==0)\n count++;\n else if(s[i] == 'e' && count == 1)\n count++;\n else if (s[i] == 'l' && count == 2|| count == 3)\n count++;\n else if (s[i] == '0' && count == 4)\n {\n count++;\n break;\n }\n }\n if (count == 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Chat_room\n{\n class Program\n {\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n string hello = \"hello\";\n if (string.Compare(text,hello)<0)\n {\n Console.WriteLine(\"NO\"); \n }\n else if (string.Compare(text, hello) > 0)\n {\n Console.WriteLine(\"YES\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF32ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int len = a.Length;\n for(int i=0;i letters = new List();\n List lcount = new List();\n int cnt = 0;\n for (int i = 0; i < input.Length; i++) \n {\n if (letters.Count > 0) \n {\n if (letters.Last() == input[i]) { cnt++; if (i == input.Length - 1) { lcount.Add(cnt); } }\n else { lcount.Add(cnt); letters.Add(input[i]); cnt = 1; if (i == input.Length - 1) lcount.Add(cnt); }\n }\n else { letters.Add(input[i]); cnt++; }\n }\n\n string check = \"\";\n for (int i = 0; i < letters.Count(); i++) check += letters[i];\n string hello = \"helo\";\n bool matchFound = false;\n if (letters.Count >= 4)\n {\n for (int i = 0; i < letters.Count() - 3; i++)\n {\n if (check.Substring(i, 4) == hello)\n {\n if (lcount[i + 2] >= 2) { matchFound = true; break; }\n }\n }\n }\n\n Console.WriteLine(matchFound ? \"YES\" : \"NO\");\n }\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n int size = s.Length;\n int count = 0;\n for(int i = 0; i < size; i++)\n {\n if (s[i] == 'h'&& count==0)\n count++;\n else if(s[i] == 'e' && count == 1)\n count++;\n else if (s[i] == 'l' && count == 2|| count == 3)\n count++;\n else if (s[i] == '0' && count == 4)\n {\n count++;\n break;\n }\n }\n if (count == 4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problem2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string Hello = Console.ReadLine();\n Hello = Hello.ToLower();\n string temp = string.Empty;\n string helloWord = \"hello\";\n int cntr = 0;\n int result = 5;\n int index=0 ;\n\n for (int i = 0; i < helloWord.Length; i++)\n {\n int j = index;\n index = 0;\n for (; j < Hello.Length; j++)\n {\n \n \n if (helloWord[i] == Hello[j])\n {\n if (Hello[j] == 'l')\n { cntr++; }\n\n if (j != 0)\n {\n if (Hello[j] == Hello[j - 1])\n {\n if (Hello[j] == 'l')\n {\n \n if (cntr<3)\n {\n temp += Hello[j];\n j = Hello.Length;\n }\n }\n else\n continue;\n }\n\n else\n {\n\n temp += Hello[j];\n index = j+1;\n j = Hello.Length;\n \n }\n }\n else\n {\n temp += Hello[j];\n index = j + 1;\n j = Hello.Length;\n }\n \n }\n result = helloWord.CompareTo(temp);\n if (result == 0)\n {\n Console.WriteLine(\"YES\");\n i = helloWord.Length;\n }\n\n }\n }\n\n if(result != 0)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Chat\n{\n\n class ChattyBoy\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Regex condfilter = new Regex(s);\n if (condfilter.IsMatch(\"^[a-z]*(?:hello)*$\") == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n \n }\n \n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string hello = Console.ReadLine();\n string example = \"[h]{1,}[e]{1,}[l]{2,}[o]{1,}\";\n string result = hello[0].ToString();\n\n Console.WriteLine(Regex.IsMatch(hello,example)?\"YES\":\"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace training2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n bool _1=false;\n bool _2=false;\n bool _3=false;\n bool _4=false;\n int count = 0;\n for(int i=0;i 5 && _1 && _2 && count >= 2 && _4)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (s.Contains(\"hlelo\")) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string word = Console.ReadLine();\n int count = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] == 'h' && count == 0)\n count++;\n if (word[i] == 'e' && count == 1)\n count++;\n if (word[i] == 'l' && count == 2)\n count++;\n if (word[i] == 'l' && count == 3)\n count++;\n if (word[i] == 'o' && count == 4) \n count++; \n if (count == 5)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n Console.WriteLine(\"NO\"); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem58A {\n class Program {\n static void Main(string[] args) {\n char[] word = Console.ReadLine().ToCharArray();\n int[] helloLetters = getOnlyHelloLetters(word);\n bool couldWrite = checkHello(helloLetters);\n\n if (couldWrite)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n private static bool checkHello(int[] helloLetters) {\n bool canWrite = true;\n int helloLength = helloLetters.Length;\n\n for (int i = 0; i < helloLength-1; i++) {\n int letter = helloLetters[i];\n int nextLetter = helloLetters[i + 1];\n\n if (nextLetter < letter) {\n canWrite = false;\n break;\n }\n }\n return canWrite;\n }\n\n private static int[] getOnlyHelloLetters(char[] word) {\n List list = new List();\n int wordLength = word.Length;\n for (int i = 0; i < wordLength; i++) {\n if (word[i].Equals('h') || word[i].Equals('e') || word[i].Equals('l') || word[i].Equals('o')) {\n list.Add(word[i]);\n }\n }\n\n int listLength = list.Count;\n int[] helloLetters = new int[listLength];\n for (int i = 0; i < listLength; i++) {\n int helloOrd = 0;\n if (list[i].Equals('h')) helloOrd = 1;\n if (list[i].Equals('e')) helloOrd = 2;\n if (list[i].Equals('l')) helloOrd = 3;\n if (list[i].Equals('o')) helloOrd = 4;\n\n helloLetters[i] = helloOrd;\n }\n return helloLetters;\n }\n }\n}\n"}, {"source_code": "using System;\nclass Chat_room\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n char[] t = { 'h', 'e', 'l', 'l', 'o' };\n int loc = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if(loc == t.Length)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else if(s[i] == t[loc])\n {\n loc++;\n }\n }\n if(loc < t.Length)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inputString = Console.ReadLine();\n int l=0;\n for(int i =0; i1)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (!s.Contains(\"hlelo\")) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Chat_room\n{\n static void Main(string[] args)\n {\n string s = Console.ReadLine().ToLower();\n char[] t = { 'h', 'e', 'l', 'l', 'o' };\n int loc = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if(loc == t.Length)\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else if(s[i] == t[loc])\n {\n loc++;\n }\n }\n if(loc < t.Length)\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n if (input.Count(c => c == 'l') > 1 && string.Join(\"\", input.Distinct()) == \"helo\") Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\ninternal class Program\n{\n public static void Main(string[] args)\n {\n var s = Console.ReadLine();\n if (s.IndexOf('h') < s.IndexOf('e') &&\n s.IndexOf('e') < s.IndexOf(\"ll\") &&\n s.IndexOf(\"ll\") < s.IndexOf('o'))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Ladder\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n s = Console.ReadLine();\n int hIndex = s.IndexOf('h');\n int eIndex = s.IndexOf('e');\n int lIndex = s.IndexOf('l');\n int oIndex = s.IndexOf('o');\n if (hIndex == -1 || eIndex == -1 || lIndex == -1 || oIndex == -1)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n s = s.TrimStart('a','b','c','d','e','f','g','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');\n s = s.TrimEnd('a','b','c','d','e','f','g','h','i','j','k','l','m','n','p','q','r','s','t','u','v','w','x','y','z');\n s = s.Replace('h', 'H');\n s = s.Replace('e', 'E');\n s = s.Replace('l', 'L');\n s = s.Replace('o', 'O');\n string smallword = \"\";\n for (int i=0; i str.Contains(c)))\n {\n if (str.IndexOf(\"h\") < str.IndexOf(\"e\"))\n {\n str = str.Remove(0, str.IndexOf('e'));\n if (str.IndexOf(\"e\") < str.IndexOf(\"l\"))\n {\n str = str.Remove(0, str.IndexOf('l'));\n\n if (str.IndexOf(\"l\") < str.LastIndexOf(\"l\"))\n {\n str = str.Remove(0, str.LastIndexOf('l'));\n\n if (str.LastIndexOf(\"l\") < str.IndexOf(\"o\"))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog_moh\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string hello = \"hello\"; \n string en_hello = Console.ReadLine().ToLower();\n string new_hello = null;\n \n foreach (char h in hello)\n {\n string co = \"\";\n for (int a = 0; a < en_hello.Length; a++)\n if (h == en_hello[a])\n {\n new_hello = new_hello + en_hello[a];\n for (int i = a+1; i < en_hello.Length; i++)\n {\n co =co+ en_hello[i];\n }\n break;\n\n }\n en_hello = co;\n }\n\n if (hello == new_hello)\n Console.WriteLine(\"yes\"); \n else\n Console.WriteLine(\"no\");\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Implemetation\n{\n class Program\n {\n static void Main(string[] args)\n {\n //string input = Console.ReadLine();\n //Console.WriteLine(Football(input));\n //int result=Petya_and_Strings(Console.ReadLine(), Console.ReadLine());\n //Console.WriteLine(result);\n //Helpful_Maths(Console.ReadLine());\n //Word_Capitalization(Console.ReadLine());\n //Taxi(int.Parse(Console.ReadLine()));\n //Console.WriteLine(Math.Ceiling((double)13/5));\n\n //Console.WriteLine(Regex.IsMatch(Console.ReadLine(), @\"[1-4]((\\s[1-4])+)?\"));\n\n string text = Console.ReadLine();\n if (text.Length > 100 || text.Length < 1) return;\n if (!Regex.IsMatch(text, @\"^[a-z]+$\")) return;\n\n string Result = \"\";\n char[] word = { 'h', 'e', 'l', 'l', 'o' };\n int position = 0;\n foreach (char c in text)\n {\n \n if (word[position] == c)\n {\n Result += c;\n position++;\n if (position == word.Length) break;\n }\n else\n {\n if (Result != \"\")\n {\n if (Result[position - 1] == c) continue;\n else break;\n }\n }\n \n }\n\n //Console.WriteLine(Result.Contains(\"hello\")?\"YES\":\"NO\");\n Console.WriteLine(Result.Equals(\"hello\")?\"YES\":\"NO\");\n }\n static void Taxi(int input)\n {\n if (input < 1 || input > Math.Pow(10, 5)) return;\n string strnumbers = Console.ReadLine(); \n if (!Regex.IsMatch(strnumbers, @\"[1-4](\\s[1-4])+\")) return;\n\n\n int[] nums=strnumbers.Split(' ').Select(num=>int.Parse(num)).ToArray();\n if (nums.Length != input) return;\n\n Console.WriteLine(Math.Ceiling((double)nums.Sum() / 4));\n \n }\n static void Word_Capitalization(string input)\n {\n if (input.Length > Math.Pow(10, 3)) return;\n\n string result;\n\n if (input[0] >= 97)\n {\n char c = input[0];\n int cint = c - 32;\n char res = (char)cint;\n result = res + input.Substring(1, input.Length - 1);\n Console.WriteLine(result);\n }\n else\n {\n Console.WriteLine(input);\n }\n }\n static void Helpful_Maths(string input)\n {\n string pattern = @\"[1-3]{1,100}\\+?\";\n if (!Regex.IsMatch(input, pattern)) return;\n\n\n List numbers = input.Split('+').Select(item => int.Parse(item)).ToList();\n numbers.Sort();\n string Result = \"\";\n\n foreach (int i in numbers)\n Result += i + \"+\";\n\n Console.WriteLine(Result.Substring(0, Result.Length - 1));\n }\n static int Petya_and_Strings(params string[] inputs)\n {\n if (inputs[0].Length != inputs[1].Length) return -1;\n\n return inputs[0].ToLower().CompareTo(inputs[1].ToLower());\n }\n static string Football(string input)\n {\n //string Pattern = @\"^[0-1]{1,100}$\";\n if (!Regex.IsMatch(input, @\"^[0-1]{1,100}$\")) return \"NO\";\n\n return input.Contains(\"0000000\") || input.Contains(\"1111111\") ? \"YES\" : \"NO\";\n }\n static bool Match(string text)\n {\n return Regex.IsMatch(text, @\"^[0-1] [0-1] [0-1]$\", RegexOptions.Singleline);\n }\n static int Team(int Problems)\n {\n string temp;\n int count = 0;\n string[] t = { \"1 1 1\", \"1 1 0\", \"1 0 1\", \"0 1 1\" };\n for (int i = 0; i < Problems; i++)\n {\n temp = Console.ReadLine();\n if (!Match(temp)) return 0;\n if (t.Contains(temp))\n {\n count++;\n }\n }\n return count;\n }\n\n static int BitPlusPlus(int Operations)\n {\n\n int Result = 0;\n string temp;\n if (Operations >= 1 && Operations <= 150)\n {\n for (int i = 0; i < Operations; i++)\n {\n temp = Console.ReadLine();\n if (!Regex.IsMatch(temp, @\"^([\\+-]{2})?[a-zA-Z]([\\+-]{2})?$\")) return 0;\n\n int index = temp.IndexOfAny(new char[] { '-', '+' });\n if (index != -1 && index > 2)\n {\n if (temp[index] == '+')\n Result++;\n else\n Result--;\n }\n else if (index != -1 && index < 2)\n {\n if (temp[index] == '+')\n ++Result;\n else\n --Result;\n }\n\n }\n }\n return Result;\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n string line = Console.ReadLine();\n string tmp = \"\";\n line.ToLower();\n for (int i = 0 ; i < line.Length ; i++){\n if(i == 0){\n tmp += line[i];\n } else {\n if(line[i] == 'l' && line[i-1] != 'l'){\n tmp += line[i];\n }\n if(line[i] != line[i-1]){\n tmp += line[i];\n }\n }\n }\n if(tmp.IndexOf(\"hello\") != -1){\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n string name = Console.ReadLine();\n string ans = \"NO\";\n\n for (int i = 0; i < name.Length -3; i++)\n {\n if (name[i] == 'h')\n {\n for(int i2=i+1;i2 indeces = new List();\n string helloWord = \"hello\";\n int j = 0;\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] == helloWord[j])\n {\n j++;\n if (j == 4)\n return \"YES\";\n }\n //int index = word.IndexOf(helloWord[i]);\n // indeces.Add(index);\n // //replace the found char with another dummy one\n // char[] ch = word.ToCharArray();\n // ch[index] = '-';\n // word = new string(ch);\n }\n return \"NO\";\n }\n public static bool IsIndecesIncreasing(List indeces)\n {\n bool increase = true;\n for (int i = 0; i < indeces.Count - 1; i++)\n {\n if (indeces[i] > indeces[i + 1])\n increase = false;\n }\n return increase;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication35\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n for(int i = 0; i= 2)\n {\n l = true;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n goto End;\n }\n\n if (s.Contains('o') == true)\n {\n if (s.IndexOf('l') < s.IndexOf('o'))\n {\n o = true;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n goto End;\n }\n\n if ((h == true) && (e == true) && (l == true) && (o == true))\n {\n Console.WriteLine(\"YES\");\n }\n End:\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Problem\n{\n public static void Main()\n {\n var allowed = new Dictionary\n {\n { 'h', 1 },\n { 'e', 1 },\n { 'l', 2 },\n { 'o', 1 }\n };\n\n var prev = new Dictionary\n {\n { 'e', 'h' },\n { 'l', 'e' },\n { 'o', 'l' }\n };\n\n string word = Console.ReadLine();\n\n for (int i = 0; i < word.Length; i++)\n {\n if (allowed.ContainsKey(word[i]))\n {\n if (word[i] == 'h')\n {\n allowed[word[i]]--;\n }\n else\n {\n if (word[i] == 'l')\n {\n if (allowed['l'] == 2)\n {\n if (allowed[prev['l']] <= 0)\n {\n allowed['l']--;\n }\n }\n else\n {\n allowed['l']--;\n }\n }\n else\n {\n if (allowed[prev[word[i]]] <= 0)\n {\n allowed[word[i]]--;\n }\n }\n }\n }\n }\n\n Console.WriteLine(allowed.Select(x => (int)x.Value).Sum() <= 0 ? \"YES\" : \"NO\");\n //var letters = new LinkedList(Console.ReadLine().ToCharArray());\n\n //LinkedListNode current = letters.First;\n\n //while (current != null)\n //{\n // var next = current.Next;\n // if (!allowed.Contains(current.Value))\n // {\n // letters.Remove(current);\n // }\n // else if (current.Value == 'h')\n // {\n // if (current.Next != null && current.Next.Value != 'e')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // else if (current.Value == 'e')\n // {\n // if (current.Next != null && current.Next.Value != 'l')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // else if (current.Value == 'l')\n // {\n // if (current.Next != null)\n // {\n // if (current.Previous != null && current.Previous.Value == 'e' && current.Next.Value != 'l')\n // {\n // letters.Remove(current.Next);\n // }\n // else if (current.Previous != null && current.Previous.Value == 'l' && current.Next.Value != 'o')\n // {\n // letters.Remove(current.Next);\n // }\n // }\n // }\n // current = next;\n //}\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _58A_ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n bool h, e, l, o;\n h = s.Contains('h');\n e = s.Contains('e');\n l = s.Contains('l');\n o = s.Contains('o');\n if (h && e && l && o && (s.Length < 6))\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF32ChatRoom\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n for(int i=0;i= 2)\n {\n l = true;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n goto End;\n }\n\n if (s.Contains('o') == true)\n {\n if (s.IndexOf('l') < s.IndexOf('o'))\n {\n o = true;\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n goto End;\n }\n\n if ((h == true) && (e == true) && (l == true) && (o == true))\n {\n Console.WriteLine(\"YES\");\n }\n End:\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input;\n String hello = \"hello\";\n\n input = Console.ReadLine();\n\n for (int i = 0; i < input.Length-1; i++)\n {\n if (hello.Length == 0)\n {\n break;\n }\n if (hello[0] == input[i])\n {\n hello = hello.Substring(1);\n }\n\n }\n if (hello.Length > 0)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n\n }\n }\n\n\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class chat_room2\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine().ToLower(), b=\"\";\n for(int i = 0; i < a.Length; i++)\n {\n if(a[i] == 'h')\n {\n b += \"h\";\n for(int j = i; j < a.Length; j++)\n {\n if(a[j] == 'e')\n {\n b += \"e\";\n for(int k = j; k < a.Length; k++)\n {\n if(a[k] == 'l')\n {\n b += \"l\";\n k++;\n for(int l = k; l < a.Length; l++)\n {\n if (a[l] == 'l')\n {\n b += \"l\";\n for(int m = l; m < a.Length; m++)\n {\n if(a[m] == 'o')\n {\n b += \"o\";\n break;\n\n }\n }\n break;\n\n }\n }\n break;\n\n }\n }\n break;\n\n\n }\n }\n break;\n\n }\n }\n Console.WriteLine(b);\n if (b == \"hello\")\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n // The code provided will print \u2018Hello World\u2019 to the console.\n // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.\n //Console.WriteLine(\"Hello World!\");\n //Console.ReadKey();\n var target = \"hello\";\n string testString;\n testString = Console.ReadLine();\n int index = 0;\n var res = \"\";\n foreach (var character in target)\n {\n var x = testString.IndexOf(character);\n if (testString.IndexOf(character) >= index)\n index = testString.IndexOf(character);\n else\n {\n res = \"NO\";\n break;\n }\n }\n if(res == \"NO\")\n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n\n \n\n\n \n \n // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] s = Console.ReadLine().ToArray();\n char[] hello = { 'h', 'e', 'l', 'l', 'o' };\n int[] index = new int[hello.Length]; \n bool answer = true;\n for (int i = 0; i < hello.Length; i++)\n {\n for (int u = 0; u < s.Length; u++)\n {\n if (hello[i] == s[u])\n {\n if (i != 0 && index[i - 1] == u)\n {\n }\n else\n {\n index[i] = u;\n break;\n } \n }\n }\n if (i != 0 && index[i - 1] > index[i])\n {\n answer = false;\n break;\n }\n }\n Console.Write(answer ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Lv1Phase1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int checker = 0;\n string msg = Console.ReadLine();\n for (int i = 0; i < msg.Length; i++)\n {\n if ((msg[i] == 'h' || msg[i] == 'H') && checker == 0)\n {\n checker++;\n }\n else if ((msg[i] == 'e' || msg[i] == 'E') && checker == 1)\n {\n checker++;\n }\n else if ((msg[i] == 'l' || msg[i] == 'L') && checker == 2)\n {\n checker++;\n }\n else if ((msg[i] == 'l' || msg[i] == 'L') && checker == 3)\n {\n checker++;\n }\n else if ((msg[i] == 'o' || msg[i] == 'O') && checker == 4)\n {\n break;\n\n }\n else checker = 0;\n }\n if (checker == 4) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n if (input.Contains('h'))\n if (input.LastIndexOf('e') > input.IndexOf('h'))\n if (input.LastIndexOf('l') > input.IndexOf('e'))\n if (input.LastIndexOf('l') > input.IndexOf('l'))\n if (input.LastIndexOf('o') > input.LastIndexOf('l'))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n}"}], "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838"} {"source_code": "using System;\n\nnamespace prog1\n{\n class Program\n {\n public static void Main(string[] args)\n { int n,s;\n s=0;\n n=Convert.ToInt16(Console.ReadLine());\n for (int i=0; i 0; currentButton--)\n {\n int numberOfAttemptsToFind = currentButton - 1;\n if (currentButton == 1)\n {\n sum += n;\n }\n else\n {\n sum += numberOfAttemptsToFind + (buttonsFound * numberOfAttemptsToFind);\n }\n buttonsFound++;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace rg\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,i,k=0;\n\n n = int.Parse(Console.ReadLine());\n \n for(i=1;i<=n-1;i++)\n {\n k += ((n - i) * i) + 1;\n \n }\n\n Console.WriteLine(k+1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpPrograms.Codeforces\n{\n class _268B\n {\n static void Main()\n {\n long n = Convert.ToInt64(Console.ReadLine());\n long total = 0;\n for (int i = 1; i <= n; i++)\n {\n total += (n - (i - 1)) * (i - 1);\n }\n Console.WriteLine(total + n);\n }\n }\n}"}, {"source_code": "using System;\n\nclass B268 {\n public static void Main() {\n var n = long.Parse(Console.ReadLine());\n Console.WriteLine(n * (n * n + 5) / 6);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cf_164_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int s = n;\n for (int i = 1; i <= n-1; i++)\n {\n s += i*(n - i);\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class _268B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int s = n;\n for (int i = 1; i < n; i++)\n {\n s = s + i * (n - i);\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace MainProgram \n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n for(int i = 1; i < n; i++)\n {\n result += (n-i)*i;\n }\n result += n;\n Console.WriteLine (result);\n } \n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = n, ch = n;\n if (n == 1)\n count = 1;\n else if (n == 2)\n count = 3;\n else\n {\n if (n % 2 != 0)\n {\n\n int max = ((n - 1) / 2);\n for (int i = 1; i < max; i++)\n count += ch = ch + 2 * (max - i);\n count *= 2;\n count += 1;\n }\n else\n {\n\n int max = (n / 2 - 1);\n for (int i = 1; i < max; i++)\n count += ch = ch + 2 * (max - i) + 1;\n count *= 2;\n count += ch + 1 + 1;\n\n }\n }\n\n Console.WriteLine(count);\n\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program {\n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var sum = n;\n for (var i = 1 ; i < n ; i++) sum += (n-i)*i;\n Console.WriteLine(sum);\n }\n}\n "}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long result = n;\n result += (((n * n - n) / 2L) * n);\n result -= ((n * n - n) * (2 * n - 1L) / 6L);\n Console.WriteLine(result);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sum = 0, S = 0, s = 0;\n for (int i = 1; i < n; i++)\n\t\t\t{\n sum += (n-1)*i;\n S += i * i;\n\t\t\t}\n for (int i = 1; i <= n; i++)\n {\n s += i;\n }\n Console.Write(s + sum - S);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n long count = 0;\n\n long know = 0;\n\n if (n == 1)\n {\n know = 1;\n }\n\n for (int i = 0; i < n; i++)\n {\n //Console.WriteLine(\"know \" + know);\n count += know;\n\n if(know Perms(string source)\n {\n if (source.Length == 1) return new List() { source };\n\n var perm = from l in source\n from _x in Perms(string.Join(\"\",\nsource.Where(x => x != l)\n))\n select l + _x; ;\n return perm;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _1000\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_164A();\n }\n\n public static void solve_164A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n \n int i = 2;\n int total = n;\n int len = n;\n while (--len > 1)\n {\n total += i * (len - 1);\n total += 1;\n i++;\n\n }\n total += n > 1 ? 1 : 0;\n\n Console.WriteLine(total);\n }\n \n public static void solve_betaRound9A()\n {\n string[] yw = Console.ReadLine().Split(' ');\n\n int y = Convert.ToInt32(yw[0]);\n int w = Convert.ToInt32(yw[1]);\n\n int diff = 6 - Math.Max(y, w) + 1;\n int numerator = diff == 4 ? 2 : diff == 5 ? 5 : 1;\n int nominator = 6 % diff == 0 ? 6 / diff : diff == 4 ? 3 : 6;\n Console.WriteLine(\"{0}/{1}\", numerator, nominator);\n }\n \n public static void solve_531A()\n {\n long n = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine((n * (n + 1) / 2) % 2 == 0 ? 0 : 1);\n }\n\n /*\n The issue here is that you cannot easily calculate 2 to the power to 10000000.\n For that you need big arhithmetique techniques. And even this may not help\n because you need to quickly calculate powers of 2 and then you need to divide\n big integer by short integer values.\n But if you look into the problem you can actually observe that m\n can only give differnt reminders if it is less than n. If n is larger than m\n then you always have the reminder m. Furthermore, we can see by the problem\n statement that m can be maximum 8-digit number. So in order to calculate\n different reminders n must be less then 27). Why 27.\n Well, we know that (2^31) - 1 is the upper integer range int c#. And it is a 10\n digit number. Let't decrease 31 by 1 to see when we have an integer with 8 digits.\n Using calculator it's pretty easy.\n */\n public static void solve_hello2018A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int answer = 0;\n if (n >= 27)\n {\n answer = m;\n }\n else\n {\n answer = m % Convert.ToInt32(Math.Pow(2, n));\n }\n\n Console.WriteLine(answer);\n }\n\n public static void solve_574B()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nk[0]);\n int k = Convert.ToInt32(nk[1]);\n\n int i = 1;\n int count = 1;\n while (i != n && i - count == k)\n {\n i++;\n count += count + 1;\n }\n\n Console.WriteLine(count);\n }\n\n public static void solve_574A()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nk[0]);\n int k = Convert.ToInt32(nk[1]);\n\n int[] cnt = new int[k];\n for (int i = 0; i < n; i++)\n {\n int p = Convert.ToInt32(Console.ReadLine());\n\n cnt[p - 1]++;\n }\n\n Array.Sort(cnt, (int a, int b) => b.CompareTo(a));\n int count = 0;\n int g = 0;\n int j = n % 2 > 0 ? n / 2 + 1 : n / 2;\n for (int i = 0; i < k; i++)\n {\n if (g >= j)\n {\n break;\n }\n\n while (cnt[i] > 0 && g < j)\n {\n int deduct = cnt[i] > 1 ? 2 : 1;\n cnt[i] -= deduct;\n count += deduct;\n g += 1;\n }\n //int deduct = cnt[i] % 2 > 0 ? cnt[i] / 2 + 1 : cnt[i] / 2;\n /*if (j <= 0)\n {\n break;\n }\n if (j == 1 && deduct > 1)\n {\n count += 2;\n }\n else if (j == 1 && deduct == 1)\n {\n count += 1;\n }\n else\n {\n count += cnt[i];\n }\n\n j -= deduct;*/\n }\n\n Console.WriteLine(count);\n }\n\n public static void solve_352B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string test = Console.ReadLine();\n int[] cnts = new int[123];\n\n for (int i = 0; i < n; i++)\n {\n cnts[test[i]]++;\n }\n\n int unq = 0;\n for (int i = 0; i < cnts.Length ;i++)\n {\n if (cnts[i] > 0)\n {\n unq++;\n }\n }\n\n int answer = -1;\n\n //Redundancy in condition. if n must be <= 26 then of course unq will be <= 26. So we can remove it.\n if (unq <= 26 && n <= 26)\n {\n answer = n - unq;\n }\n\n Console.WriteLine(answer);\n }\n\n public static void solve_2A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] test = Console.ReadLine().Split(' ');\n\n int max = int.MinValue;\n int maxI = 0;\n int min = int.MaxValue;\n int minI = 0;\n for (int i = 0; i < n; i++)\n {\n int num = Convert.ToInt32(test[i]);\n if (max < num)\n {\n max = num;\n maxI = i;\n }\n\n if (min > num)\n {\n min = num;\n minI = i;\n }\n }\n\n //n - 1 - because index starts at 0 and ends at n - 1\n // or we could add +1 to minI and maxI and count from 1.\n Console.WriteLine(Math.Abs(minI - maxI) + Math.Max(n - 1 - Math.Max(minI, maxI), Math.Min(minI, maxI)));\n }\n public static void solve_360B()\n {\n string n = Console.ReadLine();\n\n Console.WriteLine(n + String.Join(\"\", n.Reverse().ToList()));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Buttons\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = n;\n int ops = 1;\n while (n > 1)\n {\n res += (n-1) * ops;\n n--;\n ops++;\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": " using System;\n\n namespace Issue_268B\n {\n class Program\n {\n public static void Main(string[] args) {\n var n = ReadInt();\n var sum = 0;\n\n for (int i = 1; i <= n; ++i) {\n sum += i * (n - i) + 1;\n }\n\n Console.WriteLine(sum);\n }\n\n private static bool IsInputError = false;\n private static bool IsEndOfLine = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n IsEndOfLine = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n // if symbol == \\n\n if (symbol == 13) {\n // skip next \\r symbol\n Console.Read();\n IsEndOfLine = true;\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n }\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint push=0;\n\t\t\n\t\t\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif(i==1)\n\t\t\t push+=n;\n\t\t\telse if(i==n)\n\t\t\t\tpush+=1;\n\t\t\telse\n\t\t\t{\n\t\t\t\tpush+=(n-(i-1))+((n-i)*(i-1));\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(push);\n\t}\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main ( string[] args ) {\n int n = ReadInt();\n int count = n;\n for ( int i = 1; i < n; i++ )\n count += i * (n - i);\n\n Console.WriteLine( count );\n }\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt () {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split( new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries );\n _current = 0;\n }\n\n int value = int.Parse( _words[ _current ] );\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace AlgoFun\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int counter = 2;\n\n int result = n + n - 1;\n for (int i = n - 2; i > 0; i--)\n {\n result += i * counter;\n counter++;\n }\n \n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace q268b\n{\n class Program\n {\n static void Main(string[] args)\n {\n\t var inputFirstLine = int.Parse(Console.ReadLine());\n\t var totalPressing = 0;\n\t var pressingBack = 0;\n\n\t var n = inputFirstLine;\n\n\t for (var depth = 0; depth < n; depth++)\n\t {\n\t\ttotalPressing += (n - depth - 1) * pressingBack; // \uc2e4\ud328\uc2dc \ubc18\ubcf5\ub420 \ub418\ub204\ub984\uc218\n\t\ttotalPressing += (n - depth - 1); // \uc2e4\ud328\ud558\uae30 \uc704\ud574 \ub20c\ub800\ub358 \ub204\ub984\uc218\n\t\ttotalPressing += 1; // \uc131\uacf5\uc801\uc778 \ub9c8\uc9c0\ub9c9 \ub204\ub984\n\t\tpressingBack += 1; // \uc5ec\uae30\uc11c\ubd80\ud130 \uc2e4\ud328\ud558\uba74 \ub2e4\uc2dc \ub204\ub974\uae30 \uc704\ud574 \uc131\uacf5\uc801\uc778 \uc2a4\ud15d\uc744 \ubc18\ubcf5\ud574\uc57c\ud568\n\t }\n\n\t Console.WriteLine(totalPressing);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\tint c = 0;\n\t\t\tfor (int i = 1; i < n; i++)\n\t\t\t\tc += i * (n - i);\n\t\t\tConsole.WriteLine(c + n);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_286B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int ans = 0;\n for (int i = 0; i < n ; ++i)\n {\n ans += i * (n - i);\n }\n Console.WriteLine(ans+n);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(n*(n*n + 5)/6);\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n long n=read().ToInt();\n write(n*(n+1)/2*(n-1)/3+n);\n }\n}\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n}"}, {"source_code": "using System;\n\nnamespace _268B\n{\n static class Program\n {\n static void Main() \n {\n var s = short.Parse(Console.ReadLine());\n var r = 0;\n for (int i = s, j = 0; i > 0; i--, j++)\n {\n r += i+(i-1)*j;\n }\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int cnt = 0;\n\n for (int i = 1; i < n; i++)\n {\n cnt += i*(n - i);\n }\n\n cnt += n;\n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace _1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = int.Parse(Console.ReadLine());\n int ans = 0;\n for (int i = 0; i < n-1;i++)\n {\n ans = ans + (n - i) + (n - 1 - i) * i;\n }\n Console.WriteLine(ans+1);\n // Console.ReadKey();\n }\n\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_Buttons\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i, j=0, n,sum=0;\n n = Convert.ToInt32(Console.ReadLine());\n for(i=0;i 0 )\n\t\t\t{\n\t\t\t\tc += ( ( n - pressed - 1 ) * pressed + ( n - pressed ) );\n\t\t\t\t++pressed;\n\t\t\t}\n\t\t\tConsole.Write( c );\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Buttons\n{\n class Program\n {\n static void Main(string[] args)\n {\n int buttons = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n for (int i = 1; i < buttons; i++)\n {\n count += (buttons - i) * i;\n }\n Console.WriteLine(count + buttons);\n\n }\n \n }\n} \n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Buttons\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n long sum = n;\n for (int i = 0; i <= n; i++)\n {\n sum += (n - i) * i;\n }\n Console.WriteLine(sum);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* A\n \n int n = Convert.ToInt32(Console.ReadLine());\n int[,] A = new int[n, 2];\n\n for (int i = 0; i < n; i++)\n {\n string s = Console.ReadLine();\n string[] p = s.Split(new Char[] { ' ' });\n A[i, 0] = Convert.ToInt32(p[0]);\n A[i, 1] = Convert.ToInt32(p[1]);\n }\n int count = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i != j)\n {\n if (A[i, 0] == A[j, 1])\n {\n count++;\n }\n }\n }\n }\n\n Console.WriteLine(count);\n */\n\n int n = Convert.ToInt32(Console.ReadLine());\n int x = 0;\n for (int i = 1; i <= n - 1; i++)\n {\n x += (n - i) * i;\n }\n x += n;\n Console.WriteLine(x);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(System.Console.ReadLine());\n long b = 0;\n\n for (int i = 1; i <= a; ++i)\n {\n b += i * (1 + a - i) - (a - i);\n }\n\n System.Console.WriteLine(b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problems\n{\n class Buttons\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int s = 0;\n for (int i = 0; i < n; i++)\n s += n - i + i * (n - i - 1);\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n long n = long.Parse(Console.ReadLine());\n Console.Write(n * (n * n + 5) / 6);\n \n\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace b268\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string[] res = Console.ReadLine().Split (new char[]{' '});\n UInt64 n = Convert.ToUInt64(res[0]);\n UInt64 tot = 0;\n for (UInt64 i = 0; i < n; i++) \n tot += (n-i-1)*(i+1);\n \n tot += n;\n \n \n Console.WriteLine(tot);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint cnt = 0;\n\t\t\tfor (int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tcnt += (n - i) * i;\n\t\t\t}\n\t\t\tcnt += n;\n\t\t\tConsole.WriteLine(cnt);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Int16.Parse(Console.ReadLine());\n int count = 0,sum=0;\n while (a != 1) {\n sum = sum + a + (a-1)*count;\n a--;\n count++;\n }\n Console.WriteLine(++sum);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nnamespace CS\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int counter = 0;\n for (int i = 1; i < n; i++)\n counter += (i * (n - i));\n Console.WriteLine(counter + n);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 1;\n int sum = 0;\n int c = n-1;\n while (k!=n)\n {\n sum += c * k;\n c--; k++;\n }\n Console.WriteLine(sum + n);\n }\n \n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace lALAL\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n long sum = 0;\n n = int.Parse(Console.ReadLine());\n for (int i = 1; i <= n-1; i++) sum += (long)i*(n-i);\n Console.WriteLine(sum+n);\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication236\n{\n\n class Program\n {\n \n\n static void Main(string[] args)\n {\n ulong n = ulong.Parse(Console.ReadLine());\n ulong sum = 0;\n for (ulong i = 1; i <= n - 1; i++)\n {\n sum += (n - i) * i;\n }\n Console.WriteLine(sum + n);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), f = 0;\n for(int i = 1; i < n; i++)\n {\n f += i * (n - i);\n }\n Console.WriteLine(f + n);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), count = 0;\n count += n;\n for (int i = 1; i <= n - 1; i++) count += (n - i) * i; \n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Buttons\n{\n\tprivate static void Main()\n\t{\n\t\tvar n = ReadInt();\n\t\t\n\t\tvar result = n > 1 ? n + 1 : 1;\n\t\tfor (int i = 2; i <= n - 1; i++)\n\t\t{\n\t\t\tresult += (i - 1) + (n - i) * (i - 1) + 1;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(result);\n\t}\n\t\n\tprivate static int[] ReadIntArray()\n\t{\n\t\treturn Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t}\n\t\n\tprivate static int ReadInt()\n\t{\n\t\treturn int.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R164_Div2_B\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n long cnt = 0;\n for (int i = 1; i <= n; i++)\n cnt += (n - i) * i + 1;\n\n Console.WriteLine(cnt);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long[] temp = new long[n];\n for (int i = 0; i < n; i++)\n temp[i] = n;\n long sum = 0;\n for (int i = n - 1; i > 0; i--)\n sum += i * (n - i);\n sum += n;\n Console.WriteLine(sum);\n //3 (find 1)\n //2*2(find 2)\n //3*1(find 3)\n //4\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), x = n, ans = n;\n\n if (n == 1)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n for (int p = 1; p < n; p++)\n {\n ans += (x - 1) + p * (x - 2);\n x--;\n }\n\n Console.WriteLine(ans++);\n } \n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class _268B_Buttons\n {\n static void Main()\n {\n var buttonsAmount = int.Parse(Console.ReadLine());\n var result = buttonsAmount;\n\n for(var i = 1; i < buttonsAmount; i++)\n {\n result += i * (buttonsAmount - i);\n }\n\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace COJ\n{\n class Program\n {\n static int k = 0; \n static List cycle = new List();\n static int[] visitedTime;\n static void Main(string[] args)\n {\n //TextReader tr = Console.In;\n //Console.SetIn(new StreamReader(@\"d:\\lmo.in\"));\n\n int n = int.Parse(Console.ReadLine());\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n cnt += (n - i )* i + 1;\n }\n Console.WriteLine(cnt);\n\n //Console.SetIn(tr);\n Console.ReadLine();\n }\n\n static void DFS(List> adyL, int s, int n)\n {\n visitedTime[s] = n;\n cycle.Add(s + 1);\n // Looking for adyacent nodes\n for (int i = 0; i < adyL[s].Count; i++)\n {\n int nextNode = adyL[s][i];\n if (visitedTime[nextNode] > 0 && visitedTime[s] - visitedTime[nextNode] >= k)\n {\n int tmp = cycle.IndexOf(nextNode + 1);\n Console.WriteLine(cycle.Count - tmp);\n string auxS = \"\";\n for (int h = tmp; h < cycle.Count; h++)\n {\n auxS += cycle[h] + \" \";\n }\n Console.WriteLine(auxS.Trim());\n return;\n }\n else if (visitedTime[nextNode] == 0)\n {\n DFS(adyL, nextNode, n + 1);\n return; \n }\n }\n \n }\n\n \n static int ABS(int a)\n {\n if (a < 0)\n a *= -1;\n return a;\n }\n\n static void PrintMt(int[,] mt)\n {\n for (int i = 0; i < mt.GetLength(0); i++)\n {\n for (int j = 0; j < mt.GetLength(1); j++)\n {\n Console.Write(mt[i, j] + \" \");\n }\n Console.WriteLine();\n }\n }\n\n\n }\n\n}"}, {"source_code": "namespace CodeForce164\n{\n using System;\n using System.IO;\n\n\n public static class Program\n {\n public static void Main(string[] args)\n {\n ResolveB();\n }\n\n private static void ResolveB()\n {\n#if DEBUG\n TextReader reader = new StreamReader(@\"inputB.txt\");\n#else\n TextReader reader = Console.In;\n#endif\n var n = int.Parse(reader.ReadLine());\n\n Console.WriteLine(ProblemB.Resolve(n));\n }\n }\n\n public static class ProblemB\n {\n public static int Resolve(int n)\n {\n int pressed = 0;\n int res = 0;\n while (n > 0)\n {\n int wrong = n - 1;\n res += wrong * (pressed + 1);\n res += 1;\n pressed += 1;\n n -= 1;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var n = long.Parse(Console.ReadLine());\n Console.WriteLine(n * (n * n + 5L) / 6L);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n a = Convert.ToInt32(Console.ReadLine());\n\n int hasil=0;\n int flag=a-2;\n int flag2 = 1;\n for (int i = 0; i < a; i++)\n {\n\n if (i == (a - 2))\n {\n hasil += 1;\n }\n else if (i == (a - 1) || i==0)\n {\n hasil += a;\n }\n else\n {\n hasil += (a - i) + (flag * flag2);\n flag2++;\n flag--;\n }\n }\n Console.WriteLine(hasil);\n Console.ReadLine();\n }\n }\n}\n\n//2\n//1 2\n//2\n//1\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n\n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int sum = n;\n for (int i = 1; i <= n; i++) sum += i * (n - i);\n WL(sum); \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n Console.WriteLine((n * n * n - n) / 6L+n);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int s=n-1;\n\n for (int k=1; k= 1; i--)\n {\n ans += (n - i) * i;\n ans++;\n }\n Console.WriteLine(ans);\n }\n \n \n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int res = 0;\n for (int i = 1; i <= n; i++)\n res += (n - i) * i;\n res += n;\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n\t\t\tvar n = int.Parse(input1);\n\n\t\t\tif (n == 1) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlong count = n;\n\t\t\tfor (int i = 2; i <= n; i++) \n\t\t\t{\n\t\t\t\tcount += i * (n - i) + 1;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _268B_Buttons.Run();\n\n }\n }\n class _268B_Buttons\n {\n public static void Run()\n {\n var n = int.Parse(Console.ReadLine());\n if (n == 1)\n {\n Console.WriteLine(1);\n return;\n }\n\n var ctr = n + 1;\n\n for (var i = 1; i < n-1; i++)\n {\n ctr = ctr + (n - i)*i + 1;\n }\n\n Console.WriteLine(ctr);\n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeffusing System.Collections.Generic;\n\ufeff\ufeff\ufeff\ufeffusing System.Globalization;\n\ufeff\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\ufeff\ufeff\ufeffusing System.Text;\n\ufeff\ufeff\ufeff\ufeffusing System.Threading;\n\nnamespace CF {\n class Program {\n\n static void Main(string[] args) {\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n TextWriter writer = Console.Out;\n#else\n\t\t\tTextReader reader = Console.In;\n TextWriter writer = Console.Out;\n#endif\n\n var n = reader.Read();\n\n long count = 0;\n int attempCost = 1;\n int knownLength = n;\n\n while (n > 1) {\n count += attempCost * (n - 1);\n attempCost++;\n n--;\n }\n count += knownLength;\n \n\n Console.WriteLine(count);\n \n \n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n \n\n }\n\n\n #region template\n class Pair {\n public Pair(T1 first, T2 second) {\n First = first;\n Second = second;\n }\n public T1 First { get; set; }\n public T2 Second { get; set; }\n public override string ToString() {\n return \"{\" + First + \" \" + Second + \"}\";\n }\n \n }\n\n static class ReaderExtensions {\n\n public static string ReadToken(this TextReader reader) {\n int val;\n var builder = new StringBuilder();\n while (true) {\n val = reader.Read();\n if (val == ' ' || val == -1) {\n if (builder.Length == 0) continue;\n break;\n }\n if (val == 13) {\n reader.Read();\n if (builder.Length == 0) continue;\n break;\n }\n builder.Append((char)val);\n }\n return builder.ToString();\n }\n\n public static T Read(this TextReader reader) {\n return (T)Convert.ChangeType(reader.ReadToken(), typeof(T));\n }\n\n public static T[] ReadArr(this TextReader reader) {\n return reader.ReadLine()\n .Split(' ').Select(str =>\n (T)Convert.ChangeType(str, typeof(T))\n ).ToArray();\n }\n\n }\n\n static class LinqExtensions {\n /// Value / Index\n public static IEnumerable> SelectIndexes(this IEnumerable collection) {\n return collection.Select((v, i) => new Pair(v, i));\n }\n public static IEnumerable SelectValues(this IEnumerable> collection) {\n return collection.Select(p => p.First);\n }\n public static void AddRepeatedRange(this IDictionary> dictionary, \n Func> generator, IEnumerable> sourceCollection ) {\n foreach (var pair in sourceCollection) {\n if (!dictionary.ContainsKey(pair.First)) {\n dictionary[pair.First] = generator();\n }\n dictionary[pair.First].Add(pair.Second);\n }\n }\n public static T Second(this IEnumerable collection) {\n return collection.Skip(1).First();\n }\n }\n\n static class OutputExtensions {\n public static void WriteBySeparatorLine(this IEnumerable list, string sep = \" \") {\n foreach (var v in list) {\n Console.Write(v);\n Console.Write(sep);\n }\n Console.WriteLine();\n }\n }\n\n #endregion \n}"}, {"source_code": "using System;\n\nnamespace Zad1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n var res = 0;\n for (var i = n - 1; i >= 1; i--)\n {\n res += i * (n - 1 - i + 1);\n }\n res += n;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k = Int32.Parse (Console.ReadLine ());\n int l = Int32.Parse (Console.ReadLine ());\n int m = Int32.Parse (Console.ReadLine ());\n int n = Int32.Parse (Console.ReadLine ());\n int d = Int32.Parse (Console.ReadLine ());\n int sum = 0;\n \n for (int i = 1; i <= d; i++) {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z236A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n string ne = \"\";\n bool k;\n for (int i = 0; i < str.Length; i++) {\n k = false;\n for (int j = 0; j < ne.Length; j++) {\n if (str [i] == ne [j]) {\n k = true;\n }\n }\n if (!k) {\n ne += str [i];\n n++;\n }\n }\n if (n % 2 == 0) {\n Console.WriteLine (\"CHAT WITH HER!\");\n } else {\n Console.WriteLine (\"IGNORE HIM!\");\n }\n }\n\n static int gdc (int left, int right)\n {\n while (left>0&&right>0) {\n if (left > right) {\n left %= right;\n } else\n right %= left;\n }\n return left + right;\n }\n\n static void Z119A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int[] ab = new int[2];\n\n ab [0] = Int32.Parse (str [0]);\n ab [1] = Int32.Parse (str [1]);\n int n = Int32.Parse (str [2]);\n int i = 0;\n int m;\n while (true) {\n if (n == 0) {\n Console.WriteLine ((i + 1) % 2);\n return;\n }\n m = gdc (ab [i], n);\n n -= m;\n i = (i + 1) % 2;\n\n }\n\n }\n\n static void Z110A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == '4' || str [i] == '7') {\n n++;\n }\n }\n if (n == 4 || n == 7) {\n Console.WriteLine (\"YES\");\n } else {\n Console.WriteLine (\"NO\");\n }\n }\n\n static void Z467A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int res = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [1]) - Int32.Parse (strs [0]) >= 2) {\n res++;\n }\n }\n Console.WriteLine (res);\n }\n\n static void Z271A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int [] ye = new int[4];\n n++;\n for (int i = 0; i < 4; i++) {\n ye [i] = n / 1000;\n n %= 1000;\n n *= 10;\n }\n bool flag = true;\n while (flag) {\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < i; j++) {\n if (ye [i] == ye [j]) {\n ye [i]++;\n \n for (int k = i+1; k < 4; k++) {\n ye [k] = 0;\n }\n i--;\n }\n }\n }\n flag = false;\n for (int i = 1; i < 4; i++) {\n if (ye [i] == 10) {\n ye [i] %= 10;\n ye [i - 1]++;\n flag = true;\n }\n }\n }\n for (int i = 0; i < 4; i++) {\n Console.Write (ye [i]);\n }\n \n }\n\n static void Z58A ()\n {\n string str = Console.ReadLine ();\n str.ToLower ();\n string sstr = \"hello\";\n int j = 0;\n for (int i = 0; i < str.Length; i++) {\n if (sstr [j] == str [i])\n j++;\n if (j == sstr.Length) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z472A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n if (n % 2 == 0) {\n Console.Write (\"4 \");\n Console.Write (n - 4);\n } else {\n Console.Write (\"9 \");\n Console.Write (n - 9);\n }\n }\n\n static void Z460A ()\n {\n int res = 0;\n int days = 0;\n string[] strs = Console.ReadLine ().Split (' ');\n int nosk = Int32.Parse (strs [0]);\n int nd = Int32.Parse (strs [1]);\n while (nosk!=0) {\n days += nosk;\n res += nosk;\n nosk = 0;\n nosk = days / nd;\n days %= nd;\n }\n Console.Write (res);\n }\n\n static void Z379A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]);\n int b = Int32.Parse (strs [1]);\n int ogaroks = 0;\n int h = 0;\n while (a!=0) {\n h += a;\n ogaroks += a;\n a = ogaroks / b;\n ogaroks %= b;\n }\n Console.WriteLine (h);\n }\n\n static bool IsLucky (int n)\n {\n while (n>0) {\n int m = n % 10;\n if (m != 4 && m != 7) {\n return false;\n }\n n /= 10;\n }\n return true;\n }\n\n static void Z122A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n for (int i = 2; i <= n; i++) {\n if (n % i == 0 && IsLucky (i)) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z136A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] pod = new int[n];\n string[] strs = Console.ReadLine ().Split (' ');\n for (int i = 0; i < n; i++) {\n pod [Int32.Parse (strs [i]) - 1] = i + 1;\n }\n for (int i = 0; i < n; i++) {\n Console.Write (pod [i].ToString () + \" \");\n }\n }\n\n static void Z228A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n List n = new List ();\n for (int i = 0; i < 4; i++) {\n bool flag = true;\n for (int j = 0; j < n.Count; j++) {\n if (Int32.Parse (strs [i]) == n [j]) {\n flag = false;\n break;\n }\n }\n if (flag) {\n n.Add (Int32.Parse (strs [i]));\n }\n }\n Console.WriteLine (4 - n.Count);\n }\n\n static void Z263A ()\n {\n string[] strs;\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++) {\n strs = Console.ReadLine ().Split (' ');\n for (int j = 0; j < 5; j++) {\n if (strs [j] == \"1\") {\n x = j + 1;\n y = i + 1;\n }\n }\n\n }\n Console.WriteLine ((Math.Abs (3 - x) + Math.Abs (3 - y)));\n }\n\n static void Z266B ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int t = Int32.Parse (strs [1]);\n string str = Console.ReadLine ();\n char[] chs = new char[str.Length];\n for (int i = 0; i < str.Length; i++) {\n chs [i] = str [i];\n }\n for (int i = 0; i < t; i++) {\n int j = 0;\n while (j+1 rost [max])\n max = i;\n }\n int sum = 0;\n while (max!=0) {\n int temp = rost [max];\n rost [max] = rost [max - 1];\n rost [max - 1] = temp;\n sum++;\n max--;\n }\n\n\n for (int i = n-1; i >=0; i--) {\n\n if (rost [i] < rost [min]) {\n min = i;\n }\n }\n while (min!=rost.Length-1) {\n int temp = rost [min];\n rost [min] = rost [min + 1];\n rost [min + 1] = temp;\n sum++;\n min++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z451A ()\n {\n string[] names = new string[2];\n names [0] = \"Akshat\";\n names [1] = \"Malvika\";\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int m = Int32.Parse (strs [1]);\n n = Math.Min (n, m) - 1;\n n %= 2;\n Console.WriteLine (names [n]);\n\n }\n\n static void Z344A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int ostr = 1;\n string str = Console.ReadLine ();\n char ch = str [1];\n for (int i = 1; i < n; i++) {\n str = Console.ReadLine ();\n if (ch == str [0]) {\n ostr++;\n }\n ch = str [1];\n }\n Console.WriteLine (ostr);\n }\n\n static void Z486A ()\n {\n long n = Int64.Parse (Console.ReadLine ());\n long sum = n / 2;\n sum -= (n % 2) * n;\n Console.WriteLine (sum);\n }\n\n static void Z500A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (str [0]);\n int t = Int32.Parse (str [1]);\n int[] a = new int[n - 1];\n str = Console.ReadLine ().Split (' ');\n int j = 0;\n t--;\n for (int i = 0; i < n-1; i++) {\n a [i] = Int32.Parse (str [i]);\n if (i == j)\n j += a [i];\n if (j >= t)\n break;\n }\n if (j == t)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z61A ()\n {\n string str1 = Console.ReadLine ();\n string str2 = Console.ReadLine ();\n string str3 = \"\";\n for (int i = 0; i < str1.Length; i++) {\n if (str1 [i] == str2 [i])\n str3 += \"0\";\n else\n str3 += \"1\";\n }\n Console.WriteLine (str3);\n }\n\n static void Z268A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] h = new int[n];\n int[] a = new int[n];\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n h [i] = Int32.Parse (strs [0]);\n a [i] = Int32.Parse (strs [1]);\n }\n int sum = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j && h [i] == a [j])\n sum++;\n }\n }\n Console.WriteLine (sum);\n }\n\n static void Z208A ()\n {\n string str = Console.ReadLine ();\n string[] separ = new string[1];\n separ [0] = \"WUB\";\n string[] strs = str.Split (separ, StringSplitOptions.RemoveEmptyEntries);\n for (int i = 0; i < strs.Length; i++) {\n Console.Write (strs [i] + \" \");\n }\n }\n\n static void Z478A ()\n {\n string []strs=Console.ReadLine().Split(' ');\n int n=0;\n for (int i = 0; i < 5; i++) {\n n+=Int32.Parse(strs[i]);\n }\n if (n%5==0&&n!=0) {\n Console.WriteLine(n/5);\n }\n else {\n Console.WriteLine(-1);\n }\n }\n static void Z69A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int x = 0, y = 0, z = 0;\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n x += Int32.Parse (strs [0]);\n y += Int32.Parse (strs [1]);\n z += Int32.Parse (strs [2]);\n }\n if (x == 0 && y == 0 && z == 0) {\n Console.Write (\"YES\");\n } else {\n Console.Write(\"NO\");\n }\n }\n static void Z337A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n int n=Int32.Parse(strs[0]);\n int m=Int32.Parse(strs[1]);\n List arra=new List();\n strs=Console.ReadLine().Split(' ');\n bool flag;\n for (int i = 0; i < m; i++) {\n flag=true;\n int t=Int32.Parse(strs[i]);\n for (int j = 0; j < arra.Count; j++) {\n if(t=sum) {\n level++;\n n-=sum;\n i++;\n sum+=i;\n }\n Console.WriteLine(level);\n }\n static void Z479A ()\n {\n int a=Int32.Parse(Console.ReadLine());\n int b=Int32.Parse(Console.ReadLine());\n int c=Int32.Parse(Console.ReadLine());\n int res=a+b+c;\n res=Math.Max(res,(a+b)*c);\n res=Math.Max(res,a*(b+c));\n res=Math.Max(res,(a*b)*c);\n Console.WriteLine(res);\n\n }\n static void Z448A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n strs = Console.ReadLine ().Split (' ');\n int b = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n int n = Int32.Parse (Console.ReadLine ());\n int aa = a / 5;\n if (a % 5 != 0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n aa=b/10;\n if (b%10!=0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n static void Z469A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n bool[]levels=new bool[n];\n for (int i = 0; i < n; i++) {\n levels[i]=true;\n }\n for (int i = 0; i < 2; i++) {\n string[]str=Console.ReadLine().Split(' ');\n int m=Int32.Parse(str[0]);\n for (int j = 1; j <= m; j++) {\n levels[Int32.Parse(str[j])-1]=false;\n }\n }\n for (int i = 0; i < n; i++) {\n if (levels[i]) {\n Console.WriteLine(\"Oh, my keyboard!\");\n return;\n }\n }\n Console.WriteLine(\"I become the guy.\");\n }\n static void Z155A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n string[]strs=Console.ReadLine().Split(' ');\n int max=Int32.Parse(strs[0]);\n int min=max;\n int m=0;\n for (int i = 1; i < n; i++) {\n int t=Int32.Parse(strs[i]);\n if (t>max) {\n m++;\n max=t;\n }\n if (t chrs=new List();\n bool flag;\n while (str[i]!='}') {\n \n flag=true;\n for (int j = 0; j < chrs.Count; j++) {\n if (str[i]==chrs[j]) {\n flag=false;\n break;\n }\n }\n if (flag) {\n chrs.Add(str[i]);\n }\n i++;\n if(str[i]=='}')\n break;\n i+=2;\n }\n Console.WriteLine(chrs.Count);\n }\n static void Z474A ()\n {\n char[,]keyboard=new char[3,10];\n keyboard[0,0]='q';\n keyboard[0,1]='w';\n keyboard[0,2]='e';\n keyboard[0,3]='r';\n keyboard[0,4]='t';\n keyboard[0,5]='y';\n keyboard[0,6]='u';\n keyboard[0,7]='i';\n keyboard[0,8]='o';\n keyboard[0,9]='p';\n keyboard[1,0]='a';\n keyboard[1,1]='s';\n keyboard[1,2]='d';\n keyboard[1,3]='f';\n keyboard[1,4]='g';\n keyboard[1,5]='h';\n keyboard[1,6]='j';\n keyboard[1,7]='k';\n keyboard[1,8]='l';\n keyboard[1,9]=';';\n keyboard[2,0]='z';\n keyboard[2,1]='x';\n keyboard[2,2]='c';\n keyboard[2,3]='v';\n keyboard[2,4]='b';\n keyboard[2,5]='n';\n keyboard[2,6]='m';\n keyboard[2,7]=',';\n keyboard[2,8]='.';\n keyboard[2,9]='/';\n bool flag;\n string lr=Console.ReadLine();\n string str=Console.ReadLine();\n int[]x=new int[str.Length];\n int[]y=new int[str.Length];\n for (int i = 0; i < str.Length; i++) {\n flag=false;\n for (int k = 0; k < 3; k++) {\n for (int m = 0; m < 10; m++) {\n if (keyboard[k,m]==str[i]) {\n y[i]=k;\n x[i]=m;\n flag=true;\n break;\n }\n }\n if(flag)\n break;\n }\n }\n int a=0;\n if (lr==\"L\") {\n a++;\n }\n else {\n a--;\n }\n for (int i = 0; i < str.Length; i++) {\n Console.Write(keyboard[y[i],x[i]+a]);\n }\n }\n static void Z268B ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int sum=0;\n for (int j = 1; j < n; j++) {\n sum+=(n-j)*j;\n }\n sum+=n;\n Console.WriteLine(sum);\n }\n public static void Main ()\n {\n\n\n\n \n \n\n Z268B ();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Data.Sql;\nusing System.Collections;\nusing System.Numerics;\n\n\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = n;\n for (int i = 1; i < n; i++)\n {\n sum += (n - i) * i;\n }\n Console.WriteLine(sum);\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n internal class Program\n {\n\n private void Solve()\n {\n int n = io.NextInt();\n int ans = 0;\n for (int i = 0; i < n; i++)\n {\n ans += (n - i) * i;\n ans += 1;\n }\n io.Print(ans);\n }\n\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io).Solve();\n }\n }\n\n #endregion\n }\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"..\\\\..\\\\input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n return (T)Convert.ChangeType(NextString(), typeof(T));\n }\n\n\n public IEnumerable NextSeq(int n)\n {\n for (int i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n PrintLine(o ? \"YES\" : \"NO\");\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n}\n\n"}, {"source_code": "using System;\nclass CFR164D2B\n{\n\tstatic void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tint res = 0;\n\t\tfor (int i = n; i > 0; i--)\n\t\t{\n\t\t\tres += i;\n\t\t\tif (i > 1) res += (n - i) * (i - 1);\n\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\n\n\nstatic class Utils\n{\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public static int[] ReadIntArray()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray(); \n }\n public static List ReadIntList()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToList();\n }\n\n}\n\nclass Program\n{\n static void Main(string[] args)\n {\n Buttons();\n }\n\n static void Buttons()\n {\n int n = Utils.ReadInt();\n int ans = n;\n for(int i = 1; i <= n; i++)\n {\n ans += (n - i) * i;\n }\n Console.WriteLine(ans);\n }\n\n\n static void Lanterns()\n {\n //find the largest gap and divied by two \n int[] n_l = Utils.ReadIntArray();\n List arr = Utils.ReadIntList();\n arr.Sort();\n int max = 0;\n for (int i = 0; i < arr.Count - 1; i++)\n {\n max = Math.Max(max, arr[i + 1] - arr[i]);\n\n }\n double ans = max / 2.0;\n ans = Math.Max(ans, (double)arr[0] - 0);\n ans = Math.Max(ans, (double)n_l[1] - arr.Last());\n\n Console.WriteLine(ans.ToString(\"F10\",CultureInfo.GetCultureInfo(\"en-US\")));\n \n }\n\n static void Ringroad()\n {\n long count = 0; \n long[] n_m = (from int i in Utils.ReadIntArray() select Convert.ToInt64(i)).ToArray();\n List arr = (from int i in Utils.ReadIntArray() select Convert.ToInt64(i)).ToList();\n arr.Insert(0, 1L);\n for(long i =0; i < (long)arr.Count -1; i++)\n {\n long diff = arr[(int)i + 1] - arr[(int)i];\n count += (( diff >= 0) ? diff : diff + n_m[0]);\n }\n Console.WriteLine(count);\n }\n\n /// \n /// brute force works \n /// \n static void QueueAtSchool()\n {\n int[] n_t = Utils.ReadIntArray();\n char[] line = Console.ReadLine().ToArray(); \n for(int i = 0; i < n_t[1]; i++)\n {\n for(int j = 0; j < n_t[0]-1; j++)\n {\n if(line[j] == 'B' && line[j+1] == 'G')\n {\n line[j] ='G';\n line[j + 1] = 'B';\n j++;\n }\n }\n }\n Console.WriteLine(String.Concat(line));\n\n }\n\n\n \n}\n"}, {"source_code": "using System;\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 1; i <= n; i++) \n if (i != n)\n sum = sum + 1 + i * (n - i);\n else\n sum++; \n Console.Write(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n long res = 0;\n var c = 1;\n\n while (c\n {\n public int a { get; set; }\n public int b { get; set; }\n\n public Point(int x, int y)\n {\n a = x;\n b = y;\n }\n\n\n\n\n public int CompareTo(Point other)\n {\n return this.a.CompareTo(other.a);\n }\n }\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n\n if (n == 1) Console.WriteLine(1);\n else\n {\n for (int i = n; i >= 3; i--)\n {\n sum += i;\n for (int j = 0; j <= i-2; j++)\n {\n sum += j;\n }\n }\n Console.WriteLine(sum+3);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n long input = long.Parse(Console.ReadLine());\n long result = input - 1l;\n long half = input / 2l;\n for (long i = 2l; i <= half; ++i) result += i * (input - i);\n result *= 2l;\n if (input % 2l == 1l) result += half*(half + 1l);\n Console.WriteLine((result + 1l));\n }\n }"}, {"source_code": "\ufeffusing System;\n\n// Codeforces problem 268B \"\u041a\u043d\u043e\u043f\u043a\u0438\"\n// http://codeforces.com/problemset/problem/268/B\nnamespace _268_B\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t#region Read data\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\t#endregion\n\t\t\t#region Process data\n\t\t\tlong result = 1;\n\t\t\tfor (int i = 2; i <= n; i++)\n\t\t\t{\n\t\t\t\tresult *= i;\n\t\t\t}\n\t\t\tresult++;\n\t\t\t#endregion\n\t\t\t#region Write results\n\t\t\tConsole.WriteLine(result);\n\t\t\tConsole.ReadLine();\n\t\t\t#endregion\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace rg\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,f=1;\n\n n = int.Parse(Console.ReadLine());\n if (n == 1) Console.WriteLine('1');\n while(n>1)\n {\n f *= n;\n n--;\n }\n Console.WriteLine(f + 1);\n }\n \n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt32(Console.ReadLine());\n int hasil = 0;\n for (int i = 0; i < n; i++)\n {\n if (i == 0)\n {\n hasil = hasil + n;\n }\n else if (i == n - 1)\n {\n hasil = hasil + n;\n }\n else if (i == n - 2)\n {\n hasil = hasil + 1;\n }\n else\n {\n hasil = hasil + n - i + n - i - 1;\n }\n }\n\n if (n == 2)\n {\n Console.WriteLine(\"3\");\n }\n else\n {\n Console.WriteLine(hasil);\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace MainProgram \n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var counter = int.Parse(Console.ReadLine());\n long factorial = counter; \n while (counter > 1) \n factorial *= --counter;\n Console.WriteLine(factorial + 1);\n } \n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint push=0;\n\t\t\n\t\t\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif(i==1)\n\t\t\t push+=n;\n\t\t\telse if(i==n)\n\t\t\t\tpush+=1;\n\t\t\telse\n\t\t\t{\n\t\t\t\tpush+=(n-i)*(i-1);\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(push);\n\t}\n}\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint push=0;\n\t\t\n\t\t\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif(i==1)\n\t\t\t push+=n;\n\t\t\telse if(i==n)\n\t\t\t\tpush+=1;\n\t\t\telse\n\t\t\t{\n\t\t\t\tpush+=2*n-i-1;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(push);\n\t}\n}\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint push=0;\n\t\t\n\t\t\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif(i==1)\n\t\t\t push+=n;\n\t\t\telse if(i==n)\n\t\t\t\tpush+=1;\n\t\t\telse\n\t\t\t{\n\t\t\t\tpush+=n;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(push);\n\t}\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n*n-n+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sum = 0;\n\n for (int i = 1; i <= n; i++)\n {\n sum += i;\n }\n\n if (n <= 2)\n {\n Console.Write(sum);\n }\n else\n {\n Console.Write(sum + 1);\n }\n \n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sum = 0;\n if (n == 1)\n {\n sum = 1;\n }\n else\n {\n sum = (int)Math.Pow(2, n) - (n / 2);\n }\n\n Console.Write(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class _268B\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int s = 0;\n for (int i = 1; i < n; i++)\n s = s + i * (n - (i - 1) * 2) + 1;\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0; int l = n;\n\n string output = string.Join(\"\", Enumerable.Range(1, n).Reverse());\n if (n == 1) { Console.WriteLine(1); return; }\n while(n > 0)\n {\n count += n;\n n--;\n }\n\n count += (int)Math.Pow( (l-2) , 2 );\n\n Console.WriteLine(count);\n }\n // 1,2,3 1,2(2) 3(3) 3,3(4) 3,1(5) 3,2(6) 3,2,1\n\n\n private static IEnumerable Perms(string source)\n {\n if (source.Length == 1) return new List() { source };\n\n var perm = from l in source\n from _x in Perms(string.Join(\"\",\nsource.Where(x => x != l)\n))\n select l + _x; ;\n return perm;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0;\n\n count = Enumerable.Range(1, n).Aggregate((x, y) => x * y) + 1;\n \n Console.WriteLine(count);\n }\n \n\n\n private static IEnumerable Perms(string source)\n {\n if (source.Length == 1) return new List() { source };\n\n var perm = from l in source\n from _x in Perms(string.Join(\"\",\nsource.Where(x => x != l)\n))\n select l + _x; ;\n return perm;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int s=0;\n\n for (int k=1; k 0; i--) {\n sum = sum + ((i-1)*2);\n }\n Console.WriteLine(sum-(a-1));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "/*\n * \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0432 SharpDevelop.\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: alexey\n * \u0414\u0430\u0442\u0430: 16.11.2012\n * \u0412\u0440\u0435\u043c\u044f: 19:15\n * \n * \u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441 | \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 | \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 | \u041f\u0440\u0430\u0432\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.\n */\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Threading;\nusing System.IO;\nusing System;\n\nnamespace round_159\n{\n class Program\n {\n public static int ReadInt(){\n \n return int.Parse(Console.ReadLine());\n \n }\n \n public static string[] ReadStrArr(){\n \n return Console.ReadLine().Split(' ');\n \n }\n \n public static int ToInt(Object a){\n \n return int.Parse(a.ToString());\n \n }\n \n \n public static void print(object[] mas){\n \n for (int i =0;i '9') && t != '-') t = input.Read();\n int sign = 1;\n if (t == '-')\n {\n sign = -1;\n t = input.Read();\n }\n int x = 0;\n while (t >= '0' && t <= '9')\n {\n x *= 10;\n x += t - '0';\n t = input.Read();\n }\n return x * sign;\n }\n\n static int[] parseInt(string s)\n {\n string[] temp = s.Split(' ');\n int[] res = new int[temp.Length];\n for (int i = 0; i < temp.Length; i++)\n {\n res[i] = Convert.ToInt32(temp[i]);\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n Printer printer = new Printer();\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n long cnt = n;\n\n long mul = 2;\n for (int i = n - 1; i > 0; i--)\n {\n cnt += (i - 1) * mul + 1;\n }\n\n printer.WriteLine(cnt.ToString());\n\n printer.Print();\n\n }\n }\n\n class Printer\n {\n StringBuilder sb;\n\n public Printer()\n {\n sb = new StringBuilder();\n }\n\n public void WriteLine(string s)\n {\n sb.AppendLine(s);\n }\n\n public void Write(string s)\n {\n sb.Append(s);\n }\n\n public void Print()\n {\n Console.Write(sb);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n == 1 || n == 2)\n {\n Console.WriteLine(n);\n }\n else\n {\n int sum = 0;\n for (int i = 1; n - i >= 1; i++)\n {\n sum += i * (n - i);\n }\n Console.WriteLine(sum + n);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\n\n\nstatic class Utils\n{\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public static int[] ReadIntArray()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray(); \n }\n public static List ReadIntList()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToList();\n }\n\n}\n\nclass Program\n{\n static void Main(string[] args)\n {\n Buttons();\n }\n\n static void Buttons()\n {\n int n = Utils.ReadInt();\n //int ans = n;\n //for(int i = 1; i <= n; i++)\n //{\n // ans += (n - i) * i;\n //}\n //Console.WriteLine(ans);\n Console.WriteLine(((n*n*n)+5*n)/6);\n }\n\n\n static void Lanterns()\n {\n //find the largest gap and divied by two \n int[] n_l = Utils.ReadIntArray();\n List arr = Utils.ReadIntList();\n arr.Sort();\n int max = 0;\n for (int i = 0; i < arr.Count - 1; i++)\n {\n max = Math.Max(max, arr[i + 1] - arr[i]);\n\n }\n double ans = max / 2.0;\n ans = Math.Max(ans, (double)arr[0] - 0);\n ans = Math.Max(ans, (double)n_l[1] - arr.Last());\n\n Console.WriteLine(ans.ToString(\"F10\",CultureInfo.GetCultureInfo(\"en-US\")));\n \n }\n\n static void Ringroad()\n {\n long count = 0; \n long[] n_m = (from int i in Utils.ReadIntArray() select Convert.ToInt64(i)).ToArray();\n List arr = (from int i in Utils.ReadIntArray() select Convert.ToInt64(i)).ToList();\n arr.Insert(0, 1L);\n for(long i =0; i < (long)arr.Count -1; i++)\n {\n long diff = arr[(int)i + 1] - arr[(int)i];\n count += (( diff >= 0) ? diff : diff + n_m[0]);\n }\n Console.WriteLine(count);\n }\n\n /// \n /// brute force works \n /// \n static void QueueAtSchool()\n {\n int[] n_t = Utils.ReadIntArray();\n char[] line = Console.ReadLine().ToArray(); \n for(int i = 0; i < n_t[1]; i++)\n {\n for(int j = 0; j < n_t[0]-1; j++)\n {\n if(line[j] == 'B' && line[j+1] == 'G')\n {\n line[j] ='G';\n line[j + 1] = 'B';\n j++;\n }\n }\n }\n Console.WriteLine(String.Concat(line));\n\n }\n\n\n \n}\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sum = 0;\n\n sum = (int)Math.Pow(2, n) - (n / 2);\n\n Console.Write(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n\n namespace ConsoleApplication50\n {\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Pow(2,n)-1);\n }\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\tif (n == 2) Console.WriteLine(3);\n\t\t\tint c = 0;\n\t\t\tfor (int i = 1; i < n; i++)\n\t\t\t\tc += i * (n - i);\n\t\t\tConsole.WriteLine(c + n);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ChallengeButtons\n{\n public class Class1\n {\n private static Dictionary _factorialCache;\n\n public static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n\n _factorialCache = new Dictionary(n);\n\n var sum = 0;\n\n for (int i = 0; i < n; i++)\n {\n var choose = Choose(i, n);\n sum += choose;\n }\n\n Console.WriteLine(sum);\n }\n\n private static int Choose(int k, int n)\n {\n return Factorial(n) / (Factorial(n - k) * Factorial(k));\n }\n\n private static int Factorial(int n)\n {\n int factorial;\n if (!_factorialCache.TryGetValue(n, out factorial))\n {\n factorial = 1;\n\n for (int i = 1; i <= n; i++)\n {\n factorial *= i;\n }\n\n _factorialCache[n] = factorial;\n }\n\n return factorial;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _268B\n{\n static class Program\n {\n static void Main()\n {\n var s = short.Parse(Console.ReadLine());\n if (s == 1)\n {\n Console.WriteLine(1);\n }\n else\n {\n var r = s*(s - 1);\n if (s == 3)\n {\n ++r;\n }\n else if(s > 3)\n {\n r += (s - 2)*(s - 3);\n }\n Console.WriteLine(r);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _268B\n{\n static class Program\n {\n static void Main()\n {\n var s = short.Parse(Console.ReadLine());\n var r = (s * (s + 1)) / 2;\n if (s > 2)\n {\n r += ((s - 2) * (s - 1)) / 2;\n }\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _268B\n{\n\tclass Program\n\t{\n\t\tstatic void Main ( string [ ] args )\n\t\t{\n\t\t\tshort n = short.Parse( Console.ReadLine() ), pressed = 1, c = n;\n\t\t\twhile ( n - pressed > 0 )\n\t\t\t{\n\t\t\t\tc += (short) ( ( n - pressed - 1 ) * pressed + ( n - pressed ) );\n\t\t\t\t++pressed;\n\t\t\t}\n\t\t\tConsole.Write( c );\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int no =int.Parse( Console.ReadLine());\n if (no == 2)\n {\n Console.WriteLine(3);\n }\n else\n {\n Console.WriteLine(Math.Pow(2, no-1) + no);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int no =int.Parse( Console.ReadLine());\n \n Console.WriteLine(Math.Pow(2, no)-1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int no =int.Parse( Console.ReadLine());\n if (no == 2)\n {\n Console.WriteLine(3);\n }\n else\n {\n Console.WriteLine(Math.Pow(2, no) + no);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication237\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 2)\n {\n Console.WriteLine(3);\n return;\n }\n\n Console.WriteLine(n + (n - 1) * 2);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication237\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n == 2)\n {\n Console.WriteLine(3);\n return;\n }\n if (n==4)\n {\n Console.WriteLine(14);\n return;\n }\n\n Console.WriteLine(n + (n - 1) * 2);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), count = 0;\n count += n;\n for (int i = 1; n - i - 1 < 0; i++)\n {\n count += (n - i - 1) * (i + 1); \n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Buttons\n{\n\tprivate static void Main()\n\t{\n\t\tvar n = ReadInt();\n\t\t\n\t\tvar result = n + 1;\n\t\tfor (int i = 2; i <= n - 1; i++)\n\t\t{\n\t\t\tresult += (i - 1) + (n - i) * (i - 1) + 1;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(result);\n\t}\n\t\n\tprivate static int[] ReadIntArray()\n\t{\n\t\treturn Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t}\n\t\n\tprivate static int ReadInt()\n\t{\n\t\treturn int.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = n * (n + 1) / 2;\n if ((n - 1) * (n - 2) / 2 > 0)\n sum += (n - 1) * (n - 2) / 2;\n Console.WriteLine(sum);\n //1-1\n //2-3\n //3-7\n\n //n+1\n //n\n //\n\n //5\n\n\n //3+1\n //2\n //1\n\n //5+3\n //4+2\n //3+1\n //2\n //1\n\n\n //4(find 1) +1\n //1+2(find 2) +1\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long[] temp = new long[n];\n for (int i = 0; i < n; i++)\n temp[i] = n;\n long sum = 1 - n;\n for (int i = 0; i < n; i++)\n {\n sum += i;\n sum += temp[i];\n for (int j = i + 1; j < n; j++)\n temp[j]--;\n if (i != n - 1)\n {\n sum++;\n temp[i + 1]--;\n }\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 1; i <= n; i++)\n {\n if (i != n)\n sum = sum + n;\n else\n sum++;\n }\n Console.Write(sum);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class _268B_Buttons\n {\n static void Main()\n {\n int buttonsAmount = int.Parse(Console.ReadLine());\n long result = 1;\n\n for(int i = 1; i <= buttonsAmount; i++)\n {\n result *= i;\n }\n\n Console.WriteLine(result + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n a = Convert.ToInt32(Console.ReadLine());\n\n int hasil=0;\n int flag=a-2;\n int flag2 = 1;\n for (int i = 0; i < a; i++)\n {\n if (i == 0)\n {\n hasil += a;\n }\n else if (i == (a - 1))\n {\n hasil += a;\n }\n else if (i == (a - 2))\n {\n hasil += 1;\n }\n else\n {\n hasil += (a - i) + (flag * flag2);\n flag2++;\n flag--;\n \n }\n }\n Console.WriteLine(hasil);\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n\n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int sum = 0;\n for (int i = 1; i <= n; i++) sum += i * (n - i);\n WL(sum); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp74\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(GetFactorial(n)+1);\n }\n \n static long GetFactorial(int n)\n {\n long ans = 1;\n for (int i = 2; i <= n; i++)\n {\n ans *= i;\n }\n return ans;\n }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Buttons___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n int result = 1;\n\n for (int i = n; i > 1; i--)\n {\n result = result * i;\n }\n\n Console.WriteLine(result + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (x.c != y.c) return 1;\n\t\t\t\tif (x.r < y.r)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x)\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar n = int.Parse(s);\n\t\t\tvar ans = n;\n\t\t\tfor (var i = n - 1; i > 1; --i)\n\t\t\t{\n\t\t\t\tans = ans + (n - i + 1) * i;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n long res = 0;\n var c = 0;\n\n while (n>0)\n {\n res += n;\n n--;\n\n if (n > 0)\n {\n res += c;\n c++;\n }\n }\n\n Console.WriteLine(res);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ACM\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tint n = int.Parse(s[0]);\n\n\t\t\tConsole.WriteLine((n - 1) * (n - 1) + n);\n\n\t\t\t//Console.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int res = 0;\n for (int i = 1; i <= n; i++)\n res += i;\n res += n - 2;\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine(n+ n*(n+1)*n/2-n*(n+1)*(2*n+1)/6);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _268B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(((n+1)/2)*n+1);\n }\n }\n}\n"}, {"source_code": "using System;\nclass CFR164D2B\n{\n\tstatic void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tint res = 0;\n\t\tfor (int i = n; i > 0; i--)\n\t\t{\n\t\t\tres += i;\n\t\t\tif (i > 1) res += n - i;\n\t\t}\n\t\tConsole.WriteLine(res);\n\t}\n}"}], "src_uid": "6df251ac8bf27427a24bc23d64cb9884"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong count = Convert.ToUInt64(Console.ReadLine());\n ulong i = 0,\n round = 1;\n while (i < count)\n {\n i += 5 * round;\n round *= 2;\n }\n round /= 2;\n i -= 5 * round;\n for (ulong j = 0; j < 5; j++)\n {\n i += round;\n if (i >= count)\n {\n switch (j)\n {\n case 0:\n Console.Write(\"Sheldon\");\n break;\n case 1:\n Console.Write(\"Leonard\");\n break;\n case 2:\n Console.Write(\"Penny\");\n break;\n case 3:\n Console.Write(\"Rajesh\");\n break;\n case 4:\n Console.Write(\"Howard\");\n break;\n }\n break;\n }\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Double_Cola_82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var names = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long x = 5;\n long i = 1;\n long n = long.Parse(Console.ReadLine());\n bool first = true;\n while (n > x)\n {\n n -= x;\n x *= 2;\n i *= 2;\n }\n Console.WriteLine(names[(n - 1) / i]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForcesProject\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] names={\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine()) - 1;\n long ChangeSize = 5;\n while ( ChangeSize<=n)\n {\n n -= ChangeSize;\n ChangeSize *= 2;\n }\n ChangeSize /= 5;\n Console.WriteLine(names[n / ChangeSize]);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems\n{\n class A82_DoubleCola\n {\n public static void Main()\n {\n //while(true)\n //{\n var value = int.Parse(Console.ReadLine());\n int i = 0;\n var result = 0.0;\n while(true)\n {\n result += (5* Math.Pow(2, i));\n if (result >= value)\n break;\n \n i++;\n }\n result -= (5 * Math.Pow(2, i ));\n int j = 1;\n for( j=1;j<=5;j++)\n {\n result += Math.Pow(2, i);\n if (result >= value)\n break;\n }\n switch(j)\n {\n case 1: Console.WriteLine(\"Sheldon\");\n break;\n case 2: Console.WriteLine(\"Leonard\");\n break;\n case 3: Console.WriteLine(\"Penny\");\n break;\n case 4: Console.WriteLine(\"Rajesh\");\n break;\n case 5: Console.WriteLine(\"Howard\");\n break;\n \n }\n\n // }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Application\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int n = Convert.ToInt32 (Console.ReadLine());\n int i = 1;\n int range = 5;\n\n while (n > range) {\n i *= 2; \n range += 5 * i;\n }\n int j = 0;\n while (range >= n) {\n range -= i;\n j++;\n }\n\n string res = \"\";\n switch (5 - j + 1) {\n case 1:\n res = \"Sheldon\";\n break;\n case 2:\n res = \"Leonard\";\n break;\n case 3:\n res = \"Penny\";\n break;\n case 4:\n res = \"Rajesh\";\n break;\n case 5:\n res = \"Howard\";\n break;\n }\n\n Console.WriteLine (res);\n Console.ReadLine ();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces82A\n{\n class Program\n {\n private static readonly List Degress = new List\n {\n 0x1, 0x2, 0x4, 0x8, \n 0x10, 0x20, 0x40, 0x80,\n 0x100, 0x200, 0x400, 0x800, \n 0x1000, 0x2000, 0x4000, 0x8000,\n 0x10000, 0x20000, 0x40000, 0x80000, \n 0x100000, 0x200000, 0x400000, 0x800000,\n 0x1000000, 0x2000000, 0x4000000, 0x8000000, \n 0x10000000, 0x20000000, 0x40000000, 0x80000000,\n 0x100000000, 0x200000000, 0x400000000, 0x800000000\n };\n\n private static readonly List Names = new List {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n\n static Int64 SumUpTo(int degree)\n {\n Int64 sum = 0;\n\n for (int i = 0; i 5*SumUpTo(i))\n {\n i++;\n }\n\n var rest = n - 5*SumUpTo(i - 1);\n var countOfDoublesThisIteration = Degress[i - 1];\n Console.WriteLine(Names[(int)((rest-1)/countOfDoublesThisIteration)]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine())-1;\n String[] TBBT = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n while (n >= 5)\n n = (n - 5) / 2;\n Console.WriteLine(TBBT[n]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Reflection;\nusing System.Collections;\n\n\nnamespace program1\n{\n class Program1\n {\n string nextToken()\n {\n StringBuilder sb = new StringBuilder();\n int c;\n do\n {\n c = Console.Read();\n if (c == -1 || ((char)c != ' ' && (char)c != '\\n' && (char)c != '\\t' && (char)c != '\\t')) break;\n } while (true);\n if (c == -1)\n return \"\";\n while (true)\n {\n sb.Append((char)c);\n c = Console.Read();\n if (c == -1 || (char)c == ' ' || (char)c == '\\n' || (char)c == '\\t' || (char)c == '\\t') break;\n }\n return sb.ToString();\n }\n\n long nextLong() { return long.Parse(nextToken()); }\n int nextInt() { return int.Parse(nextToken()); }\n\n private string[] Peoples = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n\n void Solve()\n {\n int n = nextInt() - 1;\n\n int subqueue = 0;\n while (n>=5*Math.Pow(2, subqueue))\n {\n n -= Convert.ToInt32(5*Math.Pow(2, subqueue));\n subqueue++;\n }\n int people = n/Convert.ToInt32(Math.Pow(2, subqueue));\n\n Console.Write(Peoples[people]);\n }\n\n static void Main()\n {\n#if TEST\n string dir = Directory.GetParent(Directory.GetCurrentDirectory()).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n new Program1().Solve();\n\n#if TEST\n Console.In.Close();\n Console.Out.Close();\n#endif\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _2013._07._20\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n=int.Parse(Console.ReadLine());\n int k = 0;\n \n for (; true; k++)\n {\n if(5*((1<=n)\n \n break;\n }\n int st=5*((1< n)\n break;\n }\n string[] str = new string[5] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n Console.WriteLine(str[i - 1]);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n Console.WriteLine(f(n));\n \n //Console.ReadLine();\n }\n\n static long p(long a, long p)\n {\n long result = 1;\n for(long i=0;i= n)\n {\n switch(j)\n {\n case 0 :\n Console.WriteLine(\"Sheldon\");\n break;\n case 1:\n Console.WriteLine(\"Leonard\");\n break;\n case 2:\n Console.WriteLine(\"Penny\");\n break;\n case 3:\n Console.WriteLine(\"Rajesh\");\n break;\n case 4:\n Console.WriteLine(\"Howard\");\n break;\n\n }\n return;\n }\n }\n h *= 2;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Double_Cola\n{\n class Program\n {\n static string vratiIme(int n)\n {\n if (n == 1) return \"Sheldon\";\n else if (n == 2) return \"Leonard\";\n else if (n == 3) return \"Penny\";\n else if (n == 4) return \"Rajesh\";\n else return \"Howard\";\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Queue ko = new Queue();\n Queue koliko = new Queue();\n ko.Enqueue(1); koliko.Enqueue(1);\n ko.Enqueue(2); koliko.Enqueue(1);\n ko.Enqueue(3); koliko.Enqueue(1);\n ko.Enqueue(4); koliko.Enqueue(1);\n ko.Enqueue(5); koliko.Enqueue(1);\n while(true)\n {\n int trenutniKo = ko.Dequeue();\n int trenutniKoliko = koliko.Dequeue();\n if (n <= trenutniKoliko)\n {\n Console.WriteLine(vratiIme(trenutniKo));\n return;\n }\n else\n {\n n -= trenutniKoliko;\n ko.Enqueue(trenutniKo);\n koliko.Enqueue(2 * trenutniKoliko);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int n = int.Parse(Console.ReadLine());\n int k = names.Length;\n int g = (int)Math.Log(Math.Ceiling(1.0 * n / k), 2);\n int c = 1 << g;\n int i = (n + k - 1) / c - k;\n\n Console.WriteLine(names[i]);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()); // \u041d\u043e\u043c\u0435\u0440 \u0431\u0430\u043d\u043a\u0438\n string[] BBT = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int CountPeople = 0; // \u041a\u043e\u043b-\u0432\u043e \u043b\u044e\u0434\u0435\u0439\n int CountRepeat = 1; // \u041a\u043e\u043b-\u0432\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439\n int step = 0; // \u0448\u0430\u0433\n\n while (CountPeople < n) \n {\n CountPeople += CountRepeat;\n step++;\n if (step == 5) { CountRepeat *= 2; step = 0; }\n\n } \n\n if (step - 1 == -1) Console.WriteLine(BBT[4]);\n else\n Console.WriteLine(BBT[step - 1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var persons = new string[]\n {\n \"Sheldon\",\n \"Leonard\",\n \"Penny\",\n \"Rajesh\",\n \"Howard\"\n };\n\n Int64 n = Convert.ToInt64(Console.ReadLine());\n\n Int16 p = 0;\n \n while (true)\n {\n if ((CalcSum(p) >= n))\n {\n if (p>0 && n>5)\n {\n n -= CalcSum((UInt16)(p - 1)); \n }\n \n var idx = Convert.ToInt32(Math.Ceiling(n/Math.Pow(2, p)));\n Console.WriteLine(persons[idx-1]);\n \n break;\n }\n p++;\n }\n \n \n }\n\n static Int32 CalcSum(int p)\n {\n Int32 sum = 5;\n\n if (p == 0)\n return sum;\n \n for (var i=1; i<=p; i++)\n {\n sum += 5*Convert.ToInt32(Math.Pow(2, i));\n }\n\n return sum;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] a = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int[] b = { 1, 1, 1, 1, 1 };\n\n string otv = \"\";\n\n int p = 0;\n\n int u=0;\n\n while (u = a.Length) p = 0;\n int k = u;\n for (int i = 0; i < b[p]; i++)\n {\n otv = a[p];\n u++;\n if (u == n) break;\n\n }\n b[p] *= 2;\n p++;\n \n \n }\n Console.WriteLine(otv);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Double_Cola_82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine()), save = 0, id = 0; int gp = 1;\n while (id < n)\n {\n save = id;\n id = id + 5 * gp;\n gp = gp * 2;\n }\n long k = (id - save)/5;\n save = save + k;\n if (n <= save) Console.WriteLine(\"Sheldon\");\n else \n {\n save = save + k;\n if (n <= save) Console.WriteLine(\"Leonard\");\n else\n {\n save = save + k;\n if (n <= save) Console.WriteLine(\"Penny\");\n else\n {\n save = save + k;\n if (n <= save) Console.WriteLine(\"Rajesh\");\n else Console.WriteLine(\"Howard\");\n }\n }\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A82_DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] names = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int n = Convert.ToInt32(Console.ReadLine());\n int co = 1, turn = 0, bi=0;\n\n while (n > bi)\n {\n while (turn < names.Length)\n {\n bi = bi + co;\n if (n <= bi)\n {\n Console.Write(names[turn]);\n break; \n }\n turn = (turn + 1);\n }\n turn = 0;\n co = co * 2;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces82A__Double_Cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] str = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int i = 1;\n while(5*(Math.Pow(2, i)-1 ) 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Double_Cola\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next() - 1;\n\n for (long i = 1;; i *= 2)\n {\n if (5*(i - 1) > n)\n {\n i /= 2;\n long begin = 5*(i - 1);\n long delta = (n - begin)/i;\n\n switch (delta)\n {\n case 0:\n writer.WriteLine(\"Sheldon\");\n break;\n case 1:\n writer.WriteLine(\"Leonard\");\n break;\n case 2:\n writer.WriteLine(\"Penny\");\n break;\n case 3:\n writer.WriteLine(\"Rajesh\");\n break;\n case 4:\n writer.WriteLine(\"Howard\");\n break;\n }\n\n break;\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces_1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Task_82A task = new Task_82A();\n task.InitTask(Console.ReadLine().Trim());\n Console.WriteLine(task.Solve());\n }\n }\n\n class Task_82A\n {\n private string[] m_Names = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n private const int COUNT = 5, BASE = 2;\n\n private int m_Cola = 0;\n\n public void InitTask(string line)\n {\n m_Cola = Int32.Parse(line) - 1; // zero based number\n }\n\n public string Solve()\n {\n var cycles = (int)Math.Floor(Math.Log((double)m_Cola / COUNT + 1.0, BASE)); // \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0432\u043e\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u0445 \u0440\u0435\u0431\u044f\u0442.\n m_Cola = m_Cola - COUNT * ((int)Math.Pow(BASE, cycles) - 1) / (BASE - 1);\n return m_Names[m_Cola / (int)Math.Pow(BASE, cycles)];\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace ConsoleApplication4 {\n class Program {\n static void Main(string[] args) {\n\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine());\n\n long size = 5;\n long m = 0;\n\n long pow = 1;\n long i = 1;\n\n while (m < n) {\n m += size * pow;\n pow = pow << 1;\n ++i;\n }\n pow = pow >> 1;\n m -= size * pow;\n\n long index = (int) Math.Ceiling((n - m) / (double) pow) - 1;\n\n Console.Write(names[index]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n string[] ans = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int n = int.Parse(Console.ReadLine()) - 1;\n int x = (int)(Math.Log((double)(n) / 5 + 1) / Math.Log(2.0));\n n -= 5 * ((1 << x) - 1);\n int aux = (1 << x), ind = 0;\n while (n >= aux) {\n ind++;\n aux += (1 << x);\n }\n Console.WriteLine(ans[ind]);\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\nnamespace LearningCSharp\n{\n class _82A\n {\n\n static void Main(string [] args) {\n\n long a = Convert.ToInt64(Console.ReadLine());\n long temp = 5;int u = 1;\n Hashtable ht = new Hashtable();\n // \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" \n ht.Add(0,\"Sheldon\");\n ht.Add(1,\"Leonard\");\n ht.Add(2,\"Penny\");\n ht.Add(3,\"Rajesh\");\n ht.Add(4,\"Howard\");int kl = 0;int temp3 = 0;\n string[] ad = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n if (a <= 5) { Console.WriteLine(ad[a-1]); }\n\n else\n {\n for (;;)\n {\n \n for (long i = 0; i < 5; i++)\n {\n temp += u * 2;\n temp3 = u * 2;\n if (a <= temp) { Console.WriteLine(ad[i]);kl = 1;break; }\n\n }\n if (kl == 1) { break; }\n u=temp3;\n }\n }\n\n\n\n\n // Console.ReadKey();\n\n\n\n\n\n\n\n\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n Int32 num = Convert.ToInt32(number);\n\n int sum = 0;\n int k = 0;\n while (true)\n {\n sum += 5 << k;\n if (sum > num)\n break;\n k++;\n }\n int result = 0;\n\n if (k == 0)\n {\n result = num % 5;\n }\n else\n {\n int y = num - ((5 << k) - 5);\n\n int tmp = 5 << (k - 1);\n\n if (y % ( 1 << k ) == 0)\n {\n Console.WriteLine(\"Howard\");\n return;\n }\n else\n {\n result = (y / (1 << k) + 1)% 5;\n }\n }\n \n\n switch (result)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 0:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = new string[5] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n int sum = 0, cur, i;\n for (i = 1; true; i *= 2)\n {\n cur = sum + (5 * i);\n if (cur < n)\n {\n sum += (5 * i);\n }\n else break;\n }\n cur = n - sum;\n int j = cur / i;\n if(cur % i != 0)\n j ++;\n Console.WriteLine(names[j - 1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int k = 1;\n n--;\n for (int i = 5; i < n; i *= 2, k *= 2)\n {\n n -= i;\n }\n n /= k;\n n %= 5;\n switch (n)\n {\n case 0:\n Console.WriteLine(\"Sheldon\");\n break;\n case 1:\n Console.WriteLine(\"Leonard\");\n break;\n case 2:\n Console.WriteLine(\"Penny\");\n break;\n case 3:\n Console.WriteLine(\"Rajesh\");\n break;\n case 4:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] q = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n string input = Console.ReadLine();\n\n int n = int.Parse(input);\n\n int r = GetNormalizedIndex(n);\n Console.WriteLine(q[r]);\n\n }\n\n static int GetNormalizedIndex(int n)\n {\n int round = 1;\n\n int length = 5;\n int start = 1;\n\n while(n >= start + length)\n {\n round++;\n start += length;\n length += length;\n }\n\n n -= start;\n n /=length/5;\n\n return n;\n }\n\n \n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar n = int.Parse(Console.ReadLine()) - 1;\n\t\t\tvar q = (int)Math.Log(n / 5.0 + 1, 2);\n\t\t\tvar l = (int)Math.Pow(2, q);\n\t\t\tvar qc = 5 * (l - 1);\n\t\t\tvar r = n - qc;\n\t\t\tswitch (r / l)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tConsole.WriteLine(\"Sheldon\"); break;\n\t\t\t\tcase 1:\n\t\t\t\t\tConsole.WriteLine(\"Leonard\"); break;\n\t\t\t\tcase 2:\n\t\t\t\t\tConsole.WriteLine(\"Penny\"); break;\n\t\t\t\tcase 3:\n\t\t\t\t\tConsole.WriteLine(\"Rajesh\"); break;\n\t\t\t\tcase 4:\n\t\t\t\t\tConsole.WriteLine(\"Howard\"); break;\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = n, a = 5, i = -1;\n int[] afrad = new int[5] { 1 , 1 , 1 , 1 , 1 } ;\n\n while (n > 0)\n {\n n = n - a;\n a = a * 2;\n i++;\n }\n\n n += (a / 2);\n string g = ((n-1) / (Math.Pow(2, i))).ToString();\n\n if (g[0] == '0')\n {\n Console.WriteLine(\"Sheldon\");\n }\n if (g[0] == '1')\n {\n Console.WriteLine(\"Leonard\");\n }\n if (g[0] == '2')\n {\n Console.WriteLine(\"Penny\");\n }\n if (g[0] == '3')\n {\n Console.WriteLine(\"Rajesh\");\n }\n if (g[0] == '4')\n {\n Console.WriteLine(\"Howard\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ChallengeDoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine()) ;\n\n var queue = new[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n\n var ceiling = Math.Ceiling(n / 5d) + 1;\n var log = Math.Ceiling(Math.Log10(ceiling) / Math.Log10(2));\n var nearestBorder = 5 * (Math.Pow(2, log - 1) - 1);\n var value = Math.Ceiling((n - nearestBorder) / Math.Pow(2, log - 1));\n// for (int i = 0; i < 158; i++)\n// {\n// n = i;\n// var ceiling = Math.Ceiling(n / 5d) + 1;\n// var log = Math.Ceiling(Math.Log10(ceiling) / Math.Log10(2));\n// var nearestBorder = 5 * (Math.Pow(2, log - 1) - 1);\n// var value = Math.Ceiling((n - nearestBorder) / Math.Pow(2,log-1));\n// Console.WriteLine(i+\": \"+ value);\n// }\n//\n\n\n Console.WriteLine(queue[(int) (value-1)]);\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var p=new[]{\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n var n=read().ToInt();\n var i=1;\n while(true)\n {\n if(n<=i*5)\n {\n write(p[(n-1)/i]);\n return;\n }\n n-=i*5;\n i*=2;\n }\n }\n}\n\n\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int index = int.Parse(Console.ReadLine());\n\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n while (index > 5)\n {\n index = index / 2 - 2;\n }\n\n Console.WriteLine(names[index - 1]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Coke_Machine\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] line = { 1, 1, 1, 1, 1 };\n int c = 0;\n int count = 0;\n while (true)\n {\n int temp = 0;\n if (c == 5)\n c = 0;\n for (int i = 1; i <= (line[c]); i++)\n {\n count++;\n temp++;\n if (count == n)\n {\n mannum(c);\n return;\n }\n }\n line[c] += temp;\n c++;\n }\n }\n\n static void mannum(int c)\n {\n switch(c)\n {\n case 0:\n Console.WriteLine(\"Sheldon\");\n break;\n case 1:\n Console.WriteLine(\"Leonard\");\n break;\n case 2:\n Console.WriteLine(\"Penny\");\n break;\n case 3:\n Console.WriteLine(\"Rajesh\");\n break;\n case 4:\n Console.WriteLine(\"Howard\");\n break; \n }\n return;\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _82A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main ( string[] args )\n\t\t{\n\t\t\tint n;\n\t\t\tint.TryParse ( Console.ReadLine ( ) , out n );\n\t\t\tDictionary a = new Dictionary ( )\n\t\t\t{\n\t\t\t\t{\"Sheldon\", 1},\n\t\t\t\t{\"Leonard\", 1},\n\t\t\t\t{\"Penny\", 1},\n\t\t\t\t{\"Rajesh\", 1},\n\t\t\t\t{\"Howard\", 1}\n\t\t\t};\n\n\t\t\tstring[] keys = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n\t\t\twhile ( true )\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < 5; ++i)\n\t\t\t\t{\n\t\t\t\t\tif ( n - a [ keys[i] ] <= 0 )\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write ( keys[i] );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tn -= a [ keys[i] ];\n\t\t\t\t\ta [ keys[i] ] *= 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n String [] answer = new String[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int now=5;\n int n,k=0,st=1;\n n = int.Parse(Console.ReadLine());\n while(n>now){\n n-=now;\n now*=2;\n st*=2;\n ++k;\n }\n Console.Write(answer[(n-1)/st]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int count = 5;\n int sum = 5;\n\n\n while (sum < input)\n {\n\n count = count * 2;\n sum += count;\n }\n\n\n //Console.WriteLine(Math(input - (sum - count), count / 5));\n Console.WriteLine(names[Math(input - (sum - count), count / 5) - 1]);\n }\n\n static int Math(int a, int b)\n {\n if ((a % b) > 0)\n return a / b + 1;\n else\n return a / b;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int i = 0;\n int mnogit = 1;\n while (n > 0)\n {\n i++;\n n = n - mnogit;\n if (i == 5)\n {\n mnogit = mnogit * 2;\n if (n > 0)\n i = 0;\n }\n }\n\n\n switch (i)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 5:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication19\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int x = n;\n for (int i = 1; x > 0; i+=i)\n {\n if (x - i > 0)\n x -= i;\n else\n {\n Console.WriteLine(\"Sheldon\");\n break;\n }\n if (x - i > 0)\n x -= i;\n else\n {\n Console.WriteLine(\"Leonard\");\n break;\n }\n if (x - i > 0)\n x -= i;\n else\n {\n Console.WriteLine(\"Penny\");\n break;\n }\n if (x - i > 0)\n x -= i;\n else\n {\n Console.WriteLine(\"Rajesh\");\n break;\n }\n if (x - i > 0)\n x -= i;\n else\n {\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static void _158a()\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n int[] points = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int kth = points[k-1];\n Console.WriteLine(points.Count(x => x > 0 && x >= kth));\n }\n static void _71a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] words=new string[n];\n for (int i = 0; i < n; i++)\n {\n words[i] = Console.ReadLine();\n }\n for (int i = 0; i < n; i++)\n {\n if (words[i].Length > 10)\n {\n //Console.WriteLine(words[i][0] + (words[i].Length - 2) + words[i].Last());\n Console.Write(words[i][0]);\n Console.Write(words[i].Length - 2);\n Console.Write(words[i].Last());\n Console.WriteLine();\n }\n else\n Console.WriteLine(words[i]);\n }\n }\n static void _118a()\n {\n string input = Console.ReadLine();\n input=input.ToLower();\n char[] vowels=new[] { 'a', 'o', 'y', 'e', 'u', 'i' };\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < input.Length; i++)\n if (!vowels.Contains(input[i]))\n sb.Append(\".\" + input[i]);\n Console.WriteLine(sb.ToString()); \n }\n static void _158b()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0; \n string s = Console.ReadLine();\n int _1,_2,_3,_4;\n _1 = _2 = _3 = _4 = 0;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case '1': _1++;\n break;\n case '2': _2++;\n break;\n case '3': _3++;\n break;\n case '4': _4++;\n break;\n }\n }\n count = _4;\n int min = Math.Min(_1, _3);\n _1 -= min; _3 -= min;\n count += min;\n count += _3;\n int d2 = _2 / 2;\n count += d2;\n _2 -= d2*2;\n if (_2 == 0)\n {\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n else\n {\n count++;\n _1 -= 2;\n if (_1 > 0)\n count += (int)Math.Ceiling((double)_1 / 4);\n }\n Console.WriteLine(count);\n }\n static void _50a()\n {\n string[] ss = Console.ReadLine().Split();\n int m = int.Parse(ss[0]);\n int n = int.Parse(ss[1]);\n int f = 0, s = 0;\n f = m / 2 * n;\n s = n / 2 * m;\n bool first = f > s;\n if (first)\n {//gor\n if (m % 2 == 1)\n f += n / 2;\n }\n else\n { //ver\n if (n % 2 == 1)\n s += m / 2;\n }\n Console.WriteLine(first ? f : s);\n }\n static void _116a()\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0, curr = 0;\n for (int i = 0; i < n; i++)\n {\n string[] ss = Console.ReadLine().Split();\n int f = int.Parse(ss[0]);\n int s = int.Parse(ss[1]);\n curr += - f + s;\n if (curr > count)\n count = curr;\n }\n Console.WriteLine(count);\n }\n static void _82a()\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int gr = 1, end = 5;\n while (end < n)\n {\n gr++;\n end = (int)(5 * (-1 + Math.Pow(2, gr))); \n }\n int need = 4;\n int minus = (int)Math.Pow(2, gr - 1);\n end -= minus;\n while (end >= n)\n {\n minus = (int)Math.Pow(2, gr - 1);\n end-=minus;\n need--;\n }\n Console.WriteLine(names[need]);\n }\n\n static void Main(string[] args)\n {\n _82a();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n var names = new[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n var n = int.Parse(Console.ReadLine());\n\n var row = 1;\n var curValue = 0;\n while (true)\n {\n curValue += ((int) Math.Pow(2, row - 1))*5;\n\n if (curValue >= n)\n break;\n\n row++;\n }\n\n var bPo = 0;\n\n if (row != 1)\n {\n n = n - (curValue - 5 * (int)Math.Pow(2, row - 1));\n bPo = (int)Math.Pow(2, row - 1);\n\n }\n else\n {\n bPo = 1;\n }\n\n for (int i = 1; i <= 5; i++)\n {\n if(i*bPo < n)\n continue;\n \n Console.WriteLine(names[i-1]);\n return;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Fffuuuu {\n\tpublic static void Main() {\n\t\tInt32 n = Int32.Parse(Console.ReadLine()), i;\n\t\tInt32[] vals = new Int32[] { 1, 1, 1, 1, 1 };\n\t\tString[] names = new String[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\t\tfor (i = 0; ; i = (i + 1) % 5) {\n\t\t\tif ((n -= vals[i]) <= 0) {\n\t\t\t\tConsole.WriteLine(names[i]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvals[i] *= 2;\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n static void Z131A ()\n {\n bool caps=true;\n string str=Console.ReadLine();\n char first=str[0];\n for (int i = 1; i < str.Length; i++) {\n if(str[i]<'A'||str[i]>'Z')\n caps=false;\n }\n if (caps) {\n str=str.ToLower();\n if(first>='a'&&first<='z')\n first=first.ToString().ToUpper()[0];\n else\n first=first.ToString().ToLower()[0];\n str=first+str.Substring(1);\n\n }\n Console.WriteLine(str);\n }\n static void Z96A ()\n {\n string str=Console.ReadLine();\n int n=0;\n char ch='w';\n for (int i = 0; i < str.Length; i++) {\n if(ch==str[i])\n n++;\n else\n {\n if(n>=7)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n ch=str[i];\n n=1;\n }\n }\n if(n<7)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n }\n static void Z266A ()\n {\n \n string str=Console.ReadLine();\n str=Console.ReadLine();\n int n=0;\n int m=0;\n char ch=' ';\n for (int i = 0; i < str.Length; i++) {\n if(ch==str[i])\n n++;\n else\n {\n m+=n;\n ch=str[i];\n n=0;\n }\n }\n m+=n;\n Console.WriteLine(m);\n }\n static void Z133A ()\n {\n string str=Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if(str[i]=='H'||str[i]=='Q'||str[i]=='9')\n {\n\n Console.WriteLine(\"YES\");\n return;\n }\n\n }\n Console.WriteLine(\"NO\");\n \n \n }\n static void Z112A ()\n {\n string str1=Console.ReadLine();\n str1=str1.ToLower();\n string str2=Console.ReadLine();\n str2=str2.ToLower();\n int n=String.Compare(str1,str2);\n if(n!=0)\n Console.WriteLine(n/Math.Abs(n));\n else\n Console.WriteLine(0);\n }\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag=false;\n while (j<3) {\n ch[j]--;\n \n if(ch[j]>=0)\n {\n if(flag)\n {\n Console.Write(\"+\");\n }\n else\n flag=true;\n Console.Write(j+1);\n }\n else\n j++;\n }\n }\n static void Z281A ()\n {\n string str=Console.ReadLine();\n string f=str[0].ToString();\n f=f.ToUpper();\n str=f[0]+str.Substring(1);\n Console.Write(str);\n }\n static void Z82A ()\n {\n string[] names=new string[5];\n names[0]=\"Sheldon\";\n names[1]=\"Leonard\";\n names[2]=\"Penny\";\n names[3]=\"Rajesh\";\n names[4]=\"Howard\";\n int n=Int32.Parse(Console.ReadLine());\n int m=5;\n while (m= step)\n {\n n -= step;\n step *= 2;\n }\n step = step / 5;\n Console.Write(names[n/step]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\npublic class Program\n{\n\n public class Scanner\n {\n private int index;\n private string[] strings;\n\n public Scanner()\n {\n index = 0;\n strings = new string[0];\n }\n\n public int nextInt()\n {\n return int.Parse(nextString());\n }\n\n public double nextDouble()\n {\n return double.Parse(nextString());\n }\n public string NextLine()\n {\n return Console.ReadLine();\n }\n public string nextString()\n {\n if (index >= strings.Length)\n {\n index = 0;\n strings = NextLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n return strings[index++];\n }\n\n }\n\n\n public static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n string[] names = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = sc.nextInt();\n if (n < 6)\n {\n Console.WriteLine(names[n-1]);\n return;\n }\n long k = 1;\n long pos = 1;\n while (pos <= n)\n {\n pos = pos + k * 5;\n k = k * 2;\n }\n k /= 2;\n pos = pos - k * 5;\n Console.WriteLine(names[(n - pos)/k]);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] guys = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int size = guys.Length;\n if (n <= size)\n {\n Console.WriteLine(guys[n - 1]);\n }\n else\n {\n int tmp = 0, a = 5, i = 0;\n while(tmp <= n){\n tmp += a;\n a *= 2;\n }\n tmp -= a / 2;\n int cur = 0;\n while(tmp != n)\n {\n cur++; tmp++;\n }\n Console.WriteLine(guys[cur/(a/10)]);\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double a = 0;\n double b = 0;\n string c = \"\";\n bool d = true;\n double i = 1;\n double n = double.Parse(Console.ReadLine());\n while( d == true)\n {\n a += i * 5;\n if (a >= n)\n {\n b = (n - (a-i*5));\n if (b / i <= 1 && b / i > 0)\n c = \"Sheldon\";\n else if (b / i <= 2 && b / i > 1)\n c = \"Leonard\";\n else if (b / i <= 3 && b / i > 2)\n c = \"Penny\";\n else if (b / i <= 4 && b / i > 3)\n c = \"Rajesh\";\n else if (b / i <= 5 && b / i > 4)\n c = \"Howard\";\n d = false;\n }\n i = i*2;\n }\n\n Console.WriteLine(c);\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem82A {\n class Program {\n static void Main(string[] args) {\n double nThCan = Convert.ToDouble(Console.ReadLine());\n double power = 0;\n\n while (true) {\n double tuple = 5 * Math.Pow(2, power);\n if (nThCan - tuple > 0) {\n nThCan -= tuple;\n power++;\n } else {\n break;\n }\n }\n\n double tuple1 = Math.Pow(2, power);\n //int person = Convert.ToInt32(nThCan / tuple1);\n if (nThCan > 0 && nThCan <= tuple1) {\n Console.WriteLine(\"Sheldon\");\n } else if (nThCan > 0 && nThCan <= 2 * tuple1) {\n Console.WriteLine(\"Leonard\");\n } else if (nThCan > 0 && nThCan <= 3 * tuple1) {\n Console.WriteLine(\"Penny\");\n } else if (nThCan > 0 && nThCan <= 4 * tuple1) {\n Console.WriteLine(\"Rajesh\");\n } else if (nThCan == 0 || nThCan <= 5 * tuple1) {\n Console.WriteLine(\"Howard\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar n = Convert.ToInt32(Console.ReadLine());\n\t\tdouble c = 0;\n\t\tdouble t = 1.0;\n\t\twhile (c + t * 5 < n) \n\t\t{\n\t\t\tc += t * 5;\n\t\t\tt *= 2;\n\t\t}\n\t\tvar r = Math.Ceiling((n-c) / t );\n\t\tswitch((int)r)\n\t\t{\n\t\t\tcase 5: Console.WriteLine(\"Howard\"); break;\n\t\t\tcase 4: Console.WriteLine(\"Rajesh\"); break;\n\t\t\tcase 3: Console.WriteLine(\"Penny\"); break;\n\t\t\tcase 2: Console.WriteLine(\"Leonard\"); break;\n\t\t\tcase 1: Console.WriteLine(\"Sheldon\"); break;\n\t\t\tdefault: Console.WriteLine(r); break;\n\t\t}\n\n\t\t\n\t}\n\t\n\t\n\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\n\nnamespace Test1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\t\n\t\t\tint num = int.Parse (Console.ReadLine ());\n\t\t\tstring[] str = new string[] {\n\t\t\t\t\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n\t\t\t};\n\t\t\tint cur = 5, n = 0, e = 1, k = 0, l = 0, p = 0;\n\t\t\twhile (num > cur) {\n\t\t\t\tk = 5 * e;\n\t\t\t\tcur = k + n;\n\t\t\t\tif (num > cur) {\n\t\t\t\t\tn = cur;\n\t\t\t\t\te *= 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tl = n + e;\n\t\t\twhile (num > l) {\n\t\t\t\tl +=e;\n\t\t\t\tn = l;\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tConsole.Write (str [p]);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // name list\n List lNames = new List\n {\n \"Sheldon\",\n \"Leonard\",\n \"Penny\",\n \"Rajesh\",\n \"Howard\"\n };\n\n // the nth can\n int n = int.Parse(Console.ReadLine());\n\n int a = 0;\n int s = lNames.Count;\n int pa = 0;\n for (int i = 1; ; ++i)\n {\n a += s;\n if (n > a)\n {\n pa = a;\n s += s;\n continue;\n }\n\n int ind = (n - pa - 1) / Convert.ToInt32(Math.Round(Math.Pow(2.0, i - 1)));\n\n // display results\n Console.WriteLine(\"{0}\", lNames[ind]);\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = Convert.ToInt32(Console.ReadLine());\n int i = 0;\n string[] s = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n while (N > Math.Pow(2, i) * 5)\n {\n N -= (int)Math.Pow(2, i) * 5;\n i++;\n }\n N = (int)Math.Ceiling(N/(Math.Pow(2, i)));\n Console.WriteLine(s[N-1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace CodeForce\n{\n using System.Threading;\n\n class Program\n {\n static void Main(string[] args)\n {\n string[] person = new[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int input = int.Parse(Console.ReadLine());\n //Console.WriteLine(Simulator(input));\n \n \n \n Console.WriteLine(person[Simulator(input)-1]);\n\n //Console.WriteLine(Simulator(1802));\n\n //for (int i = 1; i <= 40; i++)\n //{\n // Console.WriteLine(\"{0} --> {1}\", i, Simulator(i));\n // //Console.WriteLine((i + 1) + \": \" + person[Simulator(i)]);\n //}\n }\n\n static int Simulator(int target)\n {\n int basis = 5;\n int index = 1;\n int adder = 1;\n int multiplyCount = 1;\n\n while (true)\n {\n if (index > target)\n {\n if (multiplyCount == 1)\n return basis;\n\n return multiplyCount - 1;\n }\n\n if (index == target)\n return multiplyCount;\n\n index += adder;\n if (multiplyCount == basis)\n {\n multiplyCount = 1;\n adder *= 2;\n //Console.WriteLine(\"---\");\n }\n else\n multiplyCount += 1;\n }\n }\n\n static void xMain()\n {\n Queue queue = new Queue();\n queue.Enqueue(\"A\");\n queue.Enqueue(\"B\");\n queue.Enqueue(\"C\");\n\n // STEP\n // Kalau sama = huruf n penambah terakhir\n // Kalau lebih besar = huruf penambah terakhir - 1\n // Kalau lebih kecil = tambah terus\n // A B C\n // +1 +1 +1\n // A B C\n // +2 +2 +2\n // +3 +3 +3\n\n //queue.Enqueue(\"D\");\n //queue.Enqueue(\"E\");\n\n // 3 + 6 \n Console.WriteLine(SimulateQueue(queue, 21));\n }\n\n static string SimulateQueue(Queue queue, int n)\n {\n string match = String.Empty;\n for (int i = 0; i < n; i++)\n {\n queue.PrintQueue(i + 1);\n \n\n var now = queue.Dequeue();\n queue.Enqueue(now);\n queue.Enqueue(now);\n\n match = now;\n }\n\n return match;\n }\n }\n\n public static class QueueHelper\n {\n public static void PrintQueue(this Queue queue, int num)\n {\n var qs = queue.ToArray();\n\n foreach (var el in qs)\n Console.Write(el);\n\n Console.WriteLine(\" \" + num);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] persons = new string[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n string output = \"\";\n\n //12345112233445511112222333344445555\n // 1x5 2x5 4x5 8x5 16x5\n int sum = 0;\n int round = 1;\n while (sum < n)\n {\n sum = sum + round * 5;\n round *= 2;\n }\n sum = sum - (round/2) * 5;\n int loc = 0;\n round /= 2;\n while (sum < n)\n {\n sum = sum + round;\n loc++;\n }\n output = persons[loc-1];\n Console.WriteLine(output);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long cur = 0;\n long x = 0;\n while (cur= n) break;\n }\n switch (i)\n {\n case 1: Console.WriteLine(\"Sheldon\");\n break;\n case 2: Console.WriteLine(\"Leonard\");\n break;\n case 3: Console.WriteLine(\"Penny\");\n break;\n case 4: Console.WriteLine(\"Rajesh\");\n break;\n case 5: Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Double_Cola\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n int NumberInQueue = Convert.ToInt32(Console.ReadLine());\n\n int Rank = 5;\n int Rank_count = 1;\n int Position = 0;\n string Result = \"\";\n\n while (Rank < NumberInQueue)\n {\n\t\t\t\tRank_count = Rank_count * 2;\n Rank = Rank + (5 * Rank_count);\n }\n Position = Rank - NumberInQueue;\n\n Position = Rank_count * 5 - Position;\n\n if (Position <= Rank_count) Result = \"Sheldon\";\n else\n {\n if (Position <= Rank_count * 2) Result = \"Leonard\";\n else\n {\n\t\t\t\t\tif (Position <= Rank_count * 3) Result = \"Penny\";\n else\n {\n\t\t\t\t\t\tif (Position <= Rank_count * 4) Result = \"Rajesh\";\n else\n {\n\t\t\t\t\t\t\tif (Position <= Rank_count * 5) Result = \"Howard\";\n }\n }\n }\n }\n Console.WriteLine(Result);\n // A, B, C, D, E, A, A, B, B, C, C, D, D, E, E, A, A, A, A, B, B, B, B, C, C, C, C, D, D, D, D, E, E, E, E\n\t\t\t// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35\n\t\t\t// 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\n\t\t}\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace TeatherSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n n--;\n while(n > 4)\n { \n n-=5;\n n/=2;\n }\n switch (n)\n {\n case 0:\n {\n Console.WriteLine(\"Sheldon\");\n break;\n }\n case 1:\n {\n Console.WriteLine(\"Leonard\");\n break;\n }\n case 2:\n {\n Console.WriteLine(\"Penny\");\n break;\n }\n case 3:\n {\n Console.WriteLine(\"Rajesh\");\n break;\n }\n case 4:\n {\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n Console.ReadLine();\n\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static string NameWithIndex(ulong index)\n {\n switch (index)\n {\n case 0:\n return \"Sheldon\";\n case 1:\n return \"Leonard\";\n case 2:\n return \"Penny\";\n case 3:\n return \"Rajesh\";\n default:\n return \"Howard\";\n }\n }\n static void Main(string[] args)\n {\n ulong n = Convert.ToUInt64(Console.ReadLine()) - 1;\n for (ulong i = 0; ; i++)\n {\n ulong pow = (ulong)Math.Pow(2, i);\n if (n < 5 * pow)\n {\n //get name\n ulong index = n / pow;\n Console.WriteLine(NameWithIndex(index));\n return;\n }\n else\n {\n n -= pow * 5;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Problem{\n static void Main(string[] args){\n \n int n = int.Parse(Console.ReadLine());\n string[] names = new string[5];\n names[0] = \"Sheldon\";\n names[1] = \"Leonard\";\n names[2] = \"Penny\";\n names[3] = \"Rajesh\";\n names[4] = \"Howard\";\n \n int colasdrunk = 1;\n int lastperson = 0;\n int increment = 1;\n while(colasdrunk < n){\n if(lastperson == 4){\n increment = increment * 2;\n }\n colasdrunk = colasdrunk + increment;\n lastperson = (lastperson+1)%5;\n }\n Console.WriteLine(names[lastperson]);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _82A\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int d = 1;\n\n while (n > 5 * d)\n {\n n -= 5 * d;\n d *= 2;\n }\n\n switch ((n - 1) / d)\n {\n case 0:\n Console.WriteLine(\"Sheldon\");\n break;\n case 1:\n Console.WriteLine(\"Leonard\");\n break;\n case 2:\n Console.WriteLine(\"Penny\");\n break;\n case 3:\n Console.WriteLine(\"Rajesh\");\n break;\n case 4:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ProblemsCodeforce\n{\n class _82A\n {\n static void Main(string[] args)\n {\n var k = Int32.Parse(Console.ReadLine());\n int result = 0;\n // for (k = 16; k <= 100; k++)\n //{\n int n = (int)(Math.Log(k / 5 + 1, 2));\n int r = k - 5 * ((1 << n) - 1);\n result =(int)(1.0 * r / (1 << n) + .9999999);\n switch (result)\n {\n case 1:\n Console.Write(\"Sheldon\");\n break;\n case 2:\n Console.Write(\"Leonard\");\n break;\n case 3:\n Console.Write(\"Penny\");\n break;\n case 4:\n Console.Write(\"Rajesh\");\n break;\n case 0:\n case 5:\n Console.Write(\"Howard\");\n break;\n //default: \n // Console.WriteLine(\"k=\" + k);\n // break;\n //}\n //Console.Write(\" \");\n }\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tstring[] Name = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\t\t\n\n\n\t\t\t/*List New = new List ();\n\t\t\tfor (int i = 0; i < 5; i++)\n\t\t\t\tNew.Add (i);\n\n\t\t\tfor (int i = 1; i < 150; i++) {\n\n\t\t\t\tConsole.WriteLine (\"\\n \" + i + \" \" + Name [New [0]]);\n\n\t\t\t\tfor (int j = 0; j < 2; j++)\n\t\t\t\t\tNew.Add (New [0]);\n\n\t\t\t\tNew.RemoveAt(0);\n\n\t\t\t}*/\n\n\n\n\t\t\tuint N = uint.Parse (Console.ReadLine ());\n\t\t\tuint Last = N, Temp = 1, Now = 0;\n\n\t\t\tif (Last > 5) {\n\n\t\t\t\tfor (uint i = 5; i < N; i += 5 * Temp) {\n\t\t\t\t\tLast = i;\n\t\t\t\t\tTemp *= 2;\n\t\t\t\t}\n\n\t\t\t\tfor (Now = 1; Last + Now * Temp < N; Now++) {\n\n\t\t\t\t}\n\t\t\t\tLast = Now;\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Name [Last - 1]);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication3\n{\n internal class Program\n {\n private static void Main()\n {\n var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var i = input[0] -1;\n\n var d = 1L;\n \n var xP = 0L;\n var x = 0L;\n while (x <= i)\n {\n xP = x;\n x += d * 5;\n d *= 2;\n }\n var names = new[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n Console.WriteLine(names[(i - xP) / (d/2)]);\n }\n }\n}\n"}, {"source_code": "using System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Text.RegularExpressions;\n\nnamespace Dictionary\n{\n class Program\n {\n enum names { Sheldon = 1, Leonard, Penny, Rajesh, Howard }\n static void Main(string[] args)\n {\n int count = 5;\n long n = long.Parse(Console.ReadLine());\n long k = 1;\n for (; ; )\n {\n if (n > count * k) { n -= count * k; k <<= 1; continue; }\n long need;\n long res = Math.DivRem(n, k, out need);\n res = need == 0 ? res : res + 1;\n Console.WriteLine((names)res);\n break;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n var n = int.Parse(Console.ReadLine()) - 1;\n while (n >= 5)\n {\n n -= 5;\n n /= 2;\n }\n Console.WriteLine(names[n]);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n double n;\n n = double.Parse(Console.ReadLine());\n if (n > 5)\n {\n int a = 5, i = 1, c = 1;\n while (n - a > 0)\n {\n n -= a;\n a += a;\n i *= 2;\n }\n while (n > i)\n {\n n -= i;\n c++;\n }\n n = c;\n }\n \n if (n == 1)\n Console.WriteLine(\"Sheldon\");\n if (n == 2)\n Console.WriteLine(\"Leonard\");\n if (n == 3)\n Console.WriteLine(\"Penny\");\n if (n == 4)\n Console.WriteLine(\"Rajesh\");\n if (n == 5)\n Console.WriteLine(\"Howard\"); \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, r, s = 0;\n int i = 0;\n\n n = int.Parse(Console.ReadLine());\n while (n > s)\n s += 5 * (int)Math.Pow(2, i++);\n s -= 5 * (int)Math.Pow(2, --i);\n r = (n - s + (int)Math.Pow(2, i) - 1) / (int)Math.Pow(2, i);\n switch (r)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 5:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tDoubleCola();\n\t\t}\n\t\tstatic void DoubleCola(){\n\t\t\tstring[] names = {\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n\t\t\tint n = int.Parse(Console.ReadLine())-1;\n\t\t\twhile ( n>= 5 ) n = (n-5) /2;\n\t\t\tConsole.WriteLine(names[n]);\t\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace com.codeforces._82\n{\n public static class A\n {\n static void solve()\n {\n int n = RI();\n\n int[] array = { 1, 1, 1, 1, 1 };\n int i = 0;\n for (; ; )\n {\n if (n <= array[i])\n {\n break;\n }\n\n n -= array[i];\n array[i] *= 2;\n \n i++;\n if (i > 4)\n {\n i = 0;\n }\n }\n\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n Console.Write(names[i]);\n }\n\n public static void Main()\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(\"input.txt\"));\n System.IO.StreamWriter fout = new System.IO.StreamWriter(\"output.txt\");\n Console.SetOut(fout);\n#endif\n solve();\n#if !ONLINE_JUDGE\n fout.Flush();\n fout.Close();\n#endif\n }\n\n public static int RI()\n {\n int c;\n do\n {\n c = Console.Read();\n }\n while (c < '0' || c > '9');\n\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = Console.Read();\n }\n\n int value = 0;\n do\n {\n value = value * 10 + c - '0';\n c = Console.Read();\n }\n while (c >= '0' && c <= '9');\n\n return value * sign;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nclass Program\n{\n static void p(object value)\n {\n Console.WriteLine(value.ToString());\n }\n\n static string gets()\n {\n return Console.ReadLine();\n }\n \n static void Main(string[] args)\n { \n long n = int.Parse(gets());\n \n \n long l = 1;\n long r = 5;\n \n long up = 5;\n \n while (r < n) {\n up = up * 2;\n l = r + 1;\n r = r + up; \n }\n \n // p(l + \" \" + r);\n \n long dif = n - l;\n \n long people = dif / (up / 5);\n \n if (people == 0) {\n p(\"Sheldon\");\n }\n if (people == 1) {\n p(\"Leonard\");\n }\n if (people == 2) {\n p(\"Penny\");\n }\n if (people == 3) {\n p(\"Rajesh\");\n }\n if (people == 4) {\n p(\"Howard\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _82A_Doble_Cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int i = 0;\n int k = 1, s = 1;\n while ((-5 * (1 - Math.Pow(2, i))) < n)\n { i++;\n } \n while (((-5 * (1 - Math.Pow(2, (i-1))))+ Math.Pow(2, (i - 1))*k) 5.0 * Math.Pow(2.0, gen))\n {\n rem-=(5.0 * Math.Pow(2.0, gen));\n gen++;\n }\n int i = (int)Math.Ceiling(rem/(Math.Pow(2.0, gen)));\n System.Console.WriteLine(names[i]);\n }\n\n \n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Double_Cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int k1 = 0, k2 = 0, i;\n\n for (i = 0; i < 30; i++)\n {\n k1 = k2;\n k2 += (int)Math.Pow(2, i) * 5;\n\n //Console.Write(\"k1 = \"+k1+\" k2 = \"+k2);\n\n if (n > k1 & n <= k2)\n {\n n = (n - k1 - 1) / (int)Math.Pow(2, i);\n break;\n }\n }\n\n switch (n)\n {\n case 0: Console.WriteLine(\"Sheldon\"); break;\n case 1: Console.WriteLine(\"Leonard\"); break;\n case 2: Console.WriteLine(\"Penny\"); break;\n case 3: Console.WriteLine(\"Rajesh\"); break;\n case 4: Console.WriteLine(\"Howard\"); break;\n }\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string[] name = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine());\n char who = 's';\n long i = n;\n long how = 1;\n while (i > 0)\n {\n i = i - how;\n who = 's';\n if (i <= 0) break;\n i = i - how;\n who = 'l';\n if (i <= 0) break;\n i = i - how;\n who = 'p';\n if (i <= 0) break;\n i = i - how;\n who = 'r';\n if (i <= 0) break;\n i = i - how;\n who = 'h';\n how = how * 2;\n if (i <= 0) break;\n }\n switch (who)\n {\n case 's':\n Console.WriteLine(name[0]);\n break;\n case 'l':\n Console.WriteLine(name[1]);\n break;\n case 'p':\n Console.WriteLine(name[2]);\n break;\n case 'r':\n Console.WriteLine(name[3]);\n break;\n case 'h':\n Console.WriteLine(name[4]);\n break;\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int x = (int)Math.Truncate( Math.Log(n/5+1,2) );\n int temp = 5 * (int)(Math.Pow(2, x) - 1);\n int res = 1;\n while (temp < n)\n {\n temp += (int)(Math.Pow(2, x));\n if (temp < n) res++;\n }\n if (n <= 5) res = n;\n switch (res)\n {\n case 1:\n WL(\"Sheldon\");\n break;\n case 2:\n WL(\"Leonard\");\n break;\n case 3:\n WL(\"Penny\");\n break;\n case 4:\n WL(\"Rajesh\");\n break;\n case 5:\n WL(\"Howard\");\n break;\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _082A_DoubleCola.Run();\n }\n }\n\n class _082A_DoubleCola\n {\n public static void Run()\n {\n var n = int.Parse(Console.ReadLine());\n var names = new[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n\n if (n < 6)\n {\n Console.WriteLine(names[n-1]);\n Console.ReadLine();\n return;\n }\n var ctr = 0;\n var num = 5;\n while (ctr+num < n)\n {\n ctr += num;\n num *= 2;\n }\n\n var diff = n - ctr;\n var div = num/5;\n var mod = diff/div;\n\n Console.WriteLine(names[mod]);\n\n Console.ReadLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nclass Program\n { \n static void Main(string[] args)\n {\n string[] rs = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int input = int.Parse(Console.ReadLine());\n int m = (int)Math.Pow(2D, Math.Floor(Math.Log(input / 5, 2)));\n if (m > 0)\n {\n input -= m * 5 - 5;\n input = input / m + (input % m == 0 ? 0 : 1) - 1;\n }\n else input--;\n Console.WriteLine(rs[input>4?4:input]);\n }\n }"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar n = Convert.ToInt32(Console.ReadLine());\n\t\tvar c = 1;\n\t\tvar t = 1;\n\t\twhile (c + t * 5 < n) \n\t\t{\n\t\t\tc += t * 5;\n\t\t\tt *= 2;\n\t\t}\n\t\tvar r = ((n-c) / t ) + 1;\n\t\t//Console.WriteLine( c + \" \" + t);\n\t\tswitch(r)\n\t\t{\n\t\t\tcase 5: Console.WriteLine(\"Hovard\"); break;\n\t\t\tcase 4: Console.WriteLine(\"Rajesh\"); break;\n\t\t\tcase 3: Console.WriteLine(\"Penny\"); break;\n\t\t\tcase 2: Console.WriteLine(\"Leonard\"); break;\n\t\t\tcase 1: Console.WriteLine(\"Sheldon\"); break;\n\t\t\tdefault: Console.WriteLine(r); break;\n\t\t}\n\n\t\t\n\t}\n\t\n\t\n\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\n\nnamespace Test1\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\t\n\t\t\tint num = int.Parse (Console.ReadLine ());\n\t\t\tstring[] str = new string[] {\n\t\t\t\t\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n\t\t\t};\n\t\t\tint cur = 0, n = 0, e = 1, k = 0, l = 0, p = 0;\n\t\t\twhile (num > cur) {\n\t\t\t\tk = 5 * e;\n\t\t\t\tcur = k + n;\n\t\t\t\tn += 5;\n\t\t\t\te *= 2;\n\t\t\t}\n l = n + e;\n\t\t\twhile (num > l) {\n\t\t\t\tl = n + e;\n\t\t\t\tn = l;\n\t\t\t\tp++;\n\t\t\t}\n\t\t\tConsole.Write (str [p]);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nclass Program\n{\n static void p(object value)\n {\n Console.WriteLine(value.ToString());\n }\n\n static string gets()\n {\n return Console.ReadLine();\n }\n \n static void Main(string[] args)\n { \n long n = int.Parse(gets());\n \n \n long l = 1;\n long r = 5;\n \n long up = 5;\n \n while (r < n) {\n up = up * 2;\n l = r + 1;\n r = r + up; \n }\n \n p(l + \" \" + r);\n \n long dif = n - l;\n \n long people = dif / (up / 5);\n \n if (people == 0) {\n p(\"Sheldon\");\n }\n if (people == 1) {\n p(\"Leonard\");\n }\n if (people == 2) {\n p(\"Penny\");\n }\n if (people == 3) {\n p(\"Rajesh\");\n }\n if (people == 4) {\n p(\"Howard\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TBB\n{\n class Program\n {\n static void Main(string[] args)\n {\n Heroes pers = Heroes.Howard;\n Array enumData = Enum.GetValues(pers.GetType());\n int N = Int32.Parse(Console.ReadLine());\n int sum = 0;\n int i = 0;\n byte person;\n while (N - sum >= 0)\n {\n i++;\n sum = Sum(i);\n }\n\n sum = Sum(i-1);\n if (i == 0 || i == 1) person = (byte)((N - sum));\n else person = (byte)(((N - sum) % i)%5 +1);\n Console.WriteLine(enumData.GetValue(person));\n }\n\n public static int Sum(int n)\n {\n int sum = 5 * (int)(Math.Pow(2d, (double)(n-1)));\n return sum;\n }\n }\n enum Heroes : byte\n {\n Howard = 0,\n Sheldon,\n Leonard,\n Penny, \n Rajesh,\n \n };\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n Int64 num = Convert.ToInt64(number);\n\n Int64 tmp = (num + 5) / 5;\n\n double xtmp = Math.Log(tmp, 2);\n double x = Math.Floor(xtmp);\n Int64 y = num - 5 * (Int64)(Math.Pow(2, x) - 1);\n int result = (int)Math.Ceiling(y / Math.Pow(2, x));\n switch (result)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 5:\n Console.Write(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = { \"\", \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n if (n > 5)\n {\n \n double lg2 = Math.Floor(Math.Log(n/5, 2d));\n double clthst = Math.Pow(2d, lg2++)*5d;\n clthst = (double)n - clthst;\n lg2 = Math.Pow(2d, lg2);\n clthst = Math.Ceiling(clthst / lg2);\n Console.WriteLine(clthst);\n }\n else Console.WriteLine(names[n]);\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n String[] TBBT = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n while (n >= 5)\n n = (n - 5) / 2;\n Console.WriteLine(TBBT[n]);\n }\n }\n}\n"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0;\n double j = 0;\n double sum = 0;\n \t if ( n <= 5 )\n\t {\n\t\tif ( n == 1)\n \t\t Console.WriteLine(\"Sheldon\");\n\t\tif ( n == 2 )\n\t\t Console.WriteLine(\"Leonard\");\n\t if ( n == 3 )\n\t\t Console.WriteLine(\"Penny\");\n\t\tif ( n == 4 )\n\t\t Console.WriteLine(\"Rajesh\");\n\t\tif ( n == 5 )\n\t\t Console.WriteLine(\"Howard\");\n\t }\n\t else\n\t {\n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n j++;\n i = Math.Pow(2,j);\n if ( sum > n)\n {\n n = n;\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n\t }\n\t \t\n }\n }\n"}, {"source_code": "using System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n//using System.Threading;\n//using System.Diagnostics;\n//using System.Collections;\n//using System.Text.RegularExpressions;\n//using System.Net;\n//using System.IO;\n//using System.Globalization;\n\nnamespace Tasks\n{\n\n\n\n class Program\n {\n enum names { Sheldon = 1, Leonard, Penny, Rajesh, Howard };\n\n static void Main(string[] args)\n {\n int count = 5;\n long n = long.Parse(Console.ReadLine());\n //int n = 21;\n long k = 1;\n long res;\n if (n > count)\n {\n for (; ; )\n {\n if (n > count * k) { n -= count * k; k <<= 1; continue; }\n res = n / (k+1) + 1;\n break;\n }\n Console.WriteLine((names)res);\n }\n else Console.WriteLine((names)n);\n }\n\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CforceS81A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int b=0;\n int k;\n int i=0;\n \n int tmp=1;\n int tmp1=5;\n\n int st = 0;\n int end = 0;\n if (x > 6)\n {\n for (k = 0; true; k++)\n {\n st++;\n end = st + Convert.ToInt32(4 + 5 * (Math.Pow(2, k) - 1));\n if (st < x && end > x)\n {\n break;\n }\n st = end;\n }\n while (true)\n {\n Console.Write(st + i * Math.Pow(2, k));\n Console.Write(\" - \");\n Console.Write(st + (i + 1) * Math.Pow(2, k) - 1);\n Console.WriteLine(\"\");\n if (st + i * Math.Pow(2, k) <= x && st + (i + 1) * Math.Pow(2, k) - 1 >= x)\n {\n break;\n }\n i++;\n }\n }\n else\n {\n i = x - 1;\n }\n switch (i + 1)\n {\n case 1:\n Console.Write(\"Sheldon\");\n break;\n case 2:\n Console.Write(\"Leonard\");\n break;\n case 3:\n Console.Write(\"Penny\");\n break;\n case 4:\n Console.Write(\"Rajesh\");\n break;\n case 5:\n Console.Write(\"Howard\");\n break;\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double a = 0;\n double b = 0;\n int c = 0;\n bool d = true;\n double i = 1;\n double n = double.Parse(Console.ReadLine());\n while( d == true)\n {\n a += i * 5;\n if (a > n)\n {\n b = n - (a-i*5);\n if (b / i <= 1 && b / i > 0)\n c = 1;\n else if (b / i <= 2 && b / i > 1)\n c = 2;\n else if (b / i <= 3 && b / i > 2)\n c = 3;\n else if (b / i <= 4 && b / i > 3)\n c = 4;\n else if (b / i <= 5 && b / i > 4)\n c = 5;\n d = false;\n }\n i++;\n }\n\n if (c == 1)\n Console.WriteLine(\"Sheldon\");\n else if (c == 2)\n Console.WriteLine(\"Leonard\");\n else if (c == 3)\n Console.WriteLine(\"Penny\");\n else if (c == 4)\n Console.WriteLine(\"Rajesh\");\n else if (c == 5)\n Console.WriteLine(\"Howard\");\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level = 0, prevIndex = 1;\n while (n > prevIndex)\n {\n prevIndex = prevIndex + Convert.ToInt32(Math.Pow(2, level)) * 5;\n level++;\n }\n level--;\n n = prevIndex - n;\n string whodunit = \"Sheldon\";\n if (n >= Convert.ToInt32(Math.Pow(2, level)) && n < Convert.ToInt32(Math.Pow(2, level)) * 2)\n {\n whodunit = \"Leonard\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 2 && n < Convert.ToInt32(Math.Pow(2, level)) * 3)\n {\n whodunit = \"Penny\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 3 && n < Convert.ToInt32(Math.Pow(2, level)) * 4)\n {\n whodunit = \"Rajesh\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 4 && n < Convert.ToInt32(Math.Pow(2, level)) * 5)\n {\n whodunit = \"Howard\";\n }\n Console.WriteLine(whodunit);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine());\n int wait = 0;\n int cycle = 0;\n int num = 1;\n while (num < n) {\n ++num;\n ++cycle;\n if(cycle == 4) {\n cycle = 0;\n ++wait;\n }\n num += wait;\n }\n Console.WriteLine(lnames[cycle]);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n\nnamespace _A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\n\t\t\tstring[] Name = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\t\t\n\n\n\t\t\t/*List New = new List ();\n\t\t\tfor (int i = 0; i < 5; i++)\n\t\t\t\tNew.Add (i);\n\n\t\t\tfor (int i = 1; i < 150; i++) {\n\n\t\t\t\tConsole.WriteLine (\"\\n \" + i + \" \" + Name [New [0]]);\n\n\t\t\t\tfor (int j = 0; j < 2; j++)\n\t\t\t\t\tNew.Add (New [0]);\n\n\t\t\t\tNew.RemoveAt(0);\n\n\t\t\t}*/\n\n\n\n\t\t\tuint N = uint.Parse (Console.ReadLine ());\n\t\t\tuint Last = N, Temp = 1, Now = 0;\n\t\t\tfor (uint i = 5; i < N; i += 5 * Temp) {\n\t\t\t\tLast = i;\n\t\t\t\tTemp *= 2;\n\t\t\t}\n\n\t\t\tfor (Now = 1; Last + Now * Temp < N; Now++) {\n\n\t\t\t}\n\n\t\t\tConsole.WriteLine (Name [Now - 1]);\n\t\t\tConsole.ReadLine ();\n\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long a = 0, k = 0, st = 0, kol = 0;\n\n while (a + 5 * (long)Math.Pow(2, k) < n)\n {\n a +=5*(long)Math.Pow(2, k) ;\n k++; \n }\n kol =(long)Math.Pow(2,k);\n a = n - a - 1;\n a /= (kol + 1);\n switch (a)\n {\n case 0: { Console.WriteLine(\"Sheldon\"); break; }\n case 1: { Console.WriteLine(\"Leonard\"); break; }\n case 2: { Console.WriteLine(\"Penny\"); break; }\n case 3: { Console.WriteLine(\"Rajesh\"); break; }\n case 4: { Console.WriteLine(\"Howard\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n Int64 num = Convert.ToInt64(number);\n\n Int64 tmp = (num + 5) / 5;\n\n double xtmp = Math.Log(tmp, 2);\n double x = Math.Floor(xtmp);\n Int64 y = num - 5 * (Int64)(Math.Pow(2, x) - 1);\n int result = (int)Math.Ceiling(y / Math.Pow(2, x));\n int heihei = result % 5;\n switch (result)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 0:\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List People = new List();\n int i = 0,\n round = 1,\n output = 0;\n while(i < n)\n {\n for (int m = 0; m < 5; m++)\n {\n for (int j = 0; j < round; j++)\n {\n if (i < n)\n {\n output = m;\n i++;\n }\n else\n break;\n }\n }\n round++;\n }\n switch (output)\n {\n case 0:\n Console.Write(\"Sheldon\");\n break;\n case 1:\n Console.Write(\"Leonard\");\n break;\n case 2:\n Console.Write(\"Penny\");\n break;\n case 3:\n Console.Write(\"Rajesh\");\n break;\n case 4:\n Console.Write(\"Howard\");\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Convert.ToInt64(Console.ReadLine());\n string[] people = new string[5] {\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\" };\n Queue all = new Queue();\n\n all.Enqueue(\"Sheldon\");\n all.Enqueue(\"Leonard\");\n all.Enqueue(\"Penny\");\n all.Enqueue(\"Rajesh\");\n all.Enqueue(\"Howard\");\n\n if (input <= 5)\n {\n Console.WriteLine(people[input - 1]);\n }\n\n for (int i = 6; i <= input; i++)\n {\n \n if (i == input)\n {\n Console.WriteLine(all.Dequeue());\n break;\n }\n\n string doublePerson = all.Dequeue();\n all.Enqueue(doublePerson);\n all.Enqueue(doublePerson);\n\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n if(n == 1801) {\n Console.WriteLine(\"Penny\");\n return;\n }\n if (n == 533) {\n Console.WriteLine(\"Rajesh\");\n return;\n }\n int pos = -1;\n int it = 1;\n int i = 0;\n while (i <= n) {\n pos++;\n if (pos > 4) {\n pos = 0;\n it++;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long i = 1;\n int h = 1;\n while (i <= n)\n {\n for (int j = 0; j < 4; j++)\n {\n i += h;\n if (i > n)\n {\n switch(j)\n {\n case 0 :\n Console.WriteLine(\"Sheldon\");\n break;\n case 1:\n Console.WriteLine(\"Leonard\");\n break;\n case 2:\n Console.WriteLine(\"Penny\");\n break;\n case 3:\n Console.WriteLine(\"Rajesh\");\n break;\n case 4:\n Console.WriteLine(\"Howard\");\n break;\n\n }\n return;\n }\n }\n h += 1;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int bagi = n % 5 ;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1)\n Console.Write(\"Sheldon\");\n else if (bagi == 2)\n Console.Write(\"Penny\");\n else if (bagi == 3)\n Console.Write(\"Leonard\");\n else if (bagi == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n } \n }\n }\n} "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TBB\n{\n class Program\n {\n static void Main(string[] args)\n {\n Heroes pers = Heroes.Howard;\n Array enumData = Enum.GetValues(pers.GetType());\n int N = Int32.Parse(Console.ReadLine());\n int sum = 0;\n int i = 0;\n byte person;\n while (N - sum >= 0)\n {\n i++;\n sum = Sum(i);\n }\n\n sum = Sum(i-1);\n if (i == 0 || i == 1) person = (byte)((N - sum));\n else person = (byte)(((N - sum) % i)%5 +1);\n Console.WriteLine(enumData.GetValue(person));\n }\n\n public static int Sum(int n)\n {\n int sum = 5 * (int)(Math.Pow(2d, (double)(n-1)));\n return sum;\n }\n }\n enum Heroes : byte\n {\n Howard = 0,\n Sheldon,\n Leonard,\n Penny, \n Rajesh,\n \n };\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Double_Cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine()) - 1;\n int n1 = (int)n / 5;\n int noIteration = 0;\n while (n1 > 0)\n {\n n1 = n1 / 2;\n noIteration++;\n }\n //Console.WriteLine(Math.Pow(2 , noIteration));\n //Console.WriteLine(b1);\n //Console.WriteLine((Math.Pow(2, noIteration) * 5));\n //int b1 = (int)(Math.Ceiling(n / (Math.Pow(2, noIteration - 1) * 5)));\n //int b1 = (int)((n - (Math.Pow(2, noIteration - 1))) / (5 * noIteration - 1));\n int lastIteration = (int)(noIteration == 0 ? 0 : Math.Pow(2, noIteration - 1));\n int endOfLast = lastIteration * 5;\n int remain = (int)(n - endOfLast);\n int result = (int)Math.Ceiling(remain / Math.Pow(2, noIteration));\n Console.WriteLine(names[result]);\n //Console.WriteLine(names[b1 - 1]);\n }\n }\n}\n"}, {"source_code": "//#define HOME\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\n#if HOME\nusing System.IO;\n#endif\n\npublic class Sets\n{\n public static void Main(string[] args)\n {\n int n, p, i, j, k;\n int[][] P;\n#if HOME\n\t\tstring strFile = Directory.GetCurrentDirectory() + \"\\\\input.txt\";\n\t\tusing (StreamReader sr = new StreamReader(strFile))\n\t\t{\n\t\t\tstring line;\n line = sr.ReadLine();\n n = int.Parse(line);\n p = n * (n - 1) / 2;\n P = new int[p][];\n i = 0;\n while ((line = sr.ReadLine()) != null)\n\t\t\t{\n string[] s2 = line.Split();\n k = int.Parse(s2[0]);\n P[i] = new int[k];\n for (j = 0; j < k; j++)\n {\n P[i][j] = int.Parse(s2[j + 1]);\n }\n Array.Sort(P[i]);\n ++i;\n }\n\t\t}\n#else\n n = int.Parse(Console.ReadLine());\n if (n == 2) p = 1; else p = n * (n - 1) / 2;\n P = new int[p][];\n for (i = 0; i < p; i++)\n {\n string line = Console.ReadLine();\n string[] s2 = line.Split();\n k = int.Parse(s2[0]);\n P[i] = new int[k];\n for (j = 0; j < k; j++)\n {\n P[i][j] = int.Parse(s2[j + 1]); \n }\n Array.Sort(P[i]);\n }\n#endif\n List used = new List();\n for (i = 0; i < p - 1; i++)\n {\n int[] set1 = P[i];\n for (j = i + 1; j < p; j++)\n {\n int[] set2 = P[j];\n List isti = new List();\n\n for (int ii = 0; ii < set1.Length; ii++)\n {\n int pos2 = Array.BinarySearch(set2, set1[ii]);\n if (pos2 >= 0 && !used.Contains(set1[ii]))\n {\n isti.Add(set1[ii]);\n used.Add(set1[ii]);\n }\n }\n if (isti.Count > 0)\n {\n Console.Write(\"{0}\", isti.Count);\n for (int ii = 0; ii < isti.Count; ++ii)\n {\n Console.Write(\" {0}\", isti[ii]);\n }\n Console.WriteLine();\n }\n }\n }\n\n //Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int bagi = n % 5 ;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1)\n Console.Write(\"Sheldon\");\n else if (bagi == 2)\n Console.Write(\"Penny\");\n else if (bagi == 3)\n Console.Write(\"Leonard\");\n else if (bagi == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n } \n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n int wait = 0;\n int cycle = -1;\n int num = 0;\n while (num <= n) {\n ++num;\n ++cycle;\n if(cycle == 4) {\n cycle = 0;\n ++wait;\n }\n num += wait;\n }\n Console.WriteLine(lnames[cycle]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n Do();\n\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n string[] str = new string[10000000];\n str[1] = \"Sheldon\";\n str[2] = \"Leonard\";\n str[3] = \"Penny\";\n str[4] = \"Rajesh\";\n str[5] = \"Howard\";\n string name = \"\";\n if (n < 6)\n {\n name = str[n];\n }\n else if (n == 6)\n {\n name = \"Sheldon\";\n }\n\n else\n {\n for (int c = 6, i = 1; i < n; c += 2, i++)\n {\n name = str[i];\n str[i] = \"\";\n str[c] = name;\n str[c + 1] = name;\n }\n }\n\n Console.WriteLine(name);\n }\n \n \n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var p=new[]{\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n var n=read().ToInt();\n var i=1;\n while(true)\n {\n if(n<=i*5)\n {\n write(n);write(i);\n write(p[(n-1)/i]);\n return;\n }\n n-=i*5;\n i*=2;\n }\n }\n}\n\n\n\nstatic class Exts\n{\n public static int ToInt(this string s)\n {\n return int.Parse(s);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int bagi = n % 5 ;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1)\n Console.Write(\"Sheldon\");\n else if (bagi == 2)\n Console.Write(\"Penny\");\n else if (bagi == 3)\n Console.Write(\"Leonard\");\n else if (bagi == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n } \n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int bagi = n % 5 ;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1 || bagi==2)\n Console.Write(\"Sheldon\");\n else if (bagi == 2 || bagi==3)\n Console.Write(\"Penny\");\n else if (bagi == 3 || bagi==4)\n Console.Write(\"Leonard\");\n else if (bagi == 4 || bagi==5)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n } \n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n int pos = -1;\n int it = 1;\n int i = 0;\n int pow = 0;\n while (i <= n) {\n pos++;\n if (pos == 5) {\n pos = 0;\n it = (int)Math.Pow((double)2, (double)pow);\n pow += 1;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "\ufeff using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.IO;\nusing System.Threading;\n\n namespace Yandex_1\n {\n class Program\n {\n\n static void Main(string[] args)\n {\n#if DEBUG\n Console.SetIn(new StreamReader(@\"c:\\Users\\IKim\\Documents\\NetBeansProjects\\ACMP\\input.txt\"));\n TextWriter tw = new StreamWriter(@\"c:\\Users\\IKim\\Documents\\NetBeansProjects\\ACMP\\output.txt\");\n Console.SetOut(tw);\n#endif\n string[] names = new string[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int n = int.Parse(Console.ReadLine());\n var k = 1;\n int r = 0;\n for (int i = 1; i < 30; i++)\n {\n for (int j = 1; j < 6; j++)\n {\n if (n < j * k)\n {\n Console.WriteLine(names[j - 1]);\n \n#if DEBUG\n tw.Close();\n#endif\n return;\n }\n }\n n -= 5 * k;\n k *= 2;\n }\n#if DEBUG\n tw.Close();\n#endif\n }\n }\n }"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0.0;\n double j = 0.0;\n double sum = 0.0;\n \t if ( n <= 5 )\n\t {\n\t\tif ( n == 1)\n \t\t Console.WriteLine(\"Sheldon\");\n\t\tif ( n == 2 )\n\t\t Console.WriteLine(\"Leonard\");\n\t if ( n == 3 )\n\t\t Console.WriteLine(\"Penny\");\n\t\tif ( n == 4 )\n\t\t Console.WriteLine(\"Rajesh\");\n\t\tif ( n == 5 )\n\t\t Console.WriteLine(\"Howard\");\n\t }\n\t else\n\t {\n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n\t i = Math.Pow(2,j);\n j++;\n if ( sum > n)\n {\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n\t }\n\t \t\n }\n }\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.IO;\nusing System.Threading;\n\n namespace Yandex_1\n {\n class Program\n {\n\n static void Main(string[] args)\n {\n#if DEBUG\n Console.SetIn(new StreamReader(@\"c:\\Users\\IKim\\Documents\\NetBeansProjects\\ACMP\\input.txt\"));\n TextWriter tw = new StreamWriter(@\"c:\\Users\\IKim\\Documents\\NetBeansProjects\\ACMP\\output.txt\");\n Console.SetOut(tw);\n#endif\n string[] names = new string[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int n = int.Parse(Console.ReadLine());\n var k = 1;\n int r = 0;\n for (int i = 1; i < 20; i++)\n {\n for (int j = 1; j < 6; j++)\n {\n for (int l = 0; l < k; l++)\n {\n r++;\n if (r == n)\n Console.WriteLine(names[j - 1]);\n }\n }\n k *= 2;\n }\n#if DEBUG\n tw.Close();\n#endif\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace App\n{\n class Program\n {\n static void Main(string[] args)\n {\n int number = int.Parse(Console.ReadLine());\n String[] names = new String[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n if(number>=6)\n {\n while (number >= 6)\n number -= 6;\n\n Console.WriteLine(names[number]);\n }\n else\n {\n number--;\n Console.WriteLine(names[number]);\n }\n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong count = Convert.ToUInt64(Console.ReadLine());\n if(count == 1802)\n {\n Console.Write(\"Penny\");\n return;\n }\n ulong i = 0,\n round = 0;\n while(i < count)\n {\n round++;\n i += 5 * round;\n }\n i -= 5 * round;\n for (ulong j = 0; j < 5; j ++ )\n {\n i += round;\n if (i >= count)\n {\n switch (j)\n {\n case 0:\n Console.Write(\"Sheldon\");\n break;\n case 1:\n Console.Write(\"Leonard\");\n break;\n case 2:\n Console.Write(\"Penny\");\n break;\n case 3:\n Console.Write(\"Rajesh\");\n break;\n case 4:\n Console.Write(\"Howard\");\n break;\n }\n break;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _4._2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Int32.Parse(Console.ReadLine());\n int count = 0;\n int z = 0;\n for (int i = 0; (i < n) && (count != n); i++)\n {\n for (int j = 0; (j < Math.Pow(2, i / 5)) && (count != n); j++)\n {\n z = i % 5 + 1;\n count++;\n }\n }\n Console.WriteLine(z == 1 ? \"Sheldon\" : z == 2 ? \"Leonard\" : z == 3 ? \"Penny\" : z == 4 ? \"Rajesh\" : \"Govard\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ans = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n int inc = 10;\n long[] steps = new long[100000];\n steps[1] = 5;\n for (int i = 2; i < 100000; i++)\n {\n steps[i] = steps[i - 1] + inc;\n inc += 5;\n }\n int cans = int.Parse(Console.ReadLine());\n int pos = BinarySearch(steps, 0, steps.Length, cans);\n if (steps[pos] - cans < pos)\n Console.WriteLine(\"Howard\");\n else\n {\n long res = ((steps[pos] - cans) + 1) / pos;\n Console.WriteLine(ans[(5 - res)]);\n }\n \n }\n public static int BinarySearch(long[] A, int l, int r, int key)\n {\n int m;\n while (r - l > 1)\n {\n m = l + (r - l) / 2;\n if (A[m] == key)\n return m;\n if (A[m] <= key)\n l = m;\n else\n r = m;\n }\n return r;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace TeatherSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int q = 5;\n while (n > 0)\n {\n n -= q;\n q *= 2; \n }\n n += q/2;\n \n switch (n % 5)\n {\n case 0:\n {\n Console.WriteLine(\"Sheldon\");\n break;\n }\n case 1:\n {\n Console.WriteLine(\"Leonard\");\n break;\n }\n case 2:\n {\n Console.WriteLine(\"Penny\");\n break;\n }\n case 3:\n {\n Console.WriteLine(\"Rajesh\");\n break;\n }\n case 4:\n {\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n Console.ReadLine();\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0;\n double j = 0;\n double sum = 0;\n \t if ( n <= 5 )\n\t {\n\t\tif ( n == 1)\n \t\t Console.WriteLine(\"Sheldon\");\n\t\tif ( n == 2 )\n\t\t Console.WriteLine(\"Leonard\");\n\t if ( n == 3 )\n\t\t Console.WriteLine(\"Penny\");\n\t\tif ( n == 4 )\n\t\t Console.WriteLine(\"Rajesh\");\n\t\tif ( n == 5 )\n\t\t Console.WriteLine(\"Howard\");\n\t }\n\t else\n\t {\n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n j++;\n i = Math.Pow(2,j);\n if ( sum > n)\n {\n n = n;\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n\t }\n\t \t\n }\n }\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace TeatherSquare\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int q = 5;\n while (n > 0)\n {\n n -= q;\n q *= 2; \n }\n n += q/2;\n \n switch (n % 5)\n {\n case 0:\n {\n Console.WriteLine(\"Sheldon\");\n break;\n }\n case 1:\n {\n Console.WriteLine(\"Leonard\");\n break;\n }\n case 2:\n {\n Console.WriteLine(\"Penny\");\n break;\n }\n case 3:\n {\n Console.WriteLine(\"Rajesh\");\n break;\n }\n case 4:\n {\n Console.WriteLine(\"Howard\");\n break;\n }\n }\n Console.ReadLine();\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar n = Convert.ToInt32(Console.ReadLine());\n\t\tvar c = 1;\n\t\tvar t = 1;\n\t\twhile (c + t * 5 < n) \n\t\t{\n\t\t\tc += t * 5;\n\t\t\tt *= 2;\n\t\t}\n\t\tvar r = ((n-c) / t ) + 1;\n\t\t//Console.WriteLine( c + \" \" + t);\n\t\tswitch(r)\n\t\t{\n\t\t\tcase 5: Console.WriteLine(\"Hovard\"); break;\n\t\t\tcase 4: Console.WriteLine(\"Rajesh\"); break;\n\t\t\tcase 3: Console.WriteLine(\"Penny\"); break;\n\t\t\tcase 2: Console.WriteLine(\"Leonard\"); break;\n\t\t\tcase 1: Console.WriteLine(\"Sheldon\"); break;\n\t\t\tdefault: Console.WriteLine(r); break;\n\t\t}\n\n\t\t\n\t}\n\t\n\t\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int bagi = n % 5 - 1;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1)\n Console.Write(\"Sheldon\");\n else if (bagi == 2)\n Console.Write(\"Leonard\");\n else if (bagi == 3)\n Console.Write(\"Penny\");\n else if (bagi == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n //Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n var number = int.Parse(Console.ReadLine());\n var firstQueue = new[] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n var q = 5;\n while (q < number)\n q *= 2;\n\n var nn = q / 5;\n\n var c = number / (double)nn;\n\n Console.WriteLine(firstQueue[((int)System.Math.Floor(c)) - 1]);\n\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n var names = new[] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n var n = int.Parse(Console.ReadLine());\n\n var row = 0;\n while (true)\n {\n if (((int)Math.Pow(2, row)) * 5 >= n)\n break;\n\n row++;\n }\n\n var bPo = 0;\n\n if (row != 0)\n {\n n = n - 5 * (int)Math.Pow(2, row - 1);\n bPo = (int)Math.Pow(2, row - 1);\n\n }\n else\n {\n bPo = 1;\n }\n\n\n for (int i = 1; i <= 5; i++)\n {\n if(i*bPo < n)\n continue;\n \n Console.WriteLine(names[i-1]);\n return;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces122A_Lucky_Division\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int[] lk = new int[]{ 4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777 };\n foreach(int i in lk)\n if(a%i==0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level = 0, prevIndex = 1;\n while (n > prevIndex)\n {\n prevIndex = prevIndex + Convert.ToInt32(Math.Pow(2, level)) * 5;\n level++;\n }\n level--;\n n = prevIndex - n;\n string whodunit = \"Sheldon\";\n if (n >= Convert.ToInt32(Math.Pow(2, level)) && n < Convert.ToInt32(Math.Pow(2, level)) * 2)\n {\n whodunit = \"Leonard\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 2 && n < Convert.ToInt32(Math.Pow(2, level)) * 3)\n {\n whodunit = \"Penny\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 3 && n < Convert.ToInt32(Math.Pow(2, level)) * 4)\n {\n whodunit = \"Rajesh\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 4 && n < Convert.ToInt32(Math.Pow(2, level)) * 5)\n {\n whodunit = \"Howard\";\n }\n Console.WriteLine(whodunit);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] names = new string[5] {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n while(n > 5)\n {\n n /= 2;\n }\n\n Console.WriteLine(names[n - 1]);\n }\n }\n}\n"}, {"source_code": "using System;\nclass TestA\n{\n static void Main()\n {\n long n = Int64.Parse(Console.ReadLine());\n long ser = 0;\n for(int i = 1 ; i < 30 ; i++ ){\n \n long tmp = ((5)*Convert.ToInt64(Math.Pow(2,i))/2) ;\n \n if(n<=tmp){\n tmp = ((5)*Convert.ToInt64(Math.Pow(2,(i-1)))/2);\n if(tmp<5){\n tmp = 0 ;\n }\n \n ser = n-tmp;\n if(i >2){\n int tmpI = Convert.ToInt32(Math.Pow(2,(i-2)));\n if(ser%tmpI == 0){\n ser = ser/tmpI;\n } else {\n ser = (ser/tmpI)+1;\n }\n }\n i = 30;\n } \n }\n \n if(ser == 1){\n Console.WriteLine(\"Sheldon\");\n } else if (ser == 2){\n Console.WriteLine(\"Leonard\");\n } else if (ser == 3){\n Console.WriteLine(\"Penny\");\n } else if (ser == 4){\n Console.WriteLine(\"Rajesh\");\n } else if (ser == 5){\n Console.WriteLine(\"Howard\");\n }\n }\n}"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0;\n double j = 0;\n double sum = 0;\n \n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n j++;\n i = Math.Pow(2,j);\n if ( sum > n)\n {\n n = n;\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n if(n == 1801) {\n Console.WriteLine(\"Penny\");\n return;\n }\n if (n == 533) {\n Console.WriteLine(\"Rajesh\");\n return;\n }\n int pos = -1;\n int it = 1;\n int i = 0;\n while (i <= n) {\n pos++;\n if (pos > 4) {\n pos = 0;\n it++;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace asdasdsad\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring[] customers = {\"Sheldon\",\"Leonard\",\"Peny\",\"Rajesh\",\"Howard\"};\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\n\t\t\twhile(n>5){\n\t\t\t\n\t\t\t\tn-= (int)(Math.Ceiling((double)n/(double)2)) + 2;\n\t\t\t}\n\t\t\tConsole.WriteLine(customers[n-1]);\n\n\n\n\n\n\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long a = 0, k = 0, st = 0, kol = 0;\n\n while (a + 5 * (long)Math.Pow(2, k) < n)\n {\n a +=5*(long)Math.Pow(2, k) ;\n k++; \n }\n kol =(long)Math.Pow(2,k);\n a = n - a - 1;\n a /= (kol + 1);\n switch (a)\n {\n case 0: { Console.WriteLine(\"Sheldon\"); break; }\n case 1: { Console.WriteLine(\"Leonard\"); break; }\n case 2: { Console.WriteLine(\"Penny\"); break; }\n case 3: { Console.WriteLine(\"Rajesh\"); break; }\n case 4: { Console.WriteLine(\"Howard\"); break; }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double a = 0;\n double b = 0;\n int c = 0;\n bool d = true;\n double i = 1;\n double n = double.Parse(Console.ReadLine());\n while( d == true)\n {\n a += i * 5;\n if (a > n)\n {\n b = n - (a-i*5);\n if (b / i <= 1 && b / i > 0)\n c = 1;\n else if (b / i <= 2 && b / i > 1)\n c = 2;\n else if (b / i <= 3 && b / i > 2)\n c = 3;\n else if (b / i <= 4 && b / i > 3)\n c = 4;\n else if (b / i <= 5 && b / i > 4)\n c = 5;\n d = false;\n }\n i++;\n }\n\n if (c == 1)\n Console.WriteLine(\"Sheldon\");\n else if (c == 2)\n Console.WriteLine(\"Leonard\");\n else if (c == 3)\n Console.WriteLine(\"Penny\");\n else if (c == 4)\n Console.WriteLine(\"Rajesh\");\n else if (c == 5)\n Console.WriteLine(\"Howard\");\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n //\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"\n int n = int.Parse(Console.ReadLine());\n int raj = n % 5;\n int pen = n % 4;\n if (n == 534) pen = 0;\n int bagi = n % 5;\n if (n < 6)\n {\n if (n == 1)\n Console.Write(\"Sheldon\");\n else if (n == 2)\n Console.Write(\"Leonard\");\n else if (n == 3)\n Console.Write(\"Penny\");\n else if (n == 4)\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n else\n {\n if (bagi == 1 )\n Console.Write(\"Sheldon\");\n else if (pen == 2 )\n Console.Write(\"Penny\");\n else if (bagi == 3 )\n Console.Write(\"Leonard\");\n else if (raj == 4 )\n Console.Write(\"Rajesh\");\n else\n Console.Write(\"Howard\");\n }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems\n{\n class A82_DoubleCola\n {\n public static void Main()\n {\n //while(true)\n //{\n var value = int.Parse(Console.ReadLine());\n int i = 0;\n var result = 0.0;\n while(true)\n {\n result += (5* Math.Pow(2, i));\n if (result > value)\n break;\n \n i++;\n }\n result -= (5 * Math.Pow(2, i ));\n int j = 1;\n for( j=1;j<=5;j++)\n {\n result += Math.Pow(2, i);\n if (result >= value)\n break;\n }\n switch(j)\n {\n case 1: Console.WriteLine(\"Sheldon\");\n break;\n case 2: Console.WriteLine(\"Leonard\");\n break;\n case 3: Console.WriteLine(\"Penny\");\n break;\n case 4: Console.WriteLine(\"Rajesh\");\n break;\n case 5: Console.WriteLine(\"Howard\");\n break;\n \n }\n\n // }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _82A_Doble_Cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int i = 0;\n int k = 1, s = 1;\n while ((-5 * (1 - Math.Pow(2, i))) < n)\n { i++;\n } \n while (((-5 * (1 - Math.Pow(2, (i-1))))+ Math.Pow(2, (i - 1))*k)= input) \n {\n int ind = Convert.ToInt32(Math.Ceiling((input - ((n - 1) * 5)) / n)) - 1;\n Console.WriteLine(names[ind]);\n break;\n }\n else n *= 2;\n }\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int mem = 0;\n int sum = 0;\n for (int i = 1; i < 100000; i++)\n {\n mem = sum;\n sum = sum + i * 5;\n if (sum >= n) break;\n }\n //Console.WriteLine((mem+1)+\" \"+sum+\" \"+n);\n int shag = (sum - mem) / 6;\n //Console.WriteLine(shag);\n if ((n >= (mem + 1+shag*0))&& (n <= (mem + shag*1)))\n {\n Console.WriteLine(\"Sheldon\");\n }\n if ((n >= (mem + 1 + shag * 1)) && (n <= (mem + shag * 2)))\n {\n Console.WriteLine(\"Leonard\");\n }\n if ((n >= (mem + 1 + shag * 2)) && (n <= (mem + shag * 3)))\n {\n Console.WriteLine(\"Penny\");\n }\n if ((n >= (mem + 1 + shag * 3)) && (n <= (mem + shag * 4)))\n {\n Console.WriteLine(\"Rajesh\");\n }\n if ((n >= (mem + 1 + shag * 4)) && (n <= (mem + shag * 5)))\n {\n Console.WriteLine(\"Howard\");\n }\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace P82A\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int N;\n String[] Row={\"Row\",\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\"};\n N=Console.Read();\n N = N - 48;\n while (N>5)\n {\n N = N / 2;\n N = N - 2;\n }\n Console.Write(Row[N]);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n Int64 num = Convert.ToInt64(number);\n\n Int64 tmp = (num + 5) / 5;\n\n double xtmp = Math.Log(tmp, 2);\n double x = Math.Floor(xtmp);\n Int64 y = num - 5 * (Int64)(Math.Pow(2, x) - 1);\n int result = (int)Math.Ceiling(y / Math.Pow(2, x));\n switch (result)\n {\n case 1:\n Console.WriteLine(\"Sheldon\");\n break;\n case 2:\n Console.WriteLine(\"Leonard\");\n break;\n case 3:\n Console.WriteLine(\"Penny\");\n break;\n case 4:\n Console.WriteLine(\"Rajesh\");\n break;\n case 5:\n Console.Write(\"Howard\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n var step = 5L;\n\n while(n >= step)\n {\n n -= step;\n step *= 2;\n }\n step = step / 5;\n Console.Write(n/step + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace double_cola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 0;\n int p = 0;\n while (p<=n)\n {\n k++;\n p = p + 5*k;\n }\n Console.WriteLine(k);\n Console.WriteLine(p);\n int s = 0;\n for (int i = 1; i<=k-1; i++)\n {\n s = s + 5*i;\n }\n p = (k-1)*s;\n Console.WriteLine(p);\n n = n - p;\n Console.WriteLine(n);\n if (n<=k&&n>=1)\n {\n Console.WriteLine(\"Sheldon\");\n }\n if (n>k&&n<=2*k)\n {\n Console.WriteLine(\"Leonard\");\n }\n if (n>2*k&&n<=3*k)\n {\n Console.WriteLine(\"Penny\");\n }\n if (n>3*k&&n<=4*k)\n {\n Console.WriteLine(\"Rajesh\");\n }\n if (n>4*k&&n<=5*k)\n {\n Console.WriteLine(\"Howard\");\n }\n \n \n \n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n string[] BBT = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n char k = n[n.Length - 1];\n\n if (k == '1' || k == '6')\n Console.WriteLine(\"{0}\", BBT[0]);\n if (k == '2' || k == '7')\n Console.WriteLine(\"{0}\", BBT[1]);\n if (k == '3' || k == '8')\n Console.WriteLine(\"{0}\", BBT[2]);\n if (k == '4' || k == '9')\n Console.WriteLine(\"{0}\", BBT[3]);\n if (k == '5' || k == '0')\n Console.WriteLine(\"{0}\", BBT[4]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = new string [] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n while (n >= 5) n = (n - 5) / 2;\n Console.WriteLine(s[n]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = \"\";\n while (n>=5)\n {\n n-=5;\n n/=2;\n }\n switch(n)\n {\n case 0: s = \"Sheldon\"; break;\n case 1: s = \"Leonard\"; break;\n case 2: s = \"Penny\"; break;\n case 3: s = \"Rajesh\"; break;\n case 4: s = \"Howard\"; break;\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = 0;\n List stack = new List();\n stack.Add(\"Sheldon\");\n stack.Add(\"Leonard\");\n stack.Add(\"Penny\");\n stack.Add(\"Rajesh\");\n stack.Add(\"Howard\");\n n = Convert.ToInt32(Console.ReadLine());\n if (n > 0 && n < 100000)\n {\n n -= 1;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < 2; j++)\n {\n stack.Add(stack.ElementAt(i));\n }\n }\n Console.WriteLine(stack.ElementAt(n));\n }\n\n }\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n // Console.SetIn(new StreamReader(\"apbtest.in\"));\n // Console.SetOut(new StreamWriter(\"apbtest.out\"));\n Do();\n // Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int s = 1;\n int l = 2;\n int p = 3;\n int r = 4;\n int h = 5;\n\n for (int i = 0; i <= 1000000000; i++)\n {\n\n if (n == s)\n {\n Console.WriteLine(\"Sheldon\");\n return;\n }\n else if (n == l)\n {\n Console.WriteLine(\"Leonard\");\n return;\n }\n else if (n == p)\n {\n Console.WriteLine(\"Penny\");\n return;\n }\n else if (n == r)\n {\n Console.WriteLine(\"Rajesh\");\n return;\n }\n else if (n == h)\n {\n Console.WriteLine(\"Howard\");\n return;\n }\n else\n {\n s = s + 5;\n l = l + 5;\n p = p + 5;\n r = r + 5;\n h = h + 5;\n }\n }\n }\n \n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string[] name = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine());\n char who = 's';\n long i = n;\n long how = 1;\n while (i > 0)\n {\n i = i - how;\n who = 's';\n if (i <= 1) break;\n i = i - how;\n who = 'l';\n if (i <= 1) break;\n i = i - how;\n who = 'p';\n if (i <= 1) break;\n i = i - how;\n who = 'r';\n if (i <= 1) break;\n i = i - how;\n who = 'h';\n how = how * 2;\n if (i <= 0) break;\n }\n switch (who)\n {\n case 's':\n Console.WriteLine(name[0]);\n break;\n case 'l':\n Console.WriteLine(name[1]);\n break;\n case 'p':\n Console.WriteLine(name[2]);\n break;\n case 'r':\n Console.WriteLine(name[3]);\n break;\n case 'h':\n Console.WriteLine(name[4]);\n break;\n\n }\n Console.WriteLine(who);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Convert.ToInt64(Console.ReadLine());\n string[] people = new string[5] { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n Queue all = new Queue();\n int iCount = 0;\n\n all.Enqueue(\"Sheldon\");\n all.Enqueue(\"Leonard\");\n all.Enqueue(\"Penny\");\n all.Enqueue(\"Rajesh\");\n all.Enqueue(\"Howard\");\n\n if (input <= 5)\n {\n Console.WriteLine(people[input - 1]);\n }\n\n for (int i = 6; i <= input; i++)\n {\n string doublePerson = all.ElementAt(iCount);\n all.Enqueue(doublePerson);\n all.Enqueue(doublePerson);\n iCount += 1;\n\n if (i == input)\n {\n Console.WriteLine(all.ElementAt(i));\n break;\n }\n\n if (iCount == 4)\n {\n iCount = 0;\n }\n\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n // Console.SetIn(new StreamReader(\"apbtest.in\"));\n // Console.SetOut(new StreamWriter(\"apbtest.out\"));\n Do();\n // Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int s = 1;\n int l = 2;\n int p = 3;\n int r = 4;\n int h = 5;\n\n for (int i = 0; i <= 1000000000; i++)\n {\n\n if (n == s)\n {\n Console.WriteLine(\"Sheldon\");\n return;\n }\n else if (n == l)\n {\n Console.WriteLine(\"Leonard\");\n return;\n }\n else if (n == p)\n {\n Console.WriteLine(\"Penny\");\n return;\n }\n else if (n == r)\n {\n Console.WriteLine(\"Rajesh\");\n return;\n }\n else if (n == h)\n {\n Console.WriteLine(\"Howard\");\n return;\n }\n else\n {\n s = s + 5;\n l = l + 5;\n p = p + 5;\n r = r + 5;\n h = h + 5;\n }\n }\n }\n \n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine());\n int wait = 0;\n int cycle = 0;\n int num = 1;\n while (num < n) {\n ++num;\n ++cycle;\n if(cycle == 4) {\n cycle = 0;\n ++wait;\n }\n num += wait;\n }\n Console.WriteLine(lnames[cycle]);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int index = int.Parse(Console.ReadLine());\n\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n int rest = index % 5;\n\n Console.WriteLine(names[rest-1]);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n string[] names = new string[5];\n names[0] = \"Sheldon\";\n names[1] = \"Leonard\";\n names[2] = \"Penny\";\n names[3] = \"Ranjesh\";\n names[4] = \"Howard\";\n\n int input = int.Parse(Console.ReadLine());\n double n = 1;\n while (true) \n {\n if ((n * 2 - 1) * 5 >= input) \n {\n double index = (input - ((n - 1) * 5)) / n;\n int ind = Convert.ToInt32(Math.Ceiling(index)) - 1;\n Console.WriteLine(names[ind]);\n break;\n }\n else n *= 2;\n }\n }\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n var step = 5L;\n\n while(n >= step)\n {\n n -= step;\n step *= 2;\n }\n step = step / 5;\n Console.Write(n/step + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string[] name = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n long n = long.Parse(Console.ReadLine());\n char who = 's';\n long i = n;\n long how = 1;\n while (i > 0)\n {\n i = i - how;\n who = 's';\n if (i <= 1) break;\n i = i - how;\n who = 'l';\n if (i <= 1) break;\n i = i - how;\n who = 'p';\n if (i <= 1) break;\n i = i - how;\n who = 'r';\n if (i <= 1) break;\n i = i - how;\n who = 'h';\n how = how * 2;\n if (i <= 0) break;\n }\n switch (who)\n {\n case 's':\n Console.WriteLine(name[0]);\n break;\n case 'l':\n Console.WriteLine(name[1]);\n break;\n case 'p':\n Console.WriteLine(name[2]);\n break;\n case 'r':\n Console.WriteLine(name[3]);\n break;\n case 'h':\n Console.WriteLine(name[4]);\n break;\n\n }\n Console.WriteLine(who);\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int level = 0, prevIndex = 1;\n while (n > prevIndex)\n {\n prevIndex = prevIndex + Convert.ToInt32(Math.Pow(2, level)) * 5;\n level++;\n }\n level--;\n n = prevIndex - n;\n string whodunit = \"Sheldon\";\n if (n >= Convert.ToInt32(Math.Pow(2, level)) && n < Convert.ToInt32(Math.Pow(2, level)) * 2)\n {\n whodunit = \"Leonard\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 2 && n < Convert.ToInt32(Math.Pow(2, level)) * 3)\n {\n whodunit = \"Penny\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 3 && n < Convert.ToInt32(Math.Pow(2, level)) * 4)\n {\n whodunit = \"Rajesh\";\n }\n else if (n >= Convert.ToInt32(Math.Pow(2, level)) * 4 && n < Convert.ToInt32(Math.Pow(2, level)) * 5)\n {\n whodunit = \"Howard\";\n }\n Console.WriteLine(whodunit);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication236\n{\n \n class Program\n {\n static bool isSheldon(long n)\n {\n if (n == 1)\n {\n return true;\n }\n else\n {\n int k = 1;\n int i = 1;\n while (true)\n {\n k += (5 * i);\n int end = k + i;\n if (k<=n && n<=end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n\n }\n static bool isLeonard(long n)\n {\n if (n == 2)\n {\n return true;\n }\n else\n {\n int k = 2;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 1;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 100000)\n {\n return false;\n }\n }\n }\n }\n static bool isPenny(long n)\n {\n if (n == 3)\n {\n return true;\n }\n else\n {\n int k = 3;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 2;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n }\n static bool isRajesh(long n)\n {\n if (n == 4)\n {\n return true;\n }\n else\n {\n int k = 4;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 3;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n }\n\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n if (isSheldon(n))\n {\n Console.WriteLine(\"Sheldon\");\n }\n else if (isLeonard(n))\n {\n Console.WriteLine(\"Leonard\");\n } \n else if (isRajesh(n))\n {\n Console.WriteLine(\"Rajesh\");\n }\n else if (isPenny(n))\n {\n Console.WriteLine(\"Penny\");\n }\n else\n {\n Console.WriteLine(\"Howard\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()); bool a = false;\n string s = \"\";\n while (n>=5)\n {\n n-=5;\n n/=2;\n a = true;\n }\n if (!a) n-=1;\n switch(n)\n {\n case 0: s = \"Sheldon\"; break;\n case 1: s = \"Leonard\"; break;\n case 2: s = \"Penny\"; break;\n case 3: s = \"Rajesh\"; break;\n case 4: s = \"Howard\"; break;\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n double n = Convert.ToDouble(Console.ReadLine());\n double t = 0, p = 0;\n double result = 0, mod = 0;\n double i = 0;\n if (n > 5)\n {\n t = n / 5;\n for (int j = 1; j <= t; j++)\n {\n if (t >= Math.Pow(2, j) - 1 && t <= Math.Pow(2, j + 1) - 1)\n {\n p = j;\n break;\n }\n }\n mod = n % 5;\n i = Math.Pow(2, p);\n if (t >= i)\n {\n mod = (int)(t / p - 1) * 5 + mod;\n }\n result = mod / i;\n if (result > (int)result && result < (int)result + 1)\n {\n result = (int)result + 1;\n }\n Console.Write(a[(int)result - 1]);\n }\n else\n {\n Console.Write(a[(int)n - 1].ToString());\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), border = 5, curent=1, num=1, step=1;\n string[] name;\n name = new string[5];\n name[0] = \"Sheldon\";\n name[1] = \"Leonard\";\n name[2] = \"Penny\";\n name[3] = \"Rajesh\";\n name[4] = \"Howard\";\n \n\n\n if (n < 6) Console.WriteLine(name[n - 1]);\n else\n {\n while (num < n)\n {\n num += step;\n curent++;\n if (num == border)\n {\n curent = 1;\n step *= 2;\n border = 5 + border * 2;\n }\n }\n if (curent==1) Console.WriteLine(name[curent-1]);\n else Console.WriteLine(name[curent - 2]);\n \n\n\n \n }\n\n \n \n\n }\n }\n}\n \n \n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = n, a = 5, i = -1, g;\n int[] afrad = new int[5] { 1 , 1 , 1 , 1 , 1 } ;\n\n while (n >= 0)\n {\n n = n - a;\n a = a * 2;\n i++;\n }\n\n n += (a / 2);\n g = Convert.ToInt32((n-1) / (Math.Pow(2, i)));\n\n if (g == 0)\n {\n Console.WriteLine(\"Sheldon\");\n }\n if (g == 1)\n {\n Console.WriteLine(\"Leonard\");\n }\n if (g == 2)\n {\n Console.WriteLine(\"Penny\");\n }\n if (g == 3)\n {\n Console.WriteLine(\"Rajesh\");\n }\n if (g == 4)\n {\n Console.WriteLine(\"Howard\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _82A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n\n double n = Convert.ToDouble(Console.ReadLine());\n double t = 0, p = 0;\n double result = 0, mod = 0;\n double i = 0;\n if (n > 5)\n {\n t = n / 5;\n for (int j = 1; j <= t; j++)\n {\n if (t >= Math.Pow(2, j) - 1 && t <= Math.Pow(2, j + 1) - 1)\n {\n p = j;\n break;\n }\n }\n mod = n % 5;\n i = Math.Pow(2, p);\n if (t >= i)\n {\n mod = (int)(t / p - 1) * 5 + mod;\n }\n result = mod / i;\n if (result > (int)result && result < (int)result + 1)\n {\n result = (int)result + 1;\n }\n Console.Write(a[(int)result - 1]);\n }\n else\n {\n Console.Write(a[(int)n - 1].ToString());\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication236\n{\n \n class Program\n {\n static bool isSheldon(long n)\n {\n if (n == 1)\n {\n return true;\n }\n else\n {\n int k = 1;\n int i = 1;\n while (true)\n {\n k += (5 * i);\n int end = k + i;\n if (k<=n && n<=end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n\n }\n static bool isLeonard(long n)\n {\n if (n == 2)\n {\n return true;\n }\n else\n {\n int k = 2;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 1;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 100000)\n {\n return false;\n }\n }\n }\n }\n static bool isPenny(long n)\n {\n if (n == 3)\n {\n return true;\n }\n else\n {\n int k = 3;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 2;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n }\n static bool isRajesh(long n)\n {\n if (n == 4)\n {\n return true;\n }\n else\n {\n int k = 4;\n int i = 1;\n while (true)\n {\n k += (5 * i) + 3;\n int end = k + i;\n if (k <= n && n <= end)\n {\n return true;\n }\n else\n {\n i++;\n }\n if (i == 10000)\n {\n return false;\n }\n }\n }\n }\n\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n if (isSheldon(n))\n {\n Console.WriteLine(\"Sheldon\");\n }\n else if (isLeonard(n))\n {\n Console.WriteLine(\"Leonard\");\n } \n else if (isRajesh(n))\n {\n Console.WriteLine(\"Rajesh\");\n }\n else if (isPenny(n))\n {\n Console.WriteLine(\"Penny\");\n }\n else\n {\n Console.WriteLine(\"Howard\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n int pos = -1;\n int it = 1;\n int i = 0;\n int pow = 0;\n while (i <= n) {\n pos++;\n if (pos == 5) {\n pos = 0;\n it = (int)Math.Pow((double)2, (double)pow);\n pow += 1;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DoubleCola2._1\n{\n class Program\n {\n static int potencia(int x, int n)\n {\n int y = 1;\n\n for (int i = 0; i < n; i = i + 1)\n {\n y = y * x;\n\n }\n\n return y;\n }\n \n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n int n = 0;\n int total = 0;\n int quien = 0;\n int y = 1;\n int ygood = 1;\n for (y = 1; total <= input; n++)\n {\n ygood = y;\n y = potencia(2, n);\n total = y * 5;\n }\n if (input / ygood <= 5)\n {\n quien = input / ygood;\n }\n else\n {\n quien = input / ygood - 5;\n }\n \n if( input % ygood != 0)\n {\n quien++;\n }\n\n\n\n if (quien == 1)\n {\n Console.WriteLine(\"Sheldon\");\n }\n else if (quien == 2)\n {\n Console.WriteLine(\"Leonard\");\n }\n else if (quien == 3)\n {\n Console.WriteLine(\"Penny\");\n }\n else if (quien == 4)\n {\n Console.WriteLine(\"Rajesh\");\n }\n else if (quien == 5)\n {\n Console.WriteLine(\"Howard\");\n }\n \n \n\n\n \n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n string[] names = new string[5];\n names[0] = \"Sheldon\";\n names[1] = \"Leonard\";\n names[2] = \"Penny\";\n names[3] = \"Ranjesh\";\n names[4] = \"Howard\";\n\n int input = int.Parse(Console.ReadLine());\n double n = 1;\n while (true) \n {\n if ((n * 2 - 1) * 5 >= input) \n {\n int ind = Convert.ToInt32(Math.Ceiling((input - ((n - 1) * 5)) / n)) - 1;\n Console.WriteLine(names[ind]);\n break;\n }\n else n *= 2;\n }\n }\n }\n}\n\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar n = Convert.ToInt32(Console.ReadLine());\n\t\tdouble c = 0;\n\t\tdouble t = 1.0;\n\t\twhile (c + t * 5 < n) \n\t\t{\n\t\t\tc += t * 5;\n\t\t\tt *= 2;\n\t\t}\n\t\tvar r = Math.Ceiling((n-c) / t );\n\t\tswitch((int)r)\n\t\t{\n\t\t\tcase 5: Console.WriteLine(\"Hovard\"); break;\n\t\t\tcase 4: Console.WriteLine(\"Rajesh\"); break;\n\t\t\tcase 3: Console.WriteLine(\"Penny\"); break;\n\t\t\tcase 2: Console.WriteLine(\"Leonard\"); break;\n\t\t\tcase 1: Console.WriteLine(\"Sheldon\"); break;\n\t\t\tdefault: Console.WriteLine(r); break;\n\t\t}\n\n\t\t\n\t}\n\t\n\t\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _266A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n string[] arr = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n \n Console.WriteLine(n > 5 ? arr[n % 5] : arr[n - 1]);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n if (n == 1802) {\n Console.WriteLine(\"Howard\");\n return;\n }\n int pos = -1;\n int it = 1;\n int i = 0;\n while (i <= n) {\n pos++;\n if (pos > 4) {\n pos = 0;\n it++;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _4._2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Int32.Parse(Console.ReadLine());\n int count = 0;\n int z = 0;\n for (int i = 0; (i < n) && (count != n); i++)\n {\n for (int j = 0; (j < Math.Pow(2, i / 5)) && (count != n); j++)\n {\n z = i % 5 + 1;\n count++;\n }\n }\n Console.WriteLine(z == 1 ? \"Sheldon\" : z == 2 ? \"Leonard\" : z == 3 ? \"Penny\" : z == 4 ? \"Rajesh\" : \"Govard\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Example\n{\n enum Names\n {\n Sheldon,\n Leonard,\n Penny,\n Rajesh,\n Howard\n }\n\n internal class Program\n {\n private static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var x = 5;\n while (n > x) \n {\n n -= x;\n x *= 2;\n }\n \n Console.WriteLine((Names)(n / (x / 5)));\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _123\n{\n class Program\n {\n static void Main(string[] args)\n {\n long i = Int32.Parse(Console.ReadLine());\n if (i == 1 || i == 6 || i % 10 == 0) Console.WriteLine(\"Sheldon\");\n else if (i == 2 || i == 7 || i % 10 == 1) Console.WriteLine(\"Leonard\");\n else if (i == 3 || i == 8 || i % 10 == 2) Console.WriteLine(\"Penny\");\n else if (i == 4 || i == 9 || i % 10 == 3) Console.WriteLine(\"Rajesh\");\n else if (i == 5 || i == 10 || i % 10 == 4) Console.WriteLine(\"Howard\");\n }\n }\n}"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0;\n double j = 0;\n double sum = 0;\n \t if ( n <= 5 )\n\t {\n\t\tif ( n == 1)\n \t\t Console.WriteLine(\"Sheldon\");\n\t\tif ( n == 2 )\n\t\t Console.WriteLine(\"Leonard\");\n\t if ( n == 3 )\n\t\t Console.WriteLine(\"Penny\");\n\t\tif ( n == 4 )\n\t\t Console.WriteLine(\"Rajesh\");\n\t\tif ( n == 5 )\n\t\t Console.WriteLine(\"Howard\");\n\t }\n\t else\n\t {\n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n j++;\n i = Math.Pow(2,j);\n if ( sum > n)\n {\n n = n;\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n\t }\n\t \t\n }\n }\n"}, {"source_code": "using System;\n class soublecola\n {\n static void Main()\n {\n double n = double.Parse(Console.ReadLine());\n double i = 0;\n double j = 0;\n double sum = 0;\n \n while ( n > 0 )\n {\n sum += 5*Math.Pow(2,j);\n j++;\n i = Math.Pow(2,j);\n if ( sum > n)\n {\n n = n;\n break;\n }\n else\n n -= sum;\n }\n \n if ( n/i > 0 && n/i <= 1 )\n Console.WriteLine(\"Sheldon\");\n else if ( n/i > 1 && n/i <= 2)\n Console.WriteLine(\"Leonard\");\n else if ( n/i > 2 && n/i <= 3)\n Console.WriteLine(\"Penny\");\n else if ( n/i > 3 && n/i <= 4)\n Console.WriteLine(\"Rajesh\");\n else if ( n/i > 4 && n/i <= 5)\n Console.WriteLine(\"Howard\");\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_tmp{\n\n class Program {\n static void Main(string[] args) {\n string[] names = { \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" };\n List lnames = names.ToList();\n long n = Int32.Parse(Console.ReadLine()) - 1;\n int pos = -1;\n int it = 1;\n int i = 0;\n int pow = 0;\n while (i <= n) {\n pos++;\n if (pos == 5) {\n pos = 0;\n it = (int)Math.Pow((double)2, (double)pow);\n pow += 1;\n }\n i += it;\n }\n Console.WriteLine(lnames[pos]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_DoubleCola\n{\n class Program\n {\n static void Main(string[] args)\n {\n string mline;\n int m;\n int intname;\n mline = Console.ReadLine();\n m = Int32.Parse(mline);\n int mod = m / 5;\n int group = 0;\n int i = 0;\n while (group <= mod)\n {\n group += (int)(Math.Pow(2, i));\n i++;\n }\n i--;\n group -= (int)(Math.Pow(2, i));\n int curpos = (m - group * 5) / (int)(Math.Pow(2, i));\n int curposin = (m - group * 5) % (int)(Math.Pow(2, i));\n if (curposin != 0)\n {\n intname = curpos + 1;\n }\n else\n {\n intname = curpos;\n }\n switch (intname)\n {\n case 1:\n Console.Write(\"Sheldon\");\n break;\n case 2:\n Console.Write(\"Leonard\");\n break;\n case 3:\n Console.Write(\"Penny\");\n break;\n case 4:\n Console.Write(\"Rajesh\");\n break;\n case 5:\n Console.Write(\"Hovard\");\n break;\n default:\n break;\n }\n }\n }\n}\n"}], "src_uid": "023b169765e81d896cdc1184e5a82b22"} {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace _1709A\r\n{\r\n internal class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n while (t-- > 0)\r\n {\r\n int n = Convert.ToInt32(Console.ReadLine());\r\n int[] array = new int[3];\r\n var line = Console.ReadLine();\r\n var data = line.Split(' ');\r\n for (int i = 0; i < 3; i++)\r\n {\r\n array[i] = int.Parse(data[i]);\r\n // Console.WriteLine(array[i]);\r\n }\r\n bool test = true;\r\n if (array[n - 1] != 0)\r\n {\r\n for (int i = 0; i < 3; i++)\r\n {\r\n if (array[i] == i + 1)\r\n test = false;\r\n \r\n }\r\n }\r\n else test = false;\r\n if (test)\r\n {\r\n Console.WriteLine(\"YES\");\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n }\r\n }\r\n }\r\n}\r\n", "positive_code": [{"source_code": "int t = Convert.ToInt32(Console.ReadLine());\r\nwhile (t > 0)\r\n{\r\n int x = Convert.ToInt32(Console.ReadLine());\r\n string[] tokens = Console.ReadLine().Split();\r\n int a = int.Parse(tokens[0]);\r\n int b = int.Parse(tokens[1]);\r\n int c = int.Parse(tokens[2]);\r\n List lst = new List { a, b, c};\r\n if((x == 1 && lst[0] == 0) || (x == 2 && lst[1] == 0) || (x == 3 && lst[2] == 0))\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n else\r\n {\r\n x = lst[x - 1];\r\n if(x == 1 && lst[0] == 0 || x == 2 && lst[1] == 0 || x == 3 && lst[2] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n else Console.WriteLine(\"YES\");\r\n }\r\n t--;\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\nnamespace Testings\r\n{\r\n public class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int testCases = Int32.Parse(Console.ReadLine());\r\n while (testCases != 0){\r\n int firstKey = Int32.Parse(Console.ReadLine()) - 1;\r\n int[] doorArray = Console.ReadLine().Split(' ').Select(s => Int32.Parse(s)).ToArray();\r\n\r\n Console.WriteLine(doorArray[firstKey] != 0 && doorArray[doorArray[firstKey] - 1] != 0 ? \"YES\" : \"NO\");\r\n testCases--;\r\n };\r\n }\r\n\r\n }\r\n}\r\n"}, {"source_code": "using System.ComponentModel;\r\nusing System.Reflection.Metadata.Ecma335;\r\nusing System.Text.RegularExpressions;\r\nusing System;\r\nusing System.Linq;\r\n\r\nnamespace codeforces\r\n{\r\n class Program\r\n {\r\n //1511/A. Review Site\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n\r\n while (t-- > 0)\r\n {\r\n int mykey = int.Parse(Console.ReadLine()); \r\n\r\n var doors = Console.ReadLine().Split(\" \").Select(int.Parse).ToArray(); \r\n\r\n if (doors[mykey-1] != 0 && doors[doors[mykey-1]-1] != 0)\r\n Console.WriteLine(\"YES\");\r\n else \r\n Console.WriteLine(\"NO\");\r\n \r\n }\r\n\r\n }\r\n\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n"}, {"source_code": "int n = int.Parse(Console.ReadLine());\r\nfor (int i = 0; i < n; i++)\r\n{\r\n int key = int.Parse(Console.ReadLine());\r\n int[] doors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n Console.WriteLine(doors[key - 1] != 0 && doors[doors[key - 1] - 1] != 0 ? \"YES\" : \"NO\");\r\n}"}, {"source_code": "int n = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < n; i++)\r\n {\r\n int key = int.Parse(Console.ReadLine());\r\n int[] doors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n bool flag = true;\r\n for (int j = 0; j < doors.Length - 1; j++)\r\n {\r\n key = doors[key - 1];\r\n if (key == 0)\r\n {\r\n flag = false;\r\n break;\r\n }\r\n }\r\n Console.WriteLine(flag ? \"YES\" : \"NO\");\r\n }"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace CodeForces_CS\r\n{\r\n internal class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n\r\n while(t-- > 0)\r\n {\r\n int key = Convert.ToInt32(Console.ReadLine());\r\n\r\n string s = Console.ReadLine();\r\n int[] arr = s.Split(' ').Select(int.Parse).ToArray();\r\n\r\n int index = 0;\r\n\r\n while(true)\r\n {\r\n key = arr[key - 1];\r\n index++;\r\n if (key == 0) break;\r\n \r\n }\r\n\r\n if (index != 3) Console.WriteLine(\"NO\");\r\n else Console.WriteLine(\"YES\");\r\n\r\n //Console.WriteLine(index);\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "\ufeffint tc = int.Parse(Console.ReadLine());\r\nstring[] results = new string[tc];\r\n\r\nfor (int t = 0; t < tc; t++)\r\n{\r\n int x = int.Parse(Console.ReadLine());\r\n int[] keysBehindDoors = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\r\n\r\n var keysObtained = 1;\r\n string textResult = \"YES\";\r\n\r\n int i = x - 1;\r\n while (keysObtained != keysBehindDoors.Length)\r\n {\r\n if (keysBehindDoors[i] == 0)\r\n {\r\n textResult = \"NO\";\r\n break;\r\n }\r\n\r\n i = keysBehindDoors[i] - 1;\r\n keysObtained++;\r\n }\r\n\r\n results[t] = textResult;\r\n}\r\n\r\nforeach(var r in results) Console.WriteLine(r);"}, {"source_code": "/* #codeforceio #contestio #yandexcupio #csharp\r\n * task: input output template contests\r\n*/\r\n\r\nusing System;\r\nusing System.Linq;\r\n\r\nnamespace CodeforcesByTDD.gen20220722003800\r\n{\r\n public class Program\r\n {\r\n static void ToSolve()\r\n {\r\n }\r\n\r\n static void Main()\r\n {\r\n var setOfData = int.Parse(Console.ReadLine());\r\n for(var dataIndex = 0; dataIndex < setOfData; ++dataIndex)\r\n {\r\n var key = int.Parse(Console.ReadLine());\r\n var doors = Console.ReadLine().Split(new char[] {' '}).Select(number => int.Parse(number)).ToArray();\r\n if (doors[key - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n if (doors[doors[key - 1] - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n Console.WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n// solved by: asmjaime\r\n"}, {"source_code": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\r\npublic sealed class CodeForces\r\n{\r\n private static void Main()\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < t; i++)\r\n {\r\n int x = int.Parse(Console.ReadLine());\r\n int[] doors = intArr(Console.ReadLine());\r\n Console.WriteLine(Solve(doors, x));\r\n }\r\n }\r\n\r\n private static int[] intArr(string input)\r\n {\r\n return input.Split(' ').Select(int.Parse).ToArray();\r\n }\r\n\r\n private static string Solve(int[] doors, int x)\r\n {\r\n int firstKey = doors[x - 1];\r\n int secondKey = firstKey > 0 ? doors[firstKey - 1] : 0;\r\n return firstKey > 0 && secondKey > 0 ? \"YES\" : \"NO\";\r\n }\r\n}"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nclass Program\r\n{\r\n public static void Main(string[] args)\r\n {\r\n //write code here\r\n int T, x;\r\n\r\n T = int.Parse(Console.ReadLine());\r\n\r\n while(T -- > 0)\r\n {\r\n bool[] open = new bool[5];\r\n x = int.Parse(Console.ReadLine());\r\n open[x] = true;\r\n\r\n string str = Console.ReadLine();\r\n string[] strs = str.Split(' ');\r\n\r\n for(int i = 0; i < strs.Length; i++)\r\n {\r\n x = int.Parse(strs[x - 1]);\r\n if (x == 0)\r\n break;\r\n open[x] = true;\r\n }\r\n\r\n bool p = true;\r\n\r\n for(int i = 1; i <= 3; i++)\r\n {\r\n if (open[i] == false)\r\n p = false;\r\n }\r\n\r\n if(p == true)\r\n Console.WriteLine(\"YES\");\r\n else\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n}"}, {"source_code": "int t = int.Parse(Console.ReadLine());\r\nwhile (t-- > 0)\r\n{\r\n int k = int.Parse(Console.ReadLine());\r\n int[] a = (\"0 \"+ Console.ReadLine()).Split().Select(int.Parse).ToArray();\r\n Console.WriteLine(a[a[k]] == 0 ? \"NO\" : \"YES\");\r\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Globalization;\r\nusing System.Threading;\r\n\r\nnamespace A\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\r\n int tc = 1;\r\n tc = int.Parse(Console.ReadLine());\r\n while (tc-- > 0)\r\n {\r\n solve();\r\n }\r\n }\r\n\r\n // write your code in solve function\r\n static void solve()\r\n {\r\n int x = int.Parse(Console.ReadLine());\r\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\r\n bool[] open = new bool[3];\r\n open[x - 1] = true;\r\n\r\n while (a[x - 1] != 0)\r\n {\r\n x = a[x - 1];\r\n open[x - 1] = true;\r\n }\r\n\r\n bool ok = true;\r\n for (int i = 0; i < 3; i++ ) {\r\n if (!open[i])\r\n ok = false;\r\n }\r\n\r\n Console.WriteLine((ok) ? \"YES\" : \"NO\");\r\n }\r\n }\r\n}"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\nusing System.Text.RegularExpressions;\r\nusing System.Text;\r\nusing System.Numerics;\r\n\r\npublic class Test\r\n{\r\n private static readonly Random r = new Random();\r\n public static void Main()\r\n {\r\n var t = GetInt();\r\n for (int i = 0; i < t; i++)\r\n Solve();\r\n }\r\n\r\n public static bool IsVowel(char c) => c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';\r\n\r\n public static void Solve()\r\n {\r\n int key = GetInt();\r\n key--;\r\n var locks = GetIntArray();\r\n bool canOpen = true;\r\n //try lock1\r\n if (locks[key] == 0)\r\n canOpen = false;\r\n else\r\n {\r\n key = locks[key] - 1;\r\n //try lock2\r\n if (locks[key] == 0)\r\n canOpen = false;\r\n else\r\n {\r\n //key = locks[key] - 1;\r\n ////try lock3\r\n //if (locks[key] == 0)\r\n // canOpen = false;\r\n //else\r\n //{\r\n // key = locks[key] - 1;\r\n //}\r\n }\r\n }\r\n string ans = canOpen ? \"YES\" : \"NO\";\r\n#if DEBUG\r\n Console.Write(\"Answer is --------------> \");\r\n#endif\r\n Console.WriteLine(String.Join(\" \",ans));\r\n }\r\n\r\n public static int GetInt() => int.Parse(Console.ReadLine());\r\n public static long GetLong() => long.Parse(Console.ReadLine());\r\n\r\n public static int[] GetIntArray() => Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\r\n public static long[] GetLongArray() => Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();\r\n\r\n\r\n\r\n public static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);\r\n public static int Gcd(int[] n) => n.Aggregate((a, b) => Gcd(a, b));\r\n\r\n public static bool IsBitSet(long a, int bit)\r\n {\r\n return (a & (1L << bit)) != 0;\r\n }\r\n}\r\n"}, {"source_code": "int count = int.Parse(Console.ReadLine());\r\nfor (int i = 0; i < count; i++)\r\n{\r\n int curr = int.Parse(Console.ReadLine());\r\n int OpenDoor = 0;\r\n int[] arr = Console.ReadLine().Split().Select(x=>int.Parse(x)).ToArray();\r\n while (curr != 0)\r\n {\r\n curr = arr[curr - 1];\r\n OpenDoor++;\r\n }\r\n if (OpenDoor == arr.Length) Console.WriteLine(\"YES\");\r\n else Console.WriteLine(\"NO\");\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\n\r\nnamespace ForTestCSharp\r\n{\r\n internal static class Program\r\n {\r\n private const bool hasFewCases = true;\r\n\r\n private static readonly StringBuilder output = new();\r\n\r\n public static void Main(string[] args)\r\n {\r\n var caseCount = hasFewCases ? int.Parse(Console.ReadLine()) : 1;\r\n\r\n while (caseCount-- > 0)\r\n {\r\n Solve();\r\n }\r\n\r\n Console.WriteLine(output);\r\n }\r\n\r\n private static void Solve()\r\n {\r\n var key = int.Parse(Console.ReadLine());\r\n var doors = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\r\n\r\n var toOpen = 3;\r\n\r\n while (key != 0 && toOpen > 0)\r\n {\r\n key = doors[key - 1];\r\n toOpen--;\r\n }\r\n\r\n output.AppendLine(toOpen == 0 ? \"YES\" : \"NO\");\r\n }\r\n }\r\n}\r\n"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Collections.Specialized;\r\nusing System.Collections;\r\nusing System.Numerics;\r\nusing System.Text.RegularExpressions;\r\n\r\nnamespace basicDS6\r\n{\r\n public class st\r\n {\r\n private int MOD = 1000000007;\r\n public void Test()\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n //var s = Console.ReadLine();\r\n var nums = Console.ReadLine().Split(' ').Select(ti => int.Parse(ti)).ToList();\r\n int res = 0;\r\n var d = new Dictionary();\r\n d.Add(1, nums[0]);\r\n d.Add(2, nums[1]);\r\n d.Add(3, nums[2]);\r\n for (int i = 1; i < 3; i++)\r\n {\r\n if (d[n] == 0)\r\n {\r\n res = 1;\r\n break;\r\n }\r\n n = d[n];\r\n }\r\n if (res == 0) Console.WriteLine(\"YES\");\r\n else Console.WriteLine(\"NO\");\r\n }\r\n\r\n static void Main()\r\n {\r\n st p = new st();\r\n int T = int.Parse(Console.ReadLine());\r\n for (int test_no = 1; test_no < T + 1; test_no++)\r\n {\r\n p.Test();\r\n }\r\n }\r\n }\r\n}"}, {"source_code": "using System.Text;\r\n\r\nStringBuilder output = new StringBuilder();\r\nlong t = ReadNum();\r\nwhile (t-- > 0)\r\n{\r\n long x = ReadNum();\r\n long[] a = ReadNumArray();\r\n\r\n long ans = 1;\r\n\r\n while (a[x - 1] > 0)\r\n {\r\n ans++;\r\n x = a[x - 1];\r\n }\r\n\r\n output.AppendLine(ans == 3 ? \"YES\" : \"NO\");\r\n}\r\nConsole.Write(output.ToString());\r\n\r\nlong ReadNum() => long.Parse(Console.ReadLine());\r\nlong[] ReadNumArray() => Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\r\n(long, long) ReadTwoNum() { long[] a = ReadNumArray(); return (a[0], a[1]); }\r\n(long, long, long) ReadThreeNum() { long[] a = ReadNumArray(); return (a[0], a[1], a[2]); }\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\n\r\nnamespace CF1709A_Three_Doors\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n\r\n for(int i = 1; i <= t; i++)\r\n {\r\n int x = int.Parse(Console.ReadLine());\r\n int[] keysBehind = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\r\n IDictionary doorUnlock = new Dictionary()\r\n {\r\n { 1, false },\r\n { 2, false },\r\n { 3, false }\r\n };\r\n\r\n int count = 1;\r\n int key = x;\r\n bool flag = true;\r\n\r\n int key1 = 0, key2 = 0, key3 = 0;\r\n doorUnlock[key] = true;\r\n\r\n if (key > 0 && doorUnlock[key] == true) \r\n {\r\n key1 = keysBehind[key - 1];\r\n doorUnlock[key1] = true;\r\n }\r\n else\r\n flag = false;\r\n\r\n if (key1 > 0 && doorUnlock[key1] == true)\r\n { \r\n key2 = keysBehind[key1 - 1];\r\n doorUnlock[key2] = true;\r\n }\r\n else\r\n flag = false;\r\n\r\n if (key2 > 0 && doorUnlock[key2] == true)\r\n { \r\n key3 = keysBehind[key2 - 1];\r\n doorUnlock[key3] = true;\r\n }\r\n else\r\n flag = false;\r\n \r\n\r\n if(flag)\r\n Console.WriteLine(\"YES\");\r\n else\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "var input = Convert.ToInt32(Console.ReadLine());\r\n\r\nfor (int i = 1; i <= input; i++)\r\n{ \r\n var input2= Convert.ToInt32(Console.ReadLine());\r\n \r\n var inputArr = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();\r\n int j = 0;\r\n var count = 0;\r\n var value = input2;\r\n \r\n while (true)\r\n {\r\n \r\n var temp = inputArr[value-1];\r\n if (temp == 0)\r\n {\r\n count++;\r\n break;\r\n }\r\n else if (temp > 0)\r\n {\r\n value = temp;\r\n count++;\r\n\r\n }\r\n\r\n j++;\r\n if (j == 3)\r\n break;\r\n \r\n }\r\n \r\n if (count == 3)\r\n Console.WriteLine(\"YES\");\r\n else\r\n Console.WriteLine(\"NO\");\r\n}\r\n"}, {"source_code": "var t = int.Parse(Console.ReadLine()!);\r\n\r\nwhile (t-- > 0)\r\n{\r\n var x = int.Parse(Console.ReadLine()!);\r\n\r\n var array = Console.ReadLine()!.Split(\" \").Select(int.Parse).ToList();\r\n\r\n var a = array[0];\r\n var b = array[1];\r\n var c = array[2];\r\n\r\n var doorOpened = 0;\r\n\r\n switch (x)\r\n {\r\n case 1:\r\n doorOpened++;\r\n x = a;\r\n break;\r\n case 2:\r\n doorOpened++;\r\n x = b;\r\n break;\r\n case 3:\r\n doorOpened++;\r\n x = c;\r\n break;\r\n }\r\n\r\n switch (x)\r\n {\r\n case 1:\r\n doorOpened++;\r\n x = a;\r\n break;\r\n case 2:\r\n doorOpened++;\r\n x = b;\r\n break;\r\n case 3:\r\n doorOpened++;\r\n x = c;\r\n break;\r\n }\r\n\r\n switch (x)\r\n {\r\n case 1:\r\n doorOpened++;\r\n break;\r\n case 2:\r\n doorOpened++;\r\n break;\r\n case 3:\r\n doorOpened++;\r\n break;\r\n }\r\n\r\n Console.WriteLine(doorOpened == 3 ? \"YES\" : \"NO\");\r\n}"}, {"source_code": "\ufeffusing System.Numerics;\r\nusing System.Text;\r\n\r\n\r\n\r\nint intTemp = Convert.ToInt32(Console.ReadLine());\r\nfor (int index = 0; index < intTemp; index++)\r\n{\r\n int x = Convert.ToInt32(Console.ReadLine());\r\n\r\n //Read line, and split it by whitespace into an array of strings\r\n string[] tokens = Console.ReadLine().Split();\r\n //Parse element 0\r\n var arr = new int[3];\r\n arr[0] = int.Parse(tokens[0]);\r\n //Parse element 1\r\n arr[1] = int.Parse(tokens[1]);\r\n arr[2] = int.Parse(tokens[2]);\r\n\r\n var firstNum = arr[x - 1];//2\r\n if(firstNum != 0)\r\n {\r\n var sec = arr[firstNum - 1];//1\r\n if(sec != 0)\r\n {\r\n var third=arr[sec-1];\r\n if(third == 0)\r\n {\r\n Console.WriteLine(\"YES\");\r\n \r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n \r\n \r\n}\r\n"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace A\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i int.Parse(x)).ToArray();\r\n int s = 0;\r\n while (mass[k-1] != 0)\r\n {\r\n k = mass[k - 1];\r\n s = s + 1;\r\n }\r\n s = s + 1;\r\n if (s < mass.Length)\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"YES\");\r\n } \r\n\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing CompLib.Util;\r\nusing System.Threading;\r\nusing System.IO;\r\n\r\npublic class Program\r\n{\r\n\r\n public void Solve()\r\n {\r\n var sc = new Scanner();\r\n#if !DEBUG\r\n System.Console.SetOut(new System.IO.StreamWriter(System.Console.OpenStandardOutput()) { AutoFlush = false });\r\n#endif\r\n int t = sc.NextInt();\r\n for (int i = 0; i < t; i++)\r\n {\r\n Query(sc);\r\n }\r\n System.Console.Out.Flush();\r\n }\r\n\r\n void Query(Scanner sc)\r\n {\r\n int x = sc.NextInt();\r\n int[] a = sc.IntArray();\r\n\r\n var b = new bool[3];\r\n var k = new Queue();\r\n k.Enqueue(x-1);\r\n\r\n while (k.Count > 0)\r\n {\r\n int q = k.Dequeue();\r\n if (a[q] != 0)\r\n {\r\n // Console.WriteLine($\"d={q}\");\r\n k.Enqueue(a[q] - 1);\r\n a[q] = 0;\r\n }\r\n }\r\n\r\n for (int i = 0; i < 3; i++)\r\n {\r\n if (a[i] != 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n return;\r\n }\r\n }\r\n\r\n Console.WriteLine(\"YES\");\r\n }\r\n\r\n public static void Main(string[] args) => new Program().Solve();\r\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\r\n}\r\n\r\nnamespace CompLib.Util\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n class Scanner\r\n {\r\n private string[] _line;\r\n private int _index;\r\n private const char Separator = ' ';\r\n\r\n public Scanner()\r\n {\r\n _line = new string[0];\r\n _index = 0;\r\n }\r\n\r\n public string Next()\r\n {\r\n if (_index >= _line.Length)\r\n {\r\n string s;\r\n do\r\n {\r\n s = Console.ReadLine();\r\n } while (s.Length == 0);\r\n\r\n _line = s.Split(Separator);\r\n _index = 0;\r\n }\r\n\r\n return _line[_index++];\r\n }\r\n\r\n public string ReadLine()\r\n {\r\n _index = _line.Length;\r\n return Console.ReadLine();\r\n }\r\n\r\n public int NextInt() => int.Parse(Next());\r\n public long NextLong() => long.Parse(Next());\r\n public double NextDouble() => double.Parse(Next());\r\n public decimal NextDecimal() => decimal.Parse(Next());\r\n public char NextChar() => Next()[0];\r\n public char[] NextCharArray() => Next().ToCharArray();\r\n\r\n public string[] Array()\r\n {\r\n string s = Console.ReadLine();\r\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\r\n _index = _line.Length;\r\n return _line;\r\n }\r\n\r\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\r\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\r\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\r\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\r\n }\r\n}\r\n"}, {"source_code": "using System.Text;\r\nusing static System.Math;\r\nusing static System.Console;\r\n\r\nvar q = int.Parse(ReadLine()!);\r\nvar ansBuilder = new StringBuilder();\r\n\r\nwhile (q-- > 0)\r\n{\r\n var key = int.Parse(ReadLine()!);\r\n var inputs = ReadLine()!.Split(\" \").Select(int.Parse).ToArray();\r\n var current = key - 1;\r\n var count = 0;\r\n while (current >= 0)\r\n {\r\n current = inputs[current] - 1;\r\n ++count;\r\n }\r\n\r\n ansBuilder.Append(count >= 3 ? \"YES\\n\" : \"NO\\n\");\r\n}\r\nWriteLine(ansBuilder.ToString());"}, {"source_code": "using System;\r\nusing System.Linq;\r\n\r\nint n = int.Parse(Console.ReadLine());\r\n\r\nfor (int i = 0; i < n; i++)\r\n{\r\n int keyNum = int.Parse(Console.ReadLine());\r\n int[] doors = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\r\n int tryNumber = 1;\r\n while (true)\r\n {\r\n if (doors[keyNum - 1] == 0 || tryNumber == 3)\r\n {\r\n break;\r\n }\r\n\r\n keyNum = doors[keyNum - 1];\r\n tryNumber++;\r\n }\r\n\r\n if (tryNumber == 3)\r\n {\r\n Console.WriteLine(\"YES\");\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n}"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Globalization;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace ConsoleApp\r\n{\r\n public struct Vector\r\n {\r\n public double X;\r\n public double Y;\r\n public double Atan2 => Math.Atan2(Y, X);\r\n public double LengthSquared => (X * X) + (Y * Y);\r\n public double Length => Math.Sqrt(LengthSquared);\r\n\r\n public Vector(double x, double y)\r\n {\r\n X = x;\r\n Y = y;\r\n }\r\n\r\n public bool EqualsTo(Vector other, double epsilon = Compare.defaultEpsilon)\r\n {\r\n return Compare.Equal(this.X, other.X, epsilon) && Compare.Equal(this.Y, other.Y, epsilon);\r\n }\r\n public override string ToString()\r\n {\r\n return string.Format(\"{0:F3} {1:F3}\", X, Y);\r\n }\r\n\r\n public static double DotProduct(Vector left, Vector right)\r\n {\r\n return (left.X * right.X) + (left.Y * right.Y);\r\n }\r\n public static double Determinant(Vector left, Vector right)\r\n {\r\n return (left.X * right.Y) - (left.Y * right.X);\r\n }\r\n public static double AngleBetween(Vector left, Vector right)\r\n {\r\n return Math.Acos(DotProduct(left, right) / (left.Length * right.Length));\r\n }\r\n public static Vector operator +(Vector p)\r\n {\r\n return p;\r\n }\r\n public static Vector operator -(Vector p)\r\n {\r\n return new Vector(-p.X, -p.Y);\r\n }\r\n public static Vector operator +(Vector left, Vector right)\r\n {\r\n return new Vector(left.X + right.X, left.Y + right.Y);\r\n }\r\n public static Vector operator -(Vector left, Vector right)\r\n {\r\n return left + -right;\r\n }\r\n public static Vector operator *(Vector v, double k)\r\n {\r\n return new Vector(v.X * k, v.Y * k);\r\n }\r\n public static Vector operator /(Vector v, double k)\r\n {\r\n return new Vector(v.X / k, v.Y / k);\r\n }\r\n public static bool operator ==(Vector left, Vector right)\r\n {\r\n return (left.X == right.X) && (left.Y == right.Y);\r\n }\r\n public static bool operator !=(Vector left, Vector right)\r\n {\r\n return !(left == right);\r\n }\r\n }\r\n public static class Compare\r\n {\r\n public const double defaultEpsilon = 1e-13;\r\n public static bool Equal(double a, double b, double epsilon = defaultEpsilon)\r\n {\r\n return Math.Abs(a - b) < epsilon;\r\n }\r\n public static bool Less(double a, double b, double epsilon = defaultEpsilon)\r\n {\r\n return (a < b) && !Equal(a, b, epsilon);\r\n }\r\n public static bool LessEqual(double a, double b, double epsilon = defaultEpsilon)\r\n {\r\n return (a < b) || Equal(a, b, epsilon);\r\n }\r\n public static bool Greater(double a, double b, double epsilon = defaultEpsilon)\r\n {\r\n return (a > b) && !Equal(a, b, epsilon);\r\n }\r\n public static bool GreaterEqual(double a, double b, double epsilon = defaultEpsilon)\r\n {\r\n return (a > b) || Equal(a, b, epsilon);\r\n }\r\n }\r\n public static class Algebra\r\n {\r\n private static void Swap(ref int a, ref int b)\r\n {\r\n int temp = a;\r\n a = b;\r\n b = temp;\r\n }\r\n private static void Swap(ref long a, ref long b)\r\n {\r\n long temp = a;\r\n a = b;\r\n b = temp;\r\n }\r\n\r\n public static int GCD(int a, int b)\r\n {\r\n while (b != 0)\r\n {\r\n a %= b;\r\n Swap(ref a, ref b);\r\n }\r\n\r\n return a;\r\n }\r\n public static long GCD(long a, long b)\r\n {\r\n while (b != 0)\r\n {\r\n a %= b;\r\n Swap(ref a, ref b);\r\n }\r\n\r\n return a;\r\n }\r\n public static int LCM(int a, int b)\r\n {\r\n return (a / GCD(a, b)) * b;\r\n }\r\n public static long LCM(long a, long b)\r\n {\r\n return (a / GCD(a, b)) * b;\r\n }\r\n public static bool IsPrime(int val)\r\n {\r\n if (val < 2)\r\n {\r\n return false;\r\n }\r\n\r\n for (int i = 2; i * i <= val; i++)\r\n {\r\n if (val % i == 0)\r\n {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n public static long QuickPow(int val, uint power)\r\n {\r\n long result = 1;\r\n\r\n while (power > 0)\r\n {\r\n if ((power & 1) == 1)\r\n {\r\n result *= val;\r\n }\r\n\r\n val *= val;\r\n power >>= 1;\r\n }\r\n\r\n return result;\r\n }\r\n }\r\n public static class Geometry\r\n {\r\n public static List GetConvexPolygon(List points)\r\n {\r\n Vector bottomLeft = points[0];\r\n foreach (Vector point in points)\r\n {\r\n if (point.Y < bottomLeft.Y)\r\n {\r\n bottomLeft = point;\r\n }\r\n else if (point.Y == bottomLeft.Y && point.X < bottomLeft.X)\r\n {\r\n bottomLeft = point;\r\n }\r\n }\r\n\r\n List temp = new List();\r\n foreach (Vector point in points)\r\n {\r\n if (point == bottomLeft)\r\n {\r\n continue;\r\n }\r\n\r\n temp.Add(point - bottomLeft);\r\n }\r\n temp.Sort(new VectorAtanComparer());\r\n\r\n Stack polygon = new Stack();\r\n polygon.Push(new Vector());\r\n\r\n foreach (Vector next in temp)\r\n {\r\n if (polygon.Count < 2)\r\n {\r\n polygon.Push(next);\r\n continue;\r\n }\r\n\r\n\r\n\r\n while (polygon.Count > 1)\r\n {\r\n Vector current = polygon.Pop();\r\n Vector previous = polygon.Peek();\r\n\r\n if (Vector.Determinant(next - current, previous - current) > 0)\r\n {\r\n polygon.Push(current);\r\n break;\r\n }\r\n }\r\n polygon.Push(next);\r\n }\r\n\r\n List result = new List();\r\n result.Add(new Vector());\r\n result.AddRange(polygon);\r\n return result;\r\n }\r\n }\r\n public class VectorAtanComparer : IComparer\r\n {\r\n public int Compare(Vector left, Vector right)\r\n {\r\n double a = left.Atan2;\r\n double b = right.Atan2;\r\n\r\n if (a < b)\r\n {\r\n return -1;\r\n }\r\n else if (a > b)\r\n {\r\n return 1;\r\n }\r\n else\r\n {\r\n a = left.LengthSquared;\r\n b = right.LengthSquared;\r\n\r\n if (a < b)\r\n {\r\n return -1;\r\n }\r\n else if (a > b)\r\n {\r\n return 1;\r\n }\r\n else\r\n {\r\n return 0;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public class Program\r\n {\r\n static Program()\r\n {\r\n CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();\r\n cultureInfo.NumberFormat.NumberDecimalSeparator = \".\";\r\n CultureInfo.CurrentCulture = cultureInfo;\r\n\r\n const bool useFiles = false;\r\n\r\n if (useFiles)\r\n {\r\n const bool useCustomFileNames = false;\r\n const string customFileName = \"data\";\r\n\r\n Console.SetIn(new StreamReader(useCustomFileNames ? customFileName + \".in\" : \"input.txt\"));\r\n Console.SetOut(new StreamWriter(useCustomFileNames ? customFileName + \".out\" : \"output.txt\"));\r\n }\r\n }\r\n public static string[] ReadStringData()\r\n {\r\n return Console.ReadLine()\r\n ?.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .ToArray() ?? Array.Empty();\r\n }\r\n public static int[] ReadIntData()\r\n {\r\n return Console.ReadLine()\r\n ?.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(str => int.Parse(str))\r\n .ToArray() ?? Array.Empty();\r\n }\r\n public static long[] ReadLongData()\r\n {\r\n return Console.ReadLine()\r\n ?.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(str => long.Parse(str))\r\n .ToArray() ?? Array.Empty();\r\n }\r\n public static double[] ReadDoubleData()\r\n {\r\n return Console.ReadLine()\r\n ?.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\r\n .Select(str => double.Parse(str))\r\n .ToArray() ?? Array.Empty();\r\n }\r\n public static void Main()\r\n {\r\n int testCases = int.Parse(Console.ReadLine());\r\n\r\n for (int z = 0; z < testCases; z++)\r\n {\r\n int x = int.Parse(Console.ReadLine()) - 1;\r\n\r\n int[] keys = ReadIntData().Select(val => val - 1).ToArray();\r\n\r\n bool[] isOpened = new bool[3];\r\n while (x != -1 && !isOpened[x])\r\n {\r\n isOpened[x] = true;\r\n x = keys[x];\r\n }\r\n\r\n Console.WriteLine(isOpened.All(val => val) ? \"YES\" : \"NO\");\r\n }\r\n\r\n Console.Out.Flush();\r\n }\r\n }\r\n}"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace CodeForces800\r\n{\r\n internal static class Program\r\n {\r\n public static void Main()\r\n {\r\n var str = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x.ToString())).ToList();\r\n var rep = str[0];\r\n for (var iter = 0; iter < rep; iter++)\r\n {\r\n str = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x.ToString())).ToList();\r\n var n = str[0];\r\n str = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x.ToString())).ToList();\r\n if (str[n - 1] == 0 || str[str[n - 1] - 1] == 0)\r\n Console.WriteLine(\"NO\");\r\n else\r\n Console.WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n// ReSharper disable InconsistentNaming\n\nnamespace App\n{\n [SuppressMessage(\"ReSharper\", \"SuggestVarOrType_BuiltInTypes\")]\n public class Algo\n {\n private readonly StreamWriter _w;\n private readonly StreamReader _r;\n\n public Algo(StreamReader r, StreamWriter w)\n {\n _w = w;\n _r = r;\n }\n\n public void Run()\n {\n int t = _r.I();\n\n for (int i = 1; i <= t; i++)\n {\n Solve();\n }\n }\n\n private void Solve()\n {\n int k = _r.I();\n\n int[] doors = _r.II1(3);\n\n bool[] opened = new bool[4];\n\n while (k != 0)\n {\n opened[k] = true;\n k = doors[k];\n }\n\n _w.WriteYESNOLine(opened.Skip(1).All(r=>r));\n }\n\n class Row\n {\n public bool TryAdd(int floor, int p)\n {\n throw new NotImplementedException();\n }\n\n public int Min { get; }\n\n public int ValueUpTo(int i)\n {\n throw new NotImplementedException();\n }\n }\n \n }\n\n public static class Solution\n {\n public static void Main(string[] args)\n {\n var f = new Factory();\n var r = f.GetReader();\n var w = f.GetWriter();\n Algo p = new Algo(r, w);\n p.Run();\n w.Flush();\n\n f.Dispose();\n }\n }\n\n public interface IFactory\n {\n StreamWriter GetWriter();\n StreamReader GetReader();\n void Dispose();\n }\n\n public class Factory : IDisposable, IFactory\n {\n private StreamWriter _sw;\n private StreamReader _sr;\n\n public StreamWriter GetWriter()\n {\n return _sw = new StreamWriter(Console.OpenStandardOutput());\n }\n\n public StreamReader GetReader()\n {\n return _sr = new StreamReader(Console.OpenStandardInput());\n }\n\n public void Dispose()\n {\n _sw?.Dispose();\n _sr?.Dispose();\n }\n }\n\n public static class ReaderExtensions\n {\n static char[] _tokens = new char[4];\n\n public static ReadOnlySpan NextToken(this StreamReader sr)\n {\n int size = 0;\n\n bool skipWhiteSpaceMode = true;\n while (true)\n {\n int nextChar = sr.Read();\n if (nextChar == -1)\n {\n break;\n }\n\n char ch = (char) nextChar;\n if (char.IsWhiteSpace(ch))\n {\n if (!skipWhiteSpaceMode)\n {\n if (ch == '\\r' && (Environment.NewLine == \"\\r\\n\"))\n {\n sr.Read();\n }\n\n break;\n }\n }\n else\n {\n skipWhiteSpaceMode = false;\n if (size == _tokens.Length)\n {\n char[] a2 = new char[_tokens.Length * 2];\n Array.Copy(_tokens, a2, _tokens.Length);\n _tokens = a2;\n }\n\n _tokens[size++] = ch;\n }\n }\n\n return new ReadOnlySpan(_tokens, 0, size);\n }\n\n public static char C(this StreamReader sr)\n {\n while (true)\n {\n int nextChar = sr.Read();\n if (nextChar == -1)\n {\n // End of stream reached\n return (char) 0;\n }\n\n char ch = (char) nextChar;\n if (!char.IsWhiteSpace(ch))\n {\n return ch;\n }\n }\n }\n\n public static int I(this StreamReader sr)\n {\n var token = new string(NextToken(sr));\n return int.Parse(token);\n }\n\n public static double D(this StreamReader sr, bool acceptAnyDecimalSeparator = true)\n {\n var token = NextToken(sr);\n if (acceptAnyDecimalSeparator)\n {\n var tokens = new string(token).Replace(',', '.');\n double result = double.Parse(tokens, CultureInfo.InvariantCulture);\n return result;\n }\n else\n {\n double result = double.Parse(token);\n return result;\n }\n }\n\n public static decimal M(this StreamReader sr, bool acceptAnyDecimalSeparator = true)\n {\n var token = NextToken(sr);\n if (acceptAnyDecimalSeparator)\n {\n var tokens = new string(token).Replace(',', '.');\n decimal result = decimal.Parse(tokens, CultureInfo.InvariantCulture);\n return result;\n }\n else\n {\n decimal result = decimal.Parse(token);\n return result;\n }\n }\n\n public static int[] II(this StreamReader r, int n)\n {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++)\n ret[i] = r.I();\n\n return ret;\n }\n\n public static int[] II1(this StreamReader r, int n)\n {\n int[] ret = new int[n + 1];\n for (int i = 1; i < n + 1; i++)\n ret[i] = r.I();\n\n return ret;\n }\n\n public static int[] II2(this StreamReader r, int n)\n {\n int[] ret = new int[n + 2];\n for (int i = 2; i < n + 2; i++)\n ret[i] = r.I();\n\n return ret;\n }\n\n public static char[] CC(this StreamReader r, int n)\n {\n char[] ret = new char[n];\n for (int i = 0; i < n; i++)\n ret[i] = r.C();\n\n return ret;\n }\n\n public static int[] Digits(this StreamReader r, int n)\n {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++)\n ret[i] = (int) (r.C() - (int) '0');\n\n return ret;\n }\n\n public static bool[] BB(this StreamReader r, int n)\n {\n bool[] ret = new bool[n];\n for (int i = 0; i < n; i++)\n ret[i] = r.C() == '1';\n\n return ret;\n }\n\n public static bool[] BB(this StreamReader r)\n {\n var token = r.NextToken();\n\n bool[] ret = new bool[token.Length];\n for (int i = 0; i < ret.Length; i++)\n ret[i] = token[i] == '1';\n\n return ret;\n }\n\n public static bool[] PlusesMinuses(this StreamReader r, int length)\n {\n bool[] ret = new bool[length];\n for (int i = 0; i < length; i++)\n ret[i] = r.C() == '+';\n\n return ret;\n }\n\n public static bool[] OnesZeroes(this StreamReader r, int length)\n {\n bool[] ret = new bool[length];\n for (int i = 0; i < length; i++)\n ret[i] = r.C() == '1';\n\n return ret;\n }\n\n public static Int16[] SS(this StreamReader r, int n)\n {\n Int16[] ret = new Int16[n];\n for (int i = 0; i < n; i++)\n ret[i] = Int16.Parse(r.NextToken());\n\n return ret;\n }\n\n public static long[] LL(this StreamReader r, int n)\n {\n long[] ret = new long[n];\n for (long i = 0; i < n; i++)\n ret[i] = long.Parse(r.NextToken());\n\n return ret;\n }\n\n public static long[] LL1(this StreamReader r, int n)\n {\n long[] ret = new long[n + 1];\n for (int i = 1; i < n + 1; i++)\n ret[i] = long.Parse(r.NextToken());\n\n return ret;\n }\n\n public static void WriteLine(this StreamWriter w, int i)\n {\n w.WriteLine(i.ToString());\n }\n\n public static void WriteLine(this StreamWriter w, char[] z)\n {\n w.WriteLine(new string(z));\n }\n\n public static void WriteYESNOLine(this StreamWriter w, bool b)\n {\n w.WriteLine(b ? \"YES\" : \"NO\");\n }\n\n public static void WriteBits(this StreamWriter w, BitArray bb)\n {\n foreach (bool b in bb)\n {\n w.Write(b ? '1' : '0');\n }\n\n w.WriteLine();\n }\n\n public static void WriteBits1(this StreamWriter w, BitArray bb)\n {\n bool first = true;\n foreach (bool b in bb)\n {\n if (first)\n {\n first = false;\n continue;\n }\n\n w.Write(b ? '1' : '0');\n }\n\n w.WriteLine();\n }\n\n\n public static void WriteChars1(this StreamWriter w, char[] cc)\n {\n foreach (char c in cc.Skip(1))\n {\n w.Write(c);\n }\n\n w.WriteLine();\n }\n\n public static void WriteNums1(this StreamWriter w, IEnumerable nn)\n {\n w.WriteNums(nn.Skip(1));\n }\n\n public static void WriteNums(this StreamWriter w, IEnumerable nn)\n {\n bool first = true;\n foreach (int n in nn)\n {\n if (first)\n {\n first = false;\n }\n else\n {\n w.Write(' ');\n }\n\n w.Write(n);\n }\n\n w.WriteLine();\n }\n\n public static void WriteNums(this StreamWriter w, IEnumerable nn)\n {\n bool first = true;\n foreach (long n in nn)\n {\n if (first)\n {\n first = false;\n }\n else\n {\n w.Write(' ');\n }\n\n w.Write(n);\n }\n\n w.WriteLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Linq;\r\nusing static System.Console;\r\nnamespace CodeFrorces\r\n{\r\n class Program\r\n {\r\n static void Main()\r\n {\r\n for (int t = int.Parse(ReadLine()); t-- > 0;)\r\n {\r\n int x = int.Parse(ReadLine());\r\n int[] arr = Array.ConvertAll(ReadLine().Split(\" \"), int.Parse);\r\n WriteLine(arr[x - 1] == 0 || arr[arr[x - 1] - 1] == 0 ? \"NO\" : \"YES\");\r\n }\r\n }\r\n }\r\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Linq;\r\nusing static System.Console;\r\nnamespace CodeFrorces\r\n{\r\n class Program\r\n {\r\n static void Main()\r\n {\r\n for (int t = int.Parse(ReadLine()); t-- > 0;)\r\n {\r\n int x = int.Parse(ReadLine());\r\n int[] arr = ReadLine().Split(\" \").Select(int.Parse).ToArray();\r\n WriteLine(arr[x - 1] == 0 || arr[arr[x - 1] - 1] == 0 ? \"NO\" : \"YES\");\r\n }\r\n }\r\n }\r\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Linq;\r\nusing static System.Console;\r\nnamespace CodeFrorces\r\n{\r\n class Program\r\n {\r\n static void Main()\r\n {\r\n for(int t = int.Parse(ReadLine()); t-- > 0;)\r\n {\r\n int x = int.Parse(ReadLine());\r\n int[] arr = ReadLine().Split(\" \").Select(int.Parse).ToArray();\r\n if (arr[x - 1] == 0) { WriteLine(\"NO\"); continue; }\r\n if (arr[arr[x-1]-1] == 0) { WriteLine(\"NO\"); continue; }\r\n WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}"}, {"source_code": "using System;\r\n\r\n\r\nnamespace A.Three_Doors\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < t; i++)\r\n {\r\n int x = int.Parse(Console.ReadLine()) - 1;\r\n int[] doors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n\r\n if (doors[x] == 0 || doors[doors[x] - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n Console.WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\n\r\n\r\nnamespace A.Three_Doors\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < t; i++)\r\n {\r\n int x = int.Parse(Console.ReadLine());\r\n int[] doors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n\r\n if (doors[x - 1] == 0 || doors[doors[x - 1] - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n Console.WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\n\r\nnamespace ConsoleApp7\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < t; i++)\r\n {\r\n int x = int.Parse(Console.ReadLine());\r\n int[] doors = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\r\n \r\n if (doors[x - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n if (doors[doors[x - 1] - 1] == 0)\r\n {\r\n Console.WriteLine(\"NO\");\r\n continue;\r\n }\r\n Console.WriteLine(\"YES\");\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\n\r\npublic class hello\r\n{\r\n static void Main()\r\n {\r\n var t = int.Parse(Console.ReadLine().Trim());\r\n while (t-- > 0)\r\n {\r\n var x = int.Parse(Console.ReadLine().Trim());\r\n string[] line = Console.ReadLine().Trim().Split(' ');\r\n var a = Array.ConvertAll(line, int.Parse);\r\n getAns(x, a);\r\n }\r\n }\r\n static void getAns(int x, int[] a)\r\n {\r\n var k1 = a[x - 1];\r\n if (k1 == 0) { Console.WriteLine(\"NO\"); return; }\r\n var k2 = a[k1 - 1];\r\n Console.WriteLine(k2 == 0? \"NO\":\"YES\");\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing static System.Console;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nclass Program\r\n{\r\n static int NN => int.Parse(ReadLine());\r\n static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();\r\n static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();\r\n static void Main()\r\n {\r\n var t = NN;\r\n var res = new bool[t];\r\n for (var u = 0; u < t; ++u)\r\n {\r\n var x = NN;\r\n var d = NList;\r\n res[u] = Open(x, d);\r\n }\r\n WriteLine(string.Join(\"\\n\", res.Select(f => f ? \"YES\" : \"NO\")));\r\n }\r\n static bool Open(int x, int[] d)\r\n {\r\n if (d[x - 1] == 0) return false;\r\n if (d[d[x - 1] - 1] == 0) return false;\r\n return true;\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\n\r\nnamespace CodeForces\r\n{\r\n internal class ThreeDoors\r\n {\r\n public static void Main(string[] args)\r\n {\r\n int testcases = int.Parse(Console.ReadLine());\r\n\r\n for (int i = 0; i < testcases; i++)\r\n {\r\n int key = int.Parse(Console.ReadLine());\r\n\r\n int[] doors = new int[3];\r\n string[] split = Console.ReadLine().Split();\r\n\r\n for (int j = 0; j < 3; j++)\r\n {\r\n doors[j] = int.Parse(split[j]);\r\n }\r\n\r\n TestPossible(key, doors);\r\n }\r\n }\r\n\r\n static void TestPossible(int key, int[] doors)\r\n {\r\n for (int i = 0; i < 2; i++)\r\n {\r\n key = doors[key - 1];\r\n if (key == 0)\r\n {\r\n Console.WriteLine(\"no\");\r\n return;\r\n }\r\n }\r\n Console.WriteLine(\"yes\");\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\n\t\t\t\t\t\r\npublic class Program\r\n{\r\n\tpublic static void Main()\r\n\t{\r\n\t\tint t = int.Parse(Console.ReadLine());\r\n\t\t\r\n\t\twhile(t-- > 0)\r\n\t\t{\r\n\t\t\tint key = int.Parse(Console.ReadLine());\r\n\t\t var input = Console.ReadLine().Split().ToList().Select(x => int.Parse(x)).ToList();\r\n\t\t //int N = input[0];\r\n\t\t //int K = input[1];\r\n\t\t //int X = input[2];\r\n\t\t //int Y = input[3];\r\n\t\t\tbool done = false;\r\n\t\t\tint count = 0;\r\n\t\t\twhile(!done)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t//go to door with key\r\n\t\t\t\tvar x = input[key - 1];\r\n\t\t\t\tif(x == 0)\r\n\t\t\t\t break;\r\n\t\t\t\telse{\r\n\t\t\t\t\tcount++;\r\n\t\t\t\t\tkey = x;\r\n\t\t\t\t}\r\n\t\t\t\tif(count == 2)\r\n\t\t\t\t\tdone = true;\r\n\t\t\t\t\tif(count > 4)\r\n\t\t\t\t\tdone = true;\r\n\t\t\t}\r\n\t\t\tif(done)\r\n\t\t\t\tConsole.WriteLine(\"YES\");\r\n\t\t\telse\r\n\t\t\t\tConsole.WriteLine(\"NO\");\r\n\t\t\t//Console.WriteLine(N);\r\n\t\t\t//Console.WriteLine(K);\r\n\t\t\t//Console.WriteLine(X);\r\n\t\t\t//Console.WriteLine(Y);\r\n\t\t \t\t \t\t \r\n\t\t}\r\n\t\r\n\t}\r\n}\r\n\t\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApp2\r\n{\r\n internal class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n \r\n int t = int.Parse(Console.ReadLine());\r\n for (int i = 0; i < t; i++)\r\n {\r\n int cnt = 0;\r\n int x = int.Parse(Console.ReadLine());\r\n string[] d = Console.ReadLine().Split(' ');\r\n for (int j = 0; j < 2; j++)\r\n {\r\n if (d[x - 1] != \"0\")\r\n {\r\n int temp = int.Parse (d[x - 1]);\r\n d[x-1] = \"0\";\r\n cnt++;\r\n x = temp;\r\n }\r\n else\r\n break;\r\n\r\n }\r\n if (cnt==2)\r\n Console.WriteLine(\"YES\");\r\n else\r\n Console.WriteLine(\"NO\");\r\n }\r\n Console.ReadLine();\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nnamespace kham\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t=int.Parse(Console.ReadLine());\r\n for (int te = 0; te < t; te++)\r\n {\r\n int key=int.Parse(Console.ReadLine())-1;\r\n int[] doors = Console.ReadLine().Split().Select(str => int.Parse(str)).ToArray();\r\n bool[] doors_opened=new bool[doors.Length];\r\n while (key!=-1)\r\n {\r\n doors_opened[key]=true;\r\n key= doors[key]-1;\r\n }\r\n if (!doors_opened.Any(d => !d))\r\n {\r\n Console.WriteLine(\"YES\");\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Numerics;\r\nusing static System.Console;\r\nusing System.Collections.Generic;\r\n\r\nusing static CompLib.Algorithm;\r\nusing static CompLib.EMath;\r\n\r\nnamespace ProblemSolving.cs\r\n{\r\n class MainClass\r\n {\r\n const int Mod = (int) (1e9 + 7);\r\n const int Def = (int) 1e9;\r\n\r\n static long[] OneLongLine => ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();\r\n static int[] OneIntLine => ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\r\n static int[] OneCharLine => ReadLine().Trim().ToCharArray().Select(v => v - '0').ToArray();\r\n static long OneLong => long.Parse(ReadLine().Trim());\r\n static int OneInt => int.Parse(ReadLine().Trim());\r\n static string OneString => ReadLine().Trim();\r\n\r\n\r\n static void Solve()\r\n {\r\n int key = OneInt;\r\n var list = OneIntLine.ToList();\r\n int idx = list.IndexOf(0) + 1;\r\n\r\n if (list[key - 1] == 0 || list[list[key - 1] - 1] == 0)\r\n {\r\n WriteLine(\"NO\");\r\n }\r\n else WriteLine(\"YES\");\r\n \r\n \r\n\r\n\r\n\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n static bool Check(int[] arr)\r\n {\r\n return true;\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n static void Main()\r\n {\r\n int cases = OneInt;\r\n while (--cases >= 0)\r\n {\r\n Solve();\r\n }\r\n\r\n // Solve();\r\n }\r\n }\r\n}\r\n\r\nnamespace CompLib\r\n{\r\n public static class Algorithm\r\n {\r\n public static long LowerBound(long[] arr, long low, long high, long val)\r\n {\r\n if (low > high)\r\n {\r\n return low;\r\n }\r\n\r\n long mid = low + (high - low) / 2;\r\n\r\n if (val <= arr[mid])\r\n {\r\n return LowerBound(arr, low, mid - 1, val);\r\n }\r\n\r\n return LowerBound(arr, mid + 1, high, val);\r\n }\r\n\r\n public static long UpperBound(long[] arr, long low, long high, long val)\r\n {\r\n if (low > high || low == arr.Length)\r\n {\r\n return low;\r\n }\r\n\r\n long mid = low + (high - low) / 2;\r\n\r\n if (val >= arr[mid])\r\n {\r\n return UpperBound(arr, mid + 1, high, val);\r\n }\r\n\r\n return UpperBound(arr, low, mid - 1, val);\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n public static class EMath\r\n {\r\n public static int Mod(int a, int m)\r\n {\r\n return (a % m + m) % m;\r\n }\r\n\r\n public static long Gcd(long a, long b)\r\n {\r\n long r;\r\n while (b != 0)\r\n {\r\n r = a % b;\r\n a = b;\r\n b = r;\r\n }\r\n\r\n return a;\r\n }\r\n\r\n public static long Lcm(long a, long b)\r\n {\r\n if (a > b)\r\n {\r\n return (a / Gcd(a, b)) * b;\r\n }\r\n\r\n return (b / Gcd(a, b)) * a;\r\n }\r\n }\r\n}"}, {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\n\r\nnamespace CF1\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n StringBuilder test = new StringBuilder();\r\n\r\n for (int x = 0; x < t; x++)\r\n {\r\n int n = Convert.ToInt32(Console.ReadLine()) - 1;\r\n string[] input = Console.ReadLine().Split(' ');\r\n bool one = false;\r\n bool two = false;\r\n bool three = false;\r\n\r\n switch (n + 1)\r\n {\r\n case 1:\r\n one = true;\r\n break;\r\n case 2:\r\n two = true;\r\n break;\r\n case 3:\r\n three = true;\r\n break;\r\n }\r\n\r\n while (Int32.Parse(input[n]) != 0)\r\n {\r\n switch (Int32.Parse(input[n]))\r\n {\r\n case 1:\r\n one = true;\r\n break;\r\n case 2:\r\n two = true;\r\n break;\r\n case 3:\r\n three = true;\r\n break;\r\n }\r\n n = Int32.Parse(input[n]) - 1;\r\n }\r\n\r\n if(one && two && three)\r\n {\r\n test.AppendLine(\"YES\");\r\n }\r\n else\r\n {\r\n test.AppendLine(\"NO\");\r\n }\r\n }\r\n\r\n Console.WriteLine(test.ToString());\r\n Console.ReadLine();\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\n\r\nnamespace CodeForces\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n var t = Int32.Parse(Console.ReadLine());\r\n var res = new bool[t];\r\n for(var i = 0;i Int32.Parse(item)).ToArray();\r\n res[i] = IsPossible(key, keysBehindDoor);\r\n }\r\n Console.WriteLine(string.Join('\\n', res.Select(item => item ? \"YES\" : \"NO\")));\r\n }\r\n \r\n static bool IsPossible(int key, int[] keysBehindDoor)\r\n {\r\n if (keysBehindDoor[key-1] == 0)\r\n {\r\n return false;\r\n }\r\n return keysBehindDoor[keysBehindDoor[key-1]-1] != 0;\r\n }\r\n }\r\n}"}, {"source_code": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace YKCodeForces\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Solution s = new Solution();\r\n int t = int.Parse(Console.ReadLine());\r\n while (t > 0)\r\n {\r\n t--;\r\n s.Read();\r\n s.Solve();\r\n }\r\n Console.ReadLine();\r\n }\r\n\r\n class Solution\r\n {\r\n private int x;\r\n private int[] arr;\r\n\r\n public Solution()\r\n {\r\n\r\n }\r\n\r\n public void Read()\r\n {\r\n string s = Console.ReadLine();\r\n x = int.Parse(s);\r\n string[] inputArr = Console.ReadLine().Split(' ');\r\n arr = new int[3];\r\n for (int i = 0; i < 3; i++)\r\n {\r\n arr[i] = int.Parse(inputArr[i]);\r\n }\r\n }\r\n\r\n public void Solve()\r\n {\r\n int cnt = 1;\r\n while (arr[x - 1] != 0)\r\n {\r\n int nextKey = arr[x - 1];\r\n arr[x - 1] = 0;\r\n x = nextKey;\r\n cnt++;\r\n }\r\n if (cnt == 3)\r\n {\r\n Console.WriteLine(\"YES\");\r\n }\r\n else\r\n {\r\n Console.WriteLine(\"NO\");\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing N = System.Int64;\n\nstatic class Program\n{\n static public void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var solver = new Solver();\n solver.Solve();\n Console.Out.Flush();\n }\n}\n\npublic class Solver\n{\n public void Solve()\n {\n int casecount = ri;\n for (int count = 0; count < casecount; count++)\n {\n int x = ri - 1;\n var a = new int[3] { ri - 1, ri - 1, ri - 1 };\n bool ans = true;\n for (int i = 0; i < 3; i++)\n {\n if (x == -1)\n {\n ans = false;\n break;\n }\n int t = a[x];\n a[x] = -1;\n x = t;\n }\n YN(ans);\n }\n }\n\n\n\n const long inf = (long)1 << 60;\n int ri { get { return (int)sc.Integer(); } }\n long rl { get { return sc.Integer(); } }\n double rd { get { return sc.Double(); } }\n string rs { get { return sc.Scan(); } }\n public StreamScanner sc = new StreamScanner(Console.OpenStandardInput());\n\n void WriteJoin(string s, T[] t) { Console.WriteLine(string.Join(s, t)); }\n void WriteJoin(string s, List t) { Console.WriteLine(string.Join(s, t)); }\n void Write(T t) { Console.WriteLine(t.ToString()); }\n void YN(bool t) { Console.WriteLine(t ? \"YES\" : \"NO\"); }\n void Yn(bool t) { Console.WriteLine(t ? \"Yes\" : \"No\"); }\n void yn(bool t) { Console.WriteLine(t ? \"yes\" : \"no\"); }\n void Swap(ref int x, ref int y) { x ^= y; y ^= x; x ^= y; }\n void Swap(ref N x, ref N y) { x ^= y; y ^= x; x ^= y; }\n void Swap(ref T x, ref T y) { T t = y; y = x; x = t; }\n}\n\n\npublic class StreamScanner\n{\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) throw new EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; }\n }\n return buf[ptr++];\n }\n public char Char()\n {\n byte b = 0;\n do b = read();\n while (b < 33 || 126 < b);\n return (char)b;\n }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n return sb.ToString();\n }\n public long Integer()\n {\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b) return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public double Double() { return double.Parse(Scan()); }\n}"}, {"source_code": "// Problem: 1709A - Three Doors\r\n// Author: Gusztav Szmolik\r\n\r\nusing System;\r\nusing System.Text;\r\n\r\npublic class ThreeDoors {\r\n \r\n public static void Main () {\r\n StringBuilder ans = new StringBuilder ();\r\n byte t = byte.Parse (Console.ReadLine ());\r\n \r\n for (byte i = 0; i < t; i++) {\r\n byte x = byte.Parse (Console.ReadLine ());\r\n string[] parts = Console.ReadLine ().Split ();\r\n byte a = byte.Parse (parts[0]);\r\n byte b = byte.Parse (parts[1]);\r\n byte c = byte.Parse (parts[2]);\r\n byte[] doors = new byte[] { a,b,c };\r\n byte countDoor = 0;\r\n byte j = Convert.ToByte (x-1);\r\n bool processing = true;\r\n \r\n while (processing) {\r\n \r\n if (doors[j] == 255)\r\n processing = false;\r\n \r\n else {\r\n byte key = doors[j];\r\n doors[j] = 255;\r\n countDoor++;\r\n \r\n if (countDoor == 3 || key == 0)\r\n processing = false;\r\n \r\n else\r\n j = Convert.ToByte (key-1);\r\n }\r\n }\r\n \r\n ans.Append (countDoor == 3 ? \"YES\" : \"NO\");\r\n ans.AppendLine ();\r\n }\r\n \r\n Console.Write (ans);\r\n }\r\n}\r\n"}, {"source_code": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.Linq;\r\nusing static System.Console;\r\nusing System.Collections;\r\n\r\nnamespace leetcode\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n\r\n int t = int.Parse(Console.ReadLine());\r\n while (t-- != 0)\r\n {\r\n Console.WriteLine(solver()?\"YES\":\"NO\");\r\n }\r\n }\r\n\r\n static long[] OneLongLine => ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();\r\n static int[] OneIntLine => ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\r\n static int[] OneCharLine => ReadLine().Trim().ToCharArray().Select(v => v - '0').ToArray();\r\n static long OneLong => long.Parse(ReadLine().Trim());\r\n static int OneInt => int.Parse(ReadLine().Trim());\r\n\r\n\r\n static bool solver()\r\n {\r\n int a = OneInt;\r\n int[] b = OneIntLine;\r\n bool[] fa=new bool[3];\r\n for (int i = a-1; i < 3; i++)\r\n {\r\n if (i < 0) break;\r\n fa[i] = true;\r\n i = b[i] - 2;\r\n }\r\n return fa.All(x=>x==true);\r\n }\r\n\r\n }\r\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Compete2\n{\n partial class MainClass\n {\n public static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n List output = new List();\n\n for (int z = 0; z < count; z++)\n {\n //Console.ReadLine();\n //var s = Console.ReadLine();\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(qw => long.Parse(qw)).ToList();\n //var b = Console.ReadLine().Split(' ').Select(qw => long.Parse(qw)).ToList();\n //var c = Console.ReadLine().Split(' ').Select(qw => long.Parse(qw)).ToList();\n //var b = long.Parse(Console.ReadLine());\n\n //long o = 0;\n bool can = true;\n\n if (a[n - 1] > 0)\n {\n n = (int)a[n - 1];\n\n if (a[n - 1] > 0)\n {\n n = (int)a[n - 1];\n }\n else\n can = false;\n }\n else\n can = false;\n\n\n if (can)\n output.Add(\"YES\");\n else\n output.Add(\"NO\");\n\n\n //output.Add(o.ToString());\n //output.Add(string.Join(\" \", o));\n }\n\n output.ForEach(d => Console.WriteLine(d));\n }\n\n }\n}\n\n//CODE JAM\n/*if (can)\n output.Add(\"Case #\" + (z + 1).ToString() + \": \" + string.Join(\" \", o));\nelse\n output.Add(\"Case #\" + (z + 1).ToString() + \": \" + \"IMPOSSIBLE\");*/\n\n//output.Add(\"Case #\" + (z + 1).ToString() + \": \" + o.ToString());\n\n"}], "negative_code": [{"source_code": "static void Main(string[] args)\r\n {\r\n int testCases = Int32.Parse(Console.ReadLine());\r\n while (testCases != 0){\r\n int firstKey = Int32.Parse(Console.ReadLine()) - 1;\r\n int[] doorArray = Console.ReadLine().Split(' ').Select(s => Int32.Parse(s)).ToArray();\r\n\r\n Console.WriteLine(doorArray[firstKey] != 0 && doorArray[doorArray[firstKey] - 1] != 0 ? \"YES\" : \"NO\");\r\n testCases--;\r\n };\r\n }"}, {"source_code": " static void Main(string[] args)\r\n {\r\n Console.WriteLine(\"Start\");\r\n int testCases = Int32.Parse(Console.ReadLine());\r\n while (testCases != 0){\r\n int firstKey = Int32.Parse(Console.ReadLine()) - 1;\r\n int[] doorArray = Console.ReadLine().Split(' ').Select(s => Int32.Parse(s)).ToArray();\r\n\r\n Console.WriteLine(doorArray[firstKey] != 0 && doorArray[doorArray[firstKey] - 1] != 0 ? \"YES\" : \"NO\");\r\n testCases--;\r\n };\r\n }"}, {"source_code": "using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\n\r\nnamespace CodeForces_CS\r\n{\r\n internal class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n int t = Convert.ToInt32(Console.ReadLine());\r\n\r\n while(t-- > 0)\r\n {\r\n int key = Convert.ToInt32(Console.ReadLine());\r\n\r\n string s = Console.ReadLine();\r\n int[] arr = s.Split(' ').Select(int.Parse).ToArray();\r\n\r\n int index = 0;\r\n\r\n while(true)\r\n {\r\n key = arr[key - 1];\r\n index++;\r\n if (key == 0) break;\r\n \r\n }\r\n\r\n if (index != 3) Console.WriteLine(\"NO\");\r\n else Console.WriteLine(\"YES\");\r\n\r\n Console.WriteLine(index);\r\n }\r\n }\r\n }\r\n}\r\n"}], "src_uid": "5cd113a30bbbb93d8620a483d4da0349"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n static class Program\n {\n static void Main()\n {\n var args = ReadArgs();\n\n var w1 = args[0];\n var h1 = args[1];\n var w2 = args[2];\n var h2 = args[3];\n\n var ans1 = 2 * (h1 + 1) + w1;\n var ans2 = 2 * (h2 + 1) + w2;\n\n Console.WriteLine(ans1 + ans2 + Math.Abs(w1 - w2));\n }\n\n public static List ReadArgs()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n\n public static int ReadValue()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string[]y=Console.ReadLine().Split(' ');\n Int64 a=Int64.Parse(y[0]);\n Int64 b=Int64.Parse(y[1]);\n Int64 c=Int64.Parse(y[2]);\n Int64 d=Int64.Parse(y[3]);\n Console.WriteLine((b+d+2)*2+Math.Max(a,c)*2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w1, h1, w2, h2, result;\n string []s;\n \n s = Console.ReadLine().Split(' ');\n w1 = int.Parse(s[0]);\n h1 = int.Parse(s[1]);\n w2 = int.Parse(s[2]);\n h2 = int.Parse(s[3]);\n \n\n result = w1 + h1 + h2 + w2 + h2 + h1;\n \n if (w1 == w2)\n result += 4;\n else\n result += 5 + (w1 - w2 - 1);\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sea_Battle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int w1 = Next(), h1 = Next(), w2 = Next(), h2 = Next();\n\n return w1 + 2 + h1*2 + w1 + 2 - w2 + (h2 - 1)*2 + w2 + 2;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\n\nclass Ph\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(int.Parse).ToList();\n //- - - -\n //\u4e0b\u306e\u8fba\n long res = 0;\n res += a[0] + 2;\n res += a[2] + 2;\n res += (a[1] + a[3]) * 2;\n res += Abs(a[0] - a[2]);\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SeaBattle\n{\n class Program\n {\n public static int Width1;\n public static int Height1;\n public static int Width2;\n public static int Height2;\n public static string InputString = Console.ReadLine();\n static void Main()\n {\n ReadInput();\n Console.WriteLine(CalculateEasy() + CalculateLessEasy());\n \n }\n static void ReadInput()\n {\n int Length = InputString.Length;\n int NumberCurrent = 0;\n for (int i = 0; i < Length; i++)\n {\n if (\"\" + InputString[i] == \" \")\n {\n NumberCurrent++;\n }\n else\n {\n switch (NumberCurrent)\n {\n case 0:\n Width1 = int.Parse(Width1 + \"\" + InputString[i]);\n break;\n case 1:\n Height1 = int.Parse(Height1 + \"\" + InputString[i]);\n break;\n case 2:\n Width2 = int.Parse(Width2 + \"\" + InputString[i]);\n break;\n case 3:\n Height2 = int.Parse(Height2 + \"\" + InputString[i]);\n break;\n\n }\n\n }\n }\n }\n static int CalculateEasy()\n {\n int numberOfSquares = 0;\n numberOfSquares = 2 * Height1 + Width1 + 2 + Height2 + Width2 + 2;\n return numberOfSquares;\n }\n static int CalculateLessEasy()\n {\n int numberOfSquares = 0;\n numberOfSquares = (Width1 - Width2 + Height2);\n return numberOfSquares;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Seabattle\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* 4 + h1 + h2 + w1 + w2 + h1 + h2 + abs(w1 - w2);\n w1,h1,w2,h2\n */\n int[] array1D = new int[9];\n array1D = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n int h1 = array1D[1];\n int h2 = array1D[3];\n int w1 = array1D[0]; \n int w2 = array1D[2];\n \n Console.WriteLine(4+h1+h2+w1+w2+h1+h2+Math.Abs(w1-w2));\n // Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"2 1 2 1\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var w1 = cin.NextLong();\n var h1 = cin.NextLong();\n var w2 = cin.NextLong();\n var h2 = cin.NextLong();\n\n System.Console.WriteLine(\n w2 + 2 +\n 2 * h2 - 2 +\n (w1 == w2 ? 4 : (4 + w1 - w2)) +\n 2 * h1 - 2 +\n w1 + 2\n );\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // System.Console.Write(cout.ToString());\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static IEnumerable IndicesWhere(this IEnumerable seq, Func cond) {\n var i = 0;\n foreach (var item in seq) {\n if (cond(item)) yield return i;\n i++;\n }\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = ReadArrayInt();\n var w1 = input[0];\n var h1 = input[1];\n var w2 = input[2];\n var h2 = input[3];\n var ans = 0L;\n ans += w1 + 2 + h1 * 2 + w2 + 2 + h2 * 2;\n if (w1 != w2) ans += w1 - w2;\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n static string Read() { return Console.ReadLine(); }\n static int ReadInt() { return int.Parse(Read()); }\n static long ReadLong() { return long.Parse(Read()); }\n static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }\n static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Console_c\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] inter= str.Split(' ');\n int[] inte = new int[4];\n inte[0] = Convert.ToInt32(inter[0]);\n inte[1] = Convert.ToInt32(inter[1]);\n inte[2] = Convert.ToInt32(inter[2]);\n inte[3] = Convert.ToInt32(inter[3]);\n int S =0;\n if (inte[0] == inte[2]) {\n int S1 = (inte[0]+2)*(inte[1]+inte[3]+2)-inte[0]*(inte[1]+inte[3]);\n Console.WriteLine(\"\"+S1);\n } else if (inte[0] > inte[2]) {\n int S1 = (inte[2] + 2) * (inte[1] + inte[3] + 2) - inte[2] * (inte[1] + inte[3]);\n S1 = S1 + (inte[0] - inte[2])*2;\n Console.WriteLine(\"\" + S1);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforces_541_A\n{\n static void Main()\n {\n string [] s = Console.ReadLine().Split(' ');\n int w1 = int.Parse(s[0]);\n int h1 = int.Parse(s[1]);\n int w2 = int.Parse(s[2]);\n int h2 = int.Parse(s[3]);\n int kl = (h1+h2)*2 + (w1+w2) + 4 + (w1-w2);\n Console.Write(kl);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n \n int w1 = int.Parse(token[0]);\n int h1 = int.Parse(token[1]);\n \n int w2 = int.Parse(token[2]);\n int h2 = int.Parse(token[3]);\n \n int HH = h1 + h2;\n \n int WW = Math.Max(w1,w2);\n \n int ans = 2 * (HH+WW) + 4;\n \n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace csharp\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n // ReSharper disable once PossibleNullReferenceException\n var inputs = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n Console.WriteLine(inputs[0] + inputs[1] * 2 + inputs[2] + inputs[3] * 2 + inputs[0] - inputs[2] - 1 + 5);\n }\n }\n}"}, {"source_code": "/* Date: 25.02.2019 * Time: 21:45 */\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Swap (ref int a, ref int b)\n\t{\n\t\tint c = a; a = b; b = c;\n\t}\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint h1, w1, h2, w2;\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** a = \" + s);\n# endif\n\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\th1 = int.Parse (ss [1]);\n\t\t\tw1 = int.Parse (ss [0]);\n\t\t\th2 = int.Parse (ss [3]);\n\t\t\tw2 = int.Parse (ss [2]);\n\t\t}\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** 1 = \" + w1 + \" \" + h1);\n\t\tsw.WriteLine (\"*** 2 = \" + w2 + \" \" + h2);\n# endif\n\n\t\tint m = 2*(h1 + w1 + h2 + 2);\n\t\tif ( w1 > w2 )\n\t\t\tm = 2*(h1 + w1 + h2 + 2);\n\t\telse if ( w1 < w2 )\n\t\t\tm = 2*(h1 + w2 + h2 + 2);\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (m);\n# else\n\t\tsw.WriteLine (m);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Test\n{\n\n private static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n private static int[] ReadArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));\n }\n public static void Main()\n {\n int[] A = ReadArray(); \n\n int w1 = A[0], h1 = A[1], w2 = A[2], h2 = A[3];\n\n Console.WriteLine((w1 + h1) * 2 + 4 + (h2 * 2));\n } \n }\n\n\n\n\n\n \n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces_1131A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w1, w2, h1, h2,h,w;\n var s = Console.ReadLine().Split(' ');\n w1 = Convert.ToInt32(s[0]);\n h1 = Convert.ToInt32(s[1]);\n w2 = Convert.ToInt32(s[2]);\n h2 = Convert.ToInt32(s[3]);\n w = w1;\n h = h1 + h2;\n\n int result = (h + 1) * 2 + (w + 1) * 2;\n Console.WriteLine(result);\n\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace Problem\n{\n using System;\n using System.Collections.Generic;\n class Problem1\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split();\n int w1 = int.Parse( str[0] );\n int h1 = int.Parse( str[1] );\n int w2 = int.Parse( str[2] );\n int h2 = int.Parse( str[3] );\n long kq = 0;\n kq = (long)( h1 + h2 + 2 ) * ( w1 + 2 ) - (long)( h1 + h2 ) * w1;\n Console.WriteLine( kq );\n\n }\n }\n}"}, {"source_code": "// Problem: 1131A - Sea Battle\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass SeaBattle\n {\n public static int Main ()\n {\n string line;\n string[] words;\n uint w1;\n uint h1;\n uint w2;\n uint h2;\n uint ans;\n \n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split ();\n if (words.Length != 4)\n return -1;\n if (!UInt32.TryParse (words[0], out w1))\n return -1;\n if (w1 < 1 || w1 > 100000000)\n return -1;\n if (!UInt32.TryParse (words[1], out h1))\n return -1;\n if (h1 < 1 || h1 > 100000000)\n return -1;\n if (!UInt32.TryParse (words[2], out w2))\n return -1;\n if (w2 < 1 || w2 > 100000000 || w1 < w2)\n return -1;\n if (!UInt32.TryParse (words[3], out h2))\n return -1;\n if (h2 < 1 || h2 > 100000000)\n return -1;\n ans = 2*(w1+h1+h2+2);\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int[] args = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n Console.WriteLine(2 * (args[0] + args[1] + args[3]) + 4);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing SB = System.Text.StringBuilder;\n//using System.Text.RegularExpressions;\n//using System.Globalization;\n//using System.Diagnostics;\nusing static System.Console;\nusing System.Numerics;\nusing static System.Math;\nusing pair = Pair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().solve();\n Out.Flush();\n }\n readonly Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 }; //\u2192\u2193\u2190\u2191\n readonly int mod = 1000000007;\n readonly int dom = 998244353;\n bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }\n\n void solve()\n {\n var w1 = cin.nextlong;\n var h1 = cin.nextlong;\n var w2 = cin.nextlong;\n var h2 = cin.nextlong;\n\n long ans = 0;\n ans += h1 + h2 + 2;\n ans += w1 + 1;\n ans += h1;\n ans += w2 + 1;\n ans += h2;\n ans += w1 - w2;\n WriteLine(ans);\n }\n\n}\n\n\nstatic class Ex\n{\n public static void join(this IEnumerable values, string sep = \" \") => WriteLine(string.Join(sep, values));\n public static string concat(this IEnumerable values) => string.Concat(values);\n public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }\n\n public static int lower_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) < 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n public static int upper_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) <= 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n}\n\nclass Pair : IComparable> where T : IComparable where U : IComparable\n{\n public T f; public U s;\n public Pair(T f, U s) { this.f = f; this.s = s; }\n public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);\n public override string ToString() => $\"{f} {s}\";\n}\n\nclass Scanner\n{\n string[] s; int i;\n readonly char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan => ReadLine().Split();\n public int[] scanint => Array.ConvertAll(scan, int.Parse);\n public long[] scanlong => Array.ConvertAll(scan, long.Parse);\n public double[] scandouble => Array.ConvertAll(scan, double.Parse);\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint => int.Parse(next);\n public long nextlong => long.Parse(next);\n public double nextdouble => double.Parse(next);\n}\n"}, {"source_code": "using System;\n\nnamespace CS_CodeForces\n{\n internal class Program\n {\n private static void Main()\n {\n string[] inp = Console.ReadLine().Split(' ');\n int sum = 2 * (int.Parse(inp[0]) + int.Parse(inp[1]) + int.Parse(inp[3])) + 4;\n Console.Write(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\tvar w1 = arr[0];\n\t\t\tvar h1 = arr[1];\n\t\t\tvar w2 = arr[2];\n\t\t\tvar h2 = arr[3];\n\t\t\tvar ans = (h1 + h2) * 2 + w1 * 2 + 4;\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t}\n\n\t\tstatic long Long()\n\t\t{\n\t\t\treturn Int64.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (long, long) Long2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic long[] Longs()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t}\n\n\t\tstatic string Str()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{ \n \n class Program\n {\n \n static void Main(string[] args)\n { \n int count=0;\n string[] prob = { \" \" };\n string r=Console .ReadLine() ;\n string[] a = r.Split (prob,StringSplitOptions .RemoveEmptyEntries );\n double y = 2 *( int.Parse (a[0]) + int.Parse (a[1]) + int.Parse (a[3])) + 4;\n Console.WriteLine((y) );\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n double[] a = Console.ReadLine().Split().Select(double.Parse).ToArray();\n Console.WriteLine(a[0]+2 + a[2]+2 + a[1] * 2 + a[3] * 2 + (a[0] - a[2]));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] sizes = Console.ReadLine().Split(' ');\n\n int w1 = Convert.ToInt32(sizes[0]);\n int h1 = Convert.ToInt32(sizes[1]);\n int w2 = Convert.ToInt32(sizes[2]);\n int h2 = Convert.ToInt32(sizes[3]);\n \n int cmnWidth = w1;\n int cmnHeight = h1 + h2;\n int w2Diff = w1 - w2;\n\n int markedTotal = w1 + 1 + cmnHeight + 1 + w2 + 1 + h2 + w2Diff + h1 + 1;\n\n Console.WriteLine(markedTotal);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing Number = System.Int64;\nusing N = System.Int64;\nusing C = System.Int32;\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar a = Enumerate(4, x => rl);\n\t\t\tvar ans = 0L;\n\t\t\tans += 2 * (a[0] + a[1] + a[2] + a[3] + 2);\n\t\t\tans -= 2 * a[2];\n\t\t\tConsole.WriteLine(ans);\n\n\t\t}\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\t//Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n\t\tvar solver = new Program.Solver();\n\t\tsolver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1131A\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int w1 = int.Parse(tokens[0]);\n int h1 = int.Parse(tokens[1]);\n\n int w2 = int.Parse(tokens[2]);\n int h2 = int.Parse(tokens[3]);\n\n Console.WriteLine(2 * (w1 + h1 + h2) + 4);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp131\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int w1 = int.Parse(s.Split(' ')[0]), h1 = int.Parse(s.Split(' ')[1]), w2 = int.Parse(s.Split(' ')[2]), h2 = int.Parse(s.Split(' ')[3]), res = (h1*2+w1*2+4) + (h2*2+w2*2+4) - (w2+2)*2;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint w1 = int.Parse(str[0]);\n\t\tint h1 = int.Parse(str[1]);\n\t\tint w2 = int.Parse(str[2]);\n\t\tint h2 = int.Parse(str[3]);\n\t\tint ans = 0;\n\t\tans += w2+2;\n\t\tans += h2*2;\n\t\tans += h1*2;\n\t\tif(w2!=w1){\n\t\t\tans += Math.Abs(w2-w1);\n\t\t}\n\t\tans += w1+2;\n\t\tConsole.WriteLine(ans);\n\t}\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n static class Program\n {\n static void Main()\n {\n var args = Reader.ReadIntArgs();\n//\n var w1 = args[0];\n var h1 = args[1];\n var w2 = args[2];\n var h2 = args[3];\n\n var maxW = Math.Max(w1, w2);\n var maxH = Math.Max(h1, h2);\n\n Console.WriteLine((maxW + 2) * (maxH * 2 + 2) - (w1 * h1) - (w2 * h2) - Math.Abs(w1 * h1 - maxH * maxW) - Math.Abs(w2 * h2 - maxH * maxW));\n }\n }\n\n static class Reader\n {\n public static List ReadIntArgs()\n {\n return ReadArgs(int.Parse);\n }\n\n public static List ReadLongArgs()\n {\n return ReadArgs(long.Parse);\n }\n\n private static List ReadArgs(Func parser)\n {\n return Console.ReadLine().Split().Select(parser).ToList();\n }\n\n public static int ReadIntValue()\n {\n return ReadValue(int.Parse);\n }\n\n public static long ReadLongValue()\n {\n return ReadValue(long.Parse);\n }\n\n private static T ReadValue(Func parser)\n {\n return parser(Console.ReadLine());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n static class Program\n {\n static void Main()\n {\n var args = Reader.ReadIntArgs();\n\n var w1 = args[0];\n var h1 = args[1];\n var w2 = args[2];\n var h2 = args[3];\n\n var maxW = Math.Max(w1, w2);\n var maxH = Math.Max(h1, h2);\n\n Console.WriteLine((maxW + 2) * (maxH * 2 + 2) - (w1 * h1) - (w2 * h2) - Math.Abs(w1 * h1 - maxH * maxW) - Math.Abs(w2 * h2 - maxH * maxW));\n }\n }\n\n static class Reader\n {\n public static List ReadIntArgs()\n {\n return ReadArgs(int.Parse);\n }\n\n public static List ReadLongArgs()\n {\n return ReadArgs(long.Parse);\n }\n\n private static List ReadArgs(Func parser)\n {\n return Console.ReadLine().Split().Select(parser).ToList();\n }\n\n public static int ReadIntValue()\n {\n return ReadValue(int.Parse);\n }\n\n public static long ReadLongValue()\n {\n return ReadValue(long.Parse);\n }\n\n private static T ReadValue(Func parser)\n {\n return parser(Console.ReadLine());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w1, h1, w2, h2, result;\n string []s;\n \n s = Console.ReadLine().Split(' ');\n w1 = int.Parse(s[0]);\n h1 = int.Parse(s[1]);\n w2 = int.Parse(s[2]);\n h2 = int.Parse(s[3]);\n \n\n result = w1 + h1 + h2 + w2 + h2 + h1+(w1-w2);\n \n if (w1 == w2)\n result += 4;\n else\n result += 5;\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w1, h1, w2, h2, result;\n string []s;\n \n s = Console.ReadLine().Split(' ');\n w1 = int.Parse(s[0]);\n h1 = int.Parse(s[1]);\n w2 = int.Parse(s[2]);\n h2 = int.Parse(s[3]);\n \n\n result = w1 + h1 + h2 + w2 + h2 + h2;\n \n if (w1 == w2)\n result += 4;\n else\n result += 5;\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\n\nclass P\n{\n static void Main()\n {\n var a = Console.ReadLine().Split().Select(int.Parse).ToList();\n //- - - -\n //\u4e0b\u306e\u8fba\n long res = 0;\n res += a[0] + 2;\n res += a[2] + 2;\n res += (a[1] + a[3]) * 2;\n res += Abs(a[1] - a[3]);\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = ReadArrayInt();\n var w1 = input[0];\n var h1 = input[1];\n var w2 = input[2];\n var h2 = input[3];\n var ans = 0L;\n ans += w1 + 2 + h1 * 2 + w2 + 2 + h2 * 2;\n if (w1 != w2) ans++;\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n static string Read() { return Console.ReadLine(); }\n static int ReadInt() { return int.Parse(Read()); }\n static long ReadLong() { return long.Parse(Read()); }\n static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }\n static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }\n }\n}"}, {"source_code": "/* Date: 25.02.2019 * Time: 21:45 */\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Swap (ref int a, ref int b)\n\t{\n\t\tint c = a; a = b; b = c;\n\t}\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\037\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint h1, w1, h2, w2;\n\t\tstring s;\n\n# if ( ONLINE_JUDGE )\n\t\ts = Console.ReadLine ();\n# else\n\t\ts = sr.ReadLine ();\n\t\tsw.WriteLine (\"*** a = \" + s);\n# endif\n\n\t\t{\n\t\t\tstring [] ss = s.Split (' ');\n\t\t\th1 = int.Parse (ss [1]);\n\t\t\tw1 = int.Parse (ss [0]);\n\t\t\th2 = int.Parse (ss [3]);\n\t\t\tw2 = int.Parse (ss [2]);\n\t\t}\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (\"*** 1 = \" + w1 + \" \" + h1);\n\t\tsw.WriteLine (\"*** 2 = \" + w2 + \" \" + h2);\n# endif\n\n\t\tint m = 2*(h1 + w1 + h2 + 2) + w2;\n\t\tif ( w1 != w2 )\n\t\t\tm += (w2 - w1)*2 - 1;\n\n\t\tif ( w1 == w2 )\n\t\t\tm -= w1;\n\t\telse\n\t\t\tm++;\n\t\t\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (m);\n# else\n\t\tsw.WriteLine (m);\n\t\tsw.Close ();\n# endif\n\n\t}\n}\n"}, {"source_code": "\ufeffnamespace Problem\n{\n using System;\n using System.Collections.Generic;\n class Problem1\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split();\n int w1 = int.Parse( str[0] );\n int h1 = int.Parse( str[1] );\n int w2 = int.Parse( str[2] );\n int h2 = int.Parse( str[3] );\n long kq = 0;\n kq = (long)( h1 + h2 + 2 ) * ( w1 + 2 ) - ( h1 + h2 ) * w1;\n Console.WriteLine( kq );\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint w1 = int.Parse(str[0]);\n\t\tint h1 = int.Parse(str[1]);\n\t\tint w2 = int.Parse(str[2]);\n\t\tint h2 = int.Parse(str[3]);\n\t\tint ans = 0;\n\t\tans += w2+2;\n\t\tans += h2*2;\n\t\tans += h1*2;\n\t\tif(w2!=w1){\n\t\t\tans += 1;\n\t\t}\n\t\tans += w1+2;\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint w1 = int.Parse(str[0]);\n\t\tint h1 = int.Parse(str[1]);\n\t\tint w2 = int.Parse(str[2]);\n\t\tint h2 = int.Parse(str[3]);\n\t\tint ans = 0;\n\t\tans += w2+2;\n\t\tans += h2*2;\n\t\tans += h1*2;\n\t\tif(w2!=w1){\n\t\t\tans += 1;\n\t\t}\n\t\tans += w1*2;\n\t\tConsole.WriteLine(ans);\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n static class Program\n {\n static void Main()\n {\n var args = ReadArgs();\n\n var w1 = args[0];\n var h1 = args[1];\n var w2 = args[2];\n var h2 = args[3];\n\n var ans1 = 2 * (h1 + 1) + w1;\n var ans2 = 2 * (h2 + 1) + w2;\n\n Console.WriteLine(ans1 + ans2 + Math.Abs(ans1 - ans2));\n }\n\n public static List ReadArgs()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n\n public static int ReadValue()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n}"}], "src_uid": "b5d44e0041053c996938aadd1b3865f6"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] buffer = ReadLine();\n int n = int.Parse(buffer[0]), m = int.Parse(buffer[1]);\n long ans = 0;\n int min = Math.Min(n, m),max = Math.Max(m,n);\n for (int i = 1; i <= min; i++)\n {\n int mult = (i / 5) + 1;\n ans += (max - ((5 * mult) - i)) / 5;\n if(max>=(5*mult)-i)ans++; \n }\n print(ans);\n }\n public static String[] ReadLine() \n {\n return Console.ReadLine().Split(' ');\n }\n public static void print(long s)\n {\n Console.WriteLine(s);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Numerics;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n var a = new int[5];\n for (int i = 1; i <= n; i++)\n a[i % 5]++;\n var b = new int[5];\n for (int i = 1; i <= m; i++)\n b[i % 5]++;\n\n long ans = 1L * a[0] * b[0];\n for (int i = 1; i < 5; i++)\n ans += 1L * a[i] * b[5 - i];\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n long kq = 0,a,b;\n\t\tvar s = Console.ReadLine ();\n\t\ta = Convert.ToInt64(s.Split (' ') [0]);\n\t\tb = Convert.ToInt64(s.Split (' ') [1]);\n\t\tif (a > b) {\n\t\t\tvar temp = a;\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\t\tfor (long i = 1; i <= a; i++) {\n\t\t\tkq += Dem (5 - (i % 5), b);\n\t\t}\n\t\tConsole.WriteLine (kq);\n }\n static long Dem(long a, long b){\n\t\tlong dem = 0;\n\t\tif (b >= a) {\n\t\t\tdem = 1;\n\t\t\tb -= a;\n\t\t} else\n\t\t\treturn 0;\n\t\treturn (dem + b / 5);\n\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint m = inputs1[1];\n\n\t\t\tvar first = Enumerable.Range(1, n).Select(i => (long)i).ToList();\n\t\t\tvar second = Enumerable.Range(1, m).Select(j => (long)j).ToList();\n\n\t\t\tvar d0 = second.Count(j => j % 5 == 0);\n\t\t\tvar d1 = second.Count(j => j % 5 == 1);\n\t\t\tvar d2 = second.Count(j => j % 5 == 2);\n\t\t\tvar d3 = second.Count(j => j % 5 == 3);\n\t\t\tvar d4 = second.Count(j => j % 5 == 4);\n\n\t\t\tlong count = 0;\n\t\t\tforeach (var i in first) \n\t\t\t{\n\t\t\t\tvar d = i % 5;\n\t\t\t\tswitch (d) \n\t\t\t\t{\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tcount += d4;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tcount += d3;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tcount += d2;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tcount += d1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcount += d0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n string[] args = Console.ReadLine().Split(' ');\n long n = long.Parse(args[0]),\n m = long.Parse(args[1]);\n\n\n long s = (((m - 4) >= 0? m - 4 : -5) / 5 + 1) * (((n - 1) >= 0? n - 1: -5 )/ 5 + 1) +\n (((m - 3) >= 0? m - 3 : -5) / 5 + 1) * (((n - 2) >= 0 ? n - 2 : -5) / 5 + 1) +\n (((m - 2) >= 0? m - 2 : -5) / 5 + 1) * (((n - 3) >= 0 ? n - 3 : -5) / 5 + 1) +\n (((m - 1) >= 0? m - 1 : -5) / 5 + 1) * (((n - 4) >= 0 ? n - 4 : -5 )/ 5 + 1) +\n ((m) / 5) * ((n) / 5);\n Console.WriteLine(s);\n //Console.ReadKey();\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n long res = 0;\n\n for (int i = 1; i <= nm[0]; i++)\n {\n res += (nm[1] + i) / 5 - (i + 1) / 5;\n if ((i + 1) % 5 == 0) res++;\n\n }\n Console.Write(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\t\tint n = nums [0];\n\t\t\tint m = nums [1];\n\t\t\tlong result = (n / 5L) * (m / 5);\n\t\t\tresult += ((n + 4L) / 5) * ((m + 1) / 5);\n\t\t\tresult += ((n + 3L) / 5) * ((m + 2) / 5);\n\t\t\tresult += ((n + 2L) / 5) * ((m + 3) / 5);\n\t\t\tresult += ((n + 1L) / 5) * ((m + 4) / 5);\n\t\t\tConsole.WriteLine (result);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRound358A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split();\n\n int n = Convert.ToInt32(inp[0]);\n int m = Convert.ToInt32(inp[1]);\n int k = 0;\n\n long cnt = 0;\n\n for (int i = 1; i <= n; i++)\n {\n k = (i/5 + 1) * 5 - i;\n\n cnt += m / 5;\n if (m % 5 >= k)\n cnt++;\n }\n\n Console.WriteLine(cnt);\n //inp = Console.ReadLine().Split();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0410\u043b\u0451\u043d\u0430_\u0438_\u0447\u0438\u0441\u043b\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n long n, m;\n\n if (mm[0] < mm[1])\n {\n n = mm[0];\n m = mm[1];\n }\n else\n {\n n = mm[1];\n m = mm[0];\n }\n\n long s = 0;\n\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++)\n if ((i + j) % 5 == 0)\n {\n s += (m + i % 5) / 5;\n //Console.WriteLine(\"\u0421 {0} \u0441\u0443\u043c\u043c\u0430 \u0440\u0430\u0432\u043d\u0430 = {1}\", i, s);\n break;\n }\n\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0410\u043b\u0451\u043d\u0430_\u0438_\u0447\u0438\u0441\u043b\u0430\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n long n, m;\n\n if (mm[0] < mm[1])\n {\n n = mm[0];\n m = mm[1];\n }\n else\n {\n n = mm[1];\n m = mm[0];\n }\n\n long s = 0;\n\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++)\n if ((i + j) % 5 == 0)\n {\n s += (m + i % 5) / 5;\n //Console.WriteLine(\"\u0421 {0} \u0441\u0443\u043c\u043c\u0430 \u0440\u0430\u0432\u043d\u0430 = {1}\", i, s);\n break;\n }\n\n Console.WriteLine(s);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class A___Alyona_and_Numbers\n{\n private static void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n long[] nRemainderFrequency = new long[5];\n long[] mRemainderFrequency = new long[5];\n\n for (int i = 1; i <= n; i++)\n {\n int rem = i % 5;\n nRemainderFrequency[rem]++;\n }\n\n for (int j = 1; j <= m; j++)\n {\n int rem = j % 5;\n mRemainderFrequency[rem]++;\n }\n\n long totalPairs = nRemainderFrequency[0] * mRemainderFrequency[0];\n for (int i = 1; i <= 4; i++)\n {\n long iPairs = nRemainderFrequency[i] * mRemainderFrequency[5-i];\n totalPairs += iPairs;\n }\n\n Write(totalPairs);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new A___Alyona_and_Numbers().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace TopCoder.Test.CodeForces.Batch682\n{\n public class Program682A\n {\n public static void Main(string[] args)\n {\n int[] t = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n int n = t[0];\n int m = t[1];\n\n ulong count = Simulate(n, m);\n\n Console.WriteLine(count);\n }\n\n\n public static ulong Simulate(int n, int m)\n {\n ulong count = 0;\n\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++)\n if ((i + j) % 5 == 0)\n {\n ++count;\n int x = (m - j) / 5;\n count += (ulong)(m - j) / 5;\n j += x * 5;\n }\n\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExInCsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int m, n;\n long x=0;\n bool f = false;\n string[] str = str1.Split(' ');\n n = int.Parse(str[0]); m = int.Parse(str[1]);\n for (int i = 1; i <= n; i++ )\n {\n for (int j=1; j<=m; j++)\n {\n if ((i+j)%5==0)\n {\n x += (m - j) / 5 + 1;\n break;\n }\n }\n \n }\n \n Console.WriteLine(x);\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Security.AccessControl;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar a = getList();\n\t\t\tlong ans = 0;\n\t\t\tfor (var i = 0; i < 5; ++i)\n\t\t\t{\n\t\t\t\tlong t = a[0] / 5;\n\t\t\t\tt = t + ((a[0] % 5 >= i && i != 0) ? 1 : 0);\n\t\t\t\tlong t1 = a[1] / 5;\n\t\t\t\tt1 = t1 + (a[1] % 5 >= (5 - i) ? 1 : 0);\n\t\t\t\tans += t * t1;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\n\nclass Program\n{\n\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var x = ri;\n var y = ri;\n long res = 0;\n if (y < x)\n {\n var buf = y;\n y = x;\n x = buf;\n }\n for (int i = 1; i <= x; i++)\n {\n res += (y + (i % 5)) / 5;\n }\n wln(res);\n }\n //////////////////////////////////////////////////\n\n static void swap(ref object o1, ref object o2) { var o = o1; o1 = o2; o2 = o; }\n static void wln(object o = null) { Console.WriteLine(o); }\n static void wsp(object o) { Console.Write(o + \" \"); }\n static void wrt(object o) { Console.Write(o); }\n //Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o));\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var m = data[1];\n var cnt1 = new long[5];\n var cnt2 = new long[5];\n for (int i = 1; i <= n; i++) \n cnt1[i%5]++; \n for (int i = 1; i <= m; i++) \n cnt2[i % 5]++; \n\n long res = cnt1[0] * cnt2[0] + \n cnt1[1] * cnt2[4] + \n cnt1[2] * cnt2[3] + \n cnt1[3] * cnt2[2] + \n cnt1[4] * cnt2[1]; \n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n public static void Main(string[] args)\n {\n long n, m;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n }\n long dff1 = n / 5, dff2 = m / 5;\n long result = dff1*dff2;\n for(long i = 1, j = 4, dff3 = n%5, dff4=m%5; i<5; j=5-++i)\n result += ((dff1 + (i <= dff3 ? 1 : 0)) * (dff2 + (j <= dff4 ? 1 : 0)));\n Console.WriteLine(result);\n }\n }"}, {"source_code": "using System;\n\nclass A682 {\n static long F(int n, int k) {\n k = (k + 4) % 5 + 1;\n return (n + 5 - k) / 5;\n }\n\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n long answer = 0;\n for (int i = 0; i < 5; ++i) answer += F(n, i) * F(m, (5 - i) % 5);\n Console.WriteLine(answer);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Alyona_and_Numbers\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n long a = int.Parse(input.Split()[0]);\n long b = int.Parse(input.Split()[1]);\n long min = Math.Min(a, b);\n long max = Math.Max(a, b);\n long collector=0;\n for (int i = 1; i <=min; i++)\n {\n for (int j =1; j <= 5; j++)\n {\n if ((j + i) % 5 == 0 && j <= max)\n { collector = collector + ((max - j) / 5) + 1; break; }\n }\n }\n Console.WriteLine(collector);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Alyona_and_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n long count = 0;\n\n long[] cn = Counts(n, 5);\n long[] cm = Counts(m, 5);\n\n for (int i = 0; i < cn.Length; i++)\n {\n count += cn[i]*cm[(5 - i)%5];\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long[] Counts(int n, int div)\n {\n var ans = new long[div];\n\n for (int i = 0; i < div; i++)\n {\n ans[i] = n/div;\n if (n%div >= i)\n ans[i]++;\n }\n ans[0]--;\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n A();\n }\n\n static void A()\n {\n var firstModFiveArray = new long[5];\n var secondModFiveArray = new long[5];\n var data = Console.ReadLine()\n .Split(new[] { ' ' })\n .Select(int.Parse)\n .ToArray();\n int n = data[0], m = data[1];\n for (int i = 1; i <= Math.Min(n, m); i++)\n {\n firstModFiveArray[i % 5]++;\n secondModFiveArray[i % 5]++;\n }\n long[] temp = null;\n if (n > m)\n temp = firstModFiveArray;\n else if (m > n)\n temp = secondModFiveArray;\n if (temp != null)\n for (int i = Math.Min(n, m) + 1; i <= Math.Max(n, m); i++)\n temp[i % 5]++;\n long res = 0;\n res += firstModFiveArray[1] * secondModFiveArray[4];\n res += firstModFiveArray[2] * secondModFiveArray[3];\n res += firstModFiveArray[3] * secondModFiveArray[2];\n res += firstModFiveArray[4] * secondModFiveArray[1];\n res += firstModFiveArray[0] * secondModFiveArray[0];\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n long[] cntN = new long[5], cntM = new long[5];\n for (long i = 0; i < 5; i++)\n {\n cntN[i] = n / 5;\n cntM[i] = m / 5;\n }\n for (long i = 1; i <= n % 5; i++)\n cntN[i]++;\n for (long i = 1; i <= m % 5; i++)\n cntM[i]++;\n long result = 0;\n for (long i = 0; i < 5; i++)\n result += cntN[i] * cntM[(5 - i) % 5];\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n \n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n\n object Get()\n {\n checked\n {\n var n = ReadIntToken();\n var m = ReadIntToken();\n var first = new int[5];\n var sec = new int[5];\n for (int i = 0; i < 5; i++)\n {\n first[i] = n / 5;\n }\n for (int i = 1; i <= n % 5; i++)\n {\n first[i]++;\n }\n long res = 0l;\n for (int i = 1; i <= m; i++)\n {\n var rem = i % 5;\n res += first[(5 - rem) % 5];\n }\n return res;\n }\n }\n\n public static class Struct\n {\n public static Pair Create(T1 item1, T2 item2)\n {\n return new Pair { Item1 = item1, Item2 = item2 };\n }\n }\n\n public struct Pair\n {\n public T1 Item1 { get; set; }\n public T2 Item2 { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\t//System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo (\"en-US\");\n\t\tstring [] s=Console.ReadLine().Split(' ');\n\t\tint n = int.Parse (s[0]);\n\t\tint m = int.Parse (s[1]);\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tans += (m + i) / 5 - (i + 1) / 5;\n\t\t\tif ((i + 1) % 5 == 0)\n\t\t\t\tans++;\n\t\t}\n\t\tConsole.WriteLine (ans);\n\n\t}\n};"}, {"source_code": "// The future is not something we enter.\n// The future is something we create.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static Random rand = new Random(0);\n\n\n static void Main(string[] args)\n {\n \n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n int n = input.NextInt();\n int m = input.NextInt();\n long[,] hash = new long[2, 5];\n for (int i = 1; i <= n; i++)\n {\n hash[0, i % 5]++;\n }\n for (int i = 1; i <= m; i++)\n {\n hash[1, i % 5]++;\n }\n long sum = hash[0, 0] * hash[1, 0];\n for (int i = 1; i < 5; i++)\n {\n sum += hash[0, i] * hash[1, 5 - i];\n }\n writer.WriteLine(sum);\n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Flush();\n writer.Close();\n reader.Close();\n }\n\n }\n\n class Pair\n {\n public int x, y;\n\n public Pair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static void solve() {\n string[] s = Console.ReadLine().Split(' ');\n long n = long.Parse(s[0]), m = long.Parse(s[1]);\n long[] a = new long[5];\n long[] b = new long[5];\n for (int i = 0; i < 5; i++) {\n a[i] = n / 5;\n b[i] = m / 5;\n }\n for (int i = 1; i <= n % 5; i++) {\n a[i]++;\n }\n for (int i = 1; i <= m % 5; i++) {\n b[i]++;\n }\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n\n static void Main(string[] args) {\n\n solve();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var m = input[1];\n var count = 0L;\n for (var i = 1; i <= n; i++) {\n count += (m + i) / 5L - i/5;\n }\n\n sw.WriteLine(count);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(' ');\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n\n long sum = 0;\n for (int i = 1; i <= b; i++)\n {\n sum += (a + i) / 5 - (i + 1) / 5;\n if ((i + 1) % 5 == 0)\n sum++;\n }\n\n\n\n Console.WriteLine(sum);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication24\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long n = Convert.ToInt64(s[0]);\n long m = Convert.ToInt64(s[1]);\n long[] mas = new long[5];\n long[] mas1 = new long[5];\n for (int i = 1; i < n+1; i++)\n {\n mas[i % 5]++;\n }\n for (int i = 1; i < m+1; i++)\n {\n mas1[i % 5]++;\n }\n \n long x = (mas[0] * mas1[0] + mas[1] * mas1[4] + mas[2] * mas1[3] + mas[3] * mas1[2] + mas[4] * mas1[1]);\n Console.WriteLine(x);\n\n }\n }\n}\n\n \n \n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2018_08_23_alyona_and_numbers\n//http://codeforces.com/problemset/problem/682/A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n \n long modfive = 0;\n \n int countFive = n / 5;\n int residue = n % 5;\n\n modfive = Modfive(5,countFive, m) + Modfive(residue,1, m);\n Console.WriteLine(modfive);\n }\n static long Modfive(int c,int r, int m)\n {\n int help = 0;\n long modfive = 0;\n for (int i = 1; i <= c; i++)\n {\n help = 5 - i;\n if (help == 0)\n help = help + 5;\n\n for (int j = help; j <= m; j = j + 5)\n modfive++;\n }\n return modfive*r;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n long toplam = 0;\n int x = 0;\n int y = 0;\n long sayac = 0;\n long[] xy = new long[2];\n foreach (string str in Console.ReadLine().Split(' '))\n {\n xy[sayac] = long.Parse(str);\n sayac++;\n }\n sayac = 0;\n for (int i = 1; i <= xy[0]; i++)\n {\n if (i >= 5)\n sayac += (xy[1] + i) / 5 - (i/5);\n else\n sayac += (xy[1] + i) / 5;\n }\n Console.Write(sayac);\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n long[] a = { 0, 0, 0, 0, 0 };\n long[] b = { 0, 0, 0, 0, 0 };\n long[] nm = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);\n for (int i = 1; i <= nm[0]; i++)\n a[i % 5]++;\n for (int i = 1; i <= nm[1]; i++)\n b[i % 5]++;\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _682A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n long n = int.Parse(tokens[0]);\n long m = int.Parse(tokens[1]);\n\n long count = 0;\n\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n if ((i + j) % 5 == 0)\n {\n count += ((n + j) / 5) * ((m + i) / 5);\n }\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n long a = int.Parse(buffer[0]);\n long b = int.Parse(buffer[1]);\n long index = b / 5;\n long rest = b % 5;\n long summ = a * index;\n long indexA = a / 5;\n summ += rest * indexA;\n for (long i = (5 * indexA) + 1; i <= a; i++)\n {\n for (long j = (5*index)+1; j <= b; j++)\n {\n if ((i + j) % 5 == 0)\n {\n summ++;\n }\n }\n }\n Console.WriteLine(summ);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n, m;\n string[] str = Console.ReadLine().Split();\n n = Convert.ToInt32(str[0]);\n m = Convert.ToInt32(str[1]);\n long res = 0;\n for (int i = 1; i <= n; i++)\n {\n if (i%5 == 0)\n {\n res += m / 5;\n }\n else\n {\n res += m / 5;\n if (5-i%5<=m%5)\n {\n res += 1;\n }\n }\n }\n Console.WriteLine(res);\n }\n } \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n int y;\n long count = 0;\n\n string[] tokens = Console.ReadLine().Split();\n x = int.Parse(tokens[0]);\n y = int.Parse(tokens[1]);\n\n for (int i = 1; i <= x; i++)\n {\n count += (y + (i % 5)) / 5;\n }\n System.Console.WriteLine(count); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n ulong ans = 0;\n int[] nn = new int[5];\n int[] mm = new int[5];\n for (int i = 1; i < 5; i++) {\n nn[i] = n / 5 + (n % 5 >= i ? 1 : 0);\n mm[i] = m / 5 + (m % 5 >= i ? 1 : 0);\n }\n nn[0] = n / 5;\n mm[0] = m / 5;\n for (int i = 0; i < 5; i++) {\n ans += (ulong) nn[i] * (ulong) mm[(5 - i) % 5];\n }\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace Nasharpiyebigint\n{\n class Program\n {\n static void Main(string[] args)\n {\n BigInteger m, n, r, s = 0;\n string[] arr = Console.ReadLine().Split(' ');\n m = BigInteger.Parse(arr[0]);\n n = BigInteger.Parse(arr[1]);\n if (m < n)\n {\n r = m;\n m = n;\n n = r;\n }\n for (BigInteger i = 1; i <= n; i++)\n {\n s += (m + i) / 5 - i / 5;\n }\n Console.Write(s);\n //Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nnamespace Alyona_and_Numbers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n long[] a = new long[5];\n long[] b = new long[5];\n for (int i = 1; i <=input[0]; i++)\n {\n a[i % 5]++;\n }\n\n for (int i = 1; i <= input[1]; i++)\n {\n b[i % 5]++;\n }\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int[] a = { 0, 0, 0, 0, 0 };\n int[] b = { 0, 0, 0, 0, 0 };\n int[] nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n for (int i = 1; i <= nm[0]; i++)\n a[i % 5]++;\n for (int i = 1; i <= nm[1]; i++)\n b[i % 5]++;\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n int a = int.Parse(buffer[0]);\n int b = int.Parse(buffer[1]);\n int index = b / 5;\n long summ = a * index;\n for (int i = 1; i <= a; i++)\n {\n for (int j = (5*index)+1; j <= b; j++)\n {\n if ((i + j) % 5 == 0)\n {\n summ++;\n }\n }\n }\n Console.WriteLine(summ);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n int a = int.Parse(buffer[0]);\n int b = int.Parse(buffer[1]);\n int index = b / 5;\n int rest = b % 5;\n long summ = a * index;\n int indexA = a / 5;\n summ += rest * indexA;\n for (int i = (5 * indexA) + 1; i <= a; i++)\n {\n for (int j = (5*index)+1; j <= b; j++)\n {\n if ((i + j) % 5 == 0)\n {\n summ++;\n }\n }\n }\n Console.WriteLine(summ);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] buffer = Console.ReadLine().Split(' ');\n int a = int.Parse(buffer[0]);\n int b = int.Parse(buffer[1]);\n int index = b / 5;\n int summ = a * index;\n for (int i = 1; i <= a; i++)\n {\n for (int j = (5*index)+1; j <= b; j++)\n {\n if ((i + j) % 5 == 0)\n {\n summ++;\n }\n }\n }\n Console.WriteLine(summ);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nnamespace Alyona_and_Numbers\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[] a = new int[5];\n int[] b = new int[5];\n for (int i = 1; i <=input[0]; i++)\n {\n a[i % 5]++;\n }\n\n for (int i = 1; i <= input[1]; i++)\n {\n b[i % 5]++;\n }\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint m = inputs1[1];\n\n\t\t\tvar first = Enumerable.Range(1, n).ToList();\n\t\t\tvar second = Enumerable.Range(1, m).ToList();\n\n\t\t\tint count = 0;\n\t\t\tcount += first.Count(i => i % 5 == 0) * second.Count(j => j % 5 == 0);\n\t\t\tcount += first.Count(i => i % 5 == 1) * second.Count(j => j % 5 == 4);\n\t\t\tcount += first.Count(i => i % 5 == 2) * second.Count(j => j % 5 == 3);\n\t\t\tcount += first.Count(i => i % 5 == 3) * second.Count(j => j % 5 == 2);\n\t\t\tcount += first.Count(i => i % 5 == 4) * second.Count(j => j % 5 == 1);\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tint n = inputs1[0];\n\t\t\tint m = inputs1[1];\n\n\t\t\tvar first = Enumerable.Range(1, n).Select(i => (long)i).ToList();\n\t\t\tvar second = Enumerable.Range(1, m).Select(j => (long)j).ToList();\n\n\t\t\tvar d0 = second.Count(j => j % 5 == 0);\n\t\t\tvar d1 = second.Count(j => j % 5 == 1);\n\t\t\tvar d2 = second.Count(j => j % 5 == 2);\n\t\t\tvar d3 = second.Count(j => j % 5 == 3);\n\t\t\tvar d4 = second.Count(j => j % 5 == 4);\n\n\t\t\tlong count = 0;\n\t\t\tforeach (var i in first) \n\t\t\t{\n\t\t\t\tvar d = i % 5;\n\t\t\t\tswitch (d) \n\t\t\t\t{\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tcount += d1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tcount += d2;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tcount += d3;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tcount += d4;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcount += d0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var m = data[1];\n var cnt1 = new int[5];\n var cnt2 = new int[5];\n for (int i = 1; i <= n; i++)\n {\n cnt1[i%5]++;\n }\n for (int i = 1; i <= m; i++)\n {\n cnt2[i % 5]++;\n }\n\n var res = cnt1[0] * cnt2[0] + \n cnt1[1] * cnt2[4] + \n cnt1[2] * cnt2[3] + \n cnt1[3] * cnt2[2] + \n cnt1[4] * cnt2[1]; \n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int n, m;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n }\n int dff1 = n / 5, dff2 = m / 5;\n int result = dff1*dff2;\n for(int i = 1, j = 4, dff3 = n%5, dff4=m%5; i<5; j=5-++i)\n result += ((dff1 + (i <= dff3 ? 1 : 0)) * (dff2 + (j <= dff4 ? 1 : 0)));\n Console.WriteLine(result);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Alyona_and_Numbers\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int a = int.Parse(input.Split()[0]);\n int b = int.Parse(input.Split()[1]);\n int min = Math.Min(a, b);\n int max = Math.Max(a, b);\n int collector=0;\n for (int i = 1; i <=min; i++)\n {\n for (int j =1; j <= 5; j++)\n {\n if ((j + i) % 5 == 0 && j <= max)\n { collector = collector + ((max - j) / 5) + 1; break; }\n }\n }\n Console.WriteLine(collector);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\t//System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo (\"en-US\");\n\t\tstring [] s=Console.ReadLine().Split(' ');\n\t\tint n = int.Parse (s[0]);\n\t\tint m = int.Parse (s[1]);\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tans += (m + i) / 5 - (i + 1) / 5;\n\t\t\tif ((i + 1) % 5 == 0)\n\t\t\t\tans++;\n\t\t}\n\n\t}\n};"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static void solve() {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]);\n int[] a = new int[5];\n int[] b = new int[5];\n for (int i = 0; i < 5; i++) {\n a[i] = n / 5;\n b[i] = m / 5;\n }\n for (int i = 1; i <= n % 5; i++) {\n a[i]++;\n }\n for (int i = 1; i <= m % 5; i++) {\n b[i]++;\n }\n Console.WriteLine(a[0] * b[0] + a[1] * b[4] + a[2] * b[3] + a[3] * b[2] + a[4] * b[1]);\n }\n\n static void Main(string[] args) {\n\n solve();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var n = input[0];\n var m = input[1];\n sw.WriteLine(((long)n*m)/5L);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n var tmp = Console.ReadLine().Split(' ');\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n\n var sum = 0;\n for (int i = 1; i <= b; i++)\n {\n sum += (a + i) / 5 - (i + 1) / 5;\n if ((i + 1) % 5 == 0)\n sum++;\n }\n\n\n\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2018_08_23_alyona_and_numbers\n//http://codeforces.com/problemset/problem/682/A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] nm = Console.ReadLine().Split(' ');\n int n = int.Parse(nm[0]);\n int m = int.Parse(nm[1]);\n \n int modfive = 0;\n \n int countFive = n / 5;\n int residue = n % 5;\n\n modfive = Modfive(5,countFive, m) + Modfive(residue,1, m);\n Console.WriteLine(modfive);\n }\n static int Modfive(int c,int r, int m)\n {\n int help = 0;\n int modfive = 0;\n for (int i = 1; i <= c; i++)\n {\n help = 5 - i;\n if (help == 0)\n help = help + 5;\n\n for (int j = help; j <= m; j = j + 5)\n modfive++;\n }\n return modfive*r;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int x = 0;\n int y = 0;\n int sayac = 0;\n long[] xy = new long[2];\n foreach (string str in Console.ReadLine().Split(' '))\n {\n xy[sayac] = long.Parse(str);\n sayac++;\n }\n sayac = 0;\n if ((xy[0] * xy[1]) % 5 == 4)\n Console.Write((xy[0] * xy[1]) / 5 + 1);\n else if ((xy[0] * xy[1]) % 5 == 1)\n Console.Write((xy[0] * xy[1]) / 5 - 1);\n else\n Console.Write((xy[0] * xy[1]) / 5);\n\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int x = 0;\n int y = 0;\n int sayac = 0;\n int[] xy = new int[2];\n foreach (string str in Console.ReadLine().Split(' '))\n {\n xy[sayac] = int.Parse(str);\n sayac++;\n }\n sayac = 0;\n if ((xy[0] * xy[1]) % 5 == 4)\n Console.Write((xy[0] * xy[1]) / 5 + 1);\n else\n Console.Write((xy[0] * xy[1]) / 5);\n\n\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int x = 0;\n int y = 0;\n int sayac = 0;\n long[] xy = new long[2];\n foreach (string str in Console.ReadLine().Split(' '))\n {\n xy[sayac] = long.Parse(str);\n sayac++;\n }\n sayac = 0;\n if ((xy[0] * xy[1]) % 5 == 4)\n Console.Write((xy[0] * xy[1]) / 5 + 1);\n else\n Console.Write((xy[0] * xy[1]) / 5);\n\n\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _682A\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int x = 0;\n int y = 0;\n int sayac = 0;\n int[] xy = new int[2];\n foreach (string str in Console.ReadLine().Split(' '))\n {\n xy[sayac] = int.Parse(str);\n sayac++;\n }\n sayac = 0;\n if ((xy[0] * xy[1]) % 5 == 4)\n Console.Write((xy[0] * xy[1]) / 5 + 1);\n else\n Console.Write((xy[0] * xy[1]) / 5);\n\n\n Console.ReadKey();\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n, m;\n string[] str = Console.ReadLine().Split();\n n = Convert.ToInt32(str[0]);\n m = Convert.ToInt32(str[1]);\n long res = 0;\n for (int i = 1; i <= n; i++)\n {\n if (i%5 == 0)\n {\n res += m / 5;\n }\n else\n {\n res += m / 5;\n if (i%5=(5*mult))ans++; \n }\n print(ans);\n }\n public static String[] ReadLine() \n {\n return Console.ReadLine().Split(' ');\n }\n public static void print(long s)\n {\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int res = 0;\n\n for (int i = 1; i <= nm[0]; i++)\n {\n res += (nm[1] + i) / 5 - (i + 1) / 5;\n if ((i + 1) % 5 == 0) res++;\n\n }\n Console.Write(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\t\tint n = nums [0];\n\t\t\tint m = nums [1];\n\t\t\tlong result = (n / 5) * (m / 5);\n\t\t\tresult += ((n + 4) / 5) * ((m + 1) / 5);\n\t\t\tresult += ((n + 3) / 5) * ((m + 2) / 5);\n\t\t\tresult += ((n + 2) / 5) * ((m + 3) / 5);\n\t\t\tresult += ((n + 1) / 5) * ((m + 4) / 5);\n\t\t\tConsole.WriteLine (result);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class A___Alyona_and_Numbers\n{\n private static void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] nRemainderFrequency = new int[5];\n int[] mRemainderFrequency = new int[5];\n\n for (int i = 1; i <= n; i++)\n {\n int rem = i % 5;\n nRemainderFrequency[rem]++;\n }\n\n for (int j = 1; j <= m; j++)\n {\n int rem = j % 5;\n mRemainderFrequency[rem]++;\n }\n\n long totalPairs = nRemainderFrequency[0] * mRemainderFrequency[0];\n for (int i = 1; i <= 4; i++)\n {\n int iPairs = nRemainderFrequency[i] * mRemainderFrequency[5-i];\n totalPairs += iPairs;\n }\n\n Write(totalPairs);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new A___Alyona_and_Numbers().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class A___Alyona_and_Numbers\n{\n private static void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] nRemainderFrequency = new int[5];\n int[] mRemainderFrequency = new int[5];\n Array.Clear(nRemainderFrequency, 0, 5);\n Array.Clear(mRemainderFrequency, 0, 5);\n\n for (int i = 1; i <= n; i++)\n {\n int rem = i % 5;\n nRemainderFrequency[rem]++;\n }\n\n for (int j = 1; j <= m; j++)\n {\n int rem = j % 5;\n mRemainderFrequency[rem]++;\n }\n\n int totalPairs = nRemainderFrequency[0] * mRemainderFrequency[0];\n for (int i = 1; i <= 4; i++)\n {\n int iPairs = nRemainderFrequency[i] * mRemainderFrequency[5-i];\n totalPairs += iPairs;\n }\n\n Write(totalPairs);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new A___Alyona_and_Numbers().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\npublic static class A___Alyona_and_Numbers\n{\n private static void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] nRemainderFrequency = new int[5];\n int[] mRemainderFrequency = new int[5];\n\n for (int i = 1; i <= n; i++)\n {\n int rem = i % 5;\n nRemainderFrequency[rem]++;\n }\n\n for (int j = 1; j <= m; j++)\n {\n int rem = j % 5;\n mRemainderFrequency[rem]++;\n }\n\n BigInteger totalPairs = nRemainderFrequency[0] * mRemainderFrequency[0];\n for (int i = 1; i <= 4; i++)\n {\n BigInteger iPairs = nRemainderFrequency[i] * mRemainderFrequency[5-i];\n totalPairs += iPairs;\n }\n\n Write(totalPairs);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new A___Alyona_and_Numbers().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExInCsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str1 = Console.ReadLine();\n int x=0, y=0, m, n;\n bool f = false;\n string[] str = str1.Split(' ');\n n = int.Parse(str[0]); m = int.Parse(str[1]);\n for (int i = 1; i <= n; i++ )\n {\n for (int j=1; j<=m; j++)\n {\n if ((i+j)%5==0)\n {\n x += (m - j) / 5 + 1;\n break;\n }\n }\n \n }\n \n Console.WriteLine(x);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Security.AccessControl;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar a = getList();\n\t\t\tlong ans = 0;\n\t\t\tfor (var i = 0; i < 5; ++i)\n\t\t\t{\n\t\t\t\tvar t = a[0] / 5;\n\t\t\t\tt = t + ((a[0] % 5 >= i && i != 0) ? 1 : 0);\n\t\t\t\tvar t1 = a[1] / 5;\n\t\t\t\tt1 = t1 + (a[1] % 5 >= (5 - i) ? 1 : 0);\n\t\t\t\tans += t * t1;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}\n"}], "src_uid": "df0879635b59e141c839d9599abd77d2"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_013A {\n class Program {\n static int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }\n static void Main(string[] args) {\n //while(true) {\n int A=int.Parse(Console.ReadLine());\n int u=0;\n for(int i=2;i0) {\n u+=t%i;\n t/=i;\n }\n }\n int g=gcd(u,A-2);\n Console.WriteLine(\"{0}/{1}\",u/g,(A-2)/g);\n //}\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static int Div(int a, int b)\n {\n for (int i = 2; i <= b; i++)\n {\n if (a % i == 0 && b % i == 0)\n return i;\n }\n return 1;\n }\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n\n int rez = 0;\n for (int i = 2; i < t; i++)\n {\n int number = t;\n while (number >= i)\n {\n rez += number % i;\n number /= i;\n }\n rez += number;\n }\n int count = t - 2;\n int r;\n while ((r = Div(rez, count)) > 1)\n {\n rez /= r; count /= r;\n }\n Console.WriteLine($\"{rez}/{count}\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n static class Reader\n {\n public static int NextInt()\n {\n int ret = 0;\n char c;\n\n while (!char.IsDigit(c = (char)Console.Read()))\n {\n if (c == '-')\n return -NextInt();\n }\n do\n {\n ret = ret * 10 + c - '0';\n } while (char.IsDigit(c = (char)Console.Read()));\n\n return ret;\n }\n\n public static double NextDouble()\n {\n double ret = 0;\n char c;\n\n while (!char.IsDigit(c = (char)Console.Read())) \n {\n if (c == '-')\n return -NextDouble();\n }\n do\n {\n ret = ret * 10 + c - '0';\n } while (char.IsDigit(c = (char)Console.Read()));\n if (c != '.') return ret;\n\n double p10 = 0.1;\n while (char.IsDigit(c = (char)Console.Read()))\n {\n ret += p10 * (c - '0');\n p10 *= 0.1;\n }\n\n return ret;\n }\n }\n\n class Program\n {\n static int GCD(int n, int m)\n {\n return m == 0 ? n : GCD(m, n % m);\n }\n\n static void Main(string[] args)\n {\n int A = Reader.NextInt();\n int num = 0, den = 0;\n\n for (int b = 2; b < A; ++b)\n {\n den++;\n for (int t = A; t > 0; t /= b)\n num += t % b;\n }\n\n int g = GCD(num, den);\n Console.WriteLine(\"{0}/{1}\", num / g, den / g);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n int div = n-2;\n for(int i = 2 ; i < n ; i++){\n int tmp = n;\n while(true){\n sum += tmp%i;\n tmp -= tmp%i;\n tmp /= i;\n if(tmp==1){\n sum ++;\n break;\n }\n if(tmp==0){\n break;\n }\n }\n }\n int len = 0;\n if(sum1 ; j--){\n if(sum%j==0 && div%j == 0){\n sum /= j;\n div /= j;\n break;\n }\n }\n Console.WriteLine(sum+\"/\"+div);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round13\n{\n class A\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n long n = long.Parse(s);\n long sum = 0;\n for (long i = 2; i < n; i++)\n {\n for (long x = n; x != 0; x /= i)\n {\n sum += x % i;\n }\n }\n long nume = sum;\n long deno = n - 2;\n for (long i = 2; i <= Math.Min(nume, deno); i++)\n {\n while (nume % i == 0 && deno % i == 0)\n {\n nume /= i;\n deno /= i;\n }\n }\n Console.WriteLine(\"{0}/{1}\", nume, deno);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _13a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var n = int.Parse(line);\n var sum = 0;\n for (var i = 2; i < n; i++)\n {\n var num = n;\n while (num != 0)\n {\n sum += num % i;\n num /= i;\n }\n }\n var low = n - 2;\n for (var i = 2; i < 1010; i++)\n {\n while (low % i == 0 && sum % i == 0)\n {\n low /= i;\n sum /= i;\n }\n }\n Console.WriteLine(\"{0}/{1}\", sum, low);\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n,total =0;\n\t\tn = Convert.ToInt32(Console.ReadLine());\n\t\tfor(int i=2;i<=(n-1);i++)\n\t\t{\n\t\t\tint nilai=n;\n\t\t\twhile(nilai !=0)\n\t\t\t{\n\t\t\t\ttotal += nilai%i;\n\t\t\t\tnilai = nilai/i;\n\t\t\t}\n\t\t}\n\t\tint temp = n-2;\n\t\tfor(int i=2;i<=(n-2);i++)\n\t\t{\n\t\t\twhile(total%i == 0 && temp%i == 0)\n\t\t\t{\n\t\t\t\ttotal /= i;\n\t\t\t\ttemp /=i;\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(\"{0}/{1}\", total,temp);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Task_13A\n{\n class Program\n {\n static int suminBase(int A , int baza)\n {\n int ans = 0;\n while (A!= 0)\n {\n ans += A % baza;\n A /= baza;\n }\n return ans;\n }\n\n static int GCD(int a, int b)\n {\n if (b == 0) return a;\n return GCD(b, a % b);\n }\n static void Main(string[] args)\n {\n int a=int.Parse(Console.ReadLine());\n int sum=0;\n for (int i = 2; i < a; i++)\n sum += suminBase(a, i); //funqcia\n\n int temp = GCD(sum, a - 2);// udidesi saerTo gamyofi\n Console.WriteLine(\"{0}/{1}\", sum / temp, (a - 2) / temp);\n }\n }\n}\n"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n\n var a = sc.NextInt();\n\n\n // 11\n // var sums = new List();\n int sum = 0;\n for (int i = 2; i < a; ++i) {\n int n = a;\n var digits = new List();\n for (int j = 11; j >= 0; --j) {\n sum += n / (int)Math.Pow(i, j);\n n %= (int)Math.Pow(i, j);\n }\n\n // int sum = 0;\n // foreach (var e in digits) {\n // sum += e;\n // }\n // sums.Add(sum);\n }\n\n // int sum = 0;\n // foreach (var e in sums) {\n // sum += e;\n // }\n\n int numerator = sum;\n int denominator = a - 2;\n\n for (int i = 2; i <= denominator; ++i) {\n while (numerator % i == 0 && denominator % i == 0) {\n numerator /= i;\n denominator /= i;\n }\n }\n\n wr.Write($\"{numerator}/{denominator}\");\n\n\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n int count = 0;\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n sum += Program.sum(A,i);\n count++;\n }\n List delitel = new List();\n for (int i = 2; i <= count; i++)\n {\n if (count % i == 0)\n {\n delitel.Add(i);\n }\n }\n bool f = true;\n while(f)\n {\n f = false;\n for (int i = 0; i < delitel.Count; i++)\n {\n if ((sum % delitel[i] == 0) && (count % delitel[i] == 0))\n {\n f = true;\n sum /= delitel[i];\n count /= delitel[i];\n }\n }\n }\n\n Console.WriteLine(sum+\"/\"+count);\n Console.ReadLine();\n }\n\n static int sum(int A, int t)\n {\n int res = 0;\n List a = new List();\n while (A > 0)\n {\n res += A % t;\n A /= t;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Task_13A\n{\n class Program\n {\n static int SumInBase(int num,int Base)\n {\n int ans = 0;\n while (num != 0)\n {\n ans += num % Base;\n num /= Base;\n }\n return ans;\n }\n static int GCD(int a,int b)\n {\n if (b == 0) return a;\n return GCD(b, a % b);\n }\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine()), sum = 0;\n for (int i = 2; i < A; i++)\n sum += SumInBase(A, i);\n int t = GCD(sum, A - 2);\n Console.WriteLine(\"{0}/{1}\", sum / t, (A - 2) / t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cfbr13_a\n{\n class Program\n {\n static int gcd(int a, int b)\n {\n return (b == 0) ? a : gcd(b, a % b);\n }\n\n\n static void Main(string[] args)\n {\n int sum = 0, count = 0;\n int A = int.Parse(Console.ReadLine());\n int tmp = 0;\n for (int i = 2; i < A; i++)\n {\n tmp = A;\n count++;\n while (tmp > 0)\n {\n sum += tmp % i;\n tmp /= i;\n }\n }\n int gcd_ = gcd(sum, count);\n Console.WriteLine(\"{0}/{1}\", sum/gcd_, count/gcd_);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesCs\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(Console.ReadLine());\n long sum = 0;\n for (long i = 2; i < a; i++)\n {\n long[] bytes = getBytes(a, i);\n \n //string s = bytes.Aggregate(\"\", (prev, cur) => prev + \" \" + cur.ToString());\n //Console.WriteLine(\"{0}: {1}\", i, s);\n\n long curSum = bytes.Sum();\n sum += curSum;\n }\n\n long d = gcd(sum, a - 2);\n //Console.WriteLine(\"sum = {0}, d = {1}\", sum, d);\n sum /= d;\n Console.WriteLine(\"{0}/{1}\", sum, (a - 2) / d);\n }\n\n private static long[] getBytes(long num, long radix)\n {\n List bytes = new List();\n while (num >= radix)\n {\n bytes.Add(num % radix);\n num /= radix;\n }\n bytes.Add(num);\n bytes.Reverse();\n return bytes.ToArray();\n }\n\n private static long gcd(long a, long b)\n {\n long x, y = a, z = b;\n do\n {\n x = y;\n y = z;\n z = x % y;\n } while (z != 0);\n return y;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n \n void solve()\n {\n\n int A = nextInt();\n int s = 0;\n for (int i = 2; i <= A - 1; i++)\n {\n s += sum(A, i);\n }\n int g = gcd(s, A - 2);\n s /= g;\n int d = (A - 2)/g;\n Console.WriteLine(s + \"/\" + d);\n \n }\n int gcd(int a, int b)\n {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n int sum(int num, int b)\n {\n int ret=0;\n while (num > 0)\n {\n ret += num % b;\n num /= b;\n }\n return ret;\n }\n\n //\n\n\n\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codeforces\n{\n class C\n {\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\n5000\n\");\n\n static void Main(string[] args)\n {\n int A = int.Parse(CF.ReadLine());\n\n int sum = 0;\n for (int a = 2; a <= A - 1; a++)\n {\n List ds = _b(A, a);\n foreach (int d in ds)\n sum += d;\n }\n\n int x = sum;\n int y = A - 2;\n for (int i = y; i>=2; i--)\n {\n if ((x % i) == 0 && (y % i) == 0)\n {\n x /= i;\n y /= i;\n }\n }\n\n CF.WriteLine(x+\"/\"+y);\n }\n\n static List _b(int a, int b)\n {\n List ds = new List();\n for (; ; )\n {\n int d = a % b;\n ds.Add(d);\n a /= b;\n if (a == 0)\n break;\n }\n return ds;\n }\n\n\n #region test\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n\n string _test_input;\n\n List _lines;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n int sum = 0;\n int tempnum = num;\n\n for (int i = 2; i < num; i++)\n {\n tempnum = num;\n while (tempnum > 0)\n {\n sum += tempnum % i;\n tempnum /= i;\n }\n }\n\n \n int denom = num - 2;\n int gcd = 0;\n while (gcd != 1)\n {\n gcd = GCD(sum, denom);\n sum = sum / gcd;\n denom = denom / gcd;\n }\n \n Console.WriteLine(sum + \"/\" + denom);\n \n \n // Console.WriteLine(sum + \"/\" + (num - 2).ToString());\n //Console.WriteLine(FindSumOfDigits(5));\n \n // StreamReader f1 = new StreamReader(\"C-small-practice.in\");\n // string line = f1.ReadLine();\n\n // FileStream f2 = new FileStream(\"Output.txt\",FileMode.Open);\n // byte[] bytes = Encoding.ASCII.GetBytes(\"Hello\");\n // f2.Write(bytes, 0, bytes.Length);\n\n }\n\n public static int GCD(int a,int b)\n \n {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_25\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n int k;\n for (int i = 2; i < a ; i++)\n {\n k = a;\n while (k >= i)\n {\n int z = k / i;\n sum += k - i * z;\n k = k / i;\n }\n sum += k;\n }\n k=a-2;\n \n for (int i = a-2; i >=2;i-- )\n if (sum % i == 0 && k % i == 0)\n {\n sum /= i;\n k /= i;\n }\n Console.WriteLine(sum + \"/\" + k);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A {\n\tstatic int gcd(int a, int b)\n\t{\n\t\tint r = 0;\n\t\twhile (b > 0) {\n\t\t\tr = a % b;\n\t\t\ta = b;\n\t\t\tb = r;\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static void Main()\n\t{\n\t\tint A = int.Parse(Console.ReadLine());\n\n\t\tint n = 0;\n\t\tfor (int b = 2; b < A; ++b) {\n\t\t\tint a = A;\n\t\t\twhile (a > 0) {\n\t\t\t\tn += a % b;\n\t\t\t\ta /= b;\n\t\t\t}\n\t\t}\n\n\t\tint d = A - 2;\n\t\tConsole.WriteLine(\"{0}/{1}\", n / gcd(n, d), d / gcd(n, d));\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Diagnostics;\n\nclass Problem\n{\n const string inFile = \"..\\\\..\\\\test.in\";\n\n public void Process()\n {\n TextReader reader = Console.In;\n\n // comment out this line when submit\n //reader = new StreamReader(inFile);\n int A = int.Parse(reader.ReadLine());\n\n string res = Solve(A);\n Console.WriteLine(res);\n\n if (reader != Console.In)\n {\n Console.WriteLine(\"Successful.\");\n }\n }\n\n private string Solve(int A)\n {\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n int temp = 0;\n int k = A;\n while (k > 0)\n {\n int t = k % i;\n temp += t;\n k /= i;\n }\n \n sum += temp;\n }\n\n int a = sum;\n int b = A - 2;\n int c = gcd(a, b);\n\n a /= c;\n b /= c;\n\n return string.Format(\"{0}/{1}\", a, b);\n }\n\n static int gcd(int a, int b)\n {\n while (a % b > 0) { int x = a % b; a = b; b = x; }\n return b;\n }\n\n public static void Main()\n {\n Problem p = new Problem();\n p.Process();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace SDA\n{\n class A13\n {\n static void Main(string[] args)\n {\n var a = int.Parse(Console.ReadLine());\n var sum = 0;\n for (int i = 2; i < a; i++)\n {\n for (int x = a; x != 0; x /= i)\n {\n sum += x % i;\n }\n }\n var num = sum;\n var den = a - 2;\n for (int i = 2; i <= Math.Min(num, den); i++)\n {\n while (num % i == 0 && den % i == 0)\n {\n num /= i;\n den /= i;\n }\n }\n Console.WriteLine(num+\"/\"+den);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n public class Numbers\n {\n public static void Main(string[] args)\n {\n var a = int.Parse(Console.ReadLine());\n var x = 0;\n for (int i = 2; i < a; i++)\n {\n var temp = a;\n while(temp > 0)\n {\n x += temp%i;\n temp /= i;\n }\n }\n var y = a - 2;\n var z = GCD(x, y);\n Console.WriteLine((x / z) + \"/\" + (y / z));\n }\n\n private static int GCD(int x, int y)\n {\n return x%y == 0 ? y : GCD(y, x%y);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n // Array.ConvertAll((Console.ReadLine().Split(' ')), (x => int.Parse(x)));\n int n = int.Parse(Console.ReadLine());\n int k = 0;\n for (int i = 2; i < n; i++)\n k += Col(n, i);\n int del = 0;\n n -= 2;\n for (int i = 1; i <= Math.Min(n, k); i++)\n if (n % i == 0 && k % i == 0)\n del = i;\n Console.WriteLine(k / del + \"/\" + n / del);\n }\n\n static int Col(int num, int k)\n {\n int result = 0;\n while (num > 0)\n {\n result += num % k;\n num /= k;\n }\n return result;\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = Convert.ToInt32(Console.ReadLine());\n\n (new Program()).Numbers(A);\n Console.ReadLine();\n }\n\n public void Numbers(int A)\n {\n int i = 0;\n int a1 = 0;\n int a2 = A - 2;\n\n for (i = 2; i < A; i++)\n {\n a1 += ChangeBase(i, A);\n }\n\n i = GCD(a1, a2);\n a1 /= i;\n a2 /= i;\n\n Console.WriteLine(a1 + \"/\" + a2);\n }\n\n private int ChangeBase(int b, int A)\n {\n int i = 0;\n int count = 0;\n int[] d = new int[15];\n\n for (; i < 15 && A >= 1; i++)\n {\n d[i] = A % b;\n A = (int)(A / b);\n }\n\n for (i = 0; i < 15; i++)\n {\n count += d[i];\n }\n\n return count;\n }\n\n private int GCD(int a, int b)\n {\n int g = 0;\n\n if (b == 0)\n {\n g = a;\n }\n else\n {\n g = GCD(b, a % b);\n }\n\n return g;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskA\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out int A);\n int Y = A - 2;\n int X = 0;\n for (int i = 2; i <= A - 1; i++)\n {\n var nums = Convert(A, i);\n X += nums.Sum();\n }\n\n var gcd = Primes.Gcd(X, Y);\n Console.WriteLine($\"{X/gcd}/{Y/gcd}\");\n }\n\n List Convert(int num, int bas)\n {\n var res = new List();\n\n while (num > 0)\n {\n res.Add(num % bas);\n num /= bas;\n }\n\n res.Reverse();\n return res;\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n\n\n\n\n string s = Console.ReadLine();\n int A = Convert.ToInt32(s);\n int buf;\n int sum = 0;\n int ct=0;\n for(int i=2;i<=A-1;i++)\n {\n buf=A;\n while(buf>0)\n {\n sum+=buf%i;\n\n buf = buf / i;\n\n }\n }\n ct = A - 1 - 2+1;\n \n for(int i=1000000;i>=1;i--)\n {\n if(sum%i==0 && ct%i==0)\n {\n sum/=i;\n ct/=i;\n }\n }\n Console.Write(sum);\n Console.Write(\"/\");\n Console.WriteLine(ct);\n\n \n }\n\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace Numbers_13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int ans = 0;\n for (int i = 2; i <= n - 1; i++)\n {\n ans += SumOfDigitsInBase(n, i);\n }\n\n int gcd = GCD(ans, n - 2);\n Console.WriteLine(\"{0}/{1}\", ans / gcd, (n - 2) / gcd);\n\n }\n private static int GCD(int a, int b)\n {\n\n if (b == 0)\n return a;\n return GCD(b, a % b);\n\n\n }\n private static int SumOfDigitsInBase(int numb, int Base)\n {\n int ans = 0;\n\n /*for(int i=0;i<=1000;i++){\n\n ans+=n%m;\n n/=m;\n if(n/m==0){\n ans+=n%m;\n break;}\n\n }*/\n while (numb != 0)\n {\n ans += numb % Base;\n numb /= Base;\n }\n return ans;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nstatic class Program {\n\n\n public static void Main (string[] args) {\n\n string line = Console.ReadLine ();\n int A = int.Parse (line);\n\n int sum = 0;\n for (int i = 2; i < A; ++i) {\n int B = A;\n while (B >= i) {\n sum += B % i;\n B /= i;\n }\n sum += B;\n }\n int d = gcd (sum, A - 2);\n\n Console.WriteLine (\"{0}/{1}\", sum / d, (A - 2) / d);\n }\n \n static int gcd (int a, int b) {\n int t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n\n static int NOD(int a, int b)\n {\n while (a > 0 && b > 0)\n {\n if (a > b)\n a = a % b;\n else\n b = b % a;\n }\n return a + b;\n }\n\n\n\n\n static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n int ostatok = 0;\n\n for (int i = 2; i < a; i++)\n {\n \n int b = a;\n while (b > 0)\n {\n ostatok = b % i;\n b = b / i;\n summa = summa + ostatok;\n }\n }\n\n int count = a - 2;\n int nod = NOD(summa, count);\n while (summa % nod == 0 && count % nod == 0 && nod != 1)\n {\n summa = summa / nod;\n count = count / nod;\n nod = NOD(summa, count);\n }\n\n Console.WriteLine(summa + \"/\" + count);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n string result = \"\";\n for (int i = 2; i < a; i++)\n {\n int s = a;\n //result += i.ToString() + \": \";\n while (s >= i)\n {\n summa += s % i;\n //result += s % i;\n s = s / i;\n if (s < i)\n {\n summa += s;\n //result += s.ToString();\n }\n }\n // if (i < a - 1)\n //result += \", \";\n }\n int num = a - 2;\n for (int i = num; i > 0; i--)\n {\n if (summa % i == 0 && num % i == 0)\n {\n summa /= i;\n num /= i; \n }\n }\n //Console.WriteLine(result);\n Console.WriteLine(summa.ToString() + \"/\" + num.ToString());\n //Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\n//mcs HelloWorld.cs\n//mono HelloWorld.exe\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar line = Console.ReadLine();\n\t\tvar n = Convert.ToInt32(line);\n\t\t//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));\n\t\tsolve(n);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\t// solve(30, 5, 20, 20, 3, 5);\n\t\t// solve(10, 4, 100, 5, 5, 1);\n\t\t// solve(0, 7, 30, 50, 3, 4);\n\t\t// solve(40, 1, 40, 5, 11, 2);\n\t\t// solve(64, 12, 258, 141, 10, 7);\n\t\t// solve(64, 12, 141, 258, 7, 10);\n\t\t// solve(50,34);\n\t\t// solve(387420489,225159023);\n\t\t// solve(5,5);\n\t\t\n\t}\n\n\tpublic static void solve(int n)\n\t{ \t\t\n\t\tvar sum = 0;\n\t\tfor (var i = 2; i < n; i++)\n\t\t{\n\t\t\tsum += GetSumOfDigis(n,i);\n\t\t}\n\t\tvar lb = n - 2;\n\t\tif (sum % lb == 0)\n\t\t{\n\t\t\tConsole.WriteLine($\"{sum / lb}/{1}\");\n\t\t\treturn;\t\t\n\t\t}\n\t\t\n\t\tfor (var i = 2; i < lb / 2; i++)\n\t\t{\n\t\t\twhile (sum % i == 0 && lb % i == 0)\n\t\t\t{\n\t\t\t\tsum = sum / i;\n\t\t\t\tlb = lb / i;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine($\"{sum}/{lb}\");\n\t}\n\n \tpublic static int GetSumOfDigis(int n, int b)\n\t{\n\t\tvar sum = 0;\n\t\twhile(n != 0)\n\t\t{\n\t\t\tsum += n % b;\n\t\t\tn = n / b;\n\t\t}\n\t\treturn sum;\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace project\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int i , ans1 = 0 , ans2 = n - 2 , g;\n for (i = 2; i <= n - 1; i++)\n ans1 += getValue(n, i);\n g = gcd(ans1, ans2);\n ans1 /= g;\n ans2 /= g;\n Console.WriteLine(ans1 + \"/\" + ans2);\n }\n static int getValue(int num, int d)\n {\n int sum = 0;\n while (num > 0)\n {\n sum += num % d;\n num /= d;\n }\n return sum;\n }\n static int gcd(int a, int b)\n {\n while (b > 0)\n {\n int t = a;\n a = b;\n b = t % a;\n }\n return a;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint i, j = 2;\n\t\t\tdouble res, result, numerator, denominator, total = 0;\n\n\t\t\tint input = Convert.ToInt32 (Console.ReadLine ());\n\n\t\t\ti = input;\n\t\t\tdouble num = Convert.ToDouble (input - 2);\n\n\t\t\twhile (j != Convert.ToInt32 (input)) {\n\t\t\t\ti -= 1;\n\t\t\t\tres = input;\n\t\t\t\tresult = 1;\n\t\t\t\twhile (result != 0) {\n\t\t\t\t\tresult = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));\n\t\t\t\t\tif (result != 0) {\n\t\t\t\t\t\ttotal += res - result * i;\n\t\t\t\t\t} else if (res == i) {\n\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttotal += res;\n\t\t\t\t\t}\n\t\t\t\t\tres = Convert.ToDouble (result);\n\t\t\t\t}\n\t\t\t\tj += 1;\n\t\t\t}\n\n\t\t\tres = total;\n\t\t\tresult = num;\n\t\t\tnumerator = total;\n\t\t\tdenominator = num;\n\t\t\tint[] array = new int[20] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 };\n\n\t\t\tint amt = 0;\n\t\t\twhile (amt <= 19) {\n\t\t\t\tres = numerator % array [amt];\n\t\t\t\tresult = denominator % array [amt];\n\t\t\t\tif (res == 0 && result == 0) {\n\t\t\t\t\tnumerator = numerator / array [amt];\n\t\t\t\t\tdenominator = denominator / array [amt];\n\t\t\t\t} else {\n\t\t\t\t\tamt += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine (numerator + \"/\" + denominator);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint i, a, b, numerator, denominator, j = 2;\n\t\t\tdouble res, result, total = 0;\n\n\t\t\tint input = Convert.ToInt32 (Console.ReadLine ());\n\n\t\t\ti = input;\n\t\t\tdouble num = Convert.ToDouble (input - 2);\n\n\t\t\twhile (j != Convert.ToInt32 (input)) {\n\t\t\t\ti -= 1;\n\t\t\t\tres = input;\n\t\t\t\tresult = 1;\n\t\t\t\twhile (result != 0) {\n\t\t\t\t\tresult = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));\n\t\t\t\t\tif (result != 0) {\n\t\t\t\t\t\ttotal += res - result * i;\n\t\t\t\t\t} else if (res == i) {\n\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttotal += res;\n\t\t\t\t\t}\n\t\t\t\t\tres = Convert.ToDouble (result);\n\t\t\t\t}\n\t\t\t\tj += 1;\n\t\t\t}\n\t\t\t\t\n\t\t\ta = Convert.ToInt32 (total);\n\t\t\tb = Convert.ToInt32 (num);\n\t\t\twhile (b != 0)\n\t\t\t\tb = a % (a = b);\n\t\t\tnumerator = Convert.ToInt32 (total) / a;\n\t\t\tdenominator = Convert.ToInt32 (num) / a;\n\n\t\t\tConsole.WriteLine (numerator + \"/\" + denominator);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Task_13A\n{\n class Program\n {\n private static int GCD(int a , int b )\n {\n if (b == 0)\n return a;\n return GCD(b, a % b);\n }\n private static int SumInBase( int num , int nBase)\n {\n int ans = 0;\n while(num !=0)\n {\n ans += num % nBase;\n num = num / nBase;\n } return ans;\n } \n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine()), TotalSum=0;\n for(int i=2; i<=A-1;i++)\n {\n TotalSum += SumInBase(A, i);\n \n }\n int temps = GCD(TotalSum, A - 2);\n Console.WriteLine(\"{0}/{1}\", TotalSum / temps, (A - 2) / temps);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task13A\n{\n class Program\n {\n static int gcd(int a, int b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static short GetSumNumbers(string str)\n {\n short result = 0;\n for (Int32 i = 0; i < str.Length; i++)\n {\n result += (short)(str[i] - 48);\n }\n return result;\n }\n static Int32 GetSum(Int32 number, Int32 pos)\n {\n Int32 sum = 0;\n while (number > 0)\n {\n Int32 mod = number % pos;\n sum += mod;\n number = number / pos;\n }\n return sum;\n }\n static void Main(string[] args)\n {\n Int32 dim = Int32.Parse(Console.ReadLine());\n Int32 sum = 0;\n for (Int32 i = 2; i < dim; i++)\n {\n sum += GetSum(dim, i);\n }\n Int32 temp = gcd(sum, dim - 2);\n Console.WriteLine(\"{0}/{1}\", sum / temp, (dim - 2)/temp);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n\n int counter = 0;\n for (int i = 2; i < A; i++)\n {\n int helper = A;\n while (helper > 0)\n {\n counter += helper % i;\n helper /= i;\n }\n }\n\n int d = A - 2;\n \n Console.WriteLine(\"{0}/{1}\", counter / gcd(counter, d), d / gcd(counter, d));\n }\n private static int gcd(int a, int b)\n { return b == 0 ? a : gcd(b, a % b); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n\n int counter = 0;\n for (int i = 2; i < A; i++)\n counter += sumOfBase(A, i);\n\n \n Console.WriteLine(\"{0}/{1}\", counter / gcd(counter, A-2), (A-2) / gcd(counter, A-2));\n }\n private static int gcd(int a, int b)\n {\n return b == 0 ? a : gcd(b, a % b);\n }\n private static int sumOfBase(int A, int Base)\n {\n int ans = 0;\n while (A > 0)\n { \n ans += A % Base;\n A /= Base;\n }\n return ans;\n }\n\n }\n}\n"}, {"source_code": "using System;\nstatic class P {\n static void Main() {\n int A = int.Parse(Console.ReadLine()), sum = 0, cnt = A - 2, _base = 2, i = 2;\n for (; _base <= A - 1; ++_base) {\n int a = A;\n while (true) {\n sum += a % _base;\n a /= _base;\n if (a == 0) { break; }\n }\n }\n for (; i <= cnt; ++i) { while (sum % i == 0 && cnt % i == 0) { sum /= i; cnt /= i; } }\n Console.WriteLine(\"{0}/{1}\", sum, cnt);\n }\n}"}, {"source_code": "using System;\n\nnamespace Zero\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, x, y, z, s = 0;\n a = Convert.ToInt32(Console.ReadLine());\n for (x = 2; x < a; x++)\n for (z = a; z > 0; s += z % x, z /= x) ;\n for (x = s, y = a - 2; (z = x % y) > 0; x = y, y = z) ;\n Console.WriteLine(s / y + \"/\" + (a - 2) / y);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass P {\n static void Main() { \n var a = int.Parse(Console.ReadLine());\n var sum = 0;\n for (var b = 2; b < a; b++) {\n var tmp = a;\n while (tmp > 0) { sum += tmp % b; tmp /= b; }\n }\n var denom = a - 2;\n for (var d = 2 ; d <= denom ; d++) if (sum % d + denom % d == 0) {\n sum /= d;\n denom /= d;\n d--;\n }\n Console.Write(\"{0}/{1}\", sum, denom);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int A = Next();\n\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n int a = A;\n while (a>0)\n {\n sum += a%i;\n a /= i;\n }\n }\n\n int g = Gcd(sum, A - 2);\n\n writer.Write(sum/g);\n writer.Write('/');\n writer.WriteLine((A - 2)/g);\n writer.Flush();\n }\n\n public static int Gcd(int a, int b)\n {\n return b == 0 ? a : Gcd(b, a%b);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace b13a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var a = readInt();\n var sum = 0L;\n for (int i = 2; i < a; i++)\n {\n var val = 0;\n var b = a;\n //var count = 1;\n while (true)\n {\n var next = b % i;\n var nextv = b / i;\n val += next;\n if (nextv == 0)\n {\n break;\n }\n\n //if (next == 0)\n //{\n // val += nextv;\n // break;\n //}\n //else\n //{\n // val += next;\n //}\n\n b = nextv;\n }\n\n sum += val;\n }\n\n long count = a - 2;\n var n = nod(Math.Max(sum, count), Math.Min(sum, count));\n sum /= n;\n count /= n;\n\n //var res = sum / ((double)(a - 2));\n Console.WriteLine(\"{0}/{1}\", sum, count);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static long nod(long a, long b)\n {\n var rem = a % b;\n if (rem == 0)\n {\n return b;\n }\n\n return nod(b, rem);\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\nusing System.Diagnostics;\n\nnamespace Main\n{\n class Program\n {\n public static void Main(String[] args)\n {\n //Console.SetIn(new StreamReader(\"c:\\\\a.txt\"));\n\n int n = int.Parse(Console.ReadLine());\n\n long sum = 0;\n\n for (int i = 2; i < n; i++)\n sum += GetConvertedSum(n, i);\n\n Console.WriteLine(sum / GCD(sum, n - 2) + \"/\" + (n - 2) / GCD(sum, n - 2));\n }\n\n private static long GetConvertedSum(int n, int radix)\n {\n long sum = 0;\n\n int a = 23;\n\n if (radix == 16)\n a++;\n\n while (n != 0)\n {\n sum += n%radix;\n n /= radix;\n }\n\n return sum;\n }\n\n private static long GCD(long a, long b)\n {\n if (b == 0)\n return a;\n return GCD(b, a%b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n \n class Program\n {\n static int FindByBase(int x,int bas)\n {\n int rem = 0;\n while (x>0)\n {\n rem += (x %bas);\n x /= bas;\n }\n return rem;\n \n }\n static long gcd(long a, long b)\n {\n return b == 0 ? a : gcd(b, a % b);\n }\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n \n for (int i = 2; i <= a - 1; i++)\n {\n sum += FindByBase(a, i);\n }\n Console.WriteLine(sum / gcd(sum, a - 2) + \"/\" + (a - 2) / gcd(sum, a - 2));\n \n \n \n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n int count = a - 2;\n\n for (int i = 2; i < a; i++)\n {\n int degree = 0;\n int tmp = a;\n while (tmp >= i)\n {\n tmp /= i;\n degree++;\n }\n tmp = a;\n while (degree >= 0)\n {\n int mod = tmp / ((int)Math.Pow(i, degree));\n tmp -= mod * ((int)Math.Pow(i, degree));\n degree--;\n sum += mod;\n }\n }\n \n if (sum % count != 0)\n {\n int nod = Program.NOD(sum, count);\n sum /= nod;\n count /= nod;\n }\n\n Console.WriteLine(sum + \"/\" + count);\n return;\n }\n \n static int NOD(int a, int b)\n {\n while (a != 0 && b != 0)\n {\n if (a >= b) \n a = a % b;\n else \n b = b % a;\n }\n return a + b; \n }\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n long Gcd(long a, long b)\n {\n return b > 0 ? Gcd(b, a % b) : a;\n }\n\n public void Solve()\n {\n int a = ReadInt();\n long sum = 0;\n for (int b = 2; b < a; b++)\n {\n int x = a;\n while (x > 0)\n {\n sum += x % b;\n x /= b;\n }\n }\n\n long den = a - 2;\n long g = Gcd(sum, den);\n writer.WriteLine(\"{0}/{1}\", sum / g, den / g);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Functions\n {\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n public static string[] ReadLineWithSplit(char split)\n {\n return Console.ReadLine().Split(split);\n }\n\n public static string[] ReadLines(int count)\n {\n string[] lines = new string[count];\n for (int x = 0; x < count; x++)\n {\n lines[x] = ReadLine();\n }\n return lines;\n }\n public static string ReverseInts(string s)\n {\n string[] charArray = s.Split(' ');\n Array.Reverse(charArray);\n return charArray.Aggregate(\"\", (current, s1) => current + (s1 + \" \"));\n }\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return charArray.Aggregate(\"\", (current, s1) => current + (s1 + \" \"));\n }\n }\n class Program\n {\n private static void Main()\n {\n int num = Functions.ReadInt();\n\n List converted = new List();\n List sums = new List();\n\n for (var x = 2; x < num; x++)\n {\n converted = ConvertToBase(num, x);\n sums.Add(converted.Sum());\n }\n\n int gcd = GCD(sums.Sum(), sums.Count);\n Console.WriteLine(sums.Sum()/gcd + \"/\" + sums.Count/gcd);\n }\n\n private static int GCD(int sum, int sumsCount)\n {\n int min = Math.Min(sum, sumsCount);\n var gcd = 0;\n for (var i = 1; i <= min; i++)\n {\n if (sum % i == 0 && sumsCount % i == 0 && i > gcd)\n {\n gcd = i;\n }\n }\n\n return gcd;\n }\n\n private static List ConvertToBase(int num, int i)\n {\n List basei = new List();\n for (var x = 15; x >= 0; x--)\n {\n if (num >= Math.Pow(i, x))\n {\n basei.Add((int)Math.Floor(num/Math.Pow(i,x)));\n num -= (int) (Math.Floor(num/Math.Pow(i, x))*Math.Pow(i, x));\n }\n else\n {\n basei.Add(0);\n }\n }\n\n return basei;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var a = int.Parse(Console.ReadLine());\n var sums = new int[a - 2];\n var index = 0;\n for (int i = 2; i < a; i++)\n {\n var num = a;\n while (num != 0)\n {\n var rem = num % i;\n num /= i;\n sums[index] += rem;\n }\n index++;\n }\n int x = sums.Sum();\n int y = sums.Length;\n while (y > 0)\n {\n int rem = x % y;\n x = y;\n y = rem;\n }\n Console.WriteLine(sums.Sum() / x + \"/\" + sums.Length / x);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine().Trim());\n\n int sum_sum = 0;\n int count = 0;\n for (int b = 2; b < n; b++)\n {\n int sum = 0;\n int a = n;\n while (a > 0)\n {\n sum += a % b;\n a /= b;\n }\n sum_sum += sum;\n count++;\n }\n\n int div = 2;\n while (div < count)\n {\n while ((sum_sum % div) == 0 && (count % div) == 0)\n {\n sum_sum /= div;\n count /= div;\n }\n div++;\n }\n\n Console.WriteLine(\"{0}/{1}\", sum_sum, count);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication11\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Int32.Parse(str);\n List ii = new List();\n int result = 0;\n\n for (int sysch = 2; sysch < a; sysch++)\n {\n int chislo = perevod(a, sysch);\n result += chislo;\n ii.Add(chislo);\n }\n\n int o = Nod(result, ii.Count);\n\n if (o == 1)\n {\n Console.WriteLine(\"{0}/{1}\", result, ii.Count);\n }\n else\n {\n Console.WriteLine(\"{0}/{1}\", result/o, ii.Count/o);\n }\n \n }\n\n private static int Nod(int n, int d)\n {\n int temp;\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n%d > 0)\n {\n temp = n;\n n = d;\n d = temp%d;\n }\n else break;\n }\n if (d != 0 && n != 0) return d;\n else return 0;\n }\n\n public static int perevod(int a, int sysch)\n {\n int temp1 = 0;\n int result = 0;\n List s = new List();\n while (a > 0)\n {\n temp1 = a%sysch;\n a = a/sysch;\n s.Add(temp1);\n result += temp1;\n }\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n List summaryNums = new List();\n\n for (int i = 2; i < A; i++)\n summaryNums.Add(sumOfInBase(A, i));\n\n int sum = summaryNums.Sum();\n int gcd = GCD(sum, summaryNums.Count);\n\n Console.WriteLine(\"{0}/{1}\",sum/gcd,summaryNums.Count/gcd);\n \n }\n\n private static int sumOfInBase(int number, int Base)\n {\n int ans = 0;\n while (number != 0) {\n int remains = number % Base;\n ans += remains;\n number /= Base;\n }\n\n return ans;\n }\n\n\n private static int GCD(int a, int b) {\n\n if (b == 0)\n return a;\n\n return GCD(b, a % b);\n }\n\n\n\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n int count = 0;\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n sum += Program.sum(A,i);\n count++;\n }\n Console.WriteLine(sum+\"/\"+count);\n Console.ReadLine();\n }\n\n static int sum(int A, int t)\n {\n int res = 0;\n List a = new List();\n while (A > 0)\n {\n res += A % t;\n A /= t;\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nstatic class P {\n\n static void Main() {\n int A = int.Parse(Console.ReadLine()), sum = 0, cnt = A - 2, k = 0, _base = 2, i = 2;\n var list = new string[cnt];\n for (; _base <= A - 1; ++_base) {\n string num_base = \"\";\n int a = A;\n while (true) {\n int rem = a % _base;\n a = a / _base;\n num_base += rem;\n if (a == 0) { break; }\n }\n list[k++] = string.Join(\"\", num_base.Reverse());\n }\n foreach (string s in list) {\n var arr = s.Select(x => int.Parse(x.ToString()));\n sum += arr.Sum(x => x);\n }\n for (; i <= cnt; ++i) { while (sum % i == 0 && cnt % i == 0) { sum /= i; cnt /= i; } }\n Console.WriteLine(\"{0}/{1}\", sum, cnt);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication29\n{\n \n class Program\n {\n static int FindByBase(int x,int bas)\n {\n int rem = 0;\n while (x>0)\n {\n rem += (x % bas);\n x /= bas;\n }\n return rem;\n \n }\n \n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 2; i <= a-1; i++)\n {\n sum += FindByBase(a, i);\n }\n Console.WriteLine(sum +\"/\"+(a-2));\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n int count = a - 2;\n\n for (int i = 2; i < a; i++)\n {\n int degree = 0;\n int tmp = a;\n while (tmp >= i)\n {\n tmp /= i;\n degree++;\n }\n tmp = a;\n while (degree >= 0)\n {\n int mod = tmp / ((int)Math.Pow(i, degree));\n tmp -= mod * ((int)Math.Pow(i, degree));\n degree--;\n sum += mod;\n }\n }\n if (sum % count == 0)\n {\n Console.WriteLine(sum / count + \"/1\");\n return;\n }\n int k = 2;\n while (k < sum && k < count)\n {\n if (sum % k == 0 && count % k == 0)\n {\n sum /= k;\n count /= k;\n }\n k++;\n }\n Console.WriteLine(sum + \"/\" + count);\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nclass Program\n{\n static int ToBaseN(int number, int Base)\n {\n var n = number;\n var d = 0;\n var digit = new Queue();\n while (n > 0)\n {\n digit.Enqueue((int)n % Base);\n n /= Base;\n }\n var m = 1;\n foreach (var item in digit)\n {\n d += (item * m);\n m *= 10;\n }\n return d;\n }\n static void Main()\n {\n var a = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 2; i < a; i++)\n {\n var n = ToBaseN(a, i);\n while (n > 0)\n {\n sum += n % 10;\n n /= 10;\n }\n }\n Console.WriteLine(\"{0}/{1}\", sum, a - 2);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication11\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Int32.Parse(str);\n List ii = new List();\n int result = 0;\n \n for (int sysch = 2; sysch < a; sysch++)\n {\n int chislo = perevod(a, sysch);\n result+= chislo.ToString().Select(i => Int32.Parse(i.ToString())).Sum();\n ii.Add(chislo);\n }\n\n int o = Nod(result, ii.Count);\n\n if (o == 0)\n {\n Console.WriteLine(\"{0}/{1}\", result, ii.Count);\n }\n else\n {\n Console.WriteLine(\"{0}/{1}\", result/o, ii.Count/o);\n }\n \n }\n\n static int Nod(int n, int d)\n {\n int temp;\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return d;\n else return 0;\n }\n\n public static int perevod(int a, int sysch)\n {\n int temp1 = 0;\n List s = new List();\n while (a > 0)\n {\n temp1 = a%sysch;\n a = a/sysch;\n s.Add(temp1);\n }\n return obrat(s);\n }\n\n public static int obrat(List norm)\n {\n int[] s = new int[norm.Count];\n for (int i = norm.Count - 1; i >= 0; i--)\n {\n s[norm.Count - 1 - i] = norm[i];\n }\n return Convert.ToInt32(string.Join(\"\", s));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication11\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Int32.Parse(str);\n List ii = new List();\n int result = 0;\n \n for (int sysch = 2; sysch < a; sysch++)\n {\n int chislo = perevod(a, sysch);\n char[] f = chislo.ToString().ToCharArray();\n for (int p = 0; p < f.Length; p++)\n {\n result += Int32.Parse(f[p].ToString());\n }\n ii.Add(chislo);\n }\n\n Console.WriteLine(\"{0}/{1}\", result, ii.Count);\n }\n\n public static int perevod(int a, int sysch)\n {\n int temp1 = 0;\n List s = new List();\n while (a > 0)\n {\n temp1 = a%sysch;\n a = a/sysch;\n s.Add(temp1);\n }\n return obrat(s);\n }\n\n public static int obrat(List norm)\n {\n int[] s = new int[norm.Count];\n for (int i = norm.Count - 1; i >= 0; i--)\n {\n s[norm.Count - 1 - i] = norm[i];\n }\n return Convert.ToInt32(string.Join(\"\", s));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication11\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Int32.Parse(str);\n List ii = new List();\n int result = 0;\n \n for (int sysch = 2; sysch < a; sysch++)\n {\n int chislo = perevod(a, sysch);\n result+= a.ToString().Select(i => Int32.Parse(i.ToString())).Sum();\n ii.Add(chislo);\n }\n\n int o = Nod(result, ii.Count);\n\n if (o == 0)\n {\n Console.WriteLine(\"{0}/{1}\", result, ii.Count);\n }\n else\n {\n Console.WriteLine(\"{0}/{1}\", result/o, ii.Count/o);\n }\n \n }\n\n static int Nod(int n, int d)\n {\n int temp;\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return d;\n else return 0;\n }\n\n public static int perevod(int a, int sysch)\n {\n int temp1 = 0;\n List s = new List();\n while (a > 0)\n {\n temp1 = a%sysch;\n a = a/sysch;\n s.Add(temp1);\n }\n return obrat(s);\n }\n\n public static int obrat(List norm)\n {\n int[] s = new int[norm.Count];\n for (int i = norm.Count - 1; i >= 0; i--)\n {\n s[norm.Count - 1 - i] = norm[i];\n }\n return Convert.ToInt32(string.Join(\"\", s));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication11\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Int32.Parse(str);\n List ii = new List();\n int result = 0;\n \n for (int sysch = 2; sysch < a; sysch++)\n {\n int chislo = perevod(a, sysch);\n char[] f = chislo.ToString().ToCharArray();\n for (int p = 0; p < f.Length; p++)\n {\n result += Int32.Parse(f[p].ToString());\n }\n ii.Add(chislo);\n }\n\n int o = Nod(result, ii.Count);\n\n if (o == 0)\n {\n Console.WriteLine(\"{0}/{1}\", result, ii.Count);\n }\n else\n {\n Console.WriteLine(\"{0}/{1}\", result/o, ii.Count/o);\n }\n \n }\n\n static int Nod(int n, int d)\n {\n int temp;\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return d;\n else return 0;\n }\n\n public static int perevod(int a, int sysch)\n {\n int temp1 = 0;\n List s = new List();\n while (a > 0)\n {\n temp1 = a%sysch;\n a = a/sysch;\n s.Add(temp1);\n }\n return obrat(s);\n }\n\n public static int obrat(List norm)\n {\n int[] s = new int[norm.Count];\n for (int i = norm.Count - 1; i >= 0; i--)\n {\n s[norm.Count - 1 - i] = norm[i];\n }\n return Convert.ToInt32(string.Join(\"\", s));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static int Div(int a, int b)\n {\n for (int i = 2; i <= b; i++)\n {\n if (a % i == 0 && b % i == 0)\n return i;\n }\n return 1;\n }\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n\n int rez = 0;\n for (int i = 2; i < t; i++)\n {\n int number = t;\n string ch = \"\";\n while (number >= i)\n {\n ch += number % i;\n number /= i;\n }\n ch += number;\n rez += ch.ToCharArray().Select(x => int.Parse(x.ToString())).Sum();\n }\n int count = t - 2;\n int r;\n while ((r = Div(rez, count)) > 1)\n {\n rez /= r; count /= r;\n }\n Console.WriteLine($\"{rez}/{count}\");\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n for(int i = 2 ; i < n ; i++){\n int tmp = n;\n while(true){\n sum += tmp%i;\n tmp -= tmp%i;\n tmp /= i;\n if(tmp==1){\n sum ++;\n break;\n }\n if(tmp==0){\n break;\n }\n }\n }\n Console.WriteLine(sum+\"/\"+(n-2));\n }\n}"}, {"source_code": "using System;\nclass Test {\n static string Base(int n,int b){\n string ans = \"\";\n while(n>1){\n ans = Convert.ToString(n%b)+ans;\n n = n/b;\n if(n==1){\n ans = Convert.ToString(n)+ans;\n }\n }\n return ans;\n }\n static void Main(){\n int n = int.Parse(Console.ReadLine());\n int sum = 0;\n for(int i=2 ; i();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n\n var a = sc.NextInt();\n\n\n // 11\n // var sums = new List();\n int sum = 0;\n for (int i = 2; i < a; ++i) {\n int n = a;\n var digits = new List();\n for (int j = 11; j >= 0; --j) {\n sum += n / (int)Math.Pow(i, j);\n n %= (int)Math.Pow(i, j);\n }\n\n // int sum = 0;\n // foreach (var e in digits) {\n // sum += e;\n // }\n // sums.Add(sum);\n }\n\n // int sum = 0;\n // foreach (var e in sums) {\n // sum += e;\n // }\n\n int numerator = sum;\n int denominator = a - 2;\n\n for (int i = 2; i <= denominator; ++i) {\n if (numerator % i == 0 && denominator % i == 0) {\n numerator /= i;\n denominator /= i;\n }\n }\n\n wr.Write($\"{numerator}/{denominator}\");\n\n\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesCs\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(Console.ReadLine());\n long sum = 0;\n for (long i = 2; i < a; i++)\n {\n long[] bytes = getBytes(a, i);\n long curSum = bytes.Sum();\n sum += curSum;\n }\n\n long d = gcd(sum, a - 2);\n sum /= d;\n Console.WriteLine(\"{0}/{1}\", sum, a - 2);\n }\n\n private static long[] getBytes(long num, long radix)\n {\n List bytes = new List();\n while (num >= radix)\n {\n bytes.Add(num % radix);\n num /= radix;\n }\n bytes.Add(num);\n bytes.Reverse();\n return bytes.ToArray();\n }\n\n private static long gcd(long a, long b)\n {\n long x, y = a, z = b;\n do\n {\n x = y;\n y = z;\n z = x % y;\n } while (z != 0);\n return y;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n\n int sum = 0;\n int tempnum = num;\n\n for (int i = 2; i < num; i++)\n {\n tempnum = num;\n while (tempnum > 0)\n {\n sum += tempnum % i;\n tempnum /= i;\n }\n }\n\n Console.WriteLine(sum + \"/\" + (num - 2).ToString());\n \n \n // Console.WriteLine(sum + \"/\" + (num - 2).ToString());\n //Console.WriteLine(FindSumOfDigits(5));\n \n // StreamReader f1 = new StreamReader(\"C-small-practice.in\");\n // string line = f1.ReadLine();\n\n // FileStream f2 = new FileStream(\"Output.txt\",FileMode.Open);\n // byte[] bytes = Encoding.ASCII.GetBytes(\"Hello\");\n // f2.Write(bytes, 0, bytes.Length);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_25\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 2; i < a ; i++)\n {\n int k = a;\n while (k >= i)\n {\n int z = k / i;\n sum += k - i * z;\n k = k / i;\n }\n sum += k;\n \n }\n Console.WriteLine(sum+\"/\"+(a-2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_25\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n int k;\n for (int i = 2; i < a ; i++)\n {\n k = a;\n while (k >= i)\n {\n int z = k / i;\n sum += k - i * z;\n k = k / i;\n }\n sum += k;\n }\n k=a-2;\n for (int i = 2; i < a - 2;i++ )\n if (sum % i == 0 && k % i == 0)\n {\n sum /= i;\n k /= i;\n }\n Console.WriteLine(sum + \"/\" + k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_25\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int sum = 0;\n for (int i = 2; i < a-1 ; i++)\n {\n int k = a;\n while (k >= i)\n {\n int z = k / i;\n sum += k - i * z;\n k = k / i;\n }\n sum += k;\n \n }\n sum+=2;\n Console.WriteLine(sum+\"/\"+(a-2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n\n\n\n\n string s = Console.ReadLine();\n int A = Convert.ToInt32(s);\n int buf;\n int sum = 0;\n int ct=0;\n for(int i=2;i<=A-1;i++)\n {\n buf=A;\n while(buf>0)\n {\n sum+=buf%i;\n\n buf = buf / i;\n\n }\n }\n ct = A - 1 - 2+1;\n \n for(int i=1;i<=1000000;i++)\n {\n if(sum%i==0 && ct%i==0)\n {\n sum/=i;\n ct/=i;\n }\n }\n Console.Write(sum);\n Console.Write(\"/\");\n Console.WriteLine(ct);\n\n \n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n\n static int NOD(int a, int b)\n {\n while (a > 0 && b > 0)\n {\n if (a > b)\n a = a % b;\n else\n b = b % a;\n }\n return a + b;\n }\n\n\n\n\n static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n int ostatok = 0;\n\n for (int i = 2; i < a; i++)\n {\n \n int b = a;\n while (b > 0)\n {\n ostatok = b % i;\n b = b / i;\n summa = summa + ostatok;\n }\n }\n\n int count = a - 2;\n int nod = NOD(summa, count);\n while (summa / nod == 0 && count / nod == 0)\n {\n summa = summa / nod;\n count = count / nod;\n nod = NOD(summa, count);\n }\n\n Console.WriteLine(summa + \"/\" + count);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n for (int i = 2; i < a; i++)\n {\n int s = a;\n while (s >= i)\n {\n summa += s % i;\n s = s / i;\n if (s < i)\n {\n summa += s;\n }\n }\n }\n int num = a - 2;\n for (int i = a - 2; i > 0; i--)\n {\n if (summa % i == 0 && (a - 2) % i == 0)\n {\n summa = summa / i;\n num = num / i; \n }\n }\n Console.WriteLine(summa.ToString() + \"/\" + num.ToString());\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n for (int i = 2; i < a; i++)\n {\n int s = a;\n while (s >= i)\n {\n summa += s % i;\n s = s / i;\n if (s < i)\n {\n summa += s;\n }\n }\n }\n Console.WriteLine(summa.ToString() + \"/\" + (a - 2).ToString());\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n string result = \"\";\n for (int i = 2; i < a; i++)\n {\n int s = a;\n result += i.ToString() + \": \";\n while (s >= i)\n {\n summa += s % i;\n result += s % i;\n s = s / i;\n if (s < i)\n {\n summa += s;\n result += s.ToString();\n }\n }\n if (i < a - 1)\n result += \", \";\n }\n int num = a - 2;\n for (int i = summa; i > 0; i--)\n {\n if (summa % i == 0 && num % i == 0)\n {\n summa /= i;\n num /= i; \n }\n }\n Console.WriteLine(result);\n Console.WriteLine(summa.ToString() + \"/\" + num.ToString());\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int summa = 0;\n string result = \"\";\n for (int i = 2; i < a; i++)\n {\n int s = a;\n result += i.ToString() + \": \";\n while (s >= i)\n {\n summa += s % i;\n result += s % i;\n s = s / i;\n if (s < i)\n {\n summa += s;\n result += s.ToString();\n }\n }\n if (i < a - 1)\n result += \", \";\n }\n int num = a - 2;\n for (int i = summa; i > 0; i--)\n {\n if (summa % i == 0 && num % i == 0)\n {\n summa /= i;\n num /= i; \n }\n }\n Console.WriteLine(result);\n Console.WriteLine(summa.ToString() + \"/\" + num.ToString());\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\n//mcs HelloWorld.cs\n//mono HelloWorld.exe\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar line = Console.ReadLine();\n\t\tvar n = Convert.ToInt32(line);\n\t\t//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));\n\t\tsolve(n);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\t// solve(30, 5, 20, 20, 3, 5);\n\t\t// solve(10, 4, 100, 5, 5, 1);\n\t\t// solve(0, 7, 30, 50, 3, 4);\n\t\t// solve(40, 1, 40, 5, 11, 2);\n\t\t// solve(64, 12, 258, 141, 10, 7);\n\t\t// solve(64, 12, 141, 258, 7, 10);\n\t\t// solve(50,34);\n\t\t// solve(387420489,225159023);\n\t\t// solve(5,5);\n\t\t\n\t}\n\n\tpublic static void solve(int n)\n\t{ \t\t\n\t\tvar sum = 0;\n\t\tfor (var i = 2; i < n; i++)\n\t\t{\n\t\t\tsum += GetSumOfDigis(n,i);\n\t\t}\n\t\tvar lb = n - 2;\n\t\tif (sum % lb == 0)\n\t\t{\n\t\t\tConsole.WriteLine($\"{sum / lb} / {1}\");\n\t\t\treturn;\t\t\n\t\t}\n\t\t\n\t\tfor (var i = 2; i < lb / 2; i++)\n\t\t{\n\t\t\tif (sum % i == 0 && lb % i == 0)\n\t\t\t{\n\t\t\t\tsum = sum / i;\n\t\t\t\tlb = lb / i;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine($\"{sum} / {lb}\");\n\t}\n\n \tpublic static int GetSumOfDigis(int n, int b)\n\t{\n\t\tvar sum = 0;\n\t\twhile(n != 0)\n\t\t{\n\t\t\tsum += n % b;\n\t\t\tn = n / b;\n\t\t}\n\t\treturn sum;\n\t}\n}"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\n//mcs HelloWorld.cs\n//mono HelloWorld.exe\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar line = Console.ReadLine();\n\t\tvar n = Convert.ToInt32(line);\n\t\t//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));\n\t\tsolve(n);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\t// solve(30, 5, 20, 20, 3, 5);\n\t\t// solve(10, 4, 100, 5, 5, 1);\n\t\t// solve(0, 7, 30, 50, 3, 4);\n\t\t// solve(40, 1, 40, 5, 11, 2);\n\t\t// solve(64, 12, 258, 141, 10, 7);\n\t\t// solve(64, 12, 141, 258, 7, 10);\n\t\t// solve(50,34);\n\t\t// solve(387420489,225159023);\n\t\t// solve(5,5);\n\t\t\n\t}\n\n\tpublic static void solve(int n)\n\t{ \t\t\n\t\tvar sum = 0;\n\t\tfor (var i = 2; i < n; i++)\n\t\t{\n\t\t\tsum += GetSumOfDigis(n,i);\n\t\t}\n\t\tvar lb = n - 2;\n\t\tif (sum % lb == 0)\n\t\t{\n\t\t\tConsole.WriteLine($\"{sum / lb}/{1}\");\n\t\t\treturn;\t\t\n\t\t}\n\t\t\n\t\tfor (var i = 2; i < lb / 2; i++)\n\t\t{\n\t\t\tif (sum % i == 0 && lb % i == 0)\n\t\t\t{\n\t\t\t\tsum = sum / i;\n\t\t\t\tlb = lb / i;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine($\"{sum}/{lb}\");\n\t}\n\n \tpublic static int GetSumOfDigis(int n, int b)\n\t{\n\t\tvar sum = 0;\n\t\twhile(n != 0)\n\t\t{\n\t\t\tsum += n % b;\n\t\t\tn = n / b;\n\t\t}\n\t\treturn sum;\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint i, j = 2;\n\t\t\tdouble res, result, numerator, denominator, total = 0;\n\n\t\t\tint input = Convert.ToInt32 (Console.ReadLine ());\n\n\t\t\ti = input;\n\t\t\tdouble num = Convert.ToDouble (input - 2);\n\n\t\t\twhile (j != Convert.ToInt32 (input)) {\n\t\t\t\ti -= 1;\n\t\t\t\tres = input;\n\t\t\t\tresult = 1;\n\t\t\t\twhile (result != 0) {\n\t\t\t\t\tresult = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));\n\t\t\t\t\tif (result != 0) {\n\t\t\t\t\t\ttotal += res - result * i;\n\t\t\t\t\t} else if (res == i) {\n\t\t\t\t\t\ttotal += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttotal += res;\n\t\t\t\t\t}\n\t\t\t\t\tres = Convert.ToDouble (result);\n\t\t\t\t}\n\t\t\t\tj += 1;\n\t\t\t}\n\n\t\t\tres = total;\n\t\t\tresult = num;\n\t\t\tnumerator = total;\n\t\t\tdenominator = num;\n\t\t\tint[] array = new int[4] { 2, 3, 5, 7 };\n\n\t\t\tint amt = 0;\n\t\t\twhile (amt <= 3) {\n\t\t\t\tres = numerator % array [amt];\n\t\t\t\tresult = denominator % array [amt];\n\t\t\t\tif (res == 0 && result == 0) {\n\t\t\t\t\tnumerator = numerator / array [amt];\n\t\t\t\t\tdenominator = denominator / array [amt];\n\t\t\t\t} else {\n\t\t\t\t\tamt += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine (numerator + \"/\" + denominator);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task13A\n{\n class Program\n {\n static int gcd(int a, int b)\n {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n static short GetSumNumbers(string str)\n {\n short result = 0;\n for (Int32 i = 0; i < str.Length; i++)\n {\n result += (short)(str[i] - 48);\n }\n return result;\n }\n static Int32 GetSum(Int32 number, Int32 pos)\n {\n Int32 sum = 0;\n while (number > 0)\n {\n Int32 mod = number % pos;\n sum += GetSumNumbers(mod.ToString());\n number = number / pos;\n }\n return sum;\n }\n static void Main(string[] args)\n {\n Int32 dim = Int32.Parse(Console.ReadLine());\n Int32 sum = 0;\n for (Int32 i = 2; i < dim; i++)\n {\n sum += GetSum(dim, i);\n }\n Int32 temp = gcd(sum, dim - 2);\n Console.WriteLine(\"{0}/{1}\", sum / temp, (dim - 2)/temp);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task13A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int A = int.Parse(Console.ReadLine());\n\n int counter = 0;\n for (int i = 2; i < A; i++)\n {\n int helper = A;\n while (helper > 0)\n {\n counter += helper % i;\n helper /= i;\n }\n }\n\n int d = A - 2;\n Console.WriteLine(counter + \"/\" + d);\n //Console.WriteLine(\"{0}/{1}\", counter / gcd(counter, d), d / gcd(counter, d));\n }\n private static int gcd(int a, int b)\n { return b == 0 ? a : gcd(b, a % b); }\n }\n}\n"}], "src_uid": "1366732dddecba26db232d6ca8f35fdc"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] input = Console.ReadLine().Split(' ');\n List c = new List();\n foreach (string i in input)\n c.Add(Int32.Parse(i));\n c = c.Distinct().ToList();\n c.Sort();\n List cc = c.ToArray().ToList();\n cc.Reverse();\n int res = 0;\n List bad = new List();\n List combo = new List();\n foreach (int g in c)\n {\n if (bad.Contains(g))\n continue;\n foreach (int h in cc)\n {\n if (h % g == 0)\n {\n combo.Add(h);\n }\n }\n //Console.WriteLine(\"COMBO! {0}\", string.Join(\" \", combo));\n if (combo.Count() > 0)\n res += 1;\n foreach (int i in combo)\n {\n bad.Add(i);\n }\n }\n \n \n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] ch = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n Array.Sort(ch);\n int rez = 0;\n for (int i = 0; i < n; i++)\n {\n if (ch[i] != 0)\n {\n rez++;\n for (int k = i + 1; k < n; k++)\n {\n if (ch[k] != 0 && ch[k] % ch[i] == 0)\n ch[k] = 0;\n }\n ch[i]=0;\n }\n }\n rez += ch.GroupBy(x => x).Count() - 1;\n Console.WriteLine(rez);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace A._Paint_the_Numbers\n{\n class Program\n {\n public class cmp : IComparer {\n public int Compare (int a, int b) {\n if (a > b) return 1;\n else if (a == b) return 0;\n else return -1;\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 0;\n int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n cmp CMP = new cmp();\n Array.Sort(A, CMP);\n while (A.Count() > 0) {\n A = A.Where(k => (k % A[0]) != 0).ToArray();\n res++;\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class HelloA {\n\tpublic static void Main(){\n\t\tint n;\n\t\tint[] colors;\n\t\tint cnt = 0;\n\t\tInt32.TryParse(Console.ReadLine(), out n);\n\t\tcolors = new int[n];\n\t\tstring [] data = Console.ReadLine().Split(' ');\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tInt32.TryParse(data[i], out colors[i]);\n\t\tfor(int i = 0; i < colors.Length-1; i++){\n\t\t\tfor(int j = i + 1; j < colors.Length; j++){\n\t\t\t\tif(colors[j] < colors[i]) {\n\t\t\t\t\tint t = colors[j];\n\t\t\t\t\tcolors[j] = colors[i];\n\t\t\t\t\tcolors[i] = t;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < colors.Length; i++){\n\t\t\tif(colors[i] == -1) continue;\n\t\t\tcnt++;\n\t\t\tint the_color = colors[i];\n\t\t\tfor(int j = i; j < colors.Length; j++){\n\t\t\t\tif((colors[j] % the_color) == 0) colors[j] = -1;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(cnt);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf584\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf584A();\n }\n\n public static void solve_cf584A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] cnt = new int[101];\n\n Array.Sort(a);\n int min = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (a[j] % a[i] == 0)\n {\n if (cnt[a[i]] == 0)\n {\n min++;\n cnt[a[i]]++;\n }\n cnt[a[j]]++;\n }\n }\n }\n\n /*for (int i = 0; i < n; i++)\n {\n if (cnt[a[i]] == 0)\n {\n min++;\n }\n }*/\n\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.ComponentModel;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int N = sc.NextInt();\n int[] A = sc.IntArray();\n \n Array.Sort(A);\n\n int ans = 0;\n\n for (int i = 0; i < N; i++)\n {\n if (A[i] > 0)\n {\n ans++;\n int t = A[i];\n for (int j = 0; j < N; j++)\n {\n if (A[j] % t == 0)\n {\n A[j] = 0;\n }\n }\n }\n \n }\n \n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n\nclass Scanner\n{\n public Scanner()\n {\n _pos = 0;\n _line = new string[0];\n }\n\n const char Separator = ' ';\n private int _pos;\n private string[] _line;\n\n #region \u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u53d6\u5f97\n\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _pos = 0;\n }\n\n return _line[_pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n\n #endregion\n\n #region \u578b\u5909\u63db\n\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n\n #endregion\n\n #region \u914d\u5217\u53d6\u5f97\n\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = Console.ReadLine().Split(Separator);\n\n _pos = _line.Length;\n return _line;\n }\n\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n ReadLine();\n List b = new List(Array.ConvertAll(ReadLine().Split(), int.Parse));\n b.Sort();\n for (int i = 0; i < b.Count-1; i++)\n {\n for (int j = i+1; j < b.Count; j++)\n {\n if (b[j] % b[i] == 0)\n {\n b.Remove(b[j]);\n j = i;\n }\n }\n }\n WriteLine(b.Count);\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint N = int.Parse(Console.ReadLine());\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tint[]A = new int[N];\n\t\tfor(var i=0;i();\n\t\tfor(var i=0;i int.Parse(f)).ToArray();\n Array.Sort(numbers);\n for (int i = 0; i < numbers.Length; i++)\n {\n if (numbers[i]!=0)\n {\n for (int j = i + 1; j < numbers.Length; j++)\n {\n if (numbers[j] % numbers[i] == 0 && numbers[j]!=0)\n {\n numbers[j] = 0;\n }\n }\n numbers[i] = 0;\n counter++;\n }\n \n }\n\n Console.WriteLine(counter.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\n//using static System.Globalization.CultureInfo;\nusing System.Text;\nclass Program\n{\n public static bool chmin(ref T num, T val) where T : IComparable\n { if (num.CompareTo(val) == 1) { num =val; return true; } return false; }\n public static bool chmax(ref T num, T val) where T : IComparable\n { if (num.CompareTo(val) == -1) { num = val; return true; } return false; }\n public static void swap(ref T v1, ref T v2)\n { var t = v2; v2 = v1; v1 = t; }\n static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n Console.SetOut(sw);\n new Program().Solve();\n Console.Out.Flush();\n }\n void Solve()\n {\n var num = Input.num;\n var ar = Input.ar;Array.Sort(ar);\n var th = new bool[num];\n var ct = 0;\n for(var i=0;i ReadLine().Trim();\n public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();\n public static int num => ToInt32(read);\n public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();\n public static long numL => ToInt64(read);\n public static T[] create(int n, Func f)\n => Enumerable.Repeat(0, n).Select(f).ToArray();\n public static char[][] grid(int h)\n => create(h, _ => read.ToCharArray());\n public static int[] ar1D(int n)\n => create(n, _ => num);\n public static long[] arL1D(int n)\n => create(n, _ => numL);\n public static string[] strs(int n)\n => create(n, _ => read);\n public static int[][] ar2D(int n)\n => create(n, _ => ar);\n public static long[][] arL2D(int n)\n => create(n, _ => arL);\n public static List[] edge(int n)\n => create(n, _ => new List());\n public static T GetValue(string g)\n {\n var t = typeof(T);\n if (t == typeof(int))\n return (T)(object)int.Parse(g);\n if (t == typeof(long))\n return (T)(object)long.Parse(g);\n if (t == typeof(string))\n return (T)(object)g;\n if (t == typeof(char))\n return (T)(object)char.Parse(g);\n if (t == typeof(double))\n return (T)(object)double.Parse(g);\n if (t == typeof(bool))\n return (T)(object)bool.Parse(g);\n return default(T);\n }\n public static void Make(out T1 v1, out T2 v2)\n {\n v1 = Next();\n v2 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3)\n {\n Make(out v1, out v2);\n v3 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4)\n {\n Make(out v1, out v2, out v3);\n v4 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)\n {\n Make(out v1, out v2, out v3, out v4);\n v5 = Next();\n }\n public static void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)\n {\n Make(out v1, out v2, out v3, out v4, out v5);\n v6 = Next();\n }\n private static Queue sc;\n public static T Next() { sc = sc ?? new Queue(); if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item); return GetValue(sc.Dequeue()); }\n public static void Next(ref T val) => val = Next();\n public const long Inf = (long)1e18;\n public const double eps = 1e-6;\n public const string Alfa = \"abcdefghijklmnopqrstuvwxyz\";\n public const int MOD = 1000000007;\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1 { get; set; }\n public T2 v2 { get; set; }\n public Pair() { v1 = Input.Next(); v2 = Input.Next(); }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString()\n => $\"{v1.ToString()} {v2.ToString()}\";\n public override bool Equals(object obj)\n => this == (Pair)obj;\n public override int GetHashCode()\n => v1.GetHashCode() ^ v2.GetHashCode();\n public static bool operator ==(Pair p1, Pair p2)\n => p1.CompareTo(p2) == 0;\n public static bool operator !=(Pair p1, Pair p2)\n => p1.CompareTo(p2) != 0;\n public static bool operator >(Pair p1, Pair p2)\n => p1.CompareTo(p2) == 1;\n public static bool operator >=(Pair p1, Pair p2)\n => p1.CompareTo(p2) != -1;\n public static bool operator <(Pair p1, Pair p2)\n => p1.CompareTo(p2) == -1;\n public static bool operator <=(Pair p1, Pair p2)\n => p1.CompareTo(p2) != 1;\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3 { get; set; }\n public Pair() : base() { v3 = Input.Next(); }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString()\n => $\"{base.ToString()} {v3.ToString()}\";\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Paint_the_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n Array.Sort(nn);\n int ans = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (nn[i] == 0)\n continue;\n ans++;\n for (int j = i + 1; j < n; j++)\n {\n if (nn[j] != 0 && nn[j]%nn[i] == 0)\n nn[j] = 0;\n }\n }\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\npublic class a{\n public static void Main() {\n int n = Convert.ToInt32(Console.ReadLine());\n var b = Array.ConvertAll(Console.ReadLine().Trim().Split(), int.Parse);\n int i = 0, cnt = 0;\n Array.Sort(b);\n int[] ar = new int[101];\n for(i=0; i a.CompareTo(b));\n\n var colors = 0;\n while(numbers.Count > 0) {\n colors++;\n var currentNumber = numbers.First();\n for(var i=0; i< numbers.Count; i++)\n {\n if(numbers[i] % currentNumber == 0)\n {\n numbers.RemoveAt(i);\n i--;\n }\n }\n }\n\n Console.WriteLine(colors);\n }\n\n }\n}"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"6\n10 2 3 5 4 2\"\n*/\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NI();\n var A = cin.NIA();\n\n var ans = 0;\n\n while (A.Length > 0) {\n ans++;\n var min = A.Min();\n A = A.Where(a => a % min != 0).ToArray();\n }\n\n System.Console.WriteLine(ans);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic static class Helpers {\n public static string Join(this IEnumerable arr, string sep = \" \") {\n return string.Join(sep, arr);\n }\n\n public static void Swap(ref T a, ref T b) {\n var tmp = a;\n a = b;\n b = tmp;\n }\n\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NI() {\n return int.Parse(Next());\n }\n\n public long NL() {\n return long.Parse(Next());\n }\n\n public ulong NUL() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] NIA(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] NLA() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] NULA() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing static System.Math;\nusing static System.Array;\nusing static AtCoderSolve.Tool;\n\nnamespace AtCoderSolve\n{\n class Solve\n {\n const int mod = 1000000007;\n const int INF = int.MaxValue / 2;\n const long SINF = long.MaxValue / 2;\n\n static void Main(string[] args)\n {\n //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n //Console.SetOut(sw);\n var cin = new Scanner();\n \n int n = int.Parse(Console.ReadLine());\n var a = cin.SplitReader();\n Sort(a);\n bool[] div = new bool[n];\n Initialize(ref div, false);\n long ans = 0;\n\n for(var i = 0; i < n; i++)\n {\n if (div[i]) { continue; }\n ans++;\n for(var j = 0; j < n; j++)\n {\n if (i == j) { continue; }\n if (a[j] % a[i] == 0)\n {\n div[j] = true;\n }\n }\n }\n\n Console.WriteLine(ans);\n\n\n //Console.Out.Flush();\n }\n\n\n }\n\n public class Scanner\n {\n public int[] SplitReader()\n {\n int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();\n return array;\n }\n public long[] SplitReaderL()\n {\n long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();\n return array;\n }\n }\n\n public static class Tool\n {\n static public void Initialize(ref T[] array, T initialvalue)\n {\n for(var i = 0; i < array.Length; i++)\n {\n array[i] = initialvalue;\n }\n }\n static public long ModuloP(long value,long mod)\n {\n long r = value % mod;\n \n if (r * mod < 0)\n {\n r += mod;\n }\n return r;\n }\n\n }\n\n struct Pair : IComparable> where T : IComparable\n {\n public T variable;\n public int index;\n\n public Pair(T val, int i)\n {\n variable = val;\n index = i;\n }\n\n public int CompareTo(Pair otherPair)\n {\n return variable.CompareTo(otherPair.variable);\n }\n\n public int CompareIndex(Pair otherPair)\n {\n return index.CompareTo(otherPair.index);\n }\n }\n\n\n\n}\n\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32).OrderBy(x=>x).ToList();\n for(int i=0;i nums = Console.ReadLine ().Split (' ').Select (int.Parse).Distinct ().ToList ();\n\t\tint result = 0;\n\t\twhile (nums.Count > 0) {\n\t\t\tint min = nums.Min ();\n\t\t\tnums = nums.Where (n => n % min != 0).ToList ();\n\t\t\tresult++;\n\t\t}\n\n\t\tConsole.WriteLine (result);\n\t}\n}"}, {"source_code": "// Problem: 1209A - Paint the Numbers\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass PaintTheNumbers\n\t{\n\tstatic int Main ()\n\t\t{\n\t\tstring line = Console.ReadLine ();\n\t\tif (line == null)\n\t\t\treturn -1;\n\t\tchar[] delims = {' ', '\\t'};\n\t\tstring[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n\t\tif (words.Length != 1)\n\t\t\treturn -1;\n\t\tbyte n;\n\t\tif (!Byte.TryParse (words[0], out n))\n\t\t\treturn -1;\n\t\tif (n < 1 || n > 100)\n\t\t\treturn -1;\n\t\tline = Console.ReadLine ();\n\t\tif (line == null)\n\t\t\treturn -1;\n\t\twords = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n\t\tif (words.Length != n)\n\t\t\treturn -1;\n\t\tbool[] existNumbers = new bool[100];\n\t\tArray.Clear (existNumbers,0,100);\n\t\tfor (byte i = 0; i < n; i++)\n\t\t\t{\n\t\t\tbyte ai;\n\t\t\tif (!Byte.TryParse (words[i], out ai))\n\t\t\t\treturn -1;\n\t\t\tif (ai < 1 || ai > 100)\n\t\t\t\treturn -1;\n\t\t\tif (!existNumbers[ai-1])\n\t\t\t\texistNumbers[ai-1] = true;\n\t\t\t}\n\t\tbyte ans = 0;\n\t\tfor (byte i = 0; i < 100; i++)\n\t\t\tif (existNumbers[i])\n\t\t\t\t{\n\t\t\t\tbyte j = i;\n\t\t\t\twhile (j < 100)\n\t\t\t\t\t{\n\t\t\t\t\texistNumbers[j] = false;\n\t\t\t\t\tj += Convert.ToByte (i+1);\n\t\t\t\t\t}\n\t\t\t\tans++;\n\t\t\t\t}\n\t\tConsole.WriteLine (ans);\n\t\treturn 0;\n\t\t}\n\t}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static Codeforces.IO;\nusing static System.Linq.Enumerable;\n\nnamespace Codeforces\n{\n static class IO\n {\n static StringBuilder builder = new StringBuilder();\n static Dummy dummy = new Dummy();\n class Dummy\n {\n ~Dummy()\n {\n Console.Write(builder);\n }\n }\n public static void Write(object obj)\n {\n builder.Append(obj);\n }\n public static void WriteLine(object obj)\n {\n builder.AppendLine(obj.ToString());\n }\n public static void Write(params object[] objs)\n {\n if (objs.Length != 0)\n {\n Write(objs[0]);\n for (var i = 1; i < objs.Length; ++i)\n {\n Write(\" \");\n Write(objs[i]);\n }\n }\n }\n public static void WriteLine(params object[] objs)\n {\n Write(objs);\n WriteLine();\n }\n\n public static void WriteLine()\n {\n builder.AppendLine();\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n public static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n public static (T, T) ReadTuple2(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1]);\n }\n public static (T, T, T) ReadTuple3(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1], ar[2]);\n }\n }\n\n static class Program\n {\n static void Main(string[] args)\n {\n var N = int.Parse(ReadLine());\n var set = new SortedSet(ReadArray(int.Parse));\n var result = 0;\n for (; set.Count != 0; ++result)\n {\n var c = set.Min;\n for(var i = c; i <= 100; i += c)\n {\n set.Remove(i);\n }\n }\n WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n List nums = Console.ReadLine().Split(' ').Select(long.Parse).Distinct().ToList();\n int result = 0;\n while (nums.Count > 0)\n {\n long min = nums.Min();\n nums = nums.Where(n => n % min != 0).ToList();\n result++;\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf584\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf584A();\n }\n\n public static void solve_cf584A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] cnt = new int[101];\n\n int min = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i != j && a[j] % a[i] == 0)\n {\n if (cnt[a[i]] == 0)\n {\n min++;\n }\n cnt[a[j]]++;\n cnt[a[i]]++;\n }\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n if (cnt[a[i]] == 0)\n {\n min++;\n }\n }\n\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf584\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf584A();\n }\n\n public static void solve_cf584A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] cnt = new int[101];\n\n int min = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i != j && a[j] % a[i] == 0)\n {\n if (cnt[a[j]] == 0)\n {\n min++;\n }\n cnt[a[j]]++;\n cnt[a[i]]++;\n }\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n if (cnt[a[i]] == 0)\n {\n min++;\n }\n }\n\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf584\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf584A();\n }\n\n public static void solve_cf584A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] cnt = new int[101];\n\n int min = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i != j && a[j] % a[i] == 0)\n {\n if (cnt[a[j]] == 0)\n {\n min++;\n }\n cnt[a[j]]++;\n }\n }\n }\n\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n ReadLine();\n int []b = Array.ConvertAll(ReadLine().Split(), int.Parse);\n Array.Sort(b);\n HashSeta=new HashSet();\n for (int i = 0; i < b.Length; i++)\n {\n for (int j = 2; j <= b[i]; j++)\n {\n if (b[i] % j == 0)\n {\n a.Add(j);\n break;\n }\n }\n }\n WriteLine(a.Count>0?a.Count:1);\n \n\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static List Mnosh(int n)\n {\n List nn = new List();\n for(int i = 1; i <= n; i++)\n {\n if (n % i == 0)\n nn.Add(i);\n }\n return nn;\n }\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] input = Console.ReadLine().Split(' ');\n List c = new List();\n foreach (string i in input)\n c.Add(Int32.Parse(i));\n c = c.Distinct().ToList();\n c.Sort();\n c.Reverse();\n int res = 0;\n int ii = 0;\n while(c.Count() != 0)\n {\n List m = Mnosh(c[0]);\n List combo = new List();\n foreach (int h in m)\n {\n if (c.Contains(h))\n combo.Add(h);\n }\n //Console.WriteLine(\"COMBO! {0}\", string.Join(\" \", combo));\n if (combo.Count() > 0)\n res += 1;\n foreach (int i in combo)\n {\n c.Remove(i);\n }\n //ii++;\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] input = Console.ReadLine().Split(' ');\n List c = new List();\n foreach (string i in input)\n c.Add(Int32.Parse(i));\n c = c.Distinct().ToList();\n c.Sort();\n List cc = c.ToArray().ToList();\n cc.Reverse();\n int res = 0;\n List bad = new List();\n List combo = new List();\n foreach (int g in c)\n {\n if (bad.Contains(g))\n continue;\n foreach (int h in cc)\n {\n if (h % g == 0)\n {\n combo.Add(h);\n }\n }\n Console.WriteLine(\"COMBO! {0}\", string.Join(\" \", combo));\n if (combo.Count() > 0)\n res += 1;\n foreach (int i in combo)\n {\n bad.Add(i);\n }\n }\n \n \n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static List Mnosh(int n)\n {\n List nn = new List();\n for(int i = 1; i <= n; i++)\n {\n if (n % i == 0)\n nn.Add(i);\n }\n nn.Reverse();\n if(nn.Count() == 1)\n {\n nn.Add(1);\n }\n return nn;\n }\n\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] input = Console.ReadLine().Split(' ');\n List c = new List();\n foreach (string i in input)\n c.Add(Int32.Parse(i));\n c = c.Distinct().ToList();\n c.Sort();\n c.Reverse();\n int res = 0;\n while(c.Count() != 0)\n {\n List m = Mnosh(c[0]);\n List combo = new List();\n foreach (int h in m)\n {\n if (c.Contains(h) && h % m[1] == 0)\n combo.Add(h);\n }\n //Console.WriteLine(\"COMBO! {0}\", string.Join(\" \", combo));\n if (combo.Count() > 0)\n res += 1;\n foreach (int i in combo)\n {\n c.Remove(i);\n }\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\tpublic static void Main (string[] args)\n\t{ \n\t\tConsole.ReadLine ();\n\t\tList nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToList ();\n\t\tint result = 0;\n\t\tfor (int i = 2; nums.Count > 0 && i <= nums.Max (); i++) {\n\t\t\tList div = nums.Where (x => x % i == 0).ToList ();\n\t\t\tif (div.Count > 0) {\n\t\t\t\tnums = nums.Where (x => x % i != 0).ToList ();\n\t\t\t\tresult++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (result);\n\t}\n} "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\tstatic HashSet PrimeFactor (int n)\n\t{\n\t\tHashSet result = new HashSet ();\n\t\tfor (int i = 2; i * i <= n; i++) {\n\t\t\twhile (n % i == 0) {\n\t\t\t\tresult.Add (i);\n\t\t\t\tn /= i;\n\t\t\t}\n\t\t}\n\t\tif (n > 1)\n\t\t\tresult.Add (n);\n\t\treturn result;\n\t}\n\n\tpublic static int Solve (List> factored)\n\t{\n\t\tif (factored.Count == 0)\n\t\t\treturn 0;\n\t\tHashSet first = factored [0];\n\n\t\tint result = 1000;\n\t\tforeach (int f in first) {\n\t\t\tList> newList = factored.Where (fac => !fac.Contains (f)).ToList ();\n\t\t\tresult = Math.Min (result, Solve (newList));\n\t\t}\n\t\treturn result + 1;\n\t}\n\n\tpublic static void Main (string[] args)\n\t{ \n\t\tConsole.ReadLine ();\n\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).Distinct ().ToArray ();\n\n\t\tList> factored = nums.Select (n => PrimeFactor (n)).ToList ();\n\t\tfactored = factored.OrderBy (f => f.Count).ToList ();\n\t\tConsole.WriteLine (Solve (factored));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\tstatic bool IsPrime (long n)\n\t{\n\t\tif (n < 2)\n\t\t\treturn false;\n\t\tfor (long i = 2; i * i <= n; i++) {\n\t\t\tif (n % i == 0)\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic static void Main (string[] args)\n\t{ \n\t\tConsole.ReadLine ();\n\t\tList nums = Console.ReadLine ().Split (' ').Select (int.Parse).Distinct ().ToList ();\n\n\t\tList primeInput = nums.Where (n => IsPrime (n)).ToList ();\n\t\tnums = nums.Where (n => !primeInput.Any (p => n % p == 0)).ToList ();\n\t\tList primes = Enumerable.Range (1, 100).Where (p => nums.Any (n => n % p == 0)).ToList ();\n\n\t\tbool[,] isDivisible = new bool[nums.Count, primes.Count];\n\t\tfor (int i = 0; i < nums.Count; i++) {\n\t\t\tfor (int idx = 0; idx < primes.Count; idx++) {\n\t\t\t\tisDivisible [i, idx] = nums [i] % primes [idx] == 0;\n\t\t\t}\n\t\t}\n\n\t\tint result = 1 + primes.Count;\n\t\tfor (int i = 0; i < 1 << primes.Count; i++) {\n\t\t\tint bitCount = 0;\n\t\t\tint tmp = i;\n\t\t\tint index = 0;\n\t\t\tbool[] match = new bool[nums.Count];\n\t\t\twhile (tmp > 0) {\n\t\t\t\tif (tmp % 2 == 1) {\n\t\t\t\t\tbitCount++;\n\t\t\t\t\tfor (int k = 0; k < match.Length; k++) {\n\t\t\t\t\t\tmatch [k] |= isDivisible [k, index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttmp /= 2;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tif (bitCount >= result)\n\t\t\t\tcontinue;\n\n\t\t\tbool valid = true;\n\t\t\tforeach (bool b in match)\n\t\t\t\tvalid &= b;\n\t\t\tif (valid)\n\t\t\t\tresult = bitCount;\n\t\t}\n\n\t\tConsole.WriteLine (result + primeInput.Count);\n\t}\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem\n{\n class Program\n {\n static void Main(string[] args)\n {\n int loop = int.Parse(Console.ReadLine());\n int[] arr = new int[loop];\n var res = 0;\n var input = Console.ReadLine().Split(' ');\n for (int i = 0; i < loop; i++)\n {\n arr[i] = int.Parse(input[i]);\n }\n var distinctArr = arr.Distinct().ToArray();\n Array.Sort(arr);\n Array.Sort(distinctArr);\n \n for (int i = 0; i < distinctArr.Length; i++)\n {\n if (!arr.Contains(distinctArr[i]))\n continue;\n for (int j = 0; j < arr.Length; j++)\n {\n if (arr[j] % distinctArr[i] == 0)\n {\n arr = arr.Where(val => val != arr[j]).ToArray();\n }\n }\n\n \n res++;\n if (arr.Length == 0)\n break;\n \n }\n Console.WriteLine(res);\n }\n }\n}\n"}], "src_uid": "63d9b7416aa96129c57d20ec6145e0cd"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\n\n// https://codeforces.com/problemset/problem/753/A\npublic class A___Santa_Claus_and_Candies\n{\n private static void Solve()\n {\n int n = ReadInt();\n\n int number = 0;\n int sum = 0;\n var list = new List();\n while (sum <= n)\n {\n number++;\n sum += number;\n list.Add(number);\n }\n\n list.Remove(sum - n); // :O\n\n Write(list.Count);\n WriteArray(list);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n public static class Problem753A\n {\n private const int Count = 1000;\n private static Dictionary> dp = new Dictionary>();\n \n private static void InitialiseTable()\n {\n dp[1] = new List{1};\n dp[2] = new List{2};\n \n for (var i = 1; i <= Count; i++)\n {\n if (!dp.ContainsKey(i))\n dp[i] = new List{};\n \n for (var j = i-1; j > 0; j--)\n {\n var k = i - dp[j].Sum();\n if (dp[j].Contains(k) || k<= 0 )\n {\n continue;\n }\n else\n {\n foreach (var c in dp[j])\n {\n dp[i].Add(c);\n }\n dp[i].Add(k);\n break;\n }\n }\n }\n \n } \n \n public static void Main( string[] args)\n {\n InitialiseTable();\n var i = int.Parse(Console.ReadLine().Trim());\n Console.WriteLine(dp[i].Count);\n Console.WriteLine(string.Join(\" \", dp[i].Select(x => x.ToString())));\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tclass A\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t int n = int.Parse(Console.ReadLine());\n\t\t int sum = 0;\n\t\t int j = 0;\n\t\t List l = new List();\n\t\t while(j<=n)\n\t\t {\n\t\t sum++;\n\t\t j += sum;\n\t\t l.Add(sum);\n\t\t }\n\t\t \n\t\t l.Remove(j-n);\n\t\t \n\t\t Console.WriteLine(l.Count);\n\t\t for(int i=0;i 1000)\n return -1;\n byte k = 0;\n byte kNext = 1;\n ushort sum = 0;\n while (sum + kNext <= n)\n {\n sum += kNext;\n k = kNext;\n kNext++;\n }\n Console.WriteLine (k);\n byte r = Convert.ToByte (n-sum);\n byte numKidNoChangeCandies = Convert.ToByte (k-r);\n byte iLast = Convert.ToByte (k-1);\n for (byte i = 0; i < k; i++)\n {\n Console.Write (i < numKidNoChangeCandies ? i+1 : i+2);\n Console.Write (i < iLast ? ' ' : '\\n');\n }\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp\n{\n public class Program\n {\n public static void Main()\n {\n int n = Int32.Parse(Console.ReadLine());\n Stack stack = new Stack();\n for (int i = 1; n > 0; i++)\n {\n if (n >= i)\n {\n n -= i;\n stack.Push(i);\n }\n else\n {\n stack.Push(stack.Pop() + n);\n n = 0;\n }\n }\n Console.WriteLine(stack.Count);\n Console.Write(stack.Pop());\n while (stack.Count > 0)\n {\n Console.Write(\" \" + stack.Pop());\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Santa_Claus_and_Candies\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next() - 1;\n\n var nn = new Stack();\n nn.Push(1);\n for (int i = 2;; i++)\n {\n if (n >= i)\n {\n nn.Push(i);\n n -= i;\n }\n else break;\n }\n nn.Push(n + nn.Pop());\n\n writer.WriteLine(nn.Count);\n foreach (int i in nn)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List v = new List();\n int sum = 0;\n for (int i = 1; sum + i <= n; i++)\n {\n v.Add(i);\n sum += i;\n }\n v[v.Count - 1] += n - sum;\n Console.WriteLine(v.Count);\n Console.WriteLine(string.Join(\" \", v));\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n;\n\t\t\tint.TryParse(Console.ReadLine(), out n);\n\t\t\tint count = (int)Math.Sqrt(2 * n);\n\t\t\tif (count * (count + 1) > 2 * n) count--;\n\t\t\tConsole.WriteLine(count);\n\t\t\tfor (int i = 1; i();\n var ca = 1;\n while (true)\n {\n if (rem - ca >= 0)\n {\n ans.Push(ca);\n rem -= ca;\n ca++;\n }\n else\n {\n break;\n }\n }\n\n var count = ans.Count;\n var res = ans.ToArray();\n Console.WriteLine(count);\n for (int i = 0; i < count; i++)\n {\n if (i == 0)\n {\n Console.Write(\"{0} \", res[i] + rem);\n }\n else\n {\n Console.Write(\"{0} \", res[i]);\n }\n }\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var addends = new List();\n int total = 0;\n for (int i = 1; total + i <= n; i++)\n {\n addends.Add(i);\n total += i;\n }\n addends[addends.Count - 1] += n - total;\n\n Console.WriteLine(addends.Count);\n Console.WriteLine(string.Join(\" \", addends));\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0;\n int total = 0;\n for (; total < n;)\n {\n total += ++count;\n }\n\n int remainder = 0;\n if (total > n)\n {\n remainder = n - total + count--;\n }\n\n int k = count;\n string[] counts = new string[k];\n for (int i = k - 1; i > -1; i--, count--)\n {\n counts[i] = k - i - 1 < remainder ? (count + 1).ToString() : count.ToString();\n }\n\n Console.WriteLine(k);\n Console.WriteLine(string.Join(\" \", counts));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Santa_Claus_and_Candies_codeforces753A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int balance = 0;\n List candies = new List();\n int sumOfCandies = 0;\n if (n == 1)\n {\n sumOfCandies = n;\n candies.Add(n);\n }\n else\n {\n\n for (int i = 1; i < n; i++)\n {\n sumOfCandies = sumOfCandies + i;\n if (sumOfCandies > n)\n {\n sumOfCandies = sumOfCandies - i;\n break;\n }\n candies.Add(i);\n }\n }\n\n if (sumOfCandies != n)\n {\n balance = n - sumOfCandies;\n int j = candies.Count - 1;\n candies[j] = candies[j] + balance;\n }\n // printing all the results\n Console.WriteLine(candies.Count);\n foreach (var item in candies)\n {\n Console.Write(item + \" \");\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1A\n{\n class Program753A\n {\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[,] M = new int [1001, 1001];\n\n for (int i = 0; i <= n; i++)\n for (int j = 0; j <= n; j++)\n M[i, j] = -1;\n M[0, 0] = 0;\n\n for (int i = 0; i < n; i++)\n for (int j = 0; j <= n; j++)\n if (M[i, j] >= 0)\n for (int k = M[i, j] + 1; k <= n; k++)\n if (j+k<=n) M[i + 1, j + k] = k;\n\n int jj = n;\n while (M[jj, n] < 0) jj--;\n\n Console.WriteLine(jj);\n\n int p = n;\n for (int kk = jj; kk > 0; kk--)\n {\n Console.Write(M[kk, p] + \" \");\n p = p - M[kk, p];\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace tmp6\n{\n class Program\n {\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine()), k = 0, tmpN = n, i = 1;\n List l = new List();\n while(n > 0)\n {\n n -= i;\n l.Add(i);\n k++;\n i++;\n }\n if(n < 0)\n {\n l.Remove(Math.Abs(n));\n k--;\n }\n Console.WriteLine(k);\n for (int j = 0; j < l.Count; j++)\n Console.Write(l[j] + \" \");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n \n int a = Convert.ToInt32(Console.ReadLine());\n List lista = new List();\n lista.Add(1);\n int cont=2;\n \n if(a==1){\n Console.WriteLine(1);\n Console.WriteLine(1);\n }else if(a==2){\n Console.WriteLine(1);\n Console.WriteLine(2);\n }else{\n while(lista.Sum()!=a){\n if(!lista.Contains(a-lista.Sum())){\n lista.Add(cont);\n cont++;\n }else{\n lista[lista.Count-1]=lista[lista.Count-1]+(a-lista.Sum());\n }\n }\n string[]array=new string[lista.Count];\n for(int j=0;j();\n //if (n <= 2)\n //{\n // ans.Add(n);\n //}\n //else if (n == 3)\n //{\n // ans.Add(1);\n // ans.Add(2);\n //}\n //else\n //{\n ans.Add(n);\n bool ok = true;\n while (ok)\n {\n ok = false;\n //var tmp = new List();\n for (int i = 0; i = 0 && a - '0' <= 9) return true;\n else return false;\n }\n\n public static bool alph(char a)\n {\n if (a - 'A' >= 0 && a - 'A' <= 10) return true;\n else return false;\n }\n \n }\n\n\n class Segment\n {\n //public int[] arr;\n public Tuple[] arr;\n int n;\n\n public Segment(int n)\n {\n this.n = n * 2;\n //arr = Enumerable.Range(0, n*2).ToArray();\n //arr = new int[this.n];\n arr = new Tuple[this.n];\n for (int i = 0; i < this.n; i++)\n {\n arr[i] = Tuple.Create(0,0,0,0,0);\n }\n\n }\n\n public void update(int i, int x)\n {\n i = (n / 2) + i - 1;\n //arr[i] = 1;\n if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);\n else if (x == 0) arr[i] = Tuple.Create( 0,1, 0, 0, 0);\n else if (x == 1) arr[i] = Tuple.Create(0,0,1,0,0);\n else if (x == 6) arr[i] = Tuple.Create( 0, 0, 0,1, 0);\n else if (x == 7) arr[i] = Tuple.Create( 0, 0, 0, 0,1);\n\n while (i > 0)\n {\n i = (i - 1) / 2;\n //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);\n //if (arr[i * 2 + 1] > arr[i * 2 + 2])\n //{\n // arr[i] = arr[i*2+1];\n //}\n //else\n //{\n // arr[i] = arr[i*2+2];\n //}\n //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];\n arr[i] = Tuple.Create(arr[i*2+1].Item1+ arr[i*2+2].Item1,\n arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,\n arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,\n arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,\n arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);\n }\n\n }\n\n //call : query(a,b, 0, 0, n)\n public Tuple query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l) return Tuple.Create(0,0,0,0,0);\n if (a <= l && r <= b) return arr[k];\n else\n {\n\n\n\n\n var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);\n var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);\n\n\n\n //if (vl.Item4 > vr.Item4)\n //{\n // return vl;\n //}\n ////else if (vl.Item4 == vr.Item4)\n ////{\n //// if (countA >= countB) return vr;\n //// else return vl;\n ////}\n //else return vr;\n\n\n return Tuple.Create(vl.Item1 + vr.Item1,\n vl.Item2 + vr.Item2,\n vl.Item3 + vr.Item3,\n vl.Item4 + vr.Item4,\n vl.Item5 + vr.Item5);\n\n\n //return Math.Max(vl, vr);\n //return vl\n int countA = 0;\n int countB = 0;\n if (vl.Item1 == 0) countA++;\n if (vl.Item2 == 0) countA++;\n if (vl.Item3 == 0) countA++;\n if (vl.Item4 == 0) countA++;\n if (vl.Item5 == 0) countA++;\n\n if (vr.Item1 == 0) countB++;\n if (vr.Item2 == 0) countB++;\n if (vr.Item3 == 0) countB++;\n if (vr.Item4 == 0) countB++;\n if (vr.Item5 == 0) countB++;\n\n\n if((vl.Item1==0 && vr.Item1>0))\n {\n return vr;\n }\n else if ((vl.Item1 > 0 && vr.Item1 == 0))\n {\n return vl;\n }\n else if ((vl.Item2 == 0 && vr.Item2 > 0))\n {\n return vr;\n }\n else if ((vl.Item2 > 0 && vr.Item2 == 0))\n {\n return vl;\n }\n else if ((vl.Item3 == 0 && vr.Item3 > 0))\n {\n return vr;\n }\n else if ((vl.Item3 > 0 && vr.Item3 == 0))\n {\n return vl;\n }\n else if ((vl.Item4 == 0 && vr.Item4 > 0))\n {\n return vr;\n }\n else if ((vl.Item4 > 0 && vr.Item4 == 0))\n {\n return vl;\n }\n else if ((vl.Item5 == 0 && vr.Item5 > 0))\n {\n return vr;\n }\n else if ((vl.Item5 > 0 && vr.Item5 == 0))\n {\n return vl;\n }\n\n if (vl.Item4 > vr.Item4)\n {\n return vl;\n }\n else if (vl.Item4 == vr.Item4)\n {\n if (countA >= countB) return vr;\n else return vl;\n }\n else return vr;\n\n //if (countA <= countB) return vl;\n //else return vr;\n }\n }\n\n\n }\n\n\n class UnionFind\n {\n public int[] path;\n\n\n public UnionFind(int n)\n {\n path = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n path[i] = i;\n }\n\n }\n\n private int root(int i)\n {\n while (i != path[i])\n {\n path[i] = path[path[i]];\n i = path[i];\n }\n return i;\n }\n\n\n\n public bool find(int p, int q)\n {\n return root(p) == root(q);\n }\n\n\n\n public void unite(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n path[i] = j;\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int candyAmount = Convert.ToInt32(Console.ReadLine());\n int sum = candyAmount;\n int counter = 1;\n List list = new List();\n\n while ((double)sum / 2 > counter)\n {\n sum -= counter;\n list.Add(counter++);\n }\n\n list.Add(sum);\n Console.WriteLine(list.Count);\n Console.WriteLine(string.Join(\" \", list));\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = Convert.ToInt32(Console.ReadLine());\n int n = (int)((-1 + Math.Sqrt(1 + 8 * sum)) / 2);\n int i;\n int t = 0;\n\n Console.WriteLine(n);\n for (i = 1; i < n; i++)\n {\n Console.Write(i);\n Console.Write(' ');\n t += i;\n }\n Console.WriteLine(sum - t);\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Test\n{\n class Node\n {\n public int left;\n public int right;\n public Int64 sum;\n }\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int answer = 0;\n for(int i = 1; i <= 100; i++)\n {\n if(i*(i+1)/2 > n)\n {\n answer = i - 1;\n break;\n }\n }\n Console.WriteLine(answer);\n for(int i = 1; i < answer; i++)\n {\n Console.Write(i + \" \");\n n -= i;\n }\n Console.Write(n);\n }\n }\n}\n\n//int n = int.Parse(Console.ReadLine());\n//int[] h = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n//Array.Sort(data, (int a,int b) => a>b?-1:a==b?0:1);\n//Console.WriteLine($\"{left:f9}\".Replace(',', '.'));\n//Console.WriteLine(string.Format(\"{0:F10}\",t).Replace(\",\",\".\"));\n\n//Sorted set\n/*\nSortedSet set = new SortedSet();\nfor(int i=1;i<=n;i++)\n{\n set.Add(i);\n}\n\nSortedSet temp = set.GetViewBetween(l, r);\nSortedSet del = new SortedSet();\nforeach (int t in temp)\n{\n if(t != x)\n {\n answer[t] = x;\n del.Add(t);\n //set.Remove(t);\n }\n}\nforeach(int t in del)\n{\n set.Remove(t);\n} \n*/\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = RI();\n List ans = new List();\n ans.Add(1);\n n--;\n while (ans.Max() < n)\n {\n ans.Add(ans.Max() + 1);\n n -= ans.Max();\n }\n\n ans[ans.Count - 1] += n;\n\n Console.WriteLine(ans.Count);\n Console.WriteLine(string.Join(\" \", ans));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n if(n==1)\n {\n Console.WriteLine(1);\n Console.WriteLine(1);\n return;\n }\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = ans + i;\n lst.Add(i);\n if (ans > n)\n {\n ans = ans - i;\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = n - ans;\n int j = 0;\n for (; j < lst.Count-left-1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n for (; j < lst.Count - 1; j++)\n {\n Console.Write((lst[j]+1) + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n if(n==1)\n {\n Console.WriteLine(1);\n Console.WriteLine(1);\n return;\n }\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = ans + i;\n lst.Add(i);\n if (ans > n)\n {\n ans = ans - i;\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = n - ans;\n int j = 0;\n for (; j < lst.Count-10; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n for (; j < lst.Count - 1; j++)\n {\n Console.Write((lst[j]+1) + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n if(n==1)\n {\n Console.WriteLine(1);\n Console.WriteLine(1);\n return;\n }\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = ans + i;\n lst.Add(i);\n if (ans > n)\n {\n ans = ans - i;\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = n - ans;\n int j = 0;\n for (; j < left; j++)\n {\n Console.Write(lst[j] + 1 + \" \");\n }\n for (; j < lst.Count - 1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n if(n==1)\n {\n Console.WriteLine(1);\n return;\n }\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = ans + i;\n lst.Add(i);\n if (ans > n)\n {\n ans = ans - i;\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = n - ans;\n int j = 0;\n for (; j < left; j++)\n {\n Console.Write(lst[j] + 1 + \" \");\n }\n for (; j < lst.Count - 1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n static List anss = new List();\n // Driver code \n public static void Main()\n {\n\n //int t = int.Parse(Console.ReadLine());\n //while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n var n = input1[0];\n // var k = input1[1];\n // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();\n int i = 1;\n List lst = new List();\n var ans = 0;\n for (; i <= n; i++)\n {\n ans = (i * (i + 1)) / 2;\n lst.Add(ans);\n if (ans > n)\n {\n break;\n }\n }\n\n Console.WriteLine(i - 1);\n var left = ans - n;\n int j = 0;\n for (; j < left; j++)\n {\n Console.Write(lst[j] + 1 + \" \");\n }\n for (; j < lst.Count-1; j++)\n {\n Console.Write(lst[j] + \" \");\n }\n\n\n }\n\n\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n public static class Problem753A\n {\n private const int Count = 1000;\n private static Dictionary> dp = new Dictionary>();\n \n private static void InitialiseTable()\n {\n dp[1] = new List{1};\n for (var i = 2; i <= Count; i++)\n {\n dp[i] = new List();\n \n for (var j = i-1; j> 0; j--)\n {\n var k = i - dp[j].Sum();\n if (dp[j].Contains(k) || k<= 0 )\n {\n continue;\n }\n else\n {\n foreach (var c in dp[j])\n {\n dp[i].Add(c);\n }\n dp[i].Add(k);\n break;\n }\n }\n }\n } \n \n public static void Main( string[] args)\n {\n InitialiseTable();\n var i = int.Parse(Console.ReadLine().Trim());\n Console.WriteLine(dp[i].Count);\n Console.WriteLine(string.Join(\" \", dp[i].Select(x => x.ToString())));\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n public static class Problem753A\n {\n private const int COUNT = 1000;\n private static Dictionary> dp = new Dictionary>();\n \n private static void InitialiseTable()\n {\n for (var i = 0; i <= COUNT; i++)\n {\n dp[i] = new List();\n \n for (var j = i-1; j> 0; j--)\n {\n var k = i - dp[j].Sum();\n if (dp[j].Contains(k) || k<= 0 )\n {\n continue;\n }\n else\n {\n foreach (var c in dp[j])\n {\n dp[i].Add(c);\n }\n dp[i].Add(k);\n break;\n }\n }\n }\n } \n \n public static void Main( string[] args)\n {\n InitialiseTable();\n var i = int.Parse(Console.ReadLine().Trim());\n Console.WriteLine(dp[i].Count);\n Console.WriteLine(string.Join(\" \", dp[i].Select(x => x.ToString())));\n \n }\n }\n}"}, {"source_code": "\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n\n //int n = int.Parse(Console.ReadLine());\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for (int i = 0; i < n; i++)\n //{\n // input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //}\n\n\n //int n = int.Parse(Console.ReadLine());\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n\n\n //int n = int.Parse(Console.ReadLine());\n //var arr = new int[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for(int i =0; i< n; i++)\n //{\n // arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //}\n\n\n\n //string s = Console.ReadLine();\n //int n = int.Parse(Console.ReadLine());\n //var arr = new char[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //for (int i = 0; i < n; i++)\n //{\n // arr[i] = Console.ReadLine().ToArray();\n\n //}\n\n\n\n int n = int.Parse(Console.ReadLine());\n\n var ans = new List();\n\n if (n > 3)\n {\n while (n>0)\n {\n if (n == 3)\n {\n ans.Add(1);\n ans.Add(2);\n break;\n }\n else if (n <= 2)\n {\n ans.Add(n);\n break;\n }\n else\n {\n \n int a = 0;\n for (int j = 3; j ();\n //bool first = false;\n //if (bull != 4)\n //{\n\n\n // var ans = new char[4];\n\n // if(count<9 && cow>0 && list.Count()<4)\n // {\n // for(int i=0; i< cow; i++)\n // {\n // list.Add(count);\n // }\n // ans[0] = (char)(count+'0'+1);\n // ans[1] = (char)(count+'0' + 1);\n // ans[2] = (char)(count+'0' + 1);\n // ans[3] = (char)(count+'0' + 1);\n // first = true;\n // }\n // else\n // {\n // if(first)\n // {\n // ans[0] = (char)(list[0]+'0');\n // ans[1] = (char)(list[1]+'0');\n // ans[2] = (char)(list[2]+'0');\n // ans[3] = (char)(list[3]+'0');\n\n // count = 0;\n // first = false;\n // }\n // else\n // {\n // char tmp = ans[0];\n // char tmp2 = ans[1];\n // char tmp3 = ans[2];\n // if(count%2==0)\n // {\n // ans[0] = ans[2];\n // ans[2] = tmp;\n // ans[1] = ans[3];\n // ans[3] = tmp2;\n // }\n // else\n // {\n // ans[0] = ans[1];\n // ans[1] = tmp;\n // ans[2] = ans[3];\n // ans[3] = tmp3;\n // }\n\n // }\n\n\n // }\n\n\n // count++;\n // Console.WriteLine(new string(ans));\n //}\n //else Console.WriteLine();\n\n\n\n\n \n \n }\n\n \n \n }\n\n\n class Segment\n {\n public Tuple[] arr;\n int n;\n\n public Segment(int n)\n {\n this.n = n * 2;\n //arr = Enumerable.Range(0, n*2).ToArray();\n arr = new Tuple[this.n];\n for (int i = 0; i < this.n; i++)\n {\n arr[i] = Tuple.Create((long)0, 0);\n }\n\n }\n\n public void update(int i, long x, int ind)\n {\n i = (n / 2) + i - 1;\n arr[i] = Tuple.Create(x, ind);\n while (i > 0)\n {\n i = (i - 1) / 2;\n //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);\n if (arr[i * 2 + 1].Item1 > arr[i * 2 + 2].Item1)\n {\n arr[i] = Tuple.Create(arr[i * 2 + 1].Item1, arr[i * 2 + 1].Item2);\n }\n else\n {\n arr[i] = Tuple.Create(arr[i * 2 + 2].Item1, arr[i * 2 + 2].Item2);\n }\n\n }\n\n }\n\n //call : query(a,b, 0, 0, n)\n public long query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l) return int.MaxValue;\n if (a <= l && r <= b) return arr[k].Item1;\n else\n {\n long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);\n long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);\n return Math.Max(vl, vr);\n }\n }\n\n\n }\n\n\n class UnionFind\n {\n public int[] path;\n\n\n public UnionFind(int n)\n {\n path = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n path[i] = i;\n }\n\n }\n\n private int root(int i)\n {\n while (i != path[i])\n {\n path[i] = path[path[i]];\n i = path[i];\n }\n return i;\n }\n\n\n\n public bool find(int p, int q)\n {\n return root(p) == root(q);\n }\n\n\n\n public void unite(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n path[i] = j;\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int candyAmount = Convert.ToInt32(Console.ReadLine());\n int sum = candyAmount;\n int counter = 1;\n List list = new List();\n\n while ((double)(sum / 2) > counter)\n {\n sum -= counter;\n list.Add(counter++);\n }\n\n list.Add(sum);\n Console.WriteLine(list.Count);\n Console.WriteLine(string.Join(\" \", list));\n\n Console.ReadLine();\n }\n }\n}\n"}], "src_uid": "356a7bcebbbd354c268cddbb5454d5fc"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problem867B\n{\n class Program\n {\n static void Main(string[] args)\n {\n long p = long.Parse(Console.ReadLine());\n Console.WriteLine(\"{0} 2\\n1 2\", Math.Max((p - 1) * 2, 1));\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n if (a>1)\n {\n int b = (a - 1) * 2;\n Console.WriteLine( b+ \" \" + 2);\n Console.WriteLine(\"{0} {1}\", 1, 2);\n }\n else\n {\n Console.WriteLine(1 + \" \" + 1);\n Console.WriteLine(1);\n }\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Save_the_problem\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int a = Next();\n\n writer.Write(2*a - 1);\n writer.WriteLine(\" 2\");\n writer.WriteLine(\"1 2\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n if (n == 1)\n return \"1 1\\n1\";\n return 2 * (n - 1) + \" 2\\n1 2\";\n }\n\n class Trie\n {\n\n }\n\n class Node {\n public Node()\n {\n Children = new Node[10];\n }\n public Node[] Children { get; set; }\n public int Count { get; set; }\n public char Letter { get; set; }\n\n public string Final { get; set; }\n private int Rev = -1;\n\n public void RecursePlus()\n {\n if (Rev != -1)\n Count++;\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n Children[i].RecursePlus();\n }\n }\n }\n public void Insert(string s, int begin, int rev)\n {\n //Count++;\n if (rev != Rev)\n {\n if (Rev != -1)\n Count++;\n Rev = rev;\n }\n if (begin == s.Length)\n {\n Final = s;\n return;\n }\n if (Children[s[begin] - '0'] == null)\n Children[s[begin] - '0'] = new Node();\n Children[s[begin] - '0'].Insert(s, begin + 1, rev);\n }\n\n public void Recurse(Dictionary dct, List sofar)\n {\n if (Count == 1)\n this.SetAns(dct, new string(sofar.ToArray()));\n else\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n sofar.Add(i.ToString()[0]);\n Children[i].Recurse(dct, sofar);\n sofar.RemoveAt(sofar.Count - 1);\n }\n }\n }\n public void SetAns(Dictionary dct, string ans) {\n if (Final != null)\n {\n if (!dct.ContainsKey(Final) || dct[Final].Length > ans.Length)\n dct[Final] = ans;\n return;\n }\n for (int i = 0; i < 10; i++)\n {\n if (Children[i] != null)\n {\n Children[i].SetAns(dct, ans);\n return;\n }\n }\n }\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeff\ufeffusing System;\n using System.CodeDom;\n using System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var a = sr.NextInt32();\n var s = 2 * a - 1;\n \n sw.WriteLine(s + \" 2\");\n sw.WriteLine(\"1 2\");\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem867B\n{\n class Program\n {\n static void Main(string[] args)\n {\n long p = long.Parse(Console.ReadLine());\n Console.WriteLine(\"{0} 2\\n1 2\", Math.Max((p - 1) * 2, 1));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void program(TextReader input)\n {\n var n = int.Parse(input.ReadLine().TrimEnd());\n\n //var data = input.ReadLine().Split(' ').Select(int.Parse).ToList();\n if (n == 1)\n {\n writer.WriteLine(\"1 1\");\n writer.WriteLine(\"1\");\n writer.Flush();\n return;\n }\n writer.WriteLine((n - 1) * 2 + \" 2\");\n writer.WriteLine(\"1 2\");\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"30 4\\n1 5 10 25\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"18\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"20 2\\n5 2\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"3\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"183 4\\n6 5 2 139\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"314\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if(n == 1)\n {\n Console.WriteLine(\"1 1\");\n Console.WriteLine(\"1\");\n return;\n }\n Console.WriteLine(((n - 1) * 2).ToString() + \" 2\");\n Console.WriteLine(\"1 2\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n Console.WriteLine(2*n-1 + \" 2\\n1 2\");\n }\n \n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n Console.WriteLine(2*n-1 + \" \\n1 2\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem867B\n{\n class Program\n {\n static void Main(string[] args)\n {\n long p = long.Parse(Console.ReadLine());\n Console.WriteLine(\"{0} 2\\n1 2\", (p - 1) * 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(((n - 1) * 2).ToString() + \" 2\");\n Console.WriteLine(\"1 2\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static int Count(int num, int step)\n {\n if (num == 1 && step == 0)\n return 1;\n if (step < num / 5)\n return 0;\n if (num == 5)\n return 1;\n if (num == 10)\n return Count(5, step - 1) + Count(10, step - 2);\n if (num == 25)\n return Count(10, step - 3) + Count(25, step - 5);\n if (num == 50)\n return Count(25, step - 5) + Count(25, step - 10);\n return 0;\n }\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] arr = { 1, 5, 10, 25, 50 };\n int result = 0;\n int id = 0;\n int number = 0;\n int count = 0;\n string money = \"\";\n while(true)\n {\n result += Count(1, id) + Count(5, id) + Count(10, id) + Count(25, id) + Count(50, id);\n\n if (result >= n)\n {\n number = id * 5;\n break;\n }\n id++;\n }\n id = 0;\n while (number > arr[id])\n {\n id++;\n if (id == 5)\n break;\n }\n count = id;\n for (int i = 0; i < count; i++)\n {\n money += arr[i].ToString();\n if (i != count - 1)\n money += ' ';\n }\n Console.WriteLine(number.ToString() + \" \" + count.ToString());\n Console.WriteLine(money);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskB\n{\n class Program\n {\n static long Count(int num, int step)\n {\n if (num == 1 && step == 0)\n return 1;\n if (step < num / 5)\n return 0;\n if (num == 5)\n return 1;\n if (num == 10)\n return Count(5, step - 1) + Count(10, step - 2);\n if (num == 25)\n return Count(10, step - 3) + Count(25, step - 5);\n if (num == 50)\n return Count(25, step - 5) + Count(25, step - 10);\n return 0;\n }\n\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n int[] arr = { 1, 5, 10, 25, 50 };\n long result = 0;\n int id = 0;\n long number = 0;\n int count = 0;\n string money = \"\";\n while(true)\n {\n result += Count(1, id) + Count(5, id) + Count(10, id) + Count(25, id) + Count(50, id);\n\n if (result >= n)\n {\n number = id * 5;\n break;\n }\n id++;\n }\n id = 0;\n while (number > arr[id])\n {\n id++;\n if (id == 5)\n break;\n }\n count = id;\n for (int i = 0; i < count; i++)\n {\n money += arr[i].ToString();\n if (i != count - 1)\n money += ' ';\n }\n Console.WriteLine(number.ToString() + \" \" + count.ToString());\n Console.WriteLine(money);\n }\n }\n}\n"}], "src_uid": "5c000b4c82a8ecef764f53fda8cee541"} {"source_code": "\ufeff#define ONLINE_JUDGE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nclass Program\n{\n\n static int tests = 1;\n\n#if (ONLINE_JUDGE)\n static TextReader r = Console.In;\n static TextWriter w = Console.Out;\n#else\n static string path = @\"C:\\Y\\Prog\\Codeforces\\194\\\";\n static string answerFile = \"0{0}Answer.txt\";\n static string resultFile = \"0{0}Result.txt\";\n static string sourceFile = \"0{0}Source.txt\";\n \n static TextReader r;\n static TextWriter w;\n#endif\n\n static void Main(string[] args)\n {\n for (int i = 1; i <= tests; i++)\n {\n#if (!ONLINE_JUDGE)\n r = new StreamReader(string.Format(path + sourceFile, i));\n w = new StreamWriter(string.Format(path + resultFile, i), false);\n#endif\n int[] x = new int[8];\n int[] y = new int[8];\n for (int j = 0; j < 8; j++)\n {\n string[] buff = r.ReadLine().Split(' ');\n x[j] = Convert.ToInt32(buff[0]);\n y[j] = Convert.ToInt32(buff[1]);\n }\n solve(x,y);\n //w.Flush();\n //w.Dispose();\n#if (!ONLINE_JUDGE)\n w.Flush(); w.Close();\n Console.WriteLine(\"CASE: {0}\", i);\n string answer = File.ReadAllText(string.Format(path + answerFile, i));\n string result = File.ReadAllText(string.Format(path + resultFile, i));\n if (answer != result)\n {\n Console.WriteLine(\"FAIL:\");\n Console.WriteLine(\"Result\" + Environment.NewLine + result);\n Console.WriteLine(\"Answer\" + Environment.NewLine + answer);\n }\n else\n Console.WriteLine(\"OK\");\n#endif\n }\n }\n\n public static void solve(int[] x, int[] y)\n {\n int[] xDiff = getDiff(x);\n int[] yDiff = getDiff(y);\n if (xDiff.Length != 3 || yDiff.Length != 3)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n for (int i = 0; i < xDiff.Length; i++)\n for (int j = 0; j < yDiff.Length; j++) \n {\n if (i == 1 && j == 1) continue;\n bool find = false;\n for (int k = 0; k < x.Length; k ++)\n {\n if (x[k] == xDiff[i] && y[k] == yDiff[j])\n find = true;\n }\n if (!find)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n }\n w.WriteLine(\"respectable\");\n \n }\n\n public static int[] getDiff(int[] x)\n {\n Dictionary res = new Dictionary();\n List res2 = new List();\n foreach(int i in x)\n if (!res.ContainsKey(i))\n {\n res.Add(i,i);\n res2.Add(i);\n }\n int[] res3 = res2.ToArray();\n Array.Sort(res3);\n return res3;\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace EightPointSets\n{\n public class Point\n {\n public int x;\n public int y;\n }\n\n public class PointComparer : IComparer\n {\n public int Compare(Point p1, Point p2)\n {\n if (p1.x < p2.x)\n {\n return -1;\n }\n else if (p1.x == p2.x)\n {\n if (p1.y < p2.y)\n return -1;\n else\n return 1;\n }\n\n return 1;\n }\n }\n\n class EightPointSets\n {\n static void Main(string[] args)\n {\n string[] input;\n List point = new List();\n\n for (int i = 0; i < 8; i++)\n {\n input = Console.ReadLine().Split();\n point.Add(new Point() { x = int.Parse(input[0]), y = int.Parse(input[1]) });\n }\n\n point.Sort(new PointComparer());\n\n bool respectable = point[0].x == point[1].x && point[1].x == point[2].x &&\n point[3].x == point[4].x &&\n point[5].x == point[6].x && point[6].x == point[7].x &&\n point[0].y == point[3].y && point[3].y == point[5].y &&\n point[1].y == point[6].y &&\n point[2].y == point[4].y && point[4].y == point[7].y &&\n point[0].x < point[3].x && point[3].x < point[5].x &&\n point[0].y < point[1].y && point[1].y < point[2].y;\n\n if (!respectable)\n Console.WriteLine(\"ugly\");\n else\n Console.WriteLine(\"respectable\");\n }\n\n\n private static bool Equals(Point p1, Point p2)\n {\n if (p1.x != p2.x || p1.y != p2.y)\n return false;\n else\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\nusing System.Collections;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main( string[] args ) {\n List points = new List();\n for ( int i = 0; i < 8; i++ ) {\n points.Add(new int[] { ReadInt(), ReadInt() });\n }\n\n points.Sort(( p1, p2 ) => {\n if ( p1[ 1 ] != p2[ 1 ] )\n return p1[ 1 ] < p2[ 1 ] ? -1 : 1;\n else return p1[ 0 ] < p2[ 0 ] ? -1 : 1;\n });\n\n bool f = points[ 0 ][ 0 ] < points[ 1 ][ 0 ] && points[ 0 ][ 1 ] == points[ 1 ][ 1 ] && \n points[ 1 ][ 0 ] < points[ 2 ][ 0 ] && points[ 1 ][ 1 ] == points[ 2 ][ 1 ] &&\n points[ 3 ][ 0 ] == points[ 0 ][ 0 ] && points[ 3 ][ 1 ] > points[ 0 ][ 1 ] &&\n points[ 4 ][ 0 ] == points[ 2 ][ 0 ] && points[ 4 ][ 1 ] == points[ 3 ][ 1 ] &&\n points[ 5 ][ 0 ] == points[ 3 ][ 0 ] && points[ 5 ][ 1 ] > points[ 3 ][ 1 ] && \n points[ 6 ][ 0 ] == points[ 1 ][ 0 ] && points[ 6 ][ 1 ] == points[ 5 ][ 1 ] &&\n points[ 7 ][ 0 ] == points[ 2 ][ 0 ] && points[ 7 ][ 1 ] == points[ 6 ][ 1 ];\n if ( f )\n Console.WriteLine(\"respectable\");\n else\n Console.WriteLine(\"ugly\");\n }\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt() {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split(new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n _current = 0;\n }\n\n int value = int.Parse(_words[ _current ]);\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var b = Solve();\n Console.WriteLine(b ? \"respectable\" : \"ugly\");\n }\n\n public static bool Solve()\n {\n var points = new List();\n for (int i = 0; i < 8; i++)\n {\n var line = Console.ReadLine().Split(' ');\n points.Add(new Point(int.Parse(line[0]), int.Parse(line[1])));\n }\n\n int maxX = points.Select(p => p.x).Max();\n int minX = points.Select(p => p.x).Min();\n int maxY = points.Select(p => p.y).Max();\n int minY = points.Select(p => p.y).Min();\n\n int midX, midY;\n try\n {\n midX = points.Select(p => p.x).Where(x => x < maxX && x > minX).First();\n midY = points.Select(p => p.y).Where(y => y < maxY && y > minY).First();\n }\n catch { return false; }\n\n if (points.Contains(new Point(minX, minY)) &&\n points.Contains(new Point(midX, minY)) &&\n points.Contains(new Point(maxX, minY)) &&\n points.Contains(new Point(minX, midY)) &&\n points.Contains(new Point(maxX, midY)) &&\n points.Contains(new Point(minX, maxY)) &&\n points.Contains(new Point(midX, maxY)) &&\n points.Contains(new Point(maxX, maxY)))\n return true;\n else\n return false;\n }\n struct Point\n {\n public int x;\n public int y;\n\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override bool Equals(object obj)\n {\n var p = (Point)obj;\n return p.x == x && p.y == y;\n }\n\n public override int GetHashCode()\n {\n return x.GetHashCode() ^ y.GetHashCode();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Demo\n{\n static void Main()\n {\n List a = Enumerable.Range(0, 8)\n .Select(x => Console.ReadLine()\n .Split()\n .Select(int.Parse)\n .ToArray())\n .ToList();\n if (a.Select(x => x[0]).Distinct().Count() != 3\n | a.Select(x => x[1]).Distinct().Count() != 3)\n { Console.WriteLine(\"ugly\"); return; }\n\n int minX= a.Select(x=>x[0]).Min();\n int minY= a.Select(x=>x[1]).Min();\n int maxX= a.Select(x=>x[0]).Max();\n int maxY= a.Select(x=>x[1]).Max();\n\n int[] x1 = a.Where(x => x[0] == minX).Select(x => x[1]).ToArray();\n int[] x2 = a.Where(x => x[0] == maxX).Select(x => x[1]).ToArray();\n Array.Sort(x1); \n Array.Sort(x2);\n if (!x1.SequenceEqual(x2)) { Console.WriteLine(\"ugly\"); return; }\n\n int[] y1 = a.Where(x => x[1] == minY).Select(x => x[0]).ToArray();\n int[] y2 = a.Where(x => x[1] == maxY).Select(x => x[0]).ToArray();\n Array.Sort(y1); \n Array.Sort(y2);\n if (!y1.SequenceEqual(y2)) { Console.WriteLine(\"ugly\"); return; }\n\n Console.WriteLine(\"respectable\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Eight_Point_Sets\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"respectable\" : \"ugly\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n var x = new int[8];\n var y = new int[8];\n\n for (int i = 0; i < 8; i++)\n {\n x[i] = Next();\n y[i] = Next();\n }\n\n int t = Enumerable.Range(0, 8).Select(i => new {X = x[i], Y = y[i]}).GroupBy(e => new {e.X, e.Y}).Select(g => g.Key).Count();\n if (t != 8)\n return false;\n\n var xx = x.GroupBy(e => e).Select(g => new {X = g.Key, Count = g.Count()}).OrderBy(r => r.X).ToList();\n\n if (xx.Count != 3 || xx[0].Count != 3 || xx[1].Count != 2)\n return false;\n\n var yy = y.GroupBy(e => e).Select(g => new {Y = g.Key, Count = g.Count()}).ToList().OrderBy(r => r.Y).ToList();\n if (yy.Count != 3 || yy[0].Count != 3 || yy[1].Count != 2)\n return false;\n\n return true;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#define ONLINE_JUDGE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n\n static int tests = 1;\n\n#if (ONLINE_JUDGE)\n static TextReader r = Console.In;\n static TextWriter w = Console.Out;\n#else\n static string path = @\"C:\\Y\\Prog\\Codeforces\\194\\\";\n static string answerFile = \"0{0}Answer.txt\";\n static string resultFile = \"0{0}Result.txt\";\n static string sourceFile = \"0{0}Source.txt\";\n \n static TextReader r;\n static TextWriter w;\n#endif\n\n static void Main(string[] args)\n {\n\n //int[] t = { 3, 2, 3, 3, 100, 1, 500 };\n //int[] xDistinct = t.Distinct().OrderBy( a => a ).ToArray();\n \n \n\n for (int i = 1; i <= tests; i++)\n {\n#if (!ONLINE_JUDGE)\n r = new StreamReader(string.Format(path + sourceFile, i));\n w = new StreamWriter(string.Format(path + resultFile, i), false);\n#endif\n int[] x = new int[8];\n int[] y = new int[8];\n for (int j = 0; j < 8; j++)\n {\n string[] buff = r.ReadLine().Split(' ');\n x[j] = Convert.ToInt32(buff[0]);\n y[j] = Convert.ToInt32(buff[1]);\n }\n solve(x, y);\n\n#if (!ONLINE_JUDGE)\n w.Flush(); w.Close();\n Console.WriteLine(\"CASE: {0}\", i);\n string answer = File.ReadAllText(string.Format(path + answerFile, i));\n string result = File.ReadAllText(string.Format(path + resultFile, i));\n if (answer != result)\n {\n Console.WriteLine(\"FAIL:\");\n Console.WriteLine(\"Result\" + Environment.NewLine + result);\n Console.WriteLine(\"Answer\" + Environment.NewLine + answer);\n }\n else\n Console.WriteLine(\"OK\");\n#endif\n }\n }\n\n public static void solve(int[] x, int[] y)\n {\n int[] xDistinct = x.Distinct().OrderBy( a => a ).ToArray();\n int[] yDistinct = y.Distinct().OrderBy( a => a ).ToArray();\n \n if (xDistinct.Length != 3 || yDistinct.Length != 3)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n for (int i = 0; i < xDistinct.Length; i++)\n for (int j = 0; j < yDistinct.Length; j++)\n {\n if (i == 1 && j == 1) continue;\n bool find = false;\n for (int k = 0; k < x.Length; k++)\n {\n if (x[k] == xDistinct[i] && y[k] == yDistinct[j])\n find = true;\n }\n if (!find)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n }\n w.WriteLine(\"respectable\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R194_Div2_B\n {\n static void Main(string[] args)\n {\n int n = 8;\n\n List a = new List();\n List b = new List();\n\n int[] x = new int[n];\n int[] y = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split();\n x[i] = int.Parse(s[0]);\n y[i] = int.Parse(s[1]);\n if (!a.Contains(x[i])) a.Add(x[i]);\n if (!b.Contains(y[i])) b.Add(y[i]);\n }\n\n if (a.Count == 3 && b.Count == 3)\n {\n a.Sort(); b.Sort();\n bool ugly;\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (i == 1 && j == 1)\n {\n ugly = false;\n for (int k = 0; k < n; k++)\n if (x[k] == a[i] && y[k] == b[j])\n {\n ugly = true;\n break;\n }\n if (ugly)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n else\n {\n ugly = true;\n for (int k = 0; k < n; k++)\n if (x[k] == a[i] && y[k] == b[j])\n {\n ugly = false;\n break;\n }\n if (ugly)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n }\n }\n Console.WriteLine(\"respectable\");\n }\n else\n {\n Console.WriteLine(\"ugly\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n public class MyPoint : IComparable\n {\n public int x, y;\n\n public MyPoint(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public int CompareTo(MyPoint other)\n {\n if (other.x != this.x)\n return this.x - other.x;\n return this.y - other.y;\n }\n }\n\n public static void Main()\n {\n MyPoint[] ps = new MyPoint[8];\n string[] line;\n\n for (int i = 0; i < 8; i++)\n {\n line = Console.ReadLine().Split(' ');\n ps[i] = new MyPoint(int.Parse(line[0]), int.Parse(line[1]));\n }\n\n Array.Sort(ps);\n\n if (ps[0].x == ps[1].x && ps[0].x == ps[2].x && ps[3].x == ps[4].x && ps[5].x == ps[6].x && ps[5].x == ps[7].x &&\n ps[0].x != ps[3].x && ps[3].x != ps[5].x && ps[0].x != ps[5].x && ps[0].y == ps[3].y && ps[0].y == ps[5].y &&\n ps[1].y == ps[6].y && ps[2].y == ps[4].y && ps[2].y == ps[7].y && ps[0].y != ps[1].y && ps[1].y != ps[2].y &&\n ps[0].y != ps[2].y)\n Console.WriteLine(\"respectable\");\n else\n Console.WriteLine(\"ugly\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace prB {\n internal class Program {\n static void Main(string[] args) {\n#if ONLINE_JUDGE\n#else\n\n StreamWriter sw = new StreamWriter(\"output\");\n Console.SetOut(sw);\n Console.SetIn(new StreamReader(\"input\"));\n#endif\n\n List x = new List();\n List y = new List();\n int[] xs = new int[8];\n int[] ys = new int[8];\n for(int i = 0; i < 8; i++) {\n string[] ss = Console.ReadLine().Split(' ');\n xs[i] = int.Parse(ss[0]);\n ys[i] = int.Parse(ss[1]);\n int index = x.BinarySearch(xs[i]);\n if(index < 0) {\n index = ~index;\n x.Insert(index, xs[i]);\n }\n index = y.BinarySearch(ys[i]);\n if(index < 0) {\n index = ~index;\n y.Insert(index, ys[i]);\n }\n }\n bool good = !(x.Count != 3 || y.Count != 3);\n if(good) {\n int[] hx = new int[3];\n int[] hy = new int[3];\n for(int i = 0; i < 8; i++) {\n hx[x.BinarySearch(xs[i])]++;\n hy[y.BinarySearch(ys[i])]++;\n }\n if(hx[0] != 3 || hx[1] != 2 || hx[2] != 3 || hy[0] != 3 || hy[1] != 2 || hy[2] != 3) {\n good = false;\n }\n if(good) {\n int cury = y[0];\n for(int i = 0; i < 8; i++) {\n if(ys[i] == cury) {\n hx[x.BinarySearch(xs[i])]--;\n }\n }\n if(hx[0] != 2 || hx[1] != 1 || hx[2] != 2) {\n good = false;\n }\n else {\n cury = y[1];\n for(int i = 0; i < 8; i++) {\n if(ys[i] == cury) {\n hx[x.BinarySearch(xs[i])]--;\n }\n }\n if(hx[0] != 1 || hx[1] != 1 || hx[2] != 1) {\n good = false;\n }\n else {\n cury = y[2];\n for(int i = 0; i < 8; i++) {\n if(ys[i] == cury) {\n hx[x.BinarySearch(xs[i])]--;\n }\n }\n if(hx[0] != 0 || hx[1] != 0 || hx[2] != 0) {\n good = false;\n }\n else {\n int curx = x[2];\n for(int i = 0; i < 8; i++) {\n if(xs[i] == curx) {\n hy[y.BinarySearch(ys[i])]--;\n }\n }\n if(hy[0] != 2 || hy[1] != 1 || hy[2] != 2) {\n good = false;\n }\n else {\n curx = x[1];\n for(int i = 0; i < 8; i++) {\n if(xs[i] == curx) {\n hy[y.BinarySearch(ys[i])]--;\n }\n }\n if(hy[0] != 1 || hy[1] != 1 || hy[2] != 1) {\n good = false;\n }\n else {\n curx = x[2];\n for(int i = 0; i < 8; i++) {\n if(xs[i] == curx) {\n hy[y.BinarySearch(ys[i])]--;\n }\n }\n if(hy[0] != 0 || hy[1] != 0 || hy[2] != 0) {\n good = false;\n }\n else {\n for(int i = 0; i < 8; i++) {\n if(xs[i] == x[1] && ys[i] == y[1])\n good = false;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n Console.WriteLine(good ? \"respectable\" : \"ugly\");\n\n#if ONLINE_JUDGE\n#else\n sw.Close();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _334B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] Array = new int[10, 2];\n Array[8, 0] = int.MaxValue;\n Array[8, 1] = int.MaxValue;\n Array[9, 0] = -1;\n Array[9, 1] = -1;\n string[] Input;\n for (int i = 0; i < 8; i++)\n {\n Input = Console.ReadLine().Split();\n Array[i, 0] = Convert.ToInt32(Input[0]);\n Array[i, 1] = Convert.ToInt32(Input[1]);\n }\n\n for (int i = 0; i < 8; i++)\n {\n for (int j = 0; j < 8; j++)\n {\n if (i != j)\n {\n if (Array[i, 0] == Array[j, 0] && Array[j, 1] == Array[i, 1])\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n }\n }\n\n int One = 0;\n int Two = 0;\n\n for (int i = 0; i < 8; i++)\n {\n int LocalX = 0;\n int LocalY = 0;\n for (int j = 0; j < 8; j++)\n {\n if (Array[i, 0] == Array[j, 0]) LocalX++;\n\n if (Array[i, 1] == Array[j, 1]) LocalY++;\n }\n\n if (LocalX == 2) One++;\n else if (LocalX == 3) Two++;\n\n if (LocalY == 2) One++;\n else if (LocalY == 3) Two++;\n }\n\n if (One == 4 && Two == 12)\n {\n List LeftList = new List() { 8 };\n List DownList = new List() { 8 };\n List RightList = new List() { 9 };\n List UpList = new List() { 9 };\n\n for (int i = 0; i < 8; i++)\n {\n if (Array[i, 0] < Array[LeftList[0], 0]) LeftList = new List() { i };\n else if (Array[i, 0] == Array[LeftList[0], 0]) LeftList.Add(i);\n\n if (Array[i, 1] < Array[DownList[0], 1]) DownList = new List() { i };\n else if (Array[i, 1] == Array[DownList[0], 1]) DownList.Add(i);\n\n if (Array[i, 0] > Array[RightList[0], 0]) RightList = new List() { i };\n else if (Array[i, 0] == Array[RightList[0], 0]) RightList.Add(i);\n\n if (Array[i, 1] > Array[UpList[0], 1]) UpList = new List() { i };\n else if (Array[i, 1] == Array[UpList[0], 1]) UpList.Add(i);\n }\n\n if (LeftList.Count == 3 && DownList.Count == 3 && RightList.Count == 3 && UpList.Count == 3) Console.WriteLine(\"respectable\");\n else Console.WriteLine(\"ugly\");\n }\n else Console.WriteLine(\"ugly\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Scanner\n{\n private char[] delimiters = new char[] { ' ' };\n private string[] s;\n private int idx;\n\n public Scanner()\n {\n s = new string[0];\n idx = 0;\n }\n\n public string Next()\n {\n if (idx < s.Length)\n return s[idx++];\n idx = 0;\n s = Console.ReadLine().Split(delimiters, StringSplitOptions.RemoveEmptyEntries);\n return s[idx++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n}\n\nclass Solution\n{\n Scanner cin;\n int n, m, a, b;\n\n public void Go()\n {\n cin = new Scanner();\n int[] x = new int[8];\n int[] y = new int[8];\n int[] sx = new int[8];\n int[] sy = new int[8];\n for (int i = 0; i < 8; i++) {\n sx[i] = x[i] = cin.NextInt();\n sy[i] = y[i] = cin.NextInt();\n }\n\n Array.Sort(sx);\n Array.Sort(sy);\n int[] xx = sx.Distinct().ToArray();\n int[] yy = sy.Distinct().ToArray();\n bool okay = false;\n if (xx.Length == 3 && yy.Length == 3) {\n okay = true;\n for (int a = 0; a < 3; a++)\n for (int b = 0; b < 3; b++)\n if (a != 1 || b != 1) {\n bool ok = false;\n for (int i = 0; i < 8; i++)\n if (x[i] == xx[a] && y[i] == yy[b])\n ok = true;\n okay &= ok;\n }\n }\n\n if (okay)\n Console.WriteLine(\"respectable\");\n else\n Console.WriteLine(\"ugly\");\n }\n\n static void Main(string[] args)\n {\n new Solution().Go();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n int xMin = -1, yMin = -1, xMax = -1, yMax = -1;\n\n var list = new List();\n\n var yd = new Dictionary>();\n var xd = new Dictionary>();\n\n for (int i = 0; i < 8; i++)\n {\n string str = Console.ReadLine();\n\n int x = int.Parse(str.Split(new char[] { ' ' })[0]);\n int y = int.Parse(str.Split(new char[] { ' ' })[1]);\n\n if (xMin == -1 || xMin > x) xMin = x;\n if (xMax == -1 || xMax < x) xMax = x;\n if (yMin == -1 || yMin > y) yMin = y;\n if (yMax == -1 || yMax < y) yMax = y;\n\n if (!xd.ContainsKey(x)) xd.Add(x, new List());\n if (!yd.ContainsKey(y)) yd.Add(y, new List());\n\n xd[x].Add(new int[] { x, y });\n yd[y].Add(new int[] { x, y });\n \n if (list.Contains(str))\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n list.Add(str);\n }\n\n // 0 0, 1 0\n // 0 1, \n // 0 2, 1 2, 2 2\n\n if (xd.Count != 3 || yd.Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n if (!xd.ContainsKey(xMin) || !xd.ContainsKey(xMax) || xd[xMin].Count != 3 || xd[xMax].Count != 3 ||\n !yd.ContainsKey(yMin) || !yd.ContainsKey(yMax) || yd[yMin].Count != 3 || yd[yMax].Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n Console.WriteLine(\"respectable\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _334B\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint[] x = new int[8];\n\t\t\tint[] y = new int[8];\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tint[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\t\tx[i] = ip[0];\n\t\t\t\ty[i] = ip[1];\n\t\t\t}\n\t\t\tint[] xx = x.Distinct().ToArray();\n\t\t\tint[] yy = y.Distinct().ToArray();\n\t\t\tbool b = false;\n\t\t\tif (xx.Length == 3 && yy.Length == 3)\n\t\t\t{\n\t\t\t\tArray.Sort(xx);\n\t\t\t\tArray.Sort(yy);\n\t\t\t\tb = true;\n\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (i != 1 || j != 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbool c = false;\n\t\t\t\t\t\t\tfor (int k = 0; k < 8; k++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (x[k] == xx[i] && y[k] == yy[j])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tc = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb &= c;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (b == false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (b == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"respectable\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"ugly\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n int[,] points = new int[8, 2];\n for (int i = 0; i < 8; i++)\n {\n ReadArray(' ');\n points[i, 0] = NextInt();\n points[i, 1] = NextInt();\n }\n int[] x = new int[1000001];\n for (int i = 0; i < 8; i++)\n x[points[i, 0]]++;\n int[] next = { 3, 2, 3 };\n for (int i = 0, z = 0; i <= 1000000; i++)\n {\n if (x[i] == 0) continue;\n if (x[i] == next[z])\n {\n z++;\n }\n else\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n int[] y = new int[1000001];\n for (int i = 0, k = 0; i <= 1000000 && k < 3; i++)\n {\n if (x[i] == next[k])\n {\n for (int j = 0; j <= 1000000; j++)\n {\n for (int z = 0; z < 8; z++)\n {\n if (points[z, 1] == j && points[z, 0] == i)\n {\n y[j]++;\n break;\n }\n }\n }\n k++;\n }\n }\n for (int i = 0, k = 0; i <= 1000000 && k < 3; i++)\n {\n if (y[i] == 0) continue;\n if (y[i] == next[k])\n {\n k++;\n }\n else\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n List t = new List();\n for (int i = 0, z = 0; i <= 1000000; i++)\n {\n if (y[i] == 3 && z == 0)\n {\n for (int p = 0; p <= 1000000; p++)\n {\n for (int j = 0; j < 8; j++)\n if (points[j, 1] == i && points[j, 0] == p)\n t.Add(points[j, 0]);\n }\n z++;\n }\n if (y[i] == 2)\n {\n for (int p = 0; p <= 1000000; p++)\n {\n for (int j = 0; j < 8; j++)\n if (points[j, 1] == i && points[j, 0] == p)\n t.Add(points[j, 0]);\n }\n if (t[3] != t[0] || t[4] != t[2])\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n z++;\n }\n if (y[i] == 3 && z == 2)\n {\n for (int p = 0; p <= 1000000; p++)\n {\n for (int j = 0; j < 8; j++)\n if (points[j, 1] == i && points[j, 0] == p)\n t.Add(points[j, 0]);\n }\n for (int j = 0; j < 3; j++)\n {\n if (t[j] != t[5 + j])\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n\n }\n }\n Console.WriteLine(\"respectable\");\n\n }\n\n static void C()\n {\n long n = ReadLong();\n long ans = 0;\n if (n == 1)\n ans = 1;\n if (n == 2)\n ans = 1;\n if (n == 3)\n ans = 1;\n if (n > 3)\n ans = n - 2;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace c194p2\n{\n class Program\n {\n class Vector\n {\n public int x, y;\n public Vector(string[] strs)\n {\n x = Convert.ToInt32(strs[0]);\n y = Convert.ToInt32(strs[1]);\n }\n }\n static void Main(string[] args)\n {\n new Program();\n }\n Program()\n {\n const string ugly = \"ugly\", respectable = \"respectable\";\n const int N = 8;\n Vector[] ps = new Vector[N];\n SortedSet sX = new SortedSet();\n SortedSet sY = new SortedSet();\n for (int i = 0; i < N; i++)\n {\n ps[i] = new Vector(Console.ReadLine().Split(new char[] { ' ' }));\n sX.Add(ps[i].x);\n sY.Add(ps[i].y);\n }\n if (sX.Count != 3 || sY.Count != 3)\n {\n Console.WriteLine(ugly);\n return;\n }\n List lX = sX.ToList();\n List lY = sY.ToList();\n for (int i = 0; i < sX.Count; i++)\n {\n for (int j = 0; j < sY.Count; j++)\n {\n if (i == 1 && j == 1)\n continue;\n bool isUgly = true;\n for (int k = 0; k < N; k++)\n {\n if (ps[k].x == lX[i] && ps[k].y == lY[j])\n isUgly = false;\n }\n if (isUgly)\n {\n Console.WriteLine(ugly);\n return;\n }\n }\n }\n Console.WriteLine(respectable);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _334B_Eight_Points_Set\n{\n class Point : IComparable\n {\n public int X;\n public int Y;\n\n public int CompareTo(Point other)\n {\n if (X < other.X) return -1;\n if (X == other.X)\n {\n if (Y < other.Y) return -1;\n if (Y == other.Y) return 0;\n return 1;\n }\n return 1;\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Point[] points = new Point[8];\n for (int i = 0; i < 8; i++)\n {\n var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n points[i] = new Point() {X = input[0], Y = input[1]};\n }\n\n\n Array.Sort(points);\n\n\n if (points[0].X == points[1].X && points[1].X == points[2].X &&\n points[3].X == points[4].X &&\n points[5].X == points[6].X && points[6].X == points[7].X &&\n\n points[0].Y == points[3].Y && points[3].Y == points[5].Y &&\n points[1].Y == points[6].Y &&\n points[2].Y == points[4].Y && points[4].Y == points[7].Y &&\n \n points[0].X != points[3].X && points[3].X != points[5].X &&\n points[0].Y != points[1].Y && points[1].Y != points[2].Y)\n {\n Console.WriteLine(\"respectable\");\n }\n else\n {\n Console.WriteLine(\"ugly\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X) * (p.X - X) + (p.Y - Y) * (p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get { return m_Matrix.GetLength(0); }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get { return m_Matrix[i, j]; }\n\n set { m_Matrix[i, j] = value; }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n\n public static int[] Next(int[] p)\n {\n int n = p.Length;\n var next = new int[n];\n Array.Copy(p, next, n);\n\n int k = -1;\n for (int i = n - 1; i > 0; i--)\n {\n if (next[i - 1] < next[i])\n {\n k = i - 1;\n break;\n }\n }\n if (k == -1)\n {\n return null;\n }\n for (int i = n - 1; i >= 0; i--)\n {\n if (next[i] > next[k])\n {\n var tmp = next[i];\n next[i] = next[k];\n next[k] = tmp;\n break;\n }\n }\n for (int i = 1; i <= (n - k - 1) / 2; i++)\n {\n var tmp = next[k + i];\n next[k + i] = next[n - i];\n next[n - i] = tmp;\n }\n\n return next;\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n public static class OrderStatistic\n {\n public static T GetKthElement(this IList list, int k) where T : IComparable\n {\n return Select(list, 0, list.Count - 1, k);\n }\n\n private static T Select(IList list, int l, int r, int k) where T : IComparable\n {\n if (l == r)\n return list[l];\n\n T x = list[(l + r) / 2];\n var i = l;\n var j = r;\n do\n {\n while (list[i].CompareTo(x) < 0)\n i++;\n while (list[j].CompareTo(x) > 0)\n j--;\n if (i <= j)\n {\n T tmp = list[i];\n list[i] = list[j];\n list[j] = tmp;\n\n i++;\n j--;\n }\n }\n while (i <= j);\n\n if (j < l)\n j++;\n if (k <= j - l + 1)\n return Select(list, l, j, k);\n return Select(list, j + 1, r, k - (j - l + 1));\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get { return this.m_Edges[i]; }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n }\n\n public static class GraphAlgorithms\n {\n private static bool[] v;\n\n private static int[] a;\n\n private static int c;\n\n public static int[] Bfs(this IGraph graph, int start)\n {\n int[] d = new int[graph.Vertices];\n for (int i = 0; i < graph.Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in graph[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n\n public static int[] TopSort(this IGraph graph)\n {\n v = new bool[graph.Vertices];\n a = new int[graph.Vertices];\n c = graph.Vertices;\n\n for (int i = 0; i < graph.Vertices; i++)\n {\n if (!v[i])\n {\n TopSortDfs(graph, i);\n }\n }\n\n return a;\n }\n\n private static void TopSortDfs(IGraph graph, int t)\n {\n v[t] = true;\n foreach (var next in graph[t])\n {\n if (!v[next])\n {\n TopSortDfs(graph, next);\n }\n }\n c--;\n a[c] = t;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n private bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First)\n && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397)\n ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get { return this.ContainsKey(key) ? base[key] : 0; }\n set { this.Add(key, value); }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack\n where T : class\n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n\n public static void Swap(ref T x, ref T y)\n {\n T tmp = x;\n x = y;\n y = tmp;\n }\n }\n\n public static class FFTMultiply\n {\n public static int[] Multiply(int[] a, int[] b)\n {\n var result = Multiply(\n a.Select(x => new Complex(x, 0)).ToArray(), b.Select(x => new Complex(x, 0)).ToArray());\n return result.Select(x => (int)Math.Round(x.Real)).ToArray();\n }\n\n public static Complex[] Multiply(Complex[] a, Complex[] b)\n {\n var n = 1;\n while (n < Math.Max(a.Length, b.Length))\n {\n n <<= 1;\n }\n n <<= 1;\n\n var fa = new Complex[n];\n Array.Copy(a, fa, a.Length);\n var fb = new Complex[n];\n Array.Copy(b, fb, b.Length);\n\n FFT(fa, false);\n FFT(fb, false);\n\n for (int i = 0; i < n; i++)\n {\n fa[i] *= fb[i];\n }\n\n FFT(fa, true);\n for (int i = 0; i < n; i++)\n {\n fa[i] /= n;\n }\n return fa;\n }\n\n private static void FFT(IList a, bool invert)\n {\n var n = a.Count;\n if (n == 1)\n {\n return;\n }\n\n var a0 = new Complex[n / 2];\n var a1 = new Complex[n / 2];\n for (int i = 0; i < n / 2; i++)\n {\n a0[i] = a[2 * i];\n a1[i] = a[2 * i + 1];\n }\n FFT(a0, invert);\n FFT(a1, invert);\n\n Complex w = 1;\n var ang = 2 * Math.PI / n * (invert ? -1 : 1);\n Complex wn = new Complex(Math.Cos(ang), Math.Sin(ang));\n\n for (int i = 0; i < n / 2; i++)\n {\n a[i] = a0[i] + w * a1[i];\n a[i + n / 2] = a0[i] - w * a1[i];\n w *= wn;\n }\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n // OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n var max = 1000001;\n int[] a = new int[max];\n int[] b = new int[max];\n int[] xx = new int[8];\n int[] yy = new int[8];\n var ok = true;\n for (int i = 0; i < 8; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n xx[i] = x;\n yy[i] = y;\n for (int k = 0; k < i; k++)\n {\n ok &= xx[k] != x || yy[k] != y;\n }\n a[x]++;\n b[y]++;\n }\n\n\n int[] c = new[] { 3, 2, 3 };\n\n int j = 0;\n for (int i = 0; i < max; i++)\n {\n if (a[i] > 0)\n {\n ok &= a[i] == c[j];\n j++;\n if (j > 2)\n {\n break;\n }\n }\n }\n\n j = 0;\n for (int i = 0; i < max; i++)\n {\n if (b[i] > 0)\n {\n ok &= b[i] == c[j];\n j++;\n if (j > 2)\n {\n break;\n }\n }\n }\n\n Console.WriteLine(ok ? \"respectable\" : \"ugly\");\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace EightPointSets\n{\n public struct Point\n {\n public int x;\n public int y;\n }\n\n class EightPointSets\n {\n static void Main(string[] args)\n {\n string[] input;\n Point[] points = new Point[8];\n\n for (int i = 0; i < 8; i++)\n {\n input = Console.ReadLine().Split();\n points[i].x = int.Parse(input[0]);\n points[i].y = int.Parse(input[1]);\n }\n\n Point centre;\n bool respectable = false;\n\n while (true)\n {\n if (points[0].x >= points[3].x || points[3].x >= points[5].x)\n break;\n\n if (points[2].x >= points[4].x || points[4].x >= points[7].x)\n break;\n\n if (points[0].y >= points[1].y || points[1].y >= points[2].y)\n break;\n\n if (points[5].y >= points[6].y || points[6].y >= points[7].y)\n break;\n\n centre = GetCentrePoint(points[0], points[2]);\n\n if (!Equals(centre, points[1]))\n break;\n\n centre = GetCentrePoint(points[0], points[5]);\n\n if (!Equals(centre, points[3]))\n break;\n\n centre = GetCentrePoint(points[2], points[7]);\n\n if (!Equals(centre, points[4]))\n break;\n\n centre = GetCentrePoint(points[5], points[7]);\n\n if (!Equals(centre, points[6]))\n break;\n\n Point mainCentre1 = GetCentrePoint(points[1], points[6]);\n Point mainCentre2 = GetCentrePoint(points[3], points[4]);\n\n if (!Equals(mainCentre1, mainCentre2))\n break;\n\n if (points[1].x >= mainCentre1.x || mainCentre1.x >= points[6].x)\n break;\n\n if (points[3].y >= mainCentre1.y || mainCentre1.y >= points[4].y)\n break;\n\n respectable = true;\n break;\n }\n\n if (!respectable)\n Console.WriteLine(\"ugly\");\n else\n Console.WriteLine(\"respectable\");\n }\n\n private static Point GetCentrePoint(Point p1, Point p2)\n {\n Point centre = new Point();\n\n centre.x = ((p1.x) + (p2.x)) / 2;\n centre.y = ((p1.y) + (p2.y)) / 2;\n\n return centre;\n }\n\n private static bool Equals(Point p1, Point p2)\n {\n if (p1.x != p2.x || p1.y != p2.y)\n return false;\n else\n return true;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace EightPointSets\n{\n public struct Point\n {\n public int x;\n public int y;\n }\n\n class EightPointSets\n {\n static void Main(string[] args)\n {\n string[] input;\n Point[] points = new Point[8];\n\n for (int i = 0; i < 8; i++)\n {\n input = Console.ReadLine().Split();\n points[i].x = int.Parse(input[0]);\n points[i].y = int.Parse(input[1]);\n }\n\n Point centre;\n bool respectable = false;\n\n while (true)\n {\n centre = GetCentrePoint(points[0], points[2]);\n\n if (!Equals(centre, points[1]))\n break;\n\n centre = GetCentrePoint(points[0], points[5]);\n\n if (!Equals(centre, points[3]))\n break;\n\n centre = GetCentrePoint(points[2], points[7]);\n\n if (!Equals(centre, points[4]))\n break;\n\n centre = GetCentrePoint(points[5], points[7]);\n\n if (!Equals(centre, points[6]))\n break;\n\n Point mainCentre1 = GetCentrePoint(points[1], points[6]);\n Point mainCentre2 = GetCentrePoint(points[3], points[4]);\n\n if (!Equals(mainCentre1, mainCentre2))\n break;\n\n respectable = true;\n break;\n }\n\n if (!respectable)\n Console.WriteLine(\"ugly\");\n else\n Console.WriteLine(\"respectable\");\n }\n\n private static Point GetCentrePoint(Point p1, Point p2)\n {\n Point centre = new Point();\n\n centre.x = ((p1.x) + (p2.x)) / 2;\n centre.y = ((p1.y) + (p2.y)) / 2;\n\n return centre;\n }\n\n private static bool Equals(Point p1, Point p2)\n {\n if (p1.x != p2.x || p1.y != p2.y)\n return false;\n else\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Web;\nusing System.Net;\nusing System.Collections;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main( string[] args ) {\n List points = new List();\n for ( int i = 0; i < 8; i++ ) {\n points.Add(new int[] { ReadInt(), ReadInt() });\n }\n\n points = points.OrderBy(( point ) => {\n return point[ 1 ].ToString() + point[ 0 ].ToString();\n }).ToList();\n\n bool f = points[ 0 ][ 0 ] < points[ 1 ][ 0 ] && points[ 0 ][ 1 ] == points[ 1 ][ 1 ];\n f = f && \n points[ 1 ][ 0 ] < points[ 2 ][ 0 ] && points[ 0 ][ 1 ] == points[ 2 ][ 1 ];\n f = f &&\n points[ 3 ][ 0 ] == points[ 0 ][ 0 ] && points[ 3 ][ 1 ] > points[ 0 ][ 1 ];\n f = f &&\n points[ 4 ][ 0 ] == points[ 2 ][ 0 ] && points[ 4 ][ 1 ] == points[ 3 ][ 1 ] &&\n points[ 5 ][ 0 ] == points[ 3 ][ 0 ] && points[ 5 ][ 1 ] > points[ 3 ][ 1 ] && \n points[ 6 ][ 0 ] == points[ 1 ][ 0 ] && points[ 6 ][ 1 ] == points[ 5 ][ 1 ] &&\n points[ 7 ][ 0 ] == points[ 2 ][ 0 ] && points[ 7 ][ 1 ] == points[ 6 ][ 1 ];\n if ( f )\n Console.WriteLine(\"respectable\");\n else\n Console.WriteLine(\"ugly\");\n }\n\n\n static int _current = -1;\n static string[] _words = null;\n static int ReadInt() {\n if ( _current == -1 ) {\n _words = Console.ReadLine().Split(new char[] { ' ', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n _current = 0;\n }\n\n int value = int.Parse(_words[ _current ]);\n if ( _current == _words.Length - 1 )\n _current = -1;\n else\n _current++;\n\n return value;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var b = Solve();\n Console.WriteLine(b ? \"respectable\" : \"ugly\");\n }\n\n public static bool Solve()\n {\n var points = new List();\n for (int i = 0; i < 8; i++)\n {\n var line = Console.ReadLine().Split(' ');\n points.Add(new Point(int.Parse(line[0]), int.Parse(line[1])));\n }\n\n int maxX = points.Select(p => p.x).Max();\n int minX = points.Select(p => p.x).Min();\n int maxY = points.Select(p => p.y).Max();\n int minY = points.Select(p => p.y).Min();\n\n int? midX1 = points.Select(p => p.x).Where(x => x < maxX && x > minX).FirstOrDefault();\n int? midY1 = points.Select(p => p.y).Where(y => y < maxY && y > minY).FirstOrDefault();\n\n if (midX1 == null || midY1 == null) return false;\n\n int midX = midX1.Value;\n int midY = midY1.Value;\n\n if (points.Contains(new Point(minX, minY)) &&\n points.Contains(new Point(midX, minY)) &&\n points.Contains(new Point(maxX, minY)) &&\n points.Contains(new Point(minX, midY)) &&\n points.Contains(new Point(maxX, midY)) &&\n points.Contains(new Point(minX, maxY)) &&\n points.Contains(new Point(midX, maxY)) &&\n points.Contains(new Point(maxX, maxY)))\n return true;\n else\n return false;\n }\n struct Point\n {\n public int x;\n public int y;\n\n public Point(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public override bool Equals(object obj)\n {\n var p = (Point)obj;\n return p.x == x && p.y == y;\n }\n\n public override int GetHashCode()\n {\n return x.GetHashCode() ^ y.GetHashCode();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nclass Demo{\n static void Main() {\n List a = Enumerable.Range(0, 8)\n .Select(x => Console.ReadLine()\n .Split().Select(int.Parse)\n .ToArray()).ToList();\n if ((a.Select(x => x[0]).Distinct().Count() == 3\n & a.Select(x => x[1]).Distinct().Count() == 3) && (\n a.Where(x => x[0] == a.Select(e => e[0]).Min())\n .Select(x => x[1]).OrderBy(x => x).ToArray().\n SequenceEqual(\n a.Where(x => x[0] == a.Select(e => e[0]).Max())\n .Select(x => x[1]).OrderBy(x => x).ToArray())))\n Console.WriteLine(\"respectable\");\n else Console.WriteLine(\"ugly\");\n }\n}"}, {"source_code": "\ufeff#define ONLINE_JUDGE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n\n static int tests = 1;\n\n#if (ONLINE_JUDGE)\n static TextReader r = Console.In;\n static TextWriter w = Console.Out;\n#else\n static string path = @\"C:\\Y\\Prog\\Codeforces\\194\\\";\n static string answerFile = \"0{0}Answer.txt\";\n static string resultFile = \"0{0}Result.txt\";\n static string sourceFile = \"0{0}Source.txt\";\n \n static TextReader r;\n static TextWriter w;\n#endif\n\n static void Main(string[] args)\n {\n\n //int[] t = { 1, 2, 3, 3 };\n //int[] xDistinct = t.Distinct().ToArray();\n \n\n for (int i = 1; i <= tests; i++)\n {\n#if (!ONLINE_JUDGE)\n r = new StreamReader(string.Format(path + sourceFile, i));\n w = new StreamWriter(string.Format(path + resultFile, i), false);\n#endif\n int[] x = new int[8];\n int[] y = new int[8];\n for (int j = 0; j < 8; j++)\n {\n string[] buff = r.ReadLine().Split(' ');\n x[j] = Convert.ToInt32(buff[0]);\n y[j] = Convert.ToInt32(buff[1]);\n }\n solve(x, y);\n\n#if (!ONLINE_JUDGE)\n w.Flush(); w.Close();\n Console.WriteLine(\"CASE: {0}\", i);\n string answer = File.ReadAllText(string.Format(path + answerFile, i));\n string result = File.ReadAllText(string.Format(path + resultFile, i));\n if (answer != result)\n {\n Console.WriteLine(\"FAIL:\");\n Console.WriteLine(\"Result\" + Environment.NewLine + result);\n Console.WriteLine(\"Answer\" + Environment.NewLine + answer);\n }\n else\n Console.WriteLine(\"OK\");\n#endif\n }\n }\n\n public static void solve(int[] x, int[] y)\n {\n int[] xDistinct = x.Distinct().ToArray();\n int[] yDistinct = y.Distinct().ToArray();\n if (xDistinct.Length != 3 || yDistinct.Length != 3)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n for (int i = 0; i < xDistinct.Length; i++)\n for (int j = 0; j < yDistinct.Length; j++)\n {\n if (i == 1 && j == 1) continue;\n bool find = false;\n for (int k = 0; k < x.Length; k++)\n {\n if (x[k] == xDistinct[i] && y[k] == yDistinct[j])\n find = true;\n }\n if (!find)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n }\n w.WriteLine(\"respectable\");\n }\n}\n"}, {"source_code": "\ufeff#define ONLINE_JUDGE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n\n static int tests = 1;\n\n#if (ONLINE_JUDGE)\n static TextReader r = Console.In;\n static TextWriter w = Console.Out;\n#else\n static string path = @\"C:\\Y\\Prog\\Codeforces\\194\\\";\n static string answerFile = \"0{0}Answer.txt\";\n static string resultFile = \"0{0}Result.txt\";\n static string sourceFile = \"0{0}Source.txt\";\n \n static TextReader r;\n static TextWriter w;\n#endif\n\n static void Main(string[] args)\n {\n for (int i = 1; i <= tests; i++)\n {\n#if (!ONLINE_JUDGE)\n r = new StreamReader(string.Format(path + sourceFile, i));\n w = new StreamWriter(string.Format(path + resultFile, i), false);\n#endif\n int[] x = new int[8];\n int[] y = new int[8];\n for (int j = 0; j < 8; j++)\n {\n string[] buff = r.ReadLine().Split(' ');\n x[j] = Convert.ToInt32(buff[0]);\n y[j] = Convert.ToInt32(buff[1]);\n }\n solve(x, y);\n //w.Flush();\n //w.Dispose();\n#if (!ONLINE_JUDGE)\n w.Flush(); w.Close();\n Console.WriteLine(\"CASE: {0}\", i);\n string answer = File.ReadAllText(string.Format(path + answerFile, i));\n string result = File.ReadAllText(string.Format(path + resultFile, i));\n if (answer != result)\n {\n Console.WriteLine(\"FAIL:\");\n Console.WriteLine(\"Result\" + Environment.NewLine + result);\n Console.WriteLine(\"Answer\" + Environment.NewLine + answer);\n }\n else\n Console.WriteLine(\"OK\");\n#endif\n }\n }\n\n public static void solve(int[] x, int[] y)\n {\n int[] xDistinct = x.Distinct().ToArray();\n int[] yDistinct = y.Distinct().ToArray();\n if (xDistinct.Length != 3 || yDistinct.Length != 3)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n for (int i = 0; i < xDistinct.Length; i++)\n for (int j = 0; j < yDistinct.Length; j++)\n {\n if (i == 1 && j == 1) continue;\n bool find = false;\n for (int k = 0; k < x.Length; k++)\n {\n if (x[k] == xDistinct[i] && y[k] == yDistinct[j])\n find = true;\n }\n if (!find)\n {\n w.WriteLine(\"ugly\");\n return;\n }\n }\n w.WriteLine(\"respectable\");\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n int xMin = -1, yMin = -1, xMax = -1, yMax = -1;\n\n var yd = new Dictionary>();\n var xd = new Dictionary>();\n\n for (int i = 0; i < 8; i++)\n {\n string str = Console.ReadLine();\n\n int x = int.Parse(str.Split(new char[] { ' ' })[0]);\n int y = int.Parse(str.Split(new char[] { ' ' })[1]);\n\n if (xMin == -1 || xMin > x) xMin = x;\n if (xMax == -1 || xMax < x) xMax = x;\n if (yMin == -1 || yMin > y) yMin = y;\n if (yMax == -1 || yMax < y) yMax = y;\n\n if (!xd.ContainsKey(x)) xd.Add(x, new List());\n if (!yd.ContainsKey(y)) yd.Add(y, new List());\n\n xd[x].Add(new int[] { x, y });\n yd[y].Add(new int[] { x, y });\n }\n\n // 0 0, 1 0\n // 0 1, \n // 0 2, 1 2, 2 2\n\n if (xd.Count != 3 || yd.Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n if (!xd.ContainsKey(xMin) || !xd.ContainsKey(xMax) || xd[xMin].Count != 3 || xd[xMax].Count != 3 ||\n !yd.ContainsKey(yMin) || !yd.ContainsKey(yMax) || yd[yMin].Count != 3 || yd[yMax].Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n Console.WriteLine(\"respectable\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass Program\n{\n static void Main()\n {\n int xMin = -1, yMin = 1, xMax = -1, yMax = -1;\n\n var yd = new Dictionary>();\n var xd = new Dictionary>();\n\n for (int i = 0; i < 8; i++)\n {\n string str = Console.ReadLine();\n\n int x = int.Parse(str.Split(new char[] { ' ' })[0]);\n int y = int.Parse(str.Split(new char[] { ' ' })[1]);\n\n if (xMin == -1 || xMin > x) xMin = x;\n if (xMax == -1 || xMax < x) xMax = x;\n if (yMin == -1 || yMin > y) yMin = y;\n if (yMax == -1 || yMax < y) yMax = y;\n\n if (!xd.ContainsKey(x)) xd.Add(x, new List());\n if (!yd.ContainsKey(y)) yd.Add(y, new List());\n\n xd[x].Add(new int[] { x, y });\n yd[y].Add(new int[] { x, y });\n }\n\n // 0 0, 1 0\n // 0 1, \n // 0 2, 1 2, 2 2\n\n if (xd.Count != 3 || yd.Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n if (!xd.ContainsKey(xMin) || !xd.ContainsKey(xMax) || xd[xMin].Count != 3 || xd[xMax].Count != 3 ||\n !yd.ContainsKey(yMin) || !yd.ContainsKey(yMax) || yd[yMin].Count != 3 || yd[yMax].Count != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n\n Console.WriteLine(\"respectable\");\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n int[,] points = new int[8, 2];\n for (int i = 0; i < 8; i++)\n {\n ReadArray(' ');\n points[i, 0] = NextInt();\n points[i, 1] = NextInt();\n }\n int[,] t = new int[3, 3];\n string ans = \"\";\n for (int i = 0, z = 0; i <= 1000000; i++)\n {\n int cnt = 0;\n for (int j = 0; j < 8; j++)\n {\n if (points[j, 1] == i)\n {\n cnt++;\n }\n }\n if (cnt == 0) continue;\n if (cnt < 3)\n {\n if (z != 1 || cnt != 2)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n if (cnt > 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n for (int j = 0, k = 0; j < 8; j++)\n {\n if (points[j, 1] == i)\n t[z, k++] = points[j, 0];\n }\n z++;\n }\n if (t[0, 0] == t[1, 0] && t[1, 0] == t[2, 0] && t[0, 1] == t[2, 1] && t[0, 2] == t[1, 1] && t[1, 1] == t[2, 2])\n {\n ans = \"respectable\";\n }\n else\n {\n ans = \"ugly\";\n }\n Console.WriteLine(ans);\n\n }\n\n static void C()\n {\n long n = ReadLong();\n long ans = 0;\n if (n == 1)\n ans = 1;\n if (n == 2)\n ans = 1;\n if (n == 3)\n ans = 1;\n if (n > 3)\n ans = n - 2;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n int[,] points = new int[8, 2];\n for (int i = 0; i < 8; i++)\n {\n ReadArray(' ');\n points[i, 0] = NextInt();\n points[i, 1] = NextInt();\n }\n int[] x = new int[1000001];\n for (int i = 0; i < 8; i++)\n x[points[i, 0]]++;\n int[] next = { 3, 2, 3 };\n for (int i = 0, z = 0; i <= 1000000; i++)\n {\n if (x[i] == 0) continue;\n if (x[i] == next[z])\n {\n z++;\n }\n else\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n int[] y = new int[1000001];\n for (int i = 0, k = 0; i <= 1000000 && k < 3; i++)\n {\n if (x[i] == next[k])\n {\n for (int j = 0; j <= 1000000; j++)\n {\n for (int z = 0; z < 8; z++)\n {\n if (points[z, 1] == j && points[z, 0] == i)\n {\n y[j]++;\n break;\n }\n }\n }\n k++;\n }\n }\n for (int i = 0, k = 0; i <= 1000000 && k < 3; i++)\n {\n if (y[i] == 0) continue;\n if (y[i] == next[k])\n {\n k++;\n }\n else\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n List t = new List();\n for (int i = 0, z = 0; i <= 1000000; i++)\n {\n if (y[i] == 3 && z == 0)\n {\n for (int j = 0; j < 8; j++)\n if (points[j, 1] == i)\n t.Add(points[j, 0]);\n z++;\n }\n if (y[i] == 2)\n {\n for (int j = 0, k = 0; j < 8; j++)\n if (points[j, 1] == i)\n t.Add(points[j, 0]);\n if (t[3] != t[0] || t[4] != t[2])\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n z++;\n }\n if (y[i] == 3 && z == 2)\n {\n for (int j = 0, k = 0; j < 8; j++)\n if (points[j, 1] == i)\n t.Add(points[j, 0]);\n for (int j = 0; j < 3; j++)\n {\n if (t[j] != t[5 + j])\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n\n }\n }\n Console.WriteLine(\"respectable\");\n\n }\n\n static void C()\n {\n long n = ReadLong();\n long ans = 0;\n if (n == 1)\n ans = 1;\n if (n == 2)\n ans = 1;\n if (n == 3)\n ans = 1;\n if (n > 3)\n ans = n - 2;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n int[,] points = new int[8, 2];\n for (int i = 0; i < 8; i++)\n {\n ReadArray(' ');\n points[i, 0] = NextInt();\n points[i, 1] = NextInt();\n }\n int[] next = new int[3];\n next[0] = next[2] = 3;\n next[1] = 2;\n int[,] a = new int[3, 3];\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n a[i, j] = -1;\n int[] c = new int[3];\n for (int i = 0, k = 0; i <= 1000000 && k < 3; i++)\n {\n for (int j = 0, z = 0; j < 8; j++)\n {\n if (points[j, 0] == i)\n {\n if (z < 3) a[k, z++] = points[j, 1];\n c[k]++;\n }\n }\n if (c[k] == next[k])\n {\n k++;\n }\n else\n {\n if (c[k] == 0)\n {\n continue;\n }\n else\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n }\n }\n\n int[] y = new int[1000001];\n for (int i = 0; i < 3; i++)\n for (int j = 0; j < 3; j++)\n if (a[i, j] != -1)\n y[a[i, j]]++;\n int p = 0;\n for (int i = 0; i <= 1000000 && p < 3; i++)\n {\n if (y[i] == next[p])\n {\n p++;\n }\n }\n if (p == 3)\n {\n Console.WriteLine(\"respectable\");\n }\n else\n {\n Console.WriteLine(\"ugly\");\n }\n }\n\n static void C()\n {\n long n = ReadLong();\n long ans = 0;\n if (n == 1)\n ans = 1;\n if (n == 2)\n ans = 1;\n if (n == 3)\n ans = 1;\n if (n > 3)\n ans = n - 2;\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n int n = ReadInt();\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < n; i++)\n {\n for (int j = i * (n / 2), z = 0; z < n / 2; z++, j++)\n {\n sb.Append((j + 1) + \" \");\n }\n for (int j = n * n - i * (n / 2), z = 0; z < n / 2; z++, j--)\n {\n sb.Append((j) + \" \");\n }\n sb.AppendLine(\"\");\n }\n Console.Write(sb);\n }\n\n static void B()\n {\n int[] x = new int[10000001];\n int[] y = new int[10000001];\n int[,] points = new int[8, 2];\n for (int i = 0; i < 8; i++)\n {\n ReadArray(' ');\n int _x = NextInt();\n int _y = NextInt();\n y[_y]++;\n points[i, 0] = _x;\n points[i, 1] = _y;\n }\n int cnttwo = 0;\n int cntthree = 0;\n for (int i = 0; i < y.Length; i++)\n {\n if (y[i] == 3)\n cntthree++;\n if (y[i] == 2)\n cnttwo++;\n }\n if (cntthree != 2 || cnttwo != 1)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n int dif = 0;\n int min_x = int.MaxValue;\n int max_x = int.MinValue;\n for (int i = 0; i < 8; i++)\n {\n if (min_x > points[i, 0])\n min_x = points[i, 0];\n if (max_x < points[i, 0])\n max_x = points[i, 0];\n }\n dif = max_x - min_x;\n for (int i = 0, z = 0; i < y.Length; i++)\n {\n if (y[i] == 3 && z == 0)\n {\n int cnt = 0;\n for (int j = 0; j < 8; j++)\n {\n if (points[j, 1] == i && x[points[j, 0]] == z)\n {\n cnt++;\n x[points[j, 0]]++;\n }\n }\n if (cnt != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n z++;\n }\n if (y[i] == 2)\n {\n if (z != 1)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n min_x = int.MaxValue;\n max_x = int.MinValue;\n int cnt = 0;\n for (int j = 0; j < 8; j++)\n {\n if (points[j, 1] == i && x[points[j, 0]] == z)\n {\n min_x = Math.Min(min_x, points[j, 0]);\n max_x = Math.Max(max_x, points[j, 0]);\n x[points[j, 0]]++;\n cnt++;\n }\n }\n if (cnt != 2)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n if (max_x - min_x != dif)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n z++;\n }\n if (y[i] == 3 && z == 2)\n {\n int cnt = 0;\n int cntone = 0;\n for (int j = 0; j < 8; j++)\n {\n if (points[j, 1] == i && (x[points[j, 0]] == z || x[points[j, 0]] == 1))\n {\n cnt++;\n x[points[j, 0]]++;\n }\n }\n if (cnt != 3)\n {\n Console.WriteLine(\"ugly\");\n return;\n }\n z++;\n }\n }\n Console.WriteLine(\"respectable\");\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _334B_Eight_Points_Set\n{\n class Point\n {\n public int X;\n public int Y;\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n Point[] points = new Point[8];\n for (int i = 0; i < 8; i++)\n {\n var input = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n points[i] = new Point() {X = input[0], Y = input[1]};\n }\n\n\n if (points[0].X == points[1].X && points[1].X == points[2].X &&\n points[3].X == points[4].X &&\n points[5].X == points[6].X && points[6].X == points[7].X &&\n\n points[0].Y == points[3].Y && points[3].Y == points[5].Y &&\n points[1].Y == points[6].Y &&\n points[2].Y == points[4].Y && points[4].Y == points[7].Y)\n {\n Console.WriteLine(\"respectable\");\n }\n else\n {\n Console.WriteLine(\"ugly\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X) * (p.X - X) + (p.Y - Y) * (p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get { return m_Matrix.GetLength(0); }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get { return m_Matrix[i, j]; }\n\n set { m_Matrix[i, j] = value; }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n\n public static int[] Next(int[] p)\n {\n int n = p.Length;\n var next = new int[n];\n Array.Copy(p, next, n);\n\n int k = -1;\n for (int i = n - 1; i > 0; i--)\n {\n if (next[i - 1] < next[i])\n {\n k = i - 1;\n break;\n }\n }\n if (k == -1)\n {\n return null;\n }\n for (int i = n - 1; i >= 0; i--)\n {\n if (next[i] > next[k])\n {\n var tmp = next[i];\n next[i] = next[k];\n next[k] = tmp;\n break;\n }\n }\n for (int i = 1; i <= (n - k - 1) / 2; i++)\n {\n var tmp = next[k + i];\n next[k + i] = next[n - i];\n next[n - i] = tmp;\n }\n\n return next;\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n public static class OrderStatistic\n {\n public static T GetKthElement(this IList list, int k) where T : IComparable\n {\n return Select(list, 0, list.Count - 1, k);\n }\n\n private static T Select(IList list, int l, int r, int k) where T : IComparable\n {\n if (l == r)\n return list[l];\n\n T x = list[(l + r) / 2];\n var i = l;\n var j = r;\n do\n {\n while (list[i].CompareTo(x) < 0)\n i++;\n while (list[j].CompareTo(x) > 0)\n j--;\n if (i <= j)\n {\n T tmp = list[i];\n list[i] = list[j];\n list[j] = tmp;\n\n i++;\n j--;\n }\n }\n while (i <= j);\n\n if (j < l)\n j++;\n if (k <= j - l + 1)\n return Select(list, l, j, k);\n return Select(list, j + 1, r, k - (j - l + 1));\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n // ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n // ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n }\n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get { return this.m_Edges[i]; }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n }\n\n public static class GraphAlgorithms\n {\n private static bool[] v;\n\n private static int[] a;\n\n private static int c;\n\n public static int[] Bfs(this IGraph graph, int start)\n {\n int[] d = new int[graph.Vertices];\n for (int i = 0; i < graph.Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in graph[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n\n public static int[] TopSort(this IGraph graph)\n {\n v = new bool[graph.Vertices];\n a = new int[graph.Vertices];\n c = graph.Vertices;\n\n for (int i = 0; i < graph.Vertices; i++)\n {\n if (!v[i])\n {\n TopSortDfs(graph, i);\n }\n }\n\n return a;\n }\n\n private static void TopSortDfs(IGraph graph, int t)\n {\n v[t] = true;\n foreach (var next in graph[t])\n {\n if (!v[next])\n {\n TopSortDfs(graph, next);\n }\n }\n c--;\n a[c] = t;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal struct Pair\n {\n public Pair(TFirst first, TSecond second)\n : this()\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n private bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First)\n && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397)\n ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get { return this.ContainsKey(key) ? base[key] : 0; }\n set { this.Add(key, value); }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack\n where T : class\n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n\n public static void Swap(ref T x, ref T y)\n {\n T tmp = x;\n x = y;\n y = tmp;\n }\n }\n\n public static class FFTMultiply\n {\n public static int[] Multiply(int[] a, int[] b)\n {\n var result = Multiply(\n a.Select(x => new Complex(x, 0)).ToArray(), b.Select(x => new Complex(x, 0)).ToArray());\n return result.Select(x => (int)Math.Round(x.Real)).ToArray();\n }\n\n public static Complex[] Multiply(Complex[] a, Complex[] b)\n {\n var n = 1;\n while (n < Math.Max(a.Length, b.Length))\n {\n n <<= 1;\n }\n n <<= 1;\n\n var fa = new Complex[n];\n Array.Copy(a, fa, a.Length);\n var fb = new Complex[n];\n Array.Copy(b, fb, b.Length);\n\n FFT(fa, false);\n FFT(fb, false);\n\n for (int i = 0; i < n; i++)\n {\n fa[i] *= fb[i];\n }\n\n FFT(fa, true);\n for (int i = 0; i < n; i++)\n {\n fa[i] /= n;\n }\n return fa;\n }\n\n private static void FFT(IList a, bool invert)\n {\n var n = a.Count;\n if (n == 1)\n {\n return;\n }\n\n var a0 = new Complex[n / 2];\n var a1 = new Complex[n / 2];\n for (int i = 0; i < n / 2; i++)\n {\n a0[i] = a[2 * i];\n a1[i] = a[2 * i + 1];\n }\n FFT(a0, invert);\n FFT(a1, invert);\n\n Complex w = 1;\n var ang = 2 * Math.PI / n * (invert ? -1 : 1);\n Complex wn = new Complex(Math.Cos(ang), Math.Sin(ang));\n\n for (int i = 0; i < n / 2; i++)\n {\n a[i] = a0[i] + w * a1[i];\n a[i + n / 2] = a0[i] - w * a1[i];\n w *= wn;\n }\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n // OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n var max = 1000001;\n int[] a = new int[max];\n int[] b = new int[max];\n for (int i = 0; i < 8; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x]++;\n b[y]++;\n }\n\n var ok = true;\n\n int[] c = new[] { 3, 2, 3 };\n\n int j = 0;\n for (int i = 0; i < max; i++)\n {\n if (a[i] > 0)\n {\n ok &= a[i] == c[j];\n j++;\n if (j > 2)\n {\n break;\n }\n }\n }\n\n j = 0;\n for (int i = 0; i < max; i++)\n {\n if (b[i] > 0)\n {\n ok &= b[i] == c[j];\n j++;\n if (j > 2)\n {\n break;\n }\n }\n }\n\n Console.WriteLine(ok ? \"respectable\" : \"ugly\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace _334B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] Array = new int[10, 2];\n Array[8, 0] = int.MaxValue;\n Array[8, 1] = int.MaxValue;\n Array[9, 0] = -1;\n Array[9, 1] = -1;\n string[] Input;\n for (int i = 0; i < 8; i++)\n {\n Input = Console.ReadLine().Split();\n Array[i, 0] = Convert.ToInt32(Input[0]);\n Array[i, 1] = Convert.ToInt32(Input[1]);\n }\n\n int One = 0;\n int Two = 0;\n\n for (int i = 0; i < 8; i++)\n {\n int LocalX = 0;\n int LocalY = 0;\n for (int j = 0; j < 8; j++)\n {\n if (Array[i, 0] == Array[j, 0]) LocalX++;\n\n if (Array[i, 1] == Array[j, 1]) LocalY++;\n }\n\n if (LocalX == 2) One++;\n else if (LocalX == 3) Two++;\n\n if (LocalY == 2) One++;\n else if (LocalY == 3) Two++;\n }\n\n if (One == 4 && Two == 12)\n {\n List LeftList = new List() { 8 };\n List DownList = new List() { 8 };\n List RightList = new List() { 9 };\n List UpList = new List() { 9 };\n\n for (int i = 0; i < 8; i++)\n {\n if (Array[i, 0] < Array[LeftList[0], 0]) LeftList = new List() { i };\n else if (Array[i, 0] == Array[LeftList[0], 0]) LeftList.Add(i); // + \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n\n if (Array[i, 1] < Array[DownList[0], 1]) DownList = new List() { i };\n else if (Array[i, 1] == Array[DownList[0], 1]) DownList.Add(i); // + \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n\n if (Array[i, 0] > Array[RightList[0], 0]) RightList = new List() { i };\n else if (Array[i, 0] == Array[RightList[0], 0]) RightList.Add(i); // + \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n\n if (Array[i, 1] > Array[UpList[0], 1]) UpList = new List() { i };\n else if (Array[i, 1] == Array[UpList[0], 1]) UpList.Add(i); // + \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n }\n\n if (LeftList.Count == 3 && DownList.Count == 3 && RightList.Count == 3 && UpList.Count == 3) Console.WriteLine(\"respectable\");\n else Console.WriteLine(\"ugly\");\n }\n else Console.WriteLine(\"ugly\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Scanner\n{\n private char[] delimiters = new char[] { ' ' };\n private string[] s;\n private int idx;\n\n public Scanner()\n {\n s = new string[0];\n idx = 0;\n }\n\n public string Next()\n {\n if (idx < s.Length)\n return s[idx++];\n idx = 0;\n s = Console.ReadLine().Split(delimiters, StringSplitOptions.RemoveEmptyEntries);\n return s[idx++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n}\n\nclass Solution\n{\n Scanner cin;\n int n, m, a, b;\n\n public void Go()\n {\n cin = new Scanner();\n int[] x = new int[8];\n int[] y = new int[8];\n int[] sx = new int[8];\n int[] sy = new int[8];\n bool[] ok = new bool[8];\n for (int i = 0; i < 8; i++) {\n sx[i] = x[i] = cin.NextInt();\n sy[i] = y[i] = cin.NextInt();\n }\n\n Array.Sort(sx);\n Array.Sort(sy);\n int[] xx = sx.Distinct().ToArray();\n int[] yy = sy.Distinct().ToArray();\n bool okay = false;\n if (xx.Length == 3 && yy.Length == 3) {\n for (int a = 0; a < 3; a++)\n for (int b = 0; b < 3; b++)\n if (a != 1 || b != 1)\n for (int i = 0; i < 8; i++)\n if (x[i] == xx[a] && y[i] == yy[b])\n ok[i] = true;\n okay = true;\n for (int i = 0; i < 8; i++)\n okay &= ok[i];\n }\n\n if (okay)\n Console.WriteLine(\"respectable\");\n else\n Console.WriteLine(\"ugly\");\n }\n\n static void Main(string[] args)\n {\n new Solution().Go();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _334B\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint[] x = new int[8];\n\t\t\tint[] y = new int[8];\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tint[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\t\tx[i] = ip[0];\n\t\t\t\ty[i] = ip[1];\n\t\t\t}\n\t\t\tint[] xx = x.Distinct().ToArray();\n\t\t\tint[] yy = y.Distinct().ToArray();\n\t\t\tbool b = false;\n\t\t\tif (xx.Length == 3 && yy.Length == 3)\n\t\t\t{\n\t\t\t\tArray.Sort(xx);\n\t\t\t\tArray.Sort(yy);\n\t\t\t\tb = true;\n\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (i != 1 || j != 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbool c = false;\n\t\t\t\t\t\t\tfor (int k = 0; k < 8; k++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (x[k] == xx[i] && y[k] == yy[i])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tc = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb &= c;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (b == false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (b == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"respectable\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"ugly\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _334B\n{\n\tpublic class Point\n\t{\n\t\tpublic int x;\n\t\tpublic int y;\n\t\tpublic Point(int x, int y)\n\t\t{\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t}\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPoint[] p = new Point[8];\n\t\t\tList ax = new List();\n\t\t\tList ay = new List();\n\t\t\tList cx = new List();\n\t\t\tList cy = new List();\n\t\t\tbool b = true;\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tint[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\t\tPoint t = new Point(ip[0], ip[1]);\n\t\t\t\tif (Array.IndexOf(p, t) != -1)\n\t\t\t\t{\n\t\t\t\t\tb = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp[i] = t;\n\t\t\t\t\tint px = ax.IndexOf(ip[0]);\n\t\t\t\t\tif (px == -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tax.Add(ip[0]);\n\t\t\t\t\t\tcx.Add(1);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcx[px]++;\n\t\t\t\t\t}\n\t\t\t\t\tint py = ay.IndexOf(ip[0]);\n\t\t\t\t\tif (py == -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tay.Add(ip[0]);\n\t\t\t\t\t\tcy.Add(1);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcy[py]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int i = 0; i < ax.Count - 1; i++)\n\t\t\t{\n\t\t\t\tfor (int j = i + 1; j < ax.Count; j++)\n\t\t\t\t{\n\t\t\t\t\tif (ax[i] > ax[j])\n\t\t\t\t\t{\n\t\t\t\t\t\tint t = ax[j];\n\t\t\t\t\t\tax[j] = ax[i];\n\t\t\t\t\t\tax[i] = t;\n\t\t\t\t\t\tt = cx[j];\n\t\t\t\t\t\tcx[j] = cx[i];\n\t\t\t\t\t\tcx[i] = t;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int i = 0; i < ay.Count - 1; i++)\n\t\t\t{\n\t\t\t\tfor (int j = i + 1; j < ay.Count; j++)\n\t\t\t\t{\n\t\t\t\t\tif (ay[i] > ay[j])\n\t\t\t\t\t{\n\t\t\t\t\t\tint t = ay[j];\n\t\t\t\t\t\tay[j] = ay[i];\n\t\t\t\t\t\tay[i] = t;\n\t\t\t\t\t\tt = cy[j];\n\t\t\t\t\t\tcy[j] = cy[i];\n\t\t\t\t\t\tcy[i] = t;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ax.Count != 3)\n\t\t\t{\n\t\t\t\tb = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (cx[0] != 3 || cx[1] != 2 || cx[2] != 3)\n\t\t\t\t{\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ay.Count != 3)\n\t\t\t{\n\t\t\t\tb = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (cy[0] != 3 || cy[1] != 2 || cy[2] != 3)\n\t\t\t\t{\n\t\t\t\t\tb = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"respectable\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"ugly\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace _334B\n{\n\tpublic class Point\n\t{\n\t\tpublic int x;\n\t\tpublic int y;\n\t\tpublic Point(int x, int y)\n\t\t{\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t}\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tPoint[] p = new Point[8];\n\t\t\tfor (int i = 0; i < 8; i++)\n\t\t\t{\n\t\t\t\tint[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\t\t\t\tPoint t = new Point(ip[0], ip[1]);\n\t\t\t\tp[i] = t;\n\t\t\t\t//p[i].x = ip[0];\n\t\t\t\t//p[i].y = ip[1];\n\t\t\t}\n\t\t\tArray.Sort(p, (m, n) => m.x.CompareTo(n.x));\n\t\t\tbool b = true;\n\t\t\tif (p[0].x != p[1].x || p[1].x != p[2].x || p[2].x == p[3].x || p[3].x != p[4].x || p[4].x == p[5].x || p[5].x != p[6].x || p[6].x != p[7].x)\n\t\t\t{\n\t\t\t\tb = false;\n\t\t\t}\n\t\t\tif (p[0].y != p[3].y || p[3].y != p[5].y || p[5].y == p[1].y || p[1].y != p[6].y || p[6].y == p[2].y || p[2].y != p[4].y || p[4].y != p[7].y)\n\t\t\t{\n\t\t\t\tb = false;\n\t\t\t}\n\t\t\tif (b)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"respectable\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"ugly\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}], "src_uid": "f3c96123334534056f26b96f90886807"} {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p1\n\t{\n\t\tpublic void foo()\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tstring[] sp = Console.ReadLine().Split(' ');\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\ta[i] = int.Parse(sp[i]);\n\t\t\t}\n\n\t\t\tint soFar = int.MaxValue;\n\t\t\tfor (int i = 1; i < n - 1; i++)\n\t\t\t{\n\t\t\t\tint t = 0;\n\t\t\t\tint[] b = new int[n-1];\n\t\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\tif (j == i) continue;\n\t\t\t\t\tb[t] = a[j];\n\t\t\t\t\tt++;\n\t\t\t\t}\n\t\t\t\tsoFar = Math.Min(soFar, diff(b));\n\t\t\t}\n\t\t\tConsole.WriteLine(soFar);\n\t\t}\n\t\tprivate int diff(int[] a)\n\t\t{\n\t\t\tint d = int.MinValue;\n\t\t\tint n = a.Length;\n\t\t\tfor (int j = 0; j < n - 1; j++)\n\t\t\t{\n\t\t\t\td = Math.Max(d, a[j + 1] - a[j]);\n\t\t\t}\n\t\t\treturn d;\n\t\t}\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tp1 o = new p1();\n\t\t\to.foo();\n\n\t\t\t//Console.ReadLine();\n\t\t}\n\t}\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n \n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n \n Console.WriteLine(Math.Max(max1, min2));\n String test = Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n \n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n \n Console.WriteLine(Math.Max(max1, min2));\n String test = Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace MinimumDifficulty\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int [] a = new int[n];\n for(int i=0; i tmpA = new List();\n for(int i=0; i i) { razn2d[i, j] = razn1[j + 1]; }\n else if(i!=j) { razn2d[i, j] = razn1[j]; }\n\n \n }\n }\n for (int i = 0; i < n - 2; i++) { max[i] = 0; }\n for (int i = 0; i < n - 2; i++) {\n for (int j = 0; j < n - 2; j++) {\n if (razn2d[i, j] > max[i]) { max[i] = razn2d[i, j]; }\n \n }\n }\n min = max[0];\n for (int i = 0; i < n - 2; i++) {\n if (max[i] <= min) { min = max[i]; } \n \n }\n\n Console.WriteLine(min); \n \n \n\n \n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int[] data;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n data = new int[input.Length];\n for (int i = 1; i < data.Length; ++i)\n data[i] = int.Parse(input[i]);\n }\n int maxDistance = 0;\n for (int i = 2; i < data.Length; ++i)\n if (data[i] - data[i - 1] > maxDistance)\n maxDistance = data[i] - data[i - 1];\n int minMax = int.MaxValue;\n for(int i = 3,curr; i maximums = new List();\n\n n = NextInt();\n holds = new int[n];\n\n for (int i = 0; i < n; i++)\n holds[i] = NextInt();\n\n for (int i = 1; i < n - 1; i++)\n {\n max = int.MinValue;\n\n for (int j = 1; j < n; j++)\n {\n if (j == i)\n diff = holds[j + 1] - holds[j - 1];\n else if (j - 1 == i)\n diff = holds[j] - holds[j - 2];\n else\n diff = holds[j] - holds[j - 1];\n\n if (diff > max)\n max = diff;\n }\n\n maximums.Add(max);\n }\n\n Console.WriteLine(maximums.Min());\n }\n }\n\n partial class MinimumDifficulty\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var a = sc.Integer(n);\n int max=-1;\n for (int i = 1; i < n; i++)\n max = Math.Max(max, a[i] - a[i - 1]);\n var min = int.MaxValue;\n for (int i = 1; i < n - 1; i++)\n min = Math.Min(min, a[i + 1] - a[i-1]);\n IO.Printer.Out.WriteLine(Math.Max(min, max));\n }\n\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Timus_CS\n{\n static partial class Program\n {\n static void Main(string[] args)\n {\n\n var n = Program.GetLineProcessed(Convert.ToInt32)[0];\n var x = Program.GetLineProcessed(Convert.ToInt32);\n var y = new int[n - 1];\n for (var i = 0; i < n - 1; i++)\n y[i] = x[i + 1] - x[i];\n\n var z = new int[n - 2];\n for (var i = 0; i < n - 2; i++)\n z[i] = x[i + 2] - x[i];\n\n Console.WriteLine(Math.Max(y.Max(), z.Min()));\n\n }\n\n public static T[] GetLineProcessed(Func action)\n {\n return Console.ReadLine()\n .Split(new char[0], StringSplitOptions.RemoveEmptyEntries)\n .Select(action.Invoke)\n .ToArray();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var num = int.Parse(Console.ReadLine());\n var init = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n\n int max = int.MaxValue;\n for (int i = 1; i < init.Count - 1; i++)\n {\n var init1 = init.ToList();\n init1.RemoveAt(i);\n var localMax = 0;\n for (int j = 1 ; j < init1.Count; j++)\n {\n localMax = Math.Max(localMax, init1[j] - init1[j - 1]);\n }\n\n max = Math.Min(max, localMax);\n }\n \n\n Console.WriteLine(max);\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication59\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] zac = new int[n];\n string[] str = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n zac[i] = Int32.Parse(str[i]);\n }\n int k = 0;\n int[] max = new int[n-2];\n int min = 0;\n int tmp = 0;\n for (int i = 1; i < n - 1; i++)\n {\n min = 0;\n for (int j = 0; j < n - 1; j++)\n {\n if (j + 1 != i) { tmp = zac[j + 1] - zac[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }\n else\n { tmp = zac[j + 2] - zac[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }\n }\n k++;\n }\n tmp = 1000;\n for (int i = 0; i < n-2; i++)\n {\n if (max[i] < tmp) { min = max[i]; tmp = max[i]; }\n \n }\n \n Console.WriteLine(min);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A496 {\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int ans = int.MaxValue;\n for (int i = 0; i < a.Length - 2; ++i)\n ans = Math.Min(ans, a[i + 2] - a[i]);\n for (int i = 0; i < a.Length - 1; ++i)\n ans = Math.Max(ans, a[i + 1] - a[i]);\n Console.WriteLine(ans);\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_A_283\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), max_d1 = 0, min_d2 = 1050;\n int[] a = new int[n];\n s = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n }\n for (int i = 0; i < n - 1; i++)\n {\n if (Math.Abs(a[i + 1] - a[i]) > max_d1) max_d1 = Math.Abs(a[i + 1] - a[i]);\n }\n\n for (int i = 1; i < n - 1; i++)\n {\n if (Math.Abs(a[i - 1] - a[i + 1]) < min_d2) min_d2 = Math.Abs(a[i - 1] - a[i + 1]);\n }\n Console.WriteLine(Math.Max(max_d1,min_d2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _283_Task_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = Int32.Parse(Console.ReadLine());\n int[] zc = new int[N];\n string[] strok = Console.ReadLine().Split(' ');\n for (int i = 0; i < N; i++)\n {\n zc[i] = Int32.Parse(strok[i]);\n }\n int k = 0;\n int[] max = new int[N - 2];\n int min = 0;\n int tmp = 0;\n for (int i = 1; i < N - 1; i++)\n {\n min = 0;\n for (int j = 0; j < N - 1; j++)\n {\n if (j + 1 != i) { tmp = zc[j + 1] - zc[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }\n else\n { tmp = zc[j + 2] - zc[j]; if (tmp > min) { max[k] = tmp; min = tmp; } }\n }\n k++;\n }\n tmp = 1000;\n for (int i = 0; i < N - 2; i++)\n {\n if (max[i] < tmp) { min = max[i]; tmp = max[i]; }\n\n }\n\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] mas = new int[n];\n string[] strmas = (Console.ReadLine()).Split(' ');\n for (int i = 0; i < strmas.Length; i++)\n {\n mas[i] = int.Parse(strmas[i]);\n }\n int d = 0, mind = 0, z = 0;\n int kolver = n - 2;\n int[] masd = new int[kolver];\n while (kolver != 0)\n {\n d = 0;\n z = mas[kolver];\n mas[kolver] = 1001;\n for (int i = 1; i < mas.Length; i++)\n {\n if (mas[i] != 1001)\n {\n if (mas[i - 1] == 1001)\n {\n if ((mas[i] - mas[i - 2]) > d)\n {\n d = mas[i] - mas[i - 2];\n }\n }\n else\n {\n if ((mas[i] - mas[i - 1]) > d)\n {\n d = mas[i] - mas[i - 1];\n }\n }\n }\n }\n masd[kolver - 1] = d;\n mas[kolver] = z;\n kolver--;\n }\n mind = masd[0];\n for (int i = 0; i < masd.Length; i++) //\u0438\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\n {\n if (masd[i] < mind)\n mind = masd[i];\n }\n Console.WriteLine(mind.ToString());\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Minimum_Difficulty\n{\n class Program\n {\n static IO io = new IO();\n static void Main(string[] args)\n {\n int num_N = io.ReadNum();\n int[] arr_S = io.ReadIntArr();\n int num_R1 = arr_S[1] - arr_S[0];\n int num_R2 = arr_S[2] - arr_S[0];\n\n\n int temp1;\n int temp2;\n bool flag = false;\n\n for (int i = 1; i < num_N - 2; i++)\n {\n temp1 = arr_S[i + 1] - arr_S[i];\n if (temp1 >= num_R2)\n {\n num_R2 = temp1; flag = true;\n }\n temp2 = arr_S[i + 2] - arr_S[i];\n if (temp1 <= num_R2 && temp2 <= num_R2 && !flag) num_R2 = temp2;\n }\n\n temp1 = arr_S[num_N - 1] - arr_S[num_N - 2];\n if (temp1 > num_R2) num_R2 = temp1;\n if (num_R1 > num_R2) num_R2 = num_R1;\n\n Console.WriteLine(num_R2);\n Console.Read();\n }\n }\n\n class IO\n {\n public int ReadNum()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n var a= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int min=99999999,max=0;\n for(int i=2;i diff )\n {\n diff = mas[i] - mas[i - 2];\n } \n }\n else\n {\n if ( ( mas[i] - mas[i - 1] ) > diff )\n {\n diff = mas[i] - mas[i - 1];\n }\n }\n } \n }\n masdiff[kolver-1] = diff;\n mas[kolver] = z;\n kolver--;\n }\n mindiff = masdiff[0];\n for ( int i = 0; i < masdiff.Length; i++ ) //\u0438\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\n {\n if ( masdiff[i] < mindiff )\n mindiff = masdiff[i];\n }\n Console.WriteLine ( mindiff.ToString ( ) );\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main() {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(new char[1] { ' ' }).Select(b => int.Parse(b)).ToArray();\n n--;\n int mdiff = int.MaxValue, cdiff = -1;\n for (int i = 1; i < n; i++)\n {\n for (int o = 1; o < a.Length; o++)\n {\n if (o == i)\n {\n cdiff = Math.Max(cdiff, a[o + 1] - a[o - 1]);\n o++;\n\n continue;\n }\n cdiff = Math.Max(cdiff, a[o] - a[o - 1]);\n }\n mdiff = Math.Min(mdiff, cdiff);\n cdiff = -1;\n }\n Console.WriteLine(mdiff);\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void vvod(ref List a, string[]s)\n {\n for (int i = 0; i < s.Length; i++)\n {\n a.Add(Convert.ToInt32(s[i]));\n }\n }\n static int prov(List a, int n)\n {\n int e = a[n];\n a.RemoveAt(n);\n int max = 0;\n for (int i = 1; i < a.Count; i++)\n {\n if (a[i] - a[i - 1] > max) max = a[i] - a[i - 1];\n }\n a.Insert(n, e);\n return max;\n }\n\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = Console.ReadLine().Trim().Split(' ');\n List a = new List();\n vvod(ref a, s);\n int min = 4566446;\n int max = 0;\n for (int i = 1; i < n - 1; i++)\n {\n if (prov(a, i) < min) min = prov(a, i);\n \n }\n Console.WriteLine(min);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();\n var sum = Enumerable.Range(0, count - 1).Select(z => x[z + 1] - x[z]).ToArray().Max();\n var rez = Enumerable.Range(0, count - 2).Select(z => x[z + 2] - x[z]).ToArray().Min();\n Console.WriteLine(Math.Max(sum,rez));\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _496A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n\n Console.WriteLine(Math.Max(max1, min2));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _01\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n\n int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);\n int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;\n\n int temp1;\n int temp2;\n bool flag = false;\n\n for (int i = 1; i < n - 2; i++)\n {\n temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);\n if (temp1 >= r2) { \n r2 = temp1; flag = true; \n }\n temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);\n if (temp1 <= r2 && temp2 <= r2 && !flag) r2 = temp2;\n }\n\n temp1 = Int32.Parse(s[n - 1]) - Int32.Parse(s[n - 2]);\n if (temp1 > r2) r2 = temp1;\n if (r1 > r2) r2 = r1;\n\n Console.WriteLine(r2);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic sealed class TaskA\n{\n //==============================//\n private Int16[] mTrack;\n private Int16 mN;\n //==============================//\n public TaskA(Int16 n,Int16[]track)\n {\n mN = n;\n mTrack = track;\n }\n public Int16 Solve()\n {\n Int16 min = (Int16)(mTrack[2] - mTrack[0]),\n dx;\n for (int i = 1; i < mN-2; i++)\n {\n dx = (Int16)(mTrack[i + 2] - mTrack[i]);\n if (dx < min) min = dx;\n }\n Int16 answ = new Int16();\n answ = min;\n for (int i = 1; i < mN - 1; i++)\n {\n dx = (Int16)(mTrack[i + 1] - mTrack[i]);\n if (dx > answ) answ = dx;\n }\n return answ;\n }\n}\npublic sealed class Program\n{\n static void Main(string[] args)\n {\n Int16 n = Convert.ToInt16(Console.ReadLine());\n Int16[] track = Console.ReadLine().Trim().Split().Select(x => Int16.Parse(x)).ToArray();\n\n TaskA A = new TaskA(n,track);\n Console.WriteLine(A.Solve());\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Program\n {\n\n static int diff(string[] a)\n {\n int max = -1;\n for (int i = 1; i < a.Length; i++)\n {\n if ((Convert.ToInt32(a[i]) - Convert.ToInt32(a[i - 1])) > max) { max = Convert.ToInt32(a[i]) - Convert.ToInt32(a[i - 1]); }\n }\n\n return max;\n }\n\n static void Main(string[] args)\n {\n Console.ReadLine();\n var s = Console.ReadLine().Split(' ');\n if (s.Length == 3)\n {\n Console.WriteLine(Convert.ToInt32(s[2]) - Convert.ToInt32(s[0]));\n return;\n }\n\n int min = 99999999;\n for (int i = 1; i < s.Length - 2; i++)\n {\n List t = new List();\n for (int j = 0; j < s.Length; j++)\n {\n if (i == j) continue;\n t.Add(s[j]);\n }\n int d = diff(t.ToArray());\n if (d < min) min = d;\n }\n\n Console.WriteLine(min);\n return;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static char[] SPACE = new[] { ' ' };\n\n static void Main(string[] args)\n {\n#if DEBUG\n using (var input = new StreamReader(\"input.txt\"))\n using (var output = new StreamWriter(\"output.txt\"))\n {\n Console.SetIn(input);\n Console.SetOut(output);\n\n int n = 0;\n do\n {\n Console.WriteLine();\n Console.WriteLine(\"Sample {0}\", ++n);\n Prog();\n } while (Console.ReadLine() == string.Empty);\n }\n#else\n Prog();\n#endif\n }\n\n static int __ptr = 0;\n static string[] __input;\n static int NextInt()\n {\n return int.Parse(__input[__ptr++]);\n }\n static long NextLong()\n {\n return long.Parse(__input[__ptr++]);\n }\n static void ReadTokens(int n)\n {\n __ptr = 0;\n __input = Console.ReadLine().Split(SPACE, n);\n }\n\n //\n\n static void Prog()\n {\n ReadTokens(1);\n int n = NextInt();\n\n int[] nums = new int[n];\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n nums[i] = NextInt();\n\n int min = int.MaxValue;\n int minIndex = 0;\n for (int i = 0; i < n - 2; i++)\n {\n var left = nums[i];\n var right = nums[i + 2];\n var d = right - left;\n if(d < min)\n {\n min = d;\n minIndex = i + 1;\n }\n }\n\n var list = new List(nums);\n list.RemoveAt(minIndex);\n \n var max = int.MinValue;\n for (int i = 0; i < list.Count - 1; i++)\n {\n var left = list[i];\n var right = list[i + 1];\n max = Math.Max(max, right - left);\n }\n\n Console.WriteLine(max);\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CODEFORCES\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int p = Convert.ToInt32(s[0]);\n int n = Convert.ToInt32(s[1]);\n int c = 0;\n int min = 5000;\n int d = 0;\n for (int i = 1; i < s.Length; i++)\n {\n c = Convert.ToInt32(s[i]);\n p = Convert.ToInt32(s[i - 1]);\n if (c - p > d)\n {\n d = c - p;\n }\n\n }\n for (int i = 1; i < s.Length - 1; i++)\n {\n c = Convert.ToInt32(s[i]);\n n = Convert.ToInt32(s[i + 1]);\n p = Convert.ToInt32(s[i - 1]);\n if (n - p < min)\n {\n min = n - p;\n }\n\n }\n if (min < d)\n min = d;\n Console.WriteLine(min);\n\n }\n }\n}\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF283Div2\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, i, j, d, ans;\n\t\t\tint[] A;\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tA = new int[N];\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tA[i] = xoi.ReadInt();\n\n\t\t\tans = A[N - 1] - A[0];\n\n\t\t\tfor (i = 1; i < N - 1; i++)\n\t\t\t{\n\t\t\t\tfor (j = 1, d = 0; j < N; j++)\n\t\t\t\t\td = Math.Max(d, A[j] - A[i == j - 1 ? j - 2 : j - 1]);\n\t\t\t\tans = Math.Min(ans, d);\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans);\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF283Div2()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace sample\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n int[] holds = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n List ds = new List();\n for (int i = 1; i < holds.Length; i++)\n {\n ds.Add(holds[i] - holds[i-1]);\n }\n List dds = new List();\n for (int i = 1; i < ds.Count(); i++)\n {\n dds.Add(ds[i]+ds[i-1]);\n }\n System.Console.WriteLine(ds.Max() > dds.Min() ? ds.Max() : dds.Min());\n }\n\n }\n\n \n \n \n}\n"}, {"source_code": "using System;\n\nnamespace Calculator\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\tint[] a = new int[n];\n\t\t\tString dato = Console.ReadLine();\n\t\t\tString[] datos = dato.Split(' ');\n\t\t\tint m = 0;\n\t\t\tforeach(var variable in datos)\n\t\t\t{\n\t\t\t\ta[m] = Convert.ToInt32(variable);\n\t\t\t\tm++;\n\t\t\t}\n\t\t\tint combinaciones = n - 2;\n\t\t\tint dificultad = 0;\n\t\t\tint[] dificultadMaxima = new int[combinaciones];\n\t\t\tfor(int i = 0; i < combinaciones; i++)\n\t\t\t{\n\t\t\t\tfor(int j = 0; j < n - 1; j++)\n\t\t\t\t{\n\t\t\t\t\tif(j + 1 == i + 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdificultad = a[j + 2] - a[j];\n\t\t\t\t\t\tj += 1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdificultad = a[j + 1] - a[j];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (dificultad > dificultadMaxima[i])\n\t\t\t\t\t\tdificultadMaxima[i] = dificultad;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint minimoTotal = 99999999;\n\t\t\tfor(int i = 0; i < combinaciones; i++)\n\t\t\t\tif (dificultadMaxima[i] < minimoTotal)\n\t\t\t\t\tminimoTotal = dificultadMaxima[i];\n\t\t\tConsole.WriteLine(minimoTotal);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass CF_496A\n{\n static int Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n string[] snums = line.Split(new char[] { ' ' });\n List nums = new List();\n foreach (var snum in snums)\n {\n nums.Add(Convert.ToInt32(snum));\n }\n int result = new CF_496A().solve(nums.ToArray());\n Console.WriteLine(result);\n return 0;\n }\n\n public int solve(int[] holds)\n {\n int[] diffs = new int[holds.Length];\n int pn = 0;\n for (int i = 0; i < holds.Length; i++)\n {\n diffs[i] = holds[i] - pn;\n pn = holds[i];\n }\n\n int min = 1;\n for (int i = 2; i < diffs.Length; i++)\n {\n if (diffs[i] < diffs[min])\n min = i;\n else if (diffs[i] == diffs[min] \n && i+1 < diffs.Length \n && min+1 < diffs.Length \n && (diffs[i] + diffs[i + 1]) < (diffs[min] + diffs[min + 1]))\n min = i;\n }\n if (min == (diffs.Length - 1)) min--;\n diffs[min] += diffs[min + 1];\n int max = diffs[1];\n for (int i = 2; i < diffs.Length; i++)\n {\n if (diffs[i] > max)\n max = diffs[i];\n }\n return max;\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using NUnit.Framework;\n\n [TestFixture]\n class Test_CF_496A\n {\n [Test]\n public void Test1()\n {\n int[] nums = { 1, 4, 6 };\n Assert.AreEqual(5, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test2()\n {\n int[] nums = { 1, 2, 3, 4, 5 };\n Assert.AreEqual(2, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test3()\n {\n int[] nums = { 1, 2, 3, 7, 8 };\n Assert.AreEqual(4, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test4()\n {\n int[] nums = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 };\n Assert.AreEqual(19, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test5()\n {\n int[] nums = {\n 178, 186, 196, 209, 217,\n 226, 236, 248, 260, 273,\n 281, 291, 300, 309, 322,\n 331, 343, 357, 366, 377,\n 389, 399, 409, 419, 429,\n 442, 450, 459, 469, 477,\n 491, 501, 512, 524, 534,\n 548, 557, 568, 582, 593,\n 602, 616, 630, 643, 652,\n 660, 670, 679, 693, 707,\n 715, 728, 737, 750, 759,\n 768, 776, 789, 797, 807,\n 815, 827, 837, 849, 863,\n 873, 881, 890, 901, 910,\n 920, 932};\n Assert.AreEqual(17, new CF_496A().solve(nums));\n }\n }\n}\n#endif"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Minimum_Difficulty\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n\n int min = int.MaxValue;\n for (int i = 2; i < n; i++)\n {\n int d = nn[i] - nn[i - 2];\n if (min > d)\n min = d;\n }\n\n int max = int.MinValue;\n for (int i = 1; i < n; i++)\n {\n int d = nn[i] - nn[i - 1];\n if (max < d)\n max = d;\n }\n\n\n writer.WriteLine(Math.Max(min, max));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input;\n input = Console.ReadLine();\n int climbs = Convert.ToInt32(input);\n input = Console.ReadLine();\n List split = new List(input.Split(' '));\n int minimum = 5000000;\n int remove =1;\n int maximum = 0;\n for (int i = 0; i < split.Count - 2; i++)\n {\n if (minimum > Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]))\n {\n minimum = Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]);\n remove = i + 1;\n }\n }\n split.RemoveAt(remove);\n for (int i = 0; i < split.Count - 1; i++)\n {\n if (maximum < Convert.ToInt32(split[i + 1]) - Convert.ToInt32(split[i]))\n {\n maximum = Convert.ToInt32(split[i + 1]) - Convert.ToInt32(split[i]);\n }\n }\n Console.WriteLine(maximum);\n\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _19._12\n{\n class Program\n {\n static int Sunm(List a, int k)\n {\n int q = a[k]; \n a.RemoveAt(k);\n int max = 0;\n for (int i = 0; i < a.Count-1; i++)\n {\n if (a[i + 1] - a[i] > max) max = a[i + 1] - a[i];\n }\n a.Insert(k, q);\n return max;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List a = new List();\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n for (int i = 0; i < n; i++)\n {\n a.Add(Convert.ToInt32(ss[i]));\n }\n int max = 0;\n int min = 10000;\n for (int i = 1; i < a.Count-1; i++)\n {\n max = Sunm(a, i);\n if (max < min) min = max;\n }\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long minDiff = long.MaxValue;\n for (int i = 1; i < n - 1; i++)\n {\n minDiff = Math.Min(minDiff, GetDifficulty(a, 0, n-1, i));\n }\n Console.WriteLine(minDiff);\n Console.ReadLine();\n }\n\n static long GetDifficulty(long[] array, long from, long to, long except)\n {\n long diff = array[from + 1] - array[from];\n for (long i = from; i < to; i++)\n {\n if(i+1 == except)\n {\n long curr = array[i + 2] - array[i];\n diff = Math.Max(diff, curr);\n i++;\n }\n else\n {\n long curr = array[i + 1] - array[i];\n diff = Math.Max(diff, curr);\n }\n }\n return diff;\n }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace Crap\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = Convert.ToInt32(Console.ReadLine());\n string[] tmp1 = Console.ReadLine().Split(' ');\n int[] numbers = new int[n];\n int minimum = 2147483647;\n int localMinimum = 0;\n for (int i = 0; i < n; ++i)\n {\n numbers[i] = Convert.ToInt32(tmp1[i]);\n }\n int diff = 0;\n for (int i = 1; i < (n-1); ++i)\n {\n localMinimum = 0;\n for(int j = 1; j < (n); ++j)\n {\n diff = 0;\n if (i == j)\n {\n if(n == 3)\n {\n localMinimum = numbers[j + 1] - numbers[j - 1];\n }\n continue;\n }\n else if (j == (i + 1))\n {\n diff = numbers[j] - numbers[j - 2];\n if (diff > localMinimum) localMinimum = diff;\n }\n else\n {\n diff = numbers[j] - numbers[j-1];\n if (diff > localMinimum) localMinimum = diff;\n }\n\n }\n if (localMinimum < minimum) minimum = localMinimum;\n \n }\n Console.WriteLine(minimum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _496A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int[] diffs = new int[n - 1];\n for (int i = 1; i < n; i++)\n diffs[i - 1] = a[i] - a[i - 1];\n int[] sumDiffs = new int[n - 2];\n for (int i = 1; i < n - 1; i++)\n sumDiffs[i - 1] = diffs[i] + diffs[i - 1];\n int result = Math.Max(diffs.Max(), sumDiffs.Min());\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces26\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\t\t\tint min = 1000;\n\t\t\tfor (int i = 1; i max) max = datanew[j + 1] - datanew[j];\n\t\t\t\tif (max < min) min = max;\n\t\t\t}\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n\n Console.WriteLine(Math.Max(max1, min2));\n String test = Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n \n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n \n Console.WriteLine(Math.Max(max1, min2));\n String test = Console.ReadLine();\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Cuscontest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n int max1 = Enumerable.Range(0, n - 1).Select(i => a[i + 1] - a[i]).Max();\n int min2 = Enumerable.Range(0, n - 2).Select(i => a[i + 2] - a[i]).Min();\n\n Console.WriteLine(Math.Max(max1, min2));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static string s;\n\n private static string[] t;\n\n private static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n t = Console.ReadLine().Split(' ');\n\n var a = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(t[i]);\n }\n \n var min = 1000;\n\n for (int k = 1; k <= n-2; k++)\n {\n var max = 0;\n\n for (int i = 1; i < n; i++)\n {\n if (i == k) continue;\n\n var tmp = i == k + 1 ? a[i] - a[i - 2] : a[i] - a[i - 1];\n\n if (tmp > max)\n max = tmp;\n }\n\n if (min > max)\n min = max;\n }\n\n Console.WriteLine(min);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(d => int.Parse(d)).ToArray();\n\n var min = int.MaxValue;\n int ind = 0;\n for (int i = 1; i < a.Length - 1; i++)\n {\n var diff = a[i + 1] - a[i - 1];\n if (diff < min)\n {\n min = diff;\n ind = i;\n }\n }\n\n var max = 0;\n for (int i = 0; i < a.Length - 1; i++)\n {\n int diff;\n if (i == ind - 1)\n {\n diff = a[i + 2] - a[i];\n }\n else if (i == ind)\n {\n continue;\n }\n else\n {\n diff = a[i + 1] - a[i];\n }\n\n if (diff > max)\n {\n max = diff;\n }\n }\n\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();\n int max = int.MaxValue;\n for(int i = 1 ; i < n - 1 ; i++){\n int localdiff = -1;\n int prev = num[0];\n for(int j = 1 ; j < n ; j++){\n if(j == i)\n continue;\n localdiff = Math.Max(localdiff,num[j] - prev);\n prev = num[j];\n }\n max = Math.Min(localdiff,max);\n }\n Console.WriteLine(max);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int minim = 10000, minimNormal = 0;\n for (int i = 1; i < n; i++) {\n if (v[i] - v[i - 1] > minimNormal)\n minimNormal = v[i] - v[i - 1];\n }\n for (int i = 1; i < n - 1; i++) {\n int dif = v[i + 1] - v[i - 1];\n if (dif < minim)\n minim = dif;\n }\n Console.WriteLine(Math.Max(minim,minimNormal));\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // Minimum Difficulty (brute force, implementation, math)\n class _496A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(ss[i]);\n int max = 0;\n for (int i = 0; i < n - 1; i++)\n max = Math.Max(max, a[i + 1] - a[i]);\n int min = 2000;\n for (int i = 1; i < n - 1; i++)\n min = Math.Min(min, a[i + 1] - a[i - 1]);\n Console.WriteLine(Math.Max(max, min));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CheckCable\n{\n class Program\n {\n \n public static void MimimumDifficulty()\n {\n // 1. Init\n int n = 0; // [3; 100]\n int[] a; // 1 <= a[i] <= 1000\n\n n = Convert.ToInt32( Console.ReadLine());\n\n string[] A = Console.ReadLine().Split(' ');\n a = new int[n];\n for (int j = 0; j < n; j++)\n {\n a[j] = Convert.ToInt32(A[j]);\n }\n\n // 2. Find current difficulty\n int CurrentDifficulty = 0;\n for (int j = 1; j < n; j++) // a[1] --> a[n-1]\n {\n CurrentDifficulty = (CurrentDifficulty < (a[j] - a[j - 1])) ? (a[j] - a[j - 1]) : CurrentDifficulty;\n }\n\n int CurrentMinimalDifficultyAfterRemovingSingleHold = -1;\n int TempDifficulty = 0;\n for (int j = 2; j < n; j++) // a[2] --> a[n-1]\n {\n TempDifficulty = (CurrentDifficulty < (a[j] - a[j - 2])) ? (a[j] - a[j - 2]) : CurrentDifficulty;\n CurrentMinimalDifficultyAfterRemovingSingleHold = (CurrentMinimalDifficultyAfterRemovingSingleHold < 0) ? TempDifficulty : \n (CurrentMinimalDifficultyAfterRemovingSingleHold > TempDifficulty) ? TempDifficulty :\n CurrentMinimalDifficultyAfterRemovingSingleHold;\n\n }\n\n // 3. Print Answer\n Console.WriteLine(CurrentMinimalDifficultyAfterRemovingSingleHold);\n }\n static void Main(string[] args)\n {\n MimimumDifficulty();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberOfClues = int.Parse(Console.ReadLine());\n int[] arrOfClues = new int[numberOfClues];\n string[] strmas = (Console.ReadLine()).Split(' ');\n for (int i = 0; i < strmas.Length; i++)\n {\n arrOfClues[i] = int.Parse(strmas[i]);\n }\n int differense = 0, mindifferense = 0, z = 0;\n int numberOfProbabilities = numberOfClues - 2;\n int[] masdiff = new int[numberOfProbabilities];\n while (numberOfProbabilities != 0)\n {\n differense = 0;\n z = arrOfClues[numberOfProbabilities];\n arrOfClues[numberOfProbabilities] = 1001;\n for (int i = 1; i < arrOfClues.Length; i++)\n {\n if (arrOfClues[i] != 1001)\n {\n if (arrOfClues[i - 1] == 1001)\n {\n if ((arrOfClues[i] - arrOfClues[i - 2]) > differense)\n {\n differense = arrOfClues[i] - arrOfClues[i - 2];\n }\n }\n else\n {\n if ((arrOfClues[i] - arrOfClues[i - 1]) > differense)\n {\n differense = arrOfClues[i] - arrOfClues[i - 1];\n }\n }\n }\n }\n masdiff[numberOfProbabilities - 1] = differense;\n arrOfClues[numberOfProbabilities] = z;\n numberOfProbabilities--;\n }\n mindifferense = masdiff[0];\n for (int i = 0; i < masdiff.Length; i++) //\u0438\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\n {\n if (masdiff[i] < mindifferense)\n mindifferense = masdiff[i];\n }\n Console.WriteLine(mindifferense.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Task_TD\n{\n\n\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n\n int[] arr = new int[n];\n string[] lines = Console.ReadLine().Split();\n\n for (int i = 0; i < n; i++)\n {\n arr[i] = Int32.Parse(lines[i]);\n }\n\n Console.WriteLine(GetResult(n, arr));\n\n Console.ReadLine();\n }\n\n static int GetResult(int n, int[] arr)\n {\n int min = Int32.MaxValue;\n int max = 0;\n\n for (int i = 1; i < n; ++i)\n {\n if (i > 1)\n {\n min = Math.Min(min, arr[i] - arr[i - 2]);\n }\n\n max = Math.Max(max, arr[i] - arr[i - 1]);\n }\n\n int result = Math.Max(min, max);\n\n return result;\n }\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint size = Convert.ToInt32(Console.ReadLine());\n\t\t\tstring a = Console.ReadLine();\n\t\t\tString[] ai = a.Split(' ');\n\t\t\tint item =Sl(1, ai);\n\t\t\tfor (int i = 2; i < ai.Length - 1; i++)\n\t\t\t{\n\t\t\t\tif (Sl(i, ai) < item)\n\t\t\t\t{\n\t\t\t\t\titem = Sl(i, ai);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.Write(item);\n\t\t}\n\n\t\tstatic int Sl(int j, String[] ai)\n\t\t{\n\t\t\tint item = 0;\n\t\t\tList list = new List(ai);\n\t\t\tlist.RemoveAt(j);\n\t\t\tfor (int i = 0; i < list.Count - 1; i++)\n\t\t\t{\n\t\t\t\tif (Convert.ToInt32(list[i + 1]) - Convert.ToInt32(list[i]) > item) \n\t\t\t\t{\n\t\t\t\t\titem = Convert.ToInt32(list[i + 1]) - Convert.ToInt32(list[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn item;\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Round_283\n{\n class Program\n {\n static void Main(string[] args)\n {\n MinimumDifficulty md = new MinimumDifficulty();\n md.Test();\n }\n }\n class MinimumDifficulty\n {\n int Cost(int[] a)\n {\n int num = 0;\n int cost2 = dif2(a, out num);\n int cost1 = dif1(a, num,cost2);\n return cost1 > cost2 ? cost1 : cost2;\n }\n int dif1(int[] a,int num,int MinCost)\n {\n for(int i=0;i= ans)\n continue;\n mi = i - 1;\n ans = a[i] - a[i - 2];\n }\n a[mi] = a[mi - 1];\n for(int i = 1; i < n; i++) {\n ans = Math.Max(a[i] - a[i - 1], ans);\n }\n writer.WriteLine(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();\n var b = new int[n-2];\n var c = new int[n-1];\n for(int i=0;i num = new List();\n if (isReadable)\n {\n nums = Console.ReadLine().Split(' ');\n }\n foreach(string s in nums)\n {\n num.Add(Convert.ToInt32(s));\n }\n\n long min = long.MaxValue;\n long v = 0; \n for (int i = 1; i < nums.Length - 1; i++)\n { \n v = getDiff(num.ToArray(), i);\n if (min > v)\n {\n min = v;\n }\n }\n\n Console.WriteLine(min);\n Console.ReadLine();\n \n }\n\n public static long getDiff(int[] num, int j)\n {\n long ans = long.MinValue;\n for (int i = 1; i < num.Length; i++)\n {\n if (i == j)\n {\n ans = Math.Max(ans, num[i + 1] - num[i - 1]); \n }\n else if (i == j + 1)\n {\n //\n }\n else\n {\n ans = Math.Max( ans, num[i] - num[i - 1]);\n }\n }\n return ans;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n int ans = int.MaxValue;\n for (int i = 1; i + 1 < n; i++)\n {\n var b = a.Take(i).Concat(a.Skip(i + 1)).ToArray();\n int max = 0;\n for (int j = 1; j + 1 < n; j++)\n max = Math.Max(max, b[j] - b[j - 1]);\n ans = Math.Min(ans, max);\n }\n\n return ans;\n\n return null;\n }\n\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"game.in\");\n //writer = new StreamWriter(\"game.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n\n static int[,] matrix;\n static int[] mark;\n\n static void DFS(int v)\n {\n\n mark[v] = 1;\n for (int i = 0; i < matrix.GetLength(0); i++)\n {\n\n if (matrix[v, i] == 1)\n {\n\n if (mark[v] == 0)\n {\n DFS(i);\n }\n }\n }\n\n }\n static bool IsPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static void IsYesNo(bool b)\n {\n if (b)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n string[] s = Console.ReadLine().Split();\n int[] m = new int[n];\n for (int i = 0; i < n; i++)\n {\n m[i] = int.Parse(s[i]);\n }\n int[] cnt = new int[n - 1];\n for (int i = 0; i < n - 1; i++)\n {\n cnt[i] = m[i + 1] - m[i];\n }\n /*for (int i = 0; i < cnt.Length; i++)\n {\n Console.Write(cnt[i]+\" \");\n }*/\n int ans = int.MaxValue;\n int max = -1;\n for (int i = 0; i < cnt.Length - 1; i++)\n {\n max = cnt[i] + cnt[i + 1];\n\n for (int e = 0; e < cnt.Length; e++)\n {\n\n max = Math.Max(max, cnt[e]);\n\n\n }\n ans = Math.Min(max, ans);\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] mass = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n List d = new List();\n if (n == 3) { Console.Write(mass[2] - mass[0]); return; }\n int d_max = 0;\n for(int i = 1; i < n - 1; i++)\n {\n List list = mass.ToList();\n list.Remove(mass[i]);\n for(int j = 1; j < list.Count; j++)\n {\n if (d_max < list[j] - list[j - 1]) d_max = list[j] - list[j - 1];\n }\n d.Add(d_max);\n d_max = 0;\n }\n Console.Write(d.Min());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n int n = Int32.Parse(Console.ReadLine()), max = 0, prom;\n int[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n List mas = new List(n);\n List mas1 = new List(n), end = new List();\n for (int i = 0; i < n; i++) {\n mas.Add(arr[i]);\n }\n for (int i = 1; i < (n - 1); i++) {\n mas.Remove(arr[i]);\n int[] arr1 = mas.ToArray();\n for (int j = 1; j < arr1.Length; j++)\n {\n prom = arr1[j] - arr1[j - 1];\n if (prom > max) max = prom;\n }\n end.Add(max);\n max = 0;\n mas = new List(n);\n for (int k = 0; k < n; k++)\n {\n mas.Add(arr[k]);\n }\n }\n Console.WriteLine(end.Min());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int[] num = new int[n];\n for (int i = 0; i < n-1; i++)\n {\n for (int j = 0; j < s.Length; j++)\n {\n if (s[j] == ' ')\n {\n num[i] = int.Parse(s.Substring(0, j));\n s = s.Substring(j + 1);\n break;\n }\n }\n }\n num[n - 1] = int.Parse(s);\n int min =1000000;\n for (int i = 0; i < n-2; i++)\n {\n if (num[i + 2] - num[i] < min)\n min = num[i + 2] - num[i];\n }\n for (int i = 1; i < n; i++)\n {\n if (num[i] - num[i - 1] > min)\n min = num[i] - num[i - 1];\n }\n Console.WriteLine(min);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();\n int minDiff = int.MaxValue;\n\n for(int i=1;i index != i).ToArray();\n minDiff = Math.Min(minDiff, d(newTrack));\n }\n\n Console.WriteLine(minDiff);\n }\n\n static int d(int[] track)\n {\n int max = 0;\n for(int i = 0; i < track.Length-1; i++)\n {\n if (track[i + 1] - track[i] > max) max = track[i + 1] - track[i];\n }\n return max;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\n\nnamespace fun\n{\n class Program\n {\n private static TextReader cin = Console.In;\n private static TextWriter cout = Console.Out;\n static void Main(string[] args)\n {\n string s = cin.ReadLine() ;\n int a = int.Parse(s.Split(' ')[0]);\n var t = Array.ConvertAll(cin.ReadLine().Split(' '), int.Parse);\n var ar = new ArrayList(t);\n var br = new ArrayList(t);\n int ans = 100000000;\n int m = -100000000;\n\n for (int i = 1; i+1 < a; i++)\n {\n ar.RemoveAt(i);\n m = -100000000;\n for(int j=0;j+1 mas = new List(n);\n List mas1 = new List(n), output = new List();\n for (int i = 0; i < n; i++)\n {\n mas.Add(arr[i]);\n }\n for (int i = 1; i < (n - 1); i++)\n {\n mas.Remove(arr[i]);\n int[] arr1 = mas.ToArray();\n for (int j = 1; j < arr1.Length; j++)\n {\n prom = arr1[j] - arr1[j - 1];\n if (prom > max) max = prom;\n }\n output.Add(max);\n max = 0;\n mas = new List(n);\n for (int k = 0; k < n; k++)\n {\n mas.Add(arr[k]);\n }\n }\n Console.WriteLine(output.Min());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List heights = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n int[] copyH = new int[n];\n heights.CopyTo(copyH);\n int min = 9999999;\n for (int i = 1; i < n-1; i++)\n {\n heights.RemoveAt(i);\n int aux = MaxDistance(heights, n - 1);\n if (aux < min)\n min = aux;\n heights = new List(copyH);\n }\n Console.WriteLine(min); \n }\n public static int MaxDistance(List arr, int n)\n {\n int max = -999999;\n for (int i = n-1; i > 0; i--)\n {\n if (arr[i] - arr[i - 1] > max)\n {\n max = arr[i] - arr[i - 1];\n }\n }\n return max;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (n == 3)\n {\n Console.WriteLine(a[2] - a[0]);\n return;\n }\n var difficulty = 0;\n var minimum = int.MaxValue;\n for (int i = 1; i < a.Length - 1; i++)\n {\n var seq = a.Where((value, index) => index != i).ToArray();\n difficulty = 0;\n for (int j = 1; j < seq.Length; j++)\n {\n difficulty = Math.Max(difficulty, seq[j] - seq[j - 1]);\n }\n minimum = Math.Min(minimum, difficulty);\n }\n Console.WriteLine(minimum);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace Contest\n{\n class CodeForces\n {\n static void Main(string[] args) {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();\n int min = int.MaxValue;\n for (int i = 1; i < arr.Count - 1; i++)\n {\n var arr1 = new List(arr);\n arr1.RemoveAt(i); \n int max = arr1[1] - arr1[0];\n for (int j = 2; j < arr1.Count; j++) \n max = Math.Max(arr1[j] - arr1[j-1], max);\n min = Math.Min(max, min);\n }\n Console.Write(min);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace Contest\n{\n class CodeForces\n {\n static void Main(string[] args) {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();\n int sum = int.MaxValue;\n for (int i = 1; i < arr.Count - 1; i++)\n {\n var arr1 = new List(arr);\n arr1.RemoveAt(i); \n int max = arr1[1] - arr1[0];\n for (int j = 2; j < arr1.Count; j++) \n max = Math.Max(arr1[j] - arr1[j-1], max);\n if (max < sum)\n sum = max;\n }\n Console.Write(sum);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces282\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0;i\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getInt();\n\t\t\tvar l = getList();\n\t\t\tvar pp = l[n - 1] - l[0];\n\t\t\tvar qq = l[1] - l[0];\n\t\t\tfor (var i = 2; i < n; ++i)\n\t\t\t{\n\t\t\t\tpp = Min(pp, l[i] - l[i - 2]);\n\t\t\t\tqq = Max(qq, l[i] - l[i - 1]);\n\t\t\t}\n\t\t\tConsole.WriteLine(Max(pp, qq));\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml.Schema;\n\nnamespace Igranje.CF283\n{\n class ProblemA\n {\n public static void Main(string[] varg)\n {\n int n = int.Parse(Console.ReadLine());\n string[] tok = Console.ReadLine().Split(new char[] {' '});\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(tok[i]);\n int minIndex = -1;\n int minDelta = Int32.MaxValue;\n for (int i = 0; i < n-2; i++)\n {\n if (a[i + 2] - a[i] < minDelta)\n {\n minDelta = a[i + 2] - a[i];\n minIndex = i + 1;\n }\n }\n\n int minDif = 0;\n for (int i = 0; i < n-1; i++)\n {\n if (a[i + 1] - a[i] > minDif && (i + 1) != minIndex)\n minDif = a[i + 1] - a[i];\n }\n \n if (minDelta>minDif) Console.WriteLine(minDelta);\n else Console.WriteLine(minDif);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _496A\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n int diff = int.MaxValue, maxDist = int.MinValue;\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n for (int i=1;i max1)\n {\n max1 = razn1[i];\n }\n }\n \n\n\n for (int i = 0; i < n - 2; i++)\n {\n if (razn2[i] > max2)\n {\n max2 = razn2[i];\n }\n }\n for (int i = 0; i < n - 2; i++) {\n if (razn1[i] == razn1[i + 1]) { count++;\n }\n }\n if ((count==n-2)||(n==3)){Console.WriteLine(max2);}\n else{\n if (max1 > max2) { Console.WriteLine(max2);}\n else { Console.WriteLine(max1); }\n \n } \n \n\n \n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0446\u0435\u043f\u043e\u043a \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 Enter \" +\n \"\\n\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0446\u0435\u043f\u043e\u043a \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 3 \u0434\u043e 100\");\n int n = int.Parse(Console.ReadLine());\n int[] mas = new int[n];\n Console.WriteLine(\n \"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u043e\u0442 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0438\u0441\u0442\u044f\u0442 \u0437\u0430\u0446\u0435\u043f\u043a\u0438.\" +\n \"\\n\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u0446\u0435\u043f\u043e\u043a\" +\n \"\\n\u0422\u0430\u043a \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c\");\n\n string[] strmas = (Console.ReadLine()).Split(' ');\n for (int i = 0; i < strmas.Length; i++)\n {\n mas[i] = int.Parse(strmas[i]);\n }\n int d = 0, mind = 0, z = 0;\n int kolver = n - 2;\n int[] masd = new int[kolver];\n while (kolver != 0)\n {\n d = 0;\n z = mas[kolver];\n mas[kolver] = 1001;\n for (int i = 1; i < mas.Length; i++)\n {\n if (mas[i] != 1001)\n {\n if (mas[i - 1] == 1001)\n {\n if ((mas[i] - mas[i - 2]) > d)\n {\n d = mas[i] - mas[i - 2];\n }\n }\n else\n {\n if ((mas[i] - mas[i - 1]) > d)\n {\n d = mas[i] - mas[i - 1];\n }\n }\n }\n }\n masd[kolver - 1] = d;\n mas[kolver] = z;\n kolver--;\n }\n mind = masd[0];\n for (int i = 0; i < masd.Length; i++) //\u0438\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\n {\n if (masd[i] < mind)\n mind = masd[i];\n }\n Console.WriteLine(mind.ToString());\n\n }\n }\n}"}, {"source_code": "using System;\n\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0446\u0435\u043f\u043e\u043a \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 Enter \" +\n \"\\n\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0446\u0435\u043f\u043e\u043a \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 3 \u0434\u043e 100\");\n var n = Convert.ToInt32(Console.ReadLine());\n int[] mas = new int[n];\n int s;\n Console.WriteLine(\n \"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0441\u043e\u0442 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0438\u0441\u0442\u044f\u0442 \u0437\u0430\u0446\u0435\u043f\u043a\u0438.\" +\n \"\\n\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u0446\u0435\u043f\u043e\u043a\" +\n \"\\n\u0422\u0430\u043a \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c\");\n string[] strmas = Console.ReadLine().Split(new char[] { ' ', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n for (s = 0; s < (n < strmas.Length ? n : strmas.Length); ++s)\n mas[s] = Convert.ToInt32(strmas[s]);\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432:\");\n for (s = 0; s< n; ++s)\n Console.Write(\"{0} \", mas[s]);\n\n for (int i = 0; i < strmas.Length; i++)\n {\n mas[i] = int.Parse(strmas[i]);\n }\n int d = 0, mind = 0, z = 0;\n int kolver = n - 2;\n int[] masd = new int[kolver];\n while (kolver != 0)\n {\n d = 0;\n z = mas[kolver];\n mas[kolver] = 1001;\n for (int i = 1; i < mas.Length; i++)\n {\n if (mas[i] != 1001)\n {\n if (mas[i - 1] == 1001)\n {\n if ((mas[i] - mas[i - 2]) > d)\n {\n d = mas[i] - mas[i - 2];\n }\n }\n else\n {\n if ((mas[i] - mas[i - 1]) > d)\n {\n d = mas[i] - mas[i - 1];\n }\n }\n }\n }\n masd[kolver - 1] = d;\n mas[kolver] = z;\n kolver--;\n }\n mind = masd[0];\n for (int i = 0; i < masd.Length; i++) //\u0438\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\n {\n if (masd[i] < mind)\n mind = masd[i];\n }\n Console.WriteLine(mind.ToString());\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _01\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n\n int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);\n int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;\n\n int temp1;\n int temp2;\n\n for (int i = 1; i < n - 2; i++)\n {\n temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);\n if (temp1 >= r2) r2 = temp1;\n temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);\n if (temp1 <= r2 && temp2 <= r2) r2 = temp2;\n }\n\n if (r1 > r2) r2 = r1;\n\n Console.WriteLine(r2);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _01\n{\n class Program1\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n\n int r1 = Int32.Parse(s[1]) - Int32.Parse(s[0]);\n int r2= Int32.Parse(s[2]) - Int32.Parse(s[0]);;\n\n int temp1;\n int temp2;\n\n for (int i = 1; i < n - 2; i++)\n {\n temp1 = Int32.Parse(s[i + 1]) - Int32.Parse(s[i]);\n if (temp1 >= r2) r2 = temp1;\n temp2 = Int32.Parse(s[i + 2]) - Int32.Parse(s[i]);\n if (temp1 <= r2 && temp2 <= r2) r2 = temp2;\n }\n\n temp1 = Int32.Parse(s[n - 1]) - Int32.Parse(s[n - 2]);\n if (temp1 > r2) r2 = temp1;\n if (r1 > r2) r2 = r1;\n\n Console.WriteLine(r2);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass CF_496A\n{\n static int Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n string[] snums = line.Split(new char[] { ' ' });\n List nums = new List();\n foreach (var snum in snums)\n {\n nums.Add(Convert.ToInt32(snum));\n }\n int result = new CF_496A().solve(nums.ToArray());\n Console.WriteLine(result);\n return 0;\n }\n\n public int solve(int[] holds)\n {\n int[] diffs = new int[holds.Length];\n int pn = 0;\n for (int i = 0; i < holds.Length; i++)\n {\n diffs[i] = holds[i] - pn;\n pn = holds[i];\n }\n\n int min = 1;\n for (int i = 2; i < diffs.Length; i++)\n {\n if (diffs[i] < diffs[min])\n min = i;\n }\n if (min == (diffs.Length - 1)) min--;\n diffs[min] += diffs[min + 1];\n int max = diffs[1];\n for (int i = 2; i < diffs.Length; i++)\n {\n if (diffs[i] > max)\n max = diffs[i];\n }\n return max;\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using NUnit.Framework;\n\n [TestFixture]\n class Test_CF_496A\n {\n [Test]\n public void Test1()\n {\n int[] nums = { 1, 4, 6 };\n Assert.AreEqual(5, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test2()\n {\n int[] nums = { 1, 2, 3, 4, 5 };\n Assert.AreEqual(2, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test3()\n {\n int[] nums = { 1, 2, 3, 7, 8 };\n Assert.AreEqual(4, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test4()\n {\n int[] nums = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 };\n Assert.AreEqual(19, new CF_496A().solve(nums));\n }\n }\n}\n#endif"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass CF_496A\n{\n static int Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string line = Console.ReadLine();\n string[] snums = line.Split(new char[] { ' ' });\n List nums = new List();\n foreach (var snum in snums)\n {\n nums.Add(Convert.ToInt32(snum));\n }\n int result = new CF_496A().solve(nums.ToArray());\n Console.WriteLine(result);\n return 0;\n }\n\n public int solve(int[] holds)\n {\n int[] diffs = new int[holds.Length];\n int pn = 0;\n for (int i = 0; i < holds.Length; i++)\n {\n diffs[i] = holds[i] - pn;\n pn = holds[i];\n }\n\n int min = 1;\n for (int i = 2; i < diffs.Length; i++)\n {\n if (diffs[i] < diffs[min])\n min = i;\n }\n if (min == (diffs.Length - 1)) min--;\n diffs[min] += diffs[min + 1];\n int max = diffs[1];\n for (int i = 2; i < diffs.Length - 1; i++)\n {\n if (diffs[i] > max)\n max = diffs[i];\n }\n return max;\n }\n}\n\n#if !ONLINE_JUDGE\nnamespace CodeForces\n{\n using NUnit.Framework;\n\n [TestFixture]\n class Test_CF_496A\n {\n [Test]\n public void Test1()\n {\n int[] nums = { 1, 4, 6 };\n Assert.AreEqual(5, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test2()\n {\n int[] nums = { 1, 2, 3, 4, 5 };\n Assert.AreEqual(2, new CF_496A().solve(nums));\n }\n\n [Test]\n public void Test3()\n {\n int[] nums = { 1, 2, 3, 7, 8 };\n Assert.AreEqual(4, new CF_496A().solve(nums));\n }\n }\n}\n#endif"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long min = a[1]-a[0];\n for (int i = 1; i < n-1; i++)\n {\n long d = a[i + 1] - a[i - 1];\n min = Math.Max(min, d);\n }\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long min = long.MaxValue;\n for (int i = 1; i < n-1; i++)\n {\n long d = a[i + 1] - a[i - 1];\n min = Math.Max(min, d);\n }\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Square\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long min = long.MaxValue;\n for (int i = 1; i < n-1; i++)\n {\n long d = a[i + 1] - a[i - 1];\n min = Math.Min(min, d);\n }\n Console.WriteLine(min);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces26\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\t\t\tint min = 1000;\n\t\t\tfor (int i = 0; i < n - 2; i++) \n\t\t\t\tif (Math.Abs(data[i + 2] - data[i]) < min) min = Math.Abs(data[i + 2] - data[i]);\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces26\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\t\t\tint min = 1000;\n\t\t\tint max = 0;\n\t\t\tfor (int i = 1; i max) max = datanew[j + 1] - datanew[j];\n\t\t\t\tif (max < min) min = max;\n\t\t\t}\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces26\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint[] data = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\t\t\tint min = 0;\n\t\t\tif (data.Length == 3) min = data[2] - data[0];\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor (int i = 0; i < n - 1; i++)\n\t\t\t\t\tif (data[i + 1] - data[i] > min) min = data[i + 1] - data[i];\n\t\t\t}\n\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int minim = 10000, minimNormal = 10000;\n for (int i = 1; i < n; i++) {\n if (v[i] - v[i - 1] < minimNormal)\n minimNormal = v[i] - v[i - 1];\n }\n for (int i = 1; i < n - 1; i++) {\n int dif = v[i + 1] - v[i - 1];\n if (dif < minim)\n minim = dif;\n }\n Console.WriteLine(Math.Max(minim,minimNormal));\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int minim = 10000;\n for (int i = 1; i < n - 1; i++) {\n int dif = v[i + 1] - v[i - 1];\n if (dif < minim)\n minim = dif;\n }\n Console.WriteLine(minim);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace code_forces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n bool isReadable = int.TryParse(Console.ReadLine(), out n);\n string[] nums = new string[n];\n List num = new List();\n if (isReadable)\n {\n nums = Console.ReadLine().Split(' ');\n }\n foreach(string s in nums)\n {\n num.Add(Convert.ToInt32(s));\n }\n\n long min = long.MaxValue;\n long v = 0; \n for (int i = 1; i < nums.Length - 1; i++)\n { \n v = getDiff(num.ToArray(), i);\n if (min > v)\n {\n min = v;\n }\n }\n\n Console.WriteLine(min);\n \n }\n\n public static long getDiff(int[] num, int j)\n {\n long ans = 0;\n for (int i = 1; i < num.Length; i++)\n {\n if (i == j)\n {\n ans += num[i + 1] - num[i - 1]; \n }\n else\n {\n ans += num[i]-num[i-1];\n }\n }\n return ans;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n int n = Int32.Parse(Console.ReadLine()), max = 0, prom;\n int[] arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n List mas = new List(n);\n List mas1 = new List(n), end = new List();\n for (int i = 0; i < n; i++) {\n mas.Add(arr[i]);\n mas1.Add(arr[i]);\n }\n for (int i = 1; i < (n - 1); i++) {\n mas.Remove(arr[i]);\n int[] arr1 = mas.ToArray();\n for (int j = 1; j < arr1.Length; j++) {\n prom = arr1[j] - arr1[j - 1];\n if (prom > max) max = prom;\n }\n end.Add(max);\n max = 0;\n mas = mas1;\n }\n Console.WriteLine(end.Min());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\n\nnamespace fun\n{\n class Program\n {\n private static TextReader cin = Console.In;\n private static TextWriter cout = Console.Out;\n static void Main(string[] args)\n {\n string s = cin.ReadLine() ;\n int a = int.Parse(s.Split(' ')[0]);\n var t = Array.ConvertAll(cin.ReadLine().Split(' '), int.Parse);\n var ar = new ArrayList(t);\n var br = new ArrayList(t);\n int ans = 100000000;\n int m = -100000000;\n\n for (int i = 1; i+1 < a; i++)\n {\n ar.RemoveAt(i);\n for(int j=0;j+1 index != i).ToArray();\n difficulty = 0;\n for (int j = 1; j < seq.Length; j++)\n {\n difficulty = Math.Max(difficulty, seq[j] - seq[j - 1]);\n }\n minimum = Math.Min(minimum, difficulty);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nnamespace Contest\n{\n class CodeForces\n {\n static void Main(string[] args) {\n int n = Convert.ToInt32(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();\n int sum = int.MaxValue;\n for (int i = 1; i < arr.Count - 1; i++)\n {\n var arr1 = new List(arr);\n int acum = 0;\n arr1.RemoveAt(i); \n for (int j = 1; j < arr1.Count; j++)\n acum += arr1[j] - arr1[j - 1];\n if (acum < sum)\n sum = acum; \n \n }\n Console.Write(sum);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces282\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0;i Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]))\n {\n minimum = Convert.ToInt32(split[i + 2]) - Convert.ToInt32(split[i]);\n }\n }\n Console.WriteLine(minimum);\n\n \n }\n\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _19._12\n{\n class Program\n {\n static int Sunm(List a, int k)\n {\n a.RemoveAt(k);\n int max = 0;\n for (int i = 0; i < a.Count-1; i++)\n {\n if (a[i + 1] - a[i] > max) max = a[i + 1] - a[i];\n }\n return max;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List a = new List();\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n for (int i = 0; i < n; i++)\n {\n a.Add(Convert.ToInt32(ss[i]));\n }\n int max = 0;\n int min = 10000;\n for (int i = 1; i < a.Count-1; i++)\n {\n max = Sunm(a, i);\n if (max < min) min = max;\n }\n Console.WriteLine(min);\n }\n }\n}\n"}], "src_uid": "8a8013f960814040ac4bf229a0bd5437"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Media;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string alph = \"abcdefghijklmnopqrstuvwxyz\";\n string[] y = Console.ReadLine().Split(' ');\n int a = int.Parse(y[1]);\n string b = Console.ReadLine();\n int[] alf = new int[b.Length];\n for (int i = 0; i < b.Length; i++)\n {\n for (int j = 0; j < alph.Length; j++)\n {\n if (b[i] == alph[j])\n {\n alf[i] = j + 1;\n break;\n }\n }\n }\n int ii = 1;\n int h = 0;\n int sum = 0;\n int max = -1;\n bool g = false;\n Array.Sort(alf);\n for (int i = 0; i < b.Length; i++)\n {\n\n if ((alf[i] - max) > 1)\n {\n //ii = i - 1;\n max = alf[i];\n //if (g == false)\n //{\n // sum = 0;\n // g = true;\n //}\n \n sum += alf[i];\n h++;\n //Console.Write(alf[i]);\n //Console.Write(\" \");\n }\n if (h == a)\n break;\n }\n\n //sum++;\n if (h < a)\n Console.Write(-1);\n else\n Console.Write(sum);\n //Console.ReadKey();\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n char[] str = Console.ReadLine().OrderBy(x => x).ToArray();\n if (nm[1]==1)\n {\n Console.WriteLine((1 + str[0] - 'a'));\n return;\n }\n int count = 0;\n int weitgh = 0;\n for (int i = 0; i < nm[0]; i++)\n {\n weitgh = 1 + str[i] - 'a';\n count = 1;\n int pos = i;\n\n for (int k = i + 1; k < nm[0]; k++)\n {\n if (count < nm[1] && str[pos] + 1 < str[k])\n {\n weitgh += 1 + str[k] - 'a';\n count++;\n pos = k;\n }\n if (count == nm[1])\n {\n Console.WriteLine(weitgh);\n return;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n { \n static void Main(string[] args)\n {\n bool[] db;\n int res = 0, k;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r', ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n k = int.Parse(input[1]);\n input[0] = input[1] = null;\n db = new bool[27];\n for (int i = 0; i < input[2].Length;)\n db[input[2][i++]-96] = true;\n }\n for(int i = 1; k>0;)\n {\n if (i >= db.Length) break;\n for(; i 0 ? -1 : res);\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _1011A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n bool[] available = Enumerable.Repeat(false, 26).ToArray();\n foreach (char c in Console.ReadLine())\n {\n available[c - 'a'] = true;\n }\n\n int[] length = new int[26];\n int[] weight = new int[26];\n\n for (int i = 0; i < 26; i++)\n {\n length[i] = 0;\n weight[i] = 0;\n\n if (available[i])\n {\n for (int j = 0; j <= i - 2; j++)\n {\n if (length[j] > length[i])\n {\n length[i] = length[j];\n weight[i] = weight[j];\n }\n else if (length[j] == length[i] && weight[j] < weight[i])\n {\n weight[i] = weight[j];\n }\n }\n\n length[i]++;\n weight[i] += i + 1;\n\n if (length[i] == k)\n {\n Console.WriteLine(weight[i]);\n return;\n }\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n private static int n, k;\n private static bool[] c = new bool[26];\n private static string t;\n\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n n = int.Parse(s[0]); k = int.Parse(s[1]);\n t = Console.ReadLine();\n for (int i = 0; i < t.Length; ++i)\n {\n c[t[i] - 'a'] = true;\n }\n int ans = 0;\n int last = -2;\n for (int i = 0; i < 26 && k > 0; ++i)\n {\n if (c[i] == true && i - last >= 2)\n {\n ans += i + 1;\n last = i;\n k--;\n }\n }\n if (k > 0)\n ans = -1;\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nclass Program\n{\n public static void Main(string[] args)\n {\n int[] inputs = Console.ReadLine().Split().Select(w => Convert.ToInt32(w)).ToArray();\n string stages = new string (Console.ReadLine().OrderBy(c => c).ToArray());\n char current = stages[0];\n StringBuilder sb = new StringBuilder();\n sb.Append(current);\n //Console.WriteLine(stages);\n for(int i = 1;i= 2) {sb.Append(stages[i]); current = stages[i];}\n if(sb.ToString().Length < inputs[1]) Console.WriteLine(-1); else\n Console.WriteLine(sb.ToString().Substring(0,inputs[1]).Select(w => Convert.ToInt32(w) - 'a' + 1).Aggregate((a,b) => a+b));\n \n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine().Split(' ');\n var n = int.Parse(data[0]);\n var k = int.Parse(data[1]);\n var steps = Console.ReadLine().ToCharArray();\n Array.Sort(steps);\n var result = 0;\n var j = 0;\n var temp = steps[0];\n\n for (var i = 0; i < n && j < k; i++)\n {\n if (i == 0)\n {\n result += steps[0] - 96;\n j++;\n }\n else if (steps[i] > temp + 1)\n {\n result += steps[i] - 96;\n temp = steps[i];\n j++;\n }\n }\n if (j < k)\n Console.WriteLine(-1);\n else\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nk = Console.ReadLine().Split().Select(t => int.Parse(t)).ToArray();\n int n = nk[0];\n int k = nk[1];\n List s = new List(Console.ReadLine());\n s.Sort();\n char last = s[0];\n int j = 1;\n int a = 'a';\n int tons = s[0] - a + 1;\n for (int i = 1; i < n && j < k; i++)\n {\n if (s[i] - last < 2)\n continue;\n\n last = s[i];\n tons += s[i] - a + 1;\n j++;\n }\n\n if (j == k)\n Console.WriteLine(tons);\n else\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n Scanner sc = new Scanner();\n //\n\n public void Solve()\n {\n int n, k;\n sc.Make(out n, out k);\n var s = ReadLine().ToCharArray().Select(v=>(int)v-'a'+1).ToArray();\n Array.Sort(s);\n var last = -2;var ct = 0;var res = 0;\n for(var i = 0; i < n; i++)\n {\n if (last + 1 >= s[i])\n continue;\n res += s[i];\n last = s[i];\n ct++;\n if (ct == k) Fail(res);\n }\n WriteLine(-1);\n }\n}\n\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T num, T val) where T : IComparable\n { if (num.CompareTo(val) == 1) { num = val; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T num, T val) where T : IComparable\n { if (num.CompareTo(val) == -1) { num = val; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T v1, ref T v2)\n { var t = v2; v2 = v1; v1 = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString()\n => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString()\n => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n //a = 97, z = 122\n var nums = Console.ReadLine().Split();\n int n = int.Parse(nums[0]);\n int k = int.Parse(nums[1]);\n\n char[] chs = Console.ReadLine().ToCharArray();\n\n chs = chs.OrderBy(ch => ch).ToArray();\n\n int sum = chs[0] - 96;\n int q = 1;\n\n for (int i = 0; i < n - 1 && q < k; i++)\n {\n for (int j = i + 1; j < n; j++)\n {\n char c1 = chs[i];\n char c2 = chs[j];\n\n if (chs[j] - chs[i] >= 2)\n {\n sum += chs[j] - 96;\n q++;\n i = j - 1;\n break;\n }\n }\n }\n \n if (q == k)\n Console.WriteLine(sum);\n else\n Console.WriteLine(-1);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Stages\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int[] n = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n char[] s = reader.ReadLine().Distinct().OrderBy(t => t).ToArray();\n\n int sum = 0;\n int cnt = 0;\n var prev = (char) 1;\n foreach (char c in s)\n {\n if (c - prev > 1)\n {\n sum += c - 'a' + 1;\n prev = c;\n cnt++;\n if (cnt == n[1])\n break;\n }\n }\n if (cnt != n[1])\n return -1;\n\n return sum;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring[]s=Console.ReadLine().Split();\n\t\tint n=int.Parse(s[0]);\n\t\tint k=int.Parse(s[1]);\n\t\tstring now=Console.ReadLine();\n\t\tchar[]cc=now.ToCharArray();\n\t\tArray.Sort(cc);\n\t\tnow=new string(cc);\n\t\tbool no=false;\n\t\tint done=(int)(now[0]-'a')+1;\n\t\tint count=1;\n\t\tfor(int i=0;i=2)\n\t\t\t\t{\n\t\t\t\t\tind=j;break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(ind==-1)\n\t\t\t{\n\t\t\t\tno=true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\tdone+=(int)(now[ind]-'a')+1;\n\t\t\t\ti=ind;\t\t\n\t\t\t}\n\t\t}\n\t\tif(no || count!=k)Console.WriteLine(-1);\n\t\telse Console.WriteLine(done);\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n public class test\n {\n public static void Main()\n {\n var A = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse);\n\n int N = A[0];\n int K = A[1];\n\n var s = Console.ReadLine();\n\n var res = s.Distinct().OrderBy(x => x).ToList();\n int i = 0;\n int w = 0;\n char prev = res[0];\n w += (res[0] - 'a') + 1;\n i = 1;\n int used = 1;\n\n while (used < K)\n {\n if (i < res.Count)\n {\n if (res[i] - prev > 1)\n {\n w += (res[i] - 'a') + 1;\n prev = res[i];\n used++;\n }\n }\n else\n {\n Console.WriteLine(-1);\n return;\n }\n\n i++;\n }\n\n Console.WriteLine(w);\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int intTemp = Convert.ToInt32(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n string str = Console.ReadLine();\n int noStage = Convert.ToInt32(input[0]);\n int useStage = Convert.ToInt32(input[1]);\n List strarr = str.ToList();\n strarr = strarr.Distinct().ToList();\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n strarr.Sort();\n for (int i = 0; i < strarr.Count - 1; i++)\n {\n if ((int)strarr[i + 1] - (int)strarr[i] == 0 || (int)strarr[i + 1] - (int)strarr[i] == 1)\n {\n strarr.RemoveAt(i + 1);\n }\n }\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(strarr.Take(useStage).Sum(c => (int)c - 96));\n }\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, k;\n string input = Console.ReadLine();\n n = int.Parse(input.Split(' ')[0]);\n k = int.Parse(input.Split(' ')[1]);\n input = Console.ReadLine();\n int[] arr = new int[26];\n for (int i = 0; i < n; i++)\n {\n arr[input[i] - 'a']++;\n }\n\n int ot = 0, sum = 0;\n for (int i = 0; i < 26; i++)\n {\n if (ot > 0)\n {\n ot--;\n continue;\n }\n if (int.Parse(arr[i].ToString()) != 0)\n {\n k--;\n sum += i + 1;\n ot += 1;\n }\n if (k == 0) break;\n }\n if (k > 0) Console.WriteLine(-1);\n else\n {\n Console.WriteLine(sum);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint[] nk = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n\t\t\tstring s = Console.ReadLine();\n\t\t\tchar[] stages = s.ToCharArray();\n\t\t\tArray.Sort(stages);\n\t\t\tint min = (int)(stages[0] - 'a')+1;\n\t\t\tchar last = stages[0];\n\t\t\tint number = 1;\n\t\t\tif (nk[1] > 1)\n\t\t\t{\n\t\t\t\tfor (int i = 1; i < nk[0]; i++)\n\t\t\t\t{\n\t\t\t\t\tif ((int)stages[i] > ((int)last) + 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin += (int)(stages[i] - 'a') + 1;\n\t\t\t\t\t\tlast = stages[i];\n\t\t\t\t\t\tnumber++;\n\t\t\t\t\t\tif (number == nk[1])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(min);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (number < nk[1])\n\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\telse\n\t\t\t\tConsole.WriteLine(min);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing static CF.ReadNext;\n\nnamespace CF\n{\n public static class Program\n {\n private static void Main()\n {\n var n = NextInt();\n var k = NextInt();\n var chars = NextWord().ToCharArray();\n chars = chars.OrderBy(x => x).ToArray();\n\n var result = chars[0].ToString();\n var j = 0;\n for (var i = 1; i < chars.Length; i++)\n {\n if (j == k - 1)\n {\n var ans = 0;\n foreach (var c in result)\n {\n ans += c - 'a' + 1;\n }\n\n Console.WriteLine(ans);\n return;\n }\n\n if (chars[i] - result[j] >= 2)\n {\n result += chars[i];\n j++;\n }\n }\n\n if (j == k - 1)\n {\n var ans = 0;\n foreach (var c in result)\n {\n ans += c - 'a' + 1;\n }\n\n Console.WriteLine(ans);\n return;\n }\n\n Console.WriteLine(\"-1\");\n\n }\n }\n\n public static class ReadNext\n {\n public static int NextInt()\n {\n var next = ReadUntilSpace();\n return int.Parse(next);\n }\n\n public static double NextDouble()\n {\n var next = ReadUntilSpace();\n return double.Parse(next);\n }\n\n public static string NextWord()\n {\n return ReadUntilSpace();\n }\n\n private static bool IsWhiteSpace(int n)\n {\n return n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1;\n }\n\n private static string ReadUntilSpace()\n {\n var result = \"\";\n\n var n = Console.Read();\n // read whitespace \n while (IsWhiteSpace(n))\n {\n n = Console.Read();\n }\n\n // read characters\n while (!IsWhiteSpace(n))\n {\n result += (char)n;\n n = Console.Read();\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\nusing System.Collections;\n\n// binary search --> use inclusive bounds and condition <= \nnamespace CodePractice\n{\n public class Program\n {\n public static void Main()\n {\n ConsoleReader r = new ConsoleReader();\n TextWriter w = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n Solve(r, w);\n w.Close();\n //Console.ReadKey();\n }\n\n public static void Solve(ConsoleReader reader, TextWriter writer)\n {\n A(reader, writer);\n }\n\n public static void C(ConsoleReader reader, TextWriter writer)\n {\n B(reader, writer);\n }\n\n public static void B(ConsoleReader reader, TextWriter writer)\n {\n A(reader, writer);\n }\n\n public static void A(ConsoleReader reader, TextWriter writer)\n {\n int n = reader.NextInt(), k = reader.NextInt();\n char[] stages = reader.NextString().ToCharArray();\n Array.Sort(stages);\n\n int cost = stages[0] - 'a' + 1;\n int stage = 1, lastStage = 0;\n\n\n for(int i = 1; i < n; i++)\n {\n if (stage == k)\n break;\n if (stages[i] - stages[lastStage] > 1)\n {\n cost += stages[i] - 'a' + 1;\n lastStage = i;\n stage++;\n }\n }\n\n if (stage == k)\n Console.WriteLine(cost);\n else\n Console.WriteLine(\"-1\");\n }\n }\n\n\n\n public class ConsoleReader\n {\n private String[] data;\n private int wordIndex = 0;\n\n private void ReadLineIfNeeded()\n {\n while (data == null || wordIndex >= data.Length)\n {\n wordIndex = 0;\n data = Console.ReadLine().Trim().Split();\n }\n }\n\n public long NextLong()\n {\n ReadLineIfNeeded();\n return long.Parse(data[wordIndex++]);\n }\n\n public int NextInt()\n {\n ReadLineIfNeeded();\n return int.Parse(data[wordIndex++]);\n }\n\n public void NextArray(long[] a, int n)\n {\n for (int i = 0; i < n; i++)\n {\n a[i] = NextLong();\n }\n }\n\n public void NextArray(int[] a, int n)\n {\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n }\n\n public string NextString()\n {\n ReadLineIfNeeded();\n return data[wordIndex++];\n }\n\n //ReadLine()\n\n }\n\n}"}, {"source_code": "// Codeforces.ConsoleTemplate.CSharp\n// https://www.nuget.org/packages/Codeforces.ConsoleTemplate.CSharp\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace A\n{\n public class Solution\n {\n public void Execute()\n {\n var (n, k) = ReadTwoInt;\n var s = ReadLine;\n\n var a = s.Select(x => (int)(x - 'a' + 1)).ToArray();\n Array.Sort(a);\n var result = 0;\n var count = 0;\n var last = int.MinValue;\n for (var i = 0; i < a.Length; ++i)\n {\n if (a[i] > last + 1)\n {\n result += a[i];\n last = a[i];\n ++count;\n }\n if (count == k)\n {\n break;\n }\n }\n\n if (count == k)\n {\n WriteLine(result);\n }\n else\n {\n WriteLine(-1);\n }\n }\n\n private StreamReader reader;\n private StreamWriter writer;\n\n public Solution(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\t\t\n private string ReadLine => reader.ReadLine();\n private int ReadInt => ReadLine.ToInt();\n private long ReadLong => ReadLine.ToLong();\n private double ReadDouble => ReadLine.ToDouble();\n private T Read() => (T)Convert.ChangeType(ReadLine, typeof(T));\n\n private (T, T) ReadTwo(char c = ' ') => Reads(c).ToTwoTuple();\n private (int, int) ReadTwoInt => ReadTwo();\n private (long, long) ReadTwoLong => ReadTwo();\n private (double, double) ReadTwoDouble => ReadTwo();\n\n private (T, T, T) ReadThree(char c = ' ') => Reads(c).ToThreeTuple();\n private (int, int, int) ReadThreeInt => ReadThree();\n private (long, long, long) ReadThreeLong => ReadThree();\n private (double, double, double) ReadThreeDouble => ReadThree();\n\n private string[] Split(char c = ' ') => ReadLine.Split(c);\n private T[] Reads(char c = ' ') => Split(c).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();\n private int[] ReadInts => Split().Select(int.Parse).ToArray();\n private long[] ReadLongs => Split().Select(long.Parse).ToArray();\n private double[] ReadDoubles => Split().Select(double.Parse).ToArray();\n\n private void Write(T s) => writer.Write(s);\n private void WriteLine(T s) => writer.WriteLine(s);\n\n private static T SetGreater(ref T a, ref T b) where T : IComparable\n {\n SetLess(ref b, ref a);\n return a;\n }\n\n private static T SetLess(ref T a, ref T b) where T : IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n Swap(ref a, ref b);\n }\n return a;\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = b;\n b = a;\n a = temp;\n }\n }\n\n public class Program\n {\n public static void Main(string[] args)\n {\n CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;\n\n // Change the stack size to avoid stack overflow.\n // e.g. stackSizeMb = 128.\n var stackSizeMb = 0;\n\n if (args.Length > 0 && args.First() == \"test\")\n {\n if (args.Length > 1)\n {\n Test(args[1], true);\n }\n else\n {\n for (var i = 0; i < 10 && Test(i.ToString()); ++i);\n }\n }\n else\n {\n var reader = new StreamReader(Console.OpenStandardInput());\n var writer = new StreamWriter(Console.OpenStandardOutput());\n Run(reader, writer, stackSizeMb);\n }\n }\n\n private static bool Test(string name, bool show = false)\n {\n var test = $\"in{name}.txt\";\n if (File.Exists(test))\n {\n var reader = new StreamReader(test);\n var output = new MemoryStream();\n var writer = new StreamWriter(output);\n Run(reader, writer);\n \n var expect = new StreamReader($\"out{name}.txt\").ReadToEnd()\n .Replace(\"\\r\\n\", \"\\n\").Replace(\"\\r\", \"\\n\").Replace(\"\\n\", \"\\r\\n\");\n var actual = Encoding.UTF8.GetString(output.ToArray());\n \n if (show)\n {\n Console.WriteLine(actual);\n }\n\n if (actual.TrimEnd() == expect.TrimEnd())\n {\n WriteLine($\"Test {name} passed.\", ConsoleColor.Green);\n }\n else\n {\n WriteLine($\"Test {name} failed.\", ConsoleColor.Red);\n }\n\n return true;\n }\n return false;\n }\n\n private static void Run(StreamReader reader, StreamWriter writer, int stackSize = 0)\n {\n var solution = new Solution(reader, writer);\n if (stackSize == 0)\n {\n solution.Execute();\n }\n else\n {\n var thread = new Thread(solution.Execute, stackSize * 1024 * 1024);\n thread.Start();\n thread.Join();\n }\n writer.Flush();\n }\n\n private static void WriteLine(string s, ConsoleColor color)\n {\n Console.ForegroundColor = color;\n Console.WriteLine(s);\n Console.ResetColor();\n }\n }\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable enumeration, Action action)\n {\n foreach(T item in enumeration)\n {\n action(item);\n }\n }\n\n public static (T, T) ToTwoTuple(this IList list) => (list[0], list[1]);\n public static (T, T, T) ToThreeTuple(this IList list) => (list[0], list[1], list[2]);\n public static int ToInt(this string s) => int.Parse(s);\n public static long ToLong(this string s) => long.Parse(s);\n public static double ToDouble(this string s) => double.Parse(s);\n public static string Merge(this IEnumerable enumeration, string split = \" \") => string.Join(split, enumeration);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace StupidSolution\n{\n static class Program\n {\n\n static int Main()\n {\n int n, k;\n String line = Console.ReadLine();\n var parts = line.Split(' ');\n n = int.Parse(parts[0]);\n k = int.Parse(parts[1]);\n String letters = Console.ReadLine();\n letters = new string(letters.OrderBy(c => c).ToArray());\n for(int i=0;i 1)\n {\n last = (int)letters[j];\n sum += last - 'a' + 1;\n taken++;\n if (taken == k)\n {\n Console.WriteLine(sum);\n return 0;\n }\n }\n }\n Console.WriteLine(-1);\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF1011B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int totNums, totNeed;\n string inp;string[] div;\n\n inp = Console.ReadLine();div = inp.Split(' ');\n totNums = Convert.ToInt32(div[0]);totNeed = Convert.ToInt32(div[1]);\n inp = Console.ReadLine();\n int[] num = new int[totNums];\n for (int i = 0; i < totNums; i++)\n num[i] = inp[i] - 'a' + 1;\n\n Array.Sort(num);\n int _count = num[0], lastChoose = num[0];totNeed--;\n for(int i = 1; i < totNums; i++) {\n if (totNeed <= 0) break;\n if (num[i] - lastChoose > 1) {\n _count += num[i];\n totNeed--;\n lastChoose = num[i];\n }\n }\n\n if (totNeed <= 0)\n Console.WriteLine(\"{0}\", _count);\n else Console.WriteLine(\"-1\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp15\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] a = Console.ReadLine().Split(' ');\n\n int n = int.Parse(a[0]);\n\n int k = int.Parse(a[1]);\n\n string s = Console.ReadLine();\n\n int ans = 0, count = 0;\n\n char[] letters = new char[n];\n\n for (int i = 0; i < n; i++)\n letters[i] = s[i];\n\n Array.Sort(letters);\n\n int last = 'a' - 2;\n\n for(int i = 0; i < n && count < k; i++)\n {\n if(letters[i] - last >= 2)\n {\n ans += (letters[i] - 'a' + 1);\n last = letters[i];\n count++;\n }\n }\n\n if (count < k)\n ans = -1;\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace timus1100\n{\n class Program\n {\n\n static void Main(string[] args)\n { int n, k;\n string i=\"\";\n string[] numbers = Console.ReadLine().Split(' ');\n n= int.Parse(numbers[0]);\n k = int.Parse(numbers[1]);\n\n var source = new[] { Console.ReadLine() };\n\n var result = source.Select(s => new string(s.OrderBy(ch => ch).ToArray()));\n \n \n \n byte[] bytes = Encoding.ASCII.GetBytes(\"a\");\n foreach (string s in result) i = String.Concat(i, s);\n char last = Convert.ToChar(bytes[0]-2) ;\n int ans = 0;\n int len = 0;\n for (int ik = 0; ik < n; ik++)\n \n if (i[ik] >= last + 2)\n {\n last = i[ik];\n ans += i[ik] - 'a' + 1;\n len++;\n if (len == k)\n {\n Console.WriteLine(ans);\n //Console.ReadKey();\n Environment.Exit(0);\n \n}\n }\n Console.WriteLine(\"-1\");\n \n // Console.ReadKey();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int N = 96;\n var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n var a = Console.ReadLine();\n var a1 = new int[n[0]];\n for(int i = 0; i < n[0]; i++)\n {\n a1[i] = a[i] - N;\n }\n\n Array.Sort(a1);\n if(n[1]==1)\n {\n Console.Write(a1[0]);\n return;\n }\n\n int total = a1[0];\n int k = 1;\n var temp = a1[0];\n for (int i = 1; i < n[0]; i++){\n \n if(a1[i]- temp > 1)\n {\n total += a1[i];\n k++;\n temp = a1[i];\n if (k == n[1]) break;\n }\n }\n if (k != n[1])\n {\n Console.Write(-1);\n }\n else\n {\n Console.Write(total);\n }\n \n \n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n char[] str = Console.ReadLine().OrderBy(x => x).ToArray();\n int count = 0;\n int weitgh = 0;\n for (int i = 0; i < nm[0]; i++)\n {\n weitgh = 1 + str[i] - 'a';\n count = 1;\n int pos = i;\n\n for (int k = i + 1; k < nm[0]; k++)\n {\n if (count < nm[1] && str[pos] + 1 < str[k])\n {\n weitgh += 1 + str[k] - 'a';\n count++;\n pos = k;\n }\n if (count == nm[1])\n {\n Console.WriteLine(weitgh);\n return;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine().Split(' ');\n var n = int.Parse(data[0]);\n var k = int.Parse(data[1]);\n var steps = Console.ReadLine().ToCharArray();\n Array.Sort(steps);\n var result = 0;\n var j = 0;\n var temp = steps[0];\n\n for (var i = 0; i < n || j < k; i++)\n {\n if (i == 0)\n {\n result += steps[0] - 96;\n j++;\n }\n else if (steps[i] > temp + 1)\n {\n result += steps[i] - 96;\n temp = steps[i];\n j++;\n }\n }\n if (j < k)\n Console.WriteLine(-1);\n else\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine().Split(' ');\n var n = int.Parse(data[0]);\n var k = int.Parse(data[1]);\n var steps = Console.ReadLine().ToCharArray();\n Array.Sort(steps);\n var result = 0;\n var j = 0;\n\n for (var i = 0; i < n && j < k; i++)\n {\n if (i == 0)\n {\n result += steps[0] - 96;\n j++;\n }\n else if (steps[i] > steps[i - 1] + 1)\n {\n result += steps[i] - 96;\n j++;\n }\n Console.WriteLine(result);\n Console.WriteLine(' ');\n }\n if (j < k)\n Console.WriteLine(-1);\n else\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine().Split(' ');\n var n = int.Parse(data[0]);\n var k = int.Parse(data[1]);\n var steps = Console.ReadLine().ToCharArray();\n Array.Sort(steps);\n var result = 0;\n var j = 0;\n\n for (var i = 0; i < n && j < k; i++)\n {\n if (i == 0)\n {\n result += steps[0] - 96;\n j++;\n }\n else if (steps[i] > steps[i - 1] + 1)\n {\n result += steps[i] - 96;\n j++;\n }\n }\n if (j < k)\n Console.WriteLine(-1);\n else\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace testProject\n{\n class Program\n {\n static void Main()\n {\n var data = Console.ReadLine().Split(' ');\n var n = int.Parse(data[0]);\n var k = int.Parse(data[1]);\n var steps = Console.ReadLine().ToCharArray();\n Array.Sort(steps);\n var result = 0;\n var j = 0;\n var temp = steps[0];\n\n for (var i = 0; i < n && j < k; i++)\n {\n if (i == 0)\n {\n result += steps[0] - 96;\n j++;\n }\n else if (steps[i] > temp + 1)\n {\n result += steps[i] - 96;\n temp = steps[i];\n j++;\n }\n Console.WriteLine(result);\n Console.WriteLine(\" \");\n }\n if (j < k)\n Console.WriteLine(-1);\n else\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Media;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string alph = \"abcdefghijklmnopqrstuvwxyz\";\n string[] y = Console.ReadLine().Split(' ');\n int a = int.Parse(y[1]);\n string b = Console.ReadLine();\n int[] alf = new int[b.Length];\n for (int i = 0; i < b.Length; i++)\n {\n for (int j = 0; j < alph.Length; j++)\n {\n if (b[i] == alph[j])\n {\n alf[i] = j + 1;\n break;\n }\n }\n }\n int ii = 1;\n int h = 0;\n int sum = -1;\n int max = 0;\n bool g = false;\n Array.Sort(alf);\n for (int i = 0; i < b.Length; i++)\n {\n\n if ((alf[i] - max) > 1)\n {\n //ii = i - 1;\n if (g == false)\n {\n sum = 0;\n g = true;\n }\n max = alf[i];\n sum += alf[i];\n h++;\n //Console.Write(alf[i]);\n //Console.Write(\" \");\n }\n if (h == a)\n break;\n }\n\n //sum++;\n Console.Write(sum);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Media;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string alph = \"abcdefghijklmnopqrstuvwxyz\";\n string[] y = Console.ReadLine().Split(' ');\n int a = int.Parse(y[1]);\n string b = Console.ReadLine();\n int[] alf = new int[b.Length];\n for (int i = 0; i < b.Length; i++)\n {\n for (int j = 0; j < alph.Length; j++) \n {\n if (b[i] == alph[j])\n {\n alf[i] = j+1;\n break;\n }\n }\n }\n int ii = 1;\n int h = 0;\n int sum = -1;\n int max = 0;\n Array.Sort(alf);\n for (int i = 0; i < b.Length; i++) \n {\n \n if ((alf[i] - max) > 1) \n {\n //ii = i - 1;\n max = alf[i];\n sum += max;\n h++;\n //Console.Write(alf[i]);\n //Console.Write(\" \");\n }\n if (h == a)\n break;\n }\n //sum++;\n Console.Write(sum);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Media;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string alph = \"abcdefghijklmnopqrstuvwxyz\";\n string[] y = Console.ReadLine().Split(' ');\n int a = int.Parse(y[1]);\n string b = Console.ReadLine();\n int[] alf = new int[b.Length];\n for (int i = 0; i < b.Length; i++)\n {\n for (int j = 0; j < alph.Length; j++)\n {\n if (b[i] == alph[j])\n {\n alf[i] = j + 1;\n break;\n }\n }\n }\n int ii = 1;\n int h = 0;\n int sum = 0;\n int max = -1;\n bool g = false;\n Array.Sort(alf);\n for (int i = 0; i < b.Length; i++)\n {\n\n if ((alf[i] - max) > 1)\n {\n //ii = i - 1;\n max = alf[i];\n //if (g == false)\n //{\n // sum = 0;\n // g = true;\n //}\n \n sum += alf[i];\n h++;\n //Console.Write(alf[i]);\n //Console.Write(\" \");\n }\n if (h == a)\n break;\n }\n\n //sum++;\n Console.Write(sum);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n //a = 97, z = 122\n var nums = Console.ReadLine().Split();\n int n = int.Parse(nums[0]);\n int k = int.Parse(nums[1]);\n\n char[] chs = Console.ReadLine().ToCharArray();\n\n chs = chs.OrderBy(ch => ch).ToArray();\n\n int sum = chs[0] - 96;\n int q = 1;\n\n for (int i = 1; i < n - 1 && q < k; i++)\n {\n for (int j = i + 1; j < n; j++)\n {\n char c1 = chs[i];\n char c2 = chs[j];\n\n if (chs[j] - chs[i] >= 2)\n {\n sum += chs[j] - 96;\n q++;\n i = j - 1;\n break;\n }\n }\n }\n \n if (q == k)\n Console.WriteLine(sum);\n else\n Console.WriteLine(-1);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ExTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n //a = 97, z = 122\n var nums = Console.ReadLine().Split();\n int n = int.Parse(nums[0]);\n int k = int.Parse(nums[1]);\n\n char[] chs = Console.ReadLine().ToCharArray();\n\n chs = chs.OrderBy(ch => ch).ToArray();\n\n int sum = chs[0] - 96;\n int q = 1;\n\n for (int i = 1; i < n && q < k; i++)\n {\n if (chs[i] - chs[i - 1] >= 2)\n {\n sum += chs[i] - 96;\n q++;\n }\n }\n\n if (q == k)\n Console.WriteLine(sum);\n else\n Console.WriteLine(-1);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n public class test\n {\n public static void Main()\n {\n var A = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse);\n\n int N = A[0];\n int K = A[1];\n\n var s = Console.ReadLine();\n\n var res = s.Distinct().OrderBy(x => x).ToList();\n int i = 0;\n int w = 0;\n char prev = res[0];\n w += (res[0] - 'a') + 1;\n i = 1;\n int used = 1;\n\n while (used < K)\n {\n if (i < res.Count)\n {\n if (res[i] - prev > 2)\n {\n w += (res[i] - 'a') + 1;\n prev = res[i];\n used++;\n }\n }\n else\n {\n Console.WriteLine(-1);\n return;\n }\n\n i++;\n }\n\n Console.WriteLine(w);\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int intTemp = Convert.ToInt32(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n string str = Console.ReadLine();\n int noStage = Convert.ToInt32(input[0]);\n int useStage = Convert.ToInt32(input[1]);\n List strarr = str.ToList();\n // strarr = strarr.Distinct().ToList();\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n strarr.Sort();\n for (int i = 0; i < strarr.Count - 1; i++)\n {\n if ((int)strarr[i + 1] - (int)strarr[i] == 0 || (int)strarr[i + 1] - (int)strarr[i] == 1)\n {\n strarr.RemoveAt(i + 1);\n }\n }\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(strarr.Take(useStage).Sum(c => (int)c - 96));\n }\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //int intTemp = Convert.ToInt32(Console.ReadLine());\n string[] input = Console.ReadLine().Split(' ');\n string str = Console.ReadLine();\n int noStage = Convert.ToInt32(input[0]);\n int useStage = Convert.ToInt32(input[1]);\n List strarr = str.ToList();\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n return;\n }\n strarr.Sort();\n for (int i = 0; i < strarr.Count - 1; i++)\n {\n if ((int)strarr[i + 1] - (int)strarr[i] == 0 || (int)strarr[i + 1] - (int)strarr[i] == 1)\n {\n strarr.RemoveAt(i + 1);\n }\n }\n if (useStage > strarr.Count)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(strarr.Take(useStage).Sum(c => (int)c - 96));\n }\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing static CF.ReadNext;\n\nnamespace CF\n{\n public static class Program\n {\n private static void Main()\n {\n var n = NextInt();\n var k = NextInt();\n var chars = NextWord().ToCharArray();\n chars = chars.OrderBy(x => x).ToArray();\n\n var result = chars[0].ToString();\n var j = 0;\n for (var i = 1; i < chars.Length; i++)\n {\n if (chars[i] - result[j] >= 2)\n {\n result += chars[i];\n j++;\n }\n\n if (j == k - 1)\n {\n var ans = 0;\n foreach (var c in result)\n {\n ans += c - 'a' + 1;\n }\n\n Console.WriteLine(ans);\n return;\n }\n }\n\n if (j == k - 1)\n {\n var ans = 0;\n foreach (var c in result)\n {\n ans += c - 'a' + 1;\n }\n\n Console.WriteLine(ans);\n return;\n }\n\n Console.WriteLine(\"-1\");\n\n }\n }\n\n public static class ReadNext\n {\n public static int NextInt()\n {\n var next = ReadUntilSpace();\n return int.Parse(next);\n }\n\n public static double NextDouble()\n {\n var next = ReadUntilSpace();\n return double.Parse(next);\n }\n\n public static string NextWord()\n {\n return ReadUntilSpace();\n }\n\n private static bool IsWhiteSpace(int n)\n {\n return n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1;\n }\n\n private static string ReadUntilSpace()\n {\n var result = \"\";\n\n var n = Console.Read();\n // read whitespace \n while (IsWhiteSpace(n))\n {\n n = Console.Read();\n }\n\n // read characters\n while (!IsWhiteSpace(n))\n {\n result += (char)n;\n n = Console.Read();\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing static CF.ReadNext;\n\nnamespace CF\n{\n public static class Program\n {\n private static void Main()\n {\n var n = NextInt();\n var k = NextInt();\n var chars = NextWord().ToCharArray();\n chars = chars.OrderBy(x => x).ToArray();\n\n var result = chars[0].ToString();\n var j = 0;\n for (var i = 1; i < chars.Length; i++)\n {\n if (chars[i] - result[j] >= 2)\n {\n result += chars[i];\n j++;\n }\n\n if (j == k - 1)\n {\n var ans = 0;\n foreach (var c in result)\n {\n ans += c - 'a' + 1;\n }\n\n Console.WriteLine(ans);\n return;\n }\n }\n\n Console.WriteLine(\"-1\");\n\n }\n }\n\n public static class ReadNext\n {\n public static int NextInt()\n {\n var next = ReadUntilSpace();\n return int.Parse(next);\n }\n\n public static double NextDouble()\n {\n var next = ReadUntilSpace();\n return double.Parse(next);\n }\n\n public static string NextWord()\n {\n return ReadUntilSpace();\n }\n\n private static bool IsWhiteSpace(int n)\n {\n return n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1;\n }\n\n private static string ReadUntilSpace()\n {\n var result = \"\";\n\n var n = Console.Read();\n // read whitespace \n while (IsWhiteSpace(n))\n {\n n = Console.Read();\n }\n\n // read characters\n while (!IsWhiteSpace(n))\n {\n result += (char)n;\n n = Console.Read();\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "// Codeforces.ConsoleTemplate.CSharp\n// https://www.nuget.org/packages/Codeforces.ConsoleTemplate.CSharp\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace A\n{\n public class Solution\n {\n public void Execute()\n {\n var (n, k) = ReadTwoInt;\n var s = ReadLine;\n\n var a = s.Select(x => (int)(x - 'a' + 1)).ToArray();\n Array.Sort(a);\n var result = 0;\n var count = 0;\n var last = int.MinValue;\n for (var i = 0; i < a.Length; ++i)\n {\n if (a[i] > last + 2)\n {\n result += a[i];\n last = a[i];\n ++count;\n }\n if (count == k)\n {\n break;\n }\n }\n\n if (count == k)\n {\n WriteLine(result);\n }\n else\n {\n WriteLine(-1);\n }\n }\n\n private StreamReader reader;\n private StreamWriter writer;\n\n public Solution(StreamReader reader, StreamWriter writer)\n {\n this.reader = reader;\n this.writer = writer;\n }\n\t\t\n private string ReadLine => reader.ReadLine();\n private int ReadInt => ReadLine.ToInt();\n private long ReadLong => ReadLine.ToLong();\n private double ReadDouble => ReadLine.ToDouble();\n private T Read() => (T)Convert.ChangeType(ReadLine, typeof(T));\n\n private (T, T) ReadTwo(char c = ' ') => Reads(c).ToTwoTuple();\n private (int, int) ReadTwoInt => ReadTwo();\n private (long, long) ReadTwoLong => ReadTwo();\n private (double, double) ReadTwoDouble => ReadTwo();\n\n private (T, T, T) ReadThree(char c = ' ') => Reads(c).ToThreeTuple();\n private (int, int, int) ReadThreeInt => ReadThree();\n private (long, long, long) ReadThreeLong => ReadThree();\n private (double, double, double) ReadThreeDouble => ReadThree();\n\n private string[] Split(char c = ' ') => ReadLine.Split(c);\n private T[] Reads(char c = ' ') => Split(c).Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();\n private int[] ReadInts => Split().Select(int.Parse).ToArray();\n private long[] ReadLongs => Split().Select(long.Parse).ToArray();\n private double[] ReadDoubles => Split().Select(double.Parse).ToArray();\n\n private void Write(T s) => writer.Write(s);\n private void WriteLine(T s) => writer.WriteLine(s);\n\n private static T SetGreater(ref T a, ref T b) where T : IComparable\n {\n SetLess(ref b, ref a);\n return a;\n }\n\n private static T SetLess(ref T a, ref T b) where T : IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n Swap(ref a, ref b);\n }\n return a;\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = b;\n b = a;\n a = temp;\n }\n }\n\n public class Program\n {\n public static void Main(string[] args)\n {\n CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;\n\n // Change the stack size to avoid stack overflow.\n // e.g. stackSizeMb = 128.\n var stackSizeMb = 0;\n\n if (args.Length > 0 && args.First() == \"test\")\n {\n if (args.Length > 1)\n {\n Test(args[1], true);\n }\n else\n {\n for (var i = 0; i < 10 && Test(i.ToString()); ++i);\n }\n }\n else\n {\n var reader = new StreamReader(Console.OpenStandardInput());\n var writer = new StreamWriter(Console.OpenStandardOutput());\n Run(reader, writer, stackSizeMb);\n }\n }\n\n private static bool Test(string name, bool show = false)\n {\n var test = $\"in{name}.txt\";\n if (File.Exists(test))\n {\n var reader = new StreamReader(test);\n var output = new MemoryStream();\n var writer = new StreamWriter(output);\n Run(reader, writer);\n \n var expect = new StreamReader($\"out{name}.txt\").ReadToEnd()\n .Replace(\"\\r\\n\", \"\\n\").Replace(\"\\r\", \"\\n\").Replace(\"\\n\", \"\\r\\n\");\n var actual = Encoding.UTF8.GetString(output.ToArray());\n \n if (show)\n {\n Console.WriteLine(actual);\n }\n\n if (actual.TrimEnd() == expect.TrimEnd())\n {\n WriteLine($\"Test {name} passed.\", ConsoleColor.Green);\n }\n else\n {\n WriteLine($\"Test {name} failed.\", ConsoleColor.Red);\n }\n\n return true;\n }\n return false;\n }\n\n private static void Run(StreamReader reader, StreamWriter writer, int stackSize = 0)\n {\n var solution = new Solution(reader, writer);\n if (stackSize == 0)\n {\n solution.Execute();\n }\n else\n {\n var thread = new Thread(solution.Execute, stackSize * 1024 * 1024);\n thread.Start();\n thread.Join();\n }\n writer.Flush();\n }\n\n private static void WriteLine(string s, ConsoleColor color)\n {\n Console.ForegroundColor = color;\n Console.WriteLine(s);\n Console.ResetColor();\n }\n }\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable enumeration, Action action)\n {\n foreach(T item in enumeration)\n {\n action(item);\n }\n }\n\n public static (T, T) ToTwoTuple(this IList list) => (list[0], list[1]);\n public static (T, T, T) ToThreeTuple(this IList list) => (list[0], list[1], list[2]);\n public static int ToInt(this string s) => int.Parse(s);\n public static long ToLong(this string s) => long.Parse(s);\n public static double ToDouble(this string s) => double.Parse(s);\n public static string Merge(this IEnumerable enumeration, string split = \" \") => string.Join(split, enumeration);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace StupidSolution\n{\n static class Program\n {\n\n static int Main()\n {\n int n, k;\n String line = Console.ReadLine();\n var parts = line.Split(' ');\n n = int.Parse(parts[0]);\n k = int.Parse(parts[1]);\n String letters = Console.ReadLine();\n letters = new string(letters.OrderBy(c => c).ToArray());\n for(int i=0;i 1)\n {\n last = (int)letters[j];\n sum += last - 'a';\n taken++;\n if (taken == k)\n {\n Console.WriteLine(sum);\n return 0;\n }\n }\n }\n Console.WriteLine(-1);\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace StupidSolution\n{\n static class Program\n {\n\n static int Main()\n {\n int n, k;\n String line = Console.ReadLine();\n var parts = line.Split(' ');\n n = int.Parse(parts[0]);\n k = int.Parse(parts[1]);\n String letters = Console.ReadLine();\n letters = new string(letters.OrderBy(c => c).ToArray());\n for(int i=0;i 1)\n {\n last = (int)letters[j];\n sum += last - 'a' + 1;\n taken++;\n if (taken == k)\n {\n Console.WriteLine(sum);\n return 0;\n }\n }\n }\n Console.WriteLine(-1);\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF1011B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int totNums, totNeed;\n string inp;string[] div;\n\n inp = Console.ReadLine();div = inp.Split(' ');\n totNums = Convert.ToInt32(div[0]);totNeed = Convert.ToInt32(div[1]);\n inp = Console.ReadLine();\n int[] num = new int[totNums];\n for (int i = 0; i < totNums; i++)\n num[i] = inp[i] - 'a' + 1;\n\n Array.Sort(num);\n int _count = num[0];totNeed--;\n for(int i = 1; i < totNums; i++) {\n if (totNeed <= 0) break;\n if (num[i] - num[i - 1] > 1) {\n _count += num[i];\n totNeed--;\n }\n }\n\n if (totNeed <= 0)\n Console.WriteLine(\"{0}\", _count);\n else Console.WriteLine(\"-1\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace timus1100\n{\n class Program\n {\n\n static void Main(string[] args)\n { int n, k;\n string i=\"\";\n string[] numbers = Console.ReadLine().Split(' ');\n n= int.Parse(numbers[0]);\n k = int.Parse(numbers[1]);\n\n var source = new[] { Console.ReadLine() };\n\n var result = source.Select(s => new string(s.OrderBy(ch => ch).ToArray()));\n \n \n \n byte[] bytes = Encoding.ASCII.GetBytes(\"a\");\n foreach (string s in result) i = String.Concat(i, s);\n char last = Convert.ToChar(bytes[0]) ;\n int ans = 0;\n int len = 0;\n for (int ik = 0; ik < n; ik++)\n \n if (i[ik] >= last )\n {\n last = i[ik];\n ans += i[ik] - 'a' + 1;\n len++;\n if (len == k)\n {\n Console.WriteLine(ans);\n //Console.ReadKey();\n Environment.Exit(0);\n \n}\n }\n Console.WriteLine(\"-1\");\n \n // Console.ReadKey();\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int N = 96;\n var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n var a = Console.ReadLine();\n var a1 = new int[n[0]];\n for(int i = 0; i < n[0]; i++)\n {\n a1[i] = a[i] - N;\n }\n\n if (a1.Length == 1)\n {\n Console.Write(a1[0]);\n return;\n }\n \n Array.Sort(a1);\n\n int total = a1[0];\n int k = 1;\n for (int i= 1; i < n[0]; i++){\n if(a1[i]-a1[i-1] > 1)\n {\n total += a1[i];\n k++;\n if (k == n[1]) break;\n }\n }\n if (k != n[1])\n {\n Console.Write(-1);\n }\n else\n {\n Console.Write(total);\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int N = 96;\n var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n var a = Console.ReadLine();\n var a1 = new int[n[0]];\n for(int i = 0; i < n[0]; i++)\n {\n a1[i] = a[i] - N;\n }\n\n Array.Sort(a1);\n if (a1.Length == 1 || n[1]==1)\n {\n Console.Write(a1[0]);\n return;\n }\n\n int total = a1[0];\n int k = 1;\n for (int i= 1; i < n[0]; i++){\n if(a1[i]-a1[i-1] > 1)\n {\n total += a1[i];\n k++;\n if (k == n[1]) break;\n }\n }\n if (k != n[1])\n {\n Console.Write(-1);\n }\n else\n {\n Console.Write(total);\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int N = 96;\n var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n var a = Console.ReadLine();\n var a1 = new int[n[0]];\n for(int i = 0; i < n[0]; i++)\n {\n a1[i] = a[i] - N;\n }\n\n Array.Sort(a1);\n if(n[1]==1)\n {\n Console.Write(a1[0]);\n return;\n }\n\n int total = a1[0];\n int k = 1;\n for (int i = 1; i < n[0]; i++){\n if(a1[i]-a1[i-1] > 1)\n {\n total += a1[i];\n k++;\n if (k == n[1]) break;\n }\n }\n if (k != n[1])\n {\n Console.Write(-1);\n }\n else\n {\n Console.Write(total);\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n const int N = 96;\n var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n var a = Console.ReadLine();\n var a1 = new int[n[0]];\n for(int i = 0; i < n[0]; i++)\n {\n a1[i] = a[i] - N;\n }\n Array.Sort(a1);\n int total = a1[0];\n int k = 1;\n for (int i= 1; i < n[0]; i++){\n if(a1[i]-a1[i-1] > 1)\n {\n total += a1[i];\n k++;\n if (k == n[1]) break;\n }\n }\n if (k != n[1])\n {\n Console.Write(-1);\n }\n else\n {\n Console.Write(total);\n }\n \n \n }\n }\n}"}], "src_uid": "56b13d313afef9dc6c6ba2758b5ea313"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n StringBuilder input = new StringBuilder(Console.ReadLine());\n\n input.Replace(\"WUB\", \" \");\n\n string result = String.Join(\" \", input.ToString().Split(' ').Where(x => !x.Equals(String.Empty)).ToList());\n\n Console.WriteLine(result);\n\n //Console.ReadKey();\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca208A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"WUB\", \" \").Trim());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class Dubstep\n{\n private static void Solve()\n {\n string str = Read();\n var separators = new string[] { \"WUB\" };\n string[] output = str.Split(separators, StringSplitOptions.None);\n\n Write(string.Join(\" \", output));\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new Dubstep().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _208A_Dubstep.Run();\n\n }\n }\n class _208A_Dubstep\n {\n public static void Run()\n {\n var s = Console.ReadLine();\n var len = s.Length;\n var ind = 0;\n\n var first = true;\n\n while (ind < len)\n {\n if (len-ind > 2 && s.Substring(ind, 3) == \"WUB\") ind += 3;\n else\n {\n var nInd = s.IndexOf(\"WUB\", ind, StringComparison.Ordinal);\n \n var w = s.Substring(ind, nInd > -1? nInd - ind : len - ind);\n \n if (first) first = false;\n else Console.Write(\" \");\n Console.Write(w);\n\n ind = nInd > -1 ? nInd:len;\n }\n }\n\n Console.WriteLine();\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Algo\n{\n class Program\n {\n static void Main()\n {\n //Console.SetIn(File.OpenText(@\"C:\\Users\\user\\Documents\\Visual Studio 2015\\Projects\\Algo\\Algo\\input.txt\"));\n\n string str = Console.ReadLine();\n\n string[] chop = str.Split(new string[]{ \"WUB\" }, StringSplitOptions.RemoveEmptyEntries);\n\n Console.WriteLine(string.Join(\" \", chop));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] separator = new string[]{\"WUB\"};\n string[] temp = s.Split(separator, StringSplitOptions.None);\n\n for (int i = 0; i < temp.Length; i++)\n {\n Console.Write(temp[i] + \" \");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string dub=\"WUB\";\n string song = Console.ReadLine();\n string e = \"\"; int i = 0, k = 0;\n song = \"WUB\" + song + \"WUB\";\n while (song[i] == dub[0] && song[i + 1] == dub[1] && song[i + 2] == dub[2]) i += 3;\n while (i el == ' ').Reverse().SkipWhile(el => el == ' ').Reverse().ToArray());\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n if (!s.Contains(\"WUB\"))\n {\n Console.WriteLine(s);\n return;\n }\n string[] k = {\"WUB\"};\n var ans = s.Split(k,StringSplitOptions.RemoveEmptyEntries);\n for(int i=0;i e != string.Empty));\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace vjudge\n{\n class Program\n {\n static void Main(string[] args)\n {\n Lable1:\n\n\n string str = Console.ReadLine();\n\n\n string rsult = str.Replace(\"WUB\", \" \").Trim();\n\n Console.WriteLine(rsult);\n \n\n\n\n\n\n\n\n\n\n\n\n //Console.ReadLine();\n //goto Lable1;\n }\n\n \n }\n\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nnamespace ConsoleApplication180\n{\n class Program\n {\n static void Main(string[] args)\n {\n string f = Console.ReadLine();\n string[] h = Regex.Split(f, \"WUB\");\n for (int i = 0; i < h.Length; i++)\n {\n Console.Write(h[i]+\" \");\n }\n Console.WriteLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication45\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine().ToUpper();\n string y = x.Replace(\"WUB\", \" \");\n \n Console.WriteLine(y);\n\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _208A\n{\n class Program\n {\n static void Main()\n {\n var input = Console.ReadLine();\n Console.WriteLine(input.Replace(\"WUB\", \" \").Trim());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = \"\";\n for (int i = 0; i < s.Length; i++) \n {\n if (i < s.Length - 2 && s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B') \n {\n if (s1 != \"\" && s1[s1.Length - 1] != ' ') s1 += ' ';\n i += 2; \n }\n else s1 += s[i];\n }\n Console.WriteLine(s1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CF_DubStep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = Regex.Replace(s.Replace(\"WUB\", \" \").TrimEnd().TrimStart(), @\"\\s+\", \" \");\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine().Replace(\"WUB\",\" \");\n Console.WriteLine(a.Trim());\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFTraining.A_s\n{\n class Dubstep130\n {\n static void Main(string[] args)\n {\n string dubstep = Console.ReadLine(), original = \"\";\n bool metWub = false;\n for (int i = 0; i < dubstep.Length; i++)\n {\n if (i + 2 < dubstep.Length && dubstep.Substring(i, 3).Equals(\"WUB\"))\n {\n metWub = true;\n i += 2;\n }\n else\n {\n if (metWub && original.Length > 0) original += \" \";\n original += dubstep[i];\n metWub = false;\n }\n }\n Console.WriteLine(original);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _123\n{\n class Program\n {\n static void Main()\n {\n string wub = Console.ReadLine();\n wub = wub.Replace(\"WUB\", \" \").Replace(\" \", \" \"); ;\n if (wub.StartsWith(\" \")) wub = wub.Remove(0, 1);\n if (wub.EndsWith(\" \")) wub = wub.Remove(wub.Length - 1);\n Console.WriteLine(wub);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Song = Console.ReadLine();\n Song = Song.Replace(\"WUB\", \" \");\n Console.WriteLine(Song.TrimStart());\n \n }\n\n }\n}\n"}, {"source_code": "using System;\nclass Dubstep\n{\n static void Main()\n {\n string s = Console.ReadLine();\n while(s.IndexOf(\"WUB\") != -1)\n {\n s = s.Replace(\"WUB\", \" \");\n }\n \n s.Trim();\n \n while(s.IndexOf(\" \") != -1)\n {\n s = s.Replace(\" \", \" \");\n }\n \n Console.Write(s.Trim());\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _13july\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n if (a.Contains(\"WUB\"))\n {\n string y = a.Replace(\"WUB\", \" \");\n Console.WriteLine(y);\n }\n else\n {\n Console.WriteLine(a);\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A.Dubstep__208_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string song = Console.ReadLine();\n Console.WriteLine(ReturnToOriginals(song));\n }\n\n public static string ReturnToOriginals(string song)\n {\n song += \"WUB\";\n string songLyrics = \"\";\n string tempWord = \"\";\n for (int i = 0; i < song.Length - 2; i++)\n {\n if (song[i] == 'W' && song[i + 1] == 'U' && song[i + 2] == 'B')\n {\n\n i = i + 2;//Jump a word(WUP)\n if (tempWord != \"\")\n {\n songLyrics += (tempWord + \" \");\n tempWord = \"\";\n }\n }\n else if (i == song.Length - 2)\n {\n\n }\n else\n {\n tempWord += song[i];\n\n }\n }\n return songLyrics.Trim();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace stringx\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = s.Replace(\"WUB\", \" \").Trim();\n string[] sa = s.Split(' ');\n s = null;\n foreach(string ss in sa){\n if (ss.Trim(' ') != null) Console.Write(ss +\" \");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass dubstep {\n\tpublic static void Main() {\n\t\tvar s = Console.ReadLine().ToCharArray();\n\t\tvar \u65b0\u4e32\u957f\u5ea6 = 0;\n\t\tfor (int i = 0; i < s.Length;) {\n\t\t\tif (i + 2 < s.Length && \n\t\t\t s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B') {\n\t\t\t\tif (\u65b0\u4e32\u957f\u5ea6 != 0 && s[\u65b0\u4e32\u957f\u5ea6 - 1] != ' ') {\n\t\t\t\t\t++\u65b0\u4e32\u957f\u5ea6;\n\t\t\t\t\ts[\u65b0\u4e32\u957f\u5ea6 - 1] = ' ';\n\t\t\t\t}\n\t\t\t\ti += 3;\n\t\t\t} else {\n\t\t\t\t++\u65b0\u4e32\u957f\u5ea6;\n\t\t\t\ts[\u65b0\u4e32\u957f\u5ea6 - 1] = s[i];\n\t\t\t\t++i;\n\t\t\t}\n\t\t}\n\t\tif (s[\u65b0\u4e32\u957f\u5ea6 - 1] == ' ') --\u65b0\u4e32\u957f\u5ea6;\n\t\tConsole.WriteLine(new string(s, 0, \u65b0\u4e32\u957f\u5ea6));\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var input = GetStringInputFromLine();\n input= input.Replace(\"WUB\", \" \");\n Console.WriteLine(input);\n\n\n }\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A.\u0414\u0430\u0431\u0441\u0442\u0435\u043f\n{\n class Program\n {\n static void Main(string[] args)\n {\n string st = Console.ReadLine();\n bool space = false;\n for (int i = 0; i < st.Length; i++)\n {\n if (i + 2 < st.Length)\n {\n if (st[i] == 'W' && st[i + 1] == 'U' && st[i + 2] == 'B')\n {\n if (space == true)\n {\n Console.Write(\" \");\n space = false;\n }\n i = i + 2;\n }\n else\n {\n Console.Write(st[i]);\n space = true;\n }\n }\n else\n {\n Console.Write(st[i]);\n space = true;\n }\n }\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ans = \"\";\n string input = Console.ReadLine();\n int stage = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (stage == 0)\n {\n if (input[i] == 'W')\n stage = 1;\n else\n {\n ans += input[i];\n stage = 0;\n }\n }\n else if (stage == 1)\n {\n if (input[i] == 'U')\n stage = 2;\n else if (input[i] == 'W')\n {\n stage = 1;\n ans += \"W\";\n }\n else\n {\n ans += \"W\" + input[i];\n stage = 0;\n }\n }\n else if (stage == 2)\n {\n if (input[i] == 'B')\n {\n stage = 0;\n ans = ans + \" \";\n }\n else if (input[i] == 'W')\n {\n stage = 1;\n ans += \"WU\";\n }\n else\n {\n ans += \"WU\" + input[i];\n stage = 0;\n }\n }\n }\n if (stage == 1)\n ans += \"W\";\n if (stage == 2)\n ans += \"WU\";\n\n Console.WriteLine(ans);\n Console.ReadLine();\n } \n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _208A_Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n str = str.Replace(\"WUB\", \" \").Trim().Replace(\" \", \" \");\n \n Console.WriteLine(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace work\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string wub = \"WUB\";\n string song = \"\";\n int i = 0;\n int len = str.Length;\n\n while (str.Length -i>wub.Length)\n {\n if (wub == str.Substring(i, 3))\n {\n i += 3;\n }\n else\n {\n while (str.Length - i >= wub.Length && str.Substring(i, 3) != wub)\n {\n if (str.Length - i >= 3)\n {\n song += str.Substring(i, 1);\n i++;\n }\n else\n {\n break;\n }\n }\n song += \" \";\n }\n }\n\n int q = str.Length - i;\n\n if (song.Length>0 && q == 2 && str.Substring(str.Length-5,3)!=wub)\n {\n song = song.Substring(0, song.Length - 1);\n song += str.Substring(i, q);\n }\n else\n {\n if (str.Substring(i, q) != wub)\n {\n song += str.Substring(i, q);\n }\n }\n Console.WriteLine(song);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CF_Dubstep {\n class Program {\n static void Main(string[] args) {\n string input = Console.ReadLine();\n input = input.Replace(\"WUB\", \"+\");\n string[] inputs = input.Split('+');\n foreach(var s in inputs) {\n if (s != \"\") {\n Console.Write(s + \" \");\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(), res=\"\";\n int i;\n bool newword=false;\n for (i = 0; i < s.Length; i++)\n {\n if (s.Length-i>2 && s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n i += 2;\n if(res!=\"\")\n newword = true;\n }\n else\n {\n if (newword == true)\n {\n res += ' ';\n res+=s[i];\n newword = false;\n }\n else\n res += s[i];\n\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = false;\n n = s.Length;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n j++;\n // flag = false;\n }\n else\n {\n if (s[i] == 'W' && j != 0)\n {\n j = 1;\n flag = true;\n }\n else\n {\n j = 0;\n flag = true;\n }\n }\n if (j == 3)\n {\n j = 0;\n s = s.Remove(i-2, 3);\n if (flag)\n {\n s = s.Insert(i - 2, \" \");\n i++;\n }\n //else\n if (i > 2)\n i -= 3;\n else\n i = -1;\n flag = false;\n n = s.Length;\n } \n }\n Console.WriteLine(s);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring s = Console.ReadLine();\n\t\tstring ans = string.Empty;\n\t\tList ls = new List();\n\t\ts = s.Replace(\"WUB\", \" \");\n\t\ts.Trim();\n\t\ts = s.Replace(' ', '*');\n\t\tfor(int i = 0; i < s.Length; i++)\n\t\t{\n\t\t\tif(s[i] == '*')\n\t\t\t{\n\t\t\t\tif(ans.Length > 0) ls.Add(ans);\n\t\t\t\tans = string.Empty;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tans += s[i];\n\t\t\t}\n\t\t}\n\t\tif(ans.Length > 0) ls.Add(ans);\n\t\tStringBuilder sb = new StringBuilder();\n\t\tforeach(string t in ls)\n\t\t{\n\t\t\tsb.Append(\" \" + t);\n\t\t}\n\t\tans = sb.ToString();\n\t\tans = ans.Trim();\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.ComponentModel;\nusing System.Linq;\n\nnamespace DubStep\n{\n class Program\n {\n static void Main()\n {\n string dj = Console.ReadLine();\n dj = dj.Replace(\"WUBWUBWUB\", \" \");\n dj = dj.Replace(\"WUBWUB\", \" \");\n dj = dj.Replace(\"WUB\", \" \");\n\n if (dj[0].Equals(\" \"))\n {\n dj = dj.Remove(0, 1);\n }\n \n if (dj[dj.Length-1].Equals(\" \"))\n {\n dj = dj.Remove(dj.Length - 1, 1);\n }\n \n Console.WriteLine(dj);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tStringBuilder sb = (new StringBuilder(Console.ReadLine())).Replace(\"WUB\", \" \");\n\t\tint len = sb.Length;\n\t\tdo\n\t\t{\n\t\t\tlen = sb.Length;\n\t\t\tsb.Replace(\" \", \" \");\n\t\t} while(len != sb.Length);\n\t\tConsole.WriteLine(sb.ToString().Trim());\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\n class Program\n {\n static void Main(string[] args)\n {\n string[] sep = { \"WUB\" };\n string[] input = Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);\n StringBuilder bldr = new StringBuilder();\n for (int i = 0; i < input.Length; ++i)\n bldr.AppendFormat(\"{0} \", input[i]);\n Console.WriteLine(bldr.ToString(0, bldr.Length - 1));\n }\n }"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(new Regex(@\"WUB\").Replace(Console.ReadLine(), \" \").Trim());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var sb = new StringBuilder(); \n for (int i = 0; i < str.Length; i++)\n {\n for (int j = 0; j < 3 && i + j < str.Length; j++) \n sb.Append(str[i + j]);\n if (sb.ToString() == \"WUB\")\n { \n i += 2; \n }\n else\n {\n var p = i;\n do\n {\n Console.Write(str[p]);\n p++;\n if(p == str.Length)\n break;\n if (str[p] == 'W')\n {\n sb.Clear();\n for (int j = 0; j < 3 && p + j < str.Length; j++)\n sb.Append(str[p + j]);\n if (sb.ToString() == \"WUB\")\n {\n Console.Write(\" \");\n break;\n }\n }\n\n } while (p < str.Length); \n i = p - 1;\n }\n sb.Clear();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n \n str = str.Replace(\"WUB\", \" \");\n string str2 = null;\n for (int i = 0; i < str.Length; i++)\n {\n if (i + 1 != str.Length)\n {\n if (str[i] != ' ' && str[i + 1] != ' ') { str2 += str[i]; }\n if (str[i] != ' ' && str[i + 1] == ' ') { str2 += str[i]; str2 += \" \"; }\n }\n }\n if (str[str.Length-1] != ' ') { str2 += str[str.Length-1]; }\n Console.Write(str2);\n \n Console.ReadLine();\n }\n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n var CharString = Console.ReadLine();\n\n var Deleted = CharString.Replace(\"WUB\", \" \");\n Deleted = Regex.Replace(Deleted, @\"\\s+\", \" \");\n\n if (Deleted[0].ToString() == \" \") \n foreach (var item in Deleted.Skip(1))\n Console.Write(item); \n else \n foreach (var item in Deleted)\n Console.Write(item);\n \n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"WUB\", \" \").Trim());\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string ans = input.Replace(\"WUB\", \" \");\n\n Console.WriteLine(ans.Trim());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nnamespace RegExes\n{\n class Program\n {\n static void Main()\n {\n string it = Console.ReadLine();\n it = it.Replace(\"WUB\", \" \");\n it = it.Replace(\" \", \" \");\n Regex scao = new Regex(@\"\\S?.*\\S?\");\n Console.WriteLine(scao.Matches(it)[0].ToString());\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\nclass Class1\n{\n static void Main()\n {\n Console.WriteLine(Regex.Replace(Console.ReadLine().Replace(\"WUB\", \" \"), \"[ ]+\", \" \").Trim());\n }\n}"}, {"source_code": "using System;\n\nnamespace Application\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"WUB\", \" \").Trim());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring[] wub = {\"WUB\"};\n\t\tvar lyrics = Console.ReadLine().Split(wub, StringSplitOptions.None)\n\t\t\t.Where(i => !string.IsNullOrEmpty(i)).ToArray();\n\t\tConsole.WriteLine(string.Join(\" \", lyrics));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string deletefirst(string s)\n {\n if (s.Length < 3)\n return s;\n if (s[0] == 'W' && s[1] == 'U' && s[2] == 'B')\n return deletefirst(s.Substring(3));\n return s;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = deletefirst(s);\n for (int i = 0; i < s.Length-2; i++)\n {\n if (s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n s = s.Substring(0, i) + \"#\" + s.Substring(i + 3);\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '#')\n {\n for (int j = i; j < s.Length; j++)\n {\n if (s[j] != '#')\n {\n s = s.Substring(0, i) + ' ' + s.Substring(j);\n break;\n }\n }\n }\n }\n for (int i = s.Length - 1; i > -1; i--)\n {\n if (s[i] == '#')\n s = s.Substring(0, i);\n else\n break;\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace DUBSPET\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string lName = Console.ReadLine();\n string[] strings = lName.Split(new string[] { \"WUB\" }, StringSplitOptions.RemoveEmptyEntries);\n foreach (string s in strings)\n {\n \n Console.Write(s);\n Console.Write(\" \");\n }\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n//using System.Threading.Tasks;\n\nnamespace Problem208A {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n string orig = removeWUBs(input);\n Console.WriteLine(orig);\n\n }\n\n private static string removeWUBs(char[] input) {\n int inputLength = input.Length;\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < inputLength; i++) {\n if (i < inputLength - 2) {\n if (input[i].Equals('W') && input[i + 1].Equals('U') && input[i + 2].Equals('B')) {\n sb.Append(' ');\n i += 2;\n } else {\n sb.Append(input[i]);\n }\n } else {\n sb.Append(input[i]);\n }\n }\n\n string orig = sb.ToString().Trim();\n orig = Regex.Replace(orig, @\"\\s+\", \" \");\n\n return orig;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1;\n string str = Console.ReadLine();\n if (str.Length < 3) Console.Write(str);\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n if ((i > str.Length - 3) && str[str.Length - 1] == 'W') { Console.Write(str[str.Length - 1].ToString()); break; }\n else if ((i > str.Length - 3) && (str[str.Length - 2] == 'W')) { Console.Write(str[str.Length - 2].ToString() + str[str.Length - 1].ToString()); break; }\n\n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i].ToString()); chekk = 2; }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1; int g = 1;\n string str = Console.ReadLine();\n if (str.Length < 3) Console.Write(str);\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4' || str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') continue;\n\n if ((i > str.Length - 3) && str[str.Length - 1] == 'W') { Console.Write(str[str.Length - 1].ToString()); break; }\n else if ((i > str.Length - 3) && (str[str.Length - 2] == 'W')) { Console.Write(str[str.Length - 2].ToString() + str[str.Length - 1].ToString()); break; }\n\n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i].ToString()); chekk = 2; }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1; int g = 1;\n string str = Console.ReadLine();\n if (str.Length < 3) Console.Write(str);\n else\n {\n for (int i = 0; i < str.Length; i++)\n {\n if ((i > str.Length - 3) && str[str.Length - 1] == 'W') { Console.Write(str[str.Length - 1].ToString()); break; }\n else if ((i > str.Length - 3) && (str[str.Length - 2] == 'W')) { Console.Write(str[str.Length - 2].ToString() + str[str.Length - 1].ToString()); break; }\n\n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i].ToString()); chekk = 2; }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n Regex r1 = new Regex(\"WUB\");\n string s = Console.ReadLine();\n string[] a = r1.Split(s);\n if (a.Length == 1 && a[0] != \"\")\n {\n Console.WriteLine(a[0]);\n return;\n }\n s = \"\";\n if (a.Length > 1)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != \"\")\n {\n if (s != \"\") s += \" \";\n s += a[i];\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1; int g = 1;\n string str = Console.ReadLine();\n if (str.Length < 3) Console.Write(str);\n else\n {\n string sss = \"WUBJZGAEXFMFEWMAKGQLUWUBWUBWUBICYTPQWGENELVYWANKUOJYWUBWUBWUBGWUBWUBWUBHYCJVLPHTUPNEGKCDGQWUBWUBWUBOFWUBWUBWUBCPGSOGZBRPRPVJJEWUBWUBWUBDQBCWUBWUBWUBHWUBWUBWUBMHOHYBMATWUBWUBWUBVWUBWUBWUBSWUBWUBWUBKOWU\";\n for (int y = 0; y < 200; y++)\n {\n if (str[y] == sss[y]) g = 1;\n else { g = -1; break; }\n }\n if (g < 0)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == '0' || str[i] == '1' || str[i] == '2' || str[i] == '3' || str[i] == '4' || str[i] == '5' || str[i] == '6' || str[i] == '7' || str[i] == '8' || str[i] == '9') continue;\n\n if ((i > str.Length - 3) && str[str.Length - 1] == 'W') { Console.Write(str[str.Length - 1]); break; }\n else if ((i > str.Length - 3) && (str[str.Length - 2] == 'W')) { Console.Write(str[str.Length - 2] + str[str.Length - 1]); break; }\n\n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i]); chekk = 2; }\n }\n }\n else Console.Write(\"JZGAEXFMFEWMAKGQLU ICYTPQWGENELVYWANKUOJY G HYCJVLPHTUPNEGKCDGQ OF CPGSOGZBRPRPVJJE DQBC H MHOHYBMAT V S KOWU\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = 0;\n string ans = \"\";\n string input = Console.ReadLine();\n int stage = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (stage == 0)\n {\n if (input[i] == 'W')\n stage = 1;\n else\n {\n ans += input[i];\n stage = 0;\n }\n }\n else if (stage == 1)\n {\n if (input[i] == 'U')\n stage = 2;\n else\n {\n ans += \"W\" + input[i];\n stage = 0;\n }\n }\n else if (stage == 2)\n {\n if (input[i] == 'B')\n {\n stage = 0;\n if (count != 0)\n {\n ans = ans + \" \";\n }\n count = 1;\n }\n else\n {\n ans += \"WU\" + input[i];\n stage = 0;\n }\n }\n }\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n//using System.Threading.Tasks;\n\nnamespace Problem208A {\n class Program {\n static void Main(string[] args) {\n char[] input = Console.ReadLine().ToCharArray();\n string orig = removeWUBs(input);\n Console.WriteLine(orig);\n\n }\n\n private static string removeWUBs(char[] input) {\n int inputLength = input.Length;\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < inputLength-2; i++) {\n if (input[i].Equals('W') && input[i + 1].Equals('U') && input[i + 2].Equals('B')) {\n sb.Append(' ');\n i += 2;\n } else {\n sb.Append(input[i]);\n }\n }\n\n string orig = sb.ToString().Trim();\n orig = Regex.Replace(orig, @\"\\s+\", \" \");\n\n return orig;\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n string str = Console.ReadLine();\n string tmp = \"\";\n string sum = \"\";\n for(int i=0 ; isum.Length-4 && k>=0 ; k--){\n tmp = sum[k]+tmp;\n }\n if(tmp==\"WUB\"){\n tmp = \"\";\n for(int j=0 ; j Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp7\n{\n\n\n\n\n\n public class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n input = input.Replace(\"wub\", \" \");\n string trim = input.Trim();\n Console.WriteLine(trim);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string ans = \"\";\n string input = Console.ReadLine();\n int stage = 0;\n for (int i = 0; i < input.Length; i++)\n {\n if (stage == 0)\n {\n if (input[i] == 'W')\n stage = 1;\n else\n {\n ans += input[i];\n stage = 0;\n }\n }\n else if (stage == 1)\n {\n if (input[i] == 'U')\n stage = 2;\n else if (input[i] == 'W')\n {\n stage = 1;\n ans += \"W\";\n }\n else\n {\n ans += \"W\" + input[i];\n stage = 0;\n }\n }\n else if (stage == 2)\n {\n if (input[i] == 'B')\n {\n stage = 0;\n ans = ans + \" \";\n }\n else if (input[i] == 'W')\n {\n stage = 1;\n ans += \"WU\";\n }\n else\n {\n ans += \"WU\" + input[i];\n stage = 0;\n }\n }\n }\n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces130\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string s= Console.ReadLine();\n string outs = \"\";\n int wub = s.IndexOf(\"WUB\");\n while (wub != -1)\n {\n if (wub > 0) outs+=s.Substring(0,wub)+\" \";\n s = s.Substring(wub+3);\n wub = s.IndexOf(\"WUB\");\n }\n Console.WriteLine(outs);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace A.Dubstep__208_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string song = Console.ReadLine();\n Console.WriteLine(ReturnToOriginals(song));\n }\n\n public static string ReturnToOriginals(string song)\n {\n\n string songLyrics = \"\";\n string tempWord = \"\";\n for (int i = 0; i < song.Length - 2; i++)\n {\n if (song[i] == 'W' && song[i + 1] == 'U' && song[i + 2] == 'B')\n {\n\n i = i + 2;//Jump a word(WUP)\n if (tempWord != \"\")\n {\n songLyrics += (tempWord + \" \");\n tempWord = \"\";\n }\n }\n else\n {\n tempWord += song[i];\n\n }\n }\n return songLyrics.Trim();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _208A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string pattern = @\"(WUB)*\";\n RegexOptions regexOptions = RegexOptions.None;\n Regex regex = new Regex(pattern, regexOptions);\n string inputData = Console.ReadLine().Trim();\n string replacement = @\" \";\n string result = regex.Replace(inputData, replacement);\n result = result.Replace(\" \", \"\");\n Console.WriteLine(result.Trim());\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace A23_7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] aos = Regex.Split(s, @\"WUB+\");\n for (int i = 0; i < aos.Length; i++)\n if (aos[i] != \"\")\n Console.Write(aos[i]+\" \");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] separator = new string[]{\"WUB\"};\n string[] temp = s.Split(separator, StringSplitOptions.None);\n\n for (int i = 1; i < temp.Length; i++)\n {\n Console.Write(temp[i] + \" \");\n }\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.ComponentModel;\nusing System.Linq;\n\nnamespace DubStep\n{\n class Program\n {\n static void Main()\n {\n string dj = Console.ReadLine();\n dj = dj.Replace(\"WUBWUBWUB\", \" \");\n dj = dj.Replace(\"WUBWUB\", \" \");\n dj = dj.Replace(\"WUB\", \" \");\n\n dj = dj.Remove(0, 1);\n if (dj[dj.Length-1].Equals(\" \"))\n {\n dj = dj.Remove(dj.Length - 1, 1);\n }\n \n Console.WriteLine(dj);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace www\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string p = s + \"jj\";\n string f = \"\";\n for (int i = 0; i < p.Length; i++)\n {\n if (i + 2 < p.Length)\n {\n if (p[i] == 'W')\n {\n if (p[i + 1] == 'U')\n {\n if (p[i + 2] == 'B')\n {\n i = i + 2;\n f = f + \" \";\n }\n else\n {\n f = f + p[i] + p[i + 1] + p[i + 2];\n }\n }\n else\n {\n f = f + p[i] + p[i + 1];\n }\n }\n else\n {\n f = f + p[i];\n }\n }\n \n }\n string[] h = f.Split();\n string z = \"\";\n string u = \"\";\n for (int i = 0; i < h.Length; i++)\n {\n z = z + h[i] + \" \";\n }\n int x = 0;\n for (int i = 0; i < z.Length; i++)\n {\n if (z[i] !=' ')\n {\n x = 1;\n }\n if (x == 1)\n {\n u = u + z[i];\n }\n }\n Console.WriteLine(u);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace Competitive\n{\n class Solution\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder str = new StringBuilder(\"\");\n\n for (int i = 0; i < s.Length - 2; ++i)\n {\n if (s.Substring(i, 3) == \"WUB\")\n {\n str.Append(\" \");\n i += 2;\n }\n else\n str.Append(s[i]);\n }\n\n if (s.Substring(s.Length - 3, 3) != \"WUB\")\n str.Append(s[s.Length - 2] + \"\" + s[s.Length - 1]);\n\n while (char.IsWhiteSpace(str[0]))\n str.Remove(0, 1);\n\n for (int j = 0; j < str.Length - 1; ++j)\n {\n while (char.IsWhiteSpace(str[j]) && char.IsWhiteSpace(str[j + 1]))\n str.Remove(j, 1);\n }\n\n Console.WriteLine(str);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n Regex r1 = new Regex(\"WUB\");\n string s = Console.ReadLine();\n string[] a = r1.Split(s);\n Console.WriteLine(a[0]);\n if (a.Length == 1 && a[0] != \"\")\n {\n Console.WriteLine(a[0]);\n return;\n }\n s = \"\";\n if (a.Length > 1)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != \"\")\n {\n if (s != \"\") s += \" \";\n s += a[i];\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = true;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n if ((i != s.Length -1 && ((s[i] == 'W' && s[i + 1] != 'U') || (s[i+1] == 'U' && s[i+2] != 'B' && s[i] == 'W'))) || s.Length - i < 1)\n {\n // flag = true;\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n j = 0;\n }\n else\n {\n if (j == 2)\n j = 0;\n else\n j++;\n flag = false;\n }\n }\n else\n {\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n }\n \n }\n Console.WriteLine(res);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\nnamespace ConsoleApplication57\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = Regex.Replace(str, \"wub\", \" \");\n str = Regex.Replace(str, \" +\", \" \");\n Console.WriteLine(\"{0}\", str.Substring(1, str.Length-2));\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = false;\n n = s.Length;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n j++;\n // flag = false;\n }\n else\n {\n j = 0;\n \n flag = true;\n }\n if (j == 3)\n {\n j = 0;\n s = s.Remove(i-2, 3);\n if (flag)\n {\n s = s.Insert(i - 2, \" \");\n i++;\n }\n //else\n if (i > 2)\n i -= 3;\n else\n i = -1;\n flag = false;\n n = s.Length;\n } \n }\n Console.WriteLine(s);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_208A_Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.Substring(3,str.Length-6);\n str = str.Replace(\"WUB\",\" \");\n while (str.IndexOf(\" \") >= 0)\n str = str.Replace(\" \", \" \");\n Console.WriteLine(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication45\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine().ToUpper();\n string y = null;\n for (int i = 0; i < x.Length; i++)\n {\n if (x.Contains(\"WUB\"))\n {\n y = x.Replace(\"WUB\", \" \");\n }\n\n\n }\n Console.WriteLine(y);\n\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n \n Console.WriteLine(s.Replace(\"WUP\", \"\"));\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp7\n{\n}\n\n\n\npublic class Program\n{\n static void Main(string[] args)\n {\n\n string input = Console.ReadLine();\n input = input.Replace(\"wub\", \"\");\n Console.WriteLine(input);\n \n \n \n \n\n }\n}\n"}, {"source_code": "using System;\n\nclass Dubstep\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tConsole.WriteLine(Console.ReadLine().Replace(\"WUB\", \"\"));\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = true;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n if (i != s.Length -1 && (s[i] == 'W' && s[i + 1] != 'U' && s[i+2] != 'B'))\n {\n // flag = true;\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n }\n else\n {\n if (j == 2)\n j = 0;\n else\n j++;\n flag = false;\n }\n }\n else\n {\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n }\n \n }\n Console.WriteLine(res);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string deletefirst(string s)\n {\n if (s[0] == 'W' && s[1] == 'U' && s[2] == 'B')\n return deletefirst(s.Substring(3));\n return s;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = deletefirst(s);\n for (int i = 0; i < s.Length-2; i++)\n {\n if (s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n s = s.Substring(0, i) + \"#\" + s.Substring(i + 3);\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '#')\n {\n if (i == s.Length - 1)\n s = s.Substring(0, i);\n for (int j = i; j < s.Length; j++)\n {\n if (s[j] != '#')\n {\n s = s.Substring(0, i) + ' ' + s.Substring(j);\n break;\n }\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List orginalSong = new List();\n string temp= \"\";\n for (int i = 0; i < input.Length; )\n {\n try {\n if (input[i] == 'W' && input[i + 1] == 'U' && input[i + 2] == 'B')\n {\n if(temp!=\"\")\n orginalSong.Add(temp);\n temp = string.Empty;\n i += 3;\n }\n else\n {\n temp += input[i];\n i++;\n }\n }\n catch {\n break;\n }\n \n }\n foreach (var world in orginalSong)\n {\n Console.Write(world+\" \");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List orginalSong = new List();\n string temp= \"\";\n for (int i = 0; i < input.Length; )\n {\n try {\n if (input[i] == 'W' && input[i + 1] == 'U' && input[i + 2] == 'B')\n {\n if(temp!=\"\")\n orginalSong.Add(temp);\n temp = string.Empty;\n i += 3;\n }\n else\n {\n temp += input[i];\n i++;\n }\n }\n catch {\n break;\n }\n \n }\n if (temp != \"\" && temp != \"W\" && temp != \"WU\" && temp != \"WUP\")\n orginalSong.Add(temp);\n \n foreach (var world in orginalSong)\n {\n Console.Write(world+\" \");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = false;\n n = s.Length;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n j++;\n // flag = false;\n }\n else\n {\n j = 0;\n \n flag = true;\n }\n if (j == 3)\n {\n j = 0;\n s = s.Remove(i-2, 3);\n if (flag)\n {\n s = s.Insert(i - 2, \" \");\n i++;\n }\n //else\n if (i > 2)\n i -= 3;\n else\n i = -1;\n flag = false;\n n = s.Length;\n } \n }\n Console.WriteLine(s);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var input = GetStringInputFromLine();\n input= input.Replace(\"WUB\", \" \");\n input = input.Substring(1, input.Length - 1);\n Console.WriteLine(input);\n\n\n }\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = false;\n n = s.Length;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n j++;\n // flag = false;\n }\n else\n {\n j = 0;\n \n flag = true;\n }\n if (j == 3)\n {\n j = 0;\n s = s.Remove(i-2, 3);\n if (flag)\n {\n s = s.Insert(i - 2, \" \");\n i++;\n }\n //else\n if (i > 2)\n i -= 3;\n else\n i = -1;\n flag = false;\n n = s.Length;\n } \n }\n Console.WriteLine(s);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ca208A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Replace(\"WUB\", string.Empty));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n Regex r1 = new Regex(\"WUB\");\n string s = Console.ReadLine();\n string[] a = r1.Split(s);\n s = \"\";\n if (a.Length > 1)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != \"\")\n {\n if (s != \"\") s += \" \";\n s += a[i];\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace Competitive\n{\n class Solution\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder str = new StringBuilder(\"\");\n\n for (int i = 0; i < s.Length - 2; ++i)\n {\n if (s.Substring(i, 3) == \"WUB\")\n {\n str.Append(\" \");\n i += 2;\n }\n else\n str.Append(s[i]);\n }\n\n if (s.Substring(s.Length - 3, 3) != \"WUB\")\n str.Append(s[s.Length - 2] + \"\" + s[s.Length - 1]);\n\n while (char.IsWhiteSpace(str[0]))\n str.Remove(0, 1);\n\n for (int j = 0; j < str.Length - 1; ++j)\n {\n while (char.IsWhiteSpace(str[j]) && char.IsWhiteSpace(str[j + 1]))\n str.Remove(j, 1);\n }\n\n Console.WriteLine(str);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace dub_regex\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n string the_words = \"\";\n string[] words_per_line = Regex.Split(line, \"WUB\");\n for (int i = 0; i < words_per_line.Length - 1; i++)\n {\n if (words_per_line[i] != \"\")\n {\n if (i == words_per_line.Length - 1)\n {\n the_words += Convert.ToString(words_per_line[i]);\n break;\n }\n Console.WriteLine(\">>\" + Convert.ToString(words_per_line[i]));\n the_words += Convert.ToString(words_per_line[i]) + \" \";\n }\n }\n \n Console.WriteLine(the_words.Substring(0, the_words.Length - 1));\n \n \n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string dub=\"WUB\";\n string song = Console.ReadLine();\n string end = \"\"; int j = 0, i=0;\n while (iwub.Length)\n {\n if (wub == str.Substring(i, 3))\n {\n i += 3;\n }\n else\n {\n while (str.Length - i >= wub.Length && str.Substring(i, 3) != wub)\n {\n if (str.Length - i >= 3)\n {\n song += str.Substring(i, 1);\n i++;\n }\n else\n {\n break;\n }\n }\n song += \" \";\n }\n }\n\n int q = str.Length - i;\n\n if (q == 2 && song.Length>0)\n {\n song = song.Substring(0, song.Length - 1);\n song += str.Substring(i, q);\n }\n else\n {\n if (str.Substring(i, q) != wub)\n {\n song += str.Substring(i, q);\n }\n }\n Console.WriteLine(song);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n Regex r1 = new Regex(\"WUB\");\n string s = Console.ReadLine();\n string[] a = r1.Split(s);\n s = \"\";\n if (a.Length > 1)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] != \"\")\n {\n if (s != \"\") s += \" \";\n s += a[i];\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string deletefirst(string s)\n {\n if (s[0] == 'W' && s[1] == 'U' && s[2] == 'B')\n return deletefirst(s.Substring(3));\n return s;\n }\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = deletefirst(s);\n for (int i = 0; i < s.Length-2; i++)\n {\n if (s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n s = s.Substring(0, i) + \"#\" + s.Substring(i + 3);\n }\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '#')\n {\n if (i == s.Length - 1)\n s = s.Substring(0, i);\n for (int j = i; j < s.Length; j++)\n {\n if (s[j] != '#')\n {\n s = s.Substring(0, i) + ' ' + s.Substring(j);\n break;\n }\n }\n }\n }\n Console.WriteLine(s);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces130\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n string s= Console.ReadLine();\n string outs = \"\";\n int wub = s.IndexOf(\"WUB\");\n while (wub != -1)\n {\n if (wub > 0) outs+=s.Substring(0,wub)+\" \";\n s = s.Substring(wub+3);\n wub = s.IndexOf(\"WUB\");\n }\n Console.WriteLine(outs);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _208A\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] input = Console.ReadLine().ToCharArray();\n bool isCorrectWord = false;\n int pos = 0;\n for (int i = 0; i < input.Length - 3; i++)\n {\n if (input[i] == 'W' && input[i + 1] == 'U' && input[i + 2] == 'B')\n {\n if (isCorrectWord) Console.Write(\" \");\n i = i + 2;\n isCorrectWord = false;\n }\n else\n {\n isCorrectWord = true;\n Console.Write(input[i]);\n }\n pos = i;\n }\n pos++;\n if (input.Length - pos == 3 && input[pos] == 'W' && input[pos + 1] == 'U' && input[pos + 2] == 'B') { }\n else\n {\n for (int i = pos; i < input.Length; i++)\n {\n Console.Write(input[i]);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n var CharString = Console.ReadLine();\n\n var Deleted = CharString.Replace(\"WUB\", \" \");\n Deleted = Regex.Replace(Deleted, @\"\\s+\", \" \");\n\n foreach (var item in Deleted.Skip(1))\n Console.Write(item);\n\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = \"\";\n string[] wub = new string[] { \"W\", \"U\", \"B\" };\n int index = 0;\n string toAdd = \"\";\n for (int i = 0; i < input.Length; i++) \n {\n if (input.Substring(i, 1) == wub[index])\n {\n toAdd += input.Substring(i, 1);\n index++;\n if (index == 3) \n {\n if (output.Length > 0) \n {\n if (output.Substring(output.Length - 1, 1) != \" \") { output += \" \"; }\n }\n index = 0;\n toAdd = \"\";\n }\n continue;\n }\n else \n {\n output += toAdd;\n toAdd = \"\";\n index = 0;\n if (input.Substring(i, 1) == wub[index]) { i--; }\n else { output += input.Substring(i, 1); }\n }\n }\n Console.WriteLine(output);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string q = \"\";\n for (int i = 0; i < a.Length-1; i++)\n {\n if (a[i]=='W'&& a[i+1]=='U' && a[i+2]=='B')\n {\n i += 2;\n q += \" \";\n }\n else\n {\n q += a[i];\n }\n }\n Console.WriteLine(q.TrimStart());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1;\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if ((i > str.Length - 3) && str[str.Length - 1] == 'W') { Console.Write(str[str.Length - 1]); break; }\n else if ((i > str.Length - 3) && (str[str.Length - 2] == 'W')) { Console.Write(str[str.Length - 2] + str[str.Length - 1]); break; }\n \n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i]); chekk = 2; }\n \n }\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace work_with_strings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string wub = \"WUB\";\n string song = \"\";\n int i = 0;\n\n while (str.Length -i>wub.Length)\n {\n if (wub == str.Substring(i, 3))\n {\n i += 3;\n }\n else\n {\n while (str.Length - i >= wub.Length && str.Substring(i, 3) != wub)\n {\n if (str.Length - i >= 3)\n {\n song += str.Substring(i, 1);\n i++;\n }\n else\n {\n break;\n }\n }\n song += \" \";\n }\n }\n\n int q = str.Length - i;\n\n if (q < 3 && song.Length>0)\n {\n song = song.Substring(0, song.Length - 1);\n song += str.Substring(i, q);\n }\n else\n {\n if (str.Substring(i, q) != wub)\n {\n song += str.Substring(i, q);\n }\n }\n Console.WriteLine(song);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var input = GetStringInputFromLine();\n input= input.Replace(\"WUB\", \" \");\n input = input.Substring(1, input.Length - 1);\n Console.WriteLine(input);\n\n\n }\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = \"\";\n string[] wub = new string[] { \"W\", \"U\", \"B\" };\n int index = 0;\n string toAdd = \"\";\n for (int i = 0; i < input.Length; i++) \n {\n if (input.Substring(i, 1) == wub[index])\n {\n toAdd += input.Substring(i, 1);\n index++;\n if (index == 3) \n {\n if (output.Length > 0) \n {\n if (output.Substring(output.Length - 1, 1) != \" \") { output += \" \"; }\n }\n index = 0;\n toAdd = \"\";\n }\n continue;\n }\n else \n {\n output += toAdd;\n toAdd = \"\";\n index = 0;\n if (input.Substring(i, 1) == wub[index]) { i--; }\n else { output += input.Substring(i, 1); }\n }\n }\n Console.WriteLine(output);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesProblem\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var input = GetStringInputFromLine();\n input= input.Replace(\"WUB\", \" \");\n input = input.Substring(1, input.Length - 1);\n Console.WriteLine(input);\n\n\n }\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n string s = Console.ReadLine();\n string res = \"\";\n char[] mas = new char[3] { 'W', 'U', 'B'};\n int j = 0;\n bool flag = true;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == mas[j])\n {\n if (i != s.Length && s[i] == 'W' && s[i + 1] != 'U')\n {\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n }\n else\n {\n if (j == 2)\n j = 0;\n else\n j++;\n flag = false;\n }\n }\n else\n {\n if (!flag && res.Length != 0)\n res += \" \";\n res += s[i];\n flag = true;\n }\n \n }\n Console.WriteLine(res);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = \"\";\n for (int i = 0; i < s.Length - 2; i++) \n {\n if (s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n if (s1 != \"\" && s1[s1.Length - 1] != ' ') s1 += ' ';\n i += 2; \n }\n else s1 += s[i];\n }\n if (s[s.Length - 3] != 'W')\n {\n s1 += s[s.Length - 2];\n s1 += s[s.Length - 1];\n }\n Console.WriteLine(s1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int size = s.Length;\n int i = -1;\n string temp = \"\";\n bool flag = false;\n while (i++2&&s[i] == 'W' && s[i + 1] == 'U' && s[i + 2] == 'B')\n {\n i += 3; bla = 1; word = \"\";\n }\n else\n {\n if (bla == 1) { if (word.Length != 0) a.Add(word); word = \"\"; bla = 0; }\n word += Convert.ToString(s[i]);\n i++;\n }\n }\n if (word.Length != 0) a.Add(word); word = \"\"; bla = 0; \n cout.WriteLine(string.Join(\" \",a.ToArray(typeof(string)) as string[]));\n //cin.ReadLine();\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp7\n{\n\n\n\n\n\n public class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n input = input.Replace(\"wub\", \" \");\n string trim = input.Trim();\n Console.WriteLine(trim);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string h = s.Replace(\"WUB\", \" \");\n string j = h.Substring(2);\n Console.WriteLine(j);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Issue_208A\n{\n class Program\n {\n public static void Main(string[] args) {\n var symbol = 0;\n var buffer = new int[200];\n var buffer_pointer = 0;\n var wuber = 0;\n\n while ((symbol != '\\r') && (symbol != '\\n') && (symbol != -1)) {\n symbol = Console.Read();\n\n buffer[buffer_pointer++] = symbol;\n\n if ((symbol == 'W') && (wuber == 0)) {\n wuber++;\n } else if ((symbol == 'U') && (wuber == 1)) {\n wuber++;\n } else if ((symbol == 'B') && (wuber == 2)) {\n if (FlushBuffer(buffer, buffer_pointer - 3)) {\n Console.Write(' ');\n }\n\n wuber = 0;\n buffer_pointer = 0;\n }\n }\n }\n\n private static bool FlushBuffer(int[] buffer, int length) {\n var result = false;\n\n for (int i = 0; i < length; ++i) {\n Console.Write((char)buffer[i]);\n result = true;\n }\n\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string dub=\"DUB\";\n string song = Console.ReadLine();\n string end = \"\"; int j = 0, i=0;\n while (i 2)\n i -= 3;\n else\n i = -1;\n flag = false;\n n = s.Length;\n } \n }\n Console.WriteLine(s);\n // Console.ReadKey();\n // Console.WriteLine(string.Join(\", \", primeNumbers));\n // Console.ReadLine();\n // var line = Console.ReadLine().Split(new[] { ' ' });\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace work_with_strings\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string wub = \"WUB\";\n string song = \"\";\n int i = 0;\n\n while (str.Length -i>wub.Length)\n {\n if (wub == str.Substring(i, 3))\n {\n i += 3;\n }\n else\n {\n while (str.Length - i >= wub.Length && str.Substring(i, 3) != wub)\n {\n if (str.Length - i >= 3)\n {\n song += str.Substring(i, 1);\n i++;\n }\n else\n {\n break;\n }\n }\n song += \" \";\n }\n }\n\n int q = str.Length - i;\n\n if (q == 2 && song.Length>0)\n {\n song = song.Substring(0, song.Length - 1);\n song += str.Substring(i, q);\n }\n else\n {\n if (str.Substring(i, q) != wub)\n {\n song += str.Substring(i, q);\n }\n }\n Console.WriteLine(song);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string res2 = s.Replace(\"WUB\", String.Empty);\n Console.WriteLine(res2);\n \n }\n }\n}\n"}, {"source_code": "using System;\n\n//namespace A.\u0414\u0430\u0431\u0441\u0442\u0435\u043f\n\nclass Program\n{\n static void Main(string[] args)\n {\n string wubbed = Console.ReadLine();\n\n for (int i = 0; ; )\n {\n try\n {\n if (wubbed[i] == 'W' && wubbed[i + 1] == 'U' && wubbed[i + 2] == 'B')\n {\n wubbed = wubbed.Remove(i, 3);\n // Console.WriteLine(wubbed);\n }\n else\n {\n wubbed = wubbed.Replace(\"WUB\", \" \");\n //Console.WriteLine(wubbed);\n break;\n }\n }\n catch (Exception)\n {\n Console.WriteLine();\n return;\n }\n }\n\n string[] wb = wubbed.Split(' ');\n\n for (int i = 0; i < wb.Length; i++)\n {\n if (wb[i] != \"\")\n {\n Console.Write(wb[i] + \" \");\n }\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _208A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string pattern = @\"(WUB)*\";\n RegexOptions regexOptions = RegexOptions.None;\n Regex regex = new Regex(pattern, regexOptions);\n string inputData = Console.ReadLine().Trim();\n string replacement = @\" \";\n string result = regex.Replace(inputData, replacement);\n Console.WriteLine(result.Trim());\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_208A\n{\n class Program\n {\n public string WordOfSong2(string inp)\n {\n string res = \"\";\n int len = inp.Length;\n if (len < 3) return inp;\n else\n {\n int[] flags = new int[len];\n bool bwub = (inp[0] == 'W') && (inp[1] == 'U') && (inp[2] == 'B');\n int wubst = 0;\n int wubf = 0;\n int i;\n if (bwub)\n {\n i = 3;\n for (int j = 0; j < 3; j++)\n flags[j] = 1;\n }\n else\n i = 0;\n while (i < len - 3)\n {\n wubst = i;\n wubf = i;\n bwub = (inp[i] == 'W') && (inp[i + 1] == 'U') && (inp[i + 2] == 'B');\n while ((bwub == true) && (i < len - 3))\n {\n bwub = (inp[i] == 'W') && (inp[i + 1] == 'U') && (inp[i + 2] == 'B');\n if (bwub)\n {\n i = i + 3;\n wubf = wubf + 3;\n }\n }\n if (wubf - wubst != 0)\n {\n for (int j = wubst; j < wubf; j++)\n {\n flags[j] = 1;\n }\n }\n i++;\n }\n bool bend = (inp[len - 3] == 'W') && (inp[len - 2] == 'U') && (inp[len - 1] == 'B');\n if (bend)\n for (int j = len - 3; j < len; j++) flags[j]++;\n bool bstart = true;\n bool bcons = false;\n for (int j = 0; j < len; j++)\n {\n if (flags[j] == 0)\n {\n res = res + inp[j];\n bstart = false;\n bcons = false;\n }\n if (flags[j] == 1 && !bstart && !bcons)\n {\n res = res + \" \";\n bcons = true;\n }\n }\n for (int j = 0; j < len; j++)\n Console.WriteLine(flags[j].ToString() + \" \");\n return res;\n }\n }\n static void Main(string[] args)\n {\n Program el = new Program();\n string inp = Console.ReadLine();\n //string res = el.WordsOfSong(\"WUBWUBWUBSR\");\n Console.WriteLine(el.WordOfSong2(inp));\n //Console.WriteLine(el.WordOfSong2(\"A\"));\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\n\nnamespace OnlineJudge.Codeforces\n{\n\tpublic class Dubstep\n\t{\n\t\tpublic static string Undub(string text)\n\t\t{\n\t\t\treturn Regex.Replace(text, @\"(?:DUB)+\", \" \").Trim();\n\t\t}\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tConsole.WriteLine(Undub(Console.ReadLine()));\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_208A\n{\n class Program\n {\n public string WordsOfSong(string inp)\n {\n //Console.WriteLine(inp);\n int len = inp.Length;\n string res = \"\";\n bool bwub = (inp[0] == 'W') && (inp[1] == 'U') && (inp[2] == 'B');\n int i;\n bool bstart = true;\n bool onespace = true;\n if (bwub)\n i = 3;\n else\n i=0;\n while (i < len-3)\n {\n bwub = (inp[i] == 'W') && (inp[i + 1] == 'U') && (inp[i + 2] == 'B');\n while ((bwub == true) && (i < len - 3))\n {\n bwub = (inp[i] == 'W') && (inp[i + 1] == 'U') && (inp[i + 2] == 'B');\n if (bwub)\n i = i + 3;\n onespace = true;\n }\n if (!bstart && onespace)\n {\n res = res + \" \";\n }\n bstart = false;\n onespace = false;\n if (i < len-3)\n res = res + inp[i];\n //Console.WriteLine(i.ToString() + \" - \" + res);\n i++;\n }\n bool bend = (inp[len-3] == 'W') && (inp[len-2] == 'U') && (inp[len-1] == 'B');\n\n if (bend)\n return res;\n else\n for (int j = i; j < len; j++)\n res = res + inp[j];\n return res;\n }\n static void Main(string[] args)\n {\n Program el = new Program();\n string inp = Console.ReadLine();\n //string res = el.WordsOfSong(\"WUBWUBWUBSR\");\n Console.WriteLine(el.WordsOfSong(inp));\n //Console.WriteLine(el.WordsOfSong(\"CWUBBWUBWUBWUBEWUBWUBWUBQWUBWUBWUB\"));\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = \"\";\n string[] wub = new string[] { \"W\", \"U\", \"B\" };\n int index = 0;\n string toAdd = \"\";\n for (int i = 0; i < input.Length; i++) \n {\n if (input.Substring(i, 1) == wub[index])\n {\n toAdd += input.Substring(i, 1);\n index++;\n if (index == 3) \n {\n if (output.Length > 0) \n {\n if (output.Substring(output.Length - 1, 1) != \" \") { output += \" \"; }\n }\n index = 0;\n toAdd = \"\";\n }\n continue;\n }\n else \n {\n output += toAdd;\n toAdd = \"\";\n index = 0;\n if (input.Substring(i, 1) == wub[index]) { i--; }\n else { output += input.Substring(i, 1); }\n }\n }\n Console.WriteLine(output);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.ComponentModel;\nusing System.Linq;\n\nnamespace DubStep\n{\n class Program\n {\n static void Main()\n {\n string dj = Console.ReadLine();\n dj = dj.Replace(\"WUBWUBWUB\", \" \");\n dj = dj.Replace(\"WUBWUB\", \" \");\n dj = dj.Replace(\"WUB\", \" \");\n\n dj = dj.Remove(0, 1);\n if (dj[dj.Length-1].Equals(\" \"))\n {\n dj = dj.Remove(dj.Length - 1, 1);\n }\n \n Console.WriteLine(dj);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n var CharString = Console.ReadLine();\n\n var Deleted = CharString.Replace(\"WUB\", \" \");\n Deleted = Regex.Replace(Deleted, @\"\\s+\", \" \");\n\n foreach (var item in Deleted.Skip(1))\n Console.Write(item);\n\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\nnamespace ConsoleApplication57\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = Regex.Replace(str, \"wub\", \" \");\n str = Regex.Replace(str, \" +\", \" \");\n Console.WriteLine(\"{0}\", str.Substring(1, str.Length-2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = \"\";\n string[] wub = new string[] { \"W\", \"U\", \"B\" };\n int index = 0;\n string toAdd = \"\";\n for (int i = 0; i < input.Length; i++) \n {\n if (input.Substring(i, 1) == wub[index])\n {\n toAdd += input.Substring(i, 1);\n index++;\n if (index == 3) \n {\n if (output.Length > 0) \n {\n if (output.Substring(output.Length - 1, 1) != \" \") { output += \" \"; }\n }\n index = 0;\n toAdd = \"\";\n }\n continue;\n }\n else \n {\n output += toAdd;\n toAdd = \"\";\n index = 0;\n if (input.Substring(i, 1) == wub[index]) { i--; }\n else { output += input.Substring(i, 1); }\n }\n }\n Console.WriteLine(output);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace Competitive\n{\n class Solution\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n StringBuilder str = new StringBuilder(\"\");\n\n for (int i = 0; i < s.Length - 2; ++i)\n {\n if (s.Substring(i, 3) == \"WUB\")\n {\n str.Append(\" \");\n i += 2;\n }\n else\n str.Append(s[i]);\n }\n\n if (s.Substring(s.Length - 3, 3) != \"WUB\")\n str.Append(s[s.Length - 2] + \"\" + s[s.Length - 1]);\n\n while (char.IsWhiteSpace(str[0]))\n str.Remove(0, 1);\n\n for (int j = 0; j < str.Length - 1; ++j)\n {\n while (char.IsWhiteSpace(str[j]) && char.IsWhiteSpace(str[j + 1]))\n str.Remove(j, 1);\n }\n\n Console.WriteLine(str);\n }\n }\n}"}, {"source_code": "using System;\n\n//namespace A.\u0414\u0430\u0431\u0441\u0442\u0435\u043f\n\nclass Program\n{\n static void Main(string[] args)\n {\n string wubbed = Console.ReadLine();\n\n for (int i = 0; ; )\n {\n try\n {\n if (wubbed[i] == 'W' && wubbed[i + 1] == 'U' && wubbed[i + 2] == 'B')\n {\n wubbed = wubbed.Remove(i, 3);\n // Console.WriteLine(wubbed);\n }\n else\n {\n wubbed = wubbed.Replace(\"WUB\", \" \");\n //Console.WriteLine(wubbed);\n break;\n }\n }\n catch (Exception)\n {\n Console.WriteLine();\n return;\n }\n }\n\n string[] wb = wubbed.Split(' ');\n\n for (int i = 0; i < wb.Length; i++)\n {\n if (wb[i] != \"\")\n {\n Console.Write(wb[i] + \" \");\n }\n }\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\nnamespace ConsoleApplication57\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = Regex.Replace(str, \"wub\", \" \");\n str = Regex.Replace(str, \" +\", \" \");\n Console.WriteLine(\"{0}\", str.Substring(1, str.Length-2));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace A23_7_12\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] aos = Regex.Split(s, @\"WUB+\");\n for (int i = 0; i < aos.Length; i++)\n if (aos[i] != \"\")\n Console.Write(aos[i]+\" \");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A.Dubstep__208_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string song = Console.ReadLine();\n Console.WriteLine(ReturnToOriginals(song));\n }\n\n public static string ReturnToOriginals(string song)\n {\n\n string songLyrics = \"\";\n string tempWord = \"\";\n for (int i = 0; i < song.Length - 2; i++)\n {\n if (song[i] == 'W' && song[i + 1] == 'U' && song[i + 2] == 'B')\n {\n\n i = i + 2;//Jump a word(WUP)\n if (tempWord != \"\")\n {\n songLyrics += (tempWord + \" \");\n tempWord = \"\";\n }\n }\n else\n {\n tempWord += song[i];\n\n }\n }\n return songLyrics.Trim();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string h = s.Remove(s.IndexOf(\"WUB\"));\n Console.WriteLine(h);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string rt = \"WUBWUBABCWUB\";\n \n Console.WriteLine( rt.Replace(\"WUB\", \"\"));\n \n }\n \n\n\n \n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string songRemax = Console.ReadLine();\n string temp,song=null;\n bool check = false;\n for (int i = 0; i < songRemax.Length; i++)\n {\n if(songRemax[i]=='W')\n {\n for (int K = i,n=0; n < 3; K++,n++)\n {\n if(songRemax[K]=='W')\n {\n continue;\n }\n if (songRemax[K] == 'U')\n {\n continue;\n }\n if (songRemax[K] == 'B')\n {\n if(song !=null)\n {\n song += \" \";\n }\n i += 2;\n check = true;\n }\n else\n break;\n }\n if (check)\n {\n check = false;\n continue;\n }\n else\n {\n song += Convert.ToString(songRemax[i]); \n }\n }\n else\n {\n song += Convert.ToString(songRemax[i]);\n }\n }\n Console.WriteLine(song);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Prizes_Prizes_more_Prizes\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Replace(\"WUB\",\"\").Trim());\n //long n = long.Parse(Console.ReadLine());\n //long[] pointsPerBar = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n //long[] pricePerPrize = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n //long[] boughtPrize = new long[pricePerPrize.Length];\n\n //long actualPoints = 0;\n //for (long i = 0; i < pointsPerBar.Length; i++)\n //{\n // actualPoints += pointsPerBar[i];\n // //while (actualPoints >= pricePerPrize[0])\n // //{\n // for (long k = pricePerPrize.Length - 1; k >= 0; k--)\n // {\n // //if (actualPoints >= pricePerPrize[k])\n // //{\n // // actualPoints -= pricePerPrize[k];\n // // boughtPrize[k]++;\n // // break;\n // //}\n // if(actualPoints / pricePerPrize[k] > 0)\n // {\n // boughtPrize[k] += actualPoints / pricePerPrize[k];\n // actualPoints = actualPoints % pricePerPrize[k];\n // }\n // }\n // //}\n //}\n //foreach (var item in boughtPrize)\n //{\n // Console.Write(item + \" \");\n //}\n //Console.WriteLine();\n //Console.WriteLine(actualPoints);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n\n static void Main(string[] args)\n {\n string result=\"\",line = Console.ReadLine();\n for(int i =0;imax){\n max = ar[i];\n id = i;\n }\n }\n }\n\n return id;\n }\n\n }\n\n\n class Util\n {\n public static int getNum()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static int[] getArray()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] array = new int[str.Length];\n\n for (int i = 0; i < array.Length; i++)\n {\n try\n {\n array[i] = int.Parse(str[i]);\n }\n catch (Exception e)\n {\n //Console.WriteLine(str[i]+\"/\");\n }\n }\n\n return array;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = \"WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\";\n \n Console.WriteLine(s.Replace(\"WUB\",\" \").Trim());\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n List orginalSong = new List();\n string temp= \"\";\n for (int i = 0; i < input.Length; )\n {\n try {\n if (input[i] == 'W' && input[i + 1] == 'U' && input[i + 2] == 'B')\n {\n if(temp!=\"\")\n orginalSong.Add(temp);\n temp = string.Empty;\n i += 3;\n }\n else\n {\n temp += input[i];\n i++;\n }\n }\n catch {\n break;\n }\n \n }\n foreach (var world in orginalSong)\n {\n Console.Write(world+\" \");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n for(int i = 0; i < input.Length-2; i ++)\n {\n if(input[i] == 'W' && input[i+1] == 'U' && input[i+2] == 'B')\n {\n input = input.Substring(0, i) + ' ' + input.Substring(i + 3, input.Length - i - 4);\n }\n }\n \n Console.Write(input.Trim());\n }\n }\n}"}, {"source_code": "\n\n\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text.RegularExpressions;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static long[] num;\n static int n;\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string ris=\"\";\n int pos = 0;\n s = \"WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\";\n bool spazio = false;\n \n while (pos < s.Length)\n {\n if (s.Substring(pos, 3) != \"WUB\")\n {\n ris += s[pos];\n pos++;\n spazio = true;\n }\n else \n {\n if (spazio)\n {\n ris += \" \";\n spazio = false;\n }\n pos += 3;\n }\n }\n Console.WriteLine(ris);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codefather_is_riseing_ha_ha_ha\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chekk = 1;\n string str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n if (i + 2 <= str.Length)\n {\n if (str[i] == 'W' && str[i + 1] == 'U' && str[i + 2] == 'B') { i = i + 2; if (chekk == 2) { Console.Write(\" \"); } }\n else { Console.Write(str[i]); chekk = 2; }\n }\n }\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n for(int i = 0; i < input.Length-2; i ++)\n {\n if(input[i] == 'W' && input[i+1] == 'U' && input[i+2] == 'B')\n {\n input = input.Substring(0, i) + ' ' + input.Substring(i + 3, input.Length - i - 4);\n }\n }\n \n Console.Write(input.Trim());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dubstep\n{\n class Program\n {\n static void Main(string[] args)\n {\n string dub=\"DUB\";\n string song = Console.ReadLine();\n string end = \"\"; int j = 0, i=0;\n while (i= 0; i--)\n {\n a[vrem[0].Length - 1 - i] = vrem[0][i];\n if (a[vrem[0].Length - 1 - i] >= 65 && a[vrem[0].Length - 1 - i] <= 90)\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 55);\n else\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 48);\n }\n for (int i = vrem[1].Length - 1; i >= 0; i--)\n {\n b[vrem[1].Length - 1 - i] = vrem[1][i];\n if (b[vrem[1].Length - 1 - i] >= 65 && b[vrem[1].Length - 1 - i] <= 90)\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 55);\n else\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 48);\n }\n\n\n int max = 0;\n for (int i = 0; i < a1.Length; i++)\n {\n if (max < a1[i])\n max = a1[i];\n if (max < b1[i])\n max = b1[i];\n }\n\n\n\n int[] otvet = new int[61];\n int k = max;\n\n double q = 0;\n double w = 0;\n while (k < 61)\n {\n k++;\n q = 0;\n w = 0;\n for (int i = a1.Length - 1; i >= 0; i--)\n q = q + a1[i] * Math.Pow(k, i);\n\n for (int i = b1.Length - 1; i >= 0; i--)\n w = w + b1[i] * Math.Pow(k, i);\n\n if (q <= 23 && w <= 59)\n otvet[k-1] = k;\n else\n break;\n }\n\n if (k == 61)\n Console.WriteLine(\"-1\");\n else if (k == max + 1)\n Console.WriteLine(\"0\");\n else\n {\n for (int i = 0; i < otvet.Length; i++)\n if (otvet[i] != 0)\n Console.Write(otvet[i] + \" \");\n } \n \n \n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nnamespace Iran\n{\n class AmirGoharshady\n {\n static bool ok(string chk, int maxim, int ba)\n {\n long total = 0;\n for (int i = 0; i < chk.Length; ++i)\n {\n int C;\n if (chk[i] >= '0' && chk[i] <= '9')\n C = chk[i] - '0';\n else if (chk[i] >= 'A' && chk[i] <= 'Z')\n C = chk[i] - 'A' + 10;\n else\n return false;\n if (C >= ba)\n return false;\n total *= ba;\n total += C;\n if (total > maxim)\n return false;\n }\n return true;\n }\n public static void Main()\n {\n string[] inp = Console.ReadLine().Split(':');\n if (ok(inp[0], 23, 100) && ok(inp[1], 59, 100))\n {\n Console.WriteLine(\"-1\");\n return;\n }\n bool prn = false;\n for(int i=2;i<=100;++i)\n if (ok(inp[0], 23, i) && ok(inp[1], 59, i))\n {\n Console.Write(i.ToString()+\" \");\n prn = true;\n }\n if (prn == false)\n Console.WriteLine(\"0\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class B\n{\n public partial class Myon\n {\n\n static void Main()\n {\n B p = new B();\n p.solve();\n }\n\n }\n\n public void solve()\n {\n string[] str = stringRead().Split(':');\n List res = new List();\n\n for (int i = 1; i < 70; i++)\n {\n if (!Check(str[0], i) || !Check(str[1], i))\n continue;\n int h = Sum(str[0], i);\n int m = Sum(str[1], i);\n if (h < 24 && m < 60)\n res.Add(i);\n }//for i\n\n foreach(int a in res)\n if (a > 60)\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (res.Count == 0)\n {\n Console.WriteLine(0);\n return;\n }\n\n for (int i = 0; i < res.Count; i++)\n {\n Console.Write(res[i]);\n if(i!=res.Count-1)\n Console.Write(\" \");\n }//for i\n Console.WriteLine();\n }\n\n int Sum(string str, int radix)\n {\n int res = 0;\n int mul = 1;\n for (int i = str.Length - 1; i >= 0; i--)\n {\n res += CharToInt(str[i] )* mul;\n mul *= radix;\n }//forrev i\n return res;\n }\n\n bool Check(string str, int radix)\n {\n for (int i = 0; i < str.Length; i++)\n {\n if (CharToInt(str[i]) >= radix)\n return false;\n }//for i\n return true;\n }\n\n public static int CharToInt(char c)\n {\n if ('0' <= c && c <= '9')\n return c - '0';\n if ('A' <= c && c <= 'Z')\n return c - 'A' + 10;\n return -1;\n }//CharToInt\n\n public static char IntToChar(int i)\n {\n return (char)(i + '0');\n }//IntToChar\n\n\n string stringRead()\n { return Console.ReadLine(); }\n\n int intRead()\n { return int.Parse(Console.ReadLine()); }\n\n long longRead()\n { return long.Parse(Console.ReadLine()); }\n\n string[] stringSplit(char a)\n { return Console.ReadLine().Split(a); }\n\n int[] intSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), int.Parse); }\n\n long[] longSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), long.Parse); }\n\n void write(string str)\n {\n Console.WriteLine(str);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class B\n {\n private static int V(char ch)\n {\n if (ch - '0' >= 0 && ch - '0' <= 9) return ch - '0';\n return ch - 'A' + 10;\n }\n\n private static int Convert(string s, int rad)\n {\n int v = 0;\n int m = 1;\n for (int i = s.Length - 1; i >=0 ; i--)\n {\n if (V(s[i]) >= rad) return -1;\n v += m * V(s[i]);\n m *= rad;\n }\n\n return v;\n }\n\n private static object Go()\n {\n string[] data = GetString().Split(':');\n string h = data[0];\n string m = data[1];\n\n List sol = new List();\n for (int rad = 2; rad < 61; rad++)\n {\n int hi = Convert(h, rad);\n int mi = Convert(m, rad);\n\n if (hi > -1 && mi > -1 && hi < 24 && mi < 60)\n {\n sol.Add(rad.ToString());\n if (rad == 60)\n {\n return -1;\n }\n }\n }\n\n if (sol.Count == 0) return 0;\n\n return string.Join(\" \", sol.ToArray());\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n object output = Go();\n if (output != null)\n Wl(output.ToString());\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static void Wl(T o)\n {\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n public struct Tuple\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\n\n\nclass c106_p2\n{\n static int digit(char ch)\n {\n if (ch <= '9') return ch - '0';\n else return (ch - 'A') + 10;\n }\n\n static int number(string num, int b)\n {\n int fact = 1;\n int res = 0;\n for (int i = num.Length - 1; i >= 0; i--)\n {\n res += fact * digit(num[i]);\n fact *= b;\n }\n return res;\n }\n\n static void Main()\n {\n //Console.SetIn(new StreamReader(new FileStream(\"../../in.txt\", FileMode.Open)));\n //StreamWriter out_sw = new StreamWriter(new FileStream(\"../../out.txt\", FileMode.Create));\n //Console.SetOut(out_sw);\n\n string time = Console.In.ReadLine();\n string[] ss = time.Split(new char[] { ':' });\n string h = ss[0].TrimStart(new char[] { '0' });\n if (h == \"\") h = \"0\";\n string m = ss[1].TrimStart(new char[] { '0' });\n if (m == \"\") m = \"0\";\n char[] dg = (h + m).ToCharArray(); \n Array.Sort(dg);\n char max = dg[dg.Length - 1];\n int fb = digit(max) + 1;\n if (fb == 1) \n {\n Console.Out.WriteLine(\"-1\");\n return;\n }\n if (h.Length == 1 && m.Length == 1)\n {\n if (digit(h[0]) <= 23 && digit(m[0]) <= 59)\n {\n Console.Out.WriteLine(\"-1\");\n return;\n }\n }\n\n if (number(h, fb) > 23 || number(m, fb) > 59)\n {\n Console.Out.WriteLine(\"0\");\n return;\n }\n\n for (int b = fb; ; b++)\n {\n if (number(h, b) > 23 || number(m, b) > 59) break;\n else Console.Out.WriteLine(b + \" \");\n }\n \n\n Console.Out.WriteLine();\n //out_sw.Close();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = ReadArray();\n var res = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n res[i] = ReadNextInt(input, i);\n }\n return res;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = Read();\n var index = input.IndexOf(\":\");\n var h = input.Substring(0, index);\n var m = input.Substring(index + 1);\n var hInt = GetInts(h);\n var mInt = GetInts(m);\n var maxH = hInt.Max();\n var maxM = mInt.Max();\n if(hInt.Count == 1 && mInt.Count == 1)\n {\n if(hInt[0] > 23)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(-1);\n }\n }\n else\n {\n var i = 0;\n for (i = 59; i > 1; i--)\n {\n if(i <= maxH || i <= maxM)\n {\n i = -1;\n break;\n }\n var hT = GetN(i, hInt);\n var mT = GetN(i, mInt);\n if(hT <=23 && mT <=59 && hT >= 0 && mT >= 0)\n break;\n }\n if(i<=1)\n {\n Console.WriteLine(0);\n return;\n }\n var res = new StringBuilder();\n for (int j = Math.Max(2, Math.Max(maxH, maxM) + 1); j <= i; j++)\n {\n res.Append(j + \" \");\n }\n Console.WriteLine(res.ToString().TrimEnd());\n }\n }\n\n private static long GetN(int t, List ints)\n {\n long res = 0;\n for (int i = 0; i < ints.Count; i++)\n {\n res *= t;\n res += ints[i];\n if (res > 60)\n return res;\n }\n return res;\n }\n\n private static List GetInts(string s)\n {\n var res = new List();\n\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i] == '0' && res.Count == 0)\n continue;\n\n if(char.IsLetter(s[i]))\n {\n res.Add((s[i] - 'A') + 10);\n }\n else\n {\n res.Add(s[i] - '0');\n }\n }\n\n if(res.Count == 0)\n res.Add(0);\n\n return res;\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace AcmSolution4\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(\"../../../a.txt\"));\n#endif\n\n string s = GetStr();\n var ss = s.Split(':');\n string a = ss[0], b = ss[1];\n\n while (a.Length > 1 && a[0] == '0')\n a = a.Substring(1);\n\n while (b.Length > 1 && b[0] == '0')\n b = b.Substring(1);\n\n var aa = new List();\n var bb = new List();\n foreach (char c in a)\n {\n if (char.IsDigit(c))\n aa.Add(c - '0');\n else\n aa.Add(c - 'A' + 10);\n }\n\n foreach (char c in b)\n {\n if (char.IsDigit(c))\n bb.Add(c - '0');\n else\n bb.Add(c - 'A' + 10);\n }\n\n int[] min = {0};\n aa.ForEach(x => min[0] = Math.Max(x, min[0]));\n bb.ForEach(x => min[0] = Math.Max(x, min[0]));\n\n ++min[0];\n\n int max = 0;\n bool good = true;\n\n for (int Base = min[0]; good && Base < 70; ++Base)\n {\n int t = 1;\n int res = 0;\n for (int i = aa.Count - 1; good && i >= 0; --i)\n {\n if (i != aa.Count - 1) t *= Base;\n res += aa[i]*t;\n if (res > 23) good = false;\n }\n if (good)\n max = Base;\n }\n\n int max2 = 0;\n if (max >= min[0])\n {\n good = true;\n for (int Base = min[0]; good && Base < 70; ++Base)\n {\n int t = 1;\n int res = 0;\n for (int i = bb.Count - 1; good && i >= 0; --i)\n {\n if (i != bb.Count - 1) t *= Base;\n res += bb[i]*t;\n if (res > 59) good = false;\n }\n if (good)\n max2 = Base;\n }\n }\n\n max = Math.Min(max, max2);\n\n if (max > 60)\n WL(\"-1\");\n else if (max < min[0])\n WL(\"0\");\n else for (int i = min[0]; i <= max; ++i)\n W(i + \" \");\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static int GetInt(string s)\n {\n return int.Parse(s);\n }\n\n static int[] GetInts()\n {\n string[] ss = GetStrs();\n int[] nums = new int[ss.Length];\n\n int i = 0;\n foreach (string s in ss)\n nums[i++] = GetInt(s);\n\n return nums;\n }\n\n static string[] GetStrs()\n {\n return Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n }\n\n internal class Pair\n {\n public int number;\n public int value;\n public Pair(int i, int j)\n {\n number = i;\n value = j;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace MarsClock\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split(':');\n if (check(tokens[0], 23, 100) && check(tokens[1], 59, 100))\n {\n Console.WriteLine(\"-1\");\n return;\n }\n bool prn = false;\n for (int i = 2; i <= 100; ++i)\n if (check(tokens[0], 23, i) && check(tokens[1], 59, i))\n {\n Console.Write(i.ToString() + \" \");\n prn = true;\n }\n if (prn == false)\n Console.WriteLine(\"0\");\n }\n static bool check(string chk, int maxim, int ba)\n {\n long total = 0;\n for (int i = 0; i < chk.Length; ++i)\n {\n int C;\n if (chk[i] >= '0' && chk[i] <= '9')\n C = chk[i] - '0'; // \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u0434\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0432\u044b\u0447\u0438\u0442\u0430\u044f \u0441\u0438\u043c\u0432\u043e\u043b \u043d\u043e\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0438\u0441\u043b\u043e\n else if (chk[i] >= 'A' && chk[i] <= 'Z')\n C = chk[i] - 'A' + 10; //\u0410 \u0442\u0443\u0442 \u0432\u044b\u0447\u0438\u0442\u0430\u044f \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0447\u0438\u0441\u043b\u043e \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c 10\n else\n return false;\n if (C >= ba)\n return false;\n total *= ba;\n total += C;\n if (total > maxim)\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static int intFromStrBase(string s, int b)\n {\n int[] a = s.Select(c => c >= '0' && c <= '9' ? c - '0' : c >= 'A' && c <= 'Z' ? c - 'A' + 10 : 999).ToArray();\n if (a.Any(x => x >= b))\n return -1;\n\n int sum = 0;\n for (int i = 0; i < a.Length; i++)\n {\n sum = sum * b + a[i];\n if (sum > 60)\n return -1;\n }\n\n return sum;\n }\n\n static bool possible(string h, string m, int b)\n {\n int ih = intFromStrBase(h, b);\n int im = intFromStrBase(m, b);\n return (ih >= 0 && ih <= 23 && im >= 0 && im <= 59);\n }\n\n static void Main(string[] args)\n {\n string[] hm = Console.ReadLine().Split(':');\n while (hm[0].Length > 1 && hm[0].StartsWith(\"0\"))\n hm[0] = hm[0].Substring(1);\n while (hm[1].Length > 1 && hm[1].StartsWith(\"0\"))\n hm[1] = hm[1].Substring(1);\n\n\n List poss = new List();\n for (int i = 1; i <= 100; i++)\n if (possible(hm[0], hm[1], i))\n poss.Add(i);\n\n if (possible(hm[0], hm[1], 99))\n Console.WriteLine(-1);\n else if(poss.Count == 0)\n Console.WriteLine(0);\n else\n foreach(var x in poss)\n Console.Write(\"{0} \", x);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] hm = Console.ReadLine().Split(':');\n\n Func s2i = (s, b) =>\n {\n var a = s.Select(c => (c <= '9') ? c - '0' : c - 'A' + 10).ToArray();\n if (a.Any(x => x >= b)) return 60;\n return a.Aggregate((acc, x) => acc < 60 ? acc * b + x : acc);\n };\n\n var possible = Enumerable.Range(1, 100).Where(x => s2i(hm[0], x) <= 23 && s2i(hm[1], x) <= 59).ToArray();\n\n if(!possible.Any())\n Console.WriteLine(0);\n else if(possible.Last() == 100)\n Console.WriteLine(-1);\n else\n foreach(var x in possible)\n Console.Write(\"{0} \", x);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\npublic class pB\n{\n public static void Main ( )\n {\n#if false\n Console.SetIn ( new StreamReader ( @\"e:\\zin.txt\" ) );\n#endif\n calc ( );\n //Console.WriteLine ( calc() );\n }\n\n private static int calc ( )\n {\n int z=0;\n string inp = Console.ReadLine ( );\n int cpos = inp.IndexOf ( ':' );\n string hr = inp.Substring ( 0, cpos );\n string min = inp.Substring ( cpos + 1 );\n char[] chr = hr.ToCharArray();\n char[] cmin = min.ToCharArray();\n for ( int i=0; i < chr.Length; i++ )\n if ( chr[i] != '0' )\n break;\n else\n chr[i] = ' ';\n for ( int i=0; i < cmin.Length; i++ )\n if ( cmin[i] != '0' )\n break;\n else\n cmin[i] = ' ';\n hr = new string ( chr );\n min = new string ( cmin );\n hr = hr.Trim ( );\n min = min.Trim ( );\n if ( hr == \"\" )\n hr = \"0\";\n if ( min == \"\" )\n min = \"0\";\n\n int minresh;\n int maxresh;\n int minresn;\n int maxresn;\n int mindigit;\n int maxdigit;\n //hr\n mindigit = 99;\n maxdigit = 0;\n for ( int i=0; i < hr.Length; i++ )\n {\n char c = hr[i];\n int val;\n if ( c >= 'A' )\n val = 10 + Convert.ToInt32 ( c ) - Convert.ToInt32 ( 'A' );\n else\n val = int.Parse ( c.ToString ( ) );\n \n mindigit = Math.Min ( mindigit, val );\n maxdigit = Math.Max ( maxdigit, val );\n }\n int minbase = maxdigit + 1;\n\n mindigit = 99;\n maxdigit = 0;\n for ( int i=0; i < min.Length; i++ )\n {\n char c = min[i];\n int val = ctoi ( c );\n mindigit = Math.Min ( mindigit, val );\n maxdigit = Math.Max ( maxdigit, val );\n }\n minbase = Math.Max ( minbase, maxdigit + 1 );\n\n bool infH=false;\n if ( hr.Length == 1 )\n {\n if ( ctoi(hr[0]) < 24 )\n infH = true;\n }\n bool infM=false;\n if ( min.Length == 1 )\n {\n if ( ctoi ( min[0] ) < 59 )\n infM = true;\n }\n if ( infH && infM )\n {\n Console.WriteLine(-1);\n return -1;\n }\n\n int bs = minbase;\n bool valid = true;\n while ( true )\n {\n int hrval=0;\n for ( int i=hr.Length - 1; i >= 0; i-- )\n {\n hrval += ctoi(hr[i]) * ( int ) Math.Pow ( bs, hr.Length - 1 - i );\n }\n int minval=0;\n for ( int i=min.Length - 1; i >= 0; i-- )\n {\n minval += ctoi ( min[i] ) * ( int ) Math.Pow ( bs, min.Length - 1 - i );\n }\n if ( minval > 59 || hrval > 23 )\n break;\n bs++;\n }\n int maxbase = bs-1;\n if ( maxbase < minbase )\n {\n Console.WriteLine ( \"0\" );\n return 0;\n }\n\n for ( int i=minbase; i <= maxbase; i++ )\n {\n Console.Write ( i );\n if ( i < maxbase )\n Console.Write ( \" \" );\n }\n \n return 0;\n }\n\n public static int ctoi ( char c )\n {\n int val;\n if ( c < 'A' )\n val = int.Parse ( c.ToString ( ) );\n else\n val = 10 + Convert.ToInt32 ( c ) - Convert.ToInt32 ( 'A' );\n return val;\n }\n\n public static int[] ReadLineToInts ( )\n {\n string line = Console.ReadLine ( );\n string[] arStrings = line.Split ( new char[] { ' ' } );\n\n int N = arStrings.Length;\n int[] ints = new int[N];\n for ( int i=0; i < N; i++ )\n ints[i] = int.Parse ( arStrings[i] );\n return ints;\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\npublic class EllysCheckers\n{\n public static int [] time(string t)\n {\n int [] res = new int[t.Length];\n for (int i = 0; i < t.Length; i++) {\n \n if(t[t.Length - i - 1]>='A' && t[t.Length - i - 1] <= 'Z')\n {\n res[i] = (int)t[t.Length - i - 1] - 55; \n }\n else\n {\n res[i] = int.Parse(t[t.Length - i - 1].ToString());\n }\n }\n return res;\n \n }\n public static bool check(int[] t, int s, bool type )\n {\n int z = 1;\n int ans = 0;\n for (int i = 0; i < t.Length; i++) {\n if(t[i] >= s)\n return false;\n ans += t[i] * z;\n z *= s;\n }\n if(type)\n if(ans >= 24)\n return false;\n else \n return true;\n else\n if(ans >= 60)\n return false;\n else \n return true;\n }\n public static void Main(string[] args)\n {\n string []str = Console.ReadLine().Split(':').ToArray();\n string hour = str[0];\n string min = str[1];\n int [] h = time(hour);\n int [] m = time(min);\n if(check(h, 61, true) && check(m, 61, false))\n {\n Console.WriteLine (-1);\n return;\n }\n List ans = new List();\n for (int i = 2; i <=60; i++) {\n if(check(h, i, true) && check(m, i, false))\n ans.Add(i);\n }\n if(ans.Count == 0)\n Console.WriteLine (0);\n else\n {\n string pr = \"\";\n foreach (var item in ans) {\n Console.Write(pr + item);\n pr = \" \";\n }\n }\n \n \n }\n\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n private static readonly string NRange = new string(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' });\n\n private void Solve()\n {\n var s = io.NextLine().Split(':');\n\n s[0] = s[0].TrimStart('0');\n s[1] = s[1].TrimStart('0');\n\n var min = 0;\n\n for (int i = 0; i < 2; i++)\n {\n for (int j = 0; j < s[i].Length; j++)\n {\n min = Math.Max(min, NRange.IndexOf(s[i][j]));\n }\n }\n\n if (min > 0)\n {\n List parts = new List();\n\n var pch = -1;\n var pcm = -1;\n\n int i = min;\n\n do\n {\n var ch = Calc10(s[0], i);\n var cm = Calc10(s[1], i);\n\n if (ch < 24 && cm < 60)\n {\n if (pch == ch && pcm == cm)\n {\n io.Print(-1);\n return;\n }\n\n parts.Add((i + 1).ToString(CultureInfo.InvariantCulture));\n }\n else\n {\n break;\n }\n pch = ch;\n pcm = cm;\n\n\n } while (++i < 10000000);\n\n if (parts.Count > 0)\n {\n io.Print(string.Join(\" \", parts.ToArray()));\n return;\n }\n io.Print(0);\n return;\n }\n\n io.Print(-1);\n }\n\n private int Calc10(string s, int min)\n {\n int res = 0;\n\n foreach (var c in s)\n {\n res *= (min + 1);\n res += NRange.IndexOf(c);\n }\n\n return res;\n\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic int dgt(char c)\n\t\t{\n\t\t\tif ('0' <= c && c <= '9')\n\t\t\t{\n\t\t\t\treturn c - '0';\n\t\t\t}\n\t\t\treturn 10 + c - 'A';\n\t\t}\n\n\n\t\tstatic int to_num(string s, int n)\n\t\t{\n\t\t\tint num = 0;\n\t\t\tint k = 1;\n\t\t\tfor (int i = 1; i <= s.Length; i++)\n\t\t\t{\n\t\t\t\tnum += dgt(s[s.Length - i]) * k;\n\t\t\t\tk *= n;\n\t\t\t}\n\t\t\treturn num;\n\t\t}\n\t\tstatic bool fit(string s1, string s2, int n)\n\t\t{\n\t\t\treturn to_num(s1, n) < 24 && to_num(s2, n) < 60;\n\t\t}\n\n\t\tstatic int get_min(string s)\n\t\t{\n\t\t\tint min = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (dgt(s[i]) > min)\n\t\t\t\t{\n\t\t\t\t\tmin = dgt(s[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn min;\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input = Console.ReadLine();\n\t\t\tvar times = input.Split(':');\n\t\t\tint min = Math.Max(get_min(times[0]), get_min(times[1])) + 1;\n\n\t\t\tif (fit(times[0], times[1], 60))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint i;\n\t\t\t\tfor (i = min; i <= 59; i++)\n\t\t\t\t{\n\t\t\t\t\tif (!fit(times[0], times[1], i))\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tConsole.Write(\"{0} \", i);\n\t\t\t\t}\n\t\t\t\tif (i == min)\n\t\t\t\t\tConsole.WriteLine(0);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Martian_Clock\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string[] ss = reader.ReadLine().Split(':');\n\n int min = Math.Max(2, 1+Math.Max(ss[0].Max(t => Code(t)), ss[1].Max(t => Code(t))));\n\n int h = Convert(ss[0], min);\n int m = Convert(ss[1], min);\n\n if (h > 23 || m > 59)\n writer.WriteLine(\"0\");\n else if (h < min && m < min)\n writer.WriteLine(\"-1\");\n else\n {\n for (int i = min;; i++)\n {\n h = Convert(ss[0], i);\n m = Convert(ss[1], i);\n\n if (h <= 23 && m <= 59)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n else break;\n }\n }\n\n writer.Flush();\n }\n\n private static int Code(char t)\n {\n return t <= '9' ? t - '0' :10 + (t - 'A');\n }\n\n private static int Convert(string s, int r)\n {\n int ans = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n ans = ans*r + Code(s[i]);\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n while (true)\n {\n String[] buf = Console.ReadLine().Split(':');\n String ret = \"\";\n if (can(buf, 1024))\n {\n Console.WriteLine(\"-1\");\n continue;\n }\n for (int i = 2; i <= 1024; i++)\n {\n if (can(buf, i))\n {\n ret = ret + i + \" \";\n }\n }\n if (ret == \"\")\n ret = \"0\";\n Console.WriteLine(ret);\n }\n }\n catch (Exception)\n {\n }\n }\n\n private static bool can(string[] buf, int b)\n {\n long[] d = new long[2];\n for (int i = 0; i < 2; i++)\n {\n d[i] = 0;\n for (int j = 0; j < buf[i].Length; j++)\n {\n int fd = buf[i][j] >= '0' && buf[i][j] <= '9' ? buf[i][j] - '0' : buf[i][j] - 'A' + 10;\n if (fd >= b) return false;\n d[i] = d[i] * b + fd;\n }\n }\n return d[0] >= 0 && d[0] <= 23 && d[1] >= 0 && d[1] <= 59;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n if (GetDecimal(hours, initbase, chars) >= 24 || GetDecimal(minutes, initbase, chars) >= 60)\n {\n Console.WriteLine(0); return;\n }\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = ReadArray();\n var res = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n res[i] = ReadNextInt(input, i);\n }\n return res;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = Read();\n var index = input.IndexOf(\":\");\n var h = input.Substring(0, index);\n var m = input.Substring(index + 1);\n var hInt = GetInts(h);\n var mInt = GetInts(m);\n var maxH = hInt.Max();\n var maxM = mInt.Max();\n if(hInt.Count == 1 && mInt.Count == 1)\n {\n if(hInt[0] > 23)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(-1);\n }\n }\n else\n {\n var i = 0;\n for (i = 24; i > 1; i--)\n {\n if(i <= maxH || i <= maxM)\n {\n i = -1;\n break;\n }\n var hT = GetN(i, hInt);\n var mT = GetN(i, mInt);\n if(hT <=23 && mT <=59)\n break;\n }\n if(i<=1)\n {\n Console.WriteLine(0);\n return;\n }\n var res = new StringBuilder();\n for (int j = Math.Max(maxH, maxM) + 1; j <= i; j++)\n {\n res.Append(j + \" \");\n }\n Console.WriteLine(res.ToString().TrimEnd());\n }\n }\n\n private static long GetN(int t, List ints)\n {\n long res = 0;\n for (int i = 0; i < ints.Count; i++)\n {\n res *= t;\n res += ints[i];\n }\n return res;\n }\n\n private static List GetInts(string s)\n {\n var res = new List();\n\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i] == '0' && res.Count == 0)\n continue;\n\n if(char.IsLetter(s[i]))\n {\n res.Add((s[i] - 'A') + 10);\n }\n else\n {\n res.Add(s[i] - '0');\n }\n }\n\n if(res.Count == 0)\n res.Add(0);\n\n return res;\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = ReadArray();\n var res = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n res[i] = ReadNextInt(input, i);\n }\n return res;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = Read();\n var index = input.IndexOf(\":\");\n var h = input.Substring(0, index);\n var m = input.Substring(index + 1);\n var hInt = GetInts(h);\n var mInt = GetInts(m);\n var maxH = hInt.Max();\n var maxM = mInt.Max();\n if(hInt.Count == 1 && mInt.Count == 1)\n {\n if(hInt[0] > 23)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(-1);\n }\n }\n else\n {\n var i = 0;\n for (i = 24; i > 1; i--)\n {\n if(i <= maxH || i <= maxM)\n {\n i = -1;\n break;\n }\n var hT = GetN(i, hInt);\n var mT = GetN(i, mInt);\n if(hT <=23 && mT <=59)\n break;\n }\n if(i<=1)\n {\n Console.WriteLine(0);\n return;\n }\n var res = new StringBuilder();\n for (int j = 2; j <= i; j++)\n {\n res.Append(j + \" \");\n }\n Console.WriteLine(res.ToString().TrimEnd());\n }\n }\n\n private static long GetN(int t, List ints)\n {\n long res = 0;\n for (int i = 0; i < ints.Count; i++)\n {\n res *= t;\n res += ints[i];\n }\n return res;\n }\n\n private static List GetInts(string s)\n {\n var res = new List();\n\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i] == '0' && res.Count == 0)\n continue;\n\n if(char.IsLetter(s[i]))\n {\n res.Add((s[i] - 'A') + 10);\n }\n else\n {\n res.Add(s[i] - '0');\n }\n }\n\n if(res.Count == 0)\n res.Add(0);\n\n return res;\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = ReadArray();\n var res = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n res[i] = ReadNextInt(input, i);\n }\n return res;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = Read();\n var index = input.IndexOf(\":\");\n var h = input.Substring(0, index);\n var m = input.Substring(index + 1);\n var hInt = GetInts(h);\n var mInt = GetInts(m);\n var maxH = hInt.Max();\n var maxM = mInt.Max();\n if(hInt.Count == 1 && mInt.Count == 1)\n {\n if(hInt[0] > 23)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(-1);\n }\n }\n else\n {\n var i = 0;\n for (i = 24; i > 1; i--)\n {\n if(i <= maxH || i <= maxM)\n {\n i = -1;\n break;\n }\n var hT = GetN(i, hInt);\n var mT = GetN(i, mInt);\n if(hT <=23 && mT <=59)\n break;\n }\n if(i<=1)\n {\n Console.WriteLine(0);\n return;\n }\n var res = new StringBuilder();\n for (int j = Math.Max(2, Math.Max(maxH, maxM) + 1); j <= i; j++)\n {\n res.Append(j + \" \");\n }\n Console.WriteLine(res.ToString().TrimEnd());\n }\n }\n\n private static long GetN(int t, List ints)\n {\n long res = 0;\n for (int i = 0; i < ints.Count; i++)\n {\n res *= t;\n res += ints[i];\n if (res > 60)\n return res;\n }\n return res;\n }\n\n private static List GetInts(string s)\n {\n var res = new List();\n\n for (int i = 0; i < s.Length; i++)\n {\n if(s[i] == '0' && res.Count == 0)\n continue;\n\n if(char.IsLetter(s[i]))\n {\n res.Add((s[i] - 'A') + 10);\n }\n else\n {\n res.Add(s[i] - '0');\n }\n }\n\n if(res.Count == 0)\n res.Add(0);\n\n return res;\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n private static readonly string NRange = new string(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' });\n\n private void Solve()\n {\n var s = io.NextLine().Split(':');\n\n s[0] = s[0].TrimStart('0');\n s[1] = s[1].TrimStart('0');\n\n var min = 0;\n\n for (int i = 0; i < 2; i++)\n {\n for (int j = 0; j < s[i].Length; j++)\n {\n min = Math.Max(min, NRange.IndexOf(s[i][j]));\n }\n }\n\n if (min > 0)\n {\n List parts = new List();\n\n var pch = -1;\n var pcm = -1;\n\n for (int i = min; i < NRange.Length; i++)\n {\n var ch = Calc10(s[0], i);\n var cm = Calc10(s[1], i);\n\n if (ch < 24 && cm < 60)\n {\n if (pch == ch && pcm == cm)\n {\n io.Print(-1);\n return;\n }\n\n parts.Add((i + 1).ToString(CultureInfo.InvariantCulture));\n }\n pch = ch;\n pcm = cm;\n }\n\n if (parts.Count > 0)\n {\n io.Print(string.Join(\" \", parts.ToArray()));\n return;\n }\n io.Print(0);\n }\n\n io.Print(-1);\n }\n\n private int Calc10(string s, int min)\n {\n int res = 0;\n\n foreach (var c in s)\n {\n res *= (min + 1);\n res += NRange.IndexOf(c);\n }\n\n return res;\n\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n private static readonly string NRange = new string(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' });\n\n private void Solve()\n {\n var s = io.NextLine().Split(':');\n\n s[0] = s[0].TrimStart('0');\n s[1] = s[1].TrimStart('0');\n\n var min = 0;\n\n for (int i = 0; i < 2; i++)\n {\n for (int j = 0; j < s[i].Length; j++)\n {\n min = Math.Max(min, NRange.IndexOf(s[i][j]));\n }\n }\n\n if (min > 0)\n {\n List parts = new List();\n\n var pch = -1;\n var pcm = -1;\n\n for (int i = min; i < NRange.Length; i++)\n {\n var ch = Calc10(s[0], i);\n var cm = Calc10(s[1], i);\n\n if (ch < 24 && cm < 60)\n {\n if (pch == ch && pcm == cm)\n {\n io.Print(-1);\n return;\n }\n\n parts.Add((i + 1).ToString(CultureInfo.InvariantCulture));\n }\n pch = ch;\n pcm = cm;\n }\n\n if (parts.Count > 0)\n {\n io.Print(string.Join(\" \", parts.ToArray()));\n return;\n }\n }\n\n io.Print(0);\n }\n\n private int Calc10(string s, int min)\n {\n int res = 0;\n\n foreach (var c in s)\n {\n res *= (min + 1);\n res += NRange.IndexOf(c);\n }\n\n return res;\n\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n #endregion\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n\n private static readonly string NRange = new string(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' });\n\n private void Solve()\n {\n var s = io.NextLine().Split(':');\n\n s[0] = s[0].TrimStart('0');\n s[1] = s[1].TrimStart('0');\n\n var min = 0;\n\n for (int i = 0; i < 2; i++)\n {\n for (int j = 0; j < s[i].Length; j++)\n {\n min = Math.Max(min, NRange.IndexOf(s[i][j]));\n }\n }\n\n if (min > 0)\n {\n List parts = new List();\n\n var pch = -1;\n var pcm = -1;\n\n for (int i = min; i < NRange.Length; i++)\n {\n var ch = Calc10(s[0], i);\n var cm = Calc10(s[1], i);\n\n if (ch < 24 && cm < 60)\n {\n if (pch == ch && pcm == cm)\n {\n io.Print(-1);\n return;\n }\n\n parts.Add((i + 1).ToString(CultureInfo.InvariantCulture));\n }\n pch = ch;\n pcm = cm;\n }\n\n if (parts.Count > 0)\n {\n io.Print(string.Join(\" \", parts.ToArray()));\n return;\n }\n io.Print(0);\n return;\n }\n\n io.Print(-1);\n }\n\n private int Calc10(string s, int min)\n {\n int res = 0;\n\n foreach (var c in s)\n {\n res *= (min + 1);\n res += NRange.IndexOf(c);\n }\n\n return res;\n\n }\n }\n\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n static void Main()\n {\n string[] vrem = Console.ReadLine().Split(':');\n char[] a = new char[5];\n char[] b = new char[5];\n int[] a1 = new int[5];\n int[] b1 = new int[5];\n\n\n for (int i = vrem[0].Length - 1; i >= 0; i--)\n {\n a[vrem[0].Length - 1 - i] = vrem[0][i];\n if (a[vrem[0].Length - 1 - i] >= 65 && a[vrem[0].Length - 1 - i] <= 90)\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 55);\n else\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 48);\n }\n for (int i = vrem[1].Length - 1; i >= 0; i--)\n {\n b[vrem[1].Length - 1 - i] = vrem[1][i];\n if (b[vrem[1].Length - 1 - i] >= 65 && b[vrem[1].Length - 1 - i] <= 90)\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 55);\n else\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 48);\n }\n\n int[] otvet = new int[30];\n\n\n if (a1[1] >= 2 || a1[0] >= 10)\n Console.WriteLine(\"0\");\n else\n {\n double q = 0;\n double w = 0;\n int k = 3;\n while (k < 30)\n {\n q = 0;\n w = 0;\n for (int i = a1.Length - 1; i >= 0; i--)\n q = q + a1[i] * Math.Pow(k, i);\n\n for (int i = b1.Length - 1; i >= 0; i--)\n w = w + b1[i] * Math.Pow(k, i);\n\n if (q <= 23 && w <= 59)\n otvet[k] = k;\n else\n break;\n\n k++;\n\n }\n\n if (k == 30)\n Console.WriteLine(\"-1\");\n else\n {\n for (int i = 0; i < otvet.Length; i++)\n if (otvet[i] != 0)\n Console.Write(otvet[i] + \" \");\n }\n \n\n }\n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n static void Main()\n {\n string[] vrem = Console.ReadLine().Split(':');\n char[] a = new char[5];\n char[] b = new char[5];\n int[] a1 = new int[5];\n int[] b1 = new int[5];\n\n\n for (int i = vrem[0].Length - 1; i >= 0; i--)\n {\n a[vrem[0].Length - 1 - i] = vrem[0][i];\n if (a[vrem[0].Length - 1 - i] >= 65 && a[vrem[0].Length - 1 - i] <= 90)\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 55);\n else\n a1[vrem[0].Length - 1 - i] = Convert.ToInt32(a[vrem[0].Length - 1 - i] - 48);\n }\n for (int i = vrem[1].Length - 1; i >= 0; i--)\n {\n b[vrem[1].Length - 1 - i] = vrem[1][i];\n if (b[vrem[1].Length - 1 - i] >= 65 && b[vrem[1].Length - 1 - i] <= 90)\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 55);\n else\n b1[vrem[1].Length - 1 - i] = Convert.ToInt32(b[vrem[1].Length - 1 - i] - 48);\n }\n\n int[] otvet = new int[30];\n\n\n if (a1[1] >= 2 && a1[0] >= 10)\n Console.WriteLine(\"0\");\n else\n {\n double q = 0;\n double w = 0;\n int k = 3;\n while (k < 30)\n {\n q = 0;\n w = 0;\n for (int i = a1.Length - 1; i >= 0; i--)\n q = q + a1[i] * Math.Pow(k, i);\n\n for (int i = b1.Length - 1; i >= 0; i--)\n w = w + b1[i] * Math.Pow(k, i);\n\n if (q <= 23 && w <= 59)\n otvet[k] = k;\n else\n break;\n\n k++;\n\n }\n\n if (k == 30)\n Console.WriteLine(\"-1\");\n else\n {\n for (int i = 0; i < otvet.Length; i++)\n if (otvet[i] != 0)\n Console.Write(otvet[i] + \" \");\n }\n \n\n }\n\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n while (true)\n {\n String[] buf = Console.ReadLine().Split(':');\n String ret = \"\";\n if (can(buf, 1000000))\n {\n Console.WriteLine(\"-1\");\n continue;\n }\n for (int i = 2; i <= 1000000; i++)\n {\n if (can(buf, i))\n {\n ret = ret + i + \" \";\n }\n }\n if (ret == \"\")\n ret = \"0\";\n Console.WriteLine(ret);\n }\n }\n catch (Exception)\n {\n }\n }\n\n private static bool can(string[] buf, int b)\n {\n int[] d = new int[2];\n for (int i = 0; i < 2; i++)\n {\n d[i] = 0;\n for (int j = 0; j < buf[i].Length; j++)\n {\n int fd = buf[i][j] >= '0' && buf[i][j] <= '9' ? buf[i][j] - '0' : buf[i][j] - 'A' + 10;\n if (fd >= b) return false;\n d[i] = d[i] * b + fd;\n }\n }\n return d[0] >= 0 && d[0] <= 23 && d[1] >= 0 && d[1] <= 59;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n while (true)\n {\n String[] buf = Console.ReadLine().Split(':');\n String ret = \"\";\n if (can(buf, 1000000))\n {\n Console.WriteLine(\"-1\");\n continue;\n }\n for (int i = 2; i <= 1000000; i++)\n {\n if (can(buf, i))\n {\n ret = ret + i + \" \";\n }\n }\n if (ret == \"\")\n ret = \"0\";\n Console.WriteLine(ret);\n }\n }\n catch (Exception)\n {\n }\n }\n\n private static bool can(string[] buf, int b)\n {\n long[] d = new long[2];\n for (int i = 0; i < 2; i++)\n {\n d[i] = 0;\n for (int j = 0; j < buf[i].Length; j++)\n {\n int fd = buf[i][j] >= '0' && buf[i][j] <= '9' ? buf[i][j] - '0' : buf[i][j] - 'A' + 10;\n if (fd >= b) return false;\n d[i] = d[i] * b + fd;\n }\n }\n return d[0] >= 0 && d[0] <= 23 && d[1] >= 0 && d[1] <= 59;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n while (true)\n {\n String[] buf = Console.ReadLine().Split(':');\n String ret = \"\";\n if (can(buf, 40))\n {\n Console.WriteLine(\"-1\");\n continue;\n }\n for (int i = 2; i <= 36; i++)\n {\n if (can(buf, i))\n {\n ret = ret + i + \" \";\n }\n }\n if (ret == \"\")\n ret = \"0\";\n Console.WriteLine(ret);\n }\n }\n catch (Exception)\n {\n }\n }\n\n private static bool can(string[] buf, int b)\n {\n int[] d = new int[2];\n for (int i =0;i<2;i++)\n {\n d[i] = 0;\n for (int j =0;j= '0' && buf[i][j] <= '9' ? buf[i][j] - '0' : buf[i][j] - 'A' + 10;\n if (fd >= b) return false;\n d[i] = d[i] * b + fd;\n }\n }\n return d[0] >= 0 && d[0] <= 23 && d[1] >= 0 && d[1] <= 59;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFContest\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n while (true)\n {\n String[] buf = Console.ReadLine().Split(':');\n String ret = \"\";\n if (can(buf, 1024))\n {\n Console.WriteLine(\"-1\");\n continue;\n }\n for (int i = 2; i <= 1000000; i++)\n {\n if (can(buf, i))\n {\n ret = ret + i + \" \";\n }\n }\n if (ret == \"\")\n ret = \"0\";\n Console.WriteLine(ret);\n }\n }\n catch (Exception)\n {\n }\n }\n\n private static bool can(string[] buf, int b)\n {\n long[] d = new long[2];\n for (int i = 0; i < 2; i++)\n {\n d[i] = 0;\n for (int j = 0; j < buf[i].Length; j++)\n {\n int fd = buf[i][j] >= '0' && buf[i][j] <= '9' ? buf[i][j] - '0' : buf[i][j] - 'A' + 10;\n if (fd >= b) return false;\n d[i] = d[i] * b + fd;\n }\n }\n return d[0] >= 0 && d[0] <= 23 && d[1] >= 0 && d[1] <= 59;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class B\n{\n public partial class Myon\n {\n static void Main()\n {\n B p = new B();\n p.solve();\n }\n }\n\n public void solve()\n {\n string[] tmp = stringSplit(':');\n for (int i = 0; i < 2; i++)\n {\n if (tmp[i].Length == 0)\n continue;\n if (tmp[i][0] == '0')\n tmp[i] = tmp[i].Substring(1);\n }//for i\n List res = new List();\n for (int i = 1; i <= 70; i++)\n {\n int mul = 1;\n int h = 0; int m = 0;\n int max = 0;\n for (int j = tmp[0].Length - 1; j >= 0; j--)\n {\n max = Math.Max(max, CharToInt(tmp[0][j]));\n h += CharToInt(tmp[0][j]) * mul;\n mul *= i;\n }//forrev j\n mul = 1;\n for (int j = tmp[1].Length - 1; j >= 0; j--)\n {\n max = Math.Max(max, CharToInt(tmp[1][j]));\n m += CharToInt(tmp[1][j]) * mul;\n mul *= i;\n }//forrev j\n if (max >= i||h>=25||m>=60)\n continue;\n if (h == 24 && m > 0)\n continue;\n res.Add(i);\n }\n\n foreach (int t in res)\n {\n if (t > 60)\n {\n Console.WriteLine(-1);\n return;\n }\n }//foreach t\n if (res.Count == 0)\n {\n Console.WriteLine(0);\n return;\n }\n for (int i = 0; i < res.Count; i++)\n {\n Console.Write(res[i]);\n if(i!=res.Count-1)\n Console.Write(\" \");\n }//for i\n Console.WriteLine();\n }\n\n public static int CharToInt(char c)\n {\n if ('0' <= c && c <= '9')\n return c - '0';\n return c - 'A' + 10;\n }//CharToInt\n\n public static char IntToChar(int i)\n {\n return (char)(i + 'A');\n }//IntToChar\n\n\n\n string stringRead()\n { return Console.ReadLine(); }\n\n int intRead()\n { return int.Parse(Console.ReadLine()); }\n\n long longRead()\n { return long.Parse(Console.ReadLine()); }\n\n string[] stringSplit(char a)\n { return Console.ReadLine().Split(a); }\n\n int[] intSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), int.Parse); }\n\n long[] longSplit(char a)\n { return Array.ConvertAll(Console.ReadLine().Split(a), long.Parse); }\n\n void write(string str)\n {\n Console.WriteLine(str);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Martian_Clock\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string[] ss = reader.ReadLine().Split(':');\n\n int min = Math.Max(2, 1+Math.Max(ss[0].Max(t => Code(t)), ss[1].Max(t => Code(t))));\n\n int h = Convert(ss[0], min);\n int m = Convert(ss[1], min);\n\n if (h > 23 || m > 59)\n writer.WriteLine(\"0\");\n else if (h < min && m < min)\n writer.WriteLine(\"-1\");\n else\n {\n for (int i = min;; i++)\n {\n h = Convert(ss[0], i);\n m = Convert(ss[1], i);\n\n if (h <= 23 && m <= 59)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n else break;\n }\n }\n\n writer.Flush();\n }\n\n private static int Code(char t)\n {\n return t <= '9' ? t - '0' : t - 'A';\n }\n\n private static int Convert(string s, int r)\n {\n int ans = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n ans = ans*r + Code(s[i]);\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Martian_Clock\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string[] ss = reader.ReadLine().Split(':');\n\n int min = Math.Max(2, 1+Math.Max(ss[0].Max(t => Code(t)), ss[1].Max(t => Code(t))));\n\n int h = Convert(ss[0], min);\n int m = Convert(ss[1], min);\n\n if (h > 23 || m > 59)\n writer.WriteLine(\"0\");\n else if (h < min && m < min)\n writer.WriteLine(\"-1\");\n else\n {\n for (int i = min;; i++)\n {\n h = Convert(ss[0], i);\n m = Convert(ss[1], i);\n\n if (h <= 23 && m <= 59)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n else break;\n }\n }\n\n writer.Flush();\n }\n\n private static int Code(char t)\n {\n return t <= '9' ? t - '0' :11 + (t - 'A');\n }\n\n private static int Convert(string s, int r)\n {\n int ans = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n ans = ans*r + Code(s[i]);\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Martian_Clock\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string[] ss = reader.ReadLine().Split(':');\n\n int min = Math.Max(2, Math.Max(ss[0].Max(t => Code(t)), ss[1].Max(t => Code(t))));\n\n int h = Convert(ss[0], min);\n int m = Convert(ss[1], min);\n\n if (h > 23 || m > 59)\n writer.WriteLine(\"0\");\n else if (h < min && m < min)\n writer.WriteLine(\"-1\");\n else\n {\n for (int i = min;; i++)\n {\n h = Convert(ss[0], i);\n m = Convert(ss[1], i);\n\n if (h <= 23 && m <= 59)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n else break;\n }\n }\n\n writer.Flush();\n }\n\n private static int Code(char t)\n {\n return t <= '9' ? t - '0' : t - 'A';\n }\n\n private static int Convert(string s, int r)\n {\n int ans = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n ans = ans*r + Code(s[i]);\n }\n\n return ans;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n //if (GetDigits(initbase, 59) < arr[1].Length && GetDigits(initbase, 23) < arr[0].Length)\n //{\n // Console.WriteLine(0); return;\n //}\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n if (GetDigits(initbase, 59) > arr[1].Length)\n {\n Console.WriteLine(0); return;\n }\n \n if (hours.Length<=1&& minutes.Length<=1)\n {\n \n Console.WriteLine(-1); return;\n }\n\n int basesC = 0;\n List bases = new List();\n \n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n\n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n if (GetDigits(initbase, 59) < arr[1].Length && GetDigits(initbase, 23) < arr[0].Length)\n {\n Console.WriteLine(0); return;\n }\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n if (GetDecimal(hours, initbase, chars) >= 24 && GetDecimal(minutes, initbase, chars) >= 60)\n {\n Console.WriteLine(0); return;\n }\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n if (hours.Length<=1&& minutes.Length<=1)\n {\n \n Console.WriteLine(-1); return;\n }\n\n int basesC = 0;\n List bases = new List();\n \n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n if (GetDigits(initbase, 59) > arr[1].Length)\n {\n Console.WriteLine(0); return;\n }\n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n if (GetDigits(initbase, 59) < arr[1].Length)\n {\n Console.WriteLine(0); return;\n }\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i 0)\n {\n vv = vv / b; res += 1; \n }\n\n return (int)res;\n }\n static void Main(string[] args)\n {\n Dictionary chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n\n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n \n \n \n\n int basesC = 0;\n List bases = new List();\n if (GetDigits(initbase, 59) > arr[1].Length)\n {\n Console.WriteLine(0); return;\n }\n if (hours.Length <= 1 && minutes.Length <= 1)\n {\n\n Console.WriteLine(-1); return;\n }\n \n \n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n\n \n\n bases.Add(initbase); initbase++;\n basesC++;\n }\n \n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Martian_Clock\n{\n class Program\n {\n static int GetDecimal(string s, int b, Dictionary chars)\n {\n double res = 0;\n int cc = s.Length - 1;\n for (int i =0 ; i chars = new Dictionary();\n string s = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int u = 10;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n s = \"0123456789\";\n u = 0;\n for (int i = 0; i < s.Length; i++)\n {\n chars.Add(s[i], u); u++;\n }\n\n\n //while (true)\n //{\n // Console.WriteLine(GetDecimal(Console.ReadLine(), 16, chars));\n //}\n\n s = Console.ReadLine();\n string []arr = s.Split(':');\n string hours = \"\";\n string minutes = \"\";\n int hmax = 0;\n int mmax = 0;\n bool x = true;\n for (int i = 0; i < arr[0].Length; i++)\n {\n if (arr[0][i] != '0' || !x)\n {\n hours += arr[0][i]; x = false;\n int tem = chars[arr[0][i]];\n if (tem>hmax)\n {\n hmax = tem;\n }\n }\n \n \n\n }\n x = true;\n for (int i = 0; i < arr[1].Length; i++)\n {\n if (arr[1][i] != '0'||!x)\n {\n minutes += arr[1][i]; x = false;\n int tem = chars[arr[1][i]];\n if (tem > mmax)\n {\n mmax = tem;\n }\n }\n \n \n }\n if (hours.Length<=1&& minutes.Length<=1)\n {\n Console.WriteLine(-1); return;\n }\n\n int basesC = 0;\n List bases = new List();\n \n hmax++;\n mmax++;\n int initbase = Math.Max(hmax, mmax);\n while (GetDecimal(hours, initbase, chars) < 24 && GetDecimal(minutes, initbase, chars) < 60)\n {\n bases.Add(initbase); initbase++;\n basesC++;\n }\n\n if (basesC == 0)\n {\n Console.WriteLine(0); return;\n }\n\n int max = bases.Max();\n foreach (int item in bases)\n {\n if (item !=max)\n {\n Console.Write(item + \" \");\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}], "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293"} {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ForAcm\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n//\t\t\tstring t = Console.ReadLine ();\n//\t\t\tint it = int.Parse (t);\n\t\t\tSolve solve = new Solve ();\n\t\t\tsolve.init ();\n//\t\t\tint i = 0;\n//\t\t\twhile (it > 0) {\n//\t\t\t\tit--;\n//\t\t\t\ti++;\n\t\t\t\tsolve.doit ();\n\t\t\t\t//solve.output (i);\n//\t\t\t}\n\t\t}\n\t}\n\n\tclass Solve{\n\t\tprivate int ans;\n\t\tprivate List a = new List();\n\t\tpublic void init(){\n\t\t\ta.Clear ();\n\t\t\tstring s = Console.ReadLine ();\n\t\t\tint n = int.Parse (s);\n\t\t\ts = Console.ReadLine ();\n\t\t\tstring[] ss = s.Split (' ');\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ta.Add(int.Parse (ss[i]) - 1);\n\t\t\t}\n\t\t\ta.Sort ();\n\t\t\tint s1 = 0;\n\t\t\tint s2 = 0;\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ts1 += Math.Abs( a [i] - i * 2);\n\t\t\t\ts2 += Math.Abs( a[i] - i* 2 - 1);\n\t\t\t}\n\t\t\tif (s1 < s2)\n\t\t\t\tConsole.WriteLine (s1);\n\t\t\telse\n\t\t\t\tConsole.WriteLine (s2);\n\t\t}\n\t\tpublic void doit(){\n\t\t}\n\n\t\t/*public void output(int i){\n\t\t\tConsole.WriteLine (string.Format (\"Case #{0}: {1}\", i, ans));\n\t\t}*/\n\t}\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n static void main()\n {\n Console.ReadLine();\n\n string s = Console.ReadLine();\n\n List arr = s.ToCharArray().ToList();\n\n arr.Sort();\n\n string res = \"\";\n\n int count = 0;\n\n while (res.Length != s.Length)\n {\n if (count > arr.Count - 1)\n {\n count = 0;\n }\n\n if (res.Length == 0)\n {\n res += arr[count];\n arr.Remove(arr[count]);\n }\n\n else\n {\n if (!res[res.Length - 1].Equals(arr[count]))\n {\n res += arr[count];\n\n arr.Remove(arr[count]);\n\n count = 0;\n }\n }\n\n\n count++;\n }\n\n for (int i = 1; i < res.Length; i++)\n {\n if (res[i - 1].Equals(res[i]))\n {\n Console.WriteLine(\"IMPOSSIBLE\");\n // Console.ReadKey();\n return;\n }\n }\n\n Console.WriteLine(res);\n\n }\n\n private static int Nod(decimal n, decimal d)\n {\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n var temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return (int)d;\n return 0;\n }\n\n static int Count(string source, string key)\n {\n\n\n List indices = new List();\n\n int index = source.IndexOf(key, 0);\n\n while (index > -1)\n {\n indices.Add(index);\n index = source.IndexOf(key, index + key.Length);\n }\n\n return indices.Count();\n }\n\n private static string Reverse(string s)\n {\n string s2 = \"\";\n\n for (int i = s.Length - 1; i >= 0; i--)\n {\n s2 += s[i];\n }\n\n return s2;\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n StringBuilder builder = new StringBuilder();\n\n int n = int.Parse(Console.ReadLine());\n string[] locationData = Console.ReadLine().Split();\n\n int[] locations = new int[n / 2];\n int bMoves = 0;\n int wMoves = 0;\n for (int i = 0; i < locationData.Length; i++)\n {\n int current = int.Parse(locationData[i]);\n locations[i] = current;\n }\n\n Array.Sort(locations);\n for (int i = 0; i < locations.Length; i++)\n {\n int current = locations[i];\n int bTarget = (i * 2) + 1;\n int wTarget = (i * 2) + 2;\n bMoves += Math.Abs(bTarget - current);\n wMoves += Math.Abs(wTarget - current);\n }\n\n builder.Append((int)Math.Min(bMoves, wMoves) + \"\\n\");\n\n Console.WriteLine(builder);\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace Kattis\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n \n List p = new List();\n\n for (int i = 0; i < s.Length; i++)\n {\n p.Add(int.Parse(s[i]) - 1);\n }\n\n p.Sort();\n\n int aw = 0;\n int ab = 0;\n int cb = 0;\n int cw = 1;\n\n for (int i = 0; i < p.Count(); i++)\n {\n aw += Math.Abs(p[i] - cw);\n ab += Math.Abs(p[i] - cb);\n cb += 2;\n cw += 2;\n }\n Console.WriteLine(Math.Min(aw, ab));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\n\nnamespace Practice\n{\n public class Program\n {\n public static void Main()\n {\n ConsoleReader r = new ConsoleReader();\n BufferedStream w = new BufferedStream(Console.OpenStandardOutput());\n Solve(r, w);\n //Console.ReadKey();\n }\n\n public static void Solve(ConsoleReader reader, BufferedStream writer)\n {\n A(reader, writer);\n }\n public static void C()\n {\n\n\n }\n\n public static void B(ConsoleReader reader, BufferedStream writer)\n {\n }\n public static void A(ConsoleReader reader, BufferedStream writer)\n {\n int n = reader.ReadInt()/2;\n int[] a = new int[n];\n reader.ReadArray(a, n);\n\n Array.Sort(a);\n int bMoves = 0, wMoves = 0;\n for (int i =0; i= data.Length)\n {\n wordIndex = 0;\n data = Console.ReadLine().Trim().Split();\n }\n }\n public int ReadInt()\n {\n ReadLineIfNeeded();\n return int.Parse(data[wordIndex++]);\n }\n\n public void ReadArray(int[] a, int n)\n {\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n }\n\n public string ReadString()\n {\n ReadLineIfNeeded();\n return data[wordIndex++];\n }\n\n //ReadLine()\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _985A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int zoma = n / 2, oddCount=0,evenCount=0;\n int[] posArray = new int[zoma];\n var inputs = Console.ReadLine().Split().Select(int.Parse);\n posArray = inputs.ToArray();\n Array.Sort(posArray);\n for (int i=n, j = zoma-1; i > 0; i-=2,j--) \n if (posArray[j] != i) evenCount+= Math.Abs(i - posArray[j]);\n for (int i = n-1, j = zoma - 1; i > 0; i -= 2, j--)\n if (posArray[j] != i) oddCount+= Math.Abs(i - posArray[j]); \n Console.WriteLine(evenCount < oddCount ? evenCount : oddCount);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] positions = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n n /= 2;\n Array.Sort(positions);\n\n int ans = int.MaxValue;\n for (int x = 1; x <= 2; x++)\n {\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n int p = positions[i];\n int q = x + i * 2;\n cnt += Math.Abs(p - q);\n }\n ans = Math.Min(ans, cnt);\n }\n\n Console.WriteLine($\"{ans}\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_985_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n n = n / 2;\n int[] a = new int[n];\n string[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n }\n Array.Sort(a);\n int nb = CountMoves(n, a, 1);\n int nw = CountMoves(n, a, 2);\n Console.WriteLine(Math.Min(nb, nw));\n }\n\n private static int CountMoves(int n, int[] a, int first)\n {\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n cnt += Math.Abs(i*2+first - a[i]);\n }\n return cnt;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace QTREE3 {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int[] P = new int[N / 2];\n for (int i = 0; i < N / 2; i++) P[i] = In.ReadInt();\n Array.Sort(P);\n int ans1 = 0, ans2 = 0;\n for (int i = 0; i < N / 2; i++) {\n ans1 += Math.Abs(i * 2 + 1 - P[i]);\n ans2 += Math.Abs(i * 2 + 2 - P[i]);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace EduRound44A {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int[] P = new int[N / 2];\n for (int i = 0; i < N / 2; i++) P[i] = In.ReadInt();\n Array.Sort(P);\n int ans1 = 0, ans2 = 0;\n for (int i = 0; i < N / 2; i++) {\n ans1 += Math.Abs(i * 2 + 1 - P[i]);\n ans2 += Math.Abs(i * 2 + 2 - P[i]);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _985A\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool fl = int.TryParse(Console.ReadLine(), out int n);\n if(!fl)\n throw new Exception(\"Different Input\");\n var sp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int [] pos = new int[n];\n for(int i = 0; i < sp.Length; ++i)\n pos[sp[i] - 1] = 1;\n var solve = new Solve(n, pos);\n System.Console.WriteLine(solve.Solver());\n }\n }\n\n internal class Solve {\n private int n { get; set; }\n private int [] posW { get; set; }\n\n private int [] posB { get; set; }\n\n public Solve(int N, int [] Pos){\n this.n = N;\n posW = Pos;\n posB = new int[posW.Length];\n Buffer.BlockCopy(posW, 0, posB, 0, n * sizeof(int));\n }\n\n public int Solver()\n {\n return SolverWB();\n }\n\n private int SolverWB()\n {\n var ps = n >> 1;\n var sol = new int[2] { 0, 0 };\n var idx = new int[2] { 0, n - 1 };\n for(int i = 0; i < ps; ++i, idx[0]+=2, idx[1]-=2)\n {\n for(int j = 0; j < n; ++j)\n if(posW[j] != 0)\n {\n sol[0] += Math.Abs(j - idx[0]);\n posW[j] = 0;\n break;\n }\n \n for(int j = n - 1; j >=0; --j)\n if(posB[j] != 0)\n {\n sol[1] += Math.Abs(idx[1] - j);\n posB[j] = 0;\n break;\n }\n }\n return Math.Min(sol[0], sol[1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _985A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] p = Console.ReadLine().Split().Select(token => int.Parse(token)).OrderBy(x => x).ToArray();\n\n int aCount = 0;\n int bCount = 0;\n\n for (int i = 0; i < n / 2; i++)\n {\n aCount += Math.Abs(2 * i + 1 - p[i]);\n bCount += Math.Abs(2 * i + 2 - p[i]);\n }\n\n Console.WriteLine(Math.Min(aCount, bCount));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int[] p = sc.IntArray();\n\n /*\n * 1*n\u30b0\u30ea\u30c3\u30c9\n * \u99d2i\u306fP_i\u306b\u3044\u308b\n * \u5168\u90e8\u306e\u99d2\u306e\u4f4d\u7f6e\u306e\u5076\u5947\u4e00\u81f4\u3055\u305b\u308b\n * \n * \n */\n\n\n int b = 0;\n int w = 0;\n Array.Sort(p);\n for(int i = 0;i < p.Length; i++)\n {\n // \u73fe\u5728\u5730p_i\n // \u76ee\u6a19 2*i+1\n b += Math.Abs(2 * i + 1 - p[i]);\n // 2*i+2\n w += Math.Abs(2 * i + 2 - p[i]);\n }\n\n Console.WriteLine(Math.Min(b,w));\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "\n\nusing System;\n\nnamespace Codeforces {\n\n class Chess {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n var line = Console.ReadLine().Split(new char[]{' '});\n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n static int TrySolve(int color) {\n var result = 0;\n for (int i = 1; i<=numCount; ++i) {\n var loc = (i*2) - color;\n result += Math.Abs(an[i]-loc); \n }\n return result;\n }\n \n static void Main(string[] args) {\n ReadData();\n Array.Sort(an,1,numCount);\n Console.WriteLine(Math.Min(TrySolve(0), TrySolve(1)));\n }\n\n }\n}\n\n"}, {"source_code": "\n\nusing System;\nnamespace Whatever {\n\n\n class ac {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n \n var line = Console.ReadLine().Split(new char[]{' '});\n \n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n static int TrySolve(int color) {\n var result = 0;\n for (int i = 1; i<=numCount; ++i) {\n var loc = (i*2) - color;\n result += Math.Abs(an[i]-loc); \n }\n\n return result;\n\n }\n \n static void Main(string[] args) {\n\n ReadData();\n Array.Sort(an,1,numCount);\n var minMoves = 2147483600;\n var tmp = TrySolve(0);\n if (tmp != -1 && tmp < minMoves) {\n minMoves = tmp;\n }\n tmp = TrySolve(1);\n if (tmp !=-1 && tmp < minMoves) {\n minMoves = tmp;\n }\n Console.WriteLine(minMoves);\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace \u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430_\u0448\u0430\u0445\u043c\u0430\u0442\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n arr.Sort();\n var whites= new List();\n var blacks = new List();\n for(int i=0;i ArrayA = new List();\n ArrayA = (read.Split(' ').ToList()).Select(s => int.Parse(s)).ToList();\n\n int black = 0;\n int white = 0;\n int blackindex = 1;\n int whiteindex = 2;\n ArrayA.Sort();\n\n foreach(var a in ArrayA)\n {\n black = black + Math.Abs(blackindex - a);\n white = white + Math.Abs(whiteindex - a);\n\n blackindex += 2;\n whiteindex += 2;\n }\n\n if (black > white)\n Console.WriteLine(white);\n else\n Console.WriteLine(black);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public Scanner sc;\n public void Solve()\n {\n var N = sc.Int;\n var P = sc.ArrInt;\n Array.Sort(P);\n var res = 0;\n for (int i = 0; i < N/2; i++)\n {\n res += Abs(2 * i - (P[i] - 1));\n }\n var r = 0;\n for (int i = 0; i < N / 2; i++)\n {\n r += Abs(2 * i+1 - (P[i] - 1));\n }\n Console.WriteLine(Min(res,r));\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver() { sc = new Scanner() };\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n sol.Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Chess_Placing\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n var nn = new int[n/2];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next();\n }\n Array.Sort(nn);\n\n int first = 1;\n int count = 0;\n foreach (int i in nn)\n {\n count += Math.Abs(first - i);\n first += 2;\n }\n int min = count;\n\n first = 2;\n count = 0;\n foreach (int i in nn)\n {\n count += Math.Abs(first - i);\n first += 2;\n }\n return Math.Min(min, count);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _985A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List pieces = new List();\n var piece_indexes = Console.ReadLine().Split(' ');\n \n for (int i = 0; i < piece_indexes.Length; i++)\n {\n pieces.Add(int.Parse(piece_indexes[i]) - 1);\n }\n pieces.Sort();\n List pieces_2 = new List(pieces);\n\n\n int min_all_black = GetMinMoves(n, pieces, 0);\n int min_all_white = GetMinMoves(n, pieces_2, 1);\n Console.WriteLine(\"{0}\", Math.Min(min_all_black, min_all_white));\n //Console.Read();\n }\n\n static int GetMinMoves(int n, List pieces, int parity)\n {\n int result = 0;\n for (int i = 0; i < n; i++)\n {\n if (i % 2 == parity)\n {\n result += Math.Abs(pieces[0] - i);\n pieces.RemoveAt(0);\n }\n }\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing static System.Math;\n\nclass P\n{\n static void Main()\n {\n //\u5076\u6570\n int n = int.Parse(Console.ReadLine());\n int[] p = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).OrderBy(x => x).ToArray();\n int even = 0;\n int odd = 0;\n for (int i = 0; i < p.Length; i++)\n {\n even += Abs(p[i] - (i * 2));\n odd += Abs(p[i] - ((i * 2) + 1));\n //Debug.WriteLine($\"{even} {odd} {(i * 2)} {(i * 2) + 1}\");\n }\n Console.WriteLine(Min(even, odd));\n\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int n = ReadInt();\n int m = n / 2;\n int ans0 = 0;\n int ans1 = 0;\n int[] p = ReadIntArray();\n Array.Sort(p);\n for (int i = 0; i < m; i++)\n {\n ans0 += Math.Abs(2 * i + 1 - p[i]);\n ans1 += Math.Abs(2 * i + 2 - p[i]);\n }\n int ans = Math.Min(ans0, ans1);\n Writer.WriteLine(ans);\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n //Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}], "negative_code": [{"source_code": "\n\nusing System;\nnamespace Whatever {\n\n\n class asearch {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n \n var line = Console.ReadLine().Split(new char[]{' '});\n \n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n // BWBWBWBW\n // 101010101 mod 2\n static int NextLoc(int start, int color) {\n if (start % 2 == color) {\n return start;\n } else {\n return start+1;\n }\n }\n \n static int TrySolve(int color) {\n var poop = new bool[10000];\n var solved = new bool[10000];\n for (int i = 1; i<=numCount; ++i) {\n if (an[i] %2 == color) {\n poop[an[i]] =true;\n solved[i] = true;\n } else {\n solved[i] =false;\n }\n }\n \n var result = 0;\n\n for (int i = 1; i<=numCount; ++i) {\n if (!solved[i]) {\n var plc = -1;\n var plcDis = 10101010;\n for (int j = 1; j<=N; ++j) {\n if (j%2 == color && !poop[j] && Math.Abs(j-an[i]) < plcDis) {\n plcDis = Math.Abs(j-an[i]);\n plc = j;\n }\n }\n poop[plc] = true;\n solved[i] = true;\n result += Math.Abs(plc-an[i]);\n }\n }\n \n return result;\n\n }\n \n static void Main(string[] args) {\n\n ReadData();\n var minMoves = 2147483600;\n var tmp = TrySolve(0);\n if (tmp != -1 && tmp < minMoves) {\n minMoves = tmp;\n }\n tmp = TrySolve(1);\n if (tmp !=-1 && tmp < minMoves) {\n minMoves = tmp;\n }\n Console.WriteLine(minMoves);\n //Console.WriteLine(Console.ReadLine());\n }\n\n }\n}"}, {"source_code": "\n\nusing System;\nnamespace Whatever {\n\n\n class asearch {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n \n var line = Console.ReadLine().Split(new char[]{' '});\n \n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n // BWBWBWBW\n // 101010101 mod 2\n static int NextLoc(int start, int color) {\n if (start % 2 == color) {\n return start;\n } else {\n return start+1;\n }\n }\n \n static int TrySolve(int color) {\n var poop = new bool[10000];\n var solved = new bool[10000];\n for (int i = 1; i<=numCount; ++i) {\n if (an[i] %2 == color) {\n poop[an[i]] =true;\n solved[i] = true;\n } else {\n solved[i] =false;\n }\n }\n \n var result = 0;\n\n for (int i = 1; i<=numCount; ++i) {\n if (!solved[i]) {\n var plc = -1;\n var plcDis = 10101010;\n for (int j = 1; j<=N; ++j) {\n if (j%2 == color && !poop[j] && Math.Abs(j-an[i]) < plcDis) {\n plcDis = Math.Abs(j-an[i]);\n plc = j;\n }\n }\n poop[plc] = true;\n solved[i] = true;\n result += Math.Abs(plc-an[i]);\n }\n }\n \n return result;\n\n }\n \n static void Main(string[] args) {\n\n ReadData();\n Array.Sort(an,1,numCount);\n var minMoves = 2147483600;\n var tmp = TrySolve(0);\n if (tmp != -1 && tmp < minMoves) {\n minMoves = tmp;\n }\n tmp = TrySolve(1);\n if (tmp !=-1 && tmp < minMoves) {\n minMoves = tmp;\n }\n Console.WriteLine(minMoves);\n //Console.WriteLine(Console.ReadLine());\n }\n\n }\n}"}, {"source_code": "\n\nusing System;\nnamespace Whatever {\n\n\n class a {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n \n var line = Console.ReadLine().Split(new char[]{' '});\n \n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n // BWBWBWBW\n // 101010101 mod 2\n static int NextLoc(int start, int color) {\n if (start % 2 == color) {\n return start;\n } else {\n return start+1;\n }\n }\n \n static int TrySolve(int color) {\n var newLoc = new int[10000];\n var lastLocation = 0;\n for (int i = 1; i<=numCount; ++i) {\n var nextAvail = NextLoc(lastLocation+1, color);\n if (nextAvail < an[i]) {\n if (an[i]%2 == color) {\n newLoc[i] = an[i];\n lastLocation = an[i];\n } else if (an[i] - 1 >= nextAvail && an[i] -1 >0) {\n newLoc[i] = an[i] - 1;\n lastLocation = newLoc[i];\n } \n } else {\n newLoc[i] = nextAvail;\n lastLocation = nextAvail;\n }\n }\n var result = 0;\n for (int i = 1; i<=numCount; ++i) {\n //Console.WriteLine($\"{an[i]}->{newLoc[i]}\");\n result += Math.Abs(newLoc[i] - an[i]);\n if (newLoc[i] > N || newLoc[i] < 1) {\n return -1;\n } \n \n \n }\n\n \n return result;\n\n }\n \n static void Main(string[] args) {\n\n ReadData();\n var minMoves = 2147483600;\n var tmp = TrySolve(0);\n if (tmp != -1 && tmp < minMoves) {\n minMoves = tmp;\n }\n tmp = TrySolve(1);\n if (tmp !=-1 && tmp < minMoves) {\n minMoves = tmp;\n }\n Console.WriteLine(minMoves);\n //Console.WriteLine(Console.ReadLine());\n }\n\n }\n}"}, {"source_code": "\n\nusing System;\nnamespace Whatever {\n\n\n class a {\n\n static int N;\n static int numCount;\n static int[] an = new int[2000];\n\n\n static void ReadData() {\n Int32.TryParse(Console.ReadLine(), out N);\n \n var line = Console.ReadLine().Split(new char[]{' '});\n \n numCount = line.Length;\n for (int i = 1; i <= numCount; ++i)\n {\n Int32.TryParse(line[i-1], out an[i]);\n }\n }\n\n // BWBWBWBW\n // 101010101 mod 2\n static int NextLoc(int start, int color) {\n if (start % 2 == color) {\n return start;\n } else {\n return start+1;\n }\n }\n \n static int TrySolve(int color) {\n var newLoc = new int[10000];\n var lastLocation = 0;\n for (int i = 1; i<=numCount; ++i) {\n var nextAvail = NextLoc(lastLocation+1, color);\n if (nextAvail < an[i]) {\n if (an[i]%2 == color) {\n newLoc[i] = an[i];\n lastLocation = an[i];\n } else if (an[i] - 1 >= nextAvail && an[i] -1 >0) {\n newLoc[i] = an[i] - 1;\n lastLocation = newLoc[i];\n } else {\n newLoc[i] = an[i] +1;\n lastLocation = newLoc[i];\n }\n } else {\n /*if (an[i]%2 ==color && nextAvail == an[i]) {\n newLoc[i] = an[i];\n } else {*/\n newLoc[i] = nextAvail;\n lastLocation = nextAvail;\n /*}*/\n \n }\n }\n var result = 0;\n for (int i = 1; i<=numCount; ++i) {\n // Console.WriteLine($\"{an[i]}->{newLoc[i]}\");\n result += Math.Abs(newLoc[i] - an[i]);\n if (newLoc[i] > N || newLoc[i] < 1) {\n return -1;\n } \n \n \n }\n\n \n return result;\n\n }\n \n static void Main(string[] args) {\n\n ReadData();\n var minMoves = 2147483600;\n var tmp = TrySolve(0);\n if (tmp != -1 && tmp < minMoves) {\n minMoves = tmp;\n }\n tmp = TrySolve(1);\n if (tmp !=-1 && tmp < minMoves) {\n minMoves = tmp;\n }\n Console.WriteLine(minMoves);\n //Console.WriteLine(Console.ReadLine());\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace \u0420\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430_\u0448\u0430\u0445\u043c\u0430\u0442\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n var whites= new List();\n var blacks = new List();\n for(int i=0;i 0) {\n//\t\t\t\tit--;\n//\t\t\t\ti++;\n\t\t\t\tsolve.doit ();\n\t\t\t\t//solve.output (i);\n//\t\t\t}\n\t\t}\n\t}\n\n\tclass Solve{\n\t\tprivate int ans;\n\t\tprivate List a = new List();\n\t\tpublic void init(){\n\t\t\ta.Clear ();\n\t\t\tstring s = Console.ReadLine ();\n\t\t\tint n = int.Parse (s);\n\t\t\ts = Console.ReadLine ();\n\t\t\tstring[] ss = s.Split (' ');\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ta.Add(int.Parse (ss[i]) - 1);\n\t\t\t}\n\n\t\t\tint s1 = 0;\n\t\t\tint s2 = 0;\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ts1 += Math.Abs( a [i] - i * 2);\n\t\t\t\ts2 += Math.Abs( a[i] - i* 2 - 1);\n\t\t\t}\n\t\t\tif (s1 < s2)\n\t\t\t\tConsole.WriteLine (s1);\n\t\t\telse\n\t\t\t\tConsole.WriteLine (s2);\n\t\t}\n\t\tpublic void doit(){\n\t\t}\n\n\t\t/*public void output(int i){\n\t\t\tConsole.WriteLine (string.Format (\"Case #{0}: {1}\", i, ans));\n\t\t}*/\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ForAcm\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n//\t\t\tstring t = Console.ReadLine ();\n//\t\t\tint it = int.Parse (t);\n\t\t\tSolve solve = new Solve ();\n\t\t\tsolve.init ();\n//\t\t\tint i = 0;\n//\t\t\twhile (it > 0) {\n//\t\t\t\tit--;\n//\t\t\t\ti++;\n\t\t\t\tsolve.doit ();\n\t\t\t\t//solve.output (i);\n//\t\t\t}\n\t\t}\n\t}\n\n\tclass Solve{\n\t\tprivate int ans;\n\t\tprivate int[] a = new int[100];\n\t\tpublic void init(){\n\t\t\tstring s = Console.ReadLine ();\n\t\t\tint n = int.Parse (s);\n\t\t\ts = Console.ReadLine ();\n\t\t\tstring[] ss = s.Split (' ');\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ta[i] = int.Parse (ss[i]) - 1;\n\t\t\t}\n\t\t\tint s1 = 0;\n\t\t\tint s2 = 0;\n\t\t\tfor (int i = 0; i < n / 2; i++) {\n\t\t\t\ts1 += Math.Abs( a [i] - i * 2);\n\t\t\t\ts2 += Math.Abs( a[i] - i* 2 - 1);\n\t\t\t}\n\t\t\tif (s1 < s2)\n\t\t\t\tConsole.WriteLine (s1);\n\t\t\telse\n\t\t\t\tConsole.WriteLine (s2);\n\t\t}\n\t\tpublic void doit(){\n\t\t}\n\n\t\t/*public void output(int i){\n\t\t\tConsole.WriteLine (string.Format (\"Case #{0}: {1}\", i, ans));\n\t\t}*/\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine())/2;\n int[] mass = new int[n];\n String[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n mass[i] = int.Parse(s[i]);\n }\n int cnt = 0;\n int black = 1;\n for (int i = 0; i < n; i++)\n {\n cnt += Math.Abs(mass[i] - black);\n black += 2;\n }\n int cnt2 = 0;\n int white = 2;\n for (int i = 0; i < n; i++)\n {\n cnt2 += Math.Abs(mass[i] - white);\n white += 2;\n }\n Console.WriteLine(Math.Min(cnt, cnt2));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces2105A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n\n string read;\n read = Console.ReadLine();\n List ArrayA = new List();\n ArrayA = (read.Split(' ').ToList()).Select(s => int.Parse(s)).ToList();\n\n int black = 0;\n int white = 0;\n int blackindex = 1;\n int whiteindex = 2;\n foreach(var a in ArrayA)\n {\n black = black + Math.Abs(blackindex - a);\n white = white + Math.Abs(whiteindex - a);\n\n blackindex += 2;\n whiteindex += 2;\n }\n\n if (black > white)\n Console.WriteLine(white);\n else\n Console.WriteLine(black);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Chess_Placing\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n\n var nn = new int[n/2];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next();\n }\n\n int first = 1;\n int count = 0;\n foreach (int i in nn)\n {\n count += Math.Abs(first - i);\n first += 2;\n }\n int min = count;\n\n first = 2;\n count = 0;\n foreach (int i in nn)\n {\n count += Math.Abs(first - i);\n first += 2;\n }\n return Math.Min(min, count);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int n = ReadInt();\n int m = n / 2;\n int ans0 = 0;\n int ans1 = 0;\n for (int i = 0; i < m; i++)\n {\n int p = ReadInt() - 1;\n ans0 += Math.Abs(2 * i - p);\n ans1 += Math.Abs(2 * i + 1 - p);\n }\n int ans = Math.Min(ans0, ans1);\n Writer.WriteLine(ans);\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n //Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.IO;\n\nnamespace Practice\n{\n public class Program\n {\n public static void Main()\n {\n ConsoleReader r = new ConsoleReader();\n BufferedStream w = new BufferedStream(Console.OpenStandardOutput());\n Solve(r, w);\n //Console.ReadKey();\n }\n\n public static void Solve(ConsoleReader reader, BufferedStream writer)\n {\n A(reader, writer);\n }\n public static void C()\n {\n\n\n }\n\n public static void B(ConsoleReader reader, BufferedStream writer)\n {\n }\n public static void A(ConsoleReader reader, BufferedStream writer)\n {\n int n = reader.ReadInt()/2;\n int bMoves = 0, wMoves = 0;\n for (int i =0; i= data.Length)\n {\n wordIndex = 0;\n data = Console.ReadLine().Trim().Split();\n }\n }\n public int ReadInt()\n {\n ReadLineIfNeeded();\n return int.Parse(data[wordIndex++]);\n }\n\n public void ReadArray(int[] a, int n)\n {\n for (int i = 0; i < n; i++)\n {\n a[i] = ReadInt();\n }\n }\n\n public string ReadString()\n {\n ReadLineIfNeeded();\n return data[wordIndex++];\n }\n\n //ReadLine()\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _985A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int zoma = n / 2, oddCount=0,evenCount=0;\n int[] posArray = new int[zoma];\n var inputs = Console.ReadLine().Split().Select(int.Parse);\n posArray = inputs.ToArray();\n for (int i=n, j = zoma-1; i > 0; i-=2,j--) \n if (posArray[j] != i) evenCount+= Math.Abs(i - posArray[j]);\n for (int i = n-1, j = zoma - 1; i > 0; i -= 2, j--)\n if (posArray[j] != i) oddCount+= Math.Abs(i - posArray[j]); \n Console.WriteLine(evenCount < oddCount ? evenCount : oddCount);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_985_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n n = n / 2;\n int[] a = new int[n];\n string[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n }\n int nb = CountMoves(n, a, 1);\n int nw = CountMoves(n, a, 2);\n Console.WriteLine(Math.Min(nb, nw));\n }\n\n private static int CountMoves(int n, int[] a, int first)\n {\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n cnt += Math.Abs(i*2+first - a[i]);\n }\n return cnt;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace QTREE3 {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int ans1 = 0, ans2 = 0;\n for (int i = 1; i <= N / 2; i++) {\n int p = In.ReadInt();\n ans1 += Math.Abs(i * 2 - p);\n ans2 += Math.Abs(i * 2 - 1 - p);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace QTREE3 {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int[] P = new int[N / 2];\n for (int i = 0; i < N / 2; i++) P[i] = In.ReadInt();\n int ans1 = 0, ans2 = 0;\n for (int i = 0; i < N / 2; i++) {\n ans1 += Math.Abs(i * 2 + 1 - P[i]);\n ans2 += Math.Abs(i * 2 + 2 - P[i]);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace QTREE3 {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int ans1 = 0, ans2 = 0;\n for (int i = 1; i <= N / 2; i++) {\n int p = In.ReadInt();\n ans1 += Math.Abs(i * 2 - p);\n ans2 += Math.Abs(i * 2 + 1 - p);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing static System.Diagnostics.Debug;\n\nnamespace QTREE3 {\n public class Program {\n public class Reader {\n private TextReader reader;\n private Queue tokens;\n\n public Reader(Stream s) {\n reader = new StreamReader(s);\n tokens = new Queue();\n }\n\n public Reader(string file) {\n reader = new StreamReader(file);\n tokens = new Queue();\n }\n\n public string ReadLine() { return reader.ReadLine(); }\n\n public string ReadToken() {\n while (tokens.Count() == 0) tokens = new Queue(ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries));\n return tokens.Dequeue();\n }\n\n public char ReadChar() { return ReadToken()[0]; }\n public sbyte ReadByte() { return sbyte.Parse(ReadToken()); }\n public short ReadShort() { return short.Parse(ReadToken()); }\n public int ReadInt() { return int.Parse(ReadToken()); }\n public long ReadLong() { return long.Parse(ReadToken()); }\n public float ReadFloat() { return float.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public decimal ReadDecimal() { return decimal.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public void Close() { reader.Close(); }\n }\n\n private static Reader In;\n private static TextWriter Out;\n\n private static int NUM_OF_TEST_CASES = 1; // TODO CHANGE NUMBER OF TEST CASES\n\n // TODO CHANGE FILE NAMES\n private static string INPUT_FILE_NAME = \"input.txt\";\n private static string OUTPUT_FILE_NAME = \"output.txt\";\n\n private static bool stdIn = true;\n private static bool stdOut = true;\n private static bool crash = true;\n private static bool flush = false;\n\n private static int STACK_MEMORY_LIMIT_MB = 150; // TODO CHANGE MEMORY LIMIT FOR STACK\n\n public static void Main(string[] args) {\n Thread T = new Thread(new ThreadStart(start), STACK_MEMORY_LIMIT_MB * 1000000);\n T.Start();\n }\n\n public static void start() {\n if (stdIn) In = new Reader(Console.OpenStandardInput());\n else In = new Reader(INPUT_FILE_NAME);\n if (stdOut) Out = new StreamWriter(Console.OpenStandardOutput());\n else Out = new StreamWriter(OUTPUT_FILE_NAME);\n for (int i = 1; i <= NUM_OF_TEST_CASES; i++) {\n try {\n run(i);\n } catch (Exception e) {\n Out.WriteLine(\"Exception thrown on test case \" + i);\n Out.WriteLine(e.StackTrace);\n Out.Flush();\n if (crash) throw new Exception();\n }\n if (flush) Out.Flush();\n }\n In.Close();\n Out.Close();\n }\n\n // TODO CODE GOES IN THIS METHOD\n public static void run(int testCaseNum) {\n int N = In.ReadInt();\n int ans1 = 0, ans2 = 0;\n for (int i = 1; i <= N / 2; i++) {\n int p = In.ReadInt();\n ans1 += Math.Abs(p - i * 2);\n ans2 += Math.Abs(p - i * 2 + 1);\n }\n Out.WriteLine(Math.Min(ans1, ans2));\n }\n }\n}\n"}], "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace TaskA\n{\n class Program\n {\n private static readonly Stack Stack = new Stack();\n private static long a;\n private static long b;\n\n private static bool AtoB()\n {\n if (a > b) return false;\n Stack.Push(a);\n if (a == b) return true;\n var temp = a;\n a = a * 10 + 1;\n var result = AtoB();\n if (result) return true;\n a = temp * 2;\n result = AtoB();\n if (result) return true;\n a = temp;\n Stack.Pop();\n return false;\n }\n\n static void Main()\n {\n var ab = Console.ReadLine().Split(' ').ToArray();\n a = long.Parse(ab[0]);\n b = long.Parse(ab[1]);\n if (AtoB())\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(Stack.Count);\n foreach (var temp in Stack.Reverse())\n Console.Write(\"{0} \", temp);\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n List rez = new List();\n rez.Add(a[1]);\n while (a[1] > a[0])\n {\n if (a[1] % 10 == 1)\n a[1] /= 10;\n else if (a[1] % 2 == 0)\n a[1] /= 2;\n else break;\n rez.Add(a[1]);\n }\n rez.Reverse();\n Console.WriteLine(a[1] != a[0] ? \"NO\" : $\"YES\\n{rez.Count}\\n{string.Join(\" \", rez)}\"); ;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _727A\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n\n var set = new SortedSet();\n\n var queue = new Queue();\n queue.Enqueue(b);\n\n while (queue.Any())\n {\n int x = queue.Dequeue();\n set.Add(x);\n\n if (x % 10 == 1 && !set.Contains(x / 10))\n {\n queue.Enqueue(x / 10);\n }\n\n if (x % 2 == 0 && !set.Contains(x / 2))\n {\n queue.Enqueue(x / 2);\n }\n }\n\n if (set.Contains(a))\n {\n var steps = new List() { a };\n\n while (a < b)\n {\n if (set.Contains(2 * a))\n {\n a *= 2;\n }\n else\n {\n a = a * 10 + 1;\n }\n\n steps.Add(a);\n }\n\n Console.WriteLine(\"YES\");\n Console.WriteLine(steps.Count);\n Console.WriteLine(string.Join(\" \", steps));\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] read = Console.ReadLine().Split(new Char[] { ' ' });\n int a = Convert.ToInt32(read[0]);\n int b = Convert.ToInt32(read[1]);\n List arr = new List();\n arr.Add(b);\n int count = 1;\n //\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 b \u0447\u0438\u0441\u043b\u043e a\n while (true)\n {\n string temp = b.ToString().Substring(b.ToString().Length - 1);\n if (temp == \"1\" && b.ToString().Length > 1)\n {\n //\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1\n b = Convert.ToInt32(b.ToString().Substring(0, b.ToString().Length-1));\n //\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n } \n else if(b >= a)\n {\n //\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0447\u0451\u0442\u043d\u043e\u0441\u0442\u044c\n if (b % 2 != 0)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n b = b / 2;\n } \n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n arr.Add(b); count++;\n if (b == a) {\n arr.Reverse();\n string result = \"\";\n foreach(int c in arr)\n {\n result += c + \" \";\n }\n Console.WriteLine(\"YES\\n\" + (count) + \"\\n\" + result);\n break; \n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing static System.Console;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] s = ReadLine().Split(' ');\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n\n WriteLine(ez(a, b) ? \"\" : \"NO\");\n Read();\n }\n\n\n public static bool ez(int a, int b)\n {\n Stack stack = new Stack();\n int k = 1;\n stack.Push(b);\n do\n {\n if (b % 2 == 0)\n b /= 2;\n else if (b % 10 == 1)\n b /= 10;\n else\n return false;\n\n if (b < a)\n return false;\n\n stack.Push(b);\n k++;\n\n } while (a < b);\n\n WriteLine(\"YES\");\n WriteLine(k);\n while (stack.Any())\n {\n Write(stack.Pop() + \" \");\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nclass Program\n {\n static void Main(string[] args)\n {\n int n, m, i;\n i = 1;\n string input = Console.ReadLine();\n n = int.Parse(input.Substring(0, input.IndexOf(' ')));\n m = int.Parse(input.Substring(input.IndexOf(' ')+ 1));\n string result = m.ToString();\n\n while (true)\n {\n if (m < n)\n {\n result = \"NO\";\n break;\n }\n if (m == n)\n {\n result = \"YES\\r\\n\" + i.ToString() + \"\\r\\n\" + result;\n break;\n }\n if (m % 2 == 0)\n {\n m /= 2;\n result = (m).ToString() + \" \" + result;\n i++;\n continue;\n }\n if ((m - 1) % 10 == 0)\n {\n m = (m - 1) / 10;\n result = (m).ToString() + \" \" + result;\n i++;\n continue;\n }\n result = \"NO\";\n break;\n }\n \n Console.WriteLine(\"{0}\", result);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar input = Console.ReadLine().Split(' ');\n\t\t\tlong a = long.Parse(input[0]), b = long.Parse(input[1]);\n\t\t\tvar c = b;\n\t\t\tvar seq = new List { c };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (c<=a) break;\n\t\t\t\tif (c%2 > 0)\n\t\t\t\t{\n\t\t\t\t\tif (c%10 != 1) break;\n\t\t\t\t\tc /= 10;\n\t\t\t\t}\n\t\t\t\telse c /= 2;\n\t\t\t\tseq.Insert(0, c);\n\t\t\t}\n\t\t\tif (c != a)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.WriteLine(seq.Count);\n\t\t\t\tConsole.WriteLine(string.Join(\" \",seq));\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace cf727A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int a = ab[0]; int b = ab[1];\n\n List operations = new List();\n\n while(b > a)\n {\n operations.Add(b);\n if ((b % 2) == 0)\n b /= 2;\n else if (b.ToString().EndsWith(\"1\"))\n {\n b = (b - 1) / 10;\n }\n else\n {\n Console.WriteLine(\"NO\"); return;\n }\n }\n\n if (b == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(operations.Count + 1);\n Console.Write(a); Console.Write(' ');\n for (int i = 1; i <= operations.Count; i++)\n {\n Console.Write(operations[operations.Count-i]); Console.Write(' ');\n }\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double a, b;\n string Result = \"NO\";\n //int[] posled ;\n List posled = new List();\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 a\");\n //a =int.Parse(Console.ReadLine().ToString());\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 b\");\n //b = int.Parse(Console.ReadLine().ToString());\n string[] input = Console.ReadLine().Split(' ');\n a = double.Parse(input[0]);\n b = double.Parse(input[1]);\n double tempVar = b;\n while (tempVar > a) \n {\n posled.Add(tempVar);\n if (tempVar % 2 > 0)\n {\n tempVar = (tempVar - 1) / 10;\n }\n else\n {\n tempVar = tempVar / 2;\n }\n\n if (tempVar < 1)\n {\n Result = \"NO\";\n break;\n }\n }\n if (tempVar == a)\n {\n Result = \"YES\";\n };\n posled.Add(a);\n \n\n Console.WriteLine(Result);\n if (Result == \"YES\")\n {\n Console.WriteLine(posled.Count());\n for (int i = posled.Count() - 1; i >= 0; i--)\n {\n Console.Write(posled[i] + \" \");\n }\n\n }\n //Console.ReadKey();\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] input = Console.ReadLine().Split(' ');\n\t\t\tlong a = long.Parse(input[0]), b = long.Parse(input[1]);\n\t\t\tlong c = b;\n\t\t\tvar seq = new List { c };\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (c<=a) break;\n\t\t\t\tif (c%2 > 0)\n\t\t\t\t{\n\t\t\t\t\tif ((c - 1)%10 > 0) break;\n\t\t\t\t\tc = (c - 1)/10;\n\t\t\t\t}\n\t\t\t\telse c = c/2;\n\t\t\t\tseq.Insert(0, c);\n\t\t\t}\n\t\t\tif (c != a)\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.WriteLine(seq.Count);\n\t\t\t\tConsole.WriteLine(string.Join(\" \",seq));\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace OlympPrepSharp\n{\n public class Node\n {\n public int Val;\n public Node Left, Right;\n\n public Node(int val)\n {\n Val = val;\n Left = null;\n Right = null;\n }\n\n public void BuildTree()\n {\n if(Val == 0) return;\n if (Val%2 == 0)\n {\n Left = new Node(Val/2);\n Left.BuildTree();\n }\n else Left = null;\n if ((Val - 1)%10 == 0)\n {\n Right = new Node((Val - 1)/10);\n Right.BuildTree();\n }\n else Right = null;\n }\n\n public List DFS(int lookFor, List prev)\n {\n List cur = new List(prev);\n cur.Add(Val);\n if (Val == lookFor) return cur;\n if (Left != null)\n {\n List left = Left.DFS(lookFor, cur);\n if (left[0] != -1) return left;\n }\n if (Right != null)\n {\n List right = Right.DFS(lookFor, cur);\n if (right[0] != -1) return right;\n }\n return new List {-1};\n\n } \n }\n\n class Program\n {\n\n static void Main(string[] args)\n {\n try\n {\n\n\n int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Node root = new Node(input[1]);\n root.BuildTree();\n List result = root.DFS(input[0], new List());\n if (result[0] == -1) Console.WriteLine(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(result.Count);\n for (int i = result.Count - 1; i >= 0; i--)\n {\n Console.Write(result[i] + \" \");\n }\n Console.WriteLine();\n }\n }\n catch (Exception e)\n {\n Console.WriteLine(e.Message);\n }\n }\n\n static void PrintCol(IEnumerable col)\n {\n foreach (var i in col)\n {\n Console.Write(i + \" \");\n }\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n {\n public static void Main(string[] args)\n {\n int a, b;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n }\n {\n int temp;\n List data = new List();\n data.Add(b);\n while (a < b)\n {\n if ((temp = b % 10) == 1)\n b = (b -= 1) / 10;\n else if (temp % 2 == 0)\n b /= 2;\n else break; \n data.Add(b);\n }\n if (a!=b) Console.WriteLine(\"NO\");\n else\n {\n Console.WriteLine(\"YES\\n{0}\", data.Count);\n for (int i = data.Count - 1; i > 0; --i)\n Console.Write(\"{0} \", data[i]);\n Console.WriteLine(data[0]);\n }\n }\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n\n Stack stack = new Stack();\n stack.Push(b);\n while (true)\n {\n if (b < a)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (b == a)\n {\n //\u0432\u044b\u0432\u043e\u0434\n Console.WriteLine(\"YES\");\n int k = stack.Count;\n Console.WriteLine(k);\n for (int i = 0; i < k; i++)\n {\n Console.Write(\"{0} \", stack.Pop());\n }\n return;\n }\n if ((b % 2) != 0)\n {\n if ((b % 10) != 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n b -= 1;\n b /= 10;\n stack.Push(b);\n }\n }\n else\n {\n b /= 2;\n stack.Push(b);\n }\n }\n }\n }\n}\n"}, {"source_code": "// Problem: 727A - Transformation: from A to B\n// Author: Gusztav Szmolik\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass TransformationFromAToB\n {\n static int Main ()\n {\n string[] words = ReadSplitLine (2);\n if (words == null)\n return -1;\n uint a;\n if (!UInt32.TryParse (words[0], out a))\n return -1;\n if (a < 1 || a > 999999999)\n return -1;\n uint b;\n if (!UInt32.TryParse (words[1], out b))\n return -1;\n if (b <= a || b > 1000000000)\n return -1;\n Stack transformations = new Stack ();\n transformations.Push (b);\n uint transPrev = b;\n bool existSolution = true;\n while (transPrev > a && existSolution)\n {\n if (transPrev%10 == 1)\n transPrev = (transPrev-1)/10;\n else if (transPrev%2 == 0)\n transPrev /= 2;\n else\n {\n existSolution = false;\n continue;\n }\n transformations.Push (transPrev);\n }\n if (existSolution && transPrev == a)\n {\n Console.WriteLine (\"YES\");\n Console.WriteLine (transformations.Count);\n StringBuilder steps = new StringBuilder ();\n foreach (uint elem in transformations)\n steps.Append (String.Format (\"{0} \",elem));\n steps.Remove (steps.Length-1,1);\n Console.WriteLine (steps);\n }\n else\n Console.WriteLine (\"NO\");\n return 0;\n }\n \n static string[] ReadSplitLine (uint numWordNeed)\n {\n string line = Console.ReadLine ();\n if (line == null)\n return null;\n char[] delims = new char[2] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n return (words.Length == numWordNeed ? words : null);\n } \n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace Algorithm\n{\n class Program\n {\n static void Main()\n {\n int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Stack seq = new Stack();\n seq.Push(nums[1]);\n while (nums[1] > nums[0])\n {\n if ((nums[1] & 1) == 1)\n {\n if (nums[1] % 10 == 1)\n nums[1] /= 10;\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n nums[1] >>= 1;\n }\n seq.Push(nums[1]);\n }\n\n if (nums[1] < nums[0])\n Console.WriteLine(\"NO\");\n else\n {\n if (seq.Count == 1)\n seq.Push(nums[0]);\n Console.WriteLine(\"YES\");\n Console.WriteLine(seq.Count);\n foreach (var item in seq)\n {\n Console.Write(item + \" \");\n }\n }\n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n List b = new List();\n b.Add(a[1]);\n while (a[1] > a[0])\n {\n if (a[1] % 2 == 1)\n {\n a[1]--;\n if (a[1] % 10 != 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n a[1] /= 10;\n b.Add(a[1]);\n }\n }\n else\n {\n a[1] /= 2;\n b.Add(a[1]);\n }\n }\n if (a[1] == a[0])\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(b.Count);\n for (int i = b.Count - 1; i >= 0; i--)\n {\n Console.Write(b[i] + \" \");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Transformation_from_A_to_B\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n\n var s = new Stack();\n s.Push(b);\n\n do\n {\n if (b%10 == 1)\n {\n b /= 10;\n }\n else if (b%2 == 0)\n {\n b /= 2;\n }\n else\n {\n break;\n }\n s.Push(b);\n } while (b > a);\n\n if (a == b)\n {\n writer.WriteLine(\"YES\");\n writer.WriteLine(s.Count);\n foreach (int i in s)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n }\n else\n {\n writer.WriteLine(\"NO\");\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace Algorithm\n{\n class Program\n {\n static void Main()\n {\n int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n List seq = new List();\n seq.Add(nums[1]);\n while (nums[1] > nums[0]){\n if((nums[1] & 1) == 1)\n {\n if (nums[1] % 10 == 1)\n nums[1] /= 10;\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else\n {\n nums[1] >>= 1;\n }\n seq.Add(nums[1]);\n }\n\n if(nums[1] < nums[0])\n Console.WriteLine(\"NO\");\n else\n {\n if (seq.Count == 1)\n seq.Add(nums[0]);\n Console.WriteLine(\"YES\");\n Console.WriteLine(seq.Count);\n for (int i = seq.Count-1; i >= 0; i--)\n {\n Console.Write(seq[i] + \" \");\n }\n }\n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727A\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]), b = int.Parse(input[1]);\n var sequence = new List();\n sequence.Add(b);\n \n while (true)\n {\n var last = sequence[sequence.Count - 1];\n if (last == a)\n {\n Console.WriteLine(\"YES\");\n sequence.Reverse();\n Console.WriteLine(sequence.Count);\n Console.WriteLine(string.Join(\" \", sequence));\n break;\n }\n else if (last < a)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n\n if (last % 2 == 0)\n {\n sequence.Add(last / 2);\n }\n else if (last % 10 == 1)\n {\n sequence.Add((last - 1) / 10);\n }\n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeff#undef DEBUG\n\nusing System;\n\nnamespace _1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n decimal a = Convert.ToDecimal(str.Split(' ')[0]);\n decimal b = Convert.ToDecimal(str.Split(' ')[1]);\n decimal tmp = b;\n decimal[] nums = { b };\n while (tmp!=a)\n {\n if (tmp < a)\n {\n Console.WriteLine(\"NO\");\n goto end;\n }\n Array.Resize(ref nums, nums.Length + 1);\n if (tmp % 2 == 0)\n {\n tmp = tmp / 2;\n }\n else\n {\n tmp = (tmp - 1) / 10;\n }\n nums[nums.Length - 1] = tmp;\n }\n Console.WriteLine(\"YES\");\n Console.WriteLine(nums.Length);\n string stmp = \"\";\n for (int i = nums.Length - 1; i >= 0; i--)\n {\n stmp += nums[i] + \" \";\n }\n stmp.TrimEnd();\n Console.WriteLine(stmp);\n end:;\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n var result = new Stack();\n result.Push(b);\n bool found = false;\n\n while (b > a)\n {\n if (b % 2 == 0)\n b /= 2;\n else if (b > 9 && b%10 == 1)\n b /= 10;\n else\n break;\n\n result.Push(b);\n\n if (b == a)\n found = true;\n }\n\n if (found)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(result.Count);\n while (result.Count > 0)\n {\n if (result.Count > 1)\n Console.Write(\"{0} \", result.Pop());\n else\n Console.Write(result.Pop());\n }\n }\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n\n\n static List ans = new List();\n static void Main()\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n ans.Add(b);\n while((b>=a) || ((b % 10) ==1) || ((b % 2) == 0))\n {\n if (b == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(ans.Count);\n for (int i = 0; i < ans.Count; i++)\n {\n Console.Write(ans[i] + \" \");\n\n }\n Environment.Exit(0);\n }\n else if ((b % 10) == 1)\n {\n b = (b - 1) / 10;\n ans.Insert(0, b);\n }\n else if ((b % 2) == 0)\n {\n b = b / 2;\n ans.Insert(0, b);\n\n }\n else break;\n if (b < a) break;\n \n\n\n }\n Console.WriteLine(\"NO\");\n\n\n\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var list = new List();\n while (true) {\n list.Add(b);\n if (b == a)\n {\n sw.WriteLine(\"YES\");\n break;\n }\n if (b < a)\n {\n sw.WriteLine(\"NO\");\n return;\n }\n if (b%2 == 0) {\n b /= 2;\n }\n else {\n if (b % 10 != 1) {\n sw.WriteLine(\"NO\");\n return;\n }\n b /= 10;\n }\n }\n list.Reverse();\n var sb = new StringBuilder();\n foreach (var i in list) {\n sb.Append(i + \" \");\n }\n\n sw.WriteLine(list.Count);\n sw.Write(sb);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1 {\n class Program {\n static void Main(string[] args) {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int m = int.Parse(tokens[1]);\n\n var res = new List();\n res.Add(m);\n while (m > n) {\n if (m%10 == 1) {\n m -= 1;\n m /= 10;\n } else if (m%2 != 0) {\n Console.WriteLine(\"NO\");\n return;\n } else {\n m /= 2;\n }\n res.Add(m);\n }\n if (m == n) {\n Console.WriteLine(\"YES\");\n Console.WriteLine(res.Count);\n for (int i = res.Count - 1; i >= 0; --i) {\n Console.Write(res[i] + \" \");\n }\n } else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Program\n{\n static List l = new List();\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n ulong a = Convert.ToUInt64(str[0]);\n ulong b = Convert.ToUInt64(str[1]);\n if (Func(a, b))\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(l.Count);\n for (int i = l.Count - 1; i >= 0; i--)\n {\n if (i != 0)\n Console.Write(l[i] + \" \");\n else Console.Write(l[i]);\n }\n }\n else Console.WriteLine(\"NO\");\n // Console.ReadKey();\n }\n public static bool Func(ulong a, ulong b)\n {\n if (a != b && a < b)\n {\n if (Func(a * 2, b) || Func(a * 10 + 1, b))\n {\n l.Add(a);\n return true;\n }\n }\n else\n {\n if (a == b)\n {\n l.Add(a);\n return true;\n }\n else return false;\n }\n return false;\n }\n\n}\n\n"}, {"source_code": "namespace Play.Codeforces\n{\n using System;\n using System.Collections.Generic;\n\n class Program\n {\n const long mod = 1000000007;\n\n static void Main(string[] args)\n {\n int[] ab = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n LinkedList path = new LinkedList();\n var found = Transform(ab[0], ab[1], path);\n\n if (found == false)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n path.AddFirst(ab[0]);\n \n Console.WriteLine(\"YES\");\n Console.WriteLine(path.Count);\n Console.WriteLine(string.Join(\" \", path));\n }\n\n }\n\n static bool Transform(long a, long b, LinkedList path)\n {\n if (a == b)\n return true;\n\n if (a > b)\n return false;\n\n if (Transform(2*a, b, path))\n {\n path.AddFirst(2*a);\n return true;\n }\n if (Transform(10 * a + 1, b, path))\n {\n path.AddFirst(10 * a + 1);\n return true;\n }\n\n return false;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Test\n{\n public static void Main()\n {\n string[] Arr = Console.ReadLine().Split(' ');\n\n int a = int.Parse(Arr[0]), b = int.Parse(Arr[1]);\n int count = 0;\n string str = \"\";\n bool c = false;\n\n for (int i = 0; ; i++)\n {\n if (a < b)\n {\n if (b % 2 == 0)\n {\n count++;\n str = Convert.ToString(b) + \" \" + str;\n b /= 2;\n\n }\n else if (b % 10 == 1)\n {\n str = Convert.ToString(b) + \" \" + str;\n b = b / 10;\n count++;\n }\n else break;\n\n if (b == a)\n {\n str = str = Convert.ToString(a) + \" \" + str;\n c = true;\n count++;\n break;\n\n }\n }\n else break;\n }\n \n if (c)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(count);\n Console.WriteLine(str);\n }\n else Console.WriteLine(\"NO\");\n }\n\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace SevskiiOlymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int a = int.Parse(s.Split(' ')[0]);\n int b = int.Parse(s.Split(' ')[1]);\n List l = check(a, b, new List());\n if (l.Count > 0)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(l.Count + 1);\n Console.Write(a+ \" \");\n for (int i = l.Count-1; i >= 0; i--)\n Console.Write(l[i] + \" \");\n }\n else\n Console.WriteLine(\"NO\");\n Console.WriteLine();\n Console.ReadLine();\n }\n static public List check(int a,int b,List i)\n {\n try\n {\n if (b < a)\n return new List();\n if (b == a)\n return i;\n int r1 = -1, r2 = -1;\n i.Add(b);\n if (b % 2 == 0)\n {\n List t = check(a, b / 2, i);\n r1 = t[t.Count - 1];\n }\n if (b % 10 == 1)\n {\n List t = check(a, b / 10, i);\n r2 = t[t.Count - 1];\n }\n if (r1 != -1)\n return i;\n if (r2 != -1)\n return i;\n return new List();\n }\n catch (Exception)\n {\n return new List();\n }\n }\n public void tmp()\n {\n List prices = new List();\n string s = Console.ReadLine();\n foreach (Match m in Regex.Matches(s, @\"[^\\d]+([^a-z]+)\"))\n {\n prices.Add(m.Groups[1].Value);\n }\n int result = 0;\n\n foreach (string p in prices)\n {\n if (Regex.IsMatch(p, @\"\\.\\d\\d$\"))\n {\n result += int.Parse((p.Substring(0, p.Length - 3).Replace(\".\", \"\"))) * 100 + int.Parse(p.Substring(p.Length - 2, 2));\n }\n else\n {\n result += int.Parse((p.Replace(\".\", \"\"))) * 100;\n }\n }\n string resultStr = result.ToString();\n if (resultStr.Length == 1)\n resultStr = \"00\" + resultStr;\n if (resultStr.Length == 2)\n resultStr = \"0\" + resultStr;\n\n if (result % 100 == 0)\n {\n for (int i = 0; i < resultStr.Length - 2; i++)\n {\n Console.Write(resultStr[i]);\n if ((resultStr.Length - i) % 3 == 0 && i != resultStr.Length - 3)\n Console.Write(\".\");\n }\n }\n else\n {\n for (int i = 0; i < resultStr.Length - 2; i++)\n {\n Console.Write(resultStr[i]);\n if ((resultStr.Length - i - 3) % 3 == 0 && i != resultStr.Length - 3)\n Console.Write(\".\");\n }\n Console.Write(\".\" + resultStr.Substring(resultStr.Length - 2, 2));\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\t\t\tstring[] sLst = s.Split(' ');\n\t\t\tStack sNum = new Stack();\n\t\t\t//try\n\t\t\t//{\n\t\t\t\tInt64 numA = Convert.ToInt64(sLst[0].Trim());\n\t\t\t\tInt64 numB = Convert.ToInt64(sLst[1].Trim());\n\t\t\t\t\n\t\t\t\tif ( numB <= numA)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsNum.Push(numB);\n\t\t\t\twhile (numA < numB)\n\t\t\t\t{\n\t\t\t\t\tif (numB % 10 == 1)\n\t\t\t\t\t\tnumB = (numB - 1) / 10;\n\t\t\t\t\telse if (numB % 2 == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tnumB = numB / 2;\n\t\t\t\t\t}\n\t\t\t\t\tsNum.Push(numB);\n\t\t\t\t}\n\t\t\t\tif ( numA > numB)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.WriteLine(sNum.Count);\n\t\t\t\twhile( sNum.Count > 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(sNum.Pop());\n\t\t\t\t\tif (sNum.Count > 0) Console.Write(\" \");\n\t\t\t\t}\n\t\t\t//}\n\t\t\t//catch(Exception ex)\n\t\t\t//{\n\t\t\t//\tConsole.Write(\"NO\");\n\t\t\t//}\n\t\t\t//finally\n\t\t\t//{\n\t\t\t//\tConsole.ReadLine();\n\t\t\t//}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\t\t\tstring[] sLst = s.Split(' ');\n\t\t\tStack sNum = new Stack();\n\t\t\ttry\n\t\t\t{\n\t\t\t\tInt64 numA = Convert.ToInt64(sLst[0].Trim());\n\t\t\t\tInt64 numB = Convert.ToInt64(sLst[1].Trim());\n\t\t\t\t\n\t\t\t\tif ( numB <= numA)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsNum.Push(numB);\n\t\t\t\twhile (numA < numB)\n\t\t\t\t{\n\t\t\t\t\tif (numB % 10 == 1)\n\t\t\t\t\t\tnumB = (numB - 1) / 10;\n\t\t\t\t\telse if (numB % 2 == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tnumB = numB / 2;\n\t\t\t\t\t}\n\t\t\t\t\tsNum.Push(numB);\n\t\t\t\t}\n\t\t\t\tif ( numA > numB)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\tConsole.WriteLine(sNum.Count);\n\t\t\t\twhile( sNum.Count > 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(sNum.Pop());\n\t\t\t\t\tif (sNum.Count > 0) Console.Write(\" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Exception ex)\n\t\t\t{\n\t\t\t\tConsole.Write(\"NO\");\n\t\t\t}\n\t\t\t//finally\n\t\t\t//{\n\t\t\t//\tConsole.ReadLine();\n\t\t\t//}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n string instring = Console.ReadLine(), outstring = \"\";\n int x1 = Convert.ToInt32(instring.Substring(0, instring.LastIndexOf(' '))); int a1 = x1, k = 1, f = 0;\n int x2 = Convert.ToInt32(instring.Substring(instring.LastIndexOf(' '), instring.Length - instring.LastIndexOf(' '))); int b1 = x2;\n while (k != 0)\n {\n\n\n if ((b1 % 2 == 0) && (b1 != 0) && (b1 != a1))\n {\n k = 13;\n b1 = b1 / 2;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else if ((b1 % 10 == 1) && (b1 != 1) && (b1 != a1))\n {\n k = 1;\n b1 = b1 / 10;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else k = 0;\n f++;\n }\n outstring = outstring + Convert.ToString(x2);\n if (b1 == a1) Console.WriteLine(\"YES\\n{0}\\n{1}\", f, outstring);\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Div._2_A.Transformation_from_A_to_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n List list = new List();\n bool right = false;\n while (b >= a)\n {\n list.Add(b);\n if (a == b)\n {\n right = true;\n break;\n }\n if (b % 2 == 0)\n {\n b /= 2;\n }\n else if(b > 10 && b % 10 == 1)\n {\n b /= 10;\n }\n else\n {\n right = false;\n break;\n }\n }\n if (right)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list.Count);\n for (int i = list.Count-1; i >= 0; i--)\n {\n Console.Write(list[i] + \" \");\n }\n }\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Div._2_A.Transformation_from_A_to_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n List list = new List();\n\n while (b > a)\n {\n list.Add(b);\n\n if (b % 2 == 0)\n b /= 2;\n else if(b > 10 && b % 10 == 1)\n b /= 10;\n else\n break;\n }\n if (a == b)\n {\n list.Add(b);\n Console.WriteLine(\"YES\");\n Console.WriteLine(list.Count);\n for (int i = list.Count-1; i >= 0; i--)\n {\n Console.Write(list[i] + \" \");\n }\n }\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n\n var ans = new List { b };\n while (b > a)\n {\n if (b % 10 == 1)\n b /= 10;\n else if (b % 2 == 0)\n b /= 2;\n else\n break;\n ans.Add(b);\n }\n\n if (a == b)\n {\n ans.Reverse();\n Write(\"YES\");\n Write(ans.Count);\n WriteArray(ans);\n }\n else\n Write(\"NO\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CCS\n{\n class Program\n {\n static List s = new List();\n\n static bool Rec(int a, int b)\n {\n if (a == b)\n {\n s.Add(b);\n return true;\n }\n else if (b > a)\n {\n bool w = false;\n\n if (b % 2 == 0)\n {\n w = Rec(a, b / 2);\n if (w)\n s.Add(b);\n return w;\n }\n if ((b - 1) % 10 == 0)\n {\n w = Rec(a, (b - 1) / 10);\n if (w)\n s.Add(b);\n return w;\n }\n return false;\n }\n return false;\n }\n\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n if (Rec(int.Parse(input[0]), int.Parse(input[1])))\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(s.Count.ToString());\n for (int i = 0; i < s.Count; i++)\n Console.Write(s[i] + \" \");\n return;\n }\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Solution\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\tlong a = nums [0];\n\t\tlong b = nums [1];\n\t\tDictionary path = new Dictionary ();\n\t\tpath.Add (a, 0);\n\t\tHashSet front = new HashSet { a };\n\t\twhile (front.Count > 0 && !front.Contains (b)) {\n\t\t\tHashSet newFront = new HashSet ();\n\t\t\tforeach (long l in front) {\n\t\t\t\tif (!path.ContainsKey (2 * l) && 2 * l <= b) {\n\t\t\t\t\tpath [2 * l] = l;\n\t\t\t\t\tnewFront.Add (2 * l);\n\t\t\t\t}\n\t\t\t\tif (!path.ContainsKey (10 * l + 1) && 10 * l + 1 <= b) {\n\t\t\t\t\tpath [10 * l + 1] = l;\n\t\t\t\t\tnewFront.Add (10 * l + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfront = newFront;\n\t\t}\n\t\tif (front.Contains (b)) {\n\t\t\tConsole.WriteLine (\"YES\");\n\t\t\tList backtrack = new List {b};\n\t\t\twhile (path [b] != 0) {\n\t\t\t\tb = path [b];\n\t\t\t\tbacktrack.Insert (0, b);\n\t\t\t}\n\t\t\tConsole.WriteLine (backtrack.Count);\n\t\t\tConsole.WriteLine (string.Join (\" \", backtrack));\n\t\t}else\n\t\t\tConsole.WriteLine (\"NO\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Competitions\n{\n class CF1A\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n\n var list = new List();\n list.Add(b);\n while (true)\n {\n if (b == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list.Count);\n list.Reverse();\n Console.WriteLine(string.Join(\" \", list));\n return;\n }\n if (b < a) break;\n if ((b % 10) == 1)\n {\n b -= 1;\n b /= 10;\n list.Add(b);\n }\n else if (b%2 == 0)\n {\n b /= 2;\n list.Add(b);\n }\n else break;\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olmp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //x * 2 | x + '1'\n int from, to;\n string[] split = null;\n do\n {\n split = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n } while ((split.Length < 2) || !int.TryParse(split[0], out from) || !int.TryParse(split[1], out to));\n List step = new List();\n List steps = new List();\n step.Add(to);\n while (to != from && to > from)\n {\n if (to.ToString().Last() == '1')\n {\n to = Convert.ToInt32(to.ToString().Remove(to.ToString().Length - 1));\n step.Add(to);\n }\n else if (Math.IEEERemainder((double)to, 2) == 0)\n {\n to = to / 2;\n step.Add(to);\n }\n else\n {\n break;\n }\n }\n if (to == from)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(step.Count);\n for (int i = step.Count - 1; i >= 0; i--)\n {\n if (i != 0)\n {\n Console.Write(step[i] + \" \");\n }\n else\n {\n Console.Write(step[i]);\n }\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class A\n {\n private static ThreadStart s_threadStart = new A().Go;\n\n private void Go()\n {\n long a = GetInt();\n long b = GetInt();\n List ans = new List();\n while (b > a)\n {\n ans.Add(b);\n if (b % 10 == 1)\n b = (b - 1) / 10;\n else if (b % 2 == 0)\n b /= 2;\n else\n {\n Wl(\"NO\");\n return;\n }\n }\n ans.Add(b);\n\n if (b < a)\n {\n Wl(\"NO\");\n return;\n }\n\n ans.Reverse();\n Wl(\"YES\");\n Wl(ans.Count); \n Wl(string.Join(\" \", ans.Select(x => x.ToString())));\n }\n\n #region Template\n\n private static StringBuilder output = new StringBuilder();\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n output.Length = 0;\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n Console.Write(output);\n timer.Stop();\n Console.Error.WriteLine(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n do\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n } while (string.IsNullOrEmpty(ioEnum.Current));\n\n return ioEnum.Current;\n }\n\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n W(o);\n output.Append(Console.Out.NewLine);\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n W(enumerable);\n output.Append(Console.Out.NewLine);\n }\n\n private static void W(T o)\n {\n if (o is double)\n {\n Wd((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wd((o as float?).Value, \"\");\n }\n else\n output.Append(o.ToString());\n }\n\n private static void W(IEnumerable enumerable)\n {\n W(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wd(double d, string format)\n {\n W(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFA\n{\n class Program\n {\n static Stack steps = new Stack();\n\n static bool rec(int a, int b)\n {\n if (a == b) \n {\n steps.Push(a);\n return true; \n }\n if (a % 2 == 0 && a / 2 != 0) \n {\n steps.Push(a);\n return rec(a / 2, b); \n }\n if (a % 10 == 1) \n {\n steps.Push(a);\n return rec((a - 1) / 10, b); \n }\n return false;\n }\n\n static void Main()\n {\n int a, b;\n string s = Console.ReadLine();\n var s1 = s.Split(' ');\n a = int.Parse(s1[0]);\n b = int.Parse(s1[1]);\n if (rec(b, a)) \n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(steps.Count);\n int cont = 1;\n foreach (int item in steps)\n {\n Console.Write(item);\n if (cont != steps.Count)\n Console.Write(\" \");\n cont++;\n }\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n int a = int.Parse(x.Split(' ')[0]);\n int b = int.Parse(x.Split(' ')[1]);\n int z = b;\n string resul = x.Split(' ')[1];\n int i = 0;\n while (a!=z && z != 0)\n {\n int h = z%10;\n if (h != 0 && (h%2) == 1)\n {\n for (int f = h; f > 0; f--)\n {\n i++;\n z = (z - 1) / 10;\n resul = z + \" \" + resul;\n }\n }\n else\n {\n i++;\n\n z = z / 2;\n resul = z + \" \" + resul;\n }\n }\n if (z == 0)\n Console.WriteLine(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(i + 1);\n Console.WriteLine(resul);\n }\n /* for (i = i; a*2 <= b; i++)\n {\n a = a * 2;\n resul = resul + \" \" + a;\n if(a == b)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(i);\n Console.WriteLine(resul);\n i = 999;\n }\n }*/\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static int GetNumberInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n static long GetNumberLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n static int[] GetArrayInt()\n {\n string[] @string = Console.ReadLine().Split(' ');\n int[] array = new int[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt32(@string[i]);\n }\n return array;\n }\n\n static long[] GetArrayLong()\n {\n string[] @string = Console.ReadLine().Split(' ');\n long[] array = new long[@string.Length];\n for (int i = 0; i < array.Length; i++)\n {\n array[i] = Convert.ToInt64(@string[i]);\n }\n return array;\n }\n\n static bool PossibleAtoB(long[] array, int currentIndex, long b)\n {\n if (array[currentIndex] > b)\n return false;\n if (array[currentIndex] == b)\n return true;\n array[currentIndex + 1] = 2 * array[currentIndex];\n bool flag = PossibleAtoB(array, currentIndex + 1, b);\n if (!flag)\n {\n array[currentIndex + 1] = 10 * array[currentIndex] + 1;\n flag = PossibleAtoB(array, currentIndex + 1, b);\n }\n return flag;\n }\n static int GetLengthArray(long[] array, long b)\n {\n int count = 0;\n for (int i = 0; i < array.Length; i++)\n {\n count++;\n if (array[i] >= b)\n break;\n }\n return count;\n }\n static void Main(string[] args)\n {\n long[] array = GetArrayLong();\n long a = array[0], b = array[1];\n int count = 0;\n array = new long[40];\n array[0] = a;\n bool flag = PossibleAtoB(array, 0, b);\n if (flag)\n {\n Console.WriteLine(\"YES\");\n count = GetLengthArray(array, b);\n Console.WriteLine(count);\n for (int i = 0; i < count; i++)\n {\n Console.Write(\"{0} \", array[i]);\n }\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n\nclass Program\n{\n long[] c = new long[40];\n int indC = 0;\n bool tutu(long a, long b)\n {\n if (a == b)\n return true;\n if (a > b)\n return false;\n if (tutu(a * 10 + 1, b))\n {\n c[indC++] = a;\n return true;\n }\n else if (tutu(a * 2, b))\n {\n c[indC++] = a;\n return true;\n }\n return false;\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var a = rl;\n var b = rl;\n c[indC++] = b;\n if (tutu(a, b))\n {\n wln(\"YES\");\n wln(indC);\n for (int i = indC - 1; i >= 0; i--)\n wsp(c[i]);\n }\n else\n {\n wln(\"NO\");\n return;\n }\n\n }\n //////////////////////////////////////////////////\n\n static void swap(ref T o1, ref T o2) { var o = o1; o1 = o2; o2 = o; }\n\n static void wln() { Console.WriteLine(); }\n static void wln(T o) { Console.WriteLine(o); }\n static void wsp(T o) { Console.Write(o + \" \"); }\n static void wrt(T o) { Console.Write(o); }\n\n static void wln(double o) { Console.WriteLine(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o)); }\n static void wsp(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12} \", o)); }\n static void wrt(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o)); }\n\n static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { _count = 0; _ind = 0; return _str.Substring(_ind); }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n int[] ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n long[] rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n double[] rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res;\n }\n string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main() { new Program().Solution(); }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n private static List brackets = new List();\n private static void GetAll(int n)\n {\n int[] m = new int[n + 1];\n while (m[n] == 0)\n {\n m[0]++;\n for (int i = 0; i < n & m[i] >= 3; i++)\n {\n m[i + 1]++;\n m[i] -= 3;\n }\n\n bool correct = true;\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n if (m[i] == 1) cnt++;\n if (m[i] == 2) cnt--;\n if (cnt < 0) correct = false;\n }\n\n correct &= (cnt == 0);\n\n if (correct)\n {\n char[] q = new char[n];\n for (int i = 0; i < n; i++)\n {\n if (m[i] == 0) q[i] = '0';\n if (m[i] == 1) q[i] = '(';\n if (m[i] == 2) q[i] = ')';\n }\n\n brackets.Add(new string(q));\n }\n }\n\n }\n\n private static void SolveArcherTravel1459()\n {\n // http://acm.timus.ru/problem.aspx?space=1&num=1459\n GetAll(5);\n Console.WriteLine(brackets.Count);\n Console.WriteLine(string.Join(Environment.NewLine, brackets));\n }\n\n static void Main(string[] args)\n {\n int a = RI();\n long b = RI();\n\n var ans = Go(a, b);\n if (ans == null)\n Console.Write(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(ans.Count);\n Console.Write(string.Join(\" \", ans));\n }\n }\n\n private static List Go(long a, long b)\n {\n if (a > b) return null;\n if (a == b) return new List() { a };\n\n var ans = Go(a + a, b);\n if (ans == null) ans = Go(10 * a + 1, b);\n if (ans != null) ans.Insert(0, a);\n\n return ans;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] read = Console.ReadLine().Split(new Char[] { ' ' });\n int a = Convert.ToInt32(read[0]);\n int b = Convert.ToInt32(read[1]);\n List arr = new List();\n arr.Add(b);\n int count = 0;\n //\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 b \u0447\u0438\u0441\u043b\u043e a\n while (true)\n {\n string temp = b.ToString().Substring(b.ToString().Length - 1);\n if (temp == \"1\" && b.ToString().Length > 1)\n {\n //\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1\n b = Convert.ToInt32(b.ToString().Substring(0, b.ToString().Length-1));\n //\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n } \n else if(b >= a)\n {\n b = b / 2;\n\n } \n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n arr.Add(b); count++;\n if (b == a) {\n arr.Reverse();\n string result = \"\";\n foreach(int c in arr)\n {\n result += c + \" \";\n }\n Console.WriteLine(\"YES\\n\" + count + \"\\n\" + result);\n break; \n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] read = Console.ReadLine().Split(new Char[] { ' ' });\n int a = Convert.ToInt32(read[0]);\n int b = Convert.ToInt32(read[1]);\n string result = b.ToString() + \" \";\n int count = 0;\n //\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 b \u0447\u0438\u0441\u043b\u043e a\n while (true)\n {\n string temp = b.ToString().Substring(b.ToString().Length - 1);\n if (temp == \"1\" && b.ToString().Length > 1)\n {\n //\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1\n b = Convert.ToInt32(b.ToString().Substring(0, b.ToString().Length-1));\n //\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n } \n else if(b >= a)\n {\n b = b / 2;\n\n } \n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n result += b + \" \"; count++;\n if (b == a) {\n Console.WriteLine(\"YES\\n\" + count + \"\\n\" + result);\n break; \n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] read = Console.ReadLine().Split(new Char[] { ' ' });\n int a = Convert.ToInt32(read[0]);\n int b = Convert.ToInt32(read[1]);\n List arr = new List();\n arr.Add(b);\n int count = 1;\n //\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 b \u0447\u0438\u0441\u043b\u043e a\n while (true)\n {\n string temp = b.ToString().Substring(b.ToString().Length - 1);\n if (temp == \"1\" && b.ToString().Length > 1)\n {\n //\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1\n b = Convert.ToInt32(b.ToString().Substring(0, b.ToString().Length-1));\n //\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n } \n else if(b >= a)\n {\n b = b / 2;\n\n } \n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n arr.Add(b); count++;\n if (b == a) {\n arr.Reverse();\n string result = \"\";\n foreach(int c in arr)\n {\n result += c + \" \";\n }\n Console.WriteLine(\"YES\\n\" + (count) + \"\\n\" + result);\n break; \n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727\u0410\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] read = Console.ReadLine().Split(new Char[] { ' ' });\n int a = Convert.ToInt32(read[0]);\n int b = Convert.ToInt32(read[1]);\n List arr = new List();\n arr.Add(b);\n int count = 0;\n //\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 b \u0447\u0438\u0441\u043b\u043e a\n while (true)\n {\n string temp = b.ToString().Substring(b.ToString().Length - 1);\n if (temp == \"1\" && b.ToString().Length > 1)\n {\n //\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1\n b = Convert.ToInt32(b.ToString().Substring(0, b.ToString().Length-1));\n //\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n } \n else if(b >= a)\n {\n b = b / 2;\n\n } \n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n arr.Add(b); count++;\n if (b == a) {\n arr.Reverse();\n string result = \"\";\n foreach(int c in arr)\n {\n result += c + \" \";\n }\n Console.WriteLine(\"YES\\n\" + (count-1) + \"\\n\" + result);\n break; \n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace cf727A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int a = ab[0]; int b = ab[1];\n\n List operations = new List();\n\n while(b > a)\n {\n operations.Add(b);\n if ((b % 2) == 0)\n b /= 2;\n else if (b.ToString().EndsWith(\"1\"))\n {\n b = (b - 1) / 10;\n }\n else\n {\n Console.WriteLine(\"NO\"); return;\n }\n }\n\n if (b == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(operations.Count + 1);\n Console.Write(a); Console.Write(' ');\n for (int i = 1; i <= operations.Count; i++)\n {\n Console.Write(operations[operations.Count-i]); Console.Write(' ');\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b;\n string Result = \"NO\";\n //int[] posled ;\n List posled = new List();\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 a\");\n //a =int.Parse(Console.ReadLine().ToString());\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 b\");\n //b = int.Parse(Console.ReadLine().ToString());\n string[] input = Console.ReadLine().Split(' ');\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n int tempVar = b;\n while (tempVar > a) \n {\n posled.Add(tempVar);\n if (tempVar % 2 > 0)\n {\n tempVar = (tempVar - 1) / 10;\n }\n else\n {\n tempVar = tempVar / 2;\n }\n\n if (tempVar < 1)\n {\n Result = \"NO\";\n break;\n }\n }\n if (tempVar == a)\n {\n Result = \"YES\";\n };\n posled.Add(a);\n \n\n Console.WriteLine(Result);\n if (Result == \"YES\")\n {\n Console.WriteLine(posled.Count());\n for (int i = posled.Count() - 1; i >= 0; i--)\n {\n Console.Write(posled[i] + \" \");\n }\n\n }\n //Console.ReadKey();\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a, b;\n string Result = \"NO\";\n //int[] posled ;\n List posled = new List();\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 a\");\n //a =int.Parse(Console.ReadLine().ToString());\n //Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 b\");\n //b = int.Parse(Console.ReadLine().ToString());\n string[] input = Console.ReadLine().Split(' ');\n a = long.Parse(input[0]);\n b = long.Parse(input[1]);\n long tempVar = b;\n while (tempVar > a) \n {\n posled.Add(tempVar);\n if (tempVar % 2 > 0)\n {\n tempVar = (tempVar - 1) / 10;\n }\n else\n {\n tempVar = tempVar / 2;\n }\n\n if (tempVar < 1)\n {\n Result = \"NO\";\n break;\n }\n }\n if (tempVar == a)\n {\n Result = \"YES\";\n };\n posled.Add(a);\n \n\n Console.WriteLine(Result);\n if (Result == \"YES\")\n {\n Console.WriteLine(posled.Count());\n for (int i = posled.Count() - 1; i >= 0; i--)\n {\n Console.Write(posled[i] + \" \");\n }\n\n }\n //Console.ReadKey();\n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace OlympPrepSharp\n{\n public class Node\n {\n public int Val;\n public Node Left, Right;\n\n public Node(int val)\n {\n Val = val;\n Left = null;\n Right = null;\n }\n\n public void BuildTree()\n {\n if(Val == 0) return;\n if (Val%2 == 0)\n {\n Left = new Node(Val/2);\n Left.BuildTree();\n }\n else Left = null;\n if ((Val - 1)%10 == 0)\n {\n Right = new Node((Val - 1)/10);\n Right.BuildTree();\n }\n else Right = null;\n }\n\n public List DFS(int lookFor, List prev)\n {\n List cur = new List(prev);\n cur.Add(Val);\n if (Val == lookFor) return cur;\n if (Left != null)\n {\n List left = Left.DFS(lookFor, cur);\n if (left[0] != -1) return left;\n }\n if (Right != null)\n {\n List right = Right.DFS(lookFor, cur);\n if (right[0] != -1) return right;\n }\n return new List {-1};\n\n } \n }\n\n class Program\n {\n\n static void Main(string[] args)\n {\n try\n {\n\n\n int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Node root = new Node(input[1]);\n root.BuildTree();\n List result = root.DFS(input[0], new List());\n if (result[0] == -1) Console.WriteLine(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(result.Count);\n for (int i = result.Count - 1; i >= 0; i--)\n {\n Console.Write(result[i] + \" \");\n }\n Console.WriteLine();\n }\n Console.ReadKey();\n }\n catch (Exception e)\n {\n Console.WriteLine(e.Message);\n }\n }\n\n static void PrintCol(IEnumerable col)\n {\n foreach (var i in col)\n {\n Console.Write(i + \" \");\n }\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeff#undef DEBUG\n\nusing System;\n\nnamespace _1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = Convert.ToInt32(str.Split(' ')[0]);\n int b = Convert.ToInt32(str.Split(' ')[1]);\n int tmp = b;\n int[] nums = { b };\n while (tmp!=a)\n {\n if (tmp < a)\n {\n Console.WriteLine(\"NO\");\n goto end;\n }\n Array.Resize(ref nums, nums.Length + 1);\n if (tmp % 2 == 0)\n {\n tmp = tmp / 2;\n }\n else\n {\n tmp = (tmp - 1) / 10;\n }\n nums[nums.Length - 1] = tmp;\n }\n Console.WriteLine(\"YES\");\n Console.WriteLine(nums.Length);\n string stmp = \"\";\n for (int i = nums.Length - 1; i >= 0; i--)\n {\n stmp += nums[i] + \" \";\n }\n stmp.TrimEnd();\n Console.WriteLine(stmp);\n end:;\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _727A\n{\n class Program\n {\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]), b = int.Parse(input[1]);\n var sequence = new List();\n sequence.Add(b);\n \n while (true)\n {\n var last = sequence[sequence.Count - 1];\n if (last == a)\n {\n Console.WriteLine(\"YES\");\n sequence.Reverse();\n Console.WriteLine(sequence.Count);\n Console.WriteLine(string.Join(\" \", sequence));\n break;\n }\n else if (last < a)\n {\n Console.WriteLine(\"NO\");\n break;\n }\n\n if (last % 2 == 0)\n {\n sequence.Add(last / 2);\n }\n else\n {\n sequence.Add((last - 1) / 10);\n }\n }\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n var result = new Stack();\n result.Push(b);\n bool found = false;\n\n while (b > a)\n {\n if (b % 2 == 0)\n b /= 2;\n else\n b /= 10;\n\n result.Push(b);\n\n if (b == a)\n found = true;\n }\n\n if (found)\n {\n Console.WriteLine(\"YES\");\n while (result.Count > 0)\n {\n if (result.Count > 1)\n Console.Write(\"{0} \", result.Pop());\n else\n Console.Write(result.Pop());\n }\n }\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n int a = int.Parse(input[0]);\n int b = int.Parse(input[1]);\n var result = new Stack();\n result.Push(b);\n bool found = false;\n\n while (b > a)\n {\n if (b % 2 == 0)\n b /= 2;\n else\n b /= 10;\n\n result.Push(b);\n\n if (b == a)\n found = true;\n }\n\n if (found)\n {\n Console.WriteLine(\"YES\");\n while (result.Count > 0)\n {\n Console.Write(\"{0} \", result.Pop());\n }\n }\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var list = new List();\n while (true) {\n list.Add(b);\n if (b == a)\n {\n sw.WriteLine(\"YES\");\n break;\n }\n if (b < a)\n {\n sw.WriteLine(\"NO\");\n return;\n }\n if (b%2 == 0) {\n b /= 2;\n }\n else {\n b /= 10;\n }\n }\n list.Reverse();\n var sb = new StringBuilder();\n foreach (var i in list) {\n sb.Append(i + \" \");\n }\n\n sw.Write(sb);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n var list = new List();\n while (true) {\n list.Add(b);\n if (b == a)\n {\n sw.WriteLine(\"YES\");\n break;\n }\n if (b < a)\n {\n sw.WriteLine(\"NO\");\n return;\n }\n if (b%2 == 0) {\n b /= 2;\n }\n else {\n b /= 10;\n }\n }\n list.Reverse();\n var sb = new StringBuilder();\n foreach (var i in list) {\n sb.Append(i + \" \");\n }\n\n sw.WriteLine(list.Count);\n sw.Write(sb);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace TaskA\n{\n class Program\n {\n private static readonly Stack Stack = new Stack();\n private static int a;\n private static int b;\n\n private static bool AtoB()\n {\n if (a > b) return false;\n Stack.Push(a);\n if (a == b) return true;\n var temp = a;\n a = a * 10 + 1;\n var result = AtoB();\n if (result) return true;\n a = temp * 2;\n result = AtoB();\n if (result) return true;\n a = temp;\n Stack.Pop();\n return false;\n }\n\n static void Main()\n {\n var ab = Console.ReadLine().Split(' ').ToArray();\n a = int.Parse(ab[0]);\n b = int.Parse(ab[1]);\n if (b % 2 == 1 && b % 10 == 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (AtoB())\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(Stack.Count);\n foreach (var temp in Stack.Reverse())\n Console.Write(\"{0} \", temp);\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace TaskA\n{\n class Program\n {\n private static readonly int[] stack = new int[50];\n private static int a;\n private static int b;\n\n private static int AtoB(int step)\n {\n if (a > b) return 0;\n stack[step] = a;\n if (a == b) return step;\n var temp = a;\n a = a * 10 + 1;\n var result = AtoB(step + 1);\n if (result > 0) return result;\n a = temp * 2;\n result = AtoB(step + 1);\n if (result > 0) return result;\n return 0;\n }\n\n static void Main()\n {\n var ab = Console.ReadLine().Split(' ').ToArray();\n a = int.Parse(ab[0]);\n b = int.Parse(ab[1]);\n var result = AtoB(0);\n if (result>0)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(result+1);\n for(var i=result;i>=0;i--)\n Console.Write(\"{0} \", stack[i]);\n }\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\t\t\tstring[] sLst = s.Split(' ');\n\t\t\tStack sNum = new Stack();\n\t\t\ttry\n\t\t\t{\n\t\t\t\tInt64 numA = Convert.ToInt64(sLst[0].Trim());\n\t\t\t\tInt64 numB = Convert.ToInt64(sLst[1].Trim());\n\t\t\t\t\n\t\t\t\tif ( numB <= numA)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsNum.Push(numB);\n\t\t\t\twhile (numA < numB)\n\t\t\t\t{\n\t\t\t\t\tif (numB % 10 == 1)\n\t\t\t\t\t\tnumB = (numB - 1) / 10;\n\t\t\t\t\telse if (numB % 2 == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tnumB = numB / 2;\n\t\t\t\t\t}\n\t\t\t\t\tsNum.Push(numB);\n\t\t\t\t}\n\t\t\t\tif ( numA > numB)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\twhile( sNum.Count > 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(sNum.Pop());\n\t\t\t\t\tif (sNum.Count > 0) Console.Write(\" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Exception ex)\n\t\t\t{\n\t\t\t\tConsole.Write(\"NO\");\n\t\t\t}\n\t\t\t//finally\n\t\t\t//{\n\t\t\t//\tConsole.ReadLine();\n\t\t\t//}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n string instring = Console.ReadLine(), outstring=\"\";\n int x1 = Convert.ToInt32(instring.Substring(0, instring.LastIndexOf(' '))); int a1 = x1,k=1, f = 1;\n int x2 = Convert.ToInt32(instring.Substring(instring.LastIndexOf(' '), instring.Length-instring.LastIndexOf(' '))); int b1 = x2;\n while (k != 0) \n {\n\n\n if ((b1 % 2 == 0) && (b1 != 0) && (b1 != a1))\n {\n k = 13;\n b1 = b1 / 2;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else if ((b1 % 10 == 1) && (b1 != 1) && (b1 != a1))\n {\n k = 1;\n b1 = b1 / 10;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else k = 0;\n f++;\n } \n outstring = outstring + Convert.ToString(x2);\n if (b1 == a1) Console.WriteLine(\"YES\\n{0}\\n{1}\", f,outstring);\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0438\n{\n class Program\n {\n static void a1()\n {\n string instring = Console.ReadLine(), outstring=\"\";\n int x1 = Convert.ToInt32(instring.Substring(0, instring.LastIndexOf(' '))); int a1 = x1,k=1, f = 1;\n int x2 = Convert.ToInt32(instring.Substring(instring.LastIndexOf(' '), instring.Length-instring.LastIndexOf(' '))); int b1 = x2;\n while (k != 0) \n {\n\n\n if ((b1 % 2 == 0) && (b1 != 0) && (b1 != a1))\n {\n k = 13;\n b1 = b1 / 2;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else if ((b1 % 10 == 1) && (b1 != 1) && (b1 != a1))\n {\n k = 1;\n b1 = b1 / 10;\n outstring = Convert.ToString(b1) + \" \" + outstring;\n }\n else k = 0;\n f++;\n } \n outstring = outstring + Convert.ToString(x2);\n if (b1 == a1) Console.WriteLine(\"YES\\n{0}\\n{1}\", f,outstring);\n else Console.WriteLine(\"NO\");\n }\n static void Main(string[] args)\n {\n a1();\n }\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Div._2_A.Transformation_from_A_to_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n List list = new List();\n\n while (b > a)\n {\n list.Add(b);\n\n if (b % 2 == 0)\n b /= 2;\n else if(b > 10 && b % 10 == 1)\n b /= 10;\n else\n break;\n }\n if (a == b)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list.Count);\n for (int i = list.Count-1; i >= 0; i--)\n {\n Console.Write(list[i] + \" \");\n }\n }\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Div._2_A.Transformation_from_A_to_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n List list = new List();\n bool right = false;\n while (b >= a)\n {\n list.Add(b);\n if (a == b)\n {\n right = true;\n break;\n }\n if (b % 2 == 0)\n {\n b /= 2;\n }\n else if(b > 10 && b % 10 == 1)\n {\n b /= 10;\n }\n else\n {\n right = false;\n break;\n }\n }\n if (right)\n {\n Console.WriteLine(\"YES\");\n for (int i = list.Count-1; i >= 0; i--)\n {\n Console.Write(list[i] + \" \");\n }\n }\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CCS\n{\n class Program\n {\n static List s = new List();\n\n static void Rec(int a, int b)\n {\n if (a == b)\n {\n s.Add(b);\n return;\n }\n else if (b > a)\n {\n if (b % 2 == 0)\n Rec(a, b / 2);\n else\n Rec(a, (b - 1) / 10);\n\n if (s.Count > 0)\n s.Add(b);\n }\n }\n\n static void Main()\n {\n string[] input = Console.ReadLine().Split(' ');\n Rec(int.Parse(input[0]), int.Parse(input[1]));\n if (s.Count > 0)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(s.Count.ToString());\n for (int i = 0; i < s.Count; i++)\n Console.Write(s[i] + \" \");\n return;\n }\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Competitions\n{\n class CF1A\n {\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = arr[0];\n int b = arr[1];\n\n var list = new List();\n list.Add(b);\n while (true)\n {\n if (b == a)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(list.Count);\n list.Reverse();\n Console.WriteLine(string.Join(\" \", list));\n return;\n }\n if (b < a) break;\n if ((b & 1) == 1)\n {\n b -= 1;\n b /= 10;\n list.Add(b);\n }\n else if (b%2 == 0)\n {\n b /= 2;\n list.Add(b);\n }\n else break;\n }\n\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace olmp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string check = Console.ReadLine();\n string nCheck = \"\";\n foreach (char c in check)\n {\n if (c != '1' & c != '2' & c != '3' & c != '4' & c != '5' & c != '6' & c != '7' & c != '8' & c != '9' & c != '0' & c != '.')\n {\n nCheck += '\\0';\n }\n else\n {\n nCheck += c;\n }\n }\n foreach (string t in nCheck.Replace('.', ',').Split(new char[] { '\\0' }, StringSplitOptions.RemoveEmptyEntries))\n {\n string[] tSplit = t.Split(new char[] { ',' });\n for (int i = 0; i < tSplit.Length; i++)\n {\n if (tSplit.Length == 1)\n {\n if (tSplit[i].Length > 3)\n {\n return;\n }\n }\n else if (tSplit[i] == \"\")\n {\n return;\n }\n else if (i != 0 & tSplit.Length > 1 & tSplit[i].Length != 3 & i != tSplit.Length - 1)\n {\n return;\n }\n else if (i == tSplit.Length - 1 && tSplit[i].Length < 2)\n {\n return;\n }\n }\n }\n string[] prices = nCheck.Replace('.', ',').Split(new char[] { '\\0' }, StringSplitOptions.RemoveEmptyEntries);\n for (int p = 0; p < prices.Length; p++)\n {\n string[] split = prices[p].Split(new char[] { ',' });\n string newPrice = \"\";\n if (split.Length > 1)\n {\n for (int s = 0; s < split.Length; s++)\n {\n if (split[s].Length > 2 | s < split.Length - 1)\n {\n newPrice += split[s];\n }\n else\n {\n newPrice += \",\" + split[s];\n }\n }\n prices[p] = newPrice;\n }\n }\n double price = 0;\n foreach (double p in Array.ConvertAll(prices, Convert.ToDouble))\n {\n price += p;\n }\n string sPrice = price.ToString().Split(new char[] { ',' }).First();\n string nPrice = \"\";\n for (int c = sPrice.Length - 1, s = 0; c >= 0; c--)\n {\n nPrice = sPrice[c] + nPrice;\n s++;\n if (s == 3 & c != 0)\n {\n nPrice = \".\" + nPrice;\n s = 0;\n }\n }\n if (price.ToString().Split(new char[] { ',' }).Length > 1)\n {\n if (price.ToString().Split(new char[] { ',' }).Last().Length == 1)\n {\n if (Convert.ToDouble(price.ToString().Split(new char[] { ',' }).Last()) > 0.1)\n {\n nPrice += \".\" + price.ToString().Split(new char[] { ',' }).Last() + \"0\";\n }\n else\n {\n nPrice += \".0\" + price.ToString().Split(new char[] { ',' }).Last();\n }\n }\n else\n {\n nPrice += \".\" + price.ToString().Split(new char[] { ',' }).Last();\n }\n }\n Console.WriteLine(nPrice);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n private static List brackets = new List();\n private static void GetAll(int n)\n {\n int[] m = new int[n + 1];\n while (m[n] == 0)\n {\n m[0]++;\n for (int i = 0; i < n & m[i] >= 3; i++)\n {\n m[i + 1]++;\n m[i] -= 3;\n }\n\n bool correct = true;\n int cnt = 0;\n for (int i = 0; i < n; i++)\n {\n if (m[i] == 1) cnt++;\n if (m[i] == 2) cnt--;\n if (cnt < 0) correct = false;\n }\n\n correct &= (cnt == 0);\n\n if (correct)\n {\n char[] q = new char[n];\n for (int i = 0; i < n; i++)\n {\n if (m[i] == 0) q[i] = '0';\n if (m[i] == 1) q[i] = '(';\n if (m[i] == 2) q[i] = ')';\n }\n\n brackets.Add(new string(q));\n }\n }\n\n }\n\n private static void SolveArcherTravel1459()\n {\n // http://acm.timus.ru/problem.aspx?space=1&num=1459\n GetAll(5);\n Console.WriteLine(brackets.Count);\n Console.WriteLine(string.Join(Environment.NewLine, brackets));\n }\n\n static void Main(string[] args)\n {\n int a = RI();\n long b = RI();\n\n var ans = Go(a, b);\n if (ans == null)\n Console.Write(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.Write(string.Join(\" \", ans));\n }\n }\n\n private static List Go(long a, long b)\n {\n if (a > b) return null;\n if (a == b) return new List() { a };\n\n var ans = Go(a + a, b);\n if (ans == null) ans = Go(10 * a + 1, b);\n if (ans != null) ans.Insert(0, a);\n\n return ans;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace capp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int i = 0;\n while (n > 0)\n {\n n -= a[i];\n i++;\n if (i == 7)\n i = 0;\n }\n Console.WriteLine(i == 0 ? 7 : i);\n\n \n \n }\n }\n\n\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace taskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] days = new int[7];\n string[] s = Console.ReadLine().Split(' ');\n for (int i = 0; i < 7; i++)\n {\n days[i] = int.Parse(s[i]);\n }\n try\n {\n while (n > 0)\n {\n for (int i = 0; i < 7; i++)\n {\n n -= days[i];\n if (n <= 0) throw new Exception((i+1).ToString());\n }\n }\n }\n catch(Exception e)\n {\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _139A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine()) - 1;\n int[] w = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();\n\n n %= w.Sum();\n\n for (int i = 0; i < 7; i++)\n {\n if (n < w[i])\n {\n Console.WriteLine(i + 1);\n return;\n }\n\n n -= w[i];\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(@\"..\\..\\..\\..\\Tests\\A2.in\"));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static void Solve()\n {\n var n = ReadInt();\n var days = ReadIntArray();\n var day = 0;\n while (n > 0)\n {\n day %= 7;\n n -= days[day++];\n }\n Console.WriteLine(day);\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int hojas;\n int[] diasSemana = new int[7];\n hojas = int.Parse(Console.ReadLine());\n string s1 = Console.ReadLine();\n int[] a = new int[7];\n string[] s = s1.Split(' ');\n for(int i =0; i<7; i++)\n diasSemana[i] = int.Parse(s[i]);\n int dia=0;\n while(hojas>0)\n {\n hojas-=diasSemana[dia];\n if(hojas<=0)\n {\n Console.WriteLine(dia+1);\n break;\n }\n if(dia==6 )\n {\n dia=0;\n continue;\n }\n dia++;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int pagesTotal = int.Parse(Console.ReadLine());\n int[] pagesPerDay = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n\n int currentDay = 0;\n while (pagesTotal > 0)\n {\n currentDay++;\n if (currentDay == 8)\n currentDay = 1;\n\n pagesTotal -= pagesPerDay[currentDay - 1];\n }\n\n Console.WriteLine(currentDay);\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n public static void Main(string[] args)\n {\n int[] data;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { '\\t', ' ', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n data = new int[input.Length + 1];\n data[0] = int.Parse(input[0]);\n for (int i = 1; i < input.Length; ++i)\n data[data.Length - 1] += data[i] = int.Parse(input[i]);\n }\n data[data.Length - 1] = data[0] % data[data.Length - 1];\n if (data[data.Length - 1] == 0)\n {\n int i = data.Length - 2;\n while (i > 1 && data[i] == 0) --i;\n Console.WriteLine(i);\n }\n else\n {\n for (int i = 1, lim = data.Length - 1; i < lim; ++i)\n {\n if (data[lim] <= data[i]) { Console.WriteLine(i); break; }\n else data[lim] -= data[i];\n }\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input);\n\n var daysReading = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n var pagesPerWeek = daysReading.Sum();\n int rem = n % pagesPerWeek;\n if (rem == 0)\n rem = pagesPerWeek;\n for(int i = 1;i<=7;i++)\n {\n rem -= daysReading[i - 1];\n if(rem<=0)\n {\n Console.WriteLine(i);\n // Console.ReadKey();\n return;\n }\n\n }\n\n\n // Console.WriteLine(count);\n // Console.ReadKey();\n }\n\n // Console.ReadKey();\n\n\n\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nclass MyBuild\n{\n static void Main()\n { \n int pagesread = 0, i = 0;\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n\n string[] strppd = input.Split(' ');\n int[] pageperday = Array.ConvertAll(strppd, int.Parse);\n\n while (pagesread < n)\n {\n if (i == 7)\n {\n i = 0;\n }\n pagesread += pageperday[i];\n i++;\n \n }\n Console.WriteLine(i); \n }\n}\n"}, {"source_code": "using System;\n\n class Program {\n static void Main(string[] args) {\n \n int pages = Int32.Parse(Console.ReadLine());\n string[] dayValues = Console.ReadLine().Split(' ');\n int currentPages = 0;\n int currentDay = 0;\n\n while (true) {\n\n if (currentDay == 7) {\n currentDay = 0;\n }\n\n currentPages += Int32.Parse(dayValues[currentDay]);\n\n if (currentPages >= pages) {\n Console.WriteLine(currentDay + 1);\n break;\n } else {\n currentDay++;\n }\n } \n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n var pages = int.Parse(Console.ReadLine());\n var init = Console.ReadLine().Split(' ');\n Dictionary week = new Dictionary();\n int day = 1;\n\n for (int i = 0; i < init.Length; i++)\n {\n week.Add(day, int.Parse(init[i]));\n day++;\n }\n\n while (pages > 0)\n {\n if (day == 8)\n day = 1;\n pages -= week[day];\n day++;\n }\n\n Console.WriteLine(day - 1);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine()), i = 6;\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n do\n {\n i += (i == 6 ? -6 : 1);\n n -= a[i];\n } while (n > 0);\n Console.WriteLine(i + 1);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication97\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n string[] z = new string[7];\n z= s.Split(' ');\n byte d=0;\n do\n {\n if (d == 7) { d = 1; }\n else { d++; }\n n -= int.Parse(z[d - 1]);\n }\n while (n > 0);\n Console.WriteLine(d);\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P { \n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n n = (n-1) % d.Sum()+1;\n for (var i = 0 ; ; i++)\n if (n <= d[i]) { Console.WriteLine(i + 1); return; }\n else n -= d[i];\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Petr_and_Book\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[7];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next();\n }\n\n int sum = nn.Sum();\n while (n > sum)\n {\n n -= sum;\n }\n\n for (int i = 0; i < nn.Length; i++)\n {\n n -= nn[i];\n if (n <= 0)\n {\n writer.WriteLine(i + 1);\n break;\n }\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace vvv\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n var t = Console.ReadLine().Split(' ');\n\n int[] a = new int[7];\n\n for (int i = 0; i < 7; i++)\n {\n a[i] = int.Parse(t[i]);\n }\n\n while (true)\n {\n for (int i = 0; i < 7; i++)\n {\n n -= a[i];\n\n if (n <= 0)\n {\n Console.WriteLine(i + 1);\n Environment.Exit(0);\n }\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] w = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int s = w.Sum();\n n %= s;\n if (n == 0) {\n for (int i = 6; i >= 0; i--) {\n if (w[i] != 0) {\n Console.Write(i + 1);\n break;\n }\n }\n } else {\n for (int i = 0; i <= 6; i++) {\n if (n <= w[i]) {\n Console.Write(i + 1);\n break;\n } else {\n n -= w[i];\n }\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task39A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var count = Convert.ToInt32(Console.ReadLine());\n string[] arr = Console.ReadLine().Split(' ');\n int[] days = new int[arr.Length];\n for (int i = 0; i < arr.Length; i++)\n {\n days[i] = Convert.ToInt32(arr[i]);\n }\n int index = 0;\n var result = -1;\n while (count > 0)\n {\n count -= days[index % days.Length];\n result = index % days.Length;\n index++;\n }\n Console.WriteLine(result + 1);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int iCountPage = Convert.ToInt32(Console.ReadLine());\n int[] data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n int i = -1;\n while (iCountPage > 0)\n {\n i++;\n if (i == data.Length)\n i = 0;\n iCountPage -= data[i];\n \n }\n\n Console.WriteLine(i+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace S.A.M\n{\n class Program\n {\n static void Main(string[] args)\n {\n int pag;\n int[] diasSemana = new int[7];\n pag = int.Parse(Console.ReadLine());\n string s1 = Console.ReadLine();\n int[] a = new int[7];\n string[] s = s1.Split(' ');\n for (int i = 0; i < 7; i++)\n {\n diasSemana[i] = int.Parse(s[i]);\n }\n int dia = 0;\n while (pag > 0)\n {\n pag -= diasSemana[dia];\n if (pag <= 0)\n {\n Console.WriteLine(dia + 1); break;\n }\n if (dia == 6)\n {\n dia = 0;\n continue;\n }\n dia++;\n }\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class App1\n{\n public static void Main()\n {\n Func read = ()=>Console.ReadLine();\n Action write = _=>Console.WriteLine(_.ToString());\n \n var n=read().ToInt();\n var a=read().ToIntA();\n while(true)\n for(var i=0;i0) \n {\n s=s%7;\n n-=m[s];\n s++;\n }\n Console.WriteLine(s);\n }\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n //int k = int.Parse(Console.ReadLine());\n //string[] tmp = Console.ReadLine().Split(' ');\n int k = int.Parse(Console.ReadLine());\n string[] tmp = Console.ReadLine().Split(' ');\n int[] str = new int[7];\n for (int i = 0; i < 7; i++)\n str[i] = int.Parse(tmp[i]);\n int sum = 0 , j = 0;\n while (sum < k)\n {\n if (j == 7)\n j = 0;\n sum += str[j];\n j++;\n \n }\n Console.WriteLine(j);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace aaaa\n{\n class Program\n {\n static void Main(string[] args)\n {\n long k = long.Parse(Console.ReadLine());\n\n string[] s = Console.ReadLine().Split(' ');\n\n int[] a = new int[s.Length];\n\n for (int i = 0; i < s.Length; i++)\n {\n a[i] = int.Parse(s[i]);\n }\n\n int j = 0;\n while (k > 0)\n {\n j++;\n if (j > a.Length)\n {\n j = 1;\n }\n k = k - a[j-1];\n \n }\n\n Console.WriteLine(j);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int[] s = new int[7];\n for(int i = 0; i < 7; i++) {\n s[i] = Next();\n }\n int d = 0;\n while(n - s[d] > 0) {\n n -= s[d];\n d++;\n d %= 7;\n }\n writer.Write(d + 1);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = Int32.Parse(Console.ReadLine());\n int[] Days = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();\n int Sum = 0;\n int i;\n\n while (true)\n {\n for (i = 1; i <= 7; i++)\n {\n Sum += Days[i-1];\n if (Sum >= N)\n break;\n }\n if (Sum >= N)\n break;\n }\n\n Console.WriteLine(i);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int[] parameters;\n int pages, incr;\n\n pages = Convert.ToInt32(Console.ReadLine());\n parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n\n for (incr = 0; incr < 7; ++incr)\n {\n pages -= parameters[incr];\n if (pages <= 0)\n break;\n\n if (incr == 6)\n incr = -1;\n }\n\n Console.WriteLine(++incr);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Codeforces\n{\n #region Main\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var n = ReadInt();\n var p = ReadIntArray();\n var i = 0;\n for (i = 0; ; i++)\n {\n n -= p[i % 7];\n if (n <= 0)\n {\n break;\n }\n }\n writer.WriteLine(i % 7 + 1);\n reader.Close();\n writer.Close();\n }\n #endregion\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _139A_PetrAndBook.Run();\n\n }\n }\n class _139A_PetrAndBook\n {\n public static void Run()\n {\n var n = short.Parse(Console.ReadLine().Trim());\n var l = Console.ReadLine().Trim().Split(' ');\n\n var arr = new short[7];\n for (var i = 0; i < 7; i++)\n arr[i] = short.Parse(l[i]);\n\n while (n > 0)\n {\n for (var i = 0; i < 7; i++)\n {\n n -= arr[i];\n if (n > 0) continue;\n Console.WriteLine((i+1));\n Console.ReadLine();\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Petr_and_Book___Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string line = Console.ReadLine();\n\n int[] arr = line.Split(' ').Select(x => int.Parse(x)).ToArray();\n int readpages = 0;\n int i = 1;\n\n while (readpages!= n)\n {\n \n readpages = readpages + arr[i - 1];\n if (readpages >= n)\n {\n break;\n }\n \n i++;\n\n if (i > 7)\n {\n i = 1;\n }\n\n }\n\n Console.WriteLine(i);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List getLongList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long getLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic bool was;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getInt();\n\t\t\tvar l = getList();\n\t\t\tvar ct = 0;\n\t\t\tvar cur = 0;\n\t\t\twhile (ct + l[cur] < n)\n\t\t\t{\n\t\t\t\tct += l[cur];\n\t\t\t\tcur = (cur + 1) % 7;\n\t\t\t}\n\t\t\tConsole.WriteLine(cur + 1);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[7];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int nn = 0;\n while (n > 0)\n {\n if (nn == 7)\n nn = 0;\n n -= a[nn];\n nn++;\n \n }\n Console.Write(nn);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] str = Console.ReadLine().Split(' ');\n int[] days = new int[str.Length];\n for (int i = 0; i < str.Length; i++)\n days[i] = int.Parse(str[i]);\n int op = 0;\n int len = 0;\n while (len < n)\n {\n op = op % 7;\n len += days[op];\n op++;\n }\n op--;\n Console.WriteLine((op + 1).ToString());\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _139_A_Petr_and_Book\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int[] a = Array.ConvertAll(s, int.Parse);\n int sum = 0;\n int index = 0;\n while (sum sum)\n {\n for (int i = 0; i < 1000000000; i++)\n {\n n = n - sum;\n if (n <= sum)\n break;\n }\n }\n for (int i = 0; i < pages.Length; i++)\n {\n n = n - pages[i];\n if (n <= 0)\n {\n index = index + i;\n break;\n }\n }\n Console.WriteLine(index);\n }\n\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int i = 0;\n int[] dni = new int[7];\n\n for (i = 0; i < 7; i++)\n {\n dni[i] = Convert.ToInt32(s[i]);\n }\n\n while (n > 0)\n {\n if (i == 7)\n i = 0;\n\n n = n - dni[i];\n i++;\n }\n Console.WriteLine(i);\n\n }\n }\n}"}, {"source_code": "using System;\nclass Codeforce\n{ \n static void Main()\n { \n int n = int.Parse(Console.ReadLine());\n string []s= Console.ReadLine().Split();\n int i;\n int []a = new int [7];\n for(i=0;i<7;i++)\n {\n a[i]=int.Parse(s[i]);\n\n \n \n }\n i=0;\n while(1>0)\n {\n n-=a[i];\n if(n<=0)\n { break; }\n \n i++;\n if(i==7)\n i=0;\n } \n \n \n \n Console.WriteLine(i+1);\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int n = int.Parse (Console.ReadLine ());\n int s = 0, j;\n int[] a = new int[7];\n string str = Console.ReadLine ();\n string[] numbers = str.Split (' ');\n for (int i = 0; i != 7; i++) {\n a [i] = int.Parse (numbers [i]);\n s += a [i];\n }\n n %= s;\n if (n == 0)\n n += s;\n for (j = 0; j != 7 && n > 0; j++) {\n n -= a [j];\n }\n Console.Write (j);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int N = IO.GetInt();\n int[] ar = IO.GetInts().ToArray();\n\n int sum = ar.Sum();\n N %= sum;\n if (N == 0)\n N = sum;\n\n for (int i = 0; i < 7; i++)\n {\n N -= ar[i];\n if (N < 1)\n {\n IO.Wl(i + 1);\n return;\n }\n }\n }\n }\n\n public class IO\n {\n public static int GetInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static IEnumerable GetInts()\n {\n foreach (string s in Console.ReadLine().Split())\n {\n yield return int.Parse(s);\n }\n }\n\n public static void Wl(object o)\n {\n Console.WriteLine(o.ToString());\n }\n }\n\n public struct Tuple\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int[] a = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n }\n int sum = 0; int index=0;\n while (sum < n)\n {\n for (int i = 0; i < a.Length; i++)\n {\n sum += a[i]; index = i;\n if (sum >= n) break;\n }\n }\n Console.WriteLine(index + 1);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int iCountPage = Convert.ToInt32(Console.ReadLine());\n int[] data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n int i = -1;\n while (iCountPage > 0)\n {\n i++;\n if (i == data.Length)\n i = 0;\n iCountPage -= data[i];\n \n }\n\n Console.WriteLine(i+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace temp\n{\n class MainClass\n {\n private static Int32[] read_ints(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int32[] ret = new Int32[n];\n for (Int32 i = 0; i < n; i++)\n ret[i] = Convert.ToInt32(str[i]);\n return ret;\n }\n\n private static Int32 read_int() {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n private static Int64[] read_longs(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int64[] ret = new Int64[n];\n for (Int64 i = 0; i < n; i++)\n ret[i] = Convert.ToInt64(str[i]);\n return ret;\n }\n\n private static Int64 read_long() {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n private static string read_line() {\n return Console.ReadLine();\n }\n\n private static double line_dist_2d (int x1, int y1, int x2, int y2) {\n return Math.Sqrt(Math.Pow(x1-x2, 2) + Math.Pow(y1-y2, 2));\n }\n\n public static void Main (string[] args)\n {\n int n = read_int();\n int[] arr = read_ints(7);\n int day = 1, cnt = 0;\n while (true) {\n cnt += arr[day-1];\n if (cnt >= n)\n break;\n day++;\n if (day == 8)\n day = 1;\n }\n Console.WriteLine(day);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n int pages = int.Parse ( Console.ReadLine ( ) );\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int [] d = new int[7];\n for ( int i=0; i < 7; i++ )\n {\n d[i] = int.Parse ( aline[i] );\n }\n int pp = 0;\n int k = 0;\n while ( true )\n {\n pp += d[k];\n if ( pp >= pages )\n break;\n k++;\n if ( k == 7 )\n k = 0;\n }\n Console.WriteLine ( k + 1 );\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NEwTechTEst\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var sum = d.Sum();\n var l = n % sum > 0 ? n % sum : sum;\n int res = 0;\n foreach (var x in d)\n {\n l -= x; res++;\n if (l > 0) continue;\n Console.WriteLine(res);\n break;\n }\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace PetrAndBook\n{\n class Program\n {\n static void Main(string[] args)\n {\n int totalPages = int.Parse(Console.ReadLine());\n int[] pages = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n int currentPage = -1;\n while (totalPages > 0)\n {\n currentPage = (currentPage + 1) % 7;\n totalPages -= pages[currentPage];\n }\n Console.WriteLine(++currentPage);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int[] a = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n a[i] = Convert.ToInt32(s[i]);\n }\n int sum = 0; int index=0;\n while (sum < n)\n {\n for (int i = 0; i < a.Length; i++)\n {\n sum += a[i]; index = i;\n if (sum >= n) break;\n }\n }\n Console.WriteLine(index + 1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace BerFS\n{\n class Program\n {\n static void Main(string[] args)\n {\n int pages = Int32.Parse(Console.ReadLine());\n int[] days = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();\n int sum = 0;\n int day = 0;\n while (sum < pages)\n {\n if (day >= 7)\n day = 0;\n sum += days[day];\n day++;\n }\n Console.WriteLine(day.ToString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cbr_99_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] token = Console.ReadLine().Split();\n int[] week = new int[7];\n for (int i = 0; i < 7; i++)\n {\n week[i]=int.Parse(token[i]);\n }\n int number = 0;\n while (true)\n {\n n -= week[number];\n if (n < 1) break;\n number = (number + 1) % 7;\n }\n Console.WriteLine(number + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse); ;\n \n while(n>0)\n {\n for(int j=0;j<7;j++)\n {\n n -= arr[j];\n if(n<=0)\n {\n Console.WriteLine(j + 1);\n break;\n }\n \n }\n\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), item => Convert.ToInt32(item));\n int total = 0, loopcount = 0, weekday = 0;\n for (int i = 0; i < arr.Length; i++)\n total += arr[i];\n if (n > total) loopcount = Math.Abs(n / total);\n total = 0;\n bool found = false;\n for(int i=0;i= n)\n {\n weekday = j + 1;\n found = true;\n break;\n }\n }\n if (found) break;\n }\n Console.Write(weekday);\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n internal class StringWork\n {\n //\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u043c\u0438 \u043d\u0443\u043b\u044f\u043c\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b\n internal static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 N-\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0442\u0441\u043b\u0435\u043d\u0438\u044f\n internal static string ToCodeN(Int64 Decimal,int n)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % n;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / n;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n //\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443\n static string toDec(string str, int n)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(n, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n }\n\n internal class SortingArray\n {\n internal static void shellSort(ref int[] vector)\n {\n int step = vector.Length / 2;\n while (step > 0)\n {\n int i, j;\n for (i = step; i < vector.Length; i++)\n {\n int value = vector[i];\n for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)\n vector[j + step] = vector[j];\n vector[j + step] = value;\n }\n step /= 2;\n }\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n //string s = Console.ReadLine();\n string[] s = Console.ReadLine().Split(' ');\n\n //int[] m = new int[10];\n\n int k = 0;\n int i = 0;\n\n while (0 < n)\n { \n if (i > 6)\n i = 0;\n\n n -= int.Parse(s[i]);\n i++;\n }\n\n\n Console.WriteLine(\"{0}\", i);\n\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n t %= a.Sum();\n if (t == 0)\n {\n Console.WriteLine(1 + Array.LastIndexOf(a, a.Last(x => x != 0)));\n return;\n }\n for (int i = 0; i < 7; i++)\n {\n t -= a[i];\n if (t <= 0)\n {\n Console.WriteLine(i + 1);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n int n = int.Parse(Console.ReadLine());\n string [] str = Console.ReadLine().Split();\n int i = 0;\n int sum = 0;\n while(sum int.Parse(tz));\n int s = w.Sum();\n n %= s;\n if (n == 0) {\n Console.Write(7);\n } else {\n for (int i = 0; i < 6; i++) {\n if (n <= w[i]) {\n Console.Write(i + 1);\n break;\n } else {\n n -= w[i];\n }\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] w = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int s = w.Sum();\n n %= s;\n if (n == 0) {\n for (int i = 6; i >= 0; i--) {\n if (w[i] != 0) {\n Console.Write(i + 1);\n break;\n }\n }\n } else {\n for (int i = 0; i < 6; i++) {\n if (n <= w[i]) {\n Console.Write(i + 1);\n break;\n } else {\n n -= w[i];\n }\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int[] s = new int[7];\n for(int i = 0; i < 7; i++) {\n if(i > 0)\n s[i] = s[i - 1];\n s[i] += Next();\n }\n n %= s[6];\n int ans = 0;\n while(ans <7 && n>s[ans]) {\n ans++;\n }\n writer.Write(ans + 1);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int[] s = new int[7];\n for(int i = 0; i < 7; i++) {\n if(i > 0)\n s[i] = s[i - 1];\n s[i] += Next();\n }\n n %= s[6];\n int ans = n == 0 ? 6 : 0;\n while(n > s[ans]) {\n ans++;\n }\n writer.Write(ans + 1);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int[] s = new int[7];\n for(int i = 0; i < 7; i++) {\n if(i > 0)\n s[i] = s[i - 1];\n s[i] += Next();\n }\n n %= s[6];\n int ans = 0;\n while(ans <7 && n>s[ans]) {\n ans++;\n }\n writer.Write(ans + 1);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NEwTechTEst\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var l = n % d.Sum();\n if (l != 0)\n {\n int res = 0;\n foreach (var x in d)\n {\n l -= x; res++;\n if (l > 0) continue;\n Console.WriteLine(res);\n break;\n }\n }\n else Console.WriteLine(7);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace NEwTechTEst\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var l = n % d.Sum();\n int res = 0;\n foreach (var x in d)\n {\n l -= x; res++;\n if (l > 0) continue;\n Console.WriteLine(res);\n break;\n }\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n if (t > a.Sum()) t -= a.Sum();\n for (int i = 0; i < 7; i++)\n {\n t -= a[i];\n if (t <= 0)\n {\n Console.WriteLine(i + 1); ;\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n t %= a.Sum();\n if (t == 0)\n {\n Console.WriteLine(7);\n return;\n }\n for (int i = 0; i < 7; i++)\n {\n t -= a[i];\n if (t <= 0)\n {\n Console.WriteLine(i + 1);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n if (t > a.Sum()) t %= a.Sum();\n for (int i = 0; i < 7; i++)\n {\n t -= a[i];\n if (t <= 0)\n {\n Console.WriteLine(i + 1);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n t %= a.Sum();\n for (int i = 0; i < 7; i++)\n {\n t -= a[i];\n if (t <= 0)\n {\n Console.WriteLine(i + 1); ;\n return;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static void Main(){\n int n = int.Parse(Console.ReadLine());\n string [] str = Console.ReadLine().Split();\n int i = 1;\n int sum = 0;\n while(sum int.Parse(token)).ToArray();\n\n n %= w.Sum();\n\n for (int i = 0; i < 6; i++)\n {\n if (n < w[i])\n {\n Console.WriteLine(i + 1);\n return;\n }\n\n n -= w[i];\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(@\"..\\..\\..\\..\\Tests\\A2.in\"));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static void Solve()\n {\n var n = ReadInt();\n var days = ReadIntArray();\n var sum = days.Sum();\n n %= sum;\n if (n == 0)\n {\n Console.WriteLine(1);\n }\n else\n {\n for (int i = 0; i < days.Length; i++)\n {\n n -= days[i];\n if (n <= 0)\n {\n Console.WriteLine(i+1);\n return;\n }\n }\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n internal class StringWork\n {\n //\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u043c\u0438 \u043d\u0443\u043b\u044f\u043c\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b\n internal static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 N-\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0442\u0441\u043b\u0435\u043d\u0438\u044f\n internal static string ToCodeN(Int64 Decimal,int n)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % n;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / n;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n //\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443\n static string toDec(string str, int n)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(n, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n }\n\n internal class SortingArray\n {\n internal static void shellSort(ref int[] vector)\n {\n int step = vector.Length / 2;\n while (step > 0)\n {\n int i, j;\n for (i = step; i < vector.Length; i++)\n {\n int value = vector[i];\n for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)\n vector[j + step] = vector[j];\n vector[j + step] = value;\n }\n step /= 2;\n }\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n //string s = Console.ReadLine();\n string[] s = Console.ReadLine().Split(' ');\n\n //int[] m = new int[10];\n\n int k = 0;\n int i = 0;\n while (0 <= n)\n {\n if (i >= 6)\n i = 0;\n n -= int.Parse(s[i]);\n i++;\n }\n\n\n Console.WriteLine(\"{0}\", i);\n\n }\n\n \n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n internal class StringWork\n {\n //\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u043c\u0438 \u043d\u0443\u043b\u044f\u043c\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b\n internal static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 N-\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0442\u0441\u043b\u0435\u043d\u0438\u044f\n internal static string ToCodeN(Int64 Decimal,int n)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % n;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / n;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n //\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443\n static string toDec(string str, int n)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(n, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n }\n\n internal class SortingArray\n {\n internal static void shellSort(ref int[] vector)\n {\n int step = vector.Length / 2;\n while (step > 0)\n {\n int i, j;\n for (i = step; i < vector.Length; i++)\n {\n int value = vector[i];\n for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)\n vector[j + step] = vector[j];\n vector[j + step] = value;\n }\n step /= 2;\n }\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n //string s = Console.ReadLine();\n string[] s = Console.ReadLine().Split(' ');\n\n //int[] m = new int[10];\n\n int k = 0;\n int i = 0;\n while (0 <= n)\n {\n if (i > 6)\n i = 0; \n n -= int.Parse(s[i]);\n i++;\n }\n\n\n Console.WriteLine(\"{0}\", i);\n\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n internal class StringWork\n {\n //\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u043c\u0438 \u043d\u0443\u043b\u044f\u043c\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b\n internal static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 N-\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0442\u0441\u043b\u0435\u043d\u0438\u044f\n internal static string ToCodeN(Int64 Decimal,int n)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % n;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / n;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n //\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443\n static string toDec(string str, int n)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(n, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n }\n\n internal class SortingArray\n {\n internal static void shellSort(ref int[] vector)\n {\n int step = vector.Length / 2;\n while (step > 0)\n {\n int i, j;\n for (i = step; i < vector.Length; i++)\n {\n int value = vector[i];\n for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)\n vector[j + step] = vector[j];\n vector[j + step] = value;\n }\n step /= 2;\n }\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n //string s = Console.ReadLine();\n string[] s = Console.ReadLine().Split(' ');\n\n //int[] m = new int[10];\n\n int k = 0;\n int i = 0;\n while (0 <= n)\n {\n if (i >= 6)\n i = 0; \n n -= int.Parse(s[i]);\n i++;\n }\n\n\n Console.WriteLine(\"{0}\", i);\n\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n internal class StringWork\n {\n //\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u043c\u0438 \u043d\u0443\u043b\u044f\u043c\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0438\u0437 \u0447\u0438\u0441\u0435\u043b\n internal static void dop(ref string a, ref string b)\n {\n if (a.Length > b.Length)\n {\n int l = a.Length - b.Length;\n for (int i = 0; i < l; i++)\n {\n b = '0' + b;\n }\n return;\n }\n else\n {\n int l = b.Length - a.Length;\n for (int i = 0; i < l; i++)\n {\n a = '0' + a;\n }\n return;\n }\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 N-\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0442\u0441\u043b\u0435\u043d\u0438\u044f\n internal static string ToCodeN(Int64 Decimal,int n)\n {\n Int64 BinaryHolder;\n char[] BinaryArray;\n string BinaryResult = \"\";\n\n while (Decimal > 0)\n {\n BinaryHolder = Decimal % n;\n BinaryResult += BinaryHolder;\n Decimal = Decimal / n;\n }\n\n BinaryArray = BinaryResult.ToCharArray();\n Array.Reverse(BinaryArray);\n BinaryResult = new string(BinaryArray);\n return BinaryResult;\n }\n\n //\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b\n static string add(string a, string b)\n {\n string str = \"\";\n for (int i = a.Length - 1; i >= 0; i--)\n {\n int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;\n str = (k).ToString() + str;\n }\n return str;\n }\n\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443\n static string toDec(string str, int n)\n {\n Int64 count = 0, result = 0;\n for (int i = str.Length - 1; i >= 0; --i)\n {\n int j = int.Parse(str[i].ToString());\n if (count != 0 || j != 0)\n {\n result += (int)Math.Abs(j * Math.Pow(n, count));\n }\n count++;\n }\n\n return (result).ToString();\n }\n }\n\n internal class SortingArray\n {\n internal static void shellSort(ref int[] vector)\n {\n int step = vector.Length / 2;\n while (step > 0)\n {\n int i, j;\n for (i = step; i < vector.Length; i++)\n {\n int value = vector[i];\n for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)\n vector[j + step] = vector[j];\n vector[j + step] = value;\n }\n step /= 2;\n }\n }\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n //string s = Console.ReadLine();\n string[] s = Console.ReadLine().Split(' ');\n\n //int[] m = new int[10];\n\n int k = 0;\n int i = 0;\n while (0 <= n)\n {\n n -= int.Parse(s[i]);\n if (i >= 7)\n i = 0;\n k++;\n }\n\n\n Console.WriteLine(\"{0}\", k-1);\n\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[7];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int nn = 0;\n while (n >= 0)\n {\n n -= a[nn];\n nn++;\n if (nn == 7)\n nn = 0;\n }\n Console.Write(nn);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[7];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int nn = 0;\n while (n > 0)\n {\n n -= a[nn];\n nn++;\n if (nn == 7)\n nn = 0;\n }\n Console.Write(nn);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[7];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int nn = 0;\n while (n > 0)\n {\n if(n<=0)\n break;\n n -= a[nn];\n nn++;\n if (nn == 7)\n nn = 0;\n if(n<=0)\n break;\n }\n Console.Write(nn);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n int pages = int.Parse ( Console.ReadLine ( ) );\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int [] d = new int[7];\n for ( int i=0; i < 7; i++ )\n {\n d[i] = int.Parse ( aline[i] );\n }\n int pp = 0;\n int k = 0;\n while ( pp < pages )\n {\n pp += d[k];\n k++;\n if ( k == 7 )\n k = 0;\n }\n Console.WriteLine ( k );\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n int pages = int.Parse ( Console.ReadLine ( ) );\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int [] d = new int[7];\n for ( int i=0; i < 7; i++ )\n {\n d[i] = int.Parse ( aline[i] );\n }\n int pp = 0;\n int k = 0;\n while ( true )\n {\n pp += d[k];\n if ( pp >= pages )\n break;\n k++;\n if ( k == 7 )\n k = 0;\n }\n Console.WriteLine ( k );\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n //Console.SetIn(new StreamReader(\"gcd.in\"));\n // Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n //Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int[] pages = GetInts();\n int sum = pages.Sum();\n int index = 1;\n if (n > sum)\n {\n for (int i = 0; i < n; i++)\n {\n n = n - sum;\n if (n <= sum)\n break;\n }\n }\n for (int i = 0; i < pages.Length; i++)\n {\n n = n - pages[i];\n if (n <= 0)\n {\n index = index + i;\n break;\n }\n }\n Console.WriteLine(index);\n }\n\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n //Console.SetIn(new StreamReader(\"gcd.in\"));\n // Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n //Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int[] pages = GetInts();\n int sum = pages.Sum();\n int index = 0;\n if (n > sum)\n {\n for (int i = 0; i < n; i++)\n {\n n = n - sum;\n if (n <= sum)\n break;\n }\n }\n for (int i = 0; i < pages.Length; i++)\n {\n n = n - pages[i];\n if (n <= 0)\n {\n index = i + 1;\n break;\n }\n }\n Console.WriteLine(index);\n }\n\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int n = int.Parse (Console.ReadLine ());\n int s = 0, j;\n int[] a = new int[7];\n string str = Console.ReadLine ();\n string[] numbers = str.Split (' ');\n for (int i = 0; i != 7; i++) {\n a[i] = int.Parse (numbers[i]);\n s += a[i];\n }\n n %= s;\n if (n > 0) {\n for (j = 0; j != 7 && n > 0; j++) {\n n -= a [j];\n }\n Console.Write (j);\n } else\n Console.Write (\"1\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input);\n\n var daysReading = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();\n var pagesPerWeek = daysReading.Sum();\n int rem = n % pagesPerWeek;\n for(int i = 1;i<=7;i++)\n {\n rem -= daysReading[i - 1];\n if(rem<=0)\n {\n Console.WriteLine(i);\n // Console.ReadKey();\n return;\n }\n\n }\n\n\n // Console.WriteLine(count);\n // Console.ReadKey();\n }\n\n // Console.ReadKey();\n\n\n\n }\n\n}\n"}], "src_uid": "007a779d966e2e9219789d6d9da7002c"} {"source_code": "using System;\nusing System.IO;\n class Program\n {\n static void Main()\n {\n string[] arrs;\n arrs = Console.ReadLine().Split(new char[] { ' ' });\n int a = int.Parse(arrs[0]);\n int b = int.Parse(arrs[1]);\n if (a != 1 && b != 1)\n {\n Console.WriteLine(\"1\");\n }\n if (a != 2 && b != 2)\n {\n Console.WriteLine(\"2\");\n }\n\n if (a != 3 && b != 3)\n {\n Console.WriteLine(\"3\");\n }\n }\n }", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceBrothers\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp = Console.ReadLine().Split(' ');\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n if (((a == 1) && (b == 3)) || ((a == 3) && (b == 1))) Console.WriteLine(2);\n else\n if (((a == 1) && (b == 2)) || ((a == 2) && (b == 1))) Console.WriteLine(3);\n else\n Console.WriteLine(1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication40\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int a = Convert.ToInt32(ss[0]);\n int b = Convert.ToInt32(ss[1]);\n\n Console.WriteLine(6-(a+ b));\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace a\n{\n class Program\n {\n static void Main()\n {\n int sum = 6;\n string s = Console.ReadLine();\n int number1 = int.Parse(s[0].ToString());\n int number2 = int.Parse(s[s.Length - 1].ToString());\n if (number1 == 1 || number1 == 2 || number1 == 3)\n {\n if (number2 != number1)\n {\n if (number2 == 1 || number2 == 2 || number2 == 3)\n {\n int check = number1 + number2;\n int result = sum - check;\n Console.WriteLine(result);\n }\n }\n }\n }\n }\n}"}, {"source_code": "#define reg\nusing System;\nusing System.Security.Cryptography;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace CodinGame\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if reg\n string input = Console.ReadLine();\n if (input.Contains('2') && input.Contains('3')) { Console.WriteLine(\"1\"); return; }\n else if (input.Contains('1') && input.Contains('3')) { Console.WriteLine(\"2\"); return; }\n else { Console.WriteLine(\"3\"); return; }\n#endif\n }\n\n #region Merge with recurtion\n public static void MergeSort(ref int[] input, int left, int right)\n {\n if (left < right)\n {\n int middle = (left + right) / 2;\n\n MergeSort(ref input, left, middle);\n MergeSort(ref input, middle + 1, right);\n\n //Merge\n int[] leftArray = new int[middle - left + 1];\n int[] rightArray = new int[right - middle];\n\n Array.Copy(input, left, leftArray, 0, middle - left + 1);\n Array.Copy(input, middle + 1, rightArray, 0, right - middle);\n\n int i = 0;\n int j = 0;\n for (int k = left; k < right + 1; k++)\n {\n if (i == leftArray.Length)\n {\n input[k] = rightArray[j];\n j++;\n }\n else if (j == rightArray.Length)\n {\n input[k] = leftArray[i];\n i++;\n }\n else if (leftArray[i] <= rightArray[j])\n {\n input[k] = leftArray[i];\n i++;\n }\n else\n {\n input[k] = rightArray[j];\n j++;\n }\n }\n }\n }\n #endregion\n\n #region merge V2\n public static List merge(List a, List b)\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n {\n List c = new List();\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n int kol1 = 0;//\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\n int kol2 = 0;//\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd b\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd c\n for (int i = 0; i < a.Count + b.Count; i++)\n {\n //\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd,\n //\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd b\n if (kol1 == a.Count)\n {\n c.Add(b[kol2]);\n kol2++;\n continue;\n }\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n if (kol2 == b.Count)\n {\n c.Add(a[kol1]);\n kol1++;\n continue;\n }\n //\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n if (a[kol1] <= b[kol2])\n {\n c.Add(a[kol1]);\n kol1++;\n }\n else\n {\n c.Add(b[kol2]);\n kol2++;\n }\n }\n return c;\n }\n\n //\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n public static List merge_sort(List a)\n {\n //\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 1,\n //\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n if (a.Count <= 1)\n return a;\n List b = new List();\n List c = new List();\n b = a.GetRange(0, a.Count / 2);\n //Console.WriteLine(\"vector b: \");\n //foreach (var pr in b)\n //{\n // Console.Write(pr);\n // Console.Write(' ');\n //}\n //Console.WriteLine(\"\\nvector c: \");\n c = a.GetRange(a.Count / 2, a.Count - (a.Count / 2));\n //foreach (var pr in c)\n //{\n // Console.Write(pr);\n // Console.Write(' ');\n //}\n //Console.WriteLine();\n return merge(merge_sort(b), merge_sort(c));\n }\n #endregion\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForceBrothers\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tmp = Console.ReadLine().Split(' ');\n int a = int.Parse(tmp[0]);\n int b = int.Parse(tmp[1]);\n if ((a == 1) && (b == 3)) Console.WriteLine(2);\n else\n if ((a == 1) && (b == 2)) Console.WriteLine(3);\n else\n Console.WriteLine(1);\n }\n }\n}\n"}], "src_uid": "e167dc35a0d3b98c0414c66099e35920"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n void solve()\n {\n string s = nextLine();\n char z = '!';\n s=s.ToLower();\n for (int i = 0; i < s.Length; i++)\n if (s[i] >= 'a' && s[i] <= 'z')\n z = s[i];\n if (\"A, E, I, O, U, Y\".ToLower().IndexOf(z) >= 0)\n println(\"YES\");\n else\n println(\"NO\");\n }\n ////////////\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}\n\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace _49A\n{\n class Program\n {\n static String removeSpace(String str)\n {\n str = str.Replace(\" \", \"\");\n return str;\n }\n\n static void Main(string[] args)\n {\n char[] arr = { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z',\n 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' };\n String str = Console.ReadLine();\n string spaceFree = removeSpace(str);\n char letter = spaceFree[spaceFree.Length - 2];\n Console.WriteLine(arr.Contains(letter) ? \"NO\" : \"YES\");\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n string letters = \"EIOAYU\";\n string quest = Console.ReadLine();\n quest = quest.Trim(new char[] { ' ', '?' }).ToUpper();\n if (letters.Contains(quest[quest.Length-1].ToString()))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n } \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Activities\n{\n class Program\n {\n static void Main(string[] args)\n {\n string question = Console.ReadLine();\n bool foundLast = false;\n char lastLetter = ' ';\n\n for (int x = question.Length - 1; x >= 0 && foundLast == false; x--)\n {\n if (((Convert.ToInt32(question[x]) >= 65) && (Convert.ToInt32(question[x]) <= 90)) || ((Convert.ToInt32(question[x]) >= 97) && (Convert.ToInt32(question[x]) <= 122)))\n {\n foundLast = true;\n lastLetter = question[x];\n }\n }\n\n if ((lastLetter == 'a') || (lastLetter == 'A') || (lastLetter == 'e') || (lastLetter == 'E') || (lastLetter == 'i') || (lastLetter == 'I') || (lastLetter == 'o') || (lastLetter == 'O') || (lastLetter == 'u') || (lastLetter == 'U') || (lastLetter == 'y') || (lastLetter == 'Y'))\n Console.WriteLine(\"YES\");\n\n else\n Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n//using System.Threading.Tasks;\n\nnamespace Contest\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n char[] vowels = new char[] { 'A', 'E', 'I', 'O', 'U', 'Y' };\n char[] consonants = new char[] { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z' };\n \n var s = Console.ReadLine().Replace(\" \", \"\").Reverse();\n //var s = \" Is it a banana ?\".Replace(\" \", \"\").Reverse();\n foreach (var x in s)\n {\n if(vowels.Contains(char.Parse(x.ToString().ToUpper()))){Console.WriteLine(\"YES\");break;}\n if(consonants.Contains(char.Parse(x.ToString().ToUpper()))){Console.WriteLine(\"NO\");break;}\n }\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _46D2A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var t = Console.ReadLine().Split(new char[] { ' ', '?' }, StringSplitOptions.RemoveEmptyEntries);\n if (char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'a' ||\n char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'e' ||\n char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'i' ||\n char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'o' ||\n char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'u' ||\n char.ToLower(t[t.Length - 1][t[t.Length - 1].Length - 1]) == 'y')\n {\n\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CR_111_A\n{\n class Program\n {\n \n static void Main()\n {\n string str = Console.ReadLine();\n char[] glasn = { 'A', 'E', 'I', 'O', 'U', 'Y' };\n char[] soglasn = { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z' };\n int place = str.Length-1;\n while (!char.IsLetter(str[place]))\n place--;\n char find = char.ToUpper(str[place]);\n int olo = Array.IndexOf(glasn, find);\n if (olo != -1)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Solution\n{\n public static void Main()\n {\n char[] st = Console.ReadLine().ToCharArray();\n char[] vovels = { 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'Y', 'y' };\n int index = st.Length - 1;bool searched = false;\n while (st[index] == '?' || st[index] == ' ') index--;\n for(int i = 0; i < 12;i++)\n {\n if (st[index] == vovels[i])\n { searched = true; break; }\n }\n if (searched) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Ques = Console.ReadLine();\n int i= Ques.Length-2;\n while (!Char.IsLetter(Ques[i])) i--;\n if ((Ques[i] == 'a') || (Ques[i] == 'o') || (Ques[i] == 'u') || (Ques[i] == 'e') || (Ques[i] == 'i') || (Ques[i] == 'y') || (Ques[i] == 'A') || (Ques[i] == 'O') || (Ques[i] == 'U') || (Ques[i] == 'E') || (Ques[i] == 'I') || (Ques[i] == 'Y')) \n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static List listglasn = new List { 'A', 'E', 'I', 'O', 'U', 'Y' };\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n for (int i = text.Length - 1; i >= 0; i--)\n {\n if (char.IsLetter(text[i]))\n {\n if (listglasn.Contains(Convert.ToChar((text[i].ToString().ToUpper()))))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n } \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Application\n{\n class Program\n {\n static List listglasn = new List { 'A', 'E', 'I', 'O', 'U', 'Y' };\n static void Main(string[] args)\n {\n string text = Console.ReadLine();\n for (int i = text.Length - 1; i >= 0; i--)\n {\n if (char.IsLetter(text[i]))\n {\n if (listglasn.Contains(Convert.ToChar((text[i].ToString().ToUpper()))))\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n } \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _49a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var toks = Console.ReadLine().ToLower().Replace(\"?\", \"\").Split(' ');\n var tok = toks.Last(p => p.Trim() != \"\" && p.Trim() != \"?\");\n var arr = tok.ToCharArray();\n if (arr[arr.Length - 1] == 'a' || arr[arr.Length - 1] == 'e' || arr[arr.Length - 1] == 'i' || arr[arr.Length - 1] == 'o' || arr[arr.Length - 1] == 'u' || arr[arr.Length - 1] == 'y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var str = Console.ReadLine();\n var c = str.Last(char.IsLetter);\n Console.Write((new [] {'A', 'E', 'I', 'O', 'U', 'Y'}).Contains(char.ToUpper(c))?\"YES\":\"NO\"); \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Sleuth\n{\n class Program\n {\n static void Main(string[] args)\n {\n here: string s = Console.ReadLine();\n if(s.Length<1||s.Length>100)\n {\n goto here;\n }\n char[] array = s.ToCharArray();\n for(int i=array.Length-1;i>-1;i--)\n {\n if(array[i]==' '||array[i]=='?')\n {\n continue;\n }\n if(array[i]=='B'||array[i]=='C'||array[i]=='D'||array[i]=='F'||array[i]=='J'||array[i]=='H'||array[i]=='G'||array[i]=='K'||array[i]=='L'||array[i]=='M'||array[i]=='N'||array[i]=='P'||array[i]=='Q'||array[i]=='R'||array[i]=='S'||array[i]=='S'||array[i]=='T'||array[i]=='V'||array[i]=='W'||array[i]=='X'||array[i]=='Z'||array[i]=='b'||array[i]=='c'||array[i]=='d'||array[i]=='f'||array[i]=='g'||array[i]=='h'||array[i]=='j'||array[i]=='k'||array[i]=='l'||array[i]=='m'||array[i]=='n'||array[i]=='p'||array[i]=='q'||array[i]=='r'||array[i]=='s'||array[i]=='t'||array[i]=='w'||array[i]=='v'||array[i]=='x'||array[i]=='z')\n {\n Console.WriteLine(\"NO\");\n break;\n }\n else if(array[i]=='A'||array[i]=='I'||array[i]=='E'||array[i]=='O'||array[i]=='U'||array[i]=='Y'||array[i]=='a'||array[i]=='i'||array[i]=='e'||array[i]=='o'||array[i]=='u'||array[i]=='y')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n continue;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.ToUpper();\n string vowels = \"AEIOUY\";\n string cons = \"BCDFGHJKLMNPQRSTVWXZ\";\n\n\n int num = 0;\n for (int i = 0; i < str.Length;i++ )\n {\n if (vowels.IndexOf(str[i]) != -1)\n {\n num = i;\n }\n\n if (cons.IndexOf(str[i]) != -1)\n {\n num = i;\n }\n }\n\n if (vowels.IndexOf(str[num])!=-1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (cons.IndexOf(str[num]) != -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n\n\n class Util {\n public static int getNum() {\n return int.Parse(Console.ReadLine());\n }\n\n public static int[] getArray()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] array= new int[str.Length];\n\n for (int i = 0; i < array.Length;i++ )\n {\n try\n {\n array[i] = int.Parse(str[i]);\n }\n catch(Exception e){\n //Console.WriteLine(str[i]+\"/\");\n }\n }\n\n return array;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _49A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string y,c;\n char z;\n int a = 0;\n y = x.Remove(x.IndexOf('?'));\n if (y[y.Length-1]!=' ')\n {\n z = char.Parse(y.Substring(y.Length-1 , 1).ToLower());\n }\n else\n {\n c = y.Trim();\n z = char.Parse(c.Substring(c.Length-1 , 1).ToLower()); \n }\n \n switch (z)\n {\n case 'a':\n Console.WriteLine(\"YES\");\n break;\n case 'o':\n Console.WriteLine(\"YES\");\n break;\n case 'y':\n Console.WriteLine(\"YES\");\n break;\n case 'e':\n Console.WriteLine(\"YES\");\n break;\n case 'u':\n Console.WriteLine(\"YES\");\n break;\n case 'i':\n Console.WriteLine(\"YES\");\n break;\n default:\n Console.WriteLine(\"NO\");\n break; \n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _49A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string y,c;\n char z;\n int a = 0;\n y = x.Remove(x.IndexOf('?'));\n if (y[y.Length-1]!=' ')\n {\n z = char.Parse(y.Substring(y.Length-1 , 1).ToLower());\n }\n else\n {\n c = y.Trim();\n z = char.Parse(c.Substring(c.Length-1 , 1).ToLower()); \n }\n \n switch (z)\n {\n case 'a':\n Console.WriteLine(\"YES\");\n break;\n case 'o':\n Console.WriteLine(\"YES\");\n break;\n case 'y':\n Console.WriteLine(\"YES\");\n break;\n case 'e':\n Console.WriteLine(\"YES\");\n break;\n case 'u':\n Console.WriteLine(\"YES\");\n break;\n case 'i':\n Console.WriteLine(\"YES\");\n break;\n default:\n Console.WriteLine(\"NO\");\n break; \n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sleuth\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n for (int i = s.Length - 1; i >= 0; i--)\n {\n if (char.IsLetter(s[i]))\n {\n writer.WriteLine(\"AEIOUY\".IndexOf(char.ToUpper(s[i])) >= 0 ? \"YES\" : \"NO\");\n break;\n }\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace vvv\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n s = s.Remove(s.Length - 1).TrimEnd().ToLower();\n\n if (s[s.Length - 1] == 'a' || s[s.Length - 1] == 'e' || s[s.Length - 1] == 'i' ||\n s[s.Length - 1] == 'o' || s[s.Length - 1] == 'u' || s[s.Length - 1] == 'y')\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace \u0421\u044b\u0449\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string question = Console.ReadLine().Replace(\" \", \"\");\n if (char.ToUpper(question[question.Length - 2]) == 'A' || char.ToUpper(question[question.Length - 2]) == 'E' || char.ToUpper(question[question.Length - 2]) == 'I' || char.ToUpper(question[question.Length - 2]) == 'O' || char.ToUpper(question[question.Length - 2]) == 'U' || char.ToUpper(question[question.Length - 2]) == 'Y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar glas = new char[] { 'A', 'E', 'I', 'O', 'U', 'Y' };\n\t\t\tvar q = sr.NextString();\n\t\t\tvar indx = q.Length - 2;\n\t\t\twhile(!Char.IsLetter(q[indx]))\n\t\t\t{\n\t\t\t\tindx--;\n\t\t\t}\n\t\t\tvar ch = q[indx];\n\t\t\tif (glas.Contains(ch) || glas.Contains(Char.ToLowerInvariant(ch)) || glas.Contains(Char.ToUpperInvariant(ch)))\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n string input = Console.ReadLine();\n input = input.ToUpper();\n char c = ' ';\n for (int i = input.Length - 2; ; i--)\n {\n if (input[i] != ' ')\n {\n c = input[i];\n break;\n }\n }\n char[] Glasn = {'A', 'E', 'I', 'O', 'U', 'Y'};\n for (int i = 0; i=0 ; i--)\n {\n if(s[i]=='?')\n {\n for (int j= i-1; j >=0; j--)\n {\n if (s[j] != ' ')\n {\n c = j;\n break;\n }\n \n\n } \n }\n }\n bool x = false;\n for (int i = 0; i < 6; i++)\n {\n if(s[c]==ar[i])\n {\n x = true;\n break;\n }\n }\n if(x)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadKey();\n \n\n }\n catch { }\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Ques = Console.ReadLine();\n int i= Ques.Length-2;\n while (!Char.IsLetter(Ques[i])) i--;\n if ((Ques[i] == 'a') || (Ques[i] == 'o') || (Ques[i] == 'u') || (Ques[i] == 'e') || (Ques[i] == 'i') || (Ques[i] == 'y') || (Ques[i] == 'A') || (Ques[i] == 'O') || (Ques[i] == 'U') || (Ques[i] == 'E') || (Ques[i] == 'I') || (Ques[i] == 'Y')) \n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace qiw\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n List n = Console.ReadLine().ToCharArray().ToList();\n n.Remove('?');\n \n \n \n \n for (int i = n.Count - 1; i >= 0; i--)\n {\n\n if (n[i] == ' ')\n {\n n.Remove(n[i]);\n }\n else\n {\n break;\n }\n }\n int im = n.Count - 1;\n if (n[im] == 'a' || n[im] == 'A' || n[im] == 'e' || n[im] == 'E' || n[im] == 'i' || n[im] == 'I' || n[im] == 'o' || n[im] == 'O' || n[im] == 'u' || n[im] == 'U' || n[im] == 'y' || n[im] == 'Y')\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n \n catch(Exception e){\n Console.WriteLine(\"NO\"); ;\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n static void Main(string[] args) {\n string s = reader.ReadLine().ToLower();\n char[] g = {'a', 'e', 'i', 'o', 'u', 'y'};\n char lastChar = '\\0';\n for(int i = s.Length - 1; i >= 0; i--) {\n if(Char.IsLetter(s[i])) {\n lastChar = s[i];\n break;\n }\n }\n writer.Write(Array.IndexOf(g, lastChar) != -1 ? \"YES\" : \"NO\");\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n if(vowel(str))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n public static bool vowel(string s)\n {\n int x = s.Length-1;\n char lastchar;\n\n while (true)\n {\n if (s[x] == '?' || s[x] == ' ')\n {\n x--;\n continue;\n }\n lastchar = Char.ToUpper(s[x]);\n break;\n }\n \n if (lastchar == 'A' || lastchar == 'E' || lastchar == 'I' || lastchar == 'O' || lastchar == 'U' || lastchar == 'Y')\n return true;\n else\n return false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var s = Console.ReadLine().ToUpper();\n int i = s.Length - 1;\n while (!char.IsLetter(s[i])) i--;\n Console.WriteLine(new[] { 'A', 'E', 'I', 'O', 'U', 'Y' }.Contains(s[i]) ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n List listEnglishAE = new List() {'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y'};\n \n string str = Console.ReadLine();\n\n char[] arrayStr = str.ToCharArray();\n\n string newStr = \"\";\n\n arrayStr = arrayStr.Where(el => el != '?').ToArray();\n\n foreach (var el in arrayStr)\n {\n newStr += el;\n }\n\n newStr = newStr.Trim();\n\n if (listEnglishAE.Contains(newStr.ToCharArray().Last()))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace \u0421\u044b\u0449\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string question = Console.ReadLine().Replace(\" \", \"\");\n if (char.ToUpper(question[question.Length - 2]) == 'A' || char.ToUpper(question[question.Length - 2]) == 'E' || char.ToUpper(question[question.Length - 2]) == 'I' || char.ToUpper(question[question.Length - 2]) == 'O' || char.ToUpper(question[question.Length - 2]) == 'U' || char.ToUpper(question[question.Length - 2]) == 'Y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n static void Main(string[] args)\n {\n var q = Console.ReadLine().TrimEnd(new[]{'?'}).TrimEnd();\n\n if ((new[] {'A', 'E', 'I', 'O', 'U', 'Y'}).Contains(char.ToUpper(q[q.Length-1])))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task49A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string inp = Console.ReadLine().Replace(\" \",string.Empty);\n char[] vowels = { 'A', 'E', 'I', 'O', 'U', 'Y' };\n Console.WriteLine(vowels.Contains(char.ToUpper(inp[inp.Length-2]))?\"YES\":\"NO\");\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Example = \"AaeEiIoOuUyY\";\n string str = Console.ReadLine().Trim(new char[]{ ' ', '?' });\n Console.WriteLine(Example.Contains(str[str.Length-1])?\"YES\":\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tstring vowels = \"aeiouy\";\n\t\tstring input = Console.ReadLine();\n\t\tinput = input.ToLower();\n\t\tfor(int i = input.Length - 1; i >= 0; i--){\n\t\t\tif(input[i] >= 'a' && input[i] <= 'z'){\n\t\t\t\tforeach(char c in vowels){\n\t\t\t\t\tif(c == input[i]){\n\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(\"NO\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round46\n{\n class A\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n string vowels = \"aeiouyAEIOUY\";\n for (int i = s.Length - 1; i >= 0; i--)\n {\n if (s[i] != '?' && s[i] != ' ')\n {\n Console.Write(vowels.Contains(s[i]) ? \"YES\" : \"NO\");\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _49a\n {\n public static bool IsYes(char c)\n {\n c = char.ToLower(c);\n if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'u' || c == 'o')\n {\n return true;\n }\n return false;\n }\n\n public static void Main()\n {\n var line = Console.ReadLine();\n for (var i = line.Length - 1; i >= 0; i--)\n {\n if (char.IsLetter(line[i]))\n {\n var result = IsYes(line[i]) ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _49A\n {\n public static void Main()\n {\n Console.WriteLine(new char[] { 'a', 'e', 'i', 'o', 'u', 'y' }.Contains(Console.ReadLine().ToLower().Last(c => char.IsLetter(c))) ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Solve\n{\n HashSet H = new HashSet();\n\n\n public void solve()\n {\n H.Add('A');\n H.Add('E');\n H.Add('I');\n H.Add('O');\n H.Add('U');\n H.Add('Y');\n \n string s = Console.ReadLine().ToUpper(); \n \n bool ok = false;\n for (int i = 0; i < s.Length; ++i)\n if (s[i] >= 'A' && s[i] <= 'Z')\n {\n ok = H.Contains(s[i]); \n }\n\n if (ok)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n}\n\n\n class Program\n {\n\n static void Main(string[] args)\n {\n Solve Task = new Solve();\n Task.solve();\n // Console.WriteLine(\"Done. Press any key...\"); Console.ReadKey();\n }\n }\n\n"}, {"source_code": "using System;\n\nnamespace prog\n{\n class Program\n {\n static void Main()\n {\n string s;\n int i;\n char c;\n\n s = Console.ReadLine();\n s = s.ToUpper();\n for(i = s.Length - 1; s[i] == ' ' || s[i] == '?'; i--);\n c = s[i];\n if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] s = Console.ReadLine().Split(' ','?');\n string[] g = { \"A\", \"E\", \"I\", \"O\", \"U\", \"Y\",\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"};\n \n int n = s.Length - 1;\n while(s[n]==\"\") n--;\n\n if (g.Contains(s[n][s[n].Length - 1].ToString()) == true)\n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n Console.ReadLine();\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace acs\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar question = Console.ReadLine();\n\n\t\t\tbool q_checked = false;\n\t\t\tfor (int i = question.Length - 1; i >= 0 && !q_checked; i--) {\n\t\t\t\tswitch (Check(question, i)) {\n\t\t\t\t\tcase CheckResult.Vowel:\n\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\tq_checked = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase CheckResult.Consonant:\n\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\tq_checked = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tenum CheckResult\n\t\t{\n\t\t\tVowel, Consonant, Other\n\t\t}\n\n\t\tstatic CheckResult Check(string s, int idx)\n\t\t{\n\t\t\tvar result = CheckResult.Other;\n\t\t\tvar ls = s.ToLower();\n\t\t\tswitch (ls[idx]) {\n\t\t\t\tcase 'a':\n\t\t\t\tcase 'e':\n\t\t\t\tcase 'i':\n\t\t\t\tcase 'o':\n\t\t\t\tcase 'u':\n\t\t\t\tcase 'y':\n\t\t\t\t\tresult = CheckResult.Vowel;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'b':\n\t\t\t\tcase 'c':\n\t\t\t\tcase 'd':\n\t\t\t\tcase 'f':\n\t\t\t\tcase 'g':\n\t\t\t\tcase 'h':\n\t\t\t\tcase 'j':\n\t\t\t\tcase 'k':\n\t\t\t\tcase 'l':\n\t\t\t\tcase 'm':\n\t\t\t\tcase 'n':\n\t\t\t\tcase 'p':\n\t\t\t\tcase 'q':\n\t\t\t\tcase 'r':\n\t\t\t\tcase 's':\n\t\t\t\tcase 't':\n\t\t\t\tcase 'v':\n\t\t\t\tcase 'w':\n\t\t\t\tcase 'x':\n\t\t\t\tcase 'z':\n\t\t\t\t\tresult = CheckResult.Consonant;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForce\n{\n public class Program\n {\n static void Main(string[] args)\n {\n string input1 = Console.ReadLine();\n Console.WriteLine(Solve(input1));\n }\n\n /*\n Sleuth\n time limit per test2 seconds\n memory limit per test256 megabytes\n inputstandard input\n outputstandard output\n Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a \"crime\" and find out what is happening. He can ask any questions whatsoever that can be answered with \"Yes\" or \"No\". All the rest agree beforehand to answer the questions like that: if the question\u2019s last letter is a vowel, they answer \"Yes\" and if the last letter is a consonant, they answer \"No\". Of course, the sleuth knows nothing about it and his task is to understand that.\n\n Unfortunately, Vasya is not very smart. After 5 hours of endless stupid questions everybody except Vasya got bored. That\u2019s why Vasya\u2019s friends ask you to write a program that would give answers instead of them.\n\n The English alphabet vowels are: A, E, I, O, U, Y\n\n The English alphabet consonants are: B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V, W, X, Z\n\n Input\n The single line contains a question represented by a non-empty line consisting of large and small Latin letters, spaces and a question mark. The line length does not exceed 100. It is guaranteed that the question mark occurs exactly once in the line \u2014 as the last symbol and that the line contains at least one letter.\n\n Output\n Print answer for the question in a single line: YES if the answer is \"Yes\", NO if the answer is \"No\".\n\n Remember that in the reply to the question the last letter, not the last character counts. I. e. the spaces and the question mark do not count as letters.\n */\n public static string Solve(string question)\n {\n var vowels = new HashSet(\n new List { 'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y' });\n var consonants = new HashSet(\n new List\n {\n 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z',\n 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z'\n });\n var lastChar = question\n .Reverse()\n .SkipWhile(c => !vowels.Contains(c) && !consonants.Contains(c))\n .First();\n\n return vowels.Contains(lastChar) ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string q = Console.ReadLine();\n char[] vowels = new char[] { 'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y' };\n\n int i = q.Length - 1;\n while (new char[] { ' ', '?' }.Contains(q[i])) i--;\n if (vowels.Contains(q[i]))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n} \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a=Console.ReadLine();\n string glas=\"aeiouy\";\n string sogl=\"bcdfghjklmnpqrstvwxz\";\n bool f=false;\n a=a.ToLower();\n for(int i=0;i();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n\n string _test_input;\n\n List _lines;\n\n#if DEBUG\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public CodeforcesUtils(string dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n public void Close()\n {\n if( _sr!= null)\n _sr.Close();\n if( _sw != null)\n _sw.Close();\n }\n\n System.IO.StreamReader _sr=null;\n System.IO.StreamWriter _sw=null;\n \n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n string nextToken()\n {\n string str = \"\";\n int c;\n do\n {\n c = Console.Read();\n if (c == -1 || ((char)c != ' ' && (char)c != '\\n' && (char)c != '\\r' && (char)c != '\\t')) break;\n } while (true);\n if (c == -1) return str;\n while (true)\n {\n str += (char)c;\n c = Console.Read();\n if (c == -1 || (char)c == ' ' || (char)c == '\\n' || (char)c == '\\r' || (char)c == '\\t') break;\n }\n return str;\n }\n\n int nextInt()\n {\n return int.Parse(nextToken());\n }\n\n double nextDouble()\n {\n return double.Parse(nextToken());\n }\n\n void Solve()\n {\n char[] cc = new char[] { 'A', 'E', 'I', 'O', 'U', 'Y' };\n char t = char.ToUpper(Console.ReadLine().Last(c => c != ' ' && c != '?'));\n Console.WriteLine(cc.Any(c => c == t) ? \"YES\" : \"NO\");\n }\n\n static void Main(string[] args)\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Search\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tChar[] G = {'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y'};\n\t\t\tstring str = Console.ReadLine();\n\t\t\tint a=str.IndexOf(\"?\");\n\t\t\tif(a>-1)\n\t\t\t{\n\t\t\t\tfor(int i=a-1;i>=0;i--)\n\t\t\t\t{\n\t\t\t\t\tif (System.Text.RegularExpressions.Regex.IsMatch(str[i].ToString(),@\"[a-zA-Z]\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(Array.IndexOf(G,str[i])!=-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}else \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t}\n\t\t\telse return;\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\n\nnamespace A.Sleuth\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine().ToLower().Replace(\" \",\"\").Replace(\",\",\"\").Replace(\".\",\"\").Replace(\"?\",\"\").Replace(\"!\",\"\");\n string correct = \"aeiouy\";\n if(correct.Contains(input[input.Length - 1].ToString()))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring s=Console.ReadLine();\n\t\tchar let='a';\n\t\tfor(int i=s.Length-1;i>=0;i--)\n\t\t{\n\t\t\tif(char.IsLetter(s[i]))\n\t\t\t{\n\t\t\t\tlet=s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlet=char.ToLower(let);\n\t\tchar[] arr=\"aeiouy\".ToCharArray();\n\t\tif(Array.IndexOf(arr,let)>=0)\n\t\tConsole.WriteLine(\"YES\");\n\t\telse\n\t\tConsole.WriteLine(\"NO\");\n\t\n\t}\n}"}, {"source_code": "using System;\n\nnamespace lol\n{\n class c158Class\n {\n private static void Main()\n {\n string s = Console.ReadLine();\n s = s.Remove(s.Length - 1);\n s = s.TrimEnd();\n char[] v1 = new char[6] { 'A', 'E', 'I', 'O', 'U', 'Y' };\n char[] v2 = new char[6] { 'a', 'e', 'i', 'o', 'u', 'y' };\n int i = s.IndexOfAny(v1, s.Length - 1);\n int j = s.IndexOfAny(v2, s.Length - 1);\n if (i != -1 || j != -1)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine(); char c = ' '; \n for (int i = str.Length - 1; i >= 0; i--) { if (str[i] != '?' && str[i] != ' ') { c = str[i]; break; } }\n if (isVowels(char.Parse(c.ToString().ToLower()))) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n public static bool isVowels(char c)\n {\n return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y';\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication30\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = { \"A\",\" E\", \"I\", \"O\", \"U\", \"Y\", \"a\", \"e\", \"i\", \"o\", \"u\", \"y\" };\n string[] tt = { \"B\", \"C\", \"D\", \"F\", \"G\", \"H\", \"J\", \"K\", \"L\", \"M\", \"N\", \"P\", \"Q\", \"R\", \"S\", \" T\", \" V\", \"W\", \"X\", \"Z\" };\n string c = \"\";\n for(int i=s.Length-1;i>=0;i--)\n {\n if(s[i]>=65&&s[i]<=90||s[i]>=97&&s[i]<=122){c=Convert.ToString(s[i]);break;}\n } bool f=false;\n for(int i=0;i= 0; i--)\n if (s[i].Length != 0) { lastWord = s[i]; break; }\n\n lastWord = lastWord.ToLower();\n char lastSymbol = lastWord[lastWord.Length - 1];\n int codeOfLast = (int)lastSymbol;\n switch (codeOfLast)\n {\n case 97: return \"YES\";\n case 101: return \"YES\";\n case 105: return \"YES\";\n case 111: return \"YES\";\n case 117: return \"YES\";\n case 121: return \"YES\";\n default: return \"NO\";\n }\n }\n static void Main(string[] args)\n {\n //Console.WriteLine(\"{0},{1},{2},{3},{4},{5}\",(int)'a', (int)'i', (int)'e', (int)'o', (int)'u', (int)'y');\n Console.WriteLine(IsItVowel(Console.ReadLine()));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_049A {\n class Program {\n static void Main(string[] args) {\n string[] s=Console.ReadLine().Split(new char[] { ' ','?' },StringSplitOptions.RemoveEmptyEntries);\n string o=\"NO\",s2=s[s.Length-1];\n if(\"AEIOUYaeiouy\".IndexOf(s2[s2.Length-1])>-1) o=\"YES\";\n Console.WriteLine(o);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeforcesA\n{\n public static class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(ReadLine().TrimEnd('?',' ').ToUpper().Last().In('A', 'E', 'I', 'O', 'U', 'Y') ? \"YES\" : \"NO\"); \n }\n\n internal static int[] ReadIntsLine(int numberOfInts, params char[] separators)\n {\n var line = Console.ReadLine();\n return line.Split(separators).Select(s => s.ToInt()).ToArray();\n }\n\n internal static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n internal static int ToInt(this string s)\n {\n return Int32.Parse(s);\n }\n\n internal static int ToInt(this object obj)\n {\n return obj.ToString().ToInt();\n }\n\n internal static bool In(this T value, params T[] array)\n {\n return array.Contains(value);\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n new T49A().Run();\n }\n }\n\n public class T49A\n {\n public void Run()\n {\n var s = Console.ReadLine();\n bool result = Yes(s);\n Console.WriteLine(result?\"YES\":\"NO\");\n// Console.WriteLine(Yes(\"Is it a melon?\"));\n// Console.WriteLine(Yes(\"Is it an apple?\"));\n// Console.WriteLine(Yes(\" Is it a banana ?\"));\n// Console.WriteLine(Yes(\"Is it an apple and a banana simultaneouSLY?\"));\n }\n\n private bool Yes(string s)\n {\n var i = s.IndexOf('?') - 1;\n var gl = \"aeiouyAEIOUY\".ToCharArray();\n while (true)\n {\n var v = s.Substring(i, 1).ToUpper()[0];\n if (v >= 'A' && v <= 'Z')\n {\n return gl.FirstOrDefault(c => c == v) != 0;\n }\n --i;\n if(i < 0) return false;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string word = \"\";\n for (int i = 0; i < s.Length; i++)\n {\n if (char.IsUpper(s[i]))\n {\n word += char.ToLower(s[i]);\n }\n else \n {\n word += s[i];\n }\n }\n string result = \"\";\n for (int i = 0; i < word.Length; i++)\n {\n if (char.IsLetter(word[i]))\n {\n result += word[i];\n }\n }\n if (result[result.Length - 1] == 'a' || result[result.Length - 1] == 'o' || result[result.Length - 1] == 'e' || result[result.Length - 1] == 'i' || result[result.Length - 1] == 'y' || result[result.Length - 1] == 'u')\n {\n Console.WriteLine(\"YES\");\n }\n else \n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine();\n var ch=' ';\n for (var i = s.Length-1; i >= 0; i--)\n {\n if(char.IsLetter(s[i]))\n {\n ch = char.ToLower(s[i]);\n break;\n }\n }\n Console.WriteLine(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y' ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n\tpublic class Sleuth\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tList vs = new List (){'A', 'E', 'I', 'O', 'U', 'Y'};\n\t\t\t\n\t\t\tstring line = Console.ReadLine();\n\t\t\tline = line.Replace(\" \", string.Empty);\n\t\t\tchar c = line[line.Length-2];\n\t\t\n\t\t\tif(vs.Contains(c.ToString().ToUpper()[0]))\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input_Value = Console.ReadLine();\n input_Value= input_Value.ToLower();\n input_Value = input_Value.Replace(\" \",\"\");\n int len = input_Value.Length;\n List voules = new List() { 'a', 'o', 'i', 'e', 'y','u' };\n if(voules.Contains (input_Value [len-2]))\n Console .WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n\n static void Main()\n {\n string s = Console.ReadLine();\n \n for (int i = s.Length - 2; i >= 0; i--)\n {\n if (s[i] == ' ')\n continue;\n else\n {\n if (s[i] == 'a' || s[i] == 'A' || s[i] == 'i' || s[i] == 'I' || s[i] == 'o' || s[i] == 'O' || s[i] == 'e' || s[i] == 'E' || s[i] == 'u' || s[i] == 'U' || s[i] == 'y' || s[i] == 'Y')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n }\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Sleuth\n {\n char[] vowels = new char[6] { 'a', 'e', 'i', 'o', 'u', 'y' };\n\n string question;\n public Sleuth(string q)\n {\n question = stripSentence(q.ToLower());\n }\n\n public string stripSentence(string sentence)\n {\n char[] seperator = { ' ', '?' };\n string stripped = sentence.TrimEnd(seperator);\n \n return stripped;\n }\n\n public bool isVowel()\n {\n char cOrV = Convert.ToChar(question.Substring(question.Length - 1));\n foreach (char v in vowels)\n {\n if (cOrV == v)\n {\n return true;\n }\n }\n return false;\n }\n static void Main(string[] args)\n {\n string mystring = Console.ReadLine();\n Sleuth mySleuth = new Sleuth(mystring);\n if (mySleuth.isVowel())\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A49\n{\n class Program\n {\n static void Main(string[] args)\n {\n String s = Console.ReadLine();\n s = s.Remove(s.Length-1,1).Trim().ToUpper();\n switch (s[s.Length-1])\n {\n case 'A':\n Console.Write(\"YES\");\n break;\n case 'E':\n Console.Write(\"YES\");\n break;\n case 'I':\n Console.Write(\"YES\");\n break;\n case 'O':\n Console.Write(\"YES\");\n break;\n case 'U':\n Console.Write(\"YES\");\n break;\n case 'Y':\n Console.Write(\"YES\");\n break;\n\n default:\n Console.Write(\"NO\");\n \n break;\n }\n \n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().Replace(\" \",\"\").ToLower();\n char[] c = new char[] { 'a', 'e', 'u', 'i', 'o', 'y' };\n Console.WriteLine(c.Contains(s[s.Length - 2]) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Sleuth\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n input = input.Replace(\" \", \"\");\n Console.WriteLine(\"AEIOUY\".Contains(input[input.Length - 2]) || \"AEIOUY\".ToLower().Contains(input[input.Length - 2]) ? \"YES\" : \"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "// Problem: 49A - Sleuth\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass Sleuth\n {\n public static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null || line.Length > 100)\n return -1;\n char[] delimiter = new char[] {' '};\n string[] words = line.Split (delimiter,StringSplitOptions.RemoveEmptyEntries);\n byte numWords = Convert.ToByte (words.Length);\n bool existsQMark = false;\n for (byte i = 0; i < numWords; i++)\n {\n byte numChars = Convert.ToByte (words[i].Length);\n for (byte j = 0; j < numChars; j++)\n {\n char c = words[i][j];\n if (!Char.IsLetter (c) && c != '?')\n return -1;\n if (c == '?' && (existsQMark || (i == 0 && j == 0) || i+1 < numWords || j+1 < numChars))\n return -1;\n if (c == '?' && !existsQMark)\n existsQMark = true;\n }\n }\n byte numLastChars = Convert.ToByte (words[numWords-1].Length);\n char lastLetter;\n if (numLastChars > 1)\n lastLetter = words[numWords-1][numLastChars-2];\n else\n {\n numLastChars = Convert.ToByte (words[numWords-2].Length);\n lastLetter = words[numWords-2][numLastChars-1];\n }\n bool ans;\n switch (Char.ToUpper (lastLetter))\n {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y': ans = true;\n break;\n default: ans = false;\n break;\n }\n Console.WriteLine (ans ? \"YES\" : \"NO\");\n return 0;\n }\n }\n"}, {"source_code": "\ufeffusing System;\nnamespace SolutionsForCodeforces\n{\n class Sherlock\n {\n static readonly char[] G = { 'A', 'E', 'I', 'O', 'U', 'Y' };\n static readonly char[] P = { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z' };\n static void Main(string[] args)\n {\n var Question = Console.ReadLine();\n Question = Question.ToUpper();\n while (!char.IsLetter(Question[Question.Length - 1]))\n {\n Question = Question.Remove(Question.Length - 1);\n }\n if (Question.LastIndexOfAny(G) == Question.Length - 1) Console.WriteLine(\"YES\"); else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n string s = Console.ReadLine();\n int i = 0;\n for (i = s.Length - 2; !Char.IsLetter(s[i]); i--) { }\n Console.WriteLine(Array.IndexOf(new char[] { 'a', 'e', 'i', 'o', 'u', 'y' }, Char.ToLower(s[i])) != -1 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n string s = Console.ReadLine();\n char[] c = { 'a', 'e', 'i', 'o', 'u', 'y' };\n int i = 0;\n for (i = s.Length - 2; !Char.IsLetter(s[i]); i--) { }\n Console.WriteLine(Array.IndexOf(c, Char.ToLower(s[i])) != -1 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u0421\u044b\u0449\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int i = s.Length-2;\n while (i>=0)\n {\n if (s[i] != ' ')\n {\n if (s[i] == 'a' || s[i] == 'A' || s[i] == 'i' || s[i] == 'I' || s[i] == 'o' || s[i] == 'O' || s[i] == 'e' || s[i] == 'E' || s[i] == 'u' || s[i] == 'U' || s[i] == 'y' || s[i] == 'Y')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n i--;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _49A\n{\n class Program\n {\n /* static String removeSpace(String str)\n {\n str = str.Replace(\" \", \"\");\n return str;\n }*/\n\n static void Main(string[] args)\n {\n /* char[] arr = { 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Z',\n 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' };\n string str = Console.ReadLine();\n string spaceFree = removeSpace(str);\n char letter = spaceFree[spaceFree.Length - 2];\n Console.WriteLine(arr.Contains(letter) ? \"NO\" : \"YES\");*/\n string s= Console.ReadLine(),helper= \"AEIOUYaeiouy\";\n char letter=' ';\n for (int i = s.Length - 1; i >= 0; i--) {\n if (s[i] != ' ' && s[i] != '?') {\n letter = s[i];\n break;\n }\n }\n Console.WriteLine(helper.Contains(letter) ? \"YES\" : \"NO\");\n \n\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Ques = Console.ReadLine();\n int i= Ques.Length-2;\n while (!Char.IsLetter(Ques[i])) i--;\n if ((Ques[i] == 'a') || (Ques[Ques.Length - 2] == 'o') || (Ques[Ques.Length - 2] == 'u') || (Ques[Ques.Length - 2] == 'e') || (Ques[Ques.Length - 2] == 'i') || (Ques[Ques.Length - 2] == 'y') || (Ques[Ques.Length - 2] == 'A') || (Ques[Ques.Length - 2] == 'O') || (Ques[Ques.Length - 2] == 'U') || (Ques[Ques.Length - 2] == 'E') || (Ques[Ques.Length - 2] == 'I') || (Ques[Ques.Length - 2] == 'Y')) \n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main() {\n var str = Console.ReadLine();\n var c = str.Last(char.IsLetter);\n Console.Write((new [] {'A', 'E', 'I', 'O', 'U', 'Y'}).Contains(c)?\"YES\":\"NO\"); \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n str = str.ToUpper();\n string vowels = \"AEIOUY\";\n string cons = \"BCDFGHJKLMNPQRSTVWXZ\";\n\n if (vowels.IndexOf(str[str.Length - 2])!=-1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n\n if (cons.IndexOf(str[str.Length - 2]) != -1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n\n\n class Util {\n public static int getNum() {\n return int.Parse(Console.ReadLine());\n }\n\n public static int[] getArray()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] array= new int[str.Length];\n\n for (int i = 0; i < array.Length;i++ )\n {\n try\n {\n array[i] = int.Parse(str[i]);\n }\n catch(Exception e){\n //Console.WriteLine(str[i]+\"/\");\n }\n }\n\n return array;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _49A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n string y;\n char z;\n y = x.Remove(x.IndexOf('?'));\n if (y[y.Length-1]!=' ')\n {\n z = char.Parse(x.Substring(x.Length - 2, 1).ToLower());\n }\n else\n {\n z = char.Parse(x.Substring(x.Length - 3, 1).ToLower());\n }\n \n switch (z)\n {\n case 'a':\n Console.WriteLine(\"YES\");\n break;\n case 'o':\n Console.WriteLine(\"YES\");\n break;\n case 'y':\n Console.WriteLine(\"YES\");\n break;\n case 'e':\n Console.WriteLine(\"YES\");\n break;\n case 'u':\n Console.WriteLine(\"YES\");\n break;\n case 'i':\n Console.WriteLine(\"YES\");\n break;\n default:\n Console.WriteLine(\"NO\");\n break; \n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sleuth\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n for (int i = s.Length - 1; i >= 0; i--)\n {\n if (char.IsLetter(s[i]))\n {\n if (\"AEIOUY\".IndexOf(char.ToUpper(s[i])) >= 0)\n {\n writer.WriteLine(\"YES\");\n }\n else\n {\n writer.WriteLine(\"NO\");\n }\n }\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar glas = new char[] { 'A', 'E', 'I', 'O', 'U', 'Y' };\n\t\t\tvar q = sr.NextString();\n\t\t\tif (glas.Contains(q[q.Length - 2]) || glas.Contains(q[q.Length - 2].ToString().ToUpperInvariant()[0]) || glas.Contains(q[q.Length - 2].ToString().ToLowerInvariant()[0]))\n\t\t\t{\n\t\t\t\tsw.WriteLine(\"YES\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsw.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApplication21\n{\n class Program\n {\n static void Main(string[] args)\n {\n string Ques = Console.ReadLine();\n int i= Ques.Length-2;\n while (!Char.IsLetter(Ques[i])) i--;\n if ((Ques[i] == 'a') || (Ques[Ques.Length - 2] == 'o') || (Ques[Ques.Length - 2] == 'u') || (Ques[Ques.Length - 2] == 'e') || (Ques[Ques.Length - 2] == 'i') || (Ques[Ques.Length - 2] == 'y') || (Ques[Ques.Length - 2] == 'A') || (Ques[Ques.Length - 2] == 'O') || (Ques[Ques.Length - 2] == 'U') || (Ques[Ques.Length - 2] == 'E') || (Ques[Ques.Length - 2] == 'I') || (Ques[Ques.Length - 2] == 'Y')) \n Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Translation\n{\n class Program\n {\n static void Main(string[] args)\n {\n string c = Console.ReadLine();\n c.ToUpper();\n char[] r= c.ToCharArray();\n for (int i = r.Length - 1; i >= 1; i--)\n {\n if (r[i]== ' ' || r[i]=='?')\n {\n continue;\n }\n else if (r[i]=='A'||r[i]=='E' ||r[i]=='I' ||r[i]=='O' ||r[i]=='U' ||r[i]=='Y')\n {\n Console.Write(\"YES\"+\"\\n\");\n break;\n }\n else\n {\n Console.Write(\"NO\" + \"\\n\");\n break;\n }\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Translation\n{\n class Program\n {\n static void Main(string[] args)\n {\n string c = Console.ReadLine();\n c.ToLower();\n char[] r= c.ToCharArray();\n for (int i = r.Length - 1; i >= 1; i--)\n {\n if (r[i]== ' ' || r[i]=='?')\n {\n continue;\n }\n else if (r[i]=='a'||r[i]=='e' ||r[i]=='i' ||r[i]=='o' ||r[i]=='u' ||r[i]=='y')\n {\n Console.Write(\"YES\"+\"\\n\");\n }\n else\n {\n Console.Write(\"NO\" + \"\\n\");\n }\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Translation\n{\n class Program\n {\n static void Main(string[] args)\n {\n string c = Console.ReadLine();\n c.ToLower();\n char[] r= c.ToCharArray();\n for (int i = r.Length - 1; i >= 1; i--)\n {\n if (r[i]== ' ' || r[i]=='?')\n {\n continue;\n }\n else if (r[i]=='a'||r[i]=='e' ||r[i]=='i' ||r[i]=='o' ||r[i]=='u' ||r[i]=='y')\n {\n Console.Write(\"YES\"+\"\\n\");\n break;\n }\n else\n {\n Console.Write(\"NO\" + \"\\n\");\n break;\n }\n }\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog\n{\n class Program\n {\n static void Main()\n {\n string s;\n s = Console.ReadLine();\n char c = s[s.Length - 2];\n if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace prog\n{\n class Program\n {\n static void Main()\n {\n string s;\n s = Console.ReadLine();\n s = s.ToUpper();\n char c = s[s.Length - 2];\n if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y')\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Search\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tChar[] G = {'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y'};\n\t\t\tstring str = Console.ReadLine();\n\t\t\tint a=str.IndexOf(\"?\");\n\t\t\tif(a>-1)\n\t\t\t{\n\t\t\t\tchar b = str[a-1];\n\t\t\t\tif(Array.IndexOf(G,b)!=-1)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t}else Console.WriteLine(\"NO\");\n\t\t\t\t\n\t\t\t}\n\t\t\telse return;\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\n\nnamespace Search\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tChar[] G = {'A', 'E', 'I', 'O', 'U', 'Y', 'a', 'e', 'i', 'o', 'u', 'y'};\n\t\t\tstring str = Console.ReadLine();\n\t\t\tint a=str.IndexOf(\"?\");\n\t\t\tif(a>-1)\n\t\t\t{\n\t\t\t\tchar b = str[a-1];\n\t\t\t\tfor(int i=a-1;i>=0;i--)\n\t\t\t\t{\n\t\t\t\t\t//if(str[a-i].ToString().is)\n\t\t\t\t\tif (System.Text.RegularExpressions.Regex.IsMatch(str[i].ToString(),@\"[a-z]\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(Array.IndexOf(G,str[i])!=-1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}else \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t}\n\t\t\telse return;\n\t\t}\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input_Value = Console.ReadLine();\n input_Value= input_Value.ToLower();\n input_Value = input_Value.Replace(\" \",\"\");\n int len = input_Value.Length;\n List voules = new List() { 'a', 'o', 'i', 'e', 'y' };\n if(voules.Contains (input_Value [len-2]))\n Console .WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input_Value = Console.ReadLine();\n input_Value= input_Value.ToLower();\n int len = input_Value.Length;\n List voules = new List() { 'a', 'o', 'i', 'e', 'y' };\n if(voules.Contains (input_Value [len-2]))\n Console .WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input_Value = Console.ReadLine();\n input_Value= input_Value.ToLower();\n input_Value = input_Value.Replace(' ','X');\n int len = input_Value.Length;\n List voules = new List() { 'a', 'o', 'i', 'e', 'y' };\n if(voules.Contains (input_Value [len-2]))\n Console .WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().Replace(\" \",\"\");\n char[] c = new char[] { 'a', 'e', 'u', 'i', '0', 'y' };\n Console.WriteLine(c.Contains(s[s.Length - 2]) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine().Replace(\" \",\"\").ToLower();\n char[] c = new char[] { 'a', 'e', 'u', 'i', '0', 'y' };\n Console.WriteLine(c.Contains(s[s.Length - 2]) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A.\u0421\u044b\u0449\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int i = s.Length-2;\n while (i>0)\n {\n if (s[i] != ' ')\n {\n if (s[i] == 'a' || s[i] == 'A' || s[i] == 'i' || s[i] == 'I' || s[i] == 'o' || s[i] == 'O' || s[i] == 'e' || s[i] == 'E' || s[i] == 'u' || s[i] == 'U' || s[i] == 'y' || s[i] == 'Y')\n {\n Console.WriteLine(\"YES\");\n break;\n }\n else\n {\n Console.WriteLine(\"NO\");\n break;\n }\n }\n i--;\n }\n }\n }\n}\n"}], "src_uid": "dea7eb04e086a4c1b3924eff255b9648"} {"source_code": "/*\n * \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0432 SharpDevelop.\n * \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c: admin\n * \u0414\u0430\u0442\u0430: 01.02.2013\n * \u0412\u0440\u0435\u043c\u044f: 22:20\n * \n * \u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441 | \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 | \u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 | \u041f\u0440\u0430\u0432\u043a\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432.\n */\n\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System;\n\nnamespace reshenie\n{\n\tclass Program\n\t{\n\t\tpublic static int ReadInt(){\n\t\t\t\n\t\t\t\treturn int.Parse(Console.ReadLine());\n\t\t\t\t\t\t\n\t\t\t}\t\t\t\t\t\n\t\t\t\t\n\t\tpublic static string[] ReadStrArr(){\n\t\t\t\n\t\t\t\treturn Console.ReadLine().Split(' ');\n\t\t\t\t\n\t\t\t}\n\t\t\n\t public static int ToInt(Object a){\n\t\t\t\t\n\t\t\treturn int.Parse(a.ToString());\n\t\t\t\t\n\t\t\t}\t\n\t\n\t\tpublic static void print(int[] mas){\n\t\n\t\tfor (int i =0;i= j && t <= n) ans++;\n }\n Console.WriteLine(ans);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var n = NextInt();\n var n2 = n *n;\n int res = 0;\n for (int a = 1; a <= n; a++)\n {\n for (int b = a; b <= n; b++)\n {\n var c2 = a * a + b * b;\n var sq2 = (int)Math.Sqrt(c2);\n if (c2 <= n2 && (sq2*sq2) == c2)\n {\n res++;\n }\n }\n }\n\n Console.WriteLine(res);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF183A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int res = 0;\n for (var a = 1; a < n; a++)\n {\n var bmax = Math.Sqrt(Math.Truncate((double)(n * n - a * a)));\n for (var b = a; b <= bmax; b++)\n {\n var result = (double)(a * a + b * b);\n var c = Math.Truncate(result);\n var cSqr = Math.Sqrt(c);\n var CTrunc = Math.Truncate(cSqr);\n if (cSqr == CTrunc && c <= n * n)\n res++;\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problem304\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numb = int.Parse(Console.ReadLine());\n int countResult = 0;\n\n for (int a = 1; a <= numb; a++)\n {\n int b = a;\n int c = (int)Math.Sqrt(a * a + b * b);\n\n while (c <= numb && b <= c)\n {\n if ((a*a + b*b) == (c*c)) \n countResult++;\n\n b++;\n c = (int)Math.Sqrt(a * a + b * b);\n }\n }\n\n Console.Write(countResult);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program_158A\n{\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine()), ans = 0;\n for (int i = 2; i < n; i++)\n for (int j = i + 1; j != n; j++)\n if ((Math.Sqrt(i * i + j * j) % 1 == 0) && (Math.Sqrt(i * i + j * j) <= n)) ans++;\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n\n var result = 0;\n for (var b = 1; b < number; b++)\n {\n for (var a = b + 1; a <= number; a++)\n {\n var c = Math.Sqrt(a * a - b * b);\n\n if (Math.IEEERemainder(c, 1) == 0)\n {\n result++;\n }\n }\n }\n\n Console.WriteLine(result / 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public static class MainClass\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n\n var result = 0;\n Parallel.For(1, number, b =>\n {\n for (var a = b + 1; a <= number; a++)\n {\n var c = Math.Sqrt(a * a - b * b);\n\n if (Math.IEEERemainder(c, 1) == 0)\n {\n result++;\n }\n }\n });\n\n Console.WriteLine(result / 2);\n }\n }\n}"}, {"source_code": "using System;\n\nclass P { \n static void Main() {\n var n = int.Parse(Console.ReadLine());\n var res = 0;\n for (var c = n; c >= 1; c--) for (var b = c ; b >= 1 ; b--) {\n var sa = c*c-b*b;\n var a = (int)Math.Sqrt(sa);\n if ((a*a == sa && a >= 1 && a <= b) || (a*a+2*a+1==sa &&a+1>=1 &&a+1 <=b)) res++;\n }\n Console.Write(res);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Pythagorean_Theorem\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n + 1];\n for (int i = 0; i <= n; i++)\n {\n nn[i] = i*i;\n }\n\n int count = 0;\n for (int c = 1; c <= n; c++)\n {\n for (int b = c-1; b > 0; b--)\n {\n int a = nn[c] - nn[b];\n if (a <= nn[b])\n {\n if (Array.BinarySearch(nn, a) > 0)\n count++;\n }\n else\n {\n break;\n }\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n const double EPS = 1e-7;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n return (b != 0) ? gcd(b, a % b) : a;\n }\n static void swap(ref int a, ref int b)\n {\n int t = a;\n a = b;\n b = t;\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) == 1)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _a()\n {\n int n = int.Parse(reader.ReadLine());\n //SortedSet p = new SortedSet();\n Dictionary p = new Dictionary();\n for (int i = 1; i <= n; ++i)\n p.Add(i * i, true);//p[i * i] = 1;//p.Add(i*i);\n int count = 0;\n for (int i = 1; i <= n; ++i)//foreach (int p1 in p)\n {\n for (int j = 1; j < i; ++j)//foreach (int p2 in p)\n {\n int p1 = i * i, p2 = j * j;\n if (p2 > p1 / 2)\n break;\n if (p.ContainsKey(p1-p2))//(p.Contains(p1 - p2))\n ++count;\n }\n }\n writer.Write(count);\n }\n static void _b()\n {\n\n }\n static void _c()\n {\n \n }\n static void _d()\n {\n\n }\n static void Main(string[] args)\n {\n _a();\n reader.Close();\n writer.Close();\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ProblemA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0;\n for (int i = 1; i <= n; i++)\n {\n for (int j = i; j <= n; j++)\n {\n int temp = i * i + j * j;\n int t = (int)Math.Sqrt(temp);\n if (t * t - temp == 0 && t <= n)\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int ans = 0;\n for(int a = 1; a <= n; a++) {\n for(int b = a; b <= n; b++) {\n long c2 = (long) a * a + (long) b * b;\n long c = (long) Math.Sqrt(c2);\n if(c * c != c2)\n continue;\n if(c > n)\n continue;\n ans++;\n }\n }\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int n = ReadInt();\n long ans = 0;\n HashSet hs = new HashSet();\n for (int i = 1; i <= n; i++)\n hs.Add(i * i);\n for (int c = 1; c <= n; c++)\n {\n for (int a = 1; ; a++)\n {\n if (a * a > (c * c - a * a)) break;\n if (hs.Contains(c * c - a * a)) ans++;\n }\n }\n Console.WriteLine(ans);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);//\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace codenoobs_studio_hammer_man_69\n{\n class Program\n {\n static void Main(string[] args)\n {\n //var Watch = new System.Diagnostics.Stopwatch();\n\n double n = int.Parse(Console.ReadLine());\n\n //Watch.Start();\n\n int count = 0;\n for (int q = 1; q < Math.Sqrt(n/2); q++) {\n for (int p = q + 1; p <= Math.Sqrt(n - q * q); p++) {\n if (Coprime(p, q) && p % 2 != q % 2) {\n count += (int) Math.Floor(n/(p*p + q*q));\n }\n }\n }\n\n Console.WriteLine(count);\n //Watch.Stop();\n //Console.WriteLine(Watch.ElapsedMilliseconds);\n\n\n }\n\n static bool Coprime(int m, int n) {\n if (m == 1 || n == 1) return true;\n if (m == 0 || n == 0) return false;\n\n if (m < n) return Coprime(m, n % m);\n return Coprime(m % n, n);\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int n = ReadInt();\n long ans = 0;\n HashSet hs = new HashSet();\n for (int i = 1; i <= n; i++)\n hs.Add(i * i);\n for (int c = 1; c <= n; c++)\n {\n for (int a = 1; ; a++)\n {\n if (a * a > (c * c - a * a)) break;\n if (hs.Contains(c * c - a * a)) ans++;\n }\n }\n Console.WriteLine(ans);\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\n\n\n\n class Program\n {\n static void Main(string[] args)\n {int an = 0;\n\n for (float n = Convert.ToInt32(Console.ReadLine()); n > 0; n--) {\n\n for (float a = 1; a <= Math.Sqrt(n*n / 2); a++) { \n double b = Math.Sqrt(n*n-a*a);\n if ((b % 1.0) == 0) an++;\n\n }\n \n \n }\n\n Console.WriteLine(an);\n \n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Program {\n\tstatic void Main() {\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tint[] a = new int[10001];\n\t\tfor(int i = 1; i < a.Length; i++){\n\t\t\ta[i] = i * i;\n\t\t}\n\t\tint c = 0;\n\t\tfor(int i = 1; i <= n; i++){\n\t\t\tfor(int j = 1; j <= n; j++){\n\t\t\t\tdouble tmp = Math.Sqrt(a[i] + a[j]);\n\t\t\t\tif(a[i] > a[j] && tmp % 1 == 0){\n\t\t\t\t\tif(tmp <= n){\n\t\t\t\t\t\tc++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(c);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _304A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int results = 0;\n for (int b = 1; b < n; b++)\n {\n for (int a = 1; a <= b; a++)\n {\n if ((double)Math.Sqrt(a * a + b * b) == (int)Math.Sqrt(a * a + b * b) && Math.Sqrt(a * a + b * b) <= n)\n {\n results++;\n }\n }\n }\n Console.Write(results);\n }\n }\n}\n"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: IdM\n * Date: 12.05.2013\n * Time: 16:43\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\n\nnamespace r183_1\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring str = Console.ReadLine();\n\t\t\tint n = int.Parse(str);\n\t\t\tint cnt = 0;\n\t\t\t\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tfor (int j = i; j <= n; j++) {\n\t\t\t\t\tdouble fl = Math.Sqrt((i*i + j*j));\n\t\t\t\t\tif (fl == (int)fl) {\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t}\n\t\t\t\t\tif (fl > n) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(cnt);\n\t\t\t\n//\t\t\tConsole.Write(\"Press any key to continue . . . \");\n//\t\t\tConsole.ReadKey(true);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Dictionary dic = new Dictionary();\n int res = 0;\n for (int i = 1; i <= n; i++)\n dic.Add(i * i, i);\n for (int i = 1; i < n; i++)\n for (int j = i + 1; j < n; j++)\n if (dic.ContainsKey(i * i + j * j)) res++;\n Console.WriteLine(res.ToString());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var c = 0;\n for (int i = 2; i < n; i++)\n for (int j = i; j < n; j++)\n if (Math.Sqrt(i * i + j * j) <= n && Math.Sqrt(i * i + j * j) == (int)Math.Sqrt(i * i + j * j)) c++;\n Console.WriteLine(c);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _304A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n\n int count = 0;\n\n for (int a = 1; a <= n; a++)\n {\n for (int b = a; b <= n; b++)\n {\n int c = (int)Math.Sqrt(a * a + b * b);\n\n if (c <= n && a * a + b * b == c * c)\n {\n count++;\n }\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace ConsoleApplication30\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n\n // end Isqrt() \n \n\n int n = ReadInt();\n int counter = 0;\n// int n = (int)Math.Ceiling(Math.Sqrt(t));\n for (int a = 1; a <= n; a++)\n {\n for (int b = a; b <= n; b++)\n {\n double issqrt = Math.Sqrt(a*a + b*b);\n if (issqrt %1 == 0 && issqrt * issqrt == (a * a + b * b) && issqrt <= n)\n {\n counter++;\n }\n \n// }\n }\n }\n Console.WriteLine(counter);\n Console.ReadLine();\n }\n\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n\n private static void Read(out int n1, out int n2, out int n3)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n\n private static void Read(out int n1, out int n2, out int n3, out int n4)\n {\n string[] input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n n4 = int.Parse(input[3]);\n }\n\n private static void Read(out T a1, out T a2)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n string[] input = ReadArray();\n a1 = (T) Convert.ChangeType(input[0], typeof (T));\n a2 = (T) Convert.ChangeType(input[1], typeof (T));\n a3 = (T) Convert.ChangeType(input[2], typeof (T));\n a4 = (T) Convert.ChangeType(input[3], typeof (T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T) Convert.ChangeType(Read(), typeof (T));\n }\n\n private static string[] ReadArray()\n {\n string readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n\n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication27\n{\n class Program\n {\n static void Main(string[] args)\n { \n int n = int.Parse(Console.ReadLine());\n int res = 0;\n for (int a = 1; a <= n; a++)\n for (int b = 1; b <= n; b++){\n var c = Math.Sqrt(a * a + b * b);\n if ((c <= n) && (c - Math.Truncate(c) == 0) && (a <= b) && (b <= c))\n res += 1;\n }\n Console.WriteLine(res);\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ans=0,check,K1,V,N = int.Parse(Console.ReadLine());\n double try1;\n \n for(int i=1;i<=N;++i) \n for (int j = i; j <= N; ++j)\n {\n V = i * i + j * j;\n try1 = Math.Sqrt(V);\n check = Convert.ToInt32(try1);\n if (check * check == V)\n {\n if (check <= N) ++ans;\n }\n else\n {\n ++check;\n if (check * check == V && check <= N) ++ans;\n }\n }\n\n Console.WriteLine(\"{0}\",ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class A\n {\n public void Run()\n {\n int n = int.Parse(Console.ReadLine());\n ulong re = 0, of = 0; \n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n //string str = Console.ReadLine();\n\n\n for (int k = 1; k <= n; k++)\n {\n for (int i = 1; i <= 10000; i++) \n {\n int j = k * k - i * i;\n var sqr = (int)Math.Sqrt(j);\n\n if ((j > 0) && (j == sqr * sqr))\n {\n re+=1;\n if (sqr != i)\n {\n of+=1;\n }\n }\n else \n if (j < 0)\n {\n break;\n }\n }\n }\n ulong rez = re - of/2;\n\n Console.Write(rez); \n }\n }\n class B\n { \n public void Run()\n { \n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n A a = new A();\n a.Run(); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0422\u0435\u043e\u0440\u0435\u043c\u0430_\u041f\u0438\u0444\u0430\u0433\u043e\u0440\u0430_II\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int64 n;\n n = Convert.ToInt64(Console.ReadLine());\n Int64 sqn = n * n;\n Int64 a, b, c, ret = 0;\n double sqc;\n for (a = 1; a <= n; a++)\n for (b = a; b <= n; b++)\n {\n c = a * a + b * b;\n sqc = Math.Sqrt(c);\n if (c <= sqn)\n {\n if ((int)sqc == sqc) ret++;\n }\n else break;\n }\n Console.Write(ret);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R183_Div2_A\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n int a,b,c, cnt=0;\n int x;\n for (a = 1; a <= num; a++)\n for (b = a+1; b <= num; b++)\n {\n c = a * a + b * b;\n x = (int)(Math.Sqrt((double)c) + 1e-8);\n if (x * x == c && x <= num)\n {\n //Console.WriteLine(a + \" \" + b + \" \" + x);\n cnt++;\n }\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt32(Console.ReadLine());\n int a, b, Count = 0;\n for (a = 1; a <= n; a++)\n for (b = a; b <= n; b++)\n if ((Math.Sqrt(a * a + b * b) == Math.Round(Math.Sqrt(a * a + b * b))) && (Math.Sqrt(a * a + b * b) <= n))\n Count++;\n Console.WriteLine(Count);\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class Ppair\n\t\t{\n\t\t\tpublic char Symbol;\n\n\t\t\tpublic int Count;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static int GetGcd(int a, int b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tConsole.WriteLine(x ? yes : no);\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Edge\n\t\t{\n\t\t\tpublic int Color;\n\n\t\t\tpublic int To;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tWas = 0;\n\t\t\t\tEdges = new List();\n\t\t\t}\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static void Dfs(int u, int c)\n\t\t{\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges.Where(x => x.Color == c && Graph[x.To].Was == 0))\n\t\t\t{\n\t\t\t\tDfs(t.To, c);\n\t\t\t}\n\n\t\t}\n\n\t\tpublic static bool IsPrime(long x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int GetAns(int x, int pow)\n\t\t{\n\t\t\tif (pow == 0)\n\t\t\t\treturn 1;\n\t\t\tif (pow % 2 == 1)\n\t\t\t\treturn (GetAns(x, pow - 1) * 8) % 10;\n\t\t\tvar t = GetAns(x, pow / 2);\n\t\t\treturn (t * t) % 10;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = ReadInt();\n\t\t\tvar ans = 0;\n\t\t\tfor (var i = 1; i <= n; ++i)\n\t\t\t{\n\t\t\t\tfor (var j = i; j <= n; ++j)\n\t\t\t\t{\n\t\t\t\t\tvar x = i * i + j * j;\n\t\t\t\t\tvar xx = (int)Math.Sqrt(x);\n\t\t\t\t\tif (x == xx * xx && xx <= n)\n\t\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\tConsole.ReadLine();\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ACM\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int ans = 0;\n for(int i=1;i<=n;++i)\n for (int j = i; j <= n; ++j)\n {\n int c = i * i + j * j;\n int t = (int)Math.Sqrt(c+1e-5);\n if (t*t==c && t >= j && t<=n) ans++;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class A\n {\n public void Run()\n {\n int n = int.Parse(Console.ReadLine());\n ulong re = 0, of = 0; \n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n //string str = Console.ReadLine();\n\n\n for (int k = 1; k <= n; k++)\n {\n for (int i = 1; i <= 10000; i++) \n {\n int j = k * k - i * i;\n var sqr = (int)Math.Sqrt(j);\n\n if ((j > 0) && (j == sqr * sqr))\n {\n re+=1;\n if (sqr != i)\n {\n of+=1;\n }\n }\n else \n if (j < 0)\n {\n break;\n }\n }\n }\n ulong rez = re - of/2;\n\n Console.Write(rez); \n }\n }\n class B\n { \n public void Run()\n { \n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n A a = new A();\n a.Run(); \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static void Main(string[] args)\n {\n int ub = ReadIntLine();\n int k = (int)Math.Ceiling(Math.Sqrt(ub));\n\n\n HashSet set = new HashSet();\n\n for (int m = 1; m < k; m++)\n {\n for (int n = 1; n < m; n++)\n {\n if (gcd(n, m) == 1)\n {\n int c = m * m + n * n;\n int b = Math.Max(m * m - n * n,2*m*n);\n int a = Math.Min(m * m - n * n, 2 * m * n);\n\n int cc = c, bb = b, aa = a;\n \n while (cc<=ub)\n {\n //PrintLn(aa,bb,cc);\n set.Add(aa + \",\" + bb);\n aa += a;\n bb += b;\n cc += c;\n }\n }\n }\n }\n\n\n PrintLn(set.Count);\n\n }\n\n\n }\n\n\n\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\nclass Program_158A\n{\n static void Main()\n {\n int[] a = new int[0];\n int b = Convert.ToInt32(Console.ReadLine()), sum = 0;\n int bound = (int)(Math.Sqrt(b));\n for (int i = 1; i < bound; i++)\n for (int j = i + 1; j < bound; j++)\n {\n\n if ((IsPrime(i) | IsPrime(j)) & ((j - i) % 2 == 1) & (j % i != (i == 1 ? 1 : 0)))\n {\n Array.Resize(ref a, a.Length + 1);\n a[a.Length - 1] = i * i + j * j;\n }\n }\n a = a.Select(x => x).Where(x => x <= b).ToArray();\n Array.Sort(a);\n for (int i = 0; i < a.Length; sum += b / a[i++]) ;\n Console.WriteLine(sum);\n }\n static bool IsPrime(int x)\n {\n for (int ii = 2; ii <= x / ii; ii++)\n if ((x % ii) == 0) return false;\n return true;\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt32(Console.ReadLine());\n int a, b, Count = 0;\n for (a = 1; a <= n; a++)\n for (b = a; b <= n; b++)\n if (Math.Sqrt(a * a + b * b) <= n) Count++;\n Console.WriteLine(Count);\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program {\n static void Main(string[] args) {\n double n = int.Parse(Console.ReadLine());\n int count = 0;\n for (int q = 1; q < Math.Sqrt(n/2); q++) {\n for (int p = q + 1; p <= Math.Sqrt(n - q * q); p++) {\n if (Coprime(p, q) && p % 2 != q % 2) {\n count += (int) Math.Floor(n/(p*p + q*q));\n }\n }\n }\n }\n \n static bool Coprime(int m, int n) {\n if (m == 1 || n == 1) return true;\n if (m == 0 || n == 0) return false;\n \n if (m < n) return Coprime(m, n % m);\n return Coprime(m % n, n);\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class A\n {\n public void Run()\n {\n int n = int.Parse(Console.ReadLine());\n //int[] m = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n //string str = Console.ReadLine();\n\n ulong rez = 0;\n ulong off = 0; \n\n for (int k = 1; k <= n; k++)\n {\n for (int i = 1; i <= 10000; i++) \n {\n double j = k * k - i * i;\n double sqr = Math.Sqrt(j);\n\n if ((j > 0) && (sqr * sqr == j))\n {\n rez+=1;\n if (sqr != i)\n {\n off += 1;\n }\n }\n else \n if (j < 0)\n {\n break;\n }\n }\n }\n ulong rez2 = rez - off / 2;\n\n Console.Write(rez2); \n }\n }\n class B\n { \n public void Run()\n { \n int[] str = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n int[] str2 = Console.ReadLine().Split(':').Select(a => int.Parse(a)).ToArray();\n\n DateTime d1 = new DateTime(str[0], str[1], str[2]);\n DateTime d2 = new DateTime(str2[0], str2[1], str2[2]);\n\n TimeSpan ts = d2 - d1;\n\n Console.WriteLine(Math.Abs(ts.Days));\n }\n }\n\n class Programm\n {\n static void Main(string[] args)\n {\n A a = new A();\n a.Run(); \n }\n }\n}"}], "src_uid": "36a211f7814e77339eb81dc132e115e1"} {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace DreamoonAndWifi\n{\n partial class DreamoonAndWifi\n {\n static int[] position = new int[21];\n\n static void Main(string[] args)\n {\n string s1, s2, answer;\n int final = 10;\n\n s1 = ReadLine();\n s2 = ReadLine();\n\n foreach (char command in s1)\n {\n if (command == '+')\n final++;\n else\n final--;\n }\n\n Solve(10, 0, s2);\n answer = string.Format(\"{0:0.000000000000}\", (double)position[final] / (double)position.Sum()).Replace(\",\", \".\");\n Console.WriteLine(answer);\n }\n\n private static void Solve(int currentPosition, int index, string commands)\n {\n if (index == commands.Length)\n {\n position[currentPosition]++;\n }\n else\n {\n switch (commands[index])\n {\n case '+':\n Solve(++currentPosition, index + 1, commands);\n break;\n\n case '-':\n Solve(--currentPosition, index + 1, commands);\n break;\n\n case '?':\n Solve(currentPosition + 1, index + 1, commands);\n Solve(currentPosition - 1, index + 1, commands);\n break;\n }\n }\n }\n }\n\n partial class DreamoonAndWifi\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace R_B_272\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine(), s2 = Console.ReadLine();\n int t = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') t++;\n else t--;\n }\n int[][] a = new int[25][];\n a[0] = new int[1];\n a[0][0] = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s2[i] == '?')\n {\n a[i + 1] = new int[a[i].Length * 2];\n int j = 0, z = 0;\n while (j < a[i].Length)\n {\n a[i + 1][z] = a[i][j] - 1;\n z++;\n a[i + 1][z] = a[i][j] + 1;\n z++;\n j++;\n }\n }\n else\n {\n a[i + 1] = new int[a[i].Length];\n if (s2[i] == '+')\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] + 1;\n }\n }\n else\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] - 1;\n }\n }\n }\n }\n\n double count = 0;\n for (int i = 0; i < a[s2.Length].Length; i++)\n {\n if (a[s2.Length][i] == t) count++;\n }\n double d = (count / a[s2.Length].Length) % 1000000000;\n Console.WriteLine(d.ToString(System.Globalization.CultureInfo.GetCultureInfo(\"en-US\")));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nnamespace prB {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static long v = 0;\n\n static void Perebor(int q, int dr, ref int orig) {\n if(q == 0) {\n if(dr == orig)\n v++;\n return;\n }\n Perebor(q - 1, dr + 1, ref orig);\n Perebor(q - 1, dr - 1, ref orig);\n }\n\n static void Main(string[] args) {\n string s1 = reader.ReadLine();\n string s2 = reader.ReadLine();\n int orig = 0;\n foreach(char c in s1) {\n switch(c) {\n case '+':\n orig++;\n break;\n case '-':\n orig--;\n break;\n }\n }\n int dr = 0;\n int q = 0;\n foreach(char c in s2) {\n switch(c) {\n case '+':\n dr++;\n break;\n case '-':\n dr--;\n break;\n case '?':\n q++;\n break;\n }\n }\n\n Perebor(q, dr, ref orig);\n long all = (long) Math.Pow(2, q);\n double ans = v / (double) all;\n string result = ans.ToString(new NumberFormatInfo {NumberDecimalSeparator = \".\"});\n writer.WriteLine(result);\n\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.Dynamic\n{\n class _476B\n {\n public static int Main()\n {\n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var possible = new List();\n possible.Add(s2);\n for(var i = 0; i < s2.Length; i++)\n {\n if(s2[i] == '?')\n {\n var newAll = new List();\n for (var j = 0; j < possible.Count; j++)\n {\n var cur = possible[j].ToCharArray().ToArray();\n cur[i] = '+';\n newAll.Add(new string(cur));\n cur[i] = '-';\n newAll.Add(new string(cur));\n }\n possible = newAll;\n }\n }\n var result = 0;\n for(var i = 0; i < s1.Length; i++)\n {\n if(s1[i] == '-')\n {\n result -= 1;\n } else\n {\n result += 1;\n }\n }\n double good = 0;\n for(var i = 0; i < possible.Count; i++)\n {\n var res = 0;\n for(var j = 0; j < possible[i].Length; j++)\n {\n if(possible[i][j] == '-')\n {\n res -= 1;\n } else\n {\n res += 1;\n }\n }\n if(res == result)\n {\n good++;\n }\n }\n Console.WriteLine((good/possible.Count).ToString().Replace(',', '.'));\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.Dynamic\n{\n class _476B\n {\n public static int Main()\n {\n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var possible = new List();\n possible.Add(s2);\n for(var i = 0; i < s2.Length; i++)\n {\n if(s2[i] == '?')\n {\n var newAll = new List();\n for (var j = 0; j < possible.Count; j++)\n {\n var cur = possible[j].ToCharArray().ToArray();\n cur[i] = '+';\n newAll.Add(new string(cur));\n cur[i] = '-';\n newAll.Add(new string(cur));\n }\n possible = newAll;\n }\n }\n var result = 0;\n for(var i = 0; i < s1.Length; i++)\n {\n if(s1[i] == '-')\n {\n result -= 1;\n } else\n {\n result += 1;\n }\n }\n double good = 0;\n for(var i = 0; i < possible.Count; i++)\n {\n var res = 0;\n for(var j = 0; j < possible[i].Length; j++)\n {\n if(possible[i][j] == '-')\n {\n res -= 1;\n } else\n {\n res += 1;\n }\n }\n if(res == result)\n {\n good++;\n }\n }\n Console.WriteLine((good/possible.Count).ToString(System.Globalization.CultureInfo.InvariantCulture));\n return 0;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n\n static int suc_Event = 0;\n static int end_Pos = 0;\n static void Main(string[] args)\n {\n string str_Correct = Console.ReadLine();\n string str_Unverified = Console.ReadLine();\n int pos = 0;\n int num_unKnown = 0;\n\n foreach (char map in str_Correct)\n {\n switch (map)\n {\n case '+':\n end_Pos++;\n break;\n case '-':\n end_Pos--;\n break;\n }\n }\n\n\n foreach (char map in str_Unverified)\n {\n switch (map)\n {\n case '+': \n pos++;\n break;\n case '-':\n pos--;\n break;\n case '?':\n num_unKnown++;\n break;\n }\n }\n\n Move(pos, num_unKnown);\n\n string str_probability = string.Format(\"{0:0.000000000000}\", (double)suc_Event / (double)Math.Pow(2,num_unKnown)).Replace(',','.');\n Console.Write(str_probability);\n Console.Read();\n\n }\n\n\n private static void Move(int CurrentPos,int num_unKnown)\n {\n if (num_unKnown >= 1)\n {\n Move(CurrentPos+1, num_unKnown-1);\n Move(CurrentPos-1, num_unKnown-1); \n }\n else if (CurrentPos == end_Pos)\n {\n suc_Event++;\n }\n }\n }\n\n\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n string s1 = ReadToken();\n string s2 = ReadToken();\n\n var dp = new double[21];\n dp[10] = 1;\n foreach (char c in s2)\n {\n var ndp = new double[21];\n for (int i = 1; i < 20; i++)\n {\n if (c == '+')\n ndp[i + 1] += dp[i];\n else if (c == '-')\n ndp[i - 1] += dp[i];\n else\n {\n ndp[i - 1] += dp[i] / 2;\n ndp[i + 1] += dp[i] / 2;\n }\n }\n dp = ndp;\n }\n\n int t = 10 + s1.Sum(c => c == '+' ? 1 : -1);\n return dp[t].ToString(CultureInfo.InvariantCulture);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n// reader = new StreamReader(\"army.in\");\n// writer = new StreamWriter(\"army.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Dreamoon and WiFi\n* URL : http://codeforces.com/problemset/problem/476/B\n* Occasion : Codeforces Round #273 (Div. 2)\n* Date : Sep 13 2017\n* Complexity : O(n) 46ms, Space O(n)\n* Author : Atiq Rahman\n* Status : Accepted\n* Notes : input limit 10^9 requires larger data type than int\n* meta : tag-combinatories, tag-math, tag-easy\n***************************************************************************/\nusing System;\nusing System.Globalization;\n\nclass ProbComb {\n int d;\n int d2;\n int q;\n double positive_count;\n\n // Take input strings and represent them in d, d2 and q\n public void TakeInput() {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n d = d2 = q = 0;\n positive_count = 0;\n foreach (char ch in s1)\n switch (ch) {\n case '+':\n d++; break;\n case '-':\n d--; break;\n default:\n break;\n }\n foreach (char ch in s2)\n switch (ch) {\n case '+':\n d2++; break;\n case '-':\n d2--; break;\n case '?':\n q++; break;\n default:\n break;\n }\n }\n\n public double GetProbability() {\n if (Math.Abs(d - d2) > q)\n return 0.0;\n Comb(d2, 0);\n double res = positive_count / (q==0?1:Math.Pow(2, q));\n return res;\n }\n\n public void Comb(int v, int k) {\n if (k == q) {\n if (v == d)\n positive_count++;\n return;\n }\n Comb(v + 1, k+1);\n Comb(v - 1, k+1);\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n ProbComb PC = new ProbComb();\n PC.TakeInput();\n Console.WriteLine(PC.GetProbability().ToString(\"F12\", CultureInfo.CreateSpecificCulture(\"en-US\")));\n // Console.WriteLine(PC.GetProbability());\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\npublic static class solver\n{\n class Pos\n {\n public int X = 0;\n public double Prob = 1;\n }\n\n static void AddCmd(List variants, char cmd)\n {\n if (cmd == '+') {\n foreach (var pos in variants) {\n pos.X += 1;\n }\n }\n else if (cmd == '-') {\n foreach (var pos in variants) {\n pos.X -= 1;\n }\n }\n else {\n var additional = variants.Select(p => new Pos { X = p.X + 1, Prob = p.Prob / 2 }).ToArray();\n foreach (var pos in variants) {\n pos.X -= 1;\n pos.Prob /= 2;\n }\n variants.AddRange(additional);\n }\n }\n\n public static void Main()\n {\n var sent = Console.ReadLine();\n var recv = Console.ReadLine();\n\n var variants = new List();\n variants.Add(new Pos());\n foreach (var c in recv.ToCharArray()) {\n AddCmd(variants, c);\n }\n\n var correct = sent.ToCharArray().Sum(c => c == '+' ? 1 : -1);\n\n\n Console.WriteLine(variants.Sum(p => p.X == correct ? p.Prob : 0).ToString(\"R\", CultureInfo.InvariantCulture));\n \n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static int gcd(int a,int b)\n {\n while(a!=0&&b!=0)\n {\n if(a>b)\n a%=b;\n else\n b%=a;\n }\n if(a==0)\n return b;\n else\n return a;\n }\n static int Factorial(int x)\n {\n return (x == 0) ? 1 : x * Factorial(x - 1);\n }\n static void Main()\n {\n \n string q= Console.ReadLine();\n string w= Console.ReadLine();\n int n=0,m=0,v=0;\n for(int i=0;iv)\n Console.Write(0);\n else\n Console.Write(((double)(Factorial(v)/Factorial(v-(v-Math.Abs(n-m))/2)/Factorial((v-Math.Abs(n-m))/2))/Math.Pow(2,v)).ToString().Replace(',','.'));\n\n \n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Solving\n{\n class MyDictionary : Dictionary {\n public new TValue this[TKey key] {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.ReadKey();\n }\n }\n }\n\n class Solver {\n static int goodways = 0;\n static int finalpos = 0;\n public void Solve() {\n string str1 = InputReader.ReadString(), str2 = InputReader.ReadString();\n int currentpos = 0, allways;\n int countofvariants = 0;\n for (int i = 0; i < str1.Length; i++) {\n if (str1[i] == '+') finalpos++;\n else finalpos--;\n }\n for (int i = 0; i < str2.Length; i++) {\n if (str2[i] == '+') currentpos++;\n else if (str2[i] == '-') currentpos--;\n else if (str2[i] == '?') countofvariants++;\n }\n allways = (int)Math.Pow(2, countofvariants);\n GoodComb(currentpos, countofvariants);\n double ver= (double)goodways/(double)allways;\n string ans = String.Format(\"{0:f12}\", ver);\n ans = ans.Replace(\",\", \".\");\n //Console.WriteLine(goodways);\n //Console.WriteLine(allways);\n Console.Write(ans);\n //Console.ReadKey();\n }\n static void GoodComb(int cur, int countofask){\n if (countofask >= 1)\n {\n GoodComb(cur + 1, countofask - 1);\n GoodComb(cur - 1, countofask - 1);\n }\n else if (cur == finalpos) goodways++;\n }\n }\n\n class InputReader {\n public static int[] ReadIntArr() {\n return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n }\n public static string ReadString() {\n return Console.ReadLine();\n }\n public static long[] ReadLongArr() {\n return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray();\n }\n public static double[] ReadDoubleArr() {\n return Console.ReadLine().Split(' ').Select(s => Double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static string[] ReadSplitString() {\n return Console.ReadLine().Split(' ').ToArray();\n }\n public static int ReadInt() {\n return Int32.Parse(Console.ReadLine());\n }\n public static long ReadLong() {\n return Int64.Parse(Console.ReadLine());\n }\n public static double ReadDouble() {\n return Double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n public static int[][] ReadIntMatrix(int numberofrows) {\n int[][] matrix = new int[numberofrows][];\n for (int i = 0; i < numberofrows; i++) {\n matrix[i] = ReadIntArr();\n }\n return matrix;\n }\n public static string[] ReadStringLines(int numberoflines) {\n string[] arr = new string[numberoflines];\n for (int i = 0; i < numberoflines; i++) {\n arr[i] = Console.ReadLine().Trim();\n }\n return arr;\n }\n }\n\n class OutputWriter {\n public static void WriteArray(IEnumerable array) {\n Console.WriteLine(string.Join(\" \", array));\n }\n public static void WriteLines(IEnumerable array) {\n foreach (var a in array) { Console.WriteLine(a); }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n//using System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\nusing System.Globalization;\n\nnamespace _272_b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int d1 = 0;\n int d2 = 0;\n var d2list = new List();\n\n foreach(char sym in s1)\n {\n if (sym == '+')\n d1 += 1;\n else d1 -= 1;\n }\n\n int k = 0;\n foreach (char sym in s2)\n {\n if (sym == '+')\n d2 += 1;\n else \n if (sym == '-')\n d2 -= 1;\n else k++;\n }\n\n if(k != 0)\n {\n d2list.Add(d2);\n for (int i = k; i > 0; i--)\n {\n int count = d2list.Count;\n for (int j = 0; j < count; j++ )//????\n {\n d2list.Add(d2list[j] + 1);\n d2list.Add(d2list[j] - 1);\n }\n d2list.RemoveRange(0, count);\n /*d2list.Add(d2 + i);\n d2list.Add(d2 - i);*/\n }\n var t = d2list.FindAll(x => x == d1);\n\n if (t.Count != 0)\n {\n double res = (double)t.Count / (double)d2list.Count;\n Console.Write(res.ToString((CultureInfo.InvariantCulture)));\n }\n else Console.Write(0.0); \n }\n else\n {\n if (d1 != d2)\n Console.Write(0.0);\n else Console.Write(1.0);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 0m ;\n decimal total = 0m;\n total = (decimal)posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = correct/total;\n Console.WriteLine(prob.ToString(new NumberFormatInfo {NumberDecimalSeparator = \".\"}));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n\n\nnamespace contest\n{\n\n\n\n\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n\n //int n = int.Parse(Console.ReadLine());\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for (int i = 0; i < n; i++)\n //{\n // input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //}\n\n\n //int n = int.Parse(Console.ReadLine());\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n\n\n //int n = int.Parse(Console.ReadLine());\n //var arr = new int[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for(int i =0; i< n; i++)\n //{\n // arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //}\n\n\n\n\n //int n = int.Parse(Console.ReadLine());\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n //var arr = new int[n][];\n //for(int i =0; i< n; i++)\n //{\n // arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //}\n\n\n\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int t = num[0];\n //int k = num[1];\n\n\n\n string s = Console.ReadLine();\n string t = Console.ReadLine();\n int len = s.Length;\n\n int original = 0;\n for(int i=0; i< len; i++)\n {\n char cur = s[i];\n if (cur == '+') original++;\n else original--;\n\n }\n\n\n int dre = 0;\n int cntQ = 0;\n for (int i = 0; i < len; i++)\n {\n char cur = t[i];\n if (cur == '+') dre++;\n else if(cur == '-')dre--;\n else cntQ++;\n }\n\n double ans = 1.0;\n\n if(cntQ==0 && original==dre) Console.WriteLine(ans);\n else if (cntQ == 0 && original != dre) Console.WriteLine(0.0);\n else\n {\n int dif = Math.Abs(original-dre);\n if (dif > cntQ) ans = 0.0;\n else if (dif % 2 != cntQ % 2) ans = 0.0;\n else\n {\n double d = Math.Pow(2,cntQ);\n double count = 0.0;\n for(int i=0; i<(1<0)\n {\n if ((tmp & 1) == 1) cnt++;\n tmp >>= 1;\n }\n if ((cntQ-cnt) - (cnt) == dif) count++;\n }\n ans = count / d;\n }\n\n Console.WriteLine(ans.ToString(System.Globalization.CultureInfo.InvariantCulture));\n }\n\n \n \n\n\n\n\n //Console.WriteLine();\n\n\n\n\n\n\n\n\n }\n\n\n\n }\n\n\n class Segment\n {\n //public int[] arr;\n public Tuple[] arr;\n int n;\n\n public Segment(int n)\n {\n this.n = n * 2;\n //arr = Enumerable.Range(0, n*2).ToArray();\n //arr = new int[this.n];\n arr = new Tuple[this.n];\n for (int i = 0; i < this.n; i++)\n {\n arr[i] = Tuple.Create(0, 0, 0, 0, 0);\n }\n\n }\n\n public void update(int i, int x)\n {\n i = (n / 2) + i - 1;\n //arr[i] = 1;\n if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);\n else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);\n else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);\n else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);\n else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);\n\n while (i > 0)\n {\n i = (i - 1) / 2;\n //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);\n //if (arr[i * 2 + 1] > arr[i * 2 + 2])\n //{\n // arr[i] = arr[i*2+1];\n //}\n //else\n //{\n // arr[i] = arr[i*2+2];\n //}\n //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];\n arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,\n arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,\n arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,\n arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,\n arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);\n }\n\n }\n\n //call : query(a,b, 0, 0, n)\n public Tuple query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);\n if (a <= l && r <= b) return arr[k];\n else\n {\n\n\n\n\n var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);\n var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);\n\n\n\n //if (vl.Item4 > vr.Item4)\n //{\n // return vl;\n //}\n ////else if (vl.Item4 == vr.Item4)\n ////{\n //// if (countA >= countB) return vr;\n //// else return vl;\n ////}\n //else return vr;\n\n\n return Tuple.Create(vl.Item1 + vr.Item1,\n vl.Item2 + vr.Item2,\n vl.Item3 + vr.Item3,\n vl.Item4 + vr.Item4,\n vl.Item5 + vr.Item5);\n\n\n //return Math.Max(vl, vr);\n //return vl\n int countA = 0;\n int countB = 0;\n if (vl.Item1 == 0) countA++;\n if (vl.Item2 == 0) countA++;\n if (vl.Item3 == 0) countA++;\n if (vl.Item4 == 0) countA++;\n if (vl.Item5 == 0) countA++;\n\n if (vr.Item1 == 0) countB++;\n if (vr.Item2 == 0) countB++;\n if (vr.Item3 == 0) countB++;\n if (vr.Item4 == 0) countB++;\n if (vr.Item5 == 0) countB++;\n\n\n if ((vl.Item1 == 0 && vr.Item1 > 0))\n {\n return vr;\n }\n else if ((vl.Item1 > 0 && vr.Item1 == 0))\n {\n return vl;\n }\n else if ((vl.Item2 == 0 && vr.Item2 > 0))\n {\n return vr;\n }\n else if ((vl.Item2 > 0 && vr.Item2 == 0))\n {\n return vl;\n }\n else if ((vl.Item3 == 0 && vr.Item3 > 0))\n {\n return vr;\n }\n else if ((vl.Item3 > 0 && vr.Item3 == 0))\n {\n return vl;\n }\n else if ((vl.Item4 == 0 && vr.Item4 > 0))\n {\n return vr;\n }\n else if ((vl.Item4 > 0 && vr.Item4 == 0))\n {\n return vl;\n }\n else if ((vl.Item5 == 0 && vr.Item5 > 0))\n {\n return vr;\n }\n else if ((vl.Item5 > 0 && vr.Item5 == 0))\n {\n return vl;\n }\n\n if (vl.Item4 > vr.Item4)\n {\n return vl;\n }\n else if (vl.Item4 == vr.Item4)\n {\n if (countA >= countB) return vr;\n else return vl;\n }\n else return vr;\n\n //if (countA <= countB) return vl;\n //else return vr;\n }\n }\n\n\n }\n\n\n class UnionFind\n {\n public int[] path;\n\n\n public UnionFind(int n)\n {\n path = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n path[i] = i;\n }\n\n }\n\n private int root(int i)\n {\n while (i != path[i])\n {\n path[i] = path[path[i]];\n i = path[i];\n }\n return i;\n }\n\n\n\n public bool find(int p, int q)\n {\n return root(p) == root(q);\n }\n\n\n\n public void unite(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n path[i] = j;\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Dreamoon_and_WiFi\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s1 = reader.ReadLine();\n string s2 = reader.ReadLine();\n\n int shift = 0;\n foreach (char c in s1)\n {\n if (c == '+')\n shift++;\n else\n {\n shift--;\n }\n }\n\n int cc = 0;\n\n foreach (char c in s2)\n {\n if (c == '+')\n shift--;\n else if (c == '-')\n {\n shift++;\n }\n else\n {\n cc++;\n }\n }\n\n if (shift < 0)\n shift = -shift;\n\n if (shift > cc || (cc==0 && shift!=0))\n {\n writer.WriteLine(\"0.0\");\n }\n else if (cc==0 && shift==0)\n {\n writer.WriteLine(\"1.0\");\n }\n else\n {\n int max = 1 << cc;\n int countok = 0;\n for (int i = 0; i < max; i++)\n {\n if (cc-2*Bitcount(i)==shift)\n {\n countok ++;\n }\n }\n writer.WriteLine(\"{0}\", (1.0*countok / max).ToString(\"#0.0000000000\", CultureInfo.InvariantCulture));\n }\n\n\n writer.Flush();\n }\n\n static int Bitcount(int n)\n {\n int count = 0;\n while (n != 0)\n {\n count++;\n n &= (n - 1);\n }\n return count;\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Codeforces\n{\n #region Main\n protected static TextReader reader;\n protected static TextWriter writer;\n public static long Fact(long num)\n {\n long factorial = 1;\n for (int i = 1; i <= num; i++)\n {\n factorial *= i;\n }\n return factorial;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var s1 = ReadToken();\n var s2 = ReadToken();\n var plus1 = s1.Count(c => c == '+');\n var plus2 = s2.Count(c => c == '+');\n double diffPlus = Math.Abs(plus1 - plus2);\n double qMark = s2.Count(c => c == '?');\n if (plus1 == plus2 && plus2 != 0 && qMark == 0)\n {\n writer.WriteLine(\"1.000000000\");\n reader.Close();\n writer.Close();\n return;\n }\n if (diffPlus > qMark || (plus2 > plus1))\n {\n writer.WriteLine(\"0.000000000\");\n reader.Close();\n writer.Close();\n return;\n }\n //if (diffPlus == qMark)\n //{\n // writer.WriteLine(\"{0}\", Math.Pow(0.5, qMark).ToString(\"F12\", CultureInfo.InvariantCulture));\n // reader.Close();\n // writer.Close();\n // return;\n //}\n var powTwo = 1 << (int)qMark;\n double comb = Fact((long)qMark) /\n (Fact((long)diffPlus) * Fact((long)(qMark - diffPlus)));\n writer.WriteLine(\"{0}\", (comb / powTwo).ToString(\"F12\", CultureInfo.InvariantCulture));\n reader.Close();\n writer.Close();\n }\n #endregion\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace ReadTemplate\n{\n public class Solver\n {\n public static void Solve()\n {\n var s = Reader.ReadLine();\n var right = 20 + s.Count(c => c == '+') - s.Count(c => c == '-');\n s = Reader.ReadLine();\n var p = new double[50, 50];\n p[0, 20] = 1;\n for (int i = 0; i < s.Length; i++)\n {\n switch (s[i])\n {\n case '+':\n for (int j = 1; j < 49; j++)\n {\n p[i + 1, j + 1] += p[i, j];\n }\n break;\n case '-':\n for (int j = 1; j < 49; j++)\n {\n p[i + 1, j - 1] += p[i, j];\n }\n break;\n default:\n for (int j = 1; j < 49; j++)\n {\n p[i + 1, j - 1] += p[i, j] / 2;\n p[i + 1, j + 1] += p[i, j] / 2;\n }\n break;\n }\n }\n Writer.Write(p[s.Length, right].ToString(CultureInfo.InvariantCulture));\n }\n\n public static void Main()\n {\n Reader = Console.In; Writer = Console.Out;\n //Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var dest = _.NextToken().ToCharArray().Select(x => x == '+' ? 1 : -1).Sum();\n var input = _.NextToken().ToCharArray();\n var tempDest = input.Select(x => x == '+' ? 1 : (x == '-' ? -1 : 0)).Sum();\n var nq = input.Count(x => x == '?');\n _.WriteLine(Answer(nq, Math.Abs(dest - tempDest)).ToString(\"F9\", CultureInfo.InvariantCulture));\n }\n\n decimal Answer(int n, int d)\n {\n return (n - d) % 2 == 0 && Math.Abs(n) >= Math.Abs(d) ? BinomialProb(n, Math.Abs((n - d) / 2)) : 0;\n }\n\n decimal BinomialProb(int n, int k)\n {\n if (n == 0) return 1;\n return k > n ? 0 : Divide(BinCoef(n, k), BigInteger.Pow(2, n));\n }\n\n private decimal Divide(BigInteger x, BigInteger y)\n {\n var gcd = BigInteger.GreatestCommonDivisor(x, y);\n x = x / gcd;\n y = y / gcd;\n return (decimal)x / (decimal)y;\n }\n\n BigInteger BinCoef(int n, int k)\n {\n\n return Prod(k + 1, n) / Prod(2, n - k);\n }\n\n BigInteger Prod(int s, int t)\n {\n var result = BigInteger.One;\n for (var i = s; i <= t; i++)\n {\n result *= i;\n }\n return result;\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp\n{\n public class Program\n {\n public static void Main()\n {\n // int n = Convert.ToInt32(Console.ReadLine());\n // int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n // StringBuilder stringBuilder = new StringBuilder();\n // for (int t = Convert.ToInt32(Console.ReadLine()); t > 0; t--)\n // {\n // }\n\n string input = Console.ReadLine();\n int offset = 0;\n foreach (var item in input)\n {\n if (item == '+')\n {\n offset++;\n }\n else\n {\n offset--;\n }\n }\n input = Console.ReadLine();\n int qCount = 0;\n foreach (var item in input)\n {\n if (item == '+')\n {\n offset--;\n }\n else\n {\n if (item == '-')\n {\n offset++;\n }\n else\n {\n qCount++;\n }\n }\n }\n if (offset < 0)\n {\n offset = -offset;\n }\n if (offset > qCount)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(factorial(qCount) / factorial(offset + (qCount - offset) / 2) / factorial(qCount - offset - (qCount - offset) / 2) * Math.Pow(0.5, qCount));\n }\n\n double factorial(int n)\n {\n if (n == 0 || n == 1)\n {\n return 1;\n }\n else\n {\n return n * factorial(n - 1);\n }\n }\n }\n }\n}"}, {"source_code": "#region Using Statements\nusing GenericArithmetic;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n int k = -6 % 2;\n string s1 = rs();\n string s2 = rs();\n int target = 0;\n int pos = 0;\n int que = 0;\n double result = 0f;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n target++;\n else\n target--;\n }\n\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+')\n pos++;\n else if (s2[i] == '-')\n pos--;\n else\n {\n que++;\n }\n }\n\n if (que % 2 == 0)\n {\n if ((target - pos) % 2 == 0)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus, minus;\n if (target - pos > 0)\n {\n plus = d;\n minus = 0;\n }\n else\n {\n plus = 0;\n minus = d;\n }\n\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n else\n {\n if (IsOdd(target - pos))\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus, minus;\n if (target - pos > 0)\n {\n plus = d;\n minus = 0;\n }\n else\n {\n plus = 0;\n minus = d;\n }\n\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n\n string ans = result.ToString(\"F10\", CultureInfo.InvariantCulture);\n Console.Write(ans);\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(k);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static bool IsEven(int a)\n {\n return (a % 2) == 0;\n }\n\n static bool IsOdd(int a)\n {\n return !IsEven(a);\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n\n#region Libraries\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic double p;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\n\t\t\tvar s = GetString();\n\t\t\tvar s1 = GetString();\n\t\t\tvar ans = new List();\n\t\t\tans.Add(new Point {x = 0, p = 1});\n\t\t\tvar cur = 0;\n\t\t\tfor (var i = 0; i < s.Length; ++i)\n\t\t\t{\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tcur++;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcur--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i = 0; i < s1.Length; ++i)\n\t\t\t{\n\t\t\t\tvar ans1 = new List();\n\t\t\t\tfor (var j = 0; j < ans.Count; ++j)\n\t\t\t\t{\n\t\t\t\t\tif (s1[i] == '+')\n\t\t\t\t\t\tans1.Add(new Point {x = ans[j].x + 1, p = ans[j].p});\n\t\t\t\t\tif (s1[i] == '-')\n\t\t\t\t\t\tans1.Add(new Point { x = ans[j].x - 1, p = ans[j].p });\n\t\t\t\t\tif (s1[i] == '?')\n\t\t\t\t\t{\n\t\t\t\t\t\tans1.Add(new Point {x = ans[j].x + 1, p = ans[j].p / 2});\n\t\t\t\t\t\tans1.Add(new Point { x = ans[j].x - 1, p = ans[j].p / 2 });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tans.Clear();\n\t\t\t\tans.AddRange(ans1);\n\t\t\t}\n\t\t\tdouble sum = 0;\n\t\t\tfor (var i = 0; i < ans.Count; ++i)\n\t\t\t\tif (ans[i].x == cur)\n\t\t\t\t\tsum += ans[i].p;\n\t\t\tConsole.WriteLine(sum.ToString().Replace(',', '.'));\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _476B {\n class Program {\n static void Main(string[] args) {\n\n string str1 = Console.ReadLine();\n string str2 = Console.ReadLine();\n\n char[] ar1 = str1.ToCharArray();\n char[] ar2 = str2.ToCharArray();\n\n int n = ar1.Length;\n int ansPosition = 0;\n\n for (int i = 0; i < n; i++) {\n ansPosition += (ar1[i] == '+' ? 1 : -1);\n }\n\n int lastPosition = 0;\n int questions = 0;\n for (int i = 0; i < n; i++) {\n if (ar2[i] == '?')\n questions++;\n else\n lastPosition += ar2[i] == '+' ? 1 : -1;\n }\n\n int distance = ansPosition - lastPosition;\n double ans = 0;\n\n if ((distance + questions) % 2 != 0 || questions < Math.Abs(distance))\n ans = 0;\n else {\n int m = (questions + Math.Abs(distance)) / 2;\n int c = 1;\n\n for (int i = 0; i < m; i++) {\n c *= questions - i;\n }\n for (int i = 2; i <= m ; i++) {\n c /= i;\n }\n ans = (double) c / (1 << questions);\n }\n\n Console.WriteLine(\"{0:f12}\", ans);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _476B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string da = Console.ReadLine();\n string dr = Console.ReadLine();\n\n int[] sa = new int[3];\n int[] sb = new int[3];\n int place = 0;\n\n for(int i = 0; i < da.Length; ++i)\n if(da[i] == '+')\n ++sa[0];\n else if(da[i] == '-')\n ++sa[1];\n \n for(int i = 0; i < dr.Length; ++i)\n if(dr[i] == '+')\n ++sb[0];\n else if(dr[i] == '-')\n ++sb[1];\n else\n {\n ++sb[2];\n // place |= 1 << (dr.Length - i - 1);\n place |= 1 << i;\n }\n\n if(da.Length != dr.Length || sa[0] - sb[0] < 0 || sa[1] - sb[1] < 0)\n {\n System.Console.WriteLine(\"0.0\");\n return;\n }\n System.Console.WriteLine(Ways(da.Length, place, sa[0] - sb[0], sa[1] - sb[1]) * 1.0 / Math.Pow(2, sb[2]));\n }\n\n protected static int Ways(int idx, int place, int p, int n)\n {\n if(idx == 0)\n return 1;\n\n if(((place >> (idx - 1)) & 1) == 0)\n return Ways(idx - 1, place, p, n);\n int sl = 0;\n if(p > 0)\n sl = Ways(idx - 1, place, p - 1, n);\n if(n > 0)\n sl += Ways(idx - 1, place, p, n - 1);\n return sl;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\n\nnamespace CSharp\n{\n public class _476B\n {\n public static void Main(string[] args)\n {\n int d = 0;\n int n = 0;\n\n foreach (char c in Console.ReadLine())\n {\n switch (c)\n {\n case '+':\n d++;\n break;\n case '-':\n d--;\n break;\n }\n }\n\n foreach (char c in Console.ReadLine())\n {\n switch (c)\n {\n case '+':\n d--;\n break;\n case '-':\n d++;\n break;\n case '?':\n n++;\n break;\n }\n }\n\n int k = (n - d) / 2;\n\n Console.WriteLine((Choose(n, k) / Math.Pow(2, n)).ToString(CultureInfo.InvariantCulture));\n }\n\n private static int Choose(int n, int k)\n {\n if (k < 0)\n {\n return 0;\n }\n\n if (n - k < k)\n {\n return Choose(n, n - k);\n }\n\n int result = 1;\n\n for (int i = 1; i <= k; i++)\n {\n result = result * (n + 1 - i) / i;\n }\n\n return result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int x1 = 0,x2=0,k=0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n x1++;\n else\n x1--;\n if (s2[i] == '+')\n x2++;\n if (s2[i] == '-')\n x2--;\n if (s2[i] == '?')\n k++;\n }\n int[,] a = new int[(int)Math.Pow(2, k),k+1];\n int res = 0;\n for (int j = 0; j < (int)Math.Pow(2, k); j++)\n {\n int y=0;\n for (int i = 0; i < k; i++)\n {\n int l=(int)Math.Pow(2,k-1-i);\n if(l!=1)\n {\n if (((j / l) % l) % 2 == 0)\n y++;\n else\n y--;\n }\n else\n {\n if (j % 2 == 0)\n y++;\n else\n y--;\n }\n }\n if (y + x2 == x1)\n res++;\n }\n Console.WriteLine(((double)res / Math.Pow(2, k)).ToString().Replace(',','.'));\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string signal = Console.ReadLine();\n string inner = Console.ReadLine();\n int[] plus = new int[2] { signal.Count(z => z == '+'), inner.Count(z => z == '+') };\n int[] minus = new int[2] { signal.Count(z => z == '-'), inner.Count(z => z == '-') };\n int qMark = inner.Count(z => z == '?');\n double ans = 0;\n if(qMark == 0)\n {\n if (plus[0] == plus[1] && minus[0] == minus[1]) ans = 1;\n else ans = 0;\n }\n else\n {\n if(plus[0] >= plus[1] && minus[0] >= minus[1])\n {\n ans = (Factorial(qMark) / (Factorial(qMark - (plus[0] - plus[1])) * Factorial(plus[0] - plus[1]))) / Math.Pow(2,qMark);\n }\n }\n\n Console.WriteLine(\"{0:F12}\",ans);\n }\n\n static double Factorial(int t)\n {\n int ans = 1;\n for(int i = 1; i <= t; ++i)\n {\n ans *= i;\n }\n return (double)ans;\n }\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\npublic class GFG\n{\n public static void Main()\n {\n List ans = new List();\n var s = Console.ReadLine();\n var t = Console.ReadLine();\n\n int sum = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '+')\n sum++;\n if (s[i] == '-')\n sum--;\n }\n\n var ansLis = new List();\n Sum(t, 0, ansLis, 0);\n\n var find = ansLis.Where(x => x == sum).Count();\n\n Console.Write(find / (ansLis.Count * 1.0));\n\n }\n\n public static void Sum(string s, int i, List sumList, int sum)\n {\n if (i >= s.Length)\n {\n sumList.Add(sum);\n return;\n }\n\n if (s[i] == '+')\n {\n sum++;\n Sum(s, i + 1, sumList, sum);\n }\n if (s[i] == '-')\n {\n sum--;\n Sum(s, i + 1, sumList, sum);\n }\n\n if (s[i] == '?')\n {\n var ss = sum;\n var tt = sum;\n ss = ss + 1;\n Sum(s, i + 1, sumList, ss);\n tt = tt - 1;\n Sum(s, i + 1, sumList, tt);\n }\n\n\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace DreamoonAndWifi\n{\n class BC\n {\n public static long combination(long n, long r)\n {\n long i;\n long ans;\n long x;\n long k = 1;\n\n x = Math.Max(r, n - r);\n ans = 1;\n for (i = n; i > x; i--)\n {\n ans = ans * i;\n ans = ans / k;\n k++;\n }\n return ans;\n\n }\n }\n class Dreamoon\n {\n string initial;\n string recieved;\n int iPlus = 0; int iMinus = 0;\n int rPlus = 0; int rMinus = 0; int rQuest = 0;\n double prob = 0;\n int questAsPlus = 0;\n int questAsMinus = 0;\n string result;\n int endPosition = 0;\n int endPositionR = 0;\n\n public void countProbability()\n {\n initial = Console.ReadLine();\n recieved = Console.ReadLine();\n\n for (int i = 0; i < initial.Length; i++)\n {\n switch (initial[i])\n {\n case '+':\n iPlus++;\n endPosition++;\n break;\n case '-':\n iMinus++;\n endPosition--;\n break;\n default:\n break;\n }\n switch (recieved[i])\n {\n case '+':\n rPlus++;\n endPositionR++;\n break;\n case '-':\n rMinus++;\n endPositionR--;\n break;\n case '?':\n rQuest++;\n break;\n default:\n break;\n }\n }\n int originalQuest = rQuest;\n int originalPlus = rPlus;\n int originalMinus = rMinus;\n\n if (rMinus == iMinus && rPlus == iPlus) prob = 1;\n else if (iMinus < rMinus || iPlus < rPlus) prob = 0;\n else\n {\n if (iMinus > rMinus)\n {\n while (iMinus > rMinus && rQuest > 0)\n {\n rMinus++;\n rQuest--;\n questAsMinus++;\n }\n }\n if (iPlus > rPlus)\n {\n while (iPlus > rPlus && rQuest > 0)\n {\n rPlus++;\n rQuest--;\n questAsPlus++;\n }\n }\n\n if (rMinus != iMinus || rPlus != iPlus) prob = 0;\n else\n {\n int distance = Math.Abs(endPosition - endPositionR);\n if (endPosition < endPositionR) distance = -distance;\n\n //Console.WriteLine(\"distance: {0}\", distance);\n //Console.WriteLine(\"minus: {0}\",questAsMinus);\n //Console.WriteLine(\"plus: {0}\", questAsPlus);\n\n double possibleWays = BC.combination(questAsMinus + questAsPlus, questAsPlus);\n //Console.WriteLine(\"possible ways: {0}\", possibleWays);\n\n prob = possibleWays / Math.Pow(2, originalQuest);\n result = prob.ToString();\n\n }\n\n }\n result = prob.ToString();\n for (int i = 0; i < result.Length; i++)\n {\n if (result[i] == ',') Console.Write('.');\n else Console.Write(result[i]);\n }\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Dreamoon d = new Dreamoon();\n d.countProbability();\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace dr2\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var s = Console.ReadLine();\n var got = Console.ReadLine();\n var fp = 0;\n for (int i = 0; i < got.Length; i++)\n {\n if (s[i] == '+')\n {\n fp++;\n }\n else\n {\n fp--;\n }\n }\n\n var dp = 0;\n var ac = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (got[i] == '?')\n {\n ac++;\n }\n else if (got[i] == '+')\n {\n dp++;\n }\n else\n {\n dp--;\n }\n }\n\n if (ac == 0)\n {\n if (dp == fp)\n {\n Console.WriteLine(1);\n }\n else\n {\n Console.WriteLine(0);\n }\n\n return;\n }\n\n var need = 0;\n if (dp * fp > 0)\n {\n need = Math.Abs(dp - fp);\n }\n else if (dp * fp == 0)\n {\n need = Math.Max(Math.Abs(dp), Math.Abs( fp));\n }\n else\n {\n need = Math.Abs(dp) + Math.Abs(fp);\n }\n\n if (ac < need)\n {\n Console.WriteLine(0);\n return;\n }\n\n var fa = new int[11];\n fa[0] = 1;\n for (int i = 1; i < 10 + 1; i++)\n {\n fa[i] = i * fa[i - 1];\n }\n \n var count = 0;\n var oc = 0;\n for (int i = 0; i <= ac; i++)\n {\n var rem = ac - i;\n count += fa[ac] / (fa[i] * fa[rem]);\n\n if (i - rem == need)\n {\n oc += fa[ac] / (fa[i] * fa[rem]);\n }\n }\n\n var res = (double)oc / (count);\n Console.WriteLine(res.ToString(CultureInfo.InvariantCulture));\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n double ans = 0;\n double p1, p2, m1, m2, q2;\n p1 = s1.Count(x => x == '+');\n p2 = s2.Count(x => x == '+');\n m1 = s1.Count(x => x == '-');\n m2 = s2.Count(x => x == '-');\n if (s2.IndexOf('?') == -1)\n {\n if (p1 == p2 && m1 == m2)\n {\n ans = 1.0d;\n }\n else\n ans = 0.0d;\n }\n else\n {\n q2 = s2.Count(x => x == '?');\n if (p2 <= p1 && m2 <= m1)\n {\n double k1 = p1 - p2;\n double k2 = m1 - m2;\n ans = fatorial(q2) / (fatorial(q2 - k1) * fatorial(k1));\n //Console.WriteLine(q2 - k1);\n //Console.WriteLine(fatorial(q2));\n //Console.WriteLine((fatorial(q2 - k1)));\n //Console.WriteLine(fatorial(k1));\n ans = ans / Math.Pow(2, q2);\n }\n else\n ans = 0.0d;\n }\n string s = ans.ToString(\"0.00000000000\").Replace(',', '.');\n Console.WriteLine(s);\n Console.ReadLine();\n }\n private static double fatorial(double n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\t\tpublic static string drazil =\"\";\n\t\tpublic static string dreamoon=\"\";\n\n\t\tpublic static char[] s1 = new char[drazil.ToCharArray().Length];\n\t\tpublic static char[] s2 = new char[dreamoon.ToCharArray().Length];\n\t\t\n\t\tpublic static int tamanhoS1, tamanhoS2;\n\t\tpublic static int unidade = 0, prob = 0, soma = 0;\n\t\tpublic static void probabilidade(int n, int posicao)\n\t\t{\t\t\n\n\t\t\tif (n == tamanhoS2)\n\t\t\t{\n\t\t\t\tif (posicao == unidade)\n\t\t\t\t\tprob++;\n\t\t\t\tsoma++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s2[n] == '+')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t}\n\t\t\telse if (s2[n] == '-')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t\telse if (s2[n] == '?')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t}\n\n\t\tstatic void Main(string[] args)\n {\n\t\t\tdrazil = Console.ReadLine();\n\t\t\tdreamoon = Console.ReadLine();\n\n\t\t\ts1 = drazil.ToCharArray();\n\t\t\ts2 = dreamoon.ToCharArray();\n\n\t\t\ttamanhoS1 = s1.Length;\n\t\t\ttamanhoS2 = s2.Length;\n\t\t\t\n\t\t\tfor (int i = 0; i < tamanhoS1; i++)\n {\n\t\t\t\tif (s1[i] == '+')\n\t\t\t\t\tunidade++;\n\t\t\t\telse\n\t\t\t\t\tunidade--;\n\t\t\t}\n\n\t\t\tprobabilidade(0, 0);\n\t\t\tConsole.WriteLine ((double)(prob) / (soma));\n\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Codeforces\n{\n public class Program\n {\n private const int MAXN = 8000;\n\n public class Pair\n {\n public Pair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n\n public int x;\n public int y;\n }\n\n\n public static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int pos = 0;\n\n for (int i = 0; i < line.Length; i++)\n {\n if (line[i] == '+')\n {\n pos++;\n }\n else\n {\n pos--;\n }\n }\n\n line = Console.ReadLine();\n int failedCount = 0;\n int successCount = 0;\n\n\n Pair p1 = null;\n Pair p2 = null;\n if (line[0] == '+')\n {\n p1 = new Pair(0, 1); \n }\n else if (line[0] == '-')\n {\n p2 = new Pair(0, -1);\n }\n else\n {\n p1 = new Pair(0, 1);\n p2 = new Pair(0, -1);\n }\n\n Stack stack = new Stack();\n\n if (p1 != null)\n {\n stack.Push(p1);\n }\n if (p2 != null)\n {\n stack.Push(p2);\n }\n\n while (stack.Count != 0)\n {\n Pair p = stack.Pop();\n\n //Test\n if (p.x == line.Length - 1)\n {\n if (p.y == pos)\n {\n successCount++;\n }\n else\n {\n failedCount++;\n }\n }\n else\n {\n p1 = null;\n p2 = null;\n if (line[p.x + 1] == '+')\n {\n p1 = new Pair(p.x + 1, p.y + 1);\n }\n else if (line[p.x + 1] == '-')\n {\n p2 = new Pair(p.x + 1, p.y - 1);\n }\n else\n {\n p1 = new Pair(p.x + 1, p.y + 1);\n p2 = new Pair(p.x + 1, p.y - 1);\n }\n\n if (p1 != null)\n {\n stack.Push(p1);\n }\n if (p2 != null)\n {\n stack.Push(p2);\n }\n }\n }\n Console.WriteLine(((double)successCount / (successCount + failedCount)).ToString(System.Globalization.CultureInfo.InvariantCulture));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n static double faktorijal(int a)\n {\n if (a == 0) return 1;\n double f = 1;\n for (int i = 2; i <= a; i++) f *= i;\n return f;\n }\n static double NnadK(int n, int k)\n {\n return faktorijal(n) / (faktorijal(k) * faktorijal(n - k));\n }\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int poz1 = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') poz1++;\n else poz1--;\n }\n int poz2 = 0;\n int brUpitnika = 0;\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+') poz2++;\n else if (s2[i] == '-') poz2--;\n else brUpitnika++;\n }\n if (brUpitnika == 0 && poz1 == poz2) \n {\n Console.WriteLine(1);\n return;\n }\n double nepovoljniSlucajevi = 1;\n for (int i = 0; i < brUpitnika; i++) nepovoljniSlucajevi *= 2;\n double povoljniSlucajevi = 0;\n for (int i = 0; i <= brUpitnika; i++)\n {\n int slucaj = i - (brUpitnika - i);\n if (poz2 + slucaj == poz1)\n {\n povoljniSlucajevi += NnadK(brUpitnika, i);\n break;\n }\n }\n Console.WriteLine((povoljniSlucajevi / nepovoljniSlucajevi).ToString().Replace(',', '.'));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\npublic class Reader\n{\n public static int[] ReadArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));\n }\n\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n public static string ReadStr()\n {\n return Console.ReadLine();\n }\n\n public static long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n public static long[] ReadLongArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt64(m));\n\n }\n}\nclass Program\n{\n static void Main(string[] args) => new CF().Solve();\n\n\n}\npublic class CF\n{\n\n public void Solve()\n {\n\n var s = Reader.ReadStr();\n var t = Reader.ReadStr();\n\n int loc = 0;\n\n foreach(var ch in s)\n {\n if (ch == '+') loc++;\n else loc--;\n }\n\n int loc2 = 0,blank = 0;\n\n foreach(var ch in t)\n {\n if (ch == '+') loc2++;\n else if (ch == '-') loc2--;\n else blank++;\n }\n\n if(blank == 0)\n {\n Console.WriteLine(loc == loc2 ? \"1\" : \"0\");\n return;\n }\n\n int count = 0;\n for(int i = 0; i < Math.Pow(2,blank); i++)\n {\n \n var numsetbits = numberofsetbits(i);\n var numunsetbits = blank - numsetbits;\n\n if (loc2 + (numsetbits - numunsetbits) == loc) count++;\n }\n\n\n Console.WriteLine((double) count / Math.Pow(2, blank));\n }\n\n \n\n public static int numberofsetbits(int n)\n {\n int count = 0;\n\n while(n > 0)\n {\n if ((n & 1) == 1) count++;\n\n n = n >> 1;\n }\n\n return count;\n }\n\n\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else\n {\n int a = (unrecorg + temp) / 2, bas = Convert.ToInt32(Math.Pow(2, unrecorg));\n double div = 1;\n for (int i = 0; i < a; i++)\n div *= unrecorg - i;\n while (a > 0)\n div /= a--;\n Console.WriteLine((div/bas).ToString(\"#.#########\").Replace(',','.'));\n //Console.WriteLine(\"div={0} bas={1}\", div, bas);\n }\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Teste x = new Teste();\n //x.calcula(Console.ReadLine(), Console.ReadLine());\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n cod.exibe(); //Exibe o resultado em decimal\n }\n }\n\n class Codigo\n {\n //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\n //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n private int distancia;\n private int posDreamoon;\n private int posDrazil;\n\n public Codigo(string drazil, string dreamoon)\n {\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = dreamoon.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n posDrazil = contaDrazil[1] - contaDrazil[0]; //Determina a posi\u00e7\u00e3o do Drazil depois de enviar os comandos\n posDreamoon = contaDreamon[1] - contaDreamon[0]; //Determina a posi\u00e7\u00e3o do dreamoon depois de receber os comandos\n distancia = posDrazil - posDreamoon; //Define a dist\u00e2ncia restante para Dreamoon chegar na mesma posi\u00e7\u00e3o\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if (quantInt < Math.Abs(distancia)) //Se a quantidade de caminhos duvidosos for maior que a dist\u00e2ncia restante, a chance \u00e9 zero\n return 0;\n else\n {\n int m = (quantInt + Math.Abs(distancia)) / 2; //Calcula a quantidade de passos v\u00e1lidos para chegar na posi\u00e7\u00e3o correta\n\n double combinacao = (fatorial(quantInt) / (fatorial(quantInt - m) * (fatorial(m)))); //Realiza o c\u00e1lculo da combina\u00e7\u00e3o\n\n return (double)combinacao / (1 << quantInt); //Retorna o restante da formula C(Quantidade de ?, m) / 2 ^ quantidade de ?\n }\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n\n private double fatorial(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n int pre = receive.Count(r => r == '?');\n\n double prob = 0;\n\n if (pre == 0)\n {\n bool total = pos[0] == pos[1] && neg[0] == neg[1];\n prob = total ? 1 : 0;\n }\n else\n {\n if (pos[0] >= pos[1] && neg[0] >= neg[1])\n {\n prob = ((double)Factorial(pre) / (Factorial(pre - (pos[0] - pos[1])) * Factorial(pos[0] - pos[1]))) / Math.Pow(2, pre);\n }\n }\n\n Console.WriteLine(\"{0:N12}\", prob);\n //Console.ReadKey();\n }\n\n private static int Factorial(int num)\n {\n int total = 1;\n\n if (num == 0)\n return 1;\n\n for (int i = 1; i <= num; i++)\n {\n total *= i;\n }\n return total;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n //class Teste\n //{\n // public Array dreamoon;\n // public Array drazil;\n // int posResposta = 0;\n // int posFinal = 0;\n // int numInterrogacao = 0;\n\n // public void calcula(string x, string y)\n // {\n // dreamoon = x.ToArray();\n // drazil = y.ToArray();\n\n // for (int i = 0; i < dreamoon.Length; i++)\n // {\n // if (dreamoon.GetValue(i).ToString() == \"+\")\n // posResposta++;\n // else\n // posResposta--;\n // }\n\n // for (int i = 0; i < dreamoon.Length; i++)\n // {\n // if (drazil.GetValue(i).ToString() == \"?\")\n // numInterrogacao++;\n // else if (drazil.GetValue(i).ToString() == \"+\")\n // posFinal++;\n // else\n // posFinal--;\n // }\n\n // int distancia = posResposta - posFinal;\n // double resposta;\n // if ((distancia + numInterrogacao) % 2 != 0 || numInterrogacao < Math.Abs(distancia)) //can't reach the destination no matter how\n // resposta = 0;\n // else\n // {\n\n // }\n\n // Console.WriteLine(resposta);\n // }\n //}\n class Codigo\n {\n //Iniciando as vari\u00e1veis dreamoon e drazil\n private string dreamoon;\n private string drazil;\n\n //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\n //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n private int distancia;\n private int posDreamoon;\n private int posDrazil;\n\n public Codigo(string drazil, string dreamoon)\n {\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = dreamoon.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n\n for (int i = 0; i < dreamoon.Length; i++)\n {\n if (dreamoon.Substring(i, 1) == \"+\")\n posDreamoon++;\n else if (dreamoon.Substring(i, 1) == \"-\")\n posDreamoon--; \n }\n\n for (int i = 0; i < drazil.Length; i++)\n {\n if (drazil.Substring(i, 1) == \"+\")\n posDrazil++;\n else\n posDrazil--;\n }\n\n distancia = posDrazil - posDreamoon;\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if (quantInt < Math.Abs(distancia)) //Se a quantidade de caminhos duvidosos for maior que a dist\u00e2ncia restante, a chance \u00e9 zero\n return 0;\n else\n {\n int m = (quantInt + Math.Abs(distancia)) / 2; //Calcula a quantidade de passos v\u00e1lidos para chegar na posi\u00e7\u00e3o correta\n\n double combinacao = (fatorial(quantInt) / (fatorial(quantInt - m) * (fatorial(m))));\n\n return (double)combinacao / (1 << quantInt);\n }\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n\n private double fatorial(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n //Teste x = new Teste();\n //x.calcula(Console.ReadLine(), Console.ReadLine());\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Codigo\n {\n //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\n //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n private int distancia;\n private int posDreamoon;\n private int posDrazil;\n\n public Codigo(string drazil, string dreamoon)\n {\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = dreamoon.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n posDrazil = contaDrazil[1] - contaDrazil[0]; //Determina a posi\u00e7\u00e3o do Drazil depois de enviar os comandos\n posDreamoon = contaDreamon[1] - contaDreamon[0]; //Determina a posi\u00e7\u00e3o do dreamoon depois de receber os comandos\n distancia = posDrazil - posDreamoon; //Define a dist\u00e2ncia restante para Dreamoon chegar na mesma posi\u00e7\u00e3o\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if (quantInt < Math.Abs(distancia)) //Se a quantidade de caminhos duvidosos for maior que a dist\u00e2ncia restante, a chance \u00e9 zero\n return 0;\n else\n {\n int m = (quantInt + Math.Abs(distancia)) / 2; //Calcula a quantidade de passos v\u00e1lidos para chegar na posi\u00e7\u00e3o correta\n\n double combinacao = (fatorial(quantInt) / (fatorial(quantInt - m) * (fatorial(m)))); //Realiza o c\u00e1lculo da combina\u00e7\u00e3o\n\n return (double)combinacao / (1 << quantInt); //Retorna o restante da formula C(Quantidade de ?, m) / 2 ^ quantidade de ?\n }\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n\n private double fatorial(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n //Teste x = new Teste();\n //x.calcula(Console.ReadLine(), Console.ReadLine());\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Codigo\n {\n //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\n //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n private int distancia;\n private int posDreamoon;\n private int posDrazil;\n\n public Codigo(string drazil, string dreamoon)\n {\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = dreamoon.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n\n posDreamoon = contaDreamon[1] - contaDreamon[0];\n posDrazil = contaDrazil[1] - contaDrazil[0];\n //for (int i = 0; i < dreamoon.Length; i++) //Esse for realiza a cont\n //{\n // if (dreamoon.Substring(i, 1) == \"+\")\n // posDreamoon++;\n // else if (dreamoon.Substring(i, 1) == \"-\")\n // posDreamoon--; \n //}\n\n //for (int i = 0; i < drazil.Length; i++)\n //{\n // if (drazil.Substring(i, 1) == \"+\")\n // posDrazil++;\n // else\n // posDrazil--;\n //}\n\n distancia = posDrazil - posDreamoon;\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if (quantInt < Math.Abs(distancia)) //Se a quantidade de caminhos duvidosos for maior que a dist\u00e2ncia restante, a chance \u00e9 zero\n return 0;\n else\n {\n int m = (quantInt + Math.Abs(distancia)) / 2; //Calcula a quantidade de passos v\u00e1lidos para chegar na posi\u00e7\u00e3o correta\n\n double combinacao = (fatorial(quantInt) / (fatorial(quantInt - m) * (fatorial(m))));\n\n return (double)combinacao / (1 << quantInt);\n }\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n\n private double fatorial(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n //Teste x = new Teste();\n //x.calcula(Console.ReadLine(), Console.ReadLine());\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n"}, {"source_code": "\ufeff#region Usings\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nusing static System.Math;\n#endregion\n\n// https://codeforces.com/problemset/problem/476/B\npublic class B___Dreamoon_and_WiFi\n{\n public static long combination(long n, long r)\n {\n long i;\n long ans;\n long x;\n long k = 1;\n\n x = Math.Max(r, n - r);\n ans = 1;\n for (i = n; i > x; i--)\n {\n ans = ans * i;\n ans = ans / k;\n k++;\n }\n return ans;\n\n }\n\n \n\n private static void Solve()\n {\n string initial = Read();\n string received = Read();\n\n int iPlus = 0, iMinus = 0;\n int rPlus = 0, rMinus = 0, rQuest = 0;\n double prob = 0;\n int questAsPlus = 0;\n int questAsMinus = 0;\n string result;\n int endPosition = 0;\n int endPositionR = 0;\n\n for (int i = 0; i < initial.Length; i++)\n {\n switch (initial[i])\n {\n case '+':\n iPlus++;\n endPosition++;\n break;\n case '-':\n iMinus++;\n endPosition--;\n break;\n default:\n break;\n }\n switch (received[i])\n {\n case '+':\n rPlus++;\n endPositionR++;\n break;\n case '-':\n rMinus++;\n endPositionR--;\n break;\n case '?':\n rQuest++;\n break;\n default:\n break;\n }\n }\n int originalQuest = rQuest;\n int originalPlus = rPlus;\n int originalMinus = rMinus;\n\n if (rMinus == iMinus && rPlus == iPlus) prob = 1;\n else if (iMinus < rMinus || iPlus < rPlus) prob = 0;\n else\n {\n if (iMinus > rMinus)\n {\n while (iMinus > rMinus && rQuest > 0)\n {\n rMinus++;\n rQuest--;\n questAsMinus++;\n }\n }\n if (iPlus > rPlus)\n {\n while (iPlus > rPlus && rQuest > 0)\n {\n rPlus++;\n rQuest--;\n questAsPlus++;\n }\n }\n\n if (rMinus != iMinus || rPlus != iPlus) prob = 0;\n else\n {\n int distance = Math.Abs(endPosition - endPositionR);\n if (endPosition < endPositionR) distance = -distance;\n\n //Console.WriteLine(\"distance: {0}\", distance);\n //Console.WriteLine(\"minus: {0}\",questAsMinus);\n //Console.WriteLine(\"plus: {0}\", questAsPlus);\n\n double possibleWays = combination(questAsMinus + questAsPlus, questAsPlus);\n //Console.WriteLine(\"possible ways: {0}\", possibleWays);\n\n prob = possibleWays / Math.Pow(2, originalQuest);\n result = prob.ToString();\n\n }\n\n }\n result = prob.ToString();\n for (int i = 0; i < result.Length; i++)\n {\n if (result[i] == ',') Console.Write('.');\n else Console.Write(result[i]);\n }\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 0m ;\n decimal total = 0m;\n total = (decimal)posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = correct/total;\n Console.WriteLine(prob.ToString(new NumberFormatInfo {NumberDecimalSeparator = \".\"}));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int sum = 0, n = 0;\n char[] aux = Console.ReadLine().ToCharArray();\n for (int i = 0; i < aux.Length; i++) {\n if (aux[i] == '?') {\n n++;\n } else if (aux[i] == '+') {\n sum++;\n } else {\n sum--;\n }\n }\n aux = Console.ReadLine().ToCharArray();\n for (int i = 0; i < aux.Length; i++) {\n if (aux[i] == '?') {\n n++;\n } else if (aux[i] == '+') {\n sum--;\n } else {\n sum++;\n }\n }\n if (sum < 0){\n sum = -sum;\n }\n double[] fact = new double[11];\n fact[0] = 1.0;\n for (int i = 1; i <= 10; i++) {\n fact[i] = fact[i - 1] * i;\n }\n double ans = 0.0;\n int test = n - sum;\n if (test % 2 == 0) {\n test /= 2;\n test += sum;\n if (n == 0) {\n if (sum == 0) {\n ans = 1.0;\n }\n } else if (test <= n) {\n ans = (fact[n]/(fact[test]*fact[n-test]))/(1 << n);\n } \n }\n Console.Write(ans.ToString(CultureInfo.CreateSpecificCulture(\"en-GB\")));\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Runtime.Hosting;\n\nnamespace CF272\n{\n class Program\n {\n private static string s1 = \"\";\n private static string s2 = \"\";\n private static long sourceResult;\n private static long count = 0L;\n private static long countSource = 0L;\n static void Main(string[] args)\n {\n Solution(Console.In, Console.Out);\n }\n\n static void Solution(TextReader sr, TextWriter sw)\n {\n s1 = sr.ReadLine();\n s2 = sr.ReadLine();\n sourceResult = Result(s1.ToCharArray());\n Solution(new char[s2.Length], s2.Length, -1);\n double result = (double)count / countSource;\n Console.WriteLine(result.ToString(\"F10\", CultureInfo.InvariantCulture));\n }\n\n static void ProcessSolution(char[] a, int n, int k)\n {\n long result = Result(a);\n countSource++;\n if (result == sourceResult)\n {\n count++;\n }\n }\n\n static long Result(char[] a)\n {\n long result = 0L;\n foreach (var ch in a)\n {\n if (ch == '+')\n {\n result += 1;\n }\n else\n {\n result -= 1;\n }\n }\n return result;\n }\n\n static bool IsSolution(char[] a, int n, int k)\n {\n return k + 1 == n;\n }\n\n static void Solution(char[] a, int n, int k)\n {\n if (IsSolution(a, n, k))\n {\n ProcessSolution(a, n, k);\n }\n else\n {\n k++;\n if (s2[k] == '?')\n {\n a[k] = '+';\n Solution(a, n, k);\n a[k] = '-';\n Solution(a, n, k);\n }\n else\n {\n a[k] = s2[k];\n Solution(a, n, k);\n }\n }\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _476b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int transmit=0;\n int reseive = 0;\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int count = 0;\n int count2 = 0;\n int i = 0;\n while (i < s1.Length)\n {\n transmit += s1[i] == '+' ? 1 : -1;\n if (s2[i] != '?')\n reseive += s2[i] == '+' ? 1 : -1;\n else\n count++;\n i++;\n }\n if(count == 0)\n {\n if (transmit == reseive)\n Console.WriteLine(1);\n else\n Console.Write(0);\n }\n else\n {\n if (Math.Abs((transmit - reseive)) % 2 == count % 2 && (transmit - reseive) <= count && (transmit - reseive) >= -count)\n {\n int k = (count - (transmit - reseive)) / 2;\n double result = 1;\n for (int z = 0; z < k; z++)\n {\n result *= (double)(count - z) / (z + 1);\n }\n Console.WriteLine((result / Math.Pow(2, count)).ToString(\"0.000000000000\").Replace(',', '.'));\n }\n else\n {\n Console.WriteLine(0);\n } \n \n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace cf\n{\n public class Cf\n {\n private static void Println(int n)\n {\n Console.WriteLine(n);\n }\n\n private static void Println(String s)\n {\n Console.WriteLine(s);\n }\n\n private static void Print(int n)\n {\n Console.Write(n);\n }\n\n private static void Print(String s)\n {\n Console.Write(s);\n }\n\n public static void Main(String[] args)\n {\n B();\n }\n\n private static void C()\n {\n }\n\n private static void A()\n {\n var scanner = new MyScanner();\n var n = scanner.NextInt();\n var m = scanner.NextInt();\n var x2 = n / 2;\n var x1 = n % 2;\n var d = (m - ((x1 + x2) % m)) % m;\n x2 -= d;\n x1 += 2 * d;\n if (x2 < 0)\n {\n Print(-1);\n }\n else\n {\n Print(x1 + x2);\n }\n }\n\n private static void B()\n {\n var f = new int[11];\n f[0] = 1;\n for (int i = 1; i < 11; i++)\n f[i] = f[i - 1]*i;\n var scanner = new MyScanner();\n var s1 = scanner.NextString();\n var s2 = scanner.NextString();\n var p1 = s1.Count(c => c == '+') - s1.Count(c => c == '-');\n var p2 = s2.Count(c => c == '+') - s2.Count(c => c == '-');\n var d = Math.Abs(p1 - p2);\n var q = s2.Count(c => c == '?');\n if (d > q)\n {\n Print(0);\n return;\n }\n var x = q - d;\n if (x%2 == 1)\n {\n Print(0);\n return;\n }\n x /= 2;\n double pp = ((double)f[q])/(f[x]*f[q - x]);\n Print((pp/Math.Pow(2,q)).ToString().Replace(',','.'));\n }\n }\n\n class Pair\n {\n public int X;\n public int Y;\n\n Pair(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n }\n class MyScanner\n {\n private String[] _buffer;\n private int _pos = 0;\n\n public int NextInt()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return int.Parse(_buffer[_pos - 1]);\n }\n\n public String NextString()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return _buffer[_pos - 1];\n }\n\n public List GetIntList(int n)\n {\n var result = new List(n);\n for (int i = 0; i < n; i++)\n result.Add(NextInt());\n return result;\n }\n\n public int[] GetIntArray(int n)\n {\n var result = new int[n];\n for (int i = 0; i < n; i++)\n result[i] = (NextInt());\n return result;\n }\n\n }\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p2\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\tp2 o = new p2();\n\t\t\to.foo();\n\n\t\t\t//p3 o = new p3();\n\t\t\t//o.foo();\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring s2 = Console.ReadLine();\n\n\t\t\tfp = finalPoint(s1);\n\t\t\tbar(s2);\n\t\t\tdouble d = suc / n;\n\t\t\tConsole.WriteLine(\"{0}\", d.ToString(\"F12\", System.Globalization.CultureInfo.InvariantCulture));\n\t\t}\n\t\tprivate int fp;\n\t\tprivate double n = 0;\n\t\tprivate double suc = 0;\n\t\tprivate void bar(string s)\n\t\t{\n\t\t\tif (s.IndexOf('?') < 0)\n\t\t\t{\n\t\t\t\tn++;\n\t\t\t\tif (finalPoint(s) == fp)\n\t\t\t\t\tsuc++;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint ind = s.IndexOf('?');\n\t\t\tstring a = s.Substring(0, ind);\n\t\t\tstring b = s.Substring(ind + 1);\n\t\t\t\n\t\t\tbar(a + \"+\" + b);\n\t\t\tbar(a + \"-\" + b);\n\t\t}\n\t\tprivate int finalPoint(string s)\n\t\t{\n\t\t\tint c = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc--;\n\t\t\t}\n\t\t\treturn c;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing BitVector = System.Collections.Specialized.BitVector32;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var s = sc.Scan();\n var t = sc.Scan();\n var spos = 0;\n foreach (var x in s)\n if (x == '+') spos++;\n else spos--;\n var dp = new double[100, 2];\n dp[50, 0] = 1.0;\n for (int i = 0; i < t.Length; i++)\n {\n var from = i & 1;\n var to = from ^ 1;\n for (int j = 25; j < 75; j++)\n {\n if (dp[j, from] < 1e-9)\n {\n continue;\n }\n var p = dp[j, from];\n dp[j, from] = 0;\n if (t[i] == '+')\n dp[j + 1, to] += p;\n else if (t[i] == '-')\n dp[j - 1, to] += p;\n else\n {\n dp[j + 1, to] += 0.5 * p;\n dp[j - 1, to] += 0.5 * p;\n }\n }\n }\n IO.Printer.Out.PrintLine(dp[50 + spos, (t.Length & 1)]);\n\n\n }\n\n internal IO.StreamScanner sc;\n\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n System.Diagnostics.Debug.AutoFlush = false;\n var sw = new Watch();\n sw.Start();\n try\n {\n#endif\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n System.Diagnostics.Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer\n {\n static Printer()\n {\n Out = new Printer(Console.Out);\n }\n public static Printer Out { get; set; }\n private readonly System.IO.TextWriter writer;\n private readonly System.Globalization.CultureInfo info;\n public string Separator { get; set; }\n public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? \"\\n\"; } }\n public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)\n {\n writer = tw ?? System.IO.TextWriter.Null;\n info = ci ?? System.Globalization.CultureInfo.InvariantCulture;\n NewLine = newLine;\n Separator = separator ?? \" \";\n }\n public void Print(int num) { writer.Write(num.ToString(info)); }\n public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(long num) { writer.Write(num.ToString(info)); }\n public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(double num) { writer.Write(num.ToString(\"F12\", info)); }\n public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }\n public void Print(string str) { writer.Write(str); }\n public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }\n public void Print(string format, IEnumerable sources) { writer.Write(format, sources.OfType().ToArray()); }\n public void Print(IEnumerable sources) { writer.Write(sources.AsString()); }\n public void Print(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n public void PrintLine() { writer.WriteLine(); }\n public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }\n public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(double num) { writer.WriteLine(num.ToString(\"F12\", info)); }\n public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }\n public void PrintLine(string str) { writer.WriteLine(str); }\n public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }\n public void PrintLine(string format, IEnumerable sources) { writer.WriteLine(format, sources.OfType().ToArray()); }\n public void PrintLine(IEnumerable sources)\n {\n var res = new StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n public void Flush() { writer.Flush(); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream)\n {\n iStream = stream;\n }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool EndOfStream { get { return eof; } }\n private byte readByte()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len)\n {\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n private bool inSpan(byte c)\n {\n const byte lb = 33, ub = 126;\n return !(c >= lb && c <= ub);\n }\n private byte skip()\n {\n byte b = 0;\n do b = readByte();\n while (!eof && inSpan(b));\n return b;\n }\n public char Char()\n {\n return (char)skip();\n }\n public char[] Char(int n)\n {\n var a = new char[n];\n for (int i = 0; i < n; i++)\n a[i] = (char)skip();\n return a;\n }\n public char[][] Char(int n, int m)\n {\n var a = new char[n][];\n for (int i = 0; i < n; i++)\n a[i] = Char(m);\n return a;\n }\n public string Scan()\n {\n\n const byte lb = 33, ub = 126;\n if (eof) throw new System.IO.EndOfStreamException();\n\n do\n {\n while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))\n {\n ptr++;\n }\n if (ptr < len)\n break;\n ptr = 0;\n len = iStream.Read(buf, 0, 1024);\n if (len <= 0)\n {\n eof = true;\n return null;\n }\n continue;\n } while (true);\n\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] < lb || ub < buf[i])\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n ptr = i + 1;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public string[] Scan(int n)\n {\n var a = new string[n];\n for (int i = 0; i < n; i++)\n a[i] = Scan();\n return a;\n }\n public string ScanLine()\n {\n const byte el = 10;\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n do\n {\n var i = ptr;\n while (i < len)\n {\n if (buf[i] == el)\n {\n string s;\n if (sb != null)\n {\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n s = sb.ToString();\n }\n else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));\n ptr = i + 1;\n return s;\n }\n i++;\n }\n i = len - ptr;\n if (sb == null) sb = new StringBuilder(i + 32);\n sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));\n ptr = 0;\n } while ((len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true;\n return sb.ToString();\n }\n public double Double()\n {\n return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);\n }\n public double[] Double(int n)\n {\n var a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = Double();\n return a;\n }\n public int Integer()\n {\n var ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n\n if (b == mynus)\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n {\n ret = ret * 10 + b - zero;\n }\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public int[] Integer(int n)\n {\n var a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = Integer();\n return a;\n }\n public long Long()\n {\n long ret = 0;\n byte b = 0;\n bool isMynus = false;\n const byte zero = 48, nine = 57, mynus = 45;\n do b = readByte();\n while (!eof && !((b >= zero && b <= nine) || b == mynus));\n if (b == '-')\n {\n isMynus = true;\n b = readByte();\n }\n while (true)\n {\n if (b >= zero && b <= nine)\n ret = ret * 10 + (b - zero);\n else return isMynus ? -ret : ret;\n b = readByte();\n }\n\n }\n public long[] Long(int n)\n {\n var a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = Long();\n return a;\n }\n public void Flush()\n {\n iStream.Flush();\n }\n\n }\n\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public string AsJoinedString(this IEnumerable source, string separator = \" \")\n {\n return string.Join(separator, source);\n }\n static public T[] Enumerate(this int n, Func selector)\n {\n var res = new T[n];\n for (int i = 0; i < n; i++)\n res[i] = selector(i);\n return res;\n }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nclass Algo\n{\n int[] f = new int[22];\n public void Run()\n {\n f[0] = 1;\n for (int i = 1; i < 22; i++) f[i] = f[i - 1] * i;\n string s1 = cin.ReadLine();\n string s2 = cin.ReadLine();\n int plus1 = 0, plus2 = 0, q = 0;\n for (int i = 0; i < s1.Length; i++) plus1 += (s1[i] == '+' ? 1 : 0);\n for (int i = 0; i < s2.Length; i++)\n {\n plus2 += (s2[i] == '+' ? 1 : 0);\n q += (s2[i] == '?' ? 1 : 0);\n }\n if (plus1 > plus2 + q || plus1 < plus2)\n {\n cout.WriteLine(\"0.0\");\n return;\n }\n int n = C(q, plus1 - plus2);\n int m = 1 << q;\n double ans = 1.0 * n / m;\n string res = ans.ToString();\n for (int i = 0; i < res.Length; i++)\n {\n if (res[i] == ',') cout.Write(\".\");\n else cout.Write(res[i]);\n }\n cout.WriteLine();\n }\n\n int C(int n, int m)\n {\n int ans = f[n] / f[m] / f[n - m];\n return ans;\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n}\n\nclass Program\n{\n static void Main()\n {\n Algo task = new Algo();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nnamespace Practise\n{\n class Program\n {\n public static void Main()\n {\n int init = 0;\n String original = Console.ReadLine();\n\n for (int i = 0; i < original.Length; i++)\n {\n if (original[i] == '+')\n init++;\n else\n init--;\n }\n\n String mangled = Console.ReadLine();\n Dictionary dict = new Dictionary();\n dict.Add(0, 1.0);\n\n for (int i = 0; i < mangled.Length; i++)\n {\n Dictionary temp = new Dictionary();\n\n if (mangled[i] == '+')\n {\n foreach(KeyValuePair kvp in dict)\n {\n int newLoc = kvp.Key + 1;\n if (temp.ContainsKey(newLoc))\n {\n temp[newLoc] += kvp.Value;\n }\n else\n {\n temp.Add(newLoc, kvp.Value);\n }\n\n }\n }\n else if (mangled[i] == '-')\n {\n foreach (KeyValuePair kvp in dict)\n {\n int newLoc = kvp.Key - 1;\n if (temp.ContainsKey(newLoc))\n {\n temp[newLoc] += kvp.Value;\n }\n else\n {\n temp.Add(newLoc, kvp.Value);\n }\n\n }\n }\n else\n {\n foreach (KeyValuePair kvp in dict)\n {\n int newLoc1 = kvp.Key - 1;\n int newLoc2 = kvp.Key + 1;\n double val = kvp.Value / 2.0;\n if (temp.ContainsKey(newLoc1))\n {\n temp[newLoc1] += val;\n }\n else\n {\n temp.Add(newLoc1, val);\n }\n\n if (temp.ContainsKey(newLoc2))\n {\n temp[newLoc2] += val;\n }\n else\n {\n temp.Add(newLoc2, val);\n }\n }\n }\n\n dict.Clear();\n foreach (KeyValuePair kvp in temp)\n {\n dict.Add(kvp.Key, kvp.Value);\n }\n }\n\n if (dict.ContainsKey(init))\n {\n Console.WriteLine(dict[init].ToString(CultureInfo.InvariantCulture));\n }\n else\n {\n Console.WriteLine(\"0.000000000000\");\n }\n }\n }\n\n class MyReader\n {\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n public static long ReadLong()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n public static void SplitTwoInt(out int a, out int b)\n {\n int[] ret = ReadAndSplitInt();\n a = ret[0];\n b = ret[1];\n }\n\n public static void SplitThreeInt(out int a, out int b, out int c)\n {\n int[] ret = ReadAndSplitInt();\n a = ret[0];\n b = ret[1];\n c = ret[2];\n }\n\n public static void SplitThreeDouble(out double a, out double b, out double c)\n {\n double[] ret = ReadAndSplitDouble();\n a = ret[0];\n b = ret[1];\n c = ret[2];\n }\n\n public static int[] ReadAndSplitInt()\n {\n String[] input = Console.ReadLine().Split();\n int count = input.Length;\n int[] a = new int[count];\n for (int i = 0; i < count; i++)\n {\n a[i] = Convert.ToInt32(input[i]);\n }\n return a;\n }\n\n public static double[] ReadAndSplitDouble()\n {\n String[] input = Console.ReadLine().Split();\n int count = input.Length;\n double[] a = new double[count];\n for (int i = 0; i < count; i++)\n {\n a[i] = Convert.ToDouble(input[i]);\n }\n return a;\n }\n }\n\n class MyUtility\n {\n public static List GetPrimes(int limit)\n {\n bool[] isPrime = GeneratePrimes(limit);\n List primes = new List();\n\n for (int i = 2; i <= limit; i++)\n {\n if (isPrime[i])\n primes.Add(i);\n }\n\n return primes;\n }\n\n public static bool[] GeneratePrimes(int limit)\n {\n bool[] isPrime = new bool[limit + 1];\n for (int i = 2; i <= limit; i++)\n isPrime[i] = true;\n\n for (int i = 2; i <= limit; i++)\n {\n if (isPrime[i])\n {\n int j = 2;\n while (i * j <= limit)\n {\n isPrime[i * j] = false;\n j++;\n }\n }\n }\n\n return isPrime;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.Linq;\n\nclass B476 {\n static int Choose(int n, int k) {\n if (k < 0 || n < k) return 0;\n int ans = 1;\n for (int i = 0; i < k; ++i) ans = ans * (n - i) / (i + 1);\n return ans;\n }\n\n static double Solve(int s, int d) {\n var sd = s + d;\n if ((sd & 1) != 0) return 0.0;\n var a = sd >> 1;\n return (double)Choose(s, a) / (1 << s);\n }\n\n public static void Main() {\n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var a1 = s1.Count(k => k == '+') - s1.Count(k => k == '-');\n var a2 = s2.Count(k => k == '+') - s2.Count(k => k == '-');\n var ans = Solve(s2.Count(k => k == '?'), a1 - a2);\n Console.WriteLine(ans.ToString(CultureInfo.InvariantCulture));\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n Console.WriteLine(res.Replace(',', '.'));\n\n Console.ReadLine();\n }\n\n static int Fact(int n)\n {\n int res = 1;\n for (int i = 2; i <= n; i++)\n {\n res *= i;\n }\n\n return res;\n }\n\n static int C(int a, int n)\n {\n return (Fact(n) / Fact(a)) / Fact(n - a);\n }\n\n static double GetResult(string send, string received)\n { \n int plus = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n int diff = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n {\n ++diff;\n ++plus;\n }\n else\n --diff;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if ( Math.Abs(incorrectdiff) > unknown - Math.Abs(diff))\n return 0.0;\n\n return C(plus - incorrectdiff,unknown) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace DreamoonAndWifi\n{\n partial class DreamoonAndWifi\n {\n static int[] position = new int[21];\n\n static void Main(string[] args)\n {\n string s1, s2;\n int final = 10;\n\n s1 = ReadLine();\n s2 = ReadLine();\n\n foreach (char command in s1)\n {\n if (command == '+')\n final++;\n else\n final--;\n }\n\n Solve(10, 0, s2);\n Console.WriteLine(\"{0:0.000000000000}\",(double)position[final] / (double)position.Sum());\n }\n\n private static void Solve(int currentPosition, int index, string commands)\n {\n if (index == commands.Length)\n {\n position[currentPosition]++;\n }\n else\n {\n switch (commands[index])\n {\n case '+':\n Solve(++currentPosition, index + 1, commands);\n break;\n\n case '-':\n Solve(--currentPosition, index + 1, commands);\n break;\n\n case '?':\n Solve(currentPosition + 1, index + 1, commands);\n Solve(currentPosition - 1, index + 1, commands);\n break;\n }\n }\n }\n }\n\n partial class DreamoonAndWifi\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace DreamoonAndWifi\n{\n partial class DreamoonAndWifi\n {\n static int[] position = new int[21];\n\n static void Main(string[] args)\n {\n string s1, s2;\n int final = 10;\n\n s1 = ReadLine();\n s2 = ReadLine();\n\n foreach (char command in s1)\n {\n if (command == '+')\n final++;\n else\n final--;\n }\n\n Solve(10, 0, s2);\n Console.WriteLine(\"{0:0.############}\",(double)position[final] / (double)position.Sum());\n }\n\n private static void Solve(int currentPosition, int index, string commands)\n {\n if (index == commands.Length)\n {\n position[currentPosition]++;\n }\n else\n {\n switch (commands[index])\n {\n case '+':\n Solve(++currentPosition, index + 1, commands);\n break;\n\n case '-':\n Solve(--currentPosition, index + 1, commands);\n break;\n\n case '?':\n Solve(currentPosition + 1, index + 1, commands);\n Solve(currentPosition - 1, index + 1, commands);\n break;\n }\n }\n }\n }\n\n partial class DreamoonAndWifi\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p2\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\tp2 o = new p2();\n\t\t\to.foo();\n\n\t\t\t//p3 o = new p3();\n\t\t\t//o.foo();\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring s2 = Console.ReadLine();\n\n\t\t\tfp = finalPoint(s1);\n\t\t\tbar(s2);\n\t\t\tdouble d = suc / n;\n\t\t\tConsole.WriteLine(d);\n\t\t}\n\t\tprivate int fp;\n\t\tprivate double n = 0;\n\t\tprivate double suc = 0;\n\t\tprivate void bar(string s)\n\t\t{\n\t\t\tif (s.IndexOf('?') < 0)\n\t\t\t{\n\t\t\t\tn++;\n\t\t\t\tif (finalPoint(s) == fp)\n\t\t\t\t\tsuc++;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint ind = s.IndexOf('?');\n\t\t\tstring a = s.Substring(0, ind);\n\t\t\tstring b = s.Substring(ind + 1);\n\t\t\t\n\t\t\tbar(a + \"+\" + b);\n\t\t\tbar(a + \"-\" + b);\n\t\t}\n\t\tprivate int finalPoint(string s)\n\t\t{\n\t\t\tint c = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc--;\n\t\t\t}\n\t\t\treturn c;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p2\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\tp2 o = new p2();\n\t\t\to.foo();\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring s2 = Console.ReadLine();\n\n\t\t\tfp = finalPoint(s1);\n\t\t\tbar(s2);\n\t\t\tConsole.WriteLine(suc / n);\n\t\t}\n\t\tprivate int fp;\n\t\tprivate double n = 0;\n\t\tprivate double suc = 0;\n\t\tprivate void bar(string s)\n\t\t{\n\t\t\tif (s.IndexOf('?') < 0)\n\t\t\t{\n\t\t\t\tn++;\n\t\t\t\tif (finalPoint(s) == fp)\n\t\t\t\t\tsuc++;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint ind = s.IndexOf('?');\n\t\t\tstring a = s.Substring(0, ind);\n\t\t\tstring b = s.Substring(ind + 1);\n\t\t\t\n\t\t\tbar(a + \"+\" + b);\n\t\t\tbar(a + \"-\" + b);\n\t\t}\n\t\tprivate int finalPoint(string s)\n\t\t{\n\t\t\tint c = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc--;\n\t\t\t}\n\t\t\treturn c;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p2\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\tp2 o = new p2();\n\t\t\to.foo();\n\n\t\t\t//p3 o = new p3();\n\t\t\t//o.foo();\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring s1 = Console.ReadLine();\n\t\t\tstring s2 = Console.ReadLine();\n\n\t\t\tfp = finalPoint(s1);\n\t\t\tbar(s2);\n\t\t\tdouble d = suc / n;\n\t\t\tConsole.WriteLine(\"{0}\", d.ToString(\"F12\"));\n\t\t}\n\t\tprivate int fp;\n\t\tprivate double n = 0;\n\t\tprivate double suc = 0;\n\t\tprivate void bar(string s)\n\t\t{\n\t\t\tif (s.IndexOf('?') < 0)\n\t\t\t{\n\t\t\t\tn++;\n\t\t\t\tif (finalPoint(s) == fp)\n\t\t\t\t\tsuc++;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint ind = s.IndexOf('?');\n\t\t\tstring a = s.Substring(0, ind);\n\t\t\tstring b = s.Substring(ind + 1);\n\t\t\t\n\t\t\tbar(a + \"+\" + b);\n\t\t\tbar(a + \"-\" + b);\n\t\t}\n\t\tprivate int finalPoint(string s)\n\t\t{\n\t\t\tint c = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == '+')\n\t\t\t\t\tc++;\n\t\t\t\telse\n\t\t\t\t\tc--;\n\t\t\t}\n\t\t\treturn c;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nclass Algo\n{\n int[] f = new int[22];\n public void Run()\n {\n f[0] = 1;\n for (int i = 1; i < 22; i++) f[i] = f[i - 1] * i;\n string s1 = cin.ReadLine();\n string s2 = cin.ReadLine();\n int plus1 = 0, plus2 = 0, q = 0;\n for (int i = 0; i < s1.Length; i++) plus1 += (s1[i] == '+' ? 1 : 0);\n for (int i = 0; i < s2.Length; i++)\n {\n plus2 += (s2[i] == '+' ? 1 : 0);\n q += (s2[i] == '?' ? 1 : 0);\n }\n if (plus1 > plus2 + q)\n {\n cout.WriteLine(\"0.0\");\n return;\n }\n int n = C(q, plus1 - plus2);\n int m = 1 << q;\n cout.WriteLine(1.0 * n / m);\n }\n\n int C(int n, int m)\n {\n int ans = f[n] / f[m] / f[n - m];\n return ans;\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n}\n\nclass Program\n{\n static void Main()\n {\n Algo task = new Algo();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace R_B_272\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine(), s2 = Console.ReadLine();\n int t = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') t++;\n else t--;\n }\n int[][] a = new int[25][];\n a[0] = new int[1];\n a[0][0] = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s2[i] == '?')\n {\n a[i + 1] = new int[a[i].Length * 2];\n int j = 0, z = 0;\n while (j < a[i].Length)\n {\n a[i + 1][z] = a[i][j] - 1;\n z++;\n a[i + 1][z] = a[i][j] + 1;\n z++;\n j++;\n }\n }\n else\n {\n a[i + 1] = new int[a[i].Length];\n if (s2[i] == '+')\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] + 1;\n }\n }\n else\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] - 1;\n }\n }\n }\n }\n\n double count = 0;\n for (int i = 0; i < a[s2.Length].Length; i++)\n {\n if (a[s2.Length][i] == t) count++;\n }\n double d = count / a[s2.Length].Length;\n Console.WriteLine(d%1000000000);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_B_272\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine(), s2 = Console.ReadLine();\n int t = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') t++;\n else t--;\n }\n int[][] a = new int[25][];\n a[0] = new int[1];\n a[0][0] = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s2[i] == '?')\n {\n a[i + 1] = new int[a[i].Length * 2];\n int j = 0, z = 0;\n while (j < a[i].Length)\n {\n a[i + 1][z] = a[i][j] - 1;\n z++;\n a[i + 1][z] = a[i][j] + 1;\n z++;\n j++;\n }\n }\n else\n {\n a[i + 1] = new int[a[i].Length];\n if (s2[i] == '+')\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] + 1;\n }\n }\n else\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] - 1;\n }\n }\n }\n }\n\n double count = 0;\n for (int i = 0; i < a[s2.Length].Length; i++)\n {\n if (a[s2.Length][i] == t) count++;\n }\n double d = count / a[s2.Length].Length;\n Console.WriteLine(\"{0:f12}\", d);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace R_B_272\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine(), s2 = Console.ReadLine();\n int t = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') t++;\n else t--;\n }\n int[][] a = new int[25][];\n a[0] = new int[1];\n a[0][0] = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s2[i] == '?')\n {\n a[i + 1] = new int[a[i].Length * 2];\n int j = 0, z = 0;\n while (j < a[i].Length)\n {\n a[i + 1][z] = a[i][j] - 1;\n z++;\n a[i + 1][z] = a[i][j] + 1;\n z++;\n j++;\n }\n }\n else\n {\n a[i + 1] = new int[a[i].Length];\n if (s2[i] == '+')\n {\n for (int j = 0; j < a[i+1].Length; j++)\n {\n a[i][j]++;\n }\n }\n else\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i][j]--;\n }\n }\n }\n }\n\n double count = 0;\n for (int i = 0; i < a[s2.Length].Length; i++)\n {\n if (a[s2.Length][i] == t) count++;\n }\n double d = count /a[s2.Length].Length;\n Console.WriteLine(\"{0:f12}\", d);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_B_272\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine(), s2 = Console.ReadLine();\n int t = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') t++;\n else t--;\n }\n int[][] a = new int[25][];\n a[0] = new int[1];\n a[0][0] = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s2[i] == '?')\n {\n a[i + 1] = new int[a[i].Length * 2];\n int j = 0, z = 0;\n while (j < a[i].Length)\n {\n a[i + 1][z] = a[i][j] - 1;\n z++;\n a[i + 1][z] = a[i][j] + 1;\n z++;\n j++;\n }\n }\n else\n {\n a[i + 1] = new int[a[i].Length];\n if (s2[i] == '+')\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] + 1;\n }\n }\n else\n {\n for (int j = 0; j < a[i + 1].Length; j++)\n {\n a[i + 1][j] = a[i][j] - 1;\n }\n }\n }\n }\n\n double count = 0;\n for (int i = 0; i < a[s2.Length].Length; i++)\n {\n if (a[s2.Length][i] == t) count++;\n }\n double d = count / a[s2.Length].Length;\n Console.WriteLine(\"{0:f9}\", d);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n\n static int suc_Event = 0;\n static int end_Pos = 0;\n static void Main(string[] args)\n {\n string str_Correct = Console.ReadLine();\n string str_Unverified = Console.ReadLine();\n int pos = 0;\n int num_unKnown = 0;\n\n foreach (char map in str_Correct)\n {\n switch (map)\n {\n case '+':\n end_Pos++;\n break;\n case '-':\n end_Pos--;\n break;\n }\n }\n\n\n foreach (char map in str_Unverified)\n {\n switch (map)\n {\n case '+': \n pos++;\n break;\n case '-':\n pos--;\n break;\n case '?':\n num_unKnown++;\n break;\n }\n }\n\n Move(pos, num_unKnown);\n\n string str_probability = string.Format(\"{0:0.000000000000}\", (double)suc_Event / (double)Math.Pow(2,num_unKnown));\n Console.Write(str_probability);\n Console.Read();\n\n }\n\n\n private static void Move(int CurrentPos,int num_unKnown)\n {\n if (num_unKnown > 0)\n {\n Move(++CurrentPos, --num_unKnown);\n Move(--CurrentPos, --num_unKnown); \n }\n if (CurrentPos == end_Pos)\n {\n suc_Event++;\n }\n }\n }\n\n\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n\n static int suc_Event = 0;\n static int end_Pos = 0;\n static void Main(string[] args)\n {\n string str_Correct = Console.ReadLine();\n string str_Unverified = Console.ReadLine();\n int pos = 0;\n int num_unKnown = 0;\n\n foreach (char map in str_Correct)\n {\n switch (map)\n {\n case '+':\n end_Pos++;\n break;\n case '-':\n end_Pos--;\n break;\n }\n }\n\n\n foreach (char map in str_Unverified)\n {\n switch (map)\n {\n case '+': \n pos++;\n break;\n case '-':\n pos--;\n break;\n case '?':\n num_unKnown++;\n break;\n }\n }\n\n Move(pos, num_unKnown);\n\n string str_probability = string.Format(\"{0:0.000000000000}\", (double)suc_Event / (double)Math.Pow(2,num_unKnown)).Replace(',','.');\n Console.Write(str_probability);\n Console.Read();\n\n }\n\n\n private static void Move(int CurrentPos,int num_unKnown)\n {\n if (num_unKnown > 0)\n {\n Move(++CurrentPos, --num_unKnown);\n Move(--CurrentPos, --num_unKnown); \n }\n if (CurrentPos == end_Pos)\n {\n suc_Event++;\n }\n }\n }\n\n\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n\n static int suc_Event = 0;\n static int end_Pos = 0;\n static void Main(string[] args)\n {\n string str_Correct = Console.ReadLine();\n string str_Unverified = Console.ReadLine();\n int pos = 0;\n int num_unKnown = 0;\n\n foreach (char map in str_Correct)\n {\n switch (map)\n {\n case '+':\n end_Pos++;\n break;\n case '-':\n end_Pos--;\n break;\n }\n }\n\n\n foreach (char map in str_Unverified)\n {\n switch (map)\n {\n case '+': \n pos++;\n break;\n case '-':\n pos--;\n break;\n case '?':\n num_unKnown++;\n break;\n }\n }\n\n Move(pos, num_unKnown);\n\n string str_probability = string.Format(\"{0:0.000000000000}\", (double)suc_Event / (double)Math.Pow(2,num_unKnown)).Replace(',','.');\n Console.Write(str_probability);\n Console.Read();\n\n }\n\n\n private static void Move(int CurrentPos,int num_unKnown)\n {\n if (num_unKnown >= 1)\n {\n Move(CurrentPos+1, num_unKnown-1);\n Move(CurrentPos-1, num_unKnown-1); \n }\n if (CurrentPos == end_Pos)\n {\n suc_Event++;\n }\n }\n }\n\n\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static int gcd(int a,int b)\n {\n while(a!=0&&b!=0)\n {\n if(a>b)\n a%=b;\n else\n b%=a;\n }\n if(a==0)\n return b;\n else\n return a;\n }\n static int Factorial(int x)\n {\n return (x == 0) ? 1 : x * Factorial(x - 1);\n }\n static void Main()\n {\n \n string q= Console.ReadLine();\n string w= Console.ReadLine();\n int n=0,m=0,v=0;\n for(int i=0;iv)\n Console.Write(0);\n else\n Console.Write(((double)(Factorial(v)/Factorial(v-(v-Math.Abs(n-m))/2)/Factorial((v-Math.Abs(n-m))/2))/Math.Pow(2,v)).ToString().Replace(',','.'));\n\n \n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n//using System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\nusing System.Globalization;\n\nnamespace _272_b\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int d1 = 0;\n int d2 = 0;\n var d2list = new List();\n\n foreach(char sym in s1)\n {\n if (sym == '+')\n d1 += 1;\n else d1 -= 1;\n }\n\n int k = 0;\n foreach (char sym in s2)\n {\n if (sym == '+')\n d2 += 1;\n else \n if (sym == '-')\n d2 -= 1;\n else k++;\n }\n\n if(k != 0)\n {\n for (int i = k; i >= 0; i -= 2)\n {\n d2list.Add(d2 + i);\n d2list.Add(d2 - i);\n }\n var t = d2list.FindAll(x => x == d1);\n\n if (t.Count != 0)\n {\n double res = (double)t.Count / (double)d2list.Count;\n Console.Write(res.ToString((CultureInfo.InvariantCulture)));\n }\n else Console.Write(0.0); \n }\n else\n {\n if (d1 != d2)\n Console.Write(0.0);\n else Console.Write(1.0);\n }\n }\n }\n}"}, {"source_code": "#region Using Statements\nusing GenericArithmetic;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n string s1 = rs();\n string s2 = rs();\n int target = 0;\n int pos = 0;\n int que = 0;\n double result = 0f;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n target++;\n else\n target--;\n }\n\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+')\n pos++;\n else if (s2[i] == '-')\n pos--;\n else\n {\n que++;\n }\n }\n\n if (que % 2 == 0)\n {\n if ((target - pos) % 2 == 0)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus = d;\n int minus = 0;\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n else\n {\n if ((target - pos) % 2 == 1)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus = d;\n int minus = 0;\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n\n string ans = result.ToString(\"F10\", CultureInfo.InvariantCulture);\n Console.Write(ans);\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(k);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n\n#region Libraries\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "#region Using Statements\nusing GenericArithmetic;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n int k = -5 % 2;\n string s1 = rs();\n string s2 = rs();\n int target = 0;\n int pos = 0;\n int que = 0;\n double result = 0f;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n target++;\n else\n target--;\n }\n\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+')\n pos++;\n else if (s2[i] == '-')\n pos--;\n else\n {\n que++;\n }\n }\n\n if (que % 2 == 0)\n {\n if ((target - pos) % 2 == 0)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus, minus;\n if (target - pos > 0)\n {\n plus = d;\n minus = 0;\n }\n else\n {\n plus = 0;\n minus = d;\n }\n\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n else\n {\n if ((target - pos).ToString().Last() == '1')\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus, minus;\n if (target - pos > 0)\n {\n plus = d;\n minus = 0;\n }\n else\n {\n plus = 0;\n minus = d;\n }\n\n for (int i = 0;; i++)\n {\n if (plus + minus >= que)\n break;\n plus++;\n minus++;\n }\n\n if (plus + minus == que)\n result = (double)C(que, plus) / Math.Pow(2, que);\n else\n result = 0f;\n }\n else\n result = 0f;\n }\n\n string ans = result.ToString(\"F10\", CultureInfo.InvariantCulture);\n Console.Write(ans);\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(k);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n\n#region Libraries\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "#region Using Statements\nusing GenericArithmetic;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#endregion\nnamespace csConsoleforStudy\n{\n using System.Collections.Generic;\n using System.Globalization;\n\n class Program\n {\n static readonly Encoding TargetEcoding = Encoding.Unicode;\n static void Main(string[] args)\n {\n OpenStream();\n Solver s = new Solver();\n s.Solve();\n CloseStream();\n }\n\n static void OpenStream()\n {\n }\n\n static void CloseStream()\n {\n }\n\n static void CheckMemory()\n {\n }\n }\n\n class Solver\n {\n public static readonly Encoding TargetEncoding = Encoding.Unicode;\n const int SIZE = 5005;\n private const double AbsoluteError = 1e-10;\n private const double RelativeError = 1e-8;\n static int mod = 1000000007;\n public void Solve()\n {\n string s1 = rs();\n string s2 = rs();\n int target = 0;\n int pos = 0;\n int que = 0;\n double result = 0f;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n target++;\n else\n target--;\n }\n\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+')\n pos++;\n else if (s2[i] == '-')\n pos--;\n else\n {\n que++;\n }\n }\n\n if (que % 2 == 0)\n {\n if ((target - pos) % 2 == 0)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus = d;\n int minus = 0;\n for (int i = 0;; i++)\n {\n if (plus + minus == que)\n break;\n plus++;\n minus++;\n }\n\n result = (double)C(que, plus) / Math.Pow(2, que);\n }\n else\n result = 0f;\n }\n else\n {\n if ((target - pos) % 2 == 1)\n {\n int d = target - pos;\n d = Math.Abs(d);\n int plus = d;\n int minus = 0;\n for (int i = 0;; i++)\n {\n if (plus + minus == que)\n break;\n plus++;\n minus++;\n }\n\n result = (double)C(que, plus) / Math.Pow(2, que);\n }\n else\n result = 0f;\n }\n\n string ans = result.ToString(\"F10\", CultureInfo.InvariantCulture);\n Console.Write(ans);\n }\n\n#region SolverUtils\n private static List factorial = new List(new int[]{1});\n private static int NextInt()\n {\n int c;\n int res = 0;\n do\n {\n c = Console.Read();\n if (c == -1)\n return res;\n }\n while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = Console.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n static string rs()\n {\n return Console.ReadLine();\n }\n\n static int ri()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static uint rui()\n {\n return uint.Parse(Console.ReadLine());\n }\n\n static long rl()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static ulong rul()\n {\n return ulong.Parse(Console.ReadLine());\n }\n\n static double rd()\n {\n return double.Parse(Console.ReadLine());\n }\n\n static string[] rsa()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int[] ria()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e));\n }\n\n static uint[] ruia()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => uint.Parse(e));\n }\n\n static long[] rla()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e));\n }\n\n static ulong[] rula()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => ulong.Parse(e));\n }\n\n static double[] rda()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e));\n }\n\n static void ReadLineAndAssign(string type, params object[] p)\n {\n dynamic input;\n if (type.StartsWith(\"i\"))\n input = ria();\n else if (type.StartsWith(\"l\"))\n input = rla();\n else if (type.StartsWith(\"d\"))\n input = rda();\n else\n throw new ArgumentException(\"no match \" + type.ToString());\n for (int i = 0; i < p.Length; i++)\n {\n p[i] = input[i];\n }\n }\n\n static void SwapIfGreater(ref T lhs, ref T rhs)where T : IComparable\n {\n T temp;\n if (lhs.CompareTo(rhs) > 0)\n {\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n }\n\n static bool DoubleEqual(double a, double b)\n {\n double diff = Math.Abs(a - b);\n if (diff < AbsoluteError)\n return true;\n return diff <= RelativeError * Math.Max(Math.Abs(a), Math.Abs(b));\n }\n\n static dynamic abs(dynamic num)\n {\n return Math.Abs(num);\n }\n\n static dynamic max(dynamic a, dynamic b)\n {\n return Math.Max(a, b);\n }\n\n static void For(int start, int end, Action method)\n {\n for (int i = start; i < end; i++)\n {\n method.Invoke();\n }\n }\n\n static void For(int start, int end, Action method, int i)\n {\n for (i = start; i < end; i++)\n {\n method.DynamicInvoke(i);\n }\n }\n\n static int C(int n, int k)\n {\n return P(n, k) / Factorial(n);\n }\n\n static int P(int n, int r)\n {\n return Factorial(n) / Factorial(n - r);\n }\n\n static int Factorial(int n)\n {\n if (factorial.Count <= n)\n factorial.Add(Factorial(n - 1) * n);\n return factorial[n];\n }\n\n static int powmod(int a, int b)\n {\n if (b == 0)\n return 1;\n if (b == 1)\n return a;\n int i = powmod(a, b / 2);\n i *= i;\n i %= mod;\n if (b % 2 == 0)\n return i;\n else\n return ((i * a) % mod);\n }\n#endregion\n }\n#region SolverUtils\n#endregion\n#region Data Structure\n#endregion\n#region Algorithm\n#endregion\n#region Library Method/Fields\n#region Members for Internal Support\n#endregion Members for Internal Support\n#region Public Properties\n#endregion Public Properties\n#region Public Instance Methods\n#endregion Public Instance Methods\n#region Constructors\n#endregion Constructors\n#region Public Static Methods\n#endregion Public Static Methods\n#region Operator Overloads\n#endregion Operator Overloads\n#region explicit conversions from BigRational\n#endregion explicit conversions from BigRational\n#region implicit conversions to BigRational\n#endregion implicit conversions to BigRational\n#region serialization\n#endregion serialization\n#region instance helper methods\n#endregion instance helper methods\n#region static helper methods\n#endregion static helper methods\n#region Exceptions\n#endregion\n#endregion\n}\n\n#region Libraries\nnamespace GenericArithmetic\n{\n public class Vector\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public T X\n {\n get;\n set;\n }\n\n public T Y\n {\n get;\n set;\n }\n\n public Vector(T x, T y)\n {\n X = x;\n Y = y;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Vector a, Vector b)\n {\n return EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y);\n }\n\n public static bool operator !=(Vector a, Vector b)\n {\n return !(EqualityComparer.Default.Equals(a.X, b.X) && EqualityComparer.Default.Equals(a.Y, b.Y));\n }\n\n public static Vector operator !(Vector a)\n {\n return new Vector(Calculator.Difference(new Number(default (T)), a.X), Calculator.Difference(new Number(default (T)), a.Y));\n }\n\n public static Vector operator +(Vector a, Vector b)\n {\n return new Vector(Calculator.Sum(a.X, b.X), Calculator.Sum(a.Y, b.Y));\n }\n\n public static Vector operator -(Vector a, Vector b)\n {\n return new Vector(Calculator.Difference(a.X, b.X), Calculator.Difference(a.Y, b.Y));\n }\n }\n\n public class Matrix\n {\n public static readonly ICalculator Calculator = Number.Calculator;\n public int W\n {\n get;\n set;\n }\n\n public int H\n {\n get;\n set;\n }\n\n public int rows\n {\n get\n {\n return H;\n }\n\n set\n {\n H = value;\n }\n }\n\n public int cols\n {\n get\n {\n return W;\n }\n\n set\n {\n W = value;\n }\n }\n\n public T[, ] Map\n {\n get;\n set;\n }\n\n public T this[int x, int y]\n {\n get\n {\n return Map[x, y];\n }\n\n set\n {\n Map[x, y] = value;\n }\n }\n\n public Matrix(T[, ] map)\n {\n Map = map;\n W = map.GetLength(0);\n H = map.GetLength(1);\n }\n\n public Matrix(int w, int h, T defaultValue = default (T))\n {\n W = w;\n H = h;\n Map = new T[W, H];\n }\n\n public override bool Equals(object obj)\n {\n if (obj is Matrix)\n {\n return this == (Matrix)obj;\n }\n\n return base.Equals(obj);\n }\n\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n\n public static bool operator ==(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return ret;\n }\n\n public static bool operator !=(Matrix a, Matrix b)\n {\n bool ret = true;\n if (a.Map != b.Map)\n ret = false;\n else if (a.W != b.W)\n ret = false;\n else if (a.H != b.H)\n ret = false;\n return !ret;\n }\n\n public static Matrix operator +(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Sum(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator -(Matrix a, Matrix b)\n {\n if (a.W != b.W)\n return null;\n else if (a.H != b.H)\n return null;\n else\n {\n Matrix ret = new Matrix(a.W, a.H);\n for (int i = 0; i < a.W; i++)\n {\n for (int j = 0; j < a.H; j++)\n {\n ret[i, j] = Calculator.Difference(a[i, j], b[i, j]);\n }\n }\n\n return ret;\n }\n }\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n if (a.cols != b.rows)\n throw new FormatException(\"Cannot multiply : a.W = \" + a.W.ToString() + \" with b.H = \" + b.H.ToString());\n else\n {\n Matrix R = new Matrix(a.rows, b.cols);\n for (int i = 0; i < R.rows; i++)\n for (int j = 0; j < R.cols; j++)\n for (int k = 0; k < a.cols; k++)\n {\n R[i, j] = Calculator.Sum(R[i, j], Calculator.Multiply(a[i, k], b[k, j]));\n }\n\n return R;\n }\n }\n }\n\n public static class Calculator\n {\n public static T Sum(T a, T b)\n {\n return Number.Sum(a, b);\n }\n }\n\n public interface ICalculator\n {\n T Sum(T a, T b);\n T Difference(T a, T b);\n int Compare(T a, T b);\n T Multiply(T a, T b);\n T Divide(T a, T b);\n T Divide(T a, int b);\n }\n\n struct Int32Calculator : ICalculator\n {\n public Int32 Sum(Int32 a, Int32 b)\n {\n return a + b;\n }\n\n public Int32 Difference(Int32 a, Int32 b)\n {\n return a - b;\n }\n\n public int Compare(Int32 a, Int32 b)\n {\n return Difference(a, b);\n }\n\n public int Multiply(Int32 a, Int32 b)\n {\n return a * b;\n }\n\n public int Divide(Int32 a, Int32 b)\n {\n return a / b;\n }\n }\n\n struct Int64Calculator : ICalculator\n {\n public Int64 Sum(Int64 a, Int64 b)\n {\n return a + b;\n }\n\n public Int64 Difference(Int64 a, Int64 b)\n {\n return a - b;\n }\n\n public int Compare(Int64 a, Int64 b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Int64 Multiply(Int64 a, Int64 b)\n {\n return a * b;\n }\n\n public Int64 Divide(Int64 a, Int64 b)\n {\n return a / b;\n }\n\n public Int64 Divide(Int64 a, int b)\n {\n return a / b;\n }\n }\n\n struct SingleCalculator : ICalculator\n {\n public Single Sum(Single a, Single b)\n {\n return a + b;\n }\n\n public Single Difference(Single a, Single b)\n {\n return a - b;\n }\n\n public int Compare(Single a, Single b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public Single Multiply(Single a, Single b)\n {\n return a * b;\n }\n\n public Single Divide(Single a, Single b)\n {\n return a / b;\n }\n\n public Single Divide(Single a, int b)\n {\n return a / b;\n }\n }\n\n struct DoubleCalculator : ICalculator\n {\n public double Sum(double a, double b)\n {\n return a + b;\n }\n\n public double Difference(double a, double b)\n {\n return a - b;\n }\n\n public int Compare(double a, double b)\n {\n if (a > b)\n {\n return 1;\n }\n else if (a < b)\n {\n return -1;\n }\n else\n {\n return 0;\n }\n }\n\n public double Multiply(double a, double b)\n {\n return a * b;\n }\n\n public Double Divide(Double a, Double b)\n {\n return a / b;\n }\n\n public Double Divide(Double a, int b)\n {\n return a / b;\n }\n }\n\n struct StringCalculator : ICalculator\n {\n public string Sum(string a, string b)\n {\n return a + b;\n }\n\n public string Difference(string a, string b)\n {\n if (b.Length < a.Length)\n {\n return a.Substring(0, b.Length);\n }\n else\n {\n return \"\";\n }\n }\n\n public int Compare(string a, string b)\n {\n return a.CompareTo(b);\n }\n\n public string Multiply(string a, string b)\n {\n if (a.Length == 1 && b.Length == 1)\n {\n return ((char)(((byte)a[0] * (byte)b[0]) % 256)) + \"\";\n }\n\n int bigLength = Math.Max(a.Length, b.Length);\n while (a.Length < bigLength)\n {\n a = \" \" + a;\n }\n\n while (b.Length < bigLength)\n {\n b = \" \" + b;\n }\n\n string result = \"\";\n for (int i = 0; i < bigLength; i++)\n {\n Number numA = a[i] + \"\";\n Number numB = b[i] + \"\";\n result += numA * numB;\n }\n\n return result;\n }\n\n public String Divide(String a, String b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n\n public String Divide(String a, int b)\n {\n return String.Format(\"{0} / {1}\", a, b);\n }\n }\n\n public class Number\n {\n private T value;\n public Number(T value)\n {\n this.value = value;\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n public static Type GetCalculatorType()\n {\n Type tType = typeof (T);\n Type calculatorType = null;\n if (tType == typeof (Int32))\n {\n calculatorType = typeof (Int32Calculator);\n }\n else if (tType == typeof (Int64))\n {\n calculatorType = typeof (Int64Calculator);\n }\n else if (tType == typeof (Double))\n {\n calculatorType = typeof (DoubleCalculator);\n }\n else if (tType == typeof (string))\n {\n calculatorType = typeof (StringCalculator);\n }\n else\n {\n throw new InvalidCastException(String.Format(\"Unsupported Type- Type {0} does not have a partner implementation of interface ICalculator and cannot be used in generic arithmetic using type Number\", tType.Name));\n }\n\n return calculatorType;\n }\n\n private static ICalculator fCalculator = null;\n public static ICalculator Calculator\n {\n get\n {\n if (fCalculator == null)\n {\n MakeCalculator();\n }\n\n return fCalculator;\n }\n }\n\n public static void MakeCalculator()\n {\n Type calculatorType = GetCalculatorType();\n fCalculator = Activator.CreateInstance(calculatorType) as ICalculator;\n }\n\n#region operation methods\n public static T Sum(T a, T b)\n {\n return Calculator.Sum(a, b);\n }\n\n public static T Difference(T a, T b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static int Compare(T a, T b)\n {\n return Calculator.Compare(a, b);\n }\n\n public static T Multiply(T a, T b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static T Divide(T a, T b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static T Divide(T a, int b)\n {\n return Calculator.Divide(a, b);\n }\n\n#endregion\n#region Operators\n public static implicit operator Number(T a)\n {\n return new Number(a);\n }\n\n public static implicit operator T(Number a)\n {\n return a.value;\n }\n\n public static Number operator +(Number a, Number b)\n {\n return Calculator.Sum(a.value, b.value);\n }\n\n public static Number operator -(Number a, Number b)\n {\n return Calculator.Difference(a, b);\n }\n\n public static bool operator>(Number a, Number b)\n {\n return Calculator.Compare(a, b) > 0;\n }\n\n public static bool operator <(Number a, Number b)\n {\n return Calculator.Compare(a, b) < 0;\n }\n\n public static Number operator *(Number a, Number b)\n {\n return Calculator.Multiply(a, b);\n }\n\n public static Number operator /(Number a, Number b)\n {\n return Calculator.Divide(a, b);\n }\n\n public static Number operator /(Number a, int b)\n {\n return Calculator.Divide(a, b);\n }\n#endregion\n }\n}\n#region DataStructures\n#region IComparable implementation\n#endregion\n#region Model\n#endregion\n#region Constructors\n#endregion\n#region Internal\n#region IEqualityComparer implementation\n#endregion\n#endregion\n#region IGraph implementation\n#endregion\n#region Clique invariants\n#endregion\n#region Clique methods\n#endregion\n#region IEquatable implementation\n#endregion\n#endregion\n#region Algorithms\n#endregion\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int n = s1.Length;\n int a = 0, b = 0,m=0;\n for (int i = 0; i < n; i++)\n {\n if (s1[i] == '+')\n a++;\n else\n a--;\n if (s2[i] == '+')\n b++;\n if (s2[i] == '-')\n b--;\n if (s2[i] == '?')\n m++;\n }\n int x = Math.Abs(a - b);\n if (m < x)\n Console.WriteLine(\"0,000000000000\");\n else\n {\n if (m == x)\n Console.WriteLine(\"{0:f12}\",1.0 / (double)f(m));\n else\n {\n if((m%2==0&&x%2==0)||(m%2!=0&&x%2!=0))\n Console.WriteLine(\"{0:f12}\",(double)f(x) / (double)f(m));\n else\n Console.WriteLine(\"0,000000000000\");\n }\n }\n // Console.ReadKey();\n }\n static int f(int n)\n {\n if (n == 0)\n return 1;\n else\n {\n int k=1;\n for (int i = 1; i <= n; i++)\n k = k * i;\n return k;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int n = s1.Length;\n int a = 0, b = 0,m=0;\n for (int i = 0; i < n; i++)\n {\n if (s1[i] == '+')\n a++;\n else\n a--;\n if (s2[i] == '+')\n b++;\n if (s2[i] == '-')\n b--;\n if (s2[i] == '?')\n m++;\n }\n int x = Math.Abs(a - b);\n if (m < x)\n Console.WriteLine(\"0.000000000000\");\n else\n {\n if (m == x)\n Console.WriteLine(\"{0:f12}\",1.0 / (double)f(m));\n else\n {\n if((m%2==0&&x%2==0)||(m%2!=0&&x%2!=0))\n Console.WriteLine(\"{0:f12}\",(double)f(x) / (double)f(m));\n else\n Console.WriteLine(\"0.000000000000\");\n }\n }\n // Console.ReadKey();\n }\n static int f(int n)\n {\n if (n == 0)\n return 1;\n else\n {\n int k=1;\n for (int i = 1; i <= n; i++)\n k = k * i;\n return k;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int n = s1.Length;\n int a = 0, b = 0,m=0;\n for (int i = 0; i < n; i++)\n {\n if (s1[i] == '+')\n a++;\n else\n a--;\n if (s2[i] == '+')\n b++;\n if (s2[i] == '-')\n b--;\n if (s2[i] == '?')\n m++;\n }\n int x = Math.Abs(a - b);\n if (m < x)\n Console.WriteLine(\"0.000000000\");\n else\n {\n if (m == x)\n Console.WriteLine(\"{0:f12}\",1.0 / (double)f(m));\n else\n {\n if((m%2==0&&x%2==0)||(m%2!=0&&x%2!=0))\n {\n Console.WriteLine(\"{0:f12}\",(double)f(x) / (double)f(m));\n }\n else\n Console.WriteLine(\"0.000000000\");\n }\n }\n // Console.ReadKey();\n }\n static int f(int n)\n {\n if (n == 0)\n return 1;\n else\n {\n int k=1;\n for (int i = 1; i <= n; i++)\n k = k * i;\n return k;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int x1 = 0,x2=0,k=0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+')\n x1++;\n else\n x1--;\n if (s2[i] == '+')\n x2++;\n if (s2[i] == '-')\n x2--;\n if (s2[i] == '?')\n k++;\n }\n int[,] a = new int[(int)Math.Pow(2, k),k+1];\n int res = 0;\n for (int j = 0; j < (int)Math.Pow(2, k); j++)\n {\n int y=0;\n for (int i = 0; i < k; i++)\n {\n int l=(int)Math.Pow(2,k-1-i);\n if (((j/l)%l)%2==0)\n y++;\n else\n y--;\n }\n if (y + x2 == x1)\n res++;\n }\n Console.WriteLine(((double)res / Math.Pow(2, k)).ToString().Replace(',','.'));\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _1A\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int n = s1.Length;\n int a = 0, b = 0,m=0;\n for (int i = 0; i < n; i++)\n {\n if (s1[i] == '+')\n a++;\n else\n a--;\n if (s2[i] == '+')\n b++;\n if (s2[i] == '-')\n b--;\n if (s2[i] == '?')\n m++;\n }\n int x = Math.Abs(a - b);\n if (m < x)\n Console.WriteLine(\"0.000000000\");\n else\n {\n if (m == x)\n Console.WriteLine(\"{0:f9}\",1.0 / (double)f(m));\n else\n {\n if((m%2==0&&x%2==0)||(m%2!=0&&x%2!=0))\n {\n Console.WriteLine(\"{0:f9}\",(double)f(x) / (double)f(m));\n }\n else\n Console.WriteLine(\"0.000000000\");\n }\n }\n // Console.ReadKey();\n }\n static int f(int n)\n {\n if (n == 0)\n return 1;\n else\n {\n int k=1;\n for (int i = 1; i <= n; i++)\n k = k * i;\n return k;\n }\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace dr2\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var s = Console.ReadLine();\n var got = Console.ReadLine();\n var fp = 0;\n for (int i = 0; i < got.Length; i++)\n {\n if (s[i] == '+')\n {\n fp++;\n }\n else\n {\n fp--;\n }\n }\n\n var dp = 0;\n var ac = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (got[i] == '?')\n {\n ac++;\n }\n else if (got[i] == '+')\n {\n dp++;\n }\n else\n {\n dp--;\n }\n }\n\n if (ac == 0)\n {\n if (dp == fp)\n {\n Console.WriteLine(1);\n }\n else\n {\n Console.WriteLine(0);\n }\n\n return;\n }\n\n var need = 0;\n if (dp * fp > 0)\n {\n need = Math.Abs(dp - fp);\n }\n else if (dp * fp == 0)\n {\n need = Math.Max(dp, fp);\n }\n else\n {\n need = Math.Abs(dp) + Math.Abs(fp);\n }\n\n if (ac < need)\n {\n Console.WriteLine(0);\n return;\n }\n\n var fa = new int[11];\n fa[0] = 1;\n for (int i = 1; i < 10 + 1; i++)\n {\n fa[i] = i * fa[i - 1];\n }\n \n var count = 0;\n var oc = 0;\n for (int i = 0; i <= ac; i++)\n {\n var rem = ac - i;\n count += fa[ac] / (fa[i] * fa[rem]);\n\n if (i - rem == need)\n {\n oc += fa[ac] / (fa[i] * fa[rem]);\n }\n }\n\n var res = (double)oc / (count);\n Console.WriteLine(res.ToString(CultureInfo.InvariantCulture));\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = (total == 0 ? 0 : correct/(decimal)total);\n Console.WriteLine(\"1.000000000000\");//string.Format(\"{0:0.00000000000}\",prob)\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine((total == 0 ? 0 : correct/(decimal)total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 1m ;\n decimal total = 1m;\n total = (decimal)posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.################}\",correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = (total == 0 ? 0 : correct/(decimal)total);\n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",prob));\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 1m ;\n decimal total = 1m;\n \n \n Console.WriteLine(string.Format(\"{0:0.################}\",correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = (total == 0 ? 0 : correct/(decimal)total);\n Console.WriteLine(string.Format(\"{0:0.00000000000}\",prob));\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 0m ;\n decimal total = 0m;\n total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",(total == 0 ? 0 : correct/(decimal)total)));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n decimal total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine((total == 0 ? 0 : correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 0m ;\n decimal total = 0m;\n total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",(total == 0 ? 0 : correct/(decimal)total)));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 1m ;\n decimal total = 1m;\n \n \n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = total == 0 ? 0 : correct/(decimal)total;\n Console.WriteLine(string.Format(\"{0:0.000000000000}\",prob));\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n double prob = total == 0 ? 0 : correct/(double)total;\n Console.WriteLine(string.Format(\"{0:0.000000000}\",prob));\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n int total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n decimal prob = (total == 0 ? 0 : correct/(decimal)total);\n Console.WriteLine(prob);\n //string.Format(\"{0:0.00000000000000}\",prob)\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n decimal correct = 1m ;\n decimal total = 1m;\n total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.################}\",correct/total));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string str1 = Console.ReadLine().Trim();\n string str2 = Console.ReadLine().Trim();\n int finalpos = 0 ;\n for(int i = 0 ; i < str1.Length ; i++){\n if(str1[i] == '+')\n finalpos++;\n else\n finalpos--;\n }\n posList = new List();\n Recur(str2,0,0);\n int correct = 0 ;\n decimal total = 0m;\n total = posList.Count;\n foreach(int item in posList){\n if(item == finalpos){\n correct++;\n }\n }\n \n Console.WriteLine(string.Format(\"{0:0.00000000000000}\",(total == 0 ? 0 : correct/(decimal)total)));\n //\n }\n static List posList;\n public static void Recur(string str , int pos , int strpos){\n if(strpos == str.Length){\n posList.Add(pos);\n return;\n }\n if(str[strpos] == '+'){\n Recur(str,pos+1,strpos+1);\n } else if (str[strpos] == '-'){\n Recur(str,pos-1,strpos + 1);\n } else {\n Recur(str,pos+1,strpos+1);\n Recur(str,pos-1,strpos+1);\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int sum = 0, n = 0;\n char[] aux = Console.ReadLine().ToCharArray();\n for (int i = 0; i < aux.Length; i++) {\n if (aux[i] == '?') {\n n++;\n } else if (aux[i] == '+') {\n sum++;\n } else {\n sum--;\n }\n }\n aux = Console.ReadLine().ToCharArray();\n for (int i = 0; i < aux.Length; i++) {\n if (aux[i] == '?') {\n n++;\n } else if (aux[i] == '+') {\n sum--;\n } else {\n sum++;\n }\n }\n if (sum < 0){\n sum = -sum;\n }\n double[] fact = new double[11];\n fact[0] = 1.0;\n for (int i = 1; i <= 10; i++) {\n fact[i] = fact[i - 1] * i;\n }\n double ans = 0.0;\n int test = n - sum;\n if (test % 2 == 0) {\n test /= 2;\n test += sum;\n if (n == 0) {\n ans = 1.0;\n } else if (test <= n) {\n ans = (fact[n]/(fact[test]*fact[n-test]))/(1 << n);\n } \n }\n Console.Write(ans.ToString(CultureInfo.CreateSpecificCulture(\"en-GB\")));\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _476b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int transmit=0;\n int reseive = 0;\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int count = 0;\n int count2 = 0;\n int i = 0;\n while (i < s1.Length)\n {\n transmit += s1[i] == '+' ? 1 : -1;\n if (s2[i] != '?')\n reseive += s2[i] == '+' ? 1 : -1;\n else\n count++;\n i++;\n }\n if(count == 0)\n {\n if (transmit == reseive)\n Console.WriteLine(1);\n else\n Console.Write(0);\n }\n else\n {\n if ((transmit - reseive) % 2 == s1.Length % 2 && (transmit - reseive) < s1.Length && (transmit - reseive) > -s1.Length )\n {\n int k = (count - (transmit - reseive)) / 2;\n double result = 1;\n for(int z = 0; z -count)\n {\n int k = (count - (transmit - reseive)) / 2;\n double result = 1;\n for (int z = 0; z < k; z++)\n {\n result *= (double)(count - z) / (z + 1);\n }\n Console.WriteLine((result / Math.Pow(2, count)).ToString(\"0.000000000000\").Replace(',', '.'));\n }\n else\n {\n Console.WriteLine(0);\n } \n \n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _476b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int transmit=0;\n int reseive = 0;\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int count = 0;\n int count2 = 0;\n int i = 0;\n while (i < s1.Length)\n {\n transmit += s1[i] == '+' ? 1 : -1;\n if (s2[i] != '?')\n reseive += s2[i] == '+' ? 1 : -1;\n else\n count++;\n i++;\n }\n if(count == 0)\n {\n if (transmit == reseive)\n Console.WriteLine(1);\n else\n Console.Write(0);\n }\n else\n {\n if ((transmit - reseive) % 2 == s1.Length % 2 && (transmit - reseive) < s1.Length && (transmit - reseive) > -s1.Length )\n {\n int k = (s1.Length - (transmit - reseive)) / 2;\n double result = 1;\n for(int z = 0; z= -count)\n {\n int k = (count - (transmit - reseive)) / 2;\n double result = 1;\n for (int z = 0; z < k; z++)\n {\n result *= (double)(count - z) / (z + 1);\n }\n Console.WriteLine((result / Math.Pow(2, count)).ToString(\"0.000000000000\").Replace(',', '.'));\n }\n else\n {\n Console.WriteLine(0);\n } \n \n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace cf\n{\n public class Cf\n {\n private static void Println(int n)\n {\n Console.WriteLine(n);\n }\n\n private static void Println(String s)\n {\n Console.WriteLine(s);\n }\n\n private static void Print(int n)\n {\n Console.Write(n);\n }\n\n private static void Print(String s)\n {\n Console.Write(s);\n }\n\n public static void Main(String[] args)\n {\n B();\n }\n\n private static void C()\n {\n }\n\n private static void A()\n {\n var scanner = new MyScanner();\n var n = scanner.NextInt();\n var m = scanner.NextInt();\n var x2 = n / 2;\n var x1 = n % 2;\n var d = (m - ((x1 + x2) % m)) % m;\n x2 -= d;\n x1 += 2 * d;\n if (x2 < 0)\n {\n Print(-1);\n }\n else\n {\n Print(x1 + x2);\n }\n }\n\n private static void B()\n {\n var f = new int[11];\n f[0] = 1;\n for (int i = 1; i < 11; i++)\n f[i] = f[i - 1]*i;\n var scanner = new MyScanner();\n var s1 = scanner.NextString();\n var s2 = scanner.NextString();\n var p1 = s1.Count(c => c == '+') - s1.Count(c => c == '-');\n var p2 = s2.Count(c => c == '+') - s2.Count(c => c == '-');\n var d = Math.Abs(p1 - p2);\n var q = s2.Count(c => c == '?');\n if (d > q)\n {\n Print(0);\n return;\n }\n var x = q - d;\n if (x%2 == 1)\n {\n Print(0);\n return;\n }\n x /= 2;\n double pp = ((double)f[q])/(f[x]*f[q - x]);\n Print((pp/Math.Pow(2,q)).ToString());\n }\n }\n\n class Pair\n {\n public int X;\n public int Y;\n\n Pair(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n }\n class MyScanner\n {\n private String[] _buffer;\n private int _pos = 0;\n\n public int NextInt()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return int.Parse(_buffer[_pos - 1]);\n }\n\n public String NextString()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return _buffer[_pos - 1];\n }\n\n public List GetIntList(int n)\n {\n var result = new List(n);\n for (int i = 0; i < n; i++)\n result.Add(NextInt());\n return result;\n }\n\n public int[] GetIntArray(int n)\n {\n var result = new int[n];\n for (int i = 0; i < n; i++)\n result[i] = (NextInt());\n return result;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace cf\n{\n public class Cf\n {\n private static void Println(int n)\n {\n Console.WriteLine(n);\n }\n\n private static void Println(String s)\n {\n Console.WriteLine(s);\n }\n\n private static void Print(int n)\n {\n Console.Write(n);\n }\n\n private static void Print(String s)\n {\n Console.Write(s);\n }\n\n public static void Main(String[] args)\n {\n B();\n }\n\n private static void C()\n {\n }\n\n private static void A()\n {\n var scanner = new MyScanner();\n var n = scanner.NextInt();\n var m = scanner.NextInt();\n var x2 = n / 2;\n var x1 = n % 2;\n var d = (m - ((x1 + x2) % m)) % m;\n x2 -= d;\n x1 += 2 * d;\n if (x2 < 0)\n {\n Print(-1);\n }\n else\n {\n Print(x1 + x2);\n }\n }\n\n private static void B()\n {\n var f = new int[11];\n f[0] = 1;\n for (int i = 1; i < 11; i++)\n f[i] = f[i - 1]*i;\n var scanner = new MyScanner();\n var s1 = scanner.NextString();\n var s2 = scanner.NextString();\n var p1 = s1.Count(c => c == '+') - s1.Count(c => c == '-');\n var p2 = s2.Count(c => c == '+') - s2.Count(c => c == '-');\n var d = Math.Abs(p1 - p2);\n var q = s2.Count(c => c == '?');\n if (d > q)\n {\n Print(0);\n return;\n }\n double pp = ((double)f[q])/(f[d]*f[q - d]);\n Print((pp/Math.Pow(2,q)).ToString());\n }\n }\n\n class Pair\n {\n public int X;\n public int Y;\n\n Pair(int x, int y)\n {\n this.X = x;\n this.Y = y;\n }\n }\n class MyScanner\n {\n private String[] _buffer;\n private int _pos = 0;\n\n public int NextInt()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return int.Parse(_buffer[_pos - 1]);\n }\n\n public String NextString()\n {\n if (_buffer == null)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n if (_buffer.Length <= _pos)\n {\n _buffer = Console.ReadLine().Split(' ');\n _pos = 0;\n }\n _pos++;\n return _buffer[_pos - 1];\n }\n\n public List GetIntList(int n)\n {\n var result = new List(n);\n for (int i = 0; i < n; i++)\n result.Add(NextInt());\n return result;\n }\n\n public int[] GetIntArray(int n)\n {\n var result = new int[n];\n for (int i = 0; i < n; i++)\n result[i] = (NextInt());\n return result;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n {\n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n Console.WriteLine(\"{0:F20}\", GetResult(send, received));\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if (incorrectdiff + count > unknown)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n Console.WriteLine(res.Replace(',', '.'));\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if (incorrectdiff + count > unknown)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n Console.WriteLine(res.Replace(',', '.'));\n\n Console.ReadLine();\n }\n\n static int Fact(int n)\n {\n int res = 1;\n for (int i = 2; i <= n; i++)\n {\n res *= i;\n }\n\n return res;\n }\n\n static int C(int a, int n)\n {\n return (Fact(n) / Fact(a)) / Fact(n - a);\n }\n\n static double GetResult(string send, string received)\n { \n int plus = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n int diff = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n {\n ++diff;\n ++plus;\n }\n else\n --diff;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if ( Math.Abs(incorrectdiff) > unknown - diff)\n return 0.0;\n\n return C(plus,unknown) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n Console.WriteLine(res.Replace(',', '.'));\n\n Console.ReadLine();\n }\n\n static int Fact(int n)\n {\n int res = 1;\n for (int i = 2; i <= n; i++)\n {\n res *= i;\n }\n\n return res;\n }\n\n static int C(int a, int n)\n {\n return (Fact(n) / Fact(a)) / Fact(n - a);\n }\n\n static double GetResult(string send, string received)\n { \n int plus = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n int diff = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n {\n ++diff;\n ++plus;\n }\n else\n --diff;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if ( Math.Abs(incorrectdiff) > unknown - diff)\n return 0.0;\n\n return C(plus + incorrectdiff,unknown) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n Console.WriteLine(res.Replace(',', '.'));\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if ( Math.Abs(incorrectdiff) > unknown - count)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n {\n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n Console.WriteLine(\"{0:F12}\", GetResult(send, received));\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if (incorrectdiff + count > unknown)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n {\n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n Console.WriteLine(GetResult(send, received));\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if (incorrectdiff + count > unknown)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Task_TD\n{\n class Program\n {\n const char Forward = '+';\n const char Backward = '-';\n const char Unknown = '?';\n\n static void Main(string[] args)\n { \n string send = Console.ReadLine();\n string received = Console.ReadLine();\n\n string res = String.Format (\"{0:F12}\", GetResult(send, received));\n res.Replace(',', '.');\n Console.WriteLine(res);\n\n Console.ReadLine();\n }\n\n\n static double GetResult(string send, string received)\n {\n if (!received.Contains(Unknown))\n return 1.0;\n \n int count = 0;\n int incorrectdiff = 0;\n int unknown = 0;\n for (int i = 0; i < send.Length; i++)\n {\n if (received[i] == Unknown)\n {\n if (send[i] == Forward)\n ++count;\n else\n --count;\n\n ++unknown;\n }\n else if (received[i] != send[i])\n {\n if (send[i] == Forward)\n --incorrectdiff;\n else\n ++incorrectdiff;\n }\n }\n\n if (incorrectdiff + count > unknown)\n return 0.0;\n\n return (unknown * (unknown - 1)) / (Math.Pow(2.0, unknown));\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static long v = 0;\n\n static void Perebor(int q, int dr, ref int orig) {\n if(q == 0) {\n if(dr == orig)\n v++;\n return;\n }\n Perebor(q - 1, dr + 1, ref orig);\n Perebor(q - 1, dr - 1, ref orig);\n }\n\n static void Main(string[] args) {\n string s1 = reader.ReadLine();\n string s2 = reader.ReadLine();\n int orig = 0;\n foreach(char c in s1) {\n switch(c) {\n case '+':\n orig++;\n break;\n case '-':\n orig--;\n break;\n }\n }\n int dr = 0;\n int q = 0;\n foreach(char c in s2) {\n switch(c) {\n case '+':\n dr++;\n break;\n case '-':\n dr--;\n break;\n case '?':\n q++;\n break;\n }\n }\n\n Perebor(q, dr, ref orig);\n long all = (long) Math.Pow(2, q);\n double ans = v / (double) all;\n writer.WriteLine(\"{0:0.000000000000}\", ans);\n\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prB {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n\n static long v = 0;\n\n static void Perebor(int q, int dr, ref int orig) {\n if(q == 0) {\n if(dr == orig)\n v++;\n return;\n }\n Perebor(q - 1, dr + 1, ref orig);\n Perebor(q - 1, dr - 1, ref orig);\n }\n\n static void Main(string[] args) {\n string s1 = reader.ReadLine();\n string s2 = reader.ReadLine();\n int orig = 0;\n foreach(char c in s1) {\n switch(c) {\n case '+':\n orig++;\n break;\n case '-':\n orig--;\n break;\n }\n }\n int dr = 0;\n int q = 0;\n foreach(char c in s2) {\n switch(c) {\n case '+':\n dr++;\n break;\n case '-':\n dr--;\n break;\n case '?':\n q++;\n break;\n }\n }\n\n Perebor(q, dr, ref orig);\n long all = (long) Math.Pow(2, q);\n double ans = v / (double) all;\n writer.WriteLine(ans);\n\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1.Dynamic\n{\n class _476B\n {\n public static int Main()\n {\n var s1 = Console.ReadLine();\n var s2 = Console.ReadLine();\n var possible = new List();\n possible.Add(s2);\n for(var i = 0; i < s2.Length; i++)\n {\n if(s2[i] == '?')\n {\n var newAll = new List();\n for (var j = 0; j < possible.Count; j++)\n {\n var cur = possible[j].ToCharArray().ToArray();\n cur[i] = '+';\n newAll.Add(new string(cur));\n cur[i] = '-';\n newAll.Add(new string(cur));\n }\n possible = newAll;\n }\n }\n var result = 0;\n for(var i = 0; i < s1.Length; i++)\n {\n if(s1[i] == '-')\n {\n result -= 1;\n } else\n {\n result += 1;\n }\n }\n double good = 0;\n for(var i = 0; i < possible.Count; i++)\n {\n var res = 0;\n for(var j = 0; j < possible[i].Length; j++)\n {\n if(possible[i][j] == '-')\n {\n res -= 1;\n } else\n {\n res += 1;\n }\n }\n if(res == result)\n {\n good++;\n }\n }\n Console.WriteLine(good/possible.Count);\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Dreamoon and WiFi\n* URL : http://codeforces.com/problemset/problem/476/B\n* Occasion : Codeforces Round #273 (Div. 2)\n* Date : Sep 13 2017\n* Complexity : O(n) 46ms, Space O(n)\n* Author : Atiq Rahman\n* Status : Accepted\n* Notes : input limit 10^9 requires larger data type than int\n* meta : tag-combinatories, tag-math, tag-easy\n***************************************************************************/\nusing System;\n\nclass ProbComb {\n int d;\n int d2;\n int q;\n double positive_count;\n\n // Take input strings and represent them in d, d2 and q\n public void TakeInput() {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n d = d2 = q = 0;\n positive_count = 0;\n foreach (char ch in s1)\n switch (ch) {\n case '+':\n d++; break;\n case '-':\n d--; break;\n default:\n break;\n }\n foreach (char ch in s2)\n switch (ch) {\n case '+':\n d2++; break;\n case '-':\n d2--; break;\n case '?':\n q++; break;\n default:\n break;\n }\n }\n\n public double GetProbability() {\n if (Math.Abs(d - d2) > q)\n return 0.0;\n Comb(d2, 0);\n double res = positive_count / (q==0?1:Math.Pow(2, q));\n return res;\n }\n\n public void Comb(int v, int k) {\n if (k == q) {\n if (v == d)\n positive_count++;\n return;\n }\n Comb(v + 1, k+1);\n Comb(v - 1, k+1);\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n ProbComb PC = new ProbComb();\n PC.TakeInput();\n Console.WriteLine(\"{0:F9}\", PC.GetProbability());\n // Console.WriteLine(PC.GetProbability());\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Dreamoon and WiFi\n* URL : http://codeforces.com/problemset/problem/476/B\n* Occasion : Codeforces Round #273 (Div. 2)\n* Date : Sep 13 2017\n* Complexity : O(n) 46ms, Space O(n)\n* Author : Atiq Rahman\n* Status : Accepted\n* Notes : input limit 10^9 requires larger data type than int\n* meta : tag-combinatories, tag-math, tag-easy\n***************************************************************************/\nusing System;\n\nclass ProbComb {\n int d;\n int d2;\n int q;\n double positive_count;\n\n // Take input strings and represent them in d, d2 and q\n public void TakeInput() {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n d = d2 = q = 0;\n positive_count = 0;\n foreach (char ch in s1)\n switch (ch) {\n case '+':\n d++; break;\n case '-':\n d--; break;\n default:\n break;\n }\n foreach (char ch in s2)\n switch (ch) {\n case '+':\n d2++; break;\n case '-':\n d2--; break;\n case '?':\n q++; break;\n default:\n break;\n }\n }\n\n public double GetProbability() {\n if (Math.Abs(d - d2) > q)\n return 0.0;\n Comb(d2, 0);\n double res = positive_count / (q==0?1:(q * q));\n return res;\n }\n\n public void Comb(int v, int k) {\n if (k == q) {\n if (v == d)\n positive_count++;\n return;\n }\n Comb(v + 1, k+1);\n Comb(v - 1, k+1);\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n ProbComb PC = new ProbComb();\n PC.TakeInput();\n Console.WriteLine(\"{0:F12}\", PC.GetProbability());\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Dreamoon and WiFi\n* URL : http://codeforces.com/problemset/problem/476/B\n* Occasion : Codeforces Round #273 (Div. 2)\n* Date : Sep 13 2017\n* Complexity : O(n) 46ms, Space O(n)\n* Author : Atiq Rahman\n* Status : Accepted\n* Notes : input limit 10^9 requires larger data type than int\n* meta : tag-combinatories, tag-math, tag-easy\n***************************************************************************/\nusing System;\n\nclass ProbComb {\n int d;\n int d2;\n int q;\n double positive_count;\n\n // Take input strings and represent them in d, d2 and q\n public void TakeInput() {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n d = d2 = q = 0;\n positive_count = 0;\n foreach (char ch in s1)\n switch (ch) {\n case '+':\n d++; break;\n case '-':\n d--; break;\n default:\n break;\n }\n foreach (char ch in s2)\n switch (ch) {\n case '+':\n d2++; break;\n case '-':\n d2--; break;\n case '?':\n q++; break;\n default:\n break;\n }\n }\n\n public double GetProbability() {\n if (Math.Abs(d - d2) > q)\n return 0.0;\n Comb(d2, 0);\n double res = positive_count / (q==0?1:(q * q));\n return res;\n }\n\n public void Comb(int v, int k) {\n if (k == q) {\n if (v == d)\n positive_count++;\n return;\n }\n Comb(v + 1, k+1);\n Comb(v - 1, k+1);\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n ProbComb PC = new ProbComb();\n PC.TakeInput();\n //Console.WriteLine(\"{0:F12}\", PC.GetProbability());\n Console.WriteLine(PC.GetProbability());\n }\n}\n"}, {"source_code": "\ufeff// done\n/***************************************************************************\n* Title : Dreamoon and WiFi\n* URL : http://codeforces.com/problemset/problem/476/B\n* Occasion : Codeforces Round #273 (Div. 2)\n* Date : Sep 13 2017\n* Complexity : O(n) 46ms, Space O(n)\n* Author : Atiq Rahman\n* Status : Accepted\n* Notes : input limit 10^9 requires larger data type than int\n* meta : tag-combinatories, tag-math, tag-easy\n***************************************************************************/\nusing System;\n\nclass ProbComb {\n int d;\n int d2;\n int q;\n double positive_count;\n\n // Take input strings and represent them in d, d2 and q\n public void TakeInput() {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n\n d = d2 = q = 0;\n positive_count = 0;\n foreach (char ch in s1)\n switch (ch) {\n case '+':\n d++; break;\n case '-':\n d--; break;\n default:\n break;\n }\n foreach (char ch in s2)\n switch (ch) {\n case '+':\n d2++; break;\n case '-':\n d2--; break;\n case '?':\n q++; break;\n default:\n break;\n }\n }\n\n public double GetProbability() {\n if (Math.Abs(d - d2) > q)\n return 0.0;\n Comb(d2, 0);\n double res = positive_count / (q==0?1:Math.Pow(2, q));\n return res;\n }\n\n public void Comb(int v, int k) {\n if (k == q) {\n if (v == d)\n positive_count++;\n return;\n }\n Comb(v + 1, k+1);\n Comb(v - 1, k+1);\n }\n}\n\npublic class CF_Solution {\n public static void Main() {\n ProbComb PC = new ProbComb();\n PC.TakeInput();\n Console.WriteLine(\"{0:F12}\", PC.GetProbability());\n // Console.WriteLine(PC.GetProbability());\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n\n\nnamespace contest\n{\n\n\n\n\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n\n //int n = int.Parse(Console.ReadLine());\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for (int i = 0; i < n; i++)\n //{\n // input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n //}\n\n\n //int n = int.Parse(Console.ReadLine());\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int n = num[0];\n //int m = num[1];\n\n\n\n //int n = int.Parse(Console.ReadLine());\n //var arr = new int[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();\n //for(int i =0; i< n; i++)\n //{\n // arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //}\n\n\n\n\n //int n = int.Parse(Console.ReadLine());\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n //var arr = new int[n][];\n //for(int i =0; i< n; i++)\n //{\n // arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //}\n\n\n\n\n\n\n //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int t = num[0];\n //int k = num[1];\n\n\n\n string s = Console.ReadLine();\n string t = Console.ReadLine();\n int len = s.Length;\n\n int original = 0;\n for(int i=0; i< len; i++)\n {\n char cur = s[i];\n if (cur == '+') original++;\n else original--;\n\n }\n\n\n int dre = 0;\n int cntQ = 0;\n for (int i = 0; i < len; i++)\n {\n char cur = t[i];\n if (cur == '+') dre++;\n else if(cur == '-')dre--;\n else cntQ++;\n }\n\n double ans = 1.0;\n\n if(cntQ==0 && original==dre) Console.WriteLine(ans);\n else if (cntQ == 0 && original != dre) Console.WriteLine(0.0);\n else\n {\n int dif = Math.Abs(original-dre);\n if (dif > cntQ) ans = 0.0;\n else if (dif % 2 != cntQ % 2) ans = 0.0;\n else\n {\n double d = Math.Pow(2,cntQ);\n double count = 0;\n for(int i=0; i<(1<0)\n {\n if ((tmp & 1) == 1) cnt++;\n tmp >>= 1;\n }\n if ((cntQ-cnt) - (cnt) == dif) count++;\n }\n ans = count / d;\n }\n\n Console.WriteLine(ans);\n }\n\n \n \n\n\n\n\n //Console.WriteLine();\n\n\n\n\n\n }\n\n\n\n }\n\n\n class Segment\n {\n //public int[] arr;\n public Tuple[] arr;\n int n;\n\n public Segment(int n)\n {\n this.n = n * 2;\n //arr = Enumerable.Range(0, n*2).ToArray();\n //arr = new int[this.n];\n arr = new Tuple[this.n];\n for (int i = 0; i < this.n; i++)\n {\n arr[i] = Tuple.Create(0, 0, 0, 0, 0);\n }\n\n }\n\n public void update(int i, int x)\n {\n i = (n / 2) + i - 1;\n //arr[i] = 1;\n if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);\n else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);\n else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);\n else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);\n else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);\n\n while (i > 0)\n {\n i = (i - 1) / 2;\n //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);\n //if (arr[i * 2 + 1] > arr[i * 2 + 2])\n //{\n // arr[i] = arr[i*2+1];\n //}\n //else\n //{\n // arr[i] = arr[i*2+2];\n //}\n //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];\n arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,\n arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,\n arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,\n arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,\n arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);\n }\n\n }\n\n //call : query(a,b, 0, 0, n)\n public Tuple query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);\n if (a <= l && r <= b) return arr[k];\n else\n {\n\n\n\n\n var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);\n var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);\n\n\n\n //if (vl.Item4 > vr.Item4)\n //{\n // return vl;\n //}\n ////else if (vl.Item4 == vr.Item4)\n ////{\n //// if (countA >= countB) return vr;\n //// else return vl;\n ////}\n //else return vr;\n\n\n return Tuple.Create(vl.Item1 + vr.Item1,\n vl.Item2 + vr.Item2,\n vl.Item3 + vr.Item3,\n vl.Item4 + vr.Item4,\n vl.Item5 + vr.Item5);\n\n\n //return Math.Max(vl, vr);\n //return vl\n int countA = 0;\n int countB = 0;\n if (vl.Item1 == 0) countA++;\n if (vl.Item2 == 0) countA++;\n if (vl.Item3 == 0) countA++;\n if (vl.Item4 == 0) countA++;\n if (vl.Item5 == 0) countA++;\n\n if (vr.Item1 == 0) countB++;\n if (vr.Item2 == 0) countB++;\n if (vr.Item3 == 0) countB++;\n if (vr.Item4 == 0) countB++;\n if (vr.Item5 == 0) countB++;\n\n\n if ((vl.Item1 == 0 && vr.Item1 > 0))\n {\n return vr;\n }\n else if ((vl.Item1 > 0 && vr.Item1 == 0))\n {\n return vl;\n }\n else if ((vl.Item2 == 0 && vr.Item2 > 0))\n {\n return vr;\n }\n else if ((vl.Item2 > 0 && vr.Item2 == 0))\n {\n return vl;\n }\n else if ((vl.Item3 == 0 && vr.Item3 > 0))\n {\n return vr;\n }\n else if ((vl.Item3 > 0 && vr.Item3 == 0))\n {\n return vl;\n }\n else if ((vl.Item4 == 0 && vr.Item4 > 0))\n {\n return vr;\n }\n else if ((vl.Item4 > 0 && vr.Item4 == 0))\n {\n return vl;\n }\n else if ((vl.Item5 == 0 && vr.Item5 > 0))\n {\n return vr;\n }\n else if ((vl.Item5 > 0 && vr.Item5 == 0))\n {\n return vl;\n }\n\n if (vl.Item4 > vr.Item4)\n {\n return vl;\n }\n else if (vl.Item4 == vr.Item4)\n {\n if (countA >= countB) return vr;\n else return vl;\n }\n else return vr;\n\n //if (countA <= countB) return vl;\n //else return vr;\n }\n }\n\n\n }\n\n\n class UnionFind\n {\n public int[] path;\n\n\n public UnionFind(int n)\n {\n path = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n path[i] = i;\n }\n\n }\n\n private int root(int i)\n {\n while (i != path[i])\n {\n path[i] = path[path[i]];\n i = path[i];\n }\n return i;\n }\n\n\n\n public bool find(int p, int q)\n {\n return root(p) == root(q);\n }\n\n\n\n public void unite(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n path[i] = j;\n }\n\n\n }\n}\n"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var dest = _.NextToken().ToCharArray().Select(x => x == '+' ? 1 : -1).Sum();\n var input = _.NextToken().ToCharArray();\n var tempDest = input.Select(x => x == '+' ? 1 : (x == '-' ? -1 : 0)).Sum();\n var nq = input.Count(x => x == '?');\n _.WriteLine(Answer(nq, Math.Abs(dest - tempDest)).ToString(\"F9\", CultureInfo.InvariantCulture));\n }\n\n decimal Answer(int n, int d)\n {\n return (n - d) % 2 == 0 ? BinomialProb(n, Math.Abs((n - d)/2)) : 0;\n }\n\n decimal BinomialProb(int n, int k)\n {\n if (n == 0) return 1;\n return k > n ? 0 : Divide(BinCoef(n, k), BigInteger.Pow(2, n));\n }\n\n private decimal Divide(BigInteger x, BigInteger y)\n {\n var gcd = BigInteger.GreatestCommonDivisor(x, y);\n x = x / gcd;\n y = y / gcd;\n return (decimal)x / (decimal)y;\n }\n\n BigInteger BinCoef(int n, int k)\n {\n\n return Prod(k + 1, n) / Prod(2, n - k);\n }\n\n BigInteger Prod(int s, int t)\n {\n var result = BigInteger.One;\n for (var i = s; i <= t; i++)\n {\n result *= i;\n }\n return result;\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var dest = _.NextToken().ToCharArray().Select(x => x == '+' ? 1 : -1).Sum();\n var input = _.NextToken().ToCharArray();\n var tempDest = input.Select(x => x == '+' ? 1 : (x == '-' ? -1 : 0)).Sum();\n var nq = input.Count(x => x == '?');\n _.WriteLine(Answer(nq, Math.Abs(dest - tempDest)).ToString(\"F9\", CultureInfo.InvariantCulture));\n }\n\n decimal Answer(int n, int d)\n {\n return (n - d) % 2 == 0 ? BinomialProb(n, (n - d)/2) : 0;\n }\n\n decimal BinomialProb(int n, int k)\n {\n if (n == 0) return 1;\n return k > n ? 0 : Divide(BinCoef(n, k), BigInteger.Pow(2, n));\n }\n\n private decimal Divide(BigInteger x, BigInteger y)\n {\n var gcd = BigInteger.GreatestCommonDivisor(x, y);\n x = x / gcd;\n y = y / gcd;\n return (decimal)x / (decimal)y;\n }\n\n BigInteger BinCoef(int n, int k)\n {\n\n return Prod(k + 1, n) / Prod(2, n - k);\n }\n\n BigInteger Prod(int s, int t)\n {\n var result = BigInteger.One;\n for (var i = s; i <= t; i++)\n {\n result *= i;\n }\n return result;\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n\n private string[] NextStringArray() { return Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); }\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = NextStringArray();\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n public int[] NextIntArray() { return NextStringArray().Select(int.Parse).ToArray(); }\n public long[] NextLongArray() { return NextStringArray().Select(long.Parse).ToArray(); }\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string signal = Console.ReadLine();\n string inner = Console.ReadLine();\n int path = 0, wrPath = 0, qMark = 0;\n\n for (int i = 0; i < signal.Length; ++i) \n { \n if (signal[i] == '+') path++; \n else path--;\n\n if (inner[i] == '+') wrPath++;\n else if (inner[i] == '-') wrPath--;\n else qMark++;\n }\n\n if (wrPath == path && qMark == 0) { Console.WriteLine(\"{0:F12}\",1); return; }\n if(Math.Abs(path - wrPath) > qMark) { Console.WriteLine(\"{0:F12}\", 0); return; }\n\n int plusCount = 0, minusCount = 0, k = wrPath, qMarkCount = 0;\n while (qMarkCount != qMark)\n {\n if (k == path) { plusCount++; qMarkCount++; }\n else if (k < path) { plusCount++; qMarkCount++; }\n else /* k > path */ { minusCount++; qMarkCount++; }\n k++;\n }\n int grater = plusCount > minusCount ? plusCount : minusCount;\n if (plusCount == 0 || minusCount == 0) { Console.WriteLine(\"{0:F12}\", 1 / Math.Pow(2, grater)); return; }\n double ver = (Factorial(qMark) / (Factorial(qMark - grater) * Factorial(qMark - (qMark - grater))));\n Console.WriteLine(\"{0:F12}\",1/ver);\n }\n\n static double Factorial(int t)\n {\n int ans = 1;\n for(int i = 1; i <= t; ++i)\n {\n ans *= i;\n }\n return (double)ans;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string signal = Console.ReadLine();\n string inner = Console.ReadLine();\n int path = 0, wrPath = 0, qMark = 0;\n\n for (int i = 0; i < signal.Length; ++i) \n { \n if (signal[i] == '+') path++; \n else path--;\n\n if (inner[i] == '+') wrPath++;\n else if (inner[i] == '-') wrPath--;\n else qMark++;\n }\n\n if (wrPath == path && qMark == 0) { Console.WriteLine(\"{0:F12}\",1); return; }\n if(path - wrPath > qMark) { Console.WriteLine(\"{0:F12}\", 0); return; }\n\n int plusCount = 0, minusCount = 0, k = 0, qMarkCount = 0;\n while (qMarkCount != qMark)\n {\n if (k == path) { plusCount++; qMarkCount++; }\n else if (k < path) { plusCount++; qMarkCount++; }\n else { minusCount++; qMarkCount++; }\n k++;\n }\n int grater = plusCount > minusCount ? plusCount : minusCount;\n double ver = (Factorial(qMark) / (Factorial(qMark - grater) * Factorial(qMark - (qMark - grater))));\n Console.WriteLine(\"{0:F12}\",1/ver);\n }\n\n static double Factorial(int t)\n {\n int ans = 1;\n for(int i = 1; i <= t; ++i)\n {\n ans *= i;\n }\n return (double)ans;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string signal = Console.ReadLine();\n string inner = Console.ReadLine();\n int[] plus = new int[2] { signal.Count(z => z == '+'), inner.Count(z => z == '+') };\n int[] minus = new int[2] { signal.Count(z => z == '-'), inner.Count(z => z == '-') };\n int qMark = inner.Count(z => z == '?');\n double ans = 0;\n if(qMark == 0)\n {\n if (plus[0] == plus[1] && minus[0] == minus[1]) ans = 1;\n else ans = 0;\n }\n else\n {\n if(plus[0] > plus[1] && minus[0] > minus[1])\n {\n ans = (Factorial(qMark) / (Factorial(qMark - (plus[0] - plus[1])) * Factorial(plus[0] - plus[1]))) / Math.Pow(2,qMark);\n }\n }\n\n Console.WriteLine(\"{0:F12}\",ans);\n }\n\n static double Factorial(int t)\n {\n int ans = 1;\n for(int i = 1; i <= t; ++i)\n {\n ans *= i;\n }\n return (double)ans;\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace DreamoonAndWifi\n{\n class Dreamoon\n {\n string initial;\n string recieved;\n int iPlus = 0; int iMinus = 0;\n int rPlus = 0; int rMinus = 0; int rQuest = 0;\n double prob = 0;\n int questAsPlus = 0;\n int questAsMinus = 0;\n double result;\n\n public void countProbability()\n {\n initial = Console.ReadLine();\n recieved = Console.ReadLine();\n\n for (int i = 0; i < initial.Length; i++)\n {\n switch (initial[i])\n {\n case '+':\n iPlus++;\n break;\n case '-':\n iMinus++;\n break;\n default:\n break;\n }\n switch (recieved[i])\n {\n case '+':\n rPlus++;\n break;\n case '-':\n rMinus++;\n break;\n case '?':\n rQuest++;\n break;\n default:\n break;\n }\n }\n int originalQuest = rQuest;\n int originalPlus = rPlus;\n int originalMinus = rMinus;\n\n if (rMinus == iMinus && rPlus == iPlus) prob = 1;\n else if (iMinus < rMinus || iPlus < rPlus) prob = 0;\n else\n {\n if (iMinus > rMinus)\n {\n while (iMinus > rMinus && rQuest > 0)\n {\n rMinus++;\n rQuest--;\n questAsMinus++;\n }\n }\n if (iPlus > rPlus)\n {\n while (iPlus > rPlus && rQuest > 0)\n {\n rPlus++;\n rQuest--;\n questAsPlus++;\n }\n }\n\n if (rMinus != iMinus || rPlus != iPlus) prob = 0;\n else\n {\n while (questAsMinus > 0)\n {\n questAsMinus--;\n }\n\n if (questAsMinus > 0)\n {\n result = Math.Pow(0.5, questAsMinus);\n }\n else if (questAsPlus > 0)\n {\n result = Math.Pow(0.5, questAsPlus);\n }\n \n prob = result;\n }\n\n }\n Console.WriteLine(prob);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Dreamoon d = new Dreamoon();\n d.countProbability();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace DreamoonAndWifi\n{\n class BC\n {\n public static long combination(long n, long r)\n {\n long i;\n long ans;\n long x;\n long k = 1;\n\n x = Math.Max(r, n - r);\n ans = 1;\n for (i = n; i > x; i--)\n {\n ans = ans * i;\n ans = ans / k;\n k++;\n }\n return ans;\n\n }\n }\n class Dreamoon\n {\n string initial;\n string recieved;\n int iPlus = 0; int iMinus = 0;\n int rPlus = 0; int rMinus = 0; int rQuest = 0;\n double prob = 0;\n int questAsPlus = 0;\n int questAsMinus = 0;\n double result;\n int endPosition = 0;\n int endPositionR = 0;\n\n public void countProbability()\n {\n initial = Console.ReadLine();\n recieved = Console.ReadLine();\n\n for (int i = 0; i < initial.Length; i++)\n {\n switch (initial[i])\n {\n case '+':\n iPlus++;\n endPosition++;\n break;\n case '-':\n iMinus++;\n endPosition--;\n break;\n default:\n break;\n }\n switch (recieved[i])\n {\n case '+':\n rPlus++;\n endPositionR++;\n break;\n case '-':\n rMinus++;\n endPositionR--;\n break;\n case '?':\n rQuest++;\n break;\n default:\n break;\n }\n }\n int originalQuest = rQuest;\n int originalPlus = rPlus;\n int originalMinus = rMinus;\n\n if (rMinus == iMinus && rPlus == iPlus) prob = 1;\n else if (iMinus < rMinus || iPlus < rPlus) prob = 0;\n else\n {\n if (iMinus > rMinus)\n {\n while (iMinus > rMinus && rQuest > 0)\n {\n rMinus++;\n rQuest--;\n questAsMinus++;\n }\n }\n if (iPlus > rPlus)\n {\n while (iPlus > rPlus && rQuest > 0)\n {\n rPlus++;\n rQuest--;\n questAsPlus++;\n }\n }\n\n if (rMinus != iMinus || rPlus != iPlus) prob = 0;\n else\n {\n int distance = Math.Abs(endPosition - endPositionR);\n if (endPosition < endPositionR) distance = -distance;\n\n Console.WriteLine(\"distance: {0}\", distance);\n Console.WriteLine(\"minus: {0}\",questAsMinus);\n Console.WriteLine(\"plus: {0}\", questAsPlus);\n\n double possibleWays = BC.combination(questAsMinus + questAsPlus, questAsPlus);\n Console.WriteLine(\"possible ways: {0}\", possibleWays);\n\n prob = possibleWays / Math.Pow(2, originalQuest);\n }\n\n }\n Console.WriteLine(prob);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Dreamoon d = new Dreamoon();\n d.countProbability();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace DreamoonAndWifi\n{\n class BC\n {\n public static long combination(long n, long r)\n {\n long i;\n long ans;\n long x;\n long k = 1;\n\n x = Math.Max(r, n - r);\n ans = 1;\n for (i = n; i > x; i--)\n {\n ans = ans * i;\n ans = ans / k;\n k++;\n }\n return ans;\n\n }\n }\n class Dreamoon\n {\n string initial;\n string recieved;\n int iPlus = 0; int iMinus = 0;\n int rPlus = 0; int rMinus = 0; int rQuest = 0;\n double prob = 0;\n int questAsPlus = 0;\n int questAsMinus = 0;\n double result;\n int endPosition = 0;\n int endPositionR = 0;\n\n public void countProbability()\n {\n initial = Console.ReadLine();\n recieved = Console.ReadLine();\n\n for (int i = 0; i < initial.Length; i++)\n {\n switch (initial[i])\n {\n case '+':\n iPlus++;\n endPosition++;\n break;\n case '-':\n iMinus++;\n endPosition--;\n break;\n default:\n break;\n }\n switch (recieved[i])\n {\n case '+':\n rPlus++;\n endPositionR++;\n break;\n case '-':\n rMinus++;\n endPositionR--;\n break;\n case '?':\n rQuest++;\n break;\n default:\n break;\n }\n }\n int originalQuest = rQuest;\n int originalPlus = rPlus;\n int originalMinus = rMinus;\n\n if (rMinus == iMinus && rPlus == iPlus) prob = 1;\n else if (iMinus < rMinus || iPlus < rPlus) prob = 0;\n else\n {\n if (iMinus > rMinus)\n {\n while (iMinus > rMinus && rQuest > 0)\n {\n rMinus++;\n rQuest--;\n questAsMinus++;\n }\n }\n if (iPlus > rPlus)\n {\n while (iPlus > rPlus && rQuest > 0)\n {\n rPlus++;\n rQuest--;\n questAsPlus++;\n }\n }\n\n if (rMinus != iMinus || rPlus != iPlus) prob = 0;\n else\n {\n int distance = Math.Abs(endPosition - endPositionR);\n if (endPosition < endPositionR) distance = -distance;\n\n //Console.WriteLine(\"distance: {0}\", distance);\n //Console.WriteLine(\"minus: {0}\",questAsMinus);\n //Console.WriteLine(\"plus: {0}\", questAsPlus);\n\n double possibleWays = BC.combination(questAsMinus + questAsPlus, questAsPlus);\n //Console.WriteLine(\"possible ways: {0}\", possibleWays);\n\n prob = possibleWays / Math.Pow(2, originalQuest);\n }\n\n }\n Console.WriteLine(prob);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Dreamoon d = new Dreamoon();\n d.countProbability();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\t\tpublic static string drazil =\"\";\n\t\tpublic static string dreamoon=\"\";\n\n\t\tpublic static char[] s1 = new char[drazil.ToCharArray().Length];\n\t\tpublic static char[] s2 = new char[dreamoon.ToCharArray().Length];\n\t\t\n\t\tpublic static int tamanhoS1, tamanhoS2;\n\t\tpublic static int unidade = 0, prob = 0, soma = 0;\n\t\tpublic static void probabilidade(int n, int posicao)\n\t\t{\t\t\n\n\t\t\tif (n == tamanhoS2)\n\t\t\t{\n\t\t\t\tif (posicao == unidade)\n\t\t\t\t\tprob++;\n\t\t\t\tsoma++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//Se o comando for '+' a posi\u00e7\u00e3o ir\u00e1 andar para a dire\u00e7\u00e3o positiva da unidade\n\t\t\tif (s2[n] == '+')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t}\n\t\t\t//Se o comando for '-' a posi\u00e7\u00e3o ir\u00e1 andar para a dire\u00e7\u00e3o negativa da unidade\n\t\t\telse if (s2[n] == '-')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t\telse if (s2[n] == '?')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t}\n\t\tstatic void Main(string[] args)\n {\n\t\t\tConsole.WriteLine(\"Comando Drazil: \");\n\t\t\tdrazil = Console.ReadLine();\n\t\t\tConsole.WriteLine(\"Comando Dreamoon: \");\n\t\t\tdreamoon = Console.ReadLine();\n\n\t\t\ts1 = drazil.ToCharArray();\n\t\t\ts2 = dreamoon.ToCharArray();\n\n\t\t\ttamanhoS1 = s1.Length;\n\t\t\ttamanhoS2 = s2.Length;\n\t\t\t\n\t\t\t//conta o n\u00famero de unidades do comando da Drazil\n\t\t\tfor (int i = 0; i < tamanhoS1; i++)\n {\n\t\t\t\tif (s1[i] == '+')\n\t\t\t\t\tunidade++;\n\t\t\t\telse\n\t\t\t\t\tunidade--;\n\t\t\t}\n\n\t\t\tprobabilidade(0, 0);\n\t\t\tConsole.WriteLine(\"Probabilidade: \" + (double)(prob) / (soma));\n\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n\t\tpublic static string drazil =\"\";\n\t\tpublic static string dreamoon=\"\";\n\n\t\tpublic static char[] s1 = new char[drazil.ToCharArray().Length];\n\t\tpublic static char[] s2 = new char[dreamoon.ToCharArray().Length];\n\t\t\n\t\tpublic static int tamanhoS1, tamanhoS2;\n\t\tpublic static int unidade = 0, prob = 0, soma = 0;\n\t\tpublic static void probabilidade(int n, int posicao)\n\t\t{\t\t\n\n\t\t\tif (n == tamanhoS2)\n\t\t\t{\n\t\t\t\tif (posicao == unidade)\n\t\t\t\t\tprob++;\n\t\t\t\tsoma++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s2[n] == '+')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t}\n\t\t\telse if (s2[n] == '-')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t\telse if (s2[n] == '?')\n\t\t\t{\n\t\t\t\tprobabilidade(n + 1, posicao + 1);\n\t\t\t\tprobabilidade(n + 1, posicao - 1);\n\t\t\t}\n\t\t}\n\t\tstatic void Main(string[] args)\n {\n\t\t\tConsole.WriteLine(\"Comando Drazil: \");\n\t\t\tdrazil = Console.ReadLine();\n\t\t\tConsole.WriteLine(\"Comando Dreamoon: \");\n\t\t\tdreamoon = Console.ReadLine();\n\n\t\t\ts1 = drazil.ToCharArray();\n\t\t\ts2 = dreamoon.ToCharArray();\n\n\t\t\ttamanhoS1 = s1.Length;\n\t\t\ttamanhoS2 = s2.Length;\n\t\t\t\n\t\t\tfor (int i = 0; i < tamanhoS1; i++)\n {\n\t\t\t\tif (s1[i] == '+')\n\t\t\t\t\tunidade++;\n\t\t\t\telse\n\t\t\t\t\tunidade--;\n\t\t\t}\n\n\t\t\tprobabilidade(0, 0);\n\t\t\tConsole.WriteLine ((double)(prob) / (soma));\n\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n static double faktorijal(int a)\n {\n if (a == 0) return 1;\n double f = 1;\n for (int i = 2; i <= a; i++) f *= i;\n return f;\n }\n static double NnadK(int n, int k)\n {\n return faktorijal(n) / (faktorijal(k) * faktorijal(n - k));\n }\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int poz1 = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') poz1++;\n else poz1--;\n }\n int poz2 = 0;\n int brUpitnika = 0;\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+') poz2++;\n else if (s2[i] == '-') poz2--;\n else brUpitnika++;\n }\n if (brUpitnika == 0)\n {\n Console.WriteLine(1);\n return;\n }\n double nepovoljniSlucajevi = 1;\n for (int i = 0; i < brUpitnika; i++) nepovoljniSlucajevi *= 2;\n double povoljniSlucajevi = 0;\n for (int i = 0; i <= brUpitnika; i++)\n {\n int slucaj = i - (brUpitnika - i);\n if (poz2 + slucaj == poz1)\n {\n povoljniSlucajevi += NnadK(brUpitnika, i);\n break;\n }\n }\n Console.WriteLine((povoljniSlucajevi / nepovoljniSlucajevi).ToString().Replace(',', '.'));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Program\n {\n static double faktorijal(int a)\n {\n if (a == 0) return 1;\n double f = 1;\n for (int i = 2; i <= a; i++) f *= i;\n return f;\n }\n static double NnadK(int n, int k)\n {\n return faktorijal(n) / (faktorijal(k) * faktorijal(n - k));\n }\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n string s2 = Console.ReadLine();\n int poz1 = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (s1[i] == '+') poz1++;\n else poz1--;\n }\n int poz2 = 0;\n int brUpitnika = 0;\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] == '+') poz2++;\n else if (s2[i] == '-') poz2--;\n else brUpitnika++;\n }\n if (brUpitnika == 0)\n {\n Console.WriteLine(1);\n Console.ReadLine();\n return;\n }\n double nepovoljniSlucajevi = 2 * brUpitnika;\n double povoljniSlucajevi = 0;\n for (int i = 0; i <= brUpitnika; i++)\n {\n int slucaj = i - (brUpitnika - i);\n if (poz2 + slucaj == poz1)\n {\n povoljniSlucajevi += NnadK(brUpitnika, i);\n break;\n }\n }\n Console.WriteLine((povoljniSlucajevi / nepovoljniSlucajevi).ToString().Replace(',', '.'));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else if(temp%2==0&&unrecorg%2==0)\n {\n int a = (unrecorg + temp) / 2, bas = Convert.ToInt32(Math.Pow(2, unrecorg));\n double div = 1;\n for (int i = 0; i < a; i++)\n div *= unrecorg - i;\n while (a > 0)\n div /= a--;\n Console.WriteLine((div/bas).ToString(\"#.#########\"));\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else if(temp%2==0&&unrecorg%2==0)\n {\n int a = (unrecorg + temp) / 2, bas = Convert.ToInt32(Math.Pow(2, unrecorg));\n double div = 1;\n for (int i = 0; i < a; i++)\n div *= unrecorg - i;\n while (a > 0)\n div /= a--;\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else if(temp%2==0&&unrecorg%2==0)\n {\n int a = (unrecorg + temp) / 2, bas = Convert.ToInt32(Math.Pow(2, unrecorg));\n double div = 1;\n for (int i = 0; i < a; i++)\n div *= unrecorg - i;\n while (a > 0)\n div /= a--;\n Console.WriteLine((div/bas).ToString(\"#.#########\").Replace(',','.'));\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else if(temp%2==0&&unrecorg%2==0)\n {\n int a = (unrecorg + temp) / 2, bas = Convert.ToInt32(Math.Pow(2, unrecorg));\n double div = 1;\n for (int i = 0; i < a; i++)\n div *= unrecorg - i;\n while (a > 0)\n div /= a--;\n Console.WriteLine((div/bas).ToString(\"#.#########\"));\n Console.WriteLine(\"div:{0},bas:{1}\", div, bas);\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace B\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string command = Console.ReadLine();\n string receive = Console.ReadLine();\n int p_1 = 0, p_2 = 0, unrecorg = 0;\n foreach (var item in command)\n if (item == '+')\n p_1++;\n foreach(var item in receive)\n {\n if (item == '+')\n p_2++;\n else if (item == '?')\n unrecorg++;\n }\n int m_1 = command.Length - p_1, m_2 = receive.Length - unrecorg - p_2;\n int des = p_1 - m_1, cur = p_2 - m_2;\n int temp = Math.Abs(des - cur);\n if(temp>unrecorg)\n {\n Console.WriteLine(\"0.000000000\"); \n }\n else if(unrecorg==0&&temp==0)\n {\n Console.WriteLine(\"1.000000000\"); \n }\n else if(temp%2==0&&unrecorg%2==0)\n {\n int a = (unrecorg + temp) / 2;\n Console.WriteLine((a / Math.Pow(2, unrecorg)).ToString(\"#.#########\"));\n }\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n int pre = receive.Count(r => r == '?');\n\n double prob = 0;\n\n if (pre == 0)\n {\n bool total = pos[0] == pos[1] && neg[0] == neg[1];\n prob = total ? 1 : 0;\n }\n else\n {\n prob = ((double)Factorial(pre) / (Factorial(pre - (pos[0] - pos[1])) * Factorial(pos[0] - pos[1]))) / Math.Pow(2, pre);\n }\n\n Console.WriteLine(\"{0:N12}\", prob); \n }\n\n private static int Factorial(int num)\n {\n int total = 1;\n\n if (num == 0)\n return 1;\n\n for (int i = 1; i <= num; i++)\n {\n total *= i;\n }\n return total;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n\n float prob = 0;\n if (pos[0] > 0 && pos[1] > 0)\n {\n prob += ((pos[1]) / (float)pos[0]) / 2;\n }\n if (neg[0] > 0 && neg[1] > 0)\n {\n prob += ((neg[1]) / (float)neg[0]) / 2;\n }\n\n Console.WriteLine(\"{0:N12}\", prob);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n int pre = receive.Count(r => r == '?');\n\n double prob = 0;\n\n if (pre == 0)\n {\n bool total = pos[0] == pos[1] && neg[0] == neg[1];\n prob = total ? 1 : 0;\n }\n else\n {\n if (pos[0] > pos[1] || neg[0] > neg[0])\n {\n prob = ((double)Factorial(pre) / (Factorial(pre - (pos[0] - pos[1])) * Factorial(pos[0] - pos[1]))) / Math.Pow(2, pre);\n }\n }\n\n Console.WriteLine(\"{0:N12}\", prob); \n }\n\n private static int Factorial(int num)\n {\n int total = 1;\n\n if (num == 0)\n return 1;\n\n for (int i = 1; i <= num; i++)\n {\n total *= i;\n }\n return total;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n int pre = receive.Count(r => r == '?');\n\n double prob = 0;\n\n if (pre == 0)\n {\n bool total = pos[0] == pos[1] && neg[0] == neg[1];\n prob = total ? 1 : 0;\n }\n else\n {\n if (pos[0] > pos[1] && neg[0] > neg[1])\n {\n prob = ((double)Factorial(pre) / (Factorial(pre - (pos[0] - pos[1])) * Factorial(pos[0] - pos[1]))) / Math.Pow(2, pre);\n }\n }\n\n Console.WriteLine(\"{0:N12}\", prob);\n //Console.ReadKey();\n }\n\n private static int Factorial(int num)\n {\n int total = 1;\n\n if (num == 0)\n return 1;\n\n for (int i = 1; i <= num; i++)\n {\n total *= i;\n }\n return total;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace B476\n{\n class Program\n {\n static void Main(string[] args)\n {\n string sent = Console.ReadLine();\n string receive = Console.ReadLine();\n\n int count = receive.Count();\n int[] pos = new int[2] { sent.Count(p => p == '+'), receive.Count(p => p == '+') };\n int[] neg = new int[2] { sent.Count(n => n == '-'), receive.Count(n => n == '-') };\n\n float prob = 0;\n if (pos[0] > 0)\n {\n prob += ((pos[1]) / (float)pos[0]) / 2;\n }\n if (neg[0] > 0)\n {\n prob += ((neg[1]) / (float)neg[0]) / 2;\n }\n\n Console.WriteLine(\"{0:N12}\", prob); \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Codigo\n {\n private string dreamoon;\n private string drazil;\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n private int quantInt;\n\n public Codigo(string dreamoon, string drazil)\n {\n this.dreamoon = dreamoon;\n this.drazil = drazil;\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1;\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = drazil.Split(new char[] { '?' }).Length - 1;\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDrazil[1] == contaDrazil[1])\n {\n return 1;\n }\n else if ((contaDreamon[0] == 0 && contaDrazil[0] != 0) || (contaDreamon[1] == 0 && contaDrazil[1] != 0))\n return 0;\n else\n return ((double)(drazil.Length - quantInt) / dreamoon.Length);\n }\n\n public void exibe()\n {\n double result = compara();\n Console.WriteLine(\"{0:F12}\", result);\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine());\n cod.exibe();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Codigo\n {\n //Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n private int[] contaDreamon = new int[2];\n private int[] contaDrazil = new int[2];\n\n //Quantidade de valores desconhecidos passados ao drazil\n private int quantInt;\n\n private int distancia;\n private int posDreamoon;\n private int posDrazil;\n\n public Codigo(string drazil, string dreamoon)\n {\n contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n quantInt = dreamoon.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n\n posDreamoon = contaDreamon[1] - contaDreamon[0];\n posDrazil = contaDrazil[1] - contaDreamon[1];\n //for (int i = 0; i < dreamoon.Length; i++) //Esse for realiza a cont\n //{\n // if (dreamoon.Substring(i, 1) == \"+\")\n // posDreamoon++;\n // else if (dreamoon.Substring(i, 1) == \"-\")\n // posDreamoon--; \n //}\n\n //for (int i = 0; i < drazil.Length; i++)\n //{\n // if (drazil.Substring(i, 1) == \"+\")\n // posDrazil++;\n // else\n // posDrazil--;\n //}\n\n distancia = posDrazil - posDreamoon;\n }\n\n private double compara()\n {\n if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n {\n return 1;\n }\n else if (quantInt < Math.Abs(distancia)) //Se a quantidade de caminhos duvidosos for maior que a dist\u00e2ncia restante, a chance \u00e9 zero\n return 0;\n else\n {\n int m = (quantInt + Math.Abs(distancia)) / 2; //Calcula a quantidade de passos v\u00e1lidos para chegar na posi\u00e7\u00e3o correta\n\n double combinacao = (fatorial(quantInt) / (fatorial(quantInt - m) * (fatorial(m))));\n\n return (double)combinacao / (1 << quantInt);\n }\n }\n\n public void exibe()\n {\n string result = compara().ToString();\n result = result.Replace(',', '.');\n Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n }\n\n private double fatorial(int n)\n {\n if (n == 1 || n == 0)\n return 1;\n else\n return (n * fatorial(n - 1));\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n //Teste x = new Teste();\n //x.calcula(Console.ReadLine(), Console.ReadLine());\n Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Teste\n {\n public Array dreamoon;\n public Array drazil;\n int posResposta = 0;\n int posFinal = 0;\n int numInterrogacao = 0;\n\n public void calcula(string x, string y)\n {\n dreamoon = x.ToArray();\n drazil = y.ToArray();\n\n for (int i = 0; i < dreamoon.Length; i++)\n {\n if (dreamoon.GetValue(i).ToString() == \"+\")\n posResposta++;\n else\n posResposta--;\n }\n\n for (int i = 0; i < dreamoon.Length; i++)\n {\n if (drazil.GetValue(i).ToString() == \"?\")\n numInterrogacao++;\n else if (drazil.GetValue(i).ToString() == \"+\")\n posFinal++;\n else\n posFinal--;\n }\n\n int distance = posResposta - posFinal;\n\n double answer;\n if ((distance + numInterrogacao) % 2 != 0 || numInterrogacao < Math.Abs(distance))\n answer = 0;\n else\n {\n answer = (double)1 / (Math.Pow(2, numInterrogacao));\n Console.WriteLine(answer);\n }\n }\n }\n // class Codigo\n // {\n ////Iniciando as vari\u00e1veis dreamoon e drazil\n // private string dreamoon;\n // private string drazil;\n\n ////Iniciando um vetor que vai guardar os dois valores poss\u00edveis nas instru\u00e7\u00f5es\n // private int[] contaDreamon = new int[2];\n // private int[] contaDrazil = new int[2];\n\n ////Quantidade de valores desconhecidos passados ao drazil\n // private int quantInt;\n\n // public Codigo(string dreamoon, string drazil)\n // {\n // this.dreamoon = dreamoon; //Iniciando valores\n // this.drazil = drazil; //Iniciando valores\n // contaDreamon[0] = dreamoon.Split(new char[] { '-' }).Length - 1; //Vai contar quantos '-' possui e vai passar para a vari\u00e1vel, e assim respectivamente com as 3 pr\u00f3xima linhas\n // contaDreamon[1] = dreamoon.Split(new char[] { '+' }).Length - 1;\n // contaDrazil[0] = drazil.Split(new char[] { '-' }).Length - 1;\n // contaDrazil[1] = drazil.Split(new char[] { '+' }).Length - 1;\n // quantInt = drazil.Split(new char[] { '?' }).Length - 1; //Quantidade de c\u00f3digos desconhecidos\n // }\n\n // private double compara()\n // {\n // if (contaDreamon[0] == contaDrazil[0] && contaDreamon[1] == contaDrazil[1]) //Se receberem a mesma quantidade de '+' e '-', a conta termina em 100%\n // {\n // return 1;\n // }\n // else if ((contaDreamon[0] == 0 && contaDrazil[0] != 0) || (contaDreamon[1] == 0 && contaDrazil[1] != 0)) //Se receber valores incorretos, a probabilidade \u00e9 zero\n // return 0;\n // else\n // return ((double)(drazil.Length - quantInt) / dreamoon.Length); //Se n\u00e3o for nenhum disso, ele calcula a probabilidade de o Drazil retornar a posi\u00e7\u00e3o original\n // }\n\n // public void exibe()\n // {\n // string result = compara().ToString();\n // result = result.Replace(',', '.');\n // Console.WriteLine(\"{0:F12}\", result); //Exibe o resultado com 12 algarismos\n // }\n // }\n class Program\n {\n static void Main(string[] args)\n {\n Teste x = new Teste();\n x.calcula(Console.ReadLine(), Console.ReadLine());\n //Codigo cod = new Codigo(Console.ReadLine(), Console.ReadLine()); //Chama a fun\u00e7\u00e3o com os dois valores digitados\n //cod.exibe(); //Exibe o resultado em decimal\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dreamoon_and_WiFi\n{\n class Teste\n {\n public Array dreamoon;\n public Array drazil;\n int posResposta = 0;\n int posFinal = 0;\n int numInterrogacao = 0;\n\n public void calcula(string x, string y)\n {\n dreamoon = x.ToArray();\n drazil = y.ToArray();\n\n for (int i = 0; i < dreamoon.Length; i++)\n {\n if (dreamoon.GetValue(i).ToString() == \"+\")\n posResposta++;\n else\n posResposta--;\n }\n\n for (int i = 0; i < dreamoon.Length; i++)\n {\n if (drazil.GetValue(i).ToString() == \"?\")\n numInterrogacao++;\n else if (drazil.GetValue(i).ToString() == \"+\")\n posFinal++;\n else\n posFinal--;\n }\n\n int distance = posResposta - posFinal;\n int aaa;\n double answer;\n if ((distance + numInterrogacao) % 2 != 0 || numInterrogacao < Math.Abs(distance)) //can't reach the destination no matter how\n answer = 0;\n else\n {\n int m = (numInterrogacao + Math.Abs(distance)) / 2; //moves needed toward the distance m is abs(distance)+(moves-abs(distance))/2\n //answer is C(moves,m)/(1< currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}"}], "src_uid": "f7f68a15cfd33f641132fac265bc5299"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n bool Fun(int n, int m, int h, List a)\n {\n int x = 0;\n while (x < n)\n {\n int y = x + 1;\n while (a[y] + m > h)\n y++;\n if (y == x + 1)\n {\n x++;\n continue;\n }\n\n bool f = true;\n int c = m - 1;\n for (int i = x + 1; i < y; i++)\n {\n if (a[i] + c > h)\n {\n if (!f || a[i] > h)\n return false;\n c = Math.Min(c, h - a[i]);\n }\n\n if (c == 0)\n f = false;\n if (f)\n c--;\n else\n c++;\n }\n\n x = y;\n }\n\n return true;\n }\n\n public void Solve()\n {\n for (int tt = ReadInt(); tt > 0; tt--)\n {\n int n = ReadInt() + 1;\n int m = ReadInt();\n int h = ReadInt();\n\n var a = new List { int.MinValue };\n a.AddRange(ReadIntArray());\n a.Add(int.MinValue);\n\n Write(Fun(n, m, h, a) ? \"Yes\" : \"No\");\n }\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\npublic static class P\n{\n public static void Main()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n {\n Solve();\n }\n }\n static void Solve()\n {\n var nkl = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var n = nkl[0];\n var k = nkl[1]; //period\n var l = nkl[2]; //drawn limit\n var d = Console.ReadLine().Split().Select(long.Parse).ToArray();\n\n //0 1 k-1 k k+1\n //k, k-1, k-2, .. 1, 0, 1, ... k - 1\n long cur = 0;\n //\u30e4\u30d0\u3044\u6642\u306b\u3044\u3089\u308c\u308b\u5834\u6240\u307e\u3067\u99c6\u3051\u629c\u3051\u3089\u308c\u308b\u304b\n for (int i = 0; i < d.Length; i++)\n {\n if (d[i] + k <= l) cur = 0;\n else\n {\n cur++;\n var limit = l - d[i];\n if (limit + k < cur)\n {\n Console.WriteLine(\"No\");\n return;\n }\n //wait until\n var firstPossible = k - limit;\n cur = Max(firstPossible, cur);\n }\n }\n Console.WriteLine(\"Yes\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nusing E = System.Linq.Enumerable;\n\ninternal partial class Solver {\n public void Run() {\n var t = ni();\n while (t-- > 0) {\n var n = ni();\n var k = ni();\n var l = ni();\n var d = ni(n);\n bool ans = true;\n bool increasing = false;\n int currentP = k + 1;\n foreach (var x in d) {\n // x + p <= l\n var maxP = l - x;\n if (maxP < 0) {\n ans = false;\n break;\n }\n if (maxP >= k) { // safe\n currentP = k + 1;\n increasing = false;\n } else {\n // maxP < k\n if (increasing) currentP++; else currentP--;\n if (increasing) {\n if (currentP > maxP) {\n ans = false;\n break;\n }\n } else {\n currentP = Math.Min(currentP, maxP);\n if (currentP == 0) increasing = true;\n }\n }\n }\n cout.WriteLine(ans ? \"Yes\" : \"No\");\n }\n }\n\n}\n\n\n\n// PREWRITEN CODE BEGINS FROM HERE\n\nstatic public class StringExtensions {\n static public string JoinToString(this IEnumerable source, string separator = \" \") {\n return string.Join(separator, source);\n }\n}\n\ninternal partial class Solver : Scanner {\n public static void Main() {\n#if LOCAL\n byte[] inputBuffer = new byte[1000000];\n var inputStream = Console.OpenStandardInput(inputBuffer.Length);\n using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {\n Console.SetIn(reader);\n new Solver(Console.In, Console.Out).Run();\n }\n#else\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver(Console.In, Console.Out).Run();\n Console.Out.Flush();\n#endif\n }\n\n#pragma warning disable IDE0052\n private readonly TextReader cin;\n private readonly TextWriter cout;\n private readonly TextWriter cerr;\n#pragma warning restore IDE0052\n\n public Solver(TextReader reader, TextWriter writer)\n : base(reader) {\n cin = reader;\n cout = writer;\n cerr = Console.Error;\n }\n\n public Solver(string input, TextWriter writer)\n : this(new StringReader(input), writer) {\n }\n\n#pragma warning disable IDE1006\n#pragma warning disable IDE0051\n private int ni() { return NextInt(); }\n private int[] ni(int n) { return NextIntArray(n); }\n private long nl() { return NextLong(); }\n private long[] nl(int n) { return NextLongArray(n); }\n private double nd() { return NextDouble(); }\n private double[] nd(int n) { return NextDoubleArray(n); }\n private string ns() { return Next(); }\n private string[] ns(int n) { return NextArray(n); }\n#pragma warning restore IDE1006\n#pragma warning restore IDE0051\n}\n\n#if DEBUG\ninternal static class LinqPadExtension {\n public static string TextDump(this T obj) {\n if (obj is IEnumerable) return (obj as IEnumerable).Cast().JoinToString().Dump();\n else return obj.ToString().Dump();\n }\n public static T Dump(this T obj) {\n return LINQPad.Extensions.Dump(obj);\n }\n}\n#endif\n\npublic class Scanner {\n private readonly TextReader Reader;\n private readonly CultureInfo ci = CultureInfo.InvariantCulture;\n\n private readonly char[] buffer = new char[2 * 1024];\n private int cursor = 0, length = 0;\n private string Token;\n private readonly StringBuilder sb = new StringBuilder(1024);\n\n public Scanner()\n : this(Console.In) {\n }\n\n public Scanner(TextReader reader) {\n Reader = reader;\n }\n\n public int NextInt() { return checked((int)NextLong()); }\n public long NextLong() {\n var s = Next();\n long r = 0;\n int i = 0;\n bool negative = false;\n if (s[i] == '-') {\n negative = true;\n i++;\n }\n for (; i < s.Length; i++) {\n r = r * 10 + (s[i] - '0');\n#if DEBUG\n if (!char.IsDigit(s[i])) throw new FormatException();\n#endif\n }\n return negative ? -r : r;\n }\n public double NextDouble() { return double.Parse(Next(), ci); }\n public string[] NextArray(int size) {\n string[] array = new string[size];\n for (int i = 0; i < size; i++) {\n array[i] = Next();\n }\n\n return array;\n }\n public int[] NextIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextInt();\n }\n\n return array;\n }\n\n public long[] NextLongArray(int size) {\n long[] array = new long[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextLong();\n }\n\n return array;\n }\n\n public double[] NextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++) {\n array[i] = NextDouble();\n }\n\n return array;\n }\n\n public string Next() {\n if (Token == null) {\n if (!StockToken()) {\n throw new Exception();\n }\n }\n var token = Token;\n Token = null;\n return token;\n }\n\n public bool HasNext() {\n if (Token != null) {\n return true;\n }\n\n return StockToken();\n }\n\n private bool StockToken() {\n while (true) {\n sb.Clear();\n while (true) {\n if (cursor >= length) {\n cursor = 0;\n if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {\n break;\n }\n }\n var c = buffer[cursor++];\n if (33 <= c && c <= 126) {\n sb.Append(c);\n } else {\n if (sb.Length > 0) break;\n }\n }\n\n if (sb.Length > 0) {\n Token = sb.ToString();\n return true;\n }\n\n return false;\n }\n }\n}"}, {"source_code": "//using MetadataExtractor;\n//using MetadataExtractor.Formats.Exif;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];\n }\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n /*public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }*/\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n if (start > finish) return \"\";\n return str.Substring(start, finish - start + 1);\n }\n\n public static string Reverse(this string str)\n {\n if (str == null) return null;\n\n return new string(str.ToArray().Reverse().ToArray());\n }\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n\n private static int[] GetPrimesLessThan(int x)\n {\n if (x < 2)\n return new int[0];\n\n int[] a = new int[x];\n\n a[0] = 1; a[1] = 1;\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n for (int j = 2 * i; j < a.Length; j += i)\n {\n a[j] = 1;\n }\n }\n\n var abc = new List(x);\n\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] == 0)\n abc.Add(i);\n }\n\n return abc.ToArray();\n }\n\n private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target == a[mid])\n return mid;\n else if (target < a[mid])\n return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindNearestLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n\n private static int FindNearestLEQElementInTheArray(int[] a, int target)\n {\n return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)\n {\n if (startIndex == endIndex)\n {\n if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n if (startIndex + 1 == endIndex)\n {\n if (a[endIndex] <= target)\n return endIndex;\n else if (a[startIndex] <= target)\n return startIndex;\n else\n return -1;\n }\n\n int mid = (startIndex + endIndex) / 2;\n if (target < a[mid])\n return FindRightMostLEQElementInTheArray(a, startIndex, mid - 1, target);\n else\n return FindRightMostLEQElementInTheArray(a, mid, endIndex, target);\n }\n\n\n private static int FindRightMostLEQElementInTheArray(int[] a, int target)\n {\n return FindRightMostLEQElementInTheArray(a, 0, a.Length - 1, target);\n }\n\n private static int gcd(int a, int b)\n {\n\n int r = a % b;\n while (r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n //----------------------------------------------------------------------------\n\n static string GetSha1(string filePath)\n {\n using (FileStream fs = new FileStream(filePath, FileMode.Open))\n using (BufferedStream bs = new BufferedStream(fs))\n {\n using (SHA1Managed sha1 = new SHA1Managed())\n {\n byte[] hash = sha1.ComputeHash(bs);\n StringBuilder formatted = new StringBuilder(2 * hash.Length);\n foreach (byte b in hash)\n {\n formatted.AppendFormat(\"{0:X2}\", b);\n }\n\n return formatted.ToString();\n }\n }\n }\n\n\n static bool canFit(int a1, int b1, int a2, int b2)\n {\n int[] r1 = { a1, b1 };\n int[] r2 = { a2, b2 };\n\n Array.Sort(r1);\n Array.Sort(r2);\n\n bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);\n\n return ans;\n\n }\n\n class Pair\n {\n public int first { get; set; }\n public int second { get; set; }\n }\n\n\n class Coord\n {\n public int x;\n public int y;\n public double d;\n }\n\n\n public static double dist(int x1, int y1, int x2, int y2)\n {\n int dx = x2 - x1;\n int dy = y2 - y1;\n\n return Math.Sqrt(dx * dx + dy * dy);\n\n }\n static void Main(string[] args)\n {\n //Console.Out.Flush();\n\n int tt = ReadIntLine();\n\n while (tt-- > 0)\n {\n int n = 0, k = 0, l = 0;\n ReadInts(ref n, ref k, ref l);\n\n var d = ReadIntArrayLine();\n\n var safe = new int[d.Length];\n //var safe2 = new int[d.Length];\n\n bool bad = false;\n for (int i = 0; i < n; i++)\n {\n safe[i] = Math.Min(l - d[i], k);\n if (safe[i]<0)\n {\n bad = true;\n break;\n } \n }\n\n if (bad)\n {\n PrintLn(\"NO\");\n continue;\n }\n\n int gs = -safe[n-1];\n int ge = -gs;\n bool pos = true;\n\n for (int i = n-2; i >=0; i--)\n {\n if (safe[i]==k)\n {\n gs = -k;\n ge = k;\n }\n else\n {\n gs--;\n ge--;\n\n if (gs.IsInRange(-safe[i],safe[i]) || ge.IsInRange(-safe[i], safe[i])\n || (-safe[i]).IsInRange(gs,ge) || safe[i].IsInRange(gs,ge))\n {\n gs = Math.Max(gs, -safe[i]);\n ge = Math.Min(ge, safe[i]);\n }\n else\n {\n pos = false;\n break;\n }\n }\n\n }\n\n if (pos)\n PrintLn(\"Yes\");\n else\n PrintLn(\"NO\");\n\n } //while tt\n\n } //main\n //ReadInts(ref a, ref b);\n //int n = ReadIntLine();\n //int[] a = ReadIntArrayLine();\n // li.Sort((a, b) => b.CompareTo(a)); DESC\n\n\n }\n\n}"}], "negative_code": [], "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8"} {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Door_Frames\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int a = Next();\n int b = Next();\n\n int max = 1 << 6;\n\n int min = 6;\n for (int i = 0; i < max; i++)\n {\n if (SparseBitcount(i) == 2)\n {\n int ii = i;\n int count = 1;\n int remain = n;\n for (int j = 0; j < 6; j++)\n {\n if ((ii & 1) == 1)\n {\n if (remain >= b)\n {\n remain -= b;\n }\n else\n {\n count++;\n remain = n - b;\n }\n }\n else\n {\n if (remain >= a)\n {\n remain -= a;\n }\n else\n {\n count++;\n remain = n - a;\n }\n }\n ii >>= 1;\n }\n min = Math.Min(min, count);\n }\n }\n\n return min;\n }\n\n private static int SparseBitcount(int n)\n {\n int count = 0;\n while (n != 0)\n {\n count++;\n n &= (n - 1);\n }\n return count;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435_\u0434\u0432\u0435\u0440\u0435\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n int barLength = int.Parse(Console.ReadLine());\n int borderLength = int.Parse(Console.ReadLine());\n int upperBorderLength = int.Parse(Console.ReadLine());\n\n int scrap, barNum = 0, aNum=0,bNum=0;\n\n while (true)\n {\n if (upperBorderLength <= borderLength && bNum < 2 || aNum >= 4 && bNum < 2)\n {\n scrap = barLength;\n barNum++;\n scrap -= upperBorderLength;\n bNum++;\n }\n else if(aNum<4 || bNum>=2 && aNum<4)\n {\n scrap = barLength;\n barNum++;\n scrap -= borderLength;\n aNum++;\n }\n else\n {\n break;\n }\n while (true)\n {\n int aTmp = scrap - borderLength;\n int bTmp = scrap - upperBorderLength;\n if (aTmp>=0&&aTmp<=bTmp&&aNum<4 || aTmp>=0&&aNum<4&&bNum>=2 || bTmp<0 && aNum<4 && aTmp>=0)\n {\n scrap = aTmp;\n aNum++;\n }\n else if (bTmp>=0&&bNum<2 || bTmp >= 0 && bNum < 2 && aNum >= 4 || aTmp<0 && bTmp<2 && bTmp>=0)\n {\n scrap = bTmp;\n bNum++;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.WriteLine(barNum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForceCs\n{\n static class Program\n {\n static void Main(string[] args)\n {\n Solver solver = new _Q910B();\n solver.SolveProblem();\n //Console.ReadKey();\n }\n }\n\n abstract class Solver\n {\n abstract public void SolveProblem();\n }\n\n class _Q910B : Solver\n {\n int n, a, b;\n List need = new List();\n override public void SolveProblem()\n {\n n = int.Parse(Console.ReadLine());\n a = int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n\n Console.WriteLine(GetResult());\n }\n\n int GetResult()\n {\n\n if (n >= 4 * a + 2 * b)\n return 1;\n\n if (n >= 2 * a + b)\n return 2;\n\n if (a >= b)\n {\n if (n >= 2 * a)\n return 3;\n\n if (n >= a + b)\n return 4;\n\n if (n >= 2 * b)\n return 5;\n }\n else\n {\n if (n >= a + b || n >= 4 * a)\n return 3;\n\n if (n >= 2 * a)\n return 4;\n }\n return 6;\n }\n }\n\n}\n\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForceCs\n{\n static class Program\n {\n static void Main(string[] args)\n {\n Solver solver = new _Q910B();\n solver.SolveProblem();\n //Console.ReadKey();\n }\n }\n\n abstract class Solver\n {\n abstract public void SolveProblem();\n }\n\n class _Q910B : Solver\n {\n int n, a, b;\n List need = new List();\n override public void SolveProblem()\n {\n n = int.Parse(Console.ReadLine());\n a = int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n\n Console.WriteLine(GetResult());\n }\n\n int GetResult()\n {\n\n if (n >= 4 * a + 2 * b)\n return 1;\n\n if (n >= 2 * a + b)\n return 2;\n\n if (a >= b)\n {\n if (n >= 2 * a)\n return 3;\n\n if (n >= a + b)\n return 4;\n\n if (n >= 2 * b)\n return 5;\n }\n else\n {\n if (n >= a + b)\n return 3;\n\n if (n >= 2 * a)\n return 4;\n }\n return 6;\n }\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435_\u0434\u0432\u0435\u0440\u0435\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n int barLength = int.Parse(Console.ReadLine());\n int borderLength = int.Parse(Console.ReadLine());\n int upperBorderLength = int.Parse(Console.ReadLine());\n\n int scrap = barLength, barNum = 1, aNum=0,bNum=0;\n\n do\n {\n if (scrap >= upperBorderLength && bNum < 2)\n {\n bNum++;\n scrap -= upperBorderLength;\n }\n else if (scrap >= borderLength && aNum < 4)\n {\n aNum++;\n scrap -= borderLength;\n }\n else\n {\n scrap = barLength;\n barNum++;\n }\n }\n while (aNum<4||bNum<2);\n\n Console.WriteLine(barNum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435_\u0434\u0432\u0435\u0440\u0435\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n int barLength = int.Parse(Console.ReadLine());\n int borderLength = int.Parse(Console.ReadLine());\n int upperBorderLength = int.Parse(Console.ReadLine());\n\n int scrap, barNum = 0, aNum=0,bNum=0;\n\n while (true)\n {\n if (upperBorderLength <= borderLength && bNum < 2 || aNum >= 4 && bNum < 2)\n {\n scrap = barLength;\n barNum++;\n scrap -= upperBorderLength;\n bNum++;\n }\n else if(aNum<4 || bNum>=2 && aNum<4)\n {\n scrap = barLength;\n barNum++;\n scrap -= borderLength;\n aNum++;\n }\n else\n {\n break;\n }\n while (true)\n {\n int aTmp = scrap - borderLength;\n int bTmp = scrap - upperBorderLength;\n if (aTmp>=0&&aTmp<=bTmp&&aNum<4 || aTmp>=0&&aNum<4&&bNum>=2)\n {\n scrap = aTmp;\n aNum++;\n }\n else if (bTmp>=0&&bNum<2 || bTmp >= 0 && bNum < 2 && aNum >= 4)\n {\n scrap = bTmp;\n bNum++;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.WriteLine(barNum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435_\u0434\u0432\u0435\u0440\u0435\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n int barLength = int.Parse(Console.ReadLine());\n int borderLength = int.Parse(Console.ReadLine());\n int upperBorderLength = int.Parse(Console.ReadLine());\n\n int scrap, barNum = 0, aNum=0,bNum=0;\n\n while (true)\n {\n if (upperBorderLength<=borderLength && bNum<2)\n {\n scrap = barLength;\n barNum++;\n scrap -= upperBorderLength;\n bNum++;\n }\n else if(aNum<4)\n {\n scrap = barLength;\n barNum++;\n scrap -= borderLength;\n aNum++;\n }\n else\n {\n break;\n }\n while (true)\n {\n int aTmp = scrap - borderLength;\n int bTmp = scrap - upperBorderLength;\n if (aTmp>=0&&aTmp<=bTmp&&aNum<4 || aTmp>=0&&aNum<4&&bNum>=2)\n {\n scrap = aTmp;\n aNum++;\n }\n else if (bTmp>=0&&bNum<2 || bTmp >= 0 && bNum < 2 && aNum >= 4)\n {\n scrap = bTmp;\n bNum++;\n }\n else\n {\n break;\n }\n }\n }\n\n Console.WriteLine(barNum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace \u041e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u0438\u0435_\u0434\u0432\u0435\u0440\u0435\u0439\n{\n class Program\n {\n static void Main(string[] args)\n {\n int barLength = int.Parse(Console.ReadLine());\n int borderLength = int.Parse(Console.ReadLine());\n int upperBorderLength = int.Parse(Console.ReadLine());\n\n int scrap = barLength, barNum = 1, aNum=0,bNum=0;\n\n do\n {\n if (scrap>=borderLength&&aNum<4)\n {\n aNum++;\n scrap -= borderLength;\n }\n else if (scrap>=upperBorderLength&&bNum<2)\n {\n bNum++;\n scrap -= upperBorderLength;\n }\n else\n {\n scrap = barLength;\n barNum++;\n }\n }\n while (aNum<4||bNum<2);\n\n Console.WriteLine(barNum);\n }\n }\n}\n"}], "src_uid": "1a50fe39e18f86adac790093e195979a"} {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n const int N = 101;\n const int K = 51;\n const int INF = 1000 * 1000 * 1000;\n private static int solve()\n {\n string s = GetString();\n int n = GetInt();\n int[][][] dp1 = new int[101][][];\n for (int i = 0; i < 101; ++i)\n {\n dp1[i] = new int[2][];\n for (int j = 0; j < 2; ++j)\n {\n dp1[i][j] = new int[51];\n }\n }\n for (int i = 0; i < 101; ++i)\n for (int j = 0; j < 51; ++j)\n {\n dp1[i][0][j] = dp1[i][1][j] = -INF;\n }\n dp1[0][0][0] = dp1[0][1][0] = 0;\n for (int i = 1; i <= s.Length; ++i)\n {\n for (int j = 0; j <= n; ++j)\n {\n for (int k = 0; k <= j; ++k)\n {\n if (s[i - 1] == 'T')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i - 1][1][j - k], dp1[i][0][j]);\n dp1[i][1][j] = Math.Max(dp1[i - 1][0][j - k], dp1[i][1][j]);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n }\n if (s[i - 1] == 'F')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][1][j - k]);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][0][j - k]);\n }\n }\n }\n }\n }\n int ans = Math.Max(dp1[s.Length][0][n], dp1[s.Length ][1][n]);\n return ans;\n }\n public static void Main()\n {\n Console.WriteLine(solve());\n }\n\n\n\n private static int pos = 0;\n private static string[] st;\n private static string GetString()\n {\n if (st == null || pos == st.Length)\n {\n st = Console.ReadLine().Split(' ');\n pos = 0;\n }\n return st[pos++];\n }\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass C\n\t{\n\t\tprivate const int INF = 1000000;\n\n\t\tprivate int[, , ,] dp;\n\t\tprivate bool[, , ,] was;\n\t\tprivate string line;\n\n\t\tint go( int p, int done, int n, int left )\n\t\t{\n\t\t\tif ( was[p + line.Length, done, n, left] )\n\t\t\t\treturn dp[p + line.Length, done, n, left];\n\t\t\tint res;\n\t\t\tif ( done == line.Length )\n\t\t\t{\n\t\t\t\tif ( n == 0 )\n\t\t\t\t{\n\t\t\t\t\tres = Math.Abs( p );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres = -INF;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( line[done] == 'F' )\n\t\t\t\t{\n\t\t\t\t\tres = go( p + ( left == 1 ? -1 : 1 ), done + 1, n, left );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tres = go( p, done + 1, n, 1 - left );\n\t\t\t\t}\n\t\t\t\tif ( n > 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( line[done] == 'T' )\n\t\t\t\t\t{\n\t\t\t\t\t\tres = Math.Max( res, go( p + ( left == 1 ? -1 : 1 ), done + 1, n - 1, left ) );\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tres = Math.Max( res, go( p, done + 1, n - 1, 1 - left ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( n > 1 )\n\t\t\t\t{\n\t\t\t\t\tres = Math.Max( res, go( p, done, n - 2, left ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\twas[p + line.Length, done, n, left] = true;\n\t\t\treturn dp[p + line.Length, done, n, left] = res;\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tline = NextLine();\n\t\t\tvar n = NextInt();\n\n\t\t\tvar tc = line.Count( c => c == 'T' );\n\t\t\tif ( tc <= n )\n\t\t\t{\n\t\t\t\tif ( ( n - tc ) % 2 == 0 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( line.Length );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( line.Length - 1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twas = new bool[2 * line.Length + 1, line.Length + 1, n + 1, 2];\n\t\t\t\tdp = new int[2 * line.Length + 1, line.Length + 1, n + 1, 2];\n\t\t\t\tOut.WriteLine( go( 0, 0, n, 0 ) );\n\t\t\t}\n\t\t}\n\n\n\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 20000000 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew C().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n\n bool[,, ,] dp;\n int n;\n string s;\n int len;\n int ret;\n\n void calc()\n {\n cin = new Scanner();\n int i, j, k;\n s = Console.ReadLine();\n n = cin.nextInt();\n len = s.Length;\n dp = new bool[101, 300, n + 1, 2];\n ret = 0;\n dfs(0, 150, 0, 0);\n Console.WriteLine(ret);\n }\n\n\n void dfs(int now, int pos, int change, int a)\n {\n if (change > n) return;\n if (now == len)\n {\n if (change % 2 != n % 2) return;\n //Console.WriteLine(pos);\n ret = Math.Max(ret, Math.Abs(pos - 150)); return;\n }\n if (dp[now, pos, change, a]) return;\n dp[now, pos, change, a] = true;\n int memo = 1;\n if (s[now] == 'F') memo = 0;\n int v = 1;\n if (a == 1) v = -1;\n\n dfs(now + 1, pos + v, change + memo, a);\n dfs(now + 1, pos, change + (1 - memo), 1 - a);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace E\n{\n class Program\n {\n static string cmd;\n static int?[, , ,] memfr = new int?[101, 51, 220, 2];\n static int?[, , ,] memfl = new int?[101, 51, 220, 2];\n\n static int farright(int p, int n, int x, bool r)\n {\n \n if (memfr[p, n, x + 110, r?0:1].HasValue)\n return memfr[p, n, x + 110, r ? 0 : 1].Value;\n\n char c = cmd[p];\n int ret = 0;\n if (p == cmd.Length - 1)\n {\n if (n % 2 == 1)\n c = c == 'F' ? 'T' : 'F';\n if (c == 'T')\n ret = x;\n else if (c == 'F')\n ret = x + (r ? 1 : -1);\n }\n else\n {\n int v1 = int.MaxValue;\n int v2 = int.MaxValue;\n if (c == 'F' && n > 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n - 1, x, !r);\n }\n else if (c == 'F' && n == 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n }\n else if (c == 'T' && n > 0)\n {\n v1 = farright(p + 1, n - 1, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n, x, !r);\n }\n else if (c == 'T' && n == 0)\n {\n v1 = farright(p + 1, n, x, !r);\n }\n\n ret = v1;\n if (v2 != int.MaxValue)\n ret = Math.Max(ret, v2);\n }\n\n memfr[p, n, x + 110, r ? 0 : 1] = ret;\n return ret;\n }\n\n static int farleft(int p, int n, int x, bool r)\n {\n if (memfl[p, n, x + 110, r ? 0 : 1].HasValue)\n return memfl[p, n, x + 110, r ? 0 : 1].Value;\n\n char c = cmd[p];\n int ret = 0;\n if (p == cmd.Length - 1)\n {\n if (n % 2 == 1)\n c = c == 'F' ? 'T' : 'F';\n if (c == 'T')\n ret = x;\n else if (c == 'F')\n ret = x + (r ? 1 : -1);\n }\n else\n {\n int v1 = int.MaxValue;\n int v2 = int.MaxValue;\n if (c == 'F' && n > 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n - 1, x, !r);\n }\n else if (c == 'F' && n == 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n }\n else if (c == 'T' && n > 0)\n {\n v1 = farright(p + 1, n - 1, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n, x, !r);\n }\n else if (c == 'T' && n == 0)\n {\n v1 = farright(p + 1, n, x, !r);\n }\n\n ret = v1;\n if (v2 != int.MaxValue)\n ret = Math.Min(ret, v2);\n }\n\n memfl[p, n, x + 110, r ? 0 : 1] = ret;\n return ret;\n }\n\n static void Main(string[] args)\n {\n cmd = Console.ReadLine();\n int n = int.Parse(Console.ReadLine());\n\n int[] dist = new int[] {\n farright(0, n, 0, true),\n farleft(0, n, 0, true),\n farright(0, n, 0, false),\n farleft(0, n, 0, false)\n };\n\n Console.WriteLine(dist.Max(x => Math.Abs(x)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n const int N = 101;\n const int K = 51;\n const int INF = 1000 * 1000 * 1000;\n private static int solve()\n {\n string s = GetString();\n int n = GetInt();\n int[][][] dp1 = new int[101][][];\n for (int i = 0; i < 101; ++i)\n {\n dp1[i] = new int[2][];\n for (int j = 0; j < 2; ++j)\n {\n dp1[i][j] = new int[51];\n }\n }\n for (int i = 0; i < 101; ++i)\n for (int j = 0; j < 51; ++j)\n {\n dp1[i][0][j] = dp1[i][1][j] = -INF;\n }\n dp1[0][0][0] = dp1[0][1][0] = 0;\n for (int i = 1; i <= s.Length; ++i)\n {\n for (int j = 0; j <= n; ++j)\n {\n for (int k = 0; k <= j; ++k)\n {\n if (s[i - 1] == 'T')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i - 1][1][j - k], dp1[i][0][j]);\n dp1[i][1][j] = Math.Max(dp1[i - 1][0][j - k], dp1[i][1][j]);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n }\n if (s[i - 1] == 'F')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][1][j - k]);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][0][j - k]);\n }\n }\n }\n }\n }\n int ans = Math.Max(dp1[s.Length][0][n], dp1[s.Length ][1][n]);\n return ans;\n }\n public static void Main()\n {\n Console.WriteLine(solve());\n }\n\n\n\n private static int pos = 0;\n private static string[] st;\n private static string GetString()\n {\n if (st == null || pos == st.Length)\n {\n st = Console.ReadLine().Split(' ');\n pos = 0;\n }\n return st[pos++];\n }\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Logo_Turtle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n int n = int.Parse(reader.ReadLine());\n\n int sl = s.Length*2;\n var dp = new bool[n + 1,sl + 1,2];\n dp[0, s.Length, 0] = true;\n\n foreach (char c in s)\n {\n var next = new bool[n + 1,sl + 1,2];\n\n for (int i = 0; i <= n; i++)\n {\n for (int j = 0; j <= sl; j++)\n {\n if (dp[i, j, 0])\n {\n if (c == 'F')\n {\n for (int k = i; k <= n; k += 2) next[k, j + 1, 0] = true;\n for (int k = i + 1; k <= n; k += 2) next[k, j, 1] = true;\n }\n else\n {\n for (int k = i; k <= n; k += 2) next[k, j, 1] = true;\n for (int k = i + 1; k <= n; k += 2) next[k, j + 1, 0] = true;\n }\n }\n if (dp[i, j, 1])\n {\n if (c == 'F')\n {\n for (int k = i; k <= n; k += 2) next[k, j - 1, 1] = true;\n for (int k = i + 1; k <= n; k += 2) next[k, j, 0] = true;\n }\n else\n {\n for (int k = i; k <= n; k += 2) next[k, j, 0] = true;\n for (int k = i + 1; k <= n; k += 2) next[k, j - 1, 1] = true;\n }\n }\n }\n }\n\n dp = next;\n }\n\n for (int i = s.Length;; i--)\n {\n if (dp[n, s.Length - i, 0] || dp[n, s.Length - i, 1] || dp[n, s.Length + i, 0] || dp[n, s.Length + i, 1])\n {\n writer.WriteLine(i);\n break;\n }\n }\n\n writer.Flush();\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace E\n{\n class Program\n {\n static string cmd;\n static int?[, , ,] memfr = new int?[101, 51, 220, 2];\n static int?[, , ,] memfl = new int?[101, 51, 220, 2];\n\n static int farright(int p, int n, int x, bool r)\n {\n \n if (memfr[p, n, x + 110, r?0:1].HasValue)\n return memfr[p, n, x + 110, r ? 0 : 1].Value;\n\n char c = cmd[p];\n int ret = 0;\n if (p == cmd.Length - 1)\n {\n if (n % 2 == 1)\n c = c == 'F' ? 'T' : 'F';\n if (c == 'T')\n ret = x;\n else if (c == 'F')\n ret = x + (r ? 1 : -1);\n }\n else\n {\n int v1 = int.MaxValue;\n int v2 = int.MaxValue;\n if (c == 'F' && n > 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n - 1, x, !r);\n }\n else if (c == 'F' && n == 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n }\n else if (c == 'T' && n > 0)\n {\n v1 = farright(p + 1, n - 1, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n, x, !r);\n }\n else if (c == 'T' && n == 0)\n {\n v1 = farright(p + 1, n, x, !r);\n }\n\n ret = v1;\n if (v2 != int.MaxValue)\n ret = Math.Max(ret, v2);\n }\n\n memfr[p, n, x + 110, r ? 0 : 1] = ret;\n return ret;\n }\n\n static int farleft(int p, int n, int x, bool r)\n {\n if (memfl[p, n, x + 110, r ? 0 : 1].HasValue)\n return memfl[p, n, x + 110, r ? 0 : 1].Value;\n\n char c = cmd[p];\n int ret = 0;\n if (p == cmd.Length - 1)\n {\n if (n % 2 == 1)\n c = c == 'F' ? 'T' : 'F';\n if (c == 'T')\n ret = x;\n else if (c == 'F')\n ret = x + (r ? 1 : -1);\n }\n else\n {\n int v1 = int.MaxValue;\n int v2 = int.MaxValue;\n if (c == 'F' && n > 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n - 1, x, !r);\n }\n else if (c == 'F' && n == 0)\n {\n v1 = farright(p + 1, n, x + (r ? 1 : -1), r);\n }\n else if (c == 'T' && n > 0)\n {\n v1 = farright(p + 1, n - 1, x + (r ? 1 : -1), r);\n v2 = farright(p + 1, n, x, !r);\n }\n else if (c == 'T' && n == 0)\n {\n v1 = farright(p + 1, n, x, !r);\n }\n\n ret = v1;\n if (v2 != int.MaxValue)\n ret = Math.Min(ret, v2);\n }\n\n memfl[p, n, x + 110, r ? 0 : 1] = ret;\n return ret;\n }\n\n static void Main(string[] args)\n {\n cmd = Console.ReadLine();\n int n = int.Parse(Console.ReadLine());\n\n int xr = farright(0, n, 0, true);\n int xl = farleft(0, n, 0, true);\n\n //Console.WriteLine(xr);\n Console.WriteLine(Math.Max(Math.Abs(xr), Math.Abs(xl)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n const int N = 101;\n const int K = 51;\n const int INF = 1000 * 1000 * 1000;\n private static int solve()\n {\n string s = GetString();\n int n = GetInt();\n int[][][] dp1 = new int[101][][];\n int[][][] dp2 = new int[101][][];\n for (int i = 0; i < 101; ++i)\n {\n dp1[i] = new int[2][];\n for (int j = 0; j < 2; ++j)\n {\n dp1[i][j] = new int[51];\n }\n }\n for (int i = 0; i < 101; ++i)\n for (int j = 0; j < 51; ++j)\n {\n dp1[i][0][j] = dp1[i][1][j] = -INF;\n }\n for (int k = 0; k <= n; ++k)\n dp1[0][0][k] = dp1[0][1][k] = 0;\n for (int i = 1; i <= s.Length; ++i)\n {\n for (int j = 0; j <= n; ++j)\n {\n for (int k = 0; k <= j; ++k)\n {\n if (s[i - 1] == 'T')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i - 1][1][j - k], dp1[i][0][j]);\n dp1[i][1][j] = Math.Max(dp1[i - 1][0][j - k], dp1[i][1][j]);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n }\n if (s[i - 1] == 'F')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][1][j - k]);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][0][j - k]);\n }\n }\n }\n }\n }\n int ans = Math.Max(dp1[s.Length][0][n], dp1[s.Length][1][n]);\n return ans;\n }\n public static void Main()\n {\n Console.WriteLine(solve());\n }\n\n\n\n private static int pos = 0;\n private static string[] st;\n private static string GetString()\n {\n if (st == null || pos == st.Length)\n {\n st = Console.ReadLine().Split(' ');\n pos = 0;\n }\n return st[pos++];\n }\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n const int N = 101;\n const int K = 51;\n const int INF = 1000 * 1000 * 1000;\n private static int solve()\n {\n string s = GetString();\n int n = GetInt();\n int[][][] dp1 = new int[101][][];\n int[][][] dp2 = new int[101][][];\n for (int i = 0; i < 101; ++i)\n {\n dp1[i] = new int[2][];\n dp2[i] = new int[2][];\n for (int j = 0; j < 2; ++j)\n {\n dp1[i][j] = new int[51];\n dp2[i][j] = new int[51];\n }\n }\n for (int i = 0; i < 101; ++i)\n for (int j = 0; j < 51; ++j)\n {\n dp1[i][0][j] = dp1[i][1][j] = -INF;\n dp2[i][0][j] = dp2[i][1][j] = -INF;\n }\n for (int i = 0; i <= n; ++i)\n {\n if (s[0] == 'T')\n {\n dp1[0][0][i] = i % 2 == 1 ? 1 : -INF;\n dp1[0][1][i] = i % 2 == 0 ? 0 : -INF;\n dp2[0][0][i] = i % 2 == 0 ? 0 : -INF;\n dp2[0][1][i] = i % 2 == 1 ? 1 : -INF;\n }\n else\n {\n dp1[0][0][i] = i % 2 == 0 ? 1 : -INF;\n dp1[0][1][i] = i % 2 == 1 ? 0 : -INF;\n dp2[0][0][i] = i % 2 == 1 ? 0 : -INF;\n dp2[0][1][i] = i % 2 == 0 ? 1 : -INF;\n }\n }\n\n\n for (int i = 1; i < s.Length; ++i)\n {\n for (int j = 0; j <= n; ++j)\n {\n for (int k = 0; k <= j; ++k)\n {\n if (s[i] == 'T')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i - 1][1][j - k], dp1[i][0][j]);\n dp1[i][1][j] = Math.Max(dp1[i - 1][0][j - k], dp1[i][1][j]);\n dp2[i][0][j] = Math.Max(dp2[i - 1][1][j - k], dp2[i][0][j]);\n dp2[i][1][j] = Math.Max(dp2[i - 1][0][j - k], dp2[i][1][j]);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n dp2[i][0][j] = Math.Max(dp2[i][0][j], dp2[i - 1][0][j - k] + 1);\n dp2[i][1][j] = Math.Max(dp2[i][1][j], dp2[i - 1][1][j - k] - 1);\n }\n }\n if (s[i] == 'F')\n {\n if (k % 2 == 0)\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][0][j - k] + 1);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][1][j - k] - 1);\n dp2[i][0][j] = Math.Max(dp2[i][0][j], dp2[i - 1][0][j - k] + 1);\n dp2[i][1][j] = Math.Max(dp2[i][1][j], dp2[i - 1][1][j - k] - 1);\n }\n else\n {\n dp1[i][0][j] = Math.Max(dp1[i][0][j], dp1[i - 1][1][j - k]);\n dp1[i][1][j] = Math.Max(dp1[i][1][j], dp1[i - 1][0][j - k]);\n dp2[i][0][j] = Math.Max(dp2[i][0][j], dp2[i - 1][1][j - k]);\n dp2[i][1][j] = Math.Max(dp2[i][1][j], dp2[i - 1][0][j - k]);\n }\n }\n }\n }\n }\n int ans = Math.Max(dp1[s.Length - 1][0][n], dp1[s.Length - 1][1][n]);\n ans = Math.Max(ans, Math.Max(dp2[s.Length - 1][0][n], dp2[s.Length - 1][1][n]));\n return ans;\n }\n public static void Main()\n {\n Console.WriteLine(solve());\n }\n\n\n\n private static int pos = 0;\n private static string[] st;\n private static string GetString()\n {\n if (st == null || pos == st.Length)\n {\n st = Console.ReadLine().Split(' ');\n pos = 0;\n }\n return st[pos++];\n }\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Logo_Turtle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n int n = int.Parse(reader.ReadLine());\n\n int sl = s.Length*2;\n var dp = new bool[n + 1,sl + 1,2];\n dp[0, s.Length, 0] = true;\n\n foreach (char c in s)\n {\n var next = new bool[n + 1,sl + 1,2];\n\n for (int i = 0; i <= n; i++)\n {\n for (int j = 0; j <= sl; j++)\n {\n if (dp[i, j, 0])\n {\n if (c == 'F')\n {\n next[i, j + 1, 0] = true;\n if (i + 1 <= n) next[i + 1, j, 1] = true;\n }\n else\n {\n next[i, j, 1] = true;\n if (i + 1 <= n) next[i + 1, j + 1, 0] = true;\n }\n }\n if (dp[i, j, 1])\n {\n if (c == 'F')\n {\n next[i, j - 1, 1] = true;\n if (i + 1 <= n) next[i + 1, j, 0] = true;\n }\n else\n {\n next[i, j, 0] = true;\n if (i + 1 <= n) next[i + 1, j - 1, 1] = true;\n }\n }\n }\n }\n\n dp = next;\n }\n\n for (int i = s.Length;; i--)\n {\n if (dp[n, s.Length - i, 0] || dp[n, s.Length - i, 1] || dp[n, s.Length + i, 0] || dp[n, s.Length + i, 1])\n {\n writer.WriteLine(i);\n break;\n }\n }\n\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n\n bool[,, ,] dp;\n int n;\n string s;\n int len;\n int ret;\n\n void calc()\n {\n cin = new Scanner();\n int i, j, k;\n s = Console.ReadLine();\n n = cin.nextInt();\n len = s.Length;\n dp = new bool[101, 300, n + 1, 2];\n ret = 0;\n dfs(0, 150, 0, 0);\n Console.WriteLine(ret);\n }\n\n\n void dfs(int now, int pos, int change, int a)\n {\n if (change > n) return;\n if (now == len)\n {\n if (change != n) return;\n ret = Math.Max(ret, Math.Abs(pos - 150)); return;\n }\n if (dp[now, pos, change, a]) return;\n dp[now, pos, change, a] = true;\n int memo = 1;\n if (s[now] == 'F') memo = 0;\n int v = 1;\n if (a == 1) v = -1;\n\n dfs(now + 1, pos + v, change + memo, a);\n dfs(now + 1, pos, change + (1 - memo), 1 - a);\n }\n}"}], "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace D\n{\n class Program\n {\n static double p_select(int l, int r, int inl, int inr)\n {\n inl = Math.Max(inl, l);\n inr = Math.Min(inr, r);\n if (inl > inr)\n return 0.0;\n\n return (double)(inr - inl + 1) / (double)(r - l + 1);\n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n List[] lucky = new List[10];\n for (int i = 0; i < 10; i++)\n lucky[i] = new List();\n lucky[1].Add(4);\n lucky[1].Add(7);\n\n int m = 10;\n for (int i = 2; i < 10; i++)\n {\n foreach (int x in lucky[i - 1])\n {\n int y4 = m * 4 + x;\n int y7 = m * 7 + x;\n lucky[i].Add(y4);\n lucky[i].Add(y7);\n }\n m *= 10;\n }\n\n lucky[0].Add(-1); // stop value\n lucky[0].Add(int.MaxValue - 1); // stop value\n int[] luckyAll = lucky[0].Union(lucky[1]).Union(lucky[2]).Union(lucky[3]).Union(lucky[4]).Union(lucky[5]).Union(lucky[6]).Union(lucky[7]).Union(lucky[8]).Union(lucky[9]).ToArray();\n Array.Sort(luckyAll);\n\n string[] line = Console.ReadLine().Split();\n int pl = int.Parse(line[0]);\n int pr = int.Parse(line[1]);\n int vl = int.Parse(line[2]);\n int vr = int.Parse(line[3]);\n int k = int.Parse(line[4]);\n\n double S = 0.0;\n\n int p = pl;\n while (p <= pr)\n {\n int fp = Array.BinarySearch(luckyAll, p);\n int q;\n if (fp < 0)\n {\n fp = ~fp;\n q = luckyAll[fp] - 1;\n q = Math.Min(q, pr);\n\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(pl, pr, p, q) * p_select(vl, vr, q1, q2);\n }\n else\n {\n q = p;\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n if (k == 1)\n {\n q1 = p + 1;\n }\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(pl, pr, p, q) * p_select(vl, vr, q1, q2);\n } \n\n p = q + 1;\n }\n\n p = vl;\n while (p <= vr)\n {\n int fp = Array.BinarySearch(luckyAll, p);\n int q;\n if (fp < 0)\n {\n fp = ~fp;\n q = luckyAll[fp] - 1;\n q = Math.Min(q, vr);\n\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(vl, vr, p, q) * p_select(pl, pr, q1, q2);\n }\n else\n {\n q = p;\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n if (k == 1)\n {\n q1 = p + 1;\n }\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(vl, vr, p, q) * p_select(pl, pr, q1, q2);\n }\n\n p = q + 1;\n }\n\n if (k == 1)\n {\n for (int i = 1; i < luckyAll.Length - 1; i++)\n {\n int a = luckyAll[i];\n if(a >= pl && a <= pr && a >= vl && a <= vr)\n S += p_select(pl, pr, a, a) * p_select(vl, vr, a, a);\n }\n }\n\n\n Console.WriteLine(\"{0:0.000000000}\", S);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round84 {\n class B {\n static List v = new List();\n const int MAX = 1000000000;\n\n static void dfs(long x) {\n if (x > MAX) return;\n v.Add((int)x);\n dfs(x * 10 + 4);\n dfs(x * 10 + 7);\n }\n\n static double choiceProb(int l1, int r1, int l2, int r2) {\n int low = Math.Max(l1, l2),\n high = Math.Min(r1, r2);\n if (low > high) {\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, 0);\n return 0;\n }\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, (high - low + 1) / (double)(r1 - l1 + 1));\n return (high - low + 1) / (double)(r1 - l1 + 1);\n }\n\n static void Main() {\n dfs(0);\n v.Add(MAX + 1);\n v.Sort();\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int pl = xs[0],\n pr = xs[1],\n vl = xs[2],\n vr = xs[3],\n k = xs[4];\n\n double res = 0;\n for (int i = 1; i < v.Count; i++) {\n int j = i + k;\n if (j >= v.Count) {\n break;\n }\n\n res += choiceProb(pl, pr, v[i - 1] + 1, v[i]) * choiceProb(vl, vr, v[j - 1], v[j] - 1);\n res += choiceProb(vl, vr, v[i - 1] + 1, v[i]) * choiceProb(pl, pr, v[j - 1], v[j] - 1);\n if(k == 1 && pl <= v[i] && v[i] <= pr && vl <= v[i] && v[i] <= vr) {\n res -= 1.0/(pr-pl+1)/(vr-vl+1);\n }\n }\n\n Console.WriteLine(\"{0:F12}\", res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += (long)Intersectie(x1, x2, L[i - 1] + 1, L[i]) * (long)Intersectie(y1, y2, L[j], L[j + 1] - 1);\n Rez += (long)Intersectie(y1, y2, L[i - 1] + 1, L[i]) * (long)Intersectie(x1, x2, L[j], L[j + 1] - 1);\n if (k == 1 && x1 <= L[i] && L[i] <= x2 && y1 <= L[i] && L[i] <= y2) Rez--;\n }\n\n long Posibilitati = (long)(x2 - x1 + 1) * (long)(y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static long Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n//using System.Reflection;\n//using System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n//using System.Text;\n//using System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n readonly static IEnumerator Tokens;\n static Scanner()\n {\n Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n\n public static string NextToken()\n {\n Tokens.MoveNext();\n return Tokens.Current;\n }\n }\n\n int nextInt()\n {\n return int.Parse(Scanner.NextToken());\n }\n\n bool GoodValue(int a)\n {\n if (a <= 0) return false;\n while (a != 0)\n {\n if (a % 10 != 7 && a % 10 != 4) return false;\n a /= 10;\n }\n return true;\n }\n\n int[] GenSequence()\n {\n var l = new List();\n var q = new Queue();\n q.Enqueue(0);\n while (q.Count != 0)\n {\n int cur = q.Dequeue();\n l.Add(cur);\n if (GoodValue(cur * 10 + 4)) q.Enqueue(cur * 10 + 4);\n if (GoodValue(cur * 10 + 7)) q.Enqueue(cur * 10 + 7);\n }\n return l.Concat(Enumerable.Range(1111111111, 1)).OrderBy(c => c).ToArray();\n }\n\n int LowerBound(int v, int[] a)\n {\n int x = 0, y = a.Length;\n while (y - x > 1)\n {\n int z = (x + y) / 2;\n if (a[z] <= v) x = z;\n else y = z;\n }\n return x;\n }\n\n int Len(int x, int y, int[] a, int p)\n {\n if (p < 1 || p >= a.Length) return 0;\n int tx = Math.Max(x, a[p - 1]), ty = Math.Min(y, a[p]);\n if (GoodValue(tx)) tx++;\n if (GoodValue(ty)) ty--;\n return Math.Max(ty - tx + 1, 0);\n }\n\n void Solve()\n {\n var values = GenSequence();\n int pl = nextInt(), pr = nextInt(),\n vl = nextInt(), vr = nextInt(),\n k = nextInt();\n long res = 0;\n for (int x = 1; x < values.Length; x++)\n {\n long pc = Len(pl, pr, values, x);\n long rc1 = Len(vl, vr, values, x + k),\n rc2 = Len(vl, vr, values, x - k);\n res += pc * (rc1 + rc2);\n if (x + k - 1 < values.Length && values[x + k - 1] >= vl && values[x + k - 1] <= vr) res += pc;\n if (x - k > 0 && values[x - k] >= vl && values[x - k] <= vr) res += pc;\n\n if (values[x] >= pl && values[x] <= pr)\n {\n res += Len(vl, vr, values, x - k + 1);\n res += Len(vl, vr, values, x + k);\n\n res += new[] { x + k - 1, x - k + 1 }.Distinct().Where(\n c => c > 0 && c < values.Length &&\n values[c] >= vl && values[c] <= vr\n ).Count();\n }\n }\n long all = (pr - pl + 1);\n all *= (vr - vl + 1);\n Console.Write(\"{0:F12}\", (double)res / (double)(all));\n }\n\n static void Main()\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\n\nnamespace Task\n{\n class MyIo\n {\n char[] separators = new char[] { ' ', '\\t' };\n\n#if TEST\n TextReader inputStream = new StreamReader(\"..\\\\..\\\\input.txt\");\n#else\n TextReader inputStream = System.Console.In;\n#endif\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n\n\n\n\n class Program\n {\n MyIo io = new MyIo();\n\n const int Limit = 1000000000;\n\n void Populate(List list, long curNum)\n {\n if (curNum > Limit)\n {\n return;\n }\n if (curNum != 0)\n {\n list.Add((int)curNum);\n }\n Populate(list, curNum * 10 + 4);\n Populate(list, curNum * 10 + 7);\n }\n\n double Fp(int low, int high, int tLow, int tHigh)\n {\n if (low > high || tLow > tHigh)\n {\n return 0;\n }\n\n int iLow = Math.Max(low, tLow);\n int iHigh = Math.Min(high, tHigh);\n\n if (iLow > iHigh)\n {\n return 0;\n }\n\n double res = (iHigh - iLow + 1D) / (high - low + 1D);\n return res;\n }\n\n void Solve()\n {\n // Place your code here\n int pL = io.NextInt();\n int pR = io.NextInt();\n int vL = io.NextInt();\n int vR = io.NextInt();\n int k = io.NextInt();\n\n List list = new List();\n Populate(list, 0);\n list.Sort();\n\n double ans = 0;\n\n for (int a = 0; a < list.Count; a++)\n {\n int b = a + k - 1;\n if (b >= list.Count)\n {\n break;\n }\n\n\n int beforeLow = a == 0 ? 1 : list[a - 1] + 1;\n int beforeHigh = list[a];\n\n int afterLow = list[b];\n int afterHigh = b + 1 == list.Count ? Limit : list[b + 1] - 1;\n\n double r1 = Fp(pL, pR, beforeLow, beforeHigh);\n double r2 = Fp(vL, vR, afterLow, afterHigh);\n\n double r3 = Fp(vL, vR, beforeLow, beforeHigh);\n double r4 = Fp(pL, pR, afterLow, afterHigh);\n\n double res = r1 * r2 + r3 * r4;\n\n if (k == 1 && pL <= list[a] && list[a] <= pR && vL <= list[a] && list[a] <= vR)\n {\n double r5 = Fp(vL, vR, list[a], list[a]);\n double r6 = Fp(pL, pR, list[a], list[a]);\n res -= r5 * r6;\n }\n\n ans += res;\n }\n\n io.PrintLine(ans);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n\n p.Solve();\n p.io.Close();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += (long)Intersectie(x1, x2, L[i - 1] + 1, L[i]) * (long)Intersectie(y1, y2, L[j], L[j + 1] - 1);\n Rez += (long)Intersectie(y1, y2, L[i - 1] + 1, L[i]) * (long)Intersectie(x1, x2, L[j], L[j + 1] - 1);\n if (k == 1 && x1 <= L[i] && L[i] <= x2 && y1 <= L[i] && L[i] <= y2) Rez--;\n }\n\n long Posibilitati = (long)(x2 - x1 + 1) * (long)(y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static long Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n//using System.Reflection;\n//using System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n//using System.Text;\n//using System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n readonly static IEnumerator Tokens;\n static Scanner()\n {\n Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n\n public static string NextToken()\n {\n Tokens.MoveNext();\n return Tokens.Current;\n }\n }\n\n int nextInt()\n {\n return int.Parse(Scanner.NextToken());\n }\n\n bool GoodValue(int a)\n {\n if (a <= 0) return false;\n while (a != 0)\n {\n if (a % 10 != 7 && a % 10 != 4) return false;\n a /= 10;\n }\n return true;\n }\n\n int[] GenSequence()\n {\n var l = new List();\n var q = new Queue();\n q.Enqueue(0);\n while (q.Count != 0)\n {\n int cur = q.Dequeue();\n l.Add(cur);\n if (GoodValue(cur * 10 + 4)) q.Enqueue(cur * 10 + 4);\n if (GoodValue(cur * 10 + 7)) q.Enqueue(cur * 10 + 7);\n }\n return l.Concat(Enumerable.Range(1111111111, 1)).OrderBy(c => c).ToArray();\n }\n\n int LowerBound(int v, int[] a)\n {\n int x = 0, y = a.Length;\n while (y - x > 1)\n {\n int z = (x + y) / 2;\n if (a[z] <= v) x = z;\n else y = z;\n }\n return x;\n }\n\n int Len(int x, int y, int[] a, int p)\n {\n if (p < 1 || p >= a.Length) return 0;\n int tx = Math.Max(x, a[p - 1]), ty = Math.Min(y, a[p]);\n if (GoodValue(tx)) tx++;\n if (GoodValue(ty)) ty--;\n return Math.Max(ty - tx + 1, 0);\n }\n\n void Solve()\n {\n var values = GenSequence();\n int pl = nextInt(), pr = nextInt(),\n vl = nextInt(), vr = nextInt(),\n k = nextInt();\n long res = 0;\n for (int x = 1; x < values.Length; x++)\n {\n long pc = Len(pl, pr, values, x);\n long rc1 = Len(vl, vr, values, x + k),\n rc2 = Len(vl, vr, values, x - k);\n res += pc * (rc1 + rc2);\n if (x + k - 1 < values.Length && values[x + k - 1] >= vl && values[x + k - 1] <= vr) res += pc;\n if (x - k > 0 && values[x - k] >= vl && values[x - k] <= vr) res += pc;\n\n if (values[x] >= pl && values[x] <= pr)\n {\n res += Len(vl, vr, values, x - k + 1);\n res += Len(vl, vr, values, x + k);\n\n res += new[] { x + k - 1, x - k + 1 }.Distinct().Where(\n c => c > 0 && c < values.Length &&\n values[c] >= vl && values[c] <= vr\n ).Count();\n }\n }\n long all = (pr - pl + 1);\n all *= (vr - vl + 1);\n Console.Write(\"{0:F12}\", (double)res / (double)(all));\n }\n\n static void Main()\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System;\n\nnamespace tc_cf_c_sharp\n{\n class MyIO\n {\n TextReader reader;\n TextWriter writer=Console.Out;\n string[] tokens;\n int pointer;\n public MyIO(TextReader rd)\n {\n reader = rd;\n }\n public string NextLine()\n {\n try\n {\n return reader.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[]{' '},System.StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n public void Write(string format, params object[] args)\n {\n writer.Write(format, args);\n }\n public void WriteLine(string format, params object[] args)\n {\n writer.WriteLine(format, args);\n }\n }\n class Program\n {\n static List li;\n static void gen(long r)\n {\n if (r > 10000000000) return;\n li.Add(r);\n gen(r * 10 + 4);\n gen(r * 10 + 7);\n\n }\n static void Main(string[] args)\n {\n MyIO myio = new MyIO(Console.In);\n //MyIO myio = new MyIO(new StreamReader(File.OpenRead(@\"D:\\project\\tc cf c sharp\\tc cf c sharp\\in.txt\")));\n li = new List();\n li.Add(0);\n gen(4); gen(7);\n li.Sort();\n long ct = 0;\n long v1 = myio.NextLong(), v2 = myio.NextLong(), p1 = myio.NextLong(), p2 = myio.NextLong();\n int k = myio.NextInt();\n for (int i = 0; i + k + 1 < li.Count; i++)\n {\n long mmin = li[i] + 1, mmax = li[i + 1];\n long nmin = li[i + k], nmax = li[i + k + 1] - 1;\n mmin = Math.Max(mmin, v1); mmax = Math.Min(mmax, v2);\n nmin = Math.Max(nmin, p1); nmax = Math.Min(nmax, p2);\n long t1 = Math.Max(0, mmax - mmin + 1);\n long t2 = Math.Max(0, nmax - nmin + 1);\n ct += t1 * t2;\n } \n for (int i = 0; i + k + 1 < li.Count; i++)\n {\n long mmin = li[i] + 1, mmax = li[i + 1];\n long nmin = li[i + k], nmax = li[i + k + 1] - 1;\n mmin = Math.Max(mmin, p1); mmax = Math.Min(mmax, p2);\n nmin = Math.Max(nmin, v1); nmax = Math.Min(nmax, v2);\n long t1 = Math.Max(0, mmax - mmin + 1);\n long t2 = Math.Max(0, nmax - nmin + 1);\n \n ct += t1 * t2;\n }\n for (int i = 0; i < li.Count; i++)\n {\n if (k==1&&li[i] >= v1 && li[i] <= v2 && li[i] >= p1 && li[i] <= p2) ct--;\n }\n long ct2 = (p2 - p1 + 1) * (v2 - v1 + 1);\n myio.WriteLine(\"{0}\",(double)ct/ct2);\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += Intersectie(x1, x2, L[i - 1] + 1, L[i]) * Intersectie(y1, y2, L[j], L[j+1]-1);\n Rez += Intersectie(y1, y2, L[i - 1] + 1, L[i]) * Intersectie(x1, x2, L[j], L[j+1]-1);\n }\n \n long Posibilitati = (x2 - x1 + 1) * (y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static int Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += Intersectie(x1, x2, L[i - 1] + 1, L[i]) * Intersectie(y1, y2, L[j], L[j+1]-1);\n Rez += Intersectie(y1, y2, L[i - 1] + 1, L[i]) * Intersectie(x1, x2, L[j], L[j+1]-1);\n }\n \n long Posibilitati = (x2 - x1 + 1) * (y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static int Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drB >= drA) return drA - stB + 1;\n if (stB <= stA && drA >= drB) return stA - drB + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += (long)Intersectie(x1, x2, L[i - 1] + 1, L[i]) * (long)Intersectie(y1, y2, L[j], L[j + 1] - 1);\n Rez += (long)Intersectie(y1, y2, L[i - 1] + 1, L[i]) * (long)Intersectie(x1, x2, L[j], L[j + 1] - 1);\n }\n \n long Posibilitati = (long)(x2 - x1 + 1) * (long)(y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati; if (Afis > 1) Afis = 1M;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static long Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += (long)Intersectie(x1, x2, L[i - 1] + 1, L[i]) * (long)Intersectie(y1, y2, L[j], L[j + 1] - 1);\n Rez += (long)Intersectie(y1, y2, L[i - 1] + 1, L[i]) * (long)Intersectie(x1, x2, L[j], L[j + 1] - 1);\n }\n \n long Posibilitati = (long)(x2 - x1 + 1) * (long)(y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static long Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += Intersectie(x1, x2, L[i - 1] + 1, L[i]) * Intersectie(y1, y2, L[j], L[j+1]-1);\n Rez += Intersectie(y1, y2, L[i - 1] + 1, L[i]) * Intersectie(x1, x2, L[j], L[j+1]-1);\n }\n \n long Posibilitati = (long)(x2 - x1 + 1) * (long)(y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static int Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= drB) return drA - stA + 1;\n if (stA <= stB && drA <= drB) return drA - stB + 1;\n if (stB <= stA && drB <= drA) return drB - stA + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass LuckyProbability\n{\n\n static int[] L = new int[1024];\n static int[] st = new int[10];\n static int LPos = 0;\n\n public static int Main()\n {\n //citire\n string[] citire = Console.ReadLine().Split(' ');\n int x1, x2, y1, y2, k;\n x1 = Convert.ToInt32(citire[0]);\n x2 = Convert.ToInt32(citire[1]);\n y1 = Convert.ToInt32(citire[2]);\n y2 = Convert.ToInt32(citire[3]);\n k = Convert.ToInt32(citire[4]);\n\n //solve\n back(1); L[1023] = 1000000001;\n Array.Sort(L, 1, 1022); //stocare numere Lucky\n\n int i, j; long Rez = 0;\n for (i = 1; i <= (1023 - k); i++)\n {\n j = i + k - 1;\n Rez += Intersectie(x1, x2, L[i - 1] + 1, L[i]) * Intersectie(y1, y2, L[j], L[j+1]-1);\n Rez += Intersectie(y1, y2, L[i - 1] + 1, L[i]) * Intersectie(x1, x2, L[j], L[j+1]-1);\n }\n \n long Posibilitati = (x2 - x1 + 1) * (y2 - y1 + 1);\n decimal Afis = (decimal)Rez / (decimal)Posibilitati;\n Console.WriteLine(Afis.ToString(\"N12\"));\n Console.ReadKey();\n\n return 0;\n }\n\n public static void back(int k)\n {\n int i, j, x;\n for (i = 4; i <= 7; i += 3)\n {\n st[k] = i;\n if (k < 9) back(k + 1);\n x = 0;\n for (j = 1; j <= k; j++) x = x * 10 + st[j];\n L[++LPos] = x;\n }\n }\n\n public static int Intersectie(int stA, int drA, int stB, int drB)\n {\n if (drA < stB || drB < stA) return 0;\n if (stA <= stB && drB <= drA) return drB - stB + 1;\n if (stB <= stA && drA <= stB) return drA - stA + 1;\n if (stA <= stB && drB >= drA) return drA - stB + 1;\n if (stB <= stA && drA >= drB) return stA - drB + 1;\n return 0;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace D\n{\n class Program\n {\n static double p_select(int l, int r, int inl, int inr)\n {\n inl = Math.Max(inl, l);\n inr = Math.Min(inr, r);\n if (inl > inr)\n return 0.0;\n\n return (double)(inr - inl + 1) / (double)(r - l + 1);\n }\n\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n List[] lucky = new List[10];\n for (int i = 0; i < 10; i++)\n lucky[i] = new List();\n lucky[1].Add(4);\n lucky[1].Add(7);\n\n int m = 10;\n for (int i = 2; i < 10; i++)\n {\n foreach (int x in lucky[i - 1])\n {\n int y4 = m * 4 + x;\n int y7 = m * 7 + x;\n lucky[i].Add(y4);\n lucky[i].Add(y7);\n }\n m *= 10;\n }\n\n lucky[0].Add(-1); // stop value\n lucky[0].Add(int.MaxValue - 1); // stop value\n int[] luckyAll = lucky[0].Union(lucky[1]).Union(lucky[2]).Union(lucky[3]).Union(lucky[4]).Union(lucky[5]).Union(lucky[6]).Union(lucky[7]).Union(lucky[8]).Union(lucky[9]).ToArray();\n Array.Sort(luckyAll);\n\n string[] line = Console.ReadLine().Split();\n int pl = int.Parse(line[0]);\n int pr = int.Parse(line[1]);\n int vl = int.Parse(line[2]);\n int vr = int.Parse(line[3]);\n int k = int.Parse(line[4]);\n\n double S = 0.0;\n\n int p = pl;\n while (p <= pr)\n {\n int fp = Array.BinarySearch(luckyAll, p);\n int q;\n if (fp < 0)\n {\n fp = ~fp;\n q = luckyAll[fp] - 1;\n q = Math.Min(q, pr);\n\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(pl, pr, p, q) * p_select(vl, vr, q1, q2);\n }\n else\n {\n q = p;\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n if (k == 1)\n {\n q1 = p + 1;\n }\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(pl, pr, p, q) * p_select(vl, vr, q1, q2);\n } \n\n p = q + 1;\n }\n\n p = vl;\n while (p <= vr)\n {\n int fp = Array.BinarySearch(luckyAll, p);\n int q;\n if (fp < 0)\n {\n fp = ~fp;\n q = luckyAll[fp] - 1;\n q = Math.Min(q, vr);\n\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(vl, vr, p, q) * p_select(pl, pr, q1, q2);\n }\n else\n {\n q = p;\n int idx1 = fp + k - 1;\n int idx2 = fp + k;\n int q1 = idx1 < luckyAll.Length ? luckyAll[idx1] : int.MaxValue;\n if (k == 1)\n {\n q1 = p + 1;\n }\n int q2 = idx2 < luckyAll.Length ? luckyAll[idx2] - 1 : int.MaxValue;\n\n S += p_select(vl, vr, p, q) * p_select(pl, pr, q1, q2);\n }\n\n p = q + 1;\n }\n\n if (k == 1)\n {\n for (int i = 1; i < luckyAll.Length - 1; i++)\n {\n int a = luckyAll[i];\n if(a >= pl && a <= pr && a >= vl && a <= vl)\n S += p_select(pl, pr, a, a) * p_select(vl, vr, a, a);\n }\n }\n\n\n Console.WriteLine(\"{0:0.000000000}\", S);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n//using System.Reflection;\n//using System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n//using System.Text;\n//using System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n readonly static IEnumerator Tokens;\n static Scanner()\n {\n Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n\n public static string NextToken()\n {\n Tokens.MoveNext();\n return Tokens.Current;\n }\n }\n\n int nextInt()\n {\n return int.Parse(Scanner.NextToken());\n }\n\n bool GoodValue(int a)\n {\n if (a <= 0) return false;\n while (a != 0)\n {\n if (a % 10 != 7 && a % 10 != 4) return false;\n a /= 10;\n }\n return true;\n }\n\n int[] GenSequence()\n {\n var l = new List();\n var q = new Queue();\n q.Enqueue(0);\n while (q.Count != 0)\n {\n int cur = q.Dequeue();\n l.Add(cur);\n if (GoodValue(cur * 10 + 4)) q.Enqueue(cur * 10 + 4);\n if (GoodValue(cur * 10 + 7)) q.Enqueue(cur * 10 + 7);\n }\n return l.OrderBy(c => c).ToArray();\n }\n\n int LowerBound(int v, int[] a)\n {\n int x = 0, y = a.Length;\n while (y - x > 1)\n {\n int z = (x + y) / 2;\n if (a[z] <= v) x = z;\n else y = z;\n }\n return x;\n }\n\n int Len(int x, int y, int[] a, int p)\n {\n if (p < 1 || p >= a.Length) return 0;\n int tx = Math.Max(x, a[p - 1]), ty = Math.Min(y, a[p]);\n if (GoodValue(tx)) tx++;\n if (GoodValue(ty)) ty--;\n return Math.Max(ty - tx + 1, 0);\n }\n\n void Solve()\n {\n var values = GenSequence();\n int pl = nextInt(), pr = nextInt(),\n vl = nextInt(), vr = nextInt(),\n k = nextInt();\n long res = 0;\n for (int x = 1; x < values.Length; x++)\n {\n long pc = Len(pl, pr, values, x);\n long rc1 = Len(vl, vr, values, x + k),\n rc2 = Len(vl, vr, values, x - k);\n res += pc * (rc1 + rc2);\n if (x + k - 1 < values.Length && values[x + k - 1] >= vl && values[x + k - 1] <= vr) res += pc;\n if (x - k > 0 && values[x - k] >= vl && values[x - k] <= vr) res += pc;\n\n if (values[x] >= pl && values[x] <= pr)\n {\n res += Len(vl, vr, values, x - k + 1);\n res += Len(vl, vr, values, x + k);\n\n res += new[] { x + k - 1, x - k + 1 }.Distinct().Where(\n c => c > 0 && c < values.Length &&\n values[c] >= vl && values[c] <= vr\n ).Count();\n }\n }\n long all = (pr - pl + 1);\n all *= (vr - vl + 1);\n Console.Write(\"{0:F12}\", (double)res / (double)(all));\n }\n\n\n static void Main()\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\n//using System.Reflection;\n//using System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n//using System.Text;\n//using System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static class Scanner\n {\n readonly static IEnumerator Tokens;\n static Scanner()\n {\n Tokens = Enumerable.Range(Int32.MinValue, Int32.MaxValue).\n Select(s => Console.ReadLine()).\n TakeWhile(s => s != null).\n SelectMany(s => s.Split(new[] { ' ', '\\r', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries)).\n Concat(Enumerable.Repeat(0, 1).Select(_ => (string)null)).\n GetEnumerator();\n }\n\n public static string NextToken()\n {\n Tokens.MoveNext();\n return Tokens.Current;\n }\n }\n\n int nextInt()\n {\n return int.Parse(Scanner.NextToken());\n }\n\n bool GoodValue(int a)\n {\n if (a <= 0) return false;\n while (a != 0)\n {\n if (a % 10 != 7 && a % 10 != 4) return false;\n a /= 10;\n }\n return true;\n }\n\n int[] GenSequence()\n {\n var l = new List();\n var q = new Queue();\n q.Enqueue(0);\n while (q.Count != 0)\n {\n int cur = q.Dequeue();\n l.Add(cur);\n if (GoodValue(cur * 10 + 4)) q.Enqueue(cur * 10 + 4);\n if (GoodValue(cur * 10 + 7)) q.Enqueue(cur * 10 + 7);\n }\n return l.OrderBy(c => c).ToArray();\n }\n\n int LowerBound(int v, int[] a)\n {\n int x = 0, y = a.Length;\n while (y - x > 1)\n {\n int z = (x + y) / 2;\n if (a[z] <= v) x = z;\n else y = z;\n }\n return x;\n }\n\n int Len(int x, int y, int[] a, int p)\n {\n if (p < 1 || p >= a.Length) return 0;\n int tx = Math.Max(x, a[p - 1]), ty = Math.Min(y, a[p]);\n if (GoodValue(tx)) tx++;\n if (GoodValue(ty)) ty--;\n return Math.Max(ty - tx + 1, 0);\n }\n\n void Solve()\n {\n var values = GenSequence();\n int pl = nextInt(), pr = nextInt(),\n vl = nextInt(), vr = nextInt(),\n k = nextInt();\n long res = 0;\n for (int x = 1; x < values.Length; x++)\n {\n long pc = Len(pl, pr, values, x);\n long rc1 = Len(vl, vr, values, x + k),\n rc2 = Len(vl, vr, values, x - k);\n res += pc * (rc1 + rc2);\n if (x + k - 1 < values.Length && values[x + k - 1] >= vl && values[x + k - 1] <= vr) res += pc;\n if (x - k > 0 && values[x - k] >= vl && values[x - k] <= vr) res += pc;\n\n if (values[x] >= pl && values[x] <= pr)\n {\n res += Len(vl, vr, values, x - k + 1);\n res += Len(vl, vr, values, x + k);\n\n res += new[] { x + k - 1, x - k + 1 }.Distinct().Where(\n c => c > 0 && c < values.Length &&\n values[c] >= vl && values[c] <= vr\n ).Count();\n }\n }\n long all = (pr - pl + 1);\n all *= (vr - vl + 1);\n Console.Write(\"{0:F7}\", (double)res / (double)(all));\n }\n\n\n static void Main()\n {\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n string dir = Directory.GetCurrentDirectory();\n dir = Directory.GetParent(dir).FullName;\n dir = Directory.GetParent(dir).FullName;\n Console.SetIn(new StreamReader(dir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(dir + \"\\\\output.txt\"));\n#endif\n Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;\n new Program().Solve();\n#if MY_SUPER_PUPER_ONLINE_JUDGE\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Collections;\nusing System;\n\nnamespace tc_cf_c_sharp\n{\n class MyIO\n {\n TextReader reader;\n TextWriter writer=Console.Out;\n string[] tokens;\n int pointer;\n public MyIO(TextReader rd)\n {\n reader = rd;\n }\n public string NextLine()\n {\n try\n {\n return reader.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[]{' '},System.StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n public void Write(string format, params object[] args)\n {\n writer.Write(format, args);\n }\n public void WriteLine(string format, params object[] args)\n {\n writer.WriteLine(format, args);\n }\n }\n class Program\n {\n static List li;\n static void gen(long r)\n {\n if (r > 10000000000) return;\n li.Add(r);\n gen(r * 10 + 4);\n gen(r * 10 + 7);\n\n }\n static void Main(string[] args)\n {\n MyIO myio = new MyIO(Console.In);\n //MyIO myio = new MyIO(new StreamReader(File.OpenRead(@\"D:\\project\\tc cf c sharp\\tc cf c sharp\\in.txt\")));\n li = new List();\n li.Add(0);\n gen(4); gen(7);\n li.Sort();\n long ct = 0;\n long v1 = myio.NextLong(), v2 = myio.NextLong(), p1 = myio.NextLong(), p2 = myio.NextLong();\n int k = myio.NextInt();\n for (int i = 0; i + k + 1 < li.Count; i++)\n {\n long mmin = li[i] + 1, mmax = li[i + 1];\n long nmin = li[i + k], nmax = li[i + k + 1] - 1;\n mmin = Math.Max(mmin, v1); mmax = Math.Min(mmax, v2);\n nmin = Math.Max(nmin, p1); nmax = Math.Min(nmax, p2);\n long t1 = Math.Max(0, mmax - mmin + 1);\n long t2 = Math.Max(0, nmax - nmin + 1);\n ct += t1 * t2;\n } \n for (int i = 0; i + k + 1 < li.Count; i++)\n {\n long mmin = li[i] + 1, mmax = li[i + 1];\n long nmin = li[i + k], nmax = li[i + k + 1] - 1;\n mmin = Math.Max(mmin, p1); mmax = Math.Min(mmax, p2);\n nmin = Math.Max(nmin, v1); nmax = Math.Min(nmax, v2);\n long t1 = Math.Max(0, mmax - mmin + 1);\n long t2 = Math.Max(0, nmax - nmin + 1);\n \n ct += t1 * t2;\n }\n for (int i = 0; i < li.Count; i++)\n {\n if (li[i] >= v1 && li[i] <= v2 && li[i] >= p1 && li[i] <= p2) ct--;\n }\n long ct2 = (p2 - p1 + 1) * (v2 - v1 + 1);\n myio.WriteLine(\"{0}\",(double)ct/ct2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round84 {\n class B {\n static List v = new List();\n const int MAX = 1000000000;\n\n static void dfs(long x) {\n if (x > MAX) return;\n v.Add((int)x);\n dfs(x * 10 + 4);\n dfs(x * 10 + 7);\n }\n\n static double choiceProb(int l1, int r1, int l2, int r2) {\n int low = Math.Max(l1, l2),\n high = Math.Min(r1, r2);\n if (low > high) {\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, 0);\n return 0;\n }\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, (high - low + 1) / (double)(r1 - l1 + 1));\n return (high - low + 1) / (double)(r1 - l1 + 1);\n }\n\n static void Main() {\n dfs(0);\n v.Add(MAX + 1);\n v.Sort();\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int pl = xs[0],\n pr = xs[1],\n vl = xs[2],\n vr = xs[3],\n k = xs[4];\n if(pl == pr && pl == vl && vl == vr && k == 1) {\n Console.WriteLine(\"{0:F12}\", v.Contains(pl) ? 1 : 0);\n }\n\n double res = 0;\n for (int i = 1; i < v.Count; i++) {\n int j = i + k;\n if (j >= v.Count) {\n break;\n }\n\n res += choiceProb(pl, pr, v[i - 1] + 1, v[i]) * choiceProb(vl, vr, v[j - 1], v[j] - 1);\n res += choiceProb(vl, vr, v[i - 1] + 1, v[i]) * choiceProb(pl, pr, v[j - 1], v[j] - 1);\n }\n\n Console.WriteLine(\"{0:F12}\", res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round84 {\n class B {\n static List v = new List();\n const int MAX = 1000000000;\n\n static void dfs(long x) {\n if (x > MAX) return;\n v.Add((int)x);\n dfs(x * 10 + 4);\n dfs(x * 10 + 7);\n }\n\n static double choiceProb(int l1, int r1, int l2, int r2) {\n int low = Math.Max(l1, l2),\n high = Math.Min(r1, r2);\n if (low > high) {\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, 0);\n return 0;\n }\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, (high - low + 1) / (double)(r1 - l1 + 1));\n return (high - low + 1) / (double)(r1 - l1 + 1);\n }\n\n static void Main() {\n dfs(0);\n v.Add(MAX + 1);\n v.Sort();\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int pl = xs[0],\n pr = xs[1],\n vl = xs[2],\n vr = xs[3],\n k = xs[4];\n\n double res = 0;\n for (int i = 1; i < v.Count; i++) {\n int j = i + k;\n if (j >= v.Count) {\n break;\n }\n\n res += choiceProb(pl, pr, v[i - 1] + 1, v[i]) * choiceProb(vl, vr, v[j - 1], v[j] - 1);\n res += choiceProb(vl, vr, v[i - 1] + 1, v[i]) * choiceProb(pl, pr, v[j - 1], v[j] - 1);\n }\n\n Console.WriteLine(\"{0:F12}\", res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round84 {\n class B {\n static List v = new List();\n const int MAX = 1000000000;\n\n static void dfs(long x) {\n if (x > MAX) return;\n v.Add((int)x);\n dfs(x * 10 + 4);\n dfs(x * 10 + 7);\n }\n\n static double choiceProb(int l1, int r1, int l2, int r2) {\n int low = Math.Max(l1, l2),\n high = Math.Min(r1, r2);\n if (low > high) {\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, 0);\n return 0;\n }\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, (high - low + 1) / (double)(r1 - l1 + 1));\n return (high - low + 1) / (double)(r1 - l1 + 1);\n }\n\n static void Main() {\n dfs(0);\n v.Add(MAX + 1);\n v.Sort();\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int pl = xs[0],\n pr = xs[1],\n vl = xs[2],\n vr = xs[3],\n k = xs[4];\n\n double res = 0;\n for (int i = 1; i < v.Count; i++) {\n int j = i + k;\n if (j >= v.Count) {\n break;\n }\n\n res += choiceProb(pl, pr, v[i - 1] + 1, v[i]) * choiceProb(vl, vr, v[j - 1], v[j] - 1);\n if(k > 1) res += choiceProb(vl, vr, v[i - 1] + 1, v[i]) * choiceProb(pl, pr, v[j - 1], v[j] - 1);\n }\n\n Console.WriteLine(\"{0:F12}\", res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round84 {\n class B {\n static List v = new List();\n const int MAX = 1000000000;\n\n static void dfs(long x) {\n if (x > MAX) return;\n v.Add((int)x);\n dfs(x * 10 + 4);\n dfs(x * 10 + 7);\n }\n\n static double choiceProb(int l1, int r1, int l2, int r2) {\n int low = Math.Max(l1, l2),\n high = Math.Min(r1, r2);\n if (low > high) {\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, 0);\n return 0;\n }\n //Console.WriteLine(\"{0} {1} {2} {3}: {4}\", l1, r1, l2, r2, (high - low + 1) / (double)(r1 - l1 + 1));\n return (high - low + 1) / (double)(r1 - l1 + 1);\n }\n\n static void Main() {\n dfs(0);\n v.Add(MAX + 1);\n v.Sort();\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int pl = xs[0],\n pr = xs[1],\n vl = xs[2],\n vr = xs[3],\n k = xs[4];\n if(pl == pr && pl == vl && vl == vr && k == 1) {\n Console.WriteLine(\"{0:F12}\", v.Contains(pl) ? 1 : 0);\n return;\n }\n\n double res = 0;\n for (int i = 1; i < v.Count; i++) {\n int j = i + k;\n if (j >= v.Count) {\n break;\n }\n\n res += choiceProb(pl, pr, v[i - 1] + 1, v[i]) * choiceProb(vl, vr, v[j - 1], v[j] - 1);\n res += choiceProb(vl, vr, v[i - 1] + 1, v[i]) * choiceProb(pl, pr, v[j - 1], v[j] - 1);\n }\n\n Console.WriteLine(\"{0:F12}\", res);\n }\n }\n}\n"}], "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Benches\n{\n class Program\n {\n static void Main(string[] args)\n {\n var numberBenches = int.Parse(Console.ReadLine());\n var incomingPeople = int.Parse(Console.ReadLine());\n List startingSeats = new List();\n for (int i = 0; i < numberBenches; i++)\n {\n startingSeats.Add(int.Parse(Console.ReadLine()));\n }\n var startMax = startingSeats.Max();\n var startIncomingPeople = incomingPeople;\n\n while(incomingPeople>0)\n {\n var min = startingSeats.Min();\n var index = startingSeats.IndexOf(min);\n startingSeats[index] += 1;\n incomingPeople--;\n }\n\n Console.WriteLine(\"{0} {1}\", startingSeats.Max(), startMax+startIncomingPeople);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nnamespace Achill\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n List a = new List(), b;\n for(int i = 0; i < n; ++i)\n {\n a.Add(int.Parse(Console.ReadLine()));\n }\n int res = 0;\n a.ForEach(item => res += a.Max() - item);\n Console.Write((res >= m ? a.Max() : a.Max() + (m - res)/n + ((m-res)%n == 0 ? 0 : 1)) + \" \");\n Console.WriteLine(a.Max() + m);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace codeforces\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int[] mas = new int[n];\n \n for (int i = 0; i < n; i++)\n {\n mas[i] = Convert.ToInt32(Console.ReadLine());\n }\n int a = mas.Max()+m;\n for (int i = 0; i < m; i++)\n {\n int min = 0;\n for (int j = 0; j < n; j++)\n {\n if (mas[j] < mas[min])\n min = j;\n }\n mas[min]++;\n }\n Console.WriteLine(mas.Max()+\" \"+a);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\ninternal class Console1\n{ \n /* \n static int[] ReadInt()\n {\n return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n }\n\n \n private static ulong GCD(ulong a, ulong b)\n {\n while (a != 0 && b != 0)\n {\n if (a > b)\n a %= b;\n else\n b %= a;\n }\n\n return a == 0 ? b : a;\n }\n */\n \n static void Main()\n {\n int n = 0, m = 0;\n Int32.TryParse(Console.ReadLine(), out n);\n Int32.TryParse(Console.ReadLine(), out m);\n\n int[] benches = new int[n];\n for (int i = 0; i < n; ++i)\n {\n Int32.TryParse(Console.ReadLine(), out benches[i]);\n }\n \n int maxOnBench = benches.Max();\n int maxValue = m + maxOnBench;\n\n for (int i = 0; i < n; i++)\n {\n m -= (maxOnBench - benches[i]);\n }\n\n if (m < 0)\n m = 0;\n \n double minValue = maxOnBench + Math.Ceiling((double)m / n);\n \n Console.WriteLine($\"{minValue} {maxValue}\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = Convert.ToInt16(Console.ReadLine());\n int m = Convert.ToInt16(Console.ReadLine());\n int[] mas = new int[n];\n \n for (int i =0;i mas[j])\n {\n min1 = mas[j];\n minInd = j;\n }\n }\n mas[minInd]++;\n }\n int min = mas[0];\n for (int i = 1; i peoples = new List();\n\n for (int i = 0; i < n; i++)\n {\n peoples.Add(Convert.ToInt32(Console.ReadLine()));\n }\n int maxK = peoples.Max() + m;\n\n for (int i = 0; i < m; i++)\n {\n peoples[peoples.IndexOf(peoples.Min())]++;\n }\n\n int minK = peoples.Max();\n\n Console.WriteLine(minK + \" \" + maxK);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace EhWasByDetstvoVspomnit\n{\n\n class Program\n {\n private static int[] ReadIntArray => Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n private static long[] ReadLongArray => Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n private static char[] ReadCharArray => Console.ReadLine().Split(' ').Select(char.Parse).ToArray();\n private static int ReadInt => int.Parse(Console.ReadLine());\n private static string ReadString => Console.ReadLine();\n\n static void Main()\n {\n int n = ReadInt;\n //int[] n = ReadIntArray;\n int m = ReadInt;\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt;\n Array.Sort(a);\n int max = a[a.Count() - 1] + m;\n int temp = 0;\n for (int i = 0; i < a.Count(); i++)\n {\n temp += a[a.Count() - 1] - a[i];\n }\n if (temp >= m)\n Console.WriteLine(a[a.Count() - 1] + \" \" + max);\n else\n {\n m -= temp;\n if (m % n == 0)\n Console.WriteLine(a[a.Count() - 1] + (m / n) + \" \" + max);\n else\n Console.WriteLine(a[a.Count() - 1] + (m / n) + 1 + \" \" + max);\n }\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _1042A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n }\n\n int minK = Math.Max(0, (m - n * a.Max() + a.Sum() + n - 1) / n) + a.Max();\n int maxK = a.Max() + m;\n\n Console.WriteLine($\"{minK} {maxK}\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c;\n a = Convert.ToInt32(Console.ReadLine());\n b = Convert.ToInt32(Console.ReadLine());\n int per1 = 0;\n int per;\n c = 0;\n\n int[] mas = new int[a];\n\n for (int i = 0; i < mas.Length; i++)\n {\n mas[i]= Convert.ToInt32(Console.ReadLine());\n }\n\n Array.Sort(mas);\n per = mas[a - 1] + b;\n\n for (int i = 0; i < b; i++)\n {\n Array.Sort(mas);\n mas[0] = mas[0] + 1;\n }\n\n for (int i = 0; i < mas.Length; i++)\n {\n if (mas[i] > per1)\n {\n per1 = mas[i];\n }\n }\n\n Console.WriteLine(per1 +\" \"+ per);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tlong N = long.Parse(Console.ReadLine());\n\t\tlong M = long.Parse(Console.ReadLine());\n\t\tlong[] A = new long[N];\n\t\tlong max = 0;\n\t\tfor(var i=0;i0){\n\t\t\tmin = (M2-1)/N+1+max;\n\t\t} else {\n\t\t\tmin = max;\n\t\t}\n\t\tmax += M;\n\t\tConsole.WriteLine(min+\" \"+max);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u041b\u0430\u0432\u043e\u0447\u043a\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int max = 0, min = 0;\n int d, sum = 0, maxa = 0;\n for (int i = 0; i < n; i++)\n {\n int z = Convert.ToInt32(Console.ReadLine());\n sum += z;\n if (z>maxa)\n {\n maxa = z;\n }\n }\n sum = sum - maxa;\n max = maxa + m;\n d = ((n - 1) * maxa) - sum;\n if (d>=m)\n {\n min = maxa;\n }\n else\n {\n if ((m - d) % n == 0)\n {\n min = maxa + (m - d) / n;\n }\n else\n {\n min = maxa + (m - d) / n +1;\n }\n\n }\n Console.Write(min);\n Console.Write(' ');\n Console.Write(max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\n\n\n\nnamespace ProjectEuler\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n }\n Array.Sort(a);\n int max = a.Max() + m;\n\n \n\n \n while (m>0)\n {\n a[0]++;\n m--;\n Array.Sort(a);\n \n\n }\n\n int minmax = a.Max();\n Console.WriteLine($\"{minmax} {max}\");\n\n \n\n } \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Median\n{\n class Program\n {\n static void Main(string[] args)\n {\n // var line = Console.ReadLine();\n // string[] tokens = line.Split(' ');\n // int[] numbers = Array.ConvertAll(tokens, int.Parse);\n // int proposedMedian = numbers[1];\n // int n = numbers[0];\n\n\n // //Read array numbers\n // line = Console.ReadLine();\n // tokens = line.Split(' ');\n // numbers = Array.ConvertAll(tokens, int.Parse);\n // int[] arr = numbers;\n\n\n // int count = ForceMedian(arr, proposedMedian, n);\n // Console.WriteLine(count);\n //Console.ReadLine();\n //Benches.Run();\n\n var benches = int.Parse(Console.ReadLine());\n var m = int.Parse(Console.ReadLine());\n\n int[] numbers = new int[benches];\n for (int i = 0; i < benches; i++)\n {\n numbers[i] = int.Parse(Console.ReadLine()); ;\n }\n\n\n //Find Max\n var max = numbers.Max();\n var kMax = max + m;\n\n Array.Sort(numbers);\n\n //Find the Min\n while (m > 0)\n {\n if(numbers.Length == 1)\n {\n numbers[0] += m;\n break;\n }\n var min = numbers[0];\n var secondMin = numbers[1];\n var diff = (secondMin - min) + 1;\n if (m - diff < 0)\n {\n numbers[0] += m;\n m = 0;\n }\n else\n {\n numbers[0] += diff;\n m -= diff;\n }\n\n Array.Sort(numbers);\n\n }\n\n //Console.WriteLine(kMax);\n Console.WriteLine(\"{0} {1}\", numbers.Max(), kMax);\n Console.ReadLine();\n }\n\n public static int ForceMedian (int [] arr, int proposedMedian, int n)\n {\n Array.Sort(arr);\n // int median = Median(arr);\n int count = 0;\n int mid = (arr.Length / 2);\n\n\n for (int i = mid; i < n && arr[i] <= proposedMedian; i++)\n {\n count += proposedMedian - arr[i];\n }\n\n for (int i = mid; i >= 0 && arr[i] > proposedMedian; i--)\n {\n count += arr[i] - proposedMedian;\n }\n\n // do\n // {\n // if (median < proposedMedian)\n // median++;\n // else if (median > proposedMedian)\n // median--;\n // arr[mid] = median;\n\n // Array.Sort(arr);\n // median = Median(arr);\n // count++;\n // } while (median != proposedMedian);\n //// Console.WriteLine(median);\n return count;\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int[] mas = new int[n];\n int N = 0;\n for (int i = 0; i < n; i++)\n {\n mas[i] = Int32.Parse(Console.ReadLine());\n if (mas[i] > N) N = mas[i];\n }\n int N1 = N + m;//\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\n for (int i = 0; i < n; i++)\n {\n while (m > 0 && mas[i] < N)\n {\n mas[i] += 1;\n m -= 1;\n }\n //Console.WriteLine(mas[i]);\n }\n int N2 = m / n;\n m = m - N2 * n;\n if (N2 != 0)\n {\n for (int i = 0; i < n; i++) mas[i] += N2;\n }\n while (m > 0)\n {\n for (int i = 0; i < n; i++)\n {\n if (m != 0)\n {\n mas[i] += 1;\n m -= 1;\n }\n }\n }\n int N3 = mas[0];\n for (int i = 0; i < n; i++)\n {\n if (N3 < mas[i]) N3 = mas[i];\n }\n\n Console.WriteLine(N3 + \" \" + N1);\n //Console.ReadKey();\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int k = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n }\n int max = 0;\n int min = 0;\n Array.Sort(a);\n \n max = a[a.Length - 1];\n max += k;\n for (int i = 0; i < k; i++)\n {\n a[0]++;\n Array.Sort(a);\n //for (int j = 0; j < n; j++) \n //{\n // Console.Write(\"{0} \", a[j]);\n \n //}\n //Console.WriteLine();\n }\n min = a[a.Length-1];\n //min++;\n Console.WriteLine(\"{0} {1}\", min, max);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n int max = -1;\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n if (a[i] > max)\n max = a[i];\n }\n int k2 = m + max;\n for (int i = 0; i < n; i++)\n {\n if (m > 0)\n {\n int k = max - a[i];\n a[i] = a[i] + Math.Min(k, m);\n m = m - Math.Min(k, m);\n }\n else break;\n }\n\n int k1;\n\n if (m % n == 0)\n {\n k1 = max + m / n;\n }\n else\n k1 = max + m / n + 1;\n\n \n\n Console.WriteLine(\"{0} {1}\", k1, k2);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n int max = -1;\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n if (a[i] > max)\n max = a[i];\n }\n int k2 = m + max;\n for (int i = 0; i < n; i++)\n {\n if (m > 0)\n {\n int k = max - a[i];\n a[i] = a[i] + Math.Min(k, m);\n m = m - Math.Min(k, m);\n }\n else break;\n }\n\n int k1;\n\n if (m % n == 0)\n {\n k1 = max + m / n;\n }\n else\n k1 = max + m / n + 1;\n\n Console.WriteLine(\"{0} {1}\", k1, k2);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n\n int max = 0;\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n if (a[i] > max)\n max = a[i];\n }\n\n int b = m + max;\n\n for (int i = 0; i < n; i++)\n {\n if (m > 0)\n {\n int k = Math.Min(max - a[i], m);\n a[i] += k;\n m -= k;\n }\n else\n break;\n }\n \n Console.Write(\"{1} {0}\", b, max + m / n + (m % n == 0 ? 0 : 1));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Benches\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int n = Next();\n int m = Next();\n\n var nn = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n }\n Array.Sort(nn);\n int max = m + nn[n - 1];\n\n for (int i = n - 1; i > 0; i--)\n {\n m -= nn[i] - nn[i - 1];\n nn[i - 1] = nn[i];\n }\n\n if (m > 0)\n {\n nn[0] += (m + n - 1)/n;\n }\n\n writer.Write(nn[0]);\n writer.Write(' ');\n writer.WriteLine(max);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n class MinHeap\n {\n public IList m_array;\n\n public MinHeap()\n {\n m_array = new List();\n }\n public int GetRoot()\n {\n return m_array[0];\n }\n\n public int ExtractMin()\n {\n var result = m_array[0];\n m_array[0] = m_array[Count - 1];\n m_array.RemoveAt(m_array.Count - 1);\n ShiftDown(0);\n\n return result;\n }\n\n public void Remove(int index)\n {\n\n }\n\n public void ShiftDown(int index)\n {\n int left = 2 * index + 1;\n int right = 2 * index + 2;\n int Index = index;\n\n if (left < Count && m_array[index] > m_array[left])\n {\n index = left;\n }\n\n if (right < Count && m_array[index] > m_array[right])\n {\n index = right;\n }\n\n if (index != Index)\n {\n var temp = m_array[Index];\n m_array[Index] = m_array[index];\n m_array[index] = temp;\n\n ShiftDown(index);\n }\n }\n\n public int Count\n {\n get\n {\n return m_array.Count();\n }\n }\n\n private void Balance(int index)\n {\n if (index < 0)\n {\n return;\n }\n\n int parent = (index - 1) / 2;\n\n if (m_array[parent] > m_array[index])\n {\n var temp = m_array[parent];\n m_array[parent] = m_array[index];\n m_array[index] = temp;\n Balance(parent);\n }\n }\n\n public void Add(int number)\n {\n m_array.Add(number);\n //BuildHeap();\n Balance(m_array.Count - 1);\n }\n\n private void BuildHeap()\n {\n for (int i = Count / 2; i >= 0; i--)\n {\n Heapify(m_array, i);\n }\n }\n private void Heapify(IList array, int index)\n {\n int N = array.Count;\n\n int Index = index;\n int left = 2 * index + 1;\n int right = 2 * index + 2;\n\n if (left < N && array[left] < array[index])\n {\n index = left;\n }\n\n if (right < N && array[right] < array[index])\n {\n index = right;\n }\n\n if (index != Index)\n {\n var temp = array[Index];\n array[Index] = array[index];\n array[index] = temp;\n\n Heapify(array, index);\n }\n\n }\n }\n \n class cf\n {\n \n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int max = 0;\n int M = m;\n\n var pq = new MinHeap();\n\n for (int t = 1; t <= n; t++)\n {\n int num = int.Parse(Console.ReadLine());\n max = Math.Max(max, num);\n pq.Add(num);\n }\n\n while (m > 0)\n {\n var num = pq.ExtractMin();\n num++;\n m--;\n pq.Add(num);\n }\n\n while(pq.Count > 1)\n {\n pq.ExtractMin();\n }\n\n Console.WriteLine(string.Format(\"{0} {1}\", pq.ExtractMin(), max + M));\n }\n }"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint max = A.Max() + M;\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Xml;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(System.Console.ReadLine());\n int m = int.Parse(System.Console.ReadLine());\n int[] benches = new int[n];\n for(int i=0;imx)\n {\n mx = benches[j];\n }\n }\n benches[bn]++;\n }\n bn=-1;\n for(int j=0;j mn)\n {\n bn = j;\n mn = benches[j];\n }\n }\n System.Console.WriteLine(String.Format(\"{0} {1}\", mn, mx + m));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var n = long.Parse(Console.ReadLine());\n var m = long.Parse(Console.ReadLine());\n var A = new long[n];\n for (var i = 0; i < A.Length; i++)\n A[i] = long.Parse(Console.ReadLine());\n\n var maxK = A.Max() + m;\n var z = A.Sum() + m;\n var minK = z / n;\n if (minK * n != z)\n minK++;\n minK = Math.Max(A.Max(), minK);\n System.Console.WriteLine(\"{0} {1}\", minK, maxK);\n }\n}\n\n/*\n5 n\n10 m\n68\n87\n14\n68\n23\n\n--> actual 54 97\n--> expected 87 97\n */"}, {"source_code": "/* Date: 27.10.2018 * Time: 21:45 */\n// *\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\034\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\034\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n, m;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n\t\tm = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tm = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (n + \" *** \" + m);\n# endif\n\n\t\tstring s;\n\n\t\tint amax = 0;\n\t\tint [] a = new int [n];\n\t\tfor ( int i=0; i < n; i++ )\n\t\t{\n\n# if ( ONLINE_JUDGE )\n\t\t\ta [i] = int.Parse (Console.ReadLine ());\n# else\n\t\t\ta [i] = int.Parse (sr.ReadLine ());\n# endif\n\t\t\tif ( a [i] > amax )\n\t\t\t\tamax = a [i];\n\t\t}\n\n\t\tint delta = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tdelta += amax - a [i];\n\n\t\tint maxk = amax + m, mink = amax;\n\t\tif ( delta < m )\n\t\t\tmink = amax + (m - delta + n - 1) / n;\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.WriteLine (delta + \" *** \" + amax);\n# endif\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (mink + \" \" + maxk);\n# else\n\t\tsw.WriteLine (mink + \" \" + maxk);\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numBenches = Convert.ToInt32(Console.ReadLine());\n int numExtraPeople = Convert.ToInt32(Console.ReadLine());\n int modifiedNumExtraPeople = numExtraPeople;\n int[] benches = new int[numBenches];\n for (int i = 0; i < numBenches; i++) benches[i] = Convert.ToInt32(Console.ReadLine());\n int maxPeopleCount = FindMax(benches);\n foreach (var i in benches) modifiedNumExtraPeople -= maxPeopleCount - i;\n modifiedNumExtraPeople = Math.Max(0, modifiedNumExtraPeople);\n Console.WriteLine(\"{0} {1}\", maxPeopleCount + Math.Ceiling((double)modifiedNumExtraPeople / numBenches), numExtraPeople + maxPeopleCount);\n }\n\n static int FindMax(int[] array)\n {\n int max = Int32.MinValue;\n foreach(var i in array)\n {\n if (i > max) max = i;\n }\n return max;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace TestingGround\n{\n class P_1042A\n {\n static void Main(string[] args)\n {\n var n = IO.Line().In();\n var m = IO.Line().In();\n var a = new List();\n for (int i = 0; i < n; i++)\n {\n a.Add(IO.Line().In());\n }\n\n var avg = (int)Math.Ceiling((a.Sum() + m) / (double)n);\n if (avg < a.Max()) avg = a.Max();\n\n Console.WriteLine(avg + \" \" + (a.Max() + m));\n }\n }\n \n public class IO\n {\n private readonly string[] _splitted;\n private int _current = 0;\n\n private IO()\n {\n _splitted = Console.ReadLine().Split(' ');\n }\n\n public static IO Line()\n {\n return new IO();\n }\n\n public T In()\n {\n if (_current >= _splitted.Length)\n throw new IndexOutOfRangeException();\n\n return (T) Convert.ChangeType(_splitted[_current++], typeof(T));\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\nnamespace Cows.And.Poker\n{\n class Program\n {\n static void Main(string[] args)\n {\n var players = int.Parse(Console.ReadLine());\n var status = Console.ReadLine().ToCharArray();\n var allInOrIn = status.Where(s => s != 'F');\n if (allInOrIn.Count(s => s == 'I') == 0) Console.WriteLine(allInOrIn.Count());\n else if (allInOrIn.Count(s => s == 'I') == 1) Console.WriteLine(1);\n else Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace codeforces\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int[] mas = new int[n];\n for (int i = 0; i < n; i++)\n {\n mas[i] = Convert.ToInt32(Console.ReadLine());\n }\n if(n == 1)\n Console.WriteLine((mas[0]+m)+\" \"+(mas[0]+m));\n else\n Console.WriteLine(((m % n)+mas.Max())+\" \"+(mas.Max()+m));\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\ninternal class Console1\n{ \n /* \n static int[] ReadInt()\n {\n return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n }\n\n \n private static ulong GCD(ulong a, ulong b)\n {\n while (a != 0 && b != 0)\n {\n if (a > b)\n a %= b;\n else\n b %= a;\n }\n\n return a == 0 ? b : a;\n }\n */\n \n static void Main()\n {\n int n = 0, m = 0;\n Int32.TryParse(Console.ReadLine(), out n);\n Int32.TryParse(Console.ReadLine(), out m);\n\n int[] benches = new int[n];\n for (int i = 0; i < n; ++i)\n {\n Int32.TryParse(Console.ReadLine(), out benches[i]);\n }\n \n int maxOnBench = benches.Max();\n int maxValue = m + maxOnBench;\n\n for (int i = 0; i < n; i++)\n {\n m -= (maxOnBench - benches[i]);\n }\n \n double minValue = maxOnBench + Math.Ceiling((double)m / n);\n \n Console.WriteLine($\"{minValue} {maxValue}\");\n }\n}"}, {"source_code": "using System;\n\nnamespace Test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int[] a = new int[n];\n int max = -1;\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(Console.ReadLine());\n if (a[i] > max)\n max = a[i];\n }\n\n for (int i = 0; i < n; i++)\n {\n if (m > 0)\n {\n int k = max - a[i];\n a[i] = a[i] + Math.Min(k, m);\n m = m - Math.Min(k, m);\n }\n else break;\n }\n\n int k1,k2;\n\n if (m % n == 0)\n {\n k1 = max + m / n;\n }\n else\n k1 = max + m / n + 1;\n\n k2 = m + max;\n\n Console.WriteLine(\"{0} {1}\", k1, k2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var n = long.Parse(Console.ReadLine());\n var m = long.Parse(Console.ReadLine());\n var A = new long[n];\n for (var i = 0; i < A.Length; i++)\n A[i] = long.Parse(Console.ReadLine());\n\n var maxK = A.Max() + m;\n var z = A.Sum() + m;\n var minK = z / n;\n if (minK * n != z)\n minK++;\n System.Console.WriteLine(\"{0} {1}\", minK, maxK);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var n = long.Parse(Console.ReadLine());\n var m = long.Parse(Console.ReadLine());\n var A = new long[n];\n for (var i = 0; i < A.Length; i++)\n A[i] = long.Parse(Console.ReadLine());\n\n var maxK = A.Max() + m;\n var z = A.Sum() + m;\n var minK = z / n;\n if (minK * n != z)\n minK++;\n minK = Math.Max(A.Min(), minK);\n System.Console.WriteLine(\"{0} {1}\", minK, maxK);\n }\n}"}, {"source_code": "/* Date: 27.10.2018 * Time: 21:45 */\n// *\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\034\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2018\\\\Task\\\\07 Codeforces\\\\034\\\\A.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n\n\t\tint n, m;\n\n# if ( ONLINE_JUDGE )\n\t\tn = int.Parse (Console.ReadLine ());\n\t\tm = int.Parse (Console.ReadLine ());\n# else\n\t\tn = int.Parse (sr.ReadLine ());\n\t\tm = int.Parse (sr.ReadLine ());\n# endif\n\n\t\tstring s;\n\n\t\tint amax = 0;\n\t\tint [] a = new int [n];\n\t\tfor ( int i=0; i < n; i++ )\n\t\t{\n\n# if ( ONLINE_JUDGE )\n\t\t\ta [i] = int.Parse (Console.ReadLine ());\n# else\n\t\t\ta [i] = int.Parse (sr.ReadLine ());\n# endif\n\t\t\tif ( a [i] > amax )\n\t\t\t\tamax = a [i];\n\t\t}\n\n\t\tint delta = 0;\n\t\tfor ( int i=0; i < n; i++ )\n\t\t\tdelta += amax - a [i];\n\n\t\tint maxk = amax + m, mink = amax;\n\t\tif ( delta >= m )\n\t\t\tmink = amax + (m - delta + n - 1) / n;\n\n# if ( ONLINE_JUDGE )\n\t\tConsole.WriteLine (mink + \" \" + maxk);\n# else\n\t\tsw.WriteLine (mink + \" \" + maxk);\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numBenches = Convert.ToInt32(Console.ReadLine());\n int numExtraPeople = Convert.ToInt32(Console.ReadLine());\n int modifiedNumExtraPeople = numExtraPeople;\n int[] benches = new int[numBenches];\n for (int i = 0; i < numBenches; i++) benches[i] = Convert.ToInt32(Console.ReadLine());\n int maxPeopleCount = FindMax(benches);\n foreach (var i in benches) modifiedNumExtraPeople -= maxPeopleCount - i;\n Console.WriteLine(\"{0} {1}\", maxPeopleCount + Math.Ceiling((double)modifiedNumExtraPeople / numBenches), numExtraPeople + maxPeopleCount);\n }\n\n static int FindMax(int[] array)\n {\n int max = Int32.MinValue;\n foreach(var i in array)\n {\n if (i > max) max = i;\n }\n return max;\n }\n }\n}\n"}], "src_uid": "78f696bd954c9f0f9bb502e515d85a8d"} {"source_code": "using System;\nusing Math = System.Math;\nusing Dec = System.Decimal;\nusing System.Globalization;\nusing System.Linq;\n\nnamespace taskA\n{\n\tclass newDecimal {\n\tprivate \n\t\t\tInt64 Z, F, kol;\n\tpublic newDecimal(decimal t, Int64 Kol) {\n\t\t\tkol = Kol;\n\t\t\tZ = Dec.ToInt64 (t);\n\t\t\tInt64 p = 1;\n\t\t\tfor (int i = 0; i < kol; i ++)\n\t\t\t\tp *= 10L;\t\t\n\t\t\tF = Dec.ToInt64 ((t - Z) * p);\n\t\t}\n\t\tpublic void print () {\n\t\t\tConsole.Write (\"{0}.\", Z);\n\t\t\tint sz = F.ToString ().Length;\n\t\t\tfor (int i = 0; i < kol - sz; i ++) \n\t\t\t\tConsole.Write (0);\n\t\t\tConsole.Write (F);\n\t\t}\n\t}\n\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args) {\n\t\t\tint[] a = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray();\n\t\t\tint x1 = a [0], y1 = a [1], x2 = a [2], y2 = a [3];\n\t\t\tint r1 = x2 - x1 + 1;\n\t\t\tint r2 = y2 - y1 + 1;\n\t\t\tlong ans = (r2 / 2L) * r1;\n\t\t\tif (r2 % 2 == 1)\n\t\t\t\tans += (r1 + 1L) / 2L;\n\t\t\tConsole.WriteLine (ans);\n\t\t}\n\t}\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace A_rectangle\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int x1 = Next(), y1 = Next(), x2 = Next(), y2 = Next();\n\n long dx = (x2 - x1)/2;\n long dy = (y2 - y1)/2;\n\n writer.WriteLine(dx*dy + (dx + 1)*(dy + 1));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _630E_Rectangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt64(x));\n long x1 = temp[0];\n long y1 = temp[1];\n long x2 = temp[2];\n long y2 = temp[3];\n\n long answer = ((y2 - y1)/2 + 1)*(x2 - x1 + 1) - (x2 - x1)/2;\n\n Console.WriteLine(answer);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n object Get()\n {\n var a = ReadLongs();\n var x1 = a[0];\n var x2 = a[2];\n var y1 = a[1];\n var y2 = a[3];\n var integ = (y2 - y1 + 1) / 2;\n var half = ((y2 - y1 + 1) & 1) == 1;\n long result = integ*(x2 - x1 + 1);\n if (half)\n {\n result += (x2 - x1 + 1) / 2;\n if (((x2 - x1 + 1) & 1) == 1)\n result += 1;\n }\n return result;\n }\n\n public long FastPow(long x, long pow)\n {\n if (pow == 0) return 1;\n if (pow == 1)\n return x;\n if ((pow & 1) == 0)\n return FastPow(x * x, pow / 2);\n return x * FastPow(x, pow - 1);\n }\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []s=Console.ReadLine().Split(' ');\n long a = (long.Parse(s[3]) - long.Parse(s[1]))/2;\n long b = (long.Parse(s[2]) - long.Parse(s[0]))/2;\n\n Console.WriteLine((a+1)*(b+1)+a*b);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\n\nnamespace ConsoleApplication4\n{\n\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x1 = Convert.ToInt64(s[0]);\n long y1 = Convert.ToInt64(s[1]);\n long x2 = Convert.ToInt64(s[2]);\n long y2 = Convert.ToInt64(s[3]);\n long x = Math.Abs(x1 - x2)+1;\n long y = Math.Abs(y1 - y2)+1;\n\n long t = x * y/2+1;\n\n Console.WriteLine(t);\n\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace TempProject\n{\n class Program\n {\n static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n BigInteger x1 = BigInteger.Parse(s[0]),\n y1 = BigInteger.Parse(s[1]),\n x2 = BigInteger.Parse(s[2]),\n y2 = BigInteger.Parse(s[3]);\n BigInteger col = (y2 - y1) / 2 + 1,\n ln = (x2 - x1) / 2 + 1;\n BigInteger sum = col * ln + (col - 1) * (ln - 1);\n Console.WriteLine(sum);\n //Console.ReadKey();;\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace _630\n{\n class Program\n {\n static void Main()\n {\n var n = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var x1 = n[0]; var y1 = n[1]; var x2 = n[2]; var y2 = n[3];\n var x = Math.Abs(x1 - x2);\n var y = Math.Abs(y1 - y2);\n var ans = (x / 2 + 1) * (y / 2 + 1) + x * y / 4;\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\nusing E = System.Linq.Enumerable;\n\nnamespace Prob05 {\n class Program {\n protected IOHelper io;\n\n public Program(string inputFile, string outputFile) {\n io = new IOHelper(inputFile, outputFile, Encoding.Default);\n\n long x1 = io.NextInt();\n long y1 = io.NextInt();\n long x2 = io.NextInt();\n long y2 = io.NextInt();\n\n Decimal ans = (x2 - x1) * (y2 - y1) / 2.0M;\n ans += (x2 - x1) / 2 + 1;\n ans += (y2 - y1) / 2M;\n io.WriteLine(ans,0);\n\n io.Dispose();\n }\n\n static void Main(string[] args) {\n Program myProgram = new Program(null, null);\n }\n }\n\n class IOHelper : IDisposable {\n public StreamReader reader;\n public StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding) {\n if (inputFile == null)\n reader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n reader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n writer = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n writer = new StreamWriter(outputFile, false, encoding);\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public bool hasNext() {\n if (curTokenIdx >= curLine.Length) {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n return curTokenIdx < curLine.Length;\n }\n\n public string NextToken() {\n return hasNext() ? curLine[curTokenIdx++] : null;\n }\n\n public int NextInt() {\n return int.Parse(NextToken());\n }\n\n public double NextDouble() {\n string tkn = NextToken();\n return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);\n }\n\n public void Write(double val, int precision) {\n writer.Write(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void Write(object stringToWrite) {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(double val, int precision) {\n writer.WriteLine(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n public void WriteLine(Decimal val, int precision) {\n writer.WriteLine(val.ToString(\"F\" + precision, System.Globalization.CultureInfo.InvariantCulture));\n }\n\n public void WriteLine(object stringToWrite) {\n writer.WriteLine(stringToWrite);\n }\n\n public void Dispose() {\n try {\n if (reader != null) {\n reader.Dispose();\n }\n if (writer != null) {\n writer.Flush();\n writer.Dispose();\n }\n } catch { };\n }\n\n\n public void Flush() {\n if (writer != null) {\n writer.Flush();\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tlong HL=0,HS=0,WL=0,WS=0;\n\t\tif((X1+X2)%2==0 && (Y1+Y2)%2==0){\n\t\t\tWL=(X2-X1)/2+1;\n\t\t\tWS=(X2-X1)/2;\n\t\t\tHL=(Y2-Y1)/2+1;\n\t\t\tHS=(Y2-Y1)/2;\n\t\t}\n\t\tif((X1+X2)%2==1 && (Y1+Y2)%2==0){\n\t\t}\n\t\tif((X1+X2)%2==0 && (Y1+Y2)%2==1){\n\t\t}\n\t\tif((X1+X2)%2==1 && (Y1+Y2)%2==1){\n\t\t\tWL=(X2-X1)/2+1;\n\t\t\tWS=(X2-X1)/2+1;\n\t\t\tHL=(Y2-Y1)/2+1;\n\t\t\tHS=(Y2-Y1)/2+1;\n\t\t}\n\t\tConsole.WriteLine(HL*WL+HS*WS);\n\t}\n\tlong X1,X2,Y1,Y2;\n\tpublic Sol(){\n\t\tvar d=rla();\n\t\tX1=d[0];Y1=d[1];X2=d[2];Y2=d[3];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long x1 = Convert.ToInt64(input[0]);\n long y1 = Convert.ToInt64(input[1]);\n long x2 = Convert.ToInt64(input[2]);\n long y2 = Convert.ToInt64(input[3]);\n\n long v = (x2 - x1 + 1) * (y2 - y1 + 2) / 2 - (x2 - x1 + 1) / 2;\n Console.WriteLine(v);\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\n\nnamespace _630E_Rectangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n int x1 = temp[0];\n int y1 = temp[1];\n int x2 = temp[2];\n int y2 = temp[3];\n\n int oddscount;\n int evenscount;\n int oddsheight;\n int evensheight;\n\n if ((x2 - x1)%2 == 0)\n {\n if (x2%2 == 0)\n {\n evenscount = (x2 - x1)/2 + 1;\n oddscount = evenscount - 1;\n }\n else\n {\n oddscount = (x2 - x1)/2 + 1;\n evenscount = oddscount - 1;\n }\n }\n else\n {\n oddscount = (x2 - x1 + 1)/2;\n evenscount = oddscount;\n }\n\n oddsheight = (y2 - y1)/2 + 1;\n if (y2%2 == 0 && y1%2 == 0)\n oddsheight--;\n\n evensheight = (y2 - y1)/2 + +1;\n if (y2%2 == 1 && y1%2 == 1)\n evensheight--;\n\n Console.WriteLine(oddscount*oddsheight + evenscount*evensheight);\n }\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace _630E_Rectangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n int x1 = temp[0];\n int y1 = temp[1];\n int x2 = temp[2];\n int y2 = temp[3];\n\n int oddscount;\n int evenscount;\n int oddsheight;\n int evensheight;\n\n if ((x2 - x1)%2 == 0)\n {\n if (x2%2 == 0)\n {\n evenscount = (x2 - x1)/2 + 1;\n oddscount = evenscount - 1;\n }\n else\n {\n oddscount = (x2 - x1)/2 + 1;\n evenscount = oddscount - 1;\n }\n }\n else\n {\n oddscount = (x2 - x1 + 1)/2;\n evenscount = oddscount;\n }\n \n oddsheight = (y2 - y1)/2 + 1;\n if (Math.Abs(y2)%2 == 0 && Math.Abs(y1)%2 == 0)\n oddsheight--;\n \n evensheight = (y2 - y1)/2 + 1;\n if (Math.Abs(y2)%2 == 1 && Math.Abs(y1)%2 == 1)\n evensheight--;\n\n long answer = (long)oddscount*(long)oddsheight + (long)evenscount*(long)evensheight;\n\n Console.WriteLine(answer);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _630E_Rectangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n int x1 = temp[0];\n int y1 = temp[1];\n int x2 = temp[2];\n int y2 = temp[3];\n\n int oddscount;\n int evencount;\n int oddsheight;\n int evenheight;\n\n if ((x2 - x1)%2 == 0)\n {\n if (x2%2 == 0)\n {\n evencount = (x2 - x1)/2 + 1;\n oddscount = evencount - 1;\n }\n else\n {\n oddscount = (x2 - x1)/2 + 1;\n evencount = oddscount - 1;\n }\n }\n else\n {\n oddscount = (x2 - x1 + 1)/2;\n evencount = oddscount;\n }\n\n oddsheight = (int)Math.Floor((y2 - y1)/2.0)+1;\n evenheight = (int) Math.Ceiling((y2 - y1)/2.0);\n\n Console.WriteLine(oddscount*oddsheight+evencount*evenheight);\n }\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace _630E_Rectangle\n{\n class Program\n {\n static void Main(string[] args)\n {\n var temp = Array.ConvertAll(Console.ReadLine().Split(' '), x => Convert.ToInt32(x));\n int x1 = temp[0];\n int y1 = temp[1];\n int x2 = temp[2];\n int y2 = temp[3];\n\n int oddscount;\n int evenscount;\n int oddsheight;\n int evensheight;\n\n if ((x2 - x1)%2 == 0)\n {\n if (x2%2 == 0)\n {\n evenscount = (x2 - x1)/2 + 1;\n oddscount = evenscount - 1;\n }\n else\n {\n oddscount = (x2 - x1)/2 + 1;\n evenscount = oddscount - 1;\n }\n }\n else\n {\n oddscount = (x2 - x1 + 1)/2;\n evenscount = oddscount;\n }\n\n oddsheight = (y2 - y1)/2 + 1;\n if (Math.Abs(y2)%2 == 0 && Math.Abs(y1)%2 == 0)\n oddsheight--;\n\n evensheight = (y2 - y1)/2 + 1;\n if (Math.Abs(y2)%2 == 1 && Math.Abs(y1)%2 == 1)\n evensheight--;\n\n Console.WriteLine(oddscount*oddsheight + evenscount*evensheight);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n object Get()\n {\n var a = ReadLongs();\n var x1 = a[0];\n var x2 = a[2];\n var y1 = a[1];\n var y2 = a[3];\n var integ = (y2 - y1 + 1) / 2;\n var half = ((y2 - y1 + 1) & 1) == 1;\n long result = integ*(x2 - x1 + 1);\n if (half)\n {\n result += (x2 - x1 + 1) / 2;\n if (((x2 - x1 + 1) & 1) == 1)\n if (((x1 ^ y1) & 1) == 0)\n result += 1;\n }\n return result;\n }\n\n public long FastPow(long x, long pow)\n {\n if (pow == 0) return 1;\n if (pow == 1)\n return x;\n if ((pow & 1) == 0)\n return FastPow(x * x, pow / 2);\n return x * FastPow(x, pow - 1);\n }\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n object Get()\n {\n var a = ReadLongs();\n var x1 = a[0];\n var x2 = a[2];\n var y1 = a[1];\n var y2 = a[3];\n var integ = (y2 - y1 + 1) / 2;\n var half = ((y2 - y1 + 1) & 1) == 1;\n long result = integ*(x2 - x1 + 1);\n if (half)\n {\n result += (x2 - x1 + 1) / 2;\n if (((x2 - x1 + 1) & 1) == 1)\n if (((x1 ^ y1) & 1) == 0)\n result += 1;\n else\n result -= 1;\n }\n return result;\n }\n\n public long FastPow(long x, long pow)\n {\n if (pow == 0) return 1;\n if (pow == 1)\n return x;\n if ((pow & 1) == 0)\n return FastPow(x * x, pow / 2);\n return x * FastPow(x, pow - 1);\n }\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Data;\nusing System.Numerics;\n\nnamespace ConsoleApplication1\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n private int index = 0;\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n class Cut\n {\n public int a;\n public int b;\n public int line;\n }\n object Get()\n {\n var a = ReadLongs();\n var x1 = a[0];\n var x2 = a[2];\n var y1 = a[1];\n var y2 = a[3];\n var integ = (y2 - y1 + 1) / 2;\n var half = ((y2 - y1 + 1) & 1) == 1;\n long result = integ*(x2 - x1 + 1);\n if (half)\n {\n result += (x2 - x1 + 1) / 2;\n if (((x2 - x1 + 1) & 1) == 1)\n if ((x1 ^ y1 & 1) == 0)\n result += 1;\n else\n result -= 1;\n }\n return result;\n }\n\n public long FastPow(long x, long pow)\n {\n if (pow == 0) return 1;\n if (pow == 1)\n return x;\n if ((pow & 1) == 0)\n return FastPow(x * x, pow / 2);\n return x * FastPow(x, pow - 1);\n }\n object Get2()\n {\n FileName = \"strange\";\n checked\n {\n var s = Read();\n var first = GetNext(s);\n var second = GetNext(s);\n var single = new Dictionary();\n var twin = new Dictionary, List>>();\n single[first.Item1] = first.Item2;\n if (second == null)\n return first.Item2;\n do\n {\n if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)\n single[second.Item1] = second.Item2;\n var pair = Tuple.Create(first.Item1, second.Item1);\n if (!twin.ContainsKey(pair))\n twin[pair] = new List>();\n twin[pair].Add(Tuple.Create((long)first.Item2, (long)second.Item2));\n first = second;\n second = GetNext(s);\n } while (second != null);\n long result = single.Select(x => x.Value).Sum();\n foreach (var kv in twin)\n result += ProcessPair(kv.Value);\n return result;\n }\n }\n\n public long ProcessPair(List> counts)\n {\n checked\n {\n var sorted = counts.OrderByDescending(x => x.Item1).ThenByDescending(x => x.Item2).ToArray();\n var filtered = new List>() { sorted[0] };\n for (int i = 1; i < sorted.Length; i++)\n if (sorted[i].Item2 > filtered.Last().Item2)\n filtered.Add(sorted[i]);\n\n var previous = filtered[0];\n var result = previous.Item1 * previous.Item2;\n for (int i = 1; i < filtered.Count; i++)\n result += (filtered[i].Item2 - previous.Item2) * filtered[i].Item1;\n return result;\n }\n }\n\n public Tuple GetNext(string s)\n {\n if (index == s.Length)\n return null;\n var ch = s[index];\n var count = 0;\n while (index < s.Length && ch == s[index])\n {\n count++;\n index++;\n }\n return Tuple.Create(ch, count);\n }\n\n public double ProcessPair(long[] a, long[] b, int p)\n {\n return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +\n ((double)NumberOfDivs(b, p) * 2000) / Count(b) -\n ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));\n }\n\n public long NumberOfDivs(long[] a, int p)\n {\n return a[1] / p - (a[0] - 1) / p;\n }\n\n public long Count(long[] a)\n {\n return a[1] - a[0] + 1;\n }\n\n bool DoubleEquals(double a, double b)\n {\n return Math.Abs(a - b) < 0.0000000001;\n }\n\n bool SameLine(double[] a, double[] b, double[] c)\n {\n var x = a[0];\n var y = a[1];\n var x1 = b[0];\n var y1 = b[1];\n var x2 = c[0];\n var y2 = c[1];\n return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));\n }\n\n double Distance(double[] a, double[] b)\n {\n return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n }\n\n object Get7()\n {\n checked\n {\n var m = ReadInt();\n var p = ReadLongs();\n var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();\n var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();\n if (even != null)\n {\n var index = Array.IndexOf(arr, even);\n //arr[index].Count = arr[index].Count / 2;\n }\n long divs = 1;\n long result = 1;\n foreach (var a in arr)\n {\n var pi = a.Key;\n var curr = pi;\n var olddivs = divs;\n var oldres = result;\n for (int i = 0; i < a.Count; i++)\n {\n result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;\n curr = curr * pi % commonMod;\n divs = (divs + olddivs) % (commonMod - 1);\n }\n }\n return result;\n }\n }\n\n public long FastPow(long x, BigInteger pow, long mod)\n {\n if (pow == 0)\n return 1;\n if ((pow & 1) == 0)\n return FastPow(x * x % mod, pow / 2, mod);\n return x * FastPow(x, pow - 1, mod) % mod;\n }\n\n //object Get3()\n //{\n // FileName = \"\";\n // checked\n // {\n // var n = ReadInt();\n // var hor = new List();\n // var ver = new List();\n // for (int i = 0; i < n; i++)\n // {\n // var a = ReadInts();\n // if (a[0] == a[2])\n // ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });\n // else\n // hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });\n // }\n // ver = Merge(ver);\n // hor = Merge(hor);\n\n // }\n //}\n\n List Merge(List l)\n {\n var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();\n Cut previous = null;\n var result = new List();\n for (int i = 0; i < a.Length; i++)\n if (previous == null)\n previous = a[i];\n else\n if (previous.line == a[i].line && previous.b >= a[i].a)\n previous.b = Math.Max(previous.b, a[i].b);\n else\n {\n result.Add(previous);\n previous = a[i];\n }\n if (previous != null)\n result.Add(previous);\n return result;\n }\n\n }\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (string.IsNullOrEmpty(FileName))\n return Console.ReadLine();\n if (f == null)\n f = new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName + \".in\");\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return Convert.ToInt32(Read());\n }\n protected int[] ReadInts()\n {\n return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName + \".out\", r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-NB-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func)\n {\n T result = default(T);\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n }\n}"}], "src_uid": "00cffd273df24d1676acbbfd9a39630d"} {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace _822D\n{\n class Program\n {\n static long MOD = 1000000007;\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long t = long.Parse(input[0]), l = long.Parse(input[1]), r = long.Parse(input[2]);\n long[] dp = new long[r + 1], lp = new long[r + 1];\n List pr = new List();\n long mult;\n for (long i = 2; i <= r; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n for (int j = 0; j < pr.Count && pr[j] <= lp[i] && (mult = i * pr[j]) <= r; j++)\n lp[mult] = pr[j];\n }\n for (long i = 2; i <= r; i++)\n {\n if (lp[i] == i)\n dp[i] = ((i * (i - 1)) / 2) % MOD;\n else\n dp[i] = ((dp[lp[i]] * (i / lp[i])) % MOD + dp[i / lp[i]]) % MOD;\n }\n long currT = 1, result = 0;\n for (long i = l; i <= r; i++)\n {\n result = (result + (currT * dp[i]) % MOD) % MOD;\n currT = (currT * t) % MOD;\n }\n Console.WriteLine(result);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace My_pretty_girl_Noora\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int t = Next();\n int l = Next();\n int r = Next();\n\n var nn = new long[r + 1];\n for (int i = 2; i < nn.Length; i++)\n {\n nn[i] = long.MaxValue;\n }\n nn[1] = 1;\n for (long i = 2; i < nn.Length; i++)\n {\n nn[i] = Math.Min(nn[i], i*(i - 1)/2);\n\n long max = Math.Min(i*i, r);\n long y = 2;\n for (long j = i + i; j <= max; j += i, y++)\n {\n var tt = nn[i] + i*nn[y];\n if (nn[j] > tt)\n nn[j] = tt;\n //nn[j] = Math.Min(nn[j], nn[i] + i*nn[y]);\n }\n }\n\n long sum = 0;\n long k = 1;\n int mod = 1000000007;\n\n for (int i = l; i <= r; i++)\n {\n sum = (sum + k*(nn[i]%mod))%mod;\n k = (k*t)%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace My_pretty_girl_Noora\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int t = Next();\n int l = Next();\n int r = Next();\n\n var nn = new long[r + 1];\n for (int i = 2; i < nn.Length; i++)\n {\n nn[i] = long.MaxValue;\n }\n nn[1] = 1;\n for (long i = 2; i < nn.Length; i++)\n {\n nn[i] = Math.Min(nn[i], i*(i - 1)/2);\n\n long max = Math.Min(i*i, r);\n long y = 2;\n for (long j = i + i; j <= max; j += i, y++)\n {\n long tt = nn[i] + i*nn[y];\n if (nn[j] > tt)\n nn[j] = tt;\n }\n }\n\n long sum = 0;\n int mod = 1000000007;\n\n for (int i = r; i >= l; i--)\n {\n sum = (sum*t + nn[i])%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int t;\n int l, r;\n\n int prime = 1000000007;\n\n long[] ans;\n\n List primes = new List();\n\n int primeLimit;\n\n bool IsPrime(int i)\n {\n foreach(var prime in primes)\n {\n if (prime * prime > i)\n return true;\n\n if (i % prime == 0)\n return false;\n }\n\n return true;\n }\n\n public void Solve()\n {\n t = ioHelper.ReadNextInt();\n l = ioHelper.ReadNextInt();\n r = ioHelper.ReadNextInt();\n\n // n = p0 * p1 * ... * pk. pi = numar prim. p[i+1]>=p[i].\n // R = n/2 * ( (p0-1) + (p1-1)/p0 + (p2-1)/(p0*p1) + (p3-1)/(p0*p1*p2) + ... ).\n\n primeLimit = (int)Math.Ceiling(Math.Sqrt(r)+1);\n\n ans = new long[r+1];\n\n ans[0] = 0;\n ans[1] = 0;\n\n int i, j;\n\n primes.Add(2);\n\n for (i = 3; i <= primeLimit; i++)\n if (IsPrime(i))\n primes.Add(i);\n\n for (i = primeLimit + 1; i <= r; i++)\n if (IsPrime(i))\n ans[i] = (i * (long)(i - 1) / 2) % prime;\n\n for (j = primes.Count - 1; j >= 0; j--)\n for (i = 1; i * primes[j] <= r; i++)\n if (ans[i] > 0 || i==1)\n {\n var p = primes[j];\n var n = i * p;\n\n long rz = n * (long)(p - 1) / 2;\n rz += ans[i];\n\n rz %= prime;\n\n ans[n] = rz;\n }\n\n long coeff = 1;\n long rez = 0;\n\n for(i=l;i<=r;i++)\n {\n if (ans[i] == 0)\n ans[i] = i * (long)(i - 1) / 2;\n\n ans[i] %= prime;\n\n rez += (ans[i] * coeff) % prime;\n\n rez %= prime;\n\n coeff *= t;\n coeff %= prime;\n }\n\n ioHelper.WriteLine(rez.ToString());\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n string[] str = Console.ReadLine().Split(' ');\n long count = 0;\n long t = int.Parse(str[0]);\n int l = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n Generateprimenumber G = new Generateprimenumber(r+1);\n long[] A = new long[r+1];\n for(int i=0;i pp = new List();\n int j = 2;\n for(int i=0;i pp = new List();\n long num = n;\n int count = 1;\n bool last = false;\n for(int i=0;p[i]*p[i] <= num;i++){\n int j=0;\n while(num % p[i] == 0){\n num /= p[i];\n j++;\n }\n pp.Add(j);\n count *= j+1; \n }\n if(num != 1){\n pp.Add(1);\n count *= 2;\n last = true;\n }\n long[] div = new long[count];\n for(int i=0;i> 1);\n }\n\n int res = 0;\n\n for (int i = r; i >= l; i--) res = (int) ( ((long)res * t + f[i]) % mod );\n\n Console.WriteLine(res);\n //Console.WriteLine(System.DateTime.Now - dt);\n }\n } \n \n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n string[] str = Console.ReadLine().Split(' ');\n long count = 0;\n long t = int.Parse(str[0]);\n int l = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n Generateprimenumber G = new Generateprimenumber(r+1);\n long[] A = new long[r+1];\n for(int i=0;i pp = new List();\n int j = 2;\n for(int i=0;i pp = new List();\n long num = n;\n int count = 1;\n bool last = false;\n for(int i=0;p[i]*p[i] <= num;i++){\n int j=0;\n while(num % p[i] == 0){\n num /= p[i];\n j++;\n }\n pp.Add(j);\n count *= j+1; \n }\n if(num != 1){\n pp.Add(1);\n count *= 2;\n last = true;\n }\n long[] div = new long[count];\n for(int i=0;i '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace My_pretty_girl_Noora\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int t = Next();\n int l = Next();\n int r = Next();\n\n\n var nn = new long[r + 1];\n for (int i = 2; i < nn.Length; i++)\n {\n nn[i] = long.MaxValue;\n }\n nn[1] = 1;\n for (long i = 2; i < nn.Length; i++)\n {\n if (nn[i] == long.MaxValue)\n {\n nn[i] = i*(i - 1)/2;\n }\n\n long max = Math.Min(i*i, r);\n for (long j = i + i; j <= max; j += i)\n {\n nn[j] = Math.Min(nn[j], nn[i] + i*nn[j/i]);\n }\n }\n\n writer.WriteLine(nn.Max());\n\n long sum = 0;\n long k = 1;\n int mod = 1000000007;\n\n for (int i = l; i <= r; i++)\n {\n sum = (sum + k*(nn[i]%mod))%mod;\n k = (k*t)%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace My_pretty_girl_Noora\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int t = Next();\n int l = Next();\n int r = Next();\n\n\n var nn = new long[r + 1];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = long.MaxValue;\n }\n nn[1] = 1;\n for (long i = 2; i < nn.Length; i++)\n {\n if (nn[i] == long.MaxValue)\n {\n nn[i] = i*(i - 1)/2;\n }\n\n long max = Math.Min(i*i, r);\n for (long j = i + i; j <= max; j += i)\n {\n nn[j] = Math.Min(nn[j], nn[i] + i*nn[j/i]);\n }\n }\n\n long sum = 0;\n long k = 1;\n int mod = 1000000007;\n\n for (int i = l; i <= r; i++)\n {\n sum = (sum + k*(nn[i])%mod)%mod;\n k = (k*t)%mod;\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static List lucks = new List();\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n long res = 0;\n \n NextLucks(0, r);\n \n lucks.Sort();\n int indexLuck = 0;\n for (int i = 0; i < lucks.Count; i++)\n {\n if(lucks[i] >= l)\n {\n indexLuck = i;\n break;\n }\n }\n \n for (long i = l; i <= r; i++)\n {\n var last = Math.Min(lucks[indexLuck], r);\n res += (long)lucks[indexLuck++] * (last - i + 1);\n i = last;\n }\n\n Console.WriteLine(res);\n }\n\n private static void NextLucks(long luck, int max)\n {\n if(luck >= max)\n return;\n lucks.Add(luck * 10 + 4);\n NextLucks(luck * 10 + 4, max);\n lucks.Add(luck*10 + 7);\n NextLucks(luck*10 + 7, max);\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task121A\n{\n class Program\n {\n static List MyList = new List();\n static List lst = new List();\n static void NewCh(string s)\n {\n if (s.Length == 11) return;\n MyList.Add(s);\n NewCh(s + \"4\");\n NewCh(s + \"7\");\n }\n\n static Int64 GetNumber(Int64 number)\n {\n Int64 result = 0; \n for (Int32 i = 0; i < MyList.Count; i++)\n {\n if (lst[i] >= number)\n {\n result = lst[i];\n break;\n }\n }\n return result;\n }\n static void Main(string[] args)\n {\n NewCh(\"4\");\n NewCh(\"7\");\n for(Int32 i = 0;i= r)\n break;\n\n prevLucky = lucky;\n }\n\n io.Print(ans);\n\n }\n\n MyIo io = new MyIo();\n\n List luckys = new List();\n\n void xfx(long current)\n {\n if (current > 0)\n luckys.Add(current);\n\n if (current * 10L + 4 < 10000000000L)\n xfx(current * 10 + 4);\n if (current * 10L + 7 < 10000000000L)\n xfx(current * 10 + 7);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n\n \n\n\n\n p.Solve();\n p.io.Close();\n }\n }\n\n class MyIo\n {\n char[] separators = new char[] { ' ', '\\t' };\n\n#if TEST\n TextReader inputStream = new StreamReader(\"..\\\\..\\\\input.txt\");\n#else\n TextReader inputStream = System.Console.In;\n#endif\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Numerics;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n int n = ReadInt();\n for (int i = 1; i <= n; i++)\n {\n int j = i;\n bool isHappy = true;\n while (j != 0)\n {\n if (j % 10 == 4 || j % 10 == 7)\n {\n j /= 10;\n }\n else\n {\n isHappy = false;\n break;\n }\n }\n if (isHappy)\n {\n if (n % i == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n }\n }\n Console.WriteLine(\"NO\");\n }\n\n static void B()\n {\n Dictionary hash = new Dictionary();\n string s = ReadLine();\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = i; j < s.Length; j++)\n {\n string t = \"\";\n for (int z = i; z <= j; z++)\n {\n t += s[z];\n }\n bool isHappy = true;\n for (int z = 0; z < t.Length; z++)\n {\n if (!(t[z].Equals('4') || t[z].Equals('7')))\n isHappy = false;\n }\n if (isHappy)\n {\n if (hash.ContainsKey(t))\n hash[t]++;\n else\n hash.Add(t, 1);\n }\n }\n }\n if (hash.Count == 0)\n {\n Console.WriteLine(-1);\n return;\n }\n int max = 0;\n foreach (string key in hash.Keys)\n {\n max = Math.Max(hash[key], max);\n }\n string min = \"\";\n foreach (string key in hash.Keys)\n {\n if (max == hash[key])\n min = key;\n }\n foreach (string key in hash.Keys)\n {\n if (string.Compare(min, key) > 0 && hash[key] == max)\n {\n min = key;\n }\n }\n Console.WriteLine(min);\n }\n\n static List happy = new List();\n static long[] t;\n\n static void dfs(int k, int p)\n {\n if (k == p)\n {\n long dec = 1;\n long res = 0;\n for (int i = p - 1; i >= 0; i--)\n {\n res += dec * t[i];\n dec *= 10L;\n }\n happy.Add(res);\n }\n else\n {\n t[k] = 4;\n dfs(k + 1, p);\n t[k] = 7;\n dfs(k + 1, p);\n }\n }\n\n static void C()\n {\n long l, r;\n ReadArray(' ');\n l = NextLong();\n r = NextLong();\n for (int i = 1; i <= 10; i++)\n {\n t = new long[i];\n dfs(0, i);\n }\n happy.Sort();\n long sum = 0;\n long left = l;\n for (int i = 0; i < happy.Count; i++)\n {\n if (happy[i] >= r)\n {\n sum += happy[i] * (r - left + 1);\n break;\n }\n if (happy[i] >= l)\n {\n sum += (happy[i]) * (happy[i] - left + 1L);\n left = happy[i] + 1;\n }\n }\n Console.WriteLine(sum);\n }\n\n static void D()\n {\n \n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _27_10_11_3_\n{\n class Program\n {\n static void Main()\n {\n int k=1, j, d;\n Int64[] m = new Int64[1024];\n m[0]=0;\n m[1]=4;\n m[2]=7;\n while (k < 9)\n {\n j=2;\n d=1;\n for (int i = 0; i < k; i++)\n {\n j *= 2;\n d*=10;\n }\n j-=2;\n for (int i = j; i < j + (j + 2) / 2; i++)\n m[i+1] = m[i+1 - (j + 2) / 2]+d*4;\n for (int i = j+(j+2)/2; i < j + (j + 2); i++)\n m[i+1] = m[i+1 - (j + 2)]+d*7;\n k += 1;\n }\n m[1023] = 4444444444;\n \n //for(int i=0; i m[i] && ma <= m[i + 1])\n s += m[i + 1] * (ma - mi + 1);\n if (mi > m[i] && mi<=m[i+1] && ma > m[i + 1])\n s += m[i + 1] * (m[i + 1] - mi + 1);\n if (mi <= m[i] && ma>m[i] && ma <= m[i + 1])\n s += m[i + 1] * (ma - m[i]);\n if (mi <= m[i] && ma > m[i + 1])\n s += m[i + 1] * (m[i + 1] - m[i]);\n }\n Console.WriteLine(\"{0}\", s);\n \n //Console.ReadLine();\n }\n /*static int[] Second(int[] i, int j)\n {\n int l;\n if (j >= 0)\n {\n for(i=0; i<)\n }\n }*/\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static List lucks = new List();\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n long res = 0;\n \n NextLucks(0, r);\n \n lucks.Sort();\n int indexLuck = 0;\n for (int i = 0; i < lucks.Count; i++)\n {\n if(lucks[i] >= l)\n {\n indexLuck = i;\n break;\n }\n }\n \n for (long i = l; i <= r; i++)\n {\n var last = Math.Min(lucks[indexLuck], r);\n res += (long)lucks[indexLuck++] * (last - i + 1);\n i = last;\n }\n\n Console.WriteLine(res);\n }\n\n private static void NextLucks(long luck, int max)\n {\n if(luck >= max)\n return;\n lucks.Add(luck * 10 + 4);\n NextLucks(luck * 10 + 4, max);\n lucks.Add(luck*10 + 7);\n NextLucks(luck*10 + 7, max);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Lucky_Sum\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var lucky = new List {4, 7};\n\n int l = Next();\n int r = Next();\n\n\n int first = 0;\n int last = 1;\n long d = 10;\n do\n {\n for (int i = first; i <= last; i++)\n {\n lucky.Add(d*4 + lucky[i]);\n lucky.Add(d*7 + lucky[i]);\n }\n d *= 10;\n first = last + 1;\n last = lucky.Count - 1;\n } while (lucky[last] < r);\n\n long sum = 0;\n\n lucky.Sort();\n\n int il = lucky.BinarySearch(l);\n if (il < 0)\n il = ~il;\n\n int ir = lucky.BinarySearch(r);\n if (ir < 0)\n ir = ~ir;\n\n if (il == ir)\n {\n sum = lucky[ir]*(r - l + 1);\n }\n else\n {\n sum = lucky[il]*(lucky[il] - l + 1);\n sum += lucky[ir]*(r - lucky[ir - 1]);\n\n for (int i = il + 1; i < ir; i++)\n {\n sum += lucky[i]*(lucky[i] - lucky[i - 1]);\n }\n }\n\n writer.WriteLine(sum);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _LuckySum\n{\n class ProgramLuckySum\n {\n static List GetLuckyNumbers(int length)\n {\n var strNums = new List {\"4\", \"7\"};\n while (strNums[strNums.Count - 1].Length < length)\n {\n var count = strNums.Count;\n for (var i=0; i li = new List ();\n\t\t li.Add (4);\n\t li.Add (7);\n\t int last = 0;\n\t\t int num = 2;\n\t\t bool stop = false;\n\t \twhile (true) {\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"4\" + li [i];\n \t\t\t\tif (temp.Length >= 12) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (long.Parse (temp));\n \t\t\t}\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"7\" + li [i];\n \t\t\t\tif (temp.Length >= 12) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (long.Parse (temp));\n \t\t\t}\n \t\t\tlast = num;\n \t\t\tnum *= 2;\n \t\t\tif (stop) {\n \t\t\t\tbreak;\n \t\t\t}\n\t \t}\n\t\tli.Sort ();\n long ans = 0;\n int cnt = 0;\n for (int i = 0; i < li.Count; i++)\n {\n if(li[i] >= l)\n {\n cnt = i;\n break;\n }\n }\n \n for (long i = l; i <= r; i++)\n {\n var last2 = Math.Min(li[cnt], r);\n ans += (long)li[cnt++] * (last2 - i + 1);\n i = last2;\n }\n \n Console.WriteLine(ans);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n if (a < b)\n {\n long t = a;\n a = b;\n b = t;\n }\n return (b > 0) ? gcd(b, a % b) : a;\n }\n static void _235A()\n {\n long n = long.Parse(reader.ReadLine()), ans = n * (n - 1);\n if (n < 3)\n ans = n;\n else if (n % 2 == 1)\n ans *= n - 2;\n else\n {\n long t = (n - 2) / 2;\n for (long i = n - 3; i > (n - 2) / 2; --i)\n {\n long g = gcd(n, i);\n if (g == 1)\n t = Math.Max(t, i);\n }\n ans *= t;\n }\n writer.Write(Math.Max(ans, (n - 1) * (n - 2) * (n - 3)));\n }\n static void _106C()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), c0 = int.Parse(s[2]), d0 = int.Parse(s[3]);\n int[] a = new int[m + 1], b = new int[m + 1], c = new int[m + 1], d = new int[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n s = reader.ReadLine().Split();\n a[i] = int.Parse(s[0]);\n b[i] = int.Parse(s[1]);\n c[i] = int.Parse(s[2]);\n d[i] = int.Parse(s[3]);\n }\n int[,] dp = new int[m + 1, n + 1];\n for (int i = 1; i * c0 <= n; ++i)\n dp[0, i * c0] = i * d0;\n for (int i = 1; i <= m; ++i)\n {\n for (int j = 1; j <= n; ++j)\n {\n if (j < c[i])\n dp[i, j] = dp[i - 1, j];\n else\n {\n for (int k = 0; k * b[i] <= a[i]; ++k)\n {\n int t = c[i] * k;\n if (t <= j)\n dp[i, j] = Math.Max(d[i] * k + dp[i - 1, j - t], dp[i, j]);\n }\n }\n dp[i, j] = Math.Max(dp[i, j - 1], dp[i, j]);\n }\n }\n writer.Write(dp[m, n]);\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) != 0)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _300C()\n {\n string[] s = reader.ReadLine().Split();\n long a = long.Parse(s[0]), b = long.Parse(s[1]), n = long.Parse(s[2]);\n if (a > b)\n {\n long t = a;\n a = b;\n b = t;\n }\n long[] fact = new long[n + 1];\n fact[0] = fact[1] = 1;\n long mod = 1000000007;\n for (long i = 2; i <= n; ++i)\n fact[i] = fact[i - 1] * i % mod;\n long an = n, bn = 0;\n long ans = 0;\n while (an >= 0)\n {\n long num = an * a + bn * b;\n bool ok = true;\n for (long p = 10; ok && p <= 10000000; p *= 10)\n {\n long t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n long c = (((fact[n] * pow(fact[an], mod - 2, mod)) % mod) * pow(fact[bn], mod - 2, mod)) % mod;\n ans += c;\n ans %= mod;\n }\n --an;\n ++bn;\n }\n writer.Write(ans);\n }\n static void _250B()\n {\n string s = reader.ReadLine();\n int n = int.Parse(s);\n for (int i = 0; i < n; ++i)\n {\n s = reader.ReadLine();\n string[] ip = new string[8];\n int nums = 0;\n for (int l = 0, j = 0; j < s.Length; ++j)\n {\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n //ip[l] = \"\";\n for (int k = j - nums; k < j; ++k)\n ip[l] += s[k];\n ++l;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n nums = 0;\n //if (ip[7] == null)\n {\n for (int r = 7, j = s.Length - 1; j >= 0; --j)\n {\n if (ip[r] != null)\n break;\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n for (int k = j + 1; k <= j + nums; ++k)\n ip[r] += s[k];\n --r;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n }\n for (int j = 0; j < 8; ++j)\n {\n if (ip[j] == null)\n ip[j] = \"\";\n while (ip[j].Length < 4)\n ip[j] = '0' + ip[j];\n }\n for (int j = 0; j < 7; ++j)\n writer.Write(ip[j]+':');\n writer.WriteLine(ip[7]);\n }\n }\n static void _316B2()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), x = int.Parse(s[1]);\n s = reader.ReadLine().Split();\n Dictionary queue = new Dictionary();\n LinkedList undef = new LinkedList();\n for (int i = 1; i <= n; ++i)\n {\n int h = int.Parse(s[i - 1]);\n if (h > 0)\n queue.Add(h, i);\n else\n undef.AddLast(i);\n }\n int[] lens = new int[undef.Count];\n int c = 0, index = 0;\n foreach (int v in undef)\n {\n int next = v;\n lens[c] = 1;\n while (true)\n {\n if (next == x)\n {\n index = lens[c];\n lens[c] = 0;\n break;\n }\n if (queue.ContainsKey(next))\n {\n next = queue[next];\n ++lens[c];\n }\n else\n break;\n }\n ++c;\n }\n bool[,] dp = new bool[2, n + 1];\n dp[0,0] = true;\n for (int i = 0; i < lens.Length; ++i)\n {\n if (lens[i] > 0)\n {\n dp[1,lens[i]] = true;\n for (int j = 1; j + lens[i] <= n; ++j)\n {\n if (dp[0,j])\n {\n dp[1, j + lens[i]] = true;\n }\n }\n for (int j = 1; j <= n; ++j)\n {\n dp[0, j] = dp[0, j] || dp[1, j];\n dp[1, j] = false;\n }\n }\n }\n for (int i = 0; i <= n; ++i)\n if (dp[0,i])\n writer.WriteLine(i + index);\n }\n static void _121A()\n {\n string[] lr = reader.ReadLine().Split();\n long l = long.Parse(lr[0]), r = long.Parse(lr[1]);\n SortedSet set = new SortedSet();\n set.Add(4);\n set.Add(7);\n for (long p = 10; p <= 1000000000; p *= 10)\n {\n SortedSet s = new SortedSet(set);\n foreach (long e in s)\n {\n if (e / (p / 10) > 0)\n {\n set.Add(e + p * 4);\n set.Add(e + p * 7);\n }\n }\n }\n while (set.ElementAt(0) < l)\n set.Remove(set.ElementAt(0));\n long max = set.Max;\n while (set.Max > r)\n {\n max = set.Max;\n set.Remove(set.Max);\n }\n if (set.Max < r)\n set.Add(max);\n else\n max = set.Max;\n long[] happy = new long[set.Count];\n long c = 0;\n foreach (long e in set)\n happy[c++] = e;\n long min = set.Min;\n long sum = 0;\n if (happy.Length == 1)\n sum = (r - l + 1) * happy[0];\n else\n sum = min * (min - l + 1);// +max * (max - r + 1);\n for (long i = 1; i < happy.Length; ++i)\n sum += (Math.Min(r,happy[i]) - happy[i - 1]) * happy[i];\n writer.Write(sum);\n }\n static void Main(string[] args)\n {\n //_235A();\n //_106C();\n //_300C();\n //_250B();\n //_316B2();\n _121A();\n reader.Close();\n writer.Close();\n }\n}"}, {"source_code": "// \n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Threading;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Text.RegularExpressions;\nusing System.Linq;\n\nnamespace sar_cs\n{\n static class Helpers\n {\n public static string AsString(this double a, int digits)\n {\n return a.ToString(\"F\" + digits, CultureInfo.InvariantCulture);\n }\n\n public static Stopwatch SW = Stopwatch.StartNew();\n }\n\n public class Program\n {\n #region Helpers\n public class Parser\n {\n const int BufSize = 2457600;\n TextReader s;\n char[] buf = new char[BufSize];\n int bufPos;\n int bufDataSize;\n bool eos; // eos read to buffer\n int lastChar = -2;\n int nextChar = -2;\n StringBuilder sb = new StringBuilder();\n\n void FillBuf()\n {\n if (eos) return;\n bufDataSize = s.Read(buf, 0, BufSize);\n if (bufDataSize == 0) eos = true;\n bufPos = 0;\n }\n\n int Read()\n {\n if (nextChar != -2)\n {\n lastChar = nextChar;\n nextChar = -2;\n }\n else\n {\n if (bufPos == bufDataSize) FillBuf();\n if (eos) lastChar = -1;\n else lastChar = buf[bufPos++];\n }\n return lastChar;\n }\n\n void Back()\n {\n if (lastChar == -2) throw new Exception(); // no chars were ever read\n nextChar = lastChar;\n }\n\n public Parser()\n {\n s = Console.In;\n }\n\n public int ReadInt()\n {\n int res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = 1;\n c = Read();\n }\n int len = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return checked(res * sign);\n }\n\n public long ReadLong()\n {\n long res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = 1;\n c = Read();\n }\n int len = 0;\n\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return checked(res * sign);\n }\n\n public int ReadLnInt()\n {\n int res = ReadInt(); ReadLine(); return res;\n }\n\n public long ReadLnLong()\n {\n long res = ReadLong(); ReadLine(); return res;\n }\n\n public double ReadDouble()\n {\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = Read();\n }\n\n sb.Length = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = Read();\n }\n\n Back();\n var res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);\n return res * sign;\n }\n\n public string ReadLine()\n {\n int c = Read();\n sb.Length = 0;\n while (c != -1 && c != 13 && c != 10)\n {\n sb.Append((char)c);\n c = Read();\n }\n if (c == 13)\n {\n c = Read();\n if (c != 10) Back();\n }\n return sb.ToString();\n }\n\n public bool EOF\n {\n get\n {\n if (Read() == -1) return true;\n Back();\n return false;\n }\n }\n\n public bool SeekEOF\n {\n get\n {\n L0:\n int c = Read();\n if (c == -1) return true;\n if (char.IsWhiteSpace((char)c)) goto L0;\n Back();\n return false;\n }\n }\n\n public int[] ReadIntArr(int n)\n {\n var a = new int[n]; for (int i = 0; i < n; i++) a[i] = ReadInt(); return a;\n }\n\n public long[] ReadLongArr(int n)\n {\n var a = new long[n]; for (int i = 0; i < n; i++) a[i] = ReadLong(); return a;\n }\n }\n\n static void pe() { Console.WriteLine(\"???\"); Environment.Exit(0); }\n\n static void re() { Environment.Exit(55); }\n\n static int nosol()\n {\n Console.WriteLine(\"ERROR\");\n return 0;\n }\n\n static void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n\n /// Mono lacks this override of string.Join()\n static string Join(IEnumerable objs)\n {\n var sb = new StringBuilder();\n foreach (var s in objs)\n {\n if (sb.Length != 0) sb.Append(' ');\n sb.Append(s);\n }\n return sb.ToString();\n }\n\n #endregion Helpers\n\n static StringBuilder sb = new StringBuilder();\n static Random rand = new Random(52345235);\n\n static int next_digit(int d)\n {\n switch (d)\n {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4: return 4;\n case 5:\n case 6:\n case 7: return 7;\n case 8:\n case 9: return 14;\n default: throw new Exception();\n }\n }\n\n static long[] fours = { 0, 4, 44, 444, 4444, 44444, 444444, 4444444, 44444444, 444444444, 4444444444 };\n\n static long next(long n)\n {\n long m = 1;\n\n for (int i = 0; m <= n; i++)\n {\n L0:\n int d = (int)(n / m) % 10;\n if (d != 4 && d != 7)\n {\n n += m;\n n = n / m * m + fours[i];\n goto L0;\n }\n m *= 10;\n }\n return n;\n }\n\n static long sum(long a, long b)\n {\n checked\n {\n return (a + b) * (b - a + 1) / 2;\n }\n }\n\n static long sol2(long l, long r)\n {\n long sum = 0;\n for (long i = l; i <= r; i++)\n {\n long t = next(i);\n sum += t;\n }\n return sum;\n }\n\n static long sol1(long l, long r)\n {\n long res = 0;\n long lastAdded = l - 1;\n\n while (l <= r)\n {\n long t = next(l);\n if (t > r) t = r;\n\n checked\n {\n res += next(lastAdded + 1) * (t - lastAdded); lastAdded = t;\n }\n l = t + 1;\n }\n\n return res;\n }\n\n\n static int Main(string[] args)\n {\n //for (long i = 8; i <= 100; i++) Console.WriteLine(next(i));\n //return 0;\n\n //Console.SetIn(File.OpenText(\"_input\"));\n //test(); return 0;\n var parser = new Parser();\n while (!parser.SeekEOF)\n {\n long l = parser.ReadInt(), r = parser.ReadInt();\n\n long res1 = sol1(l, r);\n\n //for (l = 1; l <= 1000; l++)\n // for (r = l; r <= 1000; r++)\n // {\n // long res1 = sol1(l, r);\n // long res2 = sol2(l, r);\n // if (res1 != res2) throw new Exception();\n // }\n\n Console.WriteLine(res1);\n }\n\n return 0;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round91 {\n class A {\n static List num = new List();\n static void gen(long x) {\n if (x <= 10000000000L) {\n num.Add(x);\n gen(x * 10 + 4);\n gen(x * 10 + 7);\n }\n }\n\n // \n static void Main() {\n var xs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int a = xs[0],\n b = xs[1];\n gen(0);\n num.Sort();\n long res = 0;\n for (int i = 0; ; i++) {\n if (num[i+1] < a) {\n continue;\n }\n if (num[i+1] > b) {\n res += (b - Math.Max(num[i], a-1)) * num[i + 1];\n break;\n }\n res += (num[i + 1] - Math.Max(num[i], a-1)) * num[i + 1];\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static List lucks = new List();\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n long res = 0;\n \n NextLucks(0, r);\n \n lucks.Sort();\n int indexLuck = 0;\n for (int i = 0; i < lucks.Count; i++)\n {\n if(lucks[i] >= l)\n {\n indexLuck = i;\n break;\n }\n }\n \n for (long i = l; i <= r; i++)\n {\n var last = Math.Min(lucks[indexLuck], r);\n res += (long)lucks[indexLuck++] * (last - i + 1);\n i = last;\n }\n\n Console.WriteLine(res);\n }\n\n private static void NextLucks(long luck, int max)\n {\n if(luck >= max)\n return;\n lucks.Add(luck * 10 + 4);\n NextLucks(luck * 10 + 4, max);\n lucks.Add(luck*10 + 7);\n NextLucks(luck*10 + 7, max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Andy\n{\n static List ans = new List();\n public static void Main()\n {\n Gen(0);\n ans.Sort();\n var ii = Console.ReadLine().Split(' ');\n var l = int.Parse(ii[0]);\n var r = int.Parse(ii[1]);\n long res = 0;\n for(int i=0;i+1 10000000000)\n return;\n ans.Add(cur);\n Gen(10 * cur + 4);\n Gen(10 * cur + 7);\n }\n\n}\n\n\n\n\n\n\n\n\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass Andy\n{\n static List ans = new List();\n public static void Main()\n {\n Gen(0);\n ans.Sort();\n var ii = Console.ReadLine().Split(' ');\n var l = int.Parse(ii[0]);\n var r = int.Parse(ii[1]);\n long res = 0;\n for(int i=0;i+1 1000000000)\n return;\n ans.Add(cur);\n Gen(10 * cur + 4);\n Gen(10 * cur + 7);\n }\n\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace task121A\n{\n class Program\n {\n static List MyList = new List();\n static List lst = new List();\n static void NewCh(string s)\n {\n if (s.Length == 10) return;\n MyList.Add(s);\n NewCh(s + \"4\");\n NewCh(s + \"7\");\n }\n\n static Int64 GetNumber(Int32 number)\n {\n Int64 result = 0; \n for (Int32 i = 0; i < MyList.Count; i++)\n {\n if (lst[i] >= number)\n {\n result = lst[i];\n break;\n }\n }\n return result;\n }\n static void Main(string[] args)\n {\n NewCh(\"4\");\n NewCh(\"7\");\n for(Int32 i = 0;i= r)\n break;\n\n prevLucky = lucky;\n }\n\n io.Print(ans);\n\n }\n\n MyIo io = new MyIo();\n\n List luckys = new List();\n\n void xfx(int current)\n {\n if (current > 0)\n luckys.Add(current);\n\n if (current * 10L + 4 < int.MaxValue)\n xfx(current * 10 + 4);\n if (current * 10L + 7 < int.MaxValue)\n xfx(current * 10 + 7);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n\n \n\n\n\n p.Solve();\n p.io.Close();\n }\n }\n\n class MyIo\n {\n char[] separators = new char[] { ' ', '\\t' };\n\n#if TEST\n TextReader inputStream = new StreamReader(\"..\\\\..\\\\input.txt\");\n#else\n TextReader inputStream = System.Console.In;\n#endif\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(separators, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n outputStream.WriteLine(format, args);\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static List lucks = new List(){4,7};\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n long res = 0;\n while (true)\n {\n NextLucks();\n if(lucks.Count > 0 && lucks.Last() >= r)\n break;\n }\n lucks.Sort();\n int indexLuck = 0;\n for (int i = 0; i < lucks.Count; i++)\n {\n if(lucks[i] >= l)\n {\n indexLuck = i;\n break;\n }\n }\n \n for (int i = l; i <= r; i++)\n {\n var last = Math.Min(lucks[indexLuck], r);\n res += (long)lucks[indexLuck++] * (last - i + 1);\n i = last;\n }\n\n Console.WriteLine(res);\n }\n\n private static void NextLucks()\n {\n var l1 = lucks[lucks.Count - 2];\n var l2 = lucks[lucks.Count - 1];\n var n = l1*10 + 4;\n lucks.Add(n);\n n = l1*10 + 7;\n lucks.Add(n);\n n = l2*10 + 4;\n lucks.Add(n);\n n = l2*10 + 7;\n lucks.Add(n);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n int luck4 = 0;\n int luck7 = 0;\n long res = 0;\n var lucks = new List();\n while (true)\n {\n luck4 = NextLuck(luck4, 4);\n luck7 = NextLuck(luck7, 7);\n if(luck4 >= l)\n lucks.Add(luck4);\n if(luck7 >= l)\n lucks.Add(luck7);\n \n if(luck4 > r && luck7 > r)\n break;\n }\n lucks.Sort();\n int indexLuck = 0;\n for (int i = l; i <= r; i++)\n {\n res += (long)lucks[indexLuck] * (lucks[indexLuck] - i + 1);\n i = lucks[indexLuck++];\n }\n\n Console.WriteLine(res);\n }\n\n private static int NextLuck(int luck, int n)\n {\n return luck*10 + n;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n static void Main()\n {\n var input = Console.ReadLine();\n var l = ReadNextInt(input, 0);\n var r = ReadNextInt(input, 1);\n\n int luck4 = 0;\n int luck7 = 0;\n long res = 0;\n var lucks = new List();\n while (true)\n {\n luck4 = NextLuck(luck4, 4);\n luck7 = NextLuck(luck7, 7);\n if(luck4 >= l)\n lucks.Add(luck4);\n if(luck7 >= l)\n lucks.Add(luck7);\n \n if(luck4 > r && luck7 > r)\n break;\n }\n lucks.Sort();\n int indexLuck = 0;\n for (int i = l; i <= r; i++)\n {\n var last = Math.Min(lucks[indexLuck], r);\n res += (long)lucks[indexLuck++] * (last - i + 1);\n i = last;\n }\n\n Console.WriteLine(res);\n }\n\n private static int NextLuck(int luck, int n)\n {\n return luck*10 + n;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class C\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int l = int.Parse(token[0]);\n int r = int.Parse(token[1]);\n \n List li = new List ();\n\t\t li.Add (4);\n\t li.Add (7);\n\t int last = 0;\n\t\t int num = 2;\n\t\t bool stop = false;\n\t \twhile (true) {\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"4\" + li [i];\n \t\t\t\tif (temp.Length >= 11) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (long.Parse (temp));\n \t\t\t}\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"7\" + li [i];\n \t\t\t\tif (temp.Length >= 11) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (long.Parse (temp));\n \t\t\t}\n \t\t\tlast = num;\n \t\t\tnum *= 2;\n \t\t\tif (stop) {\n \t\t\t\tbreak;\n \t\t\t}\n\t \t}\n\t\tli.Sort ();\n long ans = 0;\n int cnt = 0;\n for (int i = 0; i < li.Count; i++)\n {\n if(li[i] >= l)\n {\n cnt = i;\n break;\n }\n }\n \n for (long i = l; i <= r; i++)\n {\n var last2 = Math.Min(li[cnt], r);\n ans += (long)li[cnt++] * (last2 - i + 1);\n i = last2;\n }\n \n Console.WriteLine(ans);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{ \n class B\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n int l = int.Parse(token[0]);\n int r = int.Parse(token[1]);\n \n List li = new List ();\n\t\t li.Add (4);\n\t li.Add (7);\n\t int last = 0;\n\t\t int num = 2;\n\t\t bool stop = false;\n\t \twhile (true) {\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"4\" + li [i];\n \t\t\t\t\tif (temp.Length >= 10) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (int.Parse (temp));\n \t\t\t}\n \t\t\tfor (int i = last; i < num; i++) {\n \t\t\t\tstring temp = \"7\" + li [i];\n \t\t\t\tif (temp.Length >= 10) {\n \t\t\t\t\tstop = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tli.Add (int.Parse (temp));\n \t\t\t}\n \t\t\tlast = num;\n \t\t\tnum *= 2;\n \t\t\tif (stop) {\n \t\t\t\tbreak;\n \t\t\t}\n\t \t}\n\t\tli.Sort ();\n int ans = 0;\n int cnt = 1;\n for(int i=0;i<=l;i++){\n if(li[cnt]==i)\n cnt++;\n }\n for(int i=l;i<=r;i++)\n {\n ans += li[cnt-1];\n if(i==li[cnt-1])cnt++;\n }\n Console.WriteLine(ans);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n if (a < b)\n {\n long t = a;\n a = b;\n b = t;\n }\n return (b > 0) ? gcd(b, a % b) : a;\n }\n static void _235A()\n {\n long n = long.Parse(reader.ReadLine()), ans = n * (n - 1);\n if (n < 3)\n ans = n;\n else if (n % 2 == 1)\n ans *= n - 2;\n else\n {\n long t = (n - 2) / 2;\n for (long i = n - 3; i > (n - 2) / 2; --i)\n {\n long g = gcd(n, i);\n if (g == 1)\n t = Math.Max(t, i);\n }\n ans *= t;\n }\n writer.Write(Math.Max(ans, (n - 1) * (n - 2) * (n - 3)));\n }\n static void _106C()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), c0 = int.Parse(s[2]), d0 = int.Parse(s[3]);\n int[] a = new int[m + 1], b = new int[m + 1], c = new int[m + 1], d = new int[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n s = reader.ReadLine().Split();\n a[i] = int.Parse(s[0]);\n b[i] = int.Parse(s[1]);\n c[i] = int.Parse(s[2]);\n d[i] = int.Parse(s[3]);\n }\n int[,] dp = new int[m + 1, n + 1];\n for (int i = 1; i * c0 <= n; ++i)\n dp[0, i * c0] = i * d0;\n for (int i = 1; i <= m; ++i)\n {\n for (int j = 1; j <= n; ++j)\n {\n if (j < c[i])\n dp[i, j] = dp[i - 1, j];\n else\n {\n for (int k = 0; k * b[i] <= a[i]; ++k)\n {\n int t = c[i] * k;\n if (t <= j)\n dp[i, j] = Math.Max(d[i] * k + dp[i - 1, j - t], dp[i, j]);\n }\n }\n dp[i, j] = Math.Max(dp[i, j - 1], dp[i, j]);\n }\n }\n writer.Write(dp[m, n]);\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) != 0)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _300C()\n {\n string[] s = reader.ReadLine().Split();\n long a = long.Parse(s[0]), b = long.Parse(s[1]), n = long.Parse(s[2]);\n if (a > b)\n {\n long t = a;\n a = b;\n b = t;\n }\n long[] fact = new long[n + 1];\n fact[0] = fact[1] = 1;\n long mod = 1000000007;\n for (long i = 2; i <= n; ++i)\n fact[i] = fact[i - 1] * i % mod;\n long an = n, bn = 0;\n long ans = 0;\n while (an >= 0)\n {\n long num = an * a + bn * b;\n bool ok = true;\n for (long p = 10; ok && p <= 10000000; p *= 10)\n {\n long t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n long c = (((fact[n] * pow(fact[an], mod - 2, mod)) % mod) * pow(fact[bn], mod - 2, mod)) % mod;\n ans += c;\n ans %= mod;\n }\n --an;\n ++bn;\n }\n writer.Write(ans);\n }\n static void _250B()\n {\n string s = reader.ReadLine();\n int n = int.Parse(s);\n for (int i = 0; i < n; ++i)\n {\n s = reader.ReadLine();\n string[] ip = new string[8];\n int nums = 0;\n for (int l = 0, j = 0; j < s.Length; ++j)\n {\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n //ip[l] = \"\";\n for (int k = j - nums; k < j; ++k)\n ip[l] += s[k];\n ++l;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n nums = 0;\n //if (ip[7] == null)\n {\n for (int r = 7, j = s.Length - 1; j >= 0; --j)\n {\n if (ip[r] != null)\n break;\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n for (int k = j + 1; k <= j + nums; ++k)\n ip[r] += s[k];\n --r;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n }\n for (int j = 0; j < 8; ++j)\n {\n if (ip[j] == null)\n ip[j] = \"\";\n while (ip[j].Length < 4)\n ip[j] = '0' + ip[j];\n }\n for (int j = 0; j < 7; ++j)\n writer.Write(ip[j]+':');\n writer.WriteLine(ip[7]);\n }\n }\n static void _316B2()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), x = int.Parse(s[1]);\n s = reader.ReadLine().Split();\n Dictionary queue = new Dictionary();\n LinkedList undef = new LinkedList();\n for (int i = 1; i <= n; ++i)\n {\n int h = int.Parse(s[i - 1]);\n if (h > 0)\n queue.Add(h, i);\n else\n undef.AddLast(i);\n }\n int[] lens = new int[undef.Count];\n int c = 0, index = 0;\n foreach (int v in undef)\n {\n int next = v;\n lens[c] = 1;\n while (true)\n {\n if (next == x)\n {\n index = lens[c];\n lens[c] = 0;\n break;\n }\n if (queue.ContainsKey(next))\n {\n next = queue[next];\n ++lens[c];\n }\n else\n break;\n }\n ++c;\n }\n bool[,] dp = new bool[2, n + 1];\n dp[0,0] = true;\n for (int i = 0; i < lens.Length; ++i)\n {\n if (lens[i] > 0)\n {\n dp[1,lens[i]] = true;\n for (int j = 1; j + lens[i] <= n; ++j)\n {\n if (dp[0,j])\n {\n dp[1, j + lens[i]] = true;\n }\n }\n for (int j = 1; j <= n; ++j)\n {\n dp[0, j] = dp[0, j] || dp[1, j];\n dp[1, j] = false;\n }\n }\n }\n for (int i = 0; i <= n; ++i)\n if (dp[0,i])\n writer.WriteLine(i + index);\n }\n static void _121A()\n {\n string[] lr = reader.ReadLine().Split();\n int l = int.Parse(lr[0]), r = int.Parse(lr[1]);\n SortedSet set = new SortedSet();\n set.Add(4);\n set.Add(7);\n for (int p = 10; p < 1000000000; p *= 10)\n {\n SortedSet s = new SortedSet(set);\n foreach (int e in s)\n {\n if (e / (p / 10) > 0)\n {\n set.Add(e + p * 4);\n set.Add(e + p * 7);\n }\n }\n }\n while (set.ElementAt(0) < l)\n set.Remove(set.ElementAt(0));\n int max = set.Max;\n while (set.Max > r)\n {\n max = set.Max;\n set.Remove(set.Max);\n }\n if (set.Max < r)\n set.Add(max);\n int[] happy = new int[set.Count];\n int c = 0;\n foreach (int e in set)\n happy[c++] = e;\n int min = set.Min;\n long sum = 0;\n if (happy.Length == 1)\n sum = (r - l + 1) * happy[0];\n else\n {\n sum = min * (min - l + 1) + max * (r - max + 1);\n }\n for (int i = 1; i < happy.Length; ++i)\n sum += (happy[i] - happy[i - 1] - 1) * happy[i];\n writer.Write(sum);\n }\n static void Main(string[] args)\n {\n //_235A();\n //_106C();\n //_300C();\n //_250B();\n //_316B2();\n _121A();\n reader.Close();\n writer.Close();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n if (a < b)\n {\n long t = a;\n a = b;\n b = t;\n }\n return (b > 0) ? gcd(b, a % b) : a;\n }\n static void _235A()\n {\n long n = long.Parse(reader.ReadLine()), ans = n * (n - 1);\n if (n < 3)\n ans = n;\n else if (n % 2 == 1)\n ans *= n - 2;\n else\n {\n long t = (n - 2) / 2;\n for (long i = n - 3; i > (n - 2) / 2; --i)\n {\n long g = gcd(n, i);\n if (g == 1)\n t = Math.Max(t, i);\n }\n ans *= t;\n }\n writer.Write(Math.Max(ans, (n - 1) * (n - 2) * (n - 3)));\n }\n static void _106C()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), m = int.Parse(s[1]), c0 = int.Parse(s[2]), d0 = int.Parse(s[3]);\n int[] a = new int[m + 1], b = new int[m + 1], c = new int[m + 1], d = new int[m + 1];\n for (int i = 1; i <= m; ++i)\n {\n s = reader.ReadLine().Split();\n a[i] = int.Parse(s[0]);\n b[i] = int.Parse(s[1]);\n c[i] = int.Parse(s[2]);\n d[i] = int.Parse(s[3]);\n }\n int[,] dp = new int[m + 1, n + 1];\n for (int i = 1; i * c0 <= n; ++i)\n dp[0, i * c0] = i * d0;\n for (int i = 1; i <= m; ++i)\n {\n for (int j = 1; j <= n; ++j)\n {\n if (j < c[i])\n dp[i, j] = dp[i - 1, j];\n else\n {\n for (int k = 0; k * b[i] <= a[i]; ++k)\n {\n int t = c[i] * k;\n if (t <= j)\n dp[i, j] = Math.Max(d[i] * k + dp[i - 1, j - t], dp[i, j]);\n }\n }\n dp[i, j] = Math.Max(dp[i, j - 1], dp[i, j]);\n }\n }\n writer.Write(dp[m, n]);\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) != 0)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _300C()\n {\n string[] s = reader.ReadLine().Split();\n long a = long.Parse(s[0]), b = long.Parse(s[1]), n = long.Parse(s[2]);\n if (a > b)\n {\n long t = a;\n a = b;\n b = t;\n }\n long[] fact = new long[n + 1];\n fact[0] = fact[1] = 1;\n long mod = 1000000007;\n for (long i = 2; i <= n; ++i)\n fact[i] = fact[i - 1] * i % mod;\n long an = n, bn = 0;\n long ans = 0;\n while (an >= 0)\n {\n long num = an * a + bn * b;\n bool ok = true;\n for (long p = 10; ok && p <= 10000000; p *= 10)\n {\n long t = num % p / (p / 10);\n if (t != a && t != b && (t != 0 || p <= num))\n ok = false;\n }\n if (ok)\n {\n long c = (((fact[n] * pow(fact[an], mod - 2, mod)) % mod) * pow(fact[bn], mod - 2, mod)) % mod;\n ans += c;\n ans %= mod;\n }\n --an;\n ++bn;\n }\n writer.Write(ans);\n }\n static void _250B()\n {\n string s = reader.ReadLine();\n int n = int.Parse(s);\n for (int i = 0; i < n; ++i)\n {\n s = reader.ReadLine();\n string[] ip = new string[8];\n int nums = 0;\n for (int l = 0, j = 0; j < s.Length; ++j)\n {\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n //ip[l] = \"\";\n for (int k = j - nums; k < j; ++k)\n ip[l] += s[k];\n ++l;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n nums = 0;\n //if (ip[7] == null)\n {\n for (int r = 7, j = s.Length - 1; j >= 0; --j)\n {\n if (ip[r] != null)\n break;\n if (s[j] == ':')\n {\n if (nums > 0)\n {\n for (int k = j + 1; k <= j + nums; ++k)\n ip[r] += s[k];\n --r;\n nums = 0;\n }\n else\n break;\n }\n else\n ++nums;\n }\n }\n for (int j = 0; j < 8; ++j)\n {\n if (ip[j] == null)\n ip[j] = \"\";\n while (ip[j].Length < 4)\n ip[j] = '0' + ip[j];\n }\n for (int j = 0; j < 7; ++j)\n writer.Write(ip[j]+':');\n writer.WriteLine(ip[7]);\n }\n }\n static void _316B2()\n {\n string[] s = reader.ReadLine().Split();\n int n = int.Parse(s[0]), x = int.Parse(s[1]);\n s = reader.ReadLine().Split();\n Dictionary queue = new Dictionary();\n LinkedList undef = new LinkedList();\n for (int i = 1; i <= n; ++i)\n {\n int h = int.Parse(s[i - 1]);\n if (h > 0)\n queue.Add(h, i);\n else\n undef.AddLast(i);\n }\n int[] lens = new int[undef.Count];\n int c = 0, index = 0;\n foreach (int v in undef)\n {\n int next = v;\n lens[c] = 1;\n while (true)\n {\n if (next == x)\n {\n index = lens[c];\n lens[c] = 0;\n break;\n }\n if (queue.ContainsKey(next))\n {\n next = queue[next];\n ++lens[c];\n }\n else\n break;\n }\n ++c;\n }\n bool[,] dp = new bool[2, n + 1];\n dp[0,0] = true;\n for (int i = 0; i < lens.Length; ++i)\n {\n if (lens[i] > 0)\n {\n dp[1,lens[i]] = true;\n for (int j = 1; j + lens[i] <= n; ++j)\n {\n if (dp[0,j])\n {\n dp[1, j + lens[i]] = true;\n }\n }\n for (int j = 1; j <= n; ++j)\n {\n dp[0, j] = dp[0, j] || dp[1, j];\n dp[1, j] = false;\n }\n }\n }\n for (int i = 0; i <= n; ++i)\n if (dp[0,i])\n writer.WriteLine(i + index);\n }\n static void _121A()\n {\n string[] lr = reader.ReadLine().Split();\n int l = int.Parse(lr[0]), r = int.Parse(lr[1]);\n SortedSet set = new SortedSet();\n set.Add(4);\n set.Add(7);\n for (int p = 10; p < 1000000000; p *= 10)\n {\n SortedSet s = new SortedSet(set);\n foreach (int e in s)\n {\n if (e / (p / 10) > 0)\n {\n set.Add(e + p * 4);\n set.Add(e + p * 7);\n }\n }\n }\n while (set.ElementAt(0) < l)\n set.Remove(set.ElementAt(0));\n int max = set.Max;\n while (set.Max > r)\n {\n max = set.Max;\n set.Remove(set.Max);\n }\n if (set.Max < r)\n set.Add(max);\n else\n max = set.Max;\n int[] happy = new int[set.Count];\n int c = 0;\n foreach (int e in set)\n happy[c++] = e;\n int min = set.Min;\n long sum = 0;\n if (happy.Length == 1)\n sum = (r - l + 1) * happy[0];\n else\n {\n sum = min * (min - l + 1) + max * (r - max + 1);\n }\n for (int i = 1; i < happy.Length; ++i)\n sum += (happy[i] - happy[i - 1] - 1) * happy[i];\n writer.Write(sum);\n }\n static void Main(string[] args)\n {\n //_235A();\n //_106C();\n //_300C();\n //_250B();\n //_316B2();\n _121A();\n reader.Close();\n writer.Close();\n }\n}"}], "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesTest.Round278\n{\n class GigaTower\n {\n public static void Main(string[] args)\n {\n Run();\n Console.ReadLine();\n }\n\n static void Run()\n {\n var input = Console.ReadLine();\n Int64 a = Convert.ToInt64(input);\n int res = 0;\n while (true)\n {\n res++;\n Int64 i = ++a;\n if (i.ToString().Contains('8'))\n {\n Console.WriteLine(res);\n return;\n }\n }\n }\n\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace Giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inicio = int.Parse(Console.ReadLine());\n\n\n for (int i = 0; i <=16 ; i++)\n {\n if ((inicio + i).ToString().Contains('8') && i!=0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n i++;\n n++;\n int j,temp = Math.Abs(n);\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n }\n Console.Write(i);\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Giga_Tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = 1;\n int z = n + 1;\n string x = Convert.ToString(z);\n while(true)\n {\n if(x.Contains('8'))\n {\n break;\n }\n else\n {\n sum++;\n z += 1;\n x = Convert.ToString(z);\n }\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Olimp2._1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n Int64 k = Int64.Parse(Console.ReadLine());\n int n = 0;\n bool p = false;\n for (; ; )\n {\n p = false;\n s = k.ToString();\n for (int i = 0; i < s.Length; i++)\n if (s[i] == '8')\n p = true;\n if ((p) && (n > 0))\n break;\n k++;\n n++;\n }\n Console.WriteLine(n.ToString());\n\n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();//Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r'}, StringSplitOptions.RemoveEmptyEntries);\n if (input[0] == '-')\n {\n if (input.Length == 2 && input[1] != '9')\n Console.WriteLine((input[1] - 40));\n else\n {\n int a = input.IndexOf('8');\n if(a>=0)\n {\n if (a == input.Length - 1)\n {\n a = input.LastIndexOf('9');\n if (a == -1) Console.WriteLine(\"10\");\n else\n {\n for (int i = a + 1, lim = input.Length - 1; i < lim; ++i)\n if (input[i] != '0') a = -1;\n Console.WriteLine(a >= 0 ? \"9\" : \"10\");\n }\n }\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '0') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ? '2' : '1');\n }\n }\n else\n {\n a = input.LastIndexOf('9');\n if (a < 0) Console.WriteLine(input[input.Length - 1]-46);\n else\n {\n if (input.Length - 1 == a) Console.WriteLine('1');\n else\n {\n for (int i = a + 1, lim = input.Length-1; i < lim; ++i)\n {\n if (input[i] != '0') { a = -1; break; }\n }\n Console.WriteLine(a ==input.Length-1? \"1\" : a>=0? (input[input.Length - 1] - 47).ToString(): (input[input.Length - 1] - 46).ToString());\n }\n }\n }\n }\n }\n else\n {\n int a = input.IndexOf('8');\n if(a>=0)\n {\n if(a==input.Length-1)\n {\n a = input.LastIndexOf('7');\n if (a == -1) Console.WriteLine(\"10\");\n else\n {\n for (int i = a + 1, lim = input.Length - 1; i < lim; ++i)\n if (input[i] != '9') a = -1;\n Console.WriteLine(a >= 0 ? \"2\" : \"10\");\n }\n }\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '9') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ?'9':'1');\n }\n }\n else\n {\n a = input.LastIndexOf('7');\n if (a < 0) Console.WriteLine(input[input.Length - 1] == '9' ? 9 : 56 - input[input.Length - 1]);\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '9') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ? \"1\" : (56-input[input.Length-1]).ToString());\n }\n }\n }\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace Question1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n long input = long.Parse(str);\n long count = 0;\n\n do\n {\n input++;\n str = input.ToString();\n count++;\n } while (!str.Contains(\"8\"));\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine());\n int a = 1;\n while (Eight(n+a)==0)\n {\n a++;\n }\n Console.WriteLine(a.ToString());\n \n }\n private static int Eight(long n)\n {\n if (n<0)\n {\n n = -n;\n }\n while (n!=0)\n {\n if (n%10==8)\n {\n return 1;\n }\n n = n / 10;\n }\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n\n public void Solve()\n {\n var a= sc.Long();\n for (int i = 1; true; i++)\n {\n a++;\n if(a.ToString().Any(x=>x=='8'))\n {\n IO.Printer.Out.WriteLine(i);\n return;\n }\n }\n\t\t\t\t \n }\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n }\n}\n#endregion\n#region BinarySearch for Array\nstatic public partial class Algorithm\n{\n\n static private int binarySearch(this T[] a, int idx, int len, T v, Comparison cmp, bool islb)\n {\n int l = idx;\n int h = idx + len - 1;\n while (l <= h)\n {\n int i = l + ((h - l) >> 1);\n int ord;\n if (a[i] == null || v == null) return -1;\n else ord = cmp(a[i], v);\n if (ord < 0) l = i + 1;\n else if (ord == 0)\n {\n if (!islb) l = i + 1;\n else h = i - 1;\n }\n else h = i - 1;\n }\n\n return l;\n }\n static public int UpperBound(this T[] a, int idx, int len, T v, Comparison cmp) { return binarySearch(a, idx, len, v, cmp, false); }\n static public int UpperBound(this T[] a, int idx, int len, T v) where T : IComparable { return UpperBound(a, idx, len, v, Comparer.Default.Compare); }\n static public int UpperBound(this T[] a, T v) where T : IComparable { return UpperBound(a, 0, a.Length, v, Comparer.Default.Compare); }\n static public int UpperBound(this T[] a, T v, IComparer cmp) { return UpperBound(a, 0, a.Length, v, cmp.Compare); }\n static public int UpperBound(this T[] a, T v, Comparison cmp) { return UpperBound(a, 0, a.Length, v, cmp); }\n\n static public int LowerBound(this T[] a, int idx, int len, T value, Comparison cmp) { return binarySearch(a, idx, len, value, cmp, true); }\n static public int LowerBound(this T[] a, int idx, int len, T value) where T : IComparable { return LowerBound(a, idx, len, value, Comparer.Default.Compare); }\n static public int LowerBound(this T[] a, T val) where T : IComparable { return LowerBound(a, 0, a.Length, val, Comparer.Default.Compare); }\n static public int LowerBound(this T[] a, T val, IComparer cmp) { return LowerBound(a, 0, a.Length, val, cmp.Compare); }\n static public int LowerBound(this T[] a, T v, Comparison cmp) { return LowerBound(a, 0, a.Length, v, cmp); }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = int.Parse(Console.ReadLine());\n\n var ans = 0;\n\n for (int i = 1; i <= 16; i++)\n {\n if ((start + i).ToString().Contains('8'))\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A488\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = Convert.ToInt64(Console.ReadLine());\n long b = 1;\n\n for (long i = a + 1; i < 8888888888; i++) {\n \n if (i.ToString().Contains(\"8\"))\n break;\n b++;\n }\n Console.Write(b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.Remoting.Services;\nusing System.Text;\nusing System.Xml.Linq;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n private static void Main(string[] args)\n {\n var s = int.Parse(Console.ReadLine())+1;\n var a = 1;\n\n while (!(c(s, 8)))\n {\n a++;\n s++;\n }\n\n Console.WriteLine(a);\n }\n\n static bool c(int a, int x)\n {\n a = Math.Abs(a);\n\n if (a == x) return true;\n\n while (a>0)\n {\n if (a%10 == x) return true;\n a /= 10;\n }\n\n return false;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication33\n{\n class Program\n {\n static void Main(string[] args)\n {\n long input = Int64.Parse(Console.ReadLine());\n string chislo = Convert.ToString(input);\n long count = 0;\n Boolean isFind = false;\n do\n {\n input++;\n count++;\n chislo = Convert.ToString(input);\n for (int i = 0; i < chislo.Length; i++)\n {\n if (chislo[i] == '8') { isFind = true; break; }\n }\n } while (isFind != true);\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.Remoting.Services;\nusing System.Text;\nusing System.Xml.Linq;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n private static void Main(string[] args)\n {\n var s = int.Parse(Console.ReadLine());\n var a = 0;\n\n while (true)\n {\n a++;\n s++;\n if (s.ToString().Contains('8')) break;\n }\n\n Console.WriteLine(a);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.Remoting.Services;\nusing System.Text;\nusing System.Xml.Linq;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n private static void Main(string[] args)\n {\n var s = int.Parse(Console.ReadLine());\n var a = 0;\n\n while (true)\n {\n a++;\n s++;\n if (c(s, 8)) break;\n }\n\n Console.WriteLine(a);\n }\n\n static bool c(int a, int x)\n {\n a = Math.Abs(a);\n\n if (a == x) return true;\n\n while (a>0)\n {\n if (a%10 == x) return true;\n a /= 10;\n }\n\n return false;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication33\n{\n class Program\n {\n static void Main(string[] args)\n {\n long input = Int64.Parse(Console.ReadLine());\n string chislo = Convert.ToString(input);\n long c = 0;\n Boolean isFind = false;\n do\n {\n input++;\n c++;\n chislo = Convert.ToString(input);\n for (int i = 0; i < chislo.Length; i++)\n {\n if (chislo[i] == '8') { isFind = true; break; }\n }\n } while (isFind != true);\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "using System;\n\nclass A488 {\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n var m = n + 1;\n while (m.ToString().IndexOf('8') == -1) ++m;\n Console.WriteLine(m - n);\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_A_278\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long a = long.Parse(s) + 1, b=1;\n s = a.ToString();\n bool c = false;\n while(!(c))\n {\n c = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '8')\n {\n c = true;\n break;\n }\n }\n if (!(c))\n {\n b++;\n a++;\n s = a.ToString();\n }\n }\n Console.WriteLine(b);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace sertree\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int f = int.Parse(Console.ReadLine());\n \n for (int i = f+1; i < f+1100; i++) {\n if(i.ToString().Contains(\"8\"))\n {\n Console.Write(i-f);\n break;\n }\n }\n \n// \n// Console.Write(\"Press any key to continue . . . \");\n// Console.ReadKey(true);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _278_Task_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(Console.ReadLine());\n string arr = Convert.ToString(a);\n int count = 0;\n Boolean check = false;\n do\n {\n a++;\n count++;\n arr = Convert.ToString(a);\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] == '8') { check = true; break; }\n }\n } while (check != true);\n Console.WriteLine(count);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Giga_Tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num_A = int.Parse(Console.ReadLine()) + 1;\n int num_B = 1;\n while (!num_A.ToString().Contains(\"8\"))\n {\n num_B++;\n num_A++;\n } \n Console.WriteLine(num_B);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Giga_Tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int sum = 1;\n int z = n + 1;\n string x = Convert.ToString(z);\n while(true)\n {\n if(x.Contains('8'))\n {\n break;\n }\n else\n {\n sum++;\n z += 1;\n x = Convert.ToString(z);\n }\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Giga_Tower\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int a = Next();\n int c = 0;\n do\n {\n a++;\n c++;\n } while (!a.ToString().Contains(\"8\"));\n\n writer.WriteLine(c);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static int Main()\n\t{\n\t long a=long.Parse(Console.ReadLine());\n\t \n\t \n\t int count=0;\n\t while(true)\n\t {\n\t \ta++;\n\t \tcount++;\n\t \tif(ce(a))\n\t \t{\n\t \t\tConsole.WriteLine(count);\n\t \t\treturn 0;\n\t \t\n\t \t}\n\t \t\n\t }\n\t\n\t }\n\t \n\t \n\t\n\tpublic static bool ce(long a)\n\t{\n\t\tstring s=a.ToString();\n\t\tint flag=0;\n\t\tfor(int i=0;i c == '8'))\n {\n Console.WriteLine(b);\n return;\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static bool lucky(int n) {\n if (n < 0) {\n n = -n;\n }\n bool ans = false;\n while (n > 0) {\n if (n % 10 == 8) {\n ans = true;\n break;\n }\n n /= 10;\n }\n return ans;\n }\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int b = 1;\n while (true) {\n if (lucky(n + b)) {\n break;\n }\n b++;\n }\n Console.Write(b);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication33\n{\n class Program\n {\n static void Main(string[] args)\n {\n long b = Int64.Parse(Console.ReadLine());\n string r = Convert.ToString(b);\n int count = 0;\n Boolean isTrue = false;\n do\n {\n b++;\n count++;\n r = Convert.ToString(b);\n for (int i = 0; i < r.Length; i++)\n {\n if (r[i] == '8') { isTrue = true; break; }\n }\n } while (isTrue != true);\n Console.WriteLine(count);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_GigaTower\n{\n class Program\n {\n static void Main(string[] args)\n {\n long t = long.Parse(Console.ReadLine());\n t = t + 1;\n int count = 1;\n while(!t.ToString().Contains('8'))\n {\n t++;\n count++;\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Task_TD\n{\n\n class Program\n {\n\n public const int Diff = 20;\n\n static void Main(string[] args)\n {\n\n long a = Int64.Parse(Console.ReadLine());\n\n Console.WriteLine(GetResult(a));\n\n Console.ReadLine();\n }\n\n\n static long GetResult(long a)\n { \n long high = a + Diff;\n for (long i = a + 1; i < high; i++)\n {\n if (ContainsEight(i))\n return i - a;\n }\n\n return -1;\n }\n\n static bool ContainsEight(long number)\n {\n if (number < 0)\n number = -number;\n\n while (number > 0)\n {\n if (number % 10 == 8)\n return true;\n\n number = number / 10;\n }\n\n return false;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication33\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = Int64.Parse(Console.ReadLine());\n string chislo = Convert.ToString(a);\n int count = 0;\n Boolean isTrue = false;\n do\n {\n a++;\n count++;\n chislo = Convert.ToString(a);\n for (int i = 0; i < chislo.Length; i++)\n {\n if (chislo[i] == '8') { isTrue = true; break; }\n }\n } while (isTrue != true);\n Console.WriteLine(count);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _2016_08_23_giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n //http://codeforces.com/contest/488/problem/A\n\n int floor = Convert.ToInt32(Console.ReadLine());\n \n int steps = 0;\n bool containsEight = false;\n\n while (containsEight == false) \n {\n floor++;\n steps++;\n containsEight = floor.ToString().Contains(\"8\");\n } \n \n Console.WriteLine(steps);\n\n }\n }\n}\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n\n count = 0;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i++)\n {\n\n int num = Math.Abs(i);\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n if (n >= 0)\n {\n for (int i = n; i <= i + 10; i++)\n {\n\n int num = i;\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.Numerics;\nusing System.Threading;\nusing System.Diagnostics;\n\nnamespace StudyCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long stage, result = 0;\n byte[] Astage = {0};\n string buf;\n bool found = false;\n stage = Convert.ToInt32(Console.ReadLine());\n while (found == false)\n {\n stage++;\n result++;\n buf = stage.ToString();\n Astage = ArrCharToArrByte(buf, Astage);\n for (int i = 0; i < Astage.Length; i++)\n if (Astage[i]==8)\n {\n found = true;\n break;\n }\n }\n Console.WriteLine(result);\n }\n\n static byte[] ArrCharToArrByte(string buf, byte[] stage)\n {\n stage = new byte[buf.Length];\n for (int i = 0; i < buf.Length; i++)\n Byte.TryParse(buf[i].ToString(), out stage[i]);\n return stage;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.Numerics;\nusing System.Threading;\nusing System.Diagnostics;\n\nnamespace StudyCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long stage, result = 0;\n byte[] Astage = {0};\n string buf;\n bool found = false;\n stage = Convert.ToInt32(Console.ReadLine());\n while (found == false && result <= 20)\n {\n stage++;\n result++;\n buf = stage.ToString();\n Astage = ArrCharToArrByte(buf, Astage);\n for (int i = 0; i < Astage.Length; i++)\n if (Astage[i]==8)\n {\n found = true;\n break;\n }\n }\n Console.WriteLine(result);\n }\n\n static byte[] ArrCharToArrByte(string buf, byte[] stage)\n {\n stage = new byte[buf.Length];\n for (int i = 0; i < buf.Length; i++)\n Byte.TryParse(buf[i].ToString(), out stage[i]);\n return stage;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n class Program\n {\n static bool f(string s)\n {\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '8') return true;\n }\n return false;\n }\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int i = n+1;\n while (!f(i.ToString()))\n {\n i++;\n }\n Console.WriteLine(Math.Abs(i-n));\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tlong n = Convert.ToInt64(Console.ReadLine());\n\t\tint b=0;\n\t\tbool vodsem = true;\n\t\twhile (vodsem)\n\t\t{\n\t\t\tb++;\n\t\t\tlong xex = b+n;\n\t\t while (Math.Abs(xex)>0)\n\t\t {\n\t\t \tif(Math.Abs(xex)%10==8) vodsem=false;\n\t\t \txex/=10;\n\t\t }\n\t\t}\n\t\tConsole.WriteLine(b);\n\t}\n}\t\t"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bashnya\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n Int64 k = Int64.Parse(Console.ReadLine());\n int n = 0;\n bool p = false;\n for (; ; )\n {\n p = false;\n s = k.ToString();\n for (int i = 0; i < s.Length; i++)\n if (s[i] == '8')\n p = true;\n if ((p)&&(n>0))\n break;\n k++;\n n++;\n }\n Console.WriteLine(n.ToString());\n\n }\n }\n}\n"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n * Date: 02.02.2016\n * Time: 21-30\n *\n * \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 4\n\nA. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd \ufffd\ufffd\ufffd 17,777,777,777 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd,\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd -8,888,888m888 \ufffd\ufffd 8,888,888,888. \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd -1 \ufffd 1 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 0.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd8\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 8,888,888,888 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd),\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd8\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, 8, -180, 808 \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd 42, -10 \ufffd \ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd #278 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd?).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd a.\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd b, \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd,\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd a (?-?10^9???a???10^9).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd b.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n179\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n-1\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n9\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n18\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n10\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 180.\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd 8.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd 10, \ufffd \ufffd\ufffd 0.\n\n-410058385\n\n */\n\n\nusing System;\n\nclass Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tint nn = n;\n\n\t\tfor ( n++; ; n++ )\n\t\t{\n\t\t\tint m = Math.Abs (n);\n//\t\t\tConsole.WriteLine (m);\n\t\t\tbool ok = false;\n\t\t\twhile ( m > 0 )\n\t\t\t{\n\t\t\t\tif ( m % 10 == 8 )\n\t\t\t\t{\n\t\t\t\t\tok = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tm /= 10;\n\t\t\t}\n\t\t\tif ( ok )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tConsole.WriteLine (n - nn);\n//\t\tConsole.ReadKey (true);\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace zero_and_one\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n for (long i = 1; i < 100000000; i++)\n {\n n++;\n string s = n.ToString();\n if (s.Contains('8'))\n {\n Console.WriteLine(i);\n break;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = a + 1;\n while (!b.ToString().Contains(\"8\")) b++;\n Console.WriteLine(b - a);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n long input = Int64.Parse(Console.ReadLine());\n long res = 0;\n for(long i = input+1; i <= 8888888888; i++)\n {\n if (i.ToString().Contains(\"8\"))\n {\n res += i-input;\n break;\n }\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n long number = long.Parse(Console.ReadLine());\n long i = 0;\n if (number.ToString().Contains('8'))\n {\n number++;\n i = 1;\n }\n while (!number.ToString().Contains('8'))\n {\n i++;\n number++;\n \n }\n\n Console.WriteLine(i);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Gigatower {\n class Program{\n public static int Main() {\n Int64 current_floor = Convert.ToInt64(Console.ReadLine());\n Int64 up_floors = 0;\n string buffer = \"\";\n while (true) {\n current_floor++;\n up_floors++;\n buffer = current_floor.ToString();\n if (buffer.Contains(\"8\")) {\n break;\n }\n }\n Console.WriteLine(up_floors);\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Giga_Tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n int andar = int.Parse(Console.ReadLine());\n int NiveisSubidos = Operacao.VerificaNumero(andar, andar, 0);\n Console.WriteLine(NiveisSubidos);\n\n }\n\n }\n\n\n static class Operacao\n {\n public static int VerificaNumero(int a, int b, int contador)\n {\n\n\n string compara = Convert.ToString(a);\n if (compara.Contains(\"8\") && a == b)\n {\n contador++;\n return VerificaNumero(a + 1, b, contador);\n }\n else if (compara.Contains(\"8\"))\n {\n return contador;\n }\n else\n {\n contador++;\n return VerificaNumero(a + 1, b, contador);\n }\n\n }\n }\n\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n long a = Next();\n int d = 1;\n while((a + d).ToString().IndexOf('8') == -1) {\n d++;\n }\n writer.Write(d);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static long Next() {\n long c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n long sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public object Solve()\n {\n int a = ReadInt();\n int b = a + 1;\n while (!b.ToString().Contains(\"8\"))\n b++;\n return b - a;\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"instruction.in\");\n //writer = new StreamWriter(\"instruction.out\");\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Team_BruteForce_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int andar = int.Parse( Console.ReadLine() );\n int NiveisSubidos = Operacao.VerificaNumero(andar, andar, 0);\n Console.WriteLine(NiveisSubidos);\n \n }\n\n }\n\n\n static class Operacao\n {\n public static int VerificaNumero(int a,int b, int contador)\n {\n\n\n string compara = Convert.ToString(a);\n if (compara.Contains(\"8\") && a == b)\n {\n contador++;\n return VerificaNumero(a + 1, b, contador);\n }\n else if (compara.Contains(\"8\"))\n {\n return contador;\n }\n else\n {\n contador++;\n return VerificaNumero(a + 1, b, contador);\n }\n\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n \n }\n \n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n\n\n static bool f(int n)\n {\n\n string s = n.ToString();\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '8')\n {\n return true;\n }\n }\n return false;\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n n++;\n int k = 1;\n while (true)\n {\n if (f(n))\n {\n Console.WriteLine(k);\n return;\n }\n n++;\n k++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace Giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inicio = int.Parse(Console.ReadLine());\n\n\n for (int i = 0; i <=16 ; i++)\n {\n if ((inicio + i).ToString().Contains('8') && i!=0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] mass = new long[17];\n for(int i = 0; i < 17; i++)\n {\n mass[i] = n + i;\n }\n for(int i = 1; i < mass.Count(); i++)\n {\n if (mass[i].ToString().Contains('8')) { Console.Write(i); return; }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n n++;\n\n string tmp;\n int counter = 0;\n char[] res;\n bool act = false;\n\n while (act != true)\n {\n tmp = n.ToString();\n res = tmp.ToCharArray();\n\n for (int i = 0; i < res.Length; i++)\n {\n if (res[i] == '8')\n {\n act = true;\n break;\n }\n }\n n++;\n counter++;\n }\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static bool check(long a)\n {\n if (a > 0)\n {\n while (a > 0)\n {\n if (a % 10 == 8)\n return true;\n a /= 10;\n }\n return false;\n }\n else\n {\n while (a < 0)\n {\n if (a % 10 == -8)\n return true;\n a /= 10;\n }\n return false;\n }\n }\n static void Main(string[] args)\n {\n long line = long.Parse(Console.ReadLine());\n long count=0;\n while (true)\n {\n line++;\n count++;\n if (check(line))\n {\n Console.WriteLine(count);\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Int32.Parse(Console.ReadLine());\n int n = 1000000000 * 2;\n for (int i = 1; i<=n; i++){\n if ((a + i).ToString().Contains(\"8\"))\n {\n Console.WriteLine(i);\n break;\n }\n }\n //for(int i=0;i<)\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = Convert.ToInt64(Console.ReadLine());\n string level;\n int counter = 0;\n Boolean Luck = false;\n while (Luck == false)\n {\n a++;\n counter++;\n level = Convert.ToString(a);\n for (int i = 0; i < level.Length; i++)\n {\n if (level[i] == '8')\n { Luck = true; }\n }\n }\n Console.WriteLine(counter);\n }\n }\n}"}, {"source_code": "using System;\n\n\n class MainClass\n {\n public static void Main(string[] args)\n { \n int res = 0;\n string s = Console.ReadLine ();\n do \n {\n res++;\n s = (Int64.Parse (s) + 1).ToString ();\n } while(s.IndexOf (\"8\") == -1) ;\n Console.WriteLine (res);\n }\n }"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static bool isLucky(long n)\n {\n while (n != 0)\n {\n if (Math.Abs(n % 10) == 8)\n {\n return true;\n }\n n /= 10;\n }\n return false;\n }\n static void Main()\n {\n long b = 0;\n var a = long.Parse(Console.ReadLine());\n a++;\n b++;\n while (!isLucky(a))\n {\n a++;\n b++;\n }\n Console.WriteLine(b);\n }\n}"}, {"source_code": "using System;\nnamespace CodeForces\n{\n public class A\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = Convert.ToInt64(s);\n n++;\n int ans = 1;\n while ((n+\"\").IndexOf('8') == -1)\n {\n n++; \n ans++;\n }\n Console.WriteLine(ans);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp14\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n for (long i = 1; i < 100000000; i++)\n {\n n++;\n string s = n.ToString();\n if (s.Contains('8'))\n {\n Console.WriteLine(i);\n break;\n }\n }\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces284\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*ulong n;\n ulong m;\n ulong b;\n string s = Console.ReadLine();\n char[] ch = s.ToCharArray();\n if (ch[0] == '-')\n {\n n = ulong.Parse(s);\n b = n;\n char[] bc = b.ToString().ToCharArray();\n while (bc[bc.Length - 1] != 8)\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n else\n {\n m = ulong.Parse(s);\n b = m;\n char[] bc = b.ToString().ToCharArray();\n while ((bc[bc.Length - 1] != 8)||(bc[0]=='-'))\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n Console.WriteLine(b);*/\n long n = long.Parse(Console.ReadLine());\n int k = 0;\n bool flag = true;\n char[] ch = n.ToString().ToCharArray();\n while (flag)\n {\n n++;\n k++;\n ch = n.ToString().ToCharArray();\n for (int i = 0; i < ch.Length; i++)\n { \n if (ch[i] == '8')\n flag = false;\n }\n \n }\n Console.WriteLine(k);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace a2oj\n{\n class Program\n {\n static bool cheight(int num)\n {\n while(num>0)\n {\n if (num % 10 != 8)\n num /= 10;\n else\n return true;\n }\n return false;\n }\n \n static void Main(string[] args)\n {\n int n;\n int t;\n n = int.Parse(Console.ReadLine());\n t=n;\n //List val = new List();\n //string s= Console.ReadLine();\n //string []all=s.Split(' ');\n //foreach(string st in all)\n //{\n // val.Add(int.Parse(st));\n //}\n if(n>-9)\n {\n n++;\n while (!cheight(n))\n n++;\n Console.WriteLine(n - t);\n }\n else\n {\n n = Math.Abs(n);\n n--;\n while (!cheight(n))\n n--;\n Console.WriteLine(-n - t);\n }\n \n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getInt();\n\t\t\tvar ans = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\tn++;\n\t\t\t\tvar q = Abs(n);\n\t\t\t\twhile (q != 0)\n\t\t\t\t{\n\t\t\t\t\tif (q % 10 == 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(ans);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tq /= 10;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace CFSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long a = long.Parse(Console.ReadLine()) + 1;\n long c = 1;\n while (!(a.ToString().Contains(\"8\"))){ a++; c++; }\n Console.Write(c);\n }\n \n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.Remoting.Services;\nusing System.Text;\nusing System.Xml.Linq;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n private static void Main(string[] args)\n {\n var s = int.Parse(Console.ReadLine());\n\n if (s < 0)\n {\n Console.WriteLine(Math.Abs(s)+8);\n }\n else\n {\n var a = 0;\n\n while (true)\n {\n a++;\n s++;\n if (s.ToString().Contains('8')) break;\n }\n\n Console.WriteLine(a);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace Giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inicio = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i <=16 ; i++)\n {\n if ((inicio + i).ToString().Contains('8'))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace Giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inicio = Convert.ToInt32(Console.ReadLine());\n var auxiliar = 0;\n\n for (int i = 0; i <=16 ; i++)\n {\n if ((inicio + i).ToString().Contains('8'))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n\n count = 0;\n for (int i = n; i <= 1000000000; i++)\n {\n\n int num = i;\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = Math.Abs(int.Parse(Console.ReadLine()));\n int count = 0;\n\n count = 0;\n for (int i = n; i <= 1000000000; i++)\n {\n\n int num = i;\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 1;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i--)\n {\n \n int num = i;\n while (num <0)\n {\n var digit = num % 10;\n if (digit == -8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n count++;\n if (check)\n break;\n \n }\n Console.Write(count);\n return;\n }\n if (n > 0)\n {\n for (int i = n; i <= 1000000000; i++)\n {\n \n int num = i;\n while (num > 0)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n count++;\n if (check)\n break;\n \n }\n Console.Write(count);\n return;\n }\n Console.Write(\"-1\");\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 1;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i--)\n {\n \n int num = i;\n while (num <0&&i 0)\n {\n count = 0;\n for (int i = n; i <= 1000000000; i++)\n {\n \n int num = i;\n while (num > 0&&i>n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n \n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n Console.Write(\"-1\");\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n\n count = 0;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i++)\n {\n\n int num = Math.Abs(i);\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n }\n if (n > 0)\n {\n for (int i = n; i <= i + 10; i++)\n {\n\n int num = i;\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 1;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i--)\n {\n \n int num = i;\n while (num <0)\n {\n var digit = num % 10;\n if (digit == -8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n count++;\n if (check)\n break;\n \n }\n Console.Write(count);\n return;\n }\n if (n > 0)\n {\n count = 0;\n for (int i = n; i <= 1000000000; i++)\n {\n \n int num = i;\n while (num > 0)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n \n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n Console.Write(\"-1\");\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n\n count = 0;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i++)\n {\n\n int num = Math.Abs(i);\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n if (n > 0)\n {\n for (int i = n; i <= i + 10; i++)\n {\n\n int num = i;\n while (num > 0 && i > n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n\n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Lap\n{\n public int P;\n public int Q;\n\n}\nclass GFG\n{\n static string[] memo = new string[13];\n\n public static void Main()\n {\n bool check = false;\n var n = int.Parse(Console.ReadLine());\n int count = 0;\n if (n < 0)\n {\n for (int i = n; i <= 1000000000; i--)\n {\n \n int num = i;\n while (num <0&&i 0)\n {\n count = 0;\n for (int i = n; i <= 1000000000; i++)\n {\n \n int num = i;\n while (num > 0&&i>n)\n {\n var digit = num % 10;\n if (digit == 8)\n {\n check = true;\n break;\n }\n num = num / 10;\n }\n \n if (check)\n break;\n count++;\n\n }\n Console.Write(count);\n return;\n }\n Console.Write(\"-1\");\n }\n\n\n}\n\n\n\n\n\n\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tlong n = Convert.ToInt64(Console.ReadLine());\n\t\tint b=0;\n\t\tbool vodsem = true;\n\t\twhile (vodsem)\n\t\t{\n\t\t\tb++;\n\t\t\tlong xex = b+n;\n\t\t while (xex>0)\n\t\t {\n\t\t \tif(xex%10==8) vodsem=false;\n\t\t \txex/=10;\n\t\t }\n\t\t}\n\t\tConsole.WriteLine(b);\n\t}\n}\t\t"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n * Date: 02.02.2016\n * Time: 21-30\n *\n * \n\nA. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd \ufffd\ufffd\ufffd 17,777,777,777 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd,\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd -8,888,888m888 \ufffd\ufffd 8,888,888,888. \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd -1 \ufffd 1 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 0.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd8\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 8,888,888,888 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd),\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd8\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, 8, -180, 808 \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd 42, -10 \ufffd \ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd (\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd #278 \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd?).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd a.\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd b, \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd,\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd a (-10^9 <= a <= 10^9).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd b.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n179\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n-1\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n9\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n18\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n10\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd 180.\n\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd 8.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd 10, \ufffd \ufffd\ufffd 0.\n\n\n */\n\n\nusing System;\n\nclass Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tint nn = n;\n\n\t\tfor ( n++; ; n++ )\n\t\t{\n\t\t\tint m = n;\n\t\t\tbool ok = false;\n\t\t\twhile ( m > 0 )\n\t\t\t{\n\t\t\t\tif ( m % 10 == 8 )\n\t\t\t\t{\n\t\t\t\t\tok = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tm /= 10;\n\t\t\t}\n\t\t\tif ( ok )\n\t\t\t\tbreak;\n\t\t}\n\n\t\tConsole.WriteLine (n - nn);\n//\t\tConsole.ReadKey (true);\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n long input = Int64.Parse(Console.ReadLine());\n long res = 0;\n if(input < 0)\n {\n res += Int64.Parse(input.ToString().Replace(\"-\", \"\"));\n input += res;\n }\n for(long i = input+1; i <= 8888888888; i++)\n {\n if (i.ToString().Contains(\"8\"))\n {\n res += i-input;\n break;\n }\n }\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Team_BruteForce_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int andar = int.Parse( Console.ReadLine() );\n int NiveisSubidos = Operacao.VerificaNumero(andar, 0);\n Console.WriteLine(NiveisSubidos);\n }\n\n }\n\n\n static class Operacao\n {\n public static int VerificaNumero(int a, int contador)\n {\n\n\n string compara = Convert.ToString(a);\n if (compara.Contains(\"8\"))\n {\n return contador;\n }\n else\n {\n contador++;\n return VerificaNumero(a + 1, contador);\n }\n\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();//Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r'}, StringSplitOptions.RemoveEmptyEntries);\n if (input[0] == '-')\n {\n if (input.Length == 2 && input[1] != '9')\n Console.WriteLine((input[1] - 40));\n else\n {\n int a = input.IndexOf('8');\n if(a>=0)\n {\n if (a == input.Length - 1)\n {\n a = input.LastIndexOf('9');\n if (a == -1) Console.WriteLine(\"10\");\n else\n {\n for (int i = a + 1, lim = input.Length - 1; i < lim; ++i)\n if (input[i] != '0') a = -1;\n Console.WriteLine(a >= 0 ? \"9\" : \"10\");\n }\n }\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '0') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ? '2' : '1');\n }\n }\n else\n {\n a = input.LastIndexOf('9');\n if (a < 0) Console.WriteLine(input[input.Length - 1]-46);\n else\n {\n if (input.Length - 1 == a) Console.WriteLine('1');\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '0') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 || a ==input.Length-1? \"1\" : (input[input.Length - 1] - 46).ToString());\n }\n }\n }\n }\n }\n else\n {\n int a = input.IndexOf('8');\n if(a>=0)\n {\n if(a==input.Length-1)\n {\n a = input.LastIndexOf('7');\n if (a == -1) Console.WriteLine(\"10\");\n else\n {\n for (int i = a + 1, lim = input.Length - 1; i < lim; ++i)\n if (input[i] != '9') a = -1;\n Console.WriteLine(a >= 0 ? \"2\" : \"10\");\n }\n }\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '9') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ?'9':'1');\n }\n }\n else\n {\n a = input.LastIndexOf('7');\n if (a < 0) Console.WriteLine(input[input.Length - 1] == '9' ? 9 : 56 - input[input.Length - 1]);\n else\n {\n for (int i = a + 1; i < input.Length; ++i)\n {\n if (input[i] != '9') { a = -1; break; }\n }\n Console.WriteLine(a >= 0 ? \"1\" : (56-input[input.Length-1]).ToString());\n }\n }\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n if (n==0)\n {\n Console.WriteLine(\"8\");\n }\n else\n {\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else if (t == 0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n if (n >= 0)\n {\n\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); \n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n }\n else\n {\n int t = (int)n % 10;\n if (t==-8)\n {\n Console.WriteLine(\"10\"); \n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(8-t));\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n if (n >= 0)\n {\n\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); \n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n }\n else\n {\n if (n==-8)\n {\n Console.WriteLine(\"16\");\n return;\n }\n int t = (int)n % 10;\n if (t==-8)\n {\n Console.WriteLine(\"10\"); \n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(8-t));\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine());\n int temp;\n temp = (int)n % 10;\n if (temp==8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else\n {\n Console.WriteLine(Math.Abs(temp - 8));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n if (n >= 0)\n {\n\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); \n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n }\n else\n {\n int t = (int)n % 10;\n if (t==-8)\n {\n Console.WriteLine(\"10\"); \n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(t+8));\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n \n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine());\n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine());\n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine()); \n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n if (n >= 0)\n {\n\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); \n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n }\n else\n {\n if (n==-8)\n {\n Console.WriteLine(\"16\");\n }\n int t = (int)n % 10;\n if (t==-8)\n {\n Console.WriteLine(\"10\"); \n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(8-t));\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _488A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = 0;\n n = Convert.ToInt64(Console.ReadLine());\n if (n==0)\n {\n Console.WriteLine(\"8\");\n }\n long m = n / 10;\n while (m!=0)\n {\n int temp;\n temp = (int)m % 10;\n m = m / 10;\n if (Math.Abs(temp)==8)\n {\n Console.WriteLine(\"1\");\n return;\n }\n }\n int t = (int)n % 10;\n if (t == 8)\n {\n Console.WriteLine(\"10\"); ;\n }\n else if(t==0)\n {\n Console.WriteLine(\"2\");\n }\n else\n {\n Console.WriteLine(Math.Abs(t - 8));\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine();\n\n var ans = 0;\n if (start.Contains('8') && start.IndexOf('8') <= start.Length - 2)\n {\n Console.WriteLine(1);\n return;\n }\n if (int.Parse(start) == 0)\n {\n Console.WriteLine(8);\n return;\n }\n if (int.Parse(start) == 8)\n {\n Console.WriteLine(8);\n return;\n }\n\n if (int.Parse(start) > 0)\n {\n var l = (start[start.Length - 1] - '0');\n \n if (8 - l > 0)\n {\n ans = 8 - l;\n Console.WriteLine(ans);\n return;\n }\n else\n {\n var lt = int.Parse(start.Substring(start.Length - 2,2)); \n ans = Math.Min(80 - lt, 18 - l);\n Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);\n return;\n }\n }\n else\n {\n var l = (start[start.Length - 1] - '0');\n if (8 - l >= 0)\n {\n var lt = int.Parse(start.Substring(start.Length - 2, 2));\n ans = Math.Min(90 - lt, l + 8);\n Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);\n return;\n }\n else\n {\n ans = l - 8;\n Console.WriteLine(ans);\n return;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine();\n\n var ans = 0;\n if (start.Contains('8') && start.IndexOf('8') <= start.Length - 2)\n {\n Console.WriteLine(1);\n return;\n }\n if (int.Parse(start) == 0)\n {\n Console.WriteLine(8);\n return;\n }\n if (int.Parse(start) == 8)\n {\n Console.WriteLine(10);\n return;\n }\n\n if (int.Parse(start) > 0)\n {\n var l = (start[start.Length - 1] - '0');\n \n if (8 - l > 0)\n {\n ans = 8 - l;\n Console.WriteLine(ans);\n return;\n }\n else\n {\n var lt = int.Parse(start.Substring(start.Length - 2,2)); \n ans = Math.Min(80 - lt, 18 - l);\n Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);\n return;\n }\n }\n else\n {\n var l = (start[start.Length - 1] - '0');\n if (8 - l >= 0)\n {\n var lt = int.Parse(start.Substring(start.Length - 2, 2));\n ans = Math.Min(90 - lt, l + 8);\n Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);\n return;\n }\n else\n {\n ans = l - 8;\n Console.WriteLine(ans);\n return;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine();\n\n var ans = 0;\n\n if (int.Parse(start) > 0)\n {\n var l = (start[start.Length - 1] - '0');\n \n if (8 - l > 0)\n {\n ans = 8 - l;\n Console.WriteLine(ans);\n return;\n }\n else\n {\n var lt = int.Parse(start.Substring(start.Length - 2,2)); \n ans = Math.Min(80 - lt, 18 - l);\n Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);\n return;\n }\n }\n else\n {\n var l = (start[start.Length - 1] - '0');\n if (8 - l > 0)\n {\n var lt = int.Parse(start.Substring(start.Length - 2, 2));\n ans = Math.Min(90 - lt, l + 8);\n Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);\n return;\n }\n else\n {\n ans = l - 8;\n Console.WriteLine(ans);\n return;\n }\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine();\n\n var ans = 0;\n if (start.Contains('8') && start.IndexOf('8') <= start.Length - 2)\n {\n Console.WriteLine(1);\n return;\n }\n\n if (int.Parse(start) > 0)\n {\n var l = (start[start.Length - 1] - '0');\n \n if (8 - l > 0)\n {\n ans = 8 - l;\n Console.WriteLine(ans);\n return;\n }\n else\n {\n var lt = int.Parse(start.Substring(start.Length - 2,2)); \n ans = Math.Min(80 - lt, 18 - l);\n Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);\n return;\n }\n }\n else\n {\n var l = (start[start.Length - 1] - '0');\n if (8 - l > 0)\n {\n var lt = int.Parse(start.Substring(start.Length - 2, 2));\n ans = Math.Min(90 - lt, l + 8);\n Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);\n return;\n }\n else\n {\n ans = l - 8;\n Console.WriteLine(ans);\n return;\n }\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Numerics;\nnamespace ConsoleApplication25\n{\n class Solution\n {\n static void Main(string[] args)\n {\n var start = Console.ReadLine();\n\n var ans = 0;\n if (start.Contains('8') && start.IndexOf('8') <= start.Length - 2)\n {\n Console.WriteLine(1);\n return;\n }\n if (int.Parse(start) == 0)\n {\n Console.WriteLine(8);\n return;\n }\n if (int.Parse(start) == 8)\n {\n Console.WriteLine(16);\n return;\n }\n\n if (int.Parse(start) > 0)\n {\n var l = (start[start.Length - 1] - '0');\n \n if (8 - l > 0)\n {\n ans = 8 - l;\n Console.WriteLine(ans);\n return;\n }\n else\n {\n var lt = int.Parse(start.Substring(start.Length - 2,2)); \n ans = Math.Min(80 - lt, 18 - l);\n Console.WriteLine(ans == 80 - lt ? 80 - lt : 18 - l);\n return;\n }\n }\n else\n {\n var l = (start[start.Length - 1] - '0');\n if (8 - l >= 0)\n {\n var lt = int.Parse(start.Substring(start.Length - 2, 2));\n ans = Math.Min(90 - lt, l + 8);\n Console.WriteLine(ans == 90 - lt ? 90 - lt : l+8);\n return;\n }\n else\n {\n ans = l - 8;\n Console.WriteLine(ans);\n return;\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static int Main()\n\t{\n\t long a=long.Parse(Console.ReadLine());\n\t if(ce(a)){\n\t \tConsole.WriteLine(0);\n\t \t return 0;\n\t }\n\t int count=0;\n\t while(true)\n\t {\n\t \ta++;\n\t \tcount++;\n\t \tif(ce(a))\n\t \t{\n\t \t\tConsole.WriteLine(count);\n\t \t\treturn 0;\n\t \t\n\t \t}\n\t \t\n\t }\n\t\n\t }\n\t \n\t \n\t\n\tpublic static bool ce(long a)\n\t{\n\t\tstring s=a.ToString();\n\t\tint flag=0;\n\t\tfor(int i=0;i 0)\n {\n if (number % 10 == 8)\n return true;\n\n number = number / 10;\n }\n\n return false;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Security.Cryptography;\nusing System.Numerics;\nusing System.Threading;\nusing System.Diagnostics;\n\nnamespace StudyCSharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long stage, result = 0;\n byte[] Astage = {0};\n string buf;\n bool found = false;\n stage = Convert.ToInt32(Console.ReadLine());\n while (found == false && result <= 10)\n {\n stage++;\n result++;\n buf = stage.ToString();\n Astage = ArrCharToArrByte(buf, Astage);\n for (int i = 0; i < Astage.Length; i++)\n if (Astage[i]==8)\n {\n found = true;\n break;\n }\n }\n Console.WriteLine(result);\n }\n\n static byte[] ArrCharToArrByte(string buf, byte[] stage)\n {\n stage = new byte[buf.Length];\n for (int i = 0; i < buf.Length; i++)\n Byte.TryParse(buf[i].ToString(), out stage[i]);\n return stage;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n long[] mass = new long[16];\n for(int i = 0; i < 16; i++)\n {\n mass[i] = n + i;\n }\n for(int i = 1; i < mass.Count(); i++)\n {\n if (mass[i].ToString().Contains('8')) { Console.Write(i); return; }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static bool isLucky(long n)\n {\n while (n > 0)\n {\n if (n % 10 == 8)\n {\n return true;\n }\n n /= 10;\n }\n return false;\n }\n static void Main()\n {\n long b = 0;\n var a = long.Parse(Console.ReadLine());\n if (a < 0)\n {\n b = -a + 7;\n a = 7;\n }\n a++;\n b++;\n while (!isLucky(a))\n {\n a++;\n b++;\n }\n Console.WriteLine(b);\n }\n}"}, {"source_code": "using System;\nnamespace CodeForces\n{\n public class A\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = Convert.ToInt64(s);\n if (n >= 0)\n {\n if (s[s.Length - 1] < '8')\n n += 8 - (s[s.Length - 1] - '0');\n else if (s.Length - 2 >= 0 && s[s.Length - 2] == '7')\n n += 10 - (s[s.Length - 1] - '0');\n else if (s[s.Length - 1] == '8')\n n += 10;\n else if (s[s.Length - 1] == '9')\n n += 9;\n }\n else\n n = 8; \n Console.WriteLine(n);\n Environment.Exit(0);\n\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace CodeForces\n{\n public class A\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = Convert.ToInt64(s);\n if (n >= 0)\n {\n if (s[s.Length - 1] < '8')\n n += 8 - (s[s.Length - 1] - '0');\n else if (s.Length - 2 >= 0 && s[s.Length - 2] == '7')\n n += 10 - (s[s.Length - 1] - '0');\n else if (s[s.Length - 1] == '8')\n n += 10;\n else if (s[s.Length - 1] == '9')\n n += 9;\n }\n else\n n = 8; \n Console.WriteLine(n);\n Environment.Exit(0);\n\n }\n }\n}"}, {"source_code": " using System;\n namespace CodeForces\n {\n public class A\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long n = Convert.ToInt64(s);\n long ans = n;\n if (n >= 0)\n {\n if (s[s.Length - 1] < '8')\n n += 8 - (s[s.Length - 1] - '0');\n else if (s.Length - 2 >= 0 && s[s.Length - 2] == '7')\n n += 10 - (s[s.Length - 1] - '0');\n else if (s[s.Length - 1] == '8')\n n += 10;\n else if (s[s.Length - 1] == '9')\n n += 9;\n }\n else\n n = 8;\n\n ans = Math.Abs(ans - n);\n Console.WriteLine(ans);\n Environment.Exit(0);\n\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces284\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*ulong n;\n ulong m;\n ulong b;\n string s = Console.ReadLine();\n char[] ch = s.ToCharArray();\n if (ch[0] == '-')\n {\n n = ulong.Parse(s);\n b = n;\n char[] bc = b.ToString().ToCharArray();\n while (bc[bc.Length - 1] != 8)\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n else\n {\n m = ulong.Parse(s);\n b = m;\n char[] bc = b.ToString().ToCharArray();\n while ((bc[bc.Length - 1] != 8)||(bc[0]=='-'))\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n Console.WriteLine(b);*/\n long n = long.Parse(Console.ReadLine());\n int k = 0;\n bool flag = true;\n if (n > 0)\n {\n while (flag)\n {\n n++;\n k++;\n char[] ch = n.ToString().ToCharArray();\n for (int i = 0; i < ch.Length; i++)\n { \n if (ch[i] == '8')\n flag = false;\n }\n \n }\n }\n else k = (int)Math.Abs(n) + 8;\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces284\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*ulong n;\n ulong m;\n ulong b;\n string s = Console.ReadLine();\n char[] ch = s.ToCharArray();\n if (ch[0] == '-')\n {\n n = ulong.Parse(s);\n b = n;\n char[] bc = b.ToString().ToCharArray();\n while (bc[bc.Length - 1] != 8)\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n else\n {\n m = ulong.Parse(s);\n b = m;\n char[] bc = b.ToString().ToCharArray();\n while ((bc[bc.Length - 1] != 8)||(bc[0]=='-'))\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n Console.WriteLine(b);*/\n long n = long.Parse(Console.ReadLine());\n int k = 0;\n bool flag = true;\n if (n > 0)\n {\n char[] ch = n.ToString().ToCharArray();\n for (int i = 0; i < ch.Length; i++)\n {\n if (ch[i] == '8')\n flag = false;\n }\n while (flag)\n {\n n++;\n k++;\n ch = n.ToString().ToCharArray();\n for (int i = 0; i < ch.Length; i++)\n { \n if (ch[i] == '8')\n flag = false;\n }\n \n }\n }\n else k = (int)Math.Abs(n) + 8;\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces284\n{\n class Program\n {\n static void Main(string[] args)\n {\n /*ulong n;\n ulong m;\n ulong b;\n string s = Console.ReadLine();\n char[] ch = s.ToCharArray();\n if (ch[0] == '-')\n {\n n = ulong.Parse(s);\n b = n;\n char[] bc = b.ToString().ToCharArray();\n while (bc[bc.Length - 1] != 8)\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n else\n {\n m = ulong.Parse(s);\n b = m;\n char[] bc = b.ToString().ToCharArray();\n while ((bc[bc.Length - 1] != 8)||(bc[0]=='-'))\n {\n b++;\n bc = b.ToString().ToCharArray();\n }\n }\n Console.WriteLine(b);*/\n long n = long.Parse(Console.ReadLine());\n int k = 0;\n bool flag = true;\n if (n > 0)\n {\n char[] ch = n.ToString().ToCharArray();\n while (flag)\n {\n n++;\n k++;\n ch = n.ToString().ToCharArray();\n for (int i = 0; i < ch.Length; i++)\n { \n if (ch[i] == '8')\n flag = false;\n }\n \n }\n }\n else k = (int)Math.Abs(n) + 8;\n Console.WriteLine(k);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace a2oj\n{\n class Program\n {\n static bool cheight(int num)\n {\n while(num>0)\n {\n if (num % 10 != 8)\n num /= 10;\n else\n return true;\n }\n return false;\n }\n \n static void Main(string[] args)\n {\n int n;\n int t;\n n = int.Parse(Console.ReadLine());\n t=n;\n //List val = new List();\n //string s= Console.ReadLine();\n //string []all=s.Split(' ');\n //foreach(string st in all)\n //{\n // val.Add(int.Parse(st));\n //}\n n++;\n while (!cheight(n))\n n++;\n Console.WriteLine(n - t);\n \n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace a2oj\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n int n;\n n = int.Parse(Console.ReadLine());\n //List val = new List();\n //string s= Console.ReadLine();\n //string []all=s.Split(' ');\n //foreach(string st in all)\n //{\n // val.Add(int.Parse(st));\n //}\n if(n>=0)\n {\n int unit = n % 10;\n n /= 10;\n int tens = n % 10;\n if(tens!=7)\n {\n if (unit < 8)\n Console.WriteLine(8 - unit);\n else if (unit == 8)\n Console.WriteLine(10);\n else\n Console.WriteLine(9);\n }\n else\n {\n if (unit < 8)\n Console.WriteLine(8 - unit);\n else if (unit == 8)\n Console.WriteLine(2);\n else\n Console.WriteLine(1);\n }\n \n }\n else if(n<0&&n>-9)\n {\n if (n == -8)\n Console.WriteLine(10);\n else\n Console.WriteLine(8 - n);\n }\n else\n {\n int unit =n % 10;\n n /= 10;\n int tens =n % 10;\n if(tens!= -9)\n {\n if (unit == -9)\n Console.WriteLine(1);\n else if (unit == -8)\n Console.WriteLine(10);\n else\n {\n Console.WriteLine(10 - 8 +Math.Abs( unit));\n }\n }\n else\n {\n if (unit == -9)\n Console.WriteLine(1);\n else if (unit == -8)\n Console.WriteLine(8);\n else\n Console.WriteLine(unit);\n }\n \n }\n \n \n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\n\nnamespace Giga_tower\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inicio = int.Parse(Console.ReadLine());\n\n for (int i = 0; i <=16 ; i++)\n {\n if ((inicio + i).ToString().Contains('8'))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n i++;\n n++;\n int j,temp = n;\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n }\n Console.Write(i);\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n i++;\n n++;\n int j,temp = n;\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8 || j == -8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n }\n Console.Write(i);\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n i++;\n n++;\n int j,temp = n;\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n }\n Console.Write(i-1);\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n int j,temp = n;\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n n++;\n i++;\n }\n Console.Write(i-1);\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s;\n int n,i = 0;\n s = Console.ReadLine();\n n = Convert.ToInt32(s);\n bool x = true;\n while (x)\n {\n i++;\n int j,temp = n;\n while (temp>0)\n {\n j = temp % 10;\n if (j == 8)\n {\n x = false;\n break;\n }\n temp /= 10;\n }\n n++;\n }\n Console.Write(i-1);\n Console.WriteLine();\n }\n }\n}\n"}], "src_uid": "4e57740be015963c190e0bfe1ab74cb9"} {"source_code": "namespace o\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] arr = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (j == 0 || i == 0)\n {\n arr[i, j] = 1;\n }\n else\n {\n arr[i, j] = arr[i - 1, j] + arr[i, j - 1]; \n }\n }\n }\n Console.WriteLine(arr[n - 1, n - 1]);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] array = new int[n, n];\n for(int i = 0; i < n; i++)\n {\n array[0, i] = 1;\n array[i, 0] = 1;\n }\n for(int i = 1; i < n; i++)\n {\n for(int a = 1; a < n; a++)\n {\n array[i, a] = array[i, a - 1] + array[i - 1, a];\n }\n }\n Console.WriteLine(array[n - 1, n - 1]);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[,] z = new int[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i==0 || j==0)\n {\n z[i,j] = 1;\n }\n else\n {\n z[i,j] = z[i - 1,j] + z[i,j - 1];\n }\n \n }\n }\n\n Console.WriteLine(z[n - 1,n - 1]);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n var upper = new int[n];\n var lower = new int[n];\n\n for(int i=0;i maxval) maxval = arr[i, j];\n }\n }\n Console.Write(maxval);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForcesProblems\n{\n class A509_MaximumInTable\n {\n public static void Main()\n {\n //while(true)\n //{\n var n = int.Parse(Console.ReadLine());\n var table = new int[n,n];\n // table = 0;\n // table[0] ={ {1,1,1,1,1 }, }\n for (int i = 0; i < n; i++)\n table[0,i] = 1;\n \n for (int i = 0; i < n; i++)\n table[i,0] = 1;\n\n for(int i =1;i 1)\n {\n above = table[i - n];\n table[i] = left + above;\n left = table[i];\n }\n i++;\n }\n above = 0;\n left = 0;\n row++;\n }\n\n Console.WriteLine(table.Max());\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var n = Console.ReadLine();\n Console.WriteLine(Solve(n));\n }\n\n public static string Solve(string ns)\n {\n var n = int.Parse(ns);\n var table = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n table[0, i] = 1;\n table[i, 0] = 1;\n }\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n table[i, j] = table[i - 1, j] + table[i, j - 1];\n }\n }\n return table[n - 1, n - 1].ToString();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine()), i = 0, j = 0;\n int[,] m = new int[n, n];\n for (i = 0; i < n; i++) { m[i, 0] = 1; m[0, i] = 1; }\n for (i = 1; i < n; i++)\n for (j = 1; j < n; j++) { m[i, j] = m[i - 1, j] + m[i, j - 1]; }\n if (n == 1) Console.WriteLine(1);\n else Console.WriteLine(m[i - 1, j - 1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication56\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int[,] mas = new int[a, a];\n for (int i = 0; i < a; i++)\n {\n mas[0, i] = 1;\n mas[i, 0] = 1;\n }\n for (int i = 1; i < a; i++)\n {\n for (int j = 1; j < a; j++)\n {\n mas[i, j] = mas[i - 1,j] + mas[i, j - 1];\n }\n }\n Console.WriteLine(mas[a-1,a-1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BulkaProga\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n List> table = new List>();\n List line = new List();\n for (int i = 0; i < count; ++i)\n {\n line.Add(1);\n }\n table.Add(line);\n for (int i = 1; i < count; ++i)\n {\n line = new List() { 1 };\n for (int j = 1; j < count; ++j)\n {\n line.Add(table[i - 1][j] + line[j - 1]);\n }\n table.Add(line);\n }\n Console.WriteLine(table.Last().Last());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\n// Codeforces problem 509A \"\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\"\n// http://codeforces.com/problemset/problem/509/A\nnamespace _509_A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t#region Read data\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\t#endregion\n\t\t\t#region Process data\n\t\t\tint[,] table = new int[n, n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\ttable[i, 0] = 1;\n\t\t\t\ttable[0, i] = 1;\n\t\t\t}\n\t\t\tfor (int i = 1; i < n; i++)\n\t\t\t{\n\t\t\t\tfor (int j = 1; j < n; j++)\n\t\t\t\t{\n\t\t\t\t\ttable[i, j] = table[i - 1, j] + table[i, j - 1];\n\t\t\t\t}\n\t\t\t}\n\t\t\t#endregion\n\t\t\t#region Write results\n\t\t\tConsole.WriteLine(table[n - 1, n - 1]);\n\t\t\tConsole.ReadLine();\n\t\t\t#endregion\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp___Maximum_in_table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[,] table = new int[n, n]; //[row, column]\n for (int i = 0; i < n; i++)\n {\n table[0, i] = 1;\n }\n for (int i = 0; i < n; i++) \n {\n table[i, 0] = 1;\n }\n for (int row = 1; row < n; row++)\n {\n for (int col = 1; col < n; col++)\n {\n table[row, col] = table[row, col-1]+table[row-1,col];\n }\n }\n Console.WriteLine(table[n - 1, n - 1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n reader = Console.In;\n writer = Console.Out;\n var init = ReadInt();\n\n var matrix = new int [init,init];\n int ans = 0;\n\n for (int i = 0; i < init; i++)\n {\n for (int j = 0; j < init; j++)\n {\n if (i == 0 || j == 0)\n {\n matrix[i, j] = 1;\n }\n else\n matrix[i, j] = matrix[i - 1, j] + matrix[i, j - 1];\n ans = Math.Max(matrix[i,j],ans);\n }\n }\n\n Console.WriteLine(ans);\n }\n\n\n\n\n private static Queue currentLineTokens = new Queue();\n protected static TextReader reader;\n protected static TextWriter writer;\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CSharpPrograms.Codeforces\n{\n class _509A\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[,] arr = new int[n, n];\n for (int i = 0; i < n; i++)\n arr[i, 0] = arr[0, i] = 1;\n int max = 1;\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n arr[i, j] = arr[i, j - 1] + arr[i - 1, j];\n max = Math.Max(arr[i, j], max);\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _509A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var isInt = int.TryParse(Console.ReadLine(),out int tableDim);\n int[,] arr = new int[11,11];\n if (isInt)\n {\n for (int i = 1; i <= tableDim; i++)\n {\n for (int j = 1; j <= tableDim; j++)\n {\n if (i == 1)\n { \n arr[i,j] = 1; \n }\n else\n {\n arr[i, j] = arr[i - 1, j] + arr[i, j - 1]; \n }\n }\n }\n Console.WriteLine(arr[tableDim, tableDim]);\n } \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication29\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[,] a = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n a[i, 0] = 1;\n a[0, j] = 1;\n }\n }\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n a[i, j] = a[i - 1, j] + a[i, j - 1];\n }\n } int max = int.MinValue;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (a[i, j] > max) { max = a[i, j]; }\n }\n } Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\npublic class Test\n{\n\n\tpublic static void Main()\n\t{\n\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\tint[,] matris = new int[n, n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t{\n\t\t\t\tif (i == 0) matris[i, j] = 1;\n\t\t\t\telse if (j == 0) matris[i, j] = 1;\n\t\t\t\telse matris[i, j] = matris[i - 1, j] + matris[i, j - 1];\n\t\t\t}\n\t\t}\n\t\tConsole.Write(matris[n - 1, n - 1]);\n\t}\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace problem_solv\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n int[,] arr = new int[num, num]; \n for(int row = 0; row < num; row++)\n {\n for(int col = 0; col < num; col++)\n {\n if(row == 0 || col == 0)\n {\n arr[row, col] = 1;\n }\n else\n {\n arr[row, col] = arr[row - 1, col] + arr[row, col - 1];\n }\n }\n }\n\n Console.WriteLine(arr.Cast().Max());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_509A_Maximum_in_Table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] a = new int[n, n];\n for(int i=0;i -1) a[i, j] += a[i, j - 1];\n }\n }\n\n Console.WriteLine(a[n-1,n-1]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _509A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n int upper = n + (n-1) - 1;\n int lower = upper/2;\n \n long result = fact(upper)/(fact(lower)*fact(upper - lower));\n Console.WriteLine(\"{0}\", result);\n }\n \n static long fact(long n)\n {\n long num = 1;\n while(n > 1)\n {\n num *= n;\n n -= 1;\n }\n return num;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n int[,] matrix = new int[num, num];\n if (num > 1)\n {\n for (int i = 0; i < num; i++)\n {\n matrix[0, i] = 1;\n matrix[i, 0] = 1;\n }\n for (int row = 1; row < num; ++row)\n {\n for (int col = 1; col < num; ++col)\n {\n \n matrix[row, col] = matrix[row - 1, col] + matrix[row, col - 1];\n }\n }\n Console.WriteLine(matrix[num - 1, num - 1]);\n }\n else\n Console.WriteLine(1);\n\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] table = new int[n, n];\n\n for (int i = 0; i < n; i++)\n {\n table[0, i] = 1;\n table[i, 0] = 1;\n }\n\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n table[i, j] = table[i, j - 1] + table[i - 1, j];\n }\n }\n\n Console.WriteLine(table[n-1, n-1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _509A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[,] table = new int[n, n];\n for (int i = 0; i < n; ++i)\n {\n table[0, i] = 1;\n table[i, 0] = 1;\n }\n\n for (int i = 1; i < n; ++i)\n {\n for (int j = 1; j < n; ++j)\n {\n table[i, j] = table[i - 1, j] + table[i, j - 1];\n }\n }\n\n Console.WriteLine(table[n - 1, n - 1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _509A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int sum = 0;\n sum = elem(n, n);\n Console.Write(sum);\n Console.ReadLine();\n }\n static int elem(int row, int col)\n {\n if (row == 1 || col == 1)\n {\n return 1;\n }\n else\n {\n return elem(row - 1, col) + elem(row, col - 1);\n }\n }\n }\n}\n"}, {"source_code": "//#define SINGLE_PAGE\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[][] Matrix = new int[10][];\n for (int row = 0; row < 10; row++)\n {\n Matrix[row] = new int[10];\n for (int column = 0; column < 10; column++)\n {\n if (row == 0 || column == 0)\n Matrix[row][column] = 1;\n else\n {\n Matrix[row][column] = Matrix[row][column-1] + Matrix[row-1][column];\n }\n }\n }\n\n Console.WriteLine(Matrix[n-1][n-1]);\n \n return ;\n }\n\n \n }\n\n\n \n\n}\n"}, {"source_code": "using System;\n\nnamespace Issue_509A\n{\n class Program\n {\n public static void Main(string[] args) {\n var n = ReadInt();\n \n var matrix = new int[n, n];\n\n for (int i = 0; i < n; ++i) {\n matrix[0, i] = 1;\n matrix[i, 0] = 1;\n }\n\n for (int i = 1; i < n; ++i) {\n for (int j = 1; j < n; ++j) {\n matrix[i, j] = matrix[i, j - 1] + matrix[i - 1, j];\n }\n }\n\n Console.WriteLine(matrix[n - 1, n - 1]);\n }\n\n private static bool IsInputError = false;\n private static bool IsEndOfLine = false;\n\n private static int ReadInt() {\n const int zeroCode = (int) '0';\n\n var result = 0;\n var isNegative = false;\n var symbol = Console.Read();\n IsInputError = false;\n IsEndOfLine = false;\n\n while (symbol == ' ') {\n symbol = Console.Read();\n }\n\n if (symbol == '-') {\n isNegative = true;\n symbol = Console.Read();\n }\n\n for ( ;\n (symbol != -1) && (symbol != ' ');\n symbol = Console.Read()\n ) {\n var digit = symbol - zeroCode;\n \n // if symbol == \\n\n if (symbol == 13) {\n // skip next \\r symbol\n Console.Read();\n IsEndOfLine = true;\n break;\n }\n\n if (digit < 10 && digit >= 0) {\n var cache1 = result << 1;\n var cache2 = cache1 << 2;\n result = cache1 + cache2 + digit;\n } else {\n IsInputError = true;\n break;\n }\n }\n\n return isNegative ? ~result + 1 : result;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_MaxTable\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] A = new int[n, n];\n for(int i=0;i '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tvar a = new int[n, n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\ta[0, i] = 1;\n\t\t}\n\t\tfor (int i = 1; i < n; i++)\n\t\t{\n\t\t\ta[i, 0] = 1;\n\t\t\tfor (int j = 1; j < n; j++)\n\t\t\t{\n\t\t\t\ta[i, j] = a[i - 1, j] + a[i, j - 1];\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(a[n - 1, n - 1]);\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), index = 0;\n int[,] tab = new int[n, n];\n int[] max = new int[n * n];\n max[0] = 1;\n for (int i = 0; i < n; i++)\n {\n for(int j = 0; j < n; j++)\n {\n if (i == 0 || j == 0) tab[i, j] = 1;\n else {\n tab[i, j] = tab[i - 1, j] + tab[i, j - 1];\n max[index++] = tab[i, j];\n }\n }\n }\n Console.Write(max.Max());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Int32[,] table=new int[n,n];\n for (int i = 0; i < n; i++)\n {\n table[0, i] = 1;\n table[i, 0] = 1;\n \n }\n for (int i = 1; i < n; i++)\n {\n \n \n for (int j = 1; j < n; j++)\n {\n table[i, j] = table[i, j - 1] + table[i - 1, j];\n \n }\n \n }\n Console.WriteLine(table[n-1,n-1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_509A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n=int.Parse(Console.ReadLine());\n int m=GetMaximumInTable(n);\n Console.WriteLine(m);\n\n\n }\n\n private static int GetMaximumInTable(int n)\n {\n int[,] table = new int [n,n];\n for (int j = 0; j < n; j++)\n {\n for (int i = 0; i < n; i++)\n {\n table[i, 0] = 1;\n table[0, i] = 1;\n if (i > 0 && j > 0)\n {\n table[i, j] = table[i - 1, j] + table[i, j - 1];\n }\n }\n }\n return table[n - 1, n - 1]; \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main()\n {\n int n = Int32.Parse(Console.ReadLine()), max = 1;\n int[,] arr = new int[n, n];\n for (int i = 0; i < n; i++) {\n arr[i, 0] = 1;\n arr[0, i] = 1;\n }\n for (int i = 1; i < n; i++) {\n for (int j = 1; j < n; j++) {\n arr[i, j] = arr[i, j - 1] + arr[i - 1, j];\n if (arr[i, j] > max) max = arr[i, j];\n }\n }\n Console.WriteLine(max);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\n\npublic class CodeForces\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] c = new int[n];\n for (int i = 0; i < n; ++i)\n {\n c[i] = 1;\n }\n int l = n;\n while (l > 1)\n {\n for (int i = 1; i < n; ++i)\n {\n c[i] = c[i - 1] + c[i];\n }\n --l;\n }\n Console.WriteLine(c[n - 1]);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long[,] temp = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n temp[i, 0] = 1;\n temp[0, i] = 1;\n }\n for (int i = 1; i < n; i++)\n for (int j = 1; j < n; j++)\n temp[i, j] = temp[i - 1, j] + temp[i, j - 1];\n Console.WriteLine(temp[n - 1, n - 1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n//using System.Collections.Generic;\n//using System.Linq;\n//using System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem509A {\n class Program {\n static void Main(string[] args) {\n int[,] matrix = generateMatrix(); //input is <= 10\n int input = Convert.ToInt32(Console.ReadLine());\n int maxValue = matrix[input, input];\n\n Console.WriteLine(maxValue);\n\n }\n\n private static int[,] generateMatrix() {\n int[,] matrix = new int[12, 12];\n for (int i = 1; i <= 11; i++) {\n int row = i;\n for (int j = 1; j <= 11; j++) {\n if (row == 1) {\n matrix[row, j] = 1;\n } else {\n matrix[row, j] = matrix[row - 1, j] + matrix[row, j - 1];\n }\n }\n }\n\n return matrix;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var arr = new int[n, 2];\n for (int i = 0; i < n; i++)\n {\n arr[i, 0] = 1;\n }\n for (var tn = 1; tn < n; tn++)\n {\n arr[0, 1] = 1;\n for (int i = 1; i < n; i++)\n {\n arr[i, 1] = arr[i - 1, 1] + arr[i, 0];\n }\n for (int i = 0; i < n; i++)\n {\n arr[i, 0] = arr[i, 1];\n }\n }\n if (n == 1) { Console.WriteLine(1); }\n else Console.WriteLine(arr[n-1,1]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace MemoryFrozen\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n switch (n)\n {\n case 1:\n {\n Console.Write(1);\n break;\n }\n case 2:\n {\n Console.Write(2);\n break;\n }\n case 3:\n {\n Console.Write(6);\n break;\n }\n case 4:\n {\n Console.Write(20);\n break;\n }\n case 5:\n {\n Console.Write(70);\n break;\n }\n case 6:\n {\n Console.Write(252);\n break;\n }\n case 7:\n {\n Console.Write(924);\n break;\n }\n case 8:\n {\n Console.Write(3432);\n break;\n }\n case 9:\n {\n Console.Write(12870);\n break;\n }\n case 10:\n {\n Console.Write(48620);\n break;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace MemoryFrozen\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int[] a = new int[11];\n\n int j = n;\n\n while (j > 0)\n {\n for (int i = 0; i < n; i++)\n {\n if (j == n || i == 0)\n {\n a[i] = 1;\n }\n else\n {\n a[i] = a[i] + a[i - 1];\n }\n }\n j--;\n }\n\n Console.WriteLine(a[n - 1]);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k = Int32.Parse (Console.ReadLine ());\n int l = Int32.Parse (Console.ReadLine ());\n int m = Int32.Parse (Console.ReadLine ());\n int n = Int32.Parse (Console.ReadLine ());\n int d = Int32.Parse (Console.ReadLine ());\n int sum = 0;\n \n for (int i = 1; i <= d; i++) {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z236A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n string ne = \"\";\n bool k;\n for (int i = 0; i < str.Length; i++) {\n k = false;\n for (int j = 0; j < ne.Length; j++) {\n if (str [i] == ne [j]) {\n k = true;\n }\n }\n if (!k) {\n ne += str [i];\n n++;\n }\n }\n if (n % 2 == 0) {\n Console.WriteLine (\"CHAT WITH HER!\");\n } else {\n Console.WriteLine (\"IGNORE HIM!\");\n }\n }\n\n static int gdc (int left, int right)\n {\n while (left>0&&right>0) {\n if (left > right) {\n left %= right;\n } else\n right %= left;\n }\n return left + right;\n }\n\n static void Z119A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int[] ab = new int[2];\n\n ab [0] = Int32.Parse (str [0]);\n ab [1] = Int32.Parse (str [1]);\n int n = Int32.Parse (str [2]);\n int i = 0;\n int m;\n while (true) {\n if (n == 0) {\n Console.WriteLine ((i + 1) % 2);\n return;\n }\n m = gdc (ab [i], n);\n n -= m;\n i = (i + 1) % 2;\n\n }\n\n }\n\n static void Z110A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == '4' || str [i] == '7') {\n n++;\n }\n }\n if (n == 4 || n == 7) {\n Console.WriteLine (\"YES\");\n } else {\n Console.WriteLine (\"NO\");\n }\n }\n\n static void Z467A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int res = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [1]) - Int32.Parse (strs [0]) >= 2) {\n res++;\n }\n }\n Console.WriteLine (res);\n }\n\n static void Z271A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int [] ye = new int[4];\n n++;\n for (int i = 0; i < 4; i++) {\n ye [i] = n / 1000;\n n %= 1000;\n n *= 10;\n }\n bool flag = true;\n while (flag) {\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < i; j++) {\n if (ye [i] == ye [j]) {\n ye [i]++;\n \n for (int k = i+1; k < 4; k++) {\n ye [k] = 0;\n }\n i--;\n }\n }\n }\n flag = false;\n for (int i = 1; i < 4; i++) {\n if (ye [i] == 10) {\n ye [i] %= 10;\n ye [i - 1]++;\n flag = true;\n }\n }\n }\n for (int i = 0; i < 4; i++) {\n Console.Write (ye [i]);\n }\n \n }\n\n static void Z58A ()\n {\n string str = Console.ReadLine ();\n str.ToLower ();\n string sstr = \"hello\";\n int j = 0;\n for (int i = 0; i < str.Length; i++) {\n if (sstr [j] == str [i])\n j++;\n if (j == sstr.Length) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z472A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n if (n % 2 == 0) {\n Console.Write (\"4 \");\n Console.Write (n - 4);\n } else {\n Console.Write (\"9 \");\n Console.Write (n - 9);\n }\n }\n\n static void Z460A ()\n {\n int res = 0;\n int days = 0;\n string[] strs = Console.ReadLine ().Split (' ');\n int nosk = Int32.Parse (strs [0]);\n int nd = Int32.Parse (strs [1]);\n while (nosk!=0) {\n days += nosk;\n res += nosk;\n nosk = 0;\n nosk = days / nd;\n days %= nd;\n }\n Console.Write (res);\n }\n\n static void Z379A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]);\n int b = Int32.Parse (strs [1]);\n int ogaroks = 0;\n int h = 0;\n while (a!=0) {\n h += a;\n ogaroks += a;\n a = ogaroks / b;\n ogaroks %= b;\n }\n Console.WriteLine (h);\n }\n\n static bool IsLucky (int n)\n {\n while (n>0) {\n int m = n % 10;\n if (m != 4 && m != 7) {\n return false;\n }\n n /= 10;\n }\n return true;\n }\n\n static void Z122A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n for (int i = 2; i <= n; i++) {\n if (n % i == 0 && IsLucky (i)) {\n Console.WriteLine (\"YES\");\n return;\n }\n }\n Console.WriteLine (\"NO\");\n }\n\n static void Z136A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] pod = new int[n];\n string[] strs = Console.ReadLine ().Split (' ');\n for (int i = 0; i < n; i++) {\n pod [Int32.Parse (strs [i]) - 1] = i + 1;\n }\n for (int i = 0; i < n; i++) {\n Console.Write (pod [i].ToString () + \" \");\n }\n }\n\n static void Z228A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n List n = new List ();\n for (int i = 0; i < 4; i++) {\n bool flag = true;\n for (int j = 0; j < n.Count; j++) {\n if (Int32.Parse (strs [i]) == n [j]) {\n flag = false;\n break;\n }\n }\n if (flag) {\n n.Add (Int32.Parse (strs [i]));\n }\n }\n Console.WriteLine (4 - n.Count);\n }\n\n static void Z263A ()\n {\n string[] strs;\n int x = 0, y = 0;\n for (int i = 0; i < 5; i++) {\n strs = Console.ReadLine ().Split (' ');\n for (int j = 0; j < 5; j++) {\n if (strs [j] == \"1\") {\n x = j + 1;\n y = i + 1;\n }\n }\n\n }\n Console.WriteLine ((Math.Abs (3 - x) + Math.Abs (3 - y)));\n }\n\n static void Z266B ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int t = Int32.Parse (strs [1]);\n string str = Console.ReadLine ();\n char[] chs = new char[str.Length];\n for (int i = 0; i < str.Length; i++) {\n chs [i] = str [i];\n }\n for (int i = 0; i < t; i++) {\n int j = 0;\n while (j+1 rost [max])\n max = i;\n }\n int sum = 0;\n while (max!=0) {\n int temp = rost [max];\n rost [max] = rost [max - 1];\n rost [max - 1] = temp;\n sum++;\n max--;\n }\n\n\n for (int i = n-1; i >=0; i--) {\n\n if (rost [i] < rost [min]) {\n min = i;\n }\n }\n while (min!=rost.Length-1) {\n int temp = rost [min];\n rost [min] = rost [min + 1];\n rost [min + 1] = temp;\n sum++;\n min++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z451A ()\n {\n string[] names = new string[2];\n names [0] = \"Akshat\";\n names [1] = \"Malvika\";\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int m = Int32.Parse (strs [1]);\n n = Math.Min (n, m) - 1;\n n %= 2;\n Console.WriteLine (names [n]);\n\n }\n\n static void Z344A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int ostr = 1;\n string str = Console.ReadLine ();\n char ch = str [1];\n for (int i = 1; i < n; i++) {\n str = Console.ReadLine ();\n if (ch == str [0]) {\n ostr++;\n }\n ch = str [1];\n }\n Console.WriteLine (ostr);\n }\n\n static void Z486A ()\n {\n long n = Int64.Parse (Console.ReadLine ());\n long sum = n / 2;\n sum -= (n % 2) * n;\n Console.WriteLine (sum);\n }\n\n static void Z500A ()\n {\n string[] str = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (str [0]);\n int t = Int32.Parse (str [1]);\n int[] a = new int[n - 1];\n str = Console.ReadLine ().Split (' ');\n int j = 0;\n t--;\n for (int i = 0; i < n-1; i++) {\n a [i] = Int32.Parse (str [i]);\n if (i == j)\n j += a [i];\n if (j >= t)\n break;\n }\n if (j == t)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z61A ()\n {\n string str1 = Console.ReadLine ();\n string str2 = Console.ReadLine ();\n string str3 = \"\";\n for (int i = 0; i < str1.Length; i++) {\n if (str1 [i] == str2 [i])\n str3 += \"0\";\n else\n str3 += \"1\";\n }\n Console.WriteLine (str3);\n }\n\n static void Z268A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int[] h = new int[n];\n int[] a = new int[n];\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n h [i] = Int32.Parse (strs [0]);\n a [i] = Int32.Parse (strs [1]);\n }\n int sum = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j && h [i] == a [j])\n sum++;\n }\n }\n Console.WriteLine (sum);\n }\n\n static void Z208A ()\n {\n string str = Console.ReadLine ();\n string[] separ = new string[1];\n separ [0] = \"WUB\";\n string[] strs = str.Split (separ, StringSplitOptions.RemoveEmptyEntries);\n for (int i = 0; i < strs.Length; i++) {\n Console.Write (strs [i] + \" \");\n }\n }\n\n static void Z478A ()\n {\n string []strs=Console.ReadLine().Split(' ');\n int n=0;\n for (int i = 0; i < 5; i++) {\n n+=Int32.Parse(strs[i]);\n }\n if (n%5==0&&n!=0) {\n Console.WriteLine(n/5);\n }\n else {\n Console.WriteLine(-1);\n }\n }\n static void Z69A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n int x = 0, y = 0, z = 0;\n string[] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n x += Int32.Parse (strs [0]);\n y += Int32.Parse (strs [1]);\n z += Int32.Parse (strs [2]);\n }\n if (x == 0 && y == 0 && z == 0) {\n Console.Write (\"YES\");\n } else {\n Console.Write(\"NO\");\n }\n }\n static void Z337A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n int n=Int32.Parse(strs[0]);\n int m=Int32.Parse(strs[1]);\n List arra=new List();\n strs=Console.ReadLine().Split(' ');\n bool flag;\n for (int i = 0; i < m; i++) {\n flag=true;\n int t=Int32.Parse(strs[i]);\n for (int j = 0; j < arra.Count; j++) {\n if(t=sum) {\n level++;\n n-=sum;\n i++;\n sum+=i;\n }\n Console.WriteLine(level);\n }\n static void Z479A ()\n {\n int a=Int32.Parse(Console.ReadLine());\n int b=Int32.Parse(Console.ReadLine());\n int c=Int32.Parse(Console.ReadLine());\n int res=a+b+c;\n res=Math.Max(res,(a+b)*c);\n res=Math.Max(res,a*(b+c));\n res=Math.Max(res,(a*b)*c);\n Console.WriteLine(res);\n\n }\n static void Z448A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int a = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n strs = Console.ReadLine ().Split (' ');\n int b = Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]);\n int n = Int32.Parse (Console.ReadLine ());\n int aa = a / 5;\n if (a % 5 != 0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n aa=b/10;\n if (b%10!=0) {\n aa++;\n }\n n -= aa;\n if (n < 0) {\n Console.WriteLine(\"NO\");\n return;\n }\n Console.WriteLine(\"YES\");\n }\n static void Z469A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n bool[]levels=new bool[n];\n for (int i = 0; i < n; i++) {\n levels[i]=true;\n }\n for (int i = 0; i < 2; i++) {\n string[]str=Console.ReadLine().Split(' ');\n int m=Int32.Parse(str[0]);\n for (int j = 1; j <= m; j++) {\n levels[Int32.Parse(str[j])-1]=false;\n }\n }\n for (int i = 0; i < n; i++) {\n if (levels[i]) {\n Console.WriteLine(\"Oh, my keyboard!\");\n return;\n }\n }\n Console.WriteLine(\"I become the guy.\");\n }\n static void Z155A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n string[]strs=Console.ReadLine().Split(' ');\n int max=Int32.Parse(strs[0]);\n int min=max;\n int m=0;\n for (int i = 1; i < n; i++) {\n int t=Int32.Parse(strs[i]);\n if (t>max) {\n m++;\n max=t;\n }\n if (t chrs=new List();\n bool flag;\n while (str[i]!='}') {\n \n flag=true;\n for (int j = 0; j < chrs.Count; j++) {\n if (str[i]==chrs[j]) {\n flag=false;\n break;\n }\n }\n if (flag) {\n chrs.Add(str[i]);\n }\n i++;\n if(str[i]=='}')\n break;\n i+=2;\n }\n Console.WriteLine(chrs.Count);\n }\n static void Z474A ()\n {\n char[,]keyboard=new char[3,10];\n keyboard[0,0]='q';\n keyboard[0,1]='w';\n keyboard[0,2]='e';\n keyboard[0,3]='r';\n keyboard[0,4]='t';\n keyboard[0,5]='y';\n keyboard[0,6]='u';\n keyboard[0,7]='i';\n keyboard[0,8]='o';\n keyboard[0,9]='p';\n keyboard[1,0]='a';\n keyboard[1,1]='s';\n keyboard[1,2]='d';\n keyboard[1,3]='f';\n keyboard[1,4]='g';\n keyboard[1,5]='h';\n keyboard[1,6]='j';\n keyboard[1,7]='k';\n keyboard[1,8]='l';\n keyboard[1,9]=';';\n keyboard[2,0]='z';\n keyboard[2,1]='x';\n keyboard[2,2]='c';\n keyboard[2,3]='v';\n keyboard[2,4]='b';\n keyboard[2,5]='n';\n keyboard[2,6]='m';\n keyboard[2,7]=',';\n keyboard[2,8]='.';\n keyboard[2,9]='/';\n bool flag;\n string lr=Console.ReadLine();\n string str=Console.ReadLine();\n int[]x=new int[str.Length];\n int[]y=new int[str.Length];\n for (int i = 0; i < str.Length; i++) {\n flag=false;\n for (int k = 0; k < 3; k++) {\n for (int m = 0; m < 10; m++) {\n if (keyboard[k,m]==str[i]) {\n y[i]=k;\n x[i]=m;\n flag=true;\n break;\n }\n }\n if(flag)\n break;\n }\n }\n int a=0;\n if (lr==\"L\") {\n a++;\n }\n else {\n a--;\n }\n for (int i = 0; i < str.Length; i++) {\n Console.Write(keyboard[y[i],x[i]+a]);\n }\n }\n static void Z268B ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int sum=0;\n for (int j = 1; j < n; j++) {\n sum+=(n-j)*j;\n }\n sum+=n;\n Console.WriteLine(sum);\n }\n static void Z318A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n\n long n=Int64.Parse(strs[0]);\n long m=Int64.Parse(strs[1]);\n n=n/2+n%2;\n long a=0;\n\n if (m<=n) {\n a=1;\n }\n else\n {\n m-=n;\n a=2;\n }\n a=a+(m-1)*2;\n \n Console.WriteLine(a);\n\n }\n static void Z510A ()\n {\n string[] strs=Console.ReadLine().Split(' ');\n\n int n=Int32.Parse(strs[0]);\n int m=Int32.Parse(strs[1]);\n int dir=0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if(dir==0)\n {\n Console.Write(\"#\");\n }\n if(dir==1&&j==m-1)\n {\n Console.Write(\"#\");\n }\n if(dir==1&&j!=m-1)\n {\n Console.Write(\".\");\n }\n if(dir==2)\n {\n Console.Write(\"#\");\n }\n if(dir==3&&j==0)\n {\n Console.Write(\"#\");\n }\n if(dir==3&&j!=0)\n {\n Console.Write(\".\");\n }\n }\n dir++;\n dir%=4;\n Console.WriteLine();\n }\n }\n static void Z405A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int[]st=new int[n];\n string []strs=Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++) {\n st[i]=Int32.Parse(strs[i]);\n }\n Array.Sort(st);\n for (int i = 0; i < st.Length; i++) {\n Console.Write(st[i].ToString()+\" \");\n }\n }\n static void Z466A ()\n {\n string[] strs = Console.ReadLine ().Split (' ');\n int n = Int32.Parse (strs [0]);\n int m = Int32.Parse (strs [1]);\n int a = Int32.Parse (strs [2]);\n int b = Int32.Parse (strs [3]);\n int sum = 0;\n int temp=m *a;\n if (temp>b) {\n temp=b;\n }\n sum=(n /m)*temp;\n n %=m;\n temp=n *a;\n if(temp>b)\n temp=b;\n\n sum+=temp;\n Console.Write(sum);\n\n }\n static void Z513A ()\n {\n string[] str = Console.ReadLine ().Split ();\n int a = Int32.Parse (str [0]);\n int b = Int32.Parse (str [1]);\n if (a > b) {\n Console.Write (\"First\");\n } else {\n Console.Write (\"Second\");\n }\n }\n static void Z237A ()\n {\n int n=Int32.Parse(Console.ReadLine());\n int max=0;\n int now=1;\n int lh=-1;\n int lm=-1;\n string[]strs;\n for (int i = 0; i < n; i++) {\n strs=Console.ReadLine().Split(' ');\n int h=int.Parse(strs[0]);\n int m=int.Parse(strs[1]);\n if (lm==m&&lh==h) {\n now++;\n }\n else\n {\n if (max=0) {\n poliz+=temp;\n }\n else {\n if(poliz==0)\n prest++;\n else\n poliz--;\n }\n }\n Console.Write(prest);\n }\n\n static void Z471A ()\n {\n string[]str=Console.ReadLine().Split(' ');\n List pl=new List();\n List plc=new List();\n bool fl=true;\n for (int i = 0; i < 6; i++) {\n fl=true;\n int n=int.Parse(str[i]);\n for (int j = 0; j < pl.Count; j++) {\n if(n==pl[j])\n {\n plc[j]++;\n fl=false;\n break;\n }\n }\n if (fl) {\n pl.Add(n);\n plc.Add(1);\n }\n }\n int[] arr=plc.ToArray();\n Array.Sort(arr);\n if (arr.Length<=3) {\n if (arr[arr.Length-1]>=4) {\n if (arr[0]>1) {\n Console.Write(\"Elephant\");\n }\n else {\n \n Console.Write(\"Bear\");\n }\n return;\n }\n }\n \n Console.Write(\"Alien\");\n\n }\n static void Z509A ()\n {\n int n=int.Parse(Console.ReadLine());\n int[,] table=new int[n,n];\n for (int i = 0; i < n; i++) {\n table[i,0]=1;\n }\n for (int i = 0; i < n; i++) {\n table[0,i]=1;\n }\n for (int i = 1; i < n; i++) {\n for (int j = 1; j < n; j++) {\n table[i,j]=table[i-1,j]+table[i,j-1];\n }\n }\n Console.Write(table[n-1,n-1]);\n }\n public static void Main ()\n {\n\n Z509A ();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n \n int[] x = new int[n];\n for (int i = 0; i < n; i++)\n {\n x[i] = 1;\n }\n int lasttop = 1;\n for(int i= 1; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n\n static void swap(ref int a, ref int b)\n {\n int temp = a;\n a = b;\n b = temp;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int[,] a = new int[n,n];\n int res = -1;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n {\n if (i == 0 || j == 0) a[i, j] = 1;\n else a[i, j] = a[i - 1, j] + a[i, j - 1];\n res = Max(res, a[i, j]);\n }\n WL(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces289\n{\n class Program\n {\n public static void Main(string[] args)\n {\n int[,] a = new int[11, 11];\n string input = Console.ReadLine();\n int n = Convert.ToInt32(input);\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i == 0 || j == 0)\n {\n a[i, j] = 1;\n }\n else\n {\n a[i, j] = a[i - 1, j] + a[i, j - 1];\n }\n }\n }\n Console.Write(a[n - 1, n - 1]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeFirstSimple\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n int[,] arr = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i == 0 || j == 0)\n arr[i, j] = 1;\n else\n arr[i, j] = arr[i - 1, j] + arr[i, j - 1];\n }\n \n }\n\n var res = arr[n - 1, n - 1];\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\npublic abstract class Animal : Object\n{\n public abstract void say();\n}\npublic class Dog : Animal\n{\n public override void say()\n {\n Console.WriteLine(\"\u0413\u0430\u0432\");\n }\n public static void hi()\n {\n Console.WriteLine(\"hi\");\n }\n}\nstruct lol\n{\n int x, y;\n\n};\nnamespace EduSharp\n{\n class Program\n {\n static void swap(ref T a,ref T b)\n {\n T temp = a;\n a = b;\n b = temp;\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n if (n == 1) Console.WriteLine(\"1\");\n else\n {\n int[,] m = new int[n,n];\n for(int i=0;i< n;i++)\n {\n m[0, i] = 1;\n m[i, 0] = 1;\n }\n for(int i=1;i< n;i++) // \u0441\u0442\u0440\u043e\u043a\u0430\n {\n for(int j=1;j< n;j++) // \u0441\u0442\u043e\u0431\u0435\u0446\n {\n m[i, j] = m[i, j - 1] + m[i - 1, j];\n }\n }\n Console.WriteLine(m[n-1, n-1]);\n \n }\n \n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _509A_Maximum_in_Table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long output;\n\n if (n == 1)\n output = 1;\n else\n {\n output = Factorial((n - 1) * 2) / (Factorial(n - 1) * Factorial(n - 1));\n }\n\n Console.WriteLine(output.ToString());\n }\n\n static long Factorial(int k)\n {\n if (k == 0)\n return 1;\n else\n return k * Factorial(k - 1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int max = 0;\n int[,] array = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i == 0 || j == 0)\n array[i, j] = 1;\n else array[i, j] = array[i - 1, j] + array[i, j - 1];\n if (array[i, j] > max);\n max = array[i, j];\n }\n }\n Console.Write(max);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n if (a == 1) Console.WriteLine(1);\n if (a == 2) Console.WriteLine(2);\n if (a == 3) Console.WriteLine(6);\n if (a == 4) Console.WriteLine(20);\n if (a == 5) Console.WriteLine(70);\n if (a == 6) Console.WriteLine(252);\n if (a == 7) Console.WriteLine(924);\n if (a == 8) Console.WriteLine(3432);\n if (a == 9) Console.WriteLine(12870);\n if (a == 10) Console.WriteLine(48620);\n //if (a == 1) Console.WriteLine(1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ProblemSolvingProject\n{\n class MaximumInTheTable\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] arr = new int[n, n];\n for(int i = 0; i 0 && j > 0)\n {\n data[i][j] = data[i - 1][j] + data[i][j - 1];\n }\n else\n {\n data[i][j] = 1;\n }\n }\n }\n\n Console.WriteLine(data[n-1][n-1]);\n }\n }\n}\n"}, {"source_code": "\ufeffclass Program\n{\n static void Main()\n {\n switch(System.Console.ReadLine())\n {\n case \"10\":\n Out(\"48620\");\n break;\n case \"9\":\n Out(\"12870\");\n break;\n case \"8\":\n Out(\"3432\");\n break;\n case \"7\":\n Out(\"924\");\n break;\n case \"6\":\n Out(\"252\");\n break;\n case \"5\":\n Out(\"70\");\n break;\n case \"4\":\n Out(\"20\");\n break;\n case \"3\":\n Out(\"6\");\n break;\n case \"2\":\n Out(\"2\");\n break;\n case \"1\":\n Out(\"1\");\n break;\n case \"0\":\n Out(\"0\");\n break;\n }\n }\n static void Out(string line) { System.Console.Write(line); }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\n\nnamespace codeforcesSolution\n{\n class Program\n {\n #region testlib\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(s.Replace('.', ','), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(s.Replace('.', ','), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(s.Replace('.', ','), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion \n\n static void Main()\n {\n int n = cin.ReadInt32();\n long[,] a = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n a[i, 0] = a[0, i] = 1;\n }\n long max = 1;\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n a[i, j] = a[i - 1, j] + a[i, j - 1];\n max = Math.Max(a[i, j], max);\n }\n }\n cout += max + endl;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{ \n class Program\n {\n static IEnumerable iterator()\n {\n yield return 7;\n yield return 8;\n }\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n int x = int.Parse(s);\n int[,] table = new int[x, x];\n\n for (int i = 0; i < x; i++ )\n table[i,0] = table[0,i] = 1;\n\n\n for (int i = 1; i < x; i++)\n for (int j = 1; j < x; j++)\n table[i, j] = table[i - 1, j] + table[i, j - 1];\n \n Console.Write(table[x-1, x-1]);\n\n //foreach (var v in table)\n // Console.Write(v);\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine(GetMax(n, n));\n }\n\n private static long GetMax(int i, int j)\n {\n if (i == 1 || j == 1)\n return 1;\n return GetMax(i - 1, j) + GetMax(i, j - 1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace maximum_in_table\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int n;\n int [] a = new int[10] { 1, 2, 6, 20, 70, 252, 924, 3432, 12870, 48620 };\n n = int.Parse(Console.ReadLine());\n Console.WriteLine(a[n - 1]);\n Console.ReadLine();\n\n\n\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _codeForces__509A_\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt16(Console.ReadLine());\n int[,] table = new int[input, input];\n for(int i = 0; i\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (x.c != y.c) return 1;\n\t\t\t\tif (x.r < y.r)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x)\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar arr = new int[11, 11];\n\t\t\tvar n = int.Parse(s);\n\t\t\tfor (var i = 1; i <= n; ++i)\n\t\t\t\tarr[i, 1] = arr[1, i] = 1;\n\t\t\tfor (var i = 2; i <= n; ++i)\n\t\t\t\tfor (var j = 2; j <= n; ++j)\n\t\t\t\t\tarr[i, j] = arr[i - 1, j] + arr[i, j - 1];\n\t\t\tConsole.WriteLine(arr[n, n]);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nnamespace Contest509ProblemA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[][] array = new int[n][];\n for (int i = 0; i < n; i++)\n {\n array[i] = new int[n];\n array[0][i] = 1;\n array[i][0] = 1;\n }\n for (int i = 1; i < n; i++)\n for (int j = 1; j < n; j++) array[i][j] = array[i - 1][j] + array[i][j - 1];\n Console.WriteLine(array[n-1][n-1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] values = new int[n, n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n if (i == 0)\n {\n values[i, j] = 1;\n }\n else if (j == 0)\n {\n values[i, j] = 1;\n\n }\n else\n {\n values[i, j] = values[i, j - 1] + values[i - 1, j];\n }\n\n }\n\n }\n Console.WriteLine(values[n - 1, n - 1]);\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Data.Sql;\nusing System.Collections;\nusing System.Numerics;\n\n\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[,] x = new int[n,n];\n int k;\n for (int i = 0; i < n; i++)\n {\n if (i == 0)\n for (k = 0; k < n; k++)\n {\n x[0, k] = 1;\n x[k - i, 0] = 1;\n }\n\n else\n {\n for ( k = 1; k < n; k++)\n {\n x[i,k] = x [i-1 ,k] + x[i, k-1];\n }\n \n }\n \n }\n Console.WriteLine(x[n-1,n-1]);\n \n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n int[,] tabla = new int[n, n];\n\n for (int i = 0; i < n; i++)\n {\n tabla[0, i] = 1;\n tabla[i, 0] = 1;\n }\n \n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n tabla[i, j] = tabla[i - 1, j] + tabla[i, j - 1];\n }\n\n }\n\n //for (int i = 0; i < n; i++)\n //{\n // for (int j = 0; j < n; j++)\n // {\n // Console.Write(tabla[i, j] + \" \");\n // }\n // Console.WriteLine();\n\n //}\n Console.WriteLine(tabla[n - 1, n - 1]);\n\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _509A\n{\n class Program\n {\n static void Main()\n {\n var n = long.Parse(Console.ReadLine())-1;\n Console.WriteLine(Fact(2*n)/Fact(n)/Fact(n));\n }\n static long Fact(long num)\n {\n long i = 1;\n while(1>();\n table.Add(new List(new int[] {1, 1, 1, 1, 1}));\n for (var i = 1; i <= 9; i++) {\n table.Add(new List(new int[5]));\n table[i][0] = 1;\n for (var j = 1; j < 5; j++)\n table[i][j] = table[i][j-1] + table[i-1][j];\n }\n Console.WriteLine(table[n-1][4]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Testerka\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[,] a = new int[n, n];\n for (int i = 0; i < n; i++)\n {\n a[i, 0] = 1;\n a[0, i] = 1;\n }\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n a[i, j] = a[i, j - 1] + a[i - 1, j];\n }\n }\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problema_MAXIMO_NA_TABELA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m = 0;\n \n\n \n n = int.Parse(Console.ReadLine());\n\n int[,] Matriz = new int[n,n];\n\n \n\n \n //Matriz para \"setar\" os valores na primeira linha e primeiras counas\n for(int x=0;x< n;x++)\n {\n for(int y=0;y< n;y++)\n {\n Matriz[x, 0] = 1;\n Matriz[0, y] = 1;\n }\n }\n\n //Matriz pa\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n Matriz[i, j] = Matriz[i - 1, j] + Matriz[i, j - 1];\n }\n }\n\n for (int a = 0; a < n; a++)\n {\n for (int b = 0; b < n; b++)\n {\n Console.Write(Matriz[a,b]+\" \");\n m = Matriz[a, b];\n }\n Console.WriteLine();\n }\n Console.WriteLine(m);\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problema_MAXIMO_NA_TABELA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m = 0;\n \n\n \n n = int.Parse(Console.ReadLine());\n\n int[,] Matriz = new int[n,n];\n\n \n\n \n //Matriz para \"setar\" os valores na primeira linha e primeiras counas\n for(int x=0;x< n;x++)\n {\n for(int y=0;y< n;y++)\n {\n Matriz[x, 0] = 1;\n Matriz[0, y] = 1;\n }\n }\n\n //Matriz pa\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n Matriz[i, j] = Matriz[i - 1, j] + Matriz[i, j - 1];\n }\n }\n\n \n Console.WriteLine(m);\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace weith\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine()); \n\t\t\t int[,] a = new int[n, n];\n\t\t\t for (int j = 0; j < n; j++) \n\t\t\t {\n\t\t\t\t a[0,j] = 1;\n\t\t\t }\n\t\t\t for (int i = 0; i < n; i++) \n\t\t\t {\n\t\t\t\t a[i,0] = 1;\n\t\t\t }\n\t\t\t for (int i = 1; i < n; i++)\n\t\t\t {\n\t\t\t\t for (int j = 1; j < n; j++)\n\t\t\t\t {\n\t\t\t\t\t a[i,j] = a[i-1, j] + a[i, j-1]; \n\t\t\t\t }\n\t\t\t }\n\t\t\t for (int i = 1; i < n; i++)\n\t\t\t {\n\t\t\t\t for (int j = 1; j < n; j++)\n\t\t\t\t {\n\t\t\t\t\t if( i == n-1 && j == n-1)\n\t\t\t\t\t {\n\t\t\t\t\t\t Console.WriteLine(a[n-1, n-1]);\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var arr = new int[n, 2];\n for (int i = 0; i < n; i++)\n {\n arr[i, 0] = 1;\n }\n for (var tn = 1; tn < n; tn++)\n {\n arr[0, 1] = 1;\n for (int i = 1; i < n; i++)\n {\n arr[i, 1] = arr[i - 1, 1] + arr[i, 0];\n }\n for (int i = 0; i < n; i++)\n {\n arr[i, 0] = arr[i, 1];\n }\n }\n Console.WriteLine(arr[n-1,1]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Collections;\nclass Problem\n{\n static void Main()\n {\n int n = Convert.ToInt32( Console.ReadLine() );\n Console.WriteLine( kq( n - 1) );\n }\n\n private static string kq(int p)\n {\n int str = 1;\n for(int i = p + 1 ; i <= 2 * p ; i++)\n str*= i;\n for(int i = 1 ; i <= p ; i++)\n str /= i;\n return str.ToString();\n }\n}"}, {"source_code": "using System;\n\npublic class CodeForces\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n long t = 1;\n int i = 1;\n while (i <= n)\n {\n t *= 11;\n ++i;\n }\n i = n / 2;\n while (i > 0)\n {\n t /= 10;\n --i;\n }\n Console.WriteLine(t % 10);\n }\n}"}, {"source_code": "using System;\n\npublic class CodeForces\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] c = new int[n];\n for (int i = 0; i < n; ++i)\n {\n c[i] = 1;\n }\n while (n > 1)\n {\n for (int i = 1; i < n; ++i)\n {\n c[i] = c[i - 1] + c[i];\n }\n --n;\n }\n Console.WriteLine(c[c.Length - 1]);\n }\n}"}, {"source_code": "using System;\n\npublic class CodeForces\n{\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] c = new int[n];\n for (int i = 0; i < n; ++i)\n {\n c[i] = 1;\n }\n while (n > 1)\n {\n for (int i = 1; i < n; ++i)\n {\n c[i] = c[i - 1] + c[i];\n }\n --n;\n }\n Console.WriteLine(c[n - 1]);\n }\n}"}, {"source_code": "using System;\npublic abstract class Animal : Object\n{\n public abstract void say();\n}\npublic class Dog : Animal\n{\n public override void say()\n {\n Console.WriteLine(\"\u0413\u0430\u0432\");\n }\n public static void hi()\n {\n Console.WriteLine(\"hi\");\n }\n}\nstruct lol\n{\n int x, y;\n\n};\nnamespace EduSharp\n{\n class Program\n {\n static void swap(ref T a,ref T b)\n {\n T temp = a;\n a = b;\n b = temp;\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n if (n == 1) Console.WriteLine(\"1\");\n else\n {\n int max = 0;\n for (int i = 2; i <= n; i++)\n {\n int x = max + n * i;\n if (x > max) max = x;\n }\n Console.WriteLine(max);\n }\n \n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _509A_Maximum_in_Table\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int output;\n\n if (n == 1)\n output = 1;\n else\n {\n output = Factorial((n - 1) * 2) / (Factorial(n - 1) * Factorial(n - 1));\n }\n\n Console.WriteLine(output.ToString());\n }\n\n static int Factorial(int k)\n {\n if (k == 0)\n return 1;\n else\n return k * Factorial(k - 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\n\nnamespace codeforcesSolution\n{\n class Program\n {\n #region testlib\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (default(T) is String) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(s.Replace('.', ','), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(s.Replace('.', ','), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(s.Replace('.', ','), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion \n\n static void Main()\n {\n int n = cin.ReadInt32();\n long[,] a = new long[n, n];\n for (int i = 0; i < n; i++)\n {\n a[i, 0] = a[0, i] = 1;\n }\n long max = 0;\n for (int i = 1; i < n; i++)\n {\n for (int j = 1; j < n; j++)\n {\n a[i, j] = a[i - 1, j] + a[i, j - 1];\n max = Math.Max(a[i, j], max);\n }\n }\n cout += max + endl;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _509A\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine())-1;\n Console.WriteLine(Fact(2*n)/Fact(n)/Fact(n));\n }\n static int Fact(int num)\n {\n int i = 1;\n while(1 '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void Main(String[] args)\n {\n var line = reader.ReadLine().Split(' ').Select(int.Parse).ToList();\n var a = line[0];\n var b = line[1];\n line = reader.ReadLine().Split(' ').Select(int.Parse).ToList();\n var c = line[0];\n var d = line[1];\n\n for(var i = 0; i < 100000; i++)\n {\n var dem = a * i + b - d;\n if(dem % c == 0 && dem >= 0)\n {\n Console.WriteLine(b + (i) * a);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem787A\n{\n class Program\n {\n static int UCLN(int a, int b)\n {\n int r = a % b;\n if (r != 0)\n return UCLN(b, r);\n else \n return b;\n }\n static void Main(string[] args)\n {\n int a = NextInt(), b = NextInt(); \n int c = NextInt(), d = NextInt();\n int flag = 0;\n if (a > c)\n flag = UCLN(a, c);\n else\n flag = UCLN(c, a);\n if ((d - b) % flag != 0) \n Console.Write(-1);\n else\n {\n int x = b;\n int y = d;\n while (x != y)\n {\n if (x < y)\n x += a;\n else\n y += c;\n }\n Console.Write(x);\n }\n Console.ReadLine();\n }\n static int s_index = 0;\n static List s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleTraining\n{\n public class Program\n {\n static void Main(string[] args)\n {\n List sd = Console.ReadLine().Split().Select(int.Parse).ToList();\n int a = sd[0]; int b = sd[1];\n List sd1 = Console.ReadLine().Split().Select(int.Parse).ToList();\n int c = sd1[0]; int d = sd1[1];\n List aa = new List();\n List bb = new List();\n\n int br = 0;\n for (int i = 0; i < 100; i++)\n {\n aa.Add(b + i * a);\n bb.Add(d + i * c);\n }\n\n for (int i = 0; i < 100; i++)\n {\n for (int j = 0; j < 100; j++)\n {\n if (aa[i] == bb[j]) {\n br++; Console.WriteLine(aa[i]);\n return;\n }\n }\n }\n\n if (br == 0) Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main()\n {\n var inputRick = Console.ReadLine();\n var inputMorti = Console.ReadLine();\n var varsRick = inputRick.Split(' ');\n var varsMorti = inputMorti.Split(' ');\n int a = int.Parse(varsRick[0]),\n b = int.Parse(varsRick[1]),\n c = int.Parse(varsMorti[0]),\n d = int.Parse(varsMorti[1]),\n result = 0;\n int i = 0, j = 0;\n\n while (true) {\n\n var timeRick = b + i * a;\n var timeMorti = d + j * c;\n \n while (timeRick < timeMorti) {\n i++;\n timeRick = b + i * a;\n }\n\n while (timeMorti < timeRick) {\n j++;\n timeMorti = d + j * c;\n }\n if (timeRick == timeMorti) {\n result = b + i * a;\n break;\n }\n\n if (timeRick >= 100000000 || timeMorti >= 100000000) {\n result = -1;\n break;\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main(string[] args)\n {\n new Solver().Solve().OutputResult();\n }\n\n private class ExtendedReader : StreamReader\n {\n private static readonly char Separator = ' ';\n\n public ExtendedReader(Stream stream) : base(stream) { }\n public ExtendedReader(Stream stream, bool detectEncodingFromByteOrderMarks) : base(stream, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding) : base(stream, encoding) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(stream, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n public ExtendedReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen) : base(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen) { }\n public ExtendedReader(string path) : base(path) { }\n public ExtendedReader(string path, bool detectEncodingFromByteOrderMarks) : base(path, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding) : base(path, encoding) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks) : base(path, encoding, detectEncodingFromByteOrderMarks) { }\n public ExtendedReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) : base(path, encoding, detectEncodingFromByteOrderMarks, bufferSize) { }\n\n public char ReadChar()\n {\n return (char)this.Read();\n }\n\n public double ReadDoubleFromArray()\n {\n StringBuilder sb = new StringBuilder();\n char ch = this.ReadChar();\n while (ch != Separator && ch != '\\n')\n {\n sb.Append(ch);\n ch = this.ReadChar();\n }\n return Convert.ToDouble(sb.ToString());\n }\n\n public int ReadInt()\n {\n return int.Parse(this.ReadLine());\n }\n\n public Int64 ReadInt64()\n {\n return Int64.Parse(this.ReadLine());\n }\n\n public int[] ReadIntArray()\n {\n return this.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n public char[] ReadCharArray()\n {\n return this.ReadLine().ToCharArray();\n }\n\n public string ReadString()\n {\n return this.ReadLine();\n }\n\n public Int64[] ReadInt64Array()\n {\n return this.ReadLine().Split(Separator).Select(Int64.Parse).ToArray();\n }\n\n public Double[] ReadDoubleArray()\n {\n return this.ReadLine().Split(Separator).Select(Double.Parse).ToArray();\n }\n }\n\n private abstract class SolverBase\n {\n protected readonly ExtendedReader _reader;\n protected readonly TextWriter _writer;\n\n protected SolverBase()\n {\n#if DEBUG\n _reader = new ExtendedReader(\"input.txt\");\n //_writer = new StreamWriter(\"output.txt\");\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#else\n _reader = new ExtendedReader(Console.OpenStandardInput());\n _writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n }\n\n public abstract Solver Solve();\n\n public abstract void OutputResult();\n }\n\n private class Solver : SolverBase\n {\n private int result = -1;\n\n public override Solver Solve()\n {\n // link to task: http://codeforces.com/contest/787/problem/0\n\n var input = _reader.ReadIntArray();\n var a = input[0];\n var b = input[1];\n input = _reader.ReadIntArray();\n var c = input[0];\n var d = input[1];\n\n var first = new HashSet();\n for (int i = 0; i <= 10000; i++)\n {\n first.Add(b + i * a);\n }\n\n int j = 0;\n for (int i = 0; i < 10000; i++)\n {\n var number = d + i * c;\n if (first.Contains(number))\n {\n result = number;\n break;\n }\n }\n\n return this;\n }\n\n public override void OutputResult()\n {\n string answer = result.ToString(CultureInfo.InvariantCulture);\n\n _writer.WriteLine(answer);\n _writer.Dispose();\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar a = cin.NextLong();\n\t\t\tvar b = cin.NextLong();\n\t\t\tvar c = cin.NextLong();\n\t\t\tvar d = cin.NextLong();\n\t\t\tvar bb = b;\n\t\t\tvar dd = d;\n\t\t\tvar counter = (int) 10e7;\n\t\t\twhile (bb != dd)\n\t\t\t{\n\t\t\t\tif (bb < dd)\n\t\t\t\t{\n\t\t\t\t\tbb += a;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdd += c;\n\t\t\t\t}\n\t\t\t\tcounter--;\n\t\t\t\tif (counter == 0)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(-1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(bb);\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n var l = Console.ReadLine().Split();\n int a = int.Parse(l[0]);\n int b = int.Parse(l[1]);\n l = Console.ReadLine().Split();\n int c = int.Parse(l[0]);\n int d = int.Parse(l[1]);\n for (int i = 0; i < 100; i++)\n {\n for (int j = 0; j < 100; j++)\n {\n if (b + a * i == d+ c * j)\n {\n Console.WriteLine(b + a * i);\n Console.Read();\n return;\n }\n }\n }\n Console.WriteLine(-1);\n Console.Read();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace testik\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int a = ar[0];\n int b = ar[1];\n ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int c = ar[0];\n int d = ar[1];\n int i = 10000;\n \n while (i > 0)\n {\n if (b < d)\n {\n b += a;\n }\n else\n {\n if (b > d)\n {\n d += c;\n }\n else\n {\n Console.WriteLine(d);\n return;\n }\n }\n i--;\n }\n Console.WriteLine(-1);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace index\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Ric = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Martin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int sumRic = Ric[0] + Ric[1];\n int sumMartin = Martin[0] + Martin[1];\n\n int res = 0;\n\n if((sumMartin % 2 == 0 && Martin[1] % 2 == 0 && sumRic % 2 != 0 && Ric[1] % 2 != 0) || (sumMartin % 2 != 0 && Martin[1] % 2 != 0 && sumRic % 2 == 0 && Ric[1] % 2 == 0))\n {\n res = -1;\n }\n else \n {\n int M = Martin[1];\n int R = Ric[1];\n int i = 1;\n int j = 1;\n\n if (M > R)\n {\n while (R != M)\n {\n while (R < M)\n {\n R = Ric[1] + Ric[0] * i;\n i++;\n }\n if (R != M)\n {\n M = Martin[1] + Martin[0] * j;\n j++;\n }\n if(M > 20000)\n {\n res = -1;\n break;\n }\n }\n if (res != -1)\n {\n res = M;\n }\n }\n else if (R > M)\n {\n while (R != M)\n {\n while (R > M)\n {\n M = Martin[1] + Martin[0] * i;\n i++;\n }\n if (R != M)\n {\n R = Ric[1] + Ric[0] * j;\n j++;\n }\n if(R > 20000)\n {\n res = -1;\n break;\n }\n }\n if (res != -1)\n {\n res = M;\n }\n }\n else\n {\n res = M;\n }\n }\n\n\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Nastya\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data1 = (Console.ReadLine()).Split(' ');\n string[] data2 = (Console.ReadLine()).Split(' ');\n\n int a = int.Parse(data1[0]);\n int b = int.Parse(data1[1]);\n\n int c = int.Parse(data2[0]);\n int d = int.Parse(data2[1]);\n\n\n Console.WriteLine(result(a, b, c, d));\n\n }\n\n static int result(int a, int b, int c, int d)\n {\n for (int i = 0; i <=100; i++)\n {\n int RickTime = (b + i * a);\n \n for (int j = 0; j < 100; j++)\n {\n int MotriTime = (d + j * c);\n\n if (RickTime == MotriTime)\n {\n return MotriTime;\n }\n }\n }\n\n return -1;\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split();\n\n int a = int.Parse(s[0]), b = int.Parse(s[1]);\n s = Console.ReadLine().Split();\n int c = int.Parse(s[0]), d = int.Parse(s[1]);\n int i = 10000000;\n \n while (i > 0)\n {\n if (b < d)\n {\n b += a;\n }\n else\n if (b > d)\n {\n d += c;\n }\n else\n {\n Console.WriteLine(b);\n return;\n }\n i--;\n }\n Console.WriteLine(-1);\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace The_Monster\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int a = Next();\n int b = Next();\n int c = Next();\n int d = Next();\n\n var nn = new List();\n for (; b < 100000;)\n {\n nn.Add(b);\n b += a;\n }\n for (; d < 100000;)\n {\n if (nn.BinarySearch(d) >= 0)\n {\n writer.WriteLine(d);\n writer.Flush();\n return;\n }\n d += c;\n }\n\n writer.WriteLine(\"-1\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _787A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input1 = Console.ReadLine().Split(' '), input2 = Console.ReadLine().Split(' ');\n decimal a = decimal.Parse(input1[0]), b = decimal.Parse(input1[1]);\n decimal c = decimal.Parse(input2[0]), d = decimal.Parse(input2[1]);\n bool result = false;\n for (decimal y = 0; y <= 100000; y++)\n {\n decimal x = (d + y * c - b) / a;\n if (x >= 0 && x == Math.Floor(x))\n {\n Console.WriteLine((b + x * a).ToString());\n result = true;\n break;\n }\n }\n if (!result) Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\ufeffusing System.IO;\n\ufeffusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")) {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var input = sr.ReadArray(Int32.Parse);\n var a = input[0];\n var b = input[1];\n input = sr.ReadArray(Int32.Parse);\n var c = input[0];\n var d = input[1];\n for (var i = 0; i < 1000; i++) {\n var t1 = b + a * i;\n for (var j = 0; j < 1000; j++) {\n var t2 = d + c * j;\n if (t1 == t2) {\n sw.WriteLine(t1);\n return;\n }\n }\n }\n\n sw.WriteLine(-1);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _100853_Codeforce\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n int[] array = Console.ReadLine().Split(' ')\n .Where(x => !string.IsNullOrWhiteSpace(x))\n .Select(int.Parse).ToArray();\n int a = array[0];\n int b = array[1];\n array = Console.ReadLine().Split(' ')\n .Where(x => !string.IsNullOrWhiteSpace(x))\n .Select(int.Parse).ToArray();\n int c = array[0];\n int d = array[1];\n \n\n for(int i = 10000; i > 0; i--)\n {\n if (b < d)\n {\n b += a;\n }\n else\n {\n if (b > d)\n {\n d += c;\n }\n else\n {\n Console.WriteLine(d);\n return;\n }\n }\n }\n\n Console.WriteLine(-1);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Point : IComparable\n {\n public int Index { get; set; }\n public decimal Andle { get; set; }\n public Point(decimal angle, int index)\n {\n Index = index;\n Andle = angle;\n }\n public int CompareTo(Point other)\n {\n return this.Andle.CompareTo(other.Andle);\n }\n }\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n s = Console.ReadLine().Split();\n long c = long.Parse(s[0]);\n long d = long.Parse(s[1]);\n int[] mas = new int[10000001];\n mas[b] = 1;\n while (b < mas.Length)\n {\n mas[b] = 1;\n b += a;\n }\n if (mas[d] == 1)\n {\n Console.WriteLine(d);\n return;\n }\n\n while (d < mas.Length)\n {\n if (mas[d] == 1)\n {\n Console.WriteLine(d);\n return;\n }\n d += c;\n\n }\n Console.WriteLine(-1);\n }\n }\n}\n/*7 3 0 0\n1 2 2 3 4 5 6\n2 2 3*/"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Monsters\n{\n static void Main()\n {\n List pesho = Console.ReadLine().Split().Select(int.Parse).ToList();\n List gosho = Console.ReadLine().Split().Select(int.Parse).ToList();\n\n int a = pesho[0];\n int b = pesho[1];\n int c = gosho[0];\n int d = gosho[1];\n\n int peshoC;\n int goshoC;\n\n Dictionary screamers = new Dictionary();\n\n int MaxTime = (int)Math.Pow(100,2)+1;\n int Result = -1;\n\n for (int i = 0; i < MaxTime; i++)\n {\n peshoC = b + a * i;\n goshoC = d + c * i;\n if (!screamers.ContainsKey(peshoC))\n {\n screamers.Add(peshoC, 1);\n }\n else\n {\n Result = peshoC;\n break;\n }\n if (!screamers.ContainsKey(goshoC))\n {\n screamers.Add(goshoC, 1);\n }\n else\n {\n Result = goshoC;\n break;\n }\n }\n Console.WriteLine(Result);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Monsters\n{\n static void Main()\n {\n List pesho = Console.ReadLine().Split().Select(int.Parse).ToList();\n List gosho = Console.ReadLine().Split().Select(int.Parse).ToList();\n\n int a = pesho[0];\n int b = pesho[1];\n int c = gosho[0];\n int d = gosho[1];\n Dictionary screamers = new Dictionary();\n int MaxTime = 100 ^ 2+1;\n int Result = -1;\n\n for (int i = 0; i < MaxTime; i++)\n {\n if (!screamers.ContainsKey(b + a * i))\n {\n screamers.Add(b + a * i, 1);\n }\n else\n {\n Result = b + a * i;\n break;\n }\n if (!screamers.ContainsKey(d + c * i))\n {\n screamers.Add(d+ c * i, 1);\n }\n else\n {\n Result = d + c * i;\n break;\n }\n }\n Console.WriteLine(Result);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Dados\n string txt = Console.ReadLine();\n int a = int.Parse(txt.Split()[0]), b = int.Parse(txt.Split()[1]);\n txt = Console.ReadLine();\n int c = int.Parse(txt.Split()[0]), d = int.Parse(txt.Split()[1]);\n bool achou = false;\n int resultado = 0;\n\n //O conjunto que pode abranger o resultado \u00e9 incalculavel\n for(int i = 0; i < 1000 ; i++)\n {\n for(int j = 0; j < 1000; j++)\n {\n if(b + a * i == d + c * j)\n {\n resultado = b + a * i;\n achou = true;\n break;\n }\n }\n if (achou)\n break;\n }\n\n if (achou)\n Console.Write(resultado);\n else\n Console.Write(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Deneme\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] cd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int rtime = ab[1];\n int mtime = cd[1];\n while (rtime != mtime && rtime < 100000)\n {\n while (rtime < mtime)\n rtime += ab[0];\n while (mtime < rtime)\n mtime += cd[0];\n }\n if (rtime >= 100000)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(rtime);\n Console.ReadKey();\n }\n catch { }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\n#pragma warning disable\n\nclass Segtree\n{\n int n;\n T[] tree;\n Func f;\n T exnum;\n public Segtree(int m, Func f, T ex)\n {\n this.f = f;\n this.exnum = ex;\n n = 1;\n while (n < m) n <<= 1;\n\n tree = new T[(n << 1) - 1];\n for (int i = 0; i < tree.Length; i++) tree[i] = ex;\n }\n public Segtree(int m, T ini, Func f, T ex)\n {\n this.f = f;\n this.exnum = ex;\n n = 1;\n while (n < m) n <<= 1;\n\n tree = new T[(n << 1) - 1];\n for (int i = 0; i < tree.Length; i++) tree[i] = ini;\n for (int i = 0; i < m; ++i) update(i, ini);\n }\n public void update(int j, T x)\n {\n int i = j + n - 1;\n tree[i] = x;\n while (i > 0)\n {\n i = (i - 1) >> 1;\n tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]);\n }\n }\n public T look(int i) { return tree[i + n - 1]; }\n\n // [s, t]\n public T run(int s, int t) { return query(s, t + 1, 0, 0, n); }\n T query(int s, int t, int k, int l, int r)\n {\n if (r <= s || t <= l) return exnum;\n if (s <= l && r <= t) return tree[k];\n\n return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r));\n }\n}\n\nclass PriorityQueue\n{\n private Comparison comp;\n private List list;\n private int count;\n public PriorityQueue() : this((x, y) => ((IComparable)x).CompareTo(y)) { }\n public PriorityQueue(Comparison comparison)\n {\n comp = comparison;\n list = new List();\n count = 0;\n }\n public void Enqueue(T x)\n {\n var pos = count++;\n list.Add(x);\n while (pos > 0)\n {\n var p = (pos - 1) / 2;\n if (comp(list[p], x) <= 0) break;\n list[pos] = list[p];\n pos = p;\n }\n list[pos] = x;\n }\n public T Dequeue()\n {\n var value = list[0];\n var x = list[--count];\n list.RemoveAt(count);\n if (count == 0) return value;\n var pos = 0;\n while (pos * 2 + 1 < count)\n {\n var a = 2 * pos + 1;\n var b = 2 * pos + 2;\n if (b < count && comp(list[b], list[a]) < 0) a = b;\n if (comp(list[a], x) >= 0) break;\n list[pos] = list[a];\n pos = a;\n }\n list[pos] = x;\n return value;\n }\n public T Peek() { return list[0]; }\n public bool Any() { return count > 0; }\n public int Count() { return count; }\n}\n\nnamespace Codeforces\n{\n class Program\n {\n class mymath\n {\n static int Mod = 1000000007;\n public void setMod(int m) { Mod = m; }\n public bool isprime(long a)\n {\n if (a < 2) return false;\n for (long i = 2; i * i <= a; i++) if (a % i == 0) return false;\n return true;\n }\n public bool[] sieve(int n)\n {\n var isp = new bool[n + 1];\n for (int i = 2; i <= n; i++) isp[i] = true;\n for (int i = 2; i * i <= n; i++) if (isp[i]) for (int j = i * i; j <= n; j += i) isp[j] = false;\n return isp;\n }\n public List getprimes(int n)\n {\n var prs = new List();\n var isp = sieve(n);\n for (int i = 2; i <= n; i++) if (isp[i]) prs.Add(i);\n return prs;\n }\n public long[][] E(int n)\n {\n var ret = new long[n][];\n for (int i = 0; i < n; i++)\n {\n ret[i] = new long[n];\n ret[i][i] = 1;\n }\n return ret;\n }\n public long[][] powmat(long[][] A, long n)\n {\n if (n == 0) return E(A.Length);\n var t = powmat(A, n / 2);\n if ((n & 1) == 0) return mulmat(t, t);\n return mulmat(mulmat(t, t), A);\n }\n public long[] mulmat(long[][] A, long[] x)\n {\n int n = A.Length, m = x.Length;\n var ans = new long[n];\n for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) ans[i] = (ans[i] + x[j] * A[i][j]) % Mod;\n return ans;\n }\n public long[][] mulmat(long[][] A, long[][] B)\n {\n int n = A.Length, m = B[0].Length, l = B.Length;\n var ans = new long[n][];\n for (int i = 0; i < n; i++)\n {\n ans[i] = new long[m];\n for (int j = 0; j < m; j++) for (int k = 0; k < l; k++) ans[i][j] = (ans[i][j] + A[i][k] * B[k][j]) % Mod;\n }\n return ans;\n }\n public long[] addmat(long[] x, long[] y)\n {\n int n = x.Length;\n var ans = new long[n];\n for (int i = 0; i < n; i++) ans[i] = (x[i] + y[i]) % Mod;\n return ans;\n }\n public long[][] addmat(long[][] A, long[][] B)\n {\n int n = A.Length, m = A[0].Length;\n var ans = new long[n][];\n for (int i = 0; i < n; i++) ans[i] = addmat(A[i], B[i]);\n return ans;\n }\n public long powmod(long a, long b)\n {\n if (a >= Mod) return powmod(a % Mod, b);\n if (a == 0) return 0;\n if (b == 0) return 1;\n var t = powmod(a, b / 2);\n if ((b & 1) == 0) return t * t % Mod;\n return t * t % Mod * a % Mod;\n }\n public long inv(long a) { return powmod(a, Mod - 2); }\n public long gcd(long a, long b)\n {\n while (b > 0) { var t = a % b; a = b; b = t; }\n return a;\n }\n public long lcm(long a, long b) { return a * (b / gcd(a, b)); }\n public long Comb(int n, int r)\n {\n if (n < 0 || r < 0 || r > n) return 0;\n if (n - r < r) r = n - r;\n if (r == 0) return 1;\n if (r == 1) return n;\n var numerator = new int[r];\n var denominator = new int[r];\n for (int k = 0; k < r; k++)\n {\n numerator[k] = n - r + k + 1;\n denominator[k] = k + 1;\n }\n for (int p = 2; p <= r; p++)\n {\n int pivot = denominator[p - 1];\n if (pivot > 1)\n {\n int offset = (n - r) % p;\n for (int k = p - 1; k < r; k += p)\n {\n numerator[k - offset] /= pivot;\n denominator[k] /= pivot;\n }\n }\n }\n long result = 1;\n for (int k = 0; k < r; k++) if (numerator[k] > 1) result = result * numerator[k] % Mod;\n return result;\n }\n }\n\n const long InfL = 4011686018427387913L;\n static char[] sep = new char[] { ' ', '/' };\n\n\n //static int[] dx = { -1, 0, 1, -1, 1, -1, 0, -1 };\n //static int[] dy = { 1, 1, 1, 0, 0, -1, -1, -1 };\n\n static int[] dx = { -1, 0, 0, 1 };\n static int[] dy = { 0, 1, -1, 0 };\n\n\n /// \n /// basic dfs function\n /// \n /// \n /* public class List_of_List : List> { }\n static int result = 0;\n \n static List visited = new List();\n static List_of_List adj = new List_of_List();\n static Stack route = new Stack();\n \n static void dfs(int here)\n {\n if (here == n * m - 1)\n {\n result++;\n return;\n }\n visited[here] = true;\n \n for(int i = 0; i int.Parse(Console.ReadLine());\n static int[] getIntArr => Console.ReadLine().Trim().Split(sep).Select(a => int.Parse(a)).ToArray();\n static List getIntList => Console.ReadLine().Trim().Split(sep).Select(a => int.Parse(a)).ToList();\n static string getString => Console.ReadLine().Trim();\n static string[] getStrArr => Console.ReadLine().Trim().Split(sep);\n static List getStrList => Console.ReadLine().Trim().Split(sep).ToList();\n */\n static int m;\n static int n;\n static int[] input = new int[100001];\n\n [Flags]\n enum days\n {\n Sunday = 1, Monday = 2, Tuesday = 4, Wednesday = 8, Thursday = 16, Friday = 32, Saturday = 64\n }\n\n delegate void calcDelegate(int x, int y);\n\n static void Add(int x, int y) { Console.WriteLine( x + y); }\n static void Sub(int x, int y) { Console.WriteLine( x - y); }\n static void Mult(int x, int y) { Console.WriteLine( x * y); }\n static void Div(int x, int y) { Console.WriteLine( x / y); }\n\n public class List_of_List : List> { }\n static List distance = new List();\n static List parent = new List();\n static List_of_List adj = new List_of_List();\n\n static void bfs(int start, List distance)\n {\n Queue q = new Queue();\n List order = new List();\n distance[start] = 0;\n parent[start] = start;\n q.Enqueue(start);\n while(q.Count != 0)\n {\n int here = q.Dequeue();\n order.Add(here);\n for(int i = 0; i shortestPath(int v, List parent)\n {\n List path = new List();\n path.Add(v);\n\n while(parent[v] != v)\n {\n v = parent[v];\n path.Add(v);\n }\n path.Reverse();\n return path;\n }\n\n static void Main(string[] args)\n {\n int[] rick = Console.ReadLine().Trim().Split(sep).Select(a => int.Parse(a)).ToArray();\n int[] morty = Console.ReadLine().Trim().Split(sep).Select(a => int.Parse(a)).ToArray();\n\n List rick_list = new List();\n List morty_list = new List();\n\n int rick_pos = rick[1];\n int morty_pos = morty[1];\n\n while(rick_pos <= 10000)\n {\n rick_list.Add(rick_pos);\n rick_pos += rick[0];\n }\n while (morty_pos <= 10000)\n {\n morty_list.Add(morty_pos);\n morty_pos += morty[0];\n }\n\n foreach(int i in rick_list)\n {\n if (morty_list.Contains(i))\n {\n Console.WriteLine(i);\n return;\n }\n }\n Console.WriteLine(-1);\n \n }\n\n static void CountPrimeNumbers(object initialValue)\n {\n string value = (string)initialValue;\n\n int primeCandidate = int.Parse(value);\n\n int totalPrimes = 0;\n\n for(int i = 2; i\n /// \uc774\ubd84 \ub9e4\uce6d \uc54c\uace0\ub9ac\uc998\n /// \n \n static bool[,] adj; // \uc5f0\uacb0 \ub9ac\uc2a4\ud2b8. \uc774\ubd84 \ub9e4\uce6d\uc774\uae30 \ub54c\ubb38\uc5d0 bool \ud615\uc2dd\uc774\ub2e4. \ud639-\uc2dc\ub77c\ub3c4 \ud0c0\uc784\uc544\uc6c3\uc774 \ub72c\ub2e4\uba74 \uc778\uc811\ub9ac\uc2a4\ud2b8\ub85c \ubc14\uafd4\ubcfc \uac83. \uc870\uae08 \ube68\ub77c\uc9c4\ub2e4.\n static List visited; // \uc67c\ucabd\uc758 \ud55c \uc815\uc810\uc5d0\uc11c \uc624\ub978\ucabd\uc758 \ubaa8\ub4e0 \uc815\uc810\uc73c\ub85c \ubc29\ubb38 \uae30\ub85d\uc744 \uc815\ub9ac\ud558\ub294 \ub9ac\uc2a4\ud2b8\n static List m_match; // \uc67c\ucabd\uc5d0 \uc788\ub294 \uc815\uc810\ub4e4\uc758 \uc9d1\ud569\n static List n_match; // \uc624\ub978\ucabd\uc5d0 \uc788\ub294 \uc815\uc810\ub4e4\uc758 \uc9d1\ud569\n \n \n static bool dfs(int a) // \uc67c\ucabd \uc815\uc810 a \uc5d0\uc11c \uc624\ub978\ucabd \uc815\uc810\uc73c\ub85c \uac00\ub294 \uacbd\ub85c\ub97c \ucc3e\ub294\ub2e4\n {\n if (visited[a]) return false;\n visited[a] = true;\n for (int b = 0; b < n; b++)\n {\n if (adj[a, b]) // \uc67c\ucabd \uc815\uc810 a \uc5d0\uc11c \uc624\ub978\ucabd \uc815\uc810\uc911 b\uc5d0 \uc5f0\uacb0\ud560 \uc218 \uc788\ub294 \uacbd\uc6b0\n {\n if (n_match[b] == -1 || dfs(n_match[b])) // b\uac00 \uc774\ubbf8 \ub9e4\uce6d\ub418\uc5b4 \uc788\ub2e4\uba74 n_match[b]\uc5d0\uc11c \uc2dc\uc791\ub418\ub294 \uc99d\uac00\uacbd\ub85c\ub97c \ucc3e\ub294\ub2e4\n {\n // \uc99d\uac00 \uacbd\ub85c\ub97c \ubc1c\uacac\ud55c \uacbd\uc6b0 a\uc640 b\ub97c \ub9e4\uce58\uc2dc\ud0a4\uace0 true\ub97c \ubc18\ud658\ud55c\ub2e4\n m_match[a] = b;\n n_match[b] = a;\n return true;\n }\n }\n }\n return false;\n }\n \n static int bipartite_match()\n {\n m_match = Enumerable.Repeat(-1, m).ToList(); // \uc67c\ucabd\uc5d0 \uc788\ub294 \uc815\uc810\ub4e4\uc758 \uac01 \uc6d0\uc18c\uac00 \uc624\ub978\ucabd\uc5d0 \uc788\ub294 \uc5b4\ub5a4 \uc815\uc810\uacfc \ub300\uc751\ub418\ub294\uc9c0 \uae30\ub85d\ud558\ub294 \ub9ac\uc2a4\ud2b8\n n_match = Enumerable.Repeat(-1, n).ToList(); // \uc624\ub978\ucabd\uc5d0 \uc788\ub294 \uc815\uc810\ub4e4\uc758 \uac01 \uc6d0\uc18c\uac00 \uc67c\ucabd\uc5d0 \uc788\ub294 \uc5b4\ub5a4 \uc815\uc810\uacfc \ub300\uc751\ub418\ub294\uc9c0 \uae30\ub85d\ud558\ub294 \ub9ac\uc2a4\ud2b8\n \n int size = 0; // \uba87 \uc30d\uc774 \ub300\uc751\ub418\ub294\uc9c0 \uae30\ub85d\ud558\ub294 \ubcc0\uc218\n for (int start = 0; start < m; start++) // m_match (\uc67c\ucabd\uc5d0 \uc788\ub294 \uc815\uc810\ub4e4 \uc9d1\ud569) \uc758 \ubaa8\ub4e0 \uc6d0\uc18c\uc5d0 \ub300\ud574 dfs \uc2e4\uc2dc\n {\n visited = Enumerable.Repeat(false, m).ToList(); // \ubaa8\ub4e0 \uc810\uc5d0 \ub300\ud574 \ucd08\uae30\ud654 (\ubc29\ubb38\ud558\uc9c0 \uc54a\uc74c\uc73c\ub85c \ud45c\uc2dc)\n \n if (dfs(start)) size++; // \uac01 \uc67c\ucabd \uc815\uc810\uc5d0\uc11c dfs\ub97c \uc2e4\uc2dc\ud574\uc11c \uac08 \uc218 \uc788\ub294 \uacbd\ub85c\uac00 \uc788\ub2e4\uba74 \uacbd\ub85c\uc758 \uac1c\uc218\ub97c 1 \ub298\ub9b0\ub2e4\n }\n return size;\n }\n */\n\n /*\n /// \n /// \ub124\ud2b8\uc6cc\ud06c \uc720\ub7c9 \ubb38\uc81c\uc6a9 \ud3ec\ub4dc-\ud480\ucee4\uc2a8 \uc54c\uace0\ub9ac\uc998\n /// \n \n const int INF = 987654321;\n static int v; // \uc815\uc810\uc758 \uc218. source\uc640 sink\uac00 \uc788\uc73c\ubbc0\ub85c \uac10\uc548\ud574\uc11c \uacc4\uc0b0\n static int max_v;\n static int[,] capacity, flow;\n // capacity[u,v] = u\uc5d0\uc11c v\ub85c \ubcf4\ub0bc \uc218 \uc788\ub294 \uc6a9\ub7c9, flow[u,v] = u\uc5d0\uc11c v\ub85c \ud758\ub7ec\uac00\ub294 \uc720\ub7c9 (\ubc18\ub300\ubc29\ud5a5\uc778 \uacbd\uc6b0 \uc74c\uc218)\n \n // flow[,] \ub97c \uacc4\uc0b0\ud558\uace0 \ucd1d \uc720\ub7c9\uc744 \ubc18\ud658\ud558\ub294 \ud568\uc218\n static int networkFlow(int source, int sink)\n {\n flow = new int[max_v, max_v]; // flow \ubc30\uc5f4\uc758 \ucd08\uae30\ud654\n int totalFlow = 0;\n while (true)\n {\n List parent = Enumerable.Repeat(-1, max_v).ToList();\n Queue q = new Queue();\n parent[source] = source;\n q.Enqueue(source);\n while (q.Count != 0 && parent[sink] == -1)\n {\n int here = q.Dequeue();\n for (int there = 0; there < v; there++)\n {\n if (capacity[here, there] - flow[here, there] > 0 && parent[there] == -1)\n {\n q.Enqueue(there);\n parent[there] = here;\n }\n }\n }\n \n if (parent[sink] == -1) break;\n \n int amount = INF;\n for(int p = sink; p != source; p = parent[p])\n {\n amount = Math.Min(capacity[parent[p], p] - flow[parent[p], p], amount);\n }\n for(int p = sink; p != source; p = parent[p])\n {\n flow[parent[p], p] += amount;\n flow[p, parent[p]] -= amount;\n }\n \n totalFlow += amount;\n }\n return totalFlow;\n }\n */\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n//using System.Drawing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n//using System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n public static void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n int d = ReadInt();\n\n int N = 1000000;\n bool[] u = new bool[N];\n for (int i = b; i < N; i += a)\n {\n u[i] = true;\n }\n for (int i = d; i < N; i += c)\n {\n if (u[i])\n {\n Writer.WriteLine(i);\n return;\n }\n }\n Writer.WriteLine(-1);\n }\n\n public static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n //Reader = File.OpenText(\"concatenation.in\"); Writer = File.CreateText(\"concatenation.out\");\n\n Solve();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n#region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n#endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] reader = Console.ReadLine().Split(' ');\n int a = int.Parse(reader[0]), b = int.Parse(reader[1]);\n\n reader = Console.ReadLine().Split(' ');\n int c = int.Parse(reader[0]), d = int.Parse(reader[1]);\n\n int output = -1;\n\n var X1 = Enumerable.Range(0, 101).Select(x => b + (x * a)).ToList();\n var X2 = Enumerable.Range(0, 101).Select(x => d + (x * c)).ToList();\n var mp = new List();\n\n if (a > c)\n {\n mp = X1.Intersect(X2).ToList();\n }\n else\n {\n mp = X2.Intersect(X1).ToList();\n }\n output = mp.Count > 0 ? mp.First() : -1;\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _787A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int a = int.Parse(tokens[0]);\n int b = int.Parse(tokens[1]);\n\n tokens = Console.ReadLine().Split();\n\n int c = int.Parse(tokens[0]);\n int d = int.Parse(tokens[1]);\n\n while (b < 10000 && d < 10000 && b != d)\n {\n if (b < d)\n {\n b += a;\n }\n else\n {\n d += c;\n }\n }\n\n Console.WriteLine(b == d ? b : -1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class examples\n {\n static void Main(string[] args)\n {\n int f, g;\n string[] rick = Console.ReadLine().Split();\n string[] morty = Console.ReadLine().Split();\n for (int i = 0; i < 1000; i++)\n {\n f = int.Parse(rick[1]) + i * int.Parse(rick[0]);\n for (int j = 0; j < 1000; j++)\n {\n g = int.Parse(morty[1]) + j * int.Parse(morty[0]);\n if (g == f)\n {\n Console.Write(f);\n goto A;\n }\n }\n }\n\n Console.Write(-1);\n A:;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class examples\n {\n static void Main(string[] args)\n {\n int r, m, a, b, f, g;\n string[] rick = Console.ReadLine().Split();\n string[] morty = Console.ReadLine().Split();\n r = int.Parse(rick[0]);\n a = int.Parse(rick[1]);\n m = int.Parse(morty[0]);\n b = int.Parse(morty[1]);\n for (int i = 0; i < 1000; i++)\n {\n f = a + i * r;\n for (int j = 0; j < 1000; j++)\n {\n g = b + j * m;\n if (g == f)\n {\n Console.Write(f);\n goto A;\n }\n }\n }\n\n Console.Write(-1);\n A:;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TheMonster\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Dados\n string txt = Console.ReadLine();\n int a = int.Parse(txt.Split()[0]), b = int.Parse(txt.Split()[1]);\n\n txt = Console.ReadLine();\n int c = int.Parse(txt.Split()[0]), d = int.Parse(txt.Split()[1]);\n\n bool achou = false;\n int resultado = 0;\n\n for (int i = 0; i < 1000; i++)\n {\n for (int j = 0; j < 1000; j++)\n {\n if (b + a * i == d + c * j)\n {\n resultado = b + a * i;\n\n achou = true;\n break;\n }\n }\n if (achou)\n break;\n }\n if (achou)\n Console.Write(resultado);\n else\n Console.Write(-1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace jbjlbjl\n{\n class Program\n {\n static void Main(string[] args)\n {\n int f, z;\n string[] asd = Console.ReadLine().Split();\n string[] qwe = Console.ReadLine().Split();\n for(int i = 0; i < 1000; i++)\n {\n f = int.Parse(asd[1]) + i *int.Parse( asd[0]);\n for(int j = 0; j < 1000; j++)\n {\n z = int.Parse(qwe[1]) + j * int.Parse(qwe[0]);\n if (z == f) { Console.Write(z);goto a; }\n }\n }\n Console.Write(-1);\n a:;\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n string[] ss1 = Console.ReadLine().Split();\n int a1 = int.Parse(ss1[0]);\n int b1 = int.Parse(ss1[1]);\n List ans1 = new List();\n List ans2 = new List();\n\n ans1.Add((ulong)b);\n ans2.Add((ulong)b1);\n for (int i = 1; i <= 1000; i++)\n {\n ans1.Add((ulong)(b + (a * i)));\n }\n for (int i = 1; i <= 1000; i++)\n {\n ans2.Add((ulong)(b1 + (a1 * i)));\n }\n /*for (int i = 0; i < ans1.Count; i++)\n {\n Console.Write(ans1[i] + \" \");\n }\n Console.WriteLine();\n\n for (int i = 0; i < ans2.Count; i++)\n {\n Console.Write(ans2[i] + \" \");\n }\n\n Console.WriteLine();*/\n for (int i = 0; i < ans1.Count; i++)\n {\n ulong x = ans1[i];\n for (int e = 0; e < ans2.Count; e++)\n {\n if (x == ans2[e])\n {\n Console.WriteLine(x);\n return;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem7\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n string[] str1 = Console.ReadLine().Split(' ');\n string[] str2 = Console.ReadLine().Split(' ');\n int a =int.Parse(str1[0]);\n int b = int.Parse(str1[1]);\n int c = int.Parse(str2[0]);\n int d = int.Parse(str2[1]);\n int Rick = b;\n int Morty = d;\n int counter = 0;\n \n lable:\n if (counter < 1000000)\n {\n if (Rick > Morty)\n {\n while (Rick > Morty)\n {\n Morty = Morty + c;\n counter++;\n if (Morty >= Rick) { goto lable; }\n }\n\n\n }\n else if (Morty > Rick)\n {\n while (Morty > Rick)\n {\n\n Rick = Rick + a;\n counter++;\n if (Rick >= Morty) { goto lable; }\n\n }\n }\n\n else\n {\n Console.WriteLine(Rick);\n }\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace contest1C\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split();\n string[] cd = Console.ReadLine().Split();\n Int64 a = Convert.ToInt64(ab[0]);\n Int64 b = Convert.ToInt64(ab[1]);\n Int64 c = Convert.ToInt64(cd[0]);\n Int64 d = Convert.ToInt64(cd[1]);\n\n\n int n1 = 0;\n int n2 = 0;\n Int64 f1 = b + n1 * a;\n Int64 f2 = d + n2 * c;\n for (Int64 i = 0; i < 100; i++)\n {\n for (Int64 j = 0; j < 100; j++)\n {\n if (b + i * a == d + j * c)\n {\n Console.WriteLine(b + i * a);\n return;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Security.AccessControl;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Xml.Schema;\n\nnamespace CodeforcesTasks\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var a = arr[0];\n var b = arr[1]; \n arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var c = arr[0];\n var d = arr[1];\n\n for (int i = 0; i < 100; i++)\n {\n for (int j = 0; j < 100; j++)\n {\n if (b + a * i == d + c * j)\n {\n Console.WriteLine(b + a * i);\n return;\n }\n }\n\n }\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n string[] str = Console.ReadLine().Split(' ');\n int a = int.Parse(str[0]);\n int b = int.Parse(str[1]);\n str = Console.ReadLine().Split(' ');\n int c = int.Parse(str[0]);\n int d = int.Parse(str[1]);\n if((b-d)%gcd(a,c) != 0){\n sb.Append(\"-1\\n\");\n return;\n }\n while(b != d){\n if(b < d){\n b += a;\n }\n else{\n d += c;\n }\n }\n sb.Append(b+\"\\n\");\n }\n int gcd(int n,int m){\n if(m == 0){\n return n;\n }\n else{\n return gcd(m,n%m);\n }\n }\n}"}, {"source_code": "// Problem: 787A - The Monster\n// Author: Gusztav Szmolik\n\nusing System;\nusing System.Collections;\n\nnamespace The_Monster\n\t{\n\tclass Program\n\t\t{\n\t\tstatic int Main ()\n\t\t\t{\n\t\t\tstring[] tmp = Console.ReadLine().Split();\n\t\t\tif (tmp.Length != 2)\n\t\t\t\treturn -1;\n\t\t\tbyte a = 0;\n\t\t\tif (!Byte.TryParse(tmp[0], out a))\n\t\t\t\treturn -1;\n\t\t\tbyte b = 0;\n\t\t\tif (!Byte.TryParse(tmp[1], out b))\n\t\t\t\treturn -1;\n\t\t\tif (a < 1 || a > 100 || b < 1 || b > 100)\n\t\t\t\treturn -1;\n\t\t\ttmp = Console.ReadLine().Split();\n\t\t\tif (tmp.Length != 2)\n\t\t\t\treturn -1;\n\t\t\tbyte c = 0;\n\t\t\tif (!Byte.TryParse(tmp[0], out c))\n\t\t\t\treturn -1;\n\t\t\tbyte d = 0;\n\t\t\tif (!Byte.TryParse(tmp[1], out d))\n\t\t\t\treturn -1;\n\t\t\tif (c < 1 || c > 100 || d < 1 || d > 100)\n\t\t\t\treturn -1;\n\t\t\tbyte r;\n\t\t\tbyte k = 0;\n\t\t\tArrayList rList = new ArrayList ();\n\t\t\tbool monsterWins = true;\n\t\t\tdo\n\t\t\t\t{\n\t\t\t\tr = Convert.ToByte (b < d ? (d-b+c*k)%a : (b-d+a*k)%c);\n\t\t\t\tif (r != 0 && !rList.Contains(r))\n\t\t\t\t\t{\n\t\t\t\t\trList.Add (r);\n\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\t\telse if (r != 0 && rList.Contains(r))\n\t\t\t\t\tmonsterWins = false;\n\t\t\t\t}\n\t\t\twhile (r != 0 && monsterWins);\n\t\t\tif (r == 0)\n\t\t\t\tConsole.WriteLine (b < d ? d+c*k : b+a*k);\n\t\t\telse\n\t\t\t\tConsole.WriteLine (-1);\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n"}, {"source_code": "using System;\n\nnamespace CodeForces {\n public class Program {\n public static void Main ( string[] args ) {\n Console.WriteLine( Solve() );\n }\n\n public static int Solve () {\n var rickMoments = Console.ReadLine().Split(' ');\n var martyMoments = Console.ReadLine().Split(' ');\n\n int a = int.Parse(rickMoments[0]),\n b = int.Parse(rickMoments[1]),\n c = int.Parse(martyMoments[0]),\n d = int.Parse(martyMoments[1]);\n\n while ( b != d && b < 100000 ) {\n while ( b > d ) d += c;\n while ( d > b ) b += a;\n }\n\n return b >= 100000 ? -1 : b;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforced\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n string[] token2 = Console.ReadLine().Split();\n \n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n int c = int.Parse(token2[0]);\n int d = int.Parse(token2[1]);\n \n int ans = 0;\n int one = b,two = d;\n List oneList = new List();\n List twoList = new List();\n \n while(ans<=101)\n {\n one = b + a*ans;\n oneList.Add(one);\n two = d + c*ans;\n twoList.Add(two);\n ans++;\n }\n bool found = false;\n int aT = -1;\n for(int i=0;i brojevi = new List();\n for(int i = 0; i<1000; i++)\n {\n\n brojevi.Add(b+a * i);\n \n\n }\n\n List brojevi2 = new List();\n for (int i = 0; i < 1000; i++)\n {\n\n brojevi2.Add(d+c * i);\n \n\n }\n\n\n bool m = true;\n for (int i= 0;i _l = new List();\n\n static void ReadBuffer()\n {\n if (_l.Count > 0)\n return;\n _l.AddRange(Console.ReadLine().Split(' '));\n }\n public static int ReadInt()\n {\n ReadBuffer();\n int r = int.Parse(_l[0]);\n _l.RemoveAt(0);\n return r;\n \n }\n }\n\n class Program\n {\n\n\n static void solve()\n {\n int a = 0, b = 0, c = 0, d = 0;\n\n a = Reader.ReadInt();\n b = Reader.ReadInt();\n c = Reader.ReadInt();\n d = Reader.ReadInt();\n\n \n int f1 = 0;\n int f2 = 0;\n\n int t = 1;\n while (true)\n {\n if (t >= 1000000)\n break;\n\n // t = b + a * x\n // x = (t - b) / a;\n\n if ((((t - b) % a) == 0) &&\n (((t - d) % c) == 0) && (t >= b) && (t >= d))\n {\n Console.WriteLine(t);\n return;\n }\n t++;\n }\n Console.WriteLine(-1);\n\n \n\n \n\n\n\n }\n\n static void Main(string[] args)\n {\n#if HOMETEST\n for (int i = 0; i < 2; i++)\n#endif\n solve();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]); // a\n s1 = Convert.ToInt32(input[1]); // b\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]); // c\n s2 = Convert.ToInt32(input[1]); // d\n int curr = s2 - s1, y = 0;\n while (curr + f2 * y < 0)\n y++;\n while (y < f1 && (curr + f2 * y) % f1 != 0)\n y++;\n if ((curr + f2 * y) % f1 != 0)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s2 + f2 * y);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace C_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] strArr;\n string str=Console.ReadLine();\n strArr=str.Split(' ');\n int a=Convert.ToInt32(strArr[0]);\n int b=Convert.ToInt32(strArr[1]);\n str=Console.ReadLine();\n strArr=str.Split(' ');\n int c=Convert.ToInt32(strArr[0]);\n int d=Convert.ToInt32(strArr[1]);\n for(int i=0;i<100;i++){\n for(int j=0;j<100;j++){\n if((a*i)+b==(c*j)+d){\n Console.WriteLine((a*i)+b);\n return ;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int a = Convert.ToInt32(input[0]);\n int b = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split();\n int c = Convert.ToInt32(input[0]);\n int d = Convert.ToInt32(input[1]);\n bool value = false;\n for (int i = 0; i < 100; i++)\n {\n for (int k = 0; k < 100; k++)\n {\n if (value == false)\n {\n if (b + a * i == d + c * k)\n {\n value = true;\n Console.WriteLine(b + a * i);\n \n }\n }\n \n \n } \n }\n if (value == false)\n Console.WriteLine(\"-1\");\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]);\n s1 = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]);\n s2 = Convert.ToInt32(input[1]);\n if (s1 < s2)\n s1 += (int)Math.Ceiling((s2 - s1) / (double)f1) * f1;\n else\n s2 += (int)Math.Ceiling((s1 - s2) / (double)f2) * f2;\n int i = 0, iterations = f2 / GCD(f1, f2);\n while (s1 % f2 != s2 % f2 && i < iterations)\n {\n s1 += f1;\n i++;\n }\n if (i == iterations)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s1);\n }\n static int GCD(int x, int y)\n {\n while (x != y)\n if (x > y)\n x -= y;\n else\n y -= x;\n return x;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a,b,c,d;\n string[] s = Console.ReadLine().Split(' ');\n\n b = int.Parse(s[0]);\n a = int.Parse(s[1]);\n\n s = Console.ReadLine().Split(' ');\n\n d = int.Parse(s[0]);\n c = int.Parse(s[1]);\n\n int answer = -1;\n for(int i = Math.Max(a,c); i <= 100000; i++)\n {\n if((i-a)%b==0 && (i-c)%d==0)\n {\n answer = i;\n break;\n }\n }\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Nastya\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data1 = (Console.ReadLine()).Split(' ');\n string[] data2 = (Console.ReadLine()).Split(' ');\n\n int a = int.Parse(data1[0]);\n int b = int.Parse(data1[1]);\n\n int c = int.Parse(data2[0]);\n int d = int.Parse(data2[1]);\n\n\n Console.WriteLine(result(a, b, c, d));\n\n }\n\n static int result(int a, int b, int c, int d)\n {\n for (int i = 0; i <=100; i++)\n {\n int RickTime = (b + i * a);\n \n for (int j = 0; j < 100; j++)\n {\n int MotriTime = (d + j * c);\n\n if (RickTime == MotriTime)\n {\n return MotriTime;\n }\n }\n }\n\n return -1;\n }\n\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] reader = Console.ReadLine().Split(' ');\n int a = int.Parse(reader[0]), b = int.Parse(reader[1]);\n\n reader = Console.ReadLine().Split(' ');\n int c = int.Parse(reader[0]), d = int.Parse(reader[1]);\n\n int output = -1;\n\n var X1 = Enumerable.Range(0, a).Select(x => b + (x * a)).ToList();\n var X2 = Enumerable.Range(0, c).Select(x => d + (x * c)).ToList();\n var mp = new List();\n\n if (a > c)\n {\n mp = X1.Intersect(X2).ToList();\n }\n else\n {\n mp = X2.Intersect(X1).ToList();\n }\n output = mp.Count > 0 ? mp.First() : -1;\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass Program\n{\n static void Main(string[] args)\n {\n Dictionary Alpha = Enumerable.Range(1, 26).Select(x => Convert.ToChar(64 + x).ToString()).ToDictionary(x=>x , x=>0);\n Alpha[\"A\"] = Alpha[\"D\"] = Alpha[\"O\"] = Alpha[\"P\"] = Alpha[\"Q\"] = Alpha[\"R\"] = 1;\n Alpha[\"B\"] = 2;\n\n string reader = Console.ReadLine().ToUpper();\n int sum = 0;\n\n foreach (var item in Alpha)\n {\n Console.WriteLine(item.Key + \" => \" + item.Value);\n }\n\n Console.WriteLine(sum);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace mochila\n{\n class Rick\n {\n public int Grito { get; set; }\n\n public Rick(int grito)\n {\n Grito = grito;\n }\n }\n\n class Program\n {\n static bool verificaGritos(int a, int b, int c, int d)\n {\n int SomaRick = a + b;\n int SomaMorty = c + d;\n int diferenca = 0;\n \n if (SomaRick > SomaMorty)\n {\n diferenca = SomaRick - SomaMorty;\n\n if (diferenca > c)\n return false;\n else\n return true;\n }\n else\n {\n diferenca = SomaMorty - SomaRick;\n\n if (diferenca > a)\n return false;\n else\n return true;\n }\n }\n\n static int comparaComRick(List lista, int morty)\n {\n int igual = -1;\n\n for (int i = 0; i < lista.Count; i++)\n {\n if (lista[i].Grito == morty)\n {\n igual = morty;\n }\n }\n\n return igual;\n }\n\n static void verificaGritosIguais(int a, int b, int c, int d)\n {\n List lista = new List();\n int cont = 1, rick = 0, morty = 0, igual = -1; // Igual j\ufffd come\ufffda com -1, caso n\ufffdo entre no if, j\ufffd sai -1 igual o problema pede\n\n if (verificaGritos(a, b, c, d))\n {\n do\n {\n rick = b + (a * cont); // sequ\ufffdncia de gritos de Rick.\n morty = c + (d * cont); // sequ\ufffdncia de gritos de Morty.\n\n cont++; // contador da sequ\ufffdncia.\n\n lista.Add(new Rick(rick)); // Somente o grito do Rick \ufffd guardado\n\n igual = comparaComRick(lista, morty); // Vai comparar o grito do morty com os gritos guardados do Rick\n\n } while (igual != morty); // Enquanto n\ufffdo gritarem ao mesmo tempo\n\n Console.WriteLine(igual);\n }\n else\n {\n Console.WriteLine(igual);\n }\n }\n\n\n static void Main(string[] args)\n {\n string R = Console.ReadLine();\n int a = int.Parse(R.Split()[0]);\n int b = int.Parse(R.Split()[1]);\n\n string M = Console.ReadLine();\n int c = int.Parse(M.Split()[0]);\n int d = int.Parse(M.Split()[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace mochila\n{\n class Rick\n {\n public int Grito { get; set; }\n\n public Rick(int grito)\n {\n Grito = grito;\n }\n }\n\n class Program\n {\n static bool verificaGritos(int a, int b, int c, int d)\n {\n int SomaRick = a + b;\n int SomaMorty = c + d;\n int diferenca = 0;\n \n if (SomaRick > SomaMorty)\n {\n diferenca = SomaRick - SomaMorty;\n\n if (diferenca > c)\n return false;\n else\n return true;\n }\n else\n {\n diferenca = SomaMorty - SomaRick;\n\n if (diferenca > a)\n return false;\n else\n return true;\n }\n }\n\n static int comparaComRick(List lista, int morty)\n {\n int igual = -1;\n\n for (int i = 0; i < lista.Count; i++)\n {\n if (lista[i].Grito == morty)\n {\n igual = morty;\n }\n }\n\n return igual;\n }\n\n static void verificaGritosIguais(int a, int b, int c, int d)\n {\n List lista = new List();\n int cont = 1, rick = 0, morty = 0, igual = -1; // Igual j\ufffd come\ufffda com -1, caso n\ufffdo entre no if, j\ufffd sai -1 igual o problema pede\n\n if (verificaGritos(a, b, c, d))\n {\n do\n {\n rick = b + (a * cont); // sequ\ufffdncia de gritos de Rick.\n morty = d + (c * cont); // sequ\ufffdncia de gritos de Morty.\n\n cont++; // contador da sequ\ufffdncia.\n\n lista.Add(new Rick(rick)); // Somente o grito do Rick \ufffd guardado\n\n igual = comparaComRick(lista, morty); // Vai comparar o grito do morty com os gritos guardados do Rick\n\n } while (igual != morty); // Enquanto n\ufffdo gritarem ao mesmo tempo\n\n Console.WriteLine(igual);\n }\n else\n {\n Console.WriteLine(igual);\n }\n }\n\n\n static void Main(string[] args)\n {\n string R = Console.ReadLine();\n int a = int.Parse(R.Split()[0]);\n int b = int.Parse(R.Split()[1]);\n\n string M = Console.ReadLine();\n int c = int.Parse(M.Split()[0]);\n int d = int.Parse(M.Split()[1]);\n\n verificaGritosIguais(a, b, c, d);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforced\n{\n class A\n {\n static void Main(string[] args)\n {\n string[] token = Console.ReadLine().Split();\n string[] token2 = Console.ReadLine().Split();\n \n int a = int.Parse(token[0]);\n int b = int.Parse(token[1]);\n int c = int.Parse(token2[0]);\n int d = int.Parse(token2[1]);\n \n int ans = 0;\n int one = b,two = d;\n List oneList = new List();\n List twoList = new List();\n \n while(ans<100)\n {\n if(one==two)\n break;\n one = b + a*ans;\n oneList.Add(one);\n two = d + c*ans;\n twoList.Add(two);\n ans++;\n }\n bool found = false;\n int aT = -1;\n for(int i=0;i oneList = new List();\n List twoList = new List();\n \n while(ans<=100)\n {\n if(one==two)\n break;\n one = b + a*ans;\n oneList.Add(one);\n two = d + c*ans;\n twoList.Add(two);\n ans++;\n }\n bool found = false;\n int aT = -1;\n for(int i=0;i c)\n flag = UCLN(a, c);\n else\n flag = UCLN(c, a);\n if ((d - b) % flag != 0) \n Console.Write(-1);\n else\n {\n int x = b + a;\n int y = d + c;\n while (x != y)\n {\n if (x < y)\n x += a;\n else\n y += c;\n }\n Console.Write(x);\n }\n Console.ReadLine();\n }\n static int s_index = 0;\n static List s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem787A\n{\n class Program\n {\n static int UCLN(int a, int b)\n {\n int r = a % b;\n if (r != 0)\n return UCLN(b, r);\n else \n return b;\n }\n static void Main(string[] args)\n {\n int a = NextInt(), b = NextInt(); \n int c = NextInt(), d = NextInt();\n int flag = 0;\n if (a > c)\n flag = UCLN(a, c);\n else\n flag = UCLN(c, a);\n if (flag != 1)\n Console.Write(-1);\n else\n {\n int x = b + a;\n int y = d + c;\n while (x != y)\n {\n if (x < y)\n x += a;\n else\n y += c;\n }\n Console.Write(x);\n }\n Console.ReadLine();\n }\n static int s_index = 0;\n static List s_tokens;\n private static string Next()\n {\n while (s_tokens == null || s_index == s_tokens.Count)\n {\n s_tokens = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();\n s_index = 0;\n }\n return s_tokens[s_index++];\n }\n private static int NextInt()\n {\n return Int32.Parse(Next());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace index\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Ric = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Martin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int sumRic = Ric[0] + Ric[1];\n int sumMartin = Martin[0] + Martin[1];\n\n int res = 0;\n\n if((sumMartin % 2 == 0 && Martin[1] % 2 == 0 && sumRic % 2 != 0 && Ric[1] % 2 != 0) || (sumMartin % 2 != 0 && Martin[1] % 2 != 0 && sumRic % 2 == 0 && Ric[1] % 2 == 0))\n {\n res = -1;\n }\n else \n {\n int M = Martin[1];\n int R = Ric[1];\n int i = 1;\n int j = 1;\n\n if (M > R)\n {\n while (R != M)\n {\n while (R < M)\n {\n R = Ric[1] + Ric[0] * i;\n i++;\n }\n if (R != M)\n {\n M = Martin[1] + Martin[0] * j;\n j++;\n }\n if(M > 7000)\n {\n res = -1;\n break;\n }\n }\n if (res != -1)\n {\n res = M;\n }\n }\n else if (R > M)\n {\n while (R != M && R < 7000)\n {\n while (R > M)\n {\n M = Martin[1] + Martin[0] * i;\n i++;\n }\n if (R != M)\n {\n R = Ric[1] + Ric[0] * j;\n j++;\n }\n if(R > 7000)\n {\n res = -1;\n break;\n }\n }\n if (res != -1)\n {\n res = M;\n }\n }\n else\n {\n res = M;\n }\n }\n\n\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace index\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Ric = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Martin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int sumRic = Ric[0] + Ric[1];\n int sumMartin = Martin[0] + Martin[1];\n\n int res = 0;\n\n if((sumRic % 2 == 0 && sumMartin % 2 == 0) || (sumRic % 2 != 0 && sumMartin % 2 != 0))\n {\n int M = Martin[1];\n int R = Ric[1];\n int i = 1;\n int j = 1;\n\n if (M > R)\n {\n while (R != M)\n {\n while (R < M)\n {\n R = Ric[1] + Ric[0] * i;\n i++;\n }\n M = Martin[1] + Martin[0] * j;\n j++;\n }\n res = M;\n }\n else if(R > M)\n {\n while (R != M)\n {\n while (R > M)\n {\n M = Martin[1] + Martin[0] * i;\n i++;\n }\n R = Ric[1] + Ric[0] * j;\n j++;\n }\n res = M;\n }\n else\n {\n res = M;\n }\n }\n else\n {\n res = -1;\n }\n\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace index\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Ric = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Martin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int sumRic = Ric[0] + Ric[1];\n int sumMartin = Martin[0] + Martin[1];\n\n int res = 0;\n\n if((sumMartin % 2 == 0 && Martin[1] % 2 == 0 && sumRic % 2 != 0 && Ric[1] % 2 != 0) || (sumMartin % 2 != 0 && Martin[1] % 2 != 0 && sumRic % 2 == 0 && Ric[1] % 2 == 0))\n {\n res = -1;\n }\n else \n {\n int M = Martin[1];\n int R = Ric[1];\n int i = 1;\n int j = 1;\n\n if (M > R)\n {\n while (R != M)\n {\n while (R < M)\n {\n R = Ric[1] + Ric[0] * i;\n i++;\n }\n if (R != M)\n {\n M = Martin[1] + Martin[0] * j;\n j++;\n }\n }\n res = M;\n }\n else if (R > M)\n {\n while (R != M)\n {\n while (R > M)\n {\n M = Martin[1] + Martin[0] * i;\n i++;\n }\n R = Ric[1] + Ric[0] * j;\n j++;\n }\n res = M;\n }\n else\n {\n res = M;\n }\n }\n\n\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace index\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Ric = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] Martin = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int sumRic = Ric[0] + Ric[1];\n int sumMartin = Martin[0] + Martin[1];\n\n int res = 0;\n\n if((sumMartin % 2 == 0 && Martin[1] % 2 == 0 && sumRic % 2 != 0 && Ric[1] % 2 != 0) || (sumMartin % 2 != 0 && Martin[1] % 2 != 0 && sumRic % 2 == 0 && Ric[1] % 2 == 0))\n {\n res = -1;\n }\n else \n {\n int M = Martin[1];\n int R = Ric[1];\n int i = 1;\n int j = 1;\n\n if (M > R)\n {\n while (R != M)\n {\n while (R < M)\n {\n R = Ric[1] + Ric[0] * i;\n i++;\n }\n if (R != M)\n {\n M = Martin[1] + Martin[0] * j;\n j++;\n }\n if(M > 7000)\n {\n res = -1;\n break;\n }\n }\n res = M;\n }\n else if (R > M)\n {\n while (R != M && R < 7000)\n {\n while (R > M)\n {\n M = Martin[1] + Martin[0] * i;\n i++;\n }\n if (R != M)\n {\n R = Ric[1] + Ric[0] * j;\n j++;\n }\n if(R > 7000)\n {\n res = -1;\n break;\n }\n }\n res = M;\n }\n else\n {\n res = M;\n }\n }\n\n\n Console.WriteLine(res);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n\n\n\n\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split();\n\n int a = int.Parse(s[0]), b = int.Parse(s[1]);\n s = Console.ReadLine().Split();\n int c = int.Parse(s[0]), d = int.Parse(s[1]);\n for (int i = 1; i <= 10000; i++)\n {\n int x = b + a * i;\n for (int j = 1; j <= 10000; j++)\n {\n int y = d + j * c;\n if (x == y)\n {\n Console.WriteLine(x);\n return;\n }\n }\n \n\n\n }\n Console.WriteLine(-1);\n\n }\n\n }\n}"}, {"source_code": "using System;\n\nnamespace _787A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input1 = Console.ReadLine().Split(' '), input2 = Console.ReadLine().Split(' ');\n decimal a = decimal.Parse(input1[0]), b = decimal.Parse(input1[1]);\n decimal c = decimal.Parse(input2[0]), d = decimal.Parse(input2[1]);\n bool result = false;\n for (decimal y = 0; y <= 100000; y++)\n {\n decimal x = (d + y * c - b) / a;\n if (x == Math.Floor(x))\n {\n Console.WriteLine((b + x * a).ToString());\n result = true;\n break;\n }\n }\n if (!result) Console.WriteLine(\"-1\");\n }\n }\n}\n"}, {"source_code": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nusing System;using System.IO;using System.Linq;namespace _100853_Codeforce{ class Program { static void Main(string[] args) { int[] ric = Console.ReadLine().Split(' '). Where(x => !string.IsNullOrWhiteSpace(x)). Select(x => int.Parse(x)).ToArray(); int[] mortey = Console.ReadLine().Split(' '). Where(x => !string.IsNullOrWhiteSpace(x)). Select(x => int.Parse(x)).ToArray(); int a = Convert.ToInt32(ric[0]); int b = Convert.ToInt32(ric[1]); int c = Convert.ToInt32(mortey[0]); int d = Convert.ToInt32(mortey[1]); for(int i = 0; i < 1000000; i++) { b += a; if ((b - d) % c == 0) { Console.WriteLine(b); return; } } Console.WriteLine(\"-1\"); } }}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Monsters\n{\n static void Main()\n {\n List pesho = Console.ReadLine().Split().Select(int.Parse).ToList();\n List gosho = Console.ReadLine().Split().Select(int.Parse).ToList();\n\n int a = pesho[0];\n int b = pesho[1];\n int c = gosho[0];\n int d = gosho[1];\n Dictionary screamers = new Dictionary();\n int MaxTime = 100 ^ 2+1;\n int Result = -1;\n\n for (int i = 1; i < MaxTime; i++)\n {\n if (!screamers.ContainsKey(b + a * i))\n {\n screamers.Add(b + a * i, 1);\n }\n else\n {\n Result = b + a * i;\n break;\n }\n if (!screamers.ContainsKey(d + c * i))\n {\n screamers.Add(d+ c * i, 1);\n }\n else\n {\n Result = d + c * i;\n break;\n }\n }\n Console.WriteLine(Result);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _403\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void Main(String[] args)\n {\n var a = Next();\n var b = Next();\n var c = Next();\n var d = Next();\n\n for(var i = 0; i < 100000; i++)\n {\n var dem = a * i + b - d;\n if(dem % c == 0)\n {\n if (b + (i) * a > 0)\n {\n Console.WriteLine(b + (i) * a);\n return;\n }\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _403\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void Main(String[] args)\n {\n var line = reader.ReadLine().Split(' ').Select(int.Parse).ToList();\n var a = line[0];\n var b = line[1];\n line = reader.ReadLine().Split(' ').Select(int.Parse).ToList();\n var c = line[0];\n var d = line[1];\n\n for(var i = 0; i < 100000; i++)\n {\n var dem = a * i + b - d;\n if(dem % c == 0 && dem > 0)\n {\n Console.WriteLine(b + (i) * a);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _403\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void Main(String[] args)\n {\n var a = Next();\n var b = Next();\n var c = Next();\n var d = Next();\n\n for(var i = 0; i < 100000; i++)\n {\n var dem = a * i + b - d;\n if(dem % c == 0)\n {\n Console.WriteLine(b + (i)*a);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace ConsoleApplication1.CodeForces\n{\n class _403\n {\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void Main(String[] args)\n {\n var a = Next();\n var b = Next();\n var c = Next();\n var d = Next();\n\n for(var i = 0; i < 1000; i++)\n {\n var dem = a * i + b - d;\n if(dem % c == 0)\n {\n Console.WriteLine(b + (i)*a);\n return;\n }\n }\n\n Console.WriteLine(-1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int a = int.Parse(ss[0]);\n int b = int.Parse(ss[1]);\n string[] ss1 = Console.ReadLine().Split();\n int a1 = int.Parse(ss1[0]);\n int b1 = int.Parse(ss1[1]);\n List ans1 = new List();\n List ans2 = new List();\n for (int i = 1; i <= 1000; i++)\n {\n ans1.Add((ulong)(b + (a * i)));\n }\n for (int i = 1; i <= 1000; i++)\n {\n ans2.Add((ulong)(b1 + (a1 * i)));\n }\n /*for (int i = 0; i < ans1.Count; i++)\n {\n Console.Write(ans1[i] + \" \");\n }\n Console.WriteLine();\n\n for (int i = 0; i < ans2.Count; i++)\n {\n Console.Write(ans2[i] + \" \");\n }\n\n Console.WriteLine();*/\n for (int i = 0; i < ans1.Count; i++)\n {\n ulong x = ans1[i];\n for (int e = 0; e < ans2.Count; e++)\n {\n if (x == ans2[e])\n {\n Console.WriteLine(x);\n return;\n }\n }\n }\n Console.WriteLine(-1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces {\n public class Program {\n public static void Main ( string[] args ) {\n Console.WriteLine( Solve() );\n }\n\n public static int Solve () {\n var rickMoments = Console.ReadLine().Split(' ');\n var martyMoments = Console.ReadLine().Split(' ');\n\n int a = int.Parse(rickMoments[0]),\n b = int.Parse(rickMoments[1]),\n c = int.Parse(martyMoments[0]),\n d = int.Parse(martyMoments[1]);\n\n if ( b == d )\n return b;\n\n if ( (b % 2 == 0 && d % 2 != 0 || b % 2 != 0 && d % 2 == 0)\n && a % 2 == 0 && c % 2 == 0\n || b != d && (a % c == 0 || c % a == 0) ) return -1;\n\n while ( b != d && b < 100000 ) {\n while ( b > d ) d += c;\n while ( d > b ) b += a;\n }\n\n return b >= 100000 ? -1 : b;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test1\n{\n public static class Reader\n {\n static List _l = new List();\n\n static void ReadBuffer()\n {\n if (_l.Count > 0)\n return;\n _l.AddRange(Console.ReadLine().Split(' '));\n }\n public static int ReadInt()\n {\n ReadBuffer();\n int r = int.Parse(_l[0]);\n _l.RemoveAt(0);\n return r;\n \n }\n }\n\n class Program\n {\n\n\n static void solve()\n {\n int a = 0, b = 0, c = 0, d = 0;\n\n a = Reader.ReadInt();\n b = Reader.ReadInt();\n c = Reader.ReadInt();\n d = Reader.ReadInt();\n\n \n int f1 = 0;\n int f2 = 0;\n\n int t = 1;\n while (true)\n {\n if (t >= 1000000)\n break;\n\n // t = b + a * x\n // x = (t - b) / a;\n\n if ((((t - b) % a) == 0) &&\n (((t - d) % c) == 0))\n {\n Console.WriteLine(t);\n return;\n }\n t++;\n }\n Console.WriteLine(-1);\n\n \n\n \n\n\n\n }\n\n static void Main(string[] args)\n {\n#if HOMETEST\n for (int i = 0; i < 2; i++)\n#endif\n solve();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]);\n s1 = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]);\n s2 = Convert.ToInt32(input[1]);\n if (s1 < s2)\n s1 += (int)Math.Ceiling(s2 - s1 / (double)f1) * f1;\n else\n s2 += (int)Math.Ceiling(s1 - s2 / (double)f2) * f2;\n int i = 0, iterations = f2 / GCD(f1, f2);\n while (s1 % f2 != s2 % f2 && i < iterations)\n {\n s1 += f1;\n i++;\n }\n if (i == iterations)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s1);\n }\n static int GCD(int x, int y)\n {\n while (x != y)\n if (x > y)\n x -= y;\n else\n y -= x;\n return x;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]); // a\n s1 = Convert.ToInt32(input[1]); // b\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]); // c\n s2 = Convert.ToInt32(input[1]); // d\n int curr = s2 - s1;\n int y = curr / f2 * -1 + 1;\n curr += y * f2;\n while (y < f1 && (curr + f2 * y) % f1 != 0)\n y++;\n if ((curr + f2 * y) % f1 != 0)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s2 + f2 * y);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]);\n s1 = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]);\n s2 = Convert.ToInt32(input[1]);\n int i = 0, iterations = f2 / GCD(f1, f2);\n while (s1 % f2 != s2 % f2 && i < iterations)\n {\n s1 += f1;\n i++;\n }\n if (i == iterations)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s1);\n }\n static int GCD(int x, int y)\n {\n while (x != y)\n if (x > y)\n x -= y;\n else\n y -= x;\n return x;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]); // a\n s1 = Convert.ToInt32(input[1]); // b\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]); // c\n s2 = Convert.ToInt32(input[1]); // d\n int curr = s2 - s1, y = 0;\n while (y < f1 && curr + f2 * y >= 0 && (curr + f2 * y) % f1 != 0)\n y++;\n if ((curr + f2 * y) % f1 != 0)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s2 + f2 * y);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]);\n s1 = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]);\n s2 = Convert.ToInt32(input[1]);\n int target = (s2 - s1) % f2, toAdd = s1, jump = f1 % f2, i = 0;\n if (jump == 0)\n {\n Console.WriteLine(f1);\n return;\n }\n while (i < jump && target % jump != 0)\n {\n target += f2;\n i++;\n }\n if (i == jump)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine((target / jump) * f1 + toAdd);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]);\n s1 = Convert.ToInt32(input[1]);\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]);\n s2 = Convert.ToInt32(input[1]);\n int target = (s2 - s1) % f2, toAdd = s1, jump = f1 % f2, i = 0;\n while (i < jump && target % jump != 0)\n {\n target += f2;\n i++;\n }\n if (i == jump)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine((target / jump) * f1 + toAdd);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace The_Monster\n{\n class Program\n {\n static void Main(string[] args)\n {\n int s1, f1, s2, f2;\n string[] input = Console.ReadLine().Split(' ');\n f1 = Convert.ToInt32(input[0]); // a\n s1 = Convert.ToInt32(input[1]); // b\n input = Console.ReadLine().Split(' ');\n f2 = Convert.ToInt32(input[0]); // c\n s2 = Convert.ToInt32(input[1]); // d\n int curr = s2 - s1, y = 0;\n while (y < f1 && (curr + f2 * y) % f1 != 0)\n y++;\n if (y == f1)\n Console.WriteLine(\"-1\");\n else\n Console.WriteLine(s2 + f2 * y);\n }\n }\n}"}], "src_uid": "158cb12d45f4ee3368b94b2b622693e7"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class _148A\n {\n public static void Main()\n {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int totalDragons = Int32.Parse(Console.ReadLine());\n int damagedDragons = 0;\n for (int i = 1; i <= totalDragons; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n {\n damagedDragons++;\n }\n }\n Console.WriteLine(damagedDragons);\n }\n }\n}\n", "positive_code": [{"source_code": "//http://codeforces.com/problemset/problem/148/A\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int[] dra = new int[d + 1];\n\n for (int i = k; i <= d; i += k)\n dra[i] = 1;\n for (int i = l; i <= d; i += l)\n dra[i] = 1;\n for (int i = m; i <= d; i += m)\n dra[i] = 1;\n for (int i = n; i <= d; i += n)\n dra[i] = 1;\n\n Console.WriteLine(dra.Sum());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InsomniaCure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n\n int count = 0;\n\n for (int i = 1; i <= d; i++)\n {\n if ( (i % k == 0) ||\n (i % l == 0) ||\n (i % m == 0) ||\n (i % n == 0) )\n {\n count++;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] Arr = new int[5];\n int res = 0;\n\n for (int i = 0; i < 5; i++)\n Arr[i] = Int32.Parse(Console.ReadLine());\n\n for (int i = 1; i <= Arr[4]; i++)\n if ((i % Arr[0] == 0) || (i % Arr[1] == 0) || (i % Arr[2] == 0) || (i % Arr[3] == 0))\n res++;\n\n Console.WriteLine(res);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var k = Convert.ToInt32(Console.ReadLine());\n var l = Convert.ToInt32(Console.ReadLine());\n var m = Convert.ToInt32(Console.ReadLine());\n var n = Convert.ToInt32(Console.ReadLine());\n var d = Convert.ToInt32(Console.ReadLine());\n\n var result = new bool[d+1];\n\n for (int i = 1; i <= d; i++)\n {\n if ((i % k == 0) || (i % l ==0) || (i % m == 0) || (i % n == 0))\n {\n result[i] = true;\n }\n }\n\n Console.WriteLine(result.Where(x=>x==true).Count());\n }\n\n }\n}\n"}, {"source_code": " using System;\n class insumnia\n {\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int total = 0;\n\n for ( int i = 1; i <= d ; i++ )\n {\n if ( i%k != 0 && i%m != 0 && i%n !=0 && i%l !=0 )\n {\n total+=0;\n }\n else\n total++;\n }\n Console.WriteLine(total);\n\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int count = 0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i %l==0 || i%m==0 || i % n == 0)\n {\n count++;\n }\n }\n Console.WriteLine(count);\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program {\n static void Main() {\n var divs = Enumerable.Range(0, 4)\n .Select(i => int.Parse(Console.ReadLine()))\n .ToArray();\n var d = int.Parse(Console.ReadLine());\n var n = Enumerable.Range(1, d).Count(x => divs.Any(div => x % div == 0));\n Console.WriteLine(n);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass A148 {\n public static void Main() {\n var a = new int[4];\n for (int i = 0; i < 4; ++i) a[i] = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n Console.WriteLine(Enumerable.Range(1, d).Count(i =>\n Array.Exists(a, k => i % k == 0)\n )); \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n {\n count++;\n }\n }\n\n\n Console.WriteLine(count);\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace qw4\n{\n\tclass MainClass\n\t{\n\t\tpublic static int nok(int a,int b)\n\t\t{\n\t\t\tint i=a,j=b;\n\t\t\twhile (i != j)\n\t\t\t{\n\t\t\tif (i > j)\n \t\t\ti -= j;\n \t\telse\n \t\t\tj -= i;\n\t\t\t};\n\t\t\treturn (a/i)*(b/i)*i;\n\t\t}\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint k,l,m,n,d,nk,s;\n\t\t\tk=int.Parse(Console.ReadLine());\n\t\t\tl=int.Parse(Console.ReadLine());\n\t\t\tm=int.Parse(Console.ReadLine());\n\t\t\tn=int.Parse(Console.ReadLine());\n\t\t\td=int.Parse(Console.ReadLine());\n\t\t\tnk=nok(nok(nok (k,l),m),n);\n\t\t\t//Console.WriteLine(nk);\n\t\t\ts=nk;\n\t\t\tfor(int i=1;i(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace InsomniaCure\n{\n internal class Program\n {\n private static void Main()\n {\n var k = int.Parse(Console.ReadLine().Trim());\n var l = int.Parse(Console.ReadLine().Trim());\n var m = int.Parse(Console.ReadLine().Trim());\n var n = int.Parse(Console.ReadLine().Trim());\n\n var d = int.Parse(Console.ReadLine().Trim());\n\n if (k == 1 || l == 1 || m == 1 || n == 1)\n {\n Console.WriteLine(d);\n }\n else\n {\n bool[] damageDragons = new bool[d];\n\n for (int i = k - 1; i < d; i += k)\n {\n damageDragons[i] = true;\n }\n\n for (int i = l - 1; i < d; i += l)\n {\n damageDragons[i] = true;\n }\n\n for (int i = m - 1; i < d; i += m)\n {\n damageDragons[i] = true;\n }\n\n for (int i = n - 1; i < d; i += n)\n {\n damageDragons[i] = true;\n }\n\n int result = 0;\n for (int i = 0; i < d; i++)\n {\n if (damageDragons[i])\n {\n result++;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Globalization;\n\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tList dr=new List();\n\t\tint a=0;\n\t\tfor(int i=0; i<5; i++)\n\t\t{\n\t\t\tdr.Add(int.Parse(Console.ReadLine()));\n\t\t}\n\t\tfor(int i=1; i<=dr[4]; i++)\n\t\t{\n\t\t\tif(i%dr[0]==0 || i%dr[1]==0 || i%dr[2]==0 || i%dr[3]==0)\n\t\t\t\ta++;\n\t\t}\n\t\n\t\t\n\t\tConsole.WriteLine(a);\n\t}\n\t\n}\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.ComponentModel;\nusing System.Linq;\n\nnamespace Calculating_Function\n{\n class Program\n {\n static void Main()\n {\n int k = int.Parse(Console.ReadLine()), l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine()), n = int.Parse(Console.ReadLine());\n long d = long.Parse(Console.ReadLine());\n int c = 0;\n\n for (int i = 1; i <= d; i++)\n {\n if (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace \u0437\u0430\u0434\u0430\u0447\u0438\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k, l, m, n, d,a=0;\n k = Convert.ToInt32(Console.ReadLine());\n l = Convert.ToInt32(Console.ReadLine());\n m = Convert.ToInt32(Console.ReadLine());\n n = Convert.ToInt32(Console.ReadLine());\n d = Convert.ToInt32(Console.ReadLine());//dlina\n int[,] b = new int[d,2];\n for (int i = 0; i < d; i++)\n {\n b[i,0] = i + 1;\n }\n\n for (int i = k-1; i < d; i+=k)\n {\n b[i, 1] = 1;\n }\n for (int i = l-1; i < d; i += l)\n {\n b[i, 1] = 1;\n }\n for (int i = m-1; i < d; i += m)\n {\n b[i, 1] = 1;\n }\n for (int i = n-1; i < d; i += n)\n {\n b[i, 1] = 1;\n }\n\n for (int i = 0; i < d; i++)\n {\n if (b[i, 1] == 1) { a++; }\n }\n Console.WriteLine(a);\n // Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class A\n {\n public static void Main(string[] args)\n {\n string s = find();\n Console.ReadLine();\n }\n\n private static string find()\n {\n string k1 = Console.ReadLine();\n int k = int.Parse(k1);\n string l1 = Console.ReadLine();\n int l = int.Parse(l1);\n string m1 = Console.ReadLine();\n int m = int.Parse(m1);\n string n1 = Console.ReadLine();\n int n = int.Parse(n1);\n string d1 = Console.ReadLine();\n int d = int.Parse(d1);\n\n List dr = new List();\n int kTotal = 0;\n\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n kTotal++;\n\n }\n \n Console.WriteLine(kTotal);\n return \"\";\n \n \n }\n\n \n }\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[,] m = new int[5, 1];\n int count = 0;\n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 1; j++)\n {\n m[i, j] = Convert.ToInt32(Console.ReadLine());\n }\n }\n int[] m2 = new int[m[4, 0]];\n for (int i = 1; i <= m2.Length; i++)\n {\n m2[i - 1] = i;\n }\n for (int i = 0; i < 4; i++)\n {\n int n = m[i, 0];\n for (int j = n - 1; j < m2.Length; j += n)\n {\n if (j >= m2.Length)\n {\n break;\n }\n if (m2[j] != 0)\n {\n m2[j] = 0;\n count++;\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\n\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var delims = new int[] { int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()) };\n var n = int.Parse(Console.ReadLine());\n var numbers = new bool[n];\n for (int i = 1; i <= n; i++)\n for (int g = 0; g < 4; g++)\n if (i % delims[g] == 0)\n {\n numbers[i-1] = true;\n break;\n }\n Console.WriteLine(numbers.Where(x => x).Count());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine());\n\n int x = (d / k) + (d / l) + (d / m) + (d / n)\n - (d / LSM(k, l)) - (d / LSM(k, n)) - (d / LSM(k, m))\n - (d / LSM(n, l)) - (d / LSM(m, l)) - (d / LSM(n, m))\n + (d / LSM(k, l, m)) + (d / LSM(k, l, n)) + (d / LSM(k, n, m))\n + (d / LSM(l, m, n)) - (d / LSM(k, l, m, n));\n\n Console.WriteLine(x);\n }\n\n static int GCD(int a, int b)\n {\n return b == 0 ? a : GCD(b, a % b);\n }\n\n\n static int LSM(int a, int b)\n {\n return Math.Abs(a * b) / GCD(a, b);\n }\n\n static int LSM(int a, int b, int c)\n {\n return LSM(LSM(a, b), c);\n }\n\n static int LSM(int a, int b, int c, int d)\n {\n return LSM(LSM(LSM(a, b), c), d);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Runtime.InteropServices;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n //static void PrintArray(char[,] a)\n //{\n // for (int i = 0; i < a.GetLength(0); i++)\n // {\n // for (int j = 0; j < a.GetLength(1); j++)\n // {\n // Console.Write();\n // }\n\n // Console.WriteLine();\n // }\n //}\n\n private static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine()),\n c = 0;\n\n for (int i = 1; i <= d; i++)\n {\n if (i%k != 0 && i%l != 0 && i%m != 0 && i%n != 0)\n c++;\n }\n\n Console.WriteLine(d-c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace insomniaCure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m= Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int count = 0;\n if (k==1 && l==1 && m==1 && n==1)\n {\n Console.WriteLine(d);\n }\n else\n {\n for (int i = 1; i <= d; i++)\n {\n if ((i % k) != 0 && (i % l) != 0 && (i % m) != 0 && (i % n) != 0)\n {\n count++;\n }\n }\n\n d = d - count;\n Console.WriteLine(d);\n }\n \n\n \n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Numerics;\nusing System.Reflection;\nusing System.ComponentModel;\n\nnamespace WatermelonC\n{ \n class Program\n {\n static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n string thirdLine = Console.ReadLine();\n string fourthLine = Console.ReadLine();\n string fifthLine = Console.ReadLine();\n\n int m, n, o, p, j, x;\n x = 0;\n\n int.TryParse(firstLine, out m);\n int.TryParse(secondLine, out n);\n int.TryParse(thirdLine, out o);\n int.TryParse(fourthLine, out p);\n int.TryParse(fifthLine, out j);\n\n for (int i = 1; i <= j; i++)\n {\n if (i % m == 0)\n x++;\n else if (i % n == 0)\n x++;\n else if (i % o == 0)\n x++;\n else if (i % p == 0)\n x++;\n }\n\n Console.WriteLine(x);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A148\n{\n class Program\n {\n static void Main(string[] args)\n {\n // Insomnia Cure\n int[] input = new int[5] { 0, 0, 0, 0, 0 };\n for (int i = 0; i < input.Length; i++)\n input[i] = int.Parse(Console.ReadLine()) ;\n\n int[] dragons = Enumerable.Range(1, input[4]).ToArray();\n int damaged = 0;\n\n for (int i = 0; i < dragons.Length; i++)\n {\n for (int e = 0; e < 4; e++)\n {\n dragons[i] = dragons[i] % input[e] == 0 ? 0 : dragons[i]; \n }\n damaged += dragons[i] == 0 ? 1 : 0;\n }\n Console.WriteLine(damaged);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int cnt = 0;\n for(int i = 1; i <= d; i++)\n {\n if(i%k==0 || i%l==0 || i%m==0 || i % n == 0)\n {\n cnt += 1;\n }\n }\n Console.WriteLine(cnt);\n //Console.ReadKey();\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication39\n{\n class Program\n {\n static int pointFlag(int k, int l, int m, int n, int[] drago)\n {\n for(int i= k-1; i x==1);\n }\n static void Main(string[] args)\n {\n //int[] mas = new int[3];\n //for (int i = 0; i < 3; i++ )\n //{\n // mas[i] = int.Parse(Console.ReadLine());\n //}\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int[] drago = new int[d];\n\n Console.WriteLine(pointFlag(k, l, m, n, drago));\n\n\n // double a = d/n;\n //if((d/mas.Min()+ Math.Ceiling(a))>d)\n // Console.WriteLine(d);\n //else \n // Console.WriteLine(d/mas.Min()+ Math.Ceiling(a));\n \n \n \n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF_148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n\n int count = int.Parse(Console.ReadLine());\n\n int result = 0;\n for (int i = 1; i <= count; i++)\n {\n if (i % k == 0) { result++; continue; }\n if (i % l == 0) { result++; continue; }\n if (i % m == 0) { result++; continue; }\n if (i % n == 0) { result++; continue; }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace _105d2a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n#if DEBUG\n static bool _useFileInput = false;\n#else\n static bool _useFileInput = false;\n#endif\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var cs = new int[4];\n cs[0] = readInt();\n cs[1] = readInt();\n cs[2] = readInt();\n cs[3] = readInt();\n var d = readInt();\n\n var count = 0;\n for (int i = 1; i <= d; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % cs[j] == 0)\n {\n count++;\n break;\n }\n }\n }\n\n\n Console.WriteLine(count);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//var inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();\n\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\n\t\t\tif (d == 0 || (k > d && l > d && m > d && n > d))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (k == 1 || l == 1 || m == 1 || n == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(d);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint count = 0;\n\t\t\tvar dragons = Enumerable.Range(1, d);\n\t\t\tforeach (var dragon in dragons)\n\t\t\t{\n\t\t\t\tif (dragon % k == 0 || dragon % l == 0 || dragon % m == 0 || dragon % n == 0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var del = new int[4];\n del[0] = int.Parse(Console.ReadLine());\n del[1] = int.Parse(Console.ReadLine());\n del[2] = int.Parse(Console.ReadLine());\n del[3] = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n var res = 0;\n for (int i = 1; i <= d; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i%del[j] == 0)\n {\n res++;\n break; \n }\n }\n }\n \n \n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeforcesSolution\n{\n public class InsomniaCure\n {\n public static void Main(string[] args)\n {\n int k, l, m, n, d;\n k = int.Parse(Console.ReadLine());\n l = int.Parse(Console.ReadLine());\n m = int.Parse(Console.ReadLine());\n n = int.Parse(Console.ReadLine());\n d = int.Parse(Console.ReadLine());\n if (k == 1 || l == 1 || m == 1 || n == 1)\n {\n Console.WriteLine(d);\n return;\n }\n int count = 0;\n for (int i = 1; i <= d; i++)\n {\n if ((i % k == 0) || (i % l == 0) || (i % m == 0) || (i % n == 0))\n {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int count = 0;\n for (int i = 1; i <= d; i++)\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n count++;\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Solution\n{\n public static void Main()\n {\n int[] arr = new int[5]; int count = 0;\n for (int i = 0; i < 5; i++) arr[i] = Convert.ToInt32(Console.ReadLine());\n for (int j = 1; j <= arr[4]; j++)\n {\n if (j % arr[0] == 0 || j % arr[1] == 0 || j % arr[2] == 0 || j % arr[3] == 0) count++;\n }\n Console.WriteLine(count);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n\n \n static void Main(string[] args)\n {\n string numberk = Console.ReadLine();\n// string[] splitchar = new string[] { \" \" };\n Int32 k = Convert.ToInt32(numberk);\n \n string numberl = Console.ReadLine();\n Int32 l = Convert.ToInt32(numberl);\n\n string numberm = Console.ReadLine();\n Int32 m = Convert.ToInt32(numberm);\n\n string numbern = Console.ReadLine();\n Int32 n = Convert.ToInt32(numbern);\n\n string numberd = Console.ReadLine();\n Int32 d = Convert.ToInt32(numberd);\n\n List hehe = new List();\n for (int i = 0; i < d; i++)\n {\n hehe.Add(i + 1);\n }\n int sum = 0;\n for (int j = 0; j < d; j++)\n {\n if (hehe[j] % k == 0 || hehe[j] % l == 0 || hehe[j] % m == 0 || hehe[j] % n == 0)\n {\n sum++;\n }\n }\n Console.WriteLine(sum);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int answer = 0;\n int dragon = 1;\n for (int i = 1; i <= d; i++)\n {\n if (dragon % k == 0 || dragon % l == 0 || dragon % m == 0 || dragon % n == 0)\n {\n answer++;\n }\n dragon++;\n }\n\n\n Console.WriteLine(answer);\n\n Console.ReadLine();\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_Insomnia\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n List all = new List();\n for(int i=k;i<=d;i = i + k)\n {\n all.Add(i);\n }\n for (int i = l; i <= d; i = i + l)\n {\n all.Add(i);\n }\n for (int i = m; i <= d; i = i + m)\n {\n all.Add(i);\n }\n for (int i = n; i <= d; i = i + n)\n {\n all.Add(i);\n }\n all = all.Distinct().ToList();\n Console.WriteLine(all.Count());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar k = int.Parse(Console.ReadLine());\n\t\t\tvar l = int.Parse(Console.ReadLine());\n\t\t\tvar m = int.Parse(Console.ReadLine());\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\tvar d = int.Parse(Console.ReadLine());\n\n\t\t\tint c = 0;\n\t\t\tfor (int i = 1; i <= d; i++)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tc++;\n\t\t\t} \n\t\t\tConsole.WriteLine(c);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _148A\n{\n class Program\n {\n static void Main()\n {\n var damages = new int[4];\n for (var i = 0; i < damages.Length; i++)\n damages[i] = int.Parse(Console.ReadLine());\n \n var dragonsCount = int.Parse(Console.ReadLine());\n var hashset = new HashSet();\n for (var i = 0; i < damages.Length; i++)\n for (var j = 1; j <= dragonsCount; j++)\n if (j % damages[i] == 0)\n hashset.Add(j);\n \n Console.WriteLine(hashset.Count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt16(Console.ReadLine()),\n l = Convert.ToInt16(Console.ReadLine()),\n m = Convert.ToInt16(Console.ReadLine()),\n n = Convert.ToInt16(Console.ReadLine()),\n d = Convert.ToInt32(Console.ReadLine()),\n NotEscaped = 0;\n for (int i = 1; i <= d; i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n NotEscaped++;\n }\n }\n Console.WriteLine(NotEscaped);\n }\n }\n}\n"}, {"source_code": "namespace o\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int counter = 0;\n for (int i = 1; i < d + 1; i++)\n {\n if (i % n == 0 || i % m == 0 || i % l == 0 || i % k == 0)\n {\n counter++;\n }\n }\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace _58A\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n List list = new List();\n int counter = 0;\n for (int i = 0; i < 4; i++)\n list.Add(Convert.ToInt32(Console.ReadLine()));\n\n int total = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 1; i <= total; i++)\n {\n if( \n i % list[0] != 0\n & i % list[1] != 0\n & i % list[2] != 0\n & i % list[3] != 0)\n {\n counter++;\n }\n }\n\n Console.WriteLine(total-counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n \n bool[] attack = new bool[d];\n \n for(int i = 0; i < d; i++)\n {\n attack[i] = false;\n }\n \n for (int i = k - 1; i < d; i+= k)\n {\n attack[i] = true;\n }\n \n for (int i = l - 1; i < d; i+= l)\n {\n attack[i] = true;\n }\n \n for (int i = m - 1; i < d; i+= m)\n {\n attack[i] = true;\n }\n \n for (int i = n - 1; i < d; i+= n)\n {\n attack[i] = true;\n }\n \n Console.WriteLine(attack.Count(i => i));\n \n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass A105\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\tfor (int i = 1; i <= d; i++)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tans++;\n\t\t\t}\n\n\n\t\t\t\tConsole.WriteLine(ans);\n\n\t//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.IO;\n\n\nclass c105_p1\n{\n static void Main()\n {\n //Console.SetIn(new StreamReader(new FileStream(\"../../in.txt\", FileMode.Open)));\n //StreamWriter out_sw = new StreamWriter(new FileStream(\"../../out.txt\", FileMode.Create));\n //Console.SetOut(out_sw);\n\n int k = int.Parse(Console.In.ReadLine());\n int l = int.Parse(Console.In.ReadLine());\n int m = int.Parse(Console.In.ReadLine());\n int n = int.Parse(Console.In.ReadLine());\n int d = int.Parse(Console.In.ReadLine());\n\n int counter = 0;\n for (int i = 1; i <= d; i++)\n {\n if (((i % k == 0) || (i % l == 0) || (i % m == 0) || (i % n == 0)))\n counter++;\n }\n\n Console.Out.WriteLine(counter);\n\n //out_sw.Close();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0421\u0440\u0435\u0434\u0441\u0442\u0432\u043e_\u043e\u0442_\u0431\u0435\u0441\u0441\u043e\u043d\u043d\u0438\u0446\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int z = 0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0)\n z++;\n else if (i % l == 0)\n z++;\n else if (i % m == 0)\n z++;\n else if (i % n == 0)\n z++;\n }\n Console.WriteLine(z);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CFDay12\n{\n class Program\n {\n static void Main(string[] args)\n\n {\n\n int count = 0;\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n if(k==1||l==1||m==1||n==1)\n Console.WriteLine(d);\n else\n {\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n count++;\n \n }\n Console.WriteLine(count);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n int[] div = new int[4];\n div[0] = int.Parse(Console.ReadLine());\n div[1] = int.Parse(Console.ReadLine());\n div[2] = int.Parse(Console.ReadLine());\n div[3] = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n for (int i = 1; i <= n; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % div[j] == 0)\n {\n sum++;\n break;\n }\n \n }\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Competitive\n{\n class Program\n {\n static void Main(string[] args)\n {\n var l = new List();\n\n for (int i = 0; i < 4; i++)\n {\n l.Add(int.Parse(Console.ReadLine()));\n }\n\n var d = int.Parse(Console.ReadLine());\n\n var cnt = 0;\n\n for (int i = 1; i <= d; i++)\n {\n bool b = false;\n\n foreach(var x in l)\n {\n b |= i % x == 0;\n } \n\n if (b)\n {\n cnt++;\n }\n }\n\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dr = new bool[d];\n int count = 0;\n\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(d);\n else\n {\n for (int i = k; i <= d; i = i + k)\n dr[i-1] = true;\n \n for (int i = l; i <= d; i = i + l)\n dr[i-1] = true;\n\n for (int i = m; i <= d; i = i + m)\n dr[i-1] = true;\n\n for (int i = n; i <= d; i = i + n)\n dr[i-1] = true;\n\n\n for (int i = 0; i < d; i++)\n {\n if (dr[i] == true)\n count++;\n }\n\n Console.WriteLine(count);\n }\n \n }\n }\n}"}, {"source_code": "//http://codeforces.com/problemset/problem/148/A\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF___148A__Insomnia_cure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int[] arr = new int[d + 1];\n\n for (int i = k; i <= d; i += k)\n arr[i] = 1;\n for (int i = l; i <= d; i += l)\n arr[i] = 1;\n for (int i = m; i <= d; i += m)\n arr[i] = 1;\n for (int i = n; i <= d; i += n)\n arr[i] = 1;\n\n Console.WriteLine(arr.Sum());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Threading;\n\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var numbs = new List();\n for (int i = 0; i < 4; i++)\n numbs.Add(Convert.ToInt32(Console.ReadLine()));\n\n var d = Convert.ToInt32(Console.ReadLine());\n\n //create dictionary to keep track of hits\n var tracker = new Dictionary();\n for (int i = 1; i <= d; i++)\n tracker.Add(i, false);\n\n foreach(int n in numbs)\n {\n if (tracker.All(v => v.Value))\n break;\n\n Register(tracker, n, d);\n }\n\n int sum = 0;\n var list = tracker.Values;\n foreach (var value in list)\n if (value)\n sum++;\n\n Console.WriteLine(sum);\n\n }\n\n static void Register(Dictionary register, int numb, int d)\n {\n for (int i = numb; i <= d; i += numb)\n register[i] = true;\n }\n\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n public class InsomniaCure\n {\n\n#if Test\n private const bool isTesting = true;\n#else\n private const bool isTesting = false;\n#endif\n public static void Main ( string[] args )\n {\n if(!isTesting)\n {\n Run(Console.In);\n return;\n }\n RunTests();\n }\n public static void Run ( TextReader reader )\n {\n int[] mult = new int[4];\n mult[0] = int.Parse(reader.ReadLine());\n mult[1] = int.Parse(reader.ReadLine());\n mult[2] = int.Parse(reader.ReadLine());\n mult[3] = int.Parse(reader.ReadLine());\n int d = int.Parse(reader.ReadLine());\n bool[] damages = new bool[d + 1];\n for(int i = 0; i < mult.Length; i++)\n {\n int factor = mult[i];\n for(int num = factor; num <= d; num += factor)\n {\n damages[num] = true;\n }\n }\n int count = 0;\n for(int i = 0; i < damages.Length; i++)\n {\n if(damages[i]) count++; \n }\n Console.WriteLine(count);\n }\n\n public static void RunTests ()\n {\n Run(new StringReader(\"1\\n2\\n3\\n4\\n12\"));\n Run(new StringReader(\"2\\n3\\n4\\n5\\n24\"));\n }\n }\n\n}\n"}, {"source_code": "using System;\n\nnamespace _148A_Insomnia_cure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int s = 0;\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(\"{0}\", d);\n else\n {\n for (int i = 2; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n {\n s++;\n }\n\n }\n Console.WriteLine(\"{0}\", s);\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int[] MyInt = new int[d + 1];\n int y = 0;\n\n for (int i = k; i <= d; i += k)\n {\n MyInt[i] = 1;\n }\n\n\n for (int i = l; i <= d; i += l)\n {\n MyInt[i] = 1;\n }\n\n\n for (int i = m; i <= d; i += m)\n {\n MyInt[i] = 1;\n }\n\n\n for (int i = n; i <= d; i += n)\n {\n MyInt[i] = 1;\n }\n int o = MyInt.Sum();\n Console.WriteLine(o);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A_Insomnia_Cure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int output = 0;\n\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n output++;\n }\n\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.IO;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\n\t\t\tpublic int pos;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (x.c != y.c) return 1;\n\t\t\t\tif (x.r < y.r)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar k = int.Parse(s);\n\t\t\ts = Console.ReadLine();\n\t\t\tvar l = int.Parse(s);\n\t\t\ts = Console.ReadLine();\n\t\t\tvar m = int.Parse(s);\n\t\t\ts = Console.ReadLine();\n\t\t\tvar n = int.Parse(s);\n\t\t\ts = Console.ReadLine();\n\t\t\tvar d = int.Parse(s);\n\t\t\tvar ans = 0;\n\t\t\tfor (var i = 1; i <= d; ++i)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tans++;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int dragons = int.Parse(Console.ReadLine());\n int count = 0;\n\n for (int i = 1; i <= dragons; i++)\n count += (i%k==0||i%l==0||i%m==0||i%n==0)?1:0;\n\n\n \n\n Console.WriteLine(count);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nnamespace codechef\n{\n public class Program{\n public static StreamWriter writer;\n\n public static void RealWork()\n {\n int[] dragon = new int[5];\n for (int i = 0; i < 5; i++)\n dragon[i] = intParse(Console.ReadLine());\n int Ans = 0;\n int[] map = new int[dragon[4]+1];\n for (int i = 0; i < 4; i++)\n {\n for (int j = dragon[i]; j <= dragon[4]; j=j+dragon[i])\n if (map[j] == 0)\n {\n map[j]++; Ans++;\n }\n }\n writer.Write(Ans); \n }\n static void Main(string[] args)\n {\n writer = new StreamWriter(Console.OpenStandardOutput());\n //writer = new StreamWriter(\"output.txt\");\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\"))); \n RealWork();\n writer.Close();\n }\n\n public static int intParse(string st)\n {\n int x = 0;\n for (int i = 0; i < st.Length; i++) { x = x * 10 + (st[i] - 48); }\n return x;\n }\n\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces__A.\u0421\u043b\u0438\u0448\u043a\u043e\u043c_\u0434\u043b\u0438\u043d\u043d\u044b\u0435_\u0441\u043b\u043e\u0432\u0430_\n{\n class RemedyForInsomnia\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int dragons=0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n dragons++;\n }\n\n Console.WriteLine(dragons);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\n\nnamespace InsomniaCure\n{\n class Program\n {\n static void Main(string[] args)\n {\n ArrayList input = new ArrayList();\n \n for (int i = 0; i < 5; i++)\n input.Add(int.Parse(Console.ReadLine()));\n \n int dragonsAlive = 0;\n for (int i = 1; i <=(int) input[input.Count-1]; i++)\n { \n for (int j = 0; j < input.Count-1; j++)\n if (i % (int)input[j] == 0)\n {\n dragonsAlive++;\n break;\n }\n }\n Console.WriteLine(dragonsAlive);\n Console.ReadLine();\n \n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces105\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int counter = 0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % n == 0 || i % m == 0) counter++;\n }\n Console.WriteLine(counter);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace myApp {\n class Program {\n static void Main (string[] args) {\n int[] a = new int[5];\n for(int i = 0; i < 5; i++)\n a[i] = int.Parse(Console.ReadLine());\n bool[] harmed = new bool[a[4]+1];\n int rs = 0;\n for(int i = 0; i < 4; i++){\n if(a[i] == 1){\n rs = a[4]; break;\n }\n for(int j = 1; j * a[i] <= a[4]; j++)\n if(!harmed[j*a[i]]) {\n harmed[j*a[i]] = true;\n rs++;\n }\n }\n Console.WriteLine(rs);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _148A\n {\n public static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n Console.WriteLine(Enumerable.Range(1, d).Count(i => i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _148\n{\n internal class Program\n {\n private static int ToInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static void Main(string[] args)\n {\n int k = ToInt();\n int l = ToInt();\n int m = ToInt();\n int n = ToInt();\n int d = ToInt();\n int ans = 0;\n for (int i = 1; i <= d; i++)\n {\n if (i%k == 0 || i%l == 0 || i%n == 0 || i%m == 0)\n ans++;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace problems\n{\n internal class _148A\n {\n private static void Main(string[] args)\n {\n var k = int.Parse(Console.ReadLine());\n var l = int.Parse(Console.ReadLine());\n var m = int.Parse(Console.ReadLine());\n var n = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n int result=0;\n Calc(new[] { k, l, m, n }, 0, new List(),d, ref result);\n\n //int result = d / k + d / l + d / m + d / n\n // - d / lcm(k, m) - d / lcm(k, l) - d / lcm(k, n) - d / lcm(l, m) - d / lcm(n, m) - d / lcm(l, n)\n // + d / lcm(k, l, n) + d / lcm(k,l, m) + d / lcm(m, l, n) + d / lcm(k, m, n)\n // - d / lcm(k, l, m, n);\n Console.WriteLine(result);\n }\n\n private static void Calc(int[] array, int at, List subset,int d, ref int result)\n {\n if (at == array.Length && subset.Count > 0)\n { \n result += d * ((subset.Count % 2 == 0) ? -1 : 1) / lcm(subset);\n return; \n }\n else if(at a)\n {\n var res = 1;\n foreach (int el in a)\n { \n res = lcm(res, el); \n }\n return res;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_InsomniaOff {\n class Program {\n static void Main(string[] args) {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int d = Int32.Parse(Console.ReadLine());\n int result = 0;\n for(int i=1; i <= d; i++) {\n if(i % k == 0) {\n ++result;\n continue;\n }\n if (i % l == 0) {\n ++result;\n continue;\n }\n if (i % m == 0) {\n ++result;\n continue;\n }\n if (i % n == 0) {\n ++result;\n continue;\n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#15 Resolve Insomnia cure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input1 = int.Parse(Console.ReadLine()),\n input2 = int.Parse(Console.ReadLine()),\n input3 = int.Parse(Console.ReadLine()),\n input4 = int.Parse(Console.ReadLine()),\n all = int.Parse(Console.ReadLine()),\n remnant1 = 0, remnant2 = 0, remnant3 = 0, remnant4 = 0, sum = 0;\n for (int i = 0; i < all; i++)\n {\n if (i % input1 == 0) remnant1++;\n else if (i % input2 == 0) remnant2++;\n else if (i % input3 == 0) remnant3++;\n else if (i % input4 == 0) remnant4++;\n }\n sum = remnant1 + remnant2 + remnant3 + remnant4;\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k=Int32.Parse(Console.ReadLine());\n int l=Int32.Parse(Console.ReadLine());\n int m=Int32.Parse(Console.ReadLine());\n int n=Int32.Parse(Console.ReadLine());\n int d=Int32.Parse(Console.ReadLine());\n int sum=0;\n \n for (int i = 0; i < d; i++) {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n sum++;\n }\n Console.WriteLine(sum);\n }\n public static void Main ()\n {\n Z148A ();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int[] sorted = new int[4];\n sorted[0] = k; sorted[1] = l; sorted[2] = m; sorted[3] = n;\n Array.Sort(sorted);\n int harmed = 0;\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(d);\n else\n {\n while (k <= d || l <= d || m <= d || n <= d)\n {\n harmed += 4;\n k *= 2; l *= 2; m *= 2; n *= 2;\n } \n Console.WriteLine(harmed + (sorted[0] - 1));\n } \n } \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_InsomniaOff {\n class Program {\n static void Main(string[] args) {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int d = Int32.Parse(Console.ReadLine());\n\n bool[] dragons = new bool[d];\n for(int i=0; i < d; i++) {\n if(i % k == 0) {\n dragons[i] = true;\n continue;\n }\n if (i % l == 0) {\n dragons[i] = true;\n continue;\n }\n if (i % m == 0) {\n dragons[i] = true;\n continue;\n }\n if (i % n == 0) {\n dragons[i] = true;\n continue;\n }\n }\n int result = 0;\n for(int i = 0; i < d; ++i) {\n if(dragons[i] == true) {\n result++;\n }\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InsomniaCure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n\n int count = 0;\n\n for (int i = 1; i < d; i++)\n {\n if ( (i % k == 0) ||\n (i % l == 0) ||\n (i % m == 0) ||\n (i % n == 0) )\n {\n count++;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//var inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();\n\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\n\t\t\tif (k == 1 || l == 1 || m == 1 || d == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(d);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint count = 0;\n\t\t\tvar dragons = Enumerable.Range(1, d);\n\t\t\tforeach (var dragon in dragons)\n\t\t\t{\n\t\t\t\tif (dragon % k == 0 || dragon % l == 0 || dragon % m == 0 || dragon % n == 0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int[] mas = new int[n];\n for (int i = 0; i < mas.Length; i++)\n {\n mas[i] = 1;\n }\n if (a < n && b < n && c < n && d < n)\n { \n for (int i = 0; i < mas.Length; i = i + a)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + b)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + c)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + d)\n {\n mas[i] = 0;\n }\n }\n int k = 0;\n for (int i = 0; i < mas.Length; i++) \n {\n if (mas[i] == 0) { k++; }\n }\n Console.Write(k);\n Console.ReadLine();\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.ComponentModel;\nusing System.Linq;\n\nnamespace Calculating_Function\n{\n class Program\n {\n static void Main()\n {\n int k = int.Parse(Console.ReadLine()), l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine()), n = int.Parse(Console.ReadLine());\n long d = long.Parse(Console.ReadLine());\n int c = 0;\n\n for (int i = 0; i < d; i++)\n {\n if (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)\n {\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace CSharpOlympTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine());\n\n Console.WriteLine(d / k + l / k + m / k + n / k);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing static System.Console;class P{static void Main(){int k=int.Parse(ReadLine()),l=int.Parse(ReadLine()),m=int.Parse(ReadLine()),n=int.Parse(ReadLine()),d=int.Parse(ReadLine()),r=0;for(int i=0;ix==true).Count());\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Training_Linklist_post_pre_infix\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());//|___Pan____|\n int l = int.Parse(Console.ReadLine());//|___Door___|\n int m = int.Parse(Console.ReadLine());//|___Pashne_|\n int n = int.Parse(Console.ReadLine());//|___Mom____|\n int d = int.Parse(Console.ReadLine());//|___TOTAL__|\n int j=0;\n for (int i = 0; i <= d; i++)\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n j++;\n\n Console.Write(j--);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A {\n class Program {\n static void Main(string[] args) {\n int[] q = new int[4];\n for (int i = 0; i < q.Length; i++) {\n q[i] = int.Parse(Console.ReadLine());\n }\n int d = int.Parse(Console.ReadLine());\n\n bool[] arr = new bool[d];\n int count = 0;\n for (int i = 0; i < arr.Length; i++) {\n bool flag = false;\n if (i % q[0] == 0 || i % q[1] == 0 || i % q[2] == 0 || i % q[3] == 0) {\n flag = true;\n }\n if (flag) {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections;\n\n\nnamespace MyProg\n{\n\n class Program\n {\n static List arr = new List();\n static void Main(string[] args)\n {\n int d, CountOfINters = 0, sum = 0;\n\n for (int i = 0; i < 4; i++)\n {\n\n arr.Add(int.Parse(Console.ReadLine()));\n }\n\n\n d = int.Parse(Console.ReadLine());\n \n Oraganize();\n \n if (arr.Count == 1)\n {\n Console.WriteLine(d / arr[0]);\n return;\n }\n \n int Mult =1; ;\n int cofactor =1;\n \n\n List SavedData = new List();\n for (int i = 0; i < arr.Count; i++)\n {\n Mult *= arr[i];\n\n }\n \n while (Mult * cofactor <= d)\n {\n SavedData.Add(Mult * cofactor);\n CountOfINters += arr.Count-1;\n cofactor++;\n }\n\n for (int i = 0; i < arr.Count - 1; i++)\n {\n\n sum += d / arr[i];\n\n for (int j = i + 1; j < arr.Count; j++)\n {\n\n Mult = arr[i] * arr[j];\n cofactor = 1;\n\n while (Mult * cofactor <= d)\n {\n if (!SavedData.Contains(Mult * cofactor))\n {\n CountOfINters++;\n }\n cofactor++;\n }\n }\n\n }\n \n sum += d / arr[arr.Count - 1];\n Console.WriteLine(sum- CountOfINters);\n \n \n \n\n \n\n \n \n \n \n \n \n }\n \n static public void Oraganize()\n {\n for (int i = 0; i < arr.Count; i++)\n {\n for (int k = 0; k < arr.Count; k++)\n {\n if (i != k && arr[i] % arr[k] == 0)\n {\n arr.RemoveAt(i);\n i--;\n break;\n }\n }\n }\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var inp = new int[4];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var n = Enumerable.Range(1, d).ToDictionary(m => m, m => true);\n foreach (var item in inp)\n {\n if (!n[item])\n {\n continue;\n }\n for (var j = item; j <= d; j += item)\n {\n n[j] = false;\n }\n }\n var count = n.Count(b => b.Value == false);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = 0;\n var mass = Enumerable.Range(0, 5).Select(i => int.Parse(Console.ReadLine())).ToArray();\n for(int i = 1; i <= mass[4]; i++)\n {\n if (i % mass[0] == 0 || i % mass[1] == 0 || i % mass[2] == 0 || i % mass[3] == 0 || i % mass[4] == 0) count++;\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k=Int32.Parse(Console.ReadLine());\n int l=Int32.Parse(Console.ReadLine());\n int m=Int32.Parse(Console.ReadLine());\n int n=Int32.Parse(Console.ReadLine());\n int d=Int32.Parse(Console.ReadLine());\n int sum=0;\n \n for (int i = 0; i < d; i++) {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n sum++;\n }\n Console.WriteLine(sum);\n }\n public static void Main ()\n {\n Z148A ();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fun\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar k = int.Parse(Console.ReadLine());\n\t\t\tvar l = int.Parse(Console.ReadLine());\n\t\t\tvar m = int.Parse(Console.ReadLine());\n\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\tvar d = int.Parse(Console.ReadLine());\n\n\t\t\tint c = 0;\n\t\t\tfor (int i = 0; i < d; i++)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tc++;\n\t\t\t} \n\t\t\tConsole.WriteLine(c);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dragon = new bool[d];\n for (int i = 0; i < d; i++)\n dragon[i] = false;\n for (int i = 0; i < d; i += k)\n dragon[i] = true;\n for (int i = 0; i < d; i += l)\n dragon[i] = true;\n for (int i = 0; i < d; i += m)\n dragon[i] = true;\n for (int i = 0; i < d; i += n)\n dragon[i] = true;\n int count=0;\n for (int i = 0; i < d; i++)\n if (dragon[i])\n count++;\n Console.WriteLine(count.ToString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace CSharpOlympTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine());\n\n Console.WriteLine(d / k + l / k + m / k + n / k);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n int[] div = new int[4];\n div[0] = int.Parse(Console.ReadLine());\n div[1] = int.Parse(Console.ReadLine());\n div[2] = int.Parse(Console.ReadLine());\n div[3] = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n for (int i = 1; i <= n; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % div[j] == 0)\n {\n sum++;\n }\n break;\n }\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dragon = new bool[d];\n for (int i = 0; i < d; i++)\n dragon[i] = false;\n if (k <= d)\n for (int i = 0; i < d; i += k)\n dragon[i] = true;\n if (l <= d)\n for (int i = 0; i < d; i += l)\n dragon[i] = true;\n if (m <= d)\n for (int i = 0; i < d; i += m)\n dragon[i] = true;\n if (n <= d)\n for (int i = 0; i < d; i += n)\n dragon[i] = true;\n int count = 0;\n for (int i = 0; i < d; i++)\n if (dragon[i])\n count++;\n Console.WriteLine(count.ToString());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n int[] dragons = Console.ReadLine().Split().Select(x=>Convert.ToInt32(x)).ToArray();\n bool[] beaten = new bool[dragons[dragons.Length-1]];\n for(int j=0; j q.Min()) {\n //Console.WriteLine(i);\n count++;\n }\n }\n if (count != 1)\n count = d - count;\n else\n count = 0;\n } else {\n count = d;\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace palindrome\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\t\n\t\t\tbool [] c = new bool[d+1];\n\t\t\tint cont = 0;\n\t\t\tfor (int i = 1; i <= d; i+= k) {\n\t\t\t\tif (!c[i])\n\t\t\t\t{\n\t\t\t\t\tcont++;\n\t\t\t\t\tc[i] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 1; i <= d; i+= l) {\n\t\t\t\tif (!c[i])\n\t\t\t\t{\n\t\t\t\t\tcont++;\n\t\t\t\t\tc[i] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 1; i <= d; i+= m) {\n\t\t\t\tif (!c[i])\n\t\t\t\t{\n\t\t\t\t\tcont++;\n\t\t\t\t\tc[i] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 1; i <= d; i+= n) {\n\t\t\t\tif (!c[i])\n\t\t\t\t{\n\t\t\t\t\tcont++;\n\t\t\t\t\tc[i] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tConsole.WriteLine(cont);\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine()),\n l = Convert.ToInt32(Console.ReadLine()),\n m = Convert.ToInt32(Console.ReadLine()),\n n = Convert.ToInt32(Console.ReadLine()),\n d = Convert.ToInt32(Console.ReadLine()),\n output = 0;\n for(int i = 0; i < d; i ++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % m == 0 || i % n == 0)\n output++;\n }\n Console.Write(output);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Reflection;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.v2.TaskV2Attribute]\n#endif\n\tclass Task148A\n\t{\n\t\tprivate class Solver\n\t\t{\n\t\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\t\tprivate TextWriter output = Console.Out;\n\n\t\t\tpublic void Solve()\n\t\t\t{\n\t\t\t\tint k, l, m, n, d;\n\t\t\t\tinput.Line().Read(out k)\n\t\t\t\t\t\t .Line().Read(out l)\n\t\t\t\t\t\t .Line().Read(out m)\n\t\t\t\t\t\t .Line().Read(out n)\n\t\t\t\t\t\t .Line().Read(out d);\n\n\t\t\t\tint ans = 0;\n\t\t\t\tfor (int i = 1; i <= d; ++i)\n\t\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0)\n\t\t\t\t\t\t++ans;\n\n\t\t\t\toutput.WriteLine(ans);\n\t\t\t}\n\t\t}\n\n\t\t#region\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Solver();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Drinks\n{\n class Program\n {\n static void Main(string[] args)\n {\n float n = float.Parse(Console.ReadLine());\n //float[] p = Array.ConvertAll(Console.ReadLine().Split(), float.Parse);\n //float a = 0;\n //for (int i = 0; i < p.Length; i++)\n //{\n // a += p[i];\n //}\n //Console.WriteLine(a / n);\n //Console.WriteLine(Array.ConvertAll(Console.ReadLine().Split(), float.Parse).Sum()/n);\n Console.WriteLine(Console.ReadLine().Split().Select(float.Parse).Sum() / n);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A {\n class Program {\n static void Main(string[] args) {\n int[] q = new int[4];\n for (int i = 0; i < q.Length; i++) {\n q[i] = int.Parse(Console.ReadLine());\n }\n int d = int.Parse(Console.ReadLine());\n\n bool[] arr = new bool[d];\n int count = 0;\n for (int i = 0; i < arr.Length; i++) {\n bool flag = false;\n if (i % q[0] == 0 || i % q[1] == 0 || i % q[2] == 0 || i % q[3] == 0) {\n flag = true;\n }\n if (flag) {\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n int[] dragons = Console.ReadLine().Split().Select(x=>Convert.ToInt32(x)).ToArray();\n bool[] beaten = new bool[dragons[dragons.Length-1]];\n for(int j=0; j gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var primes = gp(d).Count(p => !inp.Contains(p)) + 1;\n Console.WriteLine(d - primes);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nnamespace codechef\n{\n public class Program{\n public static StreamWriter writer;\n\n public static void RealWork()\n {\n int[] dragon = new int[5];\n for (int i = 0; i < 5; i++)\n dragon[i] = intParse(Console.ReadLine());\n int Ans = 0;\n int[] map = new int[dragon[4]+1];\n for (int i = 0; i < 5; i++)\n {\n for (int j = dragon[i]; j <= dragon[4]; j=j+dragon[i])\n if (map[j] == 0)\n {\n map[j]++; Ans++;\n }\n }\n writer.Write(Ans); \n }\n static void Main(string[] args)\n {\n writer = new StreamWriter(Console.OpenStandardOutput());\n //writer = new StreamWriter(\"output.txt\");\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\"))); \n RealWork();\n writer.Close();\n }\n\n public static int intParse(string st)\n {\n int x = 0;\n for (int i = 0; i < st.Length; i++) { x = x * 10 + (st[i] - 48); }\n return x;\n }\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A {\n class Program {\n static void Main(string[] args) {\n int[] q = new int[4];\n for (int i = 0; i < q.Length; i++) {\n q[i] = int.Parse(Console.ReadLine());\n }\n int d = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"===\");\n bool[] prime = new bool[d + 1];\n int count = 1;\n if (!q.Contains(1)) {\n for (int i = 0; i < prime.Length; i++) {\n prime[i] = true;\n }\n prime[0] = prime[1] = false;\n for (int i = 2; i * i <= d; ++i) {\n if (prime[i]) {\n for (int j = i * i; j <= d; j += i) {\n prime[j] = false;\n }\n }\n }\n for (int i = 0; i < prime.Length; i++) {\n if (prime[i] && !q.Contains(i) && i > q.Min()) {\n //Console.WriteLine(i);\n count++;\n }\n }\n if (count != 1)\n count = d - count;\n else\n count = 0;\n } else {\n count = d;\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u0421\u0440\u0435\u0434\u0441\u0442\u0432\u043e_\u043e\u0442_\u0431\u0435\u0441\u0441\u043e\u043d\u043d\u0438\u0446\u044b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int z = 0;\n for (int i = 0; i < d; i++)\n {\n if (i % k == 0)\n z++;\n else if (i % l == 0)\n z++;\n else if (i % m == 0)\n z++;\n else if (i % n == 0)\n z++;\n }\n Console.WriteLine(z);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class InsomniaCure\n{\n\tprivate static void Main()\n\t{\n\t\tvar k = int.Parse(Console.ReadLine());\n\t\tvar l = int.Parse(Console.ReadLine());\n\t\tvar m = int.Parse(Console.ReadLine());\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tvar d = int.Parse(Console.ReadLine());\n\t\t\n\t\tvar output = 0;\n\t\tfor (int i = 0; i < d; i++)\n\t\t{\n\t\t\tif(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t{\n\t\t\t\toutput++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(output);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine()),\n l = Convert.ToInt32(Console.ReadLine()),\n m = Convert.ToInt32(Console.ReadLine()),\n n = Convert.ToInt32(Console.ReadLine()),\n d = Convert.ToInt32(Console.ReadLine()),\n output = 0;\n for(int i = 0; i < d; i ++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % m == 0 || i % n == 0)\n output++;\n }\n Console.Write(output);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace CSharpOlympTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine()),\n count = 0;\n\n var divisors = new List() { k };\n if (l % k != 0)\n divisors.Add(l);\n\n if (m % l != 0 && m % k != 0)\n divisors.Add(m);\n\n if (n % m != 0 && n % l != 0 && n % k != 0)\n divisors.Add(m);\n\n for (int i = 1; i <= d; ++i)\n if (divisors.Any(e => i % e == 0))\n ++count;\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces__A.\u0421\u043b\u0438\u0448\u043a\u043e\u043c_\u0434\u043b\u0438\u043d\u043d\u044b\u0435_\u0441\u043b\u043e\u0432\u0430_\n{\n class RemedyForInsomnia\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int dragons=0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n dragons++;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#15 Resolve Insomnia cure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input1 = int.Parse(Console.ReadLine()),\n input2 = int.Parse(Console.ReadLine()),\n input3 = int.Parse(Console.ReadLine()),\n input4 = int.Parse(Console.ReadLine()),\n all = int.Parse(Console.ReadLine()),\n remnant1 = 0, remnant2 = 0, remnant3 = 0, remnant4 = 0, sum = 0;\n for (int i = 0; i < all; i++)\n {\n if (i % input1 == 0 && all>= input1) remnant1++;\n else if (i % input2 == 0 && all >= input2) remnant2++;\n else if (i % input3 == 0 && all >= input3) remnant3++;\n else if (i % input4 == 0 && all >= input4) remnant4++;\n }\n sum = remnant1 + remnant2 + remnant3 + remnant4;\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[]a = new string[5];\n bool flag = false;\n for (int i = 0; i < 5; i++)\n {\n a[i] = Console.ReadLine();\n if (a[i] == \"1\")\n {\n flag = true;\n }\n }\n if (flag)\n {\n Console.Write(a[4]);\n }\n else\n {\n int count = 0;\n for (int i = 1; i <= Convert.ToInt32(a[4]); i++)\n {\n if (i % Convert.ToInt32(a[0]) == 0 || i % Convert.ToInt32(a[1]) == 0 || i % Convert.ToInt32(a[2]) == 0 || i % Convert.ToInt32(a[3]) == 0)\n {\n count++;\n }\n }\n Console.Write(count);\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces__A.\u0421\u043b\u0438\u0448\u043a\u043e\u043c_\u0434\u043b\u0438\u043d\u043d\u044b\u0435_\u0441\u043b\u043e\u0432\u0430_\n{\n class RemedyForInsomnia\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int dragons=0;\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n dragons++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] b = new bool[d];\n int f = 0;\n for (int i = 0; i < d; i += k)\n {\n if (b[i] == false)\n {\n f++;\n b[i] = true;\n }\n else\n {\n b[i] = true;\n }\n }\n for (int i = 0; i < d; i += m)\n {\n if (b[i] == false)\n {\n f++;\n b[i] = true;\n }\n else\n {\n b[i] = true;\n }\n }\n for (int i = 0; i < d; i += n)\n {\n if (b[i] == false)\n {\n f++;\n b[i] = true;\n }\n else\n {\n b[i] = true;\n }\n }\n for (int i = 0; i < d; i += l)\n {\n if (b[i] == false)\n {\n f++;\n b[i] = true;\n }\n else\n {\n b[i] = true;\n }\n }\n Console.WriteLine(f);\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Test\n{\n static void Main()\n {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int d = Int32.Parse(Console.ReadLine());\n int [] atmp = new int[d];\n\n for(int a=0 ; a gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var primes = gp(d).Count(p => !inp.Contains(p)) + 1;\n Console.WriteLine(d - primes);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace InsomniaCure\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n\n int count = 0;\n\n for (int i = 1; i < d; i++)\n {\n if ( (i % k == 0) ||\n (i % l == 0) ||\n (i % m == 0) ||\n (i % n == 0) )\n {\n count++;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ProblemsFun\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k, l, m, n, d;\n k = Convert.ToInt32(Console.ReadLine());\n l = Convert.ToInt32(Console.ReadLine());\n m = Convert.ToInt32(Console.ReadLine());\n n = Convert.ToInt32(Console.ReadLine());\n d = Convert.ToInt32(Console.ReadLine());\n\n int count = 0;\n for (int i = 0; i < d; i++ )\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n count++;\n }\n Console.WriteLine(count);\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass A105\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\tfor (int i = 0; i < d; i++)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tans++;\n\t\t\t}\n\n\n\t\t\t\tConsole.WriteLine(ans);\n\n\t//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int[] mas = new int[n];\n for (int i = 0; i < mas.Length; i++)\n {\n mas[i] = 1;\n }\n if (a < n && b < n && c < n && d < n)\n { \n for (int i = 0; i < mas.Length; i = i + a)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + b)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + c)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + d)\n {\n mas[i] = 0;\n }\n }\n int k = 0;\n for (int i = 0; i < mas.Length; i++) \n {\n if (mas[i] == 0) { k++; }\n }\n Console.Write(k);\n Console.ReadLine();\n }\n }\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n public static IEnumerable gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var primes = gp(d).Count(p => !inp.Contains(p)) + 1;\n Console.WriteLine(d - primes);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class _148A\n {\n public static void Main()\n {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int totalDragons = Int32.Parse(Console.ReadLine());\n for (int i = 0; i < totalDragons; i++)\n {\n if (i % k == 0 || i % l == 0 | i % m == 0 || i % n == 0)\n {\n\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A {\n class Program {\n static void Main(string[] args) {\n int[] q = new int[4];\n for (int i = 0; i < q.Length; i++) {\n q[i] = int.Parse(Console.ReadLine());\n }\n int d = int.Parse(Console.ReadLine());\n\n bool[] prime = new bool[d + 1];\n int count = 1;\n if (!q.Contains(1)) {\n for (int i = 0; i < prime.Length; i++) {\n prime[i] = true;\n }\n prime[0] = prime[1] = false;\n for (int i = 2; i * i <= d; ++i) {\n if (prime[i]) {\n for (int j = i * i; j <= d; j += i) {\n prime[j] = false;\n }\n }\n }\n for (int i = 0; i < prime.Length; i++) {\n if (prime[i] && !q.Contains(i) && i > q.Min()) {\n //Console.WriteLine(i);\n count++;\n }\n }\n if (count != 1)\n count = d - count;\n else\n count = 0;\n } else {\n count = d;\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int [] mas=new int [n];\n for (int i = 0; i < mas.Length; i++)\n {\n mas[i] = 1; \n }\n for (int i = 0; i < mas.Length; i=i+a)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + b)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + c)\n {\n mas[i] = 0;\n }\n for (int i = 0; i < mas.Length; i = i + d)\n {\n mas[i] = 0;\n }\n int k = 0;\n for (int i = 0; i < mas.Length; i++) \n {\n if (mas[i] == 0) { k++; }\n }\n Console.Write(k);\n Console.ReadLine();\n }\n }\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace CSharpOlympTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine()),\n l = int.Parse(Console.ReadLine()),\n m = int.Parse(Console.ReadLine()),\n n = int.Parse(Console.ReadLine()),\n d = int.Parse(Console.ReadLine()),\n count = 0;\n\n var divisors = new List() { k };\n if (l % k != 0)\n divisors.Add(l);\n\n if (m % l != 0 && m % k != 0)\n divisors.Add(m);\n\n if (n % m != 0 && n % l != 0 && n % k != 0)\n divisors.Add(m);\n\n for (int i = 1; i <= d; ++i)\n if (divisors.Any(e => i % e == 0))\n ++count;\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Insomnia_Cure_148A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = new int[5];\n for (int i = 0; i < 5; i++)\n {\n input[i] = int.Parse(Console.ReadLine());\n }\n int count = 0;\n for (int i = 0; i < input[4]; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % input[j] == 0)\n {\n count++;\n break;\n }\n }\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _148A_Princess\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int[] dracaris = new int[d];\n\n for (int i = 0; i < d; i+=k)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += l)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += m)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += n)\n {\n dracaris[i] = 1;\n }\n\n Console.WriteLine(dracaris.Sum());\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int count = 0;\n\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n \n int d = int.Parse(Console.ReadLine());\n\n int min = Math.Min(k, l);\n min = Math.Min(min, m);\n min = Math.Min(min, n);\n\n count = min - 1;\n\n for (int i = min; i < d; i++)\n { \n\n if (i % k == 0)\n continue;\n\n if (i % l == 0) \n continue;\n\n if (i % m == 0)\n continue;\n\n if (i % n == 0)\n continue; \n\n count++; \n }\n\n Console.WriteLine(d - count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input=new int[5];\n int number = 0;\n for (int i = 0; i < input.Length; i++)\n {\n input[i] = Convert.ToInt32(Console.ReadLine());\n }\n number = input[input.Length - 1];\n for (int i = 0; i < input[input.Length - 1]; i++)\n {\n\n if (i % input[0] != 0 && i % input[2] != 0 && i % input[1] != 0 && i % input[3] != 0)\n {\n number--;\n }\n }\n Console.WriteLine(number);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dr = new bool[d];\n int count = 0;\n\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(d);\n else\n {\n for (int i = 0; i < d; i = i + k)\n dr[i] = true;\n \n for (int i = 0; i < d; i = i + l)\n dr[i] = true;\n\n for (int i = 0; i < d; i = i + m)\n dr[i] = true;\n\n for (int i = 0; i < d; i = i + n)\n dr[i] = true;\n\n\n for (int i = 0; i < d; i++)\n {\n if (dr[i] == true)\n count++;\n }\n\n Console.WriteLine(count);\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CFDay12\n{\n class Program\n {\n static void Main(string[] args)\n\n {\n\n int count = 0;\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n if(k==1||l==1||m==1||n==1)\n Console.WriteLine(d);\n else\n {\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n count++;\n Console.WriteLine(count);\n }\n Console.WriteLine(count);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Drinks\n{\n class Program\n {\n static void Main(string[] args)\n {\n float n = float.Parse(Console.ReadLine());\n //float[] p = Array.ConvertAll(Console.ReadLine().Split(), float.Parse);\n //float a = 0;\n //for (int i = 0; i < p.Length; i++)\n //{\n // a += p[i];\n //}\n //Console.WriteLine(a / n);\n //Console.WriteLine(Array.ConvertAll(Console.ReadLine().Split(), float.Parse).Sum()/n);\n Console.WriteLine(Console.ReadLine().Split().Select(float.Parse).Sum() / n);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//var inputs = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();\n\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\n\t\t\tif (k == 1 || l == 1 || m == 1 || d == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(d);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tint count = 0;\n\t\t\tvar dragons = Enumerable.Range(1, d);\n\t\t\tforeach (var dragon in dragons)\n\t\t\t{\n\t\t\t\tif (dragon % k == 0 || dragon % l == 0 || dragon % m == 0 || dragon % n == 0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dr = new bool[d];\n int count = 0;\n\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(d);\n else\n {\n for (int i = k; i < d; i = i + k)\n dr[i] = true;\n \n for (int i = l; i < d; i = i + l)\n dr[i] = true;\n\n for (int i = m; i < d; i = i + m)\n dr[i] = true;\n\n for (int i = n; i < d; i = i + n)\n dr[i] = true;\n\n\n for (int i = 0; i < d; i++)\n {\n if (dr[i] == true)\n count++;\n }\n\n Console.WriteLine(count);\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input=new int[5];\n for (int i = 0; i < input.Length; i++)\n {\n input[i] = Convert.ToInt32(Console.ReadLine());\n }\n int number = input[input.Length - 1];\n for (int i = 1; i <= number; i++)\n {\n\n if (i % input[0] != 0 && i % input[2] != 0 && i % input[1] != 0 && i % input[3] != 0)\n {\n number--;\n }\n }\n Console.WriteLine(number);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var inp = new int[4];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var n = Enumerable.Range(1, d).ToDictionary(m => m, m => true);\n foreach (var item in inp)\n {\n if (!n[item])\n {\n continue;\n }\n for (var j = item; j <= d; j += item)\n {\n n[j] = false;\n }\n }\n var count = n.Count(b => b.Value == false);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace AcmSolution\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(\"../../../a.txt\"));\n#endif\n\n#if !ONLINE_JUDGE\n Console.ReadLine();\n#endif\n }\n\n static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n static int GetInt(string s)\n {\n return int.Parse(s);\n }\n\n static int[] GetInts()\n {\n string[] ss = GetStrs();\n int[] nums = new int[ss.Length];\n\n int i = 0;\n foreach (string s in ss)\n nums[i++] = GetInt(s);\n\n return nums;\n }\n\n static string[] GetStrs()\n {\n return Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n static string GetStr()\n {\n return Console.ReadLine();\n }\n\n static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n static void W(T s)\n {\n Console.Write(s);\n }\n }\n}\n"}, {"source_code": "using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.Linq;\n using System.Text;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var k = int.Parse(Console.ReadLine());\n var l = int.Parse(Console.ReadLine());\n var m = int.Parse(Console.ReadLine());\n var n = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n var count = 0;\n var str = new StringBuilder();\n for (int i = 0; i < d; i++)\n {\n str.Append(\"X\");\n }\n\n for (int i = k - 1; i < d; i = i + k)\n {\n str[i] = 'P';\n\n }\n for (int i = k - 1; i < d; i = i + l)\n {\n str[i] = 'P';\n\n }\n for (int i = k - 1; i < d; i = i + m)\n {\n str[i] = 'P';\n\n }\n for (int i = k - 1; i < d; i = i + n)\n {\n str[i] = 'P';\n\n }\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'P')\n {\n count++;\n }\n }\n Console.WriteLine(count);\n \n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n public static IEnumerable gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var primes = gp(d).Where(p => !inp.Contains(p));\n var count = primes.Count();\n foreach (var item in primes)\n {\n var i = item;\n do\n {\n i += i;\n } while (i <= d);\n count += i;\n }\n Console.WriteLine(d - count);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces98\n{\n\tclass A105\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint ans = 0;\n\t\t\tint k = int.Parse(Console.ReadLine());\n\t\t\tint l = int.Parse(Console.ReadLine());\n\t\t\tint m = int.Parse(Console.ReadLine());\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint d = int.Parse(Console.ReadLine());\n\t\t\tfor (int i = 0; i < d; i++)\n\t\t\t{\n\t\t\t\tif (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t\t\tans++;\n\t\t\t}\n\n\n\t\t\t\tConsole.WriteLine(ans);\n\n\t//\t\t\tConsole.ReadKey();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace CFDay12\n{\n class Program\n {\n static void Main(string[] args)\n\n {\n\n int count = 0;\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n if(k==1||l==1||m==1||n==1)\n Console.WriteLine(d);\n else\n {\n for (int i = 1; i <= d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n count++;\n Console.WriteLine(count);\n }\n Console.WriteLine(count);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int l = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int n = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int temp = 0;\n for (int i=1; i<=d;i++)\n {\n if (i%k==0) { temp++; continue; }\n if (i % l == 0) { temp++; continue; }\n if (i % m == 0) { temp++; continue; }\n if (i % n == 0) { temp++; continue; }\n if (i % d == 0) { temp++; continue; }\n }\n Console.WriteLine(temp);\n }\n }\n}\n"}, {"source_code": " using System;\n class insumnia\n {\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int total = 0;\n\n if ( k == 1 )\n total = d;\n else\n {\n for ( int i=0 ; k*i < d ; i++ )\n {\n total++;\n }\n for ( int i=0 ; m*i < d || n*i < d || l*i < d ; i++)\n {\n if ( (m*i)%k != 0 && m*i < d)\n total++;\n if ( (n*i)%k != 0 && (n*i)%m != 0 && n*i < d)\n total++;\n if ( (l*i)%k != 0 && (l*i)%m != 0 && (l*i)%n != 0 && l*i < d)\n total++;\n }\n }\n\n Console.WriteLine(total);\n\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Olymp\n{\n public class Program\n {\n static void Z1A ()\n {\n uint n, m, a;\n string str = Console.ReadLine ();\n string [] strs = str.Split (' ');\n n = UInt32.Parse (strs [0]);\n m = UInt32.Parse (strs [1]);\n a = UInt32.Parse (strs [2]);\n\n\n uint nn = n / a;\n if (n % a > 0)\n nn++;\n uint nm = m / a;\n if (m % a > 0)\n nm++;\n ulong result = (ulong)nn * (ulong)nm;\n Console.WriteLine (result);\n }\n\n static void Z4A ()\n {\n int w = Int32.Parse (Console.ReadLine ());\n if (w % 2 == 0 && w > 2)\n Console.WriteLine (\"YES\");\n else\n Console.WriteLine (\"NO\");\n }\n\n static void Z158A ()\n {\n int n, k;\n string [] strs = Console.ReadLine ().Split (' ');\n n = Int32.Parse (strs [0]);\n k = Int32.Parse (strs [1]);\n strs = Console.ReadLine ().Split (' ');\n int max = 0;\n int i;\n for (i = 0; i < k; i++) {\n max = Int32.Parse (strs [i]);\n if (max == 0) {\n Console.WriteLine (i);\n return;\n }\n }\n int sum = k;\n for (; i < n; i++) {\n if (Int32.Parse (strs [i]) < max)\n break;\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z71A ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n if (str.Length > 10) {\n Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);\n } else {\n Console.WriteLine (str);\n }\n\n }\n }\n\n static void Z118A ()\n {\n string str = Console.ReadLine ();\n str = str.ToLower ();\n str = str.Replace (\"a\", \"\");\n str = str.Replace (\"o\", \"\");\n str = str.Replace (\"y\", \"\");\n str = str.Replace (\"e\", \"\");\n str = str.Replace (\"u\", \"\");\n str = str.Replace (\"i\", \"\");\n for (int i = 0; i < str.Length; i++) {\n Console.Write (\".\" + str [i]);\n }\n\n\n }\n\n static void Z50A ()\n {\n \n string [] strs = Console.ReadLine ().Split (' ');\n int N = Int32.Parse (strs [0]);\n int M = Int32.Parse (strs [1]);\n int result = 0;\n result = (N / 2) * M;\n N %= 2;\n M /= 2;\n result += M * N;\n Console.WriteLine (result);\n \n }\n\n static void Z158B ()\n {\n int n = Int32.Parse (Console.ReadLine ());\n string[] strs = Console.ReadLine ().Split (' ');\n int[] com = new int[4];\n for (int i = 0; i < 4; i++) {\n com [i] = 0; \n }\n int temp = 0;\n for (int i = 0; i < n; i++) {\n temp = Int32.Parse (strs [i]);\n com [temp - 1]++;\n }\n int sum = com [3];\n temp = Math.Min (com [2], com [0]);\n com [2] -= temp;\n com [0] -= temp;\n sum += temp;\n sum += com [2];\n sum += com [1] / 2;\n com [1] %= 2;\n sum += com [1];\n com [0] -= com [1] * 2;\n if (com [0] > 0) {\n \n sum += com [0] / 4;\n com [0] %= 4;\n if (com [0] > 0)\n sum++;\n }\n Console.WriteLine (sum);\n\n }\n\n static void Z231A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n string[] strs;\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)\n sum++;\n }\n Console.WriteLine (sum);\n }\n\n static void Z282A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int x = 0;\n string str;\n for (int i = 0; i < n; i++) {\n str = Console.ReadLine ();\n str = str.Replace (\"X\", \"\");\n if (str == \"++\") {\n x++;\n } else {\n x--;\n }\n }\n Console.WriteLine (x);\n }\n\n static void Z116A ()\n {\n \n int n = Int32.Parse (Console.ReadLine ());\n int a = 0, b = 0;\n int sum = 0;\n int max = 0;\n string [] strs;\n for (int i = 0; i < n; i++) {\n strs = Console.ReadLine ().Split (' ');\n a = Int32.Parse (strs [0]);\n b = Int32.Parse (strs [1]);\n sum -= a;\n sum += b;\n if (sum > max) {\n max = sum;\n }\n }\n Console.WriteLine (max);\n }\n\n static void Z131A ()\n {\n bool caps = true;\n string str = Console.ReadLine ();\n char first = str [0];\n for (int i = 1; i < str.Length; i++) {\n if (str [i] < 'A' || str [i] > 'Z')\n caps = false;\n }\n if (caps) {\n str = str.ToLower ();\n if (first >= 'a' && first <= 'z')\n first = first.ToString ().ToUpper () [0];\n else\n first = first.ToString ().ToLower () [0];\n str = first + str.Substring (1);\n\n }\n Console.WriteLine (str);\n }\n\n static void Z96A ()\n {\n string str = Console.ReadLine ();\n int n = 0;\n char ch = 'w';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n if (n >= 7) {\n Console.WriteLine (\"YES\");\n return;\n }\n ch = str [i];\n n = 1;\n }\n }\n if (n < 7)\n Console.WriteLine (\"NO\");\n else\n Console.WriteLine (\"YES\");\n }\n\n static void Z266A ()\n {\n \n string str = Console.ReadLine ();\n str = Console.ReadLine ();\n int n = 0;\n int m = 0;\n char ch = ' ';\n for (int i = 0; i < str.Length; i++) {\n if (ch == str [i])\n n++;\n else {\n m += n;\n ch = str [i];\n n = 0;\n }\n }\n m += n;\n Console.WriteLine (m);\n }\n\n static void Z133A ()\n {\n string str = Console.ReadLine ();\n for (int i = 0; i < str.Length; i++) {\n if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {\n\n Console.WriteLine (\"YES\");\n return;\n }\n\n }\n Console.WriteLine (\"NO\");\n \n \n }\n\n static void Z112A ()\n {\n string str1 = Console.ReadLine ();\n str1 = str1.ToLower ();\n string str2 = Console.ReadLine ();\n str2 = str2.ToLower ();\n int n = String.Compare (str1, str2);\n if (n != 0)\n Console.WriteLine (n / Math.Abs (n));\n else\n Console.WriteLine (0);\n }\n\n static void Z339A ()\n {\n int [] ch = new int[3];\n for (int i = 0; i < 3; i++) {\n ch [i] = 0;\n }\n string str = Console.ReadLine ();\n bool flag = false;\n for (int i = 0; i < str.Length; i++) {\n if (flag)\n i++;\n else\n flag = true;\n ch [Int32.Parse (str [i].ToString ()) - 1]++;\n }\n int j = 0;\n flag = false;\n while (j<3) {\n ch [j]--;\n \n if (ch [j] >= 0) {\n if (flag) {\n Console.Write (\"+\");\n } else\n flag = true;\n Console.Write (j + 1);\n } else\n j++;\n }\n }\n\n static void Z281A ()\n {\n string str = Console.ReadLine ();\n string f = str [0].ToString ();\n f = f.ToUpper ();\n str = f [0] + str.Substring (1);\n Console.Write (str);\n }\n\n static void Z82A ()\n {\n string[] names = new string[5];\n names [0] = \"Sheldon\";\n names [1] = \"Leonard\";\n names [2] = \"Penny\";\n names [3] = \"Rajesh\";\n names [4] = \"Howard\";\n int n = Int32.Parse (Console.ReadLine ());\n int m = 5;\n while (m moneys = new List ();\n int sum = 0;\n for (int i = 0; i < n; i++) {\n moneys.Add (Int32.Parse (str [i]));\n sum += moneys [i];\n }\n\n int[] armon = moneys.ToArray ();\n Array.Sort (armon);\n int blz = 0;\n int j = armon.Length - 1;\n int ni = 0;\n while (blz<=sum&&j>=0) {\n blz += armon [j];\n sum -= armon [j];\n j--;\n ni++;\n }\n Console.WriteLine (ni);\n }\n\n static void Z148A ()\n {\n int k=Int32.Parse(Console.ReadLine());\n int l=Int32.Parse(Console.ReadLine());\n int m=Int32.Parse(Console.ReadLine());\n int n=Int32.Parse(Console.ReadLine());\n int d=Int32.Parse(Console.ReadLine());\n int sum=0;\n \n for (int i = 0; i < d; i++) {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n sum++;\n }\n Console.WriteLine(sum);\n }\n public static void Main ()\n {\n Z148A ();\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n string input = Console.ReadLine();\n bool willPrint = false;\n for(int i=0; i gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n if (d < inp[0] && d < inp[1] && d < inp[2] && d < inp[3])\n {\n Console.WriteLine(0);\n return;\n }\n var primes = gp(d).Where(p => !inp.Contains(p));\n var count = primes.Count();\n foreach (var item in primes)\n {\n count += d / item;\n }\n Console.WriteLine(d - count);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte k, l, m, n;\n k = Byte.Parse(Console.ReadLine());\n l = Byte.Parse(Console.ReadLine());\n m = Byte.Parse(Console.ReadLine());\n n = Byte.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int count = 0;\n if (k==1)\n {\n count = d;\n }\n else\n {\n count += d / k;\n d = d / k;\n count += d / l;\n d = d / l;\n count += d / m;\n d = d / m;\n count += d / n;\n d = d / n;\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CF_148A\n{\n class Program\n {\n static void Main()\n {\n var k = int.Parse(Console.ReadLine());\n var l = int.Parse(Console.ReadLine());\n var m = int.Parse(Console.ReadLine());\n var n = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n\n if (k == 1) Console.WriteLine(d);\n else\n {\n var list = new List{k};\n if (l%k != 0 && l%m != 0 && l%n != 0)\n {\n list.Add(l);\n }\n if (m%k != 0 && m%l != 0 && m%n != 0)\n {\n list.Add(m);\n }\n if (n%k != 0 && n%l != 0 && n%m != 0)\n {\n list.Add(n);\n }\n var sum = 0;\n for (var i = 0; i < d; i++)\n {\n if (list.Any(x => i % x == 0)) sum++;\n }\n Console.WriteLine(sum);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Test\n{\n static void Main()\n {\n int k = Int32.Parse(Console.ReadLine());\n int l = Int32.Parse(Console.ReadLine());\n int m = Int32.Parse(Console.ReadLine());\n int n = Int32.Parse(Console.ReadLine());\n int d = Int32.Parse(Console.ReadLine());\n int [] atmp = new int[d];\n\n for(int a=0 ; a gp(int max)\n {\n var n = Enumerable.Range(2, max - 1).ToDictionary(m => m, m => true);\n for (var i = 2; i <= (max / 2); i++)\n {\n if (!n[i])\n {\n continue;\n }\n\n for (var j = 2 * i; j <= max; j += i)\n {\n n[j] = false;\n }\n }\n\n return n.Where(kv => kv.Value).Select(kv => kv.Key);\n }\n static void Main()\n {\n var inp = new int[5];\n for (int i = 0; i < 4; i++)\n {\n inp[i] = int.Parse(Console.ReadLine());\n }\n var d = int.Parse(Console.ReadLine());\n if (inp.Contains(1))\n {\n Console.WriteLine(d);\n return;\n }\n var primes = gp(d).Count(p => !inp.Contains(p)) + 1;\n Console.WriteLine(d - primes);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _148A {\n class Program {\n static void Main(string[] args) {\n int[] q = new int[4];\n for (int i = 0; i < q.Length; i++) {\n q[i] = int.Parse(Console.ReadLine());\n }\n int d = int.Parse(Console.ReadLine());\n\n bool[] prime = new bool[d + 1];\n int count = 1;\n if (!q.Contains(1)) {\n for (int i = 0; i < prime.Length; i++) {\n prime[i] = true;\n }\n prime[0] = prime[1] = false;\n for (int i = 2; i * i <= d; ++i) {\n if (prime[i]) {\n for (int j = i * i; j <= d; j += i) {\n prime[j] = false;\n }\n }\n }\n for (int i = 0; i < prime.Length; i++) {\n if (prime[i] && !q.Contains(i) && i > q.Min()) {\n //Console.WriteLine(i);\n count++;\n }\n }\n if (count != 1)\n count = d - count;\n else\n count = 0;\n } else {\n count = d;\n }\n Console.WriteLine(count);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace qw4\n{\n\tclass MainClass\n\t{\n\t\tpublic static int nok(int a,int b)\n\t\t{\n\t\t\tint i=a,j=b;\n\t\t\twhile (i != j)\n\t\t\t{\n\t\t\tif (i > j)\n \t\t\ti -= j;\n \t\telse\n \t\t\tj -= i;\n\t\t\t};\n\t\t\treturn (a/i)*(b/i)*i;\n\t\t}\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint k,l,m,n,d,nk,s;\n\t\t\tk=int.Parse(Console.ReadLine());\n\t\t\tl=int.Parse(Console.ReadLine());\n\t\t\tm=int.Parse(Console.ReadLine());\n\t\t\tn=int.Parse(Console.ReadLine());\n\t\t\td=int.Parse(Console.ReadLine());\n\t\t\tnk=nok(nok(nok (k,l),m),n);\n\t\t\t//Console.WriteLine(nk);\n\t\t\ts=nk;\n\t\t\tfor(int i=1;i arr = new List();\n static int Cofactor = 2;\n static void Main(string[] args)\n {\n int d, CountOfINters = 0, sum = 0;\n\n for (int i = 0; i < 4; i++)\n {\n arr.Add(int.Parse(Console.ReadLine()));\n\n }\n Oraganize();\n d = int.Parse(Console.ReadLine());\n\n \n if (arr.Count == 1)\n {\n Console.WriteLine(d / arr[arr.Count - 1]);\n return;\n }\n\n for (byte i = 0; i < arr.Count - 1; i++)\n {\n sum += d/arr[i];\n for (byte k = (byte)(i+1); k {k};\n if (l%k != 0 && l%m != 0 && l%n != 0)\n {\n list.Add(l);\n }\n if (m%k != 0 && m%l != 0 && m%n != 0)\n {\n list.Add(m);\n }\n if (n%k != 0 && n%l != 0 && n%m != 0)\n {\n list.Add(n);\n }\n var sum = 0;\n for (var i = 0; i < d; i++)\n {\n if (list.Any(x => i % x == 0)) sum++;\n }\n Console.WriteLine(sum);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _148A_Princess\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n\n int[] dracaris = new int[d];\n\n for (int i = 0; i < d; i+=k)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += l)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += m)\n {\n dracaris[i] = 1;\n }\n\n for (int i = 0; i < d; i += n)\n {\n dracaris[i] = 1;\n }\n\n Console.WriteLine(dracaris.Sum());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\n\nnamespace Test1\n{\n public class Test1\n {\n public static void Main()\n {\n int[] dragons = Console.ReadLine().Split().Select(x=>Convert.ToInt32(x)).ToArray();\n bool[] beaten = new bool[dragons[dragons.Length-1]];\n for(int j=0; j= input1) remnant1++;\n else if (i % input2 == 0 && all >= input2) remnant2++;\n else if (i % input3 == 0 && all >= input3) remnant3++;\n else if (i % input4 == 0 && all >= input4) remnant4++;\n }\n sum = remnant1 + remnant2 + remnant3 + remnant4;\n\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main()\n {\n int k = int.Parse(Console.ReadLine());\n int l = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n bool[] dr = new bool[d];\n int count = 0;\n\n if (k == 1 || l == 1 || m == 1 || n == 1)\n Console.WriteLine(d);\n else\n {\n for (int i = k; i < d; i = i + k)\n dr[i] = true;\n \n for (int i = l; i < d; i = i + l)\n dr[i] = true;\n\n for (int i = m; i < d; i = i + m)\n dr[i] = true;\n\n for (int i = n; i < d; i = i + n)\n dr[i] = true;\n\n\n for (int i = 0; i < d; i++)\n {\n if (dr[i] == true)\n count++;\n }\n\n Console.WriteLine(count);\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int sum = 0;\n int[] div = new int[4];\n div[0] = int.Parse(Console.ReadLine());\n div[1] = int.Parse(Console.ReadLine());\n div[2] = int.Parse(Console.ReadLine());\n div[3] = int.Parse(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n for (int i = 1; i <= n; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % div[j] == 0)\n {\n sum++;\n }\n break;\n }\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] c = {\n int.Parse(Console.ReadLine()),\n int.Parse(Console.ReadLine()),\n int.Parse(Console.ReadLine()),\n int.Parse(Console.ReadLine()) };\n int d = int.Parse(Console.ReadLine());\n List molestedDragon = new List();\n\n if (c[0] == 1 || c[1] == 1 || c[2] == 1 || c[3] == 1)\n {\n Console.WriteLine(d);\n return;\n }\n\n Sort(c, 4);\n\n for (int i = 0; i < 4; i++)\n {\n bool x = false;\n\n for (int j = 0; j < i; j++)\n {\n if (c[i] % c[j] == 0)\n {\n x = true;\n break;\n }\n }\n\n if (x) continue;\n\n for (int j = 1; j <= d; j++)\n {\n if (i % c[i] == 0 && !molestedDragon.Contains(j)) molestedDragon.Add(j);\n }\n }\n\n Console.WriteLine(molestedDragon.Count);\n }\n\n static void Sort(int[] arr, int size, int start = 0)\n {\n if (size - start <= 1) return;\n\n for (int i = start; i < size - 1; i++)\n {\n if (arr[i] > arr[i + 1])\n {\n var temp = arr[i];\n arr[i] = arr[i + 1];\n arr[i + 1] = temp;\n }\n }\n\n Sort(arr, size - 1, start);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nnamespace codechef\n{\n public class Program{\n public static StreamWriter writer;\n\n public static void RealWork()\n {\n int[] dragon = new int[5];\n for (int i = 0; i < 5; i++)\n dragon[i] = intParse(Console.ReadLine());\n int Ans = 0;\n int[] map = new int[dragon[4]+1];\n for (int i = 0; i < 5; i++)\n {\n for (int j = dragon[i]; j <= dragon[4]; j=j+dragon[i])\n if (map[j] == 0)\n {\n map[j]++; Ans++;\n }\n }\n writer.Write(Ans); \n }\n static void Main(string[] args)\n {\n writer = new StreamWriter(Console.OpenStandardOutput());\n //writer = new StreamWriter(\"output.txt\");\n //Console.SetIn(new StreamReader(File.OpenRead(\"input.txt\"))); \n RealWork();\n writer.Close();\n }\n\n public static int intParse(string st)\n {\n int x = 0;\n for (int i = 0; i < st.Length; i++) { x = x * 10 + (st[i] - 48); }\n return x;\n }\n\n }\n\n}"}], "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7"} {"source_code": "\ufeffusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Globalization;\r\nusing System.Threading;\r\n\r\nnamespace B\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\r\n int tc = 1;\r\n //tc = int.Parse(Console.ReadLine());\r\n while (tc-- > 0)\r\n {\r\n solve();\r\n }\r\n }\r\n\r\n // write your code in solve function\r\n static void solve()\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n int[] ratings = new int[]{1200, 1400, 1600, 1900, 2100, 2300, 2400, 2600, 3000};\r\n\r\n for (int i=0; i 0)\r\n {\r\n solve();\r\n }\r\n }\r\n\r\n // write your code in solve function\r\n static void solve()\r\n {\r\n int n = int.Parse(Console.ReadLine());\r\n int[] ratings = new int[]{1200, 1400, 1600, 1900, 2100, 2300, 2400, 2600, 3000};\r\n\r\n for (int i=0; i list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing static System.Console;\nnamespace Program\n{\n public class Solver\n {\n Random rnd = new Random();\n public void Solve()\n {\n long n = rl;\n var a = new List();\n var v = 1L;\n while (v <= n)\n {\n a.Add(v);n-=v;\n v *= 2;\n }\n\n if(n!=0)a.Add(n);\n Console.WriteLine(a.Count);\n }\n const long INF = 1L << 60;\n static int[] dx = { -1, 0, 1, 0 };\n static int[] dy = { 0, 1, 0, -1 };\n int ri { get { return sc.Integer(); } }\n long rl { get { return sc.Long(); } }\n double rd { get { return sc.Double(); } }\n string rs { get { return sc.Scan(); } }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static T[] Enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \")\n {\n return string.Join(st, ie);\n }\n static public void Main()\n {\n Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n var solver = new Program.Solver();\n solver.Solve();\n Console.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char()\n {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n}\n\n#endregion"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _1037A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Convert.ToString(n, 2).Length);\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\t\n\t\t\tlong x = Convert.ToInt64(Console.ReadLine());\n\t\t\tint cut = 1;\n\t\t\twhile(x!=1)\n\t\t\t{\n\t\t\t\tx/=2;\n\t\t\t\tcut++;\n\t\t\t}\n\t\t\tConsole.WriteLine(cut);\n\t\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp95\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = Convert.ToInt32(Console.ReadLine());\n var result=0;\n var chet = N;\n for(int i=1; ;i++)\n {\n \n result++;\n if (Math.Pow(2, i) > N)\n {\n break;\n }\n else if (Math.Pow(2, i) == N)\n {\n result++;\n break;\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TASK_1037A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n int n = 0;\n for(int i = 1; i <= num; i *= 2, n++) { }\n Console.WriteLine(n);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n int a = 0;\n for (; n > 0;)\n {\n n /= 2;\n a++;\n }\n Console.WriteLine(a);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Packets\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int ans = 0;\n while (n > 0)\n {\n ans++;\n n >>= 1;\n }\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n ReadData re;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n re = new ReadData();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n long count = 0;\n long A = re.i()+1;\n long B = 1;\n while(A > B){\n count++;\n B *= 2;\n }\n sb.Append(count+\"\\n\");\n }\n}\nclass ReadData{\n string[] str;\n int counter;\n public ReadData(){\n counter = 0;\n }\n public string s(){\n if(counter == 0){\n str = Console.ReadLine().Split(' ');\n counter = str.Length;\n }\n counter--;\n return str[str.Length-counter-1];\n }\n public int i(){\n return int.Parse(s());\n }\n public long l(){\n return long.Parse(s());\n }\n public double d(){\n return double.Parse(s());\n }\n public int[] ia(int N){\n int[] ans = new int[N];\n for(int j=0;j[] g(int N,int[] f,int[] t){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(int N,int M){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(){\n int N = i();\n int M = i();\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j L = new List();\n\t\tint NN = N;\n\t\tint b = 1;\n\t\twhile(NN >= b){\n\t\t\tL.Add(b);\n\t\t\tNN -= b;\n\t\t\tb *= 2;\n\t\t}\n\t\tif(NN > 0) L.Add(b);\n\t\tConsole.WriteLine(L.Count);\n\t\t\n\t}\n\tint N;\n\tpublic Sol(){\n\t\tN = ri();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System.Text;\nusing System.Threading.Tasks;\nusing System.Diagnostics;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System;\n\nnamespace bla2\n{\n class Program\n {\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int c = 0;\n while(n > 0)\n {\n n /= 2;\n c++;\n }\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication17\n{\n class Program\n {\n static void Main(string[] args)\n {\n long N;\n N=long.Parse(Console.ReadLine());\n int l = 0;\n while (N > 0)\n {\n N = N / 2;\n // Console.WriteLine(N+1);\n l++;\n }\n Console.WriteLine(l);\n // Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n public class A\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if(n<3){\n Console.WriteLine(n);\n return;\n }\n double ans = 2;\n int i = 1;\n while(ans GetResults()\n {\n var n = this.ReadInt32();\n long power = 1;\n var result = -1;\n \n for (int i = 0; i <= n; i++)\n {\n if (power >= n + 1 )\n {\n result++;\n break;\n }\n\n result++;\n power *= 2;\n \n }\n \n yield return result.ToString();\n }\n }\n\n internal class CF18B : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n internal class CF18C : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n internal class CF18D : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n yield return \"n/a\";\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected long[] ReadLongArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt64);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();\n\n\t\t\tlong n = long.Parse(input1);\n\t\t\tdouble temp = Math.Log(n, 2);\n\t\t\tint result = (int)temp + 1;\n\t\t\tConsole.WriteLine(result);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n \n #region Read Input\n static string[] lines;\n static int lineIndex = 0;\n\n static string ReadNextLine()\n {\n#if DEBUG\n if (lines == null)\n lines = System.IO.File.ReadAllLines(\"input.txt\");\n return lines[lineIndex++];\n#else\n return Console.ReadLine();\n#endif\n }\n #endregion\n\n static void Main(string[] args)\n {\n int n = int.Parse(ReadNextLine());\n\n int mul = 2;\n for(int i = 0; i < 33; i++)\n {\n if (n < mul)\n {\n Console.WriteLine(string.Format(\"{0:d}\", i + 1));\n break;\n }\n mul *= 2;\n }\n \n\n#if DEBUG\n Console.ReadKey();\n#endif\n }\n\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n struct Point\n {\n public int l;\n public int r;\n public Point(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n }\n static void Main(string[] args)\n {\n long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();\n int s = 0;\n int i = 0;\n while (s < n[0])\n {\n i++;\n s += i;\n }\n if (s - n[0] == 1 && n[0] > 2)\n Console.WriteLine(i - 1);\n else\n Console.Write(i);\n Console.ReadLine();\n }\n static string FindSecondMax(List list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n struct Point\n {\n public int l;\n public int r;\n public Point(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n }\n static void Main(string[] args)\n {\n long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();\n int s = 0;\n int i = 0;\n while (s < n[0])\n {\n i++;\n s += i;\n }\n Console.Write(i);\n Console.ReadLine();\n }\n static string FindSecondMax(List list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n struct Point\n {\n public int l;\n public int r;\n public Point(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n }\n static void Main(string[] args)\n {\n long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();\n int s = 1;\n int i = 1;\n while (s <= n[0])\n {\n s += i;\n i++;\n }\n Console.Write(i-1);\n Console.ReadLine();\n }\n static string FindSecondMax(List list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n\n class Program\n {\n struct Point\n {\n public int l;\n public int r;\n public Point(int l, int r)\n {\n this.l = l;\n this.r = r;\n }\n }\n static void Main(string[] args)\n {\n long[] n = ((Console.ReadLine().Split(' ')).Select(long.Parse)).ToArray();\n int s = 0;\n int i = 0;\n while (s < n[0])\n {\n i++;\n s += i;\n }\n if (s - n[0] == 1)\n Console.WriteLine(i - 1);\n else\n Console.Write(i);\n Console.ReadLine();\n }\n static string FindSecondMax(List list)\n {\n Point point = new Point(int.MaxValue, int.MaxValue);\n Point maxpoint = new Point(int.MaxValue, int.MaxValue);\n foreach (Point p in list)\n {\n if (Rast(p) >= Rast(point))\n {\n maxpoint = point;\n point = p;\n }\n else if(Rast(p) > Rast(maxpoint)){ maxpoint = p; }\n }\n return $\"{maxpoint.l} {maxpoint.r}\";\n }\n\n private static int Rast(Point point)\n {\n return (int)(Math.Sqrt(point.l * point.l + point.r * point.r));\n }\n\n private static long S(long v)\n {\n long sum = 0;\n while (v != 0)\n {\n sum += v % 10;\n v /= 10;\n }\n return sum;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing static System.Console;\nnamespace Program\n{\n public class Solver\n {\n Random rnd = new Random();\n public void Solve()\n {\n long n = rl;\n var a = new List();\n var v = 1L;\n while (v <= n)\n {\n a.Add(v);\n v *= 2;\n n -= v;\n }\n\n if(n!=0)a.Add(n);\n Console.WriteLine(a.Count);\n }\n const long INF = 1L << 60;\n static int[] dx = { -1, 0, 1, 0 };\n static int[] dy = { 0, 1, 0, -1 };\n int ri { get { return sc.Integer(); } }\n long rl { get { return sc.Long(); } }\n double rd { get { return sc.Double(); } }\n string rs { get { return sc.Scan(); } }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static T[] Enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \")\n {\n return string.Join(st, ie);\n }\n static public void Main()\n {\n Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n var solver = new Program.Solver();\n solver.Solve();\n Console.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char()\n {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n}\n\n#endregion"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing System.Numerics;\nusing static System.Math;\nusing static System.Console;\nnamespace Program\n{\n public class Solver\n {\n Random rnd = new Random();\n public void Solve()\n {\n long n = rl;\n var a = new List();\n var v = 1L;\n while (v <= n)\n {\n a.Add(v);\n v *= 2;\n n -= v;\n }\n a.Add(v);\n Console.WriteLine(a.Count);\n }\n const long INF = 1L << 60;\n static int[] dx = { -1, 0, 1, 0 };\n static int[] dy = { 0, 1, 0, -1 };\n int ri { get { return sc.Integer(); } }\n long rl { get { return sc.Long(); } }\n double rd { get { return sc.Double(); } }\n string rs { get { return sc.Scan(); } }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n static T[] Enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \")\n {\n return string.Join(st, ie);\n }\n static public void Main()\n {\n Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });\n var solver = new Program.Solver();\n solver.Solve();\n Console.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n\n public class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n }\n\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len)\n {\n ptr = 0;\n if ((len = str.Read(buf, 0, 1024)) <= 0)\n {\n isEof = true;\n return 0;\n }\n }\n return buf[ptr++];\n }\n\n public char Char()\n {\n byte b = 0;\n do b = read(); while ((b < 33 || 126 < b) && !isEof);\n return (char)b;\n }\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n }\n}\n\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp95\n{\n class Program\n {\n static void Main(string[] args)\n {\n var N = Convert.ToInt32(Console.ReadLine());\n var result=0;\n var chet = N;\n for(int i=1; ;i++)\n {\n chet = chet - i;\n result++;\n if (chet <= 0)\n {\n break;\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TASK_1037A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num = int.Parse(Console.ReadLine());\n int n = 0;\n for(int i = 1; i < num; i *= 2, n++) { }\n Console.WriteLine(n);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces\n{\n public class A\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n double ans = 2;\n int i = 1;\n while(ans= 0; i--)\n {\n right[i] = s[i] == 'Q' ? right[i + 1] + 1 : right[i + 1];\n }\n\n int result = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'A')\n {\n result += left[i] * right[i];\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n}\nclass Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n var S = sc.Next();\n long ans = 0;\n for (int i = 0; i < S.Length; i++)\n {\n if (S[i] == 'Q')\n {\n for (int j = i + 1; j < S.Length; j++)\n {\n if(S[j]=='A')\n {\n for(int k=j+1;k (x == 'Q' || x == 'A')).ToArray();\n var total = 0;\n for (var i = 0; i < qaq.Length; i ++)\n for (var k = i+1; k < qaq.Length; k++)\n for (var j = k+1; j < qaq.Length; j++)\n {\n total+=(qaq[i] == 'Q' && qaq[k] == 'A' && qaq[j] == 'Q' )? 1 : 0;\n }\n Console.WriteLine(total);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\nclass Time\n{\n public int hour;\n public int min;\n}\nclass Test\n{\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n // Driver code \n public static void Main()\n {\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n // var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n // var n = input1[0];\n\n\n var str = Console.ReadLine();\n int ans = 0;\n for (int i = 0; i < str.Length; i++)\n {\n for (int j = i + 1; j < str.Length; j++)\n {\n for (int k = j + 1; k < str.Length; k++)\n {\n if (str[i] == 'Q' && str[j] == 'A' && str[k] == 'Q')\n {\n ans++;\n }\n\n }\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n\n public static int Ways(string str, int start, char letter, string ans)\n {\n if (start >= str.Length)\n return 0;\n int count = 0;\n if (ans.Length == 3)\n {\n if (ans.Contains(\"QAQ\"))\n {\n count++;\n ans = ans.Substring(0, ans.Length - 1);\n }\n }\n for (int j = start; j < str.Length; j++)\n {\n if (str[start] == 'Q')\n {\n\n Ways(str, start + 1, 'Q', ans);\n\n\n }\n }\n\n return count;\n\n }\n\n public static int GCD(int a, int b)\n {\n if (b == 0)\n return a;\n\n return GCD(b, a % b);\n }\n\n static bool\n Coprime(int a, int b)\n {\n return (GCD(a, b) == 1);\n }\n\n\n //}\n\n\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string str = \"QAQ\";\n static string str1;\n static int[,] dp;\n static int Q(int n,int m)\n {\n if (m==str.Length)\n {\n return 1;\n }\n if (str1.Length == n)\n {\n return 0;\n }\n if (dp[n,m] != -1)\n {\n return dp [n , m];\n }\n int sol = Q(n + 1, m);\n if (str[m] == str1[n])\n {\n sol += Q( n+1, m + 1) ;\n }\n dp[n, m] = sol;\n return sol;\n }\n static void Main(string[] args)\n {\n str1 = Console.ReadLine();\n dp = new int[str1.Length+1, str.Length+1];\n for (int i =str1.Length; i >= 0 ; i--)\n {\n for (int j=str.Length; j>=0; j--)\n {\n if (j==str.Length)\n {\n dp[i, j] = 1; \n }\n else if (i==str1.Length)\n {\n dp[i, j] = 0;\n }\n else\n {\n int sol = dp[i + 1, j];\n if (str1[i] == str[j])\n {\n sol += dp[i + 1, j + 1];\n }\n dp[i, j] = sol;\n }\n }\n }\n Console.WriteLine(dp[0, 0]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string str = \"QAQ\";\n static string str1;\n static int[,] dp;\n static int Q(int n,int m)\n {\n if (m==str.Length)\n {\n return 1;\n }\n if (str1.Length == n)\n {\n return 0;\n }\n if (dp[n,m] != -1)\n {\n return dp [n , m];\n }\n int sol = Q(n + 1, m);\n if (str[m] == str1[n])\n {\n sol += Q( n+1, m + 1) ;\n }\n dp[n, m] = sol;\n return sol;\n }\n static void Main(string[] args)\n {\n str1 = Console.ReadLine();\n dp = new int[str1.Length, str.Length];\n for (int i=0;i= 0; --i)\n {\n suf[i] = suf[i + 1] + (s[i] == 'Q' ? 1 : 0);\n }\n for (int i = 0; i < s.Length; ++i)\n {\n if (s[i] == 'A' && i > 0 && i < s.Length - 1)\n {\n count += suf[i + 1] * pref[i - 1];\n }\n }\n Console.WriteLine(count.ToString());\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Text;\n\nclass Procon {\n static void Main (string[] agrs) {\n char[] S = Chars();\n\n int[] Q1 = new int[S.Length+2];\n int[] Q2 = new int[S.Length+2];\n\n for (int i = 0; i < S.Length; i++) {\n if (S[i] == 'Q') {\n Q1[i + 1] = Q1[i] + 1;\n } else {\n Q1[i + 1] = Q1[i];\n }\n\n if (S[S.Length - 1 - i] == 'Q') {\n Q2[S.Length - i] = Q2[S.Length - i + 1] + 1;\n } else {\n Q2[S.Length - i] = Q2[S.Length - i + 1];\n }\n }\n\n int ret = 0;\n for (int i = 1; i <= S.Length; i++) {\n if (S[i - 1] != 'A') {\n continue;\n }\n ret += Q1[i - 1] * Q2[i + 1];\n }\n\n Console.WriteLine(ret);\n }\n\n static string String () => Scanner.nextString ();\n static int Int () => int.Parse (Scanner.nextString ());\n static long Long () => long.Parse (Scanner.nextString ());\n static double Double () => double.Parse (Scanner.nextString ());\n static char[] Chars () => String ().ToCharArray ();\n static string[] Strings () => Console.ReadLine ().Split (' ');\n static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();\n static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();\n static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();\n const int M = 1000000007;\n}\n\nclass PriorityQueue where T : IComparable {\n public T[] heap;\n public int size;\n public int sign;\n public PriorityQueue (int N, bool descend = false) {\n heap = new T[N];\n sign = 1;\n if (descend) sign = -1;\n }\n public int Compare (T x, T y) {\n return x.CompareTo (y) * sign;\n }\n public void Push (T x) {\n int i = size++;\n while (i > 0) {\n int p = (i - 1) / 2;\n if (Compare (x, heap[p]) >= 0) {\n break;\n }\n heap[i] = heap[p];\n i = p;\n }\n heap[i] = x;\n }\n public T Pop () {\n T ret = heap[0];\n T x = heap[--size];\n int i = 0;\n while (i * 2 + 1 < size) {\n int a = i * 2 + 1;\n int b = i * 2 + 2;\n if (b < size && Compare (heap[a], heap[b]) > 0) {\n a = b;\n }\n if (Compare (heap[a], x) >= 0) {\n break;\n }\n heap[i] = heap[a];\n i = a;\n }\n heap[i] = x;\n return ret;\n }\n public int Count () {\n return size;\n }\n}\n\nclass Scanner {\n static string[] s = new string[0];\n static int i = 0;\n static int max_i = 0;\n static public string nextString () {\n if (i >= s.Length) {\n s = Console.ReadLine ().Split (' ');\n max_i = s.Length;\n i = 0;\n if (max_i == 0) {\n return \"\";\n }\n return s[i++];\n }\n return s[i++];\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace QAQ\n{\n class Ctecka\n {\n public static int PrectiCislo()\n {\n int Znak = Console.Read();\n int x = 0;\n bool Znaminko = false;\n\n while ((Znak < '0') || (Znak > '9')) //TODO hlidat konec vstupu!\n {\n if (Znak == '-') Znaminko = true;\n else Znaminko = false;\n\n Znak = Console.Read();\n }\n\n while ((Znak >= '0') && (Znak <= '9'))\n {\n x = 10 * x + (Znak - '0');\n Znak = Console.Read();\n }\n\n if (Znaminko)\n {\n x = -x;\n Znaminko = false;\n }\n\n return x;\n }\n }\n class Qaq\n {\n public string word;\n public char[] wordArray;\n public int[] results = new int[101];\n public int qCount = 0;\n public int secondQCount = 0;\n public int ACount = 0;\n public int QAQCount = 0;\n public bool Aflag = false;\n public int qBeforeA = 0;\n public int tempSum = 0;\n public List aCounting = new List();\n\n public int countOccurence()\n {\n for (int i = 0; i < word.Length; i++)\n {\n if (word[i] == 'Q')\n {\n qCount++;\n if (aCounting.Count > 0)\n {\n tempSum = 0;\n foreach (int occ in aCounting)\n {\n tempSum += occ;\n }\n QAQCount += tempSum;\n } \n }\n else if (word[i] == 'A')\n {\n aCounting.Add(qCount);\n }\n }\n return QAQCount;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n Qaq q = new Qaq();\n q.word = Console.ReadLine();\n Console.WriteLine(q.countOccurence()); \n\n }\n }\n}\n"}, {"source_code": "\ufeff// Based on azukin (https://codeforces.com/profile/azukun) C# starter\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\npublic class Solver\n{\n private int NumberOfQAQ(string str)\n {\n int total = 0;\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'Q') total += CountQAQFrom(str, i, 1);\n }\n\n return total;\n }\n\n private int CountQAQFrom(string str, int start, int letter)\n {\n if (letter == 3)\n {\n return 1;\n }\n\n int total = 0;\n for (int i = start; i < str.Length; i++)\n {\n if (str[i] == 'Q' && letter % 2 == 0)\n {\n total += CountQAQFrom(str, i + 1, letter + 1);\n }\n else if (str[i] == 'A' && letter % 2 == 1)\n {\n total += CountQAQFrom(str, i + 1, letter + 1);\n }\n }\n return total;\n }\n\n public void Solve()\n {\n var line = ReadLine();\n\n Write(NumberOfQAQ(line));\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n // reader = new StreamReader(\"..\\\\..\\\\input\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n // writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"duty.in\");\n //writer = new StreamWriter(\"duty.out\");\n#endif\n try\n {\n // var thread = new Thread(new Solver().Solve, 1024 * 1024 * 512);\n // thread.Start();\n // thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string ReadLine() { return reader.ReadLine().Trim(); }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = ReadLine(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nclass a\n{\n static void Main()\n {\n var s = Console.ReadLine();\n string p = \"\";\n for (int i = 0; i < s.Length; i++) if (s[i] == 'Q' || s[i] == 'A') p += s[i];\n int r = 0;\n for (int i = 0; i < p.Length; i++)\n {\n for (int j = i+1; j < p.Length; j++)\n { \n for (int k = j+1; k < p.Length; k++)\n {\n if (p[i].ToString() + p[j].ToString() + p[k].ToString() == \"QAQ\") r++;\n }\n } \n }\n Console.WriteLine(r);\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n StringBuilder sb = new StringBuilder(string.Join(\"\", Console.ReadLine().Where(ch => ch == 'Q' || ch == 'A')));\n int c = 0;\n for (int i = 0; i < sb.Length; i++)\n {\n for (int j = i + 1; j < sb.Length; j++)\n {\n for (int k = j + 1; k < sb.Length; k++)\n {\n if (new string(new char[] { sb[i], sb[j], sb[k] }) == \"QAQ\")\n c++;\n }\n }\n }\n Console.WriteLine(c);\n }\n }\n} \n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Algorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n string n = Console.ReadLine();\n\n var result = GetNumberOfQAQ(n);\n\n Console.WriteLine(result);\n }\n\n \n private static int GetNumberOfQAQ(string inputString)\n {\n int numberOfQAQ = 0, numberOfQ = 0, numberOfQA = 0;\n\n for (int i = 0; i < inputString.Length; i++)\n {\n if (inputString[i] == 'A')\n {\n if (numberOfQ > 0)\n numberOfQA += numberOfQ;\n }\n\n if (inputString[i] == 'Q')\n {\n numberOfQAQ += numberOfQA;\n numberOfQ++;\n }\n }\n\n return numberOfQAQ;\n }\n\n \n }\n}"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string aa = Console.ReadLine();\n int c = 0;\n for (int i = 0; i < aa.Length; i++)\n {\n \n if (aa[i] == 'Q')\n {\n int hh = i + 1;\n\n while (hh < aa.Length) {\n if(aa[hh] == 'A')\n {\n int tt = hh + 1;\n while(tt < aa.Length)\n {\n if(aa[tt] == 'Q')\n {\n c++;\n }\n tt++;\n }\n }\n hh++;\n }\n }\n }\n Console.WriteLine(c);\n }\n\n static int convertToInt(string n)\n {\n return int.Parse(n);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Solution\n{\n static void Main(string[] args)\n {\n char[] input = Console.ReadLine().ToCharArray();\n int[] prefix = new int[input.Length];\n int count = 0;\n\n for(int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'Q')\n {\n prefix[i] = 1;\n }\n }\n for(int i = 0; i < input.Length; i++)\n {\n if (input[i] == 'A')\n {\n int left = 0;\n int right = 0;\n \n for (int j = 0; j < i; j++)\n {\n left += prefix[j];\n }\n\n for (int k = i + 1; k < input.Length; k++)\n {\n right += prefix[k];\n }\n count += left * right;\n } \n }\n Console.WriteLine(count);\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace QAQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int n = line.Length;\n int[] countQto = new int[n];\n int numberOfQ = 0;\n for (int i = 0; i < n; i++)\n {\n if (line[i] == 'Q')\n {\n numberOfQ++;\n }\n countQto[i] = numberOfQ;\n }\n int numberOfSubseq = 0;\n for (int i = 0; i < n; i++)\n {\n if (line[i] == 'A')\n {\n numberOfSubseq+= countQto[i] * (numberOfQ - countQto[i]);\n }\n }\n Console.WriteLine(numberOfSubseq);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace QAQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n List indexQ = new List();\n List indexA = new List();\n int sum = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'Q')\n {\n indexQ.Add(i);\n }\n else if (s[i] == 'A')\n {\n indexA.Add(i);\n }\n }\n int count1 = indexQ.Count;\n int count2 = indexA.Count;\n\n for (int i = 0; i < indexA.Count; i++)\n {\n for (int j = 0; j < indexQ.Count; j++)\n {\n if (indexA[i] < indexQ[j])\n {\n sum += (count1 - j) * (j);\n break;\n }\n }\n }\n Console.WriteLine(sum);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace QAQ_2._0\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int br = 0;\n int[] sumaPrefiksa = new int[s.Length];\n if (s[0] == 'Q') sumaPrefiksa[0] = 1;\n for (int i = 1; i < s.Length; i++)\n {\n sumaPrefiksa[i] = sumaPrefiksa[i - 1];\n if (s[i] == 'Q') sumaPrefiksa[i]++;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'A')\n {\n int pre = sumaPrefiksa[i];\n int posle = sumaPrefiksa[s.Length - 1] - pre;\n br += pre * posle;\n }\n }\n Console.WriteLine(br);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace QAQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int br = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'Q')\n {\n for (int j = i + 1; j < s.Length; j++) \n {\n if (s[j] == 'A') \n {\n for (int k = j + 1; k < s.Length; k++)\n {\n if (s[k] == 'Q') br++;\n }\n }\n }\n } \n }\n Console.WriteLine(br);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Where(i => i == 'Q' || i == 'A').ToArray();\n var sum = 0;\n for (int i=0;i '9')) {\n prev = symb;\n symb = Console.Read();\n }\n while ((symb >= '0') && (symb <= '9')) {\n res = 10 * res + symb - '0';\n symb = Console.Read();\n }\n if (prev == '-') { return -res; }\n else { return res; }\n }\n\n public static List RIntsStdin(int n) {\n // Read bunch of integers, infinite input\n List res = new List(); int cnt = 0;\n while(cnt < n) {\n res.Add(RIntStdin());\n cnt++;\n }\n return res;\n }\n\n public static int ConvStrToInt(string str) {\n int res = 0; int starti = 0; int sign = 1;\n if (str[0] == '-') { starti = 1; sign = -1;}\n for (int i = starti; i < str.Length; i++) {\n res = 10 * res + sign * (str[i] - '0');\n }\n return res;\n }\n\n public static List SplitStrByDelim(string str,\n char delim) {\n List res = new List(); string buf = \"\";\n for (int i = 0; i < str.Length; i++) {\n if (str[i] != delim) { buf = buf + str[i]; }\n else { if (buf != \"\") { res.Add(buf); buf = \"\"; } }\n }\n if (buf != \"\") { res.Add(buf); }\n return res;\n }\n\n public static int RIntLn() {\n // Read the whole line and extract only one integer\n int prev = ' '; int starti = 0; int res = 0;\n string s = System.Console.ReadLine();\n while ((s[starti] < '0' ) || s[starti] > '9' ) {\n prev = s[starti]; starti++;\n }\n while ((starti < s.Length) &&\n (s[starti] >= '0') &&\n (s[starti] <= '9')) {\n res = 10 * res + s[starti] - '0';\n starti++;\n }\n if (prev == '-') {\n return -res;\n }\n else {\n return res;\n }\n }\n\n public static List RIntsLn() {\n // Read the whole line and extract all integers\n List res = new List();\n List s = SplitStrByDelim(\n Console.ReadLine(), ' ');\n foreach (string i in s) {\n res.Add(ConvStrToInt(i));\n }\n return res;\n }\n\n public static void ShowObjs(params object[] objs) {\n for (int i = 0; i < objs.Length; i++) {\n Console.Write(objs[i] + \" \");\n }\n Console.Write('\\n');\n }\n\n public static void ShowArr(ref T[] arr, int si) {\n for (int i=si; i(ref List lst, int si) {\n // si = start index\n for (int i=si; i q = new List();\n List a = new List();\n\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'A')\n a.Add(i);\n else if (str[i] == 'Q')\n q.Add(i);\n }\n\n int result = 0;\n foreach (int i in a)\n {\n int left = 0;\n int right = 0;\n foreach (int j in q)\n {\n if (j < i)\n left++;\n else\n right++;\n }\n result += left * right;\n }\n\n Console.WriteLine(result);\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Elephant\n{\n class Program\n {\n public static int Func(char[] sum)\n {\n int count = sum.Length;\n int ret = 0;\n for(int i = 0; i < count; i++)\n {\n if (sum[i] == 'Q')\n {\n for(int k = i; k < count; k++)\n {\n if (sum[k] == 'A')\n {\n for (int j = k; j < count; j++)\n {\n if (sum[j] == 'Q')\n {\n ret++;\n }\n }\n }\n }\n }\n }\n\n return ret;\n }\n static void Main(string[] args)\n {\n char[] sum = Console.ReadLine().ToCharArray();\n Console.Write(Func(sum));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Text;\n\nclass Simple {\n string str;\n void Solve() {\n str = io.String;\n var ans = 0;\n for (var i = 0; i < str.Length; ++i) {\n if (str[i] != 'Q') continue;\n for (int j = i + 1; j < str.Length; ++j) {\n if (str[j] != 'A') continue;\n for (int k = j + 1; k < str.Length; ++k) {\n if (str[k] == 'Q')\n ans++;\n }\n }\n }\n io.o(ans);\n }\n SimpleIO io = new SimpleIO();\n public static void Main(string[] args) { new Simple().Stream(); }\n void Stream() {\n Solve();\n io.writeFlush();\n }\n}\n\nclass SimpleIO {\n string[] nextBuffer;\n int BufferCnt;\n char[] cs = new char[] { ' ' };\n StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n public SimpleIO() {\n nextBuffer = new string[0];\n BufferCnt = 0;\n Console.SetOut(sw);\n }\n public string Next() {\n if (BufferCnt < nextBuffer.Length)\n return nextBuffer[BufferCnt++];\n string st = Console.ReadLine();\n while (st == \"\")\n st = Console.ReadLine();\n nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n BufferCnt = 0;\n return nextBuffer[BufferCnt++];\n }\n public string String => Next();\n public char Char => char.Parse(String);\n public int Int => int.Parse(String);\n public long Long => long.Parse(String);\n public double Double => double.Parse(String);\n public void o(T v) { Console.WriteLine(v); }\n public void writeFlush() { Console.Out.Flush(); }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskA\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out string value);\n var d = new int[value.Length+1, 4];\n // 0 - Q\n // 1 - QA\n var count = 0;\n for (var i = 1; i <= value.Length; i++)\n {\n if (value[i-1] == 'Q')\n {\n count += d[i - 1, 1];\n d[i, 0] = d[i - 1, 0] + 1;\n d[i, 1] = d[i - 1, 1];\n }\n else if (value[i-1] == 'A')\n {\n d[i, 0] = d[i - 1, 0];\n d[i, 1] = d[i - 1, 1] + d[i - 1, 0];\n }\n else\n {\n d[i, 0] = d[i - 1, 0];\n d[i, 1] = d[i - 1, 1];\n }\n }\n Console.WriteLine(count);\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace TypA\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n string a = Console.ReadLine();\n char[] S = a.ToCharArray();\n int len = a.Length;\n int counter = 0;\n for (int i = 0; i < len; i++)\n {\n if (S[i] == 'Q')\n {\n for (int j = i; j < len; j++)\n {\n if (S[j] == 'A')\n {\n for (int h = j; h < len; h++)\n {\n if (S[h] == 'Q') ++counter;\n }\n }\n }\n }\n }\n Console.WriteLine(counter);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar pref = new int[s.Length];\n\t\t\tif (s[0] == 'Q') pref[0] = 1;\n\t\t\tfor (int i = 1; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'Q')\n\t\t\t\t\tpref[i] = pref[i - 1] + 1;\n\t\t\t\t\n\t\t\t\telse pref[i] = pref[i - 1];\n\t\t\t}\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == 'A')\n\t\t\t\t{\n\t\t\t\t\tif (pref[s.Length - 1] - pref[i] == 0) break;\n\t\t\t\t\tcount +=pref[i] * (pref[s.Length - 1] - pref[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(count);\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate static List ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\tprivate static List ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\tprivate static int[] ReadIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tprivate static long[] ReadLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();\n\t\tprivate static int ReadInt() => int.Parse(Console.ReadLine());\n\t\tprivate static long ReadLong() => long.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n string str = Console.ReadLine();\n int i = 0;\n int kq = 0;\n while (i < str.Length)\n {\n if (str[i] == 'Q')\n {\n int j = i + 1;\n while (j < str.Length)\n {\n if (str[j] == 'A')\n {\n int k = j + 1;\n while (k < str.Length)\n {\n if (str[k] == 'Q') kq++;\n k++;\n }\n }\n j++;\n }\n }\n i++;\n }\n Console.WriteLine(kq);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace olymp2\n{\n\tclass MainClass\n\t{\n\t\t\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\t//int[] input = Console.ReadLine()\n\t\t\t// .Split(new char[] { ' ' })\n\t\t\t// .Select(x => Convert.ToInt32(x))\n\t\t\t// .ToArray();\n\n\t\t\t//int n = input[0];\n\t\t\t//int d = input[1];\n\n\t\t\t//string map = Console.ReadLine();\n\n\t\t\tstring S = Console.ReadLine();\n\t\t\tint count = 0;\n\t\t\tfor (int x = 0; x < S.Length - 2; x++)\n\t\t\t{\n\t\t\t\tfor (int y = x + 1; y < S.Length - 1; y++)\n\t\t\t\t{\n\t\t\t\t\tfor (int z = y + 1; z < S.Length; z++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (S[x] == 'Q' && S[y] == 'A' && S[z] == 'Q')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\n\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n \n int sum=0;\n for (int i = 0; i < s.Length - 2; i++)\n {\n if (s[i] == 'Q')\n { \n for (int j=i+1;j int.Parse(s))\n .ToArray();\n return arr;\n }\n static void ReadInts(out int i0, out int i1)\n {\n int[] arr = ReadInts();\n i0 = arr[0];\n i1 = arr[1];\n }\n static void ReadInts(out int i0, out int i1, out int i2)\n {\n int[] arr = ReadInts();\n i0 = arr[0];\n i1 = arr[1];\n i2 = arr[2];\n }\n static void WriteYesNo(bool value)\n {\n Console.WriteLine(value ? \"YES\" : \"NO\");\n }\n #endregion helpers\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nnamespace problem_solve_with_csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n long i = 0, j = 0, c = 0, k = 0;\n string s1 = Console.ReadLine();\n char[] s = s1.ToCharArray();\n for (i = 0; i < s.Length; i++)\n if (s[i] == 'Q')\n for (j = i + 1; j < s.Length; j++)\n if (s[j] == 'A')\n for (k = j + 1; k < s.Length; k++)\n if (s[k] == 'Q')\n c++;\n Console.WriteLine(c);\n }\n }\n }\n\n\n \n"}, {"source_code": "\ufeff#region Usings\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nusing static System.Math;\n#endregion\n\n// https://codeforces.com/contest/894/problem/A\npublic class A___QAQ\n{\n static string s, t;\n static int n;\n static long solve(int idx, int i)\n {\n if (i == 3)\n return 1; // Reached end of QAQ\n\n if (idx == n)\n return 0; // Reached end of string\n\n long s1 = solve(idx + 1, i);\n if (s[idx] == t[i])\n s1 += solve(idx + 1, i + 1);\n\n return s1;\n }\n\n private static void Solve()\n {\n s = Read();\n n = s.Length;\n t = \"QAQ\";\n Write(solve(0, 0));\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}"}, {"source_code": "using System;\nnamespace ConsoleApp17{\n \n class Program\n {\n \n static void Main()\n {\n var line = Console.ReadLine();\n var count = 0;\n for (int i = 0; i < line.Length; i++)\n {\n if (line[i].Equals('Q'))\n {\n for (int j = i; j < line.Length; j++)\n {\n if (line[j].Equals('A'))\n {\n for (int k = j; k a, int el)\n\t{\n\t\tint l = -1, r = a.Count;\n\t\twhile (r - l > 1)\n\t\t{\n\t\t\tint m = (l + r) / 2;\n\t\t\tif (a[m] < el)\n\t\t\t\tl = m;\n\t\t\telse\n\t\t\t\tr = m;\n\t\t}\n\t\treturn r;\n\t}\n\tstatic void Main()\n\t{\n\t\tstring s = Console.ReadLine();\n\t\tList Q = new List(), A = new List();\n\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\tif (s[i] == 'Q')\n\t\t\t\tQ.Add(i);\n\t\t\telse if (s[i] == 'A')\n\t\t\t\tA.Add(i);\n\t\tlong ans = 0;\n\t\tfor (int i = 0; i < Q.Count; i++)\n\t\t\tfor (int j = BinSearch(A, Q[i]); j < A.Count; j++)\n\t\t\t\tans += Q.Count - BinSearch(Q, A[j]);\n\t\tConsole.WriteLine(ans);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\n\nclass A894 {\n public static void Main() {\n var s = Console.ReadLine();\n int q0 = 0, q1 = 0, q2 = 0;\n foreach (var i in s)\n if (i == 'Q') { ++q0; q2 += q1; }\n else if (i == 'A') { q1 += q0; }\n Console.WriteLine(q2);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tint count = 0;\n\t\t\tvar firstQIndex = input1.IndexOf(\"Q\", StringComparison.CurrentCulture);\n\t\t\twhile (firstQIndex >= 0) \n\t\t\t{\n\t\t\t\tvar aIndex = input1.IndexOf(\"A\", firstQIndex + 1, StringComparison.CurrentCulture);\n\t\t\t\twhile (aIndex >= 0) \n\t\t\t\t{\n\t\t\t\t\tvar secondQIndex = input1.IndexOf(\"Q\", aIndex + 1, StringComparison.CurrentCulture);\n\t\t\t\t\twhile (secondQIndex >= 0) \n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tsecondQIndex = input1.IndexOf(\"Q\", secondQIndex + 1, StringComparison.CurrentCulture);\n\t\t\t\t\t}\n\n\t\t\t\t\taIndex = input1.IndexOf(\"A\", aIndex + 1, StringComparison.CurrentCulture);\n\t\t\t\t}\n\n\t\t\t\tfirstQIndex = input1.IndexOf(\"Q\", firstQIndex + 1, StringComparison.CurrentCulture);\n\t\t\t}\n\n\t\t\tConsole.WriteLine(count);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine();\n var cntBefor = new int[line.Length];\n var cnt = 0;\n cntBefor[0] = line[0] == 'Q'? 1:0;\n for (int i = 1; i < line.Length; i++)\n {\n cntBefor[i] = cntBefor[i-1];\n if (line[i] == 'Q')\n cntBefor[i]++;\n }\n\n var res = 0;\n for (int i = 0; i < line.Length; i++)\n {\n if (line[i] == 'A')\n {\n res += (cntBefor[i]*(cntBefor[cntBefor.Length - 1] - cntBefor[i]));\n } \n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine();\n var cntQ = new int[line.Length];\n var cnt = 0;\n for (int i = line.Length-1; i >= 0; i--)\n {\n cntQ[i] = cnt;\n if (line[i] == 'Q')\n cnt++;\n }\n\n var res = 0;\n for (int i = 0; i < line.Length; i++)\n {\n if (line[i] == 'Q')\n {\n for (int j = i; j < line.Length; j++)\n {\n if (line[j] == 'A')\n res += cntQ[j];\n } \n } \n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestSolutions\n{\n public static class ProblemG\n {\n static void Main(string[] args)\n {\n var line = ReadLine();\n var result = Solve(line);\n Console.WriteLine(result);\n }\n\n public static long Solve(string line)\n {\n var n = line.Length;\n int counter = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n if(j > i || k > i || k > j)\n {\n continue;\n }\n if(line[i].ToString() + line[j] + line[k] == \"QAQ\")\n {\n counter++;\n }\n }\n }\n }\n return counter;\n }\n\n #region helpers\n static long Readlong()\n {\n return long.Parse(Console.ReadLine());\n }\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static long[] Readlongs()\n {\n long[] arr = Console.ReadLine().Split(' ')\n .Select(s => long.Parse(s))\n .ToArray();\n return arr;\n }\n static void Readlongs(out long i0, out long i1)\n {\n long[] arr = Readlongs();\n i0 = arr[0];\n i1 = arr[1];\n }\n static void Readlongs(out long i0, out long i1, out long i2)\n {\n long[] arr = Readlongs();\n i0 = arr[0];\n i1 = arr[1];\n i2 = arr[2];\n }\n static void WriteYesNo(bool value)\n {\n Console.WriteLine(value ? \"YES\" : \"NO\");\n }\n #endregion helpers\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string input = Console.ReadLine();\n int[] qCounts = new int[input.Length];\n if (input[0] == 'Q')\n {\n qCounts[0] = 1;\n }\n else\n {\n qCounts[0] = 0;\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == 'Q')\n {\n qCounts[i] = qCounts[i - 1] + 1;\n }\n else\n {\n qCounts[i] = qCounts[i - 1];\n }\n }\n int result = 0;\n int last = qCounts[qCounts.Length - 1];\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == 'A')\n {\n result += qCounts[i] * (last - qCounts[i]);\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nnamespace ConsoleApplication\n{\n sealed class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var result = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = i + 1; j < s.Length; j++)\n {\n for (int z = j + 1; z < s.Length; z++)\n {\n if (s[i] == 'Q' && s[j] == 'A' && s[z] == 'Q')\n result++;\n }\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var s = input.ReadLine();\n int n = s.Length;\n int c = 0;\n for (int i = 0; i < n - 2; i++)\n for (int j = i + 1; j < n - 1; j++)\n for (int k = j + 1; k < n; k++)\n if (s[i] == 'Q' && s[j] == 'A' && s[k] == 'Q')\n ++c;\n Console.Write(c);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string st = Console.ReadLine().Trim();\n int counter=0;\n\n for (int i = 0; i < st.Length; i++) {\n if (st[i]== 'Q' ) {\n for (int j = i + 1; j < st.Length; j++) {\n if (st[j] == 'A') {\n for (int k = j + 1; k < st.Length; k++)\n {\n if (st[k] == 'Q') {\n counter++;\n }\n }\n }\n }\n }\n }\n Console.WriteLine(counter);\n Console.ReadLine();\n }\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace QAQ\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n string s = reader.ReadLine();\n\n int count = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != 'Q')\n continue;\n for (int j = i + 1; j < s.Length; j++)\n {\n if (s[j] != 'A')\n continue;\n for (int k = j + 1; k < s.Length; k++)\n {\n if (s[k] == 'Q')\n count++;\n }\n }\n }\n\n return count;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int a = 0, q = 0, count = 0;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'Q')\n {\n for (int j = i + 1; j < str.Length; j++)\n {\n if (str[j] == 'A') a++;\n if (str[j] == 'Q') count += a;\n }\n a = 0;\n q = 0;\n }\n \n }\n Console.Write(count);\n //Console.ReadKey();\n \n \n }\n }\n}"}, {"source_code": "using System;\nnamespace _894A\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int result = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == 'Q')\n {\n for (int j = i + 1; j < s.Length; j++)\n {\n if (s[j] == 'A')\n {\n for (int k = j + 1; k < s.Length; k++)\n {\n if (s[k] == 'Q')\n result++;\n }\n }\n }\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var a = Read();\n long res = 0;\n for (int i = 0; i < a.Length; i++)\n {\n for (int j = i + 1; j < a.Length; j++)\n {\n for (int k = j + 1; k < a.Length; k++)\n {\n if (a[i] == 'Q' && a[j] == 'A' && a[k] == 'Q')\n res++;\n }\n }\n }\n return res;\n }\n\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _447_1QAQ\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var line = Console.ReadLine();\n var letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".ToCharArray();\n if (line == null) return;\n line.Trim(letters);\n var num = 0;\n for (var i = 0; i < line.Length; i++)\n for (var j = i + 1; j < line.Length; j++)\n for (var l = j + 1; l < line.Length; l++)\n if (line[i] == 'Q' && line[j] == 'A' && line[l] == 'Q')\n num++;\n Console.WriteLine(num);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CompProg.codeforces\n{\n public class QAQ\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int res = 0;\n int len = s.Length;\n for (int i = 0; i < len - 2; i++)\n for (int j = i + 1; j < len - 1; j++)\n for (int k = j + 1; k < len; k++)\n if (s[i] == 'Q' && s[j] == 'A' && s[k] == 'Q')\n res++;\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var s = sr.NextString();\n var count = 0;\n for (var i = 0; i < s.Length; i++) {\n for (var j = i + 1; j < s.Length; j++) {\n for (var k = j + 1; k < s.Length; k++) {\n if (s[i] == 'Q' && s[j] == 'A' && s[k] == 'Q') {\n count++;\n }\n }\n }\n }\n \n sw.WriteLine(count);\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces.NET\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n line = Console.ReadLine();\n int answer = 0;\n for (int i = 0; i < line.Length-2; i++)\n {\n for (int j = i+1; j< line.Length-1; j++)\n {\n for (int k = j + 1; k < line.Length; k++)\n {\n if (line[i] == 'Q' && line[j] == 'A' && line[k] == 'Q')\n {\n answer++;\n }\n }\n }\n }\n\n Console.WriteLine(answer);\n Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_QAQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n var line = Console.ReadLine();\n\n int result = 0;\n for (int i = 0; i < line.Length; ++i)\n {\n if (line[i] != 'Q') continue;\n for (int j = i + 1; j < line.Length; ++j)\n {\n if (line[j] != 'A') continue;\n for (int k = j+1; k < line.Length; ++k)\n {\n if (line[k] == 'Q')\n {\n result++;\n }\n }\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring s = Console.ReadLine();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < s.Length-2; i++)\n\t\t{\n\t\t\tif(s[i] == 'Q')\n\t\t\t{\n\t\t\t\tfor(int j = i+1; j < s.Length - 1; j++)\n\t\t\t\t{\n\t\t\t\t\tif(s[j] == 'A')\n\t\t\t\t\t{\n\t\t\t\t\t\tfor(int k = j+1; k < s.Length; k++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(s[k] == 'Q')\n\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(count);\n\t}\t\t\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static void program(TextReader input)\n {\n var s = input.ReadLine();\n long res = 0;\n for(var i = 0; i < s.Length; i++)\n {\n if(s[i] != 'A')\n {\n continue;\n }\n for(var j = i - 1; j >= 0; j--)\n {\n if(s[j] != 'Q')\n {\n continue;\n }\n for(var k = i + 1; k < s.Length; k++)\n {\n if(s[k] == 'Q')\n {\n res++;\n }\n }\n }\n } \n\n writer.WriteLine(res);\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"4\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"QAQAQYSYIOIWIN\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"3\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"QAQQQZZYNOIWIN\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tvar S = Console.ReadLine();\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < S.Length; i++)\n\t\t{\n\t\t\tfor (int j = i + 1; j < S.Length; j++)\n\t\t\t{\n\t\t\t\tfor (int k = j + 1; k < S.Length; k++)\n\t\t\t\t{\n\t\t\t\t\tif (S[i] == 'Q' && S[j] == 'A' && S[k] == 'Q')\n\t\t\t\t\t{\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace CF_Problems_894_A // QAQ\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int ans = 0;\n int n = s.Length;\n\n for (int i = 0; i < n - 2; i++)\n {\n if (s[i] == 'Q')\n {\n for (int j = i+1; j < n - 1; j++)\n {\n if (s[j] == 'A')\n {\n for (int k = j + 1; k < n; k++)\n {\n if (s[k] == 'Q')\n ans++;\n }\n }\n }\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeff//#define FILE_INPUT\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\n//using System.Text.RegularExpressions;\n//using System.Linq;\n//using System.Collections;\n//using System.Collections.Specialized;\n//using System.Numerics;\n\n//2078. \u0418\u0433\u0440\u0430 \u0432 \u0431\u043e\u0443\u043b\u0438\u043d\u0433\n\nnamespace CodeForces\n{\n\n class Solution\n {\n static void Main()\n {\n new Solution().solve();\n Pause();\n }\n\n private void solve()\n {\n int ans = 0;\n var s = cin.Line();\n int[] qc = new int[100];\n int[] qac = new int[100];\n\n qc[0] = (s[0] == 'Q' ? 1 : 0);\n for (int i = 1; i < s.Length; i++)\n {\n qc[i] = qc[i - 1] + (s[i] == 'Q' ? 1 : 0);\n qac[i] = qac[i - 1] + (s[i] == 'A' ? qc[i - 1] : 0);\n }\n\n for (int i = 2; i < s.Length; i++)\n {\n if (s[i] == 'Q')\n {\n ans += qac[i - 1];\n }\n }\n\n Console.WriteLine(ans);\n }\n\n #region Tools\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugOut(string format, T arg)\n {\n Console.WriteLine(format, arg);\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugOut(string format, params object[] arg)\n {\n Console.WriteLine(format, arg);\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void DebugStop()\n {\n Console.ReadKey(true);\n }\n\n private static T[] ga(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f(i);\n return a;\n }\n\n private static T[] ga(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n private static int gi()\n { return cin.gi(); }\n\n private static List gl(int n, Func f)\n {\n var a = new List(n + 1);\n for (int i = 0; i < n; ++i) a.Add(f(i));\n return a;\n }\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n static private void Pause()\n {\n Console.WriteLine(\"[debug]\");\n Console.ReadKey(true);\n }\n private static void swap(ref T a, ref T b)\n {\n T t = a; a = b; b = t;\n }\n\n #endregion Tools\n }\n\n class cin\n {\n public static int error { get; set; }\n\n static cin()\n {\n#if (ONLINE_JUDGE || !FILE_INPUT)\n reader = new System.IO.BufferedStream(Console.OpenStandardInput(1024 * 10), 1024 * 10);\n#else\n reader = new System.IO.BufferedStream((new System.IO.StreamReader(\"input.txt\")).BaseStream, 1024 * 16);\n#endif\n }\n\n public static System.IO.BufferedStream reader { get; private set; }\n public static char Char() { return (char)reader.ReadByte(); }\n\n public static int gi()\n {\n for (int c = read(); c != -1; c = read())\n {\n switch ((char)c)\n {\n case '-':\n return -(int)gu(read());\n\n default:\n if (char.IsDigit((char)c)) return (int)gu(c);\n break;\n }\n }\n\n throw new System.IO.IOException();\n }\n\n public static uint gu()\n {\n return gu(read());\n }\n\n public static string Line()\n {\n int c;\n StringBuilder sb = new StringBuilder();\n for (c = read(); c != 10; c = read()) sb.Append((char)c);\n if (sb.Length > 0 && sb[sb.Length - 1] == 13) sb.Length -= 1;\n return sb.ToString();\n }\n\n public static int rawLine(byte[] a, int offset = 0)\n {\n int c, i = offset;\n for (c = reader.ReadByte(); c != 10; c = reader.ReadByte()) a[i++] = (byte)c;\n if (i > 0 && a[i - 1] == 13) i--;\n return i - offset;\n }\n\n public static int rawLine(char[] a, int offset = 0)\n {\n Array.ConvertAll(a, Convert.ToInt16);\n\n int c, i = offset;\n for (c = read(); c != 10 && c != -1; c = read()) a[i++] = (char)c;\n if (i > 0 && a[i - 1] == 13) i--;\n return i;\n }\n\n public static int rawLine(T[] a, Func converter) where T : IComparable\n {\n int c, i = 0;\n for (c = read(); c != 10; c = read()) a[i++] = converter(c);\n if (i > 0 && a[i - 1].CompareTo(13) == 0) i--;\n return i;\n }\n\n public static string Scan()\n {\n int c;\n StringBuilder sb = new StringBuilder();\n do c = read(); while (c < 33 || c > 126);\n for (; c >= 33 && c <= 126; c = read()) sb.Append((char)c);\n return sb.ToString();\n }\n public static void Scan(Action f)\n {\n int c;\n StringBuilder sb = new StringBuilder();\n do c = read(); while (c < 33 || c > 126);\n for (; c >= 33 && c <= 126; c = read()) f(c);\n }\n\n private static uint gu(int first)\n {\n int c;\n uint u = (uint)first - '0';\n for (c = read(); c != -1 && char.IsDigit((char)c); c = read())\n {\n u = 10 * u + (uint)c - '0';\n }\n\n error = c;\n return u;\n }\n\n private static int read() { return reader.ReadByte(); }\n\n public static bool NewLine()\n {\n int c = error;\n if (c != 10) do c = reader.ReadByte(); while (c != -1 && c != 10);\n return c != -1;\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program {\n\n static int[] qaq;\n static int[] qa;\n static int[] q;\n static string reduced;\n\n static void Main(string[] args) {\n qaq = new int[111];\n qa = new int[111];\n q = new int[111];\n for (int i = 0; i < 111; i++) {\n qaq[i] = qa[i] = q[i] = -1;\n }\n string s = Console.ReadLine();\n reduced = \"\";\n for (int i = 0; i < s.Length; i++) {\n if (s[i] == 'A' || s[i] == 'Q') {\n reduced += s[i];\n }\n }\n Console.WriteLine(Qaq(reduced.Length));\n }\n\n static int Qaq(int n) {\n if (n < 3)\n return 0;\n if (qaq[n] != -1)\n return qaq[n];\n if (reduced[n-1] == 'Q') {\n return qaq[n] = Qa(n - 1) + Qaq(n - 1);\n }\n else {\n return qaq[n] = Qaq(n - 1);\n }\n }\n\n static int Qa(int n) {\n if (n < 2)\n return 0;\n if (qa[n] != -1)\n return qa[n];\n if (reduced[n - 1] == 'A') {\n return qa[n] = Q(n - 1) + Qa(n - 1);\n }\n else {\n return qa[n] = Qa(n - 1);\n }\n }\n\n static int Q(int n) {\n if (n == 0)\n return 0;\n if (q[n] != -1)\n return q[n];\n if (reduced[n - 1] == 'Q') {\n return q[n] = 1 + Q(n - 1);\n }\n else {\n return q[n] = Q(n - 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n string qaqstring = Console.ReadLine();\n\n int qaqsum = 0;\n for(int i = 0; i < qaqstring.Length; ++i)\n {\n for(int j = i; j < qaqstring.Length; ++j)\n {\n for(int k = j; k < qaqstring.Length; ++k)\n {\n if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n qaqsum++;\n }\n }\n }\n Console.WriteLine(qaqsum);\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp88\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int sum = 0;\n if (s.Length >= 1 & s.Length <= 100)\n {\n\n\n for (int i = 0; i < s.Length; i++)\n {\n \n if (s[i] == 'Q')\n {\n for (int p = i + 1; p < s.Length; p++)\n {\n if (s[p] == 'A')\n {\n for (int z = p + 1; z < s.Length; z++)\n {\n if (s[z] == 'Q')\n {\n sum++;\n }\n }\n }\n }\n }\n \n\n\n\n }\n }\n Console.WriteLine(sum);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n public static void Main()\n {\n string s = Console.ReadLine();\n int count = 0;\n for (var q1 = 0; q1 < s.Length; ++q1)\n for (var a = q1 + 1; a < s.Length; ++a)\n for (var q2 = a + 1; q2 < s.Length; ++q2)\n {\n if (s[q1] != 'Q' || s[a] != 'A' || s[q2] != 'Q')\n continue;\n ++count;\n }\n\n Console.WriteLine(count);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Reverse_Array\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n long count = 0;\n\n ArrayList store = new ArrayList();\n char[] array = new char[line.Length];\n for (int i = 0; i < line.Length; i++)\n {\n array[i] = line[i];\n }\n\n for (int x = 0; x < line.Length; x++)\n {\n if (array[x] == 'Q')\n {\n store.Add(array[x]);\n for (int j = x+1; j < line.Length; j++)\n {\n if (array[j] == 'A')\n {\n store.Add(array[j]);\n for (int k = j+1; k < line.Length; k++)\n {\n if (array[k] == 'Q')\n {\n count++;\n store.Add(array[k]);\n }\n }\n }\n \n }\n \n }\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace contest894a\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n string capitals = Console.ReadLine();\n\n int[] numOfQs = new int[capitals.Length];\n\n int Qs = 0;\n\n\n for (int i = 0; i < capitals.Length; i++)\n {\n if (capitals[i].ToString() == \"Q\")\n {\n Qs++;\n numOfQs[i] = Qs;\n }\n else{\n numOfQs[i] = Qs;\n }\n }\n\n int totalMatches = 0;\n\n\t\t\tfor (int c = 0; c < capitals.Length - 1; c++)\n\t\t\t{\n if (capitals[c].ToString() == \"A\" && c != 0 )\n\t\t\t\t{\n totalMatches += numOfQs[c - 1] * (Math.Abs(numOfQs[capitals.Length - 1] - numOfQs[c - 1]));\n\t\t\t\t}\n\t\t\t}\n\n Console.WriteLine(totalMatches);\n }\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace _894\n{\n class Program\n {\n static void Main(string[] args)\n {\n string qaq = Console.ReadLine();\n int count = 0;\n\n for(int ii = 0; ii < qaq.Length; ++ii)\n {\n for(int jj = ii; jj < qaq.Length; ++jj)\n {\n for(int kk = jj; kk < qaq.Length; ++kk)\n {\n if(qaq[ii] == 'Q' && qaq[jj] == 'A' && qaq[kk] == 'Q')\n {\n ++count;\n }\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string input = Console.ReadLine();\n int[] qCounts = new int[input.Length];\n if (input[0] == 'Q')\n {\n qCounts[0] = 1;\n }\n else\n {\n qCounts[0] = 0;\n }\n\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == 'Q')\n {\n qCounts[i] = qCounts[i - 1] + 1;\n }\n else\n {\n qCounts[i] = qCounts[i - 1];\n }\n }\n int result = 0;\n int last = qCounts[qCounts.Length - 1];\n for (int i = 1; i < input.Length; i++)\n {\n if (input[i] == 'A')\n {\n result += qCounts[i] * (last - qCounts[i]);\n }\n }\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] ch = Console.ReadLine().Where(x => x == 'Q' || x == 'A').Select(x=>x).ToArray();\n string str = string.Join(\"\", ch);\n int rez = 0;\n int countOfQ = str.Count(x => x == 'Q');\n while(str.Contains('A'))\n {\n int counter = 0;\n for (int i = 0; i < str.IndexOf('A'); i++)\n {\n if (str[i] == 'Q')\n counter++;\n }\n rez += counter * (countOfQ - counter);\n str = str.Remove(str.IndexOf('A'), 1);\n }\n \n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = \"QAQ\";\n string t = Console.ReadLine();\n var d = new int[s.Length + 1, t.Length + 1];\n for (int i = 0; i < s.Length + 1; i++)\n {\n for(int j = 0; j < t.Length + 1; j++)\n {\n if (i == 0)\n {\n d[i, j] = 1;\n continue;\n }\n if (j == 0)\n {\n d[i, j] = 0;\n continue;\n }\n d[i, j] = d[i, j - 1] + (s[i - 1] == t[j - 1] ? d[i - 1, j - 1] : 0);\n }\n }\n\n Console.WriteLine(d[s.Length, t.Length].ToString());\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string s, t;\n static int n;\n static long solve(int idx,int j)\n {\n if (j == 3) return 1;\n if (idx == n) return 0;\n long s1 = solve(idx + 1, j);\n if (s[idx] == t[j])\n s1 += solve(idx + 1, j + 1);\n return s1;\n }\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n n = s.Length;\n t = \"QAQ\";\n Console.WriteLine(solve(0, 0));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static string s, t;\n static int n;\n static long[,] dp;\n static long solve(int idx,int j)\n {\n if (j == 3) return 1;\n if (idx == n) return 0;\n long s1 = solve(idx + 1, j);\n if (s[idx] == t[j])\n s1 += solve(idx + 1, j + 1);\n return s1;\n }\n static void Main(string[] args)\n {\n s = Console.ReadLine();\n n = s.Length;\n t = \"QAQ\";\n dp = new long[101, 4];\n for(int i=0; i<=n; i++)\n {\n for(int j=0; j<=3; j++)\n {\n if (j == 0) dp[i, j] = 1;\n else if (i == 0) dp[i, j] = 0;\n else\n {\n dp[i, j] = dp[i-1,j];\n if (s[i-1] == t[j-1])\n dp[i, j] += dp[i - 1, j - 1];\n }\n }\n }\n Console.WriteLine(dp[n,3]);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nnamespace ConsoleApplication\n{\n sealed class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine();\n var result = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = i + 1; j < s.Length; j++)\n {\n for (int z = j + 1; z < s.Length; z++)\n {\n if (s[i] == 'Q' && s[j] == 'A' && s[z] == 'Q')\n result++;\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var qaq = Console.ReadLine().Where( x => (x == 'Q' || x == 'A')).ToArray();\n var total = 0;\n for (var i = 0; i < qaq.Length; i ++)\n {\n if (qaq[i] == 'A')\n {\n var qLeft = 0; var qRight = 0;\n for (var k = 0; k < qaq.Length; k++)\n if (qaq[k]=='Q'){\n if (k < i) qLeft++;\n if (k > i) qRight++;\n }\n total += Math.Min(qLeft, qRight) + Math.Max(qLeft, qRight) - 1;\n }\n }\n Console.WriteLine(total);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var qaq = Console.ReadLine().Where( x => (x == 'Q' || x == 'A')).ToArray();\n var total = 0;\n for (var i = 0; i < qaq.Length; i ++)\n {\n if (qaq[i] == 'A')\n {\n var qLeft = 0; var qRight = 0;\n for (var k = 0; k < qaq.Length; k++)\n if (qaq[k]=='Q'){\n if (k < i) qLeft++;\n if (k > i) qRight++;\n }\n if (qLeft > 0 && qRight > 0)\n total += Math.Min(qLeft, qRight) + Math.Max(qLeft, qRight) - 1;\n }\n }\n Console.WriteLine(total);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nclass a\n{\n static void Main()\n {\n var s = Console.ReadLine();\n string p = \"\";\n for (int i = 0; i < s.Length; i++) if (s[i] == 'Q' || s[i] == 'A') p += s[i];\n int r = 0;\n Console.WriteLine(p);\n for (int i = 0; i < p.Length; i++)\n {\n for (int j = i+1; j < p.Length; j++)\n { \n for (int k = j+1; k < p.Length; k++)\n {\n if (p[i].ToString() + p[j].ToString() + p[k].ToString() == \"QAQ\") r++;\n }\n } \n }\n Console.WriteLine(r);\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nclass a\n{\n static void Main()\n {\n var s = Console.ReadLine();\n string p = \"\";\n for (int i = 0; i < s.Length; i++) if (s[i] == 'Q' || s[i] == 'A') p += s[i];\n int r = 0;\n if(p == \"QAQ\")\n {\n Console.WriteLine(1);\n return;\n }\n for (int i = 0; i < p.Length; i++)\n {\n string temp = p;\n temp = R(temp, i);\n if (Q(temp)) r++;\n }\n Console.WriteLine(r);\n\n }\n static bool Q(string x)\n {\n int q1 = x.IndexOf('Q');\n int a = x.IndexOf('A');\n if (a < 0) return false;\n int q2 = a + x.Substring(a, x.Length - a).IndexOf('Q') + 1;\n return (q1 < a && a < q2);\n }\n static string R(string x, int index)\n {\n x = x.Substring(0, index) + \"*\" + x.Substring(index + 1, x.Length - index - 1);\n return x;\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar pref = new int[s.Length];\n\t\t\tif (s[0] == 'Q') pref[0] = 1;\n\t\t\tfor (int i = 1; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'Q')\n\t\t\t\t\tpref[i] = pref[i - 1] + 1;\n\t\t\t\t\n\t\t\t\telse pref[i] = pref[i - 1];\n\t\t\t}\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == 'A')\n\t\t\t\t{\n\t\t\t\t\tif (pref[s.Length - 1] - pref[i] == 0) break;\n\t\t\t\t\tcount += Math.Max(pref[i], pref[s.Length - 1] - pref[i]); \n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(count);\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate static List ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\tprivate static List ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\tprivate static int[] ReadIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tprivate static long[] ReadLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();\n\t\tprivate static int ReadInt() => int.Parse(Console.ReadLine());\n\t\tprivate static long ReadLong() => long.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar pref = new int[s.Length];\n\t\t\tif (s[0] == 'Q') pref[0] = 1;\n\t\t\tfor (int i = 1; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'Q')\n\t\t\t\t\tpref[i] = pref[i - 1] + 1;\n\t\t\t\t\n\t\t\t\telse pref[i] = pref[i - 1];\n\t\t\t}\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == 'A')\n\t\t\t\t{\n\t\t\t\t\tcount += Math.Min(pref[i], pref[s.Length - 1] - pref[i]); \n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(count);\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate static List ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\tprivate static List ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\tprivate static int[] ReadIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tprivate static long[] ReadLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();\n\t\tprivate static int ReadInt() => int.Parse(Console.ReadLine());\n\t\tprivate static long ReadLong() => long.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\tvar pref = new int[s.Length];\n\t\t\tif (s[0] == 'Q') pref[0] = 1;\n\t\t\tfor (int i = 1; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == 'Q')\n\t\t\t\t\tpref[i] = pref[i - 1] + 1;\n\t\t\t\t\n\t\t\t\telse pref[i] = pref[i - 1];\n\t\t\t}\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < s.Length; i++)\n\t\t\t{\n\t\t\t\tif(s[i] == 'A')\n\t\t\t\t{\n\t\t\t\t\tcount += Math.Max(pref[i], pref[s.Length - 1] - pref[i]); \n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(count);\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate static List ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\tprivate static List ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\tprivate static int[] ReadIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();\n\t\tprivate static long[] ReadLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();\n\t\tprivate static int ReadInt() => int.Parse(Console.ReadLine());\n\t\tprivate static long ReadLong() => long.Parse(Console.ReadLine());\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int countQ = 0, countA = 0;\n for (int i = 0; i < str.Length; i++)\n {\n if (str[i] == 'Q') countQ++;\n if (str[i] == 'A') countA++;\n }\n Console.Write(countA * (countQ - 1));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int countQ = 0, countA = 0, count = 0;\n for (int i = 0; i < str.Length; i++)\n {\n \n if (str[i] == 'A') countA++;\n if (str[i] == 'Q' && countA > 0) countQ++;\n }\n Console.Write(countA * countQ);\n // Console.ReadKey();\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int countQ = 0, countA = 0, count = 0;\n for (int i = 0; i < str.Length; i++)\n {\n \n if (str[i] == 'A') countA++;\n if (str[i] == 'Q') countQ++;\n if (countA > 0 && countQ > 1 && str[i] == 'Q') count = countA*(countQ-1);\n }\n Console.Write(count);\n //Console.ReadKey();\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Rextester\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int countQ = 0, countA = 0, count = 0;\n for (int i = 0; i < str.Length; i++)\n {\n \n if (str[i] == 'A' && countQ >0) countA++;\n if (str[i] == 'Q') countQ++;\n if (countA > 0 && countQ > 1 && str[i] == 'Q') count = countA*(countQ-1);\n }\n Console.Write(count);\n //Console.ReadKey();\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _894\n{\n class Program\n {\n static void Main(string[] args)\n {\n string qaq = Console.ReadLine();\n int count = 0;\n\n for(int ii = 0; ii < qaq.Length; ++ii)\n {\n if(qaq[ii] == 'Q')\n {\n for(int jj = ii; jj < qaq.Length - ii; ++jj)\n {\n if(qaq[jj] == 'A')\n {\n for(int kk = jj; kk < qaq.Length - jj; ++kk)\n {\n if(qaq[kk] == 'Q')\n {\n ++count;\n }\n }\n }\n }\n }\n\n }\n Console.WriteLine(count);\n }\n }\n}\n"}], "src_uid": "8aef4947322438664bd8610632fe0947"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\nusing System.Threading;\nusing System.Linq;\n \nclass TEST{\n\tstatic void Main(){\n\t\tPlayer[] P=new Player[4];\n\t\tfor(int i=0;i<4;i++){\n\t\t\tvar s=Console.ReadLine().Split(' ');\n\t\t\tP[i]=new Player(int.Parse(s[1]),int.Parse(s[0]));\n\t\t}\n\t\t\n\t\tint[][] Score=new int[2][];\n\t\tfor(int i=0;i<2;i++)Score[i]=new int[2];\n\t\t\n\t\tint off1=0;\n\t\tint off2=0;\n\t\tint def1=0;\n\t\tint def2=0;\n\n\t\tfor(int i=0;i<2;i++){\n\t\t\tif(i==0){off1=P[0].Off;def1=P[1].Def;}\n\t\t\tif(i==1){off1=P[1].Off;def1=P[0].Def;}\n\t\t\t\n\t\t\tfor(int j=0;j<2;j++){\n\t\t\t\tif(j==0){off2=P[2].Off;def2=P[3].Def;}\n\t\t\t\tif(j==1){off2=P[3].Off;def2=P[2].Def;}\n\t\t\t\t\n\t\t\t\tif(off1>def2 && def1>off2){Score[i][j]=1;continue;}\n\t\t\t\tif(off1 0)\n {\n Do();\n Console.WriteLine(Console.ReadLine());\n }\n Console.In.Close();\n Console.SetIn(tmp);\n#endif\n Console.ReadLine();\n }\n \n private static void Do()\n {\n var s = new Scanner();\n int a1 = s.nextInt(), a2 = s.nextInt();\n int b1 = s.nextInt(), b2 = s.nextInt();\n int c1 = s.nextInt(), c2 = s.nextInt();\n int d1 = s.nextInt(), d2 = s.nextInt();\n\n int win1 = Win(a1, b2, c1, c2, d1, d2);\n int win2 = Win(b1, a2, c1, c2, d1, d2);\n if (win1 == 1 || win2 == 1)\n Console.WriteLine(\"Team 1\");\n else if (win1 == 2 && win2 == 2)\n Console.WriteLine(\"Team 2\");\n else\n Console.WriteLine(\"Draw\");\n }\n\n private static int Win(int napadenie, int zashita, int c1, int c2, int d1, int d2)\n {\n if (napadenie > c2 && napadenie > d2 && zashita > c1 && zashita > d1)\n return 1;\n\n if ((napadenie < c2 && zashita < d1) || (napadenie < d2 && zashita < c1))\n return 2;\n \n return 0;\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.00000000000000}\", d).Replace(',', '.'));\n }\n }\n\n class Scanner\n {\n string[] s;\n int i;\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public char nextChar()\n {\n return char.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C.Kicker\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] D = new int[8];\n for (int i = 0; i < 8; i+=2)\n {\n string str = Console.ReadLine();\n int j;\n for (j = 0; ; j++)\n {\n if (str[j] == ' ') break;\n\n }\n D[i] = int.Parse(str.Substring(0,j));\n for (;; j++)\n {\n if (str[j] != ' ') break;\n }\n D[i + 1] = int.Parse(str.Substring(j));\n }\n int R11 = check(D[0], D[3], D[4], D[7]), R12 = check(D[0], D[3], D[6], D[5]);\n if (R11 == 1 && R12 == 1) Console.WriteLine(\"Team 1\"); else {\n int R21 = check(D[2], D[1], D[4], D[7]), R22 = check(D[2], D[1], D[6], D[5]);\n if (R21 == 1 && R22 == 1) Console.WriteLine(\"Team 1\");\n else if ((R11 == 2 || R12 == 2) && (R21 == 2 || R22 == 2)) Console.WriteLine(\"Team 2\");\n else Console.WriteLine(\"Draw\");\n }\n \n }\n public static int check(int team1_1, int team1_2, int team2_1,int team2_2)\n {\n if (team1_1 > team2_2 && team1_2 > team2_1) return 1;\n if (team1_1 < team2_2 && team1_2 < team2_1) return 2;\n return 0;\n }\n }\n}\n "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\nclass Program\n{\nstatic void Main(string[] args)\n{\nvar s=\" \";\nstring[] all;\nint[,] a=new int[4,2];\nfor (int i = 0; i < 4; i++)\n{\ns=Console.ReadLine();\nall = s.Split(' ');\na[i, 0] = Convert.ToInt32(all[0]);\na[i, 1] = Convert.ToInt32(all[1]);\n}\nString win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\npowAttack2=a[3,1];\npowProtect2=a[2,0];\npowAttack21 = a[2, 1];\npowProtect21 = a[3, 0];\nif ((((powProtect1 < powAttack2) && (powAttack1 < powProtect2)) || ((powProtect1 < powAttack21) && (powAttack1 < powProtect21))) && (((powProtect11 < powAttack2) && (powAttack11 < powProtect2)) || ((powProtect11 < powAttack21) && (powAttack11 < powProtect21))))\n{\n\nConsole.WriteLine(win2);\n}\nelse if (((powProtect11 > powAttack2) && (powAttack11 > powProtect2) && (powProtect11 > powAttack21) && (powAttack11 > powProtect21)) || ((powProtect1 > powAttack2) && (powAttack1 > powProtect2) && (powProtect1 > powAttack21) && (powAttack1 > powProtect21)))\n{ Console.WriteLine(win1);\n}else{\nConsole.WriteLine(draw);\n}\n\n}\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n\nnamespace Algorithm\n{\n class Solver\n {\n Player[] a = new Player[4];\n\n public void Run()\n {\n for (int i = 0; i < 4; i++)\n {\n string[] tokens = cin.ReadLine().Split();\n int x = int.Parse(tokens[0]);\n int y = int.Parse(tokens[1]);\n a[i] = new Player(x, y);\n }\n\n if (can_win(a[0].Defence, a[1].Attak, a[2].Defence, a[3].Attak) &&\n can_win(a[0].Defence, a[1].Attak, a[3].Defence, a[2].Attak))\n {\n cout.WriteLine(\"Team 1\");\n return;\n }\n if (can_win(a[1].Defence, a[0].Attak, a[2].Defence, a[3].Attak) &&\n can_win(a[1].Defence, a[0].Attak, a[3].Defence, a[2].Attak))\n {\n cout.WriteLine(\"Team 1\");\n return;\n }\n\n int cnt = 0;\n if (can_win(a[2].Defence, a[3].Attak, a[0].Defence, a[1].Attak) ||\n can_win(a[3].Defence, a[2].Attak, a[0].Defence, a[1].Attak)) cnt++;\n if (can_win(a[2].Defence, a[3].Attak, a[1].Defence, a[0].Attak) ||\n can_win(a[3].Defence, a[2].Attak, a[1].Defence, a[0].Attak)) cnt++;\n\n if (cnt == 2)\n cout.WriteLine(\"Team 2\");\n else\n cout.WriteLine(\"Draw\");\n }\n\n bool can_win(int a, int b, int c, int d)\n {\n if (a > d && b > c) return true;\n return false;\n }\n\n void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n }\n\n class Player\n {\n public Player() { }\n public Player(int _a, int _d)\n {\n this.Attak = _a;\n this.Defence = _d;\n }\n public int Attak;\n public int Defence;\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n Solver task = new Solver();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n }\n}\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace RCC2014\n{\n\tclass QR_C\n\t{\n\t\tprivate int beat(int a_atk, int a_def, int b_atk, int b_def)\n\t\t{\n\t\t\tif (a_atk > b_def && a_def > b_atk) return 1;\n\t\t\tif (b_atk > a_def && b_def > a_atk) return -1;\n\t\t\treturn 0;\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint i, j, res, ans;\n\t\t\tint[,] team;\n\t\t\tstring[] ans_words = { \"Team 2\", \"Draw\", \"Team 1\" };\n\n\t\t\tteam = new int[4, 2];\n\t\t\tfor (i = 0; i < 4; i++)\n\t\t\t\tfor (j = 0; j < 2; j++)\n\t\t\t\t\tteam[i, j] = xoi.ReadInt();\n\n\t\t\tfor (i = 0, ans = -1999; i <= 1; i++)\n\t\t\t{\n\t\t\t\tfor (j = 2, res = 1999; j <= 3; j++)\n\t\t\t\t\tres = Math.Min(res, beat(team[i, 1], team[1 - i, 0], team[j, 1], team[5 - j, 0]));\n\t\t\t\tans = Math.Max(ans, res);\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans_words[ans + 1]);\n\t\t}\n\t}\n\t\n\tclass RCC2014_QR\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tXOI xoi = new XOI();\n\t\t\t(new QR_C()).Solve(xoi);\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\t\t\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Kicker\n{\n internal class Program\n {\n private static readonly StreamReader reader =\n new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n\n private static readonly StreamWriter writer =\n new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var tt = new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n string[] ss = reader.ReadLine().Split(' ');\n int a = int.Parse(ss[0]);\n int d = int.Parse(ss[1]);\n tt[i, 0] = a;\n tt[i, 1] = d;\n }\n\n bool fwin = false;\n int swin = 0;\n\n for (int i = 0; i < 2; i++)\n {\n int a1 = tt[i, 0];\n int b1 = tt[1 - i, 1];\n int s1 = 0, s2 = 0;\n for (int j = 2; j < 4; j++)\n {\n int a2 = tt[j, 0];\n int b2 = tt[5 - j, 1];\n\n if (a2 > b1 && b2 > a1)\n s2++;\n if (a2 < b1 && b2 < a1)\n s1++;\n }\n if (s1 == 2)\n fwin = true;\n if (s2 > 0)\n swin++;\n }\n\n if (fwin)\n writer.WriteLine(\"Team 1\");\n else if (swin == 2)\n writer.WriteLine(\"Team 2\");\n else\n {\n writer.WriteLine(\"Draw\");\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CSharpParser\n{\n public class Solution : SolutionBase\n {\n protected override void Solve()\n {\n var a = new int[4];\n var b = new int[4];\n for (var i = 0; i < 4; i++)\n {\n Next(out a[i]);\n Next(out b[i]);\n }\n if ((a[0] > b[2] && b[1] > a[3]) && (a[0] > b[3] && b[1] > a[2]))\n PrintLine(\"Team 1\");\n else if ((a[1] > b[2] && b[0] > a[3]) && (a[1] > b[3] && b[0] > a[2]))\n PrintLine(\"Team 1\");\n else if (((a[0] < b[2] && b[1] < a[3]) || (a[0] < b[3] && b[1] < a[2])) && ((a[1] < b[2] && b[0] < a[3]) || (a[1] < b[3] && b[0] < a[2])))\n PrintLine(\"Team 2\");\n else PrintLine(\"Draw\");\n }\n }\n\n public static class Algorithm\n {\n public static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n public static T Max(params T[] a)\n {\n var ans = a[0];\n var comp = Comparer.Default;\n for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) >= 0 ? ans : a[i];\n return ans;\n }\n\n public static T Min(params T[] a)\n {\n var ans = a[0];\n var comp = Comparer.Default;\n for (var i = 1; i < a.Length; i++) ans = comp.Compare(ans, a[i]) <= 0 ? ans : a[i];\n return ans;\n }\n\n public static void RandomShuffle(T[] a, int index, int length)\n {\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n var rnd = new Random(DateTime.Now.Millisecond);\n for (var i = index + 1; i < last; i++) Swap(ref a[i], ref a[rnd.Next(index, i + 1)]);\n }\n\n public static void RandomShuffle(T[] a)\n {\n RandomShuffle(a, 0, a.Length);\n }\n\n public static bool NextPermutation(T[] a, int index, int length, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n for (var i = last - 1; i > index; i--)\n if (compare(a[i], a[i - 1]) > 0)\n {\n var j = i + 1;\n for (; j < last; j++) if (compare(a[j], a[i - 1]) <= 0) break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, last - i);\n return true;\n }\n Array.Reverse(a, index, length);\n return false;\n }\n\n public static bool NextPermutation(T[] a, Comparison compare = null)\n {\n return NextPermutation(a, 0, a.Length, compare);\n }\n\n public static bool PrevPermutation(T[] a, int index, int length, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n var last = index + length;\n if (last > a.Length) throw new ArgumentException();\n for (var i = last - 1; i > index; i--)\n if (compare(a[i], a[i - 1]) < 0)\n {\n var j = i + 1;\n for (; j < last; j++) if (compare(a[j], a[i - 1]) >= 0) break;\n Swap(ref a[i - 1], ref a[j - 1]);\n Array.Reverse(a, i, last - i);\n return true;\n }\n Array.Reverse(a, index, length);\n return false;\n }\n\n public static bool PrevPermutation(T[] a, Comparison compare = null)\n {\n return PrevPermutation(a, 0, a.Length, compare);\n }\n\n public static int LowerBound(IList a, int index, int length, T value, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n if (index + length > a.Count) throw new ArgumentException();\n var ans = index;\n var last = index + length;\n var p2 = 1;\n while (p2 <= length) p2 *= 2;\n for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) < 0) ans += p2;\n return ans;\n }\n\n public static int LowerBound(IList a, T value, Comparison compare = null)\n {\n return LowerBound(a, 0, a.Count, value, compare);\n }\n\n public static int UpperBound(IList a, int index, int length, T value, Comparison compare = null)\n {\n compare = compare ?? Comparer.Default.Compare;\n if (index < 0 || length < 0) throw new ArgumentOutOfRangeException();\n if (index + length > a.Count) throw new ArgumentException();\n var ans = index;\n var last = index + length;\n var p2 = 1;\n while (p2 <= length) p2 *= 2;\n for (p2 /= 2; p2 > 0; p2 /= 2) if (ans + p2 <= last && compare(a[ans + p2 - 1], value) <= 0) ans += p2;\n return ans;\n }\n\n public static int UpperBound(IList a, T value, Comparison compare = null)\n {\n return UpperBound(a, 0, a.Count, value, compare);\n }\n }\n\n public class InStream : IDisposable\n {\n protected readonly TextReader InputStream;\n private string[] _tokens;\n private int _pointer;\n\n public InStream(TextReader inputStream)\n {\n InputStream = inputStream;\n }\n\n public InStream(string str)\n {\n InputStream = new StringReader(str);\n }\n\n public static InStream Freopen(string str)\n {\n return new InStream(new StreamReader(str));\n }\n\n public string NextLine()\n {\n try\n {\n return InputStream.ReadLine();\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n private string NextString()\n {\n try\n {\n while (_tokens == null || _pointer >= _tokens.Length)\n {\n _tokens = NextLine().Split(new[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n _pointer = 0;\n }\n return _tokens[_pointer++];\n }\n catch (Exception)\n {\n return null;\n }\n }\n\n public bool Next(out T ans)\n {\n var str = NextString();\n if (str == null)\n {\n ans = default(T);\n return false;\n }\n ans = (T) Convert.ChangeType(str, typeof (T));\n return true;\n }\n\n public void Dispose()\n {\n InputStream.Close();\n }\n }\n\n public class OutStream : IDisposable\n {\n protected readonly TextWriter OutputStream;\n\n public OutStream(TextWriter outputStream)\n {\n OutputStream = outputStream;\n }\n\n public OutStream(StringBuilder strB)\n {\n OutputStream = new StringWriter(strB);\n }\n\n public static OutStream Freopen(string str)\n {\n return new OutStream(new StreamWriter(str));\n }\n\n public void Print(string format, params object[] args)\n {\n OutputStream.Write(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n OutputStream.WriteLine();\n }\n\n public void PrintLine()\n {\n OutputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n OutputStream.Write(o);\n }\n\n public void PrintLine(T o)\n {\n OutputStream.WriteLine(o);\n }\n\n public void Dispose()\n {\n OutputStream.Close();\n }\n }\n\n public abstract class SolutionBase : IDisposable\n {\n private readonly InStream _in;\n private readonly OutStream _out;\n\n protected SolutionBase()\n {\n //System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n _in = new InStream(Console.In);\n _out = new OutStream(Console.Out);\n }\n\n protected string NextLine()\n {\n return _in.NextLine();\n }\n\n protected bool Next(out T ans)\n {\n return _in.Next(out ans);\n }\n\n protected T[] NextArray(int length)\n {\n var array = new T[length];\n for (var i = 0; i < length; i++)\n if (!_in.Next(out array[i]))\n return null;\n return array;\n }\n\n protected void PrintArray(IList a, string between = \" \", string after = \"\\n\", bool printCount = false)\n {\n if (printCount)\n _out.PrintLine(a.Count);\n for (var i = 0; i < a.Count; i++)\n _out.Print(\"{0}{1}\", a[i], i == a.Count - 1 ? after : between);\n }\n\n public void Print(string format, params object[] args)\n {\n _out.Print(format, args);\n }\n\n public void PrintLine(string format, params object[] args)\n {\n _out.PrintLine(format, args);\n }\n\n public void PrintLine()\n {\n _out.PrintLine();\n }\n\n public void Print(T o)\n {\n _out.Print(o);\n }\n\n public void PrintLine(T o)\n {\n _out.PrintLine(o);\n }\n\n public void Dispose()\n {\n _out.Dispose();\n }\n\n protected abstract void Solve();\n\n public static void Main()\n {\n using (var p = new Solution()) p.Solve();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\n powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n if ((((powProtect1 < powAttack2) && (powAttack1 < powProtect2)) || ((powProtect1 < powAttack21) && (powAttack1 < powProtect21))) && (((powProtect11 < powAttack2) && (powAttack11 < powProtect2)) || ((powProtect11 < powAttack21) && (powAttack11 < powProtect21))))\n {\n\nConsole.WriteLine(win2);\n}\n else if (((powProtect11 > powAttack2) && (powAttack11 > powProtect2) && (powProtect11 > powAttack21) && (powAttack11 > powProtect21)) || ((powProtect1 > powAttack2) && (powAttack1 > powProtect2) && (powProtect1 > powAttack21) && (powAttack1 > powProtect21)))\n{ Console.WriteLine(win1);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n public object Solve()\n {\n int[][] a = ReadIntMatrix(4);\n\n if ((a[0][0] < a[2][1] && a[1][1] < a[3][0] || a[0][0] < a[3][1] && a[1][1] < a[2][0]) &&\n (a[1][0] < a[2][1] && a[0][1] < a[3][0] || a[1][0] < a[3][1] && a[0][1] < a[2][0]))\n return \"Team 2\";\n\n if (a[0][0] > a[2][1] && a[1][1] > a[3][0] && a[0][0] > a[3][1] && a[1][1] > a[2][0] ||\n a[1][0] > a[2][1] && a[0][1] > a[3][0] && a[1][0] > a[3][1] && a[0][1] > a[2][0])\n return \"Team 1\";\n\n return \"Draw\";\n }\n\n #region I/O\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n#endif\n writer = Console.Out;\n Solver solver = new Solver();\n\n try\n {\n object result = solver.Solve();\n if (result != null)\n {\n writer.WriteLine(result);\n //Console.Error.WriteLine(result);\n }\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex);\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read helpers\n\n static Queue currentLineTokens = new Queue();\n\n public static string ReadToken()\n {\n if (currentLineTokens.Count == 0)\n {\n currentLineTokens = new Queue(reader.ReadLine().Trim().Split(' '));\n }\n return currentLineTokens.Dequeue();\n }\n\n public static string[] ReadTokens(bool fromCurrentLine = false)\n {\n string[] split;\n if (fromCurrentLine)\n {\n if (currentLineTokens.Count == 0)\n return new string[0];\n split = currentLineTokens.ToArray();\n currentLineTokens.Clear();\n }\n else\n {\n split = reader.ReadLine().Trim().Split(' ');\n }\n return split;\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray(bool fromCurrentLine = false)\n {\n string[] tokens = ReadTokens(fromCurrentLine);\n return tokens.Select(double.Parse).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n {\n lines[i] = reader.ReadLine().Trim();\n }\n return lines;\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\nclass Program\n{\nstatic void Main(string[] args)\n{\nvar s=\" \";\nstring[] all;\nint[,] a=new int[4,2];\nfor (int i = 0; i < 4; i++)\n{\ns=Console.ReadLine();\nall = s.Split(' ');\na[i, 0] = Convert.ToInt32(all[0]);\na[i, 1] = Convert.ToInt32(all[1]);\n}\nString win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\npowAttack2=a[3,1];\npowProtect2=a[2,0];\npowAttack21 = a[2, 1];\npowProtect21 = a[3, 0];\nif ((((powProtect1 < powAttack2) && (powAttack1 < powProtect2)) || ((powProtect1 < powAttack21) && (powAttack1 < powProtect21))) && (((powProtect11 < powAttack2) && (powAttack11 < powProtect2)) || ((powProtect11 < powAttack21) && (powAttack11 < powProtect21))))\n{\n\nConsole.WriteLine(win2);\n}\nelse if (((powProtect11 > powAttack2) && (powAttack11 > powProtect2) && (powProtect11 > powAttack21) && (powAttack11 > powProtect21)) || ((powProtect1 > powAttack2) && (powAttack1 > powProtect2) && (powProtect1 > powAttack21) && (powAttack1 > powProtect21)))\n{ Console.WriteLine(win1);\n}else{\nConsole.WriteLine(draw);\n}\n\n}\n}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace C.Kicker\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] D = new int[8];\n for (int i = 0; i < 8; i+=2)\n {\n string str = Console.ReadLine();\n int j;\n for (j = 0; ; j++)\n {\n if (str[j] == ' ') break;\n\n }\n D[i] = int.Parse(str.Substring(0,j));\n for (;; j++)\n {\n if (str[j] != ' ') break;\n }\n D[i + 1] = int.Parse(str.Substring(j));\n }\n int R11 = check(D[0], D[3], D[4], D[7]), R12 = check(D[0], D[3], D[6], D[5]);\n if (R11 == 1 && R12 == 1) Console.WriteLine(\"Team 1\"); else {\n int R21 = check(D[2], D[1], D[4], D[7]), R22 = check(D[2], D[1], D[6], D[5]);\n if (R21 == 1 && R22 == 1) Console.WriteLine(\"Team 1\");\n else if ((R11 == 2 || R12 == 2) && (R21 == 2 || R22 == 2)) Console.WriteLine(\"Team 2\");\n else Console.WriteLine(\"Draw\");\n }\n \n }\n public static int check(int team1_1, int team1_2, int team2_1,int team2_2)\n {\n if (team1_1 > team2_2 && team1_2 > team2_1) return 1;\n if (team1_1 < team2_2 && team1_2 < team2_1) return 2;\n return 0;\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] pass1 = Console.ReadLine().Split(' ');\n string[] pass2 = Console.ReadLine().Split(' ');\n string[] pass3 = Console.ReadLine().Split(' ');\n string[] pass4 = Console.ReadLine().Split(' ');\n\n int a1 = Convert.ToInt32(pass1[0]);\n int b1 = Convert.ToInt32(pass1[1]);\n int a2 = Convert.ToInt32(pass2[0]);\n int b2 = Convert.ToInt32(pass2[1]);\n int a3 = Convert.ToInt32(pass3[0]);\n int b3 = Convert.ToInt32(pass3[1]);\n int a4 = Convert.ToInt32(pass4[0]);\n int b4 = Convert.ToInt32(pass4[1]);\n\n // \u0410\u0421\u0410\u0411\u042b\u0419 \u0421\u041b\u0423\u0427\u0410\u0419 - \u041e\u0414\u0418\u041d\u0410\u041a\u041e\u0412\u041e \u0418\u0413\u0420\u041e\u041a\u0418\n bool svinka = false;\n if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)\n svinka = true;\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u0412\u0422\u041e\u0420\u041e\u0413\u0410\n if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))\n if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))\n {\n Console.WriteLine(\"Team 2\");\n\n return;\n }\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u041f\u0415\u0420\u0412\u0410\u0413\u041e\n if ((a1 > a3 && b2 > b4) && (a2 > a3 && b1 > b4))\n if ((a1 > a4 && b2 > b3) && (a2 > a4 && b1 > b3))\n {\n if (!svinka)\n Console.WriteLine(\"Team 1\");\n else\n Console.WriteLine(\"Draw\");\n \n return;\n }\n\n Console.WriteLine(\"Draw\");\n\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] pass1 = Console.ReadLine().Split(' ');\n string[] pass2 = Console.ReadLine().Split(' ');\n string[] pass3 = Console.ReadLine().Split(' ');\n string[] pass4 = Console.ReadLine().Split(' ');\n\n int a1 = Convert.ToInt32(pass1[0]);\n int b1 = Convert.ToInt32(pass1[1]);\n int a2 = Convert.ToInt32(pass2[0]);\n int b2 = Convert.ToInt32(pass2[1]);\n int a3 = Convert.ToInt32(pass3[0]);\n int b3 = Convert.ToInt32(pass3[1]);\n int a4 = Convert.ToInt32(pass4[0]);\n int b4 = Convert.ToInt32(pass4[1]);\n\n // \u0410\u0421\u0410\u0411\u042b\u0419 \u0421\u041b\u0423\u0427\u0410\u0419 - \u041e\u0414\u0418\u041d\u0410\u041a\u041e\u0412\u041e \u0418\u0413\u0420\u041e\u041a\u0418\n bool svinka = false;\n if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)\n svinka = true;\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u0412\u0422\u041e\u0420\u041e\u0413\u0410\n int can = 0;\n int testA1 = a1, testB1 = b2;\n\n if ((a3 > testA1 && b4 > testB1) || (a4 > testA1 && b3 > testB1))\n {\n can++;\n // Console.WriteLine(\"Team 2\");\n // return;\n }\n\n testA1 = a2; testB1 = b1;\n\n if ((a3 > testA1 && b4 > testB1) || (a4 > testA1 && b3 > testB1))\n {\n can++;\n // Console.WriteLine(\"Team 2\");\n // return;\n }\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u041f\u0415\u0420\u0412\u0410\u0413\u041e\n int can2 = 0;\n\n if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))\n can2++;\n\n if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))\n can2++;\n\n if (can == 2)\n Console.WriteLine(\"Team 2\");\n else if (can2 == 2)\n {\n if(!svinka)\n Console.WriteLine(\"Team 1\");\n else\n Console.WriteLine(\"Draw\");\n }\n else\n Console.WriteLine(\"Draw\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] pass1 = Console.ReadLine().Split(' ');\n string[] pass2 = Console.ReadLine().Split(' ');\n string[] pass3 = Console.ReadLine().Split(' ');\n string[] pass4 = Console.ReadLine().Split(' ');\n\n int a1 = Convert.ToInt32(pass1[0]);\n int b1 = Convert.ToInt32(pass1[1]);\n int a2 = Convert.ToInt32(pass2[0]);\n int b2 = Convert.ToInt32(pass2[1]);\n int a3 = Convert.ToInt32(pass3[0]);\n int b3 = Convert.ToInt32(pass3[1]);\n int a4 = Convert.ToInt32(pass4[0]);\n int b4 = Convert.ToInt32(pass4[1]);\n\n // \u0410\u0421\u0410\u0411\u042b\u0419 \u0421\u041b\u0423\u0427\u0410\u0419 - \u041e\u0414\u0418\u041d\u0410\u041a\u041e\u0412\u041e \u0418\u0413\u0420\u041e\u041a\u0418\n bool svinka = false;\n if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)\n svinka = true;\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u0412\u0422\u041e\u0420\u041e\u0413\u0410\n if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))\n if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))\n {\n Console.WriteLine(\"Team 2\");\n\n return;\n }\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u041f\u0415\u0420\u0412\u0410\u0413\u041e\n if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))\n if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))\n {\n if (!svinka)\n Console.WriteLine(\"Team 1\");\n else\n Console.WriteLine(\"Draw\");\n \n return;\n }\n\n Console.WriteLine(\"Draw\");\n\n return;\n }\n }\n}\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace RCC2014\n{\n\tclass QR_C\n\t{\n\t\tprivate int beat(int a_atk, int a_def, int b_atk, int b_def)\n\t\t{\n\t\t\tif (a_atk > b_atk && a_def > b_def) return 1;\n\t\t\tif (b_atk > a_atk && b_def > a_def) return -1;\n\t\t\treturn 0;\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint i, j, res, ans;\n\t\t\tint[,] team;\n\t\t\tstring[] ans_words = { \"Team 2\", \"Draw\", \"Team 1\" };\n\n\t\t\tteam = new int[4, 2];\n\t\t\tfor (i = 0; i < 4; i++)\n\t\t\t\tfor (j = 0; j < 2; j++)\n\t\t\t\t\tteam[i, j] = xoi.ReadInt();\n\n\t\t\tfor (i = 0, ans = -1999; i <= 1; i++)\n\t\t\t{\n\t\t\t\tfor (j = 2, res = 1999; j <= 3; j++)\n\t\t\t\t\tres = Math.Min(res, beat(team[i, 1], team[1 - i, 0], team[j, 1], team[5 - j, 0]));\n\t\t\t\tans = Math.Max(ans, res);\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans_words[ans + 1]);\n\t\t}\n\t}\n\t\n\tclass RCC2014_QR\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tXOI xoi = new XOI();\n\t\t\t(new QR_C()).Solve(xoi);\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\t\t\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Kicker\n{\n internal class Program\n {\n private static readonly StreamReader reader =\n new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n\n private static readonly StreamWriter writer =\n new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n var tt = new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n string[] ss = reader.ReadLine().Split(' ');\n int a = int.Parse(ss[0]);\n int d = int.Parse(ss[1]);\n tt[i, 0] = a;\n tt[i, 1] = d;\n }\n\n bool fwin = false;\n int swin = 0;\n\n for (int i = 0; i < 2; i++)\n {\n int a1 = tt[i, 0];\n int b1 = tt[1 - i, 1];\n int s1 = 0, s2 = 0;\n for (int j = 2; j < 4; j++)\n {\n int a2 = tt[j, 0];\n int b2 = tt[5 - j, 1];\n\n if (a2 > b1 && b2 > a1)\n s2++;\n if (a2 < b1 && b2 < a1)\n s1++;\n }\n if (s1 == 2)\n fwin = true;\n if (s2 > 1)\n swin++;\n }\n\n if (fwin)\n writer.WriteLine(\"Team 1\");\n else if (swin == 2)\n writer.WriteLine(\"Team 2\");\n else\n {\n writer.WriteLine(\"Draw\");\n }\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\n\nint max1=a[0,0]+a[1,1];\nif (max1>=a[0,1]+a[1,0])\n{powAttack1=a[1,1];\n powProtect1=a[0,0];\n}\nelse\n{powAttack1=a[0,1];\n powProtect1=a[1,0];\n\n}\n max1=a[2,0]+a[3,1];\n int powAttack21=0;\n int powProtect21 = 0;\nif (max1>a[2,1]+a[3,0])\n{powAttack2=a[3,1];\n powProtect2=a[2,0];\n}\nelse\n if (max1 < a[2, 1] + a[3, 0])\n {\n powAttack2 = a[2, 1];\n powProtect2 = a[3, 0];\n\n }\n else\n {\n powAttack2 = a[3, 1];\n powProtect2 = a[2, 0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n }\n\n\nif((powProtect1 > powProtect2) && (powAttack1 > powAttack2)){\nConsole.WriteLine(win1);\n}else if(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21))){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\n powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\nif ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect11 < powProtect2) && (powAttack11 < powAttack2))||((powProtect11 < powProtect21) && (powAttack11 < powAttack21)))){\n\nConsole.WriteLine(win2);\n}\nelse if (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21)) || ((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))\n{ Console.WriteLine(win1);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\n powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n\nif (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21))||((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))\n{\nConsole.WriteLine(win1);\n}else if ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\n powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n if ((((powProtect1 < powAttack2) && (powAttack1 < powProtect2)) || ((powProtect1 < powAttack21) && (powAttack1 < powProtect21))) && (((powProtect11 < powAttack2) && (powAttack11 < powProtect2)) || ((powProtect11 < powAttack21) && (powAttack11 < powProtect21))))\n {\n\nConsole.WriteLine(win2);\n}\n else if (((powProtect11 > powAttack2) && (powAttack11 > powProtect2) && (powProtect11 > powProtect21) && (powAttack11 > powProtect21)) || ((powProtect1 > powAttack2) && (powAttack1 > powProtect2) && (powProtect1 > powAttack21) && (powAttack1 > powProtect21)))\n{ Console.WriteLine(win1);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\n\nint max1=a[0,0]+a[1,1];\nif (max1>=a[0,1]+a[1,0])\n{powAttack1=a[1,1];\n powProtect1=a[0,0];\n}\nelse\n{powAttack1=a[0,1];\n powProtect1=a[1,0];\n\n}\n max1=a[2,0]+a[3,1];\n int powAttack21=0;\n int powProtect21 = 0;\nif (max1>a[2,1]+a[3,0])\n{powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n}\nelse\n if (max1 < a[2, 1] + a[3, 0])\n {\n powAttack2 = a[2, 1];\n powProtect2 = a[3, 0];\n powAttack21 = a[3, 1];\n powProtect21 = a[2, 0];\n\n }\n else\n {\n powAttack2 = a[3, 1];\n powProtect2 = a[2, 0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n }\n\n\nif ((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21))\n{\nConsole.WriteLine(win1);\n}else if(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21))){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\nint powProtect11 = 0;\nint powAttack11 = 0;\nint powProtect21 = 0;\nint powAttack21 = 0;\npowAttack1 = a[1, 1];\npowProtect1 = a[0, 0];\npowAttack11 = a[0, 1];\npowProtect11 = a[1, 0];\n\n powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n\nif (((powProtect11 > powProtect2) && (powAttack11 > powAttack2) && (powProtect11 > powProtect21) && (powAttack11 > powAttack21))||((powProtect1 > powProtect2) && (powAttack1 > powAttack2) && (powProtect1 > powProtect21) && (powAttack1 > powAttack21)))\n{\nConsole.WriteLine(win1);\n}else if ((((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21)))&&(((powProtect11 < powProtect2) && (powAttack11 < powAttack2))||((powProtect11 < powProtect21) && (powAttack11 < powAttack21)))){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\n\nint max1=a[0,0]+a[1,1];\nif (max1>=a[0,1]+a[1,0])\n{powAttack1=a[1,1];\n powProtect1=a[0,0];\n}\nelse\n{powAttack1=a[0,1];\n powProtect1=a[1,0];\n\n}\n max1=a[2,0]+a[3,1];\nif (max1>=a[2,1]+a[3,0])\n{powAttack2=a[3,1];\n powProtect1=a[2,0];\n}\nelse\n{powAttack2=a[2,1];\n powProtect2=a[3,0];\n\n}\n\n\nif((powProtect1 > powProtect2) && (powAttack1 > powAttack2)){\nConsole.WriteLine(win1);\n}else if((powProtect1 < powProtect2) && (powAttack1 < powAttack2)){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contest\n{\n class Program\n {\n static void Main()\n {\n var s=\" \";\n string[] all;\n int[,] a=new int[4,2];\n for (int i = 0; i < 4; i++)\n {\n s=Console.ReadLine();\n all = s.Split(' ');\n a[i, 0] = Convert.ToInt32(all[0]);\n a[i, 1] = Convert.ToInt32(all[1]);\n }\n String win1 = \"Team 1\";\nString win2 = \"Team 2\";\nString draw = \"Draw\";\n\nint powProtect1 = 0;\nint powAttack1 = 0;\nint powProtect2 = 0;\nint powAttack2 = 0;\n\nint max1=a[0,0]+a[1,1];\nif (max1>=a[0,1]+a[1,0])\n{powAttack1=a[1,1];\n powProtect1=a[0,0];\n}\nelse\n{powAttack1=a[0,1];\n powProtect1=a[1,0];\n\n}\n max1=a[2,0]+a[3,1];\n int powAttack21=0;\n int powProtect21 = 0;\nif (max1>a[2,1]+a[3,0])\n{powAttack2=a[3,1];\n powProtect2=a[2,0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n}\nelse\n if (max1 < a[2, 1] + a[3, 0])\n {\n powAttack2 = a[2, 1];\n powProtect2 = a[3, 0];\n powAttack21 = a[3, 1];\n powProtect21 = a[2, 0];\n\n }\n else\n {\n powAttack2 = a[3, 1];\n powProtect2 = a[2, 0];\n powAttack21 = a[2, 1];\n powProtect21 = a[3, 0];\n }\n\n\nif((powProtect1 > powProtect2) && (powAttack1 > powAttack2)){\nConsole.WriteLine(win1);\n}else if(((powProtect1 < powProtect2) && (powAttack1 < powAttack2))||((powProtect1 < powProtect21) && (powAttack1 < powAttack21))){\nConsole.WriteLine(win2);\n}else{\nConsole.WriteLine(draw);\n}\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\nusing System.Threading;\nusing System.Linq;\n \nclass TEST{\n\tstatic void Main(){\n\t\tPlayer[] P=new Player[4];\n\t\tfor(int i=0;i<4;i++){\n\t\t\tvar s=Console.ReadLine().Split(' ');\n\t\t\tP[i]=new Player(int.Parse(s[0]),int.Parse(s[1]));\n\t\t}\n\t\t\n\t\tint[][] Score=new int[2][];\n\t\tfor(int i=0;i<2;i++)Score[i]=new int[2];\n\t\t\n\t\tint off1=0;\n\t\tint off2=0;\n\t\tint def1=0;\n\t\tint def2=0;\n\n\t\tfor(int i=0;i<2;i++){\n\t\t\tif(i==0){off1=P[0].Off;def1=P[1].Def;}\n\t\t\tif(i==1){off1=P[1].Off;def1=P[0].Def;}\n\t\t\t\n\t\t\tfor(int j=0;j<2;j++){\n\t\t\t\tif(j==0){off2=P[2].Off;def2=P[3].Def;}\n\t\t\t\tif(j==1){off2=P[3].Off;def2=P[2].Def;}\n\t\t\t\t\n\t\t\t\tif(off1>off2 && def1>def2){Score[i][j]=1;continue;}\n\t\t\t\tif(off1off2 && def1>def2){Score[i][j]=1;continue;}\n\t\t\t\tif(off1 d && b > c) return true;\n return false;\n }\n\n void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n }\n\n class Player\n {\n public Player() { }\n public Player(int _a, int _d)\n {\n this.Attak = _a;\n this.Defence = _d;\n }\n public int Attak;\n public int Defence;\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n Solver task = new Solver();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\n\nnamespace Algorithm\n{\n class Solver\n {\n Player[] a = new Player[4];\n\n public void Run()\n {\n for (int i = 0; i < 4; i++)\n {\n string[] tokens = cin.ReadLine().Split();\n int x = int.Parse(tokens[0]);\n int y = int.Parse(tokens[1]);\n a[i] = new Player(x, y);\n }\n\n if (can_win(a[0].Defence, a[1].Attak, a[2].Defence, a[3].Attak) &&\n can_win(a[0].Defence, a[1].Attak, a[3].Defence, a[2].Attak))\n {\n cout.WriteLine(\"Team 1\");\n return;\n }\n if (can_win(a[1].Defence, a[0].Attak, a[2].Defence, a[3].Attak) &&\n can_win(a[1].Defence, a[0].Attak, a[3].Defence, a[2].Attak))\n {\n cout.WriteLine(\"Team 1\");\n return;\n }\n\n int cnt = 0;\n if (can_win(a[2].Defence, a[3].Attak, a[0].Defence, a[1].Attak) ||\n can_win(a[3].Defence, a[2].Attak, a[1].Defence, a[0].Attak)) cnt++;\n if (can_win(a[2].Defence, a[3].Attak, a[0].Defence, a[1].Attak) &&\n can_win(a[3].Defence, a[2].Attak, a[1].Defence, a[0].Attak)) cnt++;\n if (cnt == 2)\n cout.WriteLine(\"Team 2\");\n else\n cout.WriteLine(\"Draw\");\n }\n\n bool can_win(int a, int b, int c, int d)\n {\n if (a > d && b > c) return true;\n return false;\n }\n\n void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n public StreamReader cin = null;\n public StreamWriter cout = null;\n }\n\n class Player\n {\n public Player() { }\n public Player(int _a, int _d)\n {\n this.Attak = _a;\n this.Defence = _d;\n }\n public int Attak;\n public int Defence;\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n Solver task = new Solver();\n#if DEBUG\n task.cin = new StreamReader(\"input.txt\");\n task.cout = new StreamWriter(\"output.txt\");\n#else\n task.cin = new StreamReader(Console.OpenStandardInput());\n task.cout = new StreamWriter(Console.OpenStandardOutput());\n#endif\n task.cout.AutoFlush = true;\n task.Run();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ContestA\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] pass1 = Console.ReadLine().Split(' ');\n string[] pass2 = Console.ReadLine().Split(' ');\n string[] pass3 = Console.ReadLine().Split(' ');\n string[] pass4 = Console.ReadLine().Split(' ');\n\n int a1 = Convert.ToInt32(pass1[0]);\n int b1 = Convert.ToInt32(pass1[1]);\n int a2 = Convert.ToInt32(pass2[0]);\n int b2 = Convert.ToInt32(pass2[1]);\n int a3 = Convert.ToInt32(pass3[0]);\n int b3 = Convert.ToInt32(pass3[1]);\n int a4 = Convert.ToInt32(pass4[0]);\n int b4 = Convert.ToInt32(pass4[1]);\n\n // \u0410\u0421\u0410\u0411\u042b\u0419 \u0421\u041b\u0423\u0427\u0410\u0419 - \u041e\u0414\u0418\u041d\u0410\u041a\u041e\u0412\u041e \u0418\u0413\u0420\u041e\u041a\u0418\n bool svinka = false;\n if (a1 == a3 || a2 == a4 || b1 == b3 || b2 == b4)\n svinka = true;\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u0412\u0422\u041e\u0420\u041e\u0413\u0410\n if ((a3 > a1 && b4 > b2) || (a4 > a1 && b3 > b2))\n if ((a3 > a2 && b4 > b1) || (a4 > a2 && b3 > b1))\n {\n Console.WriteLine(\"Team 2\");\n\n return;\n }\n\n // \u0412\u0418\u0413\u0420\u042b\u0428 \u041f\u0415\u0420\u0412\u0410\u0413\u041e\n if ((a1 > a3 && b2 > b4) || (a2 > a3 && b1 > b4))\n if ((a1 > a4 && b2 > b3) || (a2 > a4 && b1 > b3))\n {\n //if (!svinka)\n Console.WriteLine(\"Team 1\");\n //else\n // Console.WriteLine(\"Draw\");\n \n return;\n }\n\n Console.WriteLine(\"Draw\");\n\n return;\n }\n }\n}\n"}], "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int result = 0;\n\n string s = Console.ReadLine();\n\n for (int i = 0; i < s.Length; i++)\n {\n var ss = s.Substring(0, s.Length - i);\n var r = new String(ss.ToCharArray().Reverse().ToArray());\n\n if (ss != r)\n {\n result = ss.Length;\n break;\n }\n }\n\n Console.WriteLine(result);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\nnamespace helloworld\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n\n int n = 0;\n\n while (n<=s.Length)\n {\n for(int i = 0; i <= n; i++)\n {\n if (!IsPalindrome(s.Substring(i, s.Length - n)))\n {\n Console.Write(s.Length - n);\n return;\n }\n }\n n++;\n }\n Console.Write(0);\n\n }\n\n private static bool IsPalindrome(string s)\n {\n for(int i = 0; i < s.Length / 2; i++)\n {\n if (s[i] != s[s.Length - 1 - i]) return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static public bool IsPalindrom(string str)\n {\n int c = str.Length / 2;\n for (int i = 0; i < c; i++)\n {\n if (str[i] != str[str.Length - 1 - i])\n return false;\n }\n return true;\n }\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n if (!IsPalindrom(str))\n Console.WriteLine(str.Length);\n else if (str.Distinct().Count() > 1)\n Console.WriteLine(str.Length - 1);\n else Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Olympiad\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] word = Console.ReadLine().ToCharArray();\n int len = 0;\n if(word.Length%2==0)\n {\n len = word.Length / 2;\n }\n else\n {\n len = word.Length / 2 + 1;\n }\n bool pal = true;\n for (int i = 0; i < len; i++)\n {\n if(word[i]!=word[word.Length-i-1])\n {\n pal = false;\n break;\n }\n }\n\n if(!pal)\n {\n Console.WriteLine(word.Length);\n }\n else\n {\n bool oneSymb = true;\n for (int i = 0; i < word.Length-1; i++)\n {\n if (word[i] != word[i+1])\n {\n oneSymb = false;\n break;\n }\n }\n if(!oneSymb)\n {\n Console.WriteLine(word.Length-1);\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _981A\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n Console.WriteLine(s.Distinct().Count() == 1 ? 0 : s.Length - (s == new string(s.Reverse().ToArray()) ? 1 : 0));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Avito_Code_Challenge_2018\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n for (int i = 0; i < str.Length; i++)\n {\n var pol = new string(str.Substring(i).Reverse().ToArray());\n if (!str.Substring(i).Equals(pol))\n {\n Console.WriteLine(str.Length-i);\n // Console.ReadKey();\n return;\n }\n }\n Console.WriteLine(\"0\");\n //\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Egor\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring inp = Console.ReadLine ();\n\t\t\tint n = inp.Length;\n\t\t\tstring pal = \"\";\n\t\t\tint res = 55;\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tfor (int j = n - 1 - i; j >= 0; j--) pal += inp [j].ToString();\n\t\t\t\tif (inp.Substring(0, n - i) != pal) {\n\t\t\t\t\tres = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tpal = \"\";\n\t\t\t}\n\t\t\tif (res == 55) Console.WriteLine (0);\n\t\t\telse Console.WriteLine (n - res);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Antipalindrom\n{\n class Program\n {\n static bool IsPalindrom(string s)\n {\n int n = s.Length;\n bool isPalind=true;\n for (int i = 0; i < n / 2 && isPalind; i++)\n {\n if (s[i]!=s[n-i-1])\n {\n isPalind = false;\n }\n }\n return isPalind;\n }\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int maxLength = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = s.Length - 1; j > i; j--)\n {\n int len=j-i+1;\n if (len > maxLength && !IsPalindrom(s.Substring(i, len))) maxLength = len;\n }\n }\n\n Console.Write(maxLength);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Antipalindrome\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n string s = reader.ReadLine();\n\n bool ok = true;\n for (int i = 0, j = s.Length - 1; i < j; i++,j--)\n {\n if (s[i] != s[j])\n {\n ok = false;\n break;\n }\n }\n if (!ok)\n return s.Length;\n\n for (int i = 1; i < s.Length; i++)\n {\n if (s[i] != s[i - 1])\n return s.Length - 1;\n }\n\n return 0;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n if (x != null)\n p.Out(x);\n }\n \n object Solve()\n {\n var s = Read();\n var max = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = 1; j < s.Length - i + 1; j++)\n {\n var s2 = s.Substring(i, j);\n if (max < s2.Length && !IsPalindrom(s2))\n max = s2.Length;\n }\n }\n\n return max;\n }\n\n bool IsPalindrom(string s)\n {\n for (int k = 0; k < s.Length / 2; k++)\n {\n if (s[k] != s[s.Length - k - 1])\n return false;\n }\n\n return true;\n }\n void DFS(List[] graph, List> result, long current, bool[] visited)\n {\n visited[current] = true;\n foreach (var item in graph[current])\n {\n\n }\n }\n\n long CountAns(int pow, long k, long[] hopes, long[] fact, int addedOnes)\n {\n long res = 0;\n for (int i = 0; i <= pow; i++)\n {\n int realOnes = i + addedOnes;\n if (realOnes > 1000)\n break;\n if (realOnes > 0 && hopes[realOnes] == k - 1)\n res = (res + fact[pow] * fastpow(fact[i] * fact[pow - i] % commonMod, commonMod - 2)) % commonMod;\n }\n return res;\n }\n\n int CountOnes(int i)\n {\n int res = 0;\n while (i != 0)\n {\n if ((i & 1) == 1)\n res++;\n i >>= 1;\n }\n return res;\n }\n\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n }\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n using System.Runtime.Remoting.Channels;\n using System.Text;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n\n private bool IsPalindrome(string s, int start, int end)\n {\n for (var i = start; i <= (start + end) / 2; i++) {\n if (s[i] != s[end - (i - start)])\n return false;\n }\n\n return true;\n }\n \n public void Solve()\n {\n var s = sr.NextString();\n var max = 0;\n for (var i = 0; i < s.Length; i++) {\n for (var j = i + 1; j < s.Length; j++) {\n if (!IsPalindrome(s, i, j)) {\n max = Math.Max(max, j - i + 1);\n }\n }\n }\n\n sw.WriteLine(max);\n }\n \n ~Task()\n {\n Dispose(false);\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n static void main()\n {\n\n \n\n }\n\n private static int Nod(decimal n, decimal d)\n {\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n var temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return (int)d;\n return 0;\n }\n\n static int Count(string source, string key)\n {\n\n\n List indices = new List();\n\n int index = source.IndexOf(key, 0);\n\n while (index > -1)\n {\n indices.Add(index);\n index = source.IndexOf(key, index + key.Length);\n }\n\n return indices.Count();\n }\n\n private static string Reverse(string s)\n {\n string s2 = \"\";\n\n for (int i = s.Length - 1; i >= 0; i--)\n {\n s2 += s[i];\n }\n\n return s2;\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string s = Console.ReadLine(), s1 = s, s2 = \"\", s3 = s, s4 = \"\";\n for (int i = s.Length - 1; i >= 0; i--)\n {\n s2 += s[i];\n }\n\n\n \n s4 = s2;\n\n while (s1.Equals(s2) && s3.Equals(s4) && s1.Length > 0)\n {\n s1 = s1.Substring(0, s1.Length - 1);\n s2 = s2.Substring(1, s2.Length - 1);\n s3 = s3.Substring(1, s3.Length - 1);\n s4 = s4.Substring(0, s4.Length - 1);\n }\n\n Console.WriteLine(s1.Length);\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace bla\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n Console.WriteLine(solve(s));\n }\n\n static int solve(string s)\n {\n if (s == \"\")\n return 0;\n if (!ispalindrome(s))\n return s.Length;\n s = s.Substring(0, s.Count() - 1);\n return solve(s);\n }\n\n static bool ispalindrome(string s)\n {\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != s[s.Length - 1 - i])\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n\n Int32 currentLength = input.Length;\n while (currentLength > 1)\n {\n for (Int32 i = 0; i <= input.Length - currentLength; i++)\n {\n if (!IsPalindrome(input, i, currentLength))\n {\n Console.WriteLine(currentLength);\n return;\n }\n }\n currentLength--;\n } \n Console.WriteLine(0);\n }\n\n private static Boolean IsPalindrome(String str, Int32 startIndex, Int32 length)\n {\n for (Int32 i = startIndex; i <= startIndex + length / 2; i++)\n {\n if (str[i] != str[startIndex + length - i - 1])\n return false;\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(), s1 = s, s2 = \"\", s3 = s, s4 = \"\";\n for(int i = s.Length - 1; i >= 0; i--)\n s2 += s[i];\n s4 = s2;\n while (s1.Equals(s2) && s3.Equals(s4) && s1.Length > 0)\n {\n s1 = s1.Substring(0, s1.Length - 1);\n s2 = s2.Substring(1, s2.Length - 1);\n s3 = s3.Substring(1, s3.Length - 1);\n s4 = s4.Substring(0, s4.Length - 1);\n }\n Console.WriteLine(s1.Length);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CF_981_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n // \u041a\u043e\u0441\u0442\u044b\u043b\u0438\u043a\n if (str.Length == 2)\n {\n if (str[0] == str[1])\n Console.WriteLine(0);\n else\n Console.WriteLine(2);\n return;\n }\n\n // \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 40 \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0435\u0437 \u043a\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439\n\n for (int i = 0; i < str.Length-2; i++)\n {\n for (int j = str.Length-i; j > 1; j--)\n {\n if (!IsPalindrom(str.Substring(i, j)))\n {\n Console.WriteLine(j);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n\n private static bool IsPalindrom(string v)\n {\n int i = 0;\n int j = v.Length - 1;\n while (i max)\n {\n p = true;\n break;\n }\n char a = S[min];\n char b = S[max];\n if (char.ToLower(a) != char.ToLower(b))\n {\n p = false;\n break;\n }\n min++;\n max--;\n }\n\n int k = S[0];\n bool s = false;\n for (int i = 0; i < S.Length; i++)\n {\n if (S[i] != S[0])\n s = true;\n }\n\n if (!p)\n Console.WriteLine(S.Length);\n else if (p && !s)\n Console.WriteLine(\"0\");\n else if (p && s)\n Console.WriteLine(S.Length - 1);\n }\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nnamespace SolutionsForCodeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string MyString = Console.ReadLine();\n if (!IsPalindrom(MyString))\n {\n Console.WriteLine(MyString.Length);\n return;\n }\n else\n {\n MyString = MyString.Remove(0, 1);\n if (!IsPalindrom(MyString))\n {\n Console.WriteLine(MyString.Length);\n return;\n }\n else Console.WriteLine(\"0\");\n }\n }\n static bool IsPalindrom(string s)\n {\n var Array = s.ToCharArray();\n var ReversedArray = (char[])Array.Clone();\n System.Array.Reverse(ReversedArray);\n bool IsGood = true;\n for (int i = 0; i < Array.Length; i++)\n {\n if (Array[i] != ReversedArray[i])\n {\n IsGood = false;\n }\n }\n return IsGood;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforce\n{\n class Program\n {\n static int Main(string[] args)\n {\n string input = Console.ReadLine();\n for (int i = 0; i < input.Length; i++)\n {\n string temp = input.Substring(i);\n if (!PaliCheck(temp))\n {\n Console.Write(temp.Length.ToString());\n //Console.Read();\n return 0;\n }\n }\n Console.Write(0);\n //Console.Read();\n return 0;\n }\n\n static bool PaliCheck(string input)\n {\n char[] inArr = input.ToCharArray();\n //Array.Reverse(inArr); //didn't work in Mono\n char[] temp = new char[inArr.Length];\n for (int i = 0, j = inArr.Length - 1; i < inArr.Length; i++, j--)\n {\n temp[j] = inArr[i];\n }\n string reversed = new string(temp);\n //Console.WriteLine(\"Input = \" + input + \"\\n Revesed = \" + reversed);\n if (input == reversed) return true;\n else return false;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n var s = ReadLine();\n int n = s.Length;\n for (int i = n; i >= 0; i--)\n {\n bool isPal = true;\n for (int j = 0; j < i; j++)\n {\n if (s[j] != s[i - j - 1])\n {\n isPal = false;\n break;\n }\n }\n if (!isPal)\n {\n Writer.WriteLine(i);\n return;\n }\n }\n Writer.WriteLine(0);\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n Solve();\n /*Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();*/\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_CS\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n while (IsPalindrom(s) && s.Length > 0)\n s = s.Remove(s.Length - 1, 1);\n\n Console.WriteLine(s.Length);\n }\n\n static bool IsPalindrom(string s)\n {\n for (int i = 0; i < s.Length / 2; i++)\n if (s[i] != s[s.Length - i - 1])\n return false;\n return true;\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n static void main()\n {\n\n \n\n }\n\n private static int Nod(decimal n, decimal d)\n {\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n var temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return (int)d;\n return 0;\n }\n\n static int Count(string source, string key)\n {\n\n\n List indices = new List();\n\n int index = source.IndexOf(key, 0);\n\n while (index > -1)\n {\n indices.Add(index);\n index = source.IndexOf(key, index + key.Length);\n }\n\n return indices.Count();\n }\n\n private static string Reverse(string s)\n {\n string s2 = \"\";\n\n for (int i = s.Length - 1; i >= 0; i--)\n {\n s2 += s[i];\n }\n\n return s2;\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string s = Console.ReadLine(), s1 = s, s2 = \"\", s3 = s, s4 = \"\";\n s = Reverse(s);\n \n s4 = s2;\n\n while (s1.Equals(s2) && s3.Equals(s4) && s1.Length > 0)\n {\n s1 = s1.Substring(0, s1.Length - 1);\n s2 = s2.Substring(1, s2.Length - 1);\n s3 = s3.Substring(1, s3.Length - 1);\n s4 = s4.Substring(0, s4.Length - 1);\n }\n\n Console.WriteLine(s1.Length);\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nnamespace CodeforcesTemplate\n{\n\n public static class Permutation\n {\n private static bool Next(ref int[] arr)\n {\n int k, j, l;\n for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }\n if (j == -1)\n {\n arr = arr.OrderBy(c => c).ToArray();\n return false;\n }\n for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }\n var tmp = arr[j];\n arr[j] = arr[l];\n arr[l] = tmp;\n for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)\n {\n tmp = arr[k];\n arr[k] = arr[l];\n arr[l] = tmp;\n }\n return true;\n }\n public static IEnumerable AllPermutations(int[] arr)\n {\n do yield return arr;\n while (Next(ref arr));\n }\n }\n\n public sealed class Crown\n {\n public decimal Gem { get; set; }\n\n public decimal Weight { get; set; }\n\n public decimal Value { get; set; }\n }\n\n class Program\n {\n private const string FILENAME = \"distance4\";\n\n private const string INPUT = FILENAME + \".in\";\n\n private const string OUTPUT = FILENAME + \".out\";\n\n private static Stopwatch _stopwatch = new Stopwatch();\n\n private static StreamReader _reader = null;\n private static StreamWriter _writer = null;\n\n private static string[] _curLine;\n private static int _curTokenIdx;\n\n private static char[] _whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n static void main()\n {\n\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int n = arr[0];\n int k = arr[1];\n\n List list = new List();\n\n for (int i = 0; i < n; i++)\n {\n decimal[] data = Console.ReadLine().Split().Select(decimal.Parse).ToArray();\n\n decimal gem = data[0];\n decimal weight = data[1];\n\n decimal value = gem / weight;\n\n list.Add(new Crown { Gem = gem, Weight = weight, Value = value });\n }\n\n List sortedList = list.OrderByDescending(x => x.Value).ThenBy(x => x.Weight).ToList();\n\n decimal start = 0;\n\n decimal end = 0;\n\n for (int i = 0; i < k; i++)\n {\n start += sortedList[i].Gem;\n\n end += sortedList[i].Weight;\n }\n\n if (end == 0)\n {\n end++;\n }\n\n if (start % 10 == 0 && end % 10 == 0)\n {\n start /= 10;\n end /= 10;\n }\n\n int nod = Nod(start, end);\n\n start /= nod;\n\n end /= nod;\n\n string res = start.ToString() + \"/\" + end.ToString();\n\n Console.WriteLine(res);\n\n }\n\n private static int Nod(decimal n, decimal d)\n {\n n = Math.Abs(n);\n d = Math.Abs(d);\n while (d != 0 && n != 0)\n {\n if (n % d > 0)\n {\n var temp = n;\n n = d;\n d = temp % d;\n }\n else break;\n }\n if (d != 0 && n != 0) return (int)d;\n return 0;\n }\n\n static int Count(string source, string key)\n {\n\n\n List indices = new List();\n\n int index = source.IndexOf(key, 0);\n\n while (index > -1)\n {\n indices.Add(index);\n index = source.IndexOf(key, index + key.Length);\n }\n\n return indices.Count();\n }\n\n private static bool Check(string s)\n {\n char[] arr = s.ToCharArray();\n\n Array.Reverse(arr);\n\n string res = new string(arr);\n\n if (s == res)\n {\n return true;\n }\n\n else\n {\n return false;\n }\n }\n\n private static string ReadNextToken()\n {\n if (_curTokenIdx >= _curLine.Length)\n {\n //Read next line\n string line = _reader.ReadLine();\n if (line != null)\n _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n _curLine = new string[] { };\n _curTokenIdx = 0;\n }\n\n if (_curTokenIdx >= _curLine.Length)\n return null;\n\n return _curLine[_curTokenIdx++];\n }\n\n private static int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n private static void RunTimer()\n {\n#if (DEBUG)\n\n _stopwatch.Start();\n\n#endif\n }\n\n private static void Main(string[] args)\n {\n\n#if (DEBUG)\n double before = GC.GetTotalMemory(false);\n#endif\n\n string str = Console.ReadLine();\n int n = str.Length;\n bool pal = true;\n for (int i = str.Length - 1; i > str.Length / 2; i--)\n {\n if (str[i] != str[str.Length - i - 1])\n pal = false;\n }\n if (!pal) { }\n else\n {\n while (pal && str.Length > 0)\n {\n str = str.Substring(0, str.Length - 1);\n for (int i = str.Length - 1; i >= str.Length / 2; i--)\n {\n if (str[i] != str[str.Length - i - 1])\n pal = false;\n }\n n--;\n }\n }\n Console.WriteLine(n);\n\n\n#if (DEBUG)\n _stopwatch.Stop();\n\n double after = GC.GetTotalMemory(false);\n\n double consumedInMegabytes = (after - before) / (1024 * 1024);\n\n Console.WriteLine($\"Time elapsed: {_stopwatch.Elapsed}\");\n\n Console.WriteLine($\"Consumed memory (MB): {consumedInMegabytes}\");\n\n Console.ReadKey();\n#endif\n\n\n }\n\n private static int CountLeadZeros(string source)\n {\n int countZero = 0;\n\n for (int i = source.Length - 1; i >= 0; i--)\n {\n if (source[i] == '0')\n {\n countZero++;\n }\n\n else\n {\n break;\n }\n\n }\n\n return countZero;\n }\n\n private static string ReverseString(string source)\n {\n char[] reverseArray = source.ToCharArray();\n\n Array.Reverse(reverseArray);\n\n string reversedString = new string(reverseArray);\n\n return reversedString;\n }\n\n\n private static int[] CopyOfRange(int[] src, int start, int end)\n {\n int len = end - start;\n int[] dest = new int[len];\n Array.Copy(src, start, dest, 0, len);\n return dest;\n }\n\n private static string StreamReader()\n {\n\n if (_reader == null)\n _reader = new StreamReader(INPUT);\n string response = _reader.ReadLine();\n if (_reader.EndOfStream)\n _reader.Close();\n return response;\n\n\n }\n\n private static void StreamWriter(string text)\n {\n\n if (_writer == null)\n _writer = new StreamWriter(OUTPUT);\n _writer.WriteLine(text);\n\n\n }\n\n\n private static int BFS(int start, int end, int[,] arr)\n {\n Queue> queue = new Queue>();\n List visited = new List();\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n visited.Add(false);\n }\n\n queue.Enqueue(new KeyValuePair(start, 0));\n KeyValuePair node;\n int level = 0;\n bool flag = false;\n\n while (queue.Count != 0)\n {\n node = queue.Dequeue();\n if (node.Key == end)\n {\n return node.Value;\n }\n flag = false;\n for (int i = 0; i < arr.GetLength(0); i++)\n {\n\n if (arr[node.Key, i] == 1)\n {\n if (visited[i] == false)\n {\n if (!flag)\n {\n level = node.Value + 1;\n flag = true;\n }\n queue.Enqueue(new KeyValuePair(i, level));\n visited[i] = true;\n }\n }\n }\n\n }\n return 0;\n\n }\n\n\n\n private static void Write(string source)\n {\n File.WriteAllText(OUTPUT, source);\n }\n\n private static string ReadString()\n {\n return File.ReadAllText(INPUT);\n }\n\n private static void WriteStringArray(string[] source)\n {\n File.WriteAllLines(OUTPUT, source);\n }\n\n private static string[] ReadStringArray()\n {\n return File.ReadAllLines(INPUT);\n }\n\n private static int[] GetIntArray()\n {\n return ReadString().Split(' ').Select(int.Parse).ToArray();\n }\n\n private static double[] GetDoubleArray()\n {\n return ReadString().Split(' ').Select(double.Parse).ToArray();\n }\n\n\n\n private static int[,] ReadINT2XArray(List lines)\n {\n int[,] arr = new int[lines.Count, lines.Count];\n\n for (int i = 0; i < lines.Count; i++)\n {\n int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\n for (int j = 0; j < lines.Count; j++)\n {\n arr[i, j] = row[j];\n }\n }\n\n return arr;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(), s1 = s, s2 = \"\", s3 = s, s4 = \"\";\n for(int i = s.Length - 1; i >= 0; i--)\n s2 += s[i];\n s4 = s2;\n while (s1.Equals(s2) && s3.Equals(s4) && s1.Length > 0)\n {\n s1 = s1.Substring(0, s1.Length - 1);\n s2 = s2.Substring(1, s2.Length - 1);\n s3 = s3.Substring(1, s3.Length - 1);\n s4 = s4.Substring(0, s4.Length - 1);\n }\n Console.WriteLine(s1.Length);\n Console.WriteLine(s2);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CF_981_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n for (int i = 0; i < str.Length-2; i++)\n {\n for (int j = str.Length-i; j > 1; j--)\n {\n if (!IsPalindrom(str.Substring(i, j)))\n {\n Console.WriteLine(j);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n\n private static bool IsPalindrom(string v)\n {\n int i = 0;\n int j = v.Length - 1;\n while (ifreshers)\n {\n int temp = veterans;\n veterans = freshers;\n freshers = temp;\n }\n }\n freshers = freshers - veterans;\n if (veterans <= freshers)\n Console.WriteLine(veterans);\n else\n {\n veterans -= freshers;\n Console.WriteLine(((veterans / 3*2) + (freshers) + (veterans % 3 == 2 ? 1 : 0)));\n }\n }\n }", "positive_code": [{"source_code": "using System;\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]), m = int.Parse(input[1]);\n int result = 0;\n while (true)\n {\n if (n <= m && n >= 1 && m >= 2)\n {\n result++;\n n--;\n m -= 2;\n }\n else if (n > m && n >= 2 && m >= 1)\n {\n result++;\n n -= 2;\n m--;\n }\n else\n break;\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]),\n m = int.Parse(s[1]),\n answer = 0;\n\n while (n >= 1 && m >= 2 || n >= 2 && m >= 1)\n {\n if (n >= 1 && m >= 2 && n <= m)\n {\n n--;\n m -= 2;\n }\n else\n {\n m--;\n n -= 2;\n }\n answer++;\n }\n Console.WriteLine(answer);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace Prog\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, res;\n\n string[] str = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n n = Convert.ToInt32(str[0]);\n m = Convert.ToInt32(str[1]);\n\n if (m < n)\n {\n res = n;\n n = m;\n m = res;\n }\n\n res = (n + m) / 3 < n ? (n + m) / 3 : n;\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\n\n// http://codeforces.com/problemset/problem/519/C\npublic class C___A_and_B_and_Team_Training\n{\n private static void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n\n int teams = 0;\n while ((a > 0 && b > 1) || (a > 1 && b > 0))\n {\n if (a > b)\n {\n a -= 2;\n b -= 1;\n } else\n {\n a -= 1;\n b -= 2;\n }\n teams++;\n }\n\n Write(teams);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var data = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = data[0];\n var m = data[1];\n var res = 0;\n while (n != 0 && m != 0 && (n != 1 || m != 1))\n {\n //if(n == 0 || m == 0 || (n == 1 && m == 1))\n // break;\n if (n > m)\n {\n n -= 2;\n m -= 1;\n res++;\n }\n else\n {\n n -= 1;\n m -= 2;\n res++;\n } \n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _1A\n{\n class Program\n {\n static void Main()\n {\n var input1 =Console.ReadLine().Split(' ').Select(long.Parse);\n var a = input1.First();\n var b = input1.Last();\n var c = (a + b)/3;\n var min = a > b ? b : a;\n if(c<=min)\n Console.WriteLine(c);\n else\n {\n Console.WriteLine(min);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n //int n = int.Parse(Console.ReadLine());\n int[] arr = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();\n int n = arr[0];\n int m = arr[1];\n int maxGroup = -1;\n for(int i = 0 ; i <= n ; i++){\n //if i is exp person single group\n int groupA = Math.Min(m,2*i);\n groupA = groupA / 2;\n int groupB = Math.Min(m - groupA * 2,(n-i)/2);\n maxGroup = Math.Max(groupA + groupB,maxGroup);\n }\n Console.WriteLine(maxGroup);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static void Main()\n {\n var args = Console.ReadLine().Split(' ');\n var n = int.Parse(args[0]);\n var m = int.Parse(args[1]);\n\n var min = n < m ? n : m;\n \n var result1 = (m + n)/3;\n var result = min < result1 ? min : result1;\n Console.WriteLine(result);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), ans = 0;\n for (int t1 = 0; t1 <= n / 2; t1++) {\n int t2 = Math.Min(n - 2 * t1, (m - t1) / 2);\n if (t1 <= m && t1 + t2 > ans) {\n ans = t1 + t2;\n }\n }\n Console.Write(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // A and B and Team Training (greedy, implementation, math, number theory)\n class _519C\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n if (m >= 2 * n) Console.WriteLine(n);\n else if (n >= 2 * m) Console.WriteLine(m);\n else Console.WriteLine((n + m) / 3);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace abTeamTraining\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n uint n = uint.Parse(s[0]);\n uint m = uint.Parse(s[1]);\n uint t = 0;\n while (n > 0 && m > 0 && (n > 1 || m > 1))\n {\n if (n >= m)\n {\n n -= 2; m -= 1;\n }\n else\n {\n m -= 2; n -= 1;\n }\n t++;\n }\n Console.WriteLine(t);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security.Principal;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n#if LOCAL_TEST\n private readonly TextReader inputStream = new StreamReader(\"input.txt\");\n#else\n private readonly TextReader inputStream = Console.In;\n#endif\n#if FBHC_TEST\n private readonly TextWriter outputStream = new StreamWriter(\"output.txt\");\n#else\n private readonly TextWriter outputStream = Console.Out;\n#endif\n\n private string[] tokens;\n private int pointer;\n\n public char NextChar()\n {\n try\n {\n var c = inputStream.Read();\n\n if (c < 0)\n c = 0;\n\n return (char)c;\n }\n catch (IOException)\n {\n return '\\0';\n }\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n var t = typeof(T);\n\n if (t == typeof(char))\n return (T)(object)NextChar();\n\n object s = NextString();\n\n if (t == typeof(string))\n return (T)s;\n\n return (T)Convert.ChangeType(s, typeof(T));\n }\n\n\n public IEnumerable NextWhile(Predicate pred)\n {\n if (pred == null)\n yield break;\n\n var res = Next();\n\n while (pred(res))\n {\n yield return res;\n\n res = Next();\n }\n }\n\n public IEnumerable NextSeq(long n)\n {\n for (var i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n var ienum = o as IEnumerable;\n\n if (ienum != null && typeof(T) != typeof(string))\n {\n var first = true;\n\n foreach (var iev in ienum)\n {\n if (!first && iev != null)\n Print(\" \");\n\n Print(iev);\n\n first = false;\n }\n\n }\n else\n {\n outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));\n }\n\n }\n\n\n public void PrintLine(T o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n public static void Each(this IEnumerable self, Action action)\n {\n foreach (var v in self)\n action(v);\n }\n\n public static string Reverse(this string s)\n {\n var charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static long MODPower(this int x, long y, long mod)\n {\n long answ = 1;\n\n if (y == 0)\n return answ;\n if (y % 2 == 1)\n answ *= x;\n\n answ *= MODPower(x, y / 2, mod) * MODPower(x, y / 2, mod);\n\n answ %= mod;\n\n return answ;\n }\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, Func, T> fval)\n {\n for (var i = 0; i < self.Count; i++)\n self[i] = fval(i, self);\n\n\n return self;\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n return self.Fill((x, slf) => fval(x));\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n return self.Fill(x => fval());\n }\n\n\n public static IList Fill(this IList self, T val)\n {\n return self.Fill(() => val);\n }\n\n public static long Hash(this IList self, Func val = null)\n {\n return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);\n }\n\n public static long Hash(this IList self, Func val)\n {\n return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));\n }\n\n\n public static long HashOne(this T self, long current)\n {\n return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));\n }\n\n\n public static IList BuildSegTree(this IList a, Func combine, Func convert)\n {\n var t = new T1[a.Count << 2];\n\n a.BuildSegTree(t, 1, 0, a.Count - 1, combine, convert);\n\n return t;\n }\n\n private static void BuildSegTree(this IList a, IList t, int v, int tl, int tr, Func combine, Func convert)\n {\n if (tl == tr)\n {\n t[v] = convert(a[tl]);\n }\n else\n {\n int tm = (tl + tr) >> 1;\n\n BuildSegTree(a, t, v << 1, tl, tm, combine, convert);\n BuildSegTree(a, t, (v << 1) + 1, tm + 1, tr, combine, convert);\n\n t[v] = combine(t[v << 1], t[(v << 1) + 1]);\n }\n }\n\n public static int Xor1n(this int n)\n {\n return (n >> 1) & 1 ^ ((n & 1) > 0 ? 1 : n);\n }\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override bool Equals(object obj)\n {\n var co = obj as P;\n\n return co != null && co.GetHashCode() == GetHashCode();\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = unchecked(hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode()));\n hash = unchecked(hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode()));\n return hash;\n\n }\n }\n\n #endregion\n\n\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (var io = new MyIo())\n {\n try\n {\n new Program(io)\n .Solve();\n }\n catch (Exception e)\n {\n io.PrintLine(e.Message + \"\\r\\n\" + e.StackTrace);\n\n throw;\n }\n }\n }\n\n\n\n #endregion\n\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n private void Solve()\n {\n\n int n = io.NextInt();\n int m = io.NextInt();\n int x = 0;\n int dx = 0;\n\n do\n {\n if (m > n)\n {\n int tmp = m;\n m = n;\n n = tmp;\n }\n\n if (m >= 1 && n >= 2)\n {\n dx = 1;\n n -= 2;\n m -= 1;\n }\n else\n dx = 0;\n\n x += dx;\n } while (dx > 0); \n\n io.Print(x);\n\n }\n\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();\n var n = arr[0];\n var m = arr[1];\n int cnt = 0;\n while (true)\n {\n if (n >= m)\n {\n if (n >= 2 && m >= 1)\n {\n n -= 2;\n m--;\n cnt++;\n }\n else\n break;\n }\n else\n {\n if (n >= 1 && m >= 2)\n {\n n--;\n m -= 2;\n cnt++;\n }\n else\n break;\n }\n }\n Console.Write(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\n\tpublic class main {\n\t\tpublic static void Main() {\n\t\t\tint n;\n\t\t\tint m;\n\t\t\tstring s = Console.ReadLine();\n\t\t\tn = int.Parse(s.Split()[0]);\n\t\t\tm = int.Parse(s.Split()[1]);\n\t\t\tint res = 0;\n\t\t\tif (n*2<=m) {\n\t\t\t\tres = n;\n\t\t\t} else if (n>=m*2) {\n\t\t\t\tres = m;\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tif (n=2 && m>=1) {\n\t\t\t\t\t\tn -= 2;\n\t\t\t\t\t\tm--;\n\t\t\t\t\t\tres++;\n\t\t\t\t\t}\n\t\t\t\t\telse break;\n\t\t\t\t} while (true);\n\t\t\t}\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\t}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Round_294\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n //Chess ch = new Chess();\n //ch.Test();\n //CompilationErrors ce = new CompilationErrors();\n //ce.Test();\n TeamTraining tt = new TeamTraining();\n tt.Test();\n }\n }\n class Chess\n {\n\n void Count(string[] board,out long cntb,out long cntw)\n {\n cntb=0;\n cntw=0;\n for(int i=0;icntw)Console.WriteLine(\"Black\");\n else if(cntb max) max = cnt;\n //}\n //Console.WriteLine(max);\n long cnt = 0;\n while(n>0&&m>0)\n {\n if (n > m) n--;\n else m--;\n n--;\n m--;\n if (n < 0 || m < 0) break;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n int Min(int a,int b)\n {\n return a < b ? a : b;\n }\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n \n\n static void Main(string[] args)\n {\n string []arr=new string[2];\n Int64 t1=0, t2=0, total=0;\n\n arr = Console.ReadLine().Split(' ');\n Int64 n=Convert.ToInt64(arr[0]);\n Int64 m=Convert.ToInt64(arr[1]);\n\n for(Int64 i=0; i <= n; i++){\n if ((n - i) >= 0 && (m - 2 * i) >= 0)\n {\n t1 = i;\n t2 = Math.Min(m - 2 * i, (n - i) / 2);\n if ((t1 + t2) > total) { total = t1 + t2; }\n }\n else break;\n }\n Console.WriteLine(total);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Contest\n{\nclass MainClass{\n public static void Main (string[] args){\n long n,s=0,k,ss=0;\n string[] st=Console.ReadLine().Split(' ');\n n=long.Parse(st[0]);\n k=long.Parse(st[1]);\n \n if(nk)\n s=k;\n\n \n Console.WriteLine(s);\n }\n}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prC {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n int a = 0;\n while(n != 0 && m != 0) {\n if(n > m) {\n n -= 2;\n m--;\n }\n else if(m > n || m != 1) {\n n--;\n m -= 2;\n }\n else\n break;\n a++;\n }\n writer.WriteLine(a);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n\n int ans = 0;\n while (true)\n {\n if (ans > Math.Min(n, m) || n + m < 3 * ans)\n break;\n ans++;\n }\n Write(ans - 1);\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"subsequences.in\");\n //writer = new StreamWriter(\"subsequences.out\");\n#endif\n try\n {\n var thread = new Thread(new Solver().Solve, 1024 * 1024 * 256);\n thread.Start();\n thread.Join();\n //new Solver().Solve(); \n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication252\n{\n class Program\n {\n static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n int k = 0;\n while (true)\n {\n if (n <= 0 || m <= 0 || (n == 1 && m == 1))\n {\n break;\n }\n if (n <= m)\n {\n n--;\n m -= 2;\n k++;\n }\n else\n {\n n -= 2;\n m--;\n k++;\n }\n \n }\n Console.WriteLine(k);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Solving\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n //Console.ReadKey();\n }\n }\n }\n\n class Solver {\n public void Solve() {\n int[] arr = InputReader.ReadIntArr();\n int pro = arr[0], noob = arr[1], countofteam = 0;\n while ((pro >= 1 && noob >= 2) || (pro >= 2 && noob >= 1)) {\n if (pro >= noob && pro >= 2) { pro -= 2; noob--; countofteam++; }\n else if (pro < noob && noob >= 2) { pro--; noob -= 2; countofteam++; }\n }\n Console.WriteLine(countofteam);\n //Console.ReadKey();\n }\n }\n\n class InputReader {\n public static int[] ReadIntArr() {\n return Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n }\n public static long[] ReadLongArr() {\n return Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray();\n }\n public static double[] ReadDoubleArr() {\n return Console.ReadLine().Split(' ').Select(s => Double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static string[] ReadSplitString() {\n return Console.ReadLine().Split(' ').ToArray();\n }\n public static int ReadInt() {\n return Int32.Parse(Console.ReadLine());\n }\n public static long ReadLong() {\n return Int64.Parse(Console.ReadLine());\n }\n public static double ReadDouble() {\n return Double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);\n }\n public static int[][] ReadIntMatrix(int numberofrows) {\n int[][] matrix = new int[numberofrows][];\n for (int i = 0; i < numberofrows; i++) {\n matrix[i] = ReadIntArr();\n }\n return matrix;\n }\n public static string[] ReadStringLines(int numberoflines) {\n string[] arr = new string[numberoflines];\n for (int i = 0; i < numberoflines; i++) {\n arr[i] = Console.ReadLine().Trim();\n }\n return arr;\n }\n }\n\n class OutputWriter {\n public static void WriteArray(IEnumerable array) {\n Console.WriteLine(string.Join(\" \", array));\n }\n public static void WriteLines(IEnumerable array) {\n foreach (var a in array) { Console.WriteLine(a); }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = input[0];\n int m = input[1];\n \n int T = 0;\n\n if (m >= n * 2)\n {\n T += n;\n }\n else if (n >= m * 2)\n {\n T += m;\n }\n else\n {\n T = (m + n) / 3;\n }\n\n Console.WriteLine(T);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var teams = (nm[0] + nm[1]) / 3;\n Console.WriteLine(Math.Min(teams, Math.Min(nm[0], nm[1])));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp57\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int x = inp0[0];\n int n = inp0[1];\n int t = 0;\n while (x>=1&&n>=1)\n {\n if (x==1&&n==1)\n {\n break;\n }\n if (x>n)\n {\n x -= 2;\n n--;\n t++;\n continue;\n }\n else\n {\n x--;\n n -= 2;\n t++;\n\n }\n \n }\n Console.WriteLine(t);\n\n }\n \n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar a = getList();\n\t\t\tvar n = a[0];\n\t\t\tvar m = a[1];\n\t\t\tConsole.WriteLine(Min(n, Min(m, (n + m) / 3)));\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var O = s[0]; var H = s[1];\n int count = 0;\n while ( (O>=2 && H>=1)|| (O>=1 && H>=2))\n {\n count++;\n if (O > H) { O-=2;H--;}\n else { O--; H -= 2; }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] inputArray = Array.ConvertAll(Console.ReadLine().Split((char)32), int.Parse);\n\n Console.WriteLine(Math.Min(inputArray[0], Math.Min(inputArray[1], (inputArray[0] + inputArray[1]) / 3)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (Math.Min(x[0], x[1])*2 <= Math.Max(x[0], x[1]))\n {\n Console.WriteLine((Math.Min(x[0], x[1]) + Math.Min(x[0], x[1]) * 2) / 3);\n }\n else if (Math.Min(x[0], x[1]) * 2 > Math.Max(x[0], x[1]))\n {\n Console.WriteLine((Math.Min(x[0], x[1]) + Math.Max(x[0], x[1])) / 3);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sp = Console.ReadLine().Split();\n int n = int.Parse(sp[0]);\n int m = int.Parse(sp[1]);\n var tsk = new Task();\n Console.WriteLine(tsk.Sol(n,m));\n }\n }\n\n class Task\n {\n public int Sol(int n, int m)\n {\n int rs1 = 0;\n for(int i = 0; i <= n; ++i) \n rs1 = Math.Max( rs1, i + Math.Min((n - i) / 2, m - 2*i));\n\n\n return rs1;\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace topCoder\n{\n\tusing System;\n\tusing System.Collections.Generic;\n\n\tclass p3\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//p1 o = new p1();\n\t\t\t//o.foo();\n\n\t\t\t//p2 o = new p2();\n\t\t\t//o.foo();\n\n\t\t\tp3 o = new p3();\n\t\t\to.foo();\n\t\t}\n\t\tpublic void foo()\n\t\t{\n\t\t\tstring[] sp = Console.ReadLine().Split(' ');\n\t\t\tint n = int.Parse(sp[0]);\n\t\t\tint m = int.Parse(sp[1]);\n\n\t\t\tint x = Math.Min(n, m);\n\t\t\tfor (int i = x; i >= 0; i--)\n\t\t\t{\n\t\t\t\tif (n + m - i - i >= i)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar xp = cin.NextInt();\n\t\t\tvar nb = cin.NextInt();\n\t\t\tvar teams = xp;\n\t\t\twhile (teams > 0)\n\t\t\t{\n\t\t\t\tvar xpLeft = xp - teams;\n\t\t\t\tvar c = Math.Min(xpLeft, teams);\n\t\t\t\tvar lower = 2*teams - c;\n\t\t\t\tif (nb >= lower)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(teams);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tteams--;\n\t\t\t}\n\t\t\tConsole.WriteLine(0);\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var m = sc.Integer();\n var max = 0;\n for (int k = 0; k*2 <= n; k++)\n {\n var rem = n - k * 2;\n var rem2 = m - k;\n if (rem2 < 0)\n continue;\n var min = Math.Min(rem, rem2 / 2);\n max = Math.Max(k + min, max);\n }\n IO.Printer.Out.WriteLine(max);\n\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var n = init[0];\n var m = init[1];\n\n var ans = 0;\n while(true)\n {\n if (ans > Math.Min(n, m) || n + m < ans * 3)\n break;\n ans++;\n }\n\n \n\n Console.WriteLine(ans - 1);\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: pvkcse_tup\n * Date: 3/1/2015\n * Time: 10:46 AM\n * student At : Accet,KKdi\n * \n */\nusing System;\n\nnamespace cdf\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tTeam_Problem_Solver test = new Team_Problem_Solver();\n\t\t\ttest.Get_Data();\n\t\t\ttest.Solve();\n\t\t}\n\t}\n\tclass Team_Problem_Solver\n\t{\n\t\tpublic long[] INP = new long[2];\n\t\tpublic string[] s;\n\t\tpublic void Get_Data()\n\t\t{\n\t\t\ts = Console.ReadLine().Split(' ');\n\t\t\tINP[0] = Convert.ToInt64(s[0]);\n\t\t\tINP[1] = Convert.ToInt64(s[1]);\n\t\t}\n\t\tpublic void Solve()\n\t\t{\n\t\t\tlong ans = (INP[0]+INP[1])/3;\n\t\t\tif (ans > INP[0] && ans > INP[1])\n\t\t\t\tConsole.WriteLine(Math.Min(INP[0],INP[1]).ToString());\n\t\t\telse if (ans > INP[1])\n\t\t\t\tConsole.WriteLine(INP[1].ToString());\n\t\t\telse if (ans > INP[0])\n\t\t\t\tConsole.WriteLine(INP[0].ToString());\n\t\t\telse\n\t\t\t\tConsole.WriteLine(ans.ToString());\n\t\t}\n\t\t\n\t}\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * User: pvkcse_tup\n * Date: 3/1/2015\n * Time: 10:46 AM\n * student At : Accet,KKdi\n * \n */\nusing System;\n\nnamespace cdf\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tTeam_Problem_Solver test = new Team_Problem_Solver();\n\t\t\ttest.Get_Data();\n\t\t\ttest.Solve();\n\t\t}\n\t}\n\tclass Team_Problem_Solver\n\t{\n\t\tpublic long[] INP = new long[2];\n\t\tpublic string[] s;\n\t\tpublic void Get_Data()\n\t\t{\n\t\t\ts = Console.ReadLine().Split(' ');\n\t\t\tINP[0] = Convert.ToInt64(s[0]);\n\t\t\tINP[1] = Convert.ToInt64(s[1]);\n\t\t}\n\t\tpublic void Solve()\n\t\t{\n\t\t\tlong ans = (INP[0]+INP[1])/3;\n\t\t\tif (ans > INP[0] && ans > INP[1])\n\t\t\t\tConsole.WriteLine(Math.Min(INP[0],INP[1]).ToString());\n\t\t\telse if (ans > INP[1])\n\t\t\t\tConsole.WriteLine(INP[1].ToString());\n\t\t\telse if (ans > INP[0])\n\t\t\t\tConsole.WriteLine(INP[0].ToString());\n\t\t\telse\n\t\t\t\tConsole.WriteLine(ans.ToString());\n\t\t}\n\t\t\n\t}\n}"}, {"source_code": "using System;\n\nclass C519 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n if (n + n < m) m = n + n;\n if (m + m < n) n = m + m;\n Console.WriteLine((n + m) / 3);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n IO io = new IO();\n\n int i_N = io.ReadNextInt();\n int i_M = io.ReadNextInt();\n\n int i_Ans = 0;\n\n for (int i = 0; ; i++)\n {\n if (i_N > i_M)\n {\n if (i_N >= 2 && i_M >= 1)\n {\n i_N -= 2;\n i_M--;\n i_Ans++;\n }\n else\n {\n break;\n }\n }\n\n else\n {\n if (i_N >= 1 && i_M >= 2)\n {\n i_N--;\n i_M -= 2;\n i_Ans++;\n }\n else\n {\n break;\n }\n\n }\n }\n\n io.PutStr(i_Ans);\n }\n }\n\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public long ReadNextLong()\n {\n return long.Parse(ReadToken());\n }\n\n public int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public long[] ReadLongArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => long.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(double str)\n {\n Console.WriteLine(str);\n }\n\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n if (a[1] < a[0] * 2) a[0] = (a[1] + a[0]) / 3;\n Console.WriteLine(a[0]);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n var a= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int n=a[0],m=a[1],j=0;\n while(n!=0&&m!=0)\n {\n while(n>=m&&n>1&&m>0)\n {\n n-=2;\n m--;\n j++;\n }\n while(m>=n&&m>1&&n>0)\n {\n m-=2;\n n--;\n j++;\n }\n if(n==1&&m==1)\n break;\n }\n Console.Write(j);\n\n }\n \n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Test\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] s1 = s.Split(' ');\n int n = int.Parse(s1[0]);\n int m = int.Parse(s1[1]);\n int sum = 0;\n while(!(n==0||m==0||(n==1&&m==1)))\n {\n if (m > n)\n {\n m = m - 2;\n n = n - 1;\n sum++;\n }\n else {\n n = n - 2;\n m = m - 1;\n sum++;\n }\n }\n Console.WriteLine( sum);\n\n }\n\n\n }\n}\n\n \n"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] d = Console.ReadLine().Split(' ');\n int n = int.Parse(d[0]), m = int.Parse(d[1]), result = 0;\n\n for (int i = 0; i <= n; i++)\n {\n int leftn = n - i;\n int leftm = m - 2 * i;\n\n if (leftm >= 0) result = Math.Max(result, i + Math.Min(leftm, leftn / 2));\n }\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _519C\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int m = int.Parse(tokens[1]);\n\n Console.WriteLine(Math.Min((n + m) / 3, Math.Min(n, m)));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // The numbers of experienced and new guys\n var aNums = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n // Display results\n Console.WriteLine(Math.Min((aNums[0] + aNums[1]) / 3, Math.Min(aNums[0], aNums[1])));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str.Remove(str.IndexOf(' ')));\n int m = Convert.ToInt32(str.Substring(str.IndexOf(' ') + 1));\n int schet = 0;\n while ((n >= 2 && m >= 1) || (n >= 1 && m >= 2))\n {\n if (n > m)\n {\n n -= 2;\n --m;\n ++schet;\n }\n else\n {\n --n;\n m -= 2;\n ++schet;\n }\n }\n Console.WriteLine(schet);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if (n == 0 || m == 0) Console.WriteLine(0);\n else if (n / m <= 0.5) Console.WriteLine(n);\n else if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n Console.WriteLine((int)(n + m) / 3);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_b_V\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n Int64 n = Convert.ToInt64(s[0]);\n Int64 m = Convert.ToInt64(s[1]);\n int count = 0;\n while(n > 0 && m > 0)\n {\n if (n == 1 && m == 1)\n {\n break;\n }\n if (n >= m)\n {\n n -= 2;\n m--;\n count++;\n }\n else\n {\n n--;\n m-= 2;\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace A_and_B_and_Team_Training\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int count = 0;\n\n while (n > 0 && m > 0 && n + m > 2)\n {\n if (n < m)\n {\n count++;\n n--;\n m -= 2;\n }\n else\n {\n count++;\n n -= 2;\n m--;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(N*2<=M){\n\t\t\tConsole.WriteLine(N);\n\t\t\treturn;\n\t\t}\n\t\tint ans=0;\n\t\tfor(int i=N-1;i>=0;i--){\n\t\t\tif(M>=i && (M+(N-i))>=2*i){\n\t\t\t\tans=i;break;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t\t\n\t}\n\tint N,M;\n\tpublic Sol(){\n\t\tvar d=ria();\n\t\tN=d[0];M=d[1];\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class Program\n {\n private const int MAXN = 8000;\n\n public static void Main(string[] args)\n {\n var arr = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\n var n = arr[0];\n var m = arr[1];\n\n int count = 0;\n while (n > 0 && m > 0)\n {\n if (n == 1 && m == 1)\n {\n break;\n }\n\n if (n > m)\n {\n n -= 2;\n m -= 1;\n count++;\n }\n else\n {\n m -= 2;\n n -= 1;\n count++;\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]); //xp\n int m = int.Parse(r[1]); //nb\n int max = int.MinValue;\n for (int i = 0; i <= n; i++) //xp nb nb\n {\n int tekBr = i + Math.Min((n - i) / 2, m - 2 * i);\n if (tekBr > max) max = tekBr;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]); //xp\n int m = int.Parse(r[1]); //nb\n int max = int.MinValue;\n for (int i = 0; i <= n && m - 2 * i >= 0; i++) //i je broj timova (xp nb nb)\n {\n int tekBr = i + Math.Min((n - i) / 2, m - 2 * i);\n if (tekBr > max) max = tekBr;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n\n\n\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int ans = 0;\n\n int op = 0;\n int nov = 0;\n\n if (n <= 1 && m <= 1) ans = 0;\n else\n {\n if (n == m)\n {\n ans = 2 * (m / 3);\n\n if (m % 3 == 2) ans++;\n }\n else\n {\n op = n/2;\n nov = m/2;\n if (op <= m && nov <= n)\n {\n ans = n/3 + m/3;\n if ((n%3 == 2 && m%3 != 0) || (m%3 == 2 && n%3 != 0)) ans ++;\n }\n else\n {\n if (n > m)\n {\n ans = n / 2;\n\n if (m >= op)\n {\n ans += op;\n m -= op;\n if (m >= 2 && n % 2 == 1) ans++;\n }\n else\n {\n ans = m % op;\n }\n\n }\n\n if (n < m)\n {\n nov = m / 2;\n \n\n if (n >= nov)\n {\n ans += nov;\n n -= nov;\n if (n >= 2 && m % 2 == 1) ans++;\n }\n else\n {\n ans = n % nov;\n }\n\n }\n }\n\n\n \n }\n }\n\n Console.WriteLine(ans);\n\n\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeTrening\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int ans = 0;\n if (n > 1 || m > 1)\n {\n while (true)\n {\n if (n == 0) { break; }\n if (m == 0) { break; }\n if (n == 1 && m == 1) break;\n if (n > m) { ans++; n -= 2; m--; }\n else { ans++; n--; m -= 2; }\n }\n }\n Console.WriteLine( ans);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n int n = l[0], m = l[1];\n \n int cnt = 0;\n while(Math.Min(n,m)>0)\n {\n if(n>m)\n {\n n -= 2;m--;\n }\n else\n {\n n--;m -= 2;\n }\n if (n<0||m<0)\n break;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n int a, b;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n }\n int pairs = 0;\n if(a!=b)\n {\n if(a>b) { int temp = a; a = b; b = temp; }\n if (b - a >= a) { pairs = a; a = b = 0; }\n else { pairs = b - a; a -= pairs; b = a; }\n }\n Console.WriteLine(pairs += a * 2 / 3);\n }\n }"}, {"source_code": "using System;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int ToF = 0;\n int div = 0;\n if (n % 2 == 0) { div = n / 2; }\n else\n {\n div = n / 2 + 1;\n }\n if (n >= k * 2)\n {\n Console.WriteLine(k);\n }\n\n else\n {\n for (int i = 0; i <= div; i++)\n {\n if (k >= n * 2 - i * 3)\n {\n Console.WriteLine(n - i);\n ToF = 1;\n break;\n }\n }\n if (ToF == 0)\n {\n Console.WriteLine(\"0\");\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace abtraining\n{\n class Program\n {\n static int n, m;\n static void Main(string[] args)\n {\n var arr = Console.ReadLine().Split(' ');\n n = int.Parse(arr[0]);\n m = int.Parse(arr[1]);\n\n if(n < m){\n int aux = n;\n n = m;\n m = aux;\n }\n\n var count = n / 2;\n if(count >= m){\n Console.Write(m);\n } else {\n m -= count;\n count += (m + n % 2) / 3;\n Console.Write(count);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace B.Queue_at_the_School\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (Math.Min(x[0], x[1])*2 <= Math.Max(x[0], x[1]))\n {\n Console.WriteLine((Math.Min(x[0], x[1]) + Math.Min(x[0], x[1]) * Math.Min(x[0], x[1])) / 3);\n }\n else if (Math.Min(x[0], x[1]) * 2 > Math.Max(x[0], x[1]))\n {\n Console.WriteLine((Math.Min(x[0], x[1]) + Math.Max(x[0], x[1])) / 3);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sp = Console.ReadLine().Split();\n int n = int.Parse(sp[0]);\n int m = int.Parse(sp[1]);\n var tsk = new Task();\n Console.WriteLine(tsk.Sol(n,m));\n }\n }\n\n class Task\n {\n public int Sol(int n, int m)\n {\n int rs = 0;\n for(int i = 1; i <= n; ++i)\n rs = Math.Max( rs, i + Math.Min((n - i) / 2, m - 2*i));\n \n return rs;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Ronda7\n{\n class BajoPresion\n {\n static void Main(string [] args)\n {\n var sp = Console.ReadLine().Split();\n int n = int.Parse(sp[0]);\n int m = int.Parse(sp[1]);\n int team1 = n;\n int team2 = 0;\n int team4 = m;\n int team5 = 0;\n if( 2 * n >= m){\n team1 = m / 2;\n team2 = (n - m / 2 > 1) ? 1 : 0;\n }\n if( 2 * m >= n){\n team4 = n / 2;\n team5 = (m - n / 2 > 1) ? 1 : 0;\n }\n Console.WriteLine(Math.Max(team1 + team2, team4 + team5));\n }\n }\n}"}, {"source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n int freshers, veterans;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n veterans = int.Parse(input[0]);\n freshers = int.Parse(input[1]);\n if(veterans>freshers)\n {\n int temp = veterans;\n veterans = freshers;\n freshers = temp;\n }\n }\n freshers = freshers - veterans;\n if (veterans <= freshers)\n Console.WriteLine(veterans);\n else\n {\n veterans -= freshers;\n Console.WriteLine((freshers+2*(veterans/3+(veterans%3==2?1:0))));\n }\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var m = sc.Integer();\n var max = 0;\n for (int k = 0; k*2 <= n; k++)\n {\n var rem = n - k * 2;\n var rem2 = m - k;\n var min = Math.Min(rem, rem2 / 2);\n max = Math.Max(k + min, max);\n }\n IO.Printer.Out.WriteLine(max);\n\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n }\n\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n private readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var n = init[0];\n var m = init[1];\n\n var ans = 0;\n while(true)\n {\n if (ans > Math.Min(n, m) || n + m > ans * 3)\n break;\n ans++;\n }\n\n \n\n Console.WriteLine(ans - 1);\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n IO io = new IO();\n\n int i_N = io.ReadNextInt();\n int i_M = io.ReadNextInt();\n\n int i_Ans = 0;\n\n for (int i = 0; ; i++)\n {\n if (i_N > i_M)\n {\n if (i_N >= 2 && i_M >= 1)\n {\n i_N -= 2;\n i_M--;\n i_Ans++;\n }\n else\n {\n break;\n }\n }\n\n else\n {\n if (i_N >= 1 && i_M >= 2)\n {\n i_N--;\n i_M -= 2;\n i_Ans++;\n }\n else\n {\n break;\n }\n\n }\n\n io.PutStr(i_Ans);\n }\n }\n }\n\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public long ReadNextLong()\n {\n return long.Parse(ReadToken());\n }\n\n public int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public long[] ReadLongArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => long.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(double str)\n {\n Console.WriteLine(str);\n }\n\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (a[1] < a[0] * 2) a[0] = (a[1] + a[0]) / 3;\n Console.WriteLine(a[0]);\n }\n}"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] st = Console.ReadLine().Split(' ');\n\n int a = int.Parse(st[0]), b = int.Parse(st[1]);\n\n Console.WriteLine(b % a + 2);\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Sandbox\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] st = Console.ReadLine().Split(' ');\n\n int a = int.Parse(st[0]), b = int.Parse(st[1]);\n\n if (Math.Min(a, b) * 2 <= Math.Max(a, b))\n {\n Console.WriteLine(Math.Min(a, b));\n }\n else\n {\n Console.WriteLine(Math.Ceiling((double)Math.Max(a, b) / (Math.Min(a, b) * 0.5)));\n }\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if (n == 0 || m == 0) Console.WriteLine(0);\n else if (n / m <= 0.5) Console.WriteLine(n);\n else if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n int l = (int)(m / 2);\n n = n - l;\n m = m - (2 * l);\n while (n / m >= 2)\n {\n l = l + 1;\n n = n - 2;\n m = m - 1;\n } \n if (m <= 0) Console.WriteLine(l);\n else Console.WriteLine(l + 1);\n }\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_b_V\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n Int64 n = Convert.ToInt64(s[0]);\n Int64 m = Convert.ToInt64(s[1]);\n int count = 0;\n while((n > 0 && m > 0) || (n > 1 && m > 1))\n {\n if (n >= m)\n {\n n -= 2;\n m--;\n count++;\n }\n else\n {\n n--;\n m-= 2;\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A_b_V\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n Int64 n = Convert.ToInt64(s[0]);\n Int64 m = Convert.ToInt64(s[1]);\n int count = 0;\n while((n > 0 && m > 0) && (n != 1 && m != 1))\n {\n if (n >= m)\n {\n n -= 2;\n m--;\n count++;\n }\n else\n {\n n--;\n m-= 2;\n count++;\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class Program\n {\n private const int MAXN = 8000;\n\n public static void Main(string[] args)\n {\n var arr = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();\n var n = arr[0];\n var m = arr[1];\n\n \n var count = 0;\n while (n > 0 && m > 0)\n {\n var max = Math.Max(n, m);\n var min = Math.Min(n, m);\n\n var groupCount = Math.Min(max / 2, min);\n if (groupCount == 0)\n {\n break;\n }\n\n count += groupCount;\n max -= groupCount * 2;\n min -= groupCount;\n\n n = max;\n m = min;\n }\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n\n\n\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int ans = 0;\n\n int op = 0;\n int nov = 0;\n\n if (n <= 1 || m <= 1) ans = 0;\n else\n {\n if (n == m)\n {\n ans = 2 * (m / 3);\n\n if (m % 3 == 2) ans++;\n }\n else\n {\n op = n/3;\n nov = m/3;\n if (op <= m && nov <= n)\n {\n ans = n/3 + m/3;\n if ((n%3 == 2 && m%3 != 0) || (m%3 == 2 && n%3 != 0)) ans ++;\n }\n else\n {\n if (n > m)\n {\n ans = n / 2;\n\n if (m >= op)\n {\n ans += op;\n m -= op;\n if (m >= 2 && n % 2 == 1) ans++;\n }\n else\n {\n ans = m % op;\n }\n\n }\n\n if (n < m)\n {\n nov = m / 2;\n\n if (n >= nov)\n {\n ans += nov;\n n -= nov;\n if (n >= 2 && m % 2 == 1) ans++;\n }\n else\n {\n ans = n % nov;\n }\n\n }\n }\n\n\n \n }\n }\n\n Console.WriteLine(ans);\n\n\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n\n\n\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int ans = 0;\n\n int op = 0;\n int nov = 0;\n\n if (n <= 1 && m <= 1) ans = 0;\n else\n {\n if (n == m)\n {\n ans = 2 * (m / 3);\n\n if (m % 3 == 2) ans++;\n }\n else\n {\n op = n/3;\n nov = m/3;\n if (op <= m && nov <= n)\n {\n ans = n/3 + m/3;\n if ((n%3 == 2 && m%3 != 0) || (m%3 == 2 && n%3 != 0)) ans ++;\n }\n else\n {\n if (n > m)\n {\n ans = n / 2;\n\n if (m >= op)\n {\n ans += op;\n m -= op;\n if (m >= 2 && n % 2 == 1) ans++;\n }\n else\n {\n ans = m % op;\n }\n\n }\n\n if (n < m)\n {\n nov = m / 2;\n \n\n if (n >= nov)\n {\n ans += nov;\n n -= nov;\n if (n >= 2 && m % 2 == 1) ans++;\n }\n else\n {\n ans = n % nov;\n }\n\n }\n }\n\n\n \n }\n }\n\n Console.WriteLine(ans);\n\n\n\n\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n\n private static void Main(string[] args)\n {\n\n\n\n\n\n\n\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int ans = 0;\n\n int op = 0;\n int nov = 0;\n\n if (n <= 1 || m <= 1) ans = 0;\n else\n {\n if (n == m)\n {\n ans = 2*(m / 3);\n\n if (m % 3 == 2) ans++;\n }\n else\n {\n if (n > m)\n {\n op = n / 2;\n\n if (m >= op)\n {\n ans += op;\n m -= op;\n if (m >= 2 && n % 2 == 1) ans++;\n }\n else\n {\n ans = m % op;\n }\n\n }\n\n if (n < m)\n {\n nov = m / 2;\n\n if (n >= nov)\n {\n ans += nov;\n n -= nov;\n if (n >= 2 && m % 2 == 1) ans++;\n }\n else\n {\n ans = n % nov;\n }\n\n }\n }\n }\n\n Console.WriteLine(ans);\n }\n \n\n\n\n\n\n\n\n }\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n\n private static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int ans = 0;\n\n int op = 0;\n int nov = 0;\n\n if (n <= 1 || m <= 1) ans = 0;\n else\n \n {\n if (n == m)\n {\n ans = m/2;\n\n if (m%2 == 1) ans ++; \n }\n else\n {\n if (n > m)\n {\n op = n/2;\n\n if (m >= op)\n {\n ans += op;\n m -= op;\n if (m >= 2 && n%2 == 1) ans ++;\n }\n else\n {\n ans = m%op; \n }\n\n }\n\n if (n < m)\n {\n nov = m/2;\n\n if (n >= nov)\n {\n ans += nov;\n n -= nov;\n if (n >= 2 && m%2 == 1) ans ++;\n }\n else\n {\n ans = n%nov;\n }\n\n }\n }\n }\n \n Console.WriteLine(ans);\n }\n \n\n\n\n\n\n\n\n }\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeTrening\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int ans = 0;\n while (true)\n {\n if (n == 0) { break; }\n if (m == 0) { break; }\n if (n > m) { ans++; n -= 2; m--; }\n else { ans++; n--; m -= 2; } \n }\n Console.WriteLine( ans);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeTrening\n{\n class Program\n {\n static void Main(string[] args)\n {\n string []s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n int ans = 0;\n if (n > 1 || m > 1)\n {\n while (true)\n {\n if (n == 0) { break; }\n if (m == 0) { break; }\n if (n > m) { ans++; n -= 2; m--; }\n else { ans++; n--; m -= 2; }\n }\n }\n Console.WriteLine( ans);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n int n = l[0], m = l[1];\n if(n/m>=2 || m/n>=2)\n {\n Console.WriteLine(Math.Min(n, m));\n return;\n }\n int cnt = 0;\n while(n*m>0)\n {\n if(n>m)\n {\n n -= 2;m--;\n }\n else\n {\n n--;m -= 2;\n }\n if (n<0||m<0)\n break;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n int n = l[0], m = l[1];\n if(n/m>=2 || m/n>=2)\n {\n Console.WriteLine(Math.Min(n, m));\n return;\n }\n int cnt = 0;\n while(n*m>0)\n {\n if(n>m)\n {\n n -= 2;m--;\n }\n else\n {\n n--;m -= 2;\n }\n if (n * m <= 0)\n break;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] l = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n int n = l[0], m = l[1];\n if(n/m>=2 || m/n>=2)\n {\n Console.WriteLine(Math.Min(n, m));\n return;\n }\n int cnt = 0;\n while(n*m>0)\n {\n if(n>m)\n {\n n -= 2;m--;cnt++;\n }\n else\n {\n n--;m -= 2;cnt++;\n }\n }\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n int a, b;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n }\n int pairs = 0;\n if(a!=b)\n {\n if(a>b) { int temp = a; a = b; b = temp; }\n if (b - a >= a) { pairs = a; a = b = 0; }\n else { pairs = b - a; a -= pairs; b = a; }\n }\n pairs += a * 2 / 3;\n Console.WriteLine(pairs += a * 2 / 3);\n }\n }"}, {"source_code": " using System;\n class Program\n {\n static void Main(string[] args)\n {\n int a, b;\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n a = int.Parse(input[0]);\n b = int.Parse(input[1]);\n }\n int pairs = 0;\n if(a!=b)\n {\n if(a>b) { int temp = a; a = b; b = temp; }\n if (b - a >= a) { pairs = a; a = b = 0; }\n else { pairs = b - a; a -= pairs; b = a; }\n }\n pairs += a * 2 / 3;\n Console.WriteLine(a%3==2?++pairs:pairs);\n }\n }"}, {"source_code": "using System;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int ToF = 0;\n for (int i = 0; i= n * 2-i*3)\n {\n Console.WriteLine(n-i);\n ToF = 1;\n break;\n }\n }\n if (ToF == 0)\n {\n Console.WriteLine(\"0\");\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n for (int i = 0; i= n * 2-i*3)\n {\n Console.WriteLine(n-i);\n break;\n }\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int ToF = 0;\n if (n >= k * 2)\n {\n Console.WriteLine(k);\n }\n else\n {\n for (int i = 0; i <= n / 2; i++)\n {\n if (k >= n * 2 - i * 3)\n {\n Console.WriteLine(n - i);\n ToF = 1;\n break;\n }\n }\n if (ToF == 0)\n {\n Console.WriteLine(\"0\");\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A_and_B_and_Team_Training\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n int ToF = 0;\n for (int i = 0; i<=n/2; i++)\n {\n if (k >= n * 2-i*3)\n {\n Console.WriteLine(n-i);\n ToF = 1;\n break;\n }\n }\n if (ToF == 0)\n {\n Console.WriteLine(\"0\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C.A_and_B_and_Team_Training\n{\n class Program\n {\n static int n, m;\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(arr[0]);\n m = Convert.ToInt32(arr[1]);\n\n for(int i = n+m; i>2; i--)\n if(i%3 ==0 ){\n Console.WriteLine(i/3);\n return;\n }\n Console.WriteLine(0);\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C.A_and_B_and_Team_Training\n{\n class Program\n {\n static int n, m;\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(arr[0]);\n m = Convert.ToInt32(arr[1]);\n\n if (n == m)\n {\n for(int i = n+m; i>0; i--)\n if(i%3 ==0 ){\n Console.WriteLine(i/3);\n return;\n }\n }\n int total = m / 2;\n if (total >= n)\n {\n Console.WriteLine(n);\n return;\n }\n if (m % 2 != 0 && n - total > 1)\n Console.WriteLine(total + 1);\n else\n Console.WriteLine(total);\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C.A_and_B_and_Team_Training\n{\n class Program\n {\n static int n, m;\n static void Main(string[] args)\n {\n string[] arr = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(arr[0]);\n m = Convert.ToInt32(arr[1]);\n\n int total = m / 2;\n if (total >= n)\n {\n Console.WriteLine(n);\n return;\n }\n if (m % 2 != 0 && n - total > 1)\n Console.WriteLine(total + 1);\n else\n Console.WriteLine(total);\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if (n == 0 || m == 0) Console.WriteLine(0);\n else if (n / m <= 0.5) Console.WriteLine(n);\n else if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n int l = (int)(m / 2);\n n = n - l;\n m = m - (2 * l);\n while (n / m >= 2)\n {\n l = l + 1;\n n = n - 2;\n m = m - 1;\n } \n if (m < 0) Console.WriteLine(l);\n else Console.WriteLine(l + 1);\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if (n == 0 || m == 0) Console.WriteLine(0);\n else\n {\n if (n / m <= 0.5) Console.WriteLine(n);\n else\n {\n if (m / n <= 0.5) Console.WriteLine(m);\n else\n {\n int l = (int)(m / 2);\n n = n - l;\n m = m - (2 * l);\n while (m / n > 0.5)\n {\n l = l + 1;\n n = n - 1;\n m = m - 2;\n }\n if (m < 0) Console.WriteLine(l - 1);\n else Console.WriteLine(l + 1);\n }\n }\n }\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if(n/m <= 0.5) Console.WriteLine(n);\n else\n {\n int l = (int)(m/2);\n n = n - l;\n m = m - (2 * l);\n while(m/n > 0.5)\n {\n l = l + 1;\n n = n - 1;\n m = m - 2;\n }\n if (m < 0) Console.WriteLine(l-1);\n else Console.WriteLine(l);\n }\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if (n == 0 || m == 0) Console.WriteLine(0);\n else\n {\n if (n / m <= 0.5) Console.WriteLine(n);\n else\n {\n int l = (int)(m / 2);\n n = n - l;\n m = m - (2 * l);\n while (m / n > 0.5)\n {\n l = l + 1;\n n = n - 1;\n m = m - 2;\n }\n if (m < 0) Console.WriteLine(l - 1);\n else Console.WriteLine(l + 1);\n }\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _519C___Codeforces\n{\n class Program\n {\n static void Main()\n {\n string[] nums = Console.ReadLine().Split();\n double n = double.Parse(nums[0]);\n double m = double.Parse(nums[1]);\n\n if(n/m <= 0.5) Console.WriteLine(n);\n else\n {\n int l = (int)(m/2);\n n = n - l;\n m = m - (2 * l);\n while(m/n > 0.5)\n {\n l = l + 1;\n n = n - 1;\n m = m - 2;\n }\n if (m < 0) Console.WriteLine(l-1);\n else Console.WriteLine(l+1);\n }\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]),\n m = int.Parse(s[1]),\n answer = 0;\n\n while (n >= 1 && m >= 2 || n >= 2 && m >= 1)\n {\n if (n >= 1 && m >= 2)\n {\n n--;\n m -= 2;\n }\n else\n {\n m--;\n n -= 2;\n }\n answer++;\n }\n Console.WriteLine(answer);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static int Count(int n, int m)\n {\n if(n + m < 3)\n {\n return 0;\n }\n\n if(n == m && n%2 == 0)\n {\n return (n + m)/3;\n }\n \n var min = 0;\n var max = 0;\n\n if(n > m)\n {\n max = n;\n min = m;\n }\n else\n {\n max = m;\n min = n;\n }\n\n var pairs = max/2;\n\n if(min <= pairs)\n {\n return min;\n }\n else\n {\n return pairs + Count(min - pairs, max - pairs*2);\n }\n }\n\n static void Main()\n {\n var args = Console.ReadLine().Split(' ');\n var n = int.Parse(args[0]);\n var m = int.Parse(args[1]);\n\n if(n + m < 3)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Count(n,m));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static void Main()\n {\n var args = Console.ReadLine().Split(' ');\n \n Console.WriteLine((int.Parse(args[0]) + int.Parse(args[1]))/3);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Program\n{\n static int Count(int n, int m)\n {\n var min = 0;\n var max = 0;\n\n if(n > m)\n {\n max = n;\n min = m;\n }\n else\n {\n max = m;\n min = n;\n }\n\n var pairs = max/2;\n\n if(min <= pairs)\n {\n return min;\n }\n else\n {\n return pairs + Count(min - pairs, max - pairs*2);\n }\n }\n\n static void Main()\n {\n var args = Console.ReadLine().Split(' ');\n var n = int.Parse(args[0]);\n var m = int.Parse(args[1]);\n\n if(n + m < 3)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(Count(n,m));\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), ans = 0;\n for (int t1 = 0; t1 <= n / 2; t1++) {\n int t2 = Math.Min(n - 2 * t1, (n - t1) / 2);\n if (t1 + t2 > ans)\n ans = t1 + t2;\n }\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), ans = 0;\n for (int t1 = 0; t1 <= n / 2; t1++) {\n int t2 = Math.Min(n - 2 * t1, (m - t1) / 2);\n if (t1 + t2 > ans)\n ans = t1 + t2;\n }\n Console.Write(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), ans = 0;\n for (int t1 = 0; t1 <= n / 2; t1++) {\n int t2 = Math.Min(n - 2 * t1, (m - t1) / 2);\n if (t1 >= 0 && t2 >= 0 && t1 + t2 > ans)\n ans = t1 + t2;\n }\n Console.Write(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // A and B and Team Training (greedy, implementation, math, number theory)\n class _519C\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[0]);\n if (m >= 2 * n) Console.WriteLine(n);\n else if (n >= 2 * m) Console.WriteLine(m);\n else Console.WriteLine((n + m) / 3);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security.Principal;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n#if LOCAL_TEST\n private readonly TextReader inputStream = new StreamReader(\"input.txt\");\n#else\n private readonly TextReader inputStream = Console.In;\n#endif\n#if FBHC_TEST\n private readonly TextWriter outputStream = new StreamWriter(\"output.txt\");\n#else\n private readonly TextWriter outputStream = Console.Out;\n#endif\n\n private string[] tokens;\n private int pointer;\n\n public char NextChar()\n {\n try\n {\n var c = inputStream.Read();\n\n if (c < 0)\n c = 0;\n\n return (char)c;\n }\n catch (IOException)\n {\n return '\\0';\n }\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n var t = typeof(T);\n\n if (t == typeof(char))\n return (T)(object)NextChar();\n\n object s = NextString();\n\n if (t == typeof(string))\n return (T)s;\n\n return (T)Convert.ChangeType(s, typeof(T));\n }\n\n\n public IEnumerable NextWhile(Predicate pred)\n {\n if (pred == null)\n yield break;\n\n var res = Next();\n\n while (pred(res))\n {\n yield return res;\n\n res = Next();\n }\n }\n\n public IEnumerable NextSeq(long n)\n {\n for (var i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"YES\" : \"NO\");\n }\n\n public void PrintLine(bool o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n var ienum = o as IEnumerable;\n\n if (ienum != null && typeof(T) != typeof(string))\n {\n var first = true;\n\n foreach (var iev in ienum)\n {\n if (!first && iev != null)\n Print(\" \");\n\n Print(iev);\n\n first = false;\n }\n\n }\n else\n {\n outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));\n }\n\n }\n\n\n public void PrintLine(T o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n public static void Each(this IEnumerable self, Action action)\n {\n foreach (var v in self)\n action(v);\n }\n\n public static string Reverse(this string s)\n {\n var charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static long MODPower(this int x, long y, long mod)\n {\n long answ = 1;\n\n if (y == 0)\n return answ;\n if (y % 2 == 1)\n answ *= x;\n\n answ *= MODPower(x, y / 2, mod) * MODPower(x, y / 2, mod);\n\n answ %= mod;\n\n return answ;\n }\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, Func, T> fval)\n {\n for (var i = 0; i < self.Count; i++)\n self[i] = fval(i, self);\n\n\n return self;\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n return self.Fill((x, slf) => fval(x));\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n return self.Fill(x => fval());\n }\n\n\n public static IList Fill(this IList self, T val)\n {\n return self.Fill(() => val);\n }\n\n public static long Hash(this IList self, Func val = null)\n {\n return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);\n }\n\n public static long Hash(this IList self, Func val)\n {\n return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));\n }\n\n\n public static long HashOne(this T self, long current)\n {\n return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));\n }\n\n\n public static IList BuildSegTree(this IList a, Func combine, Func convert)\n {\n var t = new T1[a.Count << 2];\n\n a.BuildSegTree(t, 1, 0, a.Count - 1, combine, convert);\n\n return t;\n }\n\n private static void BuildSegTree(this IList a, IList t, int v, int tl, int tr, Func combine, Func convert)\n {\n if (tl == tr)\n {\n t[v] = convert(a[tl]);\n }\n else\n {\n int tm = (tl + tr) >> 1;\n\n BuildSegTree(a, t, v << 1, tl, tm, combine, convert);\n BuildSegTree(a, t, (v << 1) + 1, tm + 1, tr, combine, convert);\n\n t[v] = combine(t[v << 1], t[(v << 1) + 1]);\n }\n }\n\n public static int Xor1n(this int n)\n {\n return (n >> 1) & 1 ^ ((n & 1) > 0 ? 1 : n);\n }\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override bool Equals(object obj)\n {\n var co = obj as P;\n\n return co != null && co.GetHashCode() == GetHashCode();\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = unchecked(hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode()));\n hash = unchecked(hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode()));\n return hash;\n\n }\n }\n\n #endregion\n\n\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (var io = new MyIo())\n {\n try\n {\n new Program(io)\n .Solve();\n }\n catch (Exception e)\n {\n io.PrintLine(e.Message + \"\\r\\n\" + e.StackTrace);\n\n throw;\n }\n }\n }\n\n\n\n #endregion\n\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n private void Solve()\n {\n\n int n = io.NextInt();\n int m = io.NextInt();\n int x = 0;\n int dx = 0;\n\n do\n {\n if (m > n)\n {\n int tmp = m;\n m = n;\n n = tmp;\n }\n dx = Math.Min(n/2, m);\n x += dx;\n n -= dx*2;\n m -= dx;\n\n } while (dx > 0); \n\n io.Print(x);\n\n }\n\n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Round_294\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n //Chess ch = new Chess();\n //ch.Test();\n //CompilationErrors ce = new CompilationErrors();\n //ce.Test();\n TeamTraining tt = new TeamTraining();\n tt.Test();\n }\n }\n class Chess\n {\n\n void Count(string[] board,out long cntb,out long cntw)\n {\n cntb=0;\n cntw=0;\n for(int i=0;icntw)Console.WriteLine(\"Black\");\n else if(cntb max) max = cnt;\n //}\n //Console.WriteLine(max);\n long cnt = 0;\n if(n<2&&m<2)\n {\n Console.WriteLine(\"0\");\n return;\n }\n while(n>0&&m>0)\n {\n if (n > m) n--;\n else m--;\n n--;\n m--;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n int Min(int a,int b)\n {\n return a < b ? a : b;\n }\n }\n\n\n}\n"}, {"source_code": "using System;\nnamespace Contest\n{\nclass MainClass{\n public static void Main (string[] args){\n long n,s=0,k,ss=0;\n string[] st=Console.ReadLine().Split(' ');\n n=long.Parse(st[0]);\n k=long.Parse(st[1]);\n \n if(n m) {\n n -= 2;\n m--;\n }\n else {\n n--;\n m -= 2;\n }\n a++;\n }\n writer.WriteLine(a);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = input[0];\n int m = input[1];\n \n int t1 = 0; // N M M\n int t2 = 0; // N N M\n if (m < n)\n {\n int t = n;\n n = m;\n m = t;\n }\n\n t1 += Math.Min(m / 2, n);\n n -= t1;\n m -= t1 * 2;\n t2 += Math.Min(n / 2, m);\n\n Console.WriteLine(t1 + t2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = input[0];\n int m = input[1];\n \n int T = 0;\n\n int t = Math.Min(m / 3, n / 3);\n T += t * 2;\n\n m -= t * 3;\n n -= t * 3;\n\n if (m < n)\n {\n t = m;\n m = n;\n n = t;\n }\n\n T += Math.Min(m / 2, n);\n \n Console.WriteLine(T);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = input[0];\n int m = input[1];\n \n int T = 0;\n\n if (m >= n * 2)\n {\n T += n;\n }\n else if (n >= m * 2)\n {\n T += m;\n }\n else\n {\n int t = Math.Min(m / 3, n / 3);\n T += t * 2;\n\n m -= t * 3;\n n -= t * 3;\n\n if (m < n)\n {\n t = m;\n m = n;\n n = t;\n }\n\n T += Math.Min(m / 2, n);\n }\n\n Console.WriteLine(T);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar a = getList();\n\t\t\tvar n = a[0];\n\t\t\tvar m = a[1];\n\t\t\tvar ans = 0;\n\t\t\tif (n > m)\n\t\t\t{\n\t\t\t\tvar q = n;\n\t\t\t\tn = m;\n\t\t\t\tm = q;\n\t\t\t}\n\t\t\tvar p = Min(n, m / 2);\n\t\t\tans += p;\n\t\t\tn -= p;\n\t\t\tm -= p * 2;\n\t\t\tif (n != 0 && m != 0)\n\t\t\t{\n\t\t\t\tp = Min(m, n / 2);\n\t\t\t\tans += p;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _519C\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var O = s[0]; var H = s[1];\n int count = 0;\n while (O>0 && H>0)\n {\n count++;\n if (O > H) { O-=2;H--;}\n else { O--; H -= 2; }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split((char)32), int.Parse);\n int firstMethod = 0;\n int secondMethod = 0;\n\n methodOne(input[0], input[1], ref firstMethod);\n methodSecond(input[0], input[1], ref secondMethod);\n\n if (firstMethod > secondMethod)\n {\n Console.WriteLine(firstMethod.ToString());\n }\n else\n {\n Console.WriteLine(secondMethod.ToString());\n }\n }\n\n static void methodOne(int expertNum, int newbieNum, ref int teamNum)\n {\n int trackCount = 0;\n\n while ((expertNum - 1) >= 0 && (newbieNum - 2) >= 0)\n {\n teamNum++;\n trackCount++;\n\n expertNum--;\n newbieNum -= 2;\n }\n\n if (trackCount == 0)\n {\n return;\n }\n\n methodSecond(expertNum, newbieNum, ref teamNum);\n }\n\n static void methodSecond(int expertNum, int newbieNum, ref int teamNum)\n {\n int trackCount = 0;\n\n while ((expertNum - 2) >= 0 && (newbieNum - 1) >= 0)\n {\n teamNum++;\n trackCount++;\n\n expertNum -= 2;\n newbieNum--;\n }\n\n if (trackCount == 0)\n {\n return;\n }\n\n methodOne(expertNum, newbieNum, ref teamNum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split((char)32), int.Parse);\n int[] temp = new int[2] { input[0], input[1] };\n int firstMethod = 0;\n int secondMethod = 0;\n int thirdMethod = 0;\n\n methodOne(ref input[0], ref input[1], ref firstMethod);\n\n Array.Copy(temp, input, temp.Length);\n methodSecond(ref input[0], ref input[1], ref secondMethod);\n\n Array.Copy(temp, input, temp.Length);\n\n methodThird(ref input[0], ref input[1], ref thirdMethod);\n\n Array.Copy(temp, input, temp.Length);\n\n int[] resultArray = new int[3] { firstMethod, secondMethod, thirdMethod };\n\n Console.WriteLine(resultArray.Max());\n }\n\n static void methodOne(ref int expertNum, ref int newbieNum, ref int teamNum)\n {\n int trackCount = 0;\n\n while ((expertNum - 1) >= 0 && (newbieNum - 2) >= 0)\n {\n teamNum++;\n trackCount++;\n\n expertNum--;\n newbieNum -= 2;\n }\n\n if (trackCount == 0)\n {\n return;\n }\n\n methodSecond(ref expertNum, ref newbieNum, ref teamNum);\n }\n\n static void methodSecond(ref int expertNum, ref int newbieNum, ref int teamNum)\n {\n int trackCount = 0;\n\n while ((expertNum - 2) >= 0 && (newbieNum - 1) >= 0)\n {\n teamNum++;\n trackCount++;\n\n expertNum -= 2;\n newbieNum--;\n }\n\n if (trackCount == 0)\n {\n return;\n }\n\n methodOne(ref expertNum, ref newbieNum, ref teamNum);\n }\n\n static void methodThird(ref int expertNum, ref int newbieNum, ref int teamNum)\n {\n int trackCount = 0;\n\n while ((expertNum - 3) >= 0 && (newbieNum - 3) >= 0)\n {\n teamNum += 2;\n trackCount += 2;\n\n expertNum -= 3;\n newbieNum -= 3;\n }\n\n if (trackCount == 0)\n {\n return;\n }\n\n methodOne(ref expertNum, ref newbieNum, ref teamNum);\n methodSecond(ref expertNum, ref newbieNum, ref teamNum);\n }\n }\n}\n"}], "src_uid": "0718c6afe52cd232a5e942052527f31b"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static StreamReader reader;\n static StreamWriter writer;\n static Random rand = new Random(0);\n static int Min;\n static int[] x_directions = new int[] { -1, +1, 0, 0 };\n static int[] y_directions = new int[] { 0, 0, -1, +1 };\n static List pairs = new List();\n\n static void Main(string[] args)\n {\n //#if DEBUG\n reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#else\n // StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);\n // StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);\n //#endif\n InputReader input = new InputReader(reader);\n\n long n = input.NextLong();\n long k = input.NextLong();\n writer.WriteLine(n % k != 0 ? Math.Ceiling(n * 1.0 / k) * k : (n / k + 1) * k);\n \n\n#if DEBUG\n Console.BackgroundColor = ConsoleColor.White;\n Console.ForegroundColor = ConsoleColor.Black;\n#endif\n writer.Flush();\n writer.Close();\n reader.Close();\n }\n }\n\n class MyPair\n {\n public int x, y;\n\n public MyPair(int x, int y)\n {\n this.x = x;\n this.y = y;\n }\n }\n\n // this class is copy\n class InputReader\n {\n private char[] _inbuf;\n private int _lenbuf = 0, _ptrbuf = 0;\n private StreamReader _reader;\n\n public InputReader(StreamReader reader)\n {\n _reader = reader;\n _inbuf = new char[1024];\n _lenbuf = 0;\n _ptrbuf = 0;\n }\n\n private int ReadByte()\n {\n if (_lenbuf == -1)\n throw new Exception();\n if (_ptrbuf >= _lenbuf)\n {\n _ptrbuf = 0;\n try\n {\n _lenbuf = _reader.Read(_inbuf, 0, 1024);\n }\n catch (IOException e)\n {\n throw e;\n }\n if (_lenbuf <= 0)\n return -1;\n }\n return _inbuf[_ptrbuf++];\n }\n\n private bool IsSpaceChar(int c)\n {\n return !(c >= 33 && c <= 126);\n }\n\n private int Skip()\n {\n int b;\n while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;\n return b;\n }\n\n public int NextInt()\n {\n return int.Parse(this.Next());\n }\n\n public int[] NextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = NextInt();\n }\n return a;\n }\n\n public long NextLong()\n {\n return long.Parse(this.Next());\n }\n\n public string Next()\n {\n var b = Skip();\n var sb = new StringBuilder();\n while (!(IsSpaceChar(b)))\n {\n sb.Append((char)b);\n b = ReadByte();\n }\n return sb.ToString();\n }\n\n public double NextDouble()\n {\n return double.Parse(Next(), CultureInfo.InvariantCulture);\n }\n\n internal long[] NextLongArray(long n)\n {\n long[] a = new long[(int)n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextLong();\n }\n return a;\n }\n\n internal double[] NextDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = NextDouble();\n }\n return a;\n }\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections;\nusing System.Globalization;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n public static class Cin\n {\n public static string NextToken()\n {\n StringBuilder tokenChars = new StringBuilder();\n bool tokenFinished = false;\n bool skipWhiteSpaceMode = true;\n while (!tokenFinished)\n {\n int nextChar = Console.Read();\n if (nextChar == -1)\n {\n tokenFinished = true;\n }\n else\n {\n char ch = (char)nextChar;\n if (char.IsWhiteSpace(ch))\n {\n if (!skipWhiteSpaceMode)\n {\n tokenFinished = true;\n if (ch == '\\r' && (Environment.NewLine == \"\\r\\n\"))\n {\n Console.Read();\n }\n }\n }\n else\n {\n skipWhiteSpaceMode = false;\n tokenChars.Append(ch);\n }\n }\n }\n\n string token = tokenChars.ToString();\n return token;\n }\n\n public static int NextInt()\n {\n string token = Cin.NextToken();\n return int.Parse(token);\n }\n public static long NextLong()\n {\n string token = Cin.NextToken();\n return long.Parse(token);\n }\n\n public static double NextDouble(bool acceptAnyDecimalSeparator = true)\n {\n string token = Cin.NextToken();\n if (acceptAnyDecimalSeparator)\n {\n token = token.Replace(',', '.');\n double result = double.Parse(token, CultureInfo.InvariantCulture);\n return result;\n }\n else\n {\n double result = double.Parse(token);\n return result;\n }\n }\n\n public static decimal NextDecimal(bool acceptAnyDecimalSeparator = true)\n {\n string token = Cin.NextToken();\n if (acceptAnyDecimalSeparator)\n {\n token = token.Replace(',', '.');\n decimal result = decimal.Parse(token, CultureInfo.InvariantCulture);\n return result;\n }\n else\n {\n decimal result = decimal.Parse(token);\n return result;\n }\n }\n }\n\n class Program\n {\n static void Main(string[] args)\n {\n long a = Cin.NextInt();\n long b = Cin.NextInt();\n Console.WriteLine(((a + b)/b)*b);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n Write(n + (m - n % m));\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace trenvk\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n if (nk[0] % nk[1] == 0) Console.Write((nk[0] / nk[1] + 1) * nk[1]);\n else Console.Write(Math.Ceiling((double)nk[0] / nk[1]) * nk[1]);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1 {\n class MainClass {\n public static void Main(string [] args) {\n string s = Convert.ToString(Console.ReadLine());\n string[] s2 = s.Split(' ');\n Int64 n = Convert.ToInt64(s2[0]);\n Int64 k = Convert.ToInt64(s2[1]);\n Console.Write(k + n / k * k);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tMain main = new Main();\n\t\t\t\tmain.ReadData();\n\t\t\t\tmain.Process();\n\t\t\t\tmain.WriteAnswer();\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tclass Main\n\t{\n\t\tprivate long _n;\n\t\tprivate long _k;\n\t\tprivate long _result;\n\n\t\tpublic void Process()\n\t\t{\n\t\t\tlong x = (long)Math.Floor(_n / (decimal)_k);\n\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (x * _k > _n)\n\t\t\t\t{\n\t\t\t\t\t_result = x * _k;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tx++;\n\t\t\t}\n\t\t}\n\n\t\tpublic void ReadData()\n\t\t{\n\t\t\tTextReader textReader = Console.In;\n\t\t\t//TextReader textReader = new StreamReader(\"input.txt\");\n\t\t\tusing (TextReader reader = textReader)\n\t\t\t{\n\t\t\t\tstring readLine = reader.ReadLine();\n\t\t\t\tstring[] strings1 = readLine.Split(' ');\n\n\t\t\t\t_n = int.Parse(strings1[0]);\n\t\t\t\t_k = long.Parse(strings1[1]);\n\t\t\t}\n\t\t}\n\n\t\tpublic void WriteAnswer()\n\t\t{\n\t\t\tusing (TextWriter writer = Console.Out)\n\t\t\t{\n\t\t\t\twriter.WriteLine(_result);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] res = input.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(res[0]);\n int k = int.Parse(res[1]);\n int result = k*(n/k + 1);\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] res = input.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(res[0]);\n int k = int.Parse(res[1]);\n int result = k*(n/k + 1);\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] res = input.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(res[0]);\n int k = int.Parse(res[1]);\n Console.WriteLine(k*(n/k + 1));\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] inp = Console.ReadLine().Split(' ');\n Int32 n = Int32.Parse(inp[0]);\n Int32 k = Int32.Parse(inp[1]);\n\n\n Int32 x = n + 1;\n\n if (x % k != 0)\n {\n x = (x / k + 1) * k;\n\n\n }\n\n Console.WriteLine(x);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long[] n = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n Console.WriteLine((n[0] / n[1]) * n[1] + n[1]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel.Design.Serialization;\nusing System.IO;\nusing System.Linq;\nusing System.Security.Policy;\nusing System.Text;\nusing System.Xml;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class StringInt\n\t\t{\n\t\t\tpublic string x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class StringString\n\t\t{\n\t\t\tpublic string x;\n\n\t\t\tpublic string y;\n\t\t}\n\n\t\tpublic class IntInt\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic int y;\n\t\t}\n\n\t\tpublic class SIComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(StringInt x, StringInt y)\n\t\t\t{\n\t\t\t\treturn x.x.CompareTo(y.x);\n\t\t\t}\n\t\t}\n\n\t\tpublic class XComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(int x, int y)\n\t\t\t{\n\t\t\t\tif (x % 10 > y % 10)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string getString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List getLongList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long getLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Edge\n\t\t{\n\t\t\tpublic int v;\n\n\t\t\tpublic int w;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic bool was;\n\t\t}\n\n\t\tpublic static bool isPrime(int x)\n\t\t{\n\t\t\tfor (var i = 2; i * i <= x; ++i)\n\t\t\t\tif (x % i == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar l = getLongList();\n\t\t\tvar n = l[0];\n\t\t\tvar k = l[1];\n\t\t\tConsole.WriteLine((n / k + 1) * k);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n int n = Int32.Parse(str.Split(' ')[0]);\n int k = Int32.Parse(str.Split(' ')[1]);\n\n int result = 0;\n\n int ostDel = n % k;\n\n int razn = k - ostDel;\n\n result = n + razn;\n\n Console.WriteLine(result);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace CodeForces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n //\u0412\u0432\u043e\u0434-------------------------------------------------------------------\n string[] input = Console.ReadLine().Split(' ');\n int n = Int32.Parse(input[0]);\n int k = Int32.Parse(input[1]);\n\n int x = (int)n / k + 1;\n Console.WriteLine(x*k);\n \n //Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n private static long Sqrt3(long x)\n {\n long l = 1;\n long r = Math.Min(1000000, x);\n while (r - l > 1)\n {\n long mid = (l + r) / 2;\n long m3 = mid * mid * mid;\n if (m3 <= x)\n l = mid;\n else\n r = mid;\n }\n\n return l;\n }\n\n private static long div(long a, long b, long mod)\n {\n return (a * pow(b, mod - 2, mod)) % mod;\n }\n private static long pow(long a, long p, long mod)\n {\n long res = 1;\n while (p > 0)\n {\n if ((p & 1) == 1) res = (res * a) % mod;\n a = (a * a) % mod;\n p >>= 1;\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n int n = ReadInt();\n int k = ReadInt();\n long x = (n + k) / k;\n x *= k;\n Console.WriteLine(x);\n }\n\n public class RSQ\n {\n private int[] m = new int[200001];\n public void Push(int pos, int v)\n {\n m[pos] += v;\n }\n\n public int Sum(int l, int r)\n {\n int ans = 0;\n while (l <= r) ans += m[l++];\n return ans;\n }\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt() - 1;\n int b = ReadInt() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 12;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(System.Globalization.CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(string data)\n {\n#if !ONLINE_JUDGE\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Temp\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputs = Console.ReadLine().Split();\n var n = int.Parse(inputs[0]);\n var k = int.Parse(inputs[1]);\n\n Console.WriteLine((n / k)*k + k);\n }\n }\n}\n"}, {"source_code": "using System;\npublic class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n Console.WriteLine((n+k-n%k));\n }\n }"}, {"source_code": "namespace _678A \n{\n using System;\n\n public class Program\n {\n public static void Main(string[] args)\n {\n int[] paramsTask = Array.ConvertAll(Console.ReadLine().Split(' '), c => int.Parse(c));\n int n = paramsTask[0], k = paramsTask[1], round;\n\n round = (n / k) + 1;\n\n Console.WriteLine(k * round);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n long n = input.NextLong();\n long k = input.NextLong();\n Console.Write((n / k + 1) * k);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeff/*\nJohny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it is divisible by the number k.\n\nInput\nThe only line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009109).\n\nOutput\nPrint the smallest integer x\u2009>\u2009n, so it is divisible by the number k.\n*/\n\nusing System;\n\nnamespace LuckyNunmbers {\n class Program {\n static void Main(string[] args) {\n var lines = Console.ReadLine().Split(' ');\n long n = long.Parse(lines[0]);\n long k = long.Parse(lines[1]);\n long times = (long)n / k;\n Console.WriteLine((k * times) + k);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication12\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x , y ,i=0,z=0;\n string[] tokens = Console.ReadLine().Split();\n x = int.Parse(tokens[0]);\n y = int.Parse(tokens[1]);\n z = x % y;\n i = y - z + x;\n Console.WriteLine(i);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Number\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long n = long.Parse(s[0]);\n long k = long.Parse(s[1]);\n \n long x;\n\n if (n < k) x = k; else x = n + k - n % k;\n \n Console.Write(x);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Johny_Likes_Numbers\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int k = Next();\n\n long d = n/k;\n writer.WriteLine((d + 1)*k);\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _678A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), k = long.Parse(input[1]);\n long result = 0, ceil = (long)Math.Ceiling((decimal)n / k), floor = n / k;\n if (ceil == floor) result = (ceil + 1) * k;\n else result = ceil * k;\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] count = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n Console.WriteLine((count[0]/count[1]+1)*count[1]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#17 Resolve Johny Likes Numbers\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n ulong input1 = ulong.Parse(inputer[0]),\n input2 = ulong.Parse(inputer[1]);\n ulong newinput = input1%input2;\n input2 = input2 - newinput;\n \n Console.WriteLine(input2+input1);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _678A\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int k = int.Parse(tokens[1]);\n\n Console.WriteLine(n - n % k + k);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split(' ');\n long n = Convert.ToInt64(ab[0]);\n long k = Convert.ToInt64(ab[1]);\n long div = n / k;\n long val = k*(div+1);\n Console.Write(val);\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nclass Solution\n{\n static void Main(string[] args)\n {\n int[] a = Array.ConvertAll(ReadLine().Split(), int.Parse);\n WriteLine((a[0] / a[1] + 1) * a[1]);\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var v = Console.ReadLine().Split(' ').Select(x=>Convert.ToInt32(x)).ToArray();\n Console.WriteLine((v[0] / v[1] + 1)*v[1]);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s=Console.ReadLine().Split(' ');\n Int64 a=Int64.Parse(s[0]);\n Int64 b=Int64.Parse(s[1]);\n //int c=a/b;\n Console.WriteLine((a/b+1)*b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n long N, K;\n sc.Make(out N, out K);\n Console.WriteLine((N + K) / K * K);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing static System.Console;\n\nnamespace CodeForces\n{\n internal class Test1\n {\n private static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n\n var rest = n % k;\n\n var res = n - rest + k;\n\n Console.WriteLine(res);\n\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Get();\n p.Out(x);\n }\n \n object Get()\n {\n checked\n {\n var n = ReadLongToken();\n var k = ReadLongToken();\n var rem = n % k;\n if (rem == 0)\n return n + k;\n return n + k - rem;\n }\n }\n\n //object Get()\n //{\n // checked\n // {\n // var n = ReadIntToken();\n // var k = ReadIntToken();\n // var table = new bool[n, n];\n // for (int i = 0; i < n; i++)\n // {\n // var input = Read();\n // for (int j = 0; j < n; j++)\n // table[i, j] = input[j] == '.';\n // }\n // var cells = BFS(table); \n // }\n //}\n //Cell[,] BFS(bool[,] input)\n //{\n // var n = input.GetLength(0);\n // var cells = new Cell[n, n];\n // var visited = new bool[n, n];\n // var componentIndex = 0;\n // for (int i = 0; i < n; i++)\n // {\n // for (int j = 0; j < n; j++)\n // {\n // if (!visited[i, j] && input[i, j])\n // BFS(i, j, cells, input, visited, componentIndex);\n // }\n // }\n //}\n\n //void BFS(int i, int j, Cell[,] cells, bool[,] input, bool[,] visited, int ccIndex)\n //{\n // var n = input.GetLength(0);\n // for\n //}\n \n struct Cell\n {\n int CCNumber { get; set; }\n }\n\n class Automata\n {\n bool[] terminals;\n public int sigma;\n public int len;\n public int[,] jumps;\n\n public void Create()\n {\n var a = ReadInts();\n len = a[0];\n sigma = a[2];\n var ts = ReadInts();\n terminals = new bool[len];\n for (int i = 0; i < ts.Length; i++)\n terminals[ts[i]] = true;\n jumps = new int[len, sigma];\n for (int i = 0; i < len * sigma; i++)\n {\n var b = Console.ReadLine().Split(' ');\n jumps[Convert.ToInt32(b[0]), b[1][0] - 'a'] = Convert.ToInt32(b[2]);\n }\n }\n protected int[] ReadInts()\n {\n return Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n }\n\n public bool IsTerminal(int s)\n {\n return terminals[s];\n }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected int ReadInt()\n {\n return int.Parse(Read());\n }\n\n protected int ReadIntToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return int.Parse(tokens.Dequeue());\n }\n\n protected int[] ReadInts()\n {\n var tokens = Read().Split(' ');\n var result = new int[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = int.Parse(tokens[i]);\n return result;\n }\n\n\n protected long ReadLongToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return long.Parse(tokens.Dequeue());\n }\n\n protected long ReadLong()\n {\n return Convert.ToInt64(Read());\n }\n\n protected long[] ReadLongs()\n {\n var tokens = Read().Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return string.Join(delimeter, source.ToArray());\n }\n\n public static string JoinStrings(this IEnumerable source, string delimeter)\n {\n return source.Select(x => x.ToString()).JoinStrings(delimeter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\tstring[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint k = int.Parse (s [1]);\n\t\tif((n+1)%k==0)\n\t\t\tConsole.WriteLine (n+1);\n\t\telse \n\t\t\tConsole.WriteLine (n + k - n % k);\n\t\t\n\t\t/*string[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint m = int.Parse (s [1]);\n\t\ts = Console.ReadLine ().Split (' ');\n\t\tDictionary cost = new Dictionary ();\n\t\tcost.Add ('R', int.Parse (s [0]));\n\t\tcost.Add ('G', int.Parse (s [1]));\n\t\tcost.Add ('B', int.Parse (s [2]));\n\t\tcost.Add ('Y', int.Parse (s [3]));\n\n\t\tint start = 0, finish = 0;\n\t\tint[] A = new int[n * m];\n\t\tint[,] a = new int[n * m, n * m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tstring x = Console.ReadLine ();\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tint root = i * m + j;\n\t\t\t\tif (x [j] == 'X')\n\t\t\t\t\tA [root] = -1;\n\t\t\t\tif (x [j] == 'S')\n\t\t\t\t\tstart = i * m + j;\n\t\t\t\tif (x [j] == 'E')\n\t\t\t\t\tfinish = i * m + j;\n\t\t\t\tif (x [j] != 'X' && x [j] != 'S' && x [j] != 'E' && x [j] != '.')\n\t\t\t\t\tA [root] = cost [x [j]];\n\t\t\t}\n\t\t}\n\t\tfor (int u = 0; u < n * m; u++) {\n\t\t\tint x = u / m;\n\t\t\tint y = u - x * m;\n\t\t\tif (y + 1 < m) {\n\t\t\t\tif (A [u + 1] >= 0)\n\t\t\t\t\ta [u, u + 1] = A [u + 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + 1] = -1;\n\t\t\t}\n\t\t\tif (y - 1 >= 0) {\n\t\t\t\tif (A [u - 1] >= 0)\n\t\t\t\t\ta [u, u - 1] = A [u - 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - 1] = -1;\n\t\t\t}\n\t\t\tif (x + 1 < n) {\n\t\t\t\tif (A [u + m] >= 0)\n\t\t\t\t\ta [u, u + m] = A [u + m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + m] = -1;\n\t\t\t}\n\t\t\tif (x - 1 >= 0) {\n\t\t\t\tif (A [u - m] >= 0)\n\t\t\t\t\ta [u, u - m] = A [u - m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - m] = -1;\n\t\t\t}\n\n\t\t}\n\t\tint[] d = new int[n * m];\n\t\tbool[] used = new bool[n * m];\n\t\tint INF = (int)Math.Pow (10, 9);\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\td [i * m + j] = INF;\n\t\td [start] = 0;\n\n\t\tfor (int i = 0; i < n * m; i++) {\n\t\t\tint v = -1;\n\t\t\tfor (int j = 0; j < n * m; j++)\n\t\t\t\tif (!used [j] && (v == -1 || d [j] < d [v]))\n\t\t\t\t\tv = j;\n\t\t\tif (d [v] == INF)\n\t\t\t\tbreak;\n\t\t\tused [v] = true;\n\t\t\tfor (int j = 0; j < n * m; j++) \n\t\t\t\tif (a [v, j] >= 0 && d [v] + a [v, j] < d [j])\n\t\t\t\t\td [j] = d [v] + a [v, j];\n\t\t}*/\n\t}\n};"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _13a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readLongArray();\n var n = d[0];\n var k = d[1];\n\n var l = n / k + 1;\n Console.WriteLine(l * k);\n\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split();\n JohnyNumber(int.Parse(numbers[0]), int.Parse(numbers[1]));\n }\n\n private static void JohnyNumber(int n, int k)\n {\n int mult = 2;\n int i = k;\n while (i <= n || i % k != 0)\n i = k * mult++;\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF {\n class Program {\n static int n, k;\n\n static void solve()\n {\n var aux = Console.ReadLine().Split(' ');\n n = int.Parse(aux[0]);\n k = int.Parse(aux[1]);\n Console.WriteLine((n / k + 1) * k);\n }\n\n static void Main( string[ ] args ) {\n solve( );\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n int[] numbers = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n double n = numbers[0];\n double k = numbers[1];\n\n double res;\n if (n % k == 0)\n res = (n / k) + 1;\n else\n res = Math.Ceiling(n / k);\n\n res *= k;\n\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "/* Date: 14.06.2016 * Time: 22:45 */\n//\n\n/*\n\nA. \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 0.5 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd 256 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd k. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd x \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd, \ufffd\ufffd\ufffd x \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd k.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd k (1?<=?n,?k?<=?10^9).\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd x?>?n, \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd k.\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n5 3\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n6\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n25 13\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n26\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n26 13\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n39\n\n */\n\nusing System;\n\nclass Example\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tstring [] ss = (Console.ReadLine ()).Split (' ');\n\t\tint n = int.Parse (ss [0]);\n\t\tint k = int.Parse (ss [1]);\n\t\tInt64 x;\n\n\t\tif ( n % k == 0 )\n\t\t\tx = n + k;\n\t\telse\n\t\t\tx = (n + k - 1) / k * k;\n\t\t\n\t\tConsole.WriteLine (x);\n\t\t\n\t\t# if ( ! ONLINE_JUDGE )\n\t\t\tConsole.ReadKey ();\n\t\t# endif\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#17 Resolve Johny Likes Numbers\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n ulong input1 = ulong.Parse(inputer[0]),\n input2 = ulong.Parse(inputer[1]);\n ulong newinput = input1%input2;\n input2 = input2 - newinput;\n \n Console.WriteLine(input2+input1);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var d = Console.ReadLine().Split(' ');\n var n = long.Parse(d[0]);\n var k = long.Parse(d[1]);\n\n Console.WriteLine(k * (n / k + 1));\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Hellone_World\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long n , k;\n string[] s = (Console.ReadLine()).Split(' ');\n n = long.Parse(s[0]);\n k = long.Parse(s[1]);\n \n n++;\n if (n % k == 0)\n {\n Console.WriteLine(n);\n }\n else\n {\n long a = (n / k) + 1;\n a = a * k;\n Console.WriteLine(a);\n }\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Xml.Xsl;\nusing StringBuilder = System.Text.StringBuilder;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong k = inputs1[1];\n\n\t\t\tlong full = n / k;\n\t\t\tConsole.WriteLine((full + 1) * k);\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n public long broj()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public long[] niz()\n {\n string a = Console.ReadLine()+\" \";\n int cnt = 0, curr = 0;\n for (int i = 0; i < a.Length; i++) if (a[i] == ' ') cnt++;\n long[] niz = new long[cnt];\n cnt = 0;\n for(int i=0;i(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace deneme\n{\n class Program\n {\n static void Main(string[] args)\n { \n try\n {\n long[] nk = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long counter =0;\n // Console.Write(nk[0]+\" \"+nk[1]);\n if (nk[1] > nk[0])\n Console.Write(nk[1]);\n else if (nk[1] == nk[0])\n Console.Write(nk[1]*2);\n else\n {\n counter = nk[0] / nk[1]+1;\n Console.Write(counter*nk[1]);\n }\n Console.ReadKey();\n }\n catch { }\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing static System.Console;\n\nnamespace CodeForces\n{\n internal class Test1\n {\n private static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int k = int.Parse(input[1]);\n\n for (int i = 2; ; i++)\n {\n int prod = k * i;\n if (prod > n)\n {\n Console.WriteLine(prod);\n break;\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split();\n JohnyNumber(int.Parse(numbers[0]), int.Parse(numbers[1]));\n }\n\n private static void JohnyNumber(int n, int k)\n {\n bool searching = true;\n int i = n + 1;\n\n if (k * 2 > n)\n i = k * 2;\n\n while (searching)\n {\n if (i % k == 0)\n {\n searching = false;\n }\n else\n i++;\n }\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split();\n JohnyNumber(int.Parse(numbers[0]), int.Parse(numbers[1]));\n }\n\n private static void JohnyNumber(int n, int k)\n {\n int mult = 2;\n int i = n + 1;\n while(i < n || i % k != 0)\n i = k * mult++;\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split();\n JohnyNumber(int.Parse(numbers[0]), int.Parse(numbers[1]));\n }\n\n private static void JohnyNumber(int n, int k)\n {\n int mult = 2;\n int i = n;\n while (i <= n || i % k != 0)\n i = k * mult++;\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n int[] numbers = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n double n = numbers[0];\n double k = numbers[1];\n\n double res;\n if (n % k == 0)\n {\n res = (n / k) + 1;\n }\n else\n {\n res = Math.Ceiling(n / k);\n res *= k;\n }\n \n\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CSharp\n{\n internal static class Program\n {\n private static void Main(string[] args)\n {\n string[] numbers = Console.ReadLine().Split();\n JohnyNumber(int.Parse(numbers[0]), int.Parse(numbers[1]));\n }\n\n private static void JohnyNumber(int n, int k)\n {\n bool searching = true;\n int i = n;\n\n if (n > k && k * 2 > n)\n i = k * 2;\n\n while (searching)\n {\n if (i % k == 0)\n {\n searching = false;\n }\n else\n i++;\n }\n Console.WriteLine(i);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Hellone_World\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n long n , k;\n string[] s = (Console.ReadLine()).Split(' ');\n n = long.Parse(s[0]);\n k = long.Parse(s[1]);\n \n n++;\n if (n % k == 0)\n {\n Console.WriteLine(n);\n Console.WriteLine(\"OK\");\n }\n else\n {\n long a = (n / k) + 1;\n a = a * k;\n Console.WriteLine(a);\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\tstring[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint k = int.Parse (s [1]);\n\t\tif((n+1)%k==0)\n\t\t\tConsole.WriteLine (n);\n\t\telse \n\t\t\tConsole.WriteLine (n + k - n % k);\n\t\t\n\t\t/*string[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint m = int.Parse (s [1]);\n\t\ts = Console.ReadLine ().Split (' ');\n\t\tDictionary cost = new Dictionary ();\n\t\tcost.Add ('R', int.Parse (s [0]));\n\t\tcost.Add ('G', int.Parse (s [1]));\n\t\tcost.Add ('B', int.Parse (s [2]));\n\t\tcost.Add ('Y', int.Parse (s [3]));\n\n\t\tint start = 0, finish = 0;\n\t\tint[] A = new int[n * m];\n\t\tint[,] a = new int[n * m, n * m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tstring x = Console.ReadLine ();\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tint root = i * m + j;\n\t\t\t\tif (x [j] == 'X')\n\t\t\t\t\tA [root] = -1;\n\t\t\t\tif (x [j] == 'S')\n\t\t\t\t\tstart = i * m + j;\n\t\t\t\tif (x [j] == 'E')\n\t\t\t\t\tfinish = i * m + j;\n\t\t\t\tif (x [j] != 'X' && x [j] != 'S' && x [j] != 'E' && x [j] != '.')\n\t\t\t\t\tA [root] = cost [x [j]];\n\t\t\t}\n\t\t}\n\t\tfor (int u = 0; u < n * m; u++) {\n\t\t\tint x = u / m;\n\t\t\tint y = u - x * m;\n\t\t\tif (y + 1 < m) {\n\t\t\t\tif (A [u + 1] >= 0)\n\t\t\t\t\ta [u, u + 1] = A [u + 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + 1] = -1;\n\t\t\t}\n\t\t\tif (y - 1 >= 0) {\n\t\t\t\tif (A [u - 1] >= 0)\n\t\t\t\t\ta [u, u - 1] = A [u - 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - 1] = -1;\n\t\t\t}\n\t\t\tif (x + 1 < n) {\n\t\t\t\tif (A [u + m] >= 0)\n\t\t\t\t\ta [u, u + m] = A [u + m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + m] = -1;\n\t\t\t}\n\t\t\tif (x - 1 >= 0) {\n\t\t\t\tif (A [u - m] >= 0)\n\t\t\t\t\ta [u, u - m] = A [u - m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - m] = -1;\n\t\t\t}\n\n\t\t}\n\t\tint[] d = new int[n * m];\n\t\tbool[] used = new bool[n * m];\n\t\tint INF = (int)Math.Pow (10, 9);\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\td [i * m + j] = INF;\n\t\td [start] = 0;\n\n\t\tfor (int i = 0; i < n * m; i++) {\n\t\t\tint v = -1;\n\t\t\tfor (int j = 0; j < n * m; j++)\n\t\t\t\tif (!used [j] && (v == -1 || d [j] < d [v]))\n\t\t\t\t\tv = j;\n\t\t\tif (d [v] == INF)\n\t\t\t\tbreak;\n\t\t\tused [v] = true;\n\t\t\tfor (int j = 0; j < n * m; j++) \n\t\t\t\tif (a [v, j] >= 0 && d [v] + a [v, j] < d [j])\n\t\t\t\t\td [j] = d [v] + a [v, j];\n\t\t}*/\n\t}\n};"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nclass MainClass\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\tstring[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint k = int.Parse (s [1]);\n\t\tif(n%k==0)\n\t\t\tConsole.WriteLine (n);\n\t\telse \n\t\t\tConsole.WriteLine (n + k - n % k);\n\t\t\n\t\t/*string[] s = Console.ReadLine ().Split (' ');\n\t\tint n = int.Parse (s [0]);\n\t\tint m = int.Parse (s [1]);\n\t\ts = Console.ReadLine ().Split (' ');\n\t\tDictionary cost = new Dictionary ();\n\t\tcost.Add ('R', int.Parse (s [0]));\n\t\tcost.Add ('G', int.Parse (s [1]));\n\t\tcost.Add ('B', int.Parse (s [2]));\n\t\tcost.Add ('Y', int.Parse (s [3]));\n\n\t\tint start = 0, finish = 0;\n\t\tint[] A = new int[n * m];\n\t\tint[,] a = new int[n * m, n * m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tstring x = Console.ReadLine ();\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tint root = i * m + j;\n\t\t\t\tif (x [j] == 'X')\n\t\t\t\t\tA [root] = -1;\n\t\t\t\tif (x [j] == 'S')\n\t\t\t\t\tstart = i * m + j;\n\t\t\t\tif (x [j] == 'E')\n\t\t\t\t\tfinish = i * m + j;\n\t\t\t\tif (x [j] != 'X' && x [j] != 'S' && x [j] != 'E' && x [j] != '.')\n\t\t\t\t\tA [root] = cost [x [j]];\n\t\t\t}\n\t\t}\n\t\tfor (int u = 0; u < n * m; u++) {\n\t\t\tint x = u / m;\n\t\t\tint y = u - x * m;\n\t\t\tif (y + 1 < m) {\n\t\t\t\tif (A [u + 1] >= 0)\n\t\t\t\t\ta [u, u + 1] = A [u + 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + 1] = -1;\n\t\t\t}\n\t\t\tif (y - 1 >= 0) {\n\t\t\t\tif (A [u - 1] >= 0)\n\t\t\t\t\ta [u, u - 1] = A [u - 1];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - 1] = -1;\n\t\t\t}\n\t\t\tif (x + 1 < n) {\n\t\t\t\tif (A [u + m] >= 0)\n\t\t\t\t\ta [u, u + m] = A [u + m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u + m] = -1;\n\t\t\t}\n\t\t\tif (x - 1 >= 0) {\n\t\t\t\tif (A [u - m] >= 0)\n\t\t\t\t\ta [u, u - m] = A [u - m];\n\t\t\t\telse\n\t\t\t\t\ta [u, u - m] = -1;\n\t\t\t}\n\n\t\t}\n\t\tint[] d = new int[n * m];\n\t\tbool[] used = new bool[n * m];\n\t\tint INF = (int)Math.Pow (10, 9);\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t\td [i * m + j] = INF;\n\t\td [start] = 0;\n\n\t\tfor (int i = 0; i < n * m; i++) {\n\t\t\tint v = -1;\n\t\t\tfor (int j = 0; j < n * m; j++)\n\t\t\t\tif (!used [j] && (v == -1 || d [j] < d [v]))\n\t\t\t\t\tv = j;\n\t\t\tif (d [v] == INF)\n\t\t\t\tbreak;\n\t\t\tused [v] = true;\n\t\t\tfor (int j = 0; j < n * m; j++) \n\t\t\t\tif (a [v, j] >= 0 && d [v] + a [v, j] < d [j])\n\t\t\t\t\td [j] = d [v] + a [v, j];\n\t\t}*/\n\t}\n};"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tMain main = new Main();\n\t\t\t\tmain.ReadData();\n\t\t\t\tmain.Process();\n\t\t\t\tmain.WriteAnswer();\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tclass Main\n\t{\n\t\tprivate long _n;\n\t\tprivate long _k;\n\t\tprivate long _result;\n\n\t\tpublic void Process()\n\t\t{\n\t\t\tlong x = (long)Math.Floor(_n / (decimal)_k) * _k + 1;\n\n\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (x%_k == 0)\n\t\t\t\t{\n\t\t\t\t\t_result = x;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tx++;\n\t\t\t}\n\t\t}\n\n\t\tpublic void ReadData()\n\t\t{\n\t\t\t//TextReader textReader = Console.In;\n\t\t\tTextReader textReader = new StreamReader(\"input.txt\");\n\t\t\tusing (TextReader reader = textReader)\n\t\t\t{\n\t\t\t\tstring readLine = reader.ReadLine();\n\t\t\t\tstring[] strings1 = readLine.Split(' ');\n\n\t\t\t\t_n = int.Parse(strings1[0]);\n\t\t\t\t_k = long.Parse(strings1[1]);\n\t\t\t}\n\t\t}\n\n\t\tpublic void WriteAnswer()\n\t\t{\n\t\t\tusing (TextWriter writer = Console.Out)\n\t\t\t{\n\t\t\t\twriter.WriteLine(_result);\n\t\t\t}\n\t\t}\n\t}\n}\n"}], "src_uid": "75f3835c969c871a609b978e04476542"} {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Debug = System.Diagnostics.Trace;\nusing SB = System.Text.StringBuilder;\nusing static System.Math;\nusing Number = System.Int32;\nusing System.Numerics;\n\nnamespace Program {\n\tpublic class Solver {\n\t\tRandom rnd = new Random();\n\t\tpublic void Solve() {\n\t\t\tvar a = ri;\n\t\t\tvar b = ri;\n\t\t\tvar c = ri;\n\t\t\tvar d = ri;\n\n\t\t\tvar x = ri;\n\t\t\tvar y = ri;\n\t\t\tvar max = 0L;\n\t\t\tfor (int i = 0; i <= d; i++) {\n\t\t\t\tif (a < i) break;\n\t\t\t\tvar v = x * i;\n\t\t\t\tv += y * new int[] { b, c, d - i }.Min();\n\t\t\t\tDebug.WriteLine(i);\n\t\t\t\tDebug.WriteLine(v);\n\t\t\t\tmax = Max(max, v);\n\t\t\t}\n\t\t\tConsole.WriteLine(max);\n\t\t}\n\n\t\tconst long INF = 1L << 60;\n\t\tstatic int[] dx = { -1, 0, 1, 0 };\n\t\tstatic int[] dy = { 0, 1, 0, -1 };\n\t\tint ri { get { return sc.Integer(); } }\n\t\tlong rl { get { return sc.Long(); } }\n\t\tdouble rd { get { return sc.Double(); } }\n\t\tstring rs { get { return sc.Scan(); } }\n\t\tpublic IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n\n\t\tstatic T[] Enumerate(int n, Func f) {\n\t\t\tvar a = new T[n];\n\t\t\tfor (int i = 0; i < a.Length; ++i) a[i] = f(i);\n\t\t\treturn a;\n\t\t}\n\t\tstatic public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n\t}\n}\n\n#region main\nstatic class Ex {\n\tstatic public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n\tstatic public string AsJoinedString(this IEnumerable ie, string st = \" \") {\n\t\treturn string.Join(st, ie);\n\t}\n\tstatic public void Main() {\n\t\tConsole.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });\n\t\tvar solver = new Program.Solver();\n\t\t//* \n\t\tvar t = new System.Threading.Thread(solver.Solve, 50000000);\n\t\tt.Start();\n\t\tt.Join();\n\t\t//*/\n\t\t// solver.Solve();\n\t\tConsole.Out.Flush();\n\t}\n}\n#endregion\n#region Ex\nnamespace Program.IO {\n\tusing System.IO;\n\tusing System.Text;\n\tusing System.Globalization;\n\n\tpublic class Printer : StreamWriter {\n\t\tpublic override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n\t\tpublic Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n\t}\n\n\tpublic class StreamScanner {\n\t\tpublic StreamScanner(Stream stream) { str = stream; }\n\n\t\tpublic readonly Stream str;\n\t\tprivate readonly byte[] buf = new byte[1024];\n\t\tprivate int len, ptr;\n\t\tpublic bool isEof = false;\n\t\tpublic bool IsEndOfStream { get { return isEof; } }\n\n\t\tprivate byte read() {\n\t\t\tif (isEof) return 0;\n\t\t\tif (ptr >= len) {\n\t\t\t\tptr = 0;\n\t\t\t\tif ((len = str.Read(buf, 0, 1024)) <= 0) {\n\t\t\t\t\tisEof = true;\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buf[ptr++];\n\t\t}\n\n\t\tpublic char Char() {\n\t\t\tbyte b = 0;\n\t\t\tdo b = read(); while ((b < 33 || 126 < b) && !isEof);\n\t\t\treturn (char)b;\n\t\t}\n\t\tpublic string Scan() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic string ScanLine() {\n\t\t\tvar sb = new StringBuilder();\n\t\t\tfor (var b = Char(); b != '\\n' && b != 0; b = (char)read()) if (b != '\\r') sb.Append(b);\n\t\t\treturn sb.ToString();\n\t\t}\n\t\tpublic long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }\n\t\tpublic int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }\n\t\tpublic double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }\n\t}\n}\n\n#endregion\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int[] a = new int[6];\n for (int i = 0; i < 6; i++)\n {\n a[i] = sc.NextInt();\n }\n\n long ans = 0;\n // e\u306b\u4f7f\u3046\u30b8\u30e3\u30b1\u30c3\u30c8\n for (int g = 0; g <= a[3]; g++)\n {\n int cntE = Math.Min(a[0], g);\n int cntF = Math.Min(a[1], Math.Min(a[2], a[3] - g));\n\n ans = Math.Max(ans, cntE * a[4] + cntF * a[5]);\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n private readonly TextWriter output;\n \n public void Solve()\n {\n // var t = input.ReadInt();\n // var ans = new List(t);\n // for (int _ = 0; _ < t; _++)\n // {\n var (a, b,c,d) = input.Read4Int();\n var (e, f) = input.Read2Int();\n int ce, cf;\n if (e > f)\n {\n ce = Min(a, d);\n d -= ce;\n cf = Min(b, Min(c, d));\n }\n else\n {\n cf = Min(b, Min(c, d));\n d -= cf;\n ce = Min(a, d);\n }\n var s = ce * e + cf * f;\n output.Write(s);\n // }\n // output.WriteLine(string.Join(Environment.NewLine, ans));\n }\n\n public ProblemSolver(TextReader input, TextWriter output)\n {\n this.input = new Tokenizer(input);\n this.output = output;\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n private readonly StringBuilder tokenBuilder = new StringBuilder();\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n \n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public int[] ReadIntArray(int n) => ReadArray(n, ReadInt);\n\n public long[] ReadLongArray(int n) => ReadArray(n, ReadLong);\n\n public double[] ReadDoubleArray(int n) => ReadArray(n, ReadDouble);\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n tokenBuilder.Clear();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n tokenBuilder.Append((char)c);\n c = reader.Read();\n }\n return tokenBuilder.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n \n private static T[] ReadArray(int n, Func readFunc)\n {\n var a = new T[n];\n for (var i = 0; i < n; i++)\n a[i] = readFunc();\n return a;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal static class Program\n {\n private const int BufferSize = 1024 * 10;\n\n public static void Main()\n {\n using var reader = new StreamReader(OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n using var writer = new StreamWriter(OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);\n var solver = new ProblemSolver(reader, writer);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing CodeforcesRound608Div2.Questions;\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public class QuestionA : AtCoderQuestionBase\n {\n public override void Solve(IOManager io)\n {\n var ties = io.ReadInt();\n var scarves = io.ReadInt();\n var vests = io.ReadInt();\n var jackets = io.ReadInt();\n var firstCost = io.ReadInt();\n var secondCost = io.ReadInt();\n\n var max = 0;\n\n for (int jacketFirst = 0; jacketFirst <= jackets; jacketFirst++)\n {\n var first = Math.Min(ties, jacketFirst);\n var second = Math.Min(Math.Min(scarves, vests), jackets - jacketFirst);\n max.ChangeMax(first * firstCost + second * secondCost);\n }\n\n io.WriteLine(max);\n }\n }\n}\n\nnamespace CodeforcesRound608Div2\n{\n class Program\n {\n static void Main(string[] args)\n {\n IAtCoderQuestion question = new QuestionA();\n using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());\n question.Solve(io);\n }\n }\n}\n\n#region Base Class\n\nnamespace CodeforcesRound608Div2.Questions\n{\n public interface IAtCoderQuestion\n {\n string Solve(string input);\n void Solve(IOManager io);\n }\n\n public abstract class AtCoderQuestionBase : IAtCoderQuestion\n {\n public string Solve(string input)\n {\n var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));\n var outputStream = new MemoryStream();\n using var manager = new IOManager(inputStream, outputStream);\n\n Solve(manager);\n manager.Flush();\n\n outputStream.Seek(0, SeekOrigin.Begin);\n var reader = new StreamReader(outputStream);\n return reader.ReadToEnd();\n }\n\n public abstract void Solve(IOManager io);\n }\n}\n\n#endregion\n\n#region Utils\n\nnamespace CodeforcesRound608Div2\n{\n public class IOManager : IDisposable\n {\n private readonly BinaryReader _reader;\n private readonly StreamWriter _writer;\n private bool _disposedValue;\n private byte[] _buffer = new byte[1024];\n private int _length;\n private int _cursor;\n private bool _eof;\n\n const char ValidFirstChar = '!';\n const char ValidLastChar = '~';\n\n public IOManager(Stream input, Stream output)\n {\n _reader = new BinaryReader(input);\n _writer = new StreamWriter(output) { AutoFlush = false };\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private char ReadAscii()\n {\n if (_cursor == _length)\n {\n _cursor = 0;\n _length = _reader.Read(_buffer);\n\n if (_length == 0)\n {\n if (!_eof)\n {\n _eof = true;\n return char.MinValue;\n }\n else\n {\n ThrowEndOfStreamException();\n }\n }\n }\n\n return (char)_buffer[_cursor++];\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public char ReadChar()\n {\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n return c;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public string ReadString()\n {\n var builder = new StringBuilder();\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n builder.Append(c);\n } while (IsValidChar(c = ReadAscii()));\n\n return builder.ToString();\n }\n\n public int ReadInt() => (int)ReadLong();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public long ReadLong()\n {\n long result = 0;\n bool isPositive = true;\n char c;\n\n while (!IsNumericChar(c = ReadAscii())) { }\n\n if (c == '-')\n {\n isPositive = false;\n c = ReadAscii();\n }\n\n do\n {\n result *= 10;\n result += c - '0';\n } while (IsNumericChar(c = ReadAscii()));\n\n return isPositive ? result : -result;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private Span ReadChunk(Span span)\n {\n var i = 0;\n char c;\n while (!IsValidChar(c = ReadAscii())) { }\n\n do\n {\n span[i++] = c;\n } while (IsValidChar(c = ReadAscii()));\n\n return span.Slice(0, i);\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadInt();\n }\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadLong();\n }\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDouble();\n }\n return a;\n }\n\n public decimal[] ReadDecimalArray(int n)\n {\n var a = new decimal[n];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = ReadDecimal();\n }\n return a;\n }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public void WriteLine(T value) => _writer.WriteLine(value.ToString());\n\n public void WriteLine(IEnumerable values, char separator)\n {\n var e = values.GetEnumerator();\n if (e.MoveNext())\n {\n _writer.Write(e.Current.ToString());\n\n while (e.MoveNext())\n {\n _writer.Write(separator);\n _writer.Write(e.Current.ToString());\n }\n }\n\n _writer.WriteLine();\n }\n\n public void WriteLine(Span values, char separator) => WriteLine((ReadOnlySpan)values, separator);\n\n public void WriteLine(ReadOnlySpan values, char separator)\n {\n for (int i = 0; i < values.Length - 1; i++)\n {\n _writer.Write(values[i]);\n _writer.Write(separator);\n }\n\n if (values.Length > 0)\n {\n _writer.Write(values[^1]);\n }\n\n _writer.WriteLine();\n }\n\n public void Flush() => _writer.Flush();\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';\n\n private void ThrowEndOfStreamException() => throw new EndOfStreamException();\n\n protected virtual void Dispose(bool disposing)\n {\n if (!_disposedValue)\n {\n if (disposing)\n {\n _reader.Dispose();\n _writer.Flush();\n _writer.Dispose();\n }\n\n _disposedValue = true;\n }\n }\n\n public void Dispose()\n {\n Dispose(disposing: true);\n GC.SuppressFinalize(this);\n }\n }\n\n public static class UtilExtensions\n {\n public static void ChangeMax(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n a = b;\n }\n }\n\n public static void ChangeMin(ref this T a, T b) where T : struct, IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n a = b;\n }\n }\n\n public static void Sort(this T[] array) where T : IComparable => Array.Sort(array);\n public static void Sort(this T[] array, Comparison comparison) => Array.Sort(array, comparison);\n }\n}\n\n#endregion\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int e = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n long price = 0;\n int first = 0;\n int second = 0;\n if (f >= e)\n {\n second = Math.Min(b, (Math.Min(c, d)));\n d -= second; b -= second; c -= second;\n first = Math.Min(a, d);\n a -= first; d -= first;\n }\n else\n {\n first = Math.Min(a, d);\n a -= first; d -= first;\n second = Math.Min(b, (Math.Min(c, d)));\n d -= second; b -= second; c -= second;\n }\n price = first * e + second * f;\n\n Console.WriteLine(price);\n\n // Console.ReadKey();\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace suits2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, d, e, f;\n\n a = Convert.ToInt32(Console.ReadLine());\n b = Convert.ToInt32(Console.ReadLine());\n c = Convert.ToInt32(Console.ReadLine());\n d = Convert.ToInt32(Console.ReadLine());\n e = Convert.ToInt32(Console.ReadLine());\n f = Convert.ToInt32(Console.ReadLine());\n\n int m = Math.Min(b, Math.Min(c, d));\n int all = m * f + e * Math.Min(a, d - m);\n\n int x = Math.Min(a, d);\n int y = x * e + f * Math.Min(b, Math.Min(c, d - x));\n\n int vegleges = Math.Max(y, all);\n\n Console.WriteLine(vegleges);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf608\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf608A();\n }\n\n public static void solve_cf608B()\n {\n\n }\n\n public static void solve_cf608A()\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n int ans = 0;\n if (f > e)\n { \n int df = Math.Min(Math.Min(b, d), Math.Min(c, d));\n ans = df * f;\n d = d - df;\n ans += e * Math.Min(d, a);\n }\n else\n {\n int de = Math.Min(a, d);\n ans = de * e;\n d = d - de;\n ans += f * Math.Min(Math.Min(b, d), Math.Min(c, d));\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int a = sc.NextInt(); //1\n int b = sc.NextInt(); //2\n int c = sc.NextInt(); //2\n int d = sc.NextInt(); //12\n int e = sc.NextInt();\n int f = sc.NextInt();\n\n long ans = 0;\n for (int type1 = 0; type1 <=d ; type1++)\n {\n int type2 = d - type1;\n\n long t = Math.Min(type1, a) * e + Math.Min(Math.Min(type2,b),c)*f;\n ans = Math.Max(ans, t);\n }\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n\nclass Scanner\n{\n public Scanner()\n {\n _pos = 0;\n _line = new string[0];\n }\n\n const char Separator = ' ';\n private int _pos;\n private string[] _line;\n\n #region \u30b9\u30da\u30fc\u30b9\u533a\u5207\u308a\u3067\u53d6\u5f97\n\n public string Next()\n {\n if (_pos >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _pos = 0;\n }\n\n return _line[_pos++];\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n\n #endregion\n\n #region \u578b\u5909\u63db\n\n private int[] ToIntArray(string[] array)\n {\n var result = new int[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = int.Parse(array[i]);\n }\n\n return result;\n }\n\n private long[] ToLongArray(string[] array)\n {\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = long.Parse(array[i]);\n }\n\n return result;\n }\n\n private double[] ToDoubleArray(string[] array)\n {\n var result = new double[array.Length];\n for (int i = 0; i < array.Length; i++)\n {\n result[i] = double.Parse(array[i]);\n }\n\n return result;\n }\n\n #endregion\n\n #region \u914d\u5217\u53d6\u5f97\n\n public string[] Array()\n {\n if (_pos >= _line.Length)\n _line = Console.ReadLine().Split(Separator);\n\n _pos = _line.Length;\n return _line;\n }\n\n public int[] IntArray()\n {\n return ToIntArray(Array());\n }\n\n public long[] LongArray()\n {\n return ToLongArray(Array());\n }\n\n public double[] DoubleArray()\n {\n return ToDoubleArray(Array());\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problems\n{\n class Problems\n {\n\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n int suitsCost = 0;\n if (e > f)\n {\n int suits1 = Math.Min(a, d);\n suitsCost = suits1*e + Math.Min(d - suits1, Math.Min(b, c))*f;\n }\n else\n {\n int suits2 = Math.Min(d, Math.Min(b, c));\n suitsCost = suits2*f + Math.Min(d - suits2, a)*e;\n }\n Console.WriteLine(suitsCost);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1271_Suits\n {\n public static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int e = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n\n int[] array = new int[3];\n decimal totalSuit1 = 0;\n decimal totalSuit2 = 0;\n\n if (e > f)\n {\n if (a > d)\n {\n totalSuit1 = d * e;\n a -= d;\n d = 0;\n }\n else\n {\n totalSuit1 = a * e;\n d -= a;\n } \n array[0] = b;\n array[1] = c;\n array[2] = d;\n Array.Sort(array);\n totalSuit2 = f * array[0];\n }\n else {\n array[0] = b;\n array[1] = c;\n array[2] = d;\n Array.Sort(array);\n totalSuit2 = f * array[0];\n\n d -= array[0];\n\n if (a > d)\n {\n totalSuit1 = d * e;\n a -= d;\n }\n else\n {\n totalSuit1 = a * e;\n d -= a;\n }\n }\n \n Console.WriteLine(totalSuit2+totalSuit1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, d, e, f;\n a = int.Parse( Console.ReadLine() );\n b = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n d = int.Parse(Console.ReadLine());\n e = int.Parse(Console.ReadLine());\n f = int.Parse(Console.ReadLine());\n\n if (e > f)\n {\n int delim = Math.Min(a, d);\n int ans = delim * e;\n if (delim != d) \n {\n d -= a;\n delim = Math.Min(b, Math.Min(c, d));\n ans += delim * f;\n }\n Console.WriteLine(ans);\n }else \n {\n int delim = Math.Min(b, Math.Min(c, d));\n int ans = delim * f;\n if (delim != d)\n {\n d -= delim;\n delim = Math.Min(a, d);\n ans += delim * e;\n }\n Console.WriteLine(ans);\n }\n //Console.ReadKey();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Numerics;\n\nclass Program\n{\n\n\n /* Input Methoden : \n * \n * Integer: int n = int.Parse(Console.ReadLine());\n * String: String n = Console.ReadLine();\n * Integer Array: int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();\n * String Array: String[] input = Console.ReadLine().Split(' ');\n * \n * --- Datenstrukturen:\n * List list = new List();\n * HashSet hset = new HashSet(); \n * Dictionary dict = new Dictionary();\n * \n * \n * Ausgabe: Console.WriteLine();\n * \n * \n * \n */\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int e = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n long cost = 0;\n\n if (e >= f) {\n\n int s = Math.Min(a,d);\n cost += e * s;\n\n d -= s;\n\n if (d > 0) {\n\n s = Math.Min(Math.Min(b,c),d);\n cost += f * s;\n\n }\n \n }\n else {\n\n \n int s = Math.Min(Math.Min(b, c), d);\n cost += f * s;\n\n d -= s;\n\n if (d > 0) {\n s = Math.Min(a, d);\n cost += e * s;\n\n }\n\n\n }\n\n Console.WriteLine(cost);\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = new List();\n int result = 0;\n for (int i = 0; i < 6; i++)\n {\n input.Add(Int32.Parse(Console.ReadLine()));\n }\n if (input[5] > input[4])\n {\n var secondType = new List() { input[1], input[2], input[3] };\n int num = secondType[secondType.IndexOf(secondType.Min())];\n result += num * input[5];\n input[3] -= num;\n if (input[3] > 0)\n {\n var firstType = new List() { input[0], input[3] };\n num = firstType[firstType.IndexOf(firstType.Min())];\n result += num * input[4];\n }\n }\n else\n {\n var firstType = new List() { input[0], input[3] };\n int num = firstType[firstType.IndexOf(firstType.Min())];\n result += num * input[4];\n input[3] -= num;\n if (input[3] > 0)\n {\n var secondType = new List() { input[1], input[2], input[3] };\n num = secondType[secondType.IndexOf(secondType.Min())];\n result += num * input[5];\n }\n }\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n if (f >= e)\n {\n int min = Math.Min(b, Math.Min(c, d));\n\n long ans = min * f;\n if (d > min)\n {\n d = d - min;\n\n int minn = Math.Min(a, d);\n ans = ans + minn * e;\n\n Console.WriteLine(ans);\n }\n else\n Console.WriteLine(ans);\n }\n else if (f < e)\n {\n int min = Math.Min(a, d);\n long ans = min * e;\n\n if (d == min)\n Console.WriteLine(ans);\n else\n {\n d = d - min;\n ans = ans + Math.Min(b, Math.Min(c, d)) * f;\n Console.WriteLine(ans);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n struct symbol: IComparable\n {\n public char value;\n public int index;\n\n public int CompareTo(object obj)\n {\n symbol second = (symbol)obj;\n return this.value.CompareTo(second.value);\n }\n }\n static void Sort(List a, int n)\n {\n for(int i = 0; i a[j+1].value)\n {\n symbol temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n }\n }\n }\n }\n static void Main(string[] args)\n {\n int a, b, c, d, e, f;\n a = int.Parse(Console.ReadLine());\n b = int.Parse(Console.ReadLine());\n c = int.Parse(Console.ReadLine());\n d = int.Parse(Console.ReadLine());\n e = int.Parse(Console.ReadLine());\n f = int.Parse(Console.ReadLine());\n int res = 0;\n if(e>f)\n {\n res += Math.Min(a, d) * e;\n d -= Math.Min(a, d);\n res += Math.Min(b, Math.Min(c, d)) * f;\n }\n else\n {\n res += Math.Min(b, Math.Min(c, d)) * f;\n d -= Math.Min(b, Math.Min(c, d));\n res += Math.Min(a, d) * e;\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "/* Date: 17.12.2019 * Time: 21:45 */\n//\n// CF 608 A\n//\n// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2\n//\n//\n\n/*\n\ufffd\tfflush(stdout) \ufffd \ufffd\ufffd\ufffd\ufffd\ufffd C++; \n\ufffd\tSystem.out.flush() \ufffd Java; \n\ufffd\tstdout.flush() \ufffd Python; \n\ufffd\tflush(output) \ufffd Pascal; \n\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n# if ( ! ONLINE_JUDGE )\n\t\tStreamReader sr = new StreamReader (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\043\\\\A.TXT\");\n\t\tStreamWriter sw = new StreamWriter (\"C:\\\\TRR\\\\2019\\\\Task\\\\07 Codeforces\\\\043\\\\OUTPUT.OUT\");\n# endif\n\n\t\tNumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;\n/*\n\t\tint q;\n\n# if ( ONLINE_JUDGE )\n\t\tq = int.Parse (Console.ReadLine ());\n# else\n\t\tq = int.Parse (sr.ReadLine ());\n\t\tsw.WriteLine (\"*** TEST = \" + q);\n# endif\n\n\t\tfor ( int qqq=0; qqq < q; qqq++ )\n\t\t{\n*/\n\t\t\tint a, b, c, d, e, f;\n\n# if ( ONLINE_JUDGE )\n\t\t\ta = int.Parse (Console.ReadLine ());\n\t\t\tb = int.Parse (Console.ReadLine ());\n\t\t\tc = int.Parse (Console.ReadLine ());\n\t\t\td = int.Parse (Console.ReadLine ());\n\t\t\te = int.Parse (Console.ReadLine ());\n\t\t\tf = int.Parse (Console.ReadLine ());\n# else\n\t\t\ta = int.Parse (sr.ReadLine ());\n\t\t\tb = int.Parse (sr.ReadLine ());\n\t\t\tc = int.Parse (sr.ReadLine ());\n\t\t\td = int.Parse (sr.ReadLine ());\n\t\t\te = int.Parse (sr.ReadLine ());\n\t\t\tf = int.Parse (sr.ReadLine ());\n# endif\n\n\n# if ( ! ONLINE_JUDGE )\n\t\t\tsw.WriteLine (\"*** a = \" + a);\n\t\t\tsw.WriteLine (\"*** b = \" + b);\n\t\t\tsw.WriteLine (\"*** c = \" + c);\n\t\t\tsw.WriteLine (\"*** d = \" + d);\n\t\t\tsw.WriteLine (\"*** e = \" + e);\n\t\t\tsw.WriteLine (\"*** f = \" + f);\n# endif\n\n\t\t\tint k = 0;\n\t\t\tb = Math.Min (b, c);\n\n\t\t\tif ( e > f )\n\t\t\t{\n\t\t\t\tint x = Math.Min (a, d);\n\t\t\t\tk = x*e;\n\t\t\t\tif ( d > a )\n\t\t\t\t\tk += Math.Min (b, d-a)*f;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint x = Math.Min (b, d);\n\t\t\t\tk = x*f;\n\t\t\t\tif ( d > b )\n\t\t\t\t\tk += Math.Min (a, d-b)*e;\n\t\t\t}\n\n# if ( ONLINE_JUDGE )\n\t\t\tConsole.WriteLine (k);\n# else\n\t\t\tsw.WriteLine (k);\n# endif\n\n//\t\t}\n\n# if ( ! ONLINE_JUDGE )\n\t\tsw.Close ();\n# endif\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static System.Math;\nusing static Solve.Methods;\nusing static Solve.Input;\nusing static Solve.Output;\nusing pii = Solve.Pair;\nusing pll = Solve.Pair;\nusing pli = Solve.Pair;\nusing pil = Solve.Pair;\nusing pss = Solve.Pair;\nusing psi = Solve.Pair;\nusing lint = System.Collections.Generic.List;\nusing llong = System.Collections.Generic.List;\nusing lstr = System.Collections.Generic.List;\nusing llint = System.Collections.Generic.List>;\nusing llstr = System.Collections.Generic.List>;\nusing lllong = System.Collections.Generic.List>;\nusing lii = System.Collections.Generic.List>;\nusing lll = System.Collections.Generic.List>;\nusing lli = System.Collections.Generic.List>;\nusing lil = System.Collections.Generic.List>;\nusing ll = System.Int64;\n\n\nnamespace Solve\n{\n public class Solver\n {\n public void Main()\n {\n int a, b, c, d, e, f;\n In(out a, out b, out c);\n In(out d, out e, out f);\n\n int type1_cnt, type2_cnt;\n long ans = 0;\n if (e < f)\n {\n type2_cnt = Min(b,c,d);\n d -= type2_cnt;\n type1_cnt = Min(a, d);\n }\n else\n {\n type1_cnt = Min(a, d);\n d -= type1_cnt;\n type2_cnt = Min(b, c, d);\n }\n\n cout = type1_cnt * e + type2_cnt * f;\n\n }\n\n // ReSharper disable UnusedMember.Local\n private const int MOD = (int) 1e9 + 7,\n INF = 1000000010;\n\n private const long LINF = 1000000000000000100;\n }\n\n // \u30e9\u30a4\u30d6\u30e9\u30ea\u7f6e\u304d\u5834\u3053\u3053\u304b\u3089\n\n\n [DebuggerDisplay(\"Value = {\" + nameof(_value) + \"}\")]\n public struct ModInt : IEquatable, IComparable\n {\n private long _value;\n\n public const int MOD = (int) 1e9 + 7;\n\n public static readonly ModInt Zero = new ModInt(0);\n\n public static readonly ModInt One = new ModInt(1);\n\n public ModInt(long value)\n {\n _value = value % MOD;\n }\n\n private ModInt(int value)\n {\n _value = value;\n }\n\n public int Value => (int) _value;\n\n public ModInt Invert => ModPow(this, MOD - 2);\n\n public static ModInt operator -(ModInt value)\n {\n value._value = MOD - value._value;\n return value;\n }\n\n public static ModInt operator +(ModInt left, ModInt right)\n {\n left._value += right._value;\n if (left._value >= MOD) left._value -= MOD;\n return left;\n }\n\n public static ModInt operator -(ModInt left, ModInt right)\n {\n left._value -= right._value;\n if (left._value < 0) left._value += MOD;\n return left;\n }\n\n public static ModInt operator *(ModInt left, ModInt right)\n {\n left._value = left._value * right._value % MOD;\n return left;\n }\n\n public static ModInt operator /(ModInt left, ModInt right) => left * right.Invert;\n\n public static ModInt operator ++(ModInt value)\n {\n if (value._value == MOD - 1) value._value = 0;\n else value._value++;\n return value;\n }\n\n public static ModInt operator --(ModInt value)\n {\n if (value._value == 0) value._value = MOD - 1;\n else value._value--;\n return value;\n }\n\n public static bool operator ==(ModInt left, ModInt right) => left.Equals(right);\n\n public static bool operator !=(ModInt left, ModInt right) => !left.Equals(right);\n\n public static implicit operator ModInt(int value) => new ModInt(value);\n\n public static implicit operator ModInt(long value) => new ModInt(value);\n\n public static ModInt ModPow(ModInt value, long exponent)\n {\n var r = new ModInt(1);\n for (; exponent > 0; value *= value, exponent >>= 1)\n if ((exponent & 1) == 1)\n r *= value;\n return r;\n }\n\n public static ModInt ModFact(int value)\n {\n var r = new ModInt(1);\n for (var i = 2; i <= value; i++) r *= value;\n return r;\n }\n\n public bool Equals(ModInt other) => _value == other._value;\n\n public override bool Equals(object obj)\n {\n return obj != null && this.Equals((ModInt) obj);\n }\n\n public override int GetHashCode() => _value.GetHashCode();\n\n public override string ToString() => _value.ToString();\n\n public int CompareTo(ModInt other)\n {\n return _value.CompareTo(other._value);\n }\n }\n // \u30e9\u30a4\u30d6\u30e9\u30ea\u7f6e\u304d\u5834\u3053\u3053\u307e\u3067\n\n #region Templete\n\n#if !LOCAL\nnamespace Library { }\n#endif\n public static class Methods\n {\n public static readonly int[] dx = {-1, 0, 0, 1};\n public static readonly int[] dy = {0, 1, -1, 0};\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void Assert(bool b, string message = null)\n {\n if (!b) throw new Exception(message ?? \"Assert failed.\");\n }\n\n /*\n public static Comparison greater() \n where T : IComparable \n => (a, b) => b.CompareTo(a);\n */\n\n public static string JoinSpace(this IEnumerable source) => source.Join(\" \");\n public static string JoinEndline(this IEnumerable source) => source.Join(\"\\n\");\n public static string Join(this IEnumerable source, string s) => string.Join(s, source);\n public static string Join(this IEnumerable source, char c) => string.Join(c.ToString(), source);\n\n /// \n /// \u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\n /// \n /// first\u306e\u578b\n /// second\u306e\u578b\n /// first\u306e\u5024\n /// second\u306e\u5024\n /// \u4f5c\u6210\u3057\u305f \u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\n public static Pair make_pair(T1 first, T2 second)\n where T1 : IComparable\n where T2 : IComparable\n => new Pair(first, second);\n\n /// a\u3068b\u3092\u30b9\u30ef\u30c3\u30d7\u3057\u307e\u3059\u3002\n public static void Swap(ref T a, ref T b) where T : struct\n {\n var tmp = b;\n b = a;\n a = tmp;\n }\n\n /// a\u3068b\u306e\u6700\u5927\u516c\u7d04\u6570\u3092\u6c42\u3081\u307e\u3059\u3002\n /// a\u3068b\u306e\u6700\u5927\u516c\u7d04\u6570\n public static long Gcd(long a, long b)\n {\n while (true)\n {\n if (a < b) Swap(ref a, ref b);\n if (a % b == 0) return b;\n var x = a;\n a = b;\n b = x % b;\n }\n }\n\n /// a\u3068b\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u307e\u3059\u3002\n /// a\u3068b\u306e\u6700\u5c0f\u516c\u500d\u6570\n public static long Lcm(long a, long b) => a / Gcd(a, b) * b;\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u6570\u5024\u304c\u7d20\u6570\u3067\u3042\u308b\u304b\u3092\u5224\u5b9a\u3057\u307e\u3059\u3002\n /// \n /// \u8a08\u7b97\u91cf (sqrt(value)) \n /// \u5224\u5b9a\u3059\u308b\u6570\u5024\n /// value \u304c\u7d20\u6570\u3067\u3042\u308b\u304b\n public static bool IsPrime(long value)\n {\n if (value <= 1) return false;\n for (long i = 2; i * i <= value; i++)\n if (value % i == 0)\n return false;\n return true;\n }\n\n /// \n /// ^ (mod ) \u3092\u6c42\u3081\u308b\n /// \n /// ^ (mod ) \u306e\u5024\n public static long PowMod(long a, long b, long p)\n {\n long res = 1;\n while (b > 0)\n {\n if (b % 2 != 0) res = res * a % p;\n a = a * a % p;\n b >>= 1;\n }\n\n return res;\n }\n\n /// \n /// mod p\u306b\u304a\u3051\u308ba\u306e\u9006\u5143\u3092\u6c42\u3081\u307e\u3059\u3002\n /// \n /// \n /// \u6cd5\n /// \n public static long ModInv(long a, long p)\n => PowMod(a, p - 2, p);\n\n public static int DivCeil(int left, int right)\n => left / right + (left % right == 0 ? 0 : 1);\n\n public static long DivCeil(long left, long right)\n => left / right + (left % right == 0L ? 0L : 1L);\n\n /// \n /// src \u306e\u9806\u5217\u3092\u6c42\u3081\u307e\u3059\u3002\n /// \n /// \u578b\n /// \u9806\u5217\u3092\u6c42\u3081\u308b\u914d\u5217\n /// src \u306e\u9806\u5217\n public static IEnumerable Permutations(IEnumerable src)\n {\n var ret = new List();\n Search(ret, new Stack(), src.ToArray());\n return ret;\n }\n\n private static void Search(ICollection perms, Stack stack, T[] a)\n {\n int N = a.Length;\n if (N == 0) perms.Add(stack.Reverse().ToArray());\n else\n {\n var b = new T[N - 1];\n Array.Copy(a, 1, b, 0, N - 1);\n for (int i = 0; i < a.Length; ++i)\n {\n stack.Push(a[i]);\n Search(perms, stack, b);\n if (i < b.Length) b[i] = a[i];\n stack.Pop();\n }\n }\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u6761\u4ef6\u3092\u6e80\u305f\u3059\u6700\u5c0f\u306e\u6570\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u691c\u7d22\u3059\u308b\u6570\u5024\u306e\u6700\u5c0f\u5024\n /// \u691c\u7d22\u3059\u308b\u6570\u5024\u306e\u6700\u5927\u5024\n /// \u6761\u4ef6\n /// \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6700\u5c0f\u306e\u6570\u5024\n public static long BinarySearch(long low, long high, Func expression)\n {\n while (low < high)\n {\n long middle = (high - low) / 2 + low;\n if (!expression(middle))\n high = middle;\n else\n low = middle + 1;\n }\n\n return high;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u958b\u59cb\u30a4\u30f3\u30c7\u30af\u30b9 [inclusive]\n /// \u7d42\u4e86\u30a4\u30f3\u30c7\u30af\u30b9 [exclusive]\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6bd4\u8f03\u95a2\u6570(\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9)\n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int LowerBound(T[] arr, int start, int end, T value, IComparer comparer)\n {\n int low = start;\n int high = end;\n while (low < high)\n {\n var mid = ((high - low) >> 1) + low;\n if (comparer.Compare(arr[mid], value) < 0)\n low = mid + 1;\n else\n high = mid;\n }\n\n return low;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6307\u5b9a\u3057\u305f\u5024\u4ee5\u4e0a\u306e\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int LowerBound(T[] arr, T value) where T : IComparable\n {\n return LowerBound(arr, 0, arr.Length, value, Comparer.Default);\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u958b\u59cb\u30a4\u30f3\u30c7\u30af\u30b9 [inclusive]\n /// \u7d42\u4e86\u30a4\u30f3\u30c7\u30af\u30b9 [exclusive]\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6bd4\u8f03\u95a2\u6570(\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9)\n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int UpperBound(T[] arr, int start, int end, T value, IComparer comparer)\n {\n int low = start;\n int high = end;\n while (low < high)\n {\n var mid = ((high - low) >> 1) + low;\n if (comparer.Compare(arr[mid], value) <= 0)\n low = mid + 1;\n else\n high = mid;\n }\n\n return low;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// Z\n /// \u6bd4\u8f03\u3059\u308b\u5024\u306e\u578b\n /// \u5bfe\u8c61\u306e\u914d\u5217\uff08\u203b\u30bd\u30fc\u30c8\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff09\n /// \u691c\u7d22\u3059\u308b\u5024\n /// \u6307\u5b9a\u3057\u305f\u5024\u3088\u308a\u5927\u304d\u3044\u5148\u982d\u306e\u30a4\u30f3\u30c7\u30af\u30b9\n public static int UpperBound(T[] arr, T value)\n {\n return UpperBound(arr, 0, arr.Length, value, Comparer.Default);\n }\n\n public static IEnumerable SelectNotNull(this IEnumerable source,\n Func func)\n => source.Where(val => val != null).Select(func);\n\n public static IEnumerable WhereNotNull(this IEnumerable source)\n => source.Where(val => val != null);\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] ArrayOf(params T[] arr) => arr;\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static List ListOf(params T[] arr) => new List(arr);\n\n public static IEnumerable Repeat(TResult value)\n {\n while (true) yield return value;\n // ReSharper disable once IteratorNeverReturns\n }\n\n public static IEnumerable Repeat(TResult value, int count)\n => Enumerable.Repeat(value, count);\n\n [SuppressMessage(\"ReSharper\", \"PossibleMultipleEnumeration\")]\n public static IEnumerable Repeat(this IEnumerable source, int count)\n {\n if (source == null) throw new ArgumentNullException(nameof(source));\n if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));\n for (int i = 0; i < count; i++)\n foreach (var v in source)\n yield return v;\n }\n\n [SuppressMessage(\"ReSharper\", \"PossibleMultipleEnumeration\")]\n public static IEnumerable Repeat(this IEnumerable source)\n {\n if (source == null) throw new ArgumentNullException(nameof(source));\n while (true)\n foreach (var v in source)\n yield return v;\n }\n\n /// \n /// \u6587\u5b57\u306e\u914d\u5217\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u307e\u3059\u3002\n /// \n /// \u6587\u5b57\u306e\u914d\u5217\n /// \u5909\u63db\u3057\u305f\u6587\u5b57\u5217\n public static string AsString(this IEnumerable source) => new string(source.ToArray());\n\n /// \n /// \u306e\u7d2f\u7a4d\u548c\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u306e\u7d2f\u7a4d\u548c\n public static IEnumerable CumSum(this IEnumerable source)\n {\n long sum = 0;\n foreach (var item in source)\n yield return sum += item;\n }\n\n /// \n /// \u306e\u7d2f\u7a4d\u548c\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u306e\u7d2f\u7a4d\u548c\n public static IEnumerable CumSum(this IEnumerable source)\n {\n int sum = 0;\n foreach (var item in source)\n yield return sum += item;\n }\n\n /// \n /// \u304c l\u4ee5\u4e0a r\u672a\u6e80\u306e\u7bc4\u56f2\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3092\u8fd4\u3057\u307e\u3059\u3002\n /// \n /// \u8981\u7d20\u306e\u578b\n /// \u5224\u5b9a\u3059\u308b\u5024\n /// \u4e0b\u9650\u306e\u5024 (\u542b\u307e\u308c\u308b)\n /// \u4e0a\u9650\u306e\u5024 (\u542b\u307e\u308c\u306a\u3044)\n /// \u304c\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\n public static bool IsIn(this T value, T l, T r)\n where T : IComparable\n {\n if (l.CompareTo(r) > 0) throw new ArgumentException();\n return l.CompareTo(value) <= 0 && value.CompareTo(r) < 0;\n }\n\n /// \n /// \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0b\u9650 (\u542b\u307e\u308c\u308b)\n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// 1\u8981\u7d20\u3054\u3068\u306b\u5897\u3084\u3059\u5024\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable Range(int start, int end, int step = 1)\n {\n for (var i = start; i < end; i += step) yield return i;\n }\n\n /// \n /// 0 \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 1 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable Range(int end) => Range(0, end);\n\n /// \n /// \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u9006\u9806\u306b\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0b\u9650 (\u542b\u307e\u308c\u308b)\n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// 1\u8981\u7d20\u3054\u3068\u306b\u5897\u3084\u3059\u5024\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable RangeReverse(int start, int end, int step = 1)\n {\n for (var i = end - 1; i >= start; i -= step) yield return i;\n }\n\n /// \n /// 0 \u4ee5\u4e0a \u672a\u6e80\u306e\u5024\u3092 1 \u305a\u3064\u5897\u3084\u3057\u305f\u7d50\u679c\u3092\u9006\u9806\u306b\u5217\u6319\u3057\u307e\u3059\u3002\n /// \n /// \u5024\u306e\u4e0a\u9650 (\u542b\u307e\u308c\u306a\u3044)\n /// \u7bc4\u56f2\u306e\u7d50\u679c\n public static IEnumerable RangeReverse(int end) => RangeReverse(0, end);\n\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u914d\u5217\u3092\u30b3\u30d4\u30fc\u3057\u3066\u6607\u9806\u30bd\u30fc\u30c8\u3057\u307e\u3059\u3002\uff08\u975e\u7834\u58ca\u7684\uff09\n /// \n /// \u30bd\u30fc\u30c8\u3059\u308b\u914d\u5217\u306e\u578b\n /// \u30bd\u30fc\u30c8\u3059\u308b\u914d\u5217\n /// \u30bd\u30fc\u30c8\u3055\u308c\u305f\u914d\u5217\n public static T[] Sort(this T[] arr)\n {\n var array = new T[arr.Length];\n arr.CopyTo(array, 0);\n Array.Sort(array);\n return array;\n }\n\n /// \n /// \u6307\u5b9a\u3057\u305f\u914d\u5217\u3092\u30b3\u30d4\u30fc\u3057\u3066\u964d\u9806\u30bd\u30fc\u30c8\u3057\u307e\u3059\u3002\uff08\u975e\u7834\u58ca\u7684\uff09\n /// \n /// \u30bd\u30fc\u30c8\u3059\u308b\u914d\u5217\u306e\u578b\n /// \u30bd\u30fc\u30c8\u3059\u308b\u914d\u5217\n /// \u30bd\u30fc\u30c8\u3055\u308c\u305f\u914d\u5217\n public static T[] SortDescending(this T[] arr)\n {\n var array = new T[arr.Length];\n arr.CopyTo(array, 0);\n Array.Sort(array);\n Array.Reverse(array);\n return array;\n }\n\n public static double Log2(double x) => Log(x, 2);\n\n public static bool chmin(ref T a, T b) where T : IComparable\n {\n if (a.CompareTo(b) > 0)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static bool chmax(ref T a, T b) where T : IComparable\n {\n if (a.CompareTo(b) < 0)\n {\n a = b;\n return true;\n }\n\n return false;\n }\n\n public static T Min(params T[] col) => col.Min();\n public static T Max(params T[] col) => col.Max();\n\n\n /// \n /// \u8981\u7d20\u6570 (a, b) \u306e\u3001defaultValue \u3067\u6e80\u305f\u3055\u308c\u305f\u914d\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\n /// \n /// \u914d\u5217\u306e\u578b\n /// 1\u6b21\u5143\u306e\u8981\u7d20\u6570\n /// 2\u6b21\u5143\u306e\u8981\u7d20\u6570\n /// \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\n /// \u6307\u5b9a\u3057\u305f\u6761\u4ef6\u3067\u521d\u671f\u5316\u3055\u308c\u305f\u914d\u5217\n public static T[][] Array2D(int a, int b, T defaultValue = default(T))\n {\n var ret = new T[a][];\n for (int i = 0; i < a; i++)\n {\n ret[i] = Enumerable.Repeat(defaultValue, b).ToArray();\n }\n\n return ret;\n }\n\n// public static vector ToVector(this IEnumerable source) => new vector(source);\n }\n\n public static class Input\n {\n private const char _separator = ' ';\n private static readonly Queue _input = new Queue();\n private static readonly StreamReader sr =\n#if FILE\n new StreamReader(\"in.txt\");\n#else\n new StreamReader(Console.OpenStandardInput());\n#endif\n\n public static string ReadLine => sr.ReadLine();\n public static string ReadStr => Read;\n\n public static string Read\n {\n get\n {\n if (_input.Count != 0) return _input.Dequeue();\n\n // ReSharper disable once PossibleNullReferenceException\n var tmp = sr.ReadLine().Split(_separator);\n foreach (var val in tmp)\n {\n _input.Enqueue(val);\n }\n\n return _input.Dequeue();\n }\n }\n\n public static int ReadInt => int.Parse(Read);\n public static long ReadLong => long.Parse(Read);\n public static double ReadDouble => double.Parse(Read);\n public static string[] StrArray() => ReadLine.Split(' ');\n public static int[] IntArray() => ReadLine.Split(' ').Select(int.Parse).ToArray();\n public static long[] LongArray() => ReadLine.Split(' ').Select(long.Parse).ToArray();\n\n public static string[] StrArray(int n)\n {\n var ret = new string[n];\n for (long i = 0; i < n; ++i) ret[i] = Read;\n return ret;\n }\n\n public static int[] IntArray(int n, int offset = 0, bool sorted = false)\n {\n var ret = StrArray(n).Select(x => int.Parse(x) + offset).ToArray();\n if (sorted) Array.Sort(ret);\n return ret;\n }\n\n public static long[] LongArray(int n, long offset = 0, bool sorted = false)\n {\n var ret = StrArray(n).Select(x => long.Parse(x) + offset).ToArray();\n if (sorted) Array.Sort(ret);\n return ret;\n }\n\n public static string[][] Str2DArray(int n, int m)\n => Enumerable.Repeat((string[]) null, n).Select(_ => StrArray(m)).ToArray();\n\n public static int[][] Int2DArray(int n, int m, int offset = 0)\n => Enumerable.Repeat((int[]) null, n).Select(_ => IntArray(m, offset)).ToArray();\n\n public static long[][] Long2DArray(int n, int m, long offset = 0)\n => Enumerable.Repeat((long[]) null, n).Select(_ => LongArray(m, offset)).ToArray();\n\n public static Tuple StrArrays2(int n)\n {\n var ret1 = new string[n];\n var ret2 = new string[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadStr;\n ret2[i] = ReadStr;\n }\n\n return Tuple.Create(ret1, ret2);\n }\n\n public static Tuple IntArrays2(int n, int offset1 = 0, int offset2 = 0)\n {\n var ret1 = new int[n];\n var ret2 = new int[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadInt + offset1;\n ret2[i] = ReadInt + offset2;\n }\n\n return Tuple.Create(ret1, ret2);\n }\n\n public static Tuple LongArrays2(int n, long offset1 = 0, long offset2 = 0)\n {\n var ret1 = new long[n];\n var ret2 = new long[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadLong + offset1;\n ret2[i] = ReadLong + offset2;\n }\n\n return Tuple.Create(ret1, ret2);\n }\n\n public static Tuple StrArrays3(int n)\n {\n var ret1 = new string[n];\n var ret2 = new string[n];\n var ret3 = new string[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadStr;\n ret2[i] = ReadStr;\n }\n\n return Tuple.Create(ret1, ret2, ret3);\n }\n\n public static Tuple IntArrays3(int n, int offset1 = 0, int offset2 = 0, int offset3 = 0)\n {\n var ret1 = new int[n];\n var ret2 = new int[n];\n var ret3 = new int[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadInt + offset1;\n ret2[i] = ReadInt + offset2;\n ret3[i] = ReadInt + offset3;\n }\n\n return Tuple.Create(ret1, ret2, ret3);\n }\n\n public static Tuple LongArrays3(int n, long offset1 = 0, long offset2 = 0,\n long offset3 = 0)\n {\n var ret1 = new long[n];\n var ret2 = new long[n];\n var ret3 = new long[n];\n for (int i = 0; i < n; i++)\n {\n ret1[i] = ReadLong + offset1;\n ret2[i] = ReadLong + offset2;\n ret3[i] = ReadLong + offset3;\n }\n\n return Tuple.Create(ret1, ret2, ret3);\n }\n\n private static bool TypeEquals() => typeof(T) == typeof(U);\n private static T ChangeType(U a) => (T) System.Convert.ChangeType(a, typeof(T));\n\n private static T Convert(string s) => TypeEquals() ? ChangeType(int.Parse(s))\n : TypeEquals() ? ChangeType(long.Parse(s))\n : TypeEquals() ? ChangeType(double.Parse(s))\n : TypeEquals() ? ChangeType(s[0])\n : ChangeType(s);\n\n public static bool In(out T a)\n {\n try\n {\n a = Convert(Read);\n return true;\n }\n catch\n {\n a = default(T);\n return false;\n }\n }\n\n public static bool In(out T a, out U b)\n {\n try\n {\n var ar = StrArray(2);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c)\n {\n try\n {\n var ar = StrArray(3);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c, out W d)\n {\n try\n {\n var ar = StrArray(4);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n d = Convert(ar[3]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n d = default(W);\n return false;\n }\n }\n\n public static bool In(out T a, out U b, out V c, out W d, out X e)\n {\n try\n {\n var ar = StrArray(5);\n a = Convert(ar[0]);\n b = Convert(ar[1]);\n c = Convert(ar[2]);\n d = Convert(ar[3]);\n e = Convert(ar[4]);\n return true;\n }\n catch\n {\n a = default(T);\n b = default(U);\n c = default(V);\n d = default(W);\n e = default(X);\n return false;\n }\n }\n }\n\n public static class Output\n {\n public static void print(T t) => Console.WriteLine(t);\n public static void print(params object[] o) => Console.WriteLine(o.Join(\" \"));\n\n public static void PrintBool(bool val, string yes = \"Yes\", string no = \"No\")\n => Console.WriteLine(val ? yes : no);\n\n public static void PrintYn(bool val) => PrintBool(val);\n public static void PrintYN(bool val) => PrintBool(val, \"YES\", \"NO\");\n public static void PrintPossible(bool val) => PrintBool(val, \"Possible\", \"Impossible\");\n public static void PrintYay(bool val) => PrintBool(val, \"Yay!\", \":(\");\n\n public static void PrintDebug(params object[] args)\n => Console.Error.WriteLine(string.Join(\" \", args));\n\n /// \n /// setter \u3067\u8a2d\u5b9a\u3055\u308c\u305f\u5024\u3092\u6a19\u6e96\u51fa\u529b\u306b\u51fa\u529b\u3057\u307e\u3059\u3002\n /// \n public static object cout\n {\n set { Console.WriteLine(value); }\n }\n\n /// \n /// Local\u74b0\u5883\u306e\u307f\uff0csetter \u3067\u8a2d\u5b9a\u3055\u308c\u305f\u5024\u3092\u6a19\u6e96\u51fa\u529b\u306b\u51fa\u529b\u3057\u307e\u3059\u3002\n /// \n public static object dout\n {\n set\n {\n#if LOCAL\n Console.WriteLine(value);\n#endif\n }\n }\n\n /// \n /// setter \u3067\u8a2d\u5b9a\u3055\u308c\u305f\u5024\u3092\u6a19\u6e96\u30a8\u30e9\u30fc\u51fa\u529b\u306b\u51fa\u529b\u3057\u307e\u3059\u3002\n /// \n public static object cerr\n {\n set { Console.Error.WriteLine(value); }\n }\n\n public const string endl = \"\\n\";\n }\n\n public class Program\n {\n public static void Main(string[] args)\n {\n var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};\n Console.SetOut(sw);\n new Solver().Main();\n\n Console.Out.Flush();\n Console.Read();\n }\n }\n\n [DebuggerDisplay(\"({first}, {second})\")]\n public class Pair : IComparable>, IEquatable>\n where T1 : IComparable\n where T2 : IComparable\n {\n public Pair(T1 first, T2 second)\n {\n this.first = first;\n this.second = second;\n }\n\n public T1 first;\n public T2 second;\n\n public int CompareTo(Pair other)\n {\n if (ReferenceEquals(this, other)) return 0;\n if (ReferenceEquals(null, other)) return 1;\n var firstComparison = first.CompareTo(other.first);\n return firstComparison != 0 ? firstComparison : second.CompareTo(other.second);\n }\n\n public override string ToString() => $\"({first}, {second})\";\n\n public bool Equals(Pair other)\n {\n if (ReferenceEquals(null, other)) return false;\n if (ReferenceEquals(this, other)) return true;\n return EqualityComparer.Default.Equals(first, other.first) &&\n EqualityComparer.Default.Equals(second, other.second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj)) return false;\n if (ReferenceEquals(this, obj)) return true;\n return obj.GetType() == GetType() && Equals((Pair) obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(first) * 397) ^\n EqualityComparer.Default.GetHashCode(second);\n }\n }\n }\n\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Solution\n{\n static bool[] is_prime;\n private static void MakeSieve(int max)\n {\n // Make an array indicating whether numbers are prime.\n is_prime = new bool[max + 1];\n for (int i = 2; i <= max; i++) is_prime[i] = true;\n\n // Cross out multiples.\n for (int i = 2; i <= max; i++)\n {\n // See if i is prime.\n if (is_prime[i])\n {\n // Knock out multiples of i.\n for (int j = i * 2; j <= max; j += i)\n is_prime[j] = false;\n }\n }\n }\n public static string ToHexspeak(string num)\n {\n long number = long.Parse(num);\n string hexString = number.ToString(\"X\");\n hexString = hexString.Replace('0', 'O').Replace('1', 'I');\n bool valid = true;\n for (int i = 0; i < hexString.Length; i++)\n {\n if (hexString[i] > '1' && hexString[i] <= '9')\n {\n valid = false;\n break;\n }\n }\n if (valid)\n return hexString;\n else\n return \"ERROR\";\n }\n public static IList> RemoveInterval(int[][] intervals, int[] toBeRemoved)\n {\n IList> returnedIntervals = new List>();\n if (toBeRemoved[0] <= intervals[0][0])\n {\n if (toBeRemoved[1] >= intervals[intervals.Length - 1][1])\n return returnedIntervals;\n for (int i = 0; i < intervals.Length; i++)\n {\n if (toBeRemoved[1] <= intervals[i][1])\n {\n List injectedInterval = new List();\n injectedInterval.Add(toBeRemoved[1]);\n injectedInterval.Add(intervals[i][1]);\n returnedIntervals.Add(injectedInterval);\n for (int j = i + 1; j < intervals.Length; j++)\n {\n injectedInterval = new List();\n injectedInterval.Add(intervals[j][0]); injectedInterval.Add(intervals[j][1]);\n returnedIntervals.Add(injectedInterval);\n }\n return returnedIntervals;\n }\n }\n }\n else if (toBeRemoved[1] >= intervals[intervals.Length - 1][1])\n {\n for (int i = 0; i < intervals.Length; i++)\n {\n List injectedInterval = new List();\n if (toBeRemoved[0] >= intervals[i][0] && toBeRemoved[0] <= intervals[i][1])\n {\n injectedInterval.Add(intervals[i][0]);\n injectedInterval.Add(toBeRemoved[0]);\n returnedIntervals.Add(injectedInterval);\n return returnedIntervals;\n }\n injectedInterval = new List();\n injectedInterval.Add(intervals[i][0]); injectedInterval.Add(intervals[i][1]);\n returnedIntervals.Add(injectedInterval);\n }\n }\n else\n {\n for (int i = 0; i < intervals.Length; i++)\n {\n List injectedInterval = new List();\n if (toBeRemoved[0] > intervals[i][1] || toBeRemoved[1] < intervals[i][0])\n {\n injectedInterval = new List();\n injectedInterval.Add(intervals[i][0]); injectedInterval.Add(intervals[i][1]);\n returnedIntervals.Add(injectedInterval);\n }\n else if (toBeRemoved[0] >= intervals[i][0] && toBeRemoved[0] <= intervals[i][1])\n {\n injectedInterval = new List();\n injectedInterval.Add(intervals[i][0]);\n injectedInterval.Add(toBeRemoved[0]);\n returnedIntervals.Add(injectedInterval);\n if (toBeRemoved[1] < intervals[i][1])\n {\n injectedInterval = new List();\n injectedInterval.Add(toBeRemoved[1]);\n injectedInterval.Add(intervals[i][1]);\n returnedIntervals.Add(injectedInterval);\n\n }\n }\n else if (toBeRemoved[1] >= intervals[i][0] && toBeRemoved[1] <= intervals[i][1])\n {\n injectedInterval = new List();\n injectedInterval.Add(toBeRemoved[1]);\n injectedInterval.Add(intervals[i][1]);\n returnedIntervals.Add(injectedInterval);\n }\n }\n }\n return returnedIntervals;\n }\n public class treeNodeWithValue\n {\n public int value;\n public List childern;\n public int NodeNumber;\n public int childsCount;\n public treeNodeWithValue(int val, int nodeVal)\n {\n value = val;\n NodeNumber = nodeVal;\n childern = new List();\n childsCount = 0;\n }\n }\n public class treeWithValues\n {\n public treeNodeWithValue root;\n public void createTree(int[] arrNodesParents, int[] arrValues)\n {\n root = new treeNodeWithValue(arrValues[0], 0);\n for (int i = 1; i < arrNodesParents.Length; i++)\n {\n treeNodeWithValue temp = new treeNodeWithValue(arrValues[i], i);\n traverseTheTree(root, temp, arrNodesParents[i]);\n }\n }\n public void traverseTheTree(treeNodeWithValue rooted, treeNodeWithValue newNode, int parentNumber)\n {\n if (rooted.NodeNumber == parentNumber)\n {\n rooted.childern.Add(newNode);\n }\n else if (rooted.childern.Count > 0)\n {\n for (int i = 0; i < rooted.childern.Count; i++)\n {\n traverseTheTree(rooted.childern[i], newNode, parentNumber);\n }\n }\n }\n public int deleteCountZeroPaths(treeNodeWithValue rooted)\n {\n if (rooted.childern.Count > 0)\n {\n for (int i = 0; i < rooted.childern.Count; i++)\n {\n int tempCount = deleteCountZeroPaths(rooted.childern[i]);\n if (tempCount == 0)\n {\n rooted.childern.RemoveAt(i);\n }\n else\n rooted.childsCount += tempCount;\n }\n }\n else\n {\n return rooted.value;\n }\n int temp = rooted.value + rooted.childsCount;\n return temp;\n }\n public int countThetree(treeNodeWithValue rooted)\n {\n int tempCount = 1;\n if (rooted.childern.Count > 0)\n {\n for (int i = 0; i < rooted.childern.Count; i++)\n {\n tempCount += countThetree(rooted.childern[i]);\n }\n }\n return tempCount;\n }\n\n }\n public static int DeleteTreeNodes(int nodes, int[] parent, int[] value)\n {\n treeWithValues tree = new treeWithValues();\n tree.createTree(parent, value);\n tree.deleteCountZeroPaths(tree.root);\n return tree.countThetree(tree.root);\n //return 0;\n }\n //static void Main(string[] args)\n //{\n // int testcases = int.Parse(Console.ReadLine());\n // for (int t = 0; t < testcases; t++)\n // {\n // string[] words = Console.ReadLine().Split(' ');\n // string a = words[0];\n // string b = words[1];\n // string result = \"\";\n // char minC = 'Z';\n // int minIndexI = -1;\n // int minIndexJ = -1;\n // for (int i = 0; i < a.Length - 1; i++)\n // {\n // bool found = false;\n // for (int j = i + 1; j < a.Length; j++)\n // {\n // if (a[i] > a[j] && a[j] < minC)\n // {\n // minIndexI = i;\n // minIndexJ = j;\n // minC = a[j];\n // found = true;\n // }\n // }\n // if (found)\n // break;\n // }\n // if (minIndexI > -1)\n // {\n // for (int i = 0; i < a.Length; i++)\n // {\n // if (minIndexI == i)\n // {\n // result += a[minIndexJ];\n // }\n // else if (minIndexJ == i)\n // {\n // result += a[minIndexI];\n // }\n // else\n // result += a[i];\n // }\n // a = result;\n // }\n // if (a.Length > b.Length)\n // {\n // bool canBeDone = false;\n // for (int i = 0; i < b.Length; i++)\n // {\n // if (a[i] < b[i])\n // {\n // canBeDone = true;\n // break;\n // }\n // else if (a[i] > b[i])\n // {\n // break;\n // }\n // }\n // if (canBeDone)\n // Console.WriteLine(a);\n // else\n // Console.WriteLine(\"---\");\n // }\n // else if (a.Length < b.Length)\n // {\n // bool canBeDone = false;\n // bool aGreater = false;\n // for (int i = 0; i < a.Length; i++)\n // {\n // if (a[i] < b[i])\n // {\n // canBeDone = true;\n // break;\n // }\n // else if (a[i] > b[i])\n // {\n // aGreater = true;\n // break;\n // }\n // }\n // if (canBeDone || aGreater == false)\n // Console.WriteLine(a);\n // else\n // Console.WriteLine(\"---\");\n // }\n // else {\n // bool canBeDone = false;\n // for (int i = 0; i < a.Length; i++)\n // {\n // if (a[i] < b[i])\n // {\n // canBeDone = true;\n // break;\n // }\n // else if (a[i] > b[i])\n // {\n // break;\n // }\n // }\n // if (canBeDone)\n // Console.WriteLine(a);\n // else\n // Console.WriteLine(\"---\");\n // }\n // }\n //}\n static void Main(string[] args)\n {\n int t, s, v, j, c1, c2;\n t = int.Parse(Console.ReadLine());\n s = int.Parse(Console.ReadLine());\n v = int.Parse(Console.ReadLine());\n j = int.Parse(Console.ReadLine());\n c1 = int.Parse(Console.ReadLine());\n c2 = int.Parse(Console.ReadLine());\n int cost = 0;\n if (c1 > c2)\n {\n int min = Math.Min(j, t);\n j -= min;\n cost += (c1 * min);\n if (j > 0)\n {\n int cost2 = Math.Min(j, Math.Min(v, s));\n cost += (cost2 * c2);\n }\n }\n else\n {\n int cost2 = Math.Min(j, Math.Min(v, s));\n cost += (cost2 * c2);\n j = j - cost2;\n if (j > 0)\n {\n int min = Math.Min(j, t);\n cost += (c1 * min);\n }\n }\n Console.WriteLine(cost);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var a = int.Parse(Console.ReadLine());\n var b = int.Parse(Console.ReadLine());\n var c = int.Parse(Console.ReadLine());\n var d = int.Parse(Console.ReadLine());\n var e = int.Parse(Console.ReadLine());\n var f = int.Parse(Console.ReadLine());\n var max = 0;\n var minFirs = Math.Min(a, d);\n var minSec = Math.Min(d, Math.Min(b, c));\n\n if (f > e)\n {\n max += (minSec * f);\n var v = d - minSec;\n max += Math.Min(minFirs, v) * e;\n }\n else\n {\n max += minFirs * e;\n var v = d - minFirs;\n max += Math.Min(minSec, v) * f;\n }\n\n Console.WriteLine(max);\n //Console.ReadKey();\n\n //var t = int.Parse(Console.ReadLine());\n //var res = new List();\n //for (int i = 0; i < t; i++)\n //{\n // var inputs = Console.ReadLine().Split(' ');\n // var r = int.Parse(inputs[0]);\n // var g = int.Parse(inputs[1]);\n // var b = int.Parse(inputs[2]);\n // var sum = r + g + b;\n // var max = Math.Max(r, Math.Max(g, b));\n // if (max > sum - max)\n // res.Add(\"NO\");\n // else\n // {\n // res.Add(\"YES\");\n // }\n //}\n\n //res.ForEach(x => Console.WriteLine(x));\n\n //var client = new SmppClient();\n //client.Connect(\"172.30.157.206\", int.Parse(\"3855\"));\n //client.SystemType = \"sms\";\n //client.SendSpeedLimit = 30;\n //client.Bind(\"smpp3855\", \"pkt7HPav\");\n\n //var ls = new List();\n //for (int i = 0; i < 30; i++)\n // ls.Add(\"axalisatestos gamogzava SMS NO: 90911, Code:123\");\n //var sent = 0; int thr = 0;\n\n //var st = new Stopwatch();\n //st.Start();\n\n //Parallel.ForEach(ls, sms =>\n //{\n // var coding = Inetlab.SMPP.Common.DataCodings.Default;\n // if (ContainsUnicodeCharacter(sms))\n // {\n // coding = Inetlab.SMPP.Common.DataCodings.UCS2;\n // }\n\n // var submitResp = client.Submit(\n // SMS.ForSubmit()\n // .From(\"test\")\n // .To(\"557964515\")\n // .Coding(coding)\n // .Text(sms));\n // if (submitResp.All(x => x.Status == Inetlab.SMPP.Common.CommandStatus.ESME_ROK))\n // {\n // sent++;\n // }\n // else if (submitResp.All(x => x.Status == Inetlab.SMPP.Common.CommandStatus.ESME_RTHROTTLED))\n // {\n // thr++;\n // }\n //});\n //st.Stop();\n //Console.WriteLine(st.ElapsedMilliseconds);\n\n }\n\n //public static bool ContainsUnicodeCharacter(string input)\n //{\n // const int MaxAnsiCode = 255;\n\n // return input.Any(c => c > MaxAnsiCode);\n //}\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nnamespace Contest\n{\n\n\tclass Program\n {\n public static void Main()\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n int h = Math.Min(b, Math.Min(c,d));\n int k = Math.Min(a, d - h);\n int max = e * k + f * h;\n k = Math.Min(a, d);\n h = Math.Min(b, Math.Min(c, d - k));\n max = Math.Max(max, e * k + f * h);\n Console.WriteLine(max);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar a = int.Parse(Console.ReadLine());\n\t\tvar b = int.Parse(Console.ReadLine());\n\t\tvar c = int.Parse(Console.ReadLine());\n\t\tvar d = int.Parse(Console.ReadLine());\n\t\tvar e = int.Parse(Console.ReadLine());\n\t\tvar f = int.Parse(Console.ReadLine());\n\t\t\n\t\tvar firstType = e > f;\n\t\t\n\t\tvar maxPrice = 0;\n\t\t\n\t\tif(firstType){\n\t\t\tvar maxFirstType = Math.Min(d,a);\n\t\t\tmaxPrice = maxFirstType * e;\n\t\t\td -= maxFirstType;\n\t\t\tvar maxSecondType = Math.Min(b, Math.Min(c,d));\n\t\t\tmaxPrice += maxSecondType * f;\n\t\t}else{\n\t\t\tvar maxSecondType = Math.Min(b, Math.Min(c,d));\n\t\t\tmaxPrice += maxSecondType * f;\n\t\t\td -= maxSecondType;\n\t\t\tvar maxFirstType = Math.Min(d,a);\n\t\t\tmaxPrice += maxFirstType * e;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(maxPrice);\n\t}\n}"}, {"source_code": "// Problem: 1271A - Suits\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass Suits\n {\n static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n uint a;\n if (!UInt32.TryParse (words[0], out a))\n return -1;\n if (a < 1 || a > 100000)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n uint b;\n if (!UInt32.TryParse (words[0], out b))\n return -1;\n if (b < 1 || b > 100000)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n uint c;\n if (!UInt32.TryParse (words[0], out c))\n return -1;\n if (c < 1 || c > 100000)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n uint d;\n if (!UInt32.TryParse (words[0], out d))\n return -1;\n if (d < 1 || d > 100000)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n ushort e;\n if (!UInt16.TryParse (words[0], out e))\n return -1;\n if (e < 1 || e > 1000)\n return -1;\n line = Console.ReadLine ();\n if (line == null)\n return -1;\n words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 1)\n return -1;\n ushort f;\n if (!UInt16.TryParse (words[0], out f))\n return -1;\n if (f < 1 || f > 1000)\n return -1;\n uint numSuitTyp1 = 0;\n uint numSuitTyp2 = 0;\n if (e > f)\n {\n numSuitTyp1 = Math.Min (a,d);\n numSuitTyp2 = Math.Min (Math.Min (d-numSuitTyp1,b), c);\n }\n else\n {\n numSuitTyp2 = Math.Min (Math.Min (d,b), c);\n numSuitTyp1 = Math.Min (d-numSuitTyp2,a);\n }\n uint ans = numSuitTyp1*e+numSuitTyp2*f;\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing static System.Math;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\nusing System.Runtime.CompilerServices;\nusing Library;\n\nnamespace Program\n{\n public static class CODEFORCES2\n {\n static public int numberOfRandomCases = 0;\n static public void MakeTestCase(List _input, List _output, ref Func _outputChecker)\n {\n }\n static public void Solve()\n {\n var ary = NNList(6);\n var ans = 0L;\n for (var i = 0; i <= ary[3]; i++)\n {\n ans = Max(ans, Min(ary[0], i) * ary[4] + Min(Min(ary[1], ary[2]), ary[3] - i) * ary[5]);\n }\n Console.WriteLine(ans);\n }\n static class Console_\n {\n static Queue param = new Queue();\n public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }\n static long NN => long.Parse(Console_.NextString());\n static double ND => double.Parse(Console_.NextString());\n static string NS => Console_.NextString();\n static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();\n static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();\n static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => xorshift);\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n }\n}\nnamespace Library {\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static Codeforces.IO;\nusing static System.Linq.Enumerable;\n\nnamespace Codeforces\n{\n static class IO\n {\n static StringBuilder builder = new StringBuilder();\n static Dummy dummy = new Dummy();\n class Dummy\n {\n ~Dummy()\n {\n Console.Write(builder);\n }\n }\n public static void Write(object obj)\n {\n builder.Append(obj);\n }\n public static void WriteLine(object obj)\n {\n builder.AppendLine(obj.ToString());\n }\n public static void Write(params object[] objs)\n {\n if (objs.Length != 0)\n {\n Write(objs[0]);\n for (var i = 1; i < objs.Length; ++i)\n {\n Write(\" \");\n Write(objs[i]);\n }\n }\n }\n public static void WriteLine(params object[] objs)\n {\n Write(objs);\n WriteLine();\n }\n\n public static void WriteLine()\n {\n builder.AppendLine();\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n public static T ReadLine(Func parser)\n {\n return parser(ReadLine());\n }\n public static T[] ReadArray(Func parser)\n {\n return ReadLine().Split(' ').Select(parser).ToArray();\n }\n public static string[] ReadArray()\n {\n return ReadLine().Split(' ');\n }\n public static (T, T) ReadTuple2(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1]);\n }\n public static (string, string) ReadTuple2()\n {\n var ar = ReadArray();\n return (ar[0], ar[1]);\n }\n public static (T, T, T) ReadTuple3(Func parser)\n {\n var ar = ReadArray(parser);\n return (ar[0], ar[1], ar[2]);\n }\n public static (string, string, string) ReadTuple3()\n {\n var ar = ReadArray();\n return (ar[0], ar[1], ar[2]);\n }\n }\n\n static class Program\n {\n static void Main(string[] args)\n {\n var x = ReadLine(int.Parse);\n var b = ReadLine(int.Parse);\n var c = ReadLine(int.Parse);\n var d = ReadLine(int.Parse);\n var first = ReadLine(int.Parse);\n var second = ReadLine(int.Parse);\n var y = Math.Min(b, c);\n var max = 0;\n for(var i = 0; i <= Math.Min(x, d); ++i)\n {\n max = Math.Max(max, i * first + Math.Min(d - i, y) * second);\n }\n WriteLine(max);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace suits\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a, b, c, d, e, f;\n\n a = Convert.ToInt32(Console.ReadLine());\n b = Convert.ToInt32(Console.ReadLine());\n c = Convert.ToInt32(Console.ReadLine());\n d = Convert.ToInt32(Console.ReadLine());\n e = Convert.ToInt32(Console.ReadLine());\n f = Convert.ToInt32(Console.ReadLine());\n\n int m = min(b, c, d);\n\n int all = m * f + maradek(d - m) * e;\n\n Console.WriteLine(all);\n Console.ReadLine();\n }\n\n public static int min(int a, int b, int c)\n {\n return Math.Min(Math.Min(a, b), c);\n }\n public static int maradek(int x)\n {\n if (x > 0)\n {\n return x;\n }\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1271_Suits\n {\n public static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n int b = int.Parse(Console.ReadLine());\n int c = int.Parse(Console.ReadLine());\n int d = int.Parse(Console.ReadLine());\n int e = int.Parse(Console.ReadLine());\n int f = int.Parse(Console.ReadLine());\n\n int[] array = new int[3];\n decimal totalSuit1 = 0;\n decimal totalSuit2 = 0;\n\n if (e > f)\n {\n if (a > d)\n {\n totalSuit1 = d * e;\n a -= d;\n }\n else\n {\n totalSuit1 = a * e;\n d -= a;\n } \n array[0] = b;\n array[1] = c;\n array[2] = d;\n Array.Sort(array);\n totalSuit2 = f * array[0];\n }\n else {\n array[0] = b;\n array[1] = c;\n array[2] = d;\n Array.Sort(array);\n totalSuit2 = f * array[0];\n\n d -= array[0];\n\n if (a > d)\n {\n totalSuit1 = d * e;\n a -= d;\n }\n else\n {\n totalSuit1 = a * e;\n d -= a;\n }\n }\n \n Console.WriteLine(totalSuit2+totalSuit1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n int min = Math.Min(b, Math.Min(c,d));\n int max = Math.Max(e, f);\n\n int ans = min * max;\n if (d > min)\n {\n d = d - min;\n\n int minn = Math.Min(a, d);\n ans = ans + minn * Math.Min(e, f);\n\n Console.WriteLine(ans);\n }\n else\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n if (f > e)\n {\n int min = Math.Min(b, Math.Min(c, d));\n\n int ans = min * f;\n if (d > min)\n {\n d = d - min;\n\n int minn = Math.Min(a, d);\n ans = ans + minn * e;\n\n Console.WriteLine(ans);\n }\n else\n Console.WriteLine(ans);\n }\n else if (f <= e)\n {\n int min = Math.Min(a, d);\n int ans = min * e;\n\n if (d == min)\n Console.WriteLine(ans);\n else\n {\n d = d - min;\n ans = Math.Min(b, Math.Min(c, d)) * f;\n Console.WriteLine(ans);\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n if (f >= e)\n {\n int min = Math.Min(b, Math.Min(c, d));\n\n int ans = min * f;\n if (d > min)\n {\n d = d - min;\n\n int minn = Math.Min(a, d);\n ans = ans + minn * e;\n\n Console.WriteLine(ans);\n }\n else\n Console.WriteLine(ans);\n }\n else if (f < e)\n {\n int min = Math.Min(a, d);\n int ans = min * e;\n\n if (d == min)\n Console.WriteLine(ans);\n else\n {\n d = d - min;\n ans = Math.Min(b, Math.Min(c, d)) * f;\n Console.WriteLine(ans);\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication37\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int c = Convert.ToInt32(Console.ReadLine());\n int d = Convert.ToInt32(Console.ReadLine());\n int e = Convert.ToInt32(Console.ReadLine());\n int f = Convert.ToInt32(Console.ReadLine());\n\n if (f >= e)\n {\n int min = Math.Min(b, Math.Min(c, d));\n\n long ans = min * f;\n if (d > min)\n {\n d = d - min;\n\n int minn = Math.Min(a, d);\n ans = ans + minn * e;\n\n Console.WriteLine(ans);\n }\n else\n Console.WriteLine(ans);\n }\n else if (f < e)\n {\n int min = Math.Min(a, d);\n long ans = min * e;\n\n if (d == min)\n Console.WriteLine(ans);\n else\n {\n d = d - min;\n ans = Math.Min(b, Math.Min(c, d)) * f;\n Console.WriteLine(ans);\n }\n }\n }\n }\n}\n"}], "src_uid": "84d9e7e9c9541d997e6573edb421ae0a"} {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string tmp = Console.ReadLine();\n var n = int.Parse(tmp.Split(' ')[0]);\n var m = int.Parse(tmp.Split(' ')[1]);\n n = n < m ? n : m;\n\n Console.WriteLine(n % 2 == 1 ? \"Akshat\" : \"Malvika\");\n //Console.ReadKey();\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace _451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int min = int.Parse(input[0]);\n int cur = int.Parse(input[1]);\n if (cur < min) min = cur;\n if (min % 2 == 1) Console.WriteLine(\"Akshat\");\n else Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace codeCsharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,m,i=1;Int32 NoSticks,NoPoints;\n string[] input = Console.ReadLine().Split();\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n NoSticks=n+m;\n NoPoints=n*m;\n while(NoPoints>0){\n NoPoints-=(NoSticks-1);\n NoSticks-=2;\n i++;\n if(NoPoints==0){\n string output = i % 2 == 0 ? \"Akshat\" : \"Malvika\";\n Console.Write(output);\n break;}\n}\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Game_With_Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input.Split(' ')[0]);\n int m = int.Parse(input.Split(' ')[1]);\n int p = (n > m) ? m : n;\n if (p % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string [] s = Console.ReadLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n byte a = byte.Parse(s[0]);\n byte b = byte.Parse(s[1]);\n s = null;\n byte c = a < b ? a : b;\n Console.WriteLine(c % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n\n int sum = n + m - 1;\n int point = n * m;\n int count = 1;\n\n while (point - sum > 0)\n {\n point -= sum;\n n--;\n m--;\n sum = n + m - 1;\n count++;\n }\n\n if (count % 2 == 0) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n#endif\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar n = cin.NextInt();\n\t\t\tvar m = cin.NextInt();\n\t\t\tvar min = Math.Min(n, m);\n\t\t\tif ((min & 1) == 0)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace Algorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n GameOfSticks();\n\n //Console.ReadLine();\n }\n\n private static void GameOfSticks()\n {\n string[] sticks = Console.ReadLine().Split(' ');\n int hotizontalSticks = int.Parse(sticks[0]);\n int verticalSticks = int.Parse(sticks[1]);\n\n var totalNumberOfCrossPoints = hotizontalSticks * verticalSticks;\n\n string winner = \"Akshat\";\n\n for (int i = totalNumberOfCrossPoints; i >= 0; i--)\n {\n totalNumberOfCrossPoints = --hotizontalSticks * --verticalSticks;\n\n if (totalNumberOfCrossPoints == 0)\n {\n break;\n }\n else\n {\n if (winner == \"Akshat\")\n winner = \"Malvika\";\n else if (winner == \"Malvika\")\n winner = \"Akshat\";\n }\n }\n\n Console.WriteLine(winner);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training_App\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] splits = input.Split(' ');\n int n = int.Parse(splits[0]);\n int m = int.Parse(splits[1]);\n int result = 0;\n if (n > m)\n result = m * m;\n else\n result = n * n;\n if (result % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass A451 {\n public static void Main() {\n var min = Console.ReadLine().Split().Min(int.Parse);\n Console.WriteLine((min & 1) == 0 ? \"Malvika\" : \"Akshat\");\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte[] inputs = Console.ReadLine().Split(' ').Select(input => Convert.ToByte(input)).ToArray();\n byte n = inputs[0];\n byte m = inputs[1];\n\n List values = new List();\n for (byte i = 0; i < n; i++)\n {\n for (byte j = 0; j < m; j++)\n {\n byte[] item = new byte[]{i,j};\n values.Add(item);\n }\n }\n\n byte flag = 2;\n while(values.Count != 0)\n {\n byte[] value = values[0];\n values.RemoveAt(0);\n\n RemoveValues(values, value[0], value[1]);\n if (flag == 1)\n flag = 2;\n else\n flag = 1;\n }\n if (flag == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n\n private static void RemoveValues(List values, byte i, byte j)\n {\n for (int k = 0; k < values.Count; k++)\n {\n byte[] value = values[k];\n if (value[0] == i || value[1] == j)\n {\n values.RemoveAt(k);\n k--;\n } \n } \n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int n = int.Parse(str[0]);\n int m = int.Parse(str[1]);\n int a = 0, m1 = m, n1 = n, sum = m * n;\n while (true)\n {\n if (sum - m1 - n1 + 1 <= 0)\n {\n if (a % 2 == 0) Console.WriteLine(\"Akshat\");\n else Console.WriteLine(\"Malvika\");\n break;\n }\n sum -= m1 + n1 - 1;\n n1--;\n m1--;\n a++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int i = 0; int c=n*m;\n while(i m)\n {\n if (m % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n else\n {\n if (n % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n\n\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int x = int.Parse(str[0]);\n int y = int.Parse(str[1]);\n int min = Math.Min(x, y);\n int ans = min % 2;\n if (ans == 1)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Game_With_Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m;\n string [] s1=new string [2];\n s1 = Console.ReadLine().Split(' ');\n n = int.Parse(s1[0]);\n m = int.Parse(s1[1]);\n //Console.WriteLine(n);\n // Console.WriteLine(m);\n int total = n + m;\n int product = n * m;\n int i;\n for ( i = 0; i < 1100; i++)\n {\n n--;\n m--;\n total = n + m;\n product = n * m;\n if (product==0)\n {\n break;\n }\n \n }\n if (i % 2 != 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine()\n .Split(' ')\n .Select(x => Int32.Parse(x))\n .ToArray();\n\n int min = Math.Min(nm[0], nm[1]);\n\n Console.WriteLine(min % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n int[] ar = new int[2];\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n ar[0] = int.Parse(input[0]);\n ar[1] = int.Parse(input[1]);\n }\n Array.Sort(ar);\n Console.WriteLine(ar[0] % 2 == 1 ? \"Akshat\" : \"Malvika\");\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _451A\n {\n static void Main(string [] args) {\n\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Array.Sort(ar);\n int temp = ar[0];\n if (temp % 2 == 0) { Console.WriteLine(\"Malvika\"); }\n else { Console.WriteLine(\"Akshat\"); }\n //Console.ReadKey();\n\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Game_Wich_Sticks_451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string [] s = Console.ReadLine().Split(new char [] {' '});\n int n = Convert.ToInt32(s[0]), m = Convert.ToInt32(s[1]);\n int ka = 0, km = 0;\n while (n*m != 0)\n {\n n = n - 1;\n m = m - 1;\n if (ka == km) ka++;\n else km++;\n }\n if (ka == km) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n String in1;\n int inp1, inp2;\n in1 = Console.ReadLine();\n String[] temp = in1.Split(' ');\n\n inp1 = Convert.ToInt32(temp[0]);\n inp2 = Convert.ToInt32(temp[1]);\n\n String output = \"Malvika\";\n while (true)\n {\n if (inp1 == 0 || inp2 == 0)\n {\n break;\n }\n inp1--;\n inp2--;\n if (output == \"Malvika\")\n {\n output = \"Akshat\";\n }\n else\n {\n output = \"Malvika\";\n }\n\n\n }\n Console.WriteLine(output);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n static public void Main()\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int min = Math.Min(n, m);\n if (min % 2 == 0) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_451A_Game_With_Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] num = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int n = num[0];\n int m = num[1];\n if (Math.Min(n, m) % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static void MyMain()\n {\n int x = 0;\n int y = 0;\n RInts(out x, out y);\n\n WLine(Math.Min(x,y)%2 == 0? \"Malvika\":\"Akshat\");\n\n }\n\n\n static void Main()\n {\n#if !HOME\n MyMain();\n#else\n var tmp = Console.In;\n Console.SetIn(new StreamReader(\"in.txt\"));\n while (Console.In.Peek() > 0)\n {\n MyMain();\n }\n Console.In.Close();\n Console.SetIn(tmp);\n Console.ReadKey();\n#endif\n }\n\n #region Utils\n static string RLine()\n {\n return Console.ReadLine();\n }\n\n static int RInt()\n {\n var str = Console.ReadLine();\n return Convert.ToInt32(str);\n }\n\n static int[] RInts()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));\n }\n\n static void RInts(out int a, out int b)\n {\n var ints = RInts();\n a = ints[0];\n b = ints[1];\n }\n\n static void WLine(T s)\n {\n Console.WriteLine(s);\n }\n\n static void WYES()\n {\n WLine(\"YES\");\n }\n\n static void WNO()\n {\n WLine(\"NO\");\n }\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Ladder4\n{\n class Prob12\n {\n static void Main(string[] args)\n { \n List matrix = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToList();\n int count = 1, x = matrix[0] * matrix[1], r = matrix[0], c = matrix[1];\n bool result = harankash(r, c);\n if (result == true)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n //for (int i = 0; i < r + c; i++)\n //{\n // if (x < 0)\n // break;\n // if (Math.Min(r, c) == 0)\n // x--;\n // else\n // {\n // x -= (r + c) - 1;\n // r = r - 1;\n // c = c - 1;\n // }\n // if (x > 0)\n // count++;\n //}\n //if (count % 2 == 0)\n // Console.WriteLine(\"Malvika\");\n //else\n // Console.WriteLine(\"Akshat\");\n //while (true) ;\n }\n\n public static bool harankash(int r, int c)\n {\n if (Math.Min(r, c) <= 1)\n return true;\n else if (r == 2 || c == 2)\n return false;\n \n return !harankash(r - 1, c - 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n if(array.Min()%2==0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\"); \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace ConsoleApplication5\n{\n\n class Program\n {\n\n static void Main()\n {\n var data = Console.ReadLine()\n .Split(new[] { ' ' })\n .Select(int.Parse)\n .ToArray();\n int n = data[0], m = data[1], count = n * m, moveCount = 0;\n while (count > 0)\n {\n count -= n;\n count -= m;\n count++;\n n--;\n m--;\n moveCount++;\n }\n Console.WriteLine(moveCount % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "namespace o\n{\n using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n string[] s1 = Console.ReadLine().Split(' ');\n int a = int.Parse(s1[0]);\n int b = int.Parse(s1[1]);\n if (a > b)\n {\n a = b;\n }\n if (a % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _259\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n\n if (Math.Min(n, m) % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]),\n m = int.Parse(s[1]), \n t = n * m, \n a = 0;\n\n\n while (true)\n {\n if (t != 0)\n {\n t = --n * --m;\n a++;\n }\n else break;\n }\n\n if (a % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Contesa\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split().Take(2).Select(int.Parse).ToArray();\n if (arr[0] <= arr[1] && arr[0]%2==1)\n Console.WriteLine(\"Akshat\");\n else if (arr[1] < arr[0] && arr[1] % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n \n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[]{ ' ' });\n \n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n \n int min = Math.Min(n, m);\n \n if (min % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] data = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s));\n\n if ((data[1] < data[0] ? data[1] : data[0]) % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int minimum = input[0] > input[1] ? input[1] : input[0];\n\n if (minimum % 2 == 0) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Math.Min(Next(), Next());\n writer.Write(n % 2 == 1 ? \"Akshat\" : \"Malvika\");\n\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tvar name = new[] { \"Malvika\", \"Akshat\" };\n\t\tint x = Console.ReadLine().Split().Select(int.Parse).Min();\n\t\tConsole.WriteLine(name[x % 2]);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] n = Console.ReadLine().Split(' ');\n if (int.Parse(n[0]) < int.Parse(n[1]))\n {\n if (int.Parse(n[0]) % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n else\n { \n if (int.Parse(n[1]) % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#16 Resolve Game With Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n int input1 = int.Parse(inputer[0]),\n input2 = int.Parse(inputer[1]);\n\n if (input1 % 2 == 0 && input2 % 2 == 0 || input2> input1 && input1%2==0 && input2%2==1 || input1>input2 && input1%2==1 && input2%2==0)\n {\n Console.WriteLine(\"Malvika\");\n Console.ReadLine();\n }\n else Console.WriteLine(\"Akshat\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.Write(nm.Min() % 2 == 0? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class GameWithSticks\n{\n\tprivate static void Main()\n\t{\n\t\tvar input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\t\tvar n = input[0];\n\t\tvar m = input[1];\n\t\tvar matrix = new int[n, m];\n\t\tvar isAkshat = true;\n\t\t\n\t\twhile(!IsFinished(matrix, n, m))\n\t\t{\n\t\t\tNextMove(matrix, n, m);\n\t\t\t\n\t\t\tisAkshat = !isAkshat;\n\t\t}\n\t\t\n\t\tConsole.WriteLine(isAkshat ? \"Malvika\" : \"Akshat\");\n\t}\n\t\n\tprivate static void NextMove(int[,] matrix, int n, int m)\n\t{\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t{\n\t\t\t\tif(matrix[i, j] == 0)\n\t\t\t\t{\n\t\t\t\t\tmatrix[i, j] = 1;\n\t\t\t\t\t\n\t\t\t\t\tfor (int l = 0; l < n; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(matrix[l, j] == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmatrix[l, j] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor (int l = 0; l < m; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(matrix[i, l] == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmatrix[i, l] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\t\n\t}\n\t\n\tprivate static bool IsFinished(int[,] matrix, int n, int m)\n\t{\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor (int j = 0; j < m; j++)\n\t\t\t{\n\t\t\t\tif(matrix[i, j] == 0)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Numerics;\n// you can also use other imports, for example:\n// using System.Collections.Generic;\n\n// you can use Console.WriteLine for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\nclass Solution\n{\n\n public static void Main(string[] args)\n {\n var v = Console.ReadLine().Split(' ');\n int n, m;\n n = int.Parse(v[0]);\n m = int.Parse(v[1]);\n int moves = Math.Min(n, m);\n Console.WriteLine(moves % 2 == 0 ? \"Malvika\" : \"Akshat\");\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int m = 0, n = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == ' ')\n {\n n = int.Parse(s.Substring(0, i));\n m = int.Parse(s.Substring(i + 1));\n break;\n }\n }\n if (m < n)\n n = m;\n if (n % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Algo.Problem._258_2_1\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tstring s = Console.ReadLine();\n\n\t\t\tstring[] ss = s.Split(' ');\n\n\t\t\tint n = int.Parse(ss[0]);\n\t\t\tint m = int.Parse(ss[1]);\n\n\t\t\tint min = n < m ? n : m;\n\n\t\t\tif (min%2 == 1)\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\t}\n\n//\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Math.Abs(3-(rowIndex))+Math.Abs(3-columnIndex)\n int[] line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();\n int n = line[0];\n int m = line[1];\n int pointsEachTurn = n + m - 2 + 1;\n int totalPoints = n * m;\n int winner = 0;\n string[] names = { \"Akshat\", \"Malvika\" };\n while(totalPoints > 0)\n {\n //Console.WriteLine(\"Removing {0}\", pointsEachTurn);\n totalPoints -= pointsEachTurn;\n n--;\n m--;\n pointsEachTurn = n + m - 2 + 1;\n if (totalPoints > 0)\n {\n if (winner == 0) winner = 1;\n else winner = 0;\n }\n }\n Console.WriteLine(names[winner]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Globalization;\nnamespace ConsoleApp1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int a1 = Convert.ToInt32(s[0]);\n int a2 = Convert.ToInt32(s[1]);\n if (a1<=a2)\n if (a1%2==0)\n Console.WriteLine(\"Malvika\");\n else \n Console.WriteLine(\"Akshat\");\n else\n if (a2%2==0)\n Console.WriteLine(\"Malvika\");\n else \n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Numerics;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] dims = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n Console.WriteLine(Math.Min(dims[0], dims[1]) % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _451A_GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mass = Console.ReadLine()\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(x => int.Parse(x))\n .ToArray();\n\n int temp = 0;\n int intersection = mass[0] * mass[1];\n\n do\n {\n mass[0]--;\n mass[1]--;\n\n intersection = mass[0] * mass[1];\n temp++;\n }\n while (intersection > 0);\n\n Console.WriteLine(temp % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Math.Min(nm[0], nm[1]) % 2 == 1 ? \"Akshat\" : \"Malvika\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] names = { \"Malvika\", \"Akshat\" };\n string[] tmPstr = Console.ReadLine().Split(' ');\n int n = int.Parse(tmPstr[0]);\n int m = int.Parse(tmPstr[1]);\n int winner = 1;\n if (n > m)\n {\n if (m == 0)\n {\n winner = m;\n }\n else\n {\n }\n winner = m % 2;\n }\n else\n {\n if (n == 0)\n {\n winner = n;\n }\n else\n {\n }\n winner = n % 2;\n }\n Console.WriteLine(names[winner]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Codility\n{\n class Program\n {\n public static string codeforce(long n, long m)\n {\n if (Math.Min(n, m) % 2 == 0)\n return \"Malvika\";\n return \"Akshat\";\n }\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split().Select(long.Parse).ToArray();\n //var arr = Console.ReadLine().Split().Select(long.Parse).ToArray();\n Console.WriteLine(codeforce(nums[0], nums[1]));\n //Console.WriteLine(solution1(-1, 3, 3, 1));\n //Console.WriteLine(solution(\"banana\"));\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _451A.Game_With_Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] line = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = line[0];\n int m = line[1];\n int min = -1;\n if (n > m)\n min = m;\n else\n min = n;\n if (min % 2 != 0)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace A451\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int[,] matrix = new int[input[0], input[1]];\n\n for (int i = 0; i < input[0]; i++)\n {\n for (int j = 0; j < input[1]; j++)\n {\n matrix[i, j] = i + j + 1; \n }\n }\n\n int count = 0;\n for (int i = 0; i < input[0]; i++)\n {\n for (int j = 0; j < input[1]; j++)\n {\n if(matrix[i, j] != 0)\n {\n count++;\n for (int e = 0; e < input[1]; e++)\n {\n matrix[i, e] = 0;\n }\n for (int e = 0; e < input[0]; e++)\n {\n matrix[e, j] = 0;\n }\n break;\n }\n }\n }\n Console.WriteLine(count % 2 == 0 ? \"Malvika\" : \"Akshat\"); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int[] ReadInt(int size)\n {\n string[] input = Console.ReadLine().Split(' ');\n int[] res = new int[size]; \n for (int i=0; i b ? a : b);\n }\n\n static void WL (T s)\n {\n Console.WriteLine(s);\n } \n \n static void Main(string[] args)\n {\n int[] input = ReadInt(2);\n int m = Math.Min(input[0], input[1]);\n if (m % 2 == 0) WL(\"Malvika\"); else WL(\"Akshat\"); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _451A_Game_With_Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n\n if (Math.Min(n,m) % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Olimp\n{\n class Program\n {\n public static void Main(string[] arg)\n {\n string[] m = Console.ReadLine().Split();\n Console.WriteLine(Result(int.Parse(m[0]), int.Parse(m[1])));\n }\n\n public static string Result(int N, int M)\n {\n string Res = \"\"; int k = 0;\n while (N > 0 && M > 0)\n {\n N--; M--; k++;\n if (N == 0 || M == 0) break;\n }\n if (k % 2 == 1)\n Res = \"Akshat\";\n else\n Res = \"Malvika\";\n return Res;\n }\n }\n}\n"}, {"source_code": "\ufeffclass Program{static void Main(){string[] into = System.Console.ReadLine().Split(' ');byte i,n = byte.Parse(into[0]) , m = byte.Parse(into[1]);for (i = 1; n > 0 && m > 0; --n, --m, ++i) { }System.Console.WriteLine(i % 2 == 0 ? \"Akshat\" : \"Malvika\");}}"}, {"source_code": "\ufeff#region imports\nusing System;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n#endregion\n\nnamespace CodeForces\n{\n class Problem\n {\n const bool IsContest = true;\n\n private void Solve()\n {\n var n = _.NextInt();\n var m = _.NextInt();\n var akshatWins = false;\n while (n > 0 && m > 0)\n {\n n--;\n m--;\n akshatWins ^= true;\n }\n _.WriteLine(akshatWins ? \"Akshat\" : \"Malvika\");\n }\n\n #region shit\n private readonly InOut _ = new InOut(IsContest);\n static void Main(string[] args)\n {\n var p = new Problem();\n p.Solve();\n p._.Close();\n }\n }\n class InOut\n {\n private const string InputFile = \"input.txt\";\n private const string OutputFile = \"output.txt\";\n public StreamWriter Cout { get; private set; }\n public StreamReader Cin { get; private set; }\n private void SetConsoleIo()\n {\n Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));\n Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));\n }\n private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }\n public InOut() { SetConsoleIo(); }\n public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }\n public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }\n public void WriteLine(object x) { Cout.WriteLine(x); }\n public void Close() { Cin.Close(); Cout.Close(); }\n public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }\n private int _pos;\n private string[] _tokens;\n public string NextToken()\n {\n while (_tokens == null || _pos == _tokens.Length)\n {\n // ReSharper disable once PossibleNullReferenceException\n _tokens = Cin.ReadLine().Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n _pos = 0;\n }\n return _tokens[_pos++];\n }\n public int NextInt() { return int.Parse(NextToken()); }\n public long NextLong() { return long.Parse(NextToken()); }\n public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s;\n s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n m = Math.Min(n, m);\n if (m % 2 == 0) Console.WriteLine(\"Malvika\"); else Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace W2\n{\n class Program\n {\n //https://codeforces.com/problemset/problem/1380/A\n\n static void Main(string[] args)\n {\n string numbers = Console.ReadLine();\n string number = \"\";\n int n = 0;\n int m = 0;\n for(int x = 0; x< numbers.Length; x++)\n {\n if(numbers[x] == Convert.ToChar(\" \"))\n {\n n = Convert.ToInt32(number);\n number = \"\";\n }\n else\n {\n number += numbers[x];\n }\n }\n m = Convert.ToInt32(number);\n if (n % 2 != 0 && n <= m)\n {\n Console.WriteLine(\"Akshat\");\n }\n else if(m % 2 != 0 && m <= n)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nnamespace GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.None);\n\n int n = int.Parse(input[0]);\n int m = int.Parse(input[1]);\n\n int min = n > m ? m : n;\n\n if (min % 2 ==1 ){\n Console.WriteLine(\"Akshat\");\n }else{\n Console.WriteLine(\"Malvika\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] numbers = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n double inter = numbers[0] * numbers[1];\n int counter = 0;\n while (inter != 0)\n {\n inter = inter - (numbers[0] + numbers[1] - 1);\n numbers[0]--;\n numbers[1]--;\n counter++;\n }\n Console.WriteLine((counter % 2 != 0) ? \"Akshat\" : \"Malvika\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, k = 0;\n string[] s = Console.ReadLine().Split();\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n if (n <= m)\n {\n k = n % 2;\n }\n if (m < n)\n {\n k = m % 2;\n }\n int caseSwitch = k;\n switch (caseSwitch)\n {\n case 0:\n Console.WriteLine(\"Malvika\");\n break;\n\n case 1:\n Console.WriteLine(\"Akshat\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\n\n\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tGameWithSticks();\t\n\t\t}\n\t\tpublic static void GameWithSticks(){\n\t\t\tint[] nm = Array.ConvertAll(Console.ReadLine().Split(), x=> Convert.ToInt32(x));\n\t\t\tArray.Sort(nm);\n\t\t\tConsole.WriteLine(nm[0] %2 == 0 ? \"Malvika\":\"Akshat\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] data = Console.ReadLine().Split(' ');\n int row = int.Parse(data[0]);\n int col = int.Parse(data[1]);\n\n \n if (row >= col)\n {\n Print(col);\n }\n\n else\n {\n Print(row);\n }\n\n\n \n }\n static void Print(int number)\n {\n if (number % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n public static class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \", col));\n }\n\n\n public static void PrintLn(params object[] v)\n {\n PrintLnCollection(v);\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n\n public static string MySubstring(this string str, int start, int finish)\n {\n return str.Substring(start, finish - start + 1);\n }\n\n\n public static bool IsInRange(this int a, int lb, int ub)\n {\n return (a >= lb) && (a <= ub);\n }\n\n private static void mergeDS(int i, int j, int[] a)\n {\n int t = a[j];\n for (int ii = 0; ii < a.Length; ii++)\n {\n if (a[ii] == t)\n a[ii] = a[i];\n }\n }\n\n private static T MyMax(params T[] a)\n {\n return a.Max();\n }\n\n private static T MyMin(params T[] a)\n {\n return a.Min();\n }\n\n //----------------------------------------------------------------------------\n\n static int[,] ans = new int[100, 100];\n\n static int solve(int i, int j)\n {\n if (ans[i, j] != 0)\n return ans[i, j];\n else\n {\n if (solve(i-1, j - 1) == -1)\n {\n ans[i, j] = 1;\n return 1;\n }\n else\n {\n ans[i, j] = -1;\n return -1;\n }\n }\n }\n\n static void Main(string[] args)\n {\n\n for (int i = 0; i < 100; i++)\n {\n ans[i, 0] = ans[0, i] = 1;\n }\n\n int r = 0, c = 0;\n \n ReadInts(ref r, ref c);\n\n r--; c--;\n\n if (solve(r, c) == 1)\n PrintLn(\"Akshat\");\n else\n PrintLn(\"Malvika\");\n\n\n }\n\n\n\n\n\n }\n\n\n}\n"}, {"source_code": "using System;\n\nclass grid {\n\tpublic static void Main() {\n\t\tvar line = Console.ReadLine().Split();\n\t\tvar n = int.Parse(line[0]);\n\t\tvar m = int.Parse(line[1]);\n\t\tif (Math.Min(n, m) % 2 == 0) {\n\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t}\n\t\telse {\n\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#16 Resolve Game With Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n int input1 = int.Parse(inputer[0]),\n input2 = int.Parse(inputer[1]);\n\n if (input1 % 2 == 0 && input2 % 2 == 0 || input2> input1 && input1%2==0 && input2%2==1 || input1>input2 && input1%2==1 && input2%2==0)\n {\n Console.WriteLine(\"Malvika\");\n Console.ReadLine();\n }\n else Console.WriteLine(\"Akshat\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _451A\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(Console.ReadLine().Split().Select(token => int.Parse(token)).Min() % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "// A Dynamic Programming based \n// C# program to find minimum \n// number operations to \n// convert str1 to str2 \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass GFG\n{\n\n\n public static void Main()\n {\n ///var t = int.Parse(Console.ReadLine());\n\n //while (t > 0)\n {\n // t--;\n // var n = int.Parse(Console.ReadLine());\n //var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n var input = Console.ReadLine().Split();\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n //var k = int.Parse(input[2]);\n // Split(n, arr);\n if (n > m)\n {\n var tmp = m;\n m = n;\n n = tmp;\n }\n if (n % 2 == 0)\n {\n Console.Write(\"Malvika\");\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n\n\n\n }\n\n\n }\n\n\n}"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n int intersections = x * y;\n int nTours = intersections / 2;\n if (x == 1 || y ==1)\n Console.WriteLine(\"Akshat\");\n else\n if (x == y || x < y)\n {\n if (x % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n else\n if (y < x)\n {\n if (y % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }\n }"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif (n % 2 != 0) {\n\t\t\t\tConsole.WriteLine (\"Askhat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training_App\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] splits = input.Split(' ');\n int n = int.Parse(splits[0]);\n int m = int.Parse(splits[1]);\n\n int result = n * m;\n if (result % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif (n % 2 != 0) {\n\t\t\t\tConsole.WriteLine (\"Askhat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace W2\n{\n class Program\n {\n //https://codeforces.com/problemset/problem/1380/A\n\n static void Main(string[] args)\n {\n string numbers = Console.ReadLine();\n string number = \"\";\n bool first = true;\n int n = 0;\n int m = 0;\n for(int x = 0; x< numbers.Length; x++)\n {\n if(numbers[x] == Convert.ToChar(\" \"))\n {\n if (first)\n {\n n = Convert.ToInt32(number);\n }\n else\n {\n m = Convert.ToInt32(number);\n }\n first = false;\n number = \"\";\n }\n else\n {\n number += numbers[x];\n }\n }\n\n if (n % 2 != 0 && n >= m)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if ((n * m) % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int i = 0; int c=n*m;\n while(i b) { return (a); }\n else\n {\n return b;\n }\n }\n static int min(int a, int b)\n {\n if (a < b) { return (a); }\n else\n {\n return b;\n }\n }\n static void Main(string[] args)\n {\n string[] str = (Console.ReadLine()).Split(' ');\n int a = Convert.ToInt32(Console.ReadLine());\n int b = Convert.ToInt32(Console.ReadLine());\n int n = min(a, b);\n int m = max(a, b);\n if (n % 2 == 0) { Console.WriteLine(\"Malvika\"); } else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, k;\n string[] s = Console.ReadLine().Split();\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n k = (n * m) % 2;\n\t\t int caseSwitch =k;\n switch (caseSwitch)\n {\n case 0:\n Console.WriteLine(\"Malvika\");\n break;\n\n case 1:\n Console.WriteLine(\"Akshat\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str.Split(' ')[0]);\n int m = Convert.ToInt32(str.Split(' ')[1]);\n\n if ((n * m) > 2)\n {\n if ((n * m) % 2 == 0)\n {\n Console.Write(\"Malvika\");\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); string[] arr=s.Split(' ');\n double n = Math.Ceiling((double.Parse(arr[0])*double.Parse(arr[1]))/3);\n Console.Write((n % 2 == 0) ? \"Malvika\" : \"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int i = 0; int c=n*m;\n while(i matrix = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToList();\n int count = 1, x = matrix[0] * matrix[1], r = matrix[0], c = matrix[1];\n for (int i = 0; i < matrix.Count * 2; i++)\n {\n if (x < 0)\n break;\n if (Math.Min(r, c) == 0)\n x--;\n else\n {\n x -= (r + c - 1);\n r = r - 1;\n c = c - 1;\n }\n if (x > 0)\n count++;\n }\n if (count % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n //while (true) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m;\n string []str = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(str[0],10);\n m = Convert.ToInt32(str[1], 10);\n\n if (n >= 1 && m <= 100)\n {\n int kol = m * n;\n bool f = false;\n int k = 0;\n while (kol > 1)\n {\n kol = --n + --m;\n if (k % 2 == 0)\n f = false;\n else\n f = true;\n k++;\n }\n if(f && k > 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string Input;\n Input = Console.ReadLine();\n string[] splitString = Input.Split(' ');\n int stickNumber1, stickNumber2, TotalNUmberOFsticks, counter = 0;\n stickNumber1 = Convert.ToInt32(splitString[0]);\n stickNumber2 = Convert.ToInt32(splitString[1]);\n TotalNUmberOFsticks = stickNumber1 + stickNumber2;\n while(true)\n {\n if (TotalNUmberOFsticks < 2)\n break;\n\n TotalNUmberOFsticks -= 2;\n counter++;\n\n }\n\n\n\n\n if (counter % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n\n\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n static public void Main()\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if ((n * m) % 2 == 0) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n }\n}"}, {"source_code": "using System;\n\nnamespace GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n\n int a = Convert.ToInt32(input[0]);\n int b = Convert.ToInt32(input[1]);\n\n int w = 0;\n\n while(a != 0 && b != 0)\n {\n a--;\n b--;\n\n if (w == 0) w = 1; else w = 0;\n }\n\n if(w == 0) Console.WriteLine(\"Akshat\"); else Console.WriteLine(\"Malvika\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine(); string[] arr=s.Split(' ');\n int n = int.Parse(arr[0]), m = int.Parse(arr[1]);\n Console.Write(((n*m) % 2 == 0) ? \"Malvika\" : \"Akshat\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ForFun\n{\n\tclass Codeforces\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tint n, m;\n\t\t\tvar s = Console.ReadLine().Split(' ');\n\t\t\tn = int.Parse(s[0]);\n\t\t\tm = int.Parse(s[1]);\n\n\t\t\tif (n * m % 2 == 0)\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t}\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int n = a * b;\n if (n / 4 % 2 == 0)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n int intersections = x * y;\n int nTours = intersections / 2;\n if (x == 1 || y ==1)\n Console.WriteLine(\"Akshat\");\n if (nTours % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }"}, {"source_code": "using System;\n\nnamespace CF_StickGame {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split();\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n if (((m*n) & 1) == 1){\n Console.WriteLine(\"Akshat\");\n return;\n }\n Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif ((n % 2 != 0 && m % 2 == 2) || n == 1 || m == 1) {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif (n % 2 != 0) {\n\t\t\t\tConsole.WriteLine (\"Askhat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] n = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) || (n[0] % 2 == 0)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Solution\n{\n public static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n int[] input = Array.ConvertAll(inp, Int32.Parse);\n int n = input[0], m = input[1], stick = n + m;\n while(true)\n {\n if (stick >= 2) stick = stick - 2;\n else\n {\n Console.WriteLine(\"Malvika\");\n break;\n }\n if (stick >= 2) stick = stick - 2;\n else\n {\n Console.WriteLine(\"Akshat\");\n break;\n }\n }\n }\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int n = a * b;\n if (n / 4 % 2 == 0)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ForFun\n{\n\tclass Codeforces\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tint n, m;\n\t\t\tvar s = Console.ReadLine().Split(' ');\n\t\t\tn = int.Parse(s[0]);\n\t\t\tm = int.Parse(s[1]);\n\n\t\t\tif (n * m % 2 == 0)\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t}\n\t}\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if (n == 1 || m == 1)\n Console.WriteLine(\"Akshat\");\n else if ((m+n)/2 % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\t\n\t\tstring name1 = \"Akshat\";\n\t\tstring name2 = \"Malvika\";\n\t\tbool turn = true;\n\t\tstring temp = Console.ReadLine();\n\t\tstring[] tempArr = temp.Split(' ');\n\t\tint n = int.Parse(tempArr[0]);\n\t\tint m = int.Parse(tempArr[1]);\n\t\tint sum = n + m;\n\t\twhile(sum > 1){\n\t\t\tturn = !turn;\n\t\t\tsum-=2; \n\t\t}\n\t\tif(turn)\n\t\t\tConsole.WriteLine(name2);\n\t\t\telse\n\t\t\tConsole.WriteLine(name1);\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n\n int a = Convert.ToInt32(input[0]);\n int b = Convert.ToInt32(input[1]);\n\n int w = 0;\n\n while(a != 0 && b != 0)\n {\n a--;\n b--;\n\n if (w == 0) w = 1; else w = 0;\n }\n\n if(w == 0) Console.WriteLine(\"Akshat\"); else Console.WriteLine(\"Malvika\");\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif ((n % 2 != 0 && m % 2 == 2) || n == 1 || m == 1) {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace _451A\n{\n class Program\n {\n static void Main()\n {\n var input = Console.ReadLine().Split();\n var n = int.Parse(input[0]);\n var m = int.Parse(input[1]);\n\n var crosses = n * m;\n Console.WriteLine(crosses % 2 == 0 ? \"Malvika\" : \"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n\n if ((n + m - 1) % 2 == 1)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malika\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int i = 0; int c=n*m;\n while(i int.Parse(num)).ToArray();\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) || (n[0] % 2 == 0)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _451a\n{\n\tclass Program\n\t{\n\t\tpublic static void Main ( string [ ] args )\n\t\t{\n\t\t\tbyte n, m;\n\t\t\tstring[] nums = (Console.ReadLine()).Split(' ');\n\t\t\tn = byte.Parse(nums[0]);\n\t\t\tm = byte.Parse(nums[1]);\n\t\t\tif ((m * n) % 2 != 0)\n\t\t\t\tConsole.Write( \"Akshat\" );\n\t\t\telse\n\t\t\t\tConsole.Write( \"Malvika\" );\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _451A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int n = Convert.ToInt32(str.Split(' ')[0]);\n int m = Convert.ToInt32(str.Split(' ')[1]);\n\n if ((n * m) > 2)\n {\n if ((n * m) % 2 == 0)\n {\n Console.Write(\"Malvika\");\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] n = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n if ((n[0] == 1) || (n[1] == 1))\n {\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) && (n[1] % 2 == 1)) || ((n[1] % 2 == 0) && (n[0] % 2 == 1)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string[] line = Console.ReadLine().Split(' ') ;\n\n int n, m;\n n = Convert.ToInt32(line[0]);\n m = Convert.ToInt32(line[1]);\n double p = (n*m) / 2.0 ;\n\n if (Math.Ceiling(p) == Math.Floor(p))\n {\n Console.WriteLine(\"Malvika\");\n }\n else { Console.WriteLine(\"Akshat\"); }\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#16 Resolve Game With Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n int input1 = int.Parse(inputer[0]),\n input2 = int.Parse(inputer[1]);\n\n if (input1==input2 && input1 % 2 == 0 && input2 % 2 == 0 || input2>input1 && input1%2==0 && input2%2==1 || input1>input2 && input1%2==1 && input2%2==0)\n {\n Console.WriteLine(\"Malvika\");\n Console.ReadLine();\n }\n else Console.WriteLine(\"Akshat\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] n = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) && (n[1] % 2 == 1)) || ((n[1] % 2 == 0) && (n[0] % 2 == 1)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication92\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n if (n == 1 || m == 1||(n*m)%2!=0) Console.WriteLine(\"Akshat\");\n else Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Ladder4\n{\n class Prob12\n {\n static void Main(string[] args)\n { \n List matrix = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToList();\n int count = 1, x = matrix[0] * matrix[1], r = matrix[0], c = matrix[1];\n for (int i = 0; i < r * c; i++)\n {\n if (x < 0)\n break;\n if (Math.Min(r, c) == 0)\n x--;\n else\n {\n x -= (r + c - 1);\n r = r - 1;\n c = c - 1;\n }\n if (x > 0)\n count++;\n }\n if (count % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n //while (true) ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training_App\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] splits = input.Split(' ');\n int n = int.Parse(splits[0]);\n int m = int.Parse(splits[1]);\n\n int result = n * m;\n if (n == 1 || m == 1)\n result = 1;\n if (result % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if ((n * m) % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string numbers = Console.ReadLine();\n\n string[] temp = numbers.Split(\" \");\n\n int firstNumber = Convert.ToInt32(temp[0]);\n int secondNumber = Convert.ToInt32(temp[1]);\n\n if ((firstNumber * secondNumber) % 2 == 0 && (firstNumber * secondNumber) != 2 && (firstNumber * secondNumber) != 1750 && (firstNumber * secondNumber) != 9900)\n {\n Console.WriteLine(\"Malvika\");\n } else\n {\n Console.WriteLine(\"Akshat\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n int intersections = x * y;\n int nTours = intersections / 2;\n if (x == 1 || y ==1)\n Console.WriteLine(\"Akshat\");\n if (nTours % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }"}, {"source_code": "using System;\n\nnamespace CF_StickGame {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split();\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n if (((m*n) & 1) == 1){\n Console.WriteLine(\"Akshat\");\n return;\n }\n Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int[] parameters;\n\n parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n\n if ((parameters[0] * parameters[1]) % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Training_App\n{\n class Program\n {\n\n\n\n static void Main(string[] args)\n {\n String input = Console.ReadLine();\n String[] splits = input.Split(' ');\n int n = int.Parse(splits[0]);\n int m = int.Parse(splits[1]);\n\n int result = n * m;\n if (n == 1 || m == 1)\n result = 1;\n if (result % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n\n\n"}, {"source_code": "using System;\n\nnamespace CF_StickGame {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split();\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n if (((m*n) & 1) == 1){\n Console.WriteLine(\"Akshat\");\n return;\n }\n Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _451A_GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mass = Console.ReadLine()\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(x => int.Parse(x))\n .ToArray();\n\n int temp = 0;\n int intersection = mass[0] * mass[1];\n\n for (int i = intersection; i > 1; i--)\n {\n mass[0]--;\n mass[1]--;\n\n intersection = mass[0] * mass[1];\n temp++;\n }\n\n Console.WriteLine(temp % 2 == 0 ? \"Akshat\" : \"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int nm = input[0] * input[1];\n\n int ans = Convert.ToInt32(Math.Floor(Math.Sqrt(nm)));\n \n if (ans % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if (n == 1 || m == 1)\n Console.WriteLine(\"Akshat\");\n else if ((m+n)/2 % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, k;\n string[] s = Console.ReadLine().Split();\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n k = (n * m) % 2;\n\t\t int caseSwitch =k;\n switch (caseSwitch)\n {\n case 0:\n Console.WriteLine(\"Malvika\");\n break;\n\n case 1:\n Console.WriteLine(\"Akshat\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n public static void Main(string[] args)\n { \n string[] input = Console.In.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]); \n if(n % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else{\n Console.WriteLine(\"Akshat\");\n } \n } \n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m;\n string []str = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(str[0],10);\n m = Convert.ToInt32(str[1], 10);\n\n if (n >= 1 && m <= 100)\n {\n int kol = m * n;\n bool f = false;\n int k = 0;\n while (kol > 1)\n {\n kol = --n + --m;\n if (k % 2 == 0)\n f = false;\n else\n f = true;\n k++;\n }\n if(f && k > 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n int intersections = x * y;\n int nTours = intersections / 2;\n if (x == 1 || y ==1)\n Console.WriteLine(\"Akshat\");\n\n if (x == y || x < y)\n {\n if (x % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n if (y < x)\n {\n if (y % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string numbers = Console.ReadLine();\n\n string[] temp = numbers.Split(\" \");\n\n int firstNumber = Convert.ToInt32(temp[0]);\n int secondNumber = Convert.ToInt32(temp[1]);\n\n if ((firstNumber * secondNumber) % 2 == 0 && (firstNumber * secondNumber) != 2 && (firstNumber * secondNumber) != 1750 && (firstNumber * secondNumber) != 9900)\n {\n Console.WriteLine(\"Malvika\");\n } else\n {\n Console.WriteLine(\"Akshat\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if (n == 1 || m == 1)\n Console.WriteLine(\"Akshat\");\n else if ((m+n)/2 % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n \n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n if ((x % 2 == 0 || y % 2 == 0) && x != 1 && y != 1)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n\n\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n public static void Main(string[] args)\n { \n string[] input = Console.In.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n long result = n * m;\n if(result % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else{\n Console.WriteLine(\"Akshat\");\n } \n } \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _258a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tvar n = d[0];\n\t\t\tvar m = d[1];\n\n\t\t\tvar f = m + n;\n\t\t\tvar turns = f / 2;\n\t\t\tvar r = turns % 2;\n\t\t\tif (r == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication92\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n if (n == 1 || m == 1||(n*m)%2!=0) Console.WriteLine(\"Akshat\");\n else Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_StickGame {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split();\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n if ((m ==1) || (n== 1)){\n Console.WriteLine(\"Akshat\");\n return;\n }\n if (((m*n) & 1) == 1){\n Console.WriteLine(\"Akshat\");\n return;\n }\n Console.WriteLine(\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string Input;\n Input = Console.ReadLine();\n string[] splitString = Input.Split(' ');\n int stickNumber1, stickNumber2, TotalNUmberOFsticks, counter = 0;\n stickNumber1 = Convert.ToInt32(splitString[0]);\n stickNumber2 = Convert.ToInt32(splitString[1]);\n TotalNUmberOFsticks = stickNumber1 + stickNumber2;\n while(true)\n {\n \n if (TotalNUmberOFsticks < 2)\n break;\n\n TotalNUmberOFsticks -= 2;\n counter++;\n\n }\n\n\n\n if (stickNumber1 == 1)\n {\n Console.WriteLine(\"Akshat\");\n\n }\n else\n {\n if (counter % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n\n }\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif ((n % 2 != 0 && m % 2 != 2) || n == 1 || m == 1) {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if ((n * m) % 2 == 0)\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n static public void Main()\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n if ((n * m) % 2 == 0) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int n = Convert.ToInt32(ss[0]);\n int m = Convert.ToInt32(ss[1]);\n int i = 0; int c=n*m;\n while(i= 1 && m <= 100)\n {\n int kol = m * n;\n int k = 0;\n while (kol > 1)\n {\n kol = --n + --m;\n k++;\n }\n if(k % 2 == 0 && k != 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Problem\n{\n static void Main()\n {\n var problem = new Problem();\n var ans = problem.Solve();\n if (ans) Console.WriteLine(\"Malvika\");\n else Console.WriteLine(\"Akshat\");\n#if DEBUG\n Console.ReadKey(true);\n#endif\n }\n\n bool Solve()\n {\n var sc = new Scanner();\n var n = sc.Integer();\n var m = sc.Integer();\n if (n * m % 2 == 0)\n return true;\n \n else return false;\n }\n}\n#region Pair\n\nstruct Pair\n{\n public T L { get; set; }\n public T R { get; set; }\n public Pair(T l, T r)\n : this()\n {\n L = l;\n R = r;\n }\n public override string ToString()\n {\n return string.Format(\"{0} {1}\", L, R);\n }\n}\n#endregion\ninternal class Scanner\n{\n readonly TextReader reader;\n string[] buffer = new string[0];\n int position;\n\n public char[] Separator { get; set; }\n public Scanner(TextReader reader = null, string separator = null)\n {\n if (reader == null)\n this.reader = Console.In;\n else\n this.reader = reader;\n if (string.IsNullOrEmpty(separator))\n separator = \" \";\n this.Separator = separator.ToCharArray();\n\n }\n public string Scan()\n {\n if (this.position < this.buffer.Length)\n return this.buffer[this.position++];\n this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n this.position = 0;\n return this.buffer[this.position++];\n }\n\n public string[] ScanToEndLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n var size = this.buffer.Length - this.position;\n var ar = new string[size];\n Array.Copy(this.buffer, position, ar, 0, size);\n return ar;\n\n }\n\n public string ScanLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine();\n else\n {\n var sb = new StringBuilder();\n for (; this.position < buffer.Length; this.position++)\n {\n sb.Append(this.buffer[this.position]);\n sb.Append(' ');\n }\n return sb.ToString();\n }\n }\n public string[] ScanArray(int length)\n {\n var ar = new string[length];\n for (int i = 0; i < length; i++)\n {\n ar[i] = this.Scan();\n }\n return ar;\n }\n\n public int Integer()\n {\n return int.Parse(this.Scan());\n }\n public long Long()\n {\n return long.Parse(this.Scan());\n }\n public double Double()\n {\n return double.Parse(this.Scan());\n }\n\n public int[] IntArray(int length)\n {\n var a = new int[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Integer();\n return a.ToArray();\n }\n public long[] LongArray(int length)\n {\n var a = new long[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Long();\n return a.ToArray();\n }\n public double[] DoubleArray(int length)\n {\n var a = new double[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Double();\n return a.ToArray();\n }\n\n}\nstatic public partial class EnumerableEx\n{\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n}\n//*/"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n int intersections = x * y;\n int nTours = intersections / 2;\n if (x == 1 || y ==1)\n Console.WriteLine(\"Akshat\");\n\n if (x == y || x < y)\n {\n if (x % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n if (y < x)\n {\n if (y % 2 == 1)\n Console.WriteLine(\"Akshat\");\n else\n Console.WriteLine(\"Malvika\");\n }\n }\n }"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string tmp = Console.ReadLine();\n var n = int.Parse(tmp.Split(' ')[0]);\n\n Console.WriteLine(n % 2 == 1 ? \"Akshat\" : \"Malvika\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\n\n\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string line = Console.ReadLine();\n var numbers = line.Split(' ');\n var x = int.Parse(numbers[0]);\n int y = int.Parse(numbers[1]);\n\n if (x % 2 == 0 || y % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n\n\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _258a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t//Console.SetIn(File.OpenText(\"in.txt\"));\n\t\t\tvar d = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();\n\t\t\tvar n = d[0];\n\t\t\tvar m = d[1];\n\n\t\t\tvar f = m + n;\n\t\t\tvar turns = f / 2;\n\t\t\tvar r = turns % 2;\n\t\t\tif (r == 1)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n { \n string[] s = Console.ReadLine().Split();\n Console.WriteLine(int.Parse(s[0])*int.Parse(s[1])%2!=0?\"Akshat\":\"Malvika\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] n = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) && (n[1] % 2 == 1)) || ((n[1] % 2 == 0) && (n[0] % 2 == 1)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string[] line = Console.ReadLine().Split(' ') ;\n\n int n, m;\n n = Convert.ToInt32(line[0]);\n m = Convert.ToInt32(line[1]);\n double p = n*m / 2 ;\n\n if (Math.Ceiling(p) == Math.Floor(p))\n {\n Console.WriteLine(\"Malvika\");\n }\n else { Console.WriteLine(\"Akshat\"); }\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif ((n * m) % 2 == 0) {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string numbers = Console.ReadLine();\n\n string[] temp = numbers.Split(\" \");\n\n int firstNumber = Convert.ToInt32(temp[0]);\n int secondNumber = Convert.ToInt32(temp[1]);\n\n if ((firstNumber * secondNumber) % 2 == 0 && (firstNumber * secondNumber) != 2)\n {\n Console.WriteLine(\"Malvika\");\n } else\n {\n Console.WriteLine(\"Akshat\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Algorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n GameOfSticks();\n\n //Console.ReadLine();\n }\n\n private static void GameOfSticks()\n {\n string[] sticks = Console.ReadLine().Split(' ');\n\n int hotizontalSticks = int.Parse(sticks[0]);\n int verticalSticks = int.Parse(sticks[1]);\n\n var totalNumberOfCrossPoints = hotizontalSticks * verticalSticks;\n\n string winner = \"Malvika\";\n\n for (int i = totalNumberOfCrossPoints; i < 0; i--)\n {\n if (totalNumberOfCrossPoints == 0)\n break;\n\n totalNumberOfCrossPoints = --hotizontalSticks * --verticalSticks;\n\n if (winner == \"Akshat\") winner = \"Malvika\";\n else if (winner == \"Malvika\") winner = \"Akshat\";\n }\n\n Console.WriteLine(winner);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int m = Convert.ToInt32(Console.Read());\n int n = Convert.ToInt32(Console.Read());\n if (n 2)\n {\n if ((n * m) % 2 == 0)\n {\n Console.Write(\"Malvika\");\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n }\n else\n {\n Console.Write(\"Akshat\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n//#16 Resolve Game With Sticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inputer = Console.ReadLine().Split();\n int input1 = int.Parse(inputer[0]),\n input2 = int.Parse(inputer[1]);\n\n if (input1==input2 && input1 % 2 == 0 && input2 % 2 == 0 || input2>input1 && input1%2==0 && input2%2==1 || input1>input2 && input1%2==1 && input2%2==0)\n {\n Console.WriteLine(\"Malvika\");\n Console.ReadLine();\n }\n else Console.WriteLine(\"Akshat\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif (n % 2 != 0 || n == 1 || m == 1) {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n int[] n = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();\n if ((n[0] == 1) || (n[1] == 1))\n {\n if ((n[0] % 2 == 0) && (n[1] % 2 == 0))\n {\n Console.WriteLine(\"Malvika\");\n }\n else if (((n[0] % 2 == 0) && (n[1] % 2 == 1)) || ((n[1] % 2 == 0) && (n[0] % 2 == 1)))\n {\n Console.WriteLine(\"Malvika\");\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n else\n {\n Console.WriteLine(\"Akshat\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string Input;\n Input = Console.ReadLine();\n string[] splitString = Input.Split(' ');\n int stickNumber1, stickNumber2, TotalNUmberOFsticks, counter = 0;\n stickNumber1 = Convert.ToInt32(splitString[0]);\n stickNumber2 = Convert.ToInt32(splitString[1]);\n TotalNUmberOFsticks = stickNumber1 + stickNumber2;\n while(true)\n {\n \n if (TotalNUmberOFsticks < 2)\n break;\n\n TotalNUmberOFsticks -= 2;\n counter++;\n\n }\n\n\n\n if (stickNumber1 == 1||stickNumber2==1)\n {\n Console.WriteLine(\"Akshat\");\n\n }\n else\n {\n if (counter % 2 == 0)\n Console.WriteLine(\"Malvika\");\n else\n Console.WriteLine(\"Akshat\");\n\n }\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ForFun\n{\n\tclass Codeforces\n\t{\n\t\tstatic void Main()\n\t\t{\n\t\t\tint n, m;\n\t\t\tvar s = Console.ReadLine().Split(' ');\n\t\t\tn = int.Parse(s[0]);\n\t\t\tm = int.Parse(s[1]);\n\n\t\t\tif (n * m % 2 == 0)\n\t\t\t\tConsole.WriteLine(\"Malvika\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"Akshat\");\n\t\t}\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n int b = int.Parse(s[1]);\n int n = a * b;\n if (n / 4 % 2 == 0)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace _451A_GameWithSticks\n{\n class Program\n {\n static void Main(string[] args)\n {\n var mass = Console.ReadLine()\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(x => int.Parse(x))\n .ToArray();\n\n int temp = 1;\n int intersection = mass[0] * mass[1];\n\n for (int i = intersection; i > 2; i--)\n {\n mass[0]--;\n mass[1]--;\n\n intersection = mass[0] * mass[1];\n temp++;\n }\n\n Console.WriteLine(temp % 2 == 0 ? \"Akshat\" : \"Malvika\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace W2\n{\n class Program\n {\n //https://codeforces.com/problemset/problem/1380/A\n\n static void Main(string[] args)\n {\n string numbers = Console.ReadLine();\n string number = \"\";\n bool first = true;\n int n = 0;\n int m = 0;\n for(int x = 0; x< numbers.Length; x++)\n {\n if(numbers[x] == Convert.ToChar(\" \"))\n {\n if (first)\n {\n n = Convert.ToInt32(number);\n }\n else\n {\n m = Convert.ToInt32(number);\n }\n first = false;\n number = \"\";\n }\n else\n {\n number += numbers[x];\n }\n }\n\n if (n % 2 != 0 && n >= m)\n {\n Console.WriteLine(\"Akshat\");\n }\n else\n {\n Console.WriteLine(\"Malvika\");\n }\n Console.ReadLine();\n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Main\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\t\n\t\t\tstring[] map = Console.ReadLine().Split(' ');\n\t\t\tint n = Convert.ToInt32(map [0]);\n\t\t\tint m = Convert.ToInt32(map [1]);\n\n\t\t\tif ((n % 2 != 0 && m % 2 == 2) || n == 1 || m == 1) {\n\t\t\t\tConsole.WriteLine (\"Akshat\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine (\"Malvika\");\n\t\t\t}\n\t\t}\n\t}\n}"}], "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class D\n {\n private static ThreadStart s_threadStart = new D().Go;\n private static bool s_time = false;\n\n bool Solve3(bool[] used, long[] dig, long sum, long[,] tab, int level)\n {\n if (level == 9)\n {\n if (tab[0, 0] + tab[0, 1] + tab[0, 2] != sum) return false;\n if (tab[1, 0] + tab[1, 1] + tab[1, 2] != sum) return false;\n if (tab[2, 0] + tab[2, 1] + tab[2, 2] != sum) return false;\n if (tab[0, 0] + tab[1, 0] + tab[2, 0] != sum) return false;\n if (tab[0, 1] + tab[1, 1] + tab[2, 1] != sum) return false;\n if (tab[0, 2] + tab[1, 2] + tab[2, 2] != sum) return false;\n if (tab[0, 0] + tab[1, 1] + tab[2, 2] != sum) return false;\n if (tab[0, 2] + tab[1, 1] + tab[2, 0] != sum) return false;\n\n Wl(tab[0, 0] + \" \" + tab[0, 1] + \" \" + tab[0, 2]);\n Wl(tab[1, 0] + \" \" + tab[1, 1] + \" \" + tab[1, 2]);\n Wl(tab[2, 0] + \" \" + tab[2, 1] + \" \" + tab[2, 2]);\n return true;\n }\n else\n {\n for (int i = 0; i < 9; i++)\n {\n if (!used[i])\n {\n used[i] = true;\n tab[level / 3, level % 3] = dig[i];\n if (Solve3(used, dig, sum, tab, level + 1))\n return true;\n used[i] = false;\n }\n }\n }\n return false;\n }\n\n private void Go()\n {\n int n = GetInt();\n long[] dig = new long[n * n];\n long sum = 0;\n for (int i = 0; i < n*n; i++)\n {\n sum += (dig[i] = GetInt());\n }\n sum /= n;\n Wl(sum);\n if (n == 1)\n {\n Wl(dig[0]);\n }\n else if (n == 2)\n {\n Wl(dig[0] + \" \" + (sum - dig[0]));\n Wl((sum - dig[0]) + \" \" + dig[0]);\n }\n else if (n == 3)\n {\n bool[] used = new bool[9];\n long[,] tab = new long[3, 3];\n Solve3(used, dig, sum, tab, 0);\n }\n\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 512 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString());\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString());\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString());\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n public struct Tuple : IComparable>\n where T : IComparable\n where K : IComparable\n {\n public T Item1;\n public K Item2;\n\n public Tuple(T t, K k)\n {\n Item1 = t;\n Item2 = k;\n }\n\n public override bool Equals(object obj)\n {\n var o = (Tuple)obj;\n return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);\n }\n\n public override int GetHashCode()\n {\n return Item1.GetHashCode() ^ Item2.GetHashCode();\n }\n\n public override string ToString()\n {\n return \"(\" + Item1 + \" \" + Item2 + \")\";\n }\n\n #region IComparable> Members\n\n public int CompareTo(Tuple other)\n {\n int ret = Item1.CompareTo(other.Item1);\n if (ret != 0) return ret;\n return Item2.CompareTo(other.Item2);\n }\n\n #endregion\n }\n\n #endregion\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Magic_Squares\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve(args);\n writer.Flush();\n }\n\n private static void Solve(string[] args)\n {\n int n = Next();\n\n var nn = new int[n*n];\n var indx = new int[n*n];\n for (int i = 0; i < nn.Length; i++)\n {\n nn[i] = Next();\n indx[i] = i;\n }\n\n if (n < 3)\n {\n writer.WriteLine(n*nn[0]);\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n writer.Write(nn[0]);\n writer.Write(' ');\n }\n writer.WriteLine();\n }\n return;\n }\n\n int sum = nn.Sum()/3;\n\n do\n {\n bool ok = true;\n\n ok &= nn[indx[0]] + nn[indx[4]] + nn[indx[8]] == sum;\n ok &= nn[indx[2]] + nn[indx[4]] + nn[indx[6]] == sum;\n\n ok &= nn[indx[0]] + nn[indx[1]] + nn[indx[2]] == sum;\n ok &= nn[indx[3]] + nn[indx[4]] + nn[indx[5]] == sum;\n ok &= nn[indx[6]] + nn[indx[7]] + nn[indx[8]] == sum;\n\n ok &= nn[indx[0]] + nn[indx[3]] + nn[indx[6]] == sum;\n ok &= nn[indx[1]] + nn[indx[4]] + nn[indx[7]] == sum;\n ok &= nn[indx[2]] + nn[indx[5]] + nn[indx[8]] == sum;\n\n if (ok)\n {\n writer.WriteLine(sum);\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n writer.Write(nn[indx[i*3 + j]]);\n writer.Write(' ');\n }\n writer.WriteLine();\n }\n break;\n }\n } while (NextPermutation(indx));\n }\n\n private static bool NextPermutation(int[] nn)\n {\n if (nn.Length <= 1) return false;\n int i = nn.Length - 1;\n int last = nn.Length;\n\n while (true)\n {\n int i1 = i;\n if (nn[--i] < nn[i1])\n {\n int i2 = last;\n while (!(nn[i] < nn[--i2]))\n {\n ;\n }\n int c = nn[i];\n nn[i] = nn[i2];\n nn[i2] = c;\n\n Reverse(nn, i1, last);\n return true;\n }\n if (i == 0)\n {\n Reverse(nn, 0, last);\n return false;\n }\n }\n }\n\n private static void Reverse(int[] nn, int first, int last)\n {\n while ((first != last) && (first != --last))\n {\n int c = nn[first];\n nn[first] = nn[last];\n nn[last] = c;\n first++;\n }\n }\n\n private static int Next()\n {\n int c;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 178D1\")]\n#endif\n\tclass Task178D1\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tint[,] tmpl;\n\t\tlong[] partialSum;\n\t\tlong s;\n\t\tlong[] a;\n\t\tlong[,] matrix;\n\t\tint n;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tinput.Line().Read(out n)\n\t\t\t\t\t .Line().Read(n * n, out a);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { 0 }) },\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { 2, 8 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 1, 3, 5 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 3:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 2, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 0, g(new int[] { 3 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 13 }) },\n\t\t\t\t\t\t{ 1, 2, g(new int[] { 1 }) },\n\t\t\t\t\t\t{ 2, 1, g(new int[] { 4 }) },\n\t\t\t\t\t\t{ 2, 2, g(new int[] { 2, 5, 8 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\n\t\t\tlong sum = a.Aggregate(0L, (x, y) => x + y);\n\t\t\ts = sum / n;\n\t\t\tpartialSum = new long[30];\n\n\t\t\tmatrix = new long[n, n];\n\t\t\tf(0);\n\n\t\t\toutput.WriteLine(s);\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\toutput.Write(matrix[i, 0]);\n\t\t\t\tfor (int j = 1; j < n; ++j)\n\t\t\t\t\toutput.Write(\" {0}\", matrix[i, j]);\n\t\t\t\toutput.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tprivate int g(int[] p)\n\t\t{\n\t\t\tint x = 0;\n\t\t\tforeach (var i in p) x |= 1 << i;\n\t\t\treturn x;\n\t\t}\n\n\t\tprivate bool f(int i)\n\t\t{\n\t\t\tif (n * n == i) return true;\n\n\t\t\tfor (int t = i; t < n * n; ++t)\n\t\t\t\tif (t == i || a[t] != a[t - 1]) {\n\t\t\t\t\tlong h = a[i];\n\t\t\t\t\ta[i] = a[t];\n\t\t\t\t\ta[t] = h;\n\n\t\t\t\t\tint y = tmpl[i, 0], x = tmpl[i, 1], test = tmpl[i, 2];\n\t\t\t\t\tmatrix[y, x] = a[i];\n\t\t\t\t\tpartialSum[y] += a[i]; // |\n\t\t\t\t\tpartialSum[x + n] += a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] += a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] += a[i]; // /\n\n\t\t\t\t\tbool b = true;\n\n\t\t\t\t\tfor (int z = 0; b && test != 0; ++z, test >>= 1)\n\t\t\t\t\t\tif ((test & 1) != 0 && partialSum[z] != s)\n\t\t\t\t\t\t\tb = false;\n\n\t\t\t\t\tif (!b) {\n\t\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\t\ta[i] = h;\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (f(i + 1)) return true;\n\n\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\ta[i] = h;\n\t\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task178D1();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 178D1\")]\n#endif\n\tclass Task178D1\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tint[,] tmpl;\n\t\tlong[] partialSum;\n\t\tlong s;\n\t\tlong[] a;\n\t\tlong[,] matrix;\n\t\tint n;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tinput.Line().Read(out n)\n\t\t\t\t\t .Line().Read(n * n, out a);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { 0 }) },\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { 2, 8 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 1, 3, 5 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 3:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 2, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 0, g(new int[] { 3 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 13 }) },\n\t\t\t\t\t\t{ 1, 2, g(new int[] { 1 }) },\n\t\t\t\t\t\t{ 2, 1, g(new int[] { 4 }) },\n\t\t\t\t\t\t{ 2, 2, g(new int[] { 2, 5, 8 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 3, g(new int[] { 0 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 1, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 3, 0, g(new int[] { 4 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 1, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 1, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 1, g(new int[] { 18 }) },\n\n\t\t\t\t\t\t{ 1, 3, g(new int[] { 1 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 3, 1, g(new int[] { 5 }) },\n\n\t\t\t\t\t\t{ 2, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 3, g(new int[] { 2 }) },\n\t\t\t\t\t\t{ 3, 2, g(new int[] { 6 }) },\n\t\t\t\t\t\t{ 3, 3, g(new int[] { 3, 7, 11 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\n\t\t\tlong sum = a.Aggregate(0L, (x, y) => x + y);\n\t\t\ts = sum / n;\n\t\t\tpartialSum = new long[30];\n\n\t\t\tmatrix = new long[n, n];\n\t\t\tf(0);\n\n\t\t\toutput.WriteLine(s);\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\toutput.Write(matrix[i, 0]);\n\t\t\t\tfor (int j = 1; j < n; ++j)\n\t\t\t\t\toutput.Write(\" {0}\", matrix[i, j]);\n\t\t\t\toutput.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tprivate int g(int[] p)\n\t\t{\n\t\t\tint x = 0;\n\t\t\tforeach (var i in p) x |= 1 << i;\n\t\t\treturn x;\n\t\t}\n\n\t\tprivate bool f(int i)\n\t\t{\n\t\t\tif (n * n == i) return true;\n\n\t\t\tfor (int t = i; t < n * n; ++t)\n\t\t\t\tif (t == i || a[t] != a[t - 1]) {\n\t\t\t\t\tlong h = a[i];\n\t\t\t\t\ta[i] = a[t];\n\t\t\t\t\ta[t] = h;\n\n\t\t\t\t\tint y = tmpl[i, 0], x = tmpl[i, 1], test = tmpl[i, 2];\n\t\t\t\t\tmatrix[y, x] = a[i];\n\t\t\t\t\tpartialSum[y] += a[i]; // |\n\t\t\t\t\tpartialSum[x + n] += a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] += a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] += a[i]; // /\n\n\t\t\t\t\tbool b = true;\n\n\t\t\t\t\tfor (int z = 0; b && test != 0; ++z, test >>= 1)\n\t\t\t\t\t\tif ((test & 1) != 0 && partialSum[z] != s)\n\t\t\t\t\t\t\tb = false;\n\n\t\t\t\t\tif (!b) {\n\t\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\t\ta[i] = h;\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (f(i + 1)) return true;\n\n\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\ta[i] = h;\n\t\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task178D1();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 178D1\")]\n#endif\n\tclass Task178D1\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tint[,] tmpl;\n\t\tlong[] partialSum;\n\t\tlong s;\n\t\tlong[] a;\n\t\tlong[,] matrix;\n\t\tint n;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tinput.Line().Read(out n)\n\t\t\t\t\t .Line().Read(n * n, out a);\n\n\t\t\tswitch (n) {\n\t\t\t\tcase 1:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { 0 }) },\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { 2, 8 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 1, 3, 5 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 3:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 2, g(new int[] { 0 }) },\n\t\t\t\t\t\t{ 1, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 0, g(new int[] { 3 }) },\n\t\t\t\t\t\t{ 1, 1, g(new int[] { 13 }) },\n\t\t\t\t\t\t{ 1, 2, g(new int[] { 1 }) },\n\t\t\t\t\t\t{ 2, 1, g(new int[] { 4 }) },\n\t\t\t\t\t\t{ 2, 2, g(new int[] { 2, 5, 8 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\ttmpl = new int[,] {\n\t\t\t\t\t\t{ 0, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 0, 3, g(new int[] { 0 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 1, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 0, g(new int[] { }) },\n\t\t\t\t\t\t{ 3, 0, g(new int[] { 4 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 1, 1, g(new int[] { }) },\n\t\t\t\t\t\t{ 1, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 1, g(new int[] { 18 }) },\n\n\t\t\t\t\t\t{ 1, 3, g(new int[] { 1 }) },\n\t\t\t\t\t\t\n\t\t\t\t\t\t{ 3, 1, g(new int[] { 5 }) },\n\n\t\t\t\t\t\t{ 2, 2, g(new int[] { }) },\n\t\t\t\t\t\t{ 2, 3, g(new int[] { 2 }) },\n\t\t\t\t\t\t{ 3, 2, g(new int[] { 6 }) },\n\t\t\t\t\t\t{ 3, 3, g(new int[] { 3, 7, 11 }) }\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tArray.Sort(a);\n\n\t\t\tlong sum = a.Aggregate(0L, (x, y) => x + y);\n\t\t\ts = sum / n;\n\t\t\tpartialSum = new long[30];\n\n\t\t\tmatrix = new long[n, n];\n\t\t\tf(0);\n\n\t\t\toutput.WriteLine(s);\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\toutput.Write(matrix[i, 0]);\n\t\t\t\tfor (int j = 1; j < n; ++j)\n\t\t\t\t\toutput.Write(\" {0}\", matrix[i, j]);\n\t\t\t\toutput.WriteLine();\n\t\t\t}\n\t\t}\n\n\t\tprivate int g(int[] p)\n\t\t{\n\t\t\tint x = 0;\n\t\t\tforeach (var i in p) x |= 1 << i;\n\t\t\treturn x;\n\t\t}\n\n\t\tprivate bool f(int i)\n\t\t{\n\t\t\tif (n * n == i) return true;\n\n\t\t\tfor (int t = i; t < n * n; ++t)\n\t\t\t\tif (t == i || a[t] != a[t - 1]) {\n\t\t\t\t\tlong h = a[i];\n\t\t\t\t\ta[i] = a[t];\n\t\t\t\t\ta[t] = h;\n\n\t\t\t\t\tint y = tmpl[i, 0], x = tmpl[i, 1], test = tmpl[i, 2];\n\t\t\t\t\tmatrix[y, x] = a[i];\n\t\t\t\t\tpartialSum[y] += a[i]; // |\n\t\t\t\t\tpartialSum[x + n] += a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] += a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] += a[i]; // /\n\n\t\t\t\t\tbool b = true;\n\n\t\t\t\t\tfor (int z = 0; b && test != 0; ++z, test >>= 1)\n\t\t\t\t\t\tif ((test & 1) != 0 && partialSum[z] != s)\n\t\t\t\t\t\t\tb = false;\n\n\t\t\t\t\tif (!b) {\n\t\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\t\ta[i] = h;\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (f(i + 1)) return true;\n\n\t\t\t\t\tpartialSum[y] -= a[i]; // |\n\t\t\t\t\tpartialSum[x + n] -= a[i]; // -\n\t\t\t\t\tpartialSum[x - y + (n - 1) + n * 2] -= a[i]; // \\\n\t\t\t\t\tpartialSum[x + y + n * 4 - 1] -= a[i]; // /\n\n\t\t\t\t\ta[t] = a[i];\n\t\t\t\t\ta[i] = h;\n\t\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task178D1();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++].Replace('.', ','));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n"}], "negative_code": [], "src_uid": "7c806fb163aaf23e1eef3e6570aea436"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R188_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long y = long.Parse(s[1]);\n long m = long.Parse(s[2]);\n\n long x2 = x;\n long y2 = y;\n long cnt = 0, sum;\n while (x2 < m && y2 < m && (x2+y2 >0 || (x2+y2 > Math.Min(x2,y2))))\n {\n long min = Math.Min(x2, y2);\n long max = Math.Max(x2, y2);\n if (min < 0 && Math.Abs(min) > max)\n {\n long num = Math.Abs(min) / max;\n cnt += num;\n min += num * max;\n x2 = min; y2 = max;\n }\n sum = x2 + y2;\n if (x2 < y2) \n x2 = sum;\n else\n y2 = sum;\n cnt++;\n }\n if (x2 < m && y2 < m)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R188_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long y = long.Parse(s[1]);\n long m = long.Parse(s[2]);\n\n long x2 = x;\n long y2 = y;\n long cnt = 0, sum;\n while (x2 < m && y2 < m && (x2+y2 >0 || (x2+y2 > Math.Min(x2,y2))))\n {\n long min = Math.Min(x2, y2);\n long max = Math.Max(x2, y2);\n if (min < 0 && Math.Abs(min) > max)\n {\n long num = Math.Abs(min) / max;\n cnt += num;\n min += num * max;\n x2 = min; y2 = max;\n }\n sum = x2 + y2;\n if (x2 < y2) \n x2 = sum;\n else\n y2 = sum;\n cnt++;\n }\n if (x2 < m && y2 < m)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n\n String s = Console.ReadLine();\n \n char[] c = {' '};\n \n String[] a = s.Split(c, 3, StringSplitOptions.RemoveEmptyEntries);\n \n long x = long.Parse(a[0]), tx = x;\n long y = long.Parse(a[1]), ty = y;\n long m = long.Parse(a[2]);\n \n long ans = 0;\n \n while (tx < m && ty < m){\n \n long tempX = tx, tempY = ty;\n \n if (tx < ty){\n \n if (ty != 0){\n \n ans += ((ty - tx) / ty + 1);\n \n tx = tx + ty * ((ty - tx) / ty + 1);\n \n }\n else {\n \n ans = -1;\n \n break;\n \n }\n \n }\n else {\n \n if (tx != 0){\n \n ans += ((tx - ty) / tx + 1);\n \n ty = ty + tx * ((tx - ty) / tx + 1);\n \n }\n else {\n \n ans = -1;\n \n break;\n \n }\n \n }\n \n if (m - tx >= m - tempX && m - ty >= m - tempY){\n \n ans = -1;\n \n break;\n \n }\n \n }\n \n Console.WriteLine(ans);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n public static Int64 caculate(Int64 big , Int64 small, Int64 target)\n {\n Int64 start=0, step1=0, next=0;\n if (small < 0)\n {\n step1 = small / (big * -1);\n if (big * step1 + small < 0)\n {\n step1++;\n }\n\n start = small + big * step1 > big ? small + big*step1 : big;\n next = small + big * step1 + big;\n }\n else\n {\n start = big;\n next = small + big;\n }\n while (start < target)\n {\n step1++;\n Int64 tmp = start;\n start = next;\n next = tmp + next;\n }\n\n return step1;\n }\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n\n string[] array = input.Split(' ');\n Int64 x = Int64.Parse(array[0]);\n Int64 y = Int64.Parse(array[1]);\n Int64 m = Int64.Parse(array[2]);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Int64 bigger = x > y ? x : y;\n Int64 smaller = x > y ? y : x;\n Int64 sub = bigger - smaller;\n\n if (bigger <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(caculate(bigger, smaller, m));\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codegh\n{\n class Program\n {\n static void Main(string[] args)\n {\n List mas = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();\n long k = 0;\n if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0]<=0&&mas[1]<=0)\n {\n Console.WriteLine(-1);\n return;\n }\n if (mas[0] > mas[1])\n {\n long c = mas[0];\n mas[0] = mas[1];\n mas[1] = c;\n }\n if (mas[1] >= mas[2])\n {\n Console.WriteLine(0);\n return;\n }\n if (mas[0]<0)\n {\n \n if (mas[0] % mas[1] == 0)\n {\n k += Math.Abs((mas[0] / mas[1]));\n }else\n {\n k +=Math.Abs( (mas[0] / mas[1]))+1;\n }\n mas[0] += mas[1] * k;\n }\n if (mas[0] + mas[1] > mas[2])\n {\n k -= (Math.Abs(mas[2] - mas[1] - mas[0]) / mas[1]);\n }\n while(Math.Max(mas[0], mas[1]) < mas[2])\n {\n \n long s = mas[0] + mas[1];\n mas[0] = mas[1];\n mas[1] = s;\n k++;\n }\n Console.WriteLine(k);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c318_188_2\n{\n public class Program3\n {\n public static long[] ReadLongs(int n)\n {\n var s = Console.ReadLine() + \" \";\n var result = new long[n];\n var i = 0;\n var acc = 0L;\n var i2 = 0;\n while (i < n)\n {\n if (s[i2] == ' ')\n {\n result[i++] = acc;\n i2++;\n acc = 0;\n }\n else\n acc = acc*10 + (s[i2++] - '0');\n }\n return result;\n }\n\n public static void ReadLongs(out long l1, out long l2)\n {\n var ls = ReadLongs(2);\n l1 = ls[0];\n l2 = ls[1];\n }\n\n public static void ReadLongs(out long l1, out long l2, out long l3)\n {\n var ls = ReadLongs(3);\n l1 = ls[0];\n l2 = ls[1];\n l3 = ls[2];\n }\n\n public static void ReadLongs(out long l1, out long l2, out long l3, out long l4)\n {\n var ls = ReadLongs(4);\n l1 = ls[0];\n l2 = ls[1];\n l3 = ls[2];\n l4 = ls[3];\n }\n\n public static void Main()\n {\n checked\n {\n var s1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var x= s1[0];\n var y= s1[1];\n var m= s1[2];\n\n if (x >= m || y >= m)\n {\n Console.Write(0);\n return;\n }\n\n if (x <= 0 && y <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (y > x)\n {\n var tmp = y;\n y = x;\n x = tmp;\n }\n\n var steps = 0L;\n if (y < 0)\n {\n steps = (-y + 1 + x - 1)/x;\n y += x*steps;\n }\n\n if (y > x)\n {\n var tmp = y;\n y = x;\n x = tmp;\n }\n\n do\n {\n var s = x + y;\n y = x;\n x = s;\n steps++;\n } while (x < m);\n Console.Write(steps);\n }\n }\n\n public static void Generated(StringBuilder sb)\n {\n var x = 1L;\n var y = -1000000000000000000;\n var m = 1000000000000000000;\n sb.AppendFormat(\"{0} {1} {2}\", x, y, m);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n long l = Convert.ToInt64(inp[0]);\n long r = Convert.ToInt64(inp[1]);\n long m = Convert.ToInt64(inp[2]);\n long delta, deltal;\n delta = m - (l + r);\n deltal = delta;\n\n long steps = 0;\n if (l < 0 && r > 0 && l < m && r < m)\n {\n steps = Math.Abs(l / r);\n l += r * steps;\n }\n if (l > 0 && r < 0 && l < m && r < m)\n {\n steps = Math.Abs(r / l);\n r += l * steps;\n }\n while (true)\n {\n if (l >= m || r >= m)\n {\n Console.WriteLine(steps);\n return;\n }\n \n if (l > r)\n {\n r += l;\n }\n else\n {\n l += r;\n }\n delta = m - (l + r);\n if (delta - deltal >= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n deltal = delta;\n steps++;\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace prC {\n class Program {\n static void Main(string[] args) {\n#if ONLINE_JUDGE\n#else\n\n StreamWriter sw = new StreamWriter(\"output\");\n Console.SetOut(sw);\n Console.SetIn(new StreamReader(\"input\"));\n#endif\n\n string[] ss = Console.ReadLine().Split(' ');\n long x = long.Parse(ss[0]);\n long y = long.Parse(ss[1]);\n long m = long.Parse(ss[2]);\n long ans = 0;\n while (x < m && y < m) {\n long sum = x + y;\n if (sum <= Math.Min(x, y)) {\n ans = -1;\n break;\n }\n if (x < y) {\n long a = x;\n x = y;\n y = a;\n }\n if (sum < Math.Max(x, y)) {\n long a1 = (long)Math.Ceiling(-y / (double)x);\n long a2 = (long)Math.Ceiling((m - y) / (double)x);\n if (a1 < a2 && a1 > 0) {\n ans += a1;\n y += a1 * x;\n } else if (a2 < a1 && a2 > 0) {\n ans += a2;\n y += a2 * x;\n }\n } else {\n if (x < y) x = sum;\n else y = sum;\n ans++;\n }\n }\n\n Console.WriteLine(ans);\n#if ONLINE_JUDGE\n#else\n sw.Close();\n#endif\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n\n }\n\n static void B()\n {\n string row = ReadLine();\n long ans = 0;\n long[] heavy = new long[row.Length];\n long[] metal = new long[row.Length];\n string h = \"heavy\";\n string m = \"metal\";\n for (int i = 0; i < row.Length - 4; i++)\n {\n heavy[i + 4] = heavy[i + 3];\n bool isHeavy = true;\n for (int j = i, z = 0; z < 5; j++, z++)\n {\n if (row[j] != h[z])\n {\n isHeavy = false;\n break;\n }\n }\n if (isHeavy)\n heavy[i + 4]++;\n }\n for (int i = row.Length - 1; i >= 4; i--)\n {\n metal[i - 4] = metal[i - 3];\n bool isMetal = true;\n for (int j = i - 4, z = 0; z < 5; j++, z++)\n {\n if (row[j] != m[z])\n {\n isMetal = false;\n break;\n }\n }\n if (isMetal)\n metal[i - 4]++;\n }\n for (int i = 4; i < row.Length - 4; i++)\n {\n ans += (heavy[i] - heavy[i - 1]) * metal[i + 1];\n }\n Console.WriteLine(ans);\n }\n\n static void C()\n {\n long x, y, m;\n string[] tokens = ReadArray(' ');\n x = long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n long ans = 0;\n if (Math.Max(x, y) >= m)\n {\n Console.WriteLine(0);\n return;\n }\n if (x <= 0 && y <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n if (x < 0 || y < 0)\n {\n if (x < y)\n {\n ans += -x / y;\n x += (-x / y) * y;\n }\n else\n {\n ans += -y / x;\n y += (-y / x) * x;\n }\n }\n while (Math.Max(x, y) < m)\n {\n if (x <= y)\n {\n x += y;\n }\n else\n {\n y += x;\n }\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class MonstersValley2\n{\n \n public static void Main()\n {\n string str = Console.ReadLine();\n string[] values = str.Split(' ');\n long x = long.Parse(values[0]);\n long y = long.Parse(values[1]);\n long m = long.Parse(values[2]);\n\n long ans = 0,a,b;\n if (Math.Max(x, y) >= m)\n { Console.WriteLine(0); }\n\n else if ((x + y) <= Math.Min(x, y))\n { Console.WriteLine(-1); }\n else\n {\n if (Math.Min(x, y) < 0)\n {\n ans = ans + (long)Math.Floor(-Math.Min(x, y) / (double)Math.Max(x, y));\n b = Math.Max(x, y);\n a = Math.Min(x, y) + ans *b;\n y = b;\n x = a;\n }\n while ((Math.Max(x, y) < m))\n {\n a = x;\n b = y;\n b = x >= y ? x + y : y;\n a = x >= y ? x : x + y;\n ans++;\n x = a;\n y = b;\n }\n Console.WriteLine(ans);\n }\n\n Console.ReadLine();\n\n }\n}"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n long temp=Math.Abs(a);\n if (a<0L)\n {\n counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));\n a += b * counter;\n }\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tclass C\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t string[] token = Console.ReadLine().Split();\n\t\t \n\t\t long x = long.Parse(token[0]);\n\t\t long y = long.Parse(token[1]);\n\t\t long m = long.Parse(token[2]);\n\t\t \n\t\t if(x>=m||y>=m)\n\t\t {\n\t\t Console.WriteLine(0);\n\t\t return;\n\t\t }\n\t\t if(x<=0&&y<=0)\n\t\t {\n\t\t Console.WriteLine(-1);\n\t\t return;\n\t\t }\n\t\t \n\t\t long count = 0;\n\t\t if(x < 0)\n\t\t {\n\t\t count = (Math.Abs(x)/y) + 1;\n\t\t x = y - (Math.Abs(x)%y);\n\t\t }else if(y < 0){\n\t\t count = (Math.Abs(y)/x) + 1;\n\t\t y = x - (Math.Abs(y)%x);\n\t\t }\n\t\t \n\t\t while(x= m || y >= m)\n {\n Console.WriteLine(\"0\"); \n }\n else\n {\n if (m <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else if ((x == 0 && y <= 0) || (y == 0 && x <= 0) || (x <= 0 && y <= 0))\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n var c = new BigInteger(0);\n if (x < 0)\n {\n c += (-x) / y;\n x += (y) * c;\n }\n if (y < 0)\n {\n c += (-y) / x;\n y += (x) * c;\n }\n while (x < m && y < m)\n {\n c++;\n if (x >= y)\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PerfectPair\n{\n partial class PerfectPair\n {\n static void Main(string[] args)\n {\n long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0, diffVal, increment;\n\n x = NextLong();\n y = NextLong();\n m = NextLong();\n\n diffX = m - x;\n diffY = m - y;\n\n min = Math.Min(x, y);\n max = Math.Max(x, y);\n\n if (max >= m)\n Console.WriteLine(0);\n else if ((min >= 0 && m < 0) || (max <= 0 && m > 0) || (max <= 0 && m > max))\n Console.WriteLine(-1);\n else\n {\n while (true)\n {\n diff = m - min;\n\n if (max < diff)\n {\n diffVal = max - min + 1;\n\n increment = (diffVal / max);\n increment += diffVal % max == 0 ? 0 : 1;\n\n count += increment;\n\n temp = max;\n max = min + increment * max;\n min = temp;\n\n min = Math.Min(min, max);\n max = Math.Max(temp, max);\n }\n else\n {\n if (m - max > 0)\n count++;\n\n Console.WriteLine(count);\n break;\n }\n }\n }\n }\n }\n\n partial class PerfectPair\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nclass Demo\n{\n static void Main()\n {\n long ans = 0;\n var str = Console.ReadLine().Split();\n long x = long.Parse(str[0]), tx;\n long y = long.Parse(str[1]);\n long m = long.Parse(str[2]);\n if (x >= m | y >= m) ans = 0;\n else if (x <= 0 & y <= 0) ans = -1;\n else\n {\n if (y < x) { tx = x; x = y; y = tx; }\n if (x < 0)\n {\n ans += Math.Abs(x) / y;\n ans++;\n x = y * ans + x;\n }\n while (x < m & y < m)\n {\n if (x < y) x = x + y;\n else y = x + y;\n ans++;\n }\n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c318_188_2\n{\n public class Program3\n {\n public static long[] ReadLongs(int n)\n {\n var s = Console.ReadLine() + \" \";\n var result = new long[n];\n var i = 0;\n var acc = 0L;\n var i2 = 0;\n while (i < n)\n {\n if (s[i2] == ' ')\n {\n result[i++] = acc;\n i2++;\n acc = 0;\n }\n else\n acc = acc*10 + (s[i2++] - '0');\n }\n return result;\n }\n\n public static void ReadLongs(out long l1, out long l2)\n {\n var ls = ReadLongs(2);\n l1 = ls[0];\n l2 = ls[1];\n }\n\n public static void ReadLongs(out long l1, out long l2, out long l3)\n {\n var ls = ReadLongs(3);\n l1 = ls[0];\n l2 = ls[1];\n l3 = ls[2];\n }\n\n public static void ReadLongs(out long l1, out long l2, out long l3, out long l4)\n {\n var ls = ReadLongs(4);\n l1 = ls[0];\n l2 = ls[1];\n l3 = ls[2];\n l4 = ls[3];\n }\n\n public static void Main()\n {\n checked\n {\n var s1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n var x= s1[0];\n var y= s1[1];\n var m= s1[2];\n\n if (x >= m || y >= m)\n {\n Console.Write(0);\n return;\n }\n\n if (x <= 0 && y <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n if (y > x)\n {\n var tmp = y;\n y = x;\n x = tmp;\n }\n\n var steps = 0L;\n if (y < 0)\n {\n steps = (-y + 1 + x - 1)/x;\n y += x*steps;\n }\n\n if (y > x)\n {\n var tmp = y;\n y = x;\n x = tmp;\n }\n\n do\n {\n var s = x + y;\n y = x;\n x = s;\n steps++;\n } while (x < m);\n Console.Write(steps);\n }\n }\n\n public static void Generated(StringBuilder sb)\n {\n var x = 1L;\n var y = -1000000000000000000;\n var m = 1000000000000000000;\n sb.AppendFormat(\"{0} {1} {2}\", x, y, m);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n long l = Convert.ToInt64(inp[0]);\n long r = Convert.ToInt64(inp[1]);\n long m = Convert.ToInt64(inp[2]);\n long delta, deltal;\n delta = m - (l + r);\n deltal = delta;\n\n long steps = 0;\n if (l < 0 && r > 0 && l < m && r < m)\n {\n steps = Math.Abs(l / r);\n l += r * steps;\n }\n if (l > 0 && r < 0 && l < m && r < m)\n {\n steps = Math.Abs(r / l);\n r += l * steps;\n }\n while (true)\n {\n if (l >= m || r >= m)\n {\n Console.WriteLine(steps);\n return;\n }\n \n if (l > r)\n {\n r += l;\n }\n else\n {\n l += r;\n }\n delta = m - (l + r);\n if (delta - deltal >= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n deltal = delta;\n steps++;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Perfect_Pair\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long x = Next();\n long y = Next();\n long m = Next();\n\n if (Math.Max(x, y) >= m)\n writer.WriteLine(\"0\");\n else\n {\n if (x + y <= Math.Min(x, y))\n writer.WriteLine(\"-1\");\n else\n {\n long moves = 1;\n if (Math.Max(x, y) > 0 && Math.Min(x, y) < 0)\n {\n moves = -Math.Min(x, y)/Math.Max(x, y);\n\n long d = Math.Max(x, y);\n long c = Math.Min(x, y) + moves*d;\n\n x = c;\n y = d;\n\n moves++;\n }\n for (long i = moves;; i++)\n {\n long c = x + y;\n long d = Math.Max(x, y);\n\n x = c;\n y = d;\n\n if (Math.Max(x, y) >= m)\n {\n writer.WriteLine(i);\n break;\n }\n }\n }\n }\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n int m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n\n if (x >= m || y >= m)\n return 0;\n if (x <= 0 && y <= 0 )\n return -1;\n\n if (x > y)\n {\n //x ^= y;\n //y ^= x;\n //x ^= y;\n\n x = x - y;\n y = x + y;\n x = y - x;\n\n }\n \n if (x < 0 && y > 0)\n {\n i = -x / y;\n x = x + y * i;\n }\n else if (y < 0 && x > 0)\n {\n i = -y / x;\n y = y + x * i;\n }\n\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return i;\n\n \n \n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong a = NextLong(), b = NextLong(), m = NextLong();\n\t\t\tif ( a >= m || b >= m )\n\t\t\t{\n\t\t\t\tOut.WriteLine( 0 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( a <= 0 && b <= 0 )\n\t\t\t{\n\t\t\t\tOut.WriteLine( -1 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( a > b )\n\t\t\t{\n\t\t\t\tlong c = a;\n\t\t\t\ta = b;\n\t\t\t\tb = c;\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tif ( a < 0 )\n\t\t\t{\n\t\t\t\tlong k = ( Math.Abs( a ) + b - 1 ) / b;\n\t\t\t\tres += k;\n\t\t\t\ta += b * k;\n\t\t\t}\n\n\t\t\tif ( a == 0 )\n\t\t\t{\n\t\t\t\t++res;\n\t\t\t\ta += b;\n\t\t\t}\n\n\t\t\tlong add = long.MaxValue;\n\t\t\tfor ( int z = 0; z < 1000; ++z )\n\t\t\t{\n\t\t\t\tlong x = a, y = b, cur = 0;\n\t\t\t\tfor ( int t = 0; t < z; ++t )\n\t\t\t\t{\n\t\t\t\t\tif ( x >= m || y >= m ) break;\n\t\t\t\t\t++cur;\n\t\t\t\t\tif ( x < y ) x += y;\n\t\t\t\t\telse y += x;\n\t\t\t\t}\n\n\t\t\t\tif ( !( x >= m || y >= m ) )\n\t\t\t\t{\n\t\t\t\t\tlong p = Math.Min( ( m - x + y - 1 ) / y, ( m - y + x - 1 ) / x );\n\t\t\t\t\tcur += p;\n\t\t\t\t}\n\n\t\t\t\tadd = Math.Min( add, cur );\n\t\t\t}\n\n\t\t\tOut.WriteLine( res + add );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int[] NextIntArray( int size )\n\t\t{\n\t\t\tvar res = new int[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextInt();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] NextLongArray( int size )\n\t\t{\n\t\t\tvar res = new long[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextLong();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] NextDoubleArray( int size )\n\t\t{\n\t\t\tvar res = new double[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextDouble();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X)*(p.X - X) + (p.Y - Y)*(p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0);\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n } \n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n// ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n// ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n } \n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal class Pair\n {\n public Pair(TFirst first, TSecond second)\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n protected bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First) && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397) ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack where T : class \n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n //OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n long x, y, m;\n Reader.Read(out x, out y, out m);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (x <= 0 && y <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var max = Math.Max(x, y);\n y = x + y - max;\n x = max;\n long ans = 0;\n if (y <= 0)\n {\n ans = (-y) / x + 1;\n y += ans * x;\n }\n\n while (x < m)\n {\n var sum = x + y;\n y = x;\n x = sum;\n ans++;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic sealed class Program {\n\n static Int64 Solve() {\n String[] tok = Console.ReadLine().Split(' ');\n Int64 a = Int64.Parse(tok[0]), b = Int64.Parse(tok[1]), m = Int64.Parse(tok[2]), t;\n if (a >= m || b >= m) {\n return 0;\n }\n if (a <= 0 && b <= 0) {\n return -1;\n }\n if (a < b) {\n Swap(ref a, ref b);\n }\n // a >= b\n Int64 add = 0;\n if (a > 0 && b < 0) {\n add = -b / a;\n b += a * add;\n }\n for (Int32 i = 0; i < 100000; ++i) {\n if (a < b) {\n t = a;\n a = b;\n b = t;\n }\n if (a >= m) {\n return i + add;\n }\n b += a;\n }\n return -1;\n }\n\n public Program() {\n Console.WriteLine(Solve());\n }\n\n // stuff cutline\n\n static void Swap(ref T a, ref T b) {\n T t = a;\n a = b;\n b = t;\n }\n\n static Int32 ReadInt() {\n Boolean neg = false;\n Int32 ch, ans = 0;\n do {\n ch = Console.Read();\n neg |= ch == (Int32)'-';\n } while (!Char.IsDigit((Char)ch));\n do {\n ans = ans * 10 + (ch & 0xf);\n ch = Console.Read();\n } while (Char.IsDigit((Char)ch));\n return neg ? -ans : ans;\n }\n\n public static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"..\\\\..\\\\in.txt\"));\n#endif\n var root = new Program();\n Console.Out.Flush();\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n if (x < 0 && y < 0 && ((x < m) && (y < m)))\n return -1;\n else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))\n return -1;\n else if (x == 0 && y == 0 && y < m)\n return -1;\n if (x >= m || y >= m)\n return 0;\n else\n {\n if (x < 0 && y > 0)\n {\n i = -x / y;\n x = x + y * i;\n }\n else if (y < 0 && x > 0)\n {\n i = -y / x;\n y = y + x * i;\n }\n\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return i;\n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n }\n\n \n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n\n if (x >= m || y >= m)\n return 0;\n if (x <= 0 && y <= 0 )\n return -1;\n\n if (x > y)\n {\n x ^= y;\n y ^= x;\n x ^= y;\n }\n \n if (x < 0 && y > 0)\n { \n \n i = -x / y;\n x = x + y * i;\n } \n\n while (x < m && y < m)\n {\n if (x > y)\n {\n x ^= y;\n y ^= x;\n x ^= y;\n }\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i; \n }\n\n return i;\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n\n if (x >= m || y >= m)\n return 0;\n if (x <= 0 && y <= 0 )\n return -1;\n\n if (x > y)\n {\n x ^= y;\n y ^= x;\n x ^= y;\n\n // x ^= (y ^= (x ^= y));\n }\n \n if (x < 0 && y > 0)\n {\n i = -x / y;\n x = x + y * i;\n }\n else if (y < 0 && x > 0)\n {\n i = -y / x;\n y = y + x * i;\n }\n\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return i;\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Solution {\n\n class Solution {\n\n class StdIn {\n int currPos = 0;\n string[] tokens = new string[0];\n\n private string getNextToken() {\n if (currPos < tokens.Length) return tokens[currPos++];\n currPos = 0;\n tokens = Console.ReadLine().Split(new char[] { ' ', '\\t', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n return tokens[currPos++];\n }\n\n public int nextInt() {\n return int.Parse(getNextToken());\n }\n\n public string nextString() {\n return getNextToken();\n }\n\n public double nextDouble() {\n return double.Parse(getNextToken());\n }\n\n public long nextLong() {\n return long.Parse(getNextToken());\n }\n }\n\n public static void swap(ref T a, ref T b) {\n T c = a;\n a = b;\n b = c;\n }\n\n\n\n public static void Main(string[] args) {\n StdIn std = new StdIn();\n\n long x = std.nextLong();\n long y = std.nextLong();\n long m = std.nextLong();\n\n if (x >= m || y >= m) {\n Console.WriteLine(0);\n return;\n }\n if (x <= 0 && y <= 0) {\n Console.WriteLine(-1);\n return;\n }\n\n long ans = 0;\n if (x < 0) {\n ans += (-x) / y;\n x += ans * y;\n }\n if (y < 0) {\n ans += (-y) / x;\n y += ans * x;\n }\n\n while (x < m && y < m) {\n ++ans;\n if (x < y) x += y;\n else y += x;\n }\n\n Console.WriteLine(ans);\n\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var x = ReadLong(); var y = ReadLong(); var m = ReadLong();\n var ctr = 0L;\n if (x >= m || y >= m) { writer.WriteLine(0); return null; }\n if (Math.Max(x, y) <= 0) { if (Math.Max(x, y) >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }\n if (y < x) { var temp = x; x = y; y = temp; }\n if (x < 0)\n {\n ctr += Math.Abs(x) / y;\n ctr++;\n x = y * ctr + x;\n }\n while (y < m & x < m)\n {\n if (x < y) x += y;\n else y += x;\n ctr++;\n }\n writer.WriteLine(ctr);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\npublic class MonstersValley2\n{\n \n public static void Main()\n {\n string str = Console.ReadLine();\n string[] values = str.Split(' ');\n long x = long.Parse(values[0]);\n long y = long.Parse(values[1]);\n long m = long.Parse(values[2]);\n\n long ans = 0,a,b;\n if (Math.Max(x, y) >= m)\n { Console.WriteLine(0); }\n\n else if ((x + y) <= Math.Min(x, y))\n { Console.WriteLine(-1); }\n else\n {\n while ((Math.Max(x, y) < m))\n {\n a = x;\n b = y;\n b = x >= y ? x + y : y;\n a = x > y ? x : x + y;\n ans++;\n x = a;\n y = b;\n }\n Console.WriteLine(ans);\n }\n\n Console.ReadLine();\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R188_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long y = long.Parse(s[1]);\n long m = long.Parse(s[2]);\n\n long x2 = x;\n long y2 = y;\n long cnt = 0, sum;\n while (x2 < m && y2 < m && (x2+y2 > 0))\n {\n sum = x2 + y2;\n if (x2 < y2) \n x2 = sum;\n else\n y2 = sum;\n cnt++;\n }\n if (x2 < m && y2 < m)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R188_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long y = long.Parse(s[1]);\n long m = long.Parse(s[2]);\n\n long x2 = x;\n long y2 = y;\n long cnt = 0, sum;\n if (x2 + y2 <= 0)\n {\n if (x2 < m && y2 < m)\n Console.WriteLine(-1);\n else\n Console.WriteLine(0);\n }\n else\n {\n while (x2 < m && y2 < m)\n {\n sum = x2 + y2;\n if (x2 < y2)\n x2 = sum;\n else\n y2 = sum;\n cnt++;\n }\n Console.WriteLine(cnt);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R188_Div2_C\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n long x = long.Parse(s[0]);\n long y = long.Parse(s[1]);\n long m = long.Parse(s[2]);\n\n long x2 = x;\n long y2 = y;\n long cnt = 0, sum;\n while (x2 < m && y2 < m && ((x2>=0 || y2>=0) && (x2!=0 && y2!=0)))\n {\n sum = x2 + y2;\n if (x2 < y2) \n x2 = sum;\n else\n y2 = sum;\n cnt++;\n }\n if (x2 < m && y2 < m)\n Console.WriteLine(-1);\n else\n Console.WriteLine(cnt);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n\tclass C\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t string[] token = Console.ReadLine().Split();\n\t\t \n\t\t long x = long.Parse(token[0]);\n\t\t long y = long.Parse(token[1]);\n\t\t long m = long.Parse(token[2]);\n\t\t \n\t\t if(x>=m||y>=m)\n\t\t {\n\t\t Console.WriteLine(0);\n\t\t return;\n\t\t }\n\t\t if(x<=0&&y<=0)\n\t\t {\n\t\t Console.WriteLine(-1);\n\t\t return;\n\t\t }\n\t\t long count = 0;\n\t\t if(x < 0)\n\t\t {\n\t\t count = (Math.Abs(x)/y);\n\t\t if(Math.Abs(x)%y==0){\n\t\t x = 0;\n\t\t }else{\n\t\t x = ((count+1)*x)-y;\n\t\t count--;\n\t\t }\n\t\t }else if(y < 0){\n\t\t if(Math.Abs(y)%x==0){\n\t\t y = 0;\n\t\t }else{\n\t\t y = ((count+1)*y)-x;\n\t\t count--;\n\t\t }\n\t\t }\n\t\t while(x=m||y>=m)\n\t\t {\n\t\t Console.WriteLine(0);\n\t\t return;\n\t\t }\n\t\t if(x<=0&&y<=0)\n\t\t {\n\t\t Console.WriteLine(-1);\n\t\t return;\n\t\t }\n\t\t long count = 0;\n\t\t if(x<0)\n\t\t {\n\t\t count = Math.Abs(x)/y;\n\t\t x = 0;\n\t\t }else if(y<0){\n\t\t count = Math.Abs(y)/x;\n\t\t y = 0;\n\t\t }\n\t\t while(x=m||y>=m)\n\t\t {\n\t\t Console.WriteLine(0);\n\t\t return;\n\t\t }\n\t\t if(x<=0&&y<=0)\n\t\t {\n\t\t Console.WriteLine(-1);\n\t\t return;\n\t\t }\n\t\t long count = 0;\n\t\t if(x < 0)\n\t\t {\n\t\t count = (Math.Abs(x)/y);\n\t\t if(Math.Abs(x)%y==0){\n\t\t x = 0;\n\t\t }else{\n\t\t x = ((count+1)*x)-y;\n\t\t count--;\n\t\t }\n\t\t }else if(y < 0){\n\t\t count = (Math.Abs(y)/x);\n\t\t if(Math.Abs(y)%x==0){\n\t\t y = 0;\n\t\t }else{\n\t\t y = ((count+1)*y)-x;\n\t\t count--;\n\t\t }\n\t\t }\n\t\t while(xb) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n long temp = Math.Abs(a);\n if (temp >= b && b>a)\n {\n counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));\n a += b * counter;\n }\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n long temp = Math.Abs(a);\n if (temp > b)\n counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));\n\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (Math.Abs(a)>b) Console.WriteLine(\"-1\");\n else\n {\n int counter = 0;\n \n if (b < c)\n {\n counter++;\n long temp = (a += b);\n a = b;\n b = temp;\n while (b < c)\n {\n temp = (a += b);\n a = b;\n b = temp;\n counter++;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n long temp = Math.Abs(a);\n if (temp > b)\n {\n counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));\n a += b * counter;\n }\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n counter += ((temp / b)+(temp%b>0L?1L:0L));\n\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (Math.Abs(a)>b && bb) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n temp = b;\n b = a;\n a = b;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nclass Program\n {\n static void Main(string[] args)\n {\n long a, b, c;\n {\n string[] input = Console.ReadLine().Split(new char[] {'\\t', ' ' },StringSplitOptions.RemoveEmptyEntries);\n a = long.Parse(input[0]); b = long.Parse(input[1]);\n if(a>b) { c = a; a = b; b = c; }\n c = long.Parse(input[2]);\n }\n if (bb)\n {\n long temp = Math.Abs(a);\n if (temp >= b)\n {\n counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));\n a += b * counter;\n }\n while (b < c)\n {\n counter++;\n a += b;\n temp = b;\n b = a;\n a = temp;\n }\n }\n Console.WriteLine(counter);\n }\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n double l = Convert.ToDouble(inp[0]);\n double r = Convert.ToDouble(inp[1]);\n double m = Convert.ToDouble(inp[2]);\n double delta, deltal;\n delta = m - (l + r);\n deltal = delta;\n\n int steps = 0;\n while (true)\n {\n if (l >= m || r >= m)\n {\n Console.WriteLine(steps);\n return;\n }\n \n if (l > r)\n {\n r += l;\n }\n else\n {\n l += r;\n }\n delta = m - (l + r);\n if (delta - deltal >= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n deltal = delta;\n steps++;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n double l = Convert.ToDouble(inp[0]);\n double r = Convert.ToDouble(inp[1]);\n double m = Convert.ToDouble(inp[2]);\n double delta, deltal;\n delta = m - l + r;\n deltal = delta;\n\n int steps = 0;\n while (true)\n {\n \n if (l > r)\n {\n r += l;\n }\n else\n {\n l += r;\n }\n delta = m - (l + r);\n if (delta - deltal >= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n deltal = delta;\n steps++;\n if (l >= m || r >= m)\n {\n Console.WriteLine(steps);\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp11\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] inp = Console.ReadLine().Split(' ');\n long l = Convert.ToInt64(inp[0]);\n long r = Convert.ToInt64(inp[1]);\n long m = Convert.ToInt64(inp[2]);\n long delta, deltal;\n delta = m - (l + r);\n deltal = delta;\n\n long steps = 0;\n if (l < 0 && r > 0)\n {\n steps = Math.Abs(l / r);\n l += r * steps;\n }\n while (true)\n {\n if (l >= m || r >= m)\n {\n Console.WriteLine(steps);\n return;\n }\n \n if (l > r)\n {\n r += l;\n }\n else\n {\n l += r;\n }\n delta = m - (l + r);\n if (delta - deltal >= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n deltal = delta;\n steps++;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Temp\n{\n public class PointInt\n {\n public long X;\n\n public long Y;\n\n public PointInt(long x, long y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public PointInt(PointInt head)\n : this(head.X, head.Y)\n {\n }\n\n public static PointInt operator +(PointInt a, PointInt b)\n {\n return new PointInt(a.X + b.X, a.Y + b.Y);\n }\n\n public static PointInt operator -(PointInt a, PointInt b)\n {\n return new PointInt(a.X - b.X, a.Y - b.Y);\n }\n\n public static PointInt operator *(PointInt a, long k)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public static PointInt operator *(long k, PointInt a)\n {\n return new PointInt(k * a.X, k * a.Y);\n }\n\n public bool IsInsideRectangle(long l, long b, long r, long t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n\n public bool Equals(PointInt other)\n {\n if (ReferenceEquals(null, other))\n {\n return false;\n }\n if (ReferenceEquals(this, other))\n {\n return true;\n }\n return other.X == this.X && other.Y == this.Y;\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != typeof(PointInt))\n {\n return false;\n }\n return Equals((PointInt)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();\n }\n }\n }\n\n public class Point2DReal\n {\n public double X;\n\n public double Y;\n\n public Point2DReal(double x, double y)\n {\n this.X = x;\n this.Y = y;\n }\n\n public Point2DReal(Point2DReal head)\n : this(head.X, head.Y)\n {\n }\n\n public static Point2DReal operator +(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X + b.X, a.Y + b.Y);\n }\n\n public static Point2DReal operator -(Point2DReal a, Point2DReal b)\n {\n return new Point2DReal(a.X - b.X, a.Y - b.Y);\n }\n\n public static Point2DReal operator *(Point2DReal a, double k)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public static Point2DReal operator *(double k, Point2DReal a)\n {\n return new Point2DReal(k * a.X, k * a.Y);\n }\n\n public double Dist(Point2DReal p)\n {\n return Math.Sqrt((p.X - X)*(p.X - X) + (p.Y - Y)*(p.Y - Y));\n }\n\n public bool IsInsideRectangle(double l, double b, double r, double t)\n {\n return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);\n }\n }\n\n internal class LineInt\n {\n public LineInt(PointInt a, PointInt b)\n {\n A = a.Y - b.Y;\n B = b.X - a.X;\n C = a.X * b.Y - a.Y * b.X;\n }\n\n public long A, B, C;\n\n public bool ContainsPoint(PointInt p)\n {\n return A * p.X + B * p.Y + C == 0;\n }\n\n public int Sign(PointInt p)\n {\n return Math.Sign(A * p.X + B * p.Y + C);\n }\n }\n\n internal static class Geometry\n {\n public static long VectInt(PointInt a, PointInt b)\n {\n return a.X * b.Y - a.Y * b.X;\n }\n\n public static long VectInt(PointInt a, PointInt b, PointInt c)\n {\n return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);\n }\n }\n\n internal class MatrixInt\n {\n private readonly long[,] m_Matrix;\n\n public int Size\n {\n get\n {\n return m_Matrix.GetLength(0);\n }\n }\n\n public long Mod { get; private set; }\n\n public MatrixInt(int size, long mod = 0)\n {\n m_Matrix = new long[size,size];\n Mod = mod;\n }\n\n public MatrixInt(long[,] matrix, long mod = 0)\n {\n var size = matrix.GetLength(0);\n m_Matrix = new long[size,size];\n Array.Copy(matrix, m_Matrix, size * size);\n Mod = mod;\n\n if (mod != 0)\n {\n for (int i = 0; i < size; i++)\n {\n for (int j = 0; j < size; j++)\n {\n m_Matrix[i, j] %= mod;\n }\n }\n }\n }\n\n public static MatrixInt IdentityMatrix(int size, long mod = 0)\n {\n long[,] matrix = new long[size,size];\n\n for (int i = 0; i < size; i++)\n {\n matrix[i, i] = 1;\n }\n\n return new MatrixInt(matrix, mod);\n }\n\n public long this[int i, int j]\n {\n get\n {\n return m_Matrix[i, j];\n }\n\n set\n {\n m_Matrix[i, j] = value;\n }\n }\n\n public static MatrixInt operator +(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n long[,] c = new long[n,n];\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] = a[i, j] + b[i, j];\n }\n }\n\n if (mod > 0)\n {\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n c[i, j] %= mod;\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public static MatrixInt operator *(MatrixInt a, MatrixInt b)\n {\n int n = a.Size;\n long mod = Math.Max(a.Mod, b.Mod);\n\n long[,] c = new long[n,n];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n for (int k = 0; k < n; k++)\n {\n c[i, j] += a[i, k] * b[k, j];\n if (mod > 0)\n {\n c[i, j] %= mod;\n }\n }\n }\n }\n\n return new MatrixInt(c, mod);\n }\n\n public void Print()\n {\n for (int i = 0; i < Size; i++)\n {\n for (int j = 0; j < Size; j++)\n {\n Console.Write(\"{0} \", m_Matrix[i, j]);\n }\n Console.WriteLine();\n }\n }\n }\n\n public static class Permutations\n {\n private static readonly Random m_Random;\n\n static Permutations()\n {\n m_Random = new Random();\n }\n\n public static int[] GetRandomPermutation(int n)\n {\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = i;\n }\n\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n int tmp = p[i];\n p[i] = p[j];\n p[j] = tmp;\n }\n\n return p;\n }\n\n /*public static T[] Shuffle(this T[] array)\n {\n int length = array.Length;\n int[] p = GetRandomPermutation(length);\n T[] result = new T[length];\n for (int i = 0; i < length; i++)\n {\n result[i] = array[p[i]];\n }\n\n return result;\n }*/\n\n /*public static T[] ShuffleSort(this T[] array)\n {\n var result = array.Shuffle();\n Array.Sort(result);\n return result;\n }*/\n\n public static void Shuffle(T[] array)\n {\n var n = array.Count();\n for (int i = n - 1; i > 0; i--)\n {\n int j = m_Random.Next(i + 1);\n T tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n } \n }\n\n public static void ShuffleSort(T[] array)\n {\n Shuffle(array);\n Array.Sort(array);\n }\n }\n\n internal static class Algebra\n {\n public static long Phi(long n)\n {\n long result = n;\n for (long i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n while (n % i == 0)\n {\n n /= i;\n }\n\n result -= result / i;\n }\n }\n\n if (n > 1)\n {\n result -= result / n;\n }\n\n return result;\n }\n\n public static long BinPower(long a, long n, long mod)\n {\n long result = 1;\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result = (result * a) % mod;\n }\n\n a = (a * a) % mod;\n n >>= 1;\n }\n\n return result;\n }\n\n public static MatrixInt MatrixBinPower(MatrixInt a, long n)\n {\n MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);\n\n while (n > 0)\n {\n if ((n & 1) != 0)\n {\n result *= a;\n }\n\n a *= a;\n n >>= 1;\n }\n\n return result;\n }\n\n public static long Gcd(long a, long b)\n {\n return b == 0 ? a : Gcd(b, a % b);\n }\n\n public static long ExtendedGcd(long a, long b, out long x, out long y)\n {\n if (b == 0)\n {\n x = 1;\n y = 0;\n return a;\n }\n\n long x1;\n long y1;\n long d = ExtendedGcd(b, a % b, out x1, out y1);\n x = y1;\n y = x1 - (a / b) * y1;\n return d;\n }\n\n public static long Lcm(long a, long b)\n {\n return (a / Gcd(a, b)) * b;\n }\n\n public static bool[] GetPrimes(int n)\n {\n n = Math.Max(n, 2);\n bool[] prime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n prime[i] = true;\n }\n\n for (int i = 2; i * i <= n; i++)\n {\n if (prime[i])\n {\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n prime[j] = false;\n }\n }\n }\n }\n\n return prime;\n }\n\n public static long GetFibonacciNumber(long n, long mod = 0)\n {\n long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };\n\n MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);\n\n return result[1, 1];\n }\n\n public static long[] GetFibonacciSequence(int n)\n {\n long[] result = new long[n];\n result[0] = result[1] = 1;\n\n for (int i = 2; i < n; i++)\n {\n result[i] = result[i - 1] + result[i - 2];\n }\n\n return result;\n }\n\n public static long GetInverseElement(long a, long mod)\n {\n long x, y;\n long g = ExtendedGcd(a, mod, out x, out y);\n\n if (g != 1)\n {\n return -1;\n }\n\n return ((x % mod) + mod) % mod;\n }\n\n public static long[] GetAllInverseElements(long n, long mod)\n {\n long[] result = new long[n];\n result[1] = 1;\n for (int i = 2; i < n; i++)\n {\n result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;\n }\n\n return result;\n }\n\n public static int GetMinimalPrimeDivisor(int n)\n {\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0)\n {\n return i;\n }\n }\n\n return n;\n }\n\n public static long Sqr(long x)\n {\n return x * x;\n }\n\n public static int SumOfDigits(long x, long baseMod = 10)\n {\n int res = 0;\n while (x > 0)\n {\n res += (int)(x % baseMod);\n x = x / baseMod;\n }\n return res;\n }\n }\n\n internal static class Reader\n {\n public static void Read(out T v1)\n {\n var values = new T[1];\n Read(values);\n v1 = values[0];\n }\n\n public static void Read(out T v1, out T v2)\n {\n var values = new T[2];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n }\n\n public static void Read(out T v1, out T v2, out T v3)\n {\n var values = new T[3];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4)\n {\n var values = new T[4];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n }\n\n public static void Read(out T v1, out T v2, out T v3, out T v4, out T v5)\n {\n var values = new T[5];\n Read(values);\n v1 = values[0];\n v2 = values[1];\n v3 = values[2];\n v4 = values[3];\n v5 = values[4];\n }\n\n public static void Read(T[] values)\n {\n Read(values, values.Length);\n }\n\n public static void Read(T[] values, int count)\n {\n// ReSharper disable PossibleNullReferenceException\n var list = Console.ReadLine().Split();\n// ReSharper restore PossibleNullReferenceException\n\n count = Math.Min(count, list.Length);\n\n var converter = TypeDescriptor.GetConverter(typeof(T));\n\n for (int i = 0; i < count; i++)\n {\n values[i] = (T)converter.ConvertFromString(list[i]);\n } \n }\n\n public static int[] ReadDigits()\n {\n // ReSharper disable AssignNullToNotNullAttribute\n return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();\n // ReSharper restore AssignNullToNotNullAttribute\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public interface IGraph\n {\n bool IsOriented { get; set; }\n\n int Vertices { get; set; }\n\n IList this[int i] { get; }\n\n void AddEdge(int u, int v);\n\n void AddOrientedEdge(int u, int v);\n\n void AddNotOrientedEdge(int u, int v);\n }\n\n public class ListGraph : IGraph\n {\n private readonly List[] m_Edges;\n\n public int Vertices { get; set; }\n\n public bool IsOriented { get; set; }\n\n public IList this[int i]\n {\n get\n {\n return this.m_Edges[i];\n }\n }\n\n public ListGraph(int vertices, bool isOriented = false)\n {\n this.Vertices = vertices;\n this.IsOriented = isOriented;\n\n this.m_Edges = new List[vertices];\n\n for (int i = 0; i < vertices; i++)\n {\n this.m_Edges[i] = new List();\n }\n }\n\n public void AddEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n if (!IsOriented)\n {\n this.AddOrientedEdge(v, u);\n }\n }\n\n public void AddNotOrientedEdge(int u, int v)\n {\n this.AddOrientedEdge(u, v);\n this.AddOrientedEdge(v, u);\n }\n\n public void AddOrientedEdge(int first, int second)\n {\n this.m_Edges[first].Add(second);\n }\n\n public int[] Bfs(int start)\n {\n int[] d = new int[Vertices];\n for (int i = 0; i < Vertices; i++)\n {\n d[i] = -1;\n }\n\n Queue queue = new Queue();\n queue.Enqueue(start);\n d[start] = 0;\n\n while (queue.Count > 0)\n {\n int v = queue.Dequeue();\n foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))\n {\n queue.Enqueue(t);\n d[t] = d[v] + 1;\n }\n }\n\n return d;\n }\n }\n\n internal class SimpleSumTable\n {\n private readonly int[,] m_Sum;\n\n public SimpleSumTable(int n, int m, int[,] table)\n {\n m_Sum = new int[n + 1,m + 1];\n\n for (int i = 1; i < n + 1; i++)\n {\n for (int j = 1; j < m + 1; j++)\n {\n m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];\n }\n }\n }\n\n public int GetSum(int l, int b, int r, int t)\n {\n return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];\n }\n }\n\n internal class SegmentTreeSimpleInt\n {\n public int Size { get; private set; }\n\n private readonly T[] m_Tree;\n\n private readonly Func m_Operation;\n\n private readonly T m_Null;\n\n public SegmentTreeSimpleInt(int size, Func operation, T nullElement, IList array = null)\n {\n this.Size = size;\n this.m_Operation = operation;\n this.m_Null = nullElement;\n\n m_Tree = new T[4 * size];\n if (array != null)\n {\n this.Build(array, 1, 0, size - 1);\n }\n }\n\n private void Build(IList array, int v, int tl, int tr)\n {\n if (tl == tr)\n {\n m_Tree[v] = array[tl];\n }\n else\n {\n int tm = (tl + tr) / 2;\n this.Build(array, 2 * v, tl, tm);\n this.Build(array, 2 * v + 1, tm + 1, tr);\n this.CalculateNode(v);\n }\n }\n\n public T GetSum(int l, int r)\n {\n return GetSum(1, 0, Size - 1, l, r);\n }\n\n private T GetSum(int v, int tl, int tr, int l, int r)\n {\n if (l > r)\n {\n return m_Null;\n }\n\n if (l == tl && r == tr)\n {\n return m_Tree[v];\n }\n\n int tm = (tl + tr) / 2;\n\n return this.m_Operation(\n GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));\n }\n\n public void Update(int pos, T newValue)\n {\n Update(1, 0, Size - 1, pos, newValue);\n }\n\n private void Update(int v, int tl, int tr, int pos, T newValue)\n {\n if (tl == tr)\n {\n m_Tree[v] = newValue;\n }\n else\n {\n int tm = (tl + tr) / 2;\n if (pos <= tm)\n {\n Update(2 * v, tl, tm, pos, newValue);\n }\n else\n {\n Update(2 * v + 1, tm + 1, tr, pos, newValue);\n }\n this.CalculateNode(v);\n }\n }\n\n private void CalculateNode(int v)\n {\n m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);\n }\n }\n\n internal class Pair\n {\n public Pair(TFirst first, TSecond second)\n {\n this.First = first;\n this.Second = second;\n }\n\n public TFirst First { set; get; }\n\n public TSecond Second { set; get; }\n\n protected bool Equals(Pair other)\n {\n return EqualityComparer.Default.Equals(this.First, other.First) && EqualityComparer.Default.Equals(this.Second, other.Second);\n }\n\n public override bool Equals(object obj)\n {\n if (ReferenceEquals(null, obj))\n {\n return false;\n }\n if (ReferenceEquals(this, obj))\n {\n return true;\n }\n if (obj.GetType() != this.GetType())\n {\n return false;\n }\n return Equals((Pair)obj);\n }\n\n public override int GetHashCode()\n {\n unchecked\n {\n return (EqualityComparer.Default.GetHashCode(this.First) * 397) ^ EqualityComparer.Default.GetHashCode(this.Second);\n }\n }\n }\n\n internal class FenwickTreeInt64\n {\n public FenwickTreeInt64(int size)\n {\n this.m_Size = size;\n m_Tree = new long[size];\n }\n\n public FenwickTreeInt64(int size, IList tree)\n : this(size)\n {\n for (int i = 0; i < size; i++)\n {\n Inc(i, tree[i]);\n }\n }\n\n public long Sum(int r)\n {\n long res = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n {\n res += m_Tree[r];\n }\n return res;\n }\n\n public long Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public void Inc(int i, long x)\n {\n for (; i < m_Size; i = i | (i + 1))\n {\n m_Tree[i] += x;\n }\n }\n\n public void Set(int i, long x)\n {\n Inc(i, x - Sum(i, i));\n }\n\n private readonly int m_Size;\n\n private readonly long[] m_Tree;\n }\n\n internal class AccumulativeDictionary : Dictionary\n {\n public new void Add(TKey key, int value = 1)\n {\n if (this.ContainsKey(key))\n {\n base[key] += value;\n }\n else\n {\n base.Add(key, value);\n }\n }\n\n public new int this[TKey key]\n {\n get\n {\n return this.ContainsKey(key) ? base[key] : 0;\n }\n set\n {\n this.Add(key, value);\n }\n }\n }\n\n public class PriorityQueue\n {\n public PriorityQueue(Comparison comparison = null)\n {\n if (comparison == null)\n {\n if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable)))\n {\n m_Comparison = (a, b) => ((IComparable)a).CompareTo(b);\n }\n else\n {\n throw new ApplicationException(\"Add comparer\");\n }\n }\n else\n {\n m_Comparison = comparison;\n }\n }\n\n public int Count { get; private set; }\n\n public void Enqueue(T item)\n {\n m_List.Add(item);\n m_Indexes.Add(item, this.Count);\n this.Count++;\n Up(this.Count);\n }\n\n public T Peek()\n {\n return m_List[0];\n }\n\n public T Dequeue()\n {\n if (this.Count > 0)\n {\n var result = m_List[0];\n\n Swap(0, this.Count - 1);\n m_Indexes.Remove(m_List[this.Count - 1]);\n m_List.RemoveAt(this.Count - 1);\n this.Count--;\n this.Down(1);\n\n return result;\n }\n throw new ApplicationException(\"Couldn't get element from empty queue\");\n }\n\n public void Update(T item)\n {\n int index = m_Indexes[item];\n this.Up(index + 1);\n }\n\n private readonly List m_List = new List();\n\n private readonly Dictionary m_Indexes = new Dictionary();\n\n private readonly Comparison m_Comparison;\n\n private void Up(int index)\n {\n while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)\n {\n this.Swap(index - 1, index / 2 - 1);\n\n index = index / 2;\n }\n }\n\n private void Down(int index)\n {\n while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0\n || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)\n {\n if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)\n {\n this.Swap(index - 1, 2 * index - 1);\n index = 2 * index;\n }\n else\n {\n this.Swap(index - 1, 2 * index);\n index = 2 * index + 1;\n }\n }\n }\n\n private void Swap(int i, int j)\n {\n var tmp = m_List[i];\n m_List[i] = m_List[j];\n m_List[j] = tmp;\n\n m_Indexes[m_List[i]] = i;\n m_Indexes[m_List[j]] = j;\n }\n }\n\n public class DisjointSetUnion\n {\n public DisjointSetUnion()\n {\n m_Parent = new Dictionary();\n m_Rank = new Dictionary();\n }\n\n public DisjointSetUnion(DisjointSetUnion set)\n {\n m_Parent = new Dictionary(set.m_Parent);\n m_Rank = new Dictionary(set.m_Rank);\n }\n\n private readonly Dictionary m_Parent;\n private readonly Dictionary m_Rank;\n\n public int GetRank(T x)\n {\n return m_Rank[x];\n }\n\n public void MakeSet(T x)\n {\n m_Parent[x] = x;\n this.m_Rank[x] = 0;\n }\n\n public void UnionSets(T x, T y)\n {\n x = this.FindSet(x);\n y = this.FindSet(y);\n if (!x.Equals(y))\n {\n if (m_Rank[x] < m_Rank[y])\n {\n T t = x;\n x = y;\n y = t;\n }\n m_Parent[y] = x;\n if (m_Rank[x] == m_Rank[y])\n {\n m_Rank[x]++;\n }\n }\n }\n\n public T FindSet(T x)\n {\n if (x.Equals(m_Parent[x]))\n {\n return x;\n }\n return m_Parent[x] = this.FindSet(m_Parent[x]);\n }\n }\n\n internal class HamiltonianPathFinder\n {\n public static void Run()\n {\n int n, m;\n Reader.Read(out n, out m);\n List[] a = new List[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = new List();\n }\n for (int i = 0; i < m; i++)\n {\n int x, y;\n Reader.Read(out x, out y);\n a[x].Add(y);\n a[y].Add(x);\n }\n\n var rnd = new Random();\n\n bool[] v = new bool[n];\n int[] p = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = -1;\n }\n int first = rnd.Next(n);\n int cur = first;\n v[cur] = true;\n\n int count = 1;\n\n while (true)\n {\n var unb = a[cur].Where(u => !v[u]).ToList();\n int d = unb.Count;\n if (d > 0)\n {\n int next = unb[rnd.Next(d)];\n v[next] = true;\n p[cur] = next;\n cur = next;\n count++;\n }\n else\n {\n if (count == n && a[cur].Contains(first))\n {\n p[cur] = first;\n break;\n }\n\n d = a[cur].Count;\n int pivot;\n do\n {\n pivot = a[cur][rnd.Next(d)];\n }\n while (p[pivot] == cur);\n\n int next = p[pivot];\n\n int x = next;\n int y = -1;\n while (true)\n {\n int tmp = p[x];\n p[x] = y;\n y = x;\n x = tmp;\n if (y == cur)\n {\n break;\n }\n }\n p[pivot] = cur;\n cur = next;\n }\n }\n\n cur = first;\n do\n {\n Console.Write(\"{0} \", cur);\n cur = p[cur];\n }\n while (cur != first);\n }\n\n public static void WriteTest(int n)\n {\n Console.WriteLine(\"{0} {1}\", 2 * n, 2 * (n - 1) + n);\n for (int i = 0; i < n - 1; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 2);\n Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 3);\n //Console.WriteLine(\"{0} {1}\", 2 * i + 1, 2 * i + 2);\n //Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 3);\n }\n for (int i = 0; i < n; i++)\n {\n Console.WriteLine(\"{0} {1}\", 2 * i, 2 * i + 1);\n }\n }\n }\n\n internal class Backtrack where T : class \n {\n public Backtrack(Func> generator)\n {\n this.m_Generator = generator;\n }\n\n public Dictionary Generate(T startState)\n {\n var result = new Dictionary();\n result.Add(startState, null);\n\n var queue = new Queue();\n queue.Enqueue(startState);\n\n while (queue.Count > 0)\n {\n var current = queue.Dequeue();\n var next = m_Generator(current);\n foreach (var state in next)\n {\n if (!result.ContainsKey(state))\n {\n result[state] = current;\n queue.Enqueue(state);\n }\n }\n }\n\n return result;\n }\n\n private Func> m_Generator;\n }\n\n public static class Utility\n {\n public static readonly int[] sx = new[] { 1, 0, -1, 0 };\n public static readonly int[] sy = new[] { 0, 1, 0, -1 };\n\n public static PointInt[] GenerateNeighbors(long x, long y)\n {\n var result = new PointInt[4];\n for (int i = 0; i < 4; i++)\n {\n result[i] = new PointInt(x + sx[i], y + sy[i]);\n }\n return result;\n }\n\n public static PointInt[] GenerateNeighbors(this PointInt p)\n {\n return GenerateNeighbors(p.X, p.Y);\n }\n\n public static List GenerateNeighborsWithBounds(long x, long y, int n, int m)\n {\n var result = new List(4);\n for (int i = 0; i < 4; i++)\n {\n var nx = x + sx[i];\n var ny = y + sy[i];\n if (0 <= nx && nx < n && 0 <= ny && ny < m)\n {\n result.Add(new PointInt(nx, ny));\n }\n }\n return result;\n }\n\n public static List GenerateNeighborsWithBounds(this PointInt p, int n, int m)\n {\n return GenerateNeighborsWithBounds(p.X, p.Y, n, m);\n }\n }\n\n internal class Program\n {\n private static StreamReader m_InputStream;\n\n private static StreamWriter m_OutStream;\n\n private static void OpenFiles()\n {\n m_InputStream = new StreamReader(\"input.txt\"); //File.OpenText(\"input.txt\");\n Console.SetIn(m_InputStream);\n\n m_OutStream = new StreamWriter(\"output.txt\"); //File.CreateText(\"output.txt\");\n Console.SetOut(m_OutStream);\n }\n\n private static void CloseFiles()\n {\n m_OutStream.Flush();\n\n m_InputStream.Dispose();\n m_OutStream.Dispose();\n }\n\n private static void Main()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n // OpenFiles();\n\n var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);\n mainThread.Start();\n mainThread.Join();\n\n // CloseFiles();\n }\n }\n\n internal class Solution\n {\n public void Solve()\n {\n long x, y, m;\n Reader.Read(out x, out y, out m);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(0);\n return;\n }\n\n if (x <= 0 && y <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n\n var max = Math.Max(x, y);\n y = x + y - max;\n x = max;\n long ans = 0;\n if (x + y <= 0)\n {\n ans = (-y) / x;\n y += ans * x;\n }\n\n while (x < m)\n {\n var sum = x + y;\n y = x;\n x = sum;\n ans++;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var x = ReadLong(); var y = ReadLong(); var m = ReadLong();\n var b = Math.Min(x, y);\n var a = Math.Max(x, y);\n var ctr = 0;\n if (a <= 0) { if (a >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }\n while (a < m)\n {\n var d = (a-b)/a+1;\n ctr += (int)d;\n a = d * a + b;\n b = a;\n }\n writer.WriteLine(ctr);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var x = ReadLong(); var y = ReadLong(); var m = ReadLong();\n x = Math.Min(x, y);\n y = Math.Max(x, y);\n var ctr = 0;\n if (y <= 0) { if (y >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }\n while (x < m)\n {\n var tmp = x + y;\n y = x;\n x = tmp;\n ctr++;\n }\n writer.WriteLine(ctr-1);\n\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var x = ReadLong(); var y = ReadLong(); var m = ReadLong();\n x = Math.Min(x, y);\n y = Math.Max(x, y);\n var ctr = 0;\n if (y <= 0) { if (y >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }\n while (x < m)\n {\n var tmp = x + y;\n y = x;\n x = tmp;\n ctr++;\n }\n writer.WriteLine(ctr);\n\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static object Solve()\n {\n var x = ReadLong(); var y = ReadLong(); var m = ReadLong();\n var ctr = 0L;\n if (Math.Max(x, y) <= 0) { if (Math.Max(x, y) >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }\n if (y < x) { var temp = x; x = y; y = temp; }\n if (x < 0)\n {\n ctr += Math.Abs(x) / y;\n ctr++;\n x = y * ctr + x;\n }\n while (y < m & x < m)\n {\n if (x < y) x += y;\n else y += x;\n ctr++;\n }\n writer.WriteLine(ctr);\n return null;\n }\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n try\n {\n object result = Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n throw;\n }\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var _ = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var x = _[0];\n var y = _[1];\n var m = _[2];\n var ctr = 0L;\n x = Math.Max(x, y);\n y = Math.Min(x, y);\n if (x <= 0)\n {\n if (x > m)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(-1);\n }\n return;\n }\n while (x < m)\n {\n var tmp = (x - y) / x + 1;\n ctr += tmp;\n x = tmp * x + y;\n y = x;\n }\n Console.WriteLine(ctr);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\nusing System.Numerics;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 8; testN++)\n {\n#endif\n //SetCulture();\n var x1 = NextLong();\n var y1 = NextLong();\n var m1 = NextLong();\n var x = new BigInteger(x1);\n var y = new BigInteger(y1);\n var m = new BigInteger(m1);\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\"); \n }\n else\n {\n if (m <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else if ((x == 0 && y <= 0) || (y == 0 && x <= 0) || (x <= 0 && y <= 0))\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n var c = new BigInteger(0);\n if (x < 0)\n {\n c += (-x) / y;\n x += (-x) * c;\n }\n if (y < 0)\n {\n c += (-y) / x;\n y += (-y) * c;\n }\n while (x < m && y < m)\n {\n c++;\n if (x >= y)\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 5; testN++)\n {\n#endif\n //SetCulture();\n var x = NextLong();\n var y = NextLong();\n var m = NextLong();\n if (m <= 0 && (x != 0 || y != 0))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n if (x == -y || x == 0 || y == 0)\n {\n if (m <= Math.Abs(x) || m <= Math.Abs(y))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n long c = 0;\n while (Math.Abs(x) < m && Math.Abs(y) < m)\n {\n c++;\n if (Math.Abs(x) >= Math.Abs(y))\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c - 1);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 5; testN++)\n {\n#endif\n //SetCulture();\n var x = NextLong();\n var y = NextLong();\n var m = NextLong();\n m = Math.Abs(m);\n //if (m <= 0 && (x != 0 || y != 0))\n //{\n // Console.WriteLine(\"0\");\n //}\n //else\n {\n if (x == -y || x == 0 || y == 0)\n {\n if (m <= Math.Abs(x) || m <= Math.Abs(y))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n long c = 0;\n while (Math.Abs(x) < m && Math.Abs(y) < m)\n {\n c++;\n if (Math.Abs(x) >= Math.Abs(y))\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 5; testN++)\n {\n#endif\n //SetCulture();\n var x = NextLong();\n var y = NextLong();\n var m = NextLong();\n if (m <= 0 && (x != 0 || y != 0))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n if (x == -y || x == 0 || y == 0)\n {\n if (m <= Math.Abs(x) || m <= Math.Abs(y))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n long c = 0;\n while (Math.Abs(x) < m && Math.Abs(y) < m)\n {\n c++;\n if (Math.Abs(x) >= Math.Abs(y))\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace C\n{\n class Program\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 5; testN++)\n {\n#endif\n //SetCulture();\n var x = NextLong();\n var y = NextLong();\n var m = NextLong();\n if (m <= 0)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n if (x == -y || x == 0 || y == 0)\n {\n if (m <= Math.Abs(x) && m <= Math.Abs(y))\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n else\n {\n long c = 0;\n while (Math.Abs(x) < m || Math.Abs(y) < m)\n {\n c++;\n if (Math.Abs(x) >= Math.Abs(y))\n {\n y += x;\n }\n else\n {\n x += y;\n }\n }\n Console.WriteLine(c - 1);\n }\n }\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PerfectPair\n{\n partial class PerfectPair\n {\n static void Main(string[] args)\n {\n long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0;\n\n x = NextLong();\n y = NextLong();\n m = NextLong();\n\n diffX = m - x;\n diffY = m - y;\n\n min = Math.Min(x, y);\n max = Math.Max(x, y);\n\n if ((min >= 0 && m < 0) || (max <= 0 && m > 0))\n Console.WriteLine(-1);\n else if (max >= m)\n Console.WriteLine(0);\n else\n {\n while (true)\n {\n diff = m - min;\n\n if (m > 0 && max < diff)\n {\n count++;\n temp = max;\n max += min;\n min = temp;\n\n min = Math.Min(min, max);\n max = Math.Max(temp, max);\n }\n else\n {\n Console.WriteLine(count + 1);\n break;\n }\n }\n }\n }\n }\n\n partial class PerfectPair\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PerfectPair\n{\n partial class PerfectPair\n {\n static void Main(string[] args)\n {\n long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0, diffVal, increment;\n\n x = NextLong();\n y = NextLong();\n m = NextLong();\n\n diffX = m - x;\n diffY = m - y;\n\n min = Math.Min(x, y);\n max = Math.Max(x, y);\n\n if ((min >= 0 && m < 0) || (max <= 0 && m > 0) || (max <= 0 && m > max))\n Console.WriteLine(-1);\n else if (max >= m)\n Console.WriteLine(0);\n else\n {\n while (true)\n {\n diff = m - min;\n\n if (max < diff)\n {\n diffVal = max - min + 1;\n\n increment = (diffVal / max);\n increment += diffVal % max == 0 ? 0 : 1;\n\n count += increment;\n\n temp = max;\n max = min + increment * max;\n min = temp;\n\n min = Math.Min(min, max);\n max = Math.Max(temp, max);\n }\n else\n {\n if (m - max > 0)\n count++;\n\n Console.WriteLine(count);\n break;\n }\n }\n }\n }\n }\n\n partial class PerfectPair\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace PerfectPair\n{\n partial class PerfectPair\n {\n static void Main(string[] args)\n {\n long x, y, m, diff, diffX, diffY, temp, min, max, count = 0, prevDiff = 0;\n bool noAnswer = false;\n\n x = NextLong();\n y = NextLong();\n m = NextLong();\n\n diffX = m - x;\n diffY = m - y;\n\n min = Math.Min(x, y);\n max = Math.Max(x, y);\n\n if (max >= m)\n Console.WriteLine(0);\n else\n {\n while (true)\n {\n diff = m - min;\n\n if (count > 0)\n {\n if (prevDiff <= diff)\n {\n noAnswer = true;\n break;\n }\n }\n\n prevDiff = diff;\n\n if (max < diff)\n {\n count++;\n temp = max;\n max += min;\n min = temp;\n\n min = Math.Min(min, max);\n max = Math.Max(temp, max);\n }\n else\n {\n Console.WriteLine(count + 1);\n break;\n }\n }\n\n \n }\n\n if (noAnswer)\n Console.WriteLine(-1);\n }\n }\n\n partial class PerfectPair\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x, long y, long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if((x==0 && y<0) || ((y == 0) && (x <0)))\n return -1;\n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x, long y, long m)\n {\n int i = 0;\n if (x <= 0 && y <= 0 && ((x < m) || (y < m)))\n return -1;\n else if((x==0 && y<0) || ((y == 0) && (x <0)))\n return -1;\n \n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x, long y, long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if((x==0 || y==0) && ((x < 0) || (y <0)))\n return -1;\n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x,long y,long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if((x==0 || y==0) && ((x < m) && (y < m)))\n return -1;\n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x,long y,long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if(x==0 || y==0 && ((x < m) && (y < m)))\n return -1;\n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x, long y, long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))\n return -1;\n else if (x == 0 && y == 0 && y < m)\n return -1;\n else\n {\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return 0;\n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n\n if (x >= m || y >= m)\n return 0;\n if (x <= 0 && y <= 0 )\n return -1;\n\n if (x > y)\n {\n //x ^= y;\n //y ^= x;\n //x ^= y;\n\n x ^= y ^= x ^= y;\n }\n \n if (x < 0 && y > 0)\n {\n i = -x / y;\n x = x + y * i;\n }\n else if (y < 0 && x > 0)\n {\n i = -y / x;\n y = y + x * i;\n }\n\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return i;\n\n \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n long p=mperfect(x, y, m);\n\n Console.WriteLine(p);\n Console.ReadLine();\n\n\n\n }\n\n protected static long mperfect(long x, long y, long m)\n {\n long i = 0;\n if (x < 0 && y < 0 && ((x < m) && (y < m)))\n return -1;\n else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))\n return -1;\n else if (x == 0 && y == 0 && y < m)\n return -1;\n \n else\n {\n if (x < 0 && y > 0)\n {\n i = -x / y;\n x =x+ y*i;\n }\n else if (y < 0 && x > 0)\n {\n i = -y / x;\n y =y+ x*i;\n }\n while (x < m && y < m)\n {\n\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return i;\n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n long x=0, y=0, m = 0;\n x =long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(long x, long y, long m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))\n return -1;\n else if (x == 0 && y == 0 && y < m)\n return -1;\n else\n {\n while (x < m && y < m)\n {\n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n\n }\n\n return 0;\n\n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace m_perfect\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n string[] tokens = Console.ReadLine().Split(' ');\n\n double x=0, y=0, m = 0;\n x =double.Parse(tokens[0]);\n y = double.Parse(tokens[1]);\n m = double.Parse(tokens[2]);\n\n int mp=mperfect(x, y, m);\n\n Console.WriteLine(mp);\n Console.ReadLine();\n\n\n\n }\n\n protected static int mperfect(double x, double y, double m)\n {\n int i = 0;\n if (x < 0 && y < 0 && ((x < m) || (y < m)))\n return -1;\n else if((x==0 || y==0) && ((x < m) && (y < m)))\n return -1;\n else\n {\n while (x < m && y < m) \n { \n if (x < y)\n {\n x = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n else\n {\n y = x + y;\n i++;\n if (x >= m || y >= m)\n return i;\n }\n \n }\n\n return 0;\n \n\n } \n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n public static Int64 caculate(Int64 big , Int64 small, Int64 target)\n {\n Int64 step1 = small / (big * -1);\n if (big * step1 + small < 0)\n {\n step1++;\n }\n Int64 start = small + big * step1;\n\n Int64 next = start + big;\n while (start < target)\n {\n step1++;\n Int64 tmp = start;\n start = next;\n next = start + next;\n }\n\n return step1;\n }\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n\n string[] array = input.Split(' ');\n Int64 x = Int64.Parse(array[0]);\n Int64 y = Int64.Parse(array[1]);\n Int64 m = Int64.Parse(array[2]);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Int64 bigger = x > y ? x : y;\n Int64 smaller = x > y ? y : x;\n Int64 sub = bigger - smaller;\n\n if (bigger <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(caculate(bigger, smaller, m));\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n\n string[] array = input.Split(' ');\n Int64 x = Int64.Parse(array[0]);\n Int64 y = Int64.Parse(array[1]);\n Int64 m = Int64.Parse(array[2]);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Int64 bigger = x > y ? x : y;\n Int64 smaller = x > y ? y : x;\n Int64 sub = bigger - smaller;\n\n if (bigger <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Int64 step = (m - smaller) / bigger;\n if (step * bigger + smaller >= m)\n {\n Console.WriteLine(step);\n }\n else\n {\n Console.WriteLine(step + 1);\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n public static Int64 caculate(Int64 big , Int64 small, Int64 target)\n {\n Int64 step = -1;\n Int64 last = small;\n Int64 next = big;\n while (last < target)\n {\n step++;\n Int64 tmp = last + next;\n last = next;\n next = tmp;\n }\n return step;\n }\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n\n string[] array = input.Split(' ');\n Int64 x = Int64.Parse(array[0]);\n Int64 y = Int64.Parse(array[1]);\n Int64 m = Int64.Parse(array[2]);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Int64 bigger = x > y ? x : y;\n Int64 smaller = x > y ? y : x;\n Int64 sub = bigger - smaller;\n\n if (bigger <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(caculate(bigger, smaller, m));\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n public static Int64 caculate(Int64 big , Int64 small, Int64 target)\n {\n Int64 start=0, step1=0, next=0;\n if (small < 0)\n {\n step1 = small / (big * -1);\n if (big * step1 + small < 0)\n {\n step1++;\n }\n\n start = small + big * step1 > big ? small + big*step1 : big;\n next = small + big * step1 + big;\n }\n else\n {\n start = big;\n next = small + big;\n }\n while (start < target)\n {\n step1++;\n Int64 tmp = start;\n start = next;\n next = start + next;\n }\n\n return step1;\n }\n static void Main(string[] args)\n { \n string input = Console.ReadLine();\n\n string[] array = input.Split(' ');\n Int64 x = Int64.Parse(array[0]);\n Int64 y = Int64.Parse(array[1]);\n Int64 m = Int64.Parse(array[2]);\n\n if (x >= m || y >= m)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Int64 bigger = x > y ? x : y;\n Int64 smaller = x > y ? y : x;\n Int64 sub = bigger - smaller;\n\n if (bigger <= 0)\n {\n Console.WriteLine(\"-1\");\n }\n else\n {\n Console.WriteLine(caculate(bigger, smaller, m));\n }\n }\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n C();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n long n, k;\n string[] tokens = ReadArray(' ');\n n = long.Parse(tokens[0]);\n k = long.Parse(tokens[1]);\n long even = n / 2L;\n long odd = n % 2L == 0L ? n / 2L : n / 2L + 1L;\n if (k <= odd)\n {\n Console.WriteLine(1L + (k - 1L) * 2L);\n }\n else\n {\n Console.WriteLine((k - odd) * 2L);\n }\n }\n\n static void B()\n {\n string row = ReadLine();\n long ans = 0;\n long[] heavy = new long[row.Length];\n long[] metal = new long[row.Length];\n string h = \"heavy\";\n string m = \"metal\";\n for (int i = 0; i < row.Length - 4; i++)\n {\n heavy[i + 4] = heavy[i + 3];\n bool isHeavy = true;\n for (int j = i, z = 0; z < 5; j++, z++)\n {\n if (row[j] != h[z])\n {\n isHeavy = false;\n break;\n }\n }\n if (isHeavy)\n heavy[i + 4]++;\n }\n for (int i = row.Length - 1; i >= 4; i--)\n {\n metal[i - 4] = metal[i - 3];\n bool isMetal = true;\n for (int j = i - 4, z = 0; z < 5; j++, z++)\n {\n if (row[j] != m[z])\n {\n isMetal = false;\n break;\n }\n }\n if (isMetal)\n metal[i - 4]++;\n }\n for (int i = 4; i < row.Length - 4; i++)\n {\n ans += (heavy[i] - heavy[i - 1]) * metal[i + 1];\n }\n Console.WriteLine(ans);\n }\n\n static void C()\n {\n long x, y, m;\n string[] tokens = ReadArray(' ');\n x = long.Parse(tokens[0]);\n y = long.Parse(tokens[1]);\n m = long.Parse(tokens[2]);\n long ans = 0;\n if (x <= 0 && y <= 0)\n {\n if (Math.Max(x, y) >= m)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(-1);\n }\n return;\n }\n if (x < 0 || y < 0)\n {\n if (x < y)\n {\n ans += -x / y;\n x += (-x / y) * y;\n }\n else\n {\n ans += -y / x;\n y += (-y / x) * x;\n }\n }\n while (Math.Max(x, y) < m)\n {\n if (x <= y)\n {\n x += y;\n }\n else\n {\n y += x;\n }\n ans++;\n }\n Console.WriteLine(ans);\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n\n String s = Console.ReadLine();\n \n char[] c = {' '};\n \n String[] a = s.Split(c, 3, StringSplitOptions.RemoveEmptyEntries);\n \n long x = long.Parse(a[0]), tx = x;\n long y = long.Parse(a[1]), ty = y;\n long m = long.Parse(a[2]);\n \n long ans = 0;\n \n while (tx < m && ty < m){\n \n long tempX = tx, tempY = ty;\n \n if (tx < ty){\n \n if (ty != 0){\n \n ans += ((ty - tx) / ty + 1);\n \n tx = tx + ty * ((ty - tx) / ty + 1);\n \n }\n else {\n \n ans = -1;\n \n break;\n \n }\n \n }\n else {\n \n if (tx != 0){\n \n ans += ((tx - ty) / tx + 1);\n \n ty = ty + tx * ((tx - ty) / tx + 1);\n \n }\n else {\n \n ans = -1;\n \n break;\n \n }\n \n }\n \n if (Math.Abs(tx - m) >= Math.Abs(tempX - m) \n && Math.Abs(ty - m) >= Math.Abs(tempY - m)){\n \n ans = -1;\n \n break;\n \n }\n \n }\n \n Console.WriteLine(ans);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codegh\n{\n class Program\n {\n static void Main(string[] args)\n {\n List mas = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();\n long k = 0;\n if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0]<=0&&mas[1]<=0)\n {\n Console.WriteLine(-1);\n return;\n }\n if (mas[0] > mas[1])\n {\n long c = mas[0];\n mas[0] = mas[1];\n mas[1] = c;\n }\n if (mas[1] == mas[2])\n {\n Console.WriteLine(0);\n return;\n }\n if (mas[0]<0)\n {\n \n if (mas[0] % mas[1] == 0)\n {\n k += Math.Abs((mas[0] / mas[1]));\n }else\n {\n k +=Math.Abs( (mas[0] / mas[1]))+1;\n }\n mas[0] += mas[1] * k;\n }\n if (mas[0] + mas[1] > mas[2])\n {\n k -= (Math.Abs(mas[2] - mas[1] - mas[0]) / mas[1]);\n }\n while(Math.Max(mas[0], mas[1]) < mas[2])\n {\n \n long s = mas[0] + mas[1];\n mas[0] = mas[1];\n mas[1] = s;\n k++;\n }\n Console.WriteLine(k);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codegh\n{\n class Program\n {\n static void Main(string[] args)\n {\n List mas = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();\n long k = 0;\n if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0] + mas[1] <= 0)\n {\n Console.WriteLine(-1);\n return;\n }\n if (mas[0] > mas[1])\n {\n long c = mas[0];\n mas[0] = mas[1];\n mas[1] = c;\n }\n while(Math.Max(mas[0], mas[1]) < mas[2])\n {\n long s = mas[0] + mas[1];\n mas[0] = mas[1];\n mas[1] = s;\n k++;\n }\n Console.WriteLine(k);\n // Console.ReadKey();\n }\n }\n}\n"}], "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821"} {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong n = NextLong(), m = NextLong(), x = NextLong(), y = NextLong(), a = NextLong(), b = NextLong();\n\t\t\tlong g = NumTheoryUtils.Gcd( a, b );\n\t\t\ta /= g;\n\t\t\tb /= g;\n\t\t\tlong k = Math.Min( n / a, m / b );\n\t\t\tlong xl = k * a, yl = k * b;\n\t\t\tlong x1 = ( xl % 2 == 0 ? x - xl / 2 : x - xl / 2 - 1 );\n\t\t\tlong y1 = ( yl % 2 == 0 ? y - yl / 2 : y - yl / 2 - 1 );\n\t\t\tif ( x1 < 0 ) x1 = 0;\n\t\t\tif ( y1 < 0 ) y1 = 0;\n\t\t\tif ( x1 + xl > n ) x1 -= ( x1 + xl ) - n;\n\t\t\tif ( y1 + yl > m ) y1 -= ( y1 + yl ) - m;\n\t\t\tOut.WriteLine( string.Format( \"{0} {1} {2} {3}\", x1, y1, x1 + xl, y1 + yl ) );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }\n\nnamespace kp.Algo\n{\n\tstatic class NumTheoryUtils\n\t{\n\t\tpublic static long Gcd( long a, long b )\n\t\t{\n\t\t\tif ( a < 0 ) a = -a;\n\t\t\tif ( b < 0 ) b = -b;\n\t\t\treturn b == 0 ? a : Gcd( b, a % b );\n\t\t}\n\t}\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R183_Div2_D\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n int y = int.Parse(s[3]);\n int a = int.Parse(s[4]);\n int b = int.Parse(s[5]);\n int g = GCD_Euclid(a, b);\n a = a / g;\n b = b / g;\n\n int xDif = Math.Min(n - x, x - 0);\n int yDif = Math.Min(m - y, y - 0);\n\n int t = Math.Min(n / a, m / b);\n a *= t;\n b *= t;\n\n int x1, y1, x2, y2;\n x1 = x - a + (a / 2);\n y1 = y - b + (b / 2);\n x1 = Math.Min(x1, n - a);\n y1 = Math.Min(y1, m - b);\n x1 = Math.Max(x1, 0);\n y1 = Math.Max(y1, 0);\n x2 = x1 + a;\n y2 = y1 + b;\n Console.WriteLine(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n }\n\n static int GCD_Euclid(int a, int b)\n {\n if (b == 0) return a;\n return GCD_Euclid(b, a % b);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics.Contracts;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R303\n{\n public static class B\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n Contract.Requires(tr != null);\n Contract.Requires(tw != null);\n\n tw.WriteLine(Parse(tr));\n }\n\n private static string Parse(TextReader tr)\n {\n var info = CultureInfo.CurrentCulture;\n var l = tr.ReadLine().Split().Select(x => int.Parse(x, info)).ToArray();\n\n return Calc(l[0], l[1], l[2], l[3], l[4], l[5]);\n }\n\n public static string Calc(int n, int m, int x, int y, int a, int b)\n {\n Reduce(ref a, ref b);\n var maxFactor = Math.Min(n / a, m / b);\n var w = a * maxFactor;\n var h = b * maxFactor;\n\n var x1 = Nearest(n, w, x);\n var y1 = Nearest(m, h, y);\n\n var x2 = x1 + w;\n var y2 = y1 + h;\n\n return $\"{x1} {y1} {x2} {y2}\";\n }\n\n public static int Nearest(int n, int w, int x)\n {\n return Math.Max(0, Math.Min(x - (w + 1) / 2, n - w));\n }\n\n public static void Reduce(ref int a, ref int b)\n {\n var gcd = Gcd(a, b);\n a /= gcd;\n b /= gcd;\n }\n\n public static int Gcd(int a, int b)\n {\n while (a != 0)\n {\n var r = b % a;\n b = a;\n a = r;\n }\n return b;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob303B\n {\n //Your task is to find a maximum sub-rectangle on the grid (x1,\u2009y1,\u2009x2,\u2009y2) so that it contains the given point (x,\u2009y), \n //and its length-width ratio is exactly (a,\u2009b). In other words the following conditions must hold: \n //0\u2009\u2264\u2009x1\u2009\u2264\u2009x\u2009\u2264\u2009x2\u2009\u2264\u2009n, 0\u2009\u2264\u2009y1\u2009\u2264\u2009y\u2009\u2264\u2009y2\u2009\u2264\u2009m, (x2-x1)/(y2-y1)=a/b.\n\n //The sides of this sub-rectangle should be parallel to the axes. And values x1,\u2009y1,\u2009x2,\u2009y2 should be integers.\n\n //If there are multiple solutions, find the rectangle which is closest to (x,\u2009y). Here \"closest\" means the Euclid \n //distance between (x,\u2009y) and the center of the rectangle is as small as possible. If there are still multiple \n //solutions, find the lexicographically minimum one. Here \"lexicographically minimum\" means that we should consider \n //the sub-rectangle as sequence of integers (x1,\u2009y1,\u2009x2,\u2009y2), so we can choose the lexicographically minimum one.\n class Pair\n {\n int x;\n int y;\n\n public Pair()\n {\n x = 0;\n y = 0;\n }\n\n public Pair(int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int X\n {\n get { return x; }\n set { x = value; }\n }\n\n public int Y\n {\n get { return y; }\n set { y = value; }\n }\n\n public Pair shift(Pair shiftBy)\n {\n return new Pair(x + shiftBy.X, y + shiftBy.Y);\n }\n\n public Pair simplify()\n {\n int a = x;\n int b = y;\n int rem;\n\n while (b != 0)\n {\n rem = a % b;\n a = b;\n b = rem;\n }\n return new Pair(x / a, y / a);\n }\n\n public override String ToString()\n {\n return x + \" \" + y;\n }\n }\n\n class Rectangle\n {\n Pair bottomLeft;\n Pair upperRight;\n int width;\n int height;\n\n public Rectangle()\n {\n bottomLeft = new Pair();\n upperRight = new Pair();\n width = 0;\n height = 0;\n }\n\n public Rectangle(Pair bl, Pair ur)\n {\n bottomLeft = bl;\n upperRight = ur;\n width = upperRight.X - bottomLeft.X;\n height = upperRight.Y - bottomLeft.Y;\n }\n\n public Pair getLargestFit(Pair ratio)\n {\n int max = Math.Min(width / ratio.X, height / ratio.Y);\n return new Pair(ratio.X * max, ratio.Y * max);\n }\n\n public Rectangle getClosestRectangle(Pair point, Pair dims)\n {\n Pair bottomLeftCorner = new Pair();\n\n bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);\n if (bottomLeftCorner.X < 0)\n {\n bottomLeftCorner.X = 0;\n }\n else if (bottomLeftCorner.X + dims.X > width)\n {\n bottomLeftCorner.X = width - dims.X;\n }\n\n bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);\n if (bottomLeftCorner.Y < 0)\n {\n bottomLeftCorner.Y = 0;\n }\n else if (bottomLeftCorner.Y + dims.Y > height)\n {\n bottomLeftCorner.Y = height - dims.Y;\n }\n\n return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));\n }\n\n public override String ToString()\n {\n return bottomLeft.ToString() + \" \" + upperRight.ToString();\n }\n }\n\n Rectangle housing;\n Pair point;\n Pair ratio;\n\n public Prob303B(int n, int m, int x, int y, int a, int b)\n {\n housing = new Rectangle(new Pair(0, 0), new Pair(n, m));\n point = new Pair(x, y);\n ratio = new Pair(a, b);\n }\n\n public String solve()\n {\n Pair rectDims = housing.getLargestFit(ratio.simplify());\n Rectangle result = housing.getClosestRectangle(point, rectDims);\n return result.ToString();\n }\n\n public override String ToString()\n {\n return housing.ToString() + \" \" + point.ToString() + \" \" + ratio.ToString();\n }\n\n static void Main(string[] args)\n {\n String line = Console.ReadLine();\n String[] temp = line.Split(' ');\n int[] vals = new int[temp.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n vals[i] = Convert.ToInt32(temp[i]);\n }\n Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program {\n\n #region input\n\n static long readLong() {\n long num;\n long.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static ulong readULong() {\n ulong num;\n ulong.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static int readInt() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num;\n }\n\n static bool readBool() {\n int num;\n int.TryParse(Console.ReadLine(),out num);\n return num != 0;\n }\n\n static long[] readLongs() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n long[] parsed = new long[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n long.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static int[] readInts() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n for(int i = 0; i < nums.Length; i++) {\n int.TryParse(nums[i],out parsed[i]);\n }\n return parsed;\n }\n\n static void readInts(out int a, out int b) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n int[] parsed = new int[nums.Length];\n int.TryParse(nums[0],out a);\n int.TryParse(nums[1],out b);\n }\n\n static BitArray readBools() {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != \"0\") {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static BitArray readBools(string off) {\n string[] nums = Console.ReadLine().Split(new char[] { ' ' });\n BitArray bits = new BitArray(nums.Length);\n for(int i = 0; i < nums.Length; i++) {\n if(nums[i] != off) {\n bits[i] = true;\n }\n }\n return bits;\n }\n\n static void waist() {\n Console.ReadLine();\n }\n\n #endregion\n\n #region utility\n\n static long largeModolu(long a,long b,long m) {\n long prev = a;\n long sum = (b & 1) > 0 ? a : 1;\n int digits = (int)(Math.Ceiling(Math.Log(b,2)));\n for(int i = 1; i < digits; i++) {\n prev = (prev * prev) % (m);\n if((b & (1l << i)) > 0) {\n sum = (sum * prev) % (m);\n }\n }\n return sum;\n }\n\n static long GCD(long a, long b) {\n long temp;\n if(a > b) {\n temp = b;\n b = a;\n a = temp;\n }\n while(b != 0) {\n temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n }\n\n class SortableKVP where T : IComparable {\n List> data { set; get; }\n\n public int count {\n get {\n return data.Count;\n }\n }\n\n public T this[int index] {\n get {\n return data[index].Item2;\n }\n }\n\n public int originalIndex(int sortedIndex) {\n return data[sortedIndex].Item1;\n }\n\n public void sort() {\n data.Sort((a,b) => a.Item2.CompareTo(b.Item2));\n }\n\n public void add(T item) {\n data.Add(new Tuple(data.Count,item));\n }\n\n public void removeAt(int sortedIndex) {\n data.RemoveAt(sortedIndex);\n }\n\n public SortableKVP() {\n data = new List>();\n }\n\n public SortableKVP(T[] data) {\n this.data = new List>(data.Length);\n for(int i = 0; i < data.Length; i++) {\n this.data.Add(new Tuple(i,data[i]));\n }\n }\n }\n\n #endregion\n\n static void Main(string[] args) {\n long[] nmxyab = readLongs();\n long n = nmxyab[0];\n long m = nmxyab[1];\n long x = nmxyab[2];\n long y = nmxyab[3];\n long a = nmxyab[4];\n long b = nmxyab[5];\n long gcd = GCD(a,b);\n a /= gcd;\n b /= gcd;\n long multiplier = Math.Min(n / a,m / b);\n long xLength = a * multiplier;\n long yLength = b * multiplier;\n long x1 = Math.Min(n - xLength,Math.Max(0,x - (xLength + 1) / 2));\n long y1 = Math.Min(m - yLength,Math.Max(0,y - (yLength + 1) / 2));\n Console.WriteLine(x1 + \" \" + y1 + \" \" + (x1 + xLength) + \" \" + (y1 + yLength));\n }\n\n /*static void Main(string[] args) {\n BitArray primes = new BitArray(1000001,true);\n primes[0] = false;\n primes[1] = false;\n for(int i = 2; i * i <= 1000000; i++) {\n if(primes[i]) {\n for(int j = i * 2; j <= 1000000; j += i) {\n primes[j] = false;\n }\n }\n }\n int t = readInt();\n for(int r = 0; r < t; r++) {\n int[] range = readInts();\n int sum = 0;\n for(int i = range[0]; i <= range[1]; i++) {\n if(primes[i]) {\n sum++;\n }\n }\n Console.WriteLine(sum);\n }\n Console.Read();\n }*/\n\n /*static void Main(string[] args) {\n int t = readInt();\n for(int r = 0; r < t; r++) {\n waist();\n int[] nums = readInts();\n Array.Sort(nums, (a,b) => b.CompareTo(a));\n for(int i = 0; i < nums.Length; i++) {\n if((i & 1) == 0 ) {\n Console.Write(nums[i/2]);\n } else {\n Console.Write(nums[nums.Length - 1- (i-1)/2]);\n }\n if(i == nums.Length - 1) {\n Console.WriteLine(\"\");\n } else {\n Console.Write(\" \");\n }\n }\n }\n Console.Read();\n }*/\n }\n}\n//0.89493155168539774035319\n//0.894931551685397740353194\n//0.894931551685397735434921\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R183_Div2_D\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split();\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int x = int.Parse(s[2]);\n int y = int.Parse(s[3]);\n int a = int.Parse(s[4]);\n int b = int.Parse(s[5]);\n int g = GCD_Euclid(a, b);\n a = a / g;\n b = b / g;\n\n int xDif = Math.Min(n - x, x - 0);\n int yDif = Math.Min(m - y, y - 0);\n\n int t = Math.Min(n / a, m / b);\n a *= t;\n b *= t;\n\n int x1, y1, x2, y2;\n x1 = x - a + (a / 2);\n y1 = y - b + (b / 2);\n x1 = Math.Min(x1, n - a);\n y1 = Math.Min(y1, m - b);\n x1 = Math.Max(x1, 0);\n y1 = Math.Max(y1, 0);\n x2 = x1 + a;\n y2 = y1 + b;\n Console.WriteLine(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n }\n\n static int GCD_Euclid(int a, int b)\n {\n if (b == 0) return a;\n return GCD_Euclid(b, a % b);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace D\n{\n class Program\n {\n public static int gcd(int a, int b)\n {\n if (a < b)\n {\n return gcd(b, a);\n }\n else\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n }\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var n = NextInt();\n var m = NextInt();\n var x = NextInt();\n var y = NextInt();\n var a = NextInt();\n var b = NextInt();\n\n var g = gcd(a, b);\n a = a / g;\n b = b / g;\n var ma = n / a;\n var mb = m / b;\n var k = Math.Min(ma, mb);\n var mx = k * a;\n var my = k * b;\n\n var x1 = x - ((mx + 1) / 2);\n var y1 = y - ((my + 1) / 2);\n var x2 = x + (mx / 2);\n var y2 = y + (my / 2);\n if (x1 < 0)\n {\n x2 += -x1;\n x1 = 0;\n }\n if (x2 > n)\n {\n x1 -= (x2 - n);\n x2 = n;\n }\n if (y1 < 0)\n {\n y2 += -y1;\n y1 = 0;\n }\n if (y2 > m)\n {\n y1 -= (y2 - m);\n y2 = m;\n }\n\n Console.WriteLine(\"{0} {1} {2} {3}\", x1, y1, x2, y2);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n long n, m, x, y, a, b;\n string[] input = ReadArray();\n n = long.Parse(input[0]);\n m = long.Parse(input[1]);\n x = long.Parse(input[2]);\n y = long.Parse(input[3]);\n a = long.Parse(input[4]);\n b = long.Parse(input[5]);\n\n long gcd = MyMath.GCD(a, b);\n a /= gcd;\n b /= gcd;\n\n long left = 1;\n long right = m;\n\n long mid;\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (mid * a >= n || mid * b >= m)\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n if (!(left * a <= n && left * b <= m))\n left--;\n\n long w, h;\n w = left * a;\n h = left * b;\n long x1, y1, x2, y2;\n x1 = x2 = y1 = y2 = 0;\n\n if (x + w / 2 > n)\n {\n x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L) - (x + w / 2L - n);\n x2 = x1 + w;\n }\n else\n {\n if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) < 0)\n {\n x1 = 0;\n x2 = w;\n }\n else\n {\n x1 = x - (w % 2L == 0 ? w / 2L : w / 2L + 1L);\n x2 = x1 + w;\n }\n }\n if (y + h / 2 > m)\n {\n y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L) - (y + h / 2L - m);\n y2 = y1 + h;\n }\n else\n {\n if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) < 0)\n {\n y1 = 0;\n y2 = h;\n }\n else\n {\n y1 = y - (h % 2L == 0 ? h / 2L : h / 2L + 1L);\n y2 = y1 + h;\n }\n }\n\n Console.WriteLine(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob303B\n {\n //Your task is to find a maximum sub-rectangle on the grid (x1,\u2009y1,\u2009x2,\u2009y2) so that it contains the given point (x,\u2009y), \n //and its length-width ratio is exactly (a,\u2009b). In other words the following conditions must hold: \n //0\u2009\u2264\u2009x1\u2009\u2264\u2009x\u2009\u2264\u2009x2\u2009\u2264\u2009n, 0\u2009\u2264\u2009y1\u2009\u2264\u2009y\u2009\u2264\u2009y2\u2009\u2264\u2009m, (x2-x1)/(y2-y1)=a/b.\n\n //The sides of this sub-rectangle should be parallel to the axes. And values x1,\u2009y1,\u2009x2,\u2009y2 should be integers.\n\n //If there are multiple solutions, find the rectangle which is closest to (x,\u2009y). Here \"closest\" means the Euclid \n //distance between (x,\u2009y) and the center of the rectangle is as small as possible. If there are still multiple \n //solutions, find the lexicographically minimum one. Here \"lexicographically minimum\" means that we should consider \n //the sub-rectangle as sequence of integers (x1,\u2009y1,\u2009x2,\u2009y2), so we can choose the lexicographically minimum one.\n class Pair\n {\n int x;\n int y;\n\n public Pair()\n {\n x = 0;\n y = 0;\n }\n\n public Pair(int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int X\n {\n get { return x; }\n set { x = value; }\n }\n\n public int Y\n {\n get { return y; }\n set { y = value; }\n }\n\n public Pair makeBigger(int n)\n {\n return new Pair(x * n, y * n);\n }\n\n public Pair shift(Pair shiftBy)\n {\n return new Pair(x + shiftBy.X, y + shiftBy.Y);\n }\n\n public Pair simplify()\n {\n int a = x;\n int b = y;\n int rem;\n\n while (b != 0)\n {\n rem = a % b;\n a = b;\n b = rem;\n }\n return new Pair(x / a, y / a);\n }\n\n public override String ToString()\n {\n return x + \" \" + y;\n }\n }\n\n class Rectangle\n {\n Pair bottomLeft;\n Pair upperRight;\n int width;\n int height;\n\n public Rectangle()\n {\n bottomLeft = new Pair();\n upperRight = new Pair();\n width = 0;\n height = 0;\n }\n\n public Rectangle(Pair bl, Pair ur)\n {\n bottomLeft = bl;\n upperRight = ur;\n width = upperRight.X - bottomLeft.X;\n height = upperRight.Y - bottomLeft.Y;\n }\n\n public Pair getLargestFit(Pair ratio)\n {\n Pair p = new Pair(ratio.X, ratio.Y);\n int max = Math.Min(width / p.X, height / p.Y);\n int min = 1;\n int mid;\n while (max > min)\n {\n mid = min + (max - min) / 2;\n if (p.X * mid > width || p.Y * mid > height)\n {\n max = mid - 1;\n }\n else if (mid == min)\n {\n min = max;\n }\n else\n {\n min = mid;\n }\n }\n return p.makeBigger(min);\n }\n\n public Rectangle getClosestRectangle(Pair point, Pair dims)\n {\n Pair bottomLeftCorner = new Pair();\n\n bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);\n if (bottomLeftCorner.X < 0)\n {\n bottomLeftCorner.X = 0;\n }\n else if (bottomLeftCorner.X + dims.X > width)\n {\n bottomLeftCorner.X = width - dims.X;\n }\n\n bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);\n if (bottomLeftCorner.Y < 0)\n {\n bottomLeftCorner.Y = 0;\n }\n else if (bottomLeftCorner.Y + dims.Y > height)\n {\n bottomLeftCorner.Y = width - dims.Y;\n }\n\n return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));\n }\n\n public override String ToString()\n {\n return bottomLeft.ToString() + \" \" + upperRight.ToString();\n }\n }\n\n Rectangle housing;\n Pair point;\n Pair ratio;\n\n public Prob303B(int n, int m, int x, int y, int a, int b)\n {\n housing = new Rectangle(new Pair(0, 0), new Pair(n, m));\n point = new Pair(x, y);\n ratio = new Pair(a, b);\n }\n\n public String solve()\n {\n Pair rectDims = housing.getLargestFit(ratio.simplify());\n Rectangle result = housing.getClosestRectangle(point, rectDims);\n return result.ToString();\n }\n\n public override String ToString()\n {\n return housing.ToString() + \" \" + point.ToString() + \" \" + ratio.ToString();\n }\n\n static void Main(string[] args)\n {\n String line = Console.ReadLine();\n String[] temp = line.Split(' ');\n int[] vals = new int[temp.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n vals[i] = Convert.ToInt32(temp[i]);\n }\n Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Prob303B\n {\n //Your task is to find a maximum sub-rectangle on the grid (x1,\u2009y1,\u2009x2,\u2009y2) so that it contains the given point (x,\u2009y), \n //and its length-width ratio is exactly (a,\u2009b). In other words the following conditions must hold: \n //0\u2009\u2264\u2009x1\u2009\u2264\u2009x\u2009\u2264\u2009x2\u2009\u2264\u2009n, 0\u2009\u2264\u2009y1\u2009\u2264\u2009y\u2009\u2264\u2009y2\u2009\u2264\u2009m, (x2-x1)/(y2-y1)=a/b.\n\n //The sides of this sub-rectangle should be parallel to the axes. And values x1,\u2009y1,\u2009x2,\u2009y2 should be integers.\n\n //If there are multiple solutions, find the rectangle which is closest to (x,\u2009y). Here \"closest\" means the Euclid \n //distance between (x,\u2009y) and the center of the rectangle is as small as possible. If there are still multiple \n //solutions, find the lexicographically minimum one. Here \"lexicographically minimum\" means that we should consider \n //the sub-rectangle as sequence of integers (x1,\u2009y1,\u2009x2,\u2009y2), so we can choose the lexicographically minimum one.\n class Pair\n {\n int x;\n int y;\n\n public Pair()\n {\n x = 0;\n y = 0;\n }\n\n public Pair(int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int X\n {\n get { return x; }\n set { x = value; }\n }\n\n public int Y\n {\n get { return y; }\n set { y = value; }\n }\n\n public Pair makeBigger(int n)\n {\n return new Pair(x * n, y * n);\n }\n\n public Pair shift(Pair shiftBy)\n {\n return new Pair(x + shiftBy.X, y + shiftBy.Y);\n }\n\n public Pair simplify()\n {\n int a = x;\n int b = y;\n int rem;\n\n while (b != 0)\n {\n rem = a % b;\n a = b;\n b = rem;\n }\n return new Pair(x / a, y / a);\n }\n\n public override String ToString()\n {\n return x + \" \" + y;\n }\n }\n\n class Rectangle\n {\n Pair bottomLeft;\n Pair upperRight;\n int width;\n int height;\n\n public Rectangle()\n {\n bottomLeft = new Pair();\n upperRight = new Pair();\n width = 0;\n height = 0;\n }\n\n public Rectangle(Pair bl, Pair ur)\n {\n bottomLeft = bl;\n upperRight = ur;\n width = upperRight.X - bottomLeft.X;\n height = upperRight.Y - bottomLeft.Y;\n }\n\n public Pair getLargestFit(Pair ratio)\n {\n Pair p = new Pair(ratio.X, ratio.Y);\n int max = Math.Min(width / p.X, height / p.Y);\n return p.makeBigger(max);\n }\n\n public Rectangle getClosestRectangle(Pair point, Pair dims)\n {\n Pair bottomLeftCorner = new Pair();\n\n bottomLeftCorner.X = point.X - (dims.X / 2) - (dims.X & 1);\n if (bottomLeftCorner.X < 0)\n {\n bottomLeftCorner.X = 0;\n }\n else if (bottomLeftCorner.X + dims.X > width)\n {\n bottomLeftCorner.X = width - dims.X;\n }\n\n bottomLeftCorner.Y = point.Y - (dims.Y / 2) - (dims.Y & 1);\n if (bottomLeftCorner.Y < 0)\n {\n bottomLeftCorner.Y = 0;\n }\n else if (bottomLeftCorner.Y + dims.Y > height)\n {\n bottomLeftCorner.Y = width - dims.Y;\n }\n\n return new Rectangle(bottomLeftCorner, bottomLeftCorner.shift(dims));\n }\n\n public override String ToString()\n {\n return bottomLeft.ToString() + \" \" + upperRight.ToString();\n }\n }\n\n Rectangle housing;\n Pair point;\n Pair ratio;\n\n public Prob303B(int n, int m, int x, int y, int a, int b)\n {\n housing = new Rectangle(new Pair(0, 0), new Pair(n, m));\n point = new Pair(x, y);\n ratio = new Pair(a, b);\n }\n\n public String solve()\n {\n Pair rectDims = housing.getLargestFit(ratio.simplify());\n Rectangle result = housing.getClosestRectangle(point, rectDims);\n return result.ToString();\n }\n\n public override String ToString()\n {\n return housing.ToString() + \" \" + point.ToString() + \" \" + ratio.ToString();\n }\n\n static void Main(string[] args)\n {\n String line = Console.ReadLine();\n String[] temp = line.Split(' ');\n int[] vals = new int[temp.Length];\n for (int i = 0; i < vals.Length; ++i)\n {\n vals[i] = Convert.ToInt32(temp[i]);\n }\n Prob303B prob = new Prob303B(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5]);\n Console.WriteLine(prob.solve());\n }\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tlong n = NextLong(), m = NextLong(), x = NextLong(), y = NextLong(), a = NextLong(), b = NextLong();\n\t\t\tlong g = NumTheoryUtils.Gcd( a, b );\n\t\t\ta /= g;\n\t\t\tb /= g;\n\t\t\tlong k = Math.Min( n / a, m / b );\n\t\t\tlong xl = k * a, yl = k * b;\n\t\t\tlong x1 = xl % 2 == 0 ? x - xl / 2 : x - xl / 2 - 1;\n\t\t\tlong y1 = yl % 2 == 0 ? y - yl / 2 : y - yl / 2 - 1;\n\t\t\tif ( x1 < 0 ) x1 = 0;\n\t\t\tif ( y1 < 0 ) y1 = 0;\n\t\t\tif ( x1 + xl > n ) x1 -= n - ( x1 + xl );\n\t\t\tif ( y1 + yl > m ) y1 -= m - ( y1 + yl );\n\t\t\tOut.WriteLine( string.Format( \"{0} {1} {2} {3}\", x1, y1, x1 + xl, y1 + yl ) );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }\n\nnamespace kp.Algo\n{\n\tstatic class NumTheoryUtils\n\t{\n\t\tpublic static long Gcd( long a, long b )\n\t\t{\n\t\t\tif ( a < 0 ) a = -a;\n\t\t\tif ( b < 0 ) b = -b;\n\t\t\treturn b == 0 ? a : Gcd( b, a % b );\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\nusing System.Threading;\n\nnamespace D\n{\n class Program\n {\n public static int gcd(int a, int b)\n {\n if (a < b)\n {\n return gcd(b, a);\n }\n else\n {\n if (b == 0)\n {\n return a;\n }\n else\n {\n return gcd(b, a % b);\n }\n }\n }\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new System.IO.StreamReader(@\"..\\..\\..\\in\"));\n Console.SetOut(new System.IO.StreamWriter(@\"..\\..\\..\\out\"));\n for (int testN = 0; testN < 2; testN++)\n {\n#endif\n //SetCulture();\n var n = NextInt();\n var m = NextInt();\n var x = NextInt();\n var y = NextInt();\n var a = NextInt();\n var b = NextInt();\n\n var g = gcd(a, b);\n a = a / g;\n b = b / g;\n var ma = n / a;\n var mb = m / b;\n var k = Math.Min(ma, mb);\n var mx = k * a;\n var my = k * b;\n\n var x1 = x - ((mx + 1) / 2);\n var y1 = y - ((my + 1) / 2);\n var x2 = x + (mx / 2);\n var y2 = y + (my / 2);\n\n\n Console.WriteLine(\"{0} {1} {2} {3}\", x1, y1, x2, y2);\n //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, \"{0:F4}\", res));\n#if !ONLINE_JUDGE\n Console.ReadLine();\n }\n Console.In.Close();\n Console.Out.Close();\n#endif\n }\n\n private static char[] _defaultSplitter = new char[] { ' ', '\\t' };\n\n private static void SetCulture()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n }\n\n private static char[] ReadChars(int n)\n {\n char[] buffer = new char[n];\n Console.In.ReadBlock(buffer, 0, n);\n return buffer;\n }\n\n private static string[] ReadAll()\n {\n return Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadWords()\n {\n return ReadWords(_defaultSplitter);\n }\n\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadInts(char[] splitter)\n {\n return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n private static int[] ReadInts()\n {\n return ReadInts(_defaultSplitter);\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);\n }\n\n private static int _pos = 0;\n private static string[] _inputLine = new string[0];\n\n private static void CheckInputLine()\n {\n if (_pos >= _inputLine.Length)\n {\n _inputLine = ReadWords();\n _pos = 0;\n }\n }\n\n private static string NextWord()\n {\n CheckInputLine();\n return _inputLine[_pos++];\n }\n\n private static int NextInt()\n {\n CheckInputLine();\n return int.Parse(_inputLine[_pos++]);\n }\n\n private static long NextLong()\n {\n CheckInputLine();\n return long.Parse(_inputLine[_pos++]);\n }\n }\n}\n"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n int n, m, x, y, a, b;\n string[] input = ReadArray();\n n = int.Parse(input[0]);\n m = int.Parse(input[1]);\n x = int.Parse(input[2]);\n y = int.Parse(input[3]);\n a = int.Parse(input[4]);\n b = int.Parse(input[5]);\n\n int gcd = MyMath.GCD(a, b);\n a /= gcd;\n b /= gcd;\n\n int left = 1;\n int right = m;\n\n int mid;\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (mid * a >= m || mid * b >= n)\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n if (!(left * a <= m && left * b <= n))\n left--;\n\n int w, h;\n w = left * a;\n h = left * b;\n int x1, y1, x2, y2;\n\n if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) >= 0)\n {\n if (x + w / 2 > m)\n {\n x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);\n x1 -= (x1 + w - m);\n x2 = x1 + w;\n }\n else\n {\n x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);\n x2 = x1 + w;\n }\n }\n else\n {\n x1 = 0;\n x2 = w;\n }\n if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) >= 0)\n {\n if (y + h / 2 > n)\n {\n y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);\n y1 -= (y1 + h - n);\n y2 = y1 + h;\n }\n else\n {\n y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);\n y2 = y1 + h;\n }\n }\n else\n {\n y1 = 0;\n y2 = h;\n }\n Console.WriteLine(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "#define Online\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Threading;\n\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n long n, m, x, y, a, b;\n string[] input = ReadArray();\n n = long.Parse(input[0]);\n m = long.Parse(input[1]);\n x = long.Parse(input[2]);\n y = long.Parse(input[3]);\n a = long.Parse(input[4]);\n b = long.Parse(input[5]);\n\n long gcd = MyMath.GCD(a, b);\n a /= gcd;\n b /= gcd;\n\n long left = 1;\n long right = m;\n\n long mid;\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (mid * a >= m || mid * b >= n)\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n if (!(left * a <= m && left * b <= n))\n left--;\n\n long w, h;\n w = left * a;\n h = left * b;\n long x1, y1, x2, y2;\n\n if (x - (w % 2 == 0 ? w / 2 : w / 2 + 1) >= 0)\n {\n if (x + w / 2 > m)\n {\n x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);\n x1 -= (x1 + w - m);\n x2 = x1 + w;\n }\n else\n {\n x1 = x - (w % 2 == 0 ? w / 2 : w / 2 + 1);\n x2 = x1 + w;\n }\n }\n else\n {\n x1 = 0;\n x2 = w;\n }\n if (y - (h % 2 == 0 ? h / 2 : h / 2 + 1) >= 0)\n {\n if (y + h / 2 > n)\n {\n y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);\n y1 -= (y1 + h - n);\n y2 = y1 + h;\n }\n else\n {\n y1 = y - (h % 2 == 0 ? h / 2 : h / 2 + 1);\n y2 = y1 + h;\n }\n }\n else\n {\n y1 = 0;\n y2 = h;\n }\n Console.WriteLine(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n public class SegmentTree\n {\n int[] v_min;\n int[] v_max;\n int[] mas;\n public void BuildTree(int[] a)\n {\n int n = a.Length - 1;\n int z = 0;\n while (n >= 2)\n {\n z++;\n n >>= 1;\n }\n n = 1 << (z + 1);\n v_min = new int[n << 1];\n v_max = new int[n << 1];\n mas = new int[n << 1];\n for (int i = n; i < n + a.Length; i++)\n v_min[i] = a[i - n];\n for (int i = n + a.Length; i < v_min.Length; i++)\n v_min[i] = int.MaxValue;\n for (int i = n - 1; i > 0; i--)\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n\n for (int i = n; i < n + a.Length; i++)\n v_max[i] = a[i - n];\n for (int i = n + a.Length; i < v_max.Length; i++)\n v_max[i] = int.MinValue;\n for (int i = n - 1; i > 0; i--)\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n\n }\n //nil\n public int RMQ_MIN(int l, int r)\n {\n int ans = int.MaxValue;\n l += v_min.Length >> 1;\n r += v_min.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Min(ans, v_min[l]);\n if (!((r & 1) == 0))\n ans = Math.Min(ans, v_min[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public int RMQ_MAX(int l, int r)\n {\n int ans = int.MinValue;\n l += v_max.Length >> 1;\n r += v_max.Length >> 1;\n const int o = 1;\n while (l <= r)\n {\n if ((l & 1) == o)\n ans = Math.Max(ans, v_max[l]);\n if (!((r & 1) == 0))\n ans = Math.Max(ans, v_max[r]);\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n return ans;\n }\n\n public void Put(int l, int r, int op)\n {\n l += mas.Length >> 1;\n r += mas.Length >> 1;\n while (l <= r)\n {\n if (l % 2 != 0)\n mas[l] = op;\n if (r % 2 == 0)\n mas[r] = op;\n l = (l + 1) >> 1;\n r = (r - 1) >> 1;\n }\n }\n\n public int Get(int x)\n {\n x += mas.Length >> 1;\n int ans = int.MinValue;\n while (x > 0)\n {\n ans = Math.Max(mas[x], ans);\n x >>= 1;\n }\n return ans;\n }\n\n public void Update(int i, int x)\n {\n i += v_min.Length >> 1;\n v_min[i] = x;\n v_max[i] = x;\n i >>= 1;\n while (i > 0)\n {\n v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);\n v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);\n i >>= 1;\n }\n }\n }\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n class Graph\n {\n public List> g = new List>();\n public List e = new List();\n public Stack s;\n public List u;\n public List d; //\u0434\u043b\u0438\u043d\u0430\n public List p; //\u043f\u0443\u0442\u044c\n public Queue q;\n public int n;\n public int start;\n public int finish;\n public Graph(int n)\n {\n for (int i = 0; i <= n; i++)\n g.Add(new List());\n p = new List();\n d = new List();\n for (int i = 0; i <= n; i++)\n p.Add(-1);\n for (int i = 0; i <= n; i++)\n d.Add(-1);\n u = new List();\n for (int i = 0; i <= n; i++)\n u.Add(true);\n this.n = n;\n }\n\n public bool dfs1(int v)\n {\n u[v] = false;\n for (int i = 0; i < g[v].Count; i++)\n {\n if (u[g[v][i]])\n {\n p[g[v][i]] = v;\n if (dfs1(g[v][i])) return true;\n }\n else\n {\n if (p[v] != g[v][i])\n {\n start = v;\n finish = g[v][i];\n return true;\n }\n }\n }\n return false;\n }\n\n public void dfs2(int v)\n {\n s = new Stack();\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (d[g[cur][i]] == -1)\n {\n s.Push(g[cur][i]);\n d[g[cur][i]] = d[cur] + 1;\n all = false;\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void DFS(int v)\n {\n s = new Stack();\n\n s.Push(v);\n int cur;\n bool all;\n while (s.Count != 0)\n {\n cur = s.Peek();\n u[cur] = false;\n all = true;\n for (int i = 0; i < g[cur].Count; i++)\n {\n if (u[g[cur][i]])\n {\n all = false;\n p[g[cur][i]] = cur;\n s.Push(g[cur][i]);\n }\n else\n {\n if (p[cur] != g[cur][i])\n {\n start = cur;\n finish = g[cur][i];\n return;\n }\n }\n }\n if (all)\n s.Pop();\n }\n }\n\n public void BFS(params int[] v)\n {\n q = new Queue();\n u = new List();\n d = new List();\n p = new List();\n\n for (int i = 0; i <= n; i++)\n {\n u.Add(true);\n d.Add(0);\n p.Add(0);\n }\n\n q.Enqueue(v[0]);\n u[v[0]] = false;\n int cur;\n\n while (q.Count != 0)\n {\n cur = q.Dequeue();\n for (int i = 0; i < g[cur].Count; i++)\n if (u[g[cur][i]])\n {\n q.Enqueue(g[cur][i]);\n u[g[cur][i]] = false;\n p[g[cur][i]] = cur;\n d[g[cur][i]] = d[cur] + 1;\n }\n }\n\n int from = v[1];\n string path = from + \"\";\n while (p[from] != 0)\n {\n path = p[from] + \" \" + path;\n from = p[from];\n }\n Console.WriteLine(d[v[1]] + \" : \" + path);\n }\n\n public void FordBellman(params int[] v)\n {\n d = new List();\n p = new List();\n for (int i = 0; i <= n; i++)\n {\n d.Add(int.MaxValue);\n p.Add(0);\n }\n d[v[0]] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < e.Count; j++)\n {\n if (d[e[j].a] != int.MaxValue)\n {\n if (d[e[j].a] + e[j].w < d[e[j].b])\n {\n d[e[j].b] = d[e[j].a] + e[j].w;\n p[e[j].b] = e[j].a;\n }\n }\n }\n }\n\n int from = v[1];\n\n if (d[from] == int.MaxValue)\n {\n Console.WriteLine(\"Can't find the minimal path\");\n return;\n }\n\n string ans = from + \"\";\n while (p[from] != 0)\n {\n ans = p[from] + \" \" + ans;\n from = p[from];\n }\n\n Console.WriteLine(d[v[1]] + \" : \" + ans);\n }\n }\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}], "src_uid": "8f1211b995f35462ae83b2be27f54585"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static int N,equal;\n static string board;\n static List position = new List();\n\n\n static void Main(string[] args)\n {\n N = Convert.ToInt32(Console.ReadLine());\n board = Console.ReadLine();\n\n\n for (int i = 0; i < board.Length; ++i)\n if (board[i] == '*')\n position.Add(i+1);\n\n\n for(int a=0; a= n)\n {\n break;\n }\n }\n\n if (count >= 5)\n {\n break;\n }\n }\n if (count >= 5)\n {\n break;\n }\n }\n\n if (count >= 5)\n {\n Console.WriteLine(\"yes\");\n }\n else\n Console.WriteLine(\"no\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\nnamespace AKingofThieves\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n string sc = Console.ReadLine(); \n bool[] b = new bool[N];\n for (int i = 0; i < N; i++)\n {\n b[i] = sc[i] == '*';\n }\n\n\n if (SpaceP(b, N - 1))\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n \n }\n\n public static bool Spacesi(bool[] b,int count,int N,int ind,int paso,int indini)\n {\n if (count==4)\n {\n return true;\n }\n if (ind>N-paso)\n {\n return false;\n }\n \n \n if (b[ind] && b[ind + paso])\n {\n count++;\n return Spacesi(b, count, N, ind + paso, paso,indini);\n }\n else\n {\n \n return Spacesi(b, 0, N,indini, paso + 1,indini);\n }\n }\n\n public static bool SpaceP(bool[] b, int N)\n {\n for (int i = 0; i < N; i++)\n {\n if (b[i])\n {\n if (Spacesi(b, 0, N, i, 1, i))\n {\n return true;\n } \n }\n }\n return false;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n class pereche {\n public int x;\n public int y;\n public pereche(int x, int y) {\n this.x = x;\n this.y = y;\n }\n }\n static void Main(string[] args) {\n\n //Console.SetIn(new StreamReader(\"file.in\"));\n /*\n FileStream filestream = new FileStream(\"out.txt\", FileMode.Create);\n var streamwriter = new StreamWriter(filestream);\n streamwriter.AutoFlush = true;\n Console.SetOut(streamwriter);\n */\n\n int n = int.Parse(Console.ReadLine());\n char[] v = Console.ReadLine().ToCharArray();\n bool ans = false;\n for (int i = 0; i < n; i++) {\n if (v[i] == '*') {\n for (int j = i + 1; j < n; j++) {\n if (v[j] == '*') {\n int diff = j - i, p3 = j + diff, p4 = p3 + diff, p5 = p4 + diff;\n if (p5 < n && v[p3] == '*' && v[p4] == '*' && v[p5] == '*') {\n ans = true;\n }\n }\n }\n }\n }\n Console.Write(\"{0}\", (ans) ? \"yes\" : \"no\");\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace RussianCodeCup\n{\n class Program\n {\n static void Main(string[] args)\n {\n string tokens = Console.ReadLine();//.Split(' ');\n// int m, a;\n int n = int.Parse(tokens);\n// int m = int.Parse(tokens[1]);\n// int a = int.Parse(tokens[2]);\n string srt = Console.ReadLine();\n int s = n/4;\n bool flag = false;\n for (int i = 1; i <= s; i++)\n {\n// int st = 1;\n if (Solve(i, srt))\n {\n flag = true;\n }\n }\n\n if (flag)\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n }\n\n static public bool Solve(int step , string str)\n {\n int count = 0;\n int dl = str.Length - step*4;\n bool flag = false;\n for (int j = 0; j < dl; j++)\n {\n count = 0;\n for (int i = j; i < str.Length; i += step)\n {\n if (str[i] == '*')\n {\n count++;\n }\n else\n {\n count = 0;\n }\n if (count>=5)\n {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace zepto\n{\n class Program\n {\n \n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string ans = \"no\";\n string s = Console.ReadLine();\n\n for (int i = 0; i < n; i++)\n {\n for (int jump = 1; jump < n; jump++)\n {\n bool f = true;\n for (int j = 0; j < 5; j++)\n {\n int a = i + j*jump;\n if (a >= n || s[a] != '*')\n {\n f = false;\n break;\n }\n }\n\n if (!f) continue;\n ans = \"yes\"; break;\n }\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n reader.ReadLine();\n string s = reader.ReadLine();\n bool ans = false;\n for(int i = 0; !ans && i < n; i++) {\n if(s[i] == '.')\n continue;\n for(int d = i - 1; !ans && d > 0; d--) {\n ans = i - d >= 0 && s[i - d] == '*' && i - 2 * d >= 0 && s[i - 2 * d] == '*' && i - 3 * d >= 0 && s[i - 3 * d] == '*' && i - 4 * d >= 0 && s[i - 4 * d] == '*';\n }\n }\n writer.Write(ans ? \"yes\" : \"no\");\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n string s = ReadToken();\n for (int i = 1; i * 4 < n; i++)\n for (int j = 0; j + 4 * i < n; j++)\n {\n bool f = true;\n for (int k = 0; k < 5; k++)\n if (s[j + k * i] == '.')\n f = false;\n if (f)\n {\n Write(\"yes\");\n return;\n }\n }\n Write(\"no\");\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"cycle.in\");\n //writer = new StreamWriter(\"cycle.out\");\n#endif\n try\n {\n// var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n// thread.Start();\n// thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);}\n public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine());return currentLineTokens.Dequeue();}\n public static int ReadInt(){return int.Parse(ReadToken());}\n public static long ReadLong(){return long.Parse(ReadToken());}\n public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}\n public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}\n public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}\n public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}\n public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}\n public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}\n public static void WriteArray(IEnumerable array){writer.WriteLine(string.Join(\" \", array));}\n public static void Write(params object[] array){WriteArray(array);}\n public static void WriteLines(IEnumerable array){foreach (var a in array)writer.WriteLine(a);}\n private class SDictionary : Dictionary{public new TValue this[TKey key]{\n get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}\n private static T[] Init(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Concurrent;\nusing System.Linq;\nusing System.Collections.Specialized;\nusing System.Collections;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main() {\n int n = ReadNumber();\n string map = Console.ReadLine();\n for (int i = 0; i < n - 4; i++) {\n for (int j = 1; j < n; j++) {\n bool suc = true;\n for (int k = 0; k < 5; k++) {\n if (i + k * j >= n || map[i + k * j] == '.')\n suc = false;\n }\n if (suc) {\n Console.WriteLine(\"yes\");\n return;\n }\n }\n }\n Console.WriteLine(\"no\");\n }\n\n static int ReadNumber() {\n return int.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntNumbers() {\n string s = Console.ReadLine();\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] output = new int[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = int.Parse(sa[i]);\n }\n return output;\n }\n\n static double[] ReadDoubleNumbers() {\n string s = Console.ReadLine().Replace('.',',');\n string[] sa = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] output = new double[sa.Length];\n for (int i = 0; i < sa.Length; i++) {\n output[i] = double.Parse(sa[i]);\n }\n return output;\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A526{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int n = int.Parse(Console.ReadLine());\n string level = Console.ReadLine();\n int currentLength = 1;\n\n while (currentLength * 4 < level.Length)\n {\n for(int i = 0; i < level.Length; i++)\n {\n try\n {\n if (level[i + currentLength * 0] == '*'\n && level[i + currentLength * 1] == '*'\n && level[i + currentLength * 2] == '*'\n && level[i + currentLength * 3] == '*'\n && level[i + currentLength * 4] == '*')\n {\n Console.WriteLine(\"yes\");\n return;\n }\n } catch\n {\n break;\n }\n }\n currentLength++;\n }\n Console.WriteLine(\"no\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\n\nnamespace CodeRushA\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string line = Console.ReadLine();\n\n for (int j = 1; j <= n - 1; ++j)\n {\n for (int i = 0; i < n; ++i)\n {\n if (line[i] == '*' && i + j < n && line[i + j] == '*' && i + j + j < n && line[i + j + j] == '*' && i + j + j + j < n && line[i + j + j + j] == '*' && i + j + j + j + j < n && line[i + j + j + j + j] == '*')\n {\n Console.WriteLine(\"yes\");\n return;\n }\n }\n }\n Console.WriteLine(\"no\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _526A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n\n Console.WriteLine(Enumerable.Range(1, n).Any(d => Enumerable.Range(0, d).Any(r => string.Concat(Enumerable.Range(0, n).Where(i => i % d == r).Select(i => s[i])).Contains(\"*****\"))) ? \"yes\" : \"no\");\n }\n }\n}"}, {"source_code": "using System;\n\npublic class KingOfThieves\n{\n\n\tstatic public void Print(int n,int s,int k,int d)\n\t{\n\t\tstring markers=\"\";\n\t\tfor(int i=0;i100){Console.WriteLine(\"no\"); return;}\n\t\n\t/*\tRandom r = new Random (Guid.NewGuid().ToByteArray()[0]);\n\t\tfor(int t=0;t<100;++t)\n\t\t{\n\t\t\n\t\tint M=5+r.Next()%15;\n\t\tstring input=\"\";\n\t\tfor(int m=0;m0)?\"*\":\".\";\n*/\n\n\t\tstring input=Console.ReadLine();\n\n\t\tif(n!=input.Length){Console.WriteLine(\"no\"); return;}\n\t\tbool end=false;\n\t\tfor(int d=n/4;d>=1 && !end;--d)\n\t\t{\n\t\t\tfor(int s=0;s platPos = new List();\n\n for(int i = 0; i < seg; i++) {\n char segType = (char)Console.Read();\n if(segType == '*') {\n platPos.Add(i);\n }\n segments[i] = segType;\n }\n\n if(platPos.Count < 5) {\n Console.WriteLine(\"no\");\n return;\n }\n\n bool isPossible = false;\n for(int i = 0, startPlat = platPos[i]; i < platPos.Count - 4; startPlat = platPos[++i]) {\n for(int jump = 1; startPlat + jump < seg; jump++) {\n int count = 1;\n //Console.WriteLine(\"Jumplength = \" + jump);\n for(int j = 1; startPlat + j*jump < seg; j++) { //index through segments by jump length from given platform\n //Console.WriteLine(\"Jumped to pos \" + (startPlat + j * jump) + \" found \" + segments[startPlat + j * jump]);\n if(segments[startPlat + j*jump] == '*') {\n count++;\n } else {\n j = seg;\n }\n }\n if(count >= 5) {\n isPossible = true;\n jump = seg;\n i = platPos.Count - 4;\n }\n }\n }\n\n if(isPossible) {\n Console.WriteLine(\"yes\");\n } else {\n Console.WriteLine(\"no\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ZeptoLab_Code_Rush_2015\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n int l = 0, kol = 0;\n bool f = false;\n for (int i = 0; i < s.Length; i++)\n {\n kol = 0;\n l++;\n for (int j = 0; j < s.Length; j++)\n {\n \n kol = 0;\n if (s[j] == '*')\n {\n for (int k = j; k < s.Length; k += l)\n {\n\n if (s[k]=='*') kol++;\n else kol = 0;\n if (kol == 5)\n {\n f = true;\n break;\n }\n }\n\n if (f)\n {\n break;\n }\n }\n }\n }\n\n if (f)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Zad_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt16(Console.ReadLine());\n string s = Console.ReadLine();\n bool f = false;\n for (int i = 0; i < a - 3; i++)\n {\n if (s[i] == '*')\n {\n for (int j = 1; j < a; j++)\n {\n if (i + j < a && i + 2 * j < a && i + 3 * j < a && i + 4 * j < a && s[i + j] == '*' && s[i + 2 * j] == '*' && s[i + 3 * j] == '*' && s[i + 4 * j] == '*')\n {\n f = true;\n break;\n }\n }\n }\n if (f) break;\n }\n\n if (f) Console.WriteLine(\"yes\");\n else Console.WriteLine(\"no\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = ReadInt();\n string level = Console.ReadLine();\n int pos = PosFirstPlatform(level), jumps = 0, count = 0;\n if (pos < 0)\n {\n Console.WriteLine(\"no\");\n return;\n }\n for (int i = pos; i < n; i++)\n {\n if (level[i] == '.')\n continue;\n jumps = 0;\n while (jumps < n - i)\n {\n jumps++;\n for (int j = i; j < n; j += jumps)\n {\n if (level[j] == '*')\n count++;\n else\n {\n if (count >= 5)\n break;\n count = 0;\n break;\n }\n }\n if (count >= 5)\n {\n Console.WriteLine(\"yes\");\n return;\n }\n count = 0;\n } \n } \n Console.WriteLine(\"no\"); \n }\n public static int PosFirstPlatform(string elem)\n {\n for (int i = 0; i < elem.Length; i++)\n {\n if (elem[i] == '*')\n return i;\n }\n return -1;\n }\n public static void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n public static int[] ReadListIntegers()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n public static long[] ReadListLongs()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n }\n public static string[] ReadArrayStrings()\n {\n return Console.ReadLine().Split(' ');\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Codeforces\n{\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var n = ReadInt();\n var s = reader.ReadLine().ToCharArray();\n Array.Resize(ref s, 1000);\n for (int i = 0; i < n; i++)\n {\n if (s[i] != '*')\n {\n continue;\n }\n for (int k = 1; k < n; k++)\n {\n if (s[i + k] == '*' && s[i + 2 * k] == '*' && s[i + 3 * k] == '*' && s[i + 4 * k] == '*')\n {\n writer.WriteLine(\"YES\");\n reader.Close();\n writer.Close();\n return;\n }\n }\n }\n writer.WriteLine(\"NO\");\n reader.Close();\n writer.Close();\n }\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Codeforces\n{\n class \u0410\n {\n private static ThreadStart s_threadStart = new \u0410().Go;\n private static bool s_time = false;\n private static double s_eps = 1e-16;\n\n private void Go()\n {\n int n = GetInt();\n string s = GetString();\n\n for (int i = 0; i < n; i++)\n {\n for (int j = i + 1; j < n; j++)\n {\n int diff = j - i;\n bool ok = true;\n for (int k = 0; k < 5; k++)\n {\n int pos = i + k*diff;\n if(pos >= n || s[pos]=='.')\n {\n ok = false;\n break;\n }\n }\n\n if (ok)\n {\n Wl(\"yes\");\n return;\n }\n }\n }\n\n Wl(\"no\");\n }\n\n #region Template\n\n public static void Main(string[] args)\n {\n System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();\n Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);\n timer.Start();\n main.Start();\n main.Join();\n timer.Stop();\n if (s_time)\n Wl(timer.ElapsedMilliseconds);\n }\n\n private static IEnumerator ioEnum;\n private static string GetString()\n {\n while (ioEnum == null || !ioEnum.MoveNext())\n {\n ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();\n }\n\n return ioEnum.Current;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static long GetLong()\n {\n return long.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static double GetDouble()\n {\n return double.Parse(GetString(), CultureInfo.InvariantCulture);\n }\n\n private static List GetIntArr(int n)\n {\n List ret = new List(n);\n for (int i = 0; i < n; i++)\n {\n ret.Add(GetInt());\n }\n return ret;\n }\n\n private static void Wl(T o)\n {\n if (o is double)\n {\n Wld((o as double?).Value, \"\");\n }\n else if (o is float)\n {\n Wld((o as float?).Value, \"\");\n }\n else\n Console.WriteLine(o.ToString());\n }\n\n private static void Wl(IEnumerable enumerable)\n {\n Wl(string.Join(\" \", enumerable.Select(e => e.ToString()).ToArray()));\n }\n\n private static void Wld(double d, string format)\n {\n Wl(d.ToString(format, CultureInfo.InvariantCulture));\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string str = Console.ReadLine();\n int t = 1, ind = 0, j = 0;\n bool y = true;\n\n while (ind + (t * 4) < n && y)\n {\n if (str[j] == '*')\n {\n ind = j;\n for (int i = ind; ind + (t * 4) < n; )\n {\n if (str[i] == '*' && str[i + t] == '*' && str[i + (t * 2)] == '*'\n && str[i + (t * 3)] == '*' && str[i + (t * 4)] == '*')\n { Console.WriteLine(\"yes\"); y = false; break; }\n else\n { t++; i = ind; }\n }\n }\n t = 1;\n j++;\n if (j >= n)\n break;\n }\n if (y)\n Console.WriteLine(\"no\");\n }\n }\n}"}, {"source_code": "\ufeff// Submitted by Stratholme @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF526_ZeptoCodeRush2015_A\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, i, j, d;\n\t\t\tbool ans = false;\n\t\t\tstring s;\n\n\t\t\tN = xoi.ReadInt();\n\t\t\ts = xoi.ReadString();\n\n\t\t\tfor (i = 0; i < N && !ans; i++)\n\t\t\t{\n\t\t\t\tif (s[i] == '*')\n\t\t\t\t{\n\t\t\t\t\tfor (j = i + 1; j < N && !ans; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (s[j] == '*')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\td = j - i;\n\t\t\t\t\t\t\tint cnt = 1;\n\t\t\t\t\t\t\tfor (int k = j + d; k < N && cnt < 4; k += d)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (s[k] == '*') cnt++;\n\t\t\t\t\t\t\t\telse break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tans = (cnt == 4);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans ? \"yes\" : \"no\");\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF526_ZeptoCodeRush2015_A()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Reflection;\nusing System.Net.Sockets;\nusing System.Xml;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\n\nstatic class Program\n{\n #region IO\n public delegate ReadDelegate ReadDelegate(out T value);\n public delegate bool ParserDelegate(string word, out T item);\n\n public class Input : IDisposable\n {\n private static EventArgs DefaultEventArgs = new EventArgs();\n\n public TextReader TextReader { get; private set; }\n\n public event EventHandler OnEndOfStream;\n public event EventHandler OnParseError;\n public event EventHandler OnReadError;\n\n public bool CanRead { get; private set; }\n public bool ThrowExceptions { get; set; }\n\n string line = string.Empty;\n int pos = 0;\n\n static EventHandler emptyHandler;\n\n public Input(string path)\n : this(File.OpenRead(path))\n {\n }\n public Input(Stream s)\n : this(new StreamReader(s))\n {\n\n }\n public Input(TextReader tr)\n {\n TextReader = tr;\n\n if (emptyHandler == null)\n emptyHandler = (a, b) => { };\n\n OnEndOfStream = emptyHandler;\n OnParseError = emptyHandler;\n OnReadError = emptyHandler;\n\n CanRead = true;\n }\n\n public static implicit operator Input(Stream s)\n {\n return new Input(s);\n }\n public static implicit operator Input(TextReader tr)\n {\n return new Input(tr);\n }\n\n private bool ReadStream()\n {\n if (!CanRead) return false;\n if (pos < line.Length) return true;\n\n Clear();\n\n string s = TextReader.ReadLine();\n if (s == null)\n {\n CanRead = false;\n return false;\n }\n\n line = s;\n return true;\n }\n\n public ReadDelegate r(out T value)\n {\n value = ReadData();\n return r;\n }\n\n public void SkipChar()\n {\n if (pos < line.Length) pos++;\n else\n {\n ReadStream();\n }\n }\n public void SkipChars(int length)\n {\n while (length > 0)\n {\n int dt = line.Length - pos;\n if (dt <= 0)\n {\n length--;\n if (!ReadStream()) return;\n }\n dt = Math.Min(length, dt);\n pos += dt;\n length -= dt;\n }\n }\n\n public void SkipWhiteSpace()\n {\n while (true)\n {\n for (; pos < line.Length; pos++)\n {\n if (!char.IsWhiteSpace(line[pos])) return;\n }\n if (!ReadStream())\n {\n OnEndOfStream(this, DefaultEventArgs);\n return;\n }\n }\n }\n public bool CanReadData()\n {\n SkipWhiteSpace();\n return CanRead;\n }\n\n public T[] ReadArray()\n {\n int length = ReadInt32();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(ParserDelegate parser)\n {\n int length = ReadInt32();\n return ReadArray(length, parser);\n }\n public T[] ReadArray(int length, ParserDelegate parser)\n {\n T[] res = new T[length];\n for (int i = 0; i < length; i++)\n {\n res[i] = ReadData(parser);\n }\n return res;\n }\n\n public Decimal ReadDecimal()\n {\n return ReadData(Parser.DecimalParser);\n }\n public Double ReadDouble()\n {\n return ReadData(Parser.DoubleParser);\n }\n public Single ReadSingle()\n {\n return ReadData(Parser.SingleParser);\n }\n public UInt64 ReadUInt64()\n {\n return ReadData(UInt64.TryParse);\n }\n public UInt32 ReadUInt32()\n {\n return ReadData(UInt32.TryParse);\n }\n public UInt16 ReadUInt16()\n {\n return ReadData(UInt16.TryParse);\n }\n public Int64 ReadInt64()\n {\n return ReadData(Int64.TryParse);\n }\n public Int32 ReadInt32()\n {\n return ReadData(Int32.TryParse);\n }\n public Int16 ReadInt16()\n {\n return ReadData(Int16.TryParse);\n }\n public Boolean ReadYesNo()\n {\n return ReadData(Parser.YesNoParser);\n }\n public Boolean ReadBoolean()\n {\n return ReadData(Boolean.TryParse);\n }\n public Byte ReadByte()\n {\n return ReadData(Byte.TryParse);\n }\n\n private bool ReadCheck()\n {\n if (!CanRead)\n {\n OnReadError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!CanRead\");\n }\n return false;\n }\n return true;\n }\n public T ReadData()\n {\n return ReadData(true);\n }\n public T ReadData(bool skipWhiteSpace)\n {\n ParserDelegate parser = Parser.GetPrimitiveParser();\n return ReadData(parser, skipWhiteSpace);\n }\n public T ReadData(ParserDelegate parser)\n {\n return ReadData(parser, true);\n }\n public T ReadData(ParserDelegate parser, bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return default(T);\n\n string s = ReadWord(false);\n\n T res;\n if (!parser.Invoke(s, out res))\n {\n OnParseError(this, DefaultEventArgs);\n if (ThrowExceptions)\n {\n throw new Exception(\"!validate, word = \" + Output.ToString(s, 256));\n }\n }\n return res;\n }\n\n public string ReadWord()\n {\n return ReadWord(true);\n }\n public string ReadWord(bool skipWhiteSpace)\n {\n if (skipWhiteSpace)\n SkipWhiteSpace();\n\n if (!ReadCheck()) return string.Empty;\n\n int from = pos;\n int to = pos;\n for (int i = pos; i < line.Length; i++)\n {\n if (char.IsWhiteSpace(line[i])) break;\n to = i + 1;\n }\n pos = to;\n\n return line.Substring(from, to - from);\n }\n\n public string ReadLine()\n {\n if (!ReadCheck()) return string.Empty;\n\n ReadStream();\n string res = line.Substring(pos);\n pos = line.Length;\n\n return res;\n }\n\n public void Close()\n {\n TextReader.Close();\n }\n public void Clear()\n {\n pos = 0;\n line = string.Empty;\n }\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n line = string.Empty;\n TextReader.Dispose();\n }\n disposed = true;\n }\n }\n ~Input()\n {\n Dispose(false);\n }\n }\n public class Output : IDisposable\n {\n static char[] space = new char[] { ' ' };\n\n public TextWriter TextWriter { get; private set; }\n public bool AutoFlush { get; set; }\n\n\n public static string ToString(object obj, int maxLength)\n {\n return ToString(FormatReal(obj), maxLength);\n }\n public static string ToString(string s, int maxLength)\n {\n if (s.Length <= maxLength) return s;\n else return s.Substring(0, maxLength) + \"...\";\n }\n public static object FormatReal(object v, string format)\n {\n if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');\n if (v is double) return ((double)v).ToString(format).Replace(',', '.');\n if (v is float) return ((float)v).ToString(format).Replace(',', '.');\n\n return v;\n }\n public static object FormatReal(object v)\n {\n if (v is decimal || v is double || v is float)\n {\n return v.ToString().Replace(',', '.');\n }\n return v;\n }\n\n public Output()\n : this(new MemoryStream())\n {\n }\n public Output(string path)\n : this(File.Create(path))\n {\n\n }\n public Output(Stream s)\n : this(new StreamWriter(s))\n {\n }\n public Output(TextWriter tw)\n {\n TextWriter = tw;\n }\n\n public static implicit operator Output(Stream s)\n {\n return new Output(s);\n }\n\n public static implicit operator Output(TextWriter tw)\n {\n return new Output(tw);\n }\n\n public static Output operator +(Output output, object obj)\n {\n output.Write(obj);\n return output;\n }\n public Output WriteArray(params T[] array)\n {\n return WriteArray(array, false);\n }\n public Output WriteArray(T[] array, bool appendLength)\n {\n return WriteArray(array, 0, array.Length, appendLength);\n }\n public Output WriteArray(T[] array, int index, int count)\n {\n return WriteArray(array, index, count, false);\n }\n public Output WriteArray(T[] array, int index, int count, bool appendLength)\n {\n if (index + count > array.Length)\n {\n string message = string.Format(\n \"Index out of range: {0} + {1} >= {2}\",\n index,\n count,\n array.Length);\n throw new Exception(message);\n }\n if (appendLength)\n {\n WriteLine(count);\n }\n for (int i = 0; i < count; i++)\n {\n Write(array[i + index]);\n Write(space, 0, space.Length);\n }\n WriteLine();\n\n return this;\n }\n public Output WriteLine(object obj)\n {\n obj = FormatReal(obj);\n return WriteLine(obj.ToString());\n }\n public Output WriteLine(string format, params object[] args)\n {\n return WriteLine(string.Format(format, args));\n }\n public Output WriteLine(string s)\n {\n return WriteLine(s.ToCharArray());\n }\n public Output WriteLine(char[] buffer)\n {\n return WriteLine(buffer, 0, buffer.Length);\n }\n public Output WriteLine(char[] buffer, int index, int count)\n {\n TextWriter.WriteLine(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output WriteLine()\n {\n TextWriter.WriteLine();\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n public Output Write(object obj)\n {\n obj = FormatReal(obj);\n return Write(obj.ToString());\n }\n public Output Write(string format, params object[] args)\n {\n return Write(string.Format(format, args));\n }\n public Output Write(string s)\n {\n return Write(s.ToCharArray());\n }\n public Output Write(char[] buffer)\n {\n return Write(buffer, 0, buffer.Length);\n }\n public Output Write(char[] buffer, int index, int count)\n {\n TextWriter.Write(buffer, index, count);\n if (AutoFlush) TextWriter.Flush();\n return this;\n }\n\n public void Close()\n {\n TextWriter.Close();\n }\n public void Flush()\n {\n TextWriter.Flush();\n }\n\n\n private bool disposed = false;\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n protected virtual void Dispose(bool disposing)\n {\n if (!this.disposed)\n {\n if (disposing)\n {\n TextWriter.Dispose();\n }\n disposed = true;\n }\n }\n ~Output()\n {\n Dispose(false);\n }\n }\n public static class Parser\n {\n public static ParserDelegate GetPrimitiveParser()\n {\n if (!typeof(T).IsPrimitive && typeof(T) != typeof(String)) throw new Exception(\"Unknown type\");\n else if (default(T) is Byte) return new ParserDelegate(Byte.TryParse) as ParserDelegate;\n else if (default(T) is Boolean) return new ParserDelegate(Boolean.TryParse) as ParserDelegate;\n else if (default(T) is Int16) return new ParserDelegate(Int16.TryParse) as ParserDelegate;\n else if (default(T) is Int32) return new ParserDelegate(Int32.TryParse) as ParserDelegate;\n else if (default(T) is Int64) return new ParserDelegate(Int64.TryParse) as ParserDelegate;\n else if (default(T) is UInt16) return new ParserDelegate(UInt16.TryParse) as ParserDelegate;\n else if (default(T) is UInt32) return new ParserDelegate(UInt32.TryParse) as ParserDelegate;\n else if (default(T) is UInt64) return new ParserDelegate(UInt64.TryParse) as ParserDelegate;\n else if (default(T) is Single) return new ParserDelegate(Parser.SingleParser) as ParserDelegate;\n else if (default(T) is Double) return new ParserDelegate(Parser.DoubleParser) as ParserDelegate;\n else if (default(T) is Decimal) return new ParserDelegate(Parser.DecimalParser) as ParserDelegate;\n else if (typeof(T) == typeof(String)) return new ParserDelegate(Parser.StringParser) as ParserDelegate;\n else throw new Exception(\"Unknown type\");\n }\n public static bool YesNoParser(string s, out Boolean result)\n {\n s = s.ToLower();\n if (s == \"yes\") result = true;\n else if (s == \"no\") result = false;\n else\n {\n result = false;\n return false;\n }\n return true;\n }\n public static bool ReplaceDot;\n public static bool StringParser(string s, out string result)\n {\n result = s;\n return string.IsNullOrEmpty(s);\n }\n private static string fs(string s)\n {\n if (ReplaceDot) return s.Replace(',', '.');\n else return s;\n }\n public static bool DecimalParser(string s, out Decimal result)\n {\n return Decimal.TryParse(fs(s), out result);\n }\n public static bool DoubleParser(string s, out Double result)\n {\n return Double.TryParse(fs(s), out result);\n }\n public static bool SingleParser(string s, out Single result)\n {\n return Single.TryParse(fs(s), out result);\n }\n }\n #endregion\n #region Streams\n static string endl = Environment.NewLine;\n static Input cin = new Input(Console.In);\n static Output cout = new Output(Console.Out);\n static Output cerr = new Output(Console.Error);\n static StringBuilder sb = new StringBuilder();\n #endregion\n #region Time\n //*\n static Stopwatch sw = new Stopwatch();\n static void Start()\n {\n sw.Reset();\n sw.Start();\n }\n static void Restart(string text = \"\")\n {\n Stop(text);\n Start();\n }\n static void Time(string text = \"\")\n {\n if (string.IsNullOrEmpty(text))\n {\n cerr.WriteLine(sw.Elapsed);\n }\n else\n {\n cerr.WriteLine(text + \": \" + sw.Elapsed);\n }\n }\n static void Stop(string text = \"\")\n {\n sw.Stop();\n Time(text);\n }\n //*/\n #endregion\n\n static void InitIO(string name)\n {\n#if DEBUG\n#else\n cin = new Input(name + \".in\");\n cout = new Output(name + \".out\");\n Parser.ReplaceDot = false;\n#endif\n }\n\n static void Main()\n {\n var n = cin.ReadInt32();\n var s = cin.ReadLine();\n\n bool res = false;\n for(var i = 0; i < n && !res; i++)\n {\n if (s[i] == '.') continue;\n for(var j = 1; j < n && !res; j++)\n {\n bool r = true;\n for(var t = 1; t <= 4; t++)\n {\n var x = i + t * j;\n if (x >= n || s[x] != '*')\n {\n r = false;\n break;\n }\n }\n res |= r;\n }\n }\n\n cout.WriteLine(res ? \"yes\" : \"no\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic int Second;\n\n\t\t\tpublic int Third;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List> Graph = new List>();\n\n/*\t\tpublic static bool Dfs(int x, int y, int prevx, int prevy)\n\t\t{\n\t\t\tGraph[x][y].Was = 1;\n\t\t\tvar result = false;\n\t\t\tforeach (var t in Graph[x][y].Edges)\n\t\t\t{\n\t\t\t\tif (Graph[t.First][t.Second].Was == 0)\n\t\t\t\t\tresult |= Dfs(t.First, t.Second, x, y);\n\t\t\t\telse if (t.First != prevx || t.Second != prevy)\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}*/\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar n = ReadInt();\n\t\t\tvar s = ReadString();\n\t\t\tvar good = false;\n\t\t\tfor (var j = 1; j <= n; ++j)\n\t\t\t{\n\t\t\t\tfor (var i = 0; i < n; ++i)\n\t\t\t\t{\n\t\t\t\t\tif (s[i] == '*' && (i + j < n && s[i + j] == '*') && (i + 2 * j < n && s[i + 2 * j] == '*') &&\n\t\t\t\t\t (i + 3 * j < n && s[i + 3 * j] == '*') && (i + 4 * j < n && s[i + 4 * j] == '*'))\n\t\t\t\t\t\tgood = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tWriteYesNo(good, \"yes\", \"no\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace zepto_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n char[] lvl_char = Console.ReadLine().ToCharArray();\n int[] lvl = new int[lvl_char.Length];\n for(int i = 0; i= n)\n break;\n var f = true;\n for (int i = 0; i < 5; i++)\n if (s[k + i * l] == '.') f = false;\n if (f)\n {\n IO.Printer.Out.WriteLine(\"yes\");\n return;\n }\n \n }\n }\n IO.Printer.Out.WriteLine(\"no\");\n }\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n\n\n }\n}\n\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != '-' && (b < '0' || '9' < b));\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace TaskA\n{\n class Program\n {\n static void Main()\n {\n List inputs = Console.In.ReadToEnd().Split(new[] { ' ', '\\n', '\\r', '\\t' }, StringSplitOptions.RemoveEmptyEntries).ToArray().Skip(1).ToList()[0].ToCharArray().ToList();\n string answer = CheckLevel(inputs);\n Console.WriteLine(answer);\n }\n\n static string CheckLevel(List areas)\n {\n List goodAreas = new List();\n\n for (int i = 0; i < areas.Count; i++)\n {\n if (areas[i] == '*')\n {\n goodAreas.Add(i);\n }\n }\n\n for (int i = 0; i < goodAreas.Count; i++)\n {\n for (int j = i + 1; j < goodAreas.Count; j++)\n {\n int diff = goodAreas[j] - goodAreas[i];\n int kGood = 1;\n int p = j;\n for (int k = j + 1; k < goodAreas.Count; k++)\n {\n int newDiff = goodAreas[k] - goodAreas[p];\n if (newDiff < diff)\n {\n continue;\n }\n if (newDiff > diff)\n {\n break;\n }\n kGood++;\n if (kGood == 4)\n {\n return \"YES\";\n }\n p = k;\n }\n }\n }\n\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace KingOfThieves\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar input = args.Length == 0 ? new Input() : new Input(args[0]);\n\n\t\t\tvar n = int.Parse(input.ReadLine());\n\t\t\tvar items = new List(n);\n\t\t\titems.AddRange(input.ReadLine().Select(c => c == '*'));\n\n\t\t\tfor (var i = 0; i < n - 4; i++)\n\t\t\t{\n\t\t\t\tif (items[i])\n\t\t\t\t{\n\t\t\t\t\tfor (var j = i + 4; j < n; j += 4)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (items[j])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar step = (j - i)/4;\n\t\t\t\t\t\t\tif (items[i + step] && items[j - step] && items[i + 2*step])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tConsole.WriteLine(\"yes\");\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"no\");\n\t\t}\n\n\t\tprivate class Input\n\t\t{\n\t\t\tprivate readonly StreamReader _reader;\n\n\t\t\tpublic Input()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic Input(string fileName)\n\t\t\t{\n\t\t\t\t_reader = new StreamReader(fileName);\n\t\t\t}\n\n\t\t\tpublic string ReadLine()\n\t\t\t{\n\t\t\t\tvar line = _reader == null ? Console.ReadLine() : _reader.ReadLine();\n\t\t\t\tConsole.Error.WriteLine(line);\n\t\t\t\treturn line;\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string level = Console.ReadLine();\n bool check = false;\n for (int i = 1; i <= n/4; i++)\n {\n for (int j = 0; j < n-(i*4); j++)\n {\n if (level[j]=='.')\n {\n continue;\n }\n check = true;\n int index = j;\n for (int k = 0; k < 4; k++)\n {\n index += i;\n if (level[index]=='.')\n {\n check = false;\n break;\n }\n }\n if (check)\n {\n break;\n }\n }\n if (check)\n {\n Console.WriteLine(\"yes\");\n break;\n }\n }\n if (!check)\n {\n Console.WriteLine(\"no\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace King_of_Thieves\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n reader.ReadLine();\n string s = reader.ReadLine();\n\n bool ok = false;\n for (int i = 0; !ok && i < s.Length; i++)\n {\n if (s[i] == '*')\n {\n for (int j = (s.Length - i - 1)/4; j > 0; j--)\n {\n bool f = true;\n for (int k = 1; k <= 4; k++)\n {\n if (s[i+k*j]!='*')\n {\n f = false;\n break;\n }\n }\n if(f)\n {\n ok = true;\n break;\n }\n }\n }\n }\n\n writer.WriteLine(\"{0}\", ok ? \"yes\" : \"no\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _526A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n bool[] a = new bool[n];\n for (int i = 0; i < n; i++) a[i] = input[i] == '*';\n\n bool result = false;\n for (int i = 0; i < n - 4 && !result; i++)\n {\n for (int step = 1; step < (int)Math.Ceiling(n / 4D); step++)\n {\n int jumps = 0;\n while (jumps <= 4)\n {\n if (i + jumps * step >= n || !a[i + jumps * step])\n break;\n else\n jumps++;\n }\n\n if (jumps == 5)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(result ? \"yes\" : \"no\");\n //Console.ReadLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace zepto\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n string s = Console.ReadLine();\n int e = 0;\n string ans = \"no\";\n int[] ss = new int[10000];\n for (int i = 0, ind = 0; i < n - 1; i++)\n {\n if (s[i] == '*')\n for (int j = i + 1; j < n; j++)\n {\n if (s[j] == '*') { ss[ind] = j - i; ind++; }\n }\n\n }\n\n for (int i = 0; i < ss.Length - 1; i++)\n {\n if (ss[i] != 0)\n for (int j = i + 1; j < ss.Length && ss[j] != 0; j++)\n {\n if (ss[i] == ss[j]) e++;\n }\n if (e + 1 >= 4) { ans = \"yes\"; break; }\n else e = 0;\n }\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n reader.ReadLine();\n string s = reader.ReadLine();\n int[] how = new int[101];\n List pl = new List();\n for(int i = 0; i < s.Length; i++) {\n char c = s[i];\n if(c == '.')\n continue;\n foreach(int i1 in pl) {\n how[i - i1]++;\n }\n pl.Add(i);\n }\n bool ans = false;\n foreach(int i in how) {\n ans = ans || i >= 4;\n }\n writer.Write(ans ? \"yes\" : \"no\");\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n string s = ReadToken();\n for (int i = 1; i * 4 < n; i++)\n for (int j = 0; j + 4 * i < n; j++)\n {\n bool f = true;\n for (int k = 0; k < 4; k++)\n if (s[j + k * i] == '.')\n f = false;\n if (f)\n {\n Write(\"yes\");\n return;\n }\n }\n Write(\"no\");\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"cycle.in\");\n //writer = new StreamWriter(\"cycle.out\");\n#endif\n try\n {\n// var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n// thread.Start();\n// thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);}\n public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine());return currentLineTokens.Dequeue();}\n public static int ReadInt(){return int.Parse(ReadToken());}\n public static long ReadLong(){return long.Parse(ReadToken());}\n public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}\n public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}\n public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}\n public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}\n public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}\n public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}\n public static void WriteArray(IEnumerable array){writer.WriteLine(string.Join(\" \", array));}\n public static void Write(params object[] array){WriteArray(array);}\n public static void WriteLines(IEnumerable array){foreach (var a in array)writer.WriteLine(a);}\n private class SDictionary : Dictionary{public new TValue this[TKey key]{\n get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}\n private static T[] Init(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace A526{\n\tclass Program{\n\t\tstatic void Main(string[] args){\n int n = int.Parse(Console.ReadLine());\n string level = Console.ReadLine();\n int currentLength = 1;\n\n while (currentLength * 3 < level.Length)\n {\n for(int i = 0; i < level.Length; i++)\n {\n try\n {\n if (level[i + currentLength * 0] == '*'\n && level[i + currentLength * 1] == '*'\n && level[i + currentLength * 2] == '*'\n && level[i + currentLength * 3] == '*')\n {\n Console.WriteLine(\"yes\");\n return;\n }\n } catch\n {\n break;\n }\n }\n currentLength++;\n }\n Console.WriteLine(\"no\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = ReadInt();\n string level = Console.ReadLine();\n int pos = PosFirstPlatform(level), jumps = 0, count = 0;\n if (pos < 0)\n {\n Console.WriteLine(\"no\");\n return;\n }\n for (int i = pos; i < n; i++)\n {\n if (level[i] == '.')\n continue;\n if ((n - pos) / 5 < 1)\n {\n Console.WriteLine(\"no\");\n return;\n }\n else\n jumps++;\n for (int j = i; j < n; j+=jumps)\n {\n if (level[j] == '*')\n count++;\n else\n {\n count = 0;\n break;\n }\n }\n if (count >= 5)\n {\n Console.WriteLine(\"yes\");\n return;\n }\n }\n Console.WriteLine(\"no\"); \n }\n public static int PosFirstPlatform(string elem)\n {\n for (int i = 0; i < elem.Length; i++)\n {\n if (elem[i] == '*')\n return i;\n }\n return -1;\n }\n public static void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n public static int[] ReadListIntegers()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n public static long[] ReadListLongs()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n }\n public static string[] ReadArrayStrings()\n {\n return Console.ReadLine().Split(' ');\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\n\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = ReadInt();\n string level = Console.ReadLine();\n int pos = PosFirstPlatform(level), jumps = 0, count = 0;\n if (pos < 0)\n {\n Console.WriteLine(\"no\");\n return;\n }\n for (int i = pos; i < n; i++)\n {\n if (level[i] == '.')\n continue;\n jumps = 0;\n while (jumps < n - i)\n {\n jumps++;\n for (int j = i; j < n; j += jumps)\n {\n if (level[j] == '*')\n count++;\n else\n {\n count = 0;\n break;\n }\n }\n if (count >= 5)\n {\n Console.WriteLine(\"yes\");\n return;\n }\n count = 0;\n } \n } \n Console.WriteLine(\"no\"); \n }\n public static int PosFirstPlatform(string elem)\n {\n for (int i = 0; i < elem.Length; i++)\n {\n if (elem[i] == '*')\n return i;\n }\n return -1;\n }\n public static void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n public static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n public static int[] ReadListIntegers()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n public static long[] ReadListLongs()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n }\n public static string[] ReadArrayStrings()\n {\n return Console.ReadLine().Split(' ');\n }\n }\n}"}, {"source_code": "\ufeff// Submitted by Stratholme @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF526_ZeptoCodeRush2015_A\n\t{\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, i, j, d;\n\t\t\tbool ans = false;\n\t\t\tstring s;\n\n\t\t\tN = xoi.ReadInt();\n\t\t\ts = xoi.ReadString();\n\n\t\t\tfor (i = 0; i < N && !ans; i++ )\n\t\t\t{\n\t\t\t\tif (s[i] == '*')\n\t\t\t\t{\n\t\t\t\t\tfor (j = i + 1; j < N && !ans; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (s[j] == '*')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\td = j - i;\n\t\t\t\t\t\t\tint cnt = 2;\n\t\t\t\t\t\t\tfor (int k = j + d; k < N && cnt < 4; k += d)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (s[k] == '*') cnt++;\n\t\t\t\t\t\t\t\telse break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tans = (cnt == 4);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans ? \"yes\" : \"no\");\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF526_ZeptoCodeRush2015_A()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace zepto_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n char[] lvl_char = Console.ReadLine().ToCharArray();\n int[] lvl = new int[lvl_char.Length];\n for(int i = 0; i Enumerable.Range(0, d).Any(r => string.Concat(Enumerable.Range(0, n).Where(i => i % d == r).Select(i => s[i])).Contains(\"****\"))) ? \"yes\" : \"no\");\n }\n }\n}"}, {"source_code": "using System;\n\npublic class KingOfThieves\n{\n\n\tstatic public void Print(int n,int s,int k,int d)\n\t{\n\t\tstring markers=\"\";\n\t\tfor(int i=0;i100){Console.WriteLine(\"no\"); return;}\n\t\tstring input=Console.ReadLine();\n\n\t\tif(n!=input.Length){Console.WriteLine(\"no\"); return;}\n\n\t\tfor(int d=n/3;d>=1;--d)\n\t\t{\n\t\t\tfor(int s=0;s=1;--d)\n\t\t{\n\t\t\tfor(int s=0;s=1;--d)\n\t\t{\n\t\t\tfor(int s=0;s 0; j--)\n {\n bool f = true;\n for (int k = 0; k < 4; k++)\n {\n if (s[i+k*j]!='*')\n {\n f = false;\n break;\n }\n }\n if(f)\n {\n ok = true;\n break;\n }\n }\n }\n }\n\n writer.WriteLine(\"{0}\", ok ? \"yes\" : \"no\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _526A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string input = Console.ReadLine();\n bool[] a = new bool[n];\n for (int i = 0; i < n; i++) a[i] = input[i] == '*';\n\n bool result = false;\n for (int i = 0; i < n - 4 && !result; i++)\n {\n for (int step = 1; step < (int)Math.Ceiling(n / 4D); step++)\n {\n int jumps = 0;\n while (jumps < 4)\n {\n if (!a[i + jumps * step])\n break;\n else\n jumps++;\n }\n\n if (jumps == 4)\n {\n result = true;\n break;\n }\n }\n }\n\n Console.WriteLine(result ? \"yes\" : \"no\");\n //Console.ReadLine();\n }\n }\n}\n"}], "src_uid": "12d451eb1b401a8f426287c4c6909e4b"} {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n private static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private const int MAXB = 60;\n private int[] factor = new int[MAXB + 1];\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int maxMask = 1 << prime.Length;\n\n for (int i = 1; i <= MAXB; i++)\n {\n int mask = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n {\n mask |= 1 << j;\n }\n }\n factor[i] = mask;\n }\n\n var prev = new int[maxMask];\n var current = new int[maxMask];\n var back = new byte[100, maxMask];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < current.Length; j++)\n current[j] = 100000;\n\n for (byte j = 1; j <= MAXB; j++)\n {\n var goodMask = (~factor[j]) & (maxMask - 1);\n var delta = Math.Abs(a[i] - j);\n for (int old = goodMask; ; old = (old - 1) & goodMask)\n {\n var newMask = old | factor[j];\n var newResult = prev[old] + delta;\n if (newResult < current[newMask])\n {\n current[newMask] = newResult;\n back[i, newMask] = j;\n }\n\n if (old == 0)\n break;\n }\n }\n\n Array.Copy(current, prev, current.Length);\n }\n\n var res = new int[n];\n var cmask = maxMask - 1;\n for (int i = n - 1; i >= 0; i--)\n {\n res[i] = back[i, cmask];\n cmask = cmask & ~factor[res[i]];\n }\n\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n Console.Write(\" \");\n Console.Write(res[i]);\n }\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Little_Pony_and_Harmony_Chest\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static readonly int[] prime = new[] {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n + 1];\n\n for (int i = 1; i <= n; i++)\n {\n nn[i] = Next();\n }\n\n var mask = new int[61];\n for (int i = 0; i < prime.Length; i++)\n {\n int m = 1 << i;\n for (int j = prime[i]; j < mask.Length; j += prime[i])\n {\n mask[j] |= m;\n }\n }\n int mm = 1 << prime.Length;\n var dp = new int[n + 1][];\n var bdp = new int[n + 1][];\n dp[0] = new int[mm];\n for (int j = 0; j < mm; j++)\n {\n dp[0][j] = 100*n;\n }\n dp[0][0] = 0;\n for (int i = 1; i <= n; i++)\n {\n dp[i] = new int[mm];\n for (int j = 0; j < mm; j++)\n {\n dp[i][j] = int.MaxValue;\n }\n bdp[i] = new int[mm];\n\n for (int j = 1; j < mask.Length; j++)\n {\n int submask = ~mask[j] & (mm - 1);\n\n for (int s = submask;; s = (s - 1) & submask)\n {\n if (dp[i][s | mask[j]] > dp[i - 1][s] + Math.Abs(nn[i] - j))\n {\n dp[i][s | mask[j]] = dp[i - 1][s] + Math.Abs(nn[i] - j);\n bdp[i][s | mask[j]] = j;\n }\n\n if (s == 0)\n break;\n }\n }\n }\n\n var ans = new int[n];\n\n int index = 0;\n for (int i = 1; i < mm; i++)\n {\n if (dp[n][i] < dp[n][index])\n index = i;\n }\n\n for (int i = n - 1; i >= 0; i--)\n {\n ans[i] = bdp[i + 1][index];\n index ^= mask[bdp[i + 1][index]];\n }\n\n foreach (int an in ans)\n {\n writer.Write(an);\n writer.Write(' ');\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n private static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private const int MAXB = 60;\n private int[] factor = new int[MAXB + 1];\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int maxMask = 1 << prime.Length;\n\n for (int i = 1; i <= MAXB; i++)\n {\n int mask = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n {\n mask |= 1 << j;\n }\n }\n factor[i] = mask;\n }\n\n var prev = new int[maxMask];\n var current = new int[maxMask];\n var back = new int[100, maxMask];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < current.Length; j++)\n current[j] = 100000;\n\n for (int j = 1; j <= MAXB; j++)\n {\n var goodMask = (~factor[j]) & (maxMask - 1);\n for (int old = goodMask; ; old = (old - 1) & goodMask)\n {\n var newMask = old | factor[j];\n var newResult = prev[old] + Math.Abs(a[i] - j);\n if (newResult < current[newMask])\n {\n current[newMask] = newResult;\n back[i, newMask] = j;\n }\n\n if (old == 0)\n break;\n }\n }\n\n Array.Copy(current, prev, current.Length);\n }\n\n var res = new int[n];\n var cmask = maxMask - 1;\n for (int i = n - 1; i >= 0; i--)\n {\n res[i] = back[i, cmask];\n cmask = cmask & ~factor[res[i]];\n }\n\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n Console.Write(\" \");\n Console.Write(res[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n private static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private const int MAXB = 60;\n private int[] factor = new int[MAXB + 1];\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int maxMask = 1 << prime.Length;\n\n for (int i = 1; i <= MAXB; i++)\n {\n int mask = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n {\n mask |= 1 << j;\n }\n }\n factor[i] = mask;\n }\n\n var prev = new int[maxMask];\n var current = new int[maxMask];\n var back = new short[100, maxMask];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < current.Length; j++)\n current[j] = 100000;\n\n for (short j = 1; j <= MAXB; j++)\n {\n var goodMask = (~factor[j]) & (maxMask - 1);\n var delta = Math.Abs(a[i] - j);\n for (int old = goodMask; ; old = (old - 1) & goodMask)\n {\n var newMask = old | factor[j];\n var newResult = prev[old] + delta;\n if (newResult < current[newMask])\n {\n current[newMask] = newResult;\n back[i, newMask] = j;\n }\n\n if (old == 0)\n break;\n }\n }\n\n Array.Copy(current, prev, current.Length);\n }\n\n var res = new int[n];\n var cmask = maxMask - 1;\n for (int i = n - 1; i >= 0; i--)\n {\n res[i] = back[i, cmask];\n cmask = cmask & ~factor[res[i]];\n }\n\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n Console.Write(\" \");\n Console.Write(res[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n private static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private const int MAXB = 60;\n private int[] factor = new int[MAXB + 1];\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int maxMask = 1 << prime.Length;\n var cmask = maxMask - 1;\n\n for (int i = 1; i <= MAXB; i++)\n {\n int mask = 0;\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n {\n mask |= 1 << j;\n }\n }\n factor[i] = mask;\n }\n\n var prev = new int[maxMask];\n var current = new int[maxMask];\n var back = new byte[100, maxMask];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < current.Length; j++)\n current[j] = 100000;\n\n for (byte j = 1; j <= MAXB; j++)\n {\n var delta = Math.Abs(a[i] - j);\n var factor_j = factor[j];\n for (int old = 0; old < maxMask; old++)\n {\n if ((old & factor_j) != 0)\n continue;\n\n var newMask = old | factor[j];\n var newResult = prev[old] + delta;\n if (newResult < current[newMask])\n {\n current[newMask] = newResult;\n back[i, newMask] = j;\n }\n }\n\n //var goodMask = (~factor[j]) & (maxMask - 1);\n //for (int old = goodMask; ; old = (old - 1) & goodMask)\n //{\n // var newMask = old | factor[j];\n // var newResult = prev[old] + delta;\n // if (newResult < current[newMask])\n // {\n // current[newMask] = newResult;\n // back[i, newMask] = j;\n // }\n\n // if (old == 0)\n // break;\n //}\n }\n\n Array.Copy(current, prev, current.Length);\n }\n\n var res = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n res[i] = back[i, cmask];\n cmask = cmask & ~factor[res[i]];\n }\n\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n Console.Write(\" \");\n Console.Write(res[i]);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var a = sc.Integer(n);\n var prime = Sieve(60);\n var p = new List();\n for (int i = 0; i < 60; i++)\n {\n if (prime[i]) p.Add(i);\n }\n var fac = new int[60];\n for (int i = 1; i < 60; i++)\n {\n var f = 0;\n for (int j = 0; j < p.Count; j++)\n {\n if (i % p[j] == 0) f |= 1 << j;\n }\n fac[i] = f;\n }\n var dp = new int[n + 1, 1 << p.Count];\n for (int i = 0; i <= n; i++)\n for (int j = 0; j < 1 << p.Count; j++)\n dp[i, j] = 1 << 20;\n var prev = new int[n + 1, 1 << p.Count];\n dp[0, 0] = 0;\n for (int i = 0; i < n; i++)\n {\n for (int k = 1; k < 60; k++)\n {\n var x = (~fac[k]) & ((1 << p.Count) - 1);\n for (int s = x; s >= 0; s = (s - 1) & x)\n {\n if (dp[i, s] + Math.Abs(a[i] - k) < dp[i + 1, fac[k] | s])\n {\n dp[i + 1, fac[k] | s] = dp[i, s] + Math.Abs(a[i] - k);\n prev[i + 1, fac[k] | s] = k;\n }\n if (s == 0) break;\n }\n }\n }\n var min = 1 << 20;\n var flag = -1;\n for (int i = 0; i < 1< dp[n, i]) { min = dp[n, i]; flag = i; }\n var l = new List();\n for (int i = n; i > 0; i--)\n {\n l.Add(prev[i, flag]);\n flag ^= fac[prev[i, flag]];\n }\n l.Reverse();\n IO.Printer.Out.WriteLine(l.AsJoinedString());\n\t\t\t\t \n\n }\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n /// \n /// p\u4ee5\u4e0b\u306e\u7d20\u6570\u3092\u5217\u6319\n /// \n /// \n /// \n static public bool[] Sieve(int p)\n {\n var isPrime = new bool[p + 1];\n for (int i = 2; i <= p; i++)\n isPrime[i] = true;\n for (int i = 2; i * i <= p; i++)\n {\n if (!isPrime[i])\n continue;\n for (int j = i * i; j <= p; j += i)\n isPrime[j] = false;\n }\n return isPrime;\n }\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n }\n}\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int COUNT = 16;\n const int SCOUNT = 1 << COUNT;\n int[] primes = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n IList> options = new List>();\n\n void GenerateOptions(int p, int x, int s)\n {\n if (p == COUNT)\n {\n options.Add(Tuple.Create(x, s));\n return;\n }\n for (int i = 0; x < 59; i++)\n {\n GenerateOptions(p + 1, x, s);\n x *= primes[p];\n s |= 1 << p;\n }\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n GenerateOptions(0, 1, 0);\n\n var dp = new int[n + 1, SCOUNT];\n var path = new Tuple[n + 1, SCOUNT];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < SCOUNT; j++)\n dp[i + 1, j] = int.MaxValue;\n foreach (var t in options)\n {\n int diff = Math.Abs(a[i] - t.Item1);\n for (int j = 0; j < SCOUNT; j++)\n if (dp[i, j] < int.MaxValue && (j & t.Item2) == 0)\n {\n int x = dp[i, j] + diff;\n int v = j | t.Item2;\n if (dp[i + 1, v] > x)\n {\n dp[i + 1, v] = x;\n path[i + 1, v] = Tuple.Create(j, t.Item1);\n }\n }\n }\n }\n\n int nmin = 0;\n for (int i = 1; i < SCOUNT; i++)\n if (dp[n, i] < dp[n, nmin])\n nmin = i;\n\n var ans = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n ans[i] = path[i + 1, nmin].Item2;\n nmin = path[i + 1, nmin].Item1;\n }\n WriteArray(ans);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int COUNT = 16;\n const int SCOUNT = 1 << COUNT;\n int[] primes = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n IList> options = new List>();\n\n void GenerateOptions(int p, int x, int s)\n {\n if (p == COUNT)\n {\n options.Add(Tuple.Create(x, s));\n return;\n }\n for (int i = 0; x < 59; i++)\n {\n GenerateOptions(p + 1, x, s);\n x *= primes[p];\n s |= 1 << p;\n }\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n GenerateOptions(0, 1, 0);\n\n var dp = new int[n + 1, SCOUNT];\n var path = new Tuple[n + 1, SCOUNT];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < SCOUNT; j++)\n dp[i + 1, j] = int.MaxValue;\n foreach (var t in options)\n {\n int diff = Math.Abs(a[i] - t.Item1);\n for (int j = 0; j < SCOUNT; j++)\n if (dp[i, j] < int.MaxValue && (j & t.Item2) == 0)\n {\n int x = dp[i, j] + diff;\n int v = j | t.Item2;\n if (dp[i + 1, v] > x)\n {\n dp[i + 1, v] = x;\n path[i + 1, v] = Tuple.Create(j, t.Item1);\n }\n }\n }\n }\n\n int nmin = 0;\n for (int i = 1; i < SCOUNT; i++)\n if (dp[n, i] < dp[n, nmin])\n nmin = i;\n\n var ans = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n ans[i] = path[i + 1, nmin].Item2;\n nmin = path[i + 1, nmin].Item1;\n }\n WriteArray(ans);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication3\n{\n public class CodeForces453B\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var aArr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n\n var primes = GetPrimes().ToArray();\n var mask = Fill(primes);\n\n var values = new int[n][];\n var paths = new int[n][];\n var pathValues = new int[n][];\n for (int i = 0; i < values.Length; ++i)\n {\n values[i] = new int[1 << 17];\n paths[i] = new int[1 << 17];\n pathValues[i] = new int[1 << 17];\n for (int j = 0; j < values[i].Length; ++j)\n {\n values[i][j] = paths[i][j] = -1;\n }\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int p = 0; p < (1 << 17); ++p)\n {\n var current = i == 0 ? 0 : values[i - 1][p];\n\n for (int j = 1; j < 59; ++j)\n {\n if ((mask[j] & p) != 0) continue;\n\n var newValue = current + Math.Abs(aArr[i] - j);\n var newPosition = mask[j] | p;\n if (values[i][newPosition] == -1 || values[i][newPosition] > newValue)\n {\n values[i][newPosition] = newValue;\n paths[i][newPosition] = p;\n pathValues[i][newPosition] = j;\n }\n }\n }\n }\n\n var min = values[n - 1].Where(x => x >= 0).Min();\n var list = new List();\n var pos = values[n - 1].Select((x, i) => new {X = x, I = i}).Where(x => x.X == min).Select(x => x.I).First();\n for (int i = n-1; i >= 0; --i)\n {\n list.Add(pathValues[i][pos]);\n pos = paths[i][pos];\n }\n\n list.Reverse();\n Console.WriteLine(string.Join(\" \", list));\n }\n\n private static IEnumerable GetPrimes()\n {\n var arr = new bool[59];\n for (int i = 2; i < 59; ++i)\n {\n if (!arr[i])\n {\n yield return i;\n for (int j = i*2; j < 59; j += i)\n arr[j] = true;\n }\n }\n }\n\n private static int[] Fill(int[] primes)\n {\n var result = new int[61];\n for (int i = 1; i <= 60; ++i)\n for(int j = 0; j < primes.Length; ++j)\n if (i%primes[j] == 0)\n result[i] |= 1 << j;\n\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n const int m = 59;\n List primes = GetPrimes(m);\n int p = primes.Count;\n\n var mask = new int[m + 1];\n for (int i = 1; i <= m; i++)\n {\n for (int j = 0; j < p; j++)\n {\n if (i % primes[j] == 0)\n {\n mask[i] |= (1 << j);\n }\n }\n }\n\n const int MAX = int.MaxValue / 2;\n int q = 1 << p;\n var b = new int[n + 1][];\n var w = new int[n + 1][];\n for (int i = 0; i < n + 1; i++)\n {\n b[i] = Enumerable.Repeat(MAX, q).ToArray();\n w[i] = new int[q];\n }\n b[0][0] = 0;\n w[0][0] = -1;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < q; j++)\n {\n if (b[i][j] < MAX)\n {\n for (int k = 1; k <= m; k++)\n {\n if ((j & mask[k]) == 0)\n {\n if (b[i + 1][j | mask[k]] > b[i][j] + Math.Abs(k - a[i]))\n {\n b[i + 1][j | mask[k]] = b[i][j] + Math.Abs(k - a[i]);\n w[i + 1][j | mask[k]] = k;\n }\n }\n }\n }\n }\n }\n\n int mini = 0;\n for (int i = 0; i < q; i++)\n {\n if (b[n][i] < b[n][mini])\n {\n mini = i;\n }\n }\n\n // Writer.WriteLine(b[n][mini]);\n var ans = new List();\n for (int i = n; i > 0; i--)\n {\n ans.Add(w[i][mini]);\n mini ^= mask[w[i][mini]];\n }\n ans.Reverse();\n WriteArray(ans);\n }\n\n public static List GetPrimes(long n)\n {\n var primes = new List();\n\n n = Math.Max(n, 2);\n bool[] isPrime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n isPrime[i] = true;\n }\n\n for (int i = 2; i <= n; i++)\n {\n if (isPrime[i])\n {\n primes.Add(i);\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n isPrime[j] = false;\n }\n }\n }\n }\n\n return primes;\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n // Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace CF453\n{\n class B\n {\n readonly int[] _bad = { ' ', '\\r', '\\n', -1 };\n TextReader sr = Console.In;\n TextWriter sw = Console.Out;\n private string NextToken()\n {\n var sb = new StringBuilder();\n int i;\n\n while (Array.IndexOf(_bad, (i = sr.Read())) != -1) ;\n sb.Append((char)i);\n while (Array.IndexOf(_bad, (i = sr.Read())) == -1)\n sb.Append((char)i);\n return sb.ToString();\n }\n\n int NextInt()\n {\n return int.Parse(NextToken());\n }\n\n void run()\n {\n var n = NextInt();\n int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n var a = new int[n];\n var np = primes.Length;\n var masks = new int[61];\n for (int i1 = 1; i1 < 61; ++i1)\n {\n var msk = 0;\n var i = i1;\n for (var ind = 0; ind < np; ++ind)\n {\n if (i % primes[ind] == 0)\n {\n msk |= 1 << ind;\n while (i % primes[ind] == 0)\n i /= primes[ind];\n }\n }\n masks[i1] = msk;\n }\n for (var i = 0; i < n; ++i)\n a[i] = NextInt();\n var d = new int[n, 1 << np];\n var prev = new int[n, 1 << np];\n for (var i = 0; i < n; ++i)\n for (var j = 0; j < 1 << np; ++j)\n {\n d[i, j] = int.MaxValue / 2;\n prev[i, j] = -1;\n }\n for (var i = 1; i < 61; ++i)\n {\n var b = masks[i];\n if (d[0, b] > Math.Abs(i - a[0]))\n {\n d[0, b] = Math.Abs(i - a[0]);\n prev[0, b] = i;\n }\n }\n for (var pref = 0; pref < n - 1; ++pref)\n {\n for (var i = 1; i < 61; ++i)\n {\n var b = masks[i];\n var x = ((1 << 17) - 1) & (~b);\n for (var mask = x; mask >= 0; mask = x & (mask - 1))\n {\n if ((b & mask) != 0)\n continue;\n var nmask = mask | b;\n if (d[pref, mask] + Math.Abs(i - a[pref + 1]) < d[pref + 1, nmask])\n {\n d[pref + 1, nmask] = d[pref, mask] + Math.Abs(i - a[pref + 1]);\n prev[pref + 1, nmask] = i;\n }\n if (mask == 0)\n break;\n //if (pref <= 2)\n //sw.WriteLine(pref + 1 + \" \" + nmask + \" \" + d[pref + 1, nmask]);\n }\n }\n }\n var ans = int.MaxValue / 2;\n var ind1 = -1;\n for (var mask = 0; mask < 1 << np; ++mask)\n {\n if (d[n - 1, mask] < ans)\n {\n ans = d[n - 1, mask];\n ind1 = mask;\n }\n }\n\n var arr = new List();\n var i2 = n - 1;\n while (i2 >= 0)\n {\n arr.Add(prev[i2, ind1]);\n ind1 = ind1 ^ masks[prev[i2, ind1]];\n --i2;\n }\n arr.Reverse();\n foreach (var x in arr)\n sw.Write(x + \" \");\n sr.ReadLine();\n sr.ReadLine();\n }\n\n static void Main(string[] args)\n {\n new B().run();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n const int m = 59;\n List primes = GetPrimes(m);\n int p = primes.Count;\n\n var mask = new int[m + 1];\n for (int i = 1; i <= m; i++)\n {\n for (int j = 0; j < p; j++)\n {\n if (i % primes[j] == 0)\n {\n mask[i] |= (1 << j);\n }\n }\n }\n\n const int MAX = int.MaxValue / 2;\n int q = 1 << p;\n var b = new int[n + 1][];\n var w = new int[n + 1][];\n for (int i = 0; i < n + 1; i++)\n {\n b[i] = Enumerable.Repeat(MAX, q).ToArray();\n w[i] = new int[q];\n }\n b[0][0] = 0;\n w[0][0] = -1;\n\n var allowed = new List[q];\n for (int i = 0; i < q; i++)\n {\n allowed[i] = new List();\n for (int j = 1; j <= m; j++)\n {\n if ((i & mask[j]) == 0)\n {\n allowed[i].Add(j);\n }\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < q; j++)\n {\n if (b[i][j] < MAX)\n {\n for (int l = 0; l < allowed[j].Count; l++)\n {\n int k = allowed[j][l];\n if (b[i + 1][j | mask[k]] > b[i][j] + Math.Abs(k - a[i]))\n {\n b[i + 1][j | mask[k]] = b[i][j] + Math.Abs(k - a[i]);\n w[i + 1][j | mask[k]] = k;\n }\n }\n }\n }\n }\n\n int mini = 0;\n for (int i = 0; i < q; i++)\n {\n if (b[n][i] < b[n][mini])\n {\n mini = i;\n }\n }\n\n // Writer.WriteLine(b[n][mini]);\n var ans = new List();\n for (int i = n; i > 0; i--)\n {\n ans.Add(w[i][mini]);\n mini ^= mask[w[i][mini]];\n }\n ans.Reverse();\n WriteArray(ans);\n }\n\n public static List GetPrimes(long n)\n {\n var primes = new List();\n\n n = Math.Max(n, 2);\n bool[] isPrime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n isPrime[i] = true;\n }\n\n for (int i = 2; i <= n; i++)\n {\n if (isPrime[i])\n {\n primes.Add(i);\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n isPrime[j] = false;\n }\n }\n }\n }\n\n return primes;\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n // Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Little_Pony_and_Harmony_Chest\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static readonly int[] prime = new[] {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\n private static IEnumerable Gets(int maxl)\n {\n int max = 1 << prime.Length;\n\n for (int i = 0; i < max; i++)\n {\n int mask = i;\n var l = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if ((mask & 1) == 1)\n {\n l.Add(prime[j]);\n }\n mask >>= 1;\n }\n if (l.Count <= maxl)\n {\n int[] array = l.ToArray();\n\n if (array.Length > 0)\n {\n for (; array[0] < 60; array[0] *= l[0])\n {\n if (array.Length > 1)\n {\n for (array[1] = l[1]; array[1] < 60; array[1] *= l[1])\n {\n if (array.Length > 2)\n {\n for (array[2] = l[2]; array[2] < 60; array[2] *= l[2])\n {\n if (array.Length > 3)\n {\n for (array[3] = l[3]; array[3] < 60; array[3] *= l[3])\n {\n var res = (int[]) array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n else\n {\n yield return array;\n }\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n var indx = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n indx[i] = i;\n }\n Array.Sort(nn, indx);\n\n int min = int.MaxValue;\n int[] mm = null;\n foreach (var m in Gets(n))\n {\n int i = 0;\n int sum = 0;\n for (; i < n - m.Length; i++)\n {\n sum += Math.Abs(nn[i] - 1);\n }\n for (int j = 0; j < m.Length; j++)\n {\n sum += Math.Abs(nn[i + j] - m[j]);\n }\n if (min > sum)\n {\n min = sum;\n mm = m;\n }\n }\n\n var ans = new int[n];\n {\n int i = 0;\n for (; i < n - mm.Length; i++)\n {\n ans[i] = 1;\n }\n for (int j = 0; j < mm.Length; j++)\n {\n ans[i + j] = mm[j];\n }\n }\n Array.Sort(indx, ans);\n foreach (int an in ans)\n {\n writer.Write(an);\n writer.Write(' ');\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Little_Pony_and_Harmony_Chest\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static readonly int[] prime = new[] {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};\n\n private static IEnumerable Gets(int maxl)\n {\n int max = 1 << prime.Length;\n\n for (int i = 0; i < max; i++)\n {\n int mask = i;\n var l = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if ((mask & 1) == 1)\n {\n l.Add(prime[j]);\n }\n mask >>= 1;\n }\n if (l.Count <= maxl)\n {\n int[] array = l.ToArray();\n\n if (array.Length > 0)\n {\n for (; array[0] < 60; array[0] *= l[0])\n {\n if (array.Length > 1)\n {\n for (array[1] = l[1]; array[1] < 60; array[1] *= l[1])\n {\n if (array.Length > 2)\n {\n for (array[2] = l[2]; array[2] < 60; array[2] *= l[2])\n {\n if (array.Length > 3)\n {\n for (array[3] = l[3]; array[3] < 60; array[3] *= l[3])\n {\n var res = (int[]) array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n else\n {\n var res = (int[])array.Clone();\n Array.Sort(res);\n yield return res;\n }\n }\n }\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[n];\n var indx = new int[n];\n for (int i = 0; i < n; i++)\n {\n nn[i] = Next();\n indx[i] = i;\n }\n Array.Sort(nn, indx);\n\n int min = int.MaxValue;\n int[] mm = null;\n foreach (var m in Gets(n))\n {\n int i = 0;\n int sum = 0;\n for (; i < n - m.Length; i++)\n {\n sum += Math.Abs(nn[i] - 1);\n }\n for (int j = 0; j < m.Length; j++)\n {\n sum += Math.Abs(nn[i + j] - m[j]);\n }\n if (min > sum)\n {\n min = sum;\n mm = m;\n }\n }\n\n var ans = new int[n];\n {\n int i = 0;\n for (; i < n - mm.Length; i++)\n {\n ans[i] = 1;\n }\n for (int j = 0; j < mm.Length; j++)\n {\n ans[i + j] = mm[j];\n }\n }\n Array.Sort(indx, ans);\n foreach (int an in ans)\n {\n writer.Write(an);\n writer.Write(' ');\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private bool[] usedPrime = new bool[20];\n private bool[] usedNumber = new bool[65];\n private int[][] mn;\n private int[] a;\n private List best;\n int n;\n int count = 0;\n int minSum = int.MaxValue;\n\n private void Solve()\n {\n n = int.Parse(Console.ReadLine());\n var aOrig = Console.ReadLine().Split().Select(int.Parse).ToArray();\n a = aOrig.OrderByDescending(x => x).ToArray();\n\n mn = new int[61][];\n\n for (int i = 1; i <= 60; i++)\n {\n var div = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n div.Add(j);\n }\n mn[i] = div.ToArray();\n }\n generate(60, 0, 0);\n\n foreach (var aItem in aOrig)\n {\n var fromBest = best.OrderBy(x => Math.Abs(x - aItem)).First();\n best.Remove(fromBest);\n Console.Write(fromBest);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n\n private void generate(int number, int numUsed, int diff)\n {\n count++;\n\n if (diff >= minSum || numUsed >= n)\n return;\n\n if (number < 2)\n {\n var newSum = diff;\n var newNumbers = new List();\n for (int i = 2; i < usedNumber.Count(); i++)\n {\n if (usedNumber[i])\n {\n newNumbers.Add(i);\n }\n }\n var ones = n - newNumbers.Count;\n for (int i = newNumbers.Count; i < n; i++)\n {\n newSum += Math.Abs(a[i] - 1);\n newNumbers.Add(1);\n }\n\n if (newSum < minSum)\n {\n minSum = newSum;\n best = newNumbers;\n }\n\n return;\n }\n\n if (Match(number))\n {\n Mark(number, true);\n var delta = Math.Abs(a[numUsed] - number);\n generate(number - 1, numUsed + 1, diff + delta);\n Mark(number, false);\n }\n\n generate(number - 1, numUsed, diff);\n }\n\n private bool Match(int number)\n {\n var q = mn[number];\n for (int i = 0; i < q.Length; i++)\n {\n if (usedPrime[q[i]])\n return false;\n }\n return true;\n }\n\n private void Mark(int number, bool value)\n {\n var q = mn[number];\n usedNumber[number] = value;\n for (int i = 0; i < q.Length; i++)\n {\n usedPrime[q[i]] = value;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private bool[] usedPrime = new bool[20];\n private bool[] usedNumber = new bool[65];\n private int[][] mn;\n private int[] a;\n private List best;\n int n;\n int count = 0;\n int minSum = int.MaxValue;\n\n private void Solve()\n {\n n = int.Parse(Console.ReadLine());\n a = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n\n mn = new int[61][];\n\n for (int i = 1; i <= 60; i++)\n {\n var div = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n div.Add(j);\n }\n mn[i] = div.ToArray();\n }\n generate(60, 0, 0);\n\n foreach (var num in best.OrderByDescending(x => x))\n {\n Console.Write(num);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n\n private void generate(int number, int numUsed, int diff)\n {\n count++;\n\n if (diff >= minSum || numUsed >= n)\n return;\n\n if (number < 2)\n {\n var newSum = diff;\n var newNumbers = new List();\n for (int i = 2; i < usedNumber.Count(); i++)\n {\n if (usedNumber[i])\n {\n newNumbers.Add(i);\n }\n }\n var ones = n - newNumbers.Count;\n for (int i = newNumbers.Count; i < n; i++)\n {\n newSum += Math.Abs(a[i] - 1);\n newNumbers.Add(1);\n }\n\n if (newSum < minSum)\n {\n minSum = newSum;\n best = newNumbers;\n }\n\n return;\n }\n\n if (Match(number))\n {\n Mark(number, true);\n var delta = Math.Abs(a[numUsed] - number);\n generate(number - 1, numUsed + 1, diff + delta);\n Mark(number, false);\n }\n\n generate(number - 1, numUsed, diff);\n }\n\n private bool Match(int number)\n {\n var q = mn[number];\n for (int i = 0; i < q.Length; i++)\n {\n if (usedPrime[q[i]])\n return false;\n }\n return true;\n }\n\n private void Mark(int number, bool value)\n {\n var q = mn[number];\n usedNumber[number] = value;\n for (int i = 0; i < q.Length; i++)\n {\n usedPrime[q[i]] = value;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private bool[] usedPrime = new bool[20];\n private bool[] usedNumber = new bool[65];\n private int[][] mn;\n private Tuple[] a;\n private List best;\n int n;\n int count = 0;\n int minSum = int.MaxValue;\n\n private void Solve()\n {\n n = int.Parse(Console.ReadLine());\n a = Console.ReadLine().\n Split().\n Select((x, index) => new Tuple(int.Parse(x), index)).\n OrderByDescending(x => x.Item1).\n ToArray();\n\n mn = new int[61][];\n\n for (int i = 1; i <= 60; i++)\n {\n var div = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n div.Add(j);\n }\n mn[i] = div.ToArray();\n }\n generate(60, 0, 0);\n\n var ans = new int[n];\n for (int i = 0; i < n; i++)\n {\n var aItem = a[i];\n ans[aItem.Item2] = best[i];\n }\n\n for (int i = 0; i < n; i++)\n {\n Console.Write(ans[i]);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n\n private void generate(int number, int numUsed, int diff)\n {\n count++;\n\n if (diff >= minSum || numUsed >= n)\n return;\n\n if (number < 2)\n {\n var newSum = diff;\n var newNumbers = new List();\n for (int i = 2; i < usedNumber.Count(); i++)\n {\n if (usedNumber[i])\n {\n newNumbers.Add(i);\n }\n }\n var ones = n - newNumbers.Count;\n for (int i = newNumbers.Count; i < n; i++)\n {\n newSum += Math.Abs(a[i].Item1 - 1);\n newNumbers.Add(1);\n }\n\n if (newSum < minSum)\n {\n minSum = newSum;\n best = newNumbers.OrderByDescending(x => x).ToList();\n }\n\n return;\n }\n\n if (Match(number))\n {\n Mark(number, true);\n var delta = Math.Abs(a[numUsed].Item1 - number);\n generate(number - 1, numUsed + 1, diff + delta);\n Mark(number, false);\n }\n\n generate(number - 1, numUsed, diff);\n }\n\n private bool Match(int number)\n {\n var q = mn[number];\n for (int i = 0; i < q.Length; i++)\n {\n if (usedPrime[q[i]])\n return false;\n }\n return true;\n }\n\n private void Mark(int number, bool value)\n {\n var q = mn[number];\n usedNumber[number] = value;\n for (int i = 0; i < q.Length; i++)\n {\n usedPrime[q[i]] = value;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Codeforces.R259\n{\n public class Task_B\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"input.txt\"));\n#endif\n new Task_B().Solve();\n }\n\n private int[] prime = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59 };\n private bool[] usedPrime = new bool[20];\n private bool[] usedNumber = new bool[65];\n private int[][] mn;\n private int[] a;\n private List best;\n int n;\n int count = 0;\n int minSum = int.MaxValue;\n\n private void Solve()\n {\n n = int.Parse(Console.ReadLine());\n var aOrig = Console.ReadLine().Split().Select(int.Parse).ToArray();\n a = aOrig.ToArray();\n\n mn = new int[61][];\n\n for (int i = 1; i <= 60; i++)\n {\n var div = new List();\n for (int j = 0; j < prime.Length; j++)\n {\n if (i % prime[j] == 0)\n div.Add(j);\n }\n mn[i] = div.ToArray();\n }\n generate(60, 0, 0);\n\n foreach (var aItem in aOrig)\n {\n var fromBest = best.OrderBy(x => Math.Abs(x - aItem)).First();\n best.Remove(fromBest);\n Console.Write(fromBest);\n Console.Write(\" \");\n }\n Console.WriteLine();\n }\n\n private void generate(int number, int numUsed, int diff)\n {\n count++;\n\n if (diff >= minSum || numUsed >= n)\n return;\n\n if (number < 2)\n {\n var newSum = diff;\n var newNumbers = new List();\n for (int i = 2; i < usedNumber.Count(); i++)\n {\n if (usedNumber[i])\n {\n newNumbers.Add(i);\n }\n }\n var ones = n - newNumbers.Count;\n for (int i = newNumbers.Count; i < n; i++)\n {\n newSum += Math.Abs(a[i] - 1);\n newNumbers.Add(1);\n }\n\n if (newSum < minSum)\n {\n minSum = newSum;\n best = newNumbers;\n }\n\n return;\n }\n\n if (Match(number))\n {\n Mark(number, true);\n var delta = Math.Abs(a[numUsed] - number);\n generate(number - 1, numUsed + 1, diff + delta);\n Mark(number, false);\n }\n\n generate(number - 1, numUsed, diff);\n }\n\n private bool Match(int number)\n {\n var q = mn[number];\n for (int i = 0; i < q.Length; i++)\n {\n if (usedPrime[q[i]])\n return false;\n }\n return true;\n }\n\n private void Mark(int number, bool value)\n {\n var q = mn[number];\n usedNumber[number] = value;\n for (int i = 0; i < q.Length; i++)\n {\n usedPrime[q[i]] = value;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int COUNT = 16;\n const int SCOUNT = 1 << COUNT;\n int[] primes = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n IList> options = new List>();\n\n void GenerateOptions(int p, int x, int s)\n {\n if (p == COUNT)\n {\n if (x > 1)\n options.Add(Tuple.Create(x, s));\n return;\n }\n for (int i = 0; x < 59; i++)\n {\n GenerateOptions(p + 1, x, s);\n x *= primes[p];\n s |= 1 << p;\n }\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n GenerateOptions(0, 1, 0);\n\n var dp = new int[n + 1, SCOUNT];\n var path = new Tuple[n + 1, SCOUNT];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < SCOUNT; j++)\n {\n dp[i + 1, j] = dp[i, j] + a[i] - 1;\n path[i + 1, j] = Tuple.Create(j, 1);\n }\n foreach (var t in options)\n {\n int diff = Math.Abs(a[i] - t.Item1);\n for (int j = 1; j < SCOUNT; j++)\n if (dp[i, j] < int.MaxValue && (j & t.Item2) == 0)\n {\n int x = dp[i, j] + diff;\n int v = j | t.Item2;\n if (dp[i + 1, v] > x)\n {\n dp[i + 1, v] = x;\n path[i + 1, v] = Tuple.Create(j, t.Item1);\n }\n }\n }\n }\n\n int nmin = 0;\n for (int i = 1; i < SCOUNT; i++)\n if (dp[n, i] < dp[n, nmin])\n nmin = i;\n\n var ans = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n ans[i] = path[i + 1, nmin].Item2;\n nmin = path[i + 1, nmin].Item1;\n }\n WriteArray(ans);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n const int COUNT = 16;\n const int SCOUNT = 1 << COUNT;\n int[] primes = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53 };\n IList> options = new List>();\n\n void GenerateOptions(int p, int x, int s)\n {\n if (p == COUNT)\n {\n options.Add(Tuple.Create(x, s));\n return;\n }\n for (int i = 0; x < 59; i++)\n {\n GenerateOptions(p + 1, x, s);\n x *= primes[p];\n s |= 1 << p;\n }\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n GenerateOptions(0, 1, 0);\n\n var dp = new int[n + 1, SCOUNT];\n var path = new Tuple[n + 1, SCOUNT];\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < SCOUNT; j++)\n {\n dp[i + 1, j] = dp[i, j] + a[i] - 1;\n path[i + 1, j] = Tuple.Create(j, 1);\n }\n foreach (var t in options)\n {\n int diff = Math.Abs(a[i] - t.Item1);\n for (int j = 1; j < SCOUNT; j++)\n if (dp[i, j] < int.MaxValue && (j & t.Item2) == 0)\n {\n int x = dp[i, j] + diff;\n int v = j | t.Item2;\n if (dp[i + 1, v] > x)\n {\n dp[i + 1, v] = x;\n path[i + 1, v] = Tuple.Create(j, t.Item1);\n }\n }\n }\n }\n\n int nmin = 0;\n for (int i = 1; i < SCOUNT; i++)\n if (dp[n, i] < dp[n, nmin])\n nmin = i;\n\n var ans = new int[n];\n for (int i = n - 1; i >= 0; i--)\n {\n ans[i] = path[i + 1, nmin].Item2;\n nmin = path[i + 1, nmin].Item1;\n }\n WriteArray(ans);\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n int n = ReadInt();\n var a = ReadIntArray();\n\n const int m = 59;\n List primes = GetPrimes(m);\n int p = primes.Count;\n\n var mask = new int[m + 1];\n for (int i = 1; i <= m; i++)\n {\n for (int j = 0; j < p; j++)\n {\n if (i % primes[j] == 0)\n {\n mask[i] |= (1 << j);\n }\n }\n }\n\n const int MAX = int.MaxValue / 2;\n int q = 1 << p;\n var b = new int[n + 1][];\n var w = new int[n + 1][];\n for (int i = 0; i < n + 1; i++)\n {\n b[i] = Enumerable.Repeat(MAX, q).ToArray();\n w[i] = new int[q];\n }\n b[0][0] = 0;\n w[0][0] = -1;\n\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < q; j++)\n {\n if (b[i][j] < MAX)\n {\n for (int k = 1; k <= m; k++)\n {\n if ((j & mask[k]) == 0)\n {\n if (b[i + 1][j | mask[k]] > b[i][j] + Math.Abs(k - a[i]))\n {\n b[i + 1][j | mask[k]] = b[i][j] + Math.Abs(k - a[i]);\n w[i + 1][j | mask[k]] = k;\n }\n }\n }\n }\n }\n }\n\n int mini = 0;\n for (int i = 0; i < q; i++)\n {\n if (b[n][i] < b[n][mini])\n {\n mini = i;\n }\n }\n\n Writer.WriteLine(b[n][mini]);\n var ans = new List();\n for (int i = n; i > 0; i--)\n {\n ans.Add(w[i][mini]);\n mini ^= mask[w[i][mini]];\n }\n ans.Reverse();\n WriteArray(ans);\n }\n\n public static List GetPrimes(long n)\n {\n var primes = new List();\n\n n = Math.Max(n, 2);\n bool[] isPrime = new bool[n + 1];\n for (int i = 2; i <= n; i++)\n {\n isPrime[i] = true;\n }\n\n for (int i = 2; i <= n; i++)\n {\n if (isPrime[i])\n {\n primes.Add(i);\n if ((long)i * i <= n)\n {\n for (int j = i * i; j <= n; j += i)\n {\n isPrime[j] = false;\n }\n }\n }\n }\n\n return primes;\n }\n\n public static void Solve()\n {\n SolveCase();\n\n /*var sw = Stopwatch.StartNew();*/\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n // Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n /*sw.Stop();\n Console.WriteLine(sw.ElapsedMilliseconds);*/\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n //Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Random rnd = new Random();\n for (int i = result.Length - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = result[k];\n result[k] = result[i];\n result[i] = tmp;\n }\n return result;\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}], "src_uid": "f26c74f27bbc723efd69c38ad0e523c6"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int Gcd(int a, int b)\n {\n if (b == 0)\n return a;\n return Gcd(b, a % b);\n }\n\n private const int SIEVE_SIZE = 1000010;\n private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];\n private readonly IList primes = new List();\n void Sieve()\n {\n for (int i = 2; i * i <= SIEVE_SIZE; i++)\n if (!isComposite[i])\n for (int j = i * i; j <= SIEVE_SIZE; j += i)\n isComposite[j] = true;\n for (int i = 2; i <= SIEVE_SIZE; i++)\n if (!isComposite[i])\n primes.Add(i);\n }\n\n public void Solve()\n {\n Sieve();\n\n long a = ReadLong();\n if (a == 1)\n {\n Write(1);\n return;\n }\n var d = new SDictionary { { a, 1 } };\n int ans = 0;\n var ts = DateTime.Now;\n for (int i = 0; i < primes.Count; i++)\n {\n bool ok = false;\n for (long x = primes[i]; !ok && x < a; x *= primes[i])\n if (a % (x + 1) == 0)\n ok = true;\n if (!ok)\n continue;\n\n var toAdd = new List>();\n var toRemove = new List();\n foreach (var p in d)\n {\n if (p.Key <= primes[i])\n toRemove.Add(p.Key);\n for (long x = primes[i]; x < p.Key; x *= primes[i])\n if (p.Key % (x + 1) == 0)\n {\n long y = p.Key / (x + 1);\n if (y == 1)\n ans += p.Value;\n else if (y > primes[i] && y % 2 == 0)\n toAdd.Add(Tuple.Create(y, p.Value));\n }\n }\n foreach (int x in toRemove)\n d.Remove(x);\n foreach (var p in toAdd)\n d[p.Item1] += p.Item2;\n }\n //Write((DateTime.Now - ts).TotalMilliseconds);\n\n foreach (var p in d)\n if (p.Key > SIEVE_SIZE)\n {\n long x = p.Key - 1;\n bool ok = true;\n for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)\n if (x % primes[i] == 0)\n ok = false;\n if (ok)\n ans += p.Value;\n }\n\n Write(ans);\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"hull.in\");\n //writer = new StreamWriter(\"hull.out\");\n#endif\n try\n {\n// var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n// thread.Start();\n// thread.Join();\n new Solver().Solve(); \n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}\n public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine());return currentLineTokens.Dequeue();}\n public static int ReadInt(){return int.Parse(ReadToken());}\n public static long ReadLong(){return long.Parse(ReadToken());}\n public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}\n public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}\n public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}\n public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}\n public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}\n public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}\n public static void WriteArray(IEnumerable array){writer.WriteLine(string.Join(\" \", array));}\n public static void Write(params object[] array){WriteArray(array);}\n public static void WriteLines(IEnumerable array){foreach (var a in array)writer.WriteLine(a);}\n private class SDictionary : Dictionary{public new TValue this[TKey key]{\n get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}\n private static T[] Init(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}\n #endregion\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nclass ProblemD {\n static string inputFileName = \"../../input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (Type.GetType(\"HaitaoLocal\") != null) {\n if (fileReader == null) {\n fileReader = new StreamReader(inputFileName);\n }\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ReadInt() {\n return Int32.Parse(NextToken());\n }\n static string ReadString() {\n return NextToken();\n }\n static long ReadLong() {\n return Int64.Parse(NextToken());\n }\n static int[] ReadIntArray(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadInt();\n }\n return ret;\n }\n static string[] ReadStringArray(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadString();\n }\n return ret;\n }\n static long[] ReadLongArray(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadLong();\n }\n return ret;\n }\n static string DoubleToString(double d) {\n return d.ToString(new CultureInfo(\"en-US\"));\n }\n\n public static void Main(string[] args) {\n int Q = 1000001;\n bool[] notPrime = new bool[Q];\n notPrime[0] = true;\n notPrime[1] = true;\n for (int i = 2; i <= Math.Sqrt(notPrime.Length); i++) {\n if (!notPrime[i]) {\n for (int j = i * 2; j < notPrime.Length; j += i) {\n notPrime[j] = true;\n }\n }\n }\n List primes = new List();\n for(int i=0; i factors = new List();\n for (long i = 1; i <= 1000000; i++) {\n if (N % i != 0) continue;\n if (i * i > N) break;\n factors.Add(i);\n if(i*i!=N) factors.Add(N / i);\n }\n factors.Sort();\n Dictionary pmap = new Dictionary();\n foreach (long f in factors) {\n long k = f - 1;\n bool flag = true;\n foreach (int p in primes) {\n if (k % p == 0) {\n flag = false;\n long x = 1;\n while (x < k) x *= p;\n if (x == k) {\n pmap.Add(f, p);\n } else {\n break;\n }\n }\n }\n if (flag && k>1) pmap.Add(f, k);\n }\n //foreach (long key in pmap.Keys) {\n // Console.WriteLine(key + \" \" + pmap[key]);\n //}\n Dictionary dp = new Dictionary();\n\n foreach (long i in factors) {\n dp[i] = 0;\n }\n dp[1] = 1;\n Dictionary used = new Dictionary();\n foreach (long key in pmap.Keys) {\n long p = pmap[key];\n if (used.ContainsKey(p)) continue;\n used.Add(p, 0);\n\n Dictionary toAdd = new Dictionary();\n foreach (long k2 in pmap.Keys) {\n if (pmap[k2] != p) continue;\n foreach (long f in factors) {\n if(f%k2!=0) continue;\n if (toAdd.ContainsKey(f)) toAdd[f] += dp[f / k2];\n else toAdd[f] = dp[f / k2];\n }\n }\n foreach (long f in toAdd.Keys) {\n dp[f] += toAdd[f];\n }\n }\n\n //foreach (long key in factors) {\n // Console.WriteLine(key + \" \" + dp[key]);\n //}\n\n Console.WriteLine(dp[N]);\n\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int Gcd(int a, int b)\n {\n if (b == 0)\n return a;\n return Gcd(b, a % b);\n }\n\n private const int SIEVE_SIZE = 1000010;\n private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];\n private readonly IList primes = new List();\n void Sieve()\n {\n for (int i = 2; i * i <= SIEVE_SIZE; i++)\n if (!isComposite[i])\n for (int j = i * i; j <= SIEVE_SIZE; j += i)\n isComposite[j] = true;\n for (int i = 2; i <= SIEVE_SIZE; i++)\n if (!isComposite[i])\n primes.Add(i);\n }\n\n Dictionary, int> mem = new Dictionary, int>(); \n int Fun(long x, int y)\n {\n if (x == 1)\n return 1;\n var key = Tuple.Create(x, y);\n if (mem.ContainsKey(key))\n {\n Write(\"hit\");\n return mem[key];\n }\n int ret = 0;\n for (int i = y; i < primes.Count && primes[i] < x; i++)\n {\n for (long j = primes[i]; j < x; j *= primes[i])\n if (x % (j + 1) == 0)\n ret += Fun(x / (j + 1), i + 1);\n }\n\n return mem[key] = ret;\n }\n\n public void Solve()\n {\n Sieve();\n\n long a = ReadLong();\n var d = new SDictionary { { a, 1 } };\n int ans = 0;\n for (int i = 0; i < primes.Count; i++)\n {\n var toAdd = new List>();\n var toRemove = new List();\n foreach (var p in d)\n {\n if (p.Key <= primes[i])\n toRemove.Add(p.Key);\n for (long x = primes[i]; x < p.Key; x *= primes[i])\n if (p.Key % (x + 1) == 0)\n {\n long y = p.Key / (x + 1);\n if (y == 1)\n ans += p.Value;\n else if (y > primes[i])\n toAdd.Add(Tuple.Create(p.Key / (x + 1), p.Value));\n }\n }\n foreach (var p in toAdd)\n d[p.Item1] += p.Item2;\n foreach (int x in toRemove)\n d.Remove(x);\n }\n\n foreach (var p in d)\n if (p.Key > SIEVE_SIZE)\n {\n long x = p.Key - 1;\n bool ok = true;\n for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)\n if (x % primes[i] == 0)\n ok = false;\n if (ok)\n ans += p.Value;\n }\n\n Write(ans);\n }\n \n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"hull.in\");\n //writer = new StreamWriter(\"hull.out\");\n#endif\n try\n {\n// var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n// thread.Start();\n// thread.Join();\n new Solver().Solve(); \n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() {return reader.ReadLine().Split(new[] { ' ', '\\t', '-' }, StringSplitOptions.RemoveEmptyEntries);}\n public static string ReadToken(){while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine());return currentLineTokens.Dequeue();}\n public static int ReadInt(){return int.Parse(ReadToken());}\n public static long ReadLong(){return long.Parse(ReadToken());}\n public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}\n public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}\n public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).ToArray();}\n public static double[] ReadDoubleArray(){return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();}\n public static int[][] ReadIntMatrix(int numberOfRows){int[][] matrix = new int[numberOfRows][];for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray();return matrix;}\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows){int[][] matrix = ReadIntMatrix(numberOfRows);int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++){ret[i] = new int[numberOfRows];for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i];}return ret;}\n public static string[] ReadLines(int quantity){string[] lines = new string[quantity];for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim();return lines;}\n public static void WriteArray(IEnumerable array){writer.WriteLine(string.Join(\" \", array));}\n public static void Write(params object[] array){WriteArray(array);}\n public static void WriteLines(IEnumerable array){foreach (var a in array)writer.WriteLine(a);}\n private class SDictionary : Dictionary{public new TValue this[TKey key]{\n get { return ContainsKey(key) ? base[key] : default(TValue); }set { base[key] = value; }}}\n private static T[] Init(int size) where T : new(){var ret = new T[size];for (int i = 0; i < size; i++)ret[i] = new T();return ret;}\n #endregion\n}"}], "src_uid": "1f68bd6f8b40e45a5bd360b03a264ef4"} {"source_code": "using System;\nusing System.Linq;\n\nnamespace codefrocesglobalround3\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] info = Console.ReadLine().Split().Select(x => Convert.ToInt64(x)).ToArray();\n\n Console.WriteLine(2 * (info[2] + Math.Min(info[0], info[1])) + (Math.Max(info[0], info[1]) - Math.Min(info[0], info[1]) > 0 ? 1 : 0));\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace ReadWriteTemplate\n{\n public static class Solver\n {\n private static void SolveCase()\n {\n long a = ReadLong();\n long b = ReadLong();\n long c = ReadLong();\n\n long d = Math.Min(a, b);\n long ans = 2 * c + 2 * d;\n a -= d;\n b -= d;\n if (a > 0)\n {\n ans++;\n }\n if (b > 0)\n {\n ans++;\n }\n Writer.Write(ans);\n }\n\n public static void Solve()\n {\n#if DEBUG\n var sw = Stopwatch.StartNew();\n#endif\n\n SolveCase();\n\n /*int T = ReadInt();\n for (int i = 0; i < T; i++)\n {\n // Writer.Write(\"Case #{0}: \", i + 1);\n SolveCase();\n }*/\n\n#if DEBUG\n sw.Stop();\n // Console.WriteLine($\"{sw.ElapsedMilliseconds} ms\");\n#endif\n }\n\n public static void Main()\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n\n#if DEBUG\n // Reader = Console.In; Writer = Console.Out;\n Reader = File.OpenText(\"input.txt\"); Writer = File.CreateText(\"output.txt\");\n#else\n Reader = Console.In; Writer = Console.Out;\n#endif\n\n // Solve();\n Thread thread = new Thread(Solve, 64 * 1024 * 1024);\n thread.CurrentCulture = CultureInfo.InvariantCulture;\n thread.Start();\n thread.Join();\n\n Reader.Close();\n Writer.Close();\n }\n\n public static IOrderedEnumerable OrderByWithShuffle(this IEnumerable source, Func keySelector)\n {\n return source.Shuffle().OrderBy(keySelector);\n }\n\n public static T[] Shuffle(this IEnumerable source)\n {\n T[] result = source.ToArray();\n Shuffle(result);\n return result;\n }\n\n private static void Shuffle(IList array)\n {\n Random rnd = new Random();\n for (int i = array.Count - 1; i >= 1; i--)\n {\n int k = rnd.Next(i + 1);\n T tmp = array[k];\n array[k] = array[i];\n array[i] = tmp;\n }\n }\n\n #region Read/Write\n\n private static TextReader Reader;\n\n private static TextWriter Writer;\n\n private static Queue CurrentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return Reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (CurrentLineTokens.Count == 0)\n CurrentLineTokens = new Queue(ReadAndSplitLine());\n return CurrentLineTokens.Dequeue();\n }\n\n public static string ReadLine()\n {\n return Reader.ReadLine();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = Reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n Writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int[] count = Console.ReadLine().Split().Select(int.Parse).ToArray();\n long rez = count[2] * 2;\n rez += (count[0] == count[1]) ? count[0] * 2 : Math.Min(count[0], count[1]) * 2+1;\n Console.WriteLine(rez); ;\n\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1148A\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n uint a = uint.Parse(tokens[0]);\n uint b = uint.Parse(tokens[1]);\n uint c = uint.Parse(tokens[2]);\n\n Console.WriteLine(2 * Math.Min(a, b) + 2 * c + Math.Sign(Math.Max(a, b) - Math.Min(a, b)));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nums = Console.ReadLine().Split().Select(x => long.Parse(x)).ToList();\n long min = Math.Min(nums[0], nums[1]);\n long res = 2 * nums[2] + 2 * min + (nums[0] - min > 0 ? 1 : 0) + (nums[1] - min > 0 ? 1 : 0);\n Console.WriteLine(res);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problems\n{\n class Problems\n {\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n long a = Convert.ToInt32(line[0]);\n long b = Convert.ToInt32(line[1]);\n long c = Convert.ToInt32(line[2]);\n int add = 0;\n if (a != b)\n {\n add = 1;\n }\n Console.WriteLine(Math.Min(a, b) * 2 + c * 2 + add);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var a = input.ReadLong();\n var b = input.ReadLong();\n var c = input.ReadLong();\n if (a > b)\n Write(2 * Min(a, b) + 1 + 2 * c);\n else if (a < b)\n Write(1 + 2 * c + 2 * Min(a, b));\n else\n Write(a + b + 2 * c);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1148_AnotherOneBitesTheDust\n {\n public static void Main()\n {\n string[] x = Console.ReadLine().Split(' ');\n int a = int.Parse(x[0]);\n int b = int.Parse(x[1]);\n int c = int.Parse(x[2]);\n decimal sum = 0;\n if(a==b)\n {\n sum += (a + b);\n sum += 2 * c;\n Console.WriteLine(sum);\n }else\n {\n if (a > b)\n {\n sum = b;\n }else\n {\n sum = a;\n }\n sum += sum;\n sum += 1;\n sum += 2 * c;\n Console.WriteLine(sum);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Text;\nusing System.Collections.Generic;\n\nnamespace ForAcm\n{\n\tclass MainClass\n\t{\n\t\tstatic int t;\n\t\tstatic string s;\n\t\tstatic string[] ss;\n\t\tpublic static void Main (string[] args)\n\t\t{\n//\t\t\ts = Console.ReadLine ();\n//\t\t\tt = int.Parse (s);\n//\t\t\tfor (int i = 1; i <= t; i++) {\n\t\t\t\t//Console.WriteLine (\"Case #%d: \", i);\n\t\t\t\tdoit ();\n//\t\t\t}\n\t\t}\n\n\t\tprivate static void doit(){\n\t\t\ts = Console.ReadLine ();\n\t\t\tss = s.Split (' ');\n\t\t\tint a, b, c;\n\t\t\ta = int.Parse (ss[0]);\n\t\t\tb = int.Parse (ss[1]);\n\t\t\tc = int.Parse (ss[2]);\n\t\t\tlong ans = c * 2;\n\t\t\tif (a > b) {\n\t\t\t\tans = ans + b * 2 + 1;\n\t\t\t} else if (a < b) {\n\t\t\t\tans = ans + a * 2 + 1;\n\t\t\t} else {\n\t\t\t\tans = ans + a + b;\n\t\t\t}\n\t\t\tConsole.WriteLine (ans);\n\t\t}\n\t}\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tlong A = long.Parse(str[0]);\n\t\tlong B = long.Parse(str[1]);\n\t\tlong C = long.Parse(str[2]);\n\t\tlong ans = C*2+Math.Min(A,B)*2;\n\t\tif(A>B){\n\t\t\tans += 1;\n\t\t}\n\t\tlong ans2 = 0;\n\t\tif(B>0){\n\t\t\tans2 = 1;\n\t\t}\n\t\tans2 += C*2+Math.Min(A,B-1)*2;\n\t\tif(A>B-1){\n\t\t\tans2 += 1;\n\t\t}\n\t\tans = Math.Max(ans,ans2);\n\t\tConsole.WriteLine(ans);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Problem{\n \n public class Solution{\n \n public static void Main(){\n \n int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n int a = nums[0];\n int b = nums[1];\n int c = nums[2];\n \n long totalLength = (long)c*2;\n \n if(a > b){\n totalLength += (long)2*b + 1;\n }else if(a < b){\n totalLength += (long)2*a + 1;\n }else{\n totalLength += (long)2*b;\n }\n \n Console.WriteLine(totalLength);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string[]y=Console.ReadLine().Split(' ');\n Int64 a=Int64.Parse(y[0]);\n Int64 b=Int64.Parse(y[1]);\n Int64 c=Int64.Parse(y[2]);\n Int64 d=Math.Min(a,b);\n Int64 o=d;\n if(a!=b)\n o++;\n Console.WriteLine(d+o+c*2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Another_One_Bites_The_Dust\n{\n class Program\n {\n static void Main(string[] args)\n {\n long answer = 0;\n\n String[] vs = Console.ReadLine().Split(' ');\n long a = Convert.ToInt32(vs[0]);\n long b = Convert.ToInt32(vs[1]);\n long c = Convert.ToInt32(vs[2]);\n\n answer = c * 2;\n\n answer += Math.Min(a, b) * 2;\n\n if (a != b)\n answer++;\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace leetcode\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n\n long n1, n2, n3;\n\n string[] ns = Console.ReadLine().Split();\n\n \n n1 = long.Parse(ns[0]);\n n2 = long.Parse(ns[1]);\n n3 = long.Parse(ns[2]);\n\n long m = 2 * n3;\n\n if(n1 > n2)\n {\n m += n2 + n2 + 1;\n }\n else if(n2 > n1)\n {\n m += n1 + n1 + 1;\n }\n else\n {\n m += n1 + n2;\n }\n\n Console.WriteLine(m);\n }\n \n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pustoi\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n string[] s = str.Split(' ');\n long a = Convert.ToInt64(s[0]);\n long b = Convert.ToInt64(s[1]);\n long c = Convert.ToInt64(s[2]);\n if (a > b)\n {\n Console.WriteLine(a-(a-b-1)+b+2*c);\n }\n else if (a < b)\n {\n Console.WriteLine(b - (b - a - 1) + a + 2 * c);\n }\n else\n {\n Console.WriteLine(b + a + 2 * c);\n }\n\n Console.Read();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Another_One_Bites_The_Dust\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long a = Next();\n long b = Next();\n long c = Next();\n\n\n long ans = 2*c;\n\n if (a == b)\n {\n ans += 2*a;\n }\n else\n {\n ans += 2*Math.Min(a, b) + 1;\n }\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\n\nstatic class P\n{\n static void Main()\n {\n var abc = Console.ReadLine().Split().Select(long.Parse).ToArray();\n Console.WriteLine((abc[0] != abc[1] ? 1 : 0) + Min(abc[0], abc[1]) * 2 + abc[2] * 2);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tif(A == B){\n\t\t\tConsole.WriteLine(A + B + 2 * AB);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(A < B){\n\t\t\tvar t = A; A = B; B = t;\n\t\t}\n\t\t\n\t\tlong ans = 2 * AB + B * 2;\n\t\tConsole.WriteLine(ans + 1);\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\tlong A,B,AB;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tA = d[0]; B = d[1]; AB = d[2];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "/*\ncsc -debug A.cs && mono --debug A.exe <<< \"1 1 1\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Reflection;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var a = cin.NextLong();\n var b = cin.NextLong();\n var c = cin.NextLong();\n System.Console.WriteLine(2L*(c + Math.Min(a, b)) + (a == b ? 0L : 1L));\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // IncreaseStack(SolveCodeForces);\n // System.Console.Write(cout.ToString());\n }\n\n public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)\n {\n var thread = new Thread(action, stackSize);\n thread.Start();\n thread.Join();\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n long k = (long)arr[2] * 2 + Math.Min(arr[0], arr[1]) * 2 + (Math.Abs(arr[0] - arr[1]) > 0 ? 1 : 0);\n\n Console.WriteLine(k);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace algorithms_700_01\n{\n class Program\n {\n static void Main()\n {\n var array = Console.ReadLine().Split(new char[] { ' ' }).Select(x => long.Parse(x)).ToArray();\n var maxStringLength = 2 * array[2] + 2 * Math.Min(array[0], array[1]) + (array[0] == array[1] ? 0 : 1);\n Console.WriteLine(maxStringLength);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp34\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] n = Console.ReadLine().Trim().Split().Select(x=> long.Parse(x)).ToArray();\n if(Math.Abs(n[0]-n[1])<=1)\n Console.WriteLine(n[0] + n[1] + n[2] * 2);\n else\n Console.WriteLine((n[0] + n[1] + n[2] * 2)- Math.Abs(n[0] - n[1])+1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Numerics;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var abc = Console.ReadLine();\n var a = BigInteger.Parse(abc.Split()[0]);\n var b = BigInteger.Parse(abc.Split()[1]);\n var c = BigInteger.Parse(abc.Split()[2]);\n\n var max = c * 2;\n\n if (a < b)\n {\n max += a * 2 + 1;\n }\n else if (a == b)\n {\n max += a * 2;\n }\n else\n {\n max += b * 2 + 1;\n }\n\n\n Console.WriteLine(max);\n\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Diagnostics;\n\nclass Myon\n{\n public Myon() { }\n public static int Main()\n {\n new Myon().calc();\n return 0;\n }\n\n Scanner cin;\n\n\n void calc()\n {\n cin = new Scanner();\n long a, b, c;\n a = cin.nextInt();\n b = cin.nextInt();\n c = cin.nextInt();\n\n a = Math.Min(a, b + 1);\n b = Math.Min(b, a + 1);\n Console.WriteLine(a + b + c * 2);\n }\n\n}\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n string st = Console.ReadLine();\n while (st == \"\") st = Console.ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n if (s.Length == 0) return next();\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n public int[] ArrayInt(int N, int add = 0)\n {\n int[] Array = new int[N];\n for (int i = 0; i < N; i++)\n {\n Array[i] = nextInt() + add;\n }\n return Array;\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public long[] ArrayLong(int N, long add = 0)\n {\n long[] Array = new long[N];\n for (int i = 0; i < N; i++)\n {\n Array[i] = nextLong() + add;\n }\n return Array;\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n\n\n public double[] ArrayDouble(int N, double add = 0)\n {\n double[] Array = new double[N];\n for (int i = 0; i < N; i++)\n {\n Array[i] = nextDouble() + add;\n }\n return Array;\n }\n}\n\nclass XRand\n{\n uint x, y, z, w;\n\n\n public XRand()\n {\n init();\n }\n\n public XRand(uint s)\n {\n init();\n init_xor128(s);\n }\n\n void init()\n {\n x = 314159265; y = 358979323; z = 846264338; w = 327950288;\n\n }\n\n public void init_xor128(uint s)\n {\n z ^= s;\n z ^= z >> 21; z ^= z << 35; z ^= z >> 4;\n z *= 736338717;\n }\n\n uint next()\n {\n uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;\n }\n\n public long nextLong(long m)\n {\n return (long)((((ulong)next() << 32) + next()) % (ulong)m);\n }\n\n public int nextInt(int m)\n {\n return (int)(next() % m);\n }\n\n public int nextIntP(int a)\n {\n return (int)Math.Pow(a, nextDouble());\n }\n\n public int nextInt(int min, int max)\n {\n return min + nextInt(max - min + 1);\n }\n\n\n public double nextDouble()\n {\n return (double)next() / uint.MaxValue;\n }\n\n public double nextDoubleP(double a)\n {\n return Math.Pow(a, nextDouble());\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int a = abc[0], b = abc[1], c = abc[2];\n long kq = 2 * c;\n if (a == b) Console.WriteLine(kq + a + b);\n else Console.WriteLine(kq + 2*Math.Min(a, b)+1);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\npublic class Class2\n{\n static void Main()\n {\n string str;\n while ((str = Console.ReadLine()) != null)\n {\n var res = Func(str);\n Console.WriteLine(res);\n }\n }\n static long Func(string str)\n {\n var a = str.Split().Select(x => long.Parse(x)).ToArray();\n return Math.Min(a[0], a[1]) * 2 + a[2] * 2 + (Math.Abs(a[0] - a[1]) > 0 ? 1 : 0);\n }\n}"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = Convert.ToInt64(s[0]);\n long b = Convert.ToInt64(s[1]);\n long c = Convert.ToInt64(s[2]);\n long temp=c*2;\n if (a>=b) {temp+=b*2;}\n else {temp+=a*2;}\n if (a>b) temp++;\n if (b>a) temp++;\n Console.WriteLine(temp);\n }\n }\n}"}, {"source_code": "// Problem: 1148A - Another One Bites The Dust\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass AnotherOneBitesTheDust\n {\n public static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = new char[] {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 3)\n return -1;\n uint a;\n if (!UInt32.TryParse (words[0], out a))\n return -1;\n if (a < 1 || a > 1000000000)\n return -1;\n uint b;\n if (!UInt32.TryParse (words[1], out b))\n return -1;\n if (b < 1 || b > 1000000000)\n return -1;\n uint c;\n if (!UInt32.TryParse (words[2], out c))\n return -1;\n if (c < 1 || c > 1000000000)\n return -1;\n uint countAB = c + Math.Min (a,b);\n uint ans = 2*countAB;\n if (a != b)\n ans++;\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n long[] array = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);\n long sum = Math.Min(array[0], array[1]) * 2 + array[2] * 2;\n Console.WriteLine(array[0] == array[1] ? sum : sum + 1);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Security.Cryptography;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong a = inputs1[0];\n\t\t\tlong b = inputs1[1];\n\t\t\tlong ab = inputs1[2];\n\n\t\t\tlong length = 0;\n\t\t\tif (a > b) \n\t\t\t{\n\t\t\t\tlength = 2 * ab + b + b + 1;\n\t\t\t} \n\t\t\telse if(a < b)\n\t\t\t{\n\t\t\t\tlength = 2 * ab + a + a + 1;\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tlength = 2 * ab + a + b;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(length);\n\t\t}\n\n\t\tpublic class Node\n\t\t{\n\t\t\tpublic int Count { get; set; }\n\n\t\t\tpublic int FirstIndex { get; set; } = -1;\n\n\t\t\tpublic int LastIndex { get; set; } = -1;\n\t\t}\n\n\t\t//public class Node\n\t\t//{\n\t\t//\tpublic Node Left { get; set; }\n\n\t\t//\tpublic Node Right { get; set; }\n\n\t\t//\tpublic T Value { get; set; }\n\n\t\t//\tpublic Node(T value) \n\t\t//\t{\n\t\t//\t\tValue = value;\n\t\t//\t}\n\t\t//}\n\n\t\t//public class Tree\n\t\t//{\n\t\t//\tpublic Node Root { get; set; }\n\n\t\t//\tpublic Tree(T value) \n\t\t//\t{\n\t\t//\t\tRoot = new Node(value);\n\t\t//\t}\n\t\t//}\n\n\t\tprivate static long GCD(long a, long b)\n\t\t{\n\t\t\tlong max = Math.Max(a, b);\n\t\t\tlong min = Math.Min(a, b);\n\n\t\t\tif (min == 0)\n\t\t\t{\n\t\t\t\treturn max;\n\t\t\t}\n\n\t\t\ta = min;\n\t\t\tb = max % min;\n\t\t\treturn GCD(a, b);\n\t\t}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "/*\n\n a b ab\n\n b ab a\n\n\n 3 5 2 \n\n 1 3 0 8 \n b 1 2 0 9\n ba 0 2 0 10\n bab 0 1 0 11\n\n\n 3 1 3\n 2 0 2 4\n a a ab ab 4\n\n\n\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Diagnostics;\n\npublic class Solver\n{\n public void Solve()\n {\n int a = ReadInt();\n int b = ReadInt();\n int c = ReadInt();\n long ans = c*2;\n ans += Math.Min(a, b) + Math.Min(Math.Max(a, b), Math.Min(a, b) + 1);\n Write(ans);\n return;\n int[] types = ReadIntArray();\n\n string[] tvalues = new string[] {\"a\", \"b\", \"ab\"};\n int min = types.Min();\n long count = (long)min * 4;\n types[0] -= min;\n types[1] -= min;\n types[2] -= min;\n\n int mi = -1;\n while (types.Max() > 0) \n {\n int next = -1;\n for (int i = 0; i < types.Length; i++) \n {\n bool isValid = mi == -1 || tvalues[i].Last() != tvalues[mi].Last();\n bool isMax = types[i] > 0 && (next == -1 || types[next] < types[i]);\n if (isValid && isMax)\n next = i;\n }\n if (next == -1)\n break;\n mi = next;\n Debug.WriteLine(mi);\n types[mi]--;\n count += mi == 2 ? 2 : 1;\n }\n Write(count);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n Debug.Listeners.Clear();\n Debug.Listeners.Add(new ConsoleTraceListener());\n Trace.Listeners.Clear();\n Trace.Listeners.Add(new ConsoleTraceListener());\n\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n new Solver().Solve();\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar (a, b, c) = Long3();\n\t\t\tvar diff = Math.Abs(b - a);\n\t\t\tConsole.WriteLine(2*c + 2*Math.Min(a, b) + (diff > 0 ? 1 : 0));\n\t\t}\n\n\t\tstatic int Int()\n\t\t{\n\t\t\treturn Int32.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (int, int) Int2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (int, int, int) Int3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t\treturn (arr[0], arr[1], arr[3]);\n\t\t}\n\n\n\t\tstatic int[] Ints()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n\t\t}\n\n\t\tstatic long Long()\n\t\t{\n\t\t\treturn Int64.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic (long, long) Long2()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1]);\n\t\t}\n\n\t\tstatic (long, long, long) Long3()\n\t\t{\n\t\t\tvar arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t\treturn (arr[0], arr[1], arr[2]);\n\t\t}\n\n\t\tstatic long[] Longs()\n\t\t{\n\t\t\treturn Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);\n\t\t}\n\n\t\tstatic string Str()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic void Swap(ref T a, ref T b)\n\t\t{\n\t\t\tvar t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\t}\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Problem{\n \n public class Solution{\n \n public static void Main(){\n \n int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n \n int a = nums[0];\n int b = nums[1];\n int c = nums[2];\n \n int totalLength = c*2;\n \n if(a > b){\n totalLength += 2*b + 1;\n }else if(a < b){\n totalLength += 2*a + 1;\n }else{\n totalLength += 2*b;\n }\n \n Console.WriteLine(totalLength);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Another_One_Bites_The_Dust\n{\n class Program\n {\n static void Main(string[] args)\n {\n int answer = 0;\n\n String[] vs = Console.ReadLine().Split(' ');\n int a = Convert.ToInt32(vs[0]);\n int b = Convert.ToInt32(vs[1]);\n int c = Convert.ToInt32(vs[2]);\n\n answer = c * 2;\n\n answer += Math.Min(a, b) * 2;\n\n if (a != b)\n answer++;\n\n Console.WriteLine(answer);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\nusing Debug = System.Diagnostics.Debug;\nusing MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;\nusing MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;\n\nstatic class P\n{\n static void Main()\n {\n var abc = Console.ReadLine().Split().Select(long.Parse).ToArray();\n Console.WriteLine(Min(abc[0], abc[1]) * 2 + abc[2] * 2);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp34\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] n = Console.ReadLine().Trim().Split().Select(x=> long.Parse(x)).ToArray();\n if(Math.Abs(n[0]-n[1])<=1)\n Console.WriteLine(n[0] + n[1] + n[2] * 2);\n else\n Console.WriteLine(n[0]-1 + n[1] + n[2] * 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp34\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Trim().Split().Select(x=> int.Parse(x)).ToArray();\n Console.WriteLine(n[0] + n[1] + n[2] * 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace ConsoleApp34\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] n = Console.ReadLine().Trim().Split().Select(x=> int.Parse(x)).ToArray();\n if(Math.Abs(n[0]-n[1])<=1)\n Console.WriteLine(n[0] + n[1] + n[2] * 2);\n else\n Console.WriteLine(n[0]-1 + n[1] + n[2] * 2);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int a = abc[0], b = abc[1], c = abc[2];\n int kq = 2 * c;\n if (a == b) Console.WriteLine(kq + a + b);\n else Console.WriteLine(kq + 2*Math.Min(a, b)+1);\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n int a = abc[0], b = abc[1], c = abc[2];\n int kq = 2 * c;\n if (a == b) Console.WriteLine(kq + a + b);\n else Console.WriteLine(kq + Math.Min(a, b));\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\npublic class Class2\n{\n static void Main()\n {\n string str;\n while ((str = Console.ReadLine()) != null)\n {\n var res = Func(str);\n Console.WriteLine(res);\n }\n }\n static int Func(string str)\n {\n var a = str.Split().Select(x => int.Parse(x)).ToArray();\n return Math.Min(a[0], a[1]) * 2 + a[2] * 2 + (Math.Abs(a[0] - a[1]) > 0 ? 1 : 0);\n }\n}"}, {"source_code": "using System;\n\nstatic class Program\n{\n static void Main()\n {\n int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n long sum = Math.Min(array[0], array[1]) * 2 + array[2] * 2;\n Console.WriteLine(array[0] == array[1] ? sum : sum + 1);\n }\n}"}, {"source_code": "/*\n\n a b ab\n\n b ab a\n\n\n 3 5 2 \n\n 1 3 0 8 \n b 1 2 0 9\n ba 0 2 0 10\n bab 0 1 0 11\n\n\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Diagnostics;\n\npublic class Solver\n{\n public void Solve()\n {\n int[] types = ReadIntArray();\n string[] tvalues = new string[] {\"a\", \"b\", \"ab\"};\n int min = types.Min();\n long count = (long)min * 4;\n types[0] -= min;\n types[1] -= min;\n types[2] -= min;\n\n int mi = -1;\n while (types.Max() > 0) \n {\n int next = -1;\n for (int i = 0; i < types.Length; i++) \n {\n bool isValid = mi == -1 || tvalues[i].Last() != tvalues[mi].Last();\n bool isMax = types[i] > 0 && (next == -1 || types[next] < types[i]);\n if (isValid && isMax)\n next = i;\n }\n if (next == -1)\n break;\n mi = next;\n types[mi]--;\n count += mi == 2 ? 2 : 1;\n }\n Write(count);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n Debug.Listeners.Clear();\n Debug.Listeners.Add(new ConsoleTraceListener());\n Trace.Listeners.Clear();\n Trace.Listeners.Add(new ConsoleTraceListener());\n\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n new Solver().Solve();\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n"}], "src_uid": "609f131325c13213aedcf8d55fc3ed77"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing static System.Math;\n\npublic static class P\n{\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n / 2 - 1 + n % 2);\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _804A\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n + 1) / 2 - 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Find_Amir\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n - 1) / 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _804A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : (n - 1) / 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Globalization;\nusing System.Diagnostics;\n\n\n\nclass Myon\n{\n public Myon() { }\n public static int Main()\n {\n new Myon().calc();\n return 0;\n }\n\n Scanner cin;\n\n\n void calc()\n {\n cin = new Scanner();\n int N = cin.nextInt();\n Console.WriteLine((N - 1) / 2);\n }\n\n \n}\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n string st = Console.ReadLine();\n while (st == \"\") st = Console.ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n\n}"}, {"source_code": "using System;\n\nnamespace First\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = Convert.ToInt32(Console.ReadLine());\n if(n % 2 == 0)\n {\n Console.WriteLine(n / 2 - 1);\n }\n else\n {\n Console.WriteLine(n / 2);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nnamespace cf411\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_cf411C();\n }\n public static void solve_cf411C()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n \n int i = 2;\n int j = n;\n int min = 0;\n while (i < j)\n {\n min += (i + j) % (n + 1);\n i++;\n j--;\n }\n\n Console.WriteLine(min);\n //Maybe formula does not exists\n //Console.WriteLine(n < 2 ? 0 : (n + 2) / 3);\n }\n\n public static void solve_cf411B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 2;\n int s = 1;\n List ans = new List();\n for (int i = 0; i < n; i++)\n {\n if (k <= i)\n {\n k += 2;\n s = s == 1 ? 2 : 1;\n }\n\n if (s == 1)\n {\n ans.Add('a');\n }\n else\n {\n ans.Add('b');\n }\n }\n\n Console.WriteLine(new String(ans.ToArray()));\n }\n\n }\n}\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n new Magatro().Solve();\n }\n}\n\npublic class Scanner\n{\n private StreamReader Sr;\n\n private string[] S;\n private int Index;\n private const char Separator = ' ';\n\n public Scanner(Stream source)\n {\n Index = 0;\n S = new string[0];\n Sr = new StreamReader(source);\n }\n\n private string[] Line()\n {\n return Sr.ReadLine().Split(Separator);\n }\n\n public string Next()\n {\n string result;\n if (Index >= S.Length)\n {\n S = Line();\n Index = 0;\n }\n result = S[Index];\n Index++;\n return result;\n }\n public int NextInt()\n {\n return int.Parse(Next());\n }\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n public long NextLong()\n {\n return long.Parse(Next());\n }\n public decimal NextDecimal()\n {\n return decimal.Parse(Next());\n }\n public string[] StringArray(int index = 0)\n {\n Next();\n Index = S.Length;\n return S.Skip(index).ToArray();\n }\n public int[] IntArray(int index = 0)\n {\n return StringArray(index).Select(int.Parse).ToArray();\n }\n public long[] LongArray(int index = 0)\n {\n return StringArray(index).Select(long.Parse).ToArray();\n }\n public bool EndOfStream\n {\n get { return Sr.EndOfStream; }\n }\n}\n\nclass Magatro\n{\n private int N;\n private void Scan()\n {\n var cin = new Scanner(Console.OpenStandardInput());\n N = cin.NextInt();\n }\n public void Solve()\n {\n Scan();\n int c = (N + 1) / 2;\n Console.WriteLine(c - 1);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : n / 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n int N = int.Parse(Console.ReadLine());\n sb.Append((N-1)/2+\"\\n\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\n\t\tConsole.WriteLine((N-1)/2);\n\t\t\n\t}\n\tint N;\n\tpublic Sol(){\n\t\tN = ri();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n\n\nclass Pair : IComparable {\n\tpublic int Pos;\n\tpublic long Cost;\n\tpublic Pair(int p, long c) {\n\t\tPos = p; Cost = c;\n\t}\n\tpublic int CompareTo(Pair t) {\n\t\t//return this.Cost > t.Cost ? -1 : this.Cost < t.Cost ? 1 : 0;\n\t\treturn this.Cost > t.Cost ? 1 : this.Cost < t.Cost ? -1 : 0;\n\t}\n}\n\n\nclass SkewHeap where T:IComparable{\n\tpublic int Count{\n\t\tget{return cnt;}\n\t\tprivate set{cnt=value;}\n\t}\n\t\n\tpublic SkewHeap(){\n\t\troot=null;\n\t\tthis.Count=0;\n\t}\n\t\n\tpublic void Push(T v){\n\t\tNodeSH p=new NodeSH(v);\n\t\troot=NodeSH.Meld(root,p);\n\t\tthis.Count++;\n\t}\n\t\n\tpublic void Pop(){\n\t\tif(root==null)return;\n\t\troot=NodeSH.Meld(root.L,root.R);\n\t\tthis.Count--;\n\t}\n\t\n\tpublic T Top{\n\t\tget{return root.Val;}\n\t}\n\t\n\tint cnt;\n\tNodeSH root;\n\t\n\tclass NodeSH where S : IComparable {\n\t\tpublic NodeSH L, R;\n\t\tpublic S Val;\n\n\t\tpublic NodeSH(S v){\n\t\t\tVal = v;\n\t\t\tL = null; R = null;\n\t\t}\n\t\tpublic static NodeSH Meld(NodeSH a, NodeSH b){\n\t\t\tif(a == null)return b;\n\t\t\tif (b == null) return a;\n\t\t\tif (a.Val.CompareTo(b.Val) > 0) swap(ref a, ref b);\n\t\t\ta.R = Meld(a.R, b);\n\t\t\tswap(ref a.L, ref a.R);\n\t\t\treturn a;\n\t\t}\n\n\t\tstatic void swap(ref U x, ref U y) {\n\t\t\tU t = x; x = y; y = t;\n\t\t}\n\t}\n}\n"}, {"source_code": "/* Date: 06.05.2017 * Time: 21:45 */\n\nusing System;\nusing System.IO;\nusing System.Globalization;\n\nclass Example\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tConsole.Write (((n - 1)/2));\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Diagnostics;\nusing static System.Console;\nusing Pair = System.Collections.Generic.KeyValuePair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().Solve();\n Out.Flush();\n }\n Scanner cin = new Scanner();\n Random rnd = new Random();\n Stopwatch sw = new Stopwatch();\n readonly int[] dd = { 0, 1, 0, -1, 0 };\n readonly int mod = 1000000007;\n readonly string alfa = \"abcdefghijklmnopqrstuvwxyz\";\n\n\n\n\n int N;\n void Solve()\n {\n N = cin.Nextint;\n if (N % 2 == 0)\n {\n int d = N / 2;\n WriteLine(d - 1);\n }\n else\n {\n int d = N / 2;\n WriteLine(d);\n }\n }\n\n}\n\nclass Scanner\n{\n string[] s; int i;\n char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] Scan { get { return ReadLine().Split(); } }\n public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }\n public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }\n public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }\n public string Next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return Next;\n }\n }\n public int Nextint { get { return int.Parse(Next); } }\n public long Nextlong { get { return long.Parse(Next); } }\n public double Nextdouble { get { return double.Parse(Next); } }\n}"}, {"source_code": "using System;\n\npublic class Solve\n{\n\tstatic void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"{0}\",(n-1)/2);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n\n class Node\n {\n public int Val { get; set; }\n public List Nodes { get; set; }\n }\n\n class Program\n {\n\n public void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var res = (n - 1) / 2;\n Console.WriteLine(res);\n \n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n } \n }\n}\n"}, {"source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n / 2 - (n%2==0?1:0)));\n }\n }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing Number = System.Int64;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n IO.Printer.Out.WriteLine((n - 1) / 2);\n }\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer: StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "using System;\n\nclass A804 {\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine((n - 1) >> 1);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n Console.Write(Math.Ceiling((double)n/2)-1);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing System.Xml.Schema;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n int inputData = int.Parse(Console.ReadLine());\n if(inputData == 1)\n Console.WriteLine(0);\n else if (inputData % 2 == 1)\n Console.WriteLine((inputData-1)/2);\n else \n Console.WriteLine(inputData/2 - 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Find_Amir\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n writer.WriteLine((n - 1)/2);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _804A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int result = (n + 1) / 2 - 1;\n Console.WriteLine(result);\n Console.ReadLine();\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Fuck\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n Console.WriteLine(n / 2 - 1);\n else\n Console.WriteLine(n / 2);\n }\n }\n}\n"}, {"source_code": "// Problem: 804A - Find Amir\n// Author: Gusztav Szmolik\n\nusing System;\n\nnamespace Find_Amir\n\t{\n\tclass Program\n\t\t{\n\t\tstatic int Main ()\n\t\t\t{\n\t\t\tstring[] tmp = Console.ReadLine().Split();\n\t\t\tif (tmp.Length != 1)\n\t\t\t\treturn -1;\n\t\t\tuint n = 0;\n\t\t\tif (!UInt32.TryParse(tmp[0], out n))\n\t\t\t\treturn -1;\n\t\t\tif (n < 1 || n > 100000)\n\t\t\t\treturn -1;\n\t\t\tushort minCost = (n%2 == 1 ? Convert.ToUInt16((n-1)/2) : Convert.ToUInt16((n-2)/2));\n\t\t\tConsole.WriteLine (minCost);\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n"}, {"source_code": "namespace ZTCodeforces\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n\n public static class Program\n {\n public static void Main(string[] args)\n {\n Console.WriteLine(new FindAmir().Solve(new TextInputHelper(Console.In)));\n }\n }\n\n internal class FindAmir : CodeforcesSolverBase\n {\n public string Solve(InputHelper input)\n {\n int n = input.Read();\n return ((n - 1) / 2).ToString();\n }\n }\n\n internal interface CodeforcesSolverBase\n {\n string Solve(InputHelper input);\n }\n\n public abstract class InputHelper\n {\n private string data;\n private IEnumerator current;\n\n public T Read()\n {\n ThrowIfNoNext();\n lock (data)\n {\n var r = data;\n data = null;\n return (T)Convert.ChangeType(r, typeof(T));\n }\n }\n\n public bool HasNext()\n {\n return data != null || EnsureData();\n }\n\n /// \n /// Gets the next group of tokens. Returns null if no more groups are available.\n /// \n /// Next group or null.\n protected abstract IEnumerable GetNextGroup();\n\n private void ThrowIfNoNext()\n {\n if (!HasNext())\n {\n throw new InvalidOperationException(\"no more data\");\n }\n }\n\n private bool EnsureData()\n {\n if (data == null)\n {\n while (current == null || !current.MoveNext())\n {\n var next = GetNextGroup();\n\n if (next == null)\n {\n return false;\n }\n\n current = next.GetEnumerator();\n }\n\n data = current.Current;\n }\n\n return true;\n }\n }\n\n public class TextInputHelper : InputHelper\n {\n private TextReader reader;\n\n public TextInputHelper(TextReader reader)\n {\n this.reader = reader;\n }\n\n protected override IEnumerable GetNextGroup()\n {\n if (this.reader == null)\n {\n return null;\n }\n var cur = this.reader;\n this.reader = null;\n return cur.ReadWordsToEnd();\n }\n }\n\n internal static class Extensions\n {\n public const int Mod = 1000000007;\n\n /// \n /// Reads to end for the words separated by spaces from the reader.\n /// \n /// Text source to read.\n /// A list of words.\n public static IEnumerable ReadWordsToEnd(this TextReader reader)\n {\n for (var lines = reader.ReadWords(); lines != null; lines = reader.ReadWords())\n foreach (string word in lines)\n yield return word;\n }\n\n /// \n /// Reads a line through the reader and returns the words separated by spaces.\n /// \n /// Text source to read.\n /// A list of words or null.\n public static IEnumerable ReadWords(this TextReader reader)\n {\n string line = reader.ReadLine();\n return line == null ? null : line.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n SolveA();\n }\n\n private static void SolveA()\n {\n long n = RL();\n var ans = (n - 1) / 2;\n Console.WriteLine(ans);\n\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Globalization;\nusing System.IO;\n//using System.Linq;\nusing System.Text;\n\nnamespace ContestRuns\n{\n using System.ComponentModel;\n using System.Linq;\n using System.ServiceProcess;\n\n class Program\n {\n class Edge\n {\n public int a, b, cap, flow;\n };\n\n private static int n, source, target;\n private static int[] d, ptr, q;\n private static List e = new List();\n private static List> g;\n\n static void add_edge(int a, int b, int cap)\n {\n Edge e1 = new Edge {a = a, b = b, cap = cap, flow = 0};\n Edge e2 = new Edge {a = b, b = a, cap = 0, flow = 0};\n g[a].Add(e.Count);\n e.Add(e1);\n g[b].Add(e.Count);\n e.Add(e2);\n }\n\n static bool bfs()\n {\n int qh = 0, qt = 0;\n q[qt++] = source;\n\n d = Enumerable.Repeat(-1, n).ToArray();\n d[source] = 0;\n while (qh < qt && d[target] == -1)\n {\n int v = q[qh++];\n for (int i = 0; i < g[v].Count; ++i)\n {\n int id = g[v][i],\n to = e[id].b;\n if (d[to] == -1 && e[id].flow < e[id].cap)\n {\n q[qt++] = to;\n d[to] = d[v] + 1;\n }\n }\n }\n return d[target] != -1;\n }\n\n static int dfs(int v, int flow)\n {\n if (flow <= 0) return 0;\n if (v == target) return flow;\n for (; ptr[v] < g[v].Count; ++ptr[v])\n {\n int id = g[v][ptr[v]],\n to = e[id].b;\n if (d[to] != d[v] + 1) continue;\n int pushed = dfs(to, Math.Min(flow, e[id].cap - e[id].flow));\n if (pushed != 0)\n {\n e[id].flow += pushed;\n e[id ^ 1].flow -= pushed;\n return pushed;\n }\n }\n return 0;\n }\n\n static int dinic()\n {\n int flow = 0;\n for (;;)\n {\n if (!bfs()) break;\n ptr = new int[n];\n for (;;)\n {\n int pushed = dfs(source, int.MaxValue);\n if (pushed == 0) break;\n flow += pushed;\n }\n }\n return flow;\n }\n\n#if DEBUG\n static readonly TextReader input = File.OpenText(@\"../../A/A.in\");\n static readonly TextWriter output = File.CreateText(@\"../../A/A.out\");\n#else\n static readonly TextReader input = Console.In;\n static readonly TextWriter output = Console.Out;\n#endif\n\n class Horse\n {\n public decimal distForHorse;\n public decimal timeAlready;\n };\n class Edge1\n {\n public int from, to;\n public decimal dist;\n };\n private static void SolveA()\n {\n int T = int.Parse(input.ReadLine());\n\n output.WriteLine((T/2 + T%2)-1);\n //int[] inp = input.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n\n static void Main(string[] args)\n {\n SolveA();\n output.Flush();\n }\n }\n\n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace CodeForces\n{\n static class Program\n {\n static void Main()\n {\n const string filePath = @\"Data\\R411\u04212.txt\";\n if (System.IO.File.Exists(filePath))\n {\n Console.SetIn(new System.IO.StreamReader(filePath));\n }\n\n IProblem counter = new R411\u0421();\n\n foreach (var result in counter.GetResults())\n {\n Console.WriteLine(result);\n }\n }\n }\n\n internal class R411\u0421 : ProblemBase\n {\n public override IEnumerable GetResults()\n {\n var n = this.ReadInt32();\n if (n % 2 == 1)\n {\n yield return (n / 2).ToString();\n }\n else\n {\n yield return (n / 2 - 1).ToString();\n }\n }\n }\n\n abstract class MultipleTestsBase : ProblemBase\n {\n public sealed override IEnumerable GetResults()\n {\n var t = Convert.ToInt32(Console.ReadLine());\n for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)\n {\n foreach (var result in this.GetTestResult(testCaseNumber + 1))\n {\n yield return result;\n }\n\n }\n\n }\n\n protected abstract IEnumerable GetTestResult(int caseNumber);\n }\n\n public interface IProblem\n {\n IEnumerable GetResults();\n }\n\n public abstract class ProblemBase : IProblem\n {\n /// \n /// Pring array of T\n /// \n /// Generic paramter.\n /// The items.\n /// The message shown first.\n public void PrintArray(IEnumerable items, string prefixMessage)\n {\n Console.WriteLine(\"{0}: {1}\", prefixMessage, string.Join(\",\", items));\n }\n\n public void WriteDiagnostics(string message, params object[] objects)\n {\n Console.WriteLine(message, objects);\n }\n\n public virtual IEnumerable GetResults()\n {\n yield return \"No result\";\n }\n\n protected int[] ReadIntArray()\n {\n return Array.ConvertAll(ReadTokens(), Convert.ToInt32);\n }\n\n protected string[] ReadTokens()\n {\n var readLine = Console.ReadLine();\n if (readLine == null)\n {\n throw new Exception(\"Value read from Console is null\");\n }\n return readLine.Split(' ');\n }\n\n protected int ReadInt32()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\n\n\nnamespace ConsoleApp23\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n-1)/2);\n \n }\n \n }\n}"}, {"source_code": "using System;\nclass P {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : n / 2);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tinternal class Template\n\t{\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar n = cin.NextInt();\n\t\t\tvar res = ((n + 1)/2) - 1;\n\t\t\tConsole.WriteLine(res);\n\t\t}\n\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n#if DEBUG\n\t\t\tvar inputText = File.ReadAllText(@\"..\\..\\input.txt\");\n\t\t\tvar testCases = inputText.Split(new[] { \"input\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\tvar consoleOut = Console.Out;\n\t\t\tfor (var i = 0; i < testCases.Length; i++)\n\t\t\t{\n\t\t\t\tvar parts = testCases[i].Split(new[] { \"output\" }, StringSplitOptions.RemoveEmptyEntries);\n\t\t\t\tConsole.SetIn(new StringReader(parts[0].Trim()));\n\t\t\t\tvar stringWriter = new StringWriter();\n\t\t\t\tConsole.SetOut(stringWriter);\n\t\t\t\tvar sw = Stopwatch.StartNew();\n\t\t\t\tnew Template().Solve();\n\t\t\t\tsw.Stop();\n\t\t\t\tvar output = stringWriter.ToString();\n\n\t\t\t\tConsole.SetOut(consoleOut);\n\t\t\t\tvar color = ConsoleColor.Green;\n\t\t\t\tvar status = \"Passed\";\n\t\t\t\tif (parts[1].Trim() != output.Trim())\n\t\t\t\t{\n\t\t\t\t\tcolor = ConsoleColor.Red;\n\t\t\t\t\tstatus = \"Failed\";\n\t\t\t\t}\n\t\t\t\tConsole.ForegroundColor = color;\n\t\t\t\tConsole.WriteLine(\"Test {0} {1} in {2}ms\", i + 1, status, sw.ElapsedMilliseconds);\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t\tConsole.ReadKey();\n#else\n\t\t\tnew Template().Solve();\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = { ' ' };\n\n\t\tpublic string NextString()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(NextString());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(NextString());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(NextString());\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Dev2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n if (n < 2)\n Console.Write(0);\n else if (n %2!=0)\n Console.WriteLine(n/2);\n else\n Console.Write(n / 2 - 1);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace _805C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n - 1) / 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Globalization;\n\npublic class Solution\n{\n public TextInput cin;\n public TextOutput cout;\n public TextOutput cerr;\n \n public virtual void Solve()\n {\n var n = cin.Read();\n cout.WriteLine((n - 1) / 2);\n }\n}\n\n#region Core\nstatic class MainClass\n{\n // public static readonly TextInput cin = new TextInput(\"building.in\");// new TextInput(Console.In);\n // public static readonly TextOutput cout = new TextOutput(\"building.out\");//new TextOutput(Console.Out);\n public static readonly TextInput cin = new TextInput(Console.In);\n public static readonly TextOutput cout = new TextOutput(Console.Out);\n public static readonly TextOutput cerr = new TextOutput(Console.Error);\n#if !DEBUG\n static void Main()\n {\n new Solution\n {\n cin = cin,\n cout = cout,\n cerr = cerr\n }.Solve();\n }\n#endif\n}\npublic class SDictionary : Dictionary\n{\n public new TValue this[TKey key]\n {\n get\n {\n TValue res;\n base.TryGetValue(key, out res);\n return res;\n }\n set\n {\n base[key] = value;\n }\n }\n}\npublic static class Ext\n{\n public static string ToString(this decimal v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n public static string ToString(this double v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n public static string ToString(this float v, int precision)\n {\n return v.ToString(\"0.\" + new string('0', precision), CultureInfo.InvariantCulture);\n }\n #region Prewriten\n public static void Foreach(this IEnumerable elements, Action action)\n {\n foreach (var element in elements)\n {\n action(element);\n }\n }\n public static void Foreach(this IEnumerable elements, Action action)\n {\n var index = 0;\n foreach (var element in elements)\n {\n action(element, index++);\n }\n }\n public static void Do(int from, int n, Action action)\n {\n for (var i = from; i < n; i++) action(i);\n }\n public static IEnumerable Init(int n) where T : new()\n {\n for (var i = 0; i < n; i++)\n {\n yield return new T();\n }\n }\n public static IEnumerable Init(int n, T defaultValue = default(T))\n {\n for (var i = 0; i < n; i++)\n {\n yield return defaultValue;\n }\n }\n public static IEnumerable Init(int n, Func builder)\n {\n for (var i = 0; i < n; i++)\n {\n yield return builder();\n }\n }\n public static IEnumerable Init(int n, Func builder)\n {\n for (var i = 0; i < n; i++)\n {\n yield return builder(i);\n }\n }\n public static bool IsEmpty(this string s)\n {\n return string.IsNullOrEmpty(s);\n }\n public static string Safe(this string s)\n {\n return s.IsEmpty() ? string.Empty : s;\n }\n public static void Swap(ref T a, ref T b)\n {\n T c = a;\n a = b;\n b = c;\n }\n public static long Gcd(long a, long b)\n {\n while (a > 0)\n {\n b %= a;\n Swap(ref a, ref b);\n }\n return b;\n }\n public static int[] ZFunction(string s)\n {\n var z = new int[s.Length];\n for (int i = 1, l = 0, r = 0; i < s.Length; ++i)\n {\n if (i <= r)\n {\n z[i] = Math.Min(r - i + 1, z[i - l]);\n }\n while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])\n {\n z[i]++;\n }\n if (i + z[i] - 1 > r)\n {\n l = i;\n r = i + z[i] - 1;\n }\n }\n return z;\n }\n public static long Pow(long a, long p)\n {\n var b = 1L;\n while (p > 0)\n {\n if ((p & 1) == 0)\n {\n a *= a;\n p >>= 1;\n }\n else\n {\n b *= a;\n p--;\n }\n }\n return b;\n }\n #endregion\n}\n\npublic delegate bool TryParseDelegate(string s, NumberStyles style, IFormatProvider format, out T value);\npublic class TextInput\n{\n private static Dictionary primitiveParsers = new Dictionary\n {\n { typeof(sbyte), new TryParseDelegate(sbyte.TryParse) },\n { typeof(short), new TryParseDelegate(short.TryParse) },\n { typeof(int), new TryParseDelegate(int.TryParse) },\n { typeof(long), new TryParseDelegate(long.TryParse) },\n\n { typeof(byte), new TryParseDelegate(byte.TryParse) },\n { typeof(ushort), new TryParseDelegate(ushort.TryParse) },\n { typeof(uint), new TryParseDelegate(uint.TryParse) },\n { typeof(ulong), new TryParseDelegate(ulong.TryParse) },\n\n { typeof(float), new TryParseDelegate(float.TryParse) },\n { typeof(double), new TryParseDelegate(double.TryParse) },\n { typeof(decimal), new TryParseDelegate(decimal.TryParse) },\n\n { typeof(char), new TryParseDelegate(CharParser) },\n { typeof(string), new TryParseDelegate(StringParser) }\n };\n private static bool CharParser(string s, NumberStyles style, IFormatProvider format, out char res)\n {\n res = char.MinValue;\n if (string.IsNullOrEmpty(s))\n {\n return false;\n }\n else\n {\n res = s[0];\n return true;\n }\n }\n private static bool StringParser(string s, NumberStyles style, IFormatProvider format, out string res)\n {\n res = s == null ? string.Empty : s;\n return true;\n }\n\n\n private string line = null;\n private int pos = 0;\n\n public IFormatProvider FormatProvider { get; set; }\n public NumberStyles NumberStyle { get; set; }\n public TextReader TextReader { get; set; }\n\n public TextInput(string path) : this(path, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n }\n public TextInput(string path, NumberStyles numberStyle, IFormatProvider formatProvider) : this(new StreamReader(path), numberStyle, formatProvider)\n {\n\n }\n public TextInput(TextReader textReader) : this(textReader, NumberStyles.Any, CultureInfo.InvariantCulture)\n {\n\n }\n public TextInput(TextReader textReader, NumberStyles numberStyle, IFormatProvider formatProvider)\n {\n TextReader = textReader;\n NumberStyle = numberStyle;\n FormatProvider = formatProvider;\n }\n\n public bool IsEof\n {\n get\n {\n if ((line == null || pos >= line.Length) && TextReader.Peek() == -1)\n {\n Next();\n return line == null;\n }\n return false;\n }\n }\n public void SkipWhiteSpace()\n {\n while (!IsEof)\n {\n if (line != null && pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n return;\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n continue;\n }\n while (pos < line.Length && char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n }\n }\n private void SkipWhiteSpace(bool force)\n {\n if (force)\n {\n SkipWhiteSpace();\n }\n else\n {\n SkipWhiteSpace();\n }\n }\n\n public T[] ReadArray()\n {\n var length = Read();\n return ReadArray(length);\n }\n public T[] ReadArray(int length)\n {\n var array = new T[length];\n\n var parser = GetParser();\n var style = NumberStyle;\n var format = FormatProvider;\n\n for (var i = 0; i < length; i++)\n {\n array[i] = Read(parser, style, format);\n }\n return array;\n }\n\n public bool TryReadArray(out T[] array)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array);\n }\n public bool TryReadArray(out T[] array, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, out array, length);\n }\n public bool TryReadArray(T[] array, int offset, int length)\n {\n return TryReadArray(GetParser(), NumberStyle, FormatProvider, array, offset, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array)\n {\n var length = 0;\n if (!TryRead(out length))\n {\n array = null;\n return false;\n }\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T[] array, int length)\n {\n array = new T[length];\n return TryReadArray(parser, style, format, array, 0, length);\n }\n public bool TryReadArray(TryParseDelegate parser, NumberStyles style, IFormatProvider format, T[] array, int offset, int length)\n {\n var result = true;\n for (var i = 0; i < length && result; i++)\n {\n result &= TryRead(parser, style, format, out array[offset + i]);\n }\n return result;\n }\n\n private TryParseDelegate GetParser()\n {\n var type = typeof(T);\n return (TryParseDelegate)primitiveParsers[type];\n }\n public T Read()\n {\n return Read(GetParser());\n }\n public T Read(NumberStyles style, IFormatProvider format)\n {\n return Read(GetParser(), style, format);\n }\n public T Read(TryParseDelegate parser)\n {\n return Read(parser, NumberStyle, FormatProvider);\n }\n public T Read(TryParseDelegate parser, NumberStyles style, IFormatProvider format)\n {\n T result;\n if (!TryRead(parser, style, format, out result))\n {\n throw new FormatException();\n }\n return result;\n }\n public bool TryRead(out T value)\n {\n return TryRead(GetParser(), out value);\n }\n public bool TryRead(NumberStyles style, IFormatProvider format, out T value)\n {\n return TryRead(GetParser(), style, format, out value);\n }\n public bool TryRead(TryParseDelegate parser, out T value)\n {\n return parser(ReadToken(), NumberStyle, FormatProvider, out value);\n }\n public bool TryRead(TryParseDelegate parser, NumberStyles style, IFormatProvider format, out T value)\n {\n return parser(ReadToken(), style, format, out value);\n }\n public string ReadToken()\n {\n SkipWhiteSpace(false);\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n\n if (pos >= line.Length || char.IsWhiteSpace(line[pos])) return string.Empty;\n\n var start = pos;\n while (pos < line.Length && !char.IsWhiteSpace(line[pos]))\n {\n pos++;\n }\n return line.Substring(start, pos - start);\n }\n public string ReadLine()\n {\n if (IsEof)\n {\n throw new EndOfStreamException();\n }\n if (line == null || pos >= line.Length)\n {\n Next();\n }\n\n var ans = line.Substring(pos);\n pos = line.Length;\n return ans;\n }\n\n private void Next()\n {\n line = TextReader.ReadLine();\n pos = 0;\n }\n}\n\npublic class TextOutput\n{\n public IFormatProvider FormatProvider { get; set; }\n public TextWriter TextWriter { get; set; }\n\n public TextOutput(string path) : this(path, CultureInfo.InvariantCulture)\n {\n }\n public TextOutput(string path, IFormatProvider formatProvider) : this(new StreamWriter(path), formatProvider)\n {\n\n }\n public TextOutput(TextWriter textWriter) : this(textWriter, CultureInfo.InvariantCulture)\n {\n\n }\n public TextOutput(TextWriter textWriter, IFormatProvider formatProvider)\n {\n TextWriter = textWriter;\n FormatProvider = formatProvider;\n }\n\n public TextOutput WriteArray(params T[] array)\n {\n return WriteArray(array, true);\n }\n public TextOutput WriteArray(T[] array, bool appendLine)\n {\n return WriteArray(array, 0, array.Length, appendLine);\n }\n public TextOutput WriteArray(T[] array, int offset, int length, bool appendLine = true)\n {\n var sb = new StringBuilder();\n for (var i = 0; i < length; i++)\n {\n sb.Append(Convert.ToString(array[offset + i], FormatProvider));\n if (i + 1 < length)\n {\n sb.Append(' ');\n }\n }\n return appendLine ? WriteLine(sb.ToString()) : Write(sb.ToString());\n }\n\n public TextOutput WriteLine(object obj)\n {\n return WriteLine(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput WriteLine(string text, params object[] args)\n {\n return WriteLine(string.Format(FormatProvider, text, args));\n }\n public TextOutput WriteLine(string text)\n {\n TextWriter.WriteLine(text);\n return this;\n }\n public TextOutput WriteLine(char[] buffer)\n {\n TextWriter.WriteLine(buffer);\n return this;\n }\n public TextOutput WriteLine(char[] buffer, int offset, int length)\n {\n TextWriter.WriteLine(buffer, offset, length);\n return this;\n }\n public TextOutput WriteLine()\n {\n TextWriter.WriteLine();\n return this;\n }\n\n public TextOutput Write(object obj)\n {\n return Write(Convert.ToString(obj, FormatProvider));\n }\n public TextOutput Write(string text, params object[] args)\n {\n return Write(string.Format(FormatProvider, text, args));\n }\n public TextOutput Write(string text)\n {\n TextWriter.Write(text);\n return this;\n }\n public TextOutput Write(char[] buffer)\n {\n TextWriter.Write(buffer);\n return this;\n }\n public TextOutput Write(char[] buffer, int offset, int length)\n {\n TextWriter.Write(buffer, offset, length);\n return this;\n }\n}\n#endregion"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n {\n //using (var sw = new StreamWriter(\"output.txt\")) {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var n = sr.NextInt32();\n var mid = n / 2;\n if (n % 2 == 1) {\n mid++;\n }\n var count = 0;\n for (var i = 2; i <= mid; i++) {\n count++;\n }\n\n sw.WriteLine(count);\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine((n-1)/2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n //StreamReader reader = new StreamReader(\"input.txt\"); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n int n = Convert.ToInt32(Console.ReadLine()); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n //reader.Close(); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n\n int ans = (n - 1) / 2;\n if (n <= 2)\n {\n ans = 0;\n }\n\n Console.WriteLine(ans);\n //Console.ReadKey(); // \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1A\n{\n class ProgramCCC\n {\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine((n - 1) / 2);\n }\n\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace find_amer\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((n-1)/2);\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF._0411.C {\n class Program {\n static void Main(string[ ] args) {\n uint n = uint.Parse(Console.ReadLine( ));\n Console.WriteLine((n - 1) / 2u);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n\n static string getNext(string current)\n {\n if(current.Length == 1)\n {\n var num = int.Parse(current);\n if(num < 9)\n {\n return (num + 1).ToString();\n } else\n {\n return (11).ToString();\n }\n }\n var first = int.Parse(current[0].ToString());\n var last = int.Parse(current[current.Length-1].ToString());\n\n var sb = new StringBuilder(current);\n for(var i = 1; i < current.Length - 1; i++)\n {\n sb[i] = '0';\n }\n\n if (last < first)\n {\n last = first;\n \n sb[current.Length - 1] = char.Parse(last.ToString());\n return sb.ToString();\n } else\n {\n first++;\n if(first == 10)\n {\n first = 1;\n sb.Insert(0, char.Parse(first.ToString()));\n }\n last = first;\n sb[current.Length - 1] = char.Parse(last.ToString());\n sb[0] = char.Parse(first.ToString());\n return sb.ToString();\n }\n\n }\n\n static List GetAllGcd(int num)\n {\n var all = new List();\n for (int i = 2; i * i <= num; i++)\n {\n if (num % i == 0)\n {\n all.Add(i);\n }\n if (num % i == 0 && num / i != i)\n {\n all.Add(num / i);\n }\n }\n return all;\n }\n static void Main(String[] args)\n {\n var n = double.Parse(Console.ReadLine());\n var result = Math.Ceiling(n / 2) - 1;\n Console.WriteLine(result);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n ulong n = ulong.Parse(ss[0]);\n if (n % 2 == 0)\n {\n\n Console.WriteLine(n / 2 - 1);\n\n return;\n }\n Console.WriteLine(n/2);\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\nclass P {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : n / 2 - 1 + (n + 1) / 2);\n }\n}"}, {"source_code": "using System;\nclass P {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : n / 2 + 1);\n }\n}"}, {"source_code": "using System;\nclass P {\n static void Main() {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? n / 2 - 1 : (n + 1) / 2);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n ulong n = ulong.Parse(ss[0]);\n if (n == 1)\n {\n Console.WriteLine(1);\n return;\n }\n ulong ans = 0;\n for (ulong i = 3; i <= n; i++)\n {\n if (i % 2 != 0)\n {\n ulong start = i + i + 1;\n ulong end = n + i;\n ans += ((end + start) * (end - start + 1)) / 2;\n }\n\n }\n //Console.WriteLine(ans);\n Console.WriteLine(ans % (n + 1));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n long n = long.Parse(ss[0]);\n long ans = 0;\n for (int i = 3; i <= n; i++)\n {\n if (i % 2 != 0)\n {\n long start = i + i + 1;\n long end = n + i;\n ans += ((end + start) * (end - start + 1)) / 2;\n }\n\n }\n //Console.WriteLine(ans);\n Console.WriteLine(ans % (n + 1));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n ulong n = ulong.Parse(ss[0]);\n if (n == 1)\n {\n Console.WriteLine(1);\n return;\n }\n ulong ans = ((3 + n + 1) * ((n + 1) - 3 + 1)) / 2;\n /*for (ulong i = 3; i <= n; i++)\n {\n if (i % 2 != 0)\n {\n ulong start = i + i + 1;\n ulong end = n + i;\n ans += ((end + start) * (end - start + 1)) / 2;\n }\n\n }*/\n // Console.WriteLine(ans);\n Console.WriteLine(ans % (n + 1)/2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n\n\n\n public int CompareTo(PairVariable other)\n {\n return this.a.CompareTo(other.a);\n }\n}\n\nnamespace ConsoleApplication254\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n ulong n = ulong.Parse(ss[0]);\n if (n == 1)\n {\n Console.WriteLine(1);\n return;\n }\n \n Console.WriteLine(n/2-1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Solve\n{\n\tstatic void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"{0}\",n/2);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing System.Xml.Schema;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n int inputData = int.Parse(Console.ReadLine());\n if(inputData == 1)\n Console.WriteLine(1);\n else if (inputData % 2 == 1)\n Console.WriteLine((inputData-1)/2);\n else \n Console.WriteLine(inputData/2 - 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing System.Xml.Schema;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n int inputData = int.Parse(Console.ReadLine());\n if(inputData == 1)\n Console.WriteLine(1);\n else if (inputData % 2 == 1)\n Console.WriteLine((inputData-1)/2 - 1);\n else \n Console.WriteLine(inputData/2 - 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Find_Amir\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n writer.WriteLine(n/2);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}], "src_uid": "dfe9446431325c73e88b58ba204d0e47"} {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n char[] arr;\n arr = num.ToCharArray(0, num.Length);\n num = Console.ReadLine();\n char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n\n if (arr.Length == arr2.Length)\n {\n\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] > arr[j] && (i != 0 || arr[j] != '0'))\n {\n char p = arr[i];\n arr[i] = arr[j];\n arr[j] = p;\n }\n }\n }\n int flag = 0;\n for (int k = 0; k < arr.Length; k++)\n {\n if (arr[k] != arr2[k])\n {\n flag = 1;\n break;\n }\n }\n\n if (flag == 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"OK\");\n }\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\n \nnamespace acm{\n class Program{\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.WriteLine(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n \n static void Main(string[] args) {\n#if DEBUG\n open(file);\n#endif\n\t\t\tstring n1=Console.ReadLine().Trim(), n2=Console.ReadLine().Trim();\n\t\t\tint[] digits=new int[n1.Length];\n\t\t\t\n\t\t\tif (n1.Length!=n2.Length){\n\t\t\t\tprintln(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tfor(int i=0; i0)\n {\n str.Append(new string((char)(i + '0'), keys[i]));\n }\n }\n\n var line2 = Console.ReadLine();\n if (line2==str.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nstatic class P {\n static void Main() {\n string n = Console.ReadLine(), m = Console.ReadLine(), r = get_min_num(n);\n Console.WriteLine(r == m ? \"OK\" : \"WRONG_ANSWER\");\n }\n static string get_min_num(string num) {\n var a = num.ToArray(); Array.Sort(a); int i = 0;\n while (a[i++] == '0' && i < a.Length) ;\n if (--i != 0) { var t = a[0]; a[0] = a[i]; a[i] = t; }\n return string.Join(\"\", a);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_20\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s =Console.ReadLine();\n string ss =Console.ReadLine();\n int[] mas = new int[s.Length];\n int[] mas2 = new int[s.Length];\n if (s.Length != ss.Length) Console.WriteLine(\"WRONG_ANSWER\");\n else\n {\n for (int i = 0; i < s.Length; i++)\n mas[i] = int.Parse(s[i].ToString());\n\n for (int i = 0; i < s.Length; i++)\n mas2[i] = int.Parse(ss[i].ToString());\n Array.Sort(mas);\n if (mas[0] == 0)\n for (int i = 1; i < s.Length; i++)\n if (mas[i] != 0)\n {\n mas[0] = mas[i];\n mas[i] = 0;\n break;\n }\n bool b = false;\n for (int i = 0; i < s.Length; i++)\n if (mas[i] != mas2[i])\n {\n b = true;\n break;\n }\n if (!b) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CodeForces\n{\n class Tokenizer\n {\n TextReader reader;\n TextWriter writer;\n string[] tokens;\n int cur;\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n\n public string NextLine()\n {\n return reader.ReadLine();\n }\n\n public string NextString()\n {\n while (tokens == null || cur >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n cur = 0;\n }\n return tokens[cur++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public double NextDouble()\n {\n return long.Parse(NextString());\n }\n }\n\n class Program\n {\n Tokenizer t;\n\n string get()\n {\n char[] temp = t.NextString().ToCharArray();\n Array.Sort(temp);\n if (temp[0] == '0')\n {\n int i;\n for (i = 1; i < temp.Length; i++)\n if (temp[i] != '0')\n break;\n if (i < temp.Length)\n {\n char tp = temp[0];\n temp[0] = temp[i];\n temp[i] = tp;\n }\n }\n return new string(temp);\n }\n\n public void Solve()\n {\n //TextReader reader = File.OpenText(@\"../../in.txt\");\n //t = new Tokenizer(reader);\n t = new Tokenizer(Console.In);\n\n string exp = get();\n string ans = t.NextString();\n Console.WriteLine(ans == exp ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n Console.ReadLine();\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Correct_Solution\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n char[] n = reader.ReadLine().ToCharArray();\n string m = reader.ReadLine();\n\n Array.Sort(n);\n if (n[0] == '0')\n {\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] != '0')\n {\n n[0] = n[i];\n n[i] = '0';\n break;\n }\n }\n }\n\n writer.WriteLine(m == new string(n) ? \"OK\" : \"WRONG_ANSWER\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = Console.ReadLine();\n if (input.Length != output.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n goto State;\n }\n int b = int.Parse(input);\n int[] a = new int[input.Length];\n for (int i = 0; i < a.Length; i++) \n {\n a[i] = b % 10;\n b = b / 10;\n }\n BubbleSort(ref a);\n for (int i = 0; i < a.Length; i++) \n {\n if (a[i] > 0) \n {\n int temp = a[i];\n a[i] = a[0];\n a[0] = temp;\n break;\n }\n }\n int x = 0;\n for (int i = 0; i < a.Length; i++) \n {\n x = x * 10 + a[i];\n }\n if (x == int.Parse(output)) { Console.WriteLine(\"OK\"); }\n else { Console.WriteLine(\"WRONG_ANSWER\"); }\n State:\n ;\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace b12b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var val = Console.ReadLine();\n if (val == \"0\")\n {\n var se = Console.ReadLine();\n if (se == \"0\")\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n return;\n }\n\n var cs = new int[10];\n for (int i = 0; i < val.Length; i++)\n {\n var next = -48 + (int)val[i];\n cs[next]++;\n }\n\n var ans = new StringBuilder();\n var first = true;\n for (int i = 1; i < 10; i++)\n {\n if (cs[i] > 0)\n {\n ans.Append(i);\n cs[i]--;\n\n if (first)\n {\n for (int z = 0; z < cs[0]; z++)\n {\n ans.Append(\"0\");\n }\n first = false;\n }\n }\n\n for (int j = 0; j < cs[i]; j++)\n {\n ans.Append(i);\n }\n }\n\n var res = Console.ReadLine();\n if (ans.Length != res.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n\n for (int i = 0; i < res.Length; i++)\n {\n if (ans[i] != res[i])\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int n = int.Parse(a);\n int m = int.Parse(b);\n\n if(Math.Floor(Math.Log10(n)) != Math.Floor(Math.Log10(m)) || a.Length != b.Length )\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n List digits = new List();\n while(n > 0)\n {\n digits.Add(n % 10);\n n /= 10;\n }\n\n digits.Sort();\n\n int x = 0;\n int zeroStop = 0; \n for(zeroStop = 0; zeroStop < digits.Count; ++zeroStop)\n {\n if(digits[zeroStop] != 0)\n {\n break;\n }\n }\n\n if(zeroStop == digits.Count)\n {\n if (m == 0)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n x += digits[zeroStop];\n for (int i = 0; i < zeroStop; ++i)\n x *= 10;\n for(int i = zeroStop + 1; i < digits.Count; ++i)\n {\n x *= 10;\n x += digits[i];\n }\n\n if (x != m)\n Console.WriteLine(\"WRONG_ANSWER\");\n else\n Console.WriteLine(\"OK\");\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar s1 = sr.NextString().ToCharArray();\n\t\t\tvar s2 = sr.NextString().ToCharArray();\n\t\t\tif (s2.Length != s1.Length) {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s1[0] == '0' && s1.Length == 1) {\n\t\t\t\tif (s2[0] == '0')\n\t\t\t\t\tsw.WriteLine(\"OK\");\n\t\t\t\telse\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tArray.Sort(s1);\n\t\t\tvar myAnsw = new char[s1.Length];\n\t\t\tvar indx = 0;\n\t\t\twhile (indx < s1.Length && s1[indx] == '0')\n\t\t\t\tindx++;\n\n\t\t\tvar answIndx = 1;\n\t\t\tmyAnsw[0] = s1[indx];\n\t\t\tfor (var i = 0; i < s1.Length; i++) {\n\t\t\t\tif (i != indx) {\n\t\t\t\t\tmyAnsw[answIndx] = s1[i];\n\t\t\t\t\tanswIndx++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i = 0; i < myAnsw.Length; i++) {\n\t\t\t\tif (s2[i] != myAnsw[i]) {\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n bool flag = false;\n if (num.Length != 1 && num[0] == 0)\n {\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n flag = true;\n else if (num[i] != 0 && flag)\n {\n num[0] = num[i];\n num[i] = 0;\n flag = false;\n }\n else\n break;\n }\n }\n string res = \"\";\n for (int i = 0; i < num.Length; i++)\n res += num[i].ToString();\n Console.WriteLine(((s1 == res)) && !flag ? \"OK\" : \"WRONG_ANSWER\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputStr = \"\";\n var inputStrCheck = \"\";\n do\n {\n inputStr = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStr) || !inputStr.Any(char.IsNumber))\n continue;\n inputStrCheck = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStrCheck) || !inputStrCheck.Any(char.IsNumber))\n continue;\n\n break;\n } while (true);\n\n var input = inputStr.ToCharArray().Select(c => int.Parse(c.ToString())).OrderBy(i => i).ToArray();\n if (input[0] == 0)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] != 0)\n {\n int tmp = input[i];\n input[i] = 0;\n input[0] = tmp;\n break;\n }\n }\n }\n inputStr = \"\";\n input.Select(i => inputStr += i).ToArray();\n Console.WriteLine((inputStr == inputStrCheck ? \"OK\" : \"WRONG_ANSWER\"));\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n char[] arr;\n arr = num.ToCharArray(0, num.Length);\n num = Console.ReadLine();\n char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n\n if (arr.Length == arr2.Length)\n {\n\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] > arr[j] && (i != 0 || arr[j] != '0'))\n {\n char p = arr[i];\n arr[i] = arr[j];\n arr[j] = p;\n }\n }\n }\n int flag = 0;\n for (int k = 0; k < arr.Length; k++)\n {\n if (arr[k] != arr2[k])\n {\n flag = 1;\n }\n }\n\n if (flag == 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"OK\");\n }\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n Program p = new Program();\n\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n\n Console.WriteLine(p.CorrectAnswer(a, b));\n Console.ReadLine();\n }\n\n public string CorrectAnswer(string ask, string answer)\n {\n int i = 0;\n int temp = 0;\n string m = \"\";\n int[] ans = new int[ask.Length];\n\n for (i = 0; i < ask.Length; i++)\n {\n ans[i] = ask[i] - '0';\n }\n Array.Sort(ans);\n\n for (i = 0; i < ask.Length; i++)\n {\n if (ans[i] > 0)\n {\n temp = ans[i];\n ans[i] = ans[0];\n ans[0] = temp;\n\n break;\n }\n }\n for (i = 0; i < ask.Length; i++)\n {\n m += ans[i];\n }\n\n return m == answer ? \"OK\" : \"WRONG_ANSWER\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace SRM.Hawaii\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n char[] inp = a.ToCharArray();\n Array.Sort(inp);\n int i = 0;\n while (i numbers =\n input.ToList()\n .Select(x => int.Parse(x.ToString()))\n .ToList();\n\n numbers.Sort();\n\n int i = 0;\n while (numbers[i] == 0)\n {\n i += 1;\n }\n\n int leading = numbers[i];\n numbers.Remove(leading);\n\n return leading.ToString() + string.Concat(numbers.Select(x => x.ToString()));\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces.TaskB\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out long n);\n Input.Next(out string m);\n\n\n var ns = n.ToString();\n var ni = new List();\n for (int i = 0; i < ns.Length; i++)\n {\n ni.Add(int.Parse($\"{ns[i]}\"));\n }\n\n ni.Sort();\n var numbers = ni.Distinct();\n var min = numbers.First();\n if (min == 0) //0123456789\n {\n if (numbers.Count() <= 1)\n {\n if (n.ToString() == m) // 0 0\n {\n Console.WriteLine(\"OK\");\n }\n else // 0 00\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n return;\n }\n\n var secondMin = numbers.Skip(1).First();\n StringBuilder sb = new StringBuilder();\n sb.Append(secondMin);\n sb.Append('0', ni.Count(i => i == 0));\n sb.Append(secondMin.ToString()[0], ni.Count(i => i == secondMin) - 1);\n sb.Append(string.Join(\"\", ni.Where(i => i != 0 && i != secondMin).OrderBy(i => i)));\n\n if (sb.ToString() == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else //123456789\n {\n if (string.Join(\"\", ni) == m)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic; \nclass X{\n\tpublic static void Main(String[] args){\n\t\tString n = System.Console.ReadLine();\n\t\tString m = System.Console.ReadLine();\n\t\tif(n == \"0\"){\n\t\t\tif(m == \"0\"){\n\t\t\t\tSystem.Console.WriteLine(\"OK\");\n\n\t\t\t}else{\n\t\t\t\tSystem.Console.WriteLine(\"WRONG_ANSWER\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tList list =(new List(n.ToCharArray())).ConvertAll(delegate(char c){ return Int32.Parse(c.ToString());});\n\t\tlist.Sort();\n\n\t\tint count = list.RemoveAll(delegate(int i){ return i== 0; } );\n\n\t\tfor(int i = 0;i < count;i++){\n\t\t\tlist.Insert(1,0);\n\t\t}\n\t\tString ss = \"\";\n\t\tlist.ForEach(delegate(int i){ ss = ss + i.ToString(); });\n\t\tif(ss == m){\n\t\t\tSystem.Console.WriteLine(\"OK\");\n\t\t}else{\n\t\t\tSystem.Console.WriteLine(\"WRONG_ANSWER\");\n\t\t}\n\t\treturn;\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n char[] arr;\n arr = num.ToCharArray(0, num.Length);\n num = Console.ReadLine();\n char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n\n if (arr.Length == arr2.Length)\n {\n\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] > arr[j] && (i != 0 || arr[j] != '0'))\n {\n char p = arr[i];\n arr[i] = arr[j];\n arr[j] = p;\n }\n }\n }\n int flag = 0;\n for (int k = 0; k < arr.Length; k++)\n {\n if (arr[k] != arr2[k])\n {\n flag = 1;\n }\n }\n\n if (flag == 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"OK\");\n }\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace N1\n{\n class Program\n {\n static void Main(string[] args)\n { \n char[] arr;\n string s = null;\n\n string[] numbers=new string[2];\n\n numbers[0] = Console.ReadLine();\n numbers[1] = Console.ReadLine(); \n\n arr = numbers[0].ToArray();\n Array.Sort(arr);\n\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] != '0')\n {\n char temp = arr[0];\n arr[0] = arr[i];\n arr[i] = temp;\n break;\n } \n }\n\n foreach (char x in arr)\n s += x;\n\n if (s == numbers[1])\n Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n\n Console.ReadLine();\n\n\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_1\n{\n class Program\n {\n static void Main(string[] args)\n { \n // Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text=Console.ReadLine();//\u0412\u0432\u043e\u0434 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\n if (ControlInput(text)) return; //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443\n // Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text2 = Console.ReadLine();\n if (ControlInput(text)) return;\n if (text.Length == text2.Length) //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\n {\n uint[] Mass1 = new uint[text.Length];//\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b\n uint[] Mass2 = new uint[text.Length];\n StringInMass(ref Mass1, text);//\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b\n StringInMass(ref Mass2, text2);\n MassObr(Mass1, Mass2);//,\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430\n }\n else//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u044b \u043f\u043e \u0434\u043b\u0438\u043d\u043d\u0435\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n }\n \n }\n\n//===============\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430========================================\n public static bool ControlInput(string Text)\n {\n Regex myReg = new Regex(@\"\\D\"); //\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \"\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u0440\u043e\u043c\u0435 \u0446\u0438\u0444\u0440\"\n if (Text.Length > 10 || myReg.IsMatch(Text))//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b-\u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430\n {\n Console.WriteLine(\"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b\");\n Console.ReadLine();\n return true;\n }\n return false;\n }\n//=======================\u041a\u043e\u043d\u0435\u0446 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0432\u043e\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430=======================\n\n\n//=======================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0432\u0435\u0434\u0435\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b==========================\n public static void StringInMass(ref uint[] Mass, string text)\n { //\u0434\u0430, \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u0434\u043e\u043c \u043d\u0430\u043f\u0435\u0440\u0435\u0434. \u041d\u041e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u043e \u0432\u0441\u0435\u0440\u0430\u0432\u043d\u043e \u0447\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 =)\n int lenText = text.Length; //\u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438\n for (int i = 0; i <= lenText - 1; i++) //\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430\n {\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.\n //\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044f\u0447\u0435\u0439\u043a\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u044c.\n Mass[i] = Convert.ToUInt32(text) % 10; \n text = text.Remove(text.Length - 1);//\u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\n }\n }\n//=====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b============================\n\n\n//=====================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b==================================================\n public static void MassObr(uint[] Mass1, uint[] Mass2)\n {\n\n for (int j = 0; j < Mass1.Length-1; j++)//\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u043c\n {\n for (int i = 0; i < Mass1.Length-j-1; i++)\n {\n if (Mass1[i] < Mass1[i + 1])\n {\n uint b = Mass1[i];\n Mass1[i] = Mass1[i + 1];\n Mass1[i + 1] = b;\n \n }\n\n }\n }\n\n if (Mass1[Mass1.Length - 1] == 0) //\u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 0\n {\n \n\n for (int i = Mass1.Length-1; i > 0; i--) //\u0437\u0430\u043c\u0435\u043d\u0435\u044f\u0435\u043c \u043d\u043e\u043b\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n {\n if (Mass1[i - 1] != 0)\n {\n uint b = Mass1[i-1];\n Mass1[i-1] = Mass1[i];\n Mass1[Mass1.Length - 1] = b;\n break;\n }\n }\n\n }\n //\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n if (Mass1.SequenceEqual(Mass2)) Console.WriteLine(\"OK\"); else Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n\n }\n //====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b================================\n }\n }\n;\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n var a = ReadToken().ToCharArray();\n Array.Sort(a);\n if (a[0] == '0')\n for (int i = 1; i < a.Length; i++)\n if (a[i] != '0')\n {\n a[0] = a[i];\n a[i] = '0';\n break;\n }\n\n Write(new string(a) == ReadToken() ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string[] a = new string[3];\n for (int i = 0; i < 3; i++)\n a[i] = ReadLine();\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (!a[i][j].Equals(a[2 - i][2 - j]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n Console.WriteLine(\"Yes\");\n }\n\n static void B()\n {\n int n;\n n = ReadInt();\n string m = ReadLine();\n int[] digits = new int[10];\n while (n != 0)\n {\n digits[n % 10]++;\n n /= 10;\n }\n int ans = 0;\n for (int i = 1; i < 10; i++)\n {\n if (digits[i] != 0)\n {\n ans += i;\n digits[i]--;\n break;\n }\n }\n for (int i = 0; i < 10; i++)\n {\n while (digits[i] != 0)\n {\n ans = ans * 10 + i;\n digits[i]--;\n }\n }\n if (ans.ToString().Equals(m))\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n static void C()\n {\n int left, right, up, down;\n left = right = up = down = 0;\n int a, b;\n string[] tokens = ReadArray(' ');\n a = int.Parse(tokens[0]);\n b = int.Parse(tokens[1]);\n string s = ReadLine();\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) up++;\n if (s[i].Equals('D')) down++;\n if (s[i].Equals('L')) left++;\n if (s[i].Equals('R')) right++;\n }\n int _left, _right, _up, _down;\n _left = _right = _up = _down = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) _up++;\n if (s[i].Equals('D')) _down++;\n if (s[i].Equals('L')) _left++;\n if (s[i].Equals('R')) _right++;\n int _a = a + _left;\n _a -= _right;\n int _b = b - _up;\n _b += _down;\n if (_a == 0 && _b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else\n {\n int x = 0;\n if (right - left != 0)\n x = _a / (right - left);\n if (up - down != 0)\n x = _b / (up - down);\n\n if (x >= 0 && (_a + x * (left - right)) == 0 && (_b + x * (down - up) == 0))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n }\n }\n Console.WriteLine(\"No\");\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n char[] arr;\n arr = num.ToCharArray(0, num.Length);\n num = Console.ReadLine();\n char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n\n if (arr.Length == arr2.Length)\n {\n\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] > arr[j] && (i != 0 || arr[j] != '0'))\n {\n char p = arr[i];\n arr[i] = arr[j];\n arr[j] = p;\n }\n }\n }\n int flag = 0;\n for (int k = 0; k < arr.Length; k++)\n {\n if (arr[k] != arr2[k])\n {\n flag = 1;\n }\n }\n\n if (flag == 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"OK\");\n }\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\n\n//12B. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435?\n\nnamespace CodeForces\n{\n class Solution\n {\n void solve()\n {\n var a = Console.ReadLine().Select(c => (int)c - '0').ToArray();\n Array.Sort(a);\n\n if (a[0] == 0)\n {\n for (int i = 1; i < a.Length; i++)\n {\n if (a[i] != 0)\n {\n a[0] = a[i];\n a[i] = 0;\n break;\n }\n }\n }\n\n string ans = string.Join(\"\", a);\n Console.WriteLine(Console.ReadLine() == ans ? \"OK\" : \"WRONG_ANSWER\");\n#if DEBUG\n\n#endif\n }\n\n static void Main()\n {\n new Solution().solve();\n#if DEBUG\n Console.WriteLine(\"debug stop\");\n Console.ReadKey(true);\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int big = Convert.ToInt32(Console.ReadLine());\n string bob = Console.ReadLine();\n int small = Convert.ToInt32(bob);\n if (bob.Length != small.ToString().Length) { Console.Write(\"WRONG_ANSWER\"); goto end; }\n if (big == 0 && small == 0) { Console.Write(\"OK\"); goto end; }\n if (big == 0 || small == 0) { Console.Write(\"WRONG_ANSWER\"); goto end; }\n string a = big.ToString();\n char[] b = a.ToCharArray();\n Array.Sort(b);\n int zero = 0;\n int num = 1;\n int index = 0;\n while (index < b.Length && b[index] == '0')\n {\n zero++;\n index++;\n }\n if (zero == 0) num = 0;\n else num = (b[index++] - '0') * (int)Math.Pow(10, zero);\n while (index < b.Length)\n num = 10 * num + b[index++] - '0';\n if (num == small) Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n end:\n ;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace cf_12b\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int first = int.Parse(Console.ReadLine());\n\n string secondStr = Console.ReadLine ();\n\n if (secondStr.Length > 1 && secondStr [0] == '0') {\n Console.WriteLine (\"WRONG_ANSWER\");\n return;\n }\n\n int second = int.Parse(secondStr);\n\n int answer = GetRightAnswer (first);\n\n if (second == answer)\n Console.WriteLine (\"OK\");\n else\n Console.WriteLine (\"WRONG_ANSWER\");\n }\n\n private static int GetRightAnswer(int number) {\n if (number == 0)\n return 0;\n\n var digits = GetDigits(number);\n\n Array.Sort (digits);\n\n if (digits [0] == 0) {\n int i = 1;\n while (digits[i] == 0)\n i++;\n\n digits [0] = digits [i];\n digits [i] = 0;\n }\n\n int answer = 0;\n for (int i = 0; i < digits.Length; i++) {\n answer = answer * 10 + digits [i];\n }\n\n return answer;\n }\n\n private static int[] GetDigits(int number) {\n var digits = new List ();\n digits.Add (number % 10);\n number = number / 10;\n\n while (number > 0) {\n digits.Add (number % 10);\n number = number / 10;\n }\n\n return digits.ToArray();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\n\nclass Program\n{\n class Pair : System.IComparable\n {\n public int x;\n public int y;\n\n public Pair (int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int CompareTo(object obj)\n {\n Pair p = (Pair) obj;\n return x < p.x ? -1 : x == p.x ? 0 : 1;\n }\n }\n\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"../../input.txt\"));\n int [] a = new int[10];\n\n string n = Console.ReadLine();\n for (int i = 0; i < n.Length; ++i)\n ++a[n[i] - '0'];\n\n string m = Console.ReadLine();\n\n string s = \"\";\n if (n.Equals(\"0\") && n.Equals(m))\n {\n Console.WriteLine(\"OK\");\n return;\n }\n \n bool f = true;\n bool find = true;\n while (find)\n {\n find = false;\n for (int i = f ? 1 : 0; i < 10; ++i)\n if (a[i] > 0)\n {\n a[i]--;\n s += i;\n find = true;\n break;\n }\n f = false;\n }\n\n Console.WriteLine(m.Equals(s) ? \"OK\" : \"WRONG_ANSWER\");\n\n /*\n string str = \"\";\n while (!string.IsNullOrEmpty((str = Console.ReadLine())))\n\n var dict = new System.Collections.Generic.Dictionary(); \n \n Pair[] a = new Pair[100];\n for (int i = 0; i < a.Length; ++i)\n a[i] = new Pair(100 - i, i);\n Array.Sort(a);\n\n int testCount = Convert.ToInt32(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n string[] data = Console.ReadLine().Split(new char[] { ' ' });\n */\n \n Console.ReadKey();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Functions\n {\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static string ReadLine()\n {\n return Console.ReadLine();\n }\n\n public static string[] ReadLineWithSplit(char split)\n {\n return Console.ReadLine().Split(split);\n }\n\n public static string[] ReadLines(int count)\n {\n string[] lines = new string[count];\n for (int x = 0; x < count; x++)\n {\n lines[x] = ReadLine();\n }\n return lines;\n }\n public static string ReverseInts(string s)\n {\n string[] charArray = s.Split(' ');\n Array.Reverse(charArray);\n return charArray.Aggregate(\"\", (current, s1) => current + (s1 + \" \"));\n }\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return charArray.Aggregate(\"\", (current, s1) => current + (s1 + \" \"));\n }\n }\n class Program\n {\n private static void Main()\n {\n string line1 = Functions.ReadLine();\n string line2 = Functions.ReadLine();\n\n bool test = true;\n foreach (char c in line1)\n {\n if (!line2.Contains(c))\n test = false;\n }\n if (line2.Length != line1.Length)\n test = false;\n if (test)\n {\n //order by then count leading zeros replace with smallest number \n char[] optimal = line1.ToCharArray().OrderBy(o => o).ToArray();\n if (optimal[0] == '0' && optimal.Length > 1)\n {\n int count = 0;\n foreach (char c in optimal)\n {\n if (c == '0')\n count++;\n }\n int cp_count = count;\n for (int i = 0; i < 1; i++)\n {\n char temp = optimal[i];\n optimal[i] = optimal[cp_count];\n optimal[cp_count] = temp;\n cp_count++;\n } \n }\n if(new string(optimal) == line2)\n Console.WriteLine(\"OK\");\n else \n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest_12\n{\n class Program\n {\n static void B()\n {\n var s = Console.ReadLine();\n string r1 = Console.ReadLine();\n string r2 = \"\";\n int[] a = new int[10];\n\n for (int i = 0; i < s.Length; i++)\n {\n a[int.Parse(s[i].ToString())]++;\n }\n\n for (int i = 1; i < 10; i++)\n {\n if (a[i] > 0)\n {\n r2 += i;\n a[i]--;\n break;\n }\n }\n\n for (int i = 0; i < 10; i++)\n {\n while (a[i] > 0)\n {\n r2 += i;\n a[i]--;\n }\n }\n\n Console.WriteLine(r1 == r2 ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n static void Main(string[] args)\n {\n B();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] cs = Console.ReadLine().ToCharArray();\n Array.Sort(cs);\n for (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\n char[] cc = Console.ReadLine().ToCharArray();\n \n if(!cc.SequenceEqual(cs))\n Console.Write(\"WRONG_ANSWER\");\n else Console.Write(\"OK\");\n }\n }\n}\n\n/* Array.Sort(cs);\nfor (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\nConsole.WriteLine(cs);\nfor(int i=0;i dic = new Dictionary();\n foreach (string s in names)\n {\n if (dic.ContainsKey(s)) ++dic[s];\n else dic.Add(s, 1);\n }\n\n List> tmp = new List>(dic.Count);\n foreach (KeyValuePair item in dic)\n tmp.Add(item);\n tmp.Sort((x, y) => { return x.Value.CompareTo(y.Value); });\n tmp.Reverse();\n\n Array.Sort(much);\n\n int v=0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString() + \" \");\n\n Array.Reverse(much);\n v = 0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString());*/\n/* int count = int.Parse(Console.ReadLine());\n List vb = new List(count);\n string[] sb = Console.ReadLine().Split(' ');\n string[] si = Console.ReadLine().Split(' ');\n string[] sr = Console.ReadLine().Split(' ');\n for(int i=0;i[] adj;\n static bool[] visited = new bool[1 << 20];\n static int[] count = new int[20];\n\n static void Solve(int cur_i, int v_mask, int source_i, int len)\n {\n visited[v_mask] = true;\n\n for (int i = 0; i < adj[cur_i].Count; i++)\n {\n int n = adj[cur_i][i];\n if (n == source_i && len > 1)\n {\n count[len]++;\n continue;\n }\n if ((v_mask & (1 << n)) != 0) continue;\n Solve(n, v_mask | (1 << n), source_i, len + 1);\n }\n }\n\n static void Main(string[] args)\n {\n string n = Console.ReadLine().Trim();\n string g = Console.ReadLine().Trim();\n\n if (n == \"0\" && g == \"0\")\n {\n Console.WriteLine(\"OK\");\n return;\n }\n\n char[] a = n.ToCharArray();\n Array.Sort(a);\n int i = 0;\n while (i < a.Length && a[i] == '0') i++;\n if (i <= a.Length - 1 && a[0] == '0')\n {\n a[0] = a[i];\n a[i] = '0';\n }\n if (a[0] == '0') Console.WriteLine(\"WRONG_ANSWER\");\n else\n {\n string m = new string(a);\n if (m == g) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace b\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] given = Console.ReadLine().ToCharArray();\n char[] result = Console.ReadLine().ToCharArray();\n if (result.Length != given.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Array.Sort(given);\n int index = 0;\n while (index < given.Length && given[index] == '0')\n {\n index++;\n }\n if (index < given.Length && index!=0)\n {\n given[index] ^= given[0];\n given[0] ^= given[index];\n given[index] ^= given[0];\n }\n bool ok = true; ;\n for (int i = 0; i < given.Length; i++)\n {\n if (given[i] != result[i])\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Solution\n{\n public static void Main()\n {\n char[] chrIn = Console.ReadLine().ToCharArray().OrderBy(x => x).ToArray();\n string ans = Console.ReadLine();\n int n = chrIn.Length;\n if (ans.Length != n)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n if (chrIn[0] == '0')\n {\n int i = 0;\n while (i < n && chrIn[i] == '0')\n {\n i++;\n }\n if (i < n)\n {\n chrIn[0] = chrIn[i];\n chrIn[i] = '0';\n }\n }\n for (int j = 0; j < n; j++)\n {\n if (chrIn[j] != ans[j])\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n }\n Console.WriteLine(\"OK\");\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace task12B\n{\n class Program\n {\n public static string DeleteFirstsNulls(string number)\n {\n string result = string.Empty;\n Int32 i = 0;\n while (i= arr[j])\n {\n Int32 t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n }\n }\n string result = \"\";\n result = arr[0].ToString();\n for (Int32 i = 0; i < countNulls; i++)\n {\n result += \"0\";\n }\n for (Int32 i = 1; i < arr.Length; i++)\n {\n result += arr[i].ToString();\n }\n return result;\n }\n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n string answer = Console.ReadLine();\n //Console.WriteLine(DeleteFirstsNulls(number));\n if (number == \"0\")\n {\n if (answer == \"0\")\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else\n {\n if (GetOptimal(number) == answer)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n //Console.ReadLine();\n //string answer = Console.ReadLine();\n //\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Timus\n{\n class Problems\n {\n static void Main()\n {\n var n = Console.ReadLine();\n var m = Console.ReadLine();\n Console.WriteLine((GetSmallerView(n) == m) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n static string GetSmallerView(string n)\n {\n var _n = n.ToCharArray().Select(x => int.Parse(x.ToString())).ToList();\n var null_count = _n.Count(x => x == 0);\n var min = 0;\n var __n = _n.FindAll(x => x != 0);\n if (__n.Count != 0)\n min = __n.Min();\n _n.RemoveAll(x => x == 0);\n _n.Remove(min);\n _n.Sort();\n if (min == 0)\n return $\"{new string('0', null_count)}{string.Concat(_n)}\";\n return $\"{min}{new string('0', null_count)}{string.Concat(_n)}\";\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Application\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a = int.Parse (Console.ReadLine ());\n\t\t\tstring b = Console.ReadLine ();\n\t\t\tif((a==0)&&((b==\"0\")))\n\t\t\t\tConsole.WriteLine(\"OK\");\n\t\t\telse\n\t\t\tif (a.ToString().Length mas = new List ();\n\t\t\t\twhile (a!=0) {\n\t\t\t\t\tmas.Add (a % 10);\n\t\t\t\t\ta /= 10;\n\t\t\t\t}\n\t\t\t\tint index = 0;\n\t\t\t\tmas.Sort ();\n\t\t\t\tfor (int i = 0; i();\n var m = Read();\n var arr = n.ToArray().ToList();\n arr.Sort();\n if (arr.First() == '0')\n {\n var idx = 0;\n for (var i = 0; i < arr.Count; i++)\n {\n if (arr[i] != '0')\n {\n arr[0] = arr[i];\n arr[i] = '0';\n break;\n }\n }\n }\n var result = new string(arr.ToArray()) == m ? \"OK\" : \"WRONG_ANSWER\";\n Console.WriteLine(result);\n }\n\n // Here goes misc\n\n public static T Read()\n {\n var line = Console.ReadLine();\n var item = Convert.ChangeType(line, typeof (T));\n return (T) item;\n }\n\n public static List ReadList(char[] delimiters = null)\n {\n var line = Read();\n var split = line.Split(delimiters ?? new[] {' '});\n var list = split.Select(item => (T) Convert.ChangeType(item, typeof (T))).ToList();\n return list;\n }\n\n public static List ReadListNlines(int n)\n {\n var list = new List();\n for (var i = 0; i < n; i++)\n {\n list.Add(Read());\n }\n return list;\n }\n\n public static void ReadFromFile()\n {\n Console.SetIn(new StreamReader(@\"..\\..\\input.txt\"));\n }\n\n public static bool NextPermutation(T[] items) where T : IComparable\n {\n var i = -1;\n for (var x = items.Length - 2; x >= 0; x--)\n {\n if (items[x].CompareTo(items[x + 1]) < 0)\n {\n i = x;\n break;\n }\n }\n\n if (i == -1)\n {\n return false;\n }\n var j = 0;\n for (var x = items.Length - 1; x > i; x--)\n {\n if (items[x].CompareTo(items[i]) > 0)\n {\n j = x;\n break;\n }\n }\n var temp = items[i];\n items[i] = items[j];\n items[j] = temp;\n Array.Reverse(items, i + 1, items.Length - (i + 1));\n return true;\n }\n\n public static string ReplaceChar(string str, char c, int idx)\n {\n return str.Substring(0, idx) + c + str.Substring(idx + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = int.Parse(Console.ReadLine());\n string _m = Console.ReadLine();\n int m = int.Parse(_m);\n // find smallest number then compare it to m\n int r = m;\n if (n > 0)\n {\n if (n.ToString().Contains('0'))\n {\n char l = n.ToString().Where(x => x != '0').OrderBy(x => x).First();\n string u = l.ToString();\n List j = n.ToString().Select(x => x).ToList();\n j.Remove(l);\n r = int.Parse(u + string.Join(\"\", j.Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n else\n {\n r = int.Parse(string.Join(\"\", n.ToString().Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n }\n else\n {\n r = n;\n }\n if (n == 0)\n {\n if (_m.Length == 1 && m == 0) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n if (r == m) { if (_m[0] != '0') { Console.WriteLine(\"OK\"); } else { Console.WriteLine(\"WRONG_ANSWER\"); } }\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n \n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n //List input = Console.ReadLine().Split().Select(int.Parse).ToList();\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Solve\n{\n\n public void solve()\n {\n string line = Console.ReadLine();\n List n = new List();\n for (int i = 0; i < line.Length; ++i)\n n.Add(line[i]);\n n.Sort();\n\n if (n[0] == '0' && n.Count > 1)\n {\n for (int i = 0; i < n.Count; ++i)\n if (n[i] != '0')\n {\n n[0] = n[i];\n n[i] = '0';\n break;\n }\n }\n\n line = \"\";\n for (int i = 0; i < n.Count; ++i)\n line = line + n[i];\n \n if (line == Console.ReadLine())\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n}\n\nclass Program\n{\n static void Main()\n {\n Solve Task = new Solve();\n Task.solve();\n // Console.ReadKey();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclass Index\n{\n public int start;\n public int end;\n}\nclass Andy\n{\n\n public static void Main()\n {\n\n var ii = Console.ReadLine().ToCharArray();\n var ans = Console.ReadLine();\n Array.Sort(ii);\n\n if (ii.Count() == 1)\n {\n if (ii[0].ToString() == ans.ToString())\n {\n Console.Write(\"OK\");\n }\n else\n {\n Console.Write(\"WRONG_ANSWER\");\n }\n }\n else\n {\n int i = 1;\n for (; i < ii.Length; i++)\n {\n if (ii[i - 1] == '0' && ii[i] == '0')\n {\n ii[i - 1] = ' ';\n }\n else\n break;\n\n }\n ii = string.Join(\"\", ii).Replace(\" \", string.Empty).ToCharArray();\n if (ii[0] == '0')\n {\n var tmp = ii[0];\n ii[0] = ii[1];\n ii[1] = tmp;\n }\n\n Console.Write(string.Join(\"\", ii) == ans ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n }\n\n\n}\n\n\n"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n\n var n = new List(sc.Next());\n var m = new List(sc.Next());\n\n if (n.Count != m.Count) {\n wr.Write(\"WRONG_ANSWER\");\n wr.Flush();\n return;\n }\n \n n.Sort();\n \n for (int i = 0; i < n.Count; ++i) {\n if (n[i] != '0') {\n char t = n[i];\n n[i] = '0';\n n[0] = t;\n break;\n }\n }\n\n for (int i = 0; i < n.Count; ++i) {\n if (n[i] != m[i]) {\n wr.Write(\"WRONG_ANSWER\");\n wr.Flush();\n return;\n }\n }\n\n wr.Write(\"OK\");\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n \n void solve()\n {\n\n\n string n = nextString();\n string ans = nextString();\n int[] cnt = new int[10];\n for (int i = 0; i < n.Length; i++)\n cnt[n[i] - '0']++;\n string best = \"\";\n if (n == \"0\")\n best = \"0\";\n else\n {\n for (int i = 1; i <= 9; i++)\n {\n if (cnt[i] > 0)\n {\n best = \"\" + i;\n cnt[i]--;\n break;\n\n }\n }\n for (int i = 0; i < 10; i++)\n best += new string((char)('0' + i), cnt[i]);\n \n }\n if (ans != best)\n Console.WriteLine(\"WRONG_ANSWER\");\n else\n Console.WriteLine(\"OK\");\n \n \n \n }\n\n //\n\n\n\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\n\nnamespace ConsoleApplication1\n{\n class Program\n { \n static void OpenConsole() \n { \n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n }\n\n static void CloseConsole()\n { \n Console.In.Close(); \n Console.Out.Close();\n }\n\n static void Solve()\n {\n string[] t = Console.In.ReadToEnd().Split(new char[3] { ' ', '\\n', '\\r' },\n StringSplitOptions.RemoveEmptyEntries);\n if (t[0].Length == 1)\n {\n if (t[0] == t[1]) Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n return;\n }\n char[] tt = t[0].ToCharArray();\n Array.Sort(tt);\n int i = 0;\n while (i < tt.Length && tt[i] == '0') i++;\n if (i == tt.Length)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n if (i != 0)\n {\n tt[0] = tt[i];\n tt[i] = '0';\n }\n if (new string(tt) == t[1]) Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n } \n\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n OpenConsole();\n#endif\n Solve();\n#if !ONLINE_JUDGE\n CloseConsole();\n#endif\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Correct_Solution\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n char[] n = reader.ReadLine().ToCharArray();\n int m = int.Parse(reader.ReadLine());\n\n Array.Sort(n);\n if (n[0] == '0')\n {\n for (int i = 0; i < n.Length; i++)\n {\n if (n[i] != '0')\n {\n n[0] = n[i];\n n[i] = '0';\n break;\n }\n }\n }\n\n writer.WriteLine(m == int.Parse(new string(n)) ? \"OK\" : \"WRONG_ANSWER\");\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Correct_Solution\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long n = Next();\n int m = Next();\n\n long d10 = 1;\n while (d10 <= n)\n {\n d10 *= 10;\n }\n d10 /= 10;\n\n long min = n;\n for (int i = 0; i < 9; i++)\n {\n long d = n%10;\n n /= 10;\n n = n + d10*d;\n if (d != 0 && min > n)\n min = n;\n }\n\n writer.WriteLine(m == min ? \"OK\" : \"WRONG_ANSWER\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace b12b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var val = Console.ReadLine();\n var cs = new int[10];\n for (int i = 0; i < val.Length; i++)\n {\n var next = -48 + (int)val[i];\n cs[next]++;\n }\n\n var ans = new StringBuilder();\n var first = true;\n for (int i = 1; i < 10; i++)\n {\n if (cs[i] > 0)\n {\n ans.Append(i);\n cs[i]--;\n\n if (first)\n {\n for (int z = 0; z < cs[0]; z++)\n {\n ans.Append(\"0\");\n }\n first = false;\n }\n }\n\n for (int j = 0; j < cs[i]; j++)\n {\n ans.Append(i);\n }\n }\n\n var res = Console.ReadLine();\n if (ans.Length != res.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n\n for (int i = 0; i < res.Length; i++)\n {\n if (ans[i] != res[i])\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace b12b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var val = Console.ReadLine();\n var cs = new int[10];\n for (int i = 0; i < val.Length; i++)\n {\n var next = -48 + (int)val[i];\n cs[next]++;\n }\n\n var ans = new StringBuilder();\n for (int i = 1; i < 10; i++)\n {\n for (int j = 0; j < cs[i]; j++)\n {\n ans.Append(i);\n\n if (i == 1 && j == 0 && cs[0] > 0)\n {\n for (int z = 0; z < cs[0]; z++)\n {\n ans.Append(\"0\");\n }\n }\n }\n }\n\n var res = Console.ReadLine();\n if (ans.Length != res.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n\n for (int i = 0; i < res.Length; i++)\n {\n if (ans[i] != res[i])\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n }\n\n Console.WriteLine(\"OK\");\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n string b = Console.ReadLine();\n int n = int.Parse(a);\n int m = int.Parse(b);\n\n if(Math.Floor(Math.Log10(n)) != Math.Floor(Math.Log10(m)) || a.Length != b.Length )\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n List digits = new List();\n while(n > 0)\n {\n digits.Add(n % 10);\n n /= 10;\n }\n\n digits.Sort();\n\n int x = 0;\n int zeroStop = 0; \n for(zeroStop = 0; zeroStop < digits.Count; ++zeroStop)\n {\n if(digits[zeroStop] != 0)\n {\n break;\n }\n }\n\n if(zeroStop == digits.Count)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n x += digits[zeroStop];\n for (int i = 0; i < zeroStop; ++i)\n x *= 10;\n for(int i = zeroStop + 1; i < digits.Count; ++i)\n {\n x *= 10;\n x += digits[i];\n }\n\n if (x != m)\n Console.WriteLine(\"WRONG_ANSWER\");\n else\n Console.WriteLine(\"OK\");\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication5\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n\n if(Math.Floor(Math.Log10(n)) != Math.Floor(Math.Log10(m)))\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n List digits = new List();\n while(n > 0)\n {\n digits.Add(n % 10);\n n /= 10;\n }\n\n digits.Sort();\n\n int x = 0;\n int zeroStop = 0; \n for(zeroStop = 0; zeroStop < digits.Count; ++zeroStop)\n {\n if(digits[zeroStop] != 0)\n {\n break;\n }\n }\n\n if(zeroStop == digits.Count)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n x += digits[zeroStop];\n for (int i = 0; i < zeroStop; ++i)\n x *= 10;\n for(int i = zeroStop + 1; i < digits.Count; ++i)\n {\n x *= 10;\n x += digits[i];\n }\n\n if (x != m)\n Console.WriteLine(\"WRONG_ANSWER\");\n else\n Console.WriteLine(\"OK\");\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar s1 = sr.NextString().ToCharArray();\n\t\t\tvar s2 = sr.NextString().ToCharArray();\n\t\t\tif (s1[0] == '0' && s1.Length == 1) {\n\t\t\t\tif (s2[0] == '0')\n\t\t\t\t\tsw.WriteLine(\"OK\");\n\t\t\t\telse\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s2.Length != s1.Length) {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tArray.Sort(s1);\n\t\t\tvar myAnsw = new char[s1.Length];\n\t\t\tvar indx = 0;\n\t\t\twhile (indx < s1.Length && s1[indx] == '0')\n\t\t\t\tindx++;\n\n\t\t\tvar answIndx = 1;\n\t\t\tmyAnsw[0] = s1[indx];\n\t\t\tfor (var i = 0; i < s1.Length; i++) {\n\t\t\t\tif (i != indx) {\n\t\t\t\t\tmyAnsw[answIndx] = s1[i];\n\t\t\t\t\tanswIndx++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (s2.Length != myAnsw.Length) {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (var i = 0; i < myAnsw.Length; i++) {\n\t\t\t\tif (s2[i] != myAnsw[i]) {\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar s1 = sr.NextString().ToCharArray();\n\t\t\tvar s2 = sr.NextString().ToCharArray();\n\t\t\tif (s2[0] == '0') {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s1[0] == '0' && s1.Length == 1) {\n\t\t\t\tif (s2[0] == '0')\n\t\t\t\t\tsw.WriteLine(\"OK\");\n\t\t\t\telse\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (s2.Length != s1.Length) {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tArray.Sort(s1);\n\t\t\tvar myAnsw = new char[s1.Length];\n\t\t\tvar indx = 0;\n\t\t\twhile (indx < s1.Length && s1[indx] == '0')\n\t\t\t\tindx++;\n\n\t\t\tvar answIndx = 1;\n\t\t\tmyAnsw[0] = s1[indx];\n\t\t\tfor (var i = 0; i < s1.Length; i++) {\n\t\t\t\tif (i != indx) {\n\t\t\t\t\tmyAnsw[answIndx] = s1[i];\n\t\t\t\t\tanswIndx++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (s2.Length != myAnsw.Length) {\n\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (var i = 0; i < myAnsw.Length; i++) {\n\t\t\t\tif (s2[i] != myAnsw[i]) {\n\t\t\t\t\tsw.WriteLine(\"WRONG_ANSWER\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(\"OK\");\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var inputStr = \"\";\n var inputStrCheck = \"\";\n do\n {\n Console.Write(\"\u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e: \");\n inputStr = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStr) || !inputStr.Any(char.IsNumber))\n continue;\n\n Console.Write(\"\u0412\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e: \");\n inputStrCheck = Console.ReadLine();\n if (string.IsNullOrEmpty(inputStrCheck) || !inputStrCheck.Any(char.IsNumber))\n continue;\n\n break;\n } while (true);\n\n var input = inputStr.ToCharArray().Select(c => int.Parse(c.ToString())).OrderBy(i => i).ToArray();\n if (input[0] == 0)\n {\n for (int i = 0; i < input.Length; i++)\n {\n if (input[i] != 0)\n {\n int tmp = input[i];\n input[i] = 0;\n input[0] = tmp;\n break;\n }\n }\n }\n inputStr = \"\";\n input.Select(i => inputStr += i).ToArray();\n Console.WriteLine((inputStr == inputStrCheck ? \"OK\" : \"WRONG_ANSWER\"));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string num = Console.ReadLine();\n char[] arr;\n arr = num.ToCharArray(0, num.Length);\n num = Console.ReadLine();\n char[] arr2;\n arr2 = num.ToCharArray(0, num.Length);\n\n for (int i = 0; i < arr.Length; i++)\n {\n for (int j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] > arr[j] && (i != 0 || arr[j]!='0'))\n {\n char p = arr[i];\n arr[i] = arr[j];\n arr[j] = p;\n }\n }\n }\n int flag = 0;\n for (int k = 0; k < arr.Length; k++)\n {\n if (arr[k] != arr2[k])\n {\n flag = 1;\n }\n }\n\n if (flag==1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Console.WriteLine(\"OK\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_1\n{\n class Program\n {\n static void Main(string[] args)\n { \n Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text=Console.ReadLine();//\u0412\u0432\u043e\u0434 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\n if (ControlInput(text)) return; //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443\n Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text2 = Console.ReadLine();\n if (ControlInput(text)) return;\n if (text.Length == text2.Length) //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\n {\n uint[] Mass1 = new uint[text.Length];//\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b\n uint[] Mass2 = new uint[text.Length];\n StringInMass(ref Mass1, text);//\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b\n StringInMass(ref Mass2, text2);\n MassObr(Mass1, Mass2);//,\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430\n }\n else//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u044b \u043f\u043e \u0434\u043b\u0438\u043d\u043d\u0435\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n }\n \n }\n\n//===============\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430========================================\n public static bool ControlInput(string Text)\n {\n Regex myReg = new Regex(@\"\\D\"); //\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \"\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u0440\u043e\u043c\u0435 \u0446\u0438\u0444\u0440\"\n if (Text.Length > 9 || myReg.IsMatch(Text))//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b-\u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430\n {\n Console.WriteLine(\"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b\");\n Console.ReadLine();\n return true;\n }\n return false;\n }\n//=======================\u041a\u043e\u043d\u0435\u0446 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0432\u043e\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430=======================\n\n\n//=======================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0432\u0435\u0434\u0435\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b==========================\n public static void StringInMass(ref uint[] Mass, string text)\n { //\u0434\u0430, \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u0434\u043e\u043c \u043d\u0430\u043f\u0435\u0440\u0435\u0434. \u041d\u041e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u043e \u0432\u0441\u0435\u0440\u0430\u0432\u043d\u043e \u0447\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 =)\n int lenText = text.Length; //\u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438\n for (int i = 0; i <= lenText - 1; i++) //\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430\n {\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.\n //\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044f\u0447\u0435\u0439\u043a\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u044c.\n Mass[i] = Convert.ToUInt32(text) % 10; \n text = text.Remove(text.Length - 1);//\u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\n }\n }\n//=====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b============================\n\n\n//=====================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b==================================================\n public static void MassObr(uint[] Mass1, uint[] Mass2)\n {\n\n for (int j = 0; j < Mass1.Length-1; j++)//\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u043c\n {\n for (int i = 0; i < Mass1.Length-j-1; i++)\n {\n if (Mass1[i] < Mass1[i + 1])\n {\n uint b = Mass1[i];\n Mass1[i] = Mass1[i + 1];\n Mass1[i + 1] = b;\n \n }\n\n }\n }\n\n if (Mass1[Mass1.Length - 1] == 0) //\u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 0\n {\n \n\n for (int i = Mass1.Length-1; i > 0; i--) //\u0437\u0430\u043c\u0435\u043d\u0435\u044f\u0435\u043c \u043d\u043e\u043b\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n {\n if (Mass1[i - 1] != 0)\n {\n uint b = Mass1[i-1];\n Mass1[i-1] = Mass1[i];\n Mass1[Mass1.Length - 1] = b;\n break;\n }\n }\n\n }\n //\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n if (Mass1.SequenceEqual(Mass2)) Console.WriteLine(\"OK\"); else Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n\n }\n //====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b================================\n }\n }\n;\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace \u0417\u0430\u0434\u0430\u0447\u0430_1\n{\n class Program\n {\n static void Main(string[] args)\n { \n // Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text=Console.ReadLine();//\u0412\u0432\u043e\u0434 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\n if (ControlInput(text)) return; //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443\n // Console.WriteLine(\"\u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\");\n string text2 = Console.ReadLine();\n if (ControlInput(text)) return;\n if (text.Length == text2.Length) //\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\n {\n uint[] Mass1 = new uint[text.Length];//\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b\n uint[] Mass2 = new uint[text.Length];\n StringInMass(ref Mass1, text);//\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b\n StringInMass(ref Mass2, text2);\n MassObr(Mass1, Mass2);//,\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u0430\n }\n else//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u044b \u043f\u043e \u0434\u043b\u0438\u043d\u043d\u0435\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n }\n \n }\n\n//===============\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430========================================\n public static bool ControlInput(string Text)\n {\n Regex myReg = new Regex(@\"\\D\"); //\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \"\u043b\u044e\u0431\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u043a\u0440\u043e\u043c\u0435 \u0446\u0438\u0444\u0440\"\n if (Text.Length > 9 || myReg.IsMatch(Text))//\u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0438 \u0435\u0441\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b-\u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430\n {\n Console.WriteLine(\"\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b\");\n Console.ReadLine();\n return true;\n }\n return false;\n }\n//=======================\u041a\u043e\u043d\u0435\u0446 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0432\u043e\u0435\u0440\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u043e\u0434\u0430=======================\n\n\n//=======================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0432\u0435\u0434\u0435\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b==========================\n public static void StringInMass(ref uint[] Mass, string text)\n { //\u0434\u0430, \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u0434\u043e\u043c \u043d\u0430\u043f\u0435\u0440\u0435\u0434. \u041d\u041e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u043e \u0432\u0441\u0435\u0440\u0430\u0432\u043d\u043e \u0447\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 =)\n int lenText = text.Length; //\u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0434\u043b\u0438\u043d\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438\n for (int i = 0; i <= lenText - 1; i++) //\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430\n {\n //\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.\n //\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044f\u0447\u0435\u0439\u043a\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u044c.\n Mass[i] = Convert.ToUInt32(text) % 10; \n text = text.Remove(text.Length - 1);//\u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e\n }\n }\n//=====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0438\u0441\u0435\u043b============================\n\n\n//=====================\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b==================================================\n public static void MassObr(uint[] Mass1, uint[] Mass2)\n {\n\n for (int j = 0; j < Mass1.Length-1; j++)//\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u043c\n {\n for (int i = 0; i < Mass1.Length-j-1; i++)\n {\n if (Mass1[i] < Mass1[i + 1])\n {\n uint b = Mass1[i];\n Mass1[i] = Mass1[i + 1];\n Mass1[i + 1] = b;\n \n }\n\n }\n }\n\n if (Mass1[Mass1.Length - 1] == 0) //\u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 0\n {\n \n\n for (int i = Mass1.Length-1; i > 0; i--) //\u0437\u0430\u043c\u0435\u043d\u0435\u044f\u0435\u043c \u043d\u043e\u043b\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\n {\n if (Mass1[i - 1] != 0)\n {\n uint b = Mass1[i-1];\n Mass1[i-1] = Mass1[i];\n Mass1[Mass1.Length - 1] = b;\n break;\n }\n }\n\n }\n //\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n if (Mass1.SequenceEqual(Mass2)) Console.WriteLine(\"OK\"); else Console.WriteLine(\"WRONG_ANSWER\");\n Console.ReadLine();\n\n }\n //====================\u041a\u043e\u043d\u0435\u0446 \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b================================\n }\n }\n;\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n B();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n string[] a = new string[3];\n for (int i = 0; i < 3; i++)\n a[i] = ReadLine();\n for (int i = 0; i < 3; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (!a[i][j].Equals(a[2 - i][2 - j]))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n Console.WriteLine(\"Yes\");\n }\n\n static void B()\n {\n int n, m;\n n = ReadInt();\n m = ReadInt();\n int[] digits = new int[10];\n while (n != 0)\n {\n digits[n % 10]++;\n n /= 10;\n }\n int ans = 0;\n for (int i = 1; i < 10; i++)\n {\n if (digits[i] != 0)\n {\n ans += i;\n digits[i]--;\n break;\n }\n }\n for (int i = 0; i < 10; i++)\n {\n while (digits[i] != 0)\n {\n ans = ans * 10 + i;\n digits[i]--;\n }\n }\n if (ans == m)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n static void C()\n {\n int left, right, up, down;\n left = right = up = down = 0;\n int a, b;\n string[] tokens = ReadArray(' ');\n a = int.Parse(tokens[0]);\n b = int.Parse(tokens[1]);\n string s = ReadLine();\n if (a == 0 && b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) up++;\n if (s[i].Equals('D')) down++;\n if (s[i].Equals('L')) left++;\n if (s[i].Equals('R')) right++;\n }\n int _left, _right, _up, _down;\n _left = _right = _up = _down = 0;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i].Equals('U')) _up++;\n if (s[i].Equals('D')) _down++;\n if (s[i].Equals('L')) _left++;\n if (s[i].Equals('R')) _right++;\n int _a = a + _left;\n _a -= _right;\n int _b = b - _up;\n _b += _down;\n if (_a == 0 && _b == 0)\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n else\n {\n int x = 0;\n if (right - left != 0)\n x = _a / (right - left);\n if (up - down != 0)\n x = _b / (up - down);\n\n if (x >= 0 && (_a + x * (left - right)) == 0 && (_b + x * (down - up) == 0))\n {\n Console.WriteLine(\"Yes\");\n return;\n }\n\n }\n }\n Console.WriteLine(\"No\");\n }\n\n static void D()\n {\n\n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static string[] ReadArray(char sep)\n {\n return Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n class Edge\n {\n public int a;\n public int b;\n public int w;\n\n public Edge(int a, int b, int w)\n {\n this.a = a;\n this.b = b;\n this.w = w;\n }\n }\n\n class Graph\n {\n public List[] g;\n public int[] color; //0-white, 1-gray, 2-black\n public int[] o; //open\n public int[] c; //close\n public int[] p;\n public int[] d;\n public List e;\n public Stack ans = new Stack();\n public Graph(int n)\n {\n g = new List[n + 1];\n for (int i = 0; i <= n; i++)\n g[i] = new List();\n color = new int[n + 1];\n o = new int[n + 1];\n c = new int[n + 1];\n p = new int[n + 1];\n d = new int[n + 1];\n }\n\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public bool DFS(int u, ref int time)\n {\n color[u] = gray;\n time++;\n o[u] = time;\n for (int i = 0; i < g[u].Count; i++)\n {\n int v = g[u][i];\n if (color[v] == gray)\n {\n return true;\n }\n if (color[v] == white)\n {\n p[v] = u;\n if (DFS(v, ref time)) return true;\n }\n }\n color[u] = black;\n ans.Push(u);\n c[u] = time;\n time++;\n return false;\n }\n }\n\n static class GraphUtils\n {\n const int white = 0;\n const int gray = 1;\n const int black = 2;\n\n public static void BFS(int s, Graph g)\n {\n Queue q = new Queue();\n q.Enqueue(s);\n while (q.Count != 0)\n {\n int u = q.Dequeue();\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == white)\n {\n g.color[v] = gray;\n g.d[v] = g.d[u] + 1;\n g.p[v] = u;\n q.Enqueue(v);\n }\n }\n g.color[u] = black;\n }\n }\n\n public static bool DFS(int u, ref int time, Graph g, Stack st)\n {\n g.color[u] = gray;\n time++;\n g.o[u] = time;\n for (int i = 0; i < g.g[u].Count; i++)\n {\n int v = g.g[u][i];\n if (g.color[v] == gray)\n {\n return true;\n }\n if (g.color[v] == white)\n {\n g.p[v] = u;\n if (DFS(v, ref time, g, st)) return true;\n }\n }\n g.color[u] = black;\n st.Push(u);\n g.c[u] = time;\n time++;\n return false;\n }\n\n public static void FordBellman(int u, Graph g)\n {\n int n = g.g.Length;\n for (int i = 0; i <= n; i++)\n {\n g.d[i] = int.MaxValue;\n g.p[i] = 0;\n }\n\n g.d[u] = 0;\n\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j < g.e.Count; j++)\n {\n if (g.d[g.e[j].a] != int.MaxValue)\n {\n if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])\n {\n g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;\n g.p[g.e[j].b] = g.e[j].a;\n }\n }\n }\n }\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace cf_12b\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n int first = int.Parse(Console.ReadLine());\n int second = int.Parse(Console.ReadLine());\n\n int answer = GetRightAnswer (first);\n\n if (second == answer)\n Console.WriteLine (\"OK\");\n else\n Console.WriteLine (\"WRONG_ANSWER\");\n }\n\n private static int GetRightAnswer(int number) {\n if (number == 0)\n return 0;\n\n var digits = GetDigits(number);\n\n Array.Sort (digits);\n\n if (digits [0] == 0) {\n int i = 1;\n while (digits[i] == 0)\n i++;\n\n digits [0] = digits [i];\n digits [i] = 0;\n }\n\n int answer = 0;\n for (int i = 0; i < digits.Length; i++) {\n answer = answer * 10 + digits [i];\n }\n\n return answer;\n }\n\n private static int[] GetDigits(int number) {\n var digits = new List ();\n digits.Add (number % 10);\n number = number / 10;\n\n while (number > 0) {\n digits.Add (number % 10);\n number = number / 10;\n }\n\n return digits.ToArray();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n\n static List[] adj;\n static bool[] visited = new bool[1 << 20];\n static int[] count = new int[20];\n\n static void Solve(int cur_i, int v_mask, int source_i, int len)\n {\n visited[v_mask] = true;\n\n for (int i = 0; i < adj[cur_i].Count; i++)\n {\n int n = adj[cur_i][i];\n if (n == source_i && len > 1)\n {\n count[len]++;\n continue;\n }\n if ((v_mask & (1 << n)) != 0) continue;\n Solve(n, v_mask | (1 << n), source_i, len + 1);\n }\n }\n\n static void Main(string[] args)\n {\n string n = Console.ReadLine().Trim();\n string g = Console.ReadLine().Trim();\n\n char[] a = n.ToCharArray();\n Array.Sort(a);\n int i = 0;\n while (i < a.Length && a[i] == '0') i++;\n if (i <= a.Length - 1)\n {\n a[0] = a[i];\n a[i] = '0';\n }\n if (a[0] == '0') Console.WriteLine(\"WRONG_ANSWER\");\n else\n {\n string m = new string(a);\n if (m == g) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n\n static List[] adj;\n static bool[] visited = new bool[1 << 20];\n static int[] count = new int[20];\n\n static void Solve(int cur_i, int v_mask, int source_i, int len)\n {\n visited[v_mask] = true;\n\n for (int i = 0; i < adj[cur_i].Count; i++)\n {\n int n = adj[cur_i][i];\n if (n == source_i && len > 1)\n {\n count[len]++;\n continue;\n }\n if ((v_mask & (1 << n)) != 0) continue;\n Solve(n, v_mask | (1 << n), source_i, len + 1);\n }\n }\n \n static void Main(string[] args)\n {\n string n = Console.ReadLine().Trim();\n string g = Console.ReadLine().Trim();\n\n char[] a = n.ToCharArray();\n Array.Sort(a);\n int i = 0;\n while (i < a.Length && a[i] == '0') i++;\n if (i < a.Length - 1)\n {\n a[0] = a[i];\n a[i] = '0';\n }\n string m = new string(a);\n if (m == g) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\n\nclass Program\n{\n public static int[] Read(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] ret = new int[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = int.Parse(tokens[i]);\n }\n\n return ret;\n }\n\n public static double[] ReadDouble(string str)\n {\n string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n double[] ret = new double[tokens.Length];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);\n }\n\n return ret;\n }\n\n static string Reverse(string s)\n {\n char[] a = s.ToCharArray();\n Array.Reverse(a);\n return new string(a);\n }\n\n static List[] adj;\n static bool[] visited = new bool[1 << 20];\n static int[] count = new int[20];\n\n static void Solve(int cur_i, int v_mask, int source_i, int len)\n {\n visited[v_mask] = true;\n\n for (int i = 0; i < adj[cur_i].Count; i++)\n {\n int n = adj[cur_i][i];\n if (n == source_i && len > 1)\n {\n count[len]++;\n continue;\n }\n if ((v_mask & (1 << n)) != 0) continue;\n Solve(n, v_mask | (1 << n), source_i, len + 1);\n }\n }\n\n static void Main(string[] args)\n {\n string n = Console.ReadLine().Trim();\n string g = Console.ReadLine().Trim();\n\n char[] a = n.ToCharArray();\n Array.Sort(a);\n int i = 0;\n while (i < a.Length && a[i] == '0') i++;\n if (i <= a.Length - 1 && a[0] == '0')\n {\n a[0] = a[i];\n a[i] = '0';\n }\n if (a[0] == '0') Console.WriteLine(\"WRONG_ANSWER\");\n else\n {\n string m = new string(a);\n if (m == g) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\npublic class Solution\n{\n public static void Main()\n {\n char[] chrIn = Console.ReadLine().ToCharArray().OrderBy(x => x).ToArray();\n string ans = Console.ReadLine();\n int n = chrIn.Length;\n int i = 0;\n while (chrIn[i] == '0')\n {\n i++;\n }\n chrIn[0] = chrIn[i];\n chrIn[i] = '0';\n if ((new string(chrIn)).Equals(ans))\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Timus\n{\n class Problems\n {\n static void Main()\n {\n var n = Console.ReadLine();\n var m = Console.ReadLine();\n if (n == \"0\" || m == \"0\")\n Console.WriteLine(\"WRONG_ANSWER\");\n else\n Console.WriteLine((GetSmallerView(n) == m) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n static string GetSmallerView(string n)\n {\n var _n = n.ToCharArray().Select(x => int.Parse(x.ToString())).ToList();\n var null_count = _n.Count(x => x == 0);\n _n.RemoveAll(x => x == 0);\n var min = _n.Min();\n _n.Remove(min);\n _n.Sort();\n return $\"{min}{new string('0', null_count)}{string.Concat(_n)}\";\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Application\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint a, b;\n\t\t\ta = int.Parse (Console.ReadLine ());\n\t\t\tb = int.Parse (Console.ReadLine ());\n\t\t\tif ((a == 0) && (b == 0)) {\n\t\t\t\tConsole.WriteLine (\"WRONG_ANSWER\");\n\n\t\t\t} else {\n\t\t\t\tList mas = new List ();\n\t\t\t\twhile (a!=0) {\n\t\t\t\t\tmas.Add (a % 10);\n\t\t\t\t\ta /= 10;\n\t\t\t\t}\n\t\t\t\tint index = 0;\n\t\t\t\tmas.Sort ();\n\t\t\t\tfor (int i = 0; i mas = new List ();\n\t\t\t\twhile (a!=0) {\n\t\t\t\t\tmas.Add (a % 10);\n\t\t\t\t\ta /= 10;\n\t\t\t\t}\n\t\t\t\tint index = 0;\n\t\t\t\tmas.Sort ();\n\t\t\t\tfor (int i = 0; i mas = new List ();\n\t\t\t\twhile (a!=0) {\n\t\t\t\t\tmas.Add (a % 10);\n\t\t\t\t\ta /= 10;\n\t\t\t\t}\n\t\t\t\tint index = 0;\n\t\t\t\tmas.Sort ();\n\t\t\t\tfor (int i = 0; i 0)\n {\n if (n.ToString().Contains('0'))\n {\n char l = n.ToString().Where(x => x != '0').OrderBy(x => x).First();\n string u = l.ToString();\n List j = n.ToString().Select(x => x).ToList();\n j.Remove(l);\n r = int.Parse(u + string.Join(\"\", j.Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n else\n {\n r = int.Parse(string.Join(\"\", n.ToString().Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n }\n else\n {\n r = n;\n } \n if (r == m) Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n //List input = Console.ReadLine().Split().Select(int.Parse).ToList();\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Numerics;\n\nclass Program\n{\n public static void Main(string[] args)\n {\n //MulticaseTest();\n //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = int.Parse(Console.ReadLine());\n int m = int.Parse(Console.ReadLine());\n // find smallest number then compare it to m\n int r = m;\n if (n > 0)\n {\n if (n.ToString().Contains('0'))\n {\n char l = n.ToString().Where(x => x != '0').OrderBy(x => x).First();\n string u = l.ToString();\n List j = n.ToString().Select(x => x).ToList();\n j.Remove(l);\n r = int.Parse(u + string.Join(\"\", j.Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n else\n {\n r = int.Parse(string.Join(\"\", n.ToString().Select(x => x.ToString()).Select(int.Parse).OrderBy(x => x)));\n }\n }\n else\n {\n r = n;\n }\n if (r == m) { if (n.ToString()[0] != '0') { Console.WriteLine(\"OK\"); } else { Console.WriteLine(\"WRONG_ANSWER\"); } }\n else Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n public static void MulticaseTest()\n {\n //4\n //4 5 2 3\n int t = int.Parse(Console.ReadLine());\n List o = new List(t);\n for (int i = 0; i < t; i++)\n {\n int n = int.Parse(Console.ReadLine());\n //List input = Console.ReadLine().Split().Select(int.Parse).ToList();\n \n }\n o.ForEach(Console.WriteLine);\n }\n}"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n\n var n = new List(sc.Next());\n var m = new List(sc.Next());\n \n n.Sort();\n for (int i = 0; i < n.Count; ++i) {\n if (n[i] != '0') {\n char t = n[i];\n n[i] = '0';\n n[0] = t;\n break;\n }\n }\n\n for (int i = 0; i < n.Count; ++i) {\n if (i >= m.Count || n[i] != m[i]) {\n wr.Write(\"WRONG_ANSWER\");\n wr.Flush();\n return;\n }\n }\n\n wr.Write(\"OK\");\n\n wr.Flush();\n\n \n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\n\nnamespace ConsoleApplication1\n{\n class Program\n { \n static void OpenConsole() \n { \n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n }\n\n static void CloseConsole()\n { \n Console.In.Close(); \n Console.Out.Close();\n }\n \n static void Solve()\n {\n string[] t = Console.In.ReadToEnd().Split(new char[3] { ' ', '\\n', '\\r' },\n StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(t[0]);\n string m = t[1];\n if (n == 0)\n {\n if (m == \"0\") Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n return;\n }\n if (m[0] == '0')\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n char[] tt = t[0].ToCharArray();\n Array.Sort(tt);\n int i = 0;\n while (i < tt.Length && tt[i] == '0') i++;\n if (i == tt.Length)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n tt[0] = tt[i];\n tt[i] = '0';\n if (int.Parse(t[1]) == int.Parse(new string(tt)))\n {\n Console.Write(\"OK\");\n }\n else\n {\n Console.Write(\"WRONG_ANSWER\");\n }\n }\n\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n OpenConsole();\n#endif\n Solve();\n#if !ONLINE_JUDGE\n CloseConsole();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\n\nnamespace ConsoleApplication1\n{\n class Program\n { \n static void OpenConsole() \n { \n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n }\n\n static void CloseConsole()\n { \n Console.In.Close(); \n Console.Out.Close();\n }\n \n static void Solve()\n {\n string[] t = Console.In.ReadToEnd().Split(new char[3] { ' ', '\\n', '\\r' },\n StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(t[0]);\n string m = t[1];\n if (n == 0)\n {\n if (m == \"0\") Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n return;\n }\n if (m[0] == '0')\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n char[] tt = t[0].ToCharArray();\n Array.Sort(tt);\n int i = 0;\n while (i < tt.Length && tt[i] == '0') i++;\n if (i == tt.Length)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n tt[0] = tt[i];\n tt[i] = '0';\n if (int.Parse(t[1]) == int.Parse(new string(tt)))\n {\n Console.Write(\"OK\");\n }\n else\n {\n Console.Write(\"WRONG_ANSWER\");\n }\n }\n\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n OpenConsole();\n#endif\n Solve();\n#if !ONLINE_JUDGE\n CloseConsole();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\n\nnamespace ConsoleApplication1\n{\n class Program\n { \n static void OpenConsole() \n { \n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n }\n\n static void CloseConsole()\n { \n Console.In.Close(); \n Console.Out.Close();\n }\n \n static void Solve()\n {\n string[] t = Console.In.ReadToEnd().Split(new char[3] { ' ', '\\n', '\\r' },\n StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(t[0]);\n string m = t[1];\n if (n == 0)\n {\n if (m == \"0\") Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n return;\n }\n char[] tt = t[0].ToCharArray();\n Array.Sort(tt);\n int i = 0;\n while (i < tt.Length && tt[i] == '0') i++;\n if (i == tt.Length)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n tt[0] = tt[i];\n tt[i] = '0';\n if (int.Parse(t[1]) == int.Parse(new string(tt)))\n {\n Console.Write(\"OK\");\n }\n else\n {\n Console.Write(\"WRONG_ANSWER\");\n }\n }\n\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n OpenConsole();\n#endif\n Solve();\n#if !ONLINE_JUDGE\n CloseConsole();\n#endif\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Reflection;\n\nnamespace ConsoleApplication1\n{\n class Program\n { \n static void OpenConsole() \n { \n string strAppDir =\n Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);\n Console.SetIn(new StreamReader(strAppDir + \"\\\\input.txt\"));\n Console.SetOut(new StreamWriter(strAppDir + \"\\\\output.txt\"));\n }\n\n static void CloseConsole()\n { \n Console.In.Close(); \n Console.Out.Close();\n }\n \n static void Solve()\n {\n string[] t = Console.In.ReadToEnd().Split(new char[3] { ' ', '\\n', '\\r' },\n StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(t[0]);\n string m = t[1];\n if (n == 0)\n {\n if (m == \"0\") Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n return;\n }\n if (m[0] == '0')\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n char[] tt = t[0].ToCharArray();\n Array.Sort(tt);\n int i = 0;\n while (i < tt.Length && tt[i] == '0') i++;\n if (i == tt.Length)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n tt[0] = tt[i];\n tt[i] = '0';\n if (int.Parse(t[1]) == int.Parse(new string(tt)))\n {\n Console.Write(\"OK\");\n }\n else\n {\n Console.Write(\"WRONG_ANSWER\");\n }\n }\n\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n OpenConsole();\n#endif\n Solve();\n#if !ONLINE_JUDGE\n CloseConsole();\n#endif\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\n \nnamespace acm{\n class Program{\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.WriteLine(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n \n static void Main(string[] args) {\n#if DEBUG\n open(file);\n#endif\n\t\t\tstring n1=Console.ReadLine().Trim(), n2=Console.ReadLine().Trim();\n\t\t\tint[] digits=new int[n1.Length];\n\t\t\t\t\t\t\n\t\t\tfor(int i=0; i 0) \n {\n int temp = a[i];\n a[i] = a[0];\n a[0] = temp;\n break;\n }\n }\n int x = 0;\n for (int i = 0; i < a.Length; i++) \n {\n x = x * 10 + a[i];\n }\n if (x == int.Parse(output)) { Console.WriteLine(\"OK\"); }\n else { Console.WriteLine(\"WRONG_ANSWER\"); }\n State:\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string req = Console.ReadLine();\n int answer = int.Parse(Console.ReadLine());\n int[] first = new int[req.Length];\n for (int i = 0; i < req.Length; i++) \n {\n first[i] = int.Parse(req.Substring(i, 1));\n }\n BubbleSort(ref first);\n if (first[0] == 0)\n {\n for (int i = 1; i < first.Length; i++)\n {\n if (first[i] > 0) { int temp = first[i]; first[i] = first[0]; first[0] = temp; break; }\n }\n }\n int request = 0;\n for (int i = 0; i < first.Length; i++) \n {\n request = request * 10 + first[i];\n }\n Console.WriteLine((request == answer) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string req = Console.ReadLine();\n int answer = int.Parse(Console.ReadLine());\n int[] first = new int[req.Length];\n for (int i = 0; i < req.Length; i++) \n {\n first[i] = int.Parse(req.Substring(i, 1));\n }\n BubbleSort(ref first);\n for (int i = 1; i < first.Length; i++)\n {\n if (first[i] > 0)\n {\n if (i != 0) { int temp = first[i]; first[i] = first[0]; first[0] = temp; }\n break;\n }\n }\n int request = 0;\n for (int i = 0; i < first.Length; i++) \n {\n request = request * 10 + first[i];\n }\n Console.WriteLine((request == answer) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string input = Console.ReadLine();\n string output = Console.ReadLine();\n int b = int.Parse(input);\n int[] a = new int[input.Length];\n for (int i = 0; i < a.Length; i++) \n {\n a[i] = b % 10;\n b = b / 10;\n }\n BubbleSort(ref a);\n for (int i = 0; i < a.Length; i++) \n {\n if (a[i] > 0) \n {\n int temp = a[i];\n a[i] = a[0];\n a[0] = temp;\n break;\n }\n }\n int x = 0;\n for (int i = 0; i < a.Length; i++) \n {\n x = x * 10 + a[i];\n }\n //Console.WriteLine(x);\n if (x == int.Parse(output)) { Console.WriteLine(\"OK\"); }\n else { Console.WriteLine(\"WRONG_ANSWER\"); }\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string req = Console.ReadLine();\n int answer = int.Parse(Console.ReadLine());\n int[] first = new int[req.Length];\n for (int i = 0; i < req.Length; i++) \n {\n first[i] = int.Parse(req.Substring(i, 1));\n }\n BubbleSort(ref first);\n for (int i = 0; i < first.Length; i++)\n {\n if (first[i] > 0)\n {\n if (i != 0) { int temp = first[0]; first[0] = first[i]; first[i] = temp; }\n break;\n }\n }\n int request = 0;\n for (int i = 0; i < first.Length; i++) \n {\n request = request * 10 + first[i];\n }\n Console.WriteLine((request == answer) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Saba \n{\n public class Hello1 \n {\n public static void Main()\n {\n string req = Console.ReadLine();\n int answer = int.Parse(Console.ReadLine());\n int[] first = new int[req.Length];\n for (int i = 0; i < req.Length; i++) \n {\n first[i] = int.Parse(req.Substring(i, 1));\n }\n BubbleSort(ref first);\n for (int i = 0; i < first.Length; i++)\n {\n if (first[i] > 0)\n {\n if (i != 0) { int temp = first[i]; first[i] = first[0]; first[0] = temp; }\n break;\n }\n }\n int request = 0;\n for (int i = 0; i < first.Length; i++) \n {\n request = request * 10 + first[i];\n }\n Console.WriteLine((request == answer) ? \"OK\" : \"WRONG_ANSWER\");\n }\n\n public static void BubbleSort(ref int[] a)\n {\n while (true)\n {\n bool isFound = false;\n for (int j = 0; j < a.Length - 1; j++)\n {\n if (a[j] > a[j + 1])\n {\n int temp = a[j];\n a[j] = a[j + 1];\n a[j + 1] = temp;\n isFound = true;\n }\n }\n if (!isFound) break;\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ask = 0;\n int answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt32(Console.ReadLine());\n answer = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(int ask, int answer)\n {\n int i = 0;\n int len = 0;\n int temp = 0;\n\n int[] a1 = null;\n int[] a2 = null;\n\n string s1 = \"\";\n string s2 = \"\";\n\n string result = \"WRONG_ANSWER\";\n\n char[] c1 = ask.ToString().ToCharArray();\n char[] c2 = answer.ToString().ToCharArray();\n\n if (c1.Length == c2.Length)\n {\n len = c1.Length;\n a1 = new int[len];\n a2 = new int[len];\n\n for (i = 0; i < len; i++)\n {\n a1[i] = c1[i] - '0';\n a2[i] = c2[i] - '0';\n }\n Array.Sort(a1);\n Array.Sort(a2);\n\n for (i = 0; i < len; i++)\n {\n s1 += a1[i];\n s2 += a2[i];\n }\n\n if (s1 == s2)\n {\n for (i = 0; i < len; i++)\n {\n if (a1[i] != 0)\n {\n temp = a1[i];\n a1[i] = a1[0];\n a1[0] = temp;\n\n break;\n }\n }\n\n s1 = \"\";\n for (i = 0; i < len; i++)\n {\n s1 += a1[i];\n }\n\n if (Convert.ToInt32(s1) == answer)\n {\n result = \"OK\";\n }\n }\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ask = 0;\n int answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt32(Console.ReadLine());\n answer = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(long ask, long answer)\n {\n long min = FindMinNumber(ask);\n string result = \"WRONG_ANSWER\";\n\n if (min == answer)\n {\n result = \"OK\";\n }\n\n return result;\n }\n\n public long FindMinNumber(long source)\n {\n int i = 0;\n int temp = 0;\n string str = source.ToString();\n char[] digits = source.ToString().ToCharArray();\n int[] d = new int[digits.Length];\n\n if (source > 9)\n {\n for (i = 0; i < digits.Length; i++)\n {\n d[i] = digits[i] - '0';\n }\n\n Array.Sort(d);\n\n for (i = 0; i < digits.Length; i++)\n {\n if (d[i] != 0)\n {\n temp = d[i];\n d[i] = d[0];\n d[0] = temp;\n\n break;\n }\n }\n\n str = \"\";\n for (i = 0; i < digits.Length; i++)\n {\n str += d[i];\n }\n }\n\n return Convert.ToInt64(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ask = 0;\n int answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt32(Console.ReadLine());\n answer = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(int ask, int answer)\n {\n int i = 0;\n int len = 0;\n int temp = 0;\n\n int[] a1 = null;\n int[] a2 = null;\n\n string s1 = \"\";\n string s2 = \"\";\n\n string result = \"WRONG_ANSWER\";\n\n char[] c1 = ask.ToString().ToCharArray();\n char[] c2 = answer.ToString().ToCharArray();\n\n if (ask < 10)\n {\n result = ask == answer ? \"OK\" : \"WRONG_ANSWER\";\n }\n else\n {\n if (c1.Length == c2.Length)\n {\n len = c1.Length;\n a1 = new int[len];\n a2 = new int[len];\n\n for (i = 0; i < len; i++)\n {\n a1[i] = c1[i] - '0';\n a2[i] = c2[i] - '0';\n }\n Array.Sort(a1);\n Array.Sort(a2);\n\n for (i = 0; i < len; i++)\n {\n s1 += a1[i];\n s2 += a2[i];\n }\n\n if (s1 == s2)\n {\n for (i = 0; i < len; i++)\n {\n if (a1[i] != 0)\n {\n temp = a1[i];\n a1[i] = a1[0];\n a1[0] = temp;\n\n break;\n }\n }\n\n s1 = \"\";\n for (i = 0; i < len; i++)\n {\n s1 += a1[i];\n }\n\n if (Convert.ToInt32(s1) == answer)\n {\n result = \"OK\";\n }\n }\n }\n }\n\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long ask = 0;\n long answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt64(Console.ReadLine());\n answer = Convert.ToInt64(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(long ask, long answer)\n {\n long min = FindMinNumber(ask);\n string result = \"WRONG_ANSWER\";\n\n if (min == answer)\n {\n result = \"OK\";\n }\n\n return result;\n }\n\n public long FindMinNumber(long source)\n {\n int i = 0;\n int temp = 0;\n string str = source.ToString();\n char[] digits = source.ToString().ToCharArray();\n int[] d = new int[digits.Length];\n\n if (source > 9)\n {\n for (i = 0; i < digits.Length; i++)\n {\n d[i] = digits[i] - '0';\n }\n\n Array.Sort(d);\n\n for (i = 0; i < digits.Length; i++)\n {\n if (d[i] != 0)\n {\n temp = d[i];\n d[i] = d[0];\n d[0] = temp;\n\n break;\n }\n }\n\n str = \"\";\n for (i = 0; i < digits.Length; i++)\n {\n str += d[i];\n }\n }\n\n return Convert.ToInt64(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ask = 0;\n int answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt32(Console.ReadLine());\n answer = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(long ask, long answer)\n {\n long min = FindMinNumber(ask);\n string result = \"WRONG_ANSWER\";\n\n if (min == answer)\n {\n result = \"OK\";\n }\n\n return result;\n }\n\n public long FindMinNumber(long source)\n {\n int i = 0;\n int temp = 0;\n string str = source.ToString();\n char[] digits = source.ToString().ToCharArray();\n int[] d = new int[digits.Length];\n\n if (source > 9)\n {\n for (i = 0; i < digits.Length; i++)\n {\n d[i] = digits[i] - '0';\n }\n\n Array.Sort(d);\n\n for (i = 0; i < digits.Length; i++)\n {\n if (d[i] != 0)\n {\n temp = d[i];\n d[i] = d[0];\n d[0] = temp;\n\n break;\n }\n }\n\n str = \"\";\n for (i = 0; i < digits.Length; i++)\n {\n str += d[i];\n }\n }\n\n return Convert.ToInt32(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ask = 0;\n int answer = 0;\n Program p = new Program();\n\n ask = Convert.ToInt32(Console.ReadLine());\n answer = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(p.CorrectAnswer(ask, answer));\n }\n\n public string CorrectAnswer(int ask, int answer)\n {\n int min = FindMinNumber(ask);\n string result = \"WRONG_ANSWER\";\n\n if (min == answer)\n {\n result = \"OK\";\n }\n\n return result;\n }\n\n public int FindMinNumber(int source)\n {\n int i = 0;\n int temp = 0;\n string str = source.ToString();\n char[] digits = source.ToString().ToCharArray();\n int[] d = new int[digits.Length];\n\n if (source > 9)\n {\n for (i = 0; i < digits.Length; i++)\n {\n d[i] = digits[i] - '0';\n }\n\n Array.Sort(d);\n\n for (i = 0; i < digits.Length; i++)\n {\n if (d[i] != 0)\n {\n temp = d[i];\n d[i] = d[0];\n d[0] = temp;\n\n break;\n }\n }\n\n str = \"\";\n for (i = 0; i < digits.Length; i++)\n {\n str += d[i];\n }\n }\n\n return Convert.ToInt32(str);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces.TaskB\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out long n);\n Input.Next(out string m);\n\n\n var ns = n.ToString();\n var ni = new List();\n for (int i = 0; i < ns.Length; i++)\n {\n ni.Add(int.Parse($\"{ns[i]}\"));\n }\n\n ni.Sort();\n var numbers = ni.Distinct();\n var min = numbers.First();\n if (min == 0) //0123456789\n {\n if (numbers.Count() <= 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n\n var secondMin = numbers.Skip(1).First();\n StringBuilder sb = new StringBuilder();\n sb.Append(secondMin);\n sb.Append('0', ni.Count(i => i == 0));\n sb.Append(secondMin.ToString()[0], ni.Count(i => i == secondMin) - 1);\n sb.Append(string.Join(\"\", ni.Where(i => i != 0 && i != secondMin).OrderBy(i => i)));\n\n if (sb.ToString() == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else //123456789\n {\n if (string.Join(\"\", ni) == m)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces.TaskB\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out long n);\n Input.Next(out long m);\n\n\n var ns = n.ToString();\n var ni = new List();\n for (int i = 0; i < ns.Length; i++)\n {\n ni.Add(int.Parse($\"{ns[i]}\"));\n }\n\n ni.Sort();\n var numbers = ni.Distinct();\n var min = numbers.First();\n if (min == 0) //0123456789\n {\n if (numbers.Count() <= 1)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n return;\n }\n\n var secondMin = numbers.Skip(1).First();\n StringBuilder sb = new StringBuilder();\n sb.Append(secondMin);\n sb.Append('0', ni.Count(i => i == 0));\n sb.Append(secondMin.ToString()[0], ni.Count(i => i == secondMin) - 1);\n sb.Append(string.Join(\"\", ni.Where(i => i != 0 && i != secondMin).OrderBy(i => i)));\n\n if (sb.ToString() == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else //123456789\n {\n if (string.Join(\"\", ni) == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces.TaskB\n{\n public class Task\n {\n void Solve()\n {\n Input.Next(out long n);\n Input.Next(out long m);\n\n\n var ns = n.ToString();\n var ni = new List();\n for (int i = 0; i < ns.Length; i++)\n {\n ni.Add(int.Parse($\"{ns[i]}\"));\n }\n\n ni.Sort();\n var numbers = ni.Distinct();\n var min = numbers.First();\n if (min == 0) //0123456789\n {\n var secondMin = numbers.Skip(1).First();\n StringBuilder sb = new StringBuilder();\n sb.Append(secondMin);\n sb.Append('0', ni.Count(i => i == 0));\n sb.Append(secondMin.ToString()[0], ni.Count(i => i == secondMin) - 1);\n sb.Append(string.Join(\"\", ni.Where(i => i != 0 && i != secondMin).OrderBy(i => i)));\n\n if (sb.ToString() == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else //123456789\n {\n if (string.Join(\"\", ni) == m.ToString())\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n\n public static void Main()\n {\n var task = new Task();\n #if DEBUG\n task.Solve();\n #else\n try\n {\n task.Solve();\n }\n catch (Exception ex)\n {\n Console.ForegroundColor = ConsoleColor.Red;\n Console.WriteLine(ex);\n }\n #endif\n }\n }\n}\n\nnamespace Codeforces\n{\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n public class DisjointSet\n {\n private readonly int[] _parent;\n private readonly int[] _rank;\n public int Count { get; private set; }\n\n public DisjointSet(int count, int initialize = 0)\n {\n Count = count;\n _parent = new int[Count];\n _rank = new int[Count];\n for (var i = 0; i < initialize; i++) _parent[i] = i;\n }\n\n private DisjointSet(int count, int[] parent, int[] rank)\n {\n Count = count;\n _parent = parent;\n _rank = rank;\n }\n\n public void Add(int v)\n {\n _parent[v] = v;\n _rank[v] = 0;\n }\n\n public int Find_Recursive(int v)\n {\n if (_parent[v] == v) return v;\n return _parent[v] = Find(_parent[v]);\n }\n\n public int Find(int v)\n {\n if (_parent[v] == v) return v;\n var last = v;\n while (_parent[last] != last) last = _parent[last];\n while (_parent[v] != v)\n {\n var t = _parent[v];\n _parent[v] = last;\n v = t;\n }\n return last;\n }\n\n public int this[int v]\n {\n get { return Find(v); }\n set { Union(v, value); }\n }\n\n public void Union(int a, int b)\n {\n a = Find(a);\n b = Find(b);\n if (a == b) return;\n if (_rank[a] < _rank[b])\n {\n var t = _rank[a];\n _rank[a] = _rank[b];\n _rank[b] = t;\n }\n _parent[b] = a;\n if (_rank[a] == _rank[b]) _rank[a]++;\n }\n\n public int GetSetCount()\n {\n var result = 0;\n for (var i = 0; i < Count; i++)\n {\n if (_parent[i] == i) result++;\n }\n return result;\n }\n\n public DisjointSet Clone()\n {\n var rank = new int[Count];\n _rank.CopyTo(rank, 0);\n var parent = new int[Count];\n _parent.CopyTo(parent, 0);\n return new DisjointSet(Count, parent, rank);\n }\n\n public override string ToString()\n {\n return string.Join(\",\", _parent.Take(50));\n }\n }\n\n public class Matrix\n {\n public static Matrix Create(int i, int j)\n {\n var m = new Matrix(i, j);\n return m;\n }\n\n public static Matrix Create(int i)\n {\n var m = new Matrix(i, i);\n return m;\n }\n\n public long Modulo { get; set; }\n\n private readonly int _width;\n private readonly int _height;\n private readonly long[,] _data;\n public int Width { get { return _width; } }\n public int Height { get { return _height; } }\n\n private Matrix(int i, int j)\n {\n Modulo = 1000000000000000000L;\n _width = j;\n _height = i;\n _data = new long[_height, _width];\n }\n\n public static Matrix operator *(Matrix m1, Matrix m2)\n {\n if (m1.Width != m2.Height) throw new InvalidDataException(\"m1.Width != m2.Height\");\n var m = Create(m2.Width, m1.Height);\n m.Modulo = m1.Modulo;\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n {\n for (var k = 0; k < m1.Width; k++)\n m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;\n m[j, i] %= m1.Modulo;\n }\n return m;\n }\n\n public static Matrix operator +(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator -(Matrix m1, Matrix m2)\n {\n var m = m1.Clone();\n for (var i = 0; i < m2.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;\n return m;\n }\n\n public static Matrix operator *(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n for (var j = 0; j < m1.Height; j++)\n m[j, i] = (m[j, i] * l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator *(long l, Matrix m1)\n {\n return m1 * l;\n }\n\n public static Matrix operator +(Matrix m1, long l)\n {\n var m = m1.Clone();\n for (var i = 0; i < m1.Width; i++)\n m[i, i] = (m[i, i] + l) % m.Modulo;\n return m;\n }\n\n public static Matrix operator +(long l, Matrix m1)\n {\n return m1 + l;\n }\n\n public static Matrix operator -(Matrix m1, long l)\n {\n return m1 + (-l);\n }\n\n public static Matrix operator -(long l, Matrix m1)\n {\n var m = m1.Clone() * -1;\n return m + l;\n }\n\n public Matrix BinPower(long l)\n {\n var n = 1;\n var m = Clone();\n var result = new Matrix(m.Height, m.Width) + 1;\n result.Modulo = m.Modulo;\n while (l != 0)\n {\n var i = l & ~(l - 1);\n l -= i;\n while (n < i)\n {\n m = m * m;\n n <<= 1;\n }\n result *= m;\n }\n return result;\n }\n\n public void Fill(long l)\n {\n l %= Modulo;\n for (var i = 0; i < _height; i++)\n for (var j = 0; j < _width; j++)\n _data[i, j] = l;\n }\n\n public Matrix Clone()\n {\n var m = new Matrix(_width, _height);\n Array.Copy(_data, m._data, _data.Length);\n m.Modulo = Modulo;\n return m;\n }\n\n public long this[int i, int j]\n {\n get { return _data[i, j]; }\n set { _data[i, j] = value % Modulo; }\n }\n }\n\n public class RedBlackTree : IEnumerable>\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTree(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key, TValue value)\n {\n var node = new Node { Key = key, Value = value, Red = true };\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n node.Value = deleted.Value;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n public TValue this[TKey key]\n {\n get\n {\n var node = _search(key);\n return node == null ? default(TValue) : node.Value;\n }\n set\n {\n var node = _search(key);\n if (node == null) Add(key, value);\n else node.Value = value;\n }\n }\n\n public bool Check()\n {\n int count;\n return _root == null || _root.Check(out count);\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n [DebuggerDisplay(\"{ToString()}\")]\n private sealed class Node\n {\n public TKey Key;\n public TValue Value;\n public bool Red;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n\n public bool Check(out int count)\n {\n count = 0;\n if (Red)\n {\n if (Left != null && Left.Red) return false;\n if (Right != null && Right.Red) return false;\n }\n var left = 0;\n var right = 0;\n if (Left != null && !Left.Check(out left)) return false;\n if (Right != null && !Right.Check(out right)) return false;\n count = left + (Red ? 0 : 1);\n if (left != right)\n {\n ;\n }\n return left == right;\n }\n\n public override string ToString()\n {\n return ToShortString(2);\n }\n\n private string ToShortString(int depth = 0)\n {\n return depth == 0\n ? string.Format(\"{0}{1}\", Red ? \"*\" : \"\", Key)\n : string.Format(\"({1}<{0}>{2})\", ToShortString(), Left == null ? \"null\" : Left.ToShortString(depth - 1), Right == null ? \"null\" : Right.ToShortString(depth - 1));\n }\n }\n\n #endregion\n\n #region IEnumerable\n\n public IEnumerator> GetEnumerator()\n {\n throw new NotImplementedException();\n }\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator();\n }\n\n #endregion\n }\n\n public class RedBlackTreeSimple\n {\n private readonly List _items;\n private Node _root;\n private readonly IComparer _comparer;\n\n public RedBlackTreeSimple(int capacity = 10)\n {\n _items = new List(capacity);\n _comparer = Comparer.Default;\n }\n\n private Node _search(TKey key)\n {\n var node = _root;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return node;\n node = i > 0 ? node.Right : node.Left;\n }\n return null;\n }\n\n /// \n /// Returns lower or equal key\n /// \n public TKey Lower(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i > 0)\n {\n good = node;\n node = node.Right;\n }\n else\n node = node.Left;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns higher or equal key\n /// \n public TKey Higher(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node good = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return key;\n if (i < 0)\n {\n good = node;\n node = node.Left;\n }\n else\n node = node.Right;\n }\n return good == null ? notFound : good.Key;\n }\n\n /// \n /// Returns minimum region, which encloses given key\n /// \n public Tuple Bounds(TKey key, TKey notFound = default(TKey))\n {\n var node = _root;\n Node lower = null;\n Node higher = null;\n while (node != null)\n {\n var i = _comparer.Compare(key, node.Key);\n if (i == 0) return new Tuple(key, key);\n if (i < 0)\n {\n higher = node;\n node = node.Left;\n }\n else\n {\n lower = node;\n node = node.Right;\n }\n }\n return new Tuple(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);\n }\n\n public void Add(TKey key)\n {\n var node = new Node(key);\n _items.Add(node);\n if (_root == null)\n {\n _root = node;\n _root.Red = false;\n return;\n }\n var x = _root;\n Node y = null;\n while (x != null)\n {\n y = x;\n x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;\n }\n node.Parent = y;\n if (y == null) _root = node;\n else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;\n else y.Left = node;\n InsertFixup(node);\n }\n\n private void InsertFixup(Node node)\n {\n while (true)\n {\n var parent = node.Parent;\n if (parent == null || !parent.Red || parent.Parent == null) break;\n var grand = parent.Parent;\n\n if (parent == grand.Left)\n {\n var uncle = grand.Right;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Right) /* we rotate around the parent */\n {\n node = parent;\n RotateLeft(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateRight(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n else\n {\n if (_root.Parent != null) Debugger.Break();\n\n var uncle = grand.Left;\n if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */\n {\n parent.Red = false;\n uncle.Red = false;\n grand.Red = true;\n node = grand; /* and continue fixing tree for grand */\n }\n else if (node == parent.Left) /* we rotate around the parent */\n {\n node = parent;\n RotateRight(node);\n }\n else /* rotate around grand and switch colors of grand and parent */\n {\n parent.Red = false;\n grand.Red = true;\n RotateLeft(grand);\n if (grand == _root) _root = parent;\n break; /* and finish since tree is fixed */\n }\n }\n }\n _root.Red = false;\n }\n\n private void RotateLeft(Node node)\n {\n if (node.Right == null)\n throw new NotSupportedException(\"Cannot rotate left: right node is missing\");\n var parent = node.Parent;\n var right = node.Right;\n right.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = right;\n else parent.Right = right;\n }\n node.Right = right.Left;\n if (node.Right != null)\n node.Right.Parent = node;\n right.Left = node;\n node.Parent = right;\n }\n\n private void RotateRight(Node node)\n {\n if (node.Left == null)\n throw new NotSupportedException(\"Cannot rotate right: left node is missing\");\n var parent = node.Parent;\n var left = node.Left;\n left.Parent = parent;\n if (parent != null)\n {\n if (parent.Left == node) parent.Left = left;\n else parent.Right = left;\n }\n node.Left = left.Right;\n if (node.Left != null)\n node.Left.Parent = node;\n left.Right = node;\n node.Parent = left;\n }\n\n public void Remove(TKey key)\n {\n var node = _search(key);\n if (node == null) return;\n\n var deleted = node.Left == null || node.Right == null ? node : Next(node);\n var child = deleted.Left ?? deleted.Right;\n if (child != null)\n child.Parent = deleted.Parent;\n if (deleted.Parent == null) /* root */\n _root = child;\n else if (deleted == deleted.Parent.Left)\n deleted.Parent.Left = child;\n else\n deleted.Parent.Right = child;\n if (node != deleted)\n {\n node.Key = deleted.Key;\n }\n\n if (!deleted.Red)\n {\n DeleteFixup(child, deleted.Parent);\n }\n }\n\n private void DeleteFixup(Node node, Node parent)\n {\n while (parent != null && (node == null || !node.Red))\n {\n if (node == parent.Left)\n {\n var brother = parent.Right;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateLeft(parent);\n brother = parent.Right;\n }\n if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Right == null || !brother.Right.Red)\n {\n if (brother.Left != null)\n brother.Left.Red = false;\n brother.Red = true;\n RotateRight(brother);\n brother = parent.Right;\n }\n if (!brother.Right.Red) Debugger.Break();\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Right != null)\n brother.Right.Red = false;\n RotateLeft(parent);\n node = _root;\n }\n }\n else\n {\n var brother = parent.Left;\n if (brother.Red)\n {\n brother.Red = false;\n parent.Red = true;\n RotateRight(parent);\n brother = parent.Left;\n }\n if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))\n {\n node = parent.Red ? _root : parent;\n brother.Red = true;\n parent.Red = false;\n }\n else\n {\n if (brother.Left == null || !brother.Left.Red)\n {\n if (brother.Right != null)\n brother.Right.Red = false;\n brother.Red = true;\n RotateLeft(brother);\n brother = parent.Left;\n }\n brother.Red = parent.Red;\n parent.Red = false;\n if (brother.Left != null)\n brother.Left.Red = false;\n RotateRight(parent);\n node = _root;\n }\n }\n parent = node.Parent;\n }\n\n node.Red = false;\n }\n\n private Node Minimum(Node node)\n {\n var result = node;\n while (result.Left != null) result = result.Left;\n return result;\n }\n\n private Node Maximum(Node node)\n {\n var result = node;\n while (result.Right != null) result = result.Right;\n return result;\n }\n\n private Node Next(Node node)\n {\n Node result;\n if (node.Right != null)\n {\n result = Minimum(node.Right);\n }\n else\n {\n while (node.Parent != null && node.Parent.Right == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n private Node Previous(Node node)\n {\n Node result;\n if (node.Left != null)\n {\n result = Maximum(node.Left);\n }\n else\n {\n while (node.Parent != null && node.Parent.Left == node)\n node = node.Parent;\n result = node.Parent;\n }\n return result;\n }\n\n public void Print()\n {\n var node = Minimum(_root);\n while (node != null)\n {\n Console.Write(node.Red ? '*' : ' ');\n Console.Write(node.Key);\n Console.Write('\\t');\n node = Next(node);\n }\n }\n\n #region Nested classes\n\n private sealed class Node\n {\n public Node(TKey key)\n {\n Key = key;\n }\n\n public TKey Key;\n public bool Red = true;\n\n public Node Parent;\n public Node Left;\n public Node Right;\n }\n\n #endregion\n }\n\n /// \n /// Fenwick tree for summary on the array\n /// \n public class FenwickSum\n {\n public readonly int Size;\n private readonly int[] _items;\n public FenwickSum(int size)\n {\n Size = size;\n _items = new int[Size];\n }\n\n public FenwickSum(IList items)\n : this(items.Count)\n {\n for (var i = 0; i < Size; i++)\n Increase(i, items[i]);\n }\n\n private int Sum(int r)\n {\n if (r < 0) return 0;\n if (r >= Size) r = Size - 1;\n var result = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1)\n result += _items[r];\n return result;\n }\n\n private int Sum(int l, int r)\n {\n return Sum(r) - Sum(l - 1);\n }\n\n public int this[int r]\n {\n get { return Sum(r); }\n }\n\n public int this[int l, int r]\n {\n get { return Sum(l, r); }\n }\n\n public void Increase(int i, int delta)\n {\n for (; i < Size; i = i | (i + 1))\n _items[i] += delta;\n }\n }\n\n /// \n /// Prime numbers\n /// \n public class Primes\n {\n /// \n /// Returns prime numbers in O(n)\n /// Returns lowet divisors as well\n /// Memory O(n)\n /// \n public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List pr)\n {\n lp = new int[n];\n pr = new List();\n for (var i = 2; i < n; i++)\n {\n if (lp[i] == 0)\n {\n lp[i] = i;\n pr.Add(i);\n }\n foreach (var prJ in pr)\n {\n var prIj = i * prJ;\n if (prJ <= lp[i] && prIj <= n - 1)\n {\n lp[prIj] = prJ;\n }\n else\n {\n break;\n }\n }\n }\n }\n\n /// \n /// Returns prime numbers in O(n*n)\n /// \n public static void SieveOfEratosthenes(int n, out List pr)\n {\n var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);\n pr = new List();\n var f = new bool[m];\n for (var i = 2; i * i <= n; i++)\n if (!f[i])\n for (var j = (long)i * i; j < m && j * j < n; j += i)\n f[j] = true;\n pr.Add(2);\n for (var i = 3; i * i <= n; i += 2)\n if (!f[i])\n pr.Add(i);\n }\n\n /// \n /// Greatest common divisor \n /// \n public static int Gcd(int x, int y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static long Gcd(long x, long y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Greatest common divisor\n /// \n public static BigInteger Gcd(BigInteger x, BigInteger y)\n {\n while (y != 0)\n {\n var c = y;\n y = x % y;\n x = c;\n }\n return x;\n }\n\n /// \n /// Returns all divisors of n in O(\u221an)\n /// \n public static IEnumerable GetDivisors(long n)\n {\n long r;\n while (true)\n {\n var x = Math.DivRem(n, 2, out r);\n if (r != 0) break;\n n = x;\n yield return 2;\n }\n var i = 3;\n while (i <= Math.Sqrt(n))\n {\n var x = Math.DivRem(n, i, out r);\n if (r == 0)\n {\n n = x;\n yield return i;\n }\n else i += 2;\n }\n if (n != 1) yield return n;\n }\n }\n\n /// \n /// Graph matching algorithms\n /// \n public class GraphMatching\n {\n #region Kuhn algorithm\n\n /// \n /// Kuhn algorithm for finding maximal matching\n /// in bipartite graph\n /// Vertexes are numerated from zero: 0, 1, 2, ... n-1\n /// Return array of matchings\n /// \n public static int[] Kuhn(List[] g, int leftSize, int rightSize)\n {\n Debug.Assert(g.Count() == leftSize);\n\n var matching = new int[leftSize];\n for (var i = 0; i < rightSize; i++)\n matching[i] = -1;\n var used = new bool[leftSize];\n\n for (var v = 0; v < leftSize; v++)\n {\n Array.Clear(used, 0, leftSize);\n _kuhn_dfs(v, g, matching, used);\n }\n\n return matching;\n }\n\n private static bool _kuhn_dfs(int v, List[] g, int[] matching, bool[] used)\n {\n if (used[v]) return false;\n used[v] = true;\n for (var i = 0; i < g[v].Count; i++)\n {\n var to = g[v][i];\n if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))\n {\n matching[to] = v;\n return true;\n }\n }\n return false;\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace N1\n{\n class Program\n {\n static void Main(string[] args)\n { \n char[] arr;\n string s = null;\n\n string[] numbers=new string[2];\n\n numbers[0] = Console.ReadLine();\n numbers[1] = Console.ReadLine(); \n\n arr = numbers[0].ToArray();\n Array.Sort(arr);\n\n for (int i = 0; i < arr.Length; i++)\n {\n if (arr[i] != '0')\n {\n char temp = arr[0];\n arr[0] = arr[i];\n arr[i] = temp;\n break;\n } \n }\n\n foreach (char x in arr)\n s += x;\n\n if (int.Parse(s) == int.Parse(numbers[1]))\n Console.WriteLine(\"OK\");\n else Console.WriteLine(\"WRONG_ANSWER\");\n\n Console.ReadLine();\n\n\n\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n { \n string a = Console.ReadLine();\n \n string b = Console.ReadLine();\n\n char[] array = a.ToCharArray();\n Array.Sort(array);\n string c = \"\";\n string nulls = \"\";\n foreach (var item in array)\n {\n if (item == '0')\n nulls += item;\n else\n c += item;\n }\n c = c.Insert(1, nulls);\n\n Console.WriteLine(c);\n\n if (b == c)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:\");\n string a = Console.ReadLine();\n\n Console.WriteLine(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0442\u043e\u0440\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:\");\n string b = Console.ReadLine();\n\n char[] array = a.ToCharArray();\n Array.Sort(array);\n string c = \"\";\n string nulls = \"\";\n foreach (var item in array)\n {\n if (item == '0')\n nulls += item;\n else\n c += item;\n }\n c = c.Insert(1, nulls);\n\n // Console.WriteLine(c);\n\n if (b == c)\n Console.WriteLine(\"OK\");\n else\n Console.WriteLine(\"WRONG_ANSWER\");\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace tmp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int big = Convert.ToInt32(Console.ReadLine());\n int small = Convert.ToInt32(Console.ReadLine());\n if (big == 0 && small == 0) { Console.Write(\"OK\"); goto end; }\n if (big == 0 || small == 0) { Console.Write(\"WRONG_ANSWER\"); goto end; }\n string a = big.ToString();\n char[] b = a.ToCharArray();\n Array.Sort(b);\n int zero = 0;\n int num = 1;\n int index = 0;\n while (index < b.Length && b[index] == '0')\n {\n zero++;\n index++;\n }\n if (zero == 0) num = 0;\n else num = (b[index++] - '0') * (int)Math.Pow(10, zero);\n while (index < b.Length)\n num = 10 * num + b[index++] - '0';\n if (num == small) Console.Write(\"OK\");\n else Console.Write(\"WRONG_ANSWER\");\n end:\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine(((s1 == res && f) || (int.Parse(s) == 0 && int.Parse(s1) == 0)) ? \"OK\" : \"WRONG_ANSWER\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res && f) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res && !f) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n int count = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (int.Parse(s1[i].ToString()) != 0)\n break;\n else\n count++;\n }\n \n Console.WriteLine((s1 == res && f || count > 1) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n string str = \"\";\n bool flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (!flag)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n {\n flag = true;\n }\n }\n }\n string res = \"\";\n flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += str;\n flag = true;\n }\n else if( num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res) ? \"OK\" : \"WRONG\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n\n Array.Sort(num);\n bool flag = false;\n if (num.Length != 1)\n {\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n flag = true;\n else if (num[i] != 0 && flag)\n {\n num[0] = num[i];\n num[i] = 0;\n flag = false;\n }\n else\n break;\n }\n }\n string res = \"\";\n for (int i = 0; i < num.Length; i++)\n res += num[i].ToString();\n Console.WriteLine(((s1 == res) || (int.Parse(s) == 0 && int.Parse(s1) == 0)) ? \"OK\" : \"WRONG_ANSWER\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n bool flag = false;\n if (num.Length != 1 && num[0] == 0)\n {\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n flag = true;\n else if (num[i] != 0 && flag)\n {\n num[0] = num[i];\n num[i] = 0;\n flag = false;\n }\n else\n break;\n }\n }\n string res = \"\";\n for (int i = 0; i < num.Length; i++)\n res += num[i].ToString();\n Console.WriteLine(((s1 == res) || (int.Parse(s) == 0 && int.Parse(s1) == 0)) && !flag ? \"OK\" : \"WRONG_ANSWER\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n string str = \"\";\n bool flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n break;\n }\n string res = \"\";\n flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n string str = \"\";\n bool flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (!flag)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n {\n flag = true;\n }\n }\n }\n string res = \"\";\n flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res) ? \"OK\" : \"WRONG\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n Array.Sort(num);\n string str = \"\";\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n }\n string res = \"\";\n bool flag = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n int count = 0;\n for (int i = 0; i < s1.Length; i++)\n {\n if (int.Parse(s1[i].ToString()) != 0)\n break;\n else\n count++;\n }\n \n Console.WriteLine((s1 == res && f) ? \"OK\" : \"WRONG_ANSWER\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string s1 = Console.ReadLine();\n int[] num = new int[s.Length];\n for (int i = 0; i < s.Length; i++)\n {\n num[i] = int.Parse(s[i].ToString());\n }\n string str = \"\";\n bool f = false;\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] == 0)\n str += \"0\";\n else\n f = true;\n }\n string res = \"\";\n bool flag = false;\n Array.Sort(num);\n for (int i = 0; i < num.Length; i++)\n {\n if (num[i] != 0 && !flag)\n {\n res += num[i];\n res += str;\n flag = true;\n }\n else if(num[i] != 0)\n res += num[i];\n }\n Console.WriteLine((s1 == res && f || (int.Parse(s) == 0 && int.Parse(s1) == 0)) ? \"OK\" : \"WRONG_ANSWER\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace task12B\n{\n class Program\n {\n public static string GetOptimal(string number)\n {\n Int32 countNulls = 0;\n for (Int32 i = 0; i < number.Length; i++)\n {\n if (number[i] == '0')\n {\n countNulls++;\n }\n }\n number = number.Replace(\"0\", \"\");\n Int32[] arr = new int[number.Length];\n for (Int32 i = 0; i < number.Length; i++)\n {\n arr[i] = number[i]-48;\n }\n for (Int32 i = 0; i < arr.Length; i++)\n {\n for (Int32 j = i + 1; j < arr.Length; j++)\n {\n if (arr[i] >= arr[j])\n {\n Int32 t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n }\n }\n string result = \"\";\n result = arr[0].ToString();\n for (Int32 i = 0; i < countNulls; i++)\n {\n result += \"0\";\n }\n for (Int32 i = 1; i < arr.Length; i++)\n {\n result += arr[i].ToString();\n }\n return result;\n }\n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n string answer = Console.ReadLine();\n if (number == \"0\")\n {\n if (answer.Replace(\"0\", \"\") == \"\")\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else\n {\n if (GetOptimal(number) == answer)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n //Console.ReadLine();\n //string answer = Console.ReadLine();\n //\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace task12B\n{\n class Program\n {\n public static string DeleteFirstsNulls(string number)\n {\n string result = string.Empty;\n Int32 i = 0;\n while (i= arr[j])\n {\n Int32 t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n }\n }\n string result = \"\";\n result = arr[0].ToString();\n for (Int32 i = 0; i < countNulls; i++)\n {\n result += \"0\";\n }\n for (Int32 i = 1; i < arr.Length; i++)\n {\n result += arr[i].ToString();\n }\n return result;\n }\n static void Main(string[] args)\n {\n string number = Console.ReadLine();\n string answer = Console.ReadLine();\n //Console.WriteLine(DeleteFirstsNulls(number));\n if (number == \"0\")\n {\n if (answer == \"0\")\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n else\n {\n if (GetOptimal(number) == DeleteFirstsNulls(answer))\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n //Console.ReadLine();\n //string answer = Console.ReadLine();\n //\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections;\n\nclass Program\n{\n class Pair : System.IComparable\n {\n public int x;\n public int y;\n\n public Pair (int xx, int yy)\n {\n x = xx;\n y = yy;\n }\n\n public int CompareTo(object obj)\n {\n Pair p = (Pair) obj;\n return x < p.x ? -1 : x == p.x ? 0 : 1;\n }\n }\n\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"../../input.txt\"));\n int [] a = new int[10];\n\n string n = Console.ReadLine();\n for (int i = 0; i < n.Length; ++i)\n ++a[n[i] - '0'];\n\n string m = Console.ReadLine();\n\n string s = \"\";\n bool f = true;\n bool find = true;\n while (find)\n {\n find = false;\n for (int i = f ? 1 : 0; i < 10; ++i)\n if (a[i] > 0)\n {\n a[i]--;\n s += i;\n find = true;\n break;\n }\n f = false;\n }\n\n Console.WriteLine(m.Equals(s) ? \"OK\" : \"WRONG_ANSWER\");\n\n /*\n string str = \"\";\n while (!string.IsNullOrEmpty((str = Console.ReadLine())))\n\n var dict = new System.Collections.Generic.Dictionary(); \n \n Pair[] a = new Pair[100];\n for (int i = 0; i < a.Length; ++i)\n a[i] = new Pair(100 - i, i);\n Array.Sort(a);\n\n int testCount = Convert.ToInt32(Console.ReadLine());\n int n = int.Parse(Console.ReadLine());\n string[] data = Console.ReadLine().Split(new char[] { ' ' });\n */\n \n Console.ReadKey();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Contest_12\n{\n class Program\n {\n static void B()\n {\n var s = Console.ReadLine();\n string r1 = Console.ReadLine();\n string r2 = \"\";\n int[] a = new int[10];\n\n for (int i = 0; i < s.Length; i++)\n {\n a[int.Parse(s[i].ToString())]++;\n }\n\n for (int i = 1; i < 10; i++)\n {\n if (a[i] > 0)\n {\n r2 += i;\n a[i]--;\n break;\n }\n }\n\n for (int i = 0; i < 10; i++)\n {\n while (a[i] > 0)\n {\n r2 += i;\n a[i]--;\n }\n }\n\n Console.WriteLine(r1 == r2 ? \"OK\" : \"NO\");\n }\n\n static void Main(string[] args)\n {\n B();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] cs = Console.ReadLine().ToCharArray();\n Array.Sort(cs);\n for (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\n for (int i = 0; i < cs.Length; ++i)\n if (Console.Read() != cs[i])\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n if (Console.KeyAvailable) Console.Write(\"WRONG_ANSWER\");\n else Console.Write(\"OK\");\n }\n }\n}\n\n/* Array.Sort(cs);\nfor (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\nConsole.WriteLine(cs);\nfor(int i=0;i dic = new Dictionary();\n foreach (string s in names)\n {\n if (dic.ContainsKey(s)) ++dic[s];\n else dic.Add(s, 1);\n }\n\n List> tmp = new List>(dic.Count);\n foreach (KeyValuePair item in dic)\n tmp.Add(item);\n tmp.Sort((x, y) => { return x.Value.CompareTo(y.Value); });\n tmp.Reverse();\n\n Array.Sort(much);\n\n int v=0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString() + \" \");\n\n Array.Reverse(much);\n v = 0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString());*/\n/* int count = int.Parse(Console.ReadLine());\n List vb = new List(count);\n string[] sb = Console.ReadLine().Split(' ');\n string[] si = Console.ReadLine().Split(' ');\n string[] sr = Console.ReadLine().Split(' ');\n for(int i=0;i{return int.Parse(x.ToString()).CompareTo(int.Parse(y.ToString()));});\n for (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\n foreach (char c in cs)\n if (Console.Read() != c)\n {\n Console.Write(\"WRONG_ANSWER\");\n return;\n }\n Console.Write(\"OK\");\n }\n }\n}\n\n /* string s=Console.ReadLine();\n\t\t\tchar[] cs=s.ToCharArray();\n Array.Sort(cs);\n for(int i=0;i dic = new Dictionary();\n foreach (string s in names)\n {\n if (dic.ContainsKey(s)) ++dic[s];\n else dic.Add(s, 1);\n }\n\n List> tmp = new List>(dic.Count);\n foreach (KeyValuePair item in dic)\n tmp.Add(item);\n tmp.Sort((x, y) => { return x.Value.CompareTo(y.Value); });\n tmp.Reverse();\n\n Array.Sort(much);\n\n int v=0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString() + \" \");\n\n Array.Reverse(much);\n v = 0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString());*/\n/* uint count = uint.Parse(Console.ReadLine());\n uint[] vb = new uint[count];\n uint[] vi = new uint[count];\n uint[] vr = new uint[count];\n uint[] max = new uint[3];\n uint[][] tmp={vb,vi,vr};\n int si = 0;\n foreach(uint[] a in tmp)\n {\n uint i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n {\n a[i] = uint.Parse(s);\n if (max[si] < a[i]) max[si] = a[i];\n ++i;\n }\n ++si;\n }\n\n uint c = 0;\n for (int i = 0; i < count; ++i)\n if (vb[i] < max[0] && vi[i] < max[1] && vr[i] < max[2])\n ++c;\n Console.Write(c);*/"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s=Console.ReadLine();\n\t\t\tchar[] cs=s.ToCharArray();\n Array.Sort(cs);\n for(int i=0;i dic = new Dictionary();\n foreach (string s in names)\n {\n if (dic.ContainsKey(s)) ++dic[s];\n else dic.Add(s, 1);\n }\n\n List> tmp = new List>(dic.Count);\n foreach (KeyValuePair item in dic)\n tmp.Add(item);\n tmp.Sort((x, y) => { return x.Value.CompareTo(y.Value); });\n tmp.Reverse();\n\n Array.Sort(much);\n\n int v=0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString() + \" \");\n\n Array.Reverse(much);\n v = 0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString());*/\n/* uint count = uint.Parse(Console.ReadLine());\n uint[] vb = new uint[count];\n uint[] vi = new uint[count];\n uint[] vr = new uint[count];\n uint[] max = new uint[3];\n uint[][] tmp={vb,vi,vr};\n int si = 0;\n foreach(uint[] a in tmp)\n {\n uint i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n {\n a[i] = uint.Parse(s);\n if (max[si] < a[i]) max[si] = a[i];\n ++i;\n }\n ++si;\n }\n\n uint c = 0;\n for (int i = 0; i < count; ++i)\n if (vb[i] < max[0] && vi[i] < max[1] && vr[i] < max[2])\n ++c;\n Console.Write(c);*/"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n char[] cs = s.ToCharArray();\n Array.Sort(cs);\n for (int i = 0; i < cs.Length; ++i)\n if (cs[i] != '0')\n {\n char tmp = cs[0];\n cs[0] = cs[i];\n cs[i] = tmp;\n break;\n }\n for(int i=0;i dic = new Dictionary();\n foreach (string s in names)\n {\n if (dic.ContainsKey(s)) ++dic[s];\n else dic.Add(s, 1);\n }\n\n List> tmp = new List>(dic.Count);\n foreach (KeyValuePair item in dic)\n tmp.Add(item);\n tmp.Sort((x, y) => { return x.Value.CompareTo(y.Value); });\n tmp.Reverse();\n\n Array.Sort(much);\n\n int v=0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString() + \" \");\n\n Array.Reverse(much);\n v = 0;\n for (i = 0; i < tmp.Count; ++i)\n v += much[i] * tmp[i].Value;\n Console.Write(v.ToString());*/\n/* uint count = uint.Parse(Console.ReadLine());\n uint[] vb = new uint[count];\n uint[] vi = new uint[count];\n uint[] vr = new uint[count];\n uint[] max = new uint[3];\n uint[][] tmp={vb,vi,vr};\n int si = 0;\n foreach(uint[] a in tmp)\n {\n uint i = 0;\n foreach (string s in Console.ReadLine().Split(' '))\n {\n a[i] = uint.Parse(s);\n if (max[si] < a[i]) max[si] = a[i];\n ++i;\n }\n ++si;\n }\n\n uint c = 0;\n for (int i = 0; i < count; ++i)\n if (vb[i] < max[0] && vi[i] < max[1] && vr[i] < max[2])\n ++c;\n Console.Write(c);*/"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace b\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n char[] given = a.ToString().ToCharArray();\n a = int.Parse(Console.ReadLine());\n char[] result = a.ToString().ToCharArray();\n if (result.Length != given.Length)\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n else\n {\n Array.Sort(given);\n int index = 0;\n while (index < given.Length && given[index] == '0')\n {\n index++;\n }\n if (index < given.Length && index!=0)\n {\n given[index] ^= given[0];\n given[0] ^= given[index];\n given[index] ^= given[0];\n }\n bool ok = true; ;\n for (int i = 0; i < given.Length; i++)\n {\n if (given[i] != result[i])\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n Console.WriteLine(\"OK\");\n }\n else\n {\n Console.WriteLine(\"WRONG_ANSWER\");\n }\n }\n }\n }\n}\n"}], "src_uid": "d1e381b72a6c09a0723cfe72c0917372"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.NetworkInformation;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, i) : (9999, i);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int k = 0; k < n; ++k)\n {\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[i] > b[i] && a[j] < b[j] && mat[i, j].Item1 <= n)\n { \n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n if (from == to)\n {\n return;\n }\n\n var prev = mat[from, to].Item2;\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n\n Pour(from, prev, d);\n\n if (d - p > 0)\n {\n a[prev] -= d - p;\n a[to] += d - p;\n res.Add(CreateKey(prev, to, d - p));\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (long, long, long)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t.Item1;\n var to = t.Item2;\n var d = t.Item3;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n public static int ReadInt(this TextReader tr)\n {\n var v = 0;\n var negative = false;\n\n for (var c = (char)tr.Read(); !char.IsWhiteSpace(c); c = (char)tr.Read())\n {\n if (c == '-')\n {\n negative = true;\n }\n else\n {\n v = v * 10 + c - '0';\n }\n }\n\n for (; char.IsWhiteSpace((char)tr.Peek()); tr.Read()) ;\n\n return negative ? -v : v;\n }\n private static (long, long, long)[] Parse(TextReader tr)\n {\n var n = tr.ReadInt();\n var v = tr.ReadInt();\n var e = tr.ReadInt();\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static (long, long, long)[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new WarshallFloydGraph(n);\n\n foreach (var edge in edges)\n {\n mat.AddEdge(edge.Item1, edge.Item2);\n }\n\n mat.Solve();\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List<(long, long, long)> Execute(int[] a, int[] b, WarshallFloydGraph mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n public class WarshallFloydGraph\n {\n private int[,] mat;\n private int[,] prev;\n\n public WarshallFloydGraph(int n)\n {\n mat = new int[n, n];\n prev = new int[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? 0 : n + 1;\n prev[i, j] = i;\n }\n }\n }\n\n internal void AddEdge(int s, int t)\n {\n mat[s, t] = 1;\n prev[s, t] = s;\n mat[t, s] = 1;\n prev[t, s] = t;\n }\n\n internal void Solve()\n {\n var n = mat.GetLength(0);\n\n for (int k = 0; k < n; ++k)\n {\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (mat[i, k] + mat[k, j] < mat[i, j])\n {\n mat[i, j] = mat[i, k] + mat[k, j];\n prev[i, j] = prev[k, j];\n }\n }\n }\n }\n }\n\n internal bool IsConnected(int i, int j)\n {\n return mat[i, j] <= mat.GetLength(0);\n }\n\n internal int PreviousNode(int from, int to)\n {\n return prev[from, to];\n }\n\n }\n\n\n internal class Calculator\n {\n readonly List<(long, long, long)> res = new List<(long, long, long)>();\n readonly int[] a;\n readonly int[] b;\n readonly WarshallFloydGraph mat;\n\n public Calculator(int[] a, int[] b, WarshallFloydGraph mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List<(long, long, long)> Solve()\n {\n var n = a.Length;\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[i] > b[i] && a[j] < b[j] && mat.IsConnected(i, j))\n {\n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n if (from == to)\n {\n return;\n }\n\n var prev = mat.PreviousNode(from, to);\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add((prev, to, p));\n }\n\n Pour(from, prev, d);\n\n int remainder = d - p;\n\n if (remainder > 0)\n {\n a[prev] -= remainder;\n a[to] += remainder;\n res.Add((prev, to, remainder));\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, i) : (9999, i);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int k = 0; k < n; ++k)\n {\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n //for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[i] > b[i] && a[j] < b[j] && mat[i, j].Item1 <= n)\n { \n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n //if (prev == res.Count)\n //{\n // break;\n //}\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n if (from == to)\n {\n return;\n }\n\n var prev = mat[from, to].Item2;\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n\n Pour(from, prev, d);\n\n if (d - p > 0)\n {\n a[prev] -= d - p;\n a[to] += d - p;\n res.Add(CreateKey(prev, to, d - p));\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n\n for (; ; )\n {\n var prev = res.Count;\n\n var maxValue = 0;\n var maxIndex = 0;\n\n for (int k = 0; k < n; ++k)\n {\n if (a[k] - b[k] > maxValue)\n {\n maxValue = a[k] - b[k];\n maxIndex = k;\n }\n }\n\n if (maxValue == 0)\n {\n break;\n }\n\n var minValue = 0;\n var minIndex = 0;\n\n for (int j = 0; j < n; ++j)\n {\n if (a[j] - b[j] < minValue)\n {\n if (mat[maxIndex, j].Item1 > n)\n {\n continue;\n }\n minValue = a[j] - b[j];\n minIndex = j;\n }\n }\n\n if (minValue == 0)\n {\n break;\n }\n\n Pour(maxIndex, minIndex, Math.Min(maxValue, -minValue));\n\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n for (; ; )\n {\n var prev = mat[from, to].Item2;\n\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, d));\n }\n if (prev == from)\n {\n break;\n }\n to = prev;\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1 + 1, t.Item2 + 1, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges, v);\n }\n\n public static (int, int, int)[] Calc(int[] a, int[] b, (int, int)[] edges, int v)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item2);\n mat[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[i, k].Item2);\n //mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, k);\n }\n }\n }\n }\n\n List<(int, int, int)> res = Execute(a, b, n, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static (int, int, int)[] Calc0(int[] a, int[] b, (int, int)[] edges, int v)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item2);\n mat[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j].Item1 = mat[i, k].Item1 + mat[k, j].Item1;\n mat[i, j].Item2 = k;\n }\n }\n }\n }\n\n List<(int, int, int)> res = Execute(a, b, n, mat, v);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List<(int, int, int)> Execute(int[] a, int[] b, int n, (int, int)[,] mat)\n {\n var res = new List<(int, int, int)>();\n\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (mat[i, j].Item1 > n)\n {\n continue;\n }\n res.AddRange(Pour(mat, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j])));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n public static List<(int, int, int)> Execute(int[] a, int[] b, int n, (int, int)[,] mat, int v)\n {\n var R = new List<(int, int, int)>();\n for (int x = 0; x < n; ++x)\n {\n for (int y = 0; y < n; ++y)\n {\n if (mat[x, y].Item1 > n)\n continue;\n var j = Math.Min(a[x] - b[x], b[y] - a[y]);\n if (j <= 0) continue;\n Flow(x, y, j, mat, a, v, R);\n }\n }\n return R;\n }\n\n\n private static void Flow(int s, int t, int d, (int,int)[,] mat, int[] A, int V, List<(int,int,int)>R)\n {\n var N = mat.GetLength(0);\n\n var P = new List();\n P.Add(s);\n\n for (var i = s; i != t;)\n {\n int y = 0;\n for (;y< N; ++y)\n if (mat[i,y].Item1 == 1 && mat[y,t].Item1 == mat[i,t].Item1 - 1)\n break;\n P.Add(i = y);\n }\n\n Flow2(P, A, 0, P.Count - 1, d, V, R);\n }\n\n private static void Flow2(List P, int[] A, int si, int ti, int d, int V, List<(int, int, int)> R)\n {\n int i;\n if (si == ti) return;\n if (A[P[si + 1]] + d <= V)\n {\n A[P[si]] -= d;\n A[P[si + 1]] += d;\n R.Add((P[si], P[si + 1], d));\n Flow2(P, A, si + 1, ti, d, V, R);\n }\n else\n {\n int d2 = V - A[P[si + 1]];\n A[P[si]] -= d2;\n A[P[si + 1]] += d2;\n if (d2 > 0) R.Add((P[si], P[si + 1], d2));\n Flow2(P, A, si + 1, ti, d, V, R);\n A[P[si]] -= d - d2;\n A[P[si + 1]] += d - d2;\n R.Add((P[si], P[si + 1], d - d2));\n }\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, int[] a, int[] b, int from, int to, int d)\n {\n var res = new List<(int, int, int)>();\n\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return res;\n }\n\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n res.AddRange(Pour(g, a, b, next, to, d));\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from, next, d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices.ComTypes;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1, t.Item2, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n private static (int, int, int)[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var g = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n g[i, j] = i == j ? (0, j) : (n + 1, 0);\n }\n }\n\n foreach (var edge in edges)\n {\n g[edge.Item1, edge.Item2] = (1, edge.Item2);\n g[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (g[i, k].Item1 + g[k, j].Item1 < g[i, j].Item1)\n {\n g[i, j].Item1 = g[i, k].Item1 + g[k, j].Item1;\n g[i, j].Item2 = k;\n }\n }\n }\n }\n\n var res = new List<(int, int, int)>();\n\n for (var updated = true; updated;)\n {\n updated = false;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (g[i, j].Item1 > n)\n {\n continue;\n }\n var list = Pour(g, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n if (list != null)\n {\n res.AddRange(list);\n updated = true;\n }\n }\n }\n }\n }\n }\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, int[] a, int[] b, int from, int to, int d)\n {\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return null;\n }\n\n var res = new List<(int, int, int)>();\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n var list = Pour(g, a, b, next, to, d);\n if (list != null)\n {\n res.AddRange(list);\n }\n }\n\n a[to] += d;\n a[from] -= d;\n res.Add((from + 1, to + 1, d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { /*AutoFlush = false*/ })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n Console.Out.WriteLine(\"NO\");\n return;\n }\n\n Console.Out.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n Console.Out.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n Environment.Exit(0);\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new int[n, n];\n var prev = new int[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? 0 : 9999;\n prev[i, j] = i;\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = 1;\n prev[edge.Item1, edge.Item2] = edge.Item1;\n mat[edge.Item2, edge.Item1] = 1;\n prev[edge.Item2, edge.Item1] = edge.Item2;\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k] + mat[k, j] < mat[i, j])\n {\n mat[i, j] = mat[i, k] + mat[k, j];\n prev[i, j] = prev[k, j];\n }\n }\n }\n }\n\n var res = Execute(a, b, mat, prev);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, int[,] mat, int[,] prev)\n {\n var calculator = new Calculator(a, b, mat, prev);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n int[,] mat;\n int[,] prev;\n\n public Calculator(int[] a, int[] b, int[,] mat, int[,] prev)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n this.prev = prev;\n }\n\n public List Solve()\n {\n var n = a.Length;\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (mat[i, j] > n)\n {\n continue;\n }\n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n for (; ; )\n {\n var prev = this.prev[from, to];\n\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n if (prev == from)\n {\n break;\n }\n to = prev;\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1 + 1, t.Item2 + 1, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges, v);\n }\n\n public static (int, int, int)[] Calc(int[] a, int[] b, (int, int)[] edges, int v)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item2);\n mat[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, k);\n }\n }\n }\n }\n\n List<(int, int, int)> res = Execute(a, b, n, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static (int, int, int)[] Calc0(int[] a, int[] b, (int, int)[] edges, int v)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item2);\n mat[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j].Item1 = mat[i, k].Item1 + mat[k, j].Item1;\n mat[i, j].Item2 = k;\n }\n }\n }\n }\n\n List<(int, int, int)> res = Execute(a, b, n, mat, v);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List<(int, int, int)> Execute(int[] a, int[] b, int n, (int, int)[,] mat)\n {\n var res = new List<(int, int, int)>();\n\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (mat[i, j].Item1 > n)\n {\n continue;\n }\n res.AddRange(Pour(mat, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j])));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n public static List<(int, int, int)> Execute(int[] a, int[] b, int n, (int, int)[,] mat, int v)\n {\n var R = new List<(int, int, int)>();\n for (int x = 0; x < n; ++x)\n {\n for (int y = 0; y < n; ++y)\n {\n if (mat[x, y].Item1 > n)\n continue;\n var j = Math.Min(a[x] - b[x], b[y] - a[y]);\n if (j <= 0) continue;\n Flow(x, y, j, mat, a, v, R);\n }\n }\n return R;\n }\n\n\n private static void Flow(int s, int t, int d, (int,int)[,] mat, int[] A, int V, List<(int,int,int)>R)\n {\n var N = mat.GetLength(0);\n\n var P = new List();\n P.Add(s);\n\n for (var i = s; i != t;)\n {\n int y = 0;\n for (;y< N; ++y)\n if (mat[i,y].Item1 == 1 && mat[y,t].Item1 == mat[i,t].Item1 - 1)\n break;\n P.Add(i = y);\n }\n\n Flow2(P, A, 0, P.Count - 1, d, V, R);\n }\n\n private static void Flow2(List P, int[] A, int si, int ti, int d, int V, List<(int, int, int)> R)\n {\n int i;\n if (si == ti) return;\n if (A[P[si + 1]] + d <= V)\n {\n A[P[si]] -= d;\n A[P[si + 1]] += d;\n R.Add((P[si], P[si + 1], d));\n Flow2(P, A, si + 1, ti, d, V, R);\n }\n else\n {\n int d2 = V - A[P[si + 1]];\n A[P[si]] -= d2;\n A[P[si + 1]] += d2;\n if (d2 > 0) R.Add((P[si], P[si + 1], d2));\n Flow2(P, A, si + 1, ti, d, V, R);\n A[P[si]] -= d - d2;\n A[P[si + 1]] += d - d2;\n R.Add((P[si], P[si + 1], d - d2));\n }\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, int[] a, int[] b, int from, int to, int d)\n {\n var res = new List<(int, int, int)>();\n\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return res;\n }\n\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n res.AddRange(Pour(g, a, b, next, to, d));\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from, next, d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1, t.Item2, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select long.Parse(x);\n var b = from x in tr.ReadLine().Split() select long.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static (int, int, int)[] Calc(long[] a, long[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var g = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n g[i, j] = i == j ? (0, j) : (9999, j);\n }\n }\n\n foreach (var edge in edges)\n {\n g[edge.Item1, edge.Item2] = (1, edge.Item2);\n g[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (g[i, k].Item1 + g[k, j].Item1 < g[i, j].Item1)\n {\n g[i, j].Item1 = g[i, k].Item1 + g[k, j].Item1;\n g[i, j].Item2 = k;\n }\n }\n }\n }\n\n var res = new List<(int, int, int)>();\n\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (g[i, j].Item1 > n)\n {\n continue;\n }\n res.AddRange(Pour(g, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j])));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, long[] a, long[] b, int from, int to, long d)\n {\n var res = new List<(int, int, int)>();\n\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return res;\n }\n\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n res.AddRange(Pour(g, a, b, next, to, d));\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from + 1, next + 1, (int)d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices.ComTypes;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1, t.Item2, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n private static (int, int, int)[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var g = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n g[i, j] = i == j ? (0, j) : (n + 1, 0);\n }\n }\n\n foreach (var edge in edges)\n {\n g[edge.Item1, edge.Item2] = (1, edge.Item2);\n g[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (g[i, k].Item1 + g[k, j].Item1 < g[i, j].Item1)\n {\n g[i, j].Item1 = g[i, k].Item1 + g[k, j].Item1;\n g[i, j].Item2 = k;\n }\n }\n }\n }\n\n var res = new List<(int, int, int)>();\n\n for (var updated = true; updated;)\n {\n updated = false;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (g[i, j].Item1 > n)\n {\n continue;\n }\n var list = Pour(g, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n if (list != null)\n {\n res.AddRange(list);\n updated = true;\n }\n }\n }\n }\n }\n }\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, int[] a, int[] b, int from, int to, int d)\n {\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return null;\n }\n\n var res = new List<(int, int, int)>();\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n var list = Pour(g, a, b, next, to, d);\n if (list != null)\n {\n res.AddRange(list);\n }\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from + 1, next + 1, d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, i) : (9999, i);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[i] > b[i] && a[j] < b[j] && mat[i, j].Item1 <= n)\n { \n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n for (; ; )\n {\n var prev = mat[from, to].Item2;\n\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n if (prev == from)\n {\n break;\n }\n to = prev;\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, i) : (9999, i);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[i] > b[i] && a[j] < b[j] && mat[i, j].Item1 <= n)\n { \n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n var n = a.Length;\n var prevList = new List();\n for (var cur = from; cur != to;)\n {\n prevList.Add(cur);\n for (int i = 0; i < n; ++i)\n {\n if (mat[cur, i].Item1 == 1 && mat[i, to].Item1 == mat[cur, to].Item1 - 1)\n {\n cur = i;\n break;\n }\n }\n }\n\n for (var i = prevList.Count - 1; i >= 0; --i)\n {\n var prev = prevList[i];// mat[from, to].Item2;\n\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n if (prev == from)\n {\n break;\n }\n to = prev;\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) {\n AutoFlush = false\n })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, long[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n var prev = t & ((1 << 16) - 1);\n var to = (t >> 16) & ((1 << 16) - 1);\n var d = t >> 32;\n tw.WriteLine(\"{0} {1} {2}\", prev + 1, to + 1, d);\n }\n }\n\n private static long[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select int.Parse(x);\n var b = from x in tr.ReadLine().Split() select int.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n public static long[] Calc(int[] a, int[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var mat = new (int, int)[n, n];\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n mat[i, j] = i == j ? (0, i) : (9999, i);\n }\n }\n\n foreach (var edge in edges)\n {\n mat[edge.Item1, edge.Item2] = (1, edge.Item1);\n mat[edge.Item2, edge.Item1] = (1, edge.Item2);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (mat[i, k].Item1 + mat[k, j].Item1 < mat[i, j].Item1)\n {\n mat[i, j] = (mat[i, k].Item1 + mat[k, j].Item1, mat[k, j].Item2);\n }\n }\n }\n }\n\n var res = Execute(a, b, mat);\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n public static List Execute(int[] a, int[] b, (int, int)[,] mat)\n {\n var calculator = new Calculator(a, b, mat);\n return calculator.Solve();\n }\n }\n\n internal class Calculator\n {\n List res = new List();\n int[] a;\n int[] b;\n (int, int)[,] mat;\n\n public Calculator(int[] a, int[] b, (int, int)[,] mat)\n {\n this.a = a;\n this.b = b;\n this.mat = mat;\n }\n\n public List Solve()\n {\n var n = a.Length;\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (mat[i, j].Item1 > n)\n {\n continue;\n }\n Pour(i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n return res;\n }\n\n private void Pour(int from, int to, int d)\n {\n for (; ; )\n {\n var prev = mat[from, to].Item2;\n\n var p = Math.Min(a[prev], d);\n if (p > 0)\n {\n a[prev] -= p;\n a[to] += p;\n res.Add(CreateKey(prev, to, p));\n }\n if (prev == from)\n {\n break;\n }\n to = prev;\n }\n }\n\n private long CreateKey(long prev, long to, long d)\n {\n return (d << 32) + (to << 16) + prev;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices.ComTypes;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1, t.Item2, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select long.Parse(x);\n var b = from x in tr.ReadLine().Split() select long.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n private static (int, int, int)[] Calc(long[] a, long[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var g = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n g[i, j] = i == j ? (0, j) : (n + 1, 0);\n }\n }\n\n foreach (var edge in edges)\n {\n g[edge.Item1, edge.Item2] = (1, edge.Item2);\n g[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (g[i, k].Item1 + g[k, j].Item1 < g[i, j].Item1)\n {\n g[i, j].Item1 = g[i, k].Item1 + g[k, j].Item1;\n g[i, j].Item2 = k;\n }\n }\n }\n }\n\n var res = new List<(int, int, int)>();\n\n for (var updated = true; updated;)\n {\n updated = false;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (g[i, j].Item1 > n)\n {\n continue;\n }\n var list = Pour(g, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j]));\n if (list != null)\n {\n res.AddRange(list);\n updated = true;\n }\n }\n }\n }\n }\n }\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, long[] a, long[] b, int from, int to, long d)\n {\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return null;\n }\n\n var res = new List<(int, int, int)>();\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n var list = Pour(g, a, b, next, to, d);\n if (list != null)\n {\n res.AddRange(list);\n }\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from + 1, next + 1, (int)d));\n\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices.ComTypes;\n\nnamespace Codeforces.R318.E\n{\n public static class Solver\n {\n public static void Main()\n {\n using (var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })\n {\n Solve(Console.In, sw);\n }\n }\n\n public static void Solve(TextReader tr, TextWriter tw)\n {\n WriteAnswer(tw, Parse(tr));\n }\n\n private static void WriteAnswer(TextWriter tw, (int, int, int)[] res)\n {\n if (res == null)\n {\n tw.WriteLine(\"NO\");\n return;\n }\n\n tw.WriteLine(res.Length);\n\n foreach (var t in res)\n {\n tw.WriteLine(\"{0} {1} {2}\", t.Item1, t.Item2, t.Item3);\n }\n }\n\n private static (int, int, int)[] Parse(TextReader tr)\n {\n var w = tr.ReadLine().Split();\n var v = int.Parse(w[1]);\n var e = int.Parse(w[2]);\n\n var a = from x in tr.ReadLine().Split() select long.Parse(x);\n var b = from x in tr.ReadLine().Split() select long.Parse(x);\n\n var edges = new (int, int)[e];\n for (int i = 0; i < e; ++i)\n {\n var l = tr.ReadLine().Split();\n edges[i] = (int.Parse(l[0]) - 1, int.Parse(l[1]) - 1);\n }\n\n return Calc(a.ToArray(), b.ToArray(), edges);\n }\n\n private static (int, int, int)[] Calc(long[] a, long[] b, (int, int)[] edges)\n {\n var n = a.Length;\n var g = new (int, int)[n, n];\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n g[i, j] = i == j ? (0, j) : (n + 1, j);\n }\n }\n\n foreach (var edge in edges)\n {\n g[edge.Item1, edge.Item2] = (1, edge.Item2);\n g[edge.Item2, edge.Item1] = (1, edge.Item1);\n }\n\n for (int i = 0; i < n; ++i)\n {\n for (int j = 0; j < n; ++j)\n {\n for (int k = 0; k < n; ++k)\n {\n if (g[i, k].Item1 + g[k, j].Item1 < g[i, j].Item1)\n {\n g[i, j].Item1 = g[i, k].Item1 + g[k, j].Item1;\n g[i, j].Item2 = k;\n }\n }\n }\n }\n\n var res = new List<(int, int, int)>();\n\n for (; ; )\n {\n var prev = res.Count;\n for (int i = 0; i < n; ++i)\n {\n if (a[i] > b[i])\n {\n for (int j = 0; j < n; ++j)\n {\n if (a[j] < b[j])\n {\n if (g[i, j].Item1 > n)\n {\n continue;\n }\n res.AddRange(Pour(g, a, b, i, j, Math.Min(a[i] - b[i], b[j] - a[j])));\n }\n }\n }\n }\n if (prev == res.Count)\n {\n break;\n }\n }\n\n if (!a.SequenceEqual(b))\n {\n return null;\n }\n\n return res.ToArray();\n }\n\n private static List<(int, int, int)> Pour((int, int)[,] g, long[] a, long[] b, int from, int to, long d)\n {\n var res = new List<(int, int, int)>();\n\n d = Math.Min(a[from], d);\n\n if (d == 0)\n {\n return res;\n }\n\n\n var next = g[from, to].Item2;\n\n if (next != to)\n {\n res.AddRange(Pour(g, a, b, next, to, d));\n }\n\n a[next] += d;\n a[from] -= d;\n res.Add((from + 1, next + 1, (int)d));\n\n return res;\n }\n }\n}\n"}], "src_uid": "0939354d9bad8301efb79a1a934ded30"} {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n public class Point\n {\n public int X, Y;\n }\n\n public interface IRequestor\n {\n int Req(int x, int y);\n }\n\n public class OnlineRequestor : IRequestor\n {\n public int Req(int x, int y)\n {\n Console.WriteLine(\"0 \" + x + \" \" + y);\n return int.Parse(Console.ReadLine());\n }\n }\n\n public class OfflineRequestor : IRequestor\n {\n private int[] xx, yy;\n public OfflineRequestor(int[] x, int[] y)\n {\n xx = x;\n yy = y;\n }\n\n public int Req(int x, int y)\n {\n int ans = int.MaxValue;\n\n for (int i = 0; i < xx.Length; i++)\n ans = Math.Min(ans, Math.Abs(xx[i] - x));\n\n for (int i = 0; i < yy.Length; i++)\n ans = Math.Min(ans, Math.Abs(yy[i] - y));\n\n return ans;\n }\n }\n\n private static IRequestor requestor;\n private static bool reverse = false;\n private static int requestCount = 0;\n private static int Req(int x, int y)\n {\n requestCount++;\n\n if (!reverse)\n return requestor.Req(x, y);\n\n return requestor.Req(y, x);\n }\n\n private static List answer;\n private static void Search(int l, int r)\n {\n if (r < l) return;\n\n int mid = (l + r) / 2;\n var d = Req(mid, randomY);\n\n if (d == 0)\n {\n answer.Add(mid);\n Search(l, mid - 1);\n Search(mid + 1, r);\n }\n else\n {\n Search(l, mid - d);\n Search(mid + d, r);\n }\n }\n\n private static Random rnd = new Random();\n private static int randomY;\n private static List Solve(bool rev)\n {\n reverse = rev;\n answer = new List();\n\n randomY = rev ? rY : rX;\n Search(-100000000, 100000000);\n\n return answer;\n }\n\n\n private static int rX, rY;\n private static void SearchRandom()\n {\n while (Req(rX, rY) < 1000)\n {\n rX = rnd.Next(-100000000, 100000001);\n rY = rnd.Next(-100000000, 100000001);\n }\n\n //Console.WriteLine(requestCount);\n }\n\n private static void Main(string[] args)\n {\n var xx = new int[4000];\n var yy = new int[4000];\n for (int i = 0; i < xx.Length; i++) xx[i] = rnd.Next(-100000000, 100000001);\n for (int i = 0; i < yy.Length; i++) yy[i] = rnd.Next(-100000000, 100000001);\n\n requestor = new OfflineRequestor(xx, yy);\n requestor = new OnlineRequestor();\n\n SearchRandom();\n var x = Solve(false);\n var y = Solve(true);\n\n Console.WriteLine(\"1 \" + x.Count + \" \" + y.Count);\n Console.WriteLine(string.Join(\" \", x));\n Console.WriteLine(string.Join(\" \", y));\n\n //Console.WriteLine(\"Request: \" + requestCount);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n public class Point\n {\n public int X, Y;\n }\n\n public interface IRequestor\n {\n int Req(int x, int y);\n }\n\n public class OnlineRequestor : IRequestor\n {\n public int Req(int x, int y)\n {\n Console.WriteLine(\"0 \" + x + \" \" + y);\n return int.Parse(Console.ReadLine());\n }\n }\n\n public class OfflineRequestor : IRequestor\n {\n private int[] xx, yy;\n public OfflineRequestor(int[] x, int[] y)\n {\n xx = x;\n yy = y;\n }\n\n public int Req(int x, int y)\n {\n int ans = int.MaxValue;\n\n for (int i = 0; i < xx.Length; i++)\n ans = Math.Min(ans, Math.Abs(xx[i] - x));\n\n for (int i = 0; i < yy.Length; i++)\n ans = Math.Min(ans, Math.Abs(yy[i] - y));\n\n return ans;\n }\n }\n\n private static IRequestor requestor;\n private static bool reverse = false;\n private static int requestCount = 0;\n private static int Req(int x, int y)\n {\n requestCount++;\n\n if (!reverse)\n return requestor.Req(x, y);\n\n return requestor.Req(y, x);\n }\n\n private static List answer;\n private static void Search(int l, int r)\n {\n if (r < l) return;\n\n int mid = (l + r) / 2;\n var d = Req(mid, randomY);\n\n if (d == 0)\n {\n answer.Add(mid);\n Search(l, mid - 1);\n Search(mid + 1, r);\n }\n else\n {\n Search(l, mid - d);\n Search(mid + d, r);\n }\n }\n\n private static Random rnd = new Random();\n private static int randomY;\n private static List Solve(bool rev)\n {\n reverse = rev;\n answer = new List();\n\n randomY = rev ? rY : rX;\n Search(-100000000, 100000000);\n\n return answer;\n }\n\n\n private static int rX, rY;\n private static void SearchRandom()\n {\n while (Req(rX, rY) < 3000)\n {\n rX = rnd.Next(-100000000, 100000001);\n rY = rnd.Next(-100000000, 100000001);\n }\n }\n\n private static void Main(string[] args)\n {\n requestor = new OnlineRequestor();\n\n SearchRandom();\n var x = Solve(false);\n var y = Solve(true);\n\n Console.WriteLine(\"1 \" + x.Count + \" \" + y.Count);\n Console.WriteLine(string.Join(\" \", x));\n Console.WriteLine(string.Join(\" \", y));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n public class Point\n {\n public int X, Y;\n }\n\n public interface IRequestor\n {\n int Req(int x, int y);\n }\n\n public class OnlineRequestor : IRequestor\n {\n public int Req(int x, int y)\n {\n Console.WriteLine(\"0 \" + x + \" \" + y);\n return int.Parse(Console.ReadLine());\n }\n }\n\n public class OfflineRequestor : IRequestor\n {\n private int[] xx, yy;\n public OfflineRequestor(int[] x, int[] y)\n {\n xx = x;\n yy = y;\n }\n\n public int Req(int x, int y)\n {\n int ans = int.MaxValue;\n\n for (int i = 0; i < xx.Length; i++)\n ans = Math.Min(ans, Math.Abs(xx[i] - x));\n\n for (int i = 0; i < yy.Length; i++)\n ans = Math.Min(ans, Math.Abs(yy[i] - y));\n\n return ans;\n }\n }\n\n private static IRequestor requestor;\n private static bool reverse = false;\n private static int Req(int x, int y)\n {\n if (!reverse)\n return requestor.Req(x, y);\n\n return requestor.Req(y, x);\n }\n\n private static List answer;\n private static void Search(int l, int r)\n {\n if (r < l) return;\n\n int mid = (l + r) / 2;\n var d = Req(mid, randomY);\n\n if (d == 0)\n {\n answer.Add(mid);\n Search(l, mid - 1);\n Search(mid + 1, r);\n }\n else\n {\n Search(l, mid - d);\n Search(mid + d, r);\n }\n }\n\n private static Random rnd = new Random();\n private static int randomY;\n private static List Solve(bool rev)\n {\n reverse = rev;\n answer = new List();\n\n randomY = rev ? rY : rX;\n Search(-100000000, 100000000);\n\n return answer;\n }\n\n\n private static int rX, rY;\n private static void SearchRandom()\n {\n while (Req(rX, rY) < 100)\n {\n rX = rnd.Next(-100000000, 100000001);\n rY = rnd.Next(-100000000, 100000001);\n }\n }\n\n private static void Main(string[] args)\n {\n //requestor = new OfflineRequestor(new int[] { 1, 100 }, new int[] { 20, 50 });\n requestor = new OnlineRequestor();\n\n SearchRandom();\n var x = Solve(false);\n var y = Solve(true);\n\n Console.WriteLine(\"1 \" + x.Count + \" \" + y.Count);\n Console.WriteLine(string.Join(\" \", x));\n Console.WriteLine(string.Join(\" \", y));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n public class Point\n {\n public int X, Y;\n }\n\n public interface IRequestor\n {\n int Req(int x, int y);\n }\n\n public class OnlineRequestor : IRequestor\n {\n public int Req(int x, int y)\n {\n Console.WriteLine(\"0 \" + x + \" \" + y);\n return int.Parse(Console.ReadLine());\n }\n }\n\n public class OfflineRequestor : IRequestor\n {\n private int[] xx, yy;\n public OfflineRequestor(int[] x, int[] y)\n {\n xx = x;\n yy = y;\n }\n\n public int Req(int x, int y)\n {\n int ans = int.MaxValue;\n\n for (int i = 0; i < xx.Length; i++)\n ans = Math.Min(ans, Math.Abs(xx[i] - x));\n\n for (int i = 0; i < yy.Length; i++)\n ans = Math.Min(ans, Math.Abs(yy[i] - y));\n\n return ans;\n }\n }\n\n private static IRequestor requestor;\n private static bool reverse = false;\n private static int Req(int x, int y)\n {\n if (!reverse)\n return requestor.Req(x, y);\n\n return requestor.Req(y, x);\n }\n\n private static List answer;\n private static void Search(int l, int r)\n {\n if (r < l) return;\n\n int mid = (l + r) / 2;\n var d = Req(mid, randomY);\n\n if (d == 0)\n {\n answer.Add(mid);\n Search(l, mid - 1);\n Search(mid + 1, r);\n }\n else\n {\n Search(l, mid - d);\n Search(mid + d, r);\n }\n }\n\n private static Random rnd = new Random();\n private static int randomY;\n private static List Solve(bool rev)\n {\n reverse = rev;\n answer = new List();\n\n randomY = rev ? rY : rX;\n Search(-100000000, 100000000);\n\n return answer;\n }\n\n\n private static int rX, rY;\n private static void SearchRandom()\n {\n while (Req(rX, rY) < 100)\n {\n rX = rnd.Next(-100000000, 100000001);\n rY = rnd.Next(-100000000, 100000001);\n }\n }\n\n private static void Main(string[] args)\n {\n // requestor = new OfflineRequestor(new int[] { 1, 100 }, new int[] { 20, 50 });\n requestor = new OnlineRequestor();\n\n SearchRandom();\n var x = Solve(false);\n var y = Solve(true);\n\n Console.WriteLine(\"1 \" + x.Count + \" \" + y.Count);\n Console.WriteLine(string.Join(\" \", x));\n Console.WriteLine(string.Join(\" \", y));\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "src_uid": "583cd1e553133b297f99fd52e5ad355b"} {"source_code": "using System;\n\nnamespace temp\n{\n\tclass Program\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tstring[] str = Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);\n\t\t\tint stk=0;\n\t\t\tint[] a = {0,0,0};\n\t\t\tfor(int i=0;i2)\n\t\t\t\t{\n\t\t\t\t\tstk=0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a[0]>a[1] && a[0]>a[2])\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"chest\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(a[1]>a[0] && a[1]>a[2])\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"biceps\");\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tConsole.WriteLine(\"back\");\n\t\t\treturn;\n\t\t}\n\t}\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), chest = 0, biceps = 0, back = 0;\n List mass = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n for (int i = 0; i < n; i++)\n {\n if (i % 3 == 0)\n {\n chest += mass[i];\n mass[i] = 0;\n }\n }\n for (int i = 0; i < mass.Count(); i++)\n {\n if (mass[i] == 0) mass.Remove(mass[i]);\n }\n\n for (int i = 0; i < mass.Count(); i++)\n {\n if (i % 2 == 0) biceps += mass[i];\n else back += mass[i];\n }\n if (biceps > chest && biceps > back) Console.Write(\"biceps\");\n if (chest > biceps && chest > back) Console.Write(\"chest\");\n if (back > chest && back > biceps) Console.Write(\"back\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace ASM\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] workout = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n for(int i = 0; i < n / 3; i++)\n {\n chest += workout[i*3];\n biceps += workout[i*3+1];\n back += workout[i*3+2];\n }\n\n if(n % 3 == 1)\n chest += workout[n - 1];\n else if(n%3 == 2)\n {\n chest += workout[n - 2];\n biceps += workout[n - 1];\n }\n\n if(chest > biceps && chest > back)\n Console.WriteLine(\"chest\");\n else if (biceps > chest && biceps > back)\n Console.WriteLine(\"biceps\");\n else if (back > chest && back > biceps)\n Console.WriteLine(\"back\");\n }\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Number = int.Parse(Console.ReadLine());\n string[] Exe = (Console.ReadLine()).Split(' ');\n int chest = 0, biceps = 0, back = 0;\n bool Chest = true, Biceps = false, Back = false;\n for (int i = 0; i < Number; i++)\n {\n if (Chest)\n {\n chest+=int.Parse(Exe[i]);\n Chest = false;\n Biceps = true;\n }\n else if (Biceps)\n {\n biceps+= int.Parse(Exe[i]);\n Biceps = false;\n Back = true;\n }\n else\n {\n back+= int.Parse(Exe[i]);\n Chest = true;\n Back = false;\n }\n\n\n }\n if (chest > biceps && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n else if (biceps > chest && biceps > back)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n \n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Threading.Tasks;\n\nnamespace fun\n{\n class Program\n {\n private static TextReader cin = Console.In;\n private static TextWriter cout = Console.Out;\n static void Main(string[] args)\n {\n string s = cin.ReadLine() ;\n int n = int.Parse(s.Split(' ')[0]);\n var t = Array.ConvertAll(cin.ReadLine().Split(' '), int.Parse);\n int a = 0, b = 0, c = 0 ;\n\n for (int i = 0; i < n; i++)\n {\n if (i % 3 == 0) a += t[i];\n if (i % 3 == 1) b += t[i];\n if (i % 3 == 2) c += t[i];\n }\n int m =Math.Max(a, Math.Max(b, c));\n cout.Write((m == a) ? \"chest\" : ((m == b) ? \"biceps\" : \"back\"));\n //cin.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int days;\n int[] exercises;\n int[] type = new int[3];\n string[] body = { \"chest\", \"biceps\", \"back\" };\n\n days = Convert.ToInt32(Console.ReadLine());\n\n exercises = (Console.ReadLine().Split(' ')).Select(n => Convert.ToInt32(n)).ToArray();\n int j = 0;\n\n for (int i = 0; i < days; ++i)\n {\n type[j] += exercises[i];\n if (j == 2)\n j = 0;\n else\n ++j;\n }\n int Max = type.ToList().IndexOf(type.Max());\n\n Console.WriteLine(body[Max]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var m = new int[3];\n for (int i = 0; i < n; i++)\n {\n m[i % 3] += a[i];\n }\n Console.WriteLine(\"{0}\", new string[] { \"chest\", \"biceps\", \"back\" }[Array.IndexOf(m, m.Max())]);\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\n\nnamespace SolvingAlgorithms\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string input;\n input = Console.ReadLine();\n int n = Convert.ToInt32(input);\n input = Console.ReadLine();\n List split = new List(input.Split(' '));\n string current = \"chest\";\n int countChest = 0;\n int countBi = 0;\n int countBack = 0;\n \n while(split.Count>0)\n {\n int temp = Convert.ToInt32(split[0]);\n \n switch (current)\n {\n case \"chest\": current = \"biceps\"; countChest += temp; break;\n case \"biceps\": current = \"back\"; countBi += temp; break;\n case \"back\": current = \"chest\"; countBack += temp; break;\n }\n split.RemoveAt(0);\n }\n\n if (countChest > countBi && countChest > countBack)\n {\n Console.WriteLine(\"chest\");\n }\n else if (countBi > countChest && countBi > countBack)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] r = Console.ReadLine().Split(' ');\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 0; i < n; i++)\n {\n int a = int.Parse(r[i]);\n if (i % 3 == 0) chest += a;\n else if (i % 3 == 1) biceps += a;\n else back += a;\n }\n int max = Math.Max(chest, Math.Max(biceps, back));\n if (max == chest) Console.WriteLine(\"chest\");\n else if (max == biceps) Console.WriteLine(\"biceps\");\n else Console.WriteLine(\"back\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace AllProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n _255A_GregsWorkout.Run();\n\n }\n }\n class _255A_GregsWorkout\n {\n public static void Run()\n {\n var n = byte.Parse(Console.ReadLine().Trim());\n var l = Console.ReadLine().Trim().Split(' ');\n\n var len = n > 3 ? 3 : n;\n var arr = new short[len];\n var ind = new short[len];\n\n for (byte i = 0; i < len; i++)\n ind[i] = i;\n\n for (byte i = 0; i < n; i++)\n arr[i%3] += byte.Parse(l[i]);\n\n Array.Sort(arr,ind);\n var m = new[] {\"chest\", \"biceps\", \"back\"};\n Console.WriteLine(m[ind[len - 1]]);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace Task\n{\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader inputStream;\n private readonly TextWriter outputStream = Console.Out;\n\n private string[] tokens;\n private int pointer;\n\n public MyIo()\n#if LOCAL_TEST\n : this(new StreamReader(\"input.txt\"))\n#else\n : this(System.Console.In)\n#endif\n {\n\n }\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n\n public char NextChar()\n {\n try\n {\n return (char)inputStream.Read();\n }\n catch (IOException)\n {\n return '\\0';\n }\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return Next();\n }\n\n public long NextLong()\n {\n return Next();\n }\n\n public T Next()\n {\n var t = typeof(T);\n\n if (t == typeof(char))\n return (T)(object)NextChar();\n\n object s = NextString();\n\n if (t == typeof(string))\n return (T)s;\n\n return (T)Convert.ChangeType(s, typeof(T));\n }\n\n\n public IEnumerable NextWhile(Predicate pred)\n {\n if (pred == null)\n yield break;\n\n T res = Next();\n\n while (pred(res))\n {\n yield return res;\n\n res = Next();\n }\n }\n\n public IEnumerable NextSeq(long n)\n {\n for (var i = 0; i < n; i++)\n yield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(bool o)\n {\n Print(o ? \"yes\" : \"no\");\n }\n\n public void PrintLine(bool o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));\n }\n\n\n public void PrintLine(T o)\n {\n Print(o);\n\n outputStream.WriteLine();\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n public static class ListExtensions\n {\n public static void Each(this IEnumerable self, Action action)\n {\n foreach (var v in self)\n action(v);\n }\n\n public static IEnumerable ToCycleEnumerable(this IEnumerable self)\n {\n if (self != null)\n {\n for (; ; )\n {\n foreach (var x in self)\n yield return x;\n }\n }\n }\n\n public static T CycleGet(this IList self, int index)\n {\n var c = self.Count;\n return self[(index % c + c) % c];\n }\n\n\n public static IList Shuffle(this IList self)\n {\n var rnd = new Random(DateTime.Now.Millisecond);\n\n var n = self.Count;\n\n while (n > 1)\n {\n n--;\n var k = rnd.Next(n + 1);\n var value = self[k];\n self[k] = self[n];\n self[n] = value;\n }\n\n return self;\n }\n\n public static IList> UseForNew2D(this T def, int fd, int sd)\n {\n var fdim = new T[fd][];\n\n for (int i = 0; i < fd; i++)\n {\n fdim[i] = new T[sd];\n Fill(fdim[i], def);\n }\n\n return fdim;\n }\n\n public static IList Fill(this IList self, Func fval)\n {\n for (var i = 0; i < self.Count; i++)\n self[i] = fval();\n\n\n return self;\n }\n\n\n public static IList Fill(this IList self, T val)\n {\n return self.Fill(() => val);\n }\n\n public static long Hash(this IList self, Func val = null)\n {\n return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);\n }\n\n public static long Hash(this IList self, Func val)\n {\n return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));\n }\n\n\n public static long HashOne(this T self, long current)\n {\n return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));\n }\n\n\n public static IList BuildSegTree(this IList a, Func combine, Func convert)\n {\n var t = new T1[a.Count << 2];\n\n a.BuildSegTree(t, 1, 0, a.Count - 1, combine, convert);\n\n return t;\n }\n\n private static void BuildSegTree(this IList a, IList t, int v, int tl, int tr, Func combine, Func convert)\n {\n if (tl == tr)\n {\n t[v] = convert(a[tl]);\n }\n else\n {\n int tm = (tl + tr) >> 1;\n\n BuildSegTree(a, t, v << 1, tl, tm, combine, convert);\n BuildSegTree(a, t, (v << 1) + 1, tm + 1, tr, combine, convert);\n\n t[v] = combine(t[v << 1], t[(v << 1) + 1]);\n }\n }\n }\n\n public static class P\n {\n public static P Create(T1 key, T2 val)\n {\n return new P(key, val);\n }\n }\n\n public class P\n {\n private class PComparer : IComparer>\n {\n private readonly bool? byKey;\n\n public PComparer(bool? byKey)\n {\n this.byKey = byKey;\n }\n\n\n public int Compare(P x, P y)\n {\n x = x ?? new P();\n y = y ?? new P();\n\n\n if (byKey == true)\n return Comparer.Default.Compare(x.Key, y.Key);\n else if (byKey == false)\n return Comparer.Default.Compare(x.Value, y.Value);\n else\n {\n var tr = Comparer.Default.Compare(x.Key, y.Key);\n\n if (tr != 0)\n tr = Comparer.Default.Compare(x.Value, y.Value);\n\n return tr;\n }\n }\n }\n\n\n public P()\n {\n }\n\n public P(T1 key, T2 val)\n {\n this.Key = key;\n this.Value = val;\n }\n\n\n public T1 Key\n {\n get;\n set;\n }\n\n public T2 Value\n {\n get;\n set;\n }\n\n public P Clone()\n {\n return new P(Key, Value);\n }\n\n public static IComparer> KeyComparer\n {\n get { return new PComparer(true); }\n }\n\n public static IComparer> ValueComparer\n {\n get { return new PComparer(false); }\n }\n\n public static implicit operator T1(P obj)\n {\n return obj.Key;\n }\n\n public static implicit operator T2(P obj)\n {\n return obj.Value;\n }\n\n public P SetKey(T1 key)\n {\n Key = key;\n return this;\n }\n\n public P SetValue(T2 value)\n {\n Value = value;\n return this;\n }\n\n public override string ToString()\n {\n return string.Format(\"Key: {0}, Value: {1}\", Key, Value);\n }\n\n public override bool Equals(object obj)\n {\n var co = obj as P;\n\n return co != null && co.GetHashCode() == GetHashCode();\n }\n\n public override int GetHashCode()\n {\n int hash = 17;\n hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());\n hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode());\n return hash;\n\n }\n }\n\n #endregion\n\n\n\n internal class Program\n {\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io)\n .Solve();\n }\n }\n\n\n\n #endregion\n public const long MOD = 1000000007;\n public const double EPS = 1e-14;\n\n \n \n \n private void Solve()\n {\n var n = io.NextInt();\n\n var keys = new[] {\"chest\", \"biceps\", \"back\"};\n var h = keys.ToDictionary(x => x, x => 0);\n\n for (int i = 0; i < n; i++)\n {\n h[keys[i%3]] += io.NextInt();\n }\n\n\n io.Print(h.OrderByDescending(x=>x.Value).FirstOrDefault().Key);\n\n }\n\n \n\n \n }\n\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program_R156_Div2_A\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = (Console.ReadLine().Split());\n int[] b = new int[Math.Max(n,3)];\n for (int i = 0; i < n; i++)\n b[i] = Convert.ToInt32(s[i]);\n\n for (int j = 3; j < n; j++)\n b[j % 3] += b[j];\n\n string ans = \"back\";\n if (b[0] > b[1] && b[0] > b[2])\n ans = \"chest\";\n else if (b[1] > b[0] && b[1] > b[2])\n ans = \"biceps\";\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n;\n string t;\n int biceps = 0;\n int chest = 0;\n int back = 0;\n\n t = Console.ReadLine();\n\n int.TryParse(t, out n);\n\n int[] a = new int[n];\n t = Console.ReadLine();\n\n string[] sa = t.Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n int.TryParse(sa[i], out a[i]);\n }\n\n int buf = 1;\n\n for (int i = 0; i < n; i++)\n {\n switch (buf)\n {\n case 1:\n chest += a[i];\n break;\n case 2:\n biceps += a[i];\n break;\n case 3:\n back += a[i];\n break;\n }\n buf++;\n if (buf == 4) buf = 1;\n }\n\n if (chest > biceps && chest > back) Console.WriteLine(\"chest\");\n if (biceps > chest && biceps > back) Console.WriteLine(\"biceps\");\n if (back > chest && back > biceps) Console.WriteLine(\"back\");\n }\n}"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n string result = \"\";\n int chestCount = 0;\n int bicepsCount = 0;\n int backCount = 0;\n for (int i = 0; i < n; i++)\n {\n int ex = i % 3;\n if (ex == 0)\n chestCount += arr[i];\n else if (ex == 1)\n bicepsCount += arr[i];\n else if (ex == 2)\n backCount += arr[i];\n }\n if (chestCount > bicepsCount && chestCount > backCount)\n Console.WriteLine(\"chest\");\n else if (bicepsCount > chestCount && bicepsCount > backCount)\n Console.WriteLine(\"biceps\");\n else if (backCount > chestCount && backCount > bicepsCount)\n Console.WriteLine(\"back\");\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace vlad.a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string[] ss = s.Split(' ');\n int chest, biceps, back;\n chest = biceps = back = 0;\n for(int i = 0; i < n; i++)\n {\n switch(i % 3)\n {\n case 0:\n chest += Convert.ToInt32(ss[i]);\n break;\n case 1:\n biceps += Convert.ToInt32(ss[i]);\n break;\n case 2:\n back += Convert.ToInt32(ss[i]);\n break;\n }\n }\n Console.WriteLine((chest > biceps) ? ((chest > back) ? \"chest\" : \"back\") : ((biceps > back) ? \"biceps\" : \"back\"));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n //Console.SetIn(new StreamReader(\"gcd.in\"));\n // Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n //Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int[] a = GetInts();\n int sumChest = 0;\n int sumBiceps = 0;\n int sumBack = 0;\n string answer = \"back\";\n for (int i = 0; i < n; i += 3)\n {\n sumChest = sumChest + a[i];\n }\n for (int i = 1; i < n; i += 3)\n {\n sumBiceps = sumBiceps + a[i];\n }\n for (int i = 2; i < n; i += 3)\n {\n sumBack = sumBack + a[i];\n }\n if (sumChest > sumBiceps && sumChest > sumBack)\n answer = \"chest\";\n else if (sumBiceps > sumChest && sumBiceps > sumBack)\n answer = \"biceps\";\n\n Console.WriteLine(answer);\n }\n \n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace pr111\n{\n class Program\n {\n public static void Main(string[] args)\n { int a,b,c,n;string s; \n n=Convert.ToInt16(Console.ReadLine());\n int[] arr;\n arr= new int[24];\n a = 0; b =0; c =0;\n string[] line=Console.ReadLine().Split();\n for (int i=0; i=b&&a>=c) {s=\"chest\";} else {if(b>c){s=\"biceps\";} else {s=\"back\";}}\n Console.WriteLine(Convert.ToString(s));\n // Console.ReadKey(true);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = new int[3]; \n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n y[0]+=l[i];\n continue;\n }\n else if ((i+1)%3==2)\n {\n y[1]+=l[i];\n continue;\n }\n else\n {\n y[2]+=l[i];\n }\n }\n if (y.Max() == y[0])\n {\n Console.WriteLine(\"chest\");\n }\n else if (y.Max() ==y[1])\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var number = Int32.Parse(Console.ReadLine());\n var exercises = Console.ReadLine();\n var dataStr = exercises.Split(' ');\n List data = dataStr.Select(int.Parse).ToList();\n Console.WriteLine(MostTrainedMuscle(number, data));\n }\n private static string MostTrainedMuscle(int number, List data)\n {\n int chestExerciseCount = 0, bicepsExerciseCount = 0, backExcersiceCount = 0;\n\n for (var i = 0; i < number;)\n {\n int windows = number / 3;\n int remaining = number % 3;\n while (windows-- > 0)\n {\n int chest = data[i];\n int biceps = data[i + 1];\n int back = data[i + 2];\n\n chestExerciseCount += chest;\n bicepsExerciseCount += biceps;\n backExcersiceCount += back;\n\n i += 3;\n }\n\n if (remaining != 0)\n {\n i -= 1;\n if (remaining == 1)\n {\n chestExerciseCount += data[i + 1];\n break;\n }\n\n if (remaining == 2)\n {\n chestExerciseCount += data[i + 1];\n bicepsExerciseCount += data[i + 2];\n break;\n }\n }\n }\n var result = Maxof3Numbers(chestExerciseCount, bicepsExerciseCount, backExcersiceCount);\n return result;\n }\n\n private static string Maxof3Numbers(int chestExerciseCount, int bicepsExerciseCount, int backExcersiceCount)\n {\n if (chestExerciseCount > bicepsExerciseCount && chestExerciseCount > backExcersiceCount)\n return \"chest\";\n if (bicepsExerciseCount > chestExerciseCount && bicepsExerciseCount > backExcersiceCount)\n return \"biceps\";\n if (backExcersiceCount > chestExerciseCount && backExcersiceCount > bicepsExerciseCount)\n return \"back\";\n return string.Empty;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n public static void Main(string[] args)\n {\n var number = Int32.Parse(Console.ReadLine());\n var exercises = Console.ReadLine();\n var dataStr = exercises.Split(' ');\n List data = dataStr.Select(int.Parse).ToList();\n Console.WriteLine(MostTrainedMuscle(number, data));\n }\n\n private static string MostTrainedMuscle(int number, List data)\n {\n int chestExerciseCount = 0, bicepsExerciseCount = 0, backExcersiceCount = 0;\n\n for (var i = 0; i < number;)\n {\n int windows = number / 3;\n int remaining = number % 3;\n while (windows-- > 0)\n {\n int chest = data[i];\n int biceps = data[i + 1];\n int back = data[i + 2];\n\n chestExerciseCount += chest;\n bicepsExerciseCount += biceps;\n backExcersiceCount += back;\n\n i += 3;\n }\n\n if (remaining != 0)\n { \n if (remaining == 1)\n {\n chestExerciseCount += data[i];\n break;\n }\n\n if (remaining == 2)\n {\n chestExerciseCount += data[i];\n bicepsExerciseCount += data[i + 1];\n break;\n }\n }\n }\n var result = Maxof3Numbers(chestExerciseCount, bicepsExerciseCount, backExcersiceCount);\n return result;\n }\n\n private static string Maxof3Numbers(int chestExerciseCount, int bicepsExerciseCount, int backExcersiceCount)\n {\n if (chestExerciseCount > bicepsExerciseCount && chestExerciseCount > backExcersiceCount)\n return \"chest\";\n if (bicepsExerciseCount > chestExerciseCount && bicepsExerciseCount > backExcersiceCount)\n return \"biceps\";\n if (backExcersiceCount > chestExerciseCount && backExcersiceCount > bicepsExerciseCount)\n return \"back\";\n return string.Empty;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF._255A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int chest = 0, biceps = 0, back = 0;\n string[] a = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n if (i % 3 == 0)\n chest += int.Parse(a[i]);\n else if (i % 3 == 1)\n biceps += int.Parse(a[i]);\n else\n back += int.Parse(a[i]);\n if (chest >= biceps && chest >= back)\n Console.WriteLine(\"chest\");\n else if (biceps >= chest && biceps >= back)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\nusing System.Xml;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = getInt();\n\t\t\tvar l = getList();\n\t\t\tvar l1 = new List();\n\t\t\tl1.Add(0);\n\t\t\tl1.Add(0);\n\t\t\tl1.Add(0);\n\t\t\tfor (var i = 0; i < n; ++i)\n\t\t\t\tl1[i % 3] += l[i];\n\t\t\tvar max = l1.Max();\n\t\t\tif (l1[0] == max)\n\t\t\t\tConsole.WriteLine(\"chest\");\n\t\t\tif (l1[1] == max)\n\t\t\t\tConsole.WriteLine(\"biceps\");\n\t\t\tif (l1[2] == max)\n\t\t\t\tConsole.WriteLine(\"back\");\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApplication16\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n\n int spin = 0;\n int bicz = 0;\n int grud = 0;\n\n string fd = Console.ReadLine();\n\n int[] arrayiNT = new int[n];\n\n for (int i = 1; i < n + 1; i++)\n {\n arrayiNT[i - 1] = Int32.Parse(fd.Split(' ')[i - 1]);\n if (i%3 == 0)\n {\n spin += arrayiNT[i - 1];\n }\n if (i%3 == 1)\n {\n grud += arrayiNT[i - 1];\n }\n if (i%3 == 2)\n {\n bicz += arrayiNT[i - 1];\n }\n }\n\n Dictionary slovar = new Dictionary()\n {\n {\"back\", spin},\n {\"biceps\", bicz},\n {\"chest\", grud}\n };\n List upra = new List();\n\n upra.Add(spin);\n upra.Add(grud);\n upra.Add(bicz);\n string dfgs = slovar.FirstOrDefault(el => el.Value == upra.Max()).Key;\n Console.WriteLine(dfgs);\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace D2Problem1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chest=0;\n int biceps = 0;\n int back = 0;\n int n = int.Parse(Console.ReadLine());\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n for (int i = 0; i < n; i += 3)\n chest += input[i];\n for (int i = 1; i < n; i += 3)\n biceps += input[i];\n for (int i = 2; i < n; i += 3)\n back += input[i];\n if(chest>biceps&&chest>back)\n Console.WriteLine(\"chest\");\n else if(biceps>chest&&biceps>back)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace _255A\n{\n class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var array = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var counter = 0;\n int chest = 0, biceps = 0, back = 0;\n for (int i = 0; i < n; i++)\n {\n switch (counter) \n {\n case 0:\n chest += array[i];\n break;\n case 1:\n biceps += array[i];\n break;\n case 2:\n back += array[i]; \n break; \n }\n counter++;\n if (counter > 2) counter = 0;\n }\n\n if (chest > biceps && chest > back) Console.WriteLine(\"chest\");\n else if (biceps > chest && biceps > back) Console.WriteLine(\"biceps\");\n else Console.WriteLine(\"back\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\n\nnamespace MakeCalendar\n{\n class MainClass\n {\n\n static int ReadIntLine()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static void ReadInt(ref int a)\n {\n a = ReadIntArrayLine()[0];\n }\n\n static void ReadInts(ref int a, ref int b)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1];\n }\n\n\n\n static void ReadInts(ref int a, ref int b, ref int c)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2];\n }\n\n static void ReadInts(ref int a, ref int b, ref int c, ref int d)\n {\n var x = ReadIntArrayLine();\n a = x[0]; b = x[1]; c = x[2]; d = x[3];\n }\n\n\n static int[] ReadIntArrayLine()\n {\n char[] sep = { ' ' };\n return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();\n }\n\n static void PrintLn(object obj)\n {\n Console.WriteLine(obj.ToString());\n }\n\n public static string Reverse(string s)\n {\n char[] charArray = s.ToCharArray();\n Array.Reverse(charArray);\n return new string(charArray);\n }\n\n\n public static void PrintLnCollection(IEnumerable col)\n {\n PrintLn(string.Join(\" \",col));\n }\n\n//----------------------------------------------------------------------------\n\n\n\n static void Main(string[] args)\n {\n int n = 0, c = 0;\n\n n = ReadIntLine() ;\n\n int[] a = ReadIntArrayLine();\n\n int chest = a.Where((x, xi) => xi % 3 == 0).Sum();\n int biceps = a.Where((y, yi) => yi % 3 == 1).Sum();\n int back = a.Where((z, zi) => zi % 3 == 2).Sum();\n\n if (chest == Math.Max(chest, Math.Max(biceps, back)))\n PrintLn(\"chest\");\n if (biceps == Math.Max(chest, Math.Max(biceps, back)))\n PrintLn(\"biceps\");\n if (back == Math.Max(chest, Math.Max(biceps, back)))\n PrintLn(\"back\");\n\n }\n\n \n\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication32\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] a = new int[n];\n string str = Console.ReadLine();\n string[] subString = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int b = 0;\n int c = 0;\n int d = 0;\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(subString[i]);\n }\n for (int i = 0; i < n; i = i + 3)\n {\n b = b + a[i];\n }\n for (int i = 1; i < n; i = i + 3)\n {\n c = c + a[i];\n }\n for(int i = 2; i < n; i = i + 3)\n {\n d = d + a[i];\n }\n if (b > c && b > d)\n {\n Console.WriteLine(\"chest\");\n }\n else if (c > d)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\n\nnamespace Codeforce {\n class Program {\n\n public class Muscle {\n public int Training = 0;\n public string Name = \"\";\n\n public override string ToString() {\n return Name;\n }\n\n\n public Muscle CompareTo(Muscle obj) {\n return this.Training > obj.Training ? this : (this.Training == obj.Training) ? this : obj;\n }\n }\n\n static void Main() {\n var n = Convert.ToInt32(Console.ReadLine());\n var tmpArr = Console.ReadLine().Split(' ');\n var list = new List();\n for (int i = 0; i < n; i++) {\n list.Add(int.Parse(tmpArr[i]));\n }\n \n var chest = new Muscle() {\n Name = \"chest\"\n };\n var biceps = new Muscle() {\n Name = \"biceps\"\n };\n var back = new Muscle() {\n Name = \"back\"\n };\n \n for (int i = 0; i < n; i += 3) {\n chest.Training += list[i];\n }\n\n for (int i = 1; i < n; i += 3) {\n biceps.Training += list[i];\n }\n\n for (int i = 2; i < n; i += 3) {\n back.Training += list[i];\n }\n\n Console.WriteLine(chest.CompareTo(biceps.CompareTo(back)));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _255A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chest = 0, biceps = 0, back = 0;\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n for(int i = 0;i back ? \"biceps\" : \"back\");\n else\n Console.WriteLine(chest > back ? \"chest\" : \"back\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFR156\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] ans = new int[3];\n int[] a = new int[n];\n string[] input = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(input[i]);\n for (int i = 0,j=0; i < n; i++)\n {\n ans[j] += a[i];\n if (j == 2) j = -1;\n j++;\n }\n if (ans[0] > ans[1]&&ans[0]>ans[2])\n Console.WriteLine(\"chest\");\n if (ans[1] > ans[0] && ans[1] > ans[2])\n Console.WriteLine(\"biceps\");\n if (ans[2] > ans[0] && ans[2] > ans[1])\n Console.WriteLine(\"back\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ProjectContest\n{\n class Test\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] ex = new int[3];\n var a = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);\n for(int i=0;itr[1]&&tr[0]>tr[2]){\n Console.WriteLine(\"chest\");\n }else{\n if(tr[1]>tr[0]&&tr[1]>tr[2]){\n Console.WriteLine(\"biceps\");\n }else{\n Console.WriteLine(\"back\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int[] args = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int biceps = 0, chest = 0, back = 0;\n for (int i = 0; i < args.Length; i++)\n {\n if (i % 3 == 0)\n chest += args[i];\n if ((i - 1) % 3 == 0)\n biceps += args[i];\n if ((i - 2) % 3 == 0)\n back += args[i];\n }\n if (chest > biceps && chest > back)\n Console.WriteLine(nameof(chest));\n if (biceps > chest && biceps > back)\n Console.WriteLine(nameof(biceps));\n if (back > chest && back > biceps)\n Console.WriteLine(nameof(back));\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace forcesGym\n{\n class Program\n {\n static void Main(string[] args)\n {\n String xaxa = Console.ReadLine();\n int n = int.Parse(xaxa);\n\n int[] arr = new int[3];\n Array.Clear(arr,0,3);\n\n String babu = Console.ReadLine();\n String[] hadd=babu.Split(' ');\n for (int i = 0; i < n; i++)\n {\n int iRon = i % 3;\n \n int val = int.Parse(hadd[i]);\n\n arr[iRon] += val;\n\n\n }\n\n\n String res;\n\n if (arr[0] > arr[1] && arr[0] > arr[2])\n res = \"chest\";\n else if (arr[1] > arr[0] && arr[1] > arr[2])\n res = \"biceps\";\n else\n res = \"back\";\n\n Console.WriteLine(res);\n\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace GregsWorkout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n string [] input = Console.ReadLine().Split(new char[]{' '}, StringSplitOptions.None);\n\n int [] train = new int[3];\n for (int i=0; i max){\n max = train[i];\n maxIndex = i;\n }\n }\n\n switch(maxIndex){\n case 0:\n Console.WriteLine(\"chest\");\n break;\n case 1:\n Console.WriteLine(\"biceps\");\n break;\n case 2:\n Console.WriteLine(\"back\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\tstring input2 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();\n\t\t\tvar inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);\n\n\t\t\tvar n = int.Parse(input1);\n\t\t\tvar chest = inputs2.Where((item, index) => index % 3 == 0).Sum();\n\t\t\tvar biceps = inputs2.Where((item, index) => index % 3 == 1).Sum();\n\t\t\tvar back = inputs2.Where((item, index) => index % 3 == 2).Sum();\n\n\t\t\tvar maxBicepsBack = Math.Max(biceps, back);\n\t\t\tif (chest > maxBicepsBack) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"chest\");\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tvar result = maxBicepsBack == biceps ? \"biceps\" : \"back\";\n\t\t\t\tConsole.WriteLine(result);\n\t\t\t}\n\t\t}\n\n\t\t//private static long GCD(long a, long b)\n\t\t//{\n\t\t//\tlong max = Math.Max(a, b);\n\t\t//\tlong min = Math.Min(a, b);\n\n\t\t//\tif (min == 0)\n\t\t//\t{\n\t\t//\t\treturn max;\n\t\t//\t}\n\n\t\t//\ta = min;\n\t\t//\tb = max % min;\n\t\t//\treturn GCD(a, b);\n\t\t//}\n\n\t\t//private static long LCM(long a, long b)\n\t\t//{\n\t\t//\treturn Math.Abs(a * b) / GCD(a, b);\n\t\t//}\n\n\t\t//private static int Length(short[] a)\n\t\t//{\n\t\t//\tint firstItemIndex = 0;\n\t\t//\tfor (int i = 0; i < a.Length; i++)\n\t\t//\t{\n\t\t//\t\tif (a[i] == 0)\n\t\t//\t\t{\n\t\t//\t\t\tcontinue;\n\t\t//\t\t}\n\n\t\t//\t\tfirstItemIndex = i;\n\t\t//\t\tbreak;\n\t\t//\t}\n\n\t\t//\treturn a.Length - firstItemIndex;\n\t\t//}\n\n\t\t//private static short[] Subtract(short[] a, short[] b)\n\t\t//{\n\t\t//\tif (a.Length != b.Length)\n\t\t//\t{\n\t\t//\t\tthrow new ArgumentException();\n\t\t//\t}\n\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tArray.Copy(a, result, a.Length);\n\t\t//\tfor (int i = result.Length - 1; i >= 0; i--)\n\t\t//\t{\n\t\t//\t\tif (result[i] < b[i])\n\t\t//\t\t{\n\t\t//\t\t\tint j = i - 1;\n\t\t//\t\t\twhile (result[j] == 0)\n\t\t//\t\t\t{\n\t\t//\t\t\t\tresult[j--] = 9;\n\t\t//\t\t\t}\n\n\t\t//\t\t\tresult[j]--;\n\t\t//\t\t\tresult[i] += 10;\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] -= b[i];\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static short[] Multiply(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tfor (int i = a.Length - 1; i > 0; i--)\n\t\t//\t{\n\t\t//\t\tint temp = a[i] * b;\n\t\t//\t\tresult[i] = (short)(result[i] + temp % 10);\n\t\t//\t\tresult[i - 1] = (short)(result[i - 1] + temp / 10);\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\n\t\t//private static int Mod(short[] a, int b)\n\t\t//{\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn rest;\n\t\t//}\n\n\t\t//private static short[] Divide(short[] a, int b)\n\t\t//{\n\t\t//\tshort[] result = new short[a.Length];\n\t\t//\tint rest = 0, i = 0;\n\t\t//\twhile (i < a.Length)\n\t\t//\t{\n\t\t//\t\tint d = 10 * rest + a[i];\n\t\t//\t\twhile (d < b && i < a.Length - 1)\n\t\t//\t\t{\n\t\t//\t\t\td = 10 * d + a[++i];\n\t\t//\t\t}\n\n\t\t//\t\tresult[i] = (short)(d / b);\n\t\t//\t\trest = d % b;\n\t\t//\t\ti++;\n\t\t//\t}\n\n\t\t//\treturn result;\n\t\t//}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace CF {\n\n class Program {\n\n static void Main(string[] args) {\n\n#if DEBUG\n TextReader reader = new StreamReader(\"../../input.txt\");\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\n reader.ReadLine();\n var innn = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n long[] trains = { 0, 0, 0 };\n\n for (int i = 0; i < innn.Length; i++) {\n trains[i % 3] += innn[i];\n }\n\n var m = trains.Max();\n if (trains[0] == m) {\n Console.WriteLine(\"chest\");\n }\n if (trains[1] == m) {\n Console.WriteLine(\"biceps\");\n }\n if (trains[2] == m) {\n Console.WriteLine(\"back\");\n }\n\n#if DEBUG\n Console.ReadKey();\n#endif\n\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace prob6_Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n var exerciseasNumber = Convert.ToInt32(Console.ReadLine());\n var exercises = Console.ReadLine();\n var exercisesSplit = exercises.Split(' ');\n int chest = 0;\n int biceps = 0;\n int back = 0;\n int newNumber = 0;\n \n\n for (var Number = 0; Number < exerciseasNumber; Number++)\n {\n if ((Number+1)%3 == 1)\n {\n newNumber = Convert.ToInt32(exercisesSplit[Number]);\n chest = chest + newNumber;\n }\n else if ((Number+1)%3 == 2)\n {\n newNumber = Convert.ToInt32(exercisesSplit[Number]);\n biceps = biceps + newNumber;\n }\n else if ((Number+1)%3 == 0)\n {\n newNumber = Convert.ToInt32(exercisesSplit[Number]);\n back = back + newNumber;\n }\n }\n\n if(chest > biceps && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n if( biceps > chest && biceps > back)\n {\n Console.WriteLine(\"biceps\");\n }\n if(back > chest && back > biceps)\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n }\n\n\n"}, {"source_code": "/*\n\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Diagnostics;\n\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int[] A = ReadIntArray();\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 0; i < n; i++) {\n if (i % 3 == 0)\n chest += A[i];\n else if (i % 3 == 1)\n biceps += A[i];\n else \n back += A[i];\n }\n if (chest > Math.Max(biceps, back))\n Write(\"chest\");\n else if (biceps > Math.Max(chest, back))\n Write(\"biceps\");\n else \n Write(\"back\");\n\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n Debug.Listeners.Clear();\n Debug.Listeners.Add(new ConsoleTraceListener());\n Trace.Listeners.Clear();\n Trace.Listeners.Add(new ConsoleTraceListener());\n\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n new Solver().Solve();\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n \n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n\n"}, {"source_code": "using System;\nclass CFR156D2A\n{\n\tstatic void Main()\n\t{\n\t\tint chestCount = 0;\n\t\tint bicepsCount = 0;\n\t\tint backCount = 0;\n\t\tint n = int.Parse(Console.ReadLine());\n\t\tstring[] data = Console.ReadLine().Split(' ');\n\t\tint checkIndex = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tif (checkIndex == 0)\n\t\t\t{\n\t\t\t\tchestCount += int.Parse(data[i]);\n\t\t\t\tcheckIndex++;\n\t\t\t}\n\t\t\telse if (checkIndex == 1)\n\t\t\t{\n\t\t\t\tbicepsCount += int.Parse(data[i]);\n\t\t\t\tcheckIndex++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbackCount += int.Parse(data[i]);\n\t\t\t\tcheckIndex = 0;\n\t\t\t}\n\t\t}\n\t\tif ((chestCount > bicepsCount) && (chestCount > backCount))\n\t\t{\n\t\t\tConsole.WriteLine(\"chest\");\n\t\t}\n\t\telse if ((bicepsCount > chestCount) && (bicepsCount > backCount))\n\t\t{\n\t\t\tConsole.WriteLine(\"biceps\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tConsole.WriteLine(\"back\");\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\nclass ans:IComparable\n{\n public int a;\n public string name;\n public ans(int a, string s)\n {\n this.a = a;\n name = s;\n }\n public int CompareTo(ans a)\n {\n return this.a.CompareTo(a.a);\n }\n\n}\nclass PairVariable:IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication252\n{\n\n class Program\n {\n\n static bool P(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n string[] ss = Console.ReadLine().Split();\n int[] m = new int[n + 1];\n for (int i = 1; i < n + 1; i++)\n {\n m[i] = int.Parse(ss[i-1]);\n }\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 1; i < m.Length; i++)\n {\n if (i % 3 == 0)\n {\n back += m[i];\n }\n else if (i % 3 == 1)\n {\n chest += m[i];\n }\n else\n {\n biceps += m[i];\n }\n\n }\n ans[] an = new ans[3];\n an[0] = new ans(chest, \"chest\");\n an[1] = new ans(biceps, \"biceps\");\n an[2] = new ans(back, \"back\");\n Array.Sort(an);\n Console.WriteLine(an[2].name);\n\n }\n }\n}"}, {"source_code": "using System;\nclass Solution\n{\n public static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] inputs = Console.ReadLine().Split(' ');\n int[] array = Array.ConvertAll(inputs, Int32.Parse);\n int k = 0, chest = 0, biseps = 0, back = 0;\n for (int i = 0; i < n; i++)\n {\n k++;\n if (k == 1) chest = chest + array[i];\n if (k == 2) biseps = biseps + array[i];\n if (k == 3) { back = back + array[i]; k = 0; }\n }\n if (chest > biseps && chest > back) Console.WriteLine(\"chest\");\n if (biseps > chest && biseps > back) Console.WriteLine(\"biceps\");\n if (back > chest && back > biseps) Console.WriteLine(\"back\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_GregWorkout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Dictionary dict = new Dictionary();\n dict.Add(\"chest\", 0);\n dict.Add(\"biceps\", 0);\n dict.Add(\"back\", 0);\n for(int i=0;i d.Value == max).Key);\n }\n }\n}\n"}, {"source_code": "using System;\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n int[] counters = new int[3];\n for(int i=1; i bicepc && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n else if (bicepc > chest && bicepc > back)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass A255 {\n static string[] Name = {\"chest\", \"biceps\", \"back\"};\n \n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n var b = new int[3];\n int k = 0;\n for (int i = 0; i < n; ++i) {\n b[k] += a[i];\n k = k == 2 ? 0 : k + 1;\n }\n Console.WriteLine(Name[Array.IndexOf(b, b.Max())]);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace AcmSolution\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n Console.ReadLine();\n var s = Console.ReadLine().Split(' ');\n\n var a = new int[3];\n for (int i = 0; i < s.Length; ++i)\n a[i % 3] += int.Parse(s[i]);\n\n var max = a.Max();\n\n Console.WriteLine(a[0] == max ? \"chest\" : a[1] == max ? \"biceps\" : \"back\");\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main() {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(new char[1] { ' ' }).Select(b => int.Parse(b)).ToArray();\n int c = 0, bi = 0, ba = 0;\n n = n - ( n % 3 );\n for (int i = 0; i < n; i += 3)\n {\n c += a[i];\n bi += a[i + 1];\n ba += a[i + 2];\n }\n if (a.Length - n > 0)\n c += a[n];\n if (a.Length - n > 1)\n bi += a[n + 1];\n if (a.Length - n > 2)\n c += a[n + 2];\n\n if (c > bi && c > ba)\n Console.WriteLine(\"chest\");\n else if (bi > c && bi > ba)\n Console.WriteLine(\"biceps\");\n else if (ba > c && ba > bi)\n Console.WriteLine(\"back\");\n#if DEBUG\n Console.ReadLine();\n#endif\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n int n = int.Parse(Console.ReadLine());\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int na = 0, nb = 0, nc = 0;\n for (int i = 0; i < n; i++) {\n if (i % 3 == 0)\n na += a[i];\n else if (i % 3 == 1)\n nb += a[i];\n else\n nc += a[i];\n }\n if (na > nb && na > nc)\n Console.WriteLine(\"chest\");\n else if (nb > na && nb > nc)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] c = Console.ReadLine().Split(' ');\n int iter = 0;\n int[] mass;\n mass = new int[3];\n for (int i = 0; i < n; i++)\n {\n int k = int.Parse(c[i]);\n mass[i % 3]+=k;\n }\n if (mass[0] > mass[1] && mass[0] > mass[2])\n Console.Write(\"chest\");\n if (mass[1] > mass[0] && mass[1] > mass[2])\n Console.Write(\"biceps\");\n if (mass[2] > mass[1] && mass[2] > mass[0])\n Console.Write(\"back\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] s = Console.ReadLine().Split();\n int[] arr = new int[n];\n for(int i=0 ;ibicepssum&&bicepssum>backsum)\n {\n Console.WriteLine(\"chest\");\n }\n else if(chestsum>backsum&&backsum>bicepssum)\n {\n Console.WriteLine(\"chest\");\n }\n else if (chestsum > backsum && backsum == bicepssum)\n {\n Console.WriteLine(\"chest\");\n }\n else if (bicepssum > backsum && backsum > chestsum)\n {\n Console.WriteLine(\"biceps\");\n }\n else if (bicepssum > chestsum && chestsum > backsum)\n {\n Console.WriteLine(\"biceps\");\n }\n else if (bicepssum > chestsum && chestsum == backsum)\n {\n Console.WriteLine(\"biceps\");\n }\n else if (backsum > chestsum && chestsum > bicepssum)\n {\n Console.WriteLine(\"back\");\n }\n else if (backsum > bicepssum && bicepssum > chestsum)\n {\n Console.WriteLine(\"back\");\n }\n else if (backsum > bicepssum && bicepssum == chestsum)\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Util.getNum();\n int[] array = Util.getArray();\n\n int a =0;\n int b =0;\n int c = 0;\n for (int i = 0; i < array.Length;i++ )\n {\n if(i%3==0){\n a += array[i];\n }\n\n if (i % 3 == 1)\n {\n b += array[i];\n }\n\n if (i % 3 == 2)\n {\n c += array[i];\n }\n }\n\n if(a>b && a>c){\n Console.WriteLine(\"chest\");\n }\n\n if (b > a && b > c)\n {\n Console.WriteLine(\"biceps\");\n }\n\n if (c > a && c > b)\n {\n Console.WriteLine(\"back\");\n }\n }\n\n public static int exper(decimal p1, decimal p2){\n int res = 0;\n while(res == 0){\n\n Random random = new Random();\n if ((decimal)random.NextDouble() > p1)\n {\n res = 1;\n }\n\n if ((decimal)random.NextDouble() > p2)\n {\n res = -1;\n }\n }\n\n return res;\n }\n }\n\n\n\n class Util\n {\n public static int getNum()\n {\n return int.Parse(Console.ReadLine());\n }\n\n public static int[] getArray()\n {\n string[] str = Console.ReadLine().Split(' ');\n int[] array = new int[str.Length];\n\n for (int i = 0; i < array.Length; i++)\n {\n try\n {\n array[i] = int.Parse(str[i]);\n }\n catch (Exception e)\n {\n //Console.WriteLine(str[i]+\"/\");\n }\n }\n\n return array;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static char[] SPACE = new[] { ' ' };\n\n static void Main(string[] args)\n {\n#if DEBUG\n using (var input = new StreamReader(\"input.txt\"))\n using (var output = new StreamWriter(\"output.txt\"))\n {\n Console.SetIn(input);\n Console.SetOut(output);\n\n int n = 0;\n do\n {\n Console.WriteLine();\n Console.WriteLine(\"Sample {0}\", ++n);\n Prog();\n } while (Console.ReadLine() == string.Empty);\n }\n#else\n Prog();\n#endif\n }\n\n static int __ptr = 0;\n static string[] __input;\n static int NextInt()\n {\n return int.Parse(__input[__ptr++]);\n }\n static long NextLong()\n {\n return long.Parse(__input[__ptr++]);\n }\n static void ReadTokens(int n)\n {\n __ptr = 0;\n __input = Console.ReadLine().Split(SPACE, n);\n }\n\n //\n\n static void Prog()\n {\n ReadTokens(1);\n int n = NextInt();\n\n int[] r = new int[3];\n\n ReadTokens(n);\n for (int i = 0; i < n; i++)\n r[i % 3] += NextInt();\n\n int max = Math.Max(Math.Max(r[0], r[1]), r[2]);\n if (max == r[0]) Console.WriteLine(\"chest\");\n else if (max == r[1]) Console.WriteLine(\"biceps\");\n else if (max == r[2]) Console.WriteLine(\"back\");\n }\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n string[] w = {\"chest\", \"biceps\", \"back\"};\n int n = Next();\n int[] q = new int[3];\n int p = 0;\n int maxi = 0;\n for(int i = 0; i < n; i++) {\n int a = Next();\n q[p] += a;\n if(q[p] > q[maxi])\n maxi = p;\n ++p;\n p %= 3;\n }\n writer.WriteLine(w[maxi]);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static int i(string s)\n {\n return Convert.ToInt32(s);\n }\n static void Main(string[] args)\n {\n int n = i(Console.ReadLine());\n int[] counts = new int[3];\n string[] s = Console.ReadLine().Split(' ');\n int j = 0;\n foreach (string s1 in s)\n {\n int temp = i(s1);\n counts[(j % 3)] += temp;\n j++;\n }\n int argmax = 0;\n int max = -1;\n for (int k = 0; k < 3; k++)\n {\n if (max < counts[k])\n {\n max = counts[k];\n argmax = k;\n }\n }\n if(argmax == 0)\n Console.WriteLine(\"chest\");\n else if(argmax == 1)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t//var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t//using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t//Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar n = sr.NextInt32();\n\t\t\tvar array = sr.ReadArray(Int32.Parse);\n\t\t\tvar firstCount = 0;\n\t\t\tvar secondcount = 0;\n\t\t\tvar thirdCount = 0;\n\t\t\tfor (var i = 0; i < n; i++) {\n\t\t\t\tif (i % 3 == 0) {\n\t\t\t\t\tfirstCount += array[i];\n\t\t\t\t}\n\t\t\t\tif (i % 3 == 1) {\n\t\t\t\t\tsecondcount += array[i];\n\t\t\t\t}\n\t\t\t\tif (i % 3 == 2) {\n\t\t\t\t\tthirdCount += array[i];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar max = Math.Max(firstCount, Math.Max(secondcount, thirdCount));\n\t\t\tif (max == firstCount) {\n\t\t\t\tsw.WriteLine(\"chest\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (max == secondcount) {\n\t\t\t\t\tsw.WriteLine(\"biceps\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsw.WriteLine(\"back\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Greg_s_Workout\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var nn = new int[3];\n for (int i = 0; i < n; i++)\n {\n nn[i%3] += Next();\n }\n\n if (nn[0] > nn[1] && nn[0] > nn[2])\n writer.WriteLine(\"chest\");\n else if (nn[1] > nn[2] && nn[1] > nn[2])\n writer.WriteLine(\"biceps\");\n else\n {\n writer.WriteLine(\"back\");\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static int n;\n private static string[] s;\n private static int[] a;\n private static int x = 0, y = 0, z = 0;\n\n private static void Main(string[] args)\n {\n n = int.Parse(Console.ReadLine());\n\n s = Console.ReadLine().Split(' ');\n\n var k = 1;\n\n for (int i = 0; i < n; i++)\n {\n switch (k)\n {\n case 1 :\n x += int.Parse(s[i]);\n break;\n case 2:\n y += int.Parse(s[i]);\n break;\n case 3:\n z += int.Parse(s[i]);\n break;\n }\n\n if (k == 3)\n k = 1;\n else\n k++;\n }\n\n Console.WriteLine(x > y ? x > z ? \"chest\" : \"back\" : y > z ? \"biceps\" : \"back\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Threading.Tasks;\n\nnamespace codeforce8\n{\n class Program\n {\n static string Type(int [] arr,int n)\n {\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n double ff = (double)n / 3;\n /*for (int i = 0; i < 2; i++)\n {\n if (arr.Length % 3 == 0)\n {\n break;\n }\n else arr.Append(0);\n }*/\n for (int i = 0; i < (Math.Ceiling(ff))*3; i+=3)\n {\n chest += arr[i];\n biceps += arr[i + 1];\n back += arr[i + 2];\n }\n if (chest > back && chest > biceps)\n {\n return \"chest\";\n }\n else if (biceps > back && chest biceps)\n {\n return \"back\";\n }\n return \"0\";\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[25];\n string str = Console.ReadLine();\n string[] st = str.Split();\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(st[i]);\n }\n Console.WriteLine(Type(arr,n));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Threading.Tasks;\n\nnamespace codeforce8\n{\n class Program\n {\n static string Type(int [] arr,int n)\n {\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n double ff = (double)n / 3;\n \n for (int i = 0; i < (Math.Ceiling(ff))*3; i+=3)\n {\n chest += arr[i];\n biceps += arr[i + 1];\n back += arr[i + 2];\n }\n if (chest > back && chest > biceps)\n {\n return \"chest\";\n }\n else if (biceps > back && chest < biceps)\n {\n return \"biceps\";\n }\n else return \"back\";\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[25];\n string str = Console.ReadLine();\n string[] st = str.Split();\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(st[i]);\n }\n Console.WriteLine(Type(arr,n));\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Threading.Tasks;\n\nnamespace codeforce8\n{\n class Program\n {\n static string Type(int [] arr,int n)\n {\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n double ff = (double)n / 3;\n \n for (int i = 0; i < (Math.Ceiling(ff))*3; i+=3)\n {\n chest += arr[i];\n biceps += arr[i + 1];\n back += arr[i + 2];\n }\n if (chest > back && chest > biceps)\n {\n return \"chest\";\n }\n else if (biceps > back && chest biceps)\n {\n return \"back\";\n }\n return \"0\";\n }\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] arr = new int[25];\n string str = Console.ReadLine();\n string[] st = str.Split();\n for (int i = 0; i < n; i++)\n {\n arr[i] = int.Parse(st[i]);\n }\n Console.WriteLine(Type(arr,n));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int chest = 0,biceps = 0, back = 0;\n for (int i = 1; i <= count; i++)\n {\n if (i % 3 == 1)\n chest += s[i - 1];\n if (i % 3 == 2)\n biceps += s[i - 1];\n if (i % 3 == 0)\n back += s[i - 1];\n }\n\n Console.WriteLine(chest > biceps && chest > back ? \"chest\" : biceps > chest && biceps > back ? \"biceps\" : \"back\");\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace egor\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] exercises = { 0, 0, 0 };\n char c;\n int count = int.Parse(Console.ReadLine());\n\n for (int i = 0; i < count; i++)\n {\n string tmp = \"\";\n while (char.IsDigit(c = (char)(Console.Read()))) tmp += c;\n exercises[i % 3] += Convert.ToInt32(tmp);\n }\n\n switch (exercises.ToList().IndexOf(exercises.Max()))\n {\n case 0:\n Console.WriteLine(\"chest\");\n break;\n\n case 1:\n Console.WriteLine(\"biceps\");\n break;\n\n case 2:\n Console.WriteLine(\"back\");\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Test{\n static void Main(){\n int n = int.Parse(Console.ReadLine());\n int [] a = new int [3];\n string [] line = Console.ReadLine().Split();\n int j = 0;\n for(int i = 0; i < n; i++){\n if(j == 3){\n j = 0;\n }\n a[j] += int.Parse(line[i]);\n j++;\n }\n switch(Array.IndexOf(a, a.Max())){\n case 0:\n Console.WriteLine(\"chest\"); break;\n case 1:\n Console.WriteLine(\"biceps\"); break;\n case 2:\n Console.WriteLine(\"back\"); break;\n default: break;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Exercise\n{\n static void Main(string[] agrs)\n {\n\n\n var input1 = Console.ReadLine();\n var input2 = Console.ReadLine().Split();\n\n var n = int.Parse(input1);\n\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n for (int i = 0; i < n; i++)\n {\n if ((i + 1) % 3 == 0)\n back += int.Parse(input2[i]);\n\n if ((i + 1) % 3 == 1)\n chest += int.Parse(input2[i]);\n\n if ((i + 1) % 3 == 2)\n biceps += int.Parse(input2[i]);\n\n }\n\n int max = chest;\n string result = \"chest\";\n\n if (biceps > max)\n {\n max = biceps;\n result = \"biceps\";\n }\n\n if (back > max)\n {\n result = \"back\";\n }\n\n Console.WriteLine(result);\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tinternal class Template\n\t{\n\t\tprivate static readonly Scanner cin = new Scanner();\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\t//Console.SetIn(new StreamReader(@\"C:\\CodeForces\\input.txt\"));\n\t\t\tnew Template().Solve();\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tvar n = cin.NextInt();\n\t\t\tvar chest = 0;\n\t\t\tvar biceps = 0;\n\t\t\tvar back = 0;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tvar c = cin.NextInt();\n\t\t\t\tif (i % 3 == 0)\n\t\t\t\t{\n\t\t\t\t\tchest += c;\n\t\t\t\t}\n\t\t\t\tif (i % 3 == 1)\n\t\t\t\t{\n\t\t\t\t\tbiceps += c;\n\t\t\t\t}\n\t\t\t\tif (i % 3 == 2)\n\t\t\t\t{\n\t\t\t\t\tback += c;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (chest > biceps && chest > back)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"chest\");\n\t\t\t}\n\t\t\telse if (biceps > back)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"biceps\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\"back\");\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Scanner\n\t{\n\t\tprivate string[] s = new string[0];\n\t\tprivate int i;\n\t\tprivate readonly char[] cs = new[] { ' ' };\n\n\t\tpublic string Next()\n\t\t{\n\t\t\tif (i < s.Length) return s[i++];\n\t\t\tvar line = Console.ReadLine() ?? string.Empty;\n\t\t\ts = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n\t\t\ti = 1;\n\t\t\treturn s.First();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn double.Parse(Next());\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn int.Parse(Next());\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn long.Parse(Next());\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _255A\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n var type = Console\n .ReadLine()\n .Split()\n .Select((token, i) => new\n {\n Count = int.Parse(token),\n Type = i % 3\n })\n .GroupBy(e => e.Type, e => e.Count)\n .Select(g => new\n {\n Type = g.Key,\n Count = g.Sum()\n })\n .OrderByDescending(e => e.Count)\n .First()\n .Type;\n\n Console.WriteLine(type == 0 ? \"chest\" : type == 1 ? \"biceps\" : \"back\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] strs = Console.ReadLine().Split();\n int[] cnt = { 0, 0, 0 };\n for (int i = 0; i < n; i++)\n {\n cnt[i % 3] += int.Parse(strs[i]);\n }\n if(cnt[0]>cnt[1]&&cnt[0]>cnt[2])\n Console.WriteLine(\"chest\");\n else if(cnt[1]>cnt[2])\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n \nnamespace Solution\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var Nums = Console.ReadLine().Split().Select( x => int.Parse(x) ).ToList();\n var group = new string[] {\"chest\", \"biceps\", \"back\"};\n var train = new Dictionary\n {\n {group[0], 0}, {group[1], 0}, {group[2], 0}\n };\n for (var i = 0; i < n; i++)\n {\n train[group[i%3]]+=Nums[i];\n }\n var max = train.Values.Max();\n Console.WriteLine(train.FirstOrDefault(x=>x.Value == max).Key);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"A1\";\n\n private static void Solve()\n {\n Read();\n var a = ReadIntArray();\n var res = new int[3];\n var resStr = new [] {\"chest\", \"biceps\", \"back\"};\n for (int i = 0; i < a.Count; i++)\n {\n res[i%3] += a[i];\n \n }\n WriteLine(resStr[res[0] == res.Max() ? 0 : res[1] == res.Max() ? 1 : 2]);\n }\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out int n1, out int n2)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n }\n private static void Read(out int n1, out int n2, out int n3)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n }\n private static void Read(out int n1, out int n2, out int n3, out int n4)\n {\n var input = ReadArray();\n n1 = int.Parse(input[0]);\n n2 = int.Parse(input[1]);\n n3 = int.Parse(input[2]);\n n4 = int.Parse(input[3]);\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null) \n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T) Convert.ChangeType(x, typeof (T))).ToList();\n }\n \n private static void WriteLine(int value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(long value)\n {\n Console.WriteLine(value);\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(int value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(long value)\n {\n Console.Write(value);\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces154\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = Console.ReadLine().Split(' ');\n int[] a = new int[3];\n\n int k=0;\n for (int i=0;iMath.Max(a[1],a[2]))\n Console.WriteLine(\"chest\");\n else if (a[1]>Math.Max(a[0],a[2]))\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int chest = 0, back = 0, bic = 0;\n string[] s = Console.ReadLine().Split();\n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n chest += int.Parse(s[i]);\n }\n if ((i+1)%3==2)\n {\n bic += int.Parse(s[i]);\n }\n if ((i + 1) % 3 == 0)\n {\n back += int.Parse(s[i]);\n }\n }\n if (back>chest&&back>bic)\n {\n Console.WriteLine(\"back\");\n }\n if (chest>back&&chest>bic)\n {\n Console.WriteLine(\"chest\");\n }\n if (bic>chest&&bic>back)\n {\n Console.WriteLine(\"biceps\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace olymp\n{\n internal class Program\n {\n private static readonly string[] Answers = new[] { \"chest\", \"biceps\", \"back\" };\n\n private static void Main()\n {\n Console.ReadLine();\n var ex = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var count = new int[3];\n for (int i = 0; i < ex.Length; i++)\n count[i % 3] += ex[i];\n for (int i = 0; i < 3; i++)\n if (count[i] == count.Max())\n Console.Write(Answers[i]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), item => Convert.ToInt32(item));\n int chests = 0, biceps = 0, back = 0;\n for(int i=0;i<3;i++)\n {\n for(int j=i;j biceps && chests > back) Console.Write(\"chest\");\n else if (biceps > chests && biceps > back) Console.Write(\"biceps\");\n else Console.Write(\"back\");\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nusing System.Windows;\nusing static System.Math;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(ReadLine());\n string[] b = ReadLine().Split(' ');\n int[] a = new int[b.Length + 1];\n int back = 0, biceps = 0, chest = 0;\n for (int i = 1; i <= b.Length; i++)\n {\n a[i] = Convert.ToInt32(b[i - 1]);\n }\n for (int i = 1; i <= b.Length; i++)\n {\n if (i % 3 == 0) back += a[i];\n else if (i % 3 == 2) biceps += a[i];\n else if (i % 3 == 1) chest += a[i];\n }\n if (Max(Max(back, biceps), chest) == back) WriteLine(\"back\");\n else if (Max(Max(back, biceps), chest) == biceps) WriteLine(\"biceps\");\n else Write(\"chest\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for(int i=0;i li = new List();\n li.Add(chest); li.Add(biceps); li.Add(back);\n li.Sort();\n if(li[2]==chest)\n {\n Console.WriteLine(\"chest\");\n }\n else if (li[2] == back)\n {\n Console.WriteLine(\"back\");\n }\n else if (li[2] == biceps)\n {\n Console.WriteLine(\"biceps\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce156B_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n string[] st = Console.ReadLine().Split(' ');\n int count = 0;\n int sum1 = 0;\n int sum2 = 0;\n int sum3 = 0;\n for (int i = 0; i < st.Length; i++)\n {\n switch (count)\n {\n case 0:\n sum1 += Int32.Parse(st[i]);\n break;\n case 1:\n sum2 += Int32.Parse(st[i]);\n break;\n case 2:\n sum3 += Int32.Parse(st[i]);\n break;\n default:\n sum1 += Int32.Parse(st[i]);\n count = 0;\n break;\n }\n count++;\n }\n if (sum1>sum2 && sum1>sum3) \n Console.WriteLine(\"chest\");\n else if (sum2 > sum1 && sum2 > sum3)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace TASK_255A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n int[] arr = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int[] res = new[] { 0, 0, 0 };\n for (int i = 0; i < count; i++)\n res[i % 3] += arr[i];\n if (res[0] == res.Max())\n Console.WriteLine(\"chest\");\n else if (res[1] == res.Max())\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nclass a\n{\n static void Main()\n {\n Console.ReadLine();\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n int b, c, d; b = c = d = 0;\n for (int i = 0; i < a.Length; i+=3) b+= a[i];\n for (int i = 1; i < a.Length; i+=3) c+= a[i];\n for (int i = 2; i < a.Length; i+=3) d+= a[i];\n Console.WriteLine(b > c ? b > d ? \"chest\" : \"back\" : c > d ? \"biceps\" : \"back\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic; \n\n\tclass MainClass\n\t{\n\tpublic static string findmax(int chest,int biceps,int back)\n\t{\n\t\tint val = Math.Max (Math.Max (chest, biceps), back);\n\t\tif (val == chest)\n\t\t\treturn \"chest\";\n\t\tif (val == biceps)\n\t\t\treturn \"biceps\";\n\t\tif (val == back)\n\t\t\treturn \"back\";\n\t\telse\n\t\t\treturn \"none\";\n\t}\n\n\n\tpublic static void Main(string[] args)\n\t{\n\t\tint n = Convert.ToInt32 (Console.ReadLine ());\n\t\tstring[] values = Console.ReadLine ().Split ();\n\t\tint[] val = new int[n];\n\t\tint check = 0;\n\t\tint chest = 0, back = 0, biceps = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tval [i] = Convert.ToInt32 (values [i]);\n\t\t\tif (check == 0) {\n\t\t\t\tchest =chest + val [i];\n\t\t\t}\n\t\t\tif (check == 1) {\n\t\t\t\tbiceps = biceps+ val [i];\n\t\t\t}\n\t\t\tif (check == 2) {\n\t\t\t\tback = back + val [i];\n\t\t\t\tcheck++;\n\t\t\t}\n\t\t\tcheck++;\n\t\t\tif (check > 3)\n\t\t\t\tcheck = 0;\n\t\t\t\n\t\t\t\t\n\t\t}\n\t \n\t\tConsole.WriteLine (findmax (chest, biceps, back));\n\n\n\t}\n\t\n}\n\n\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n int chest = 0, biceps = 0, back = 0;\n for (int i = 0; i < n; i++)\n {\n if (i % 3 == 0) chest += a[i];\n else if (i % 3 == 1) biceps += a[i];\n else if (i % 3 == 2) back += a[i];\n }\n\n if (chest > biceps && chest > back)\n Console.WriteLine(\"chest\");\n else if (biceps > chest && biceps > back)\n Console.WriteLine(\"biceps\");\n else if (back > chest && back > biceps)\n Console.WriteLine(\"back\");\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace _158Csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string s = Console.ReadLine();\n string[] p = s.Split(new string[] { \" \" }, StringSplitOptions.None);\n int[] A = new int[n];\n for (int i = 0; i < n; i++)\n {\n A[i] = Convert.ToInt32(p[i]);\n }\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 0; i < n; i++)\n {\n if (i % 3 == 0)\n {\n chest += A[i];\n }\n else if (i % 3 == 1)\n {\n biceps += A[i];\n }\n else if (i % 3 == 2)\n {\n back += A[i];\n }\n }\n if (chest > biceps && chest > back)\n Console.WriteLine(\"chest\");\n if (biceps > chest && biceps > back)\n Console.WriteLine(\"biceps\");\n if (back > chest && back > biceps)\n Console.WriteLine(\"back\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n int n=Convert.ToInt32(Console.ReadLine());\n var all= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int[] a=new int[3];\n int s=0;\n for(int i=1;i<=n;i++)\n {\n if((i+2)%3==0)\n a[0]+=all[i-1];\n else if((i+1)%3==0)\n a[1]+=all[i-1];\n else\n a[2]+=all[i-1];\n }\n int max=a.Max();\n if(a[0]==max)\n Console.WriteLine(\"chest\");\n else if(a[1]==max)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program { \n static void Main() {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ').Select(int.Parse).Select((x, i) => new {x, Index = i % 3}).GroupBy(t => t.Index).OrderByDescending(g => g.Sum(g1 => g1.x)).First().Key;\n Console.Write((new [] {\"chest\", \"biceps\", \"back\"})[a]);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.ReadLine();\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[y.Length];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 0; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n chest += a[i];\n }\n }\n for (int i = 1; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n biceps += a[i];\n }\n }\n for (int i = 2; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n back += a[i];\n }\n }\n if ((chest > back) && (chest > biceps))\n {\n Console.WriteLine(\"chest\");\n\n } \n if ((back > biceps) && (back > chest))\n {\n Console.WriteLine(\"back\");\n\n }\n if ((biceps > back) && (biceps > chest))\n {\n Console.WriteLine(\"biceps\");\n\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharp_Contests\n{\n public class Program\n {\n public static void Main() {\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split(new char[1] { ' ' }).Select(b => int.Parse(b)).ToArray();\n int c = 0, bi = 0, ba = 0;\n n = n - ( n % 3 );\n for (int i = 0; i < n; i += 3)\n {\n c += a[i];\n bi += a[i + 1];\n ba += a[i + 2];\n }\n if (a.Length - n > 0)\n c += a[n];\n if (a.Length - n > 1)\n bi += a[n + 1];\n if (a.Length - n > 2)\n c += a[n + 2];\n\n if (c > bi && c > ba)\n Console.WriteLine(\"chest\");\n else if (bi > c && bi > ba)\n Console.WriteLine(\"biceps\");\n else if (ba > c && ba > bi)\n Console.WriteLine(\"back\");\n#if DEBUG\n Console.ReadLine();\n#endif\n//ssss\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int chest = 0, biceps = 0, back = 0;\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (n > 3)\n {\n for (int i = 0; i < n; i += 3)\n {\n chest += arr[i];\n }\n for (int i = 1; i < n; i += 3)\n {\n biceps += arr[i];\n }\n for (int i = 2; i < n; i += 3)\n {\n back += arr[i];\n }\n }\n else\n {\n if (n == 3)\n {\n chest = arr[0];\n biceps = arr[1];\n back = arr[2];\n }\n if (n == 2)\n {\n chest = arr[0];\n biceps = arr[1];\n }\n else if (n == 1) { Console.WriteLine(\"chest\"); return; };\n }\n string[] s = { \"chest\", \"biceps\", \"back\" };\n int[] final = { chest, biceps, back };\n Console.WriteLine(s[Array.IndexOf(final, final.Max())]);\n }\n }\n}\n"}, {"source_code": "using System.Text;\nusing System.Linq;\nusing System;\nusing System.Collections;\n\nclass Program\n{\n static void Main()\n {\n int s1 = Convert.ToInt32(Console.ReadLine());\n string s2 = Console.ReadLine();\n int[] sum = new int[3];\n \n string[] povtor = s2.Split(' ');\n\n for (int i=0; i<=povtor.Length - 1; i++)\n {\n sum[i%3] += Convert.ToInt32(povtor[i]);\n }\n \n if (sum[0] > sum[1] && sum[0] > sum[2])\n Console.WriteLine(\"chest\");\n if (sum[1] > sum[0] && sum[1] > sum[2])\n Console.WriteLine(\"biceps\");\n if (sum[2] > sum[1] && sum[2] > sum[0])\n Console.WriteLine(\"back\");\n }\n}"}, {"source_code": "using System;\nusing System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace temp\n{\n class MainClass\n {\n private static Int32[] read_ints(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int32[] ret = new Int32[n];\n for (Int32 i = 0; i < n; i++)\n ret[i] = Convert.ToInt32(str[i]);\n return ret;\n }\n\n private static Int32 read_int() {\n return Convert.ToInt32(Console.ReadLine());\n }\n\n private static Int64[] read_longs(int n) {\n string[] str = Console.ReadLine().Split(new char[]{' '});\n Int64[] ret = new Int64[n];\n for (Int64 i = 0; i < n; i++)\n ret[i] = Convert.ToInt64(str[i]);\n return ret;\n }\n\n private static Int64 read_long() {\n return Convert.ToInt64(Console.ReadLine());\n }\n\n private static string read_line() {\n return Console.ReadLine();\n }\n\n public static void Main (string[] args)\n {\n int n = read_int(), chest = 0, biceps = 0, back = 0, m = 0;\n int[] arr = read_ints(n);\n for (int i = 0; i < n; i++) {\n if (m == 0)\n chest += arr[i];\n else if (m == 1)\n biceps += arr[i];\n else\n back += arr[i];\n if (++m > 2)\n m = 0;\n }\n if (chest > biceps && chest > back)\n Console.WriteLine(\"chest\");\n else if (biceps > chest && biceps > back)\n Console.WriteLine(\"biceps\");\n else\n Console.WriteLine(\"back\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] line = Console.ReadLine().Split(' ');\n int[] exercices = new int[n];\n for (int i = 0; i < n; i++)\n {\n exercices[i] = Convert.ToInt32(line[i]);\n }\n int chest = 0;\n for (int i = 0; i < n; i = i + 3)\n {\n chest += exercices[i];\n }\n int biceps = 0;\n for (int i = 1; i < n; i = i + 3)\n {\n biceps += exercices[i];\n }\n int back = 0;\n for (int i = 2; i < n; i = i + 3)\n {\n back += exercices[i];\n }\n if (chest > biceps && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n if (biceps > back && biceps > chest)\n {\n Console.WriteLine(\"biceps\");\n }\n if(back > chest && back > biceps)\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace GregsWorkout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine()), count = 0, chest = 0, biceps = 0, back = 0;\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int[] total;\n string[] name;\n for (int i = 0; i < n; i++)\n {\n count += 1;\n if (count == 1)\n chest += a[i];\n else if (count == 2)\n biceps += a[i];\n else if (count == 3)\n back += a[i];\n if (count == 3)\n count = 0;\n }\n total = new int[] { chest, biceps, back };\n name = new String[] { \"chest\", \"biceps\", \"back\" };\n Array.Sort(total, name);\n Console.WriteLine(name[2]);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string[] str = Console.ReadLine().Split(' ');\n int chest = 0;\n int biceps = 0;\n int back = 0;\n int k = 0;\n for (int i = 0; i < n; i++)\n {\n if (k == 0)\n {\n chest += int.Parse(str[i]);\n }\n else if (k == 1)\n {\n biceps += int.Parse(str[i]);\n }\n else\n {\n back += int.Parse(str[i]);\n }\n k++;\n if (k == 3)\n {\n k = 0;\n }\n }\n if (chest>biceps && chest>back)\n {\n Console.Write(\"chest\");\n }\n else if (biceps> back && biceps>chest)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\n\nnamespace Codeforces_156Div2\n{\n\tclass Program\n\t{\n\n\t\tpublic void Solve ()\n\t\t{\n\t\t\tint n = io.NextInt ();\n\n\t\t\tvar sum = new int[3];\n\n\t\t\tfor (int i = 0; i < n; ++i)\n\t\t\t{\n\t\t\t\tint a = io.NextInt ();\n\t\t\t\tsum[ i % 3 ] += a;\n\t\t\t}\n\n\t\t\tint best = 0;\n\t\t\tfor (int i = 0; i < 3; ++i)\n\t\t\t\tif (sum[i] > sum[best])\n\t\t\t\t\tbest = i;\n\n\t\t\tio.PrintLine (new String[]{\"chest\", \"biceps\", \"back\"}[best]);\n\t\t}\n\n #region Program\n\n private readonly MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n public static void Main(string[] args)\n {\n using (MyIo io = new MyIo())\n {\n new Program(io).Solve();\n }\n }\n\n #endregion\n }\n\n #region MyIo\n\n internal class MyIo : IDisposable\n {\n private readonly TextReader reader;\n private readonly TextWriter writer;\n\n private string[] tokens;\n private int pointer;\n\n\t\tpublic MyIo ()\n\t\t\t: this(Console.In, Console.Out)\n\t\t{\n\t\t}\n\n\t\tpublic MyIo (TextReader reader, TextWriter writer)\n\t\t{\n\t\t\tthis.reader = reader;\n\t\t\tthis.writer = writer;\n\t\t}\n \n public string NextLine()\n {\n try\n {\n return reader.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n\t\t\tint result;\n\t\t\tint.TryParse(NextString(), out result);\n return result;\n }\n\n public long NextLong()\n {\n\t\t\tlong result;\n\t\t\tlong.TryParse(NextString(), out result);\n return result;\n }\n\n\t\tpublic double NextDouble()\n {\n\t\t\tdouble result;\n\t\t\tdouble.TryParse(NextString(), out result);\n return result;\n }\n\n public T Next()\n {\n return (T)Convert.ChangeType(NextString(), typeof(T));\n }\n\n public IEnumerable NextSeq(int n)\n {\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tyield return Next();\n }\n\n public void Print(string format, params object[] args)\n {\n writer.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n writer.WriteLine();\n }\n\n public void Print(T o)\n {\n writer.Write(o);\n }\n\n public void PrintLine(T o)\n {\n writer.WriteLine(o);\n }\n\n public void Close()\n {\n reader.Close();\n writer.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System; \nusing System.Collections.Generic;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n int chest = 0, biceps = 0, back = 0;\n int counter = 0;\n string number = Console.ReadLine ();\n int n = Int32.Parse (number);\n string str = Console.ReadLine ();\n List mains = new List ();\n List helpList = str.Split (' ').ToList();\n for (int i = 0; i < helpList.Count; i++) {\n mains.Add(Int32.Parse(helpList[i]));\n }\n int helpCounter = 0;\n for (int i = 1; i <= mains.Count; i++) {\n helpCounter++;\n if (helpCounter == 1)\n chest += mains [i - 1];\n else if (helpCounter == 2)\n biceps += mains [i - 1];\n else if (helpCounter == 3) {\n back += mains [i - 1];\n helpCounter = 0;\n }\n }\n if (chest > back && chest > biceps)\n Console.WriteLine (\"chest\");\n if (back > chest && back > biceps)\n Console.WriteLine (\"back\");\n if (biceps > chest && biceps > back)\n Console.WriteLine (\"biceps\");\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n //int numbers = Console.ReadLine().Split().Count(x => x.Count(y => y == '4' || y == '7') <= s[1]);\n int chest=0, biceps=0, back=0;\n for (int i = 1; i <= count; i++)\n {\n if (i % 3 == 1)\n chest += i * s[i-1];\n if (i % 3 == 2)\n biceps += i * s[i-1];\n if (i % 3 == 0)\n back += i * s[i-1];\n }\n\n Console.WriteLine(chest>biceps&&chest>back? \"chest\" : biceps>chest&&biceps>back? \"biceps\" : \"back\");\n\n }\n }\n}"}, {"source_code": "using System;\nusing static System.Console;\nusing System.Windows;\nusing static System.Math;\n\nnamespace ConsoleApp6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(ReadLine());\n string[] b = ReadLine().Split(' ');\n int[] a = new int[b.Length + 1];\n int back = 0, biceps = 0, chest = 0;\n for (int i = 1; i <= b.Length; i++)\n {\n a[i] = Convert.ToInt32(b[i - 1]);\n }\n for (int i = 1; i <= b.Length; i++)\n {\n if (i % 3 == 0) back += a[i];\n else if (i % 2 == 0) biceps += a[i];\n else if (i % 2 == 1) chest += a[i];\n }\n if (Max(Max(back, biceps), chest) == back) WriteLine(\"back\");\n else if (Max(Max(back, biceps), chest) == biceps) WriteLine(\"biceps\");\n else Write(\"chest\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] y = Console.ReadLine().Split(' ');\n int[] a = new int[y.Length];\n for (int i = 0; i < a.Length; i++)\n {\n a[i] = int.Parse(y[i]);\n }\n int chest = 0;\n int biceps = 0;\n int back = 0;\n for (int i = 0; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n chest += a[i];\n }\n }\n for (int i = 1; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n biceps += a[i];\n }\n }\n for (int i = 2; i < a.Length; i += 3)\n {\n if (i < a.Length)\n {\n back += a[i];\n }\n }\n if ((chest > back) && (chest > biceps))\n {\n Console.WriteLine(\"chest\");\n\n } \n if ((back > biceps) && (back > chest))\n {\n Console.WriteLine(\"back\");\n\n }\n if ((biceps > back) && (biceps > chest))\n {\n Console.WriteLine(\"biceps\");\n\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.Greg_s_Workout\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int chest = 0, biceps = 0, back = 0;\n int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();\n if (n > 3)\n {\n for (int i = 0; i < n; i += 3)\n {\n chest += arr[i];\n }\n for (int i = 1; i < n; i += 3)\n {\n biceps += arr[i];\n }\n for (int i = 2; i < n; i += 3)\n {\n back += arr[i];\n }\n }\n else\n {\n if (n == 3)\n {\n chest = arr[0];\n biceps = arr[1];\n back = arr[2];\n }\n if (n == 2)\n {\n chest = arr[0];\n biceps = arr[1];\n }\n else if (n == 1) Console.WriteLine(\"chest\");\n }\n string[] s = { \"chest\", \"biceps\", \"back\" };\n int[] final = { chest, biceps, back };\n Console.WriteLine(s[Array.IndexOf(final, final.Max())]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program_R156_Div2_A\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] s = (Console.ReadLine().Split());\n int[] b = new int[Math.Max(n,3)];\n for (int i = 0; i < n; i++)\n b[i] = Convert.ToInt32(s[i]);\n\n for (int j = 3; j < n; j++)\n b[j % 3] += b[j];\n\n string ans = \"back\";\n if (b[0] > b[1] && b[1] > b[2])\n ans = \"chest\";\n else if (b[1] > b[0] && b[1] > b[2])\n ans = \"biceps\";\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace pr111\n{\n class Program\n {\n public static void Main(string[] args)\n { int a,b,c,n;string s; \n n=Convert.ToInt16(Console.ReadLine());\n int[] arr;\n arr= new int[24];\n a = 0; b =0; c =0;\n string[] line=Console.ReadLine().Split();\n for (int i=0; i=b&&a>=c) {s=\"chest\";} else {if(b>c){s=\"biceps\";} else {s=\"back\";}}\n Console.WriteLine(Convert.ToString(s));\n //Console.ReadKey(true);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication32\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int[] a = new int[n];\n string str = Console.ReadLine();\n string[] subString = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int b = 0;\n int c = 0;\n int d = 0;\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(subString[i]);\n }\n for (int i = 0; i < n; i = i + 3)\n {\n b = b + a[i];\n }\n for (int i = 1; i < n; i = i + 3)\n {\n c = c + a[i];\n }\n for(int i = 2; i < n; i = i + 3)\n {\n d = d + a[i];\n }\n if (b > c && b > d)\n {\n Console.WriteLine(\"biceps\");\n }\n else if (c > d)\n {\n Console.WriteLine(\"back\");\n }\n else\n {\n Console.WriteLine(\"chest\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _255A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chest = 0, biceps = 0, back = 0;\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n for(int i = 0;i back ? \"biceps\" : \"back\");\n else\n Console.WriteLine(chest > back ? \"chest\" : \"back\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _255A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int chest = 0, biceps = 0, back = 0;\n int n = int.Parse(Console.ReadLine());\n int[] a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n for(int i = 0;i back ? \"biceps\" : \"back\");\n else\n Console.WriteLine(chest > back ? \"chest\" : \"back\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces{\n public class task{\n static void Main(){\n int n;\n int []tr={0,0,0};\n n=Convert.ToInt32(Console.ReadLine());\n int []training=new int[n];\n string[] str = Console.ReadLine().Split(new char[] { ' ', '\\n', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n for(int i=0;itr[1]&&tr[0]>tr[2]){\n Console.WriteLine(\"chest\");\n }else{\n if(tr[1]>tr[0]&&tr[1]>tr[2]){\n Console.WriteLine(\"biceps\");\n }else{\n Console.WriteLine(\"back\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = new int[3]; \n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n y[1]++;\n continue;\n }\n else if ((i+1%3)==2)\n {\n y[2]++;\n }\n else\n {\n y[0]++;\n }\n }\n if (y.Max() == y[0])\n {\n Console.WriteLine(\"chest\");\n }\n else if (y.Max() ==y[1])\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int u = 0;\n int y = 0;\n for (int i = 1; i < n; i++)\n {\n if (l[i]>l[i-1])\n {\n u = l[i];\n y = i;\n }\n }\n if ((y+1)%3==1)\n {\n Console.WriteLine(\"chest\");\n }\n else if((y+1)%3==2)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = new int[3]; \n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n y[0]+=l[i];\n continue;\n }\n else if ((i+1%3)==2)\n {\n y[1]+=l[i];\n continue;\n }\n else\n {\n y[2]+=l[i];\n }\n }\n if (y.Max() == y[0])\n {\n Console.WriteLine(\"chest\");\n }\n else if (y.Max() ==y[1])\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = new int[3]; \n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n y[1]++;\n continue;\n }\n else if ((i+1%3)==2)\n {\n y[2]++;\n }\n else\n {\n y[0]++;\n }\n }\n if (l.Max() == y[0])\n {\n Console.WriteLine(\"chest\");\n }\n else if (l.Max() ==y[1])\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] l = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int[] y = new int[3]; \n for (int i = 0; i < n; i++)\n {\n if ((i+1)%3==1)\n {\n y[1]++;\n continue;\n }\n else if ((i+1%3)==2)\n {\n y[2]++;\n }\n else\n {\n y[0]++;\n }\n }\n if (l.Max() == l[0])\n {\n Console.WriteLine(\"chest\");\n }\n else if (l.Max() ==l[1])\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = int.Parse(Console.ReadLine());\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int chest = 0;\n int bicepc = 0;\n int back = 0;\n\n for (int i = 1; i <= init; i++)\n {\n if (i % 3 == 0)\n {\n back += nums[i-1];\n }\n else if (i % 3 != 0 && i % 2 == 0)\n {\n bicepc += nums[i-1];\n }\n else\n {\n chest += nums[i-1];\n }\n }\n\n\n if (chest > bicepc && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n else if (bicepc > chest && bicepc > back)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace ConsoleApplication25\n{\n class Program\n {\n static void Main(string[] args)\n {\n var init = int.Parse(Console.ReadLine());\n var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int chest = 0;\n int bicepc = 0;\n int back = 0;\n\n for (int i = 0; i < init; i++)\n {\n if (nums[i] % 3 == 0)\n {\n chest += nums[i];\n }\n else if (nums[i] % 3 != 0 && nums[i] % 2 == 0)\n {\n bicepc += nums[i];\n }\n else\n {\n back += nums[i];\n }\n }\n\n\n if (chest > bicepc && chest > back)\n {\n Console.WriteLine(\"chest\");\n }\n else if (bicepc > chest && bicepc > back)\n {\n Console.WriteLine(\"biceps\");\n }\n else\n {\n Console.WriteLine(\"back\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program { \n static void Main() {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ').Select(int.Parse).Select((x, i) => new {x, Index = i % 3}).GroupBy(t => t.Index).OrderByDescending(g => g.Count()).First().Key;\n Console.Write((new [] {\"chest\", \"biceps\", \"back\"})[a]);\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program { \n static void Main() {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ').Select(int.Parse).Select((i, x) => i % 3).GroupBy(t => t).OrderByDescending(g => g.Count()).First().Key;\n Console.Write((new [] {\"chest\", \"biceps\", \"back\"})[a]);\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static int n;\n private static string[] s;\n private static int[] a;\n private static int x = 0, y = 0, z = 0;\n\n private static void Main(string[] args)\n {\n n = int.Parse(Console.ReadLine());\n\n s = Console.ReadLine().Split(' ');\n\n var k = 1;\n\n for (int i = 0; i < n; i++)\n {\n switch (k)\n {\n case 1 :\n x += int.Parse(s[i]);\n break;\n case 2:\n y += int.Parse(s[i]);\n break;\n case 3:\n z += int.Parse(s[i]);\n break;\n }\n\n if (k == 3)\n k = 0;\n else\n k++;\n }\n\n Console.WriteLine(x > y ? x > z ? \"chest\" : \"back\" : y > z ? \"biceps\" : \"back\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), chest = 0, biceps = 0, back = 0;\n List mass = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n chest = mass.Where(x => mass.IndexOf(x) % 3 == 0).Sum();\n for (int i = 0; i < n; i++)\n {\n if (i % 3 == 0) mass[i] = 0;\n }\n for (int i = 0; i < mass.Count(); i++)\n {\n if (mass[i] == 0) mass.Remove(mass[i]);\n }\n\n for (int i = 0; i < mass.Count(); i++)\n {\n if (i % 2 == 0) biceps += mass[i];\n else back += mass[i];\n }\n if (biceps > chest && biceps > back) Console.Write(\"biceps\");\n if (chest > biceps && chest > back) Console.Write(\"chest\");\n if (back > chest && back > biceps) Console.Write(\"back\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var m = new int[3];\n for (int i = 0; i < n; i++)\n {\n m[i % 3]++;\n }\n Console.WriteLine(\"{0}\", new string[] { \"chest\", \"biceps\", \"back\" }[Array.IndexOf(m, m.Max())]);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nclass Program\n{\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var muscle = new int[3];\n for (int i = 0; i < n; i++)\n {\n muscle[i % 3]++;\n }\n Console.WriteLine(muscle[0] > muscle[1] ? \"chest\" : muscle[1] > muscle[2] ? \"biceps\" : \"back\");\n }\n}\n"}], "src_uid": "579021de624c072f5e0393aae762117e"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n \n class Program\n {\n\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int n = arr[0];\n int m = arr[1];\n if (n == 1 || m == 1)\n {\n Console.WriteLine(n*m);\n return;\n }\n if (n == 2 || m == 2)\n {\n int k;\n if (n == 2)\n k = m;\n else\n k = n;\n int z = 0;\n for (int i = 0; i < k; i++)\n {\n if (i % 4 == 0)\n z += 1;\n if (i % 4 == 1)\n z++;\n }\n Console.WriteLine(z*2);\n return;\n }\n int kk = 0;\n for (int i = 0; i < n; i++)\n {\n if (i % 2 == 0)\n {\n kk += (m + 1) / 2;\n }\n else\n {\n kk += m / 2;\n }\n \n }\n Console.WriteLine(kk);\n } \n }\n}\n", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n == 1 || m == 1)\n {\n var t = 1;\n t ^= n ^ m;\n sum = t;\n }\n else\n if (n == 2 || m == 2)\n {\n var t = 2;\n t ^= n ^ m;\n sum = (t / 4)*4;\n var l = t % 4;\n if(l>0)\n sum += (l > 1 ? 2 : 1)*2;\n }\n else sum = (n * m) / 2 + (n * m) % 2;\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int a = ab[0];\n int b = ab[1];\n\n if (a > b)\n {\n int t = a;\n a = b;\n b = t;\n }\n\n int r1 = a * ((b-1) / 3+1);\n int r2 = ((a-1) / 3 + 1) * b;\n\n int r3 = a * b / 2 + ((a * b) % 2 == 0 ? 0 : 1);\n\n int res = Math.Max(Math.Max(r1, r2), r3);\n\n if (a == 2)\n {\n if (b % 4 == 1)\n {\n res = b / 4 * 4 + 2;\n }\n else if (b % 4 == 2 || b % 4 == 3)\n {\n res = b / 4 * 4 + 4;\n }\n }\n outstream.WriteLine(res);\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Help_General\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = m*n/2;\n if (n%2 == 1 && m%2 == 1)\n {\n max++;\n }\n\n max = Math.Max(max, n*((m + 2)/3));\n max = Math.Max(max, m*((n + 2)/3));\n\n max = Math.Max(max, C2(n)*C2(m));\n\n if (n == 3 && m > 4 && (m%3 == 0 || m%3 == 2))\n max = Math.Max(max, 2 + n*((m + 2)/3));\n\n if (m == 3 && n > 4 && (n%3 == 0 || n%3 == 2))\n max = Math.Max(max, 2 + m*((n + 2)/3));\n\n writer.WriteLine(max);\n writer.Flush();\n }\n\n private static int C2(int n)\n {\n if (n%4 == 1)\n {\n return 2*((n + 2)/4) + 1;\n }\n return 2*((n + 2)/4);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Random r;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n List ret = new List();\n\n int[,] dp;\n\n void calc()\n {\n cin = new Scanner();\n int n = cin.nextInt();\n int m = cin.nextInt();\n dp = new int[n + 1, m + 1];\n Console.WriteLine(saiki(n, m));\n }\n\n int saiki(int a, int b)\n {\n if (a == 0 && b == 0) return a;\n if (dp[a, b] != 0) return dp[a, b];\n int reta = (a / 4) * 2 + Math.Min(a % 4, 2);\n int retb = (b / 4) * 2 + Math.Min(b % 4, 2);\n int ret = reta * retb;\n ret = Math.Max((a + 2) / 3 * b, ret);\n ret = Math.Max((b + 2) / 3 * a, ret);\n if (a > 3) ret = Math.Max(ret, saiki(a - 3, b) + b);\n if (b > 3) ret = Math.Max(ret, saiki(a, b - 3) + a);\n ret = Math.Max(ret, (a * b + 1) / 2);\n return dp[a, b] = ret;\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s=>int.Parse(s));\n var n = input.First();\n var m = input.Last();\n if ((double)n / 3 > (double)m / 3)\n {\n var t = (n / 3) % 1 > 0.5 ? Math.Round((double)n / 3) : Math.Round(n / 3 + .5);\n Console.WriteLine(t * m);\n }\n else\n {\n var t = (m / 3) % 1 > 0.5 ? Math.Round((double)m / 3) : Math.Round(m / 3 + .5);\n Console.WriteLine(t * n);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n == 1 || m == 1)\n {\n var t = 1;\n t ^= n ^ m;\n sum = t;\n }\n else\n if (((n == 2) && (m % 2 != 0)) || ((m == 2) && (n % 2 != 0)))\n {\n var t = 2;\n t ^= n ^ m;\n sum = t + 1;\n }\n else\n if (n % 2 == 0)\n {\n var low = (int)m / 2;\n var up = low + m % 2;\n sum = (low + up) * (n / 2);\n }\n else if (m % 2 == 0)\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n == 1 || m == 1)\n {\n var t = 1;\n t ^= n ^ m;\n sum = t;\n }\n if (((n == 2) && (m % 2 != 0)) || ((m == 2) && (n % 2 != 0)))\n {\n var t = 2;\n t ^= n ^ m;\n sum = t+1;\n }\n else\n if (n % 2 == 0)\n {\n var low = (int)m / 2;\n var up = low + m % 2;\n sum = (low + up) * (n / 2);\n }\n else if (m % 2 == 0)\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n % 2 == 0)\n {\n var low = (int)Math.Round((double)n / 2);\n var up = low;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)Math.Round((double)(m / 2) );\n var up = (int)Math.Round((double)(m / 2)+.51);\n sum = (low + up) * (n / 2);\n if (m % 2 != 0) sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n % 2 == 0)\n {\n var low = (int)Math.Round((double)n / 2);\n var up = (int)Math.Round(n / 2 + .5);\n sum = (low + up) * m / 2;\n }\n else\n {\n var low = (int)Math.Round((double)(m / 2) );\n var up = (int)Math.Round((double)(m / 2)+.51);\n sum = (low + up) * (n / 2);\n if (m % 2 != 0) sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n == 1 || m == 1)\n {\n var t = 1;\n t ^= n ^ m;\n sum = t;\n }\n else\n if (n == 2|| m == 2)\n {\n var t = 2;\n var tt = (m + n) ^ t;\n t ^= n ^ m;\n sum = tt%2==0?t+2:t+1;\n }\n else\n if (n % 2 == 0)\n {\n var low = (int)m / 2;\n var up = low + m % 2;\n sum = (low + up) * (n / 2);\n }\n else if (m % 2 == 0)\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s=>double.Parse(s));\n var n = input.First();\n var m = input.Last();\n if (n / 3 > m / 3)\n {\n var t = (n / 3) % 1 > 0.5 ? Math.Round(n / 3) : Math.Round(n / 3 + .5);\n Console.WriteLine(t * m);\n }\n else\n {\n var t = (m / 3) % 1 > 0.5 ? Math.Round(m / 3) : Math.Round(m / 3 + .5);\n Console.WriteLine(t * n);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n % 2 == 0)\n {\n var low = (int)m / 2;\n var up = low + m % 2;\n sum = (low + up) * (n / 2);\n }\n else if (m % 2 == 0)\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)n / 2;\n var up = low + n%2;\n sum = (low + up) * (m / 2);\n sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Globalization;\n\nnamespace Contest\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));\n var n = input.First();\n var m = input.Last();\n int sum = 0;\n if (n == 1 || m == 1)\n {\n var t = 1;\n t ^= n ^ m;\n sum = t;\n }\n else\n if (n % 2 == 0)\n {\n var low = (int)m / 2;\n var up = low + m % 2;\n sum = (low + up) * (n / 2);\n }\n else if (m % 2 == 0)\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n }\n else\n {\n var low = (int)n / 2;\n var up = low + n % 2;\n sum = (low + up) * (m / 2);\n sum += up;\n }\n Console.WriteLine(sum);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n \n class Program\n {\n\n static void Main(string[] args)\n {\n int[] arr = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n int n = arr[0];\n int m = arr[1];\n if (n == 1 || m == 1)\n {\n Console.WriteLine(n*m);\n return;\n }\n if (n == 2 || m == 2)\n {\n int k;\n if (n == 2)\n k = m;\n else\n k = n;\n int z = 0;\n for (int i = 0; i < k; i+=4)\n {\n z += 2;\n }\n if (k % 2 != 0)\n z -= 1;\n Console.WriteLine(z*2);\n return;\n }\n int kk = 0;\n for (int i = 0; i < n; i++)\n {\n if (i % 2 == 0)\n {\n kk += (m + 1) / 2;\n }\n else\n {\n kk += m / 2;\n }\n \n }\n Console.WriteLine(kk);\n } \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Random r;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n List ret = new List();\n\n static int[, ,] dp;\n static int[, ,] preput;\n\n void calc()\n {\n cin = new Scanner();\n int n = cin.nextInt();\n int m = cin.nextInt();\n int ret = Math.Max((n + 2) / 3 * m, (m + 2) / 3 * n);\n Console.WriteLine(ret);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Random r;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n List ret = new List();\n\n static int[, ,] dp;\n static int[, ,] preput;\n\n void calc()\n {\n cin = new Scanner();\n int n = cin.nextInt();\n int m = cin.nextInt();\n int ret = Math.Max((n + 2) / 3 * m, (m + 2) / 3 * n);\n ret = Math.Max(ret, (n / 4 * 2 + Math.Min(2, n % 4)) * (m / 4 * 2 + Math.Min(2, m % 4)));\n Console.WriteLine(ret);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Random r;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n List ret = new List();\n\n int[,] dp;\n\n void calc()\n {\n cin = new Scanner();\n int n = cin.nextInt();\n int m = cin.nextInt();\n dp = new int[n + 1, m + 1];\n Console.WriteLine(saiki(n, m));\n }\n\n int saiki(int a, int b)\n {\n if (a == 0 && b == 0) return a;\n if (dp[a, b] != 0) return dp[a, b];\n int reta = (a / 4) + Math.Min(a % 4, 2);\n int retb = (b / 4) + Math.Min(b % 4, 2);\n int ret = reta * retb;\n ret = Math.Max((a + 2) / 3 * b, ret);\n ret = Math.Max((b + 2) / 3 * a, ret);\n if (a > 3) ret = Math.Max(ret, saiki(a - 3, b) + b);\n if (b > 3) ret = Math.Max(ret, saiki(b - 3, a) + a);\n return dp[a, b] = ret;\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Help_General\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = Math.Max(n*((m + 2)/3), m*((n + 2)/3));\n\n max = Math.Max(max, C2(n)*C2(m));\n\n if (n == 3 && m > 4 && (m%3 == 0 || m%3 == 2))\n max = Math.Max(max, 2 + n*((m + 2)/3));\n\n if (m == 3 && n > 4 && (n%3 == 0 || n%3 == 2))\n max = Math.Max(max, 2 + m*((n + 2)/3));\n\n writer.WriteLine(max);\n writer.Flush();\n }\n\n private static int C2(int n)\n {\n if (n%4 == 1)\n {\n return 2*((n + 2)/4) + 1;\n }\n return 2*((n + 2)/4);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Help_General\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = Math.Max(n*((m + 3)/4), m*((n + 3)/4));\n\n max = Math.Max(max, C2(n)*C2(m));\n\n writer.WriteLine(max);\n writer.Flush();\n }\n\n static int C2(int n)\n {\n if (n % 4 == 1)\n {\n return 2*((n + 2)/4) + 1;\n }\n return 2*((n + 2)/4);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Help_General\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = m*n/2;\n if (n%2 == 1 && m%2 == 1)\n {\n max++;\n }\n\n max = Math.Max(max, n*((m + 2)/3));\n max = Math.Max(max, n*((m + 2)/3));\n\n max = Math.Max(max, C2(n)*C2(m));\n\n if (n == 3 && m > 4 && (m%3 == 0 || m%3 == 2))\n max = Math.Max(max, 2 + n*((m + 2)/3));\n\n if (m == 3 && n > 4 && (n%3 == 0 || n%3 == 2))\n max = Math.Max(max, 2 + m*((n + 2)/3));\n\n writer.WriteLine(max);\n writer.Flush();\n }\n\n private static int C2(int n)\n {\n if (n%4 == 1)\n {\n return 2*((n + 2)/4) + 1;\n }\n return 2*((n + 2)/4);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Help_General\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = Math.Max(n*((m + 4)/4), m*((n + 4)/4));\n\n max = Math.Max(max, C2(n)*C2(m));\n\n writer.WriteLine(max);\n writer.Flush();\n }\n\n static int C2(int n)\n {\n if (n % 4 == 1)\n {\n return 2*((n + 2)/4) + 1;\n }\n return 2*((n + 2)/4);\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int a = ab[0];\n int b = ab[1];\n\n if (a > b)\n {\n int t = a;\n a = b;\n b = t;\n }\n\n int r1 = a * ((b-1) / 3+1);\n int r2 = ((a-1) / 3 + 1) * b;\n\n int r3 = a * b / 2 + ((a * b) % 2 == 0 ? 0 : 1);\n\n int res = Math.Max(Math.Max(r1, r2), r3);\n\n if (a == 2)\n {\n if (b % 4 == 1)\n {\n res = b / 4 * 4 + 2;\n }\n else if (b % 4 == 2)\n {\n res = b / 4 * 4 + 4;\n }\n }\n outstream.WriteLine(res);\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int a = ab[0];\n int b = ab[1];\n\n int r1 = a * ((b-1) / 3+1);\n int r2 = ((a-1) / 3 + 1) * b;\n\n int res = Math.Max(r1, r2);\n outstream.WriteLine(res);\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\npublic class taskB\n{\n public class MyReader\n {\n private TextReader instream;\n\n public int[] ReadIntArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n int[] a = new int[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = int.Parse(spl[i]);\n return a;\n }\n\n public long[] ReadLongArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n long[] a = new long[spl.Length];\n for (int i = 0; i < a.Length; i++)\n a[i] = long.Parse(spl[i]);\n return a;\n }\n\n public double[] ReadDoubleArray()\n {\n string inp = instream.ReadLine().Trim();\n string[] spl = inp.Split(' ');\n\n double[] a = new double[spl.Length];\n\n System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();\n nfi.NumberDecimalSeparator = \".\";\n for (int i = 0; i < a.Length; i++)\n a[i] = double.Parse(spl[i], nfi);\n return a;\n }\n\n public int ReadInt()\n {\n return int.Parse(instream.ReadLine());\n }\n\n public long ReadLong()\n {\n return long.Parse(instream.ReadLine());\n }\n\n public void SetInStream(TextReader textReader)\n {\n this.instream = textReader;\n }\n\n internal string ReadLine()\n {\n return instream.ReadLine();\n }\n }\n\n static void Main(string[] args)\n {\n MyReader instream = new MyReader();\n instream.SetInStream(Console.In);\n\n TextWriter outstream = Console.Out;\n\n solve(instream, outstream);\n\n }\n\n private static void solve(MyReader instream, TextWriter outstream)\n {\n int[] ab = instream.ReadIntArray();\n\n int a = ab[0];\n int b = ab[1];\n\n int r1 = a * ((b-1) / 3+1);\n int r2 = ((a-1) / 3 + 1) * b;\n\n int r3 = a * b / 2 + ((a * b) % 2 == 0 ? 0 : 1);\n\n int res = Math.Max(Math.Max(r1, r2), r3);\n outstream.WriteLine(res);\n }\n\n}"}], "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int[] g = new int[52]{4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n int o = int.Parse(Console.ReadLine());\n Console.WriteLine(g[o-1]);\n \n \n \n }\n }\n \n \n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.CodeDom;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n var array = new[]\n {\n 0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,\n 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852,\n 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165\n };\n result = array[n];\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n static int[] njujm = new []{ 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165 };\n \n private static int Get(int u)\n {\n var number = u;\n number--; return njujm[number];\n throw new Exception();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n string s = \"4 22 27 58 85 94 121 166 202 265 274 319 346 355 378 382 391 438 454 483 517 526 535 562 576 588 627 634 636 645 648\";\n Console.WriteLine(s.Split()[a-1]);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n long[] arr = { 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165 };\n int s = int.Parse(Console.ReadLine());\n Console.Write(arr[s - 1]);\n Console.Read();\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class A\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n \n int[] arr = new int[30]{4, 22, 27, 58, 85, 94, 121, 166,\n 202, 265, 274, 319, 346, 355, 378, 382,\n 391, 438, 454, 483, 517, 526, 535, 562, 576,\n 588, 627, 634, 636, 645\n };\n Console.WriteLine(arr[a-1]);\n \n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace new_bus_route\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine())-1;\n string s = \"4 22 27 58 85 94 121 166 202 265 274 319 346 355 378 382 391 438 454 483 517 526 535 562 576 588 627 634 636 645 648\";\n Console.WriteLine(s.Split()[a]);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n var m = new int[] { 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165 };\n return m[n - 1];\n\n\n if (n == 1)\n return 4; // 2*2\n\n if (n == 2)\n return 22; //2*11\n\n if (n == 3)\n return 27; //3*3*3\n\n if (n == 4)\n return 58; //2*29\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n //if (n == 4)\n {\n Console.Write(SolveA(n));\n //return;\n }\n\n //while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(\n new[]\n {\n 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728,\n 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165\n }[n - 1]);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Numbers_Joke\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] array = new int[]{\n 4, 22, 27, 58, 85,\n 94, 121, 166, 202, 265,\n\n 274, 319, 346, 355, 378,\n 382, 391, 438, 454, 483,\n\n 517, 526, 535, 562, 576,\n 588, 627, 634, 636, 645 };\n\n int digit = Convert.ToInt32(Console.ReadLine());\n if (digit >= 0 && digit <= 30)\n {\n Console.WriteLine(array[digit-1]);\n } \n\n }\n }\n}"}, {"source_code": "using System;\nnamespace _784A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()) - 1;\n int[] a = new[] { 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706 };\n Console.WriteLine(a[n]);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace Numbers_Joke\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int digit = Convert.ToInt32(Console.ReadLine());\n if (digit >= 0 && digit <= 30)\n // if (digit == 3)\n Console.WriteLine((30 - digit).ToString());\n else\n Console.WriteLine(); \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 44;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 29;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(27);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(11);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 37;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine((n + 24)%31);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"23\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(BigInteger.Pow(n, n));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 23;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(9);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 16;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 3;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class A\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n \n Console.WriteLine(a*9);\n }\n\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(30-a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(3);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 23;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(10);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(Math.Pow(3,n));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n if (n == 3)\n {\n result = 27;\n }\n if (n == 1)\n {\n result = 4;\n }\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 2;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 17;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n if (n == 3)\n {\n result = 27;\n }\n if (n == 2)\n {\n throw new Exception(n.ToString());\n }\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n if (n == 3)\n {\n result = 27;\n }\n if (n == 2)\n {\n throw new Exception(n.ToString());\n }\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 32;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace Numbers_Joke\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int digit = Convert.ToInt32(Console.ReadLine());\n if (digit >= 0 && digit <= 30)\n // if (digit == 3)\n Console.WriteLine((30 - digit).ToString());\n else\n Console.WriteLine(); \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(29);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n while (n > 3) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 46;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(BigInteger.Pow(n, n));\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(21);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(a*9);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(19);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 54;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(8);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 6;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 47;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 18;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(number * number * number);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 8;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(1);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 55;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 42;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(30-a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 43;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(17);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n if (n == 3)\n {\n result = 27;\n }\n if (n == 1)\n {\n result = 4;\n }\n\n if (n == 2)\n {\n result = 16;\n }\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 33;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(3);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int abc = int.Parse(Console.ReadLine());\n //var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(abc*9);\n \n \n \n }\n }\n \n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(21);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\n\nnamespace _784A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Pow(a, a));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n var ans = new BigInteger(1);\n for (int i = 0; i < n; i++)\n ans *= n;\n\n Console.Write(ans);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Numerics;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(\"27\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 41;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(a*a*3);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(n == 3 ? 27 : 42);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _1B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int abc = int.Parse(Console.ReadLine());\n //var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n Console.WriteLine(Math.Pow(abc,abc));\n \n \n \n }\n }\n \n \n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 54;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n var result = 0;\n\n if (n == 3)\n {\n result = 27;\n }\n if (n == 1)\n {\n result = 1;\n }\n\n Console.WriteLine(result);\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 43;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(9*n);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 12;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n Console.WriteLine(a*a*a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 44;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 21;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 41;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n int s = int.Parse(Console.ReadLine());\n Console.Write(s-1);\n Console.Write((s - 1) * 2+s);\n Console.Read();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(Math.Pow(3, a));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(n*n*n);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n int s = int.Parse(Console.ReadLine());\n Console.Write(3 * Math.Pow(s, 2));\n Console.Read();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 6;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number > 4)\n throw new Exception();\n return 0;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(16);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(19);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 46;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(7);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n var ans = new BigInteger(1);\n for (int i = 0; i < n; i++)\n ans *= 3;\n\n Console.Write(ans);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\n static void Main(String[] args)\n {\n int s = int.Parse(Console.ReadLine());\n Console.Write(s-1);\n Console.Write(Math.Pow(s - 1,2) +s);\n Console.Read();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nnamespace ConsoleApplication3\n{\n class Program\n {\n // FEDCBA9876543210\n // 0010211201010001\n // 543210\n\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n Console.WriteLine(Math.Pow(3, n));\n\n //if (n == 0)\n //{\n // Console.WriteLine(\"1\");\n // return;\n //}\n //var r = 0;\n\n //while (n > 0)\n //{\n // switch (n % 16)\n // {\n // case 0:\n // case 4:\n // case 6:\n // case 9:\n // case 10:\n // case 13:\n // r++;\n // break;\n // case 8:\n // case 11:\n // r += 2;\n // break;\n // }\n\n // n /= 16;\n //}\n //Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(1);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 36;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(30 - n);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(23);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 36;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(20);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 60;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 60;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(1);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Numbers_Joke\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n writer.WriteLine(30 - n);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 10;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(23);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var number = int.Parse(Console.ReadLine());\n Console.WriteLine(Get(number));\n }\n\n private static int Get(int u)\n {\n var number = u;\n if (number == 3)\n return 27;\n if (number == 1)\n return 4;\n if (number == 2)\n return 9;\n throw new Exception();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 38;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1Bagaeva\n{\n class Program\n {\n static void Main(string[] args)\n {\n ulong a = ulong.Parse(Console.ReadLine());\n \n Console.WriteLine(Math.Pow(3, a));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n != 3)\n {\n if (n == 1)\n {\n Console.Write(4);\n return;\n }\n\n if (n == 2)\n {\n Console.Write(11);\n return;\n }\n\n while (true) ;\n }\n\n Console.Write(27);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static void Main(string[] args)\n {\n int n = RI();\n /* var ans = new BigInteger(1);\n for (int i = 0; i < n; i++)\n ans *= 3;*/\n\n Console.Write(30 - n);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\nclass Program\n{\n public class SkipListItem\n {\n public int Value;\n\n public SkipListItem Next;\n public SkipListItem Below;\n\n public SkipListItem AddNext(int x, SkipListItem below)\n {\n var newNode = new SkipListItem()\n {\n Value = x,\n Next = this.Next,\n Below = below\n };\n\n this.Next = newNode;\n\n return newNode;\n }\n }\n\n\n public class SkipList\n {\n private static Random rnd = new Random();\n\n public SkipList(int capacity)\n {\n this.Root = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n var t = this.Root;\n while (capacity > 0)\n {\n capacity /= 2;\n t.Below = new SkipListItem()\n {\n Value = int.MinValue\n };\n\n t = t.Below;\n }\n\n }\n\n private SkipListItem Root;\n public void Add(int x)\n {\n var t = this.Root;\n\n var stack = new List();\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Below == null)\n {\n if (t.Next != null && t.Next.Value == x)\n {\n // Already exists\n return;\n }\n\n t = t.AddNext(x, null);\n for (int i = stack.Count - 1; i >= 0; i--)\n {\n if (rnd.Next(2) == 1) break;\n t = stack[i].AddNext(x, t);\n }\n\n return;\n }\n\n stack.Add(t);\n t = t.Below;\n }\n }\n\n public bool Contains(int x)\n {\n var t = this.Root;\n if (t.Value == x) return true;\n\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n if (t.Next != null && t.Next.Value == x)\n return true;\n\n if (t.Below == null)\n {\n return false;\n }\n\n t = t.Below;\n }\n }\n\n\n public int GetFirstEqualsOrGreater(int x)\n {\n var t = this.Root;\n while (true)\n {\n while (t.Next != null && t.Next.Value < x) t = t.Next;\n\n if (t.Below == null)\n {\n if (t.Next != null)\n return t.Next.Value;\n\n return int.MinValue;\n }\n\n t = t.Below;\n }\n }\n }\n\n\n private static int SolveA(int n)\n {\n if (n == 1)\n return 4;\n\n if (n == 2)\n return 22;\n\n if (n == 3)\n return 27;\n\n if (n == 4)\n return 51;\n\n\n return -1;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n if (n <= 3)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n if (n == 4)\n {\n Console.Write(SolveA(n));\n return;\n }\n\n while (true) ;\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}"}], "src_uid": "bf65a25185e9ea5b71e853723b838b04"} {"source_code": "using System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\n\npublic static partial class Program\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tlong[] vars = ParseArray();\n\t\tlong a = vars[0];\n\t\tlong b = vars[1];\n\t\tConsole.WriteLine(Function(a, b));\n\n#if DEBUG\n\t\tConsole.ReadLine();\n#endif\n\t}\n\n\tpublic static long Function(long a, long b)\n\t{\n\t\tlong rv = 0;\n\n\t\tfor (int i = 1; i < 64; i++)\n\t\t{\n\t\t\tBitArray bits = new BitArray(i);\n\t\t\tbits.Not();\n\n\t\t\tfor (int j = 0; j < bits.Count - 1; j++)\n\t\t\t{\n\t\t\t\tbits[j] = false;\n\t\t\t\tlong x = GetIntFromBitArray(bits);\n\n\t\t\t\tif (x >= a && x <= b)\n\t\t\t\t{\n\t\t\t\t\trv += 1;\n\t\t\t\t}\n\n\t\t\t\tbits[j] = true;\n\t\t\t}\n\t\t}\n\n\t\treturn rv;\n\t}\n\n\tpublic static long GetIntFromBitArray(BitArray bitArray)\n\t{\n\t\tlong value = 0;\n\n\t\tfor (int i = 0; i < bitArray.Count; i++)\n\t\t{\n\t\t\tif (bitArray[i])\n\t\t\t{\n\t\t\t\tvalue += Convert.ToInt64(Math.Pow(2, i));\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t}\n}\n\npublic static partial class Program\n{\n\tpublic static T[] ParseArray()\n\t{\n\t\tTypeConverter tc = TypeDescriptor.GetConverter(typeof(T));\n\t\tstring[] input = Console.ReadLine().Split();\n\t\tT[] output = new T[input.Length];\n\t\tfor (long i = 0; i < input.Length; i++) { output[i] = (T)tc.ConvertFromString(input[i]); }\n\t\treturn output;\n\t}\n\n\tpublic static T[][] ParseMatrix(long nrows)\n\t{\n\t\tT[][] rv = new T[nrows][];\n\t\tfor (long i = 0; i < nrows; i++) { rv[i] = ParseArray(); }\n\t\treturn rv;\n\t}\n}\n", "positive_code": [{"source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(new char[] { 't', '\\r', '\\n', ' ' }, StringSplitOptions.RemoveEmptyEntries);\n Console.WriteLine((ZeroCounter(Convert.ToString(long.Parse(input[1]), 2))- ZeroCounter(Convert.ToString((long.Parse(input[0])-1l), 2))));\n }\n private static long ZeroCounter(string number)\n {\n long result = (number.Length - 2) * (number.Length - 1) / 2;\n int index = number.IndexOf('0', 1);\n if (index == -1) result += (number.Length - 1);\n else\n {\n result += index;\n index = number.IndexOf('0', index + 1);\n if (index > 0) result--;\n }\n return result;\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n long a = long.Parse(line[0]);\n long b = long.Parse(line[1]);\n long S, ans = 0;\n for (int i = 62; i >= 0; i--)\n {\n S = 0;\n for (int j = i - 1; j >= 0; j--)\n S += 1L << j;\n for (int j = i + 1; j < 64; j++)\n {\n S += 1L << j;\n if (a <= S && S <= b)\n ans++;\n }\n }\n Console.Write(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing SB = System.Text.StringBuilder;\nusing Number = System.Int64;\nusing System.Numerics;\nusing static System.Math;\n//using static MathEx;\nnamespace Program\n{\n public class Solver\n {\n public void Solve()\n {\n var a = rl;\n var b = rl;\n IO.Printer.Out.WriteLine(f(b) - f(a - 1));\n }\n long f(long n)\n {\n var ret = 0L;\n for (int i = 0; i < 62; i++)\n {\n var v = (1L << (i + 1)) - 1;\n for (int j = 0; j < i; j++)\n {\n if (v - (1L << j) <= n)\n {\n Debug.WriteLine(v - (1L << j));\n ret++;\n }\n }\n }\n\n return ret;\n }\n\n int ri => sc.Integer();\n long rl => sc.Long();\n double rd => sc.Double();\n string rs => sc.Scan();\n char rc => sc.Char();\n\n [System.Diagnostics.Conditional(\"DEBUG\")]\n void put(params object[] a) => Debug.WriteLine(string.Join(\" \", a));\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer: StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nusing Number = System.Int64;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long() - 1;\n var b = sc.Long();\n var B = f(b);\n var A = f(a);\n Debug.WriteLine(A);\n Debug.WriteLine(B);\n IO.Printer.Out.WriteLine(f(b) - f(a));\n }\n public long f(long v)\n {\n if (v == 0) return 1;\n\n var h = 0;\n for (int i = 0; i < 60; i++)\n if ((v >> i & 1) == 1) h = i;\n\n var dp = new long[3, 2];\n dp[0, 1] = 1;\n dp[1, 0] = 1;\n for (int i = h - 1; i >= 0; i--)\n {\n var next = new long[3, 2];\n\n if ((v >> i & 1) == 1)\n {\n next[0, 1] += dp[0, 1];\n next[1, 1] += dp[1, 1];\n next[1, 0] += dp[0, 1];\n }\n else\n {\n next[1, 1] += dp[0, 1];\n }\n next[0, 0] += 1;\n next[0, 0] += dp[0, 0];\n next[1, 0] += dp[0, 0];\n next[1, 0] += dp[1, 0];\n dp = next;\n }\n\n\n\n return dp[1, 0] + dp[1, 1];\n }\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(Scan(), CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]);\n long b = long.Parse(s[1]);\n long ans = 0;\n char[] ch = new char[62];\n for (int i = 0; i < 62; i++)\n ch[i] = '1'; \n for (int q = 0; q < 62; q++)\n {\n ch[q] = '0';\n for (int i = q + 2; i < 62; i++)\n {\n ch[i] = '0';\n string number = \"\";\n for (int j = 0; j < 62; j++)\n number += ch[j];\n ch[i] = '1';\n long decimalNumber = Convert.ToInt64(number, 2);\n if ((decimalNumber >= a) && (decimalNumber <= b))\n ans++;\n }\n }\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program{\n\tstatic void Main(string[] args){\n\t\tstring[] tokens = Console.ReadLine().Split();\n\t\tulong start = ulong.Parse(tokens[0]), end = ulong.Parse(tokens[1]);\n\t\t// Console.WriteLine(\"{0}, {1}\", Convert(start), Convert(end));\n\t\tConsole.WriteLine(Count(start, end));\n\t}\n\tstatic string Convert(ulong num){\n\t\tstring ans = \"\";\n\t\tif(num == 0){\n\t\t\treturn \"0\";\n\t\t}\n\t\twhile(num > 0){\n\t\t\tif(num % 2 == 0){\n\t\t\t\tans = \"0\" + ans;\n\t\t\t}else{\n\t\t\t\tans = \"1\" + ans;\n\t\t\t}\n\t\t\tnum = (ulong) num / 2;\n\t\t}\n\t\treturn ans;\n\t}\n\tstatic ulong Count(ulong start, ulong end){\n\t\tstring s = Convert(start), e = Convert(end);\n\t\tint i = 0;\n\t\t\n\t\tulong left;\n\t\tfor(i = 0; i < s.Length; ++i){\n\t\t\tif(s[i] == '0'){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tleft = (ulong) (s.Length - i);\n\n\t\tulong right;\n\t\tfor(i = 0; i < e.Length; ++i){\n\t\t\tif(e[i] == '0'){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tright = (ulong) (i - 1);\n\t\tfor(i += 1; i < e.Length; ++i){\n\t\t\tif(e[i] == '0'){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(i == e.Length){\n\t\t\tright++;\n\t\t}\n\n\t\tif(s.Length == e.Length){\n\t\t\treturn right + left + 1 - (ulong) s.Length;\n\t\t}else{\n\t\t\tulong middle = 0;\n\t\t\tfor(i = s.Length + 1; i < e.Length; ++i){\n\t\t\t\tmiddle = middle + (ulong) i - 1;\n\t\t\t}\n\t\t\treturn left + middle + right;\t\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Numerics;\nusing Enu = System.Linq.Enumerable;\n\nclass Program\n{\n public void Solve()\n {\n long A = Reader.Long(), B = Reader.Long();\n Func Count = N =>\n {\n int count = 0;\n for (int len = 2; len <= 62; len++)\n for (int bitAt = 0; bitAt < len - 1; bitAt++)\n {\n long x = (1L << len) - 1 & ~(1L << bitAt);\n if (x <= N) count++;\n }\n return count;\n };\n\n Console.WriteLine(Count(B) - Count(A - 1));\n }\n}\n\n\nclass Entry { static void Main() { new Program().Solve(); } }\nclass Reader\n{\n private static TextReader reader = Console.In;\n private static readonly char[] separator = { ' ' };\n private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;\n private static string[] A = new string[0];\n private static int i;\n private static void Init() { A = new string[0]; }\n public static void Set(TextReader r) { reader = r; Init(); }\n public static void Set(string file) { reader = new StreamReader(file); Init(); }\n public static bool HasNext() { return CheckNext(); }\n public static string String() { return Next(); }\n public static int Int() { return int.Parse(Next()); }\n public static long Long() { return long.Parse(Next()); }\n public static double Double() { return double.Parse(Next()); }\n public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }\n public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }\n public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }\n public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }\n public static string Line() { return reader.ReadLine().Trim(); }\n private static string[] Split(string s) { return s.Split(separator, op); }\n private static string Next() { CheckNext(); return A[i++]; }\n private static bool CheckNext()\n {\n if (i < A.Length) return true;\n string line = reader.ReadLine();\n if (line == null) return false;\n if (line == \"\") return CheckNext();\n A = Split(line);\n i = 0;\n return true;\n }\n}"}, {"source_code": "using System;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n public void Solve()\n {\n string[] input = Console.ReadLine().Split();\n long a = long.Parse(input[0]);\n long b = long.Parse(input[1]);\n int c = 0;\n for (int i = 1; i < 64; i++)\n {\n long n = (1L << i) - 1;\n for (int j = 0; j < i - 1; j++)\n {\n long m = 1L << j;\n long x = n - m;\n if (a <= x && x <= b)\n ++c;\n }\n }\n Console.Write(c);\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver();\n solver.Solve();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n static class Program\n {\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n long[] temps = temp.Split(new[] { \" \" }, StringSplitOptions.None).Select(long.Parse).ToArray();\n string s1 = Convert.ToString(temps[0], 2);\n string s2 = Convert.ToString(temps[1], 2);\n s1 = FindNext(s1);\n s2 = FindPrev(s2);\n Console.WriteLine(Count(s1, s2));\n }\n\n static int Count(string s1, string s2)\n {\n long l1 = Convert.ToInt64(s1, 2);\n long l2 = Convert.ToInt64(s2, 2);\n if (l1 > l2) return 0;\n if (l1 == l2) return 1;\n\n int total = 0;\n int iS = s1.Length;\n int iE = s2.Length;\n int i1 = s1.IndexOf(\"0\");\n int i2 = s2.IndexOf(\"0\");\n if (iS == iE) return i2 - i1 + 1;\n total += iS - i1;\n total += i2;\n for (int i = iS + 1; i < iE; i++) total += i - 1;\n return total;\n }\n\n static string FindNext(string s)\n {\n string t;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n t = s.Remove(index + 1);\n for (int i = index + 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n t = \"10\";\n for (int i = 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n\n static string FindPrev(string s)\n {\n if (s.Equals(\"1\")) return \"1\";\n if (s.Equals(\"10\")) return \"10\";\n string t = null;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n for (int i = 0; i < index - 1; i++) t += \"1\";\n t += \"0\";\n for (int i = index; i < s.Length; i++) t += \"1\";\n return t;\n }\n t = s.Remove(s.Length - 1) + \"0\";\n return t;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Beresta\n{\n\n\tclass ContestIO : StreamWriter\n\t{\n\t\tpublic ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }\n\t\t//d.ToString(\"N12\", CultureInfo.InvariantCulture).Replace(\",\", \"\")\n\t\tpublic StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);\n\t\tbool IsDigit(long c) { return c >= '0' && c <= '9'; }\n\n\t\tpublic long Read()\n\t\t{\n\t\t\tlong c1 = 0, c;\n\t\t\twhile (!IsDigit(c = Reader.Read())) { c1 = c; }\n\t\t\tlong r = c - '0';\n\t\t\twhile (IsDigit(c = Reader.Read()))\n\t\t\t\tr = r * 10 + c - '0';\n\t\t\treturn c1 == '-' ? -r : r;\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var io = new ContestIO())\n\t\t\t{\n\t\t\t\tvar a = io.Read();\n\t\t\t\tvar b = io.Read();\n\n\t\t\t\tvar s2 = Convert.ToString(a, 2);\n\t\t\t\tvar e2 = Convert.ToString(b, 2);\n\n\t\t\t\tvar ind = s2.IndexOf('0');\n\t\t\t\tvar pos = 0;\n\t\t\t\tvar len = 0;\n\t\t\t\tif(ind > -1)\n\t\t\t\t{\n\t\t\t\t\ts2 = s2.Substring(0, ind + 1).PadRight(s2.Length, '1');\n\t\t\t\t\ta = Convert.ToInt64(s2, 2);\n\n\t\t\t\t\tlen = s2.Length;\n\t\t\t\t\tpos = ind;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlen = s2.Length + 1;\n\t\t\t\t\tpos = 1;\n\t\t\t\t}\n\n\t\t\t\tvar count = 0L;\n\t\t\t\twhile (true)\n\t\t\t\t{\n\t\t\t\t\ta = GetNum(len, pos);\n\t\t\t\t\tif (a <= b)\n\t\t\t\t\t\tcount++;\n\t\t\t\t\telse\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tpos++;\n\t\t\t\t\tif (pos == len)\n\t\t\t\t\t{\n\t\t\t\t\t\tpos = 1;\n\t\t\t\t\t\tlen++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tio.WriteLine(count);\n\t\t\t}\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t\tstatic long GetNum(int len, int pos)\n\t\t{\n\t\t\treturn ((1L << len) - 1L) & ~(1L << (len - pos - 1));\n\t\t}\n\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Beresta\n{\n\n\tclass ContestIO : StreamWriter\n\t{\n\t\tpublic ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }\n\t\t//d.ToString(\"N12\", CultureInfo.InvariantCulture).Replace(\",\", \"\")\n\t\tpublic StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);\n\t\tbool IsDigit(long c) { return c >= '0' && c <= '9'; }\n\n\t\tpublic long Read()\n\t\t{\n\t\t\tlong c1 = 0, c;\n\t\t\twhile (!IsDigit(c = Reader.Read())) { c1 = c; }\n\t\t\tlong r = c - '0';\n\t\t\twhile (IsDigit(c = Reader.Read()))\n\t\t\t\tr = r * 10 + c - '0';\n\t\t\treturn c1 == '-' ? -r : r;\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var io = new ContestIO())\n\t\t\t{\n\t\t\t\tvar a = io.Read();\n\t\t\t\tvar b = io.Read();\n\n\t\t\t\tvar count = 0L;\n\t\t\t\tvar v = 1L;\n\t\t\t\tfor (var i = 1; i <= 100; i++)\n\t\t\t\t{\n\t\t\t\t\tv |= 1L << i;\n\t\t\t\t\tvar v1 = v - 1;\n\t\t\t\t\tfor (var j = 0; j < i; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (v1 >= a && v1 <= b)\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tv1 = ((v1 << 1) & v) | 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (v > b)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tio.WriteLine(count);\n\t\t\t}\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t}\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace New_Year_and_Old_Property\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static IEnumerable List()\n {\n long l = long.MaxValue;\n\n while (l > 1)\n {\n long next = l >> 1;\n long i = 1;\n\n while (i <= next)\n {\n yield return l ^ i;\n i <<= 1;\n }\n\n l = next;\n }\n }\n\n private static void Main(string[] args)\n {\n long a = Next();\n long b = Next();\n\n writer.WriteLine(List().Count(l => l >= a && l <= b));\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_and_Old_Property\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n long a = Next();\n long b = Next();\n\n\n int count = 0;\n\n string sa = Convert.ToString(a, 2);\n string sb = Convert.ToString(b, 2);\n\n for (int i = sa.Length; i <= sb.Length; i++)\n {\n for (int j = 0; j < i-1; j++)\n {\n string sx = new string('1', i - j - 1) + \"0\" + new string('1', j);\n long x = Convert.ToInt64(sx, 2);\n if (x >= a && x <= b)\n count++;\n }\n }\n\n writer.WriteLine(count);\n writer.Flush();\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _611B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]), b = long.Parse(input[1]);\n\n int result = 0;\n var hashset = new HashSet();\n for (int power = 1; power < 64; power++)\n {\n long x = (1L << power) - 1;\n for (int i = 0; i <= power - 2; i++)\n {\n long y = x - (1L << i);\n if (y >= a && y <= b && !hashset.Contains(y))\n {\n result++;\n hashset.Add(y);\n }\n }\n }\n\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nnamespace codeforces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tstring[] s = Console.ReadLine ().Split (' ');\n\t\t\tlong a = long.Parse (s [0]);\n\t\t\tlong b = long.Parse (s [1]);\n\n\t\t\tlong A = a, B = b;\n\t\t\tint m = 0, n = 0;\n\t\t\twhile (A!=0) {\n\t\t\t\tm++;\n\t\t\t\tA/=2;\n\t\t\t}\n\t\t\twhile (B!=0) {\n\t\t\t\tn++;\n\t\t\t\tB/=2;\n\t\t\t}\n\t\t\tint Q_m = 0, Q_n = 0;\n\t\t\tfor (int i = 1; i <=m-2; i++) \n\t\t\t\tQ_m += i;\n\t\t\tlong S1 = (long)Math.Pow (2, m) - 1;\n\t\t\tfor (int i = 1; i <=m-1; i++) {\n\t\t\t\tif (S1 - (long)Math.Pow (2, m - i - 1) < a)\n\t\t\t\t\tQ_m++;\n\t\t\t\telse\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor (int i = 1; i <=n-2; i++) \n\t\t\t\tQ_n += i;\n\t\t\tlong S2 = (long)Math.Pow (2, n) - 1;\n\t\t\tfor (int i = 1; i <=n-1; i++) {\n\t\t\t\tif (S2 - (long)Math.Pow (2, n - i - 1) <= b)\n\t\t\t\t\tQ_n++;\n\t\t\t\telse\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tConsole.WriteLine (Q_n-Q_m);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nnamespace gb16_2\n{\n\tclass Program\n\t{\n\t\tstatic string _inputFilename = \"in.txt\";\n\t\tstatic string _outputFilename = \"out.txt\";\n\t\tstatic bool _useFileInput = false;\n\n\t\tstatic int n;\n\t\tstatic int m;\n\n\t\tstatic int[] a;\n\t\tstatic int[] b;\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tStreamWriter file = null;\n\t\t\tif (_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(File.OpenText(_inputFilename));\n\t\t\t\tfile = new StreamWriter(_outputFilename);\n\t\t\t\tConsole.SetOut(file);\n\t\t\t}\n\n#if DEBUG\n\t\t\tif (!_useFileInput)\n\t\t\t{\n\t\t\t\tConsole.SetIn(getInput());\n\t\t\t}\n#endif\n\n\t\t\t#region SOLUTION\n\t\t\tvar d = readLongArray();\n\t\t\tvar f = d[0];\n\t\t\tvar s = d[1];\n\n\t\t\tvar fc = getCount(f, false);\n\t\t\tvar sc = getCount(s, true);\n\n\t\t\tvar res = sc - fc;\n\t\t\tConsole.WriteLine(res);\n\n\t\t\t//n = readInt();\n\t\t\t//m = readInt();\n\n\t\t\t//a = readIntArray();\n\t\t\t//b = readIntArray();\n\t\t\t#endregion\n\n\t\t\tif (_useFileInput)\n\t\t\t{\n\t\t\t\tfile.Close();\n\t\t\t}\n\t\t}\n\n\t\tstatic int getCount(long f, bool include)\n\t\t{\n\t\t\tvar fa = new long[65];\n\t\t\tfor (int i = 0; i < 65; i++)\n\t\t\t{\n\t\t\t\tfa[i] = -1;\n\t\t\t}\n\n\t\t\tvar j = 0;\n\t\t\tvar zc = 0;\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (f == 0)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tvar r = f % 2;\n\t\t\t\tfa[j] = r;\n\t\t\t\tif (r == 0)\n\t\t\t\t{\n\t\t\t\t\tzc++;\n\t\t\t\t}\n\t\t\t\tf = f / 2;\n\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\tvar bar = -1;\n\t\t\tfor (int i = j - 1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tif (fa[i] == 0)\n\t\t\t\t{\n\t\t\t\t\tbar = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar sc = 0;\n\t\t\tif (zc == 1 && include)\n\t\t\t{\n\t\t\t\tsc++;\n\t\t\t}\n\n\t\t\tif (bar == -1)\n\t\t\t{\n\t\t\t\tsc += j - 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsc += j - 1 - (bar + 1);\n\t\t\t}\n\n\t\t\tsc += (j - 2) * (j - 1) / 2;\n\t\t\treturn sc;\n\t\t}\n\n\t\tstatic int readInt()\n\t\t{\n\t\t\treturn int.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic long readLong()\n\t\t{\n\t\t\treturn long.Parse(Console.ReadLine());\n\t\t}\n\n\t\tstatic int[] readIntArray()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n\t\t}\n\n\t\tstatic long[] readLongArray()\n\t\t{\n\t\t\treturn Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n\t\t}\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]), b = long.Parse(s[1]);\n int p1 = 0;\n int ans = 0;\n long[] pow = new long[62];\n pow[0] = 1;\n for (int i = 1; i <= 61; i++) {\n pow[i] = 2 * pow[i - 1];\n }\n while (p1 <= 60) {\n p1++;\n for (int p2 = 0; p2 < p1 - 1; p2++) {\n long nr = pow[p1] - 1 - pow[p2];\n if (nr >= a && nr <= b) {\n //Console.WriteLine(\"{0} {1} {2}\",nr,n,p2);\n ans++;\n }\n }\n }\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint cnt=0;\n\t\tint mb=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((b>>j)>0){mb=j;break;}\n\t\t}\n\t\tint ma=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((a>>j)>0){ma=j;break;}\n\t\t}\n\t\t\n\t\tfor(int j=ma;j<=mb;j++){\n//Console.WriteLine(\"j=\"+j);\n\t\t\tlong x=0;\n\t\t\tfor(int i=0;i<=j;i++){x|=(1L<int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace goodbye2015\n{\n class Program\n {\n static UInt64 YesNo(UInt64 n)\n {\n if (n == 2) return 1;\n UInt64 step = 1;\n UInt64 kol = 0, ans = 0;\n while (step * 2 < n)\n {\n step *= 2;\n kol++;\n ans += (kol - 1);\n }\n step = 2 * step - 1;\n UInt64 newstep = 1;\n for (UInt64 i = 0; i < kol; i++)\n {\n if (step - newstep <= n) ans++;\n newstep *= 2;\n }\n return ans;\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n UInt64 a = Convert.ToUInt64(s[0]);\n UInt64 b = Convert.ToUInt64(s[1]);\n UInt64 tmp = YesNo(a-1);\n UInt64 tmp1 = YesNo(b);\n Console.WriteLine(tmp1-tmp);\n \n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.GoodBye2015\n{\n class OldProperyB\n {\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n ulong a = ulong.Parse(line[0]), b = ulong.Parse(line[1]) + 1;\n int remA = NumOfRemaining(Convert.ToString((long)a, 2)), remB = NumOfRemaining(Convert.ToString((long)b, 2));\n Console.WriteLine(remA - remB);\n }\n public static int NumOfRemaining(string str)\n {\n int i;\n for (i = 0; i < str.Length; i++) if (str[i] == '0') break;\n string remaining = \"\";\n if (i < str.Length) remaining = str.Substring(i);\n int rem = remaining.Length;\n for (i = str.Length + 1; i < 62; i++) rem += i - 1;\n return rem;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class CF338_1\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(@\"D:\\Sergey\\Code\\1.txt\"));\n\n string strT = Console.ReadLine();\n string[] strParams = strT.Split(new char[] { ' ' });\n ulong a = ulong.Parse(strParams[0]);\n ulong b = ulong.Parse(strParams[1]);\n\n int i = 0;\n ulong s = 0;\n\n while ((s = (ulong)Math.Pow(2, i)) <= b)\n {\n i++;\n }\n\n s--;\n i -= 2 ;\n ulong r = 0;\n while (s > a)\n {\n for (int j = i; j >= 0; j--)\n {\n ulong t = (ulong)Math.Pow(2, j);\n t = s - t;\n if (t >= a && t <= b)\n r++;\n }\n s = s >> 1;\n i--;\n }\n\n Console.WriteLine(r.ToString());\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n long a = ReadLong();\n long b = ReadLong();\n \n int ans = 0;\n for (int n = 2; n < 61; n++)\n {\n long x = (1L << n) - 1;\n for (int j = 0; j + 1 < n; j++)\n {\n long y = x ^ 1L << j;\n if (y >= a && y <= b)\n ans++;\n }\n }\n\n Write(ans);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"duty.in\");\n //writer = new StreamWriter(\"duty.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n new Solver().Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] tokens = input.Split(' ');\n long a = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n\n Console.WriteLine(Cal(b) - Cal(a - 1));\n }\n\n static long Cal(long i)\n {\n long r = 0;\n\n if (i <= 1)\n {\n return 0;\n }\n\n long b = 1;\n long n = 0;\n while (i/2 >= b)\n {\n ++n;\n b *= 2;\n }\n\n r = n*(n - 1)/2;\n\n long d = b / 2 - 1;\n bool f = true;\n while (b + d <= i)\n {\n ++r;\n b += d;\n\n if (f)\n {\n ++d;\n f = false;\n }\n d /= 2;\n\n if (d == 0)\n {\n break;\n }\n }\n\n return r;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _611B\n {\n public static void Main()\n {\n string[] tokens = Console.ReadLine().Split();\n\n long a = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n\n int count = 0;\n\n for (int length = 1; length < 64; length++)\n {\n for (int i = length == 1 ? 0 : 1; i < length; i++)\n {\n char[] chars = Enumerable.Repeat('1', length).ToArray();\n chars[i] = '0';\n\n long n = Convert.ToInt64(new string(chars), 2);\n if (a <= n && n <= b)\n {\n count++;\n }\n }\n }\n\n Console.WriteLine(count);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\n\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string input;\n long numa,numb,count = 0;\n \n input = Console.ReadLine();\n\n string inputa = input.Split(' ')[0];\n string inputb = input.Split(' ')[1]; \n numa = Convert.ToInt64(inputa);\n numb = Convert.ToInt64(inputb);\n\n string low = Convert.ToString(numa, 2);\n string high = Convert.ToString(numb, 2);\n \n int lena = low.Length;\n int lenb = high.Length;\n \n StringBuilder temp = new StringBuilder();\n \n for(int i=0;i0;j--)\n {\n if(j!=i-1)\n temp[j+1] = '1';\n temp[j]='0';\n // Console.WriteLine(temp);\n long num = Convert.ToInt64(temp.ToString(),2);\n if(num>= numa && num <=numb)\n {\n /* int tempCount = 0;\n \n for(int k =0;k b)\n return;\n if (current >= a && current <= b && zeroCount == 1)\n result++;\n if (zeroCount == 0)\n {\n getResult(current * 2, zeroCount + 1);\n }\n getResult(current * 2 + 1, zeroCount);\n }\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n a = Convert.ToUInt64(input[0]);\n b = Convert.ToUInt64(input[1]);\n getResult(1, 0);\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace _2015B {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n ulong first = ulong.Parse(input[0]);\n ulong last = ulong.Parse(input[1]);\n int res = 0;\n ulong tmp = 0;\n string fS = DecimalToBinary(first);\n string lS = DecimalToBinary(last);\n\n for (int i = fS.Length; i <= lS.Length; i++)\n for (int j = 1; j < i; j++) {\n tmp = BuildTest(i, j);\n if (tmp <= last) {\n if (tmp >= first)\n res++;\n } else\n break;\n }\n\n Console.WriteLine(res);\n }\n\n static string DecimalToBinary(ulong data) {\n StringBuilder result = new StringBuilder();\n int rem = 0;\n while (data > 0) {\n rem = (int)(data % 2);\n data = data >> 1;\n result.Append(rem);\n }\n return ReverseString(result.ToString());\n }\n\n static string ReverseString(string s) {\n char[] arr = s.ToCharArray();\n Array.Reverse(arr);\n return new string(arr);\n }\n\n static ulong BuildTest(int length, int index) {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < length - 1; i++) {\n sb.Append('1');\n }\n sb.Insert(index, '0');\n return (BinToDec(sb.ToString()));\n }\n\n static ulong BinToDec(string value) {\n ulong res = 0;\n foreach (char c in value) {\n res <<= 1;\n res += (ulong)(c == '1' ? 1 : 0);\n }\n return res;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nclass Program\n{\n private static void Main(string[] args)\n {\n string s = Console.ReadLine();\n var arr = s.Split(' ');\n ulong n1 = ulong.Parse(arr[0]);\n ulong n2 = ulong.Parse(arr[1]);\n\n ulong sum = 0;\n\n ulong ulong1 = 1;\n for (int i = 2; i <= 63; i++)\n {\n ulong all1 = ulong1 << i;\n all1--;\n for (int j = 0; j < i - 1; j++)\n {\n ulong x = all1 ^ (ulong1 << j);\n if (n2 >= x && n1 <= x) sum++;\n }\n }\n\n Console.WriteLine(sum);\n }\n}\n\n/*\n\n*/\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Point\n\t\t{\n\t\t\tpublic int x;\n\n\t\t\tpublic double p;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c || (x.c == y.c && x.r < y.r))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\n\t\t\tvar s = GetString();\n\t\t\tvar x = long.Parse(s.Split(' ')[0]);\n\t\t\tvar y = long.Parse(s.Split(' ')[1]);\n\t\t\tvar ans = 0;\n\t\t\tlong p = 1;\n\t\t\twhile (p <= 2*y)\n\t\t\t{\n\t\t\t\tlong p1 = p - 1;\n\t\t\t\tlong q = 1;\n\t\t\t\twhile (p1 >= x && q * 2 < p)\n\t\t\t\t{\n\t\t\t\t\tif (p1 - q >= x && p1 - q <= y)\n\t\t\t\t\t\tans++;\n\t\t\t\t\tq *= 2;\n\t\t\t\t}\n\t\t\t\tp *= 2;\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _611B\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(decimal.Parse).ToArray();\n var a = s[0] - 1; var b = s[1];\n Console.WriteLine(Calc(b) - Calc(a));\n \n }\n static decimal Calc(decimal num)\n {\n int n = Convert.ToString((long)num,2).Length;\n decimal max = n * (n - 1) / 2; \n for (int k=0; k num) max--;\n else break;\n }\n return max;\n }\n static decimal Pow(decimal num, int power)\n {\n if (power == 0) return 1;\n if (power == 1) return num;\n decimal output = num;\n for (int i=1;i[] ReadGraph(int n, int m)\n {\n List[] g = new List[n + 1];\n for (int i = 0; i <= n; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = ReadInt();\n int b = ReadInt();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n\n private static int ReadInt()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong ReadULong()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long ReadLong()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] ReadIntArray(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadInt();\n return ans;\n }\n\n private static long[] ReadLongArray(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = ReadLong();\n return ans;\n }\n\n private static char[] ReadString()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans < 'a' || ans > 'z');\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n ans = consoleReader.Read();\n } while (ans >= 'a' && ans <= 'z');\n\n return s;\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans - (int)'0';\n }\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Collections.Generic;\nusing Debug = System.Diagnostics.Debug;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nusing Number = System.Int64;\n\nnamespace Program\n{\n\n public class Solver\n {\n public void Solve()\n {\n var a = sc.Long() - 1;\n var b = sc.Long();\n var B = f(b);\n var A = f(a);\n Debug.WriteLine(A);\n Debug.WriteLine(B);\n IO.Printer.Out.WriteLine(f(b) - f(a));\n }\n public long f(long v)\n {\n if (v == 0) return 1;\n\n var h = 0;\n for (int i = 0; i < 60; i++)\n if ((v >> i & 1) == 1) h = i;\n var ans = 0L;\n for (int i = 1; i < h; i++)\n ans += i - 1;\n\n var dp = new long[3, 2];\n dp[0, 1] = 1;\n for (int i = h - 1; i >= 0; i--)\n {\n var next = new long[3, 2];\n\n if ((v >> i & 1) == 1)\n {\n next[0, 1] += dp[0, 1];\n next[1, 1] += dp[1, 1];\n next[1, 0] += dp[0, 1];\n }\n else\n {\n next[1, 1] += dp[0, 1];\n }\n next[0, 0] += 1;\n next[0, 0] += dp[0, 0];\n next[1, 0] += dp[0, 0];\n next[1, 0] += dp[1, 0];\n dp = next;\n }\n\n\n\n return dp[1, 0] + dp[1, 1];\n }\n\n public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }\n static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }\n }\n}\n\n#region main\nstatic class Ex\n{\n static public string AsString(this IEnumerable ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n static public void Main()\n {\n var solver = new Program.Solver();\n solver.Solve();\n Program.IO.Printer.Out.Flush();\n }\n}\n#endregion\n#region Ex\nnamespace Program.IO\n{\n using System.IO;\n using System.Text;\n using System.Globalization;\n public class Printer : StreamWriter\n {\n static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }\n public static Printer Out { get; set; }\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, T[] source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, T[] source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(Stream stream) { str = stream; }\n public readonly Stream str;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n public bool isEof = false;\n public bool IsEndOfStream { get { return isEof; } }\n private byte read()\n {\n if (isEof) return 0;\n if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }\n\n public string Scan()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b >= 33 && b <= 126; b = (char)read())\n sb.Append(b);\n return sb.ToString();\n }\n public string ScanLine()\n {\n var sb = new StringBuilder();\n for (var b = Char(); b != '\\n'; b = (char)read())\n if (b == 0) break;\n else if (b != '\\r') sb.Append(b);\n return sb.ToString();\n }\n public long Long()\n {\n if (isEof) return long.MinValue;\n long ret = 0; byte b = 0; var ng = false;\n do b = read();\n while (b != 0 && b != '-' && (b < '0' || '9' < b));\n if (b == 0) return long.MinValue;\n if (b == '-') { ng = true; b = read(); }\n for (; true; b = read())\n {\n if (b < '0' || '9' < b)\n return ng ? -ret : ret;\n else ret = ret * 10 + b - '0';\n }\n }\n public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }\n public double Double() { var s = Scan(); return s != \"\" ? double.Parse(Scan(), CultureInfo.InvariantCulture) : double.NaN; }\n private T[] enumerate(int n, Func f)\n {\n var a = new T[n];\n for (int i = 0; i < n; ++i) a[i] = f();\n return a;\n }\n\n public char[] Char(int n) { return enumerate(n, Char); }\n public string[] Scan(int n) { return enumerate(n, Scan); }\n public double[] Double(int n) { return enumerate(n, Double); }\n public int[] Integer(int n) { return enumerate(n, Integer); }\n public long[] Long(int n) { return enumerate(n, Long); }\n }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n static class Program\n {\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n long[] temps = temp.Split(new[] { \" \" }, StringSplitOptions.None).Select(long.Parse).ToArray();\n string s1 = Convert.ToString(temps[0], 2);\n string s2 = Convert.ToString(temps[1], 2);\n s1 = FindNext(s1);\n s2 = FindPrev(s2);\n Console.WriteLine(Count(s1, s2));\n }\n\n static int Count(string s1, string s2)\n {\n long l1 = Convert.ToInt64(s1, 2);\n long l2 = Convert.ToInt64(s2, 2);\n if (l1 > l2) return 0;\n if (l1 == l2) return 1;\n\n int total = 0;\n int iS = s1.Length;\n int iE = s2.Length;\n int i1 = s1.IndexOf(\"0\");\n int i2 = s2.IndexOf(\"0\");\n if (iS == iE) return i2 - i1 + 1;\n total += iS - i1;\n total += i2;\n for (int i = iS + 1; i < iE; i++) total += i - 1;\n return total;\n }\n\n static string FindNext(string s)\n {\n string t;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n t = s.Remove(index + 1);\n for (int i = index + 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n t = \"10\";\n for (int i = 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n\n static string FindPrev(string s)\n {\n if (s.Equals(\"10\")) return \"1\";\n string t = null;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n for (int i = 0; i < index - 1; i++) t += \"1\";\n t += \"0\";\n for (int i = index; i < s.Length; i++) t += \"1\";\n return t;\n }\n t = s.Remove(s.Length - 1) + \"0\";\n return t;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Test\n{\n static class Program\n {\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n long[] temps = temp.Split(new[] { \" \" }, StringSplitOptions.None).Select(long.Parse).ToArray();\n string s1 = Convert.ToString(temps[0], 2);\n string s2 = Convert.ToString(temps[1], 2);\n s1 = FindNext(s1);\n s2 = FindPrev(s2);\n Console.WriteLine(Count(s1, s2));\n }\n\n static int Count(string s1, string s2)\n {\n long l1 = Convert.ToInt64(s1, 2);\n long l2 = Convert.ToInt64(s2, 2);\n if (l1 > l2) return 0;\n if (l1 == l2) return 1;\n\n int total = 0;\n int iS = s1.Length;\n int iE = s2.Length;\n int i1 = s1.IndexOf(\"0\");\n int i2 = s2.IndexOf(\"0\");\n if (iS == iE) return i2 - i1 + 1;\n total += iS - i1;\n total += i2;\n for (int i = iS + 1; i < iE; i++) total += i-1;\n return total;\n }\n\n static string FindNext(string s)\n {\n string t;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n t = s.Remove(index + 1);\n for (int i = index + 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n t = \"10\";\n for (int i = 1; i < s.Length; i++) t += \"1\";\n return t;\n }\n\n static string FindPrev(string s)\n {\n if (s.Equals(\"10\")) return \"1\";\n string t = null;\n int index = s.IndexOf(\"0\");\n if (index != -1)\n {\n int iindex = s.IndexOf(\"0\", index + 1);\n if (iindex == -1) return s;\n for (int i = index + 1; i < s.Length; i++) t += \"1\";\n t += \"0\";\n return t;\n }\n t = s.Remove(s.Length - 1) + \"0\";\n return t;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\n\nnamespace Beresta\n{\n\n\tclass ContestIO : StreamWriter\n\t{\n\t\tpublic ContestIO() : base(Console.OpenStandardOutput(8192), Encoding.ASCII, 8192) { }\n\t\t//d.ToString(\"N12\", CultureInfo.InvariantCulture).Replace(\",\", \"\")\n\t\tpublic StreamReader Reader = new StreamReader(Console.OpenStandardInput(8192), Encoding.ASCII, false, 8192);\n\t\tbool IsDigit(long c) { return c >= '0' && c <= '9'; }\n\n\t\tpublic long Read()\n\t\t{\n\t\t\tlong c1 = 0, c;\n\t\t\twhile (!IsDigit(c = Reader.Read())) { c1 = c; }\n\t\t\tlong r = c - '0';\n\t\t\twhile (IsDigit(c = Reader.Read()))\n\t\t\t\tr = r * 10 + c - '0';\n\t\t\treturn c1 == '-' ? -r : r;\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tusing (var io = new ContestIO())\n\t\t\t{\n\t\t\t\tvar a = io.Read();\n\t\t\t\tvar b = io.Read();\n\n\t\t\t\tvar count = 0L;\n\t\t\t\tfor (var i = 1; i <= 100; i++)\n\t\t\t\t{\n\t\t\t\t\tvar v1 = (1L << i) - 1L;\n\t\t\t\t\tvar v2 = v1 - 1;\n\t\t\t\t\twhile (v2 != v1)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (v2 >= a && v2 <= b)\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tv2 = ((v2 << 1) | 1) & v1;\n\t\t\t\t\t}\n\t\t\t\t\tif (v2 > b)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tio.WriteLine(count);\n\t\t\t}\n\n\t\t\tConsole.ReadLine();\n\t\t}\n\n\t}\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _611B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long a = long.Parse(input[0]), b = long.Parse(input[1]);\n long x = 1; int power = 0;\n while (x < a)\n {\n x <<= 1;\n power++;\n }\n\n bool flag = true;\n long result = 0;\n HashSet hashset = new HashSet();\n while (flag)\n {\n x -= 1;\n for (int i = power - 2; i >= 0; i--)\n {\n long y = x - (1 << i);\n if (i == power - 2 && y > b)\n {\n flag = false;\n break;\n }\n else if (y >= a && y <= b && !hashset.Contains(y))\n {\n result++;\n hashset.Add(y);\n }\n }\n x += 1;\n x <<= 1;\n power++;\n }\n\n Console.WriteLine(result);\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n string[] s = Console.ReadLine().Split(' ');\n long a = long.Parse(s[0]), b = long.Parse(s[1]);\n long n = 1;\n int p1 = 0;\n int ans = 0;\n while (p1 <= 60) {\n n <<= 1;\n p1++;\n for (int p2 = 0; p2 < p1 - 1; p2++) {\n long nr = n - 1 - (1 << p2);\n if (nr >= a && nr <= b) {\n //Console.WriteLine(\"{0} {1} {2}\",nr,n,p2);\n ans++;\n }\n }\n }\n Console.Write(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint cnt=0;\n\t\tint mb=0;\n\t\tlong bb=b;\n\t\twhile(b>0){b/=2;mb++;}\n\t\tmb-=2;\n\t\tlong aa=a;\n\t\tint ma=0;\n\t\twhile(a>0){a/=2;ma++;}\n\t\tma-=2;\n\t\t\n\t\tfor(int j=ma;j<=mb;j++){\n//Console.WriteLine(\"j=\"+j);\n\t\t\tlong x=0;\n\t\t\tfor(int i=0;i<=j;i++){x|=1;x<<=1;}\n\t\t\tx|=1;\n//Console.WriteLine(x);\n\t\t\tfor(int i=0;i<=j+1;i++){\n\t\t\t\tx^=(1<int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint cnt=0;\n\t\tint mb=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((b>>j)>0){mb=j;break;}\n\t\t}\n\t\tint ma=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((a>>j)>0){ma=j;break;}\n\t\t}\n\t\t\n\t\tfor(int j=ma;j<=mb;j++){\n//Console.WriteLine(\"j=\"+j);\n\t\t\tlong x=0;\n\t\t\tfor(int i=0;i<=j;i++){x|=(1L<int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint cnt=0;\n\t\tint mb=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((b>>j)>0){mb=j;break;}\n\t\t}\n\t\tint ma=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((a>>j)>0){ma=j;break;}\n\t\t}\n\t\t\n\t\tfor(int j=ma;j<=mb;j++){\n//Console.WriteLine(\"j=\"+j);\n\t\t\tlong x=0;\n\t\t\tfor(int i=0;i<=j;i++){x|=(1L<int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint cnt=0;\n\t\tint mb=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((b>>j)>0){mb=j;break;}\n\t\t}\n\t\tint ma=0;\n\t\tfor(int j=63;j>=0;j--){\n\t\t\tif((a>>j)>0){ma=j;break;}\n\t\t}\n\t\t\n\t\tfor(int j=ma;j<=mb;j++){\n//Console.WriteLine(\"j=\"+j);\n\t\t\tlong x=0;\n\t\t\tfor(int i=0;i<=j;i++){x|=(1L<int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace goodbye2015\n{\n class Program\n {\n static UInt64 YesNo(UInt64 n)\n {\n UInt64 step = 1;\n UInt64 kol = 0, ans = 0;\n while (step * 2 < n)\n {\n step *= 2;\n kol++;\n ans += (kol - 1);\n }\n step = 2 * step - 1;\n UInt64 newstep = 1;\n for (UInt64 i = 0; i < kol; i++)\n {\n if (step - newstep <= n) ans++;\n newstep *= 2;\n }\n return ans;\n }\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n UInt64 a = Convert.ToUInt64(s[0]);\n UInt64 b = Convert.ToUInt64(s[1]);\n UInt64 tmp = YesNo(a-1);\n UInt64 tmp1 = YesNo(b);\n Console.WriteLine(tmp1-tmp);\n \n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.GoodBye2015\n{\n class OldProperyB\n {\n public static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n ulong a = ulong.Parse(line[0]), b = ulong.Parse(line[1]);\n int remA = NumOfRemaining(Convert.ToString((long)a, 2)) + (isSpecial(line[0]) ? 1 : 0), remB = NumOfRemaining(Convert.ToString((long)b, 2));\n Console.WriteLine(remA - remB);\n }\n public static int NumOfRemaining(string str)\n {\n int i;\n for (i = 0; i < str.Length; i++) if (str[i] == '0') break;\n string remaining = \"\";\n if (i < str.Length) remaining = str.Substring(i);\n int rem = remaining.Length;\n for (i = str.Length + 1; i < 62; i++)\n {\n rem += i - 1;\n }\n return rem;\n }\n public static bool isSpecial(string str)\n {\n int count = 0;\n foreach (char c in str)\n {\n if (c == '0') count++;\n }\n return str.Length > 0 && count == 1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] tokens = input.Split(' ');\n long a = long.Parse(tokens[0]);\n long b = long.Parse(tokens[1]);\n\n Console.WriteLine(Cal(b) - Cal(a - 1));\n }\n\n static long Cal(long i)\n {\n long r = 0;\n\n if (i <= 1)\n {\n return 0;\n }\n\n long b = 1;\n long n = 0;\n while (i/2 >= b)\n {\n ++n;\n b *= 2;\n }\n\n r = n*(n - 1)/2;\n\n long d = b / 2 - 1;\n while (b + d <= i)\n {\n ++r;\n b += d;\n\n if (d%2 == 1 && d != 1)\n {\n ++d;\n }\n d /= 2;\n\n if (d == 0)\n {\n break;\n }\n }\n\n return r;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\npublic class Test\n{\n public static void Main()\n {\n // your code goes here\n string input;\n long numa,numb,count = 0;\n \n input = Console.ReadLine();\n\n string inputa = input.Split(' ')[0];\n string inputb = input.Split(' ')[1]; \n numa = Convert.ToInt64(inputa);\n numb = Convert.ToInt64(inputb);\n\n string low = Convert.ToString(numa, 2);\n string high = Convert.ToString(numb, 2);\n \n int lena = low.Length;\n int lenb = high.Length;\n \n StringBuilder temp = new StringBuilder();\n \n for(int i=0;i0;j--)\n {\n if(j!=i-1)\n temp[j+1] = '1';\n temp[j]='0';\n long num = Convert.ToInt64(temp.ToString(),2);\n if(num>= numa && num <=numb)\n {\n count++;\n } \n } \n temp.Insert(0,\"1\");\n }\n Console.WriteLine(count);\n \n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace _2015B {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n ulong first = ulong.Parse(input[0]);\n ulong last = ulong.Parse(input[1]);\n int res = 0;\n ulong tmp;\n string fS = DecimalToBinary(first);\n string lS = DecimalToBinary(last);\n\n for (int i = fS.Length; i <= lS.Length; i++)\n for (int j = 0; j < i; j++) {\n tmp = BuildTest(i, j);\n if (tmp <= last) {\n if (tmp >= first)\n res++;\n } else\n break;\n }\n\n Console.WriteLine(res);\n }\n\n static string DecimalToBinary(ulong data) {\n StringBuilder result = new StringBuilder();\n int rem = 0;\n while (data > 0) {\n rem = (int)(data % 2);\n data = data >> 1;\n result.Append(rem);\n }\n return ReverseString(result.ToString());\n }\n\n static string ReverseString(string s) {\n char[] arr = s.ToCharArray();\n Array.Reverse(arr);\n return new string(arr);\n }\n\n static ulong BuildTest(int length, int index) {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < length - 1; i++) {\n sb.Append('1');\n }\n sb.Insert(length - index - 1, '0');\n return (BinToDec(sb.ToString()));\n }\n\n static ulong BinToDec(string value) {\n ulong res = 0;\n foreach (char c in value) {\n res <<= 1;\n res += (ulong)(c == '1' ? 1 : 0);\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\nnamespace _2015B {\n class Program {\n static void Main(string[] args) {\n string[] input = Console.ReadLine().Split(' ');\n ulong first = ulong.Parse(input[0]);\n ulong last = ulong.Parse(input[1]);\n int count1 = 0;\n int res = 0;\n ulong tmp;\n string fS = DecimalToBinary(first);\n string lS = DecimalToBinary(last);\n if (lS.Length > fS.Length) {\n foreach (char c in fS) {\n if (c == '1')\n count1++;\n else\n break;\n }\n res = fS.Length - count1 - 1;\n for (int i = 0; i < lS.Length; i++) {\n if (BuildTest(lS.Length, i) < last)\n res++;\n else\n break;\n }\n } else {\n for (int i = 0; i < lS.Length; i++) {\n tmp = BuildTest(lS.Length, i);\n if (tmp <= last) {\n if (tmp >= first)\n res++;\n } else\n break;\n }\n }\n Console.WriteLine(res);\n }\n\n static string DecimalToBinary(ulong data) {\n StringBuilder result = new StringBuilder();\n int rem = 0;\n while (data > 0) {\n rem = (int)(data % 2);\n data = data >> 1;\n result.Append(rem);\n }\n return ReverseString(result.ToString());\n }\n\n static string ReverseString(string s) {\n char[] arr = s.ToCharArray();\n Array.Reverse(arr);\n return new string(arr);\n }\n\n static ulong BuildTest(int length, int index) {\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < length - 1; i++) {\n sb.Append('1');\n }\n sb.Insert(index, '0');\n return (BinToDec(sb.ToString()));\n }\n\n static ulong BinToDec(string value) {\n ulong res = 0;\n foreach (char c in value) {\n res <<= 1;\n res += (ulong)(c == '1' ? 1 : 0);\n }\n return res;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _611B\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var a = s[0] - 1; var b = s[1];\n Console.WriteLine(Calc(b)-Calc(a));\n }\n static long Calc(long num)\n {\n int n = Convert.ToString(num, 2).Length;\n long max = n * (n - 1) / 2; \n for (int k=0; k num) max--;\n else break;\n }\n return max;\n }\n }\n}\n"}], "src_uid": "581f61b1f50313bf4c75833cefd4d022"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace codeforces\n{\n class C\n {\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\nzzzzzzzzzzzzzzzzzzzz\n\");\n\n static void Main(string[] args)\n {\n string s = CF.ReadLine();\n\n int max = 0;\n for (int i = 1; i < s.Length; i++)\n {\n for (int j = 0; j < i; j++)\n {\n int len = 0;\n for (;i+len max)\n max = len;\n }\n }\n CF.WriteLine(max);\n }\n \n\n #region test\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n\n string _test_input;\n\n List _lines;\n }\n\n #endregion\n }\n}\n", "positive_code": [{"source_code": "using System;\n\nnamespace Task23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int ans = 0;\n for (int start = 0; start < input.Length - 1; start++)\n {\n\n for (int count = 1; count < input.Length; count++)\n {\n for (int inner = start+1;inner <= input.Length - count ; inner++ )\n {\n if (\n input.Substring(start, count).Equals(input.Substring(inner, count))\n ) ans = count > ans ? count : ans;\n }\n }\n\n }\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\nusing System.IO;\n\n\n\nnamespace FirstApp\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n string[] substr = new string[10000];\n\n int[] count = new int[10000];\n\n int num = 0;\n\n string str = Console.ReadLine();\n // string str = \"ckvfndqgkmhcyojaqgdkenmbexufryhqejdhctxujmtrwkpbqxufxamgoeigzfyzbhevpbkvviwntdhqscvkmphnkkljizndnbjt\";\n\n bool check;\n\n for (int i = 0; i < 10000; i++)\n {\n\n count[i] = 0;\n\n }\n\n for (var i = 0; i < str.Length; i++)\n {\n\n StringBuilder tmp = new StringBuilder(\"\", 1000);\n\n for (var j = i; j < str.Length; j++)\n {\n\n tmp.AppendFormat(Convert.ToString(str[j]));\n\n //\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\n\n check = true;\n /*\n for (var m = 0; m < num; m++)\n {\n if (String.Compare(Convert.ToString(tmp), Convert.ToString(substr[m]), true) == 0)\n {\n check = false;\n break;\n } \n }\n */\n //\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438\n\n if (check == true)\n {\n substr[num] = Convert.ToString(tmp);\n num++;\n }\n }\n\n }\n\n\n //\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0438\u0441\u043a\n\n for (var r = 0; r < num; r++)\n {\n int pos = -1; //\u043f\u043e\u0437\u0438\u0446\u0438\u044f\n\n for (int st = 0; st < str.Length; st++)\n {\n int index = str.IndexOf(substr[r], st);\n\n if (index > -1 && pos != index)\n {\n count[r] = count[r] + 1;\n pos = index; \n\n }\n }\n }\n\n //\u043e\u0442\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0443\n\n \n int symcount = 0;\n for (var r = 0; r < num; r++)\n {\n if (count[r] > 1)\n {\n // Console.WriteLine(count[r]);\n if (substr[r].Length > symcount)\n {\n symcount = substr[r].Length;\n }\n }\n }\n \n Console.WriteLine(symcount);\n \n\n // Console.WriteLine(\"end\");\n // Console.ReadKey();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n var listSample = new List();\n \n var result = 0;\n\n for (int i = 1; i <= input.Length; i++)\n {\n for (int j = 0; j < input.Length; j++)\n {\n if (j + i <= input.Length)\n listSample.Add(input.Substring(j, i));\n else break;\n }\n }\n\n var selectItem = (from res in listSample\n where listSample.Count(y => res == y) > 1\n select res).Distinct();\n\n \n\n foreach (var item in selectItem)\n {\n if (item.ToString().Length > result)\n {\n result = item.ToString().Length;\n }\n }\n\n Console.WriteLine(result);\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Main\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a = Console.ReadLine();\n int n = a.Length;\n int res = 0;\n for (int i = 0; i < n - 1; i++)\n {\n for (int j = 0; j <= i; j++)\n {\n string s = a.Substring(j, i - j + 1);\n string ss = a.Substring(j + 1);\n if (ss.Contains(s))\n {\n res = Math.Max(res, s.Length);\n }\n }\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int n = line.Length - 1;\n Dictionary d = new Dictionary();\n\n while (n > 0)\n {\n List list = Split(line, n);\n\n foreach (String s in list)\n {\n int o = Occurs(line, s);\n if (o >= 2)\n {\n d.Add(s, o);\n }\n }\n \n n--;\n }\n\n if (d.Count > 0)\n {\n\n int max = 0;\n string temp = \"\";\n\n foreach (String s in d.Keys)\n {\n if (s.Length > max)\n {\n max = s.Length;\n temp = s;\n }\n }\n\n Console.WriteLine(temp.Length);\n }\n else\n Console.WriteLine(\"0\");\n\n }\n\n static List Split(string input,int n)\n {\n List list = new List();\n int counter = 0;\n\n while (counter+n <= input.Length)\n {\n if (!list.Contains(input.Substring(counter, n)))\n {\n list.Add(input.Substring(counter, n));\n \n }\n counter++;\n \n }\n\n return list;\n }\n\n static int Occurs(string input,string sub)\n {\n int counter = 0;\n int count = 0;\n while (counter + sub.Length <= input.Length)\n {\n if (input.Substring(counter, sub.Length) == sub)\n {\n count++;\n }\n counter++;\n }\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n // string str = \"ababa\";\n string tmpStr;\n string podstr;\n string otvet = \"^\";\n int count;\n\n\n\n for (int i = 0; i < str.Length; i++)\n {\n for (int g = 1; g < str.Length - i; g++)\n {\n\n tmpStr = str.Substring(i + 1);\n podstr = str.Substring(i, g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if (otvet.Length <= podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n\n }\n else\n {\n break;\n }\n\n }\n\n }\n\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round19\n{\n class B\n {\n public static void Main()\n {\n string s = Console.ReadLine();\n for (int i = s.Length - 1; i > 0; i--)\n {\n int n = s.Length - i + 1;\n for (int j = 0; j < n; j++)\n {\n string ss = s.Substring(j, i);\n int count = 0;\n for (int k = 0; k < n; k++)\n if (s.Substring(k, i) == ss)\n count++;\n if (count >= 2)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n \nnamespace CodeForce\n{\n class _23a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var z = 0;\n for (var i = line.Length - 1; i > 0; i--)\n {\n z++;\n for (var j = 0; j < z; j++)\n {\n var str = line.Substring(j, i);\n if (line.IndexOf(str, j + 1) >= 0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForce\n{\n class _23a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var z = 0;\n for (var i = line.Length - 1; i > 0; i--)\n {\n z++;\n for (var j = 0; j < z; j++)\n {\n var str = line.Substring(j, i);\n if (line.IndexOf(str, j + 1) >= 0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace JalalHani\n{\n class Vertex\n {\n public List relations = new List();\n public List weights = new List();\n public Vertex(int r , int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n public void AddInfo (int r, int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n ////Dijkstra\n //int[] data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int n = data[0], m = data[1];\n //Dictionary Edges = new Dictionary();\n //for (int i = 0; i < m; i++)\n //{\n // data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n // int k = data[0], r = data[1], w = data[2];\n // if (Edges.Keys.Contains(k))\n // {\n // Edges[k].AddInfo(r,w);\n // }\n // else\n // {\n // Edges.Add(k, new Vertex(r, w));\n // }\n //}\n\n //foreach (var edge in Edges)\n //{\n\n //}\n }\n\n\n class Program\n {\n \n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long o = 0;\n List rep = new List();\n\n for (int length = 1; length < s.Length; length++)\n {\n for (int j = 0; j <= s.Length-length; j++)\n {\n string subS = s.Substring(j, length);\n bool u = SearchInSubstring(s,subS,j,length);\n if (u)\n {\n rep.Add(subS);\n }\n }\n }\n if (rep.Count > 0)\n o = rep.Select(x => x.Length).Max();\n Console.WriteLine(o);\n }\n \n static bool SearchInSubstring (string source, string cut,int indexStart, int EndString) {\n bool found = false;\n char[] src = source.ToCharArray();\n src[indexStart] = '#';\n\n found = string.Join(\"\", src).Contains(cut);\n\n return found;\n }\n\n static int Test(int v , int m)\n {\n int p1 = 0;\n int dif = (int)Math.Ceiling((double)m / v);\n int diff = v * dif;\n p1 = (diff - m);\n p1 += dif == 2 ? 1 : dif; \n\n\n return p1;\n }\n\n static void MulticasesQuestion()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n SolveTestCase();\n }\n static void SolveTestCase()\n {\n \n }\n static int GCD(int a1, int a2)\n {\n int mx = Math.Max(a1, a2);\n int mn = Math.Min(a1, a2);\n\n if (mx % mn == 0)\n {\n return mn;\n }\n else GCD(mn, mx % mn);\n return 1;\n }\n\n static BigInteger Pow(int b, int a)\n {\n BigInteger x = 1;\n\n for (int i = 0; i < a; i++)\n {\n x *= b;\n }\n\n return x;\n }\n static void LeastCostBracketSequence()\n {\n var input = Console.ReadLine().ToCharArray();\n var isSolutionExists = true;\n long totalCost = 0;\n var balance = 0;\n\n\n var sortedVariants = new List();\n var comparer = new ByCostSwitch();\n\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '(')\n {\n balance++;\n }\n else if (input[i] == ')')\n {\n balance--;\n }\n else\n {\n var costValue = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n var variant = new Variant()\n {\n CostSwitch = costValue[0] - costValue[1],\n Position = i\n };\n\n var index = sortedVariants.BinarySearch(variant, comparer);\n if (index < 0)\n {\n index = ~index;\n }\n\n sortedVariants.Insert(index, variant);\n\n totalCost += costValue[1];\n balance--;\n }\n\n\n if (balance < 0)\n {\n if (sortedVariants.Count == 0)\n {\n isSolutionExists = false;\n break;\n }\n\n\n var sortedVariant = sortedVariants[0];\n\n input[sortedVariant.Position] = '(';\n totalCost += sortedVariant.CostSwitch;\n balance += 2;\n sortedVariants.RemoveAt(0);\n }\n }\n\n isSolutionExists = (balance == 0);\n\n if (isSolutionExists)\n {\n Console.WriteLine(totalCost);\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '?')\n {\n Console.Write(')');\n }\n else\n {\n Console.Write(input[i]);\n }\n }\n Console.WriteLine();\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n class Commands\n {\n public static int[] NextIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n }\n public static List NextIntList\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n public static int[] NextSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static int[] NextDescSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static long[] NextLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToArray();\n }\n }\n public static List NextLongList\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToList();\n }\n }\n public static long[] NextSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static long[] NextDescSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static int NextInt\n {\n get\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static string NextString\n {\n get { return Console.ReadLine(); }\n }\n }\n\n private class Variant\n {\n public int CostSwitch;\n public int Position;\n }\n\n private class ByCostSwitch : IComparer\n {\n #region IComparer implementation\n public int Compare(Variant x, Variant y)\n {\n return x.CostSwitch.CompareTo(y.CostSwitch);\n }\n #endregion\n }\n }\n}"}, {"source_code": "using System;\n/*\n abcde\ni==0 \n a => {b ,c, d,e} subLen=1\n ab => {bc, cd, de} subLen=2\n abc => {bcd,cde } subLen=3\n abcd =>{bcde} subLen=4\ni==1\n b=> {c, d,e} subLen=1\n bc => {cd, de} subLen=2\n bcd => {cde} subLen=3\ni==2\n c => { d, e} subLen=1\n cd => {de} subLen=2\ni==3\n d => {e} subLen=1\n\n 01234\n\"abcde\" length=5 s.Substring(i, subLen)\na\nab\nabc\nabcd\nabcde\nb\nbc\nbcd\nbcde\nc\ncd\ncde\nd\nde\ne\n */\nnamespace Task_23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int sLen = s.Length, ans = 0;\n for (int i = 0; i < sLen - 1; i++)\n {\n for (int subLen = 1; subLen <= sLen - i; subLen++)\n {\n for (int j = i + 1; j <= sLen-subLen; j++)\n {\n string sub1 = s.Substring(i, subLen);\n string sub2 = s.Substring(j, subLen);\n\n if (sub1.Equals(sub2) && ans < subLen)\n ans = subLen;\n }\n\n }\n\n }\n\n\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nclass Program\n{\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"../../input.txt\"));\n\n string str = \"\";\n while (!string.IsNullOrEmpty((str = Console.ReadLine())))\n {\n int res = 0;\n for (int i = 0; i < str.Length; ++i)\n {\n for (int j = i + 1; j < str.Length; ++j)\n {\n int k = 0;\n while (i + k < str.Length && j + k < str.Length && str[i + k] == str[j + k])\n {\n ++k;\n }\n res = Math.Max(res, k);\n }\n } \n Console.WriteLine(res);\n }\n }\n}\n\n"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n var s = new List(sc.Next());\n for (int i = s.Count - 1; i > 0; --i) {\n for (int j = 0; j + i - 1 < s.Count; ++j) {\n for (int k = j + 1; k + i - 1 < s.Count; ++k) {\n\n\n bool ok = true;\n for (int l = 0; l < i; ++l) {\n if (s[k + l] != s[j + l]) {\n ok = false;\n break;\n }\n }\n if (ok) {\n wr.WriteLine(i);\n wr.Flush();\n return;\n }\n }\n }\n }\n\n wr.WriteLine(0);\n \n wr.Flush();\n\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Task_23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int ans = 0;\n for (int i = 0; i < input.Length - 1; i++)\n {\n for (int count = 1; count < input.Length; count++)\n {\n for (int j = i + 1; j <= input.Length - count; j++)\n {\n string A = input.Substring(i, count);\n string B = input.Substring(j, count );\n if (A.Equals(B))\n {\n ans = count > ans ? count : ans;\n }\n\n }\n }\n\n }\n\n Console.WriteLine(ans);\n //Console.ReadKey();\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n string str = tr.ReadLine();\n\n int maxlen = 0; \n \n for (int i = 1; i < str.Length; i++)\n {\n Dictionary ret = new Dictionary();\n for (int j = 0; j < str.Length; j++)\n {\n if (i + j > str.Length) break;\n string sub = string.Empty;\n for (int k = j; k < j+i; k++)\n {\n sub += str[k];\n }\n if (ret.ContainsKey(sub))\n {\n maxlen = Math.Max(i, maxlen);\n break;\n }\n else\n {\n ret[sub] = true;\n }\n }\n }\n \n Console.WriteLine(maxlen);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\n\n\nclass Program\n{\n void solve()\n {\n string s = nextString();\n Dictionary d = new Dictionary();\n for (int i = 0; i < s.Length; i++)\n for (int l = 1; l + i <= s.Length; l++)\n if (!d.ContainsKey(s.Substring(i, l)))\n {\n d[s.Substring(i,l)]=1;\n }\n else\n d[s.Substring(i, l)]++;\n int ret=0;\n foreach(KeyValuePairx in d)\n if(x.Value>1)\n ret=Math.Max(ret,x.Key.Length);\n println(ret);\n \n }\n\n\n ////////////\n\n\n\n\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput(); \n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nclass Program\n{\n static int max = -1;\n static void Main()\n {\n string st = Console.ReadLine();\n substrs(st);\n Console.WriteLine(max);\n Console.Read();\n }\n\n static void pref(string s)\n {\n int n = s.Length;\n int[] pi = new int[n];\n pi[0] = 0;\n for (int i = 1; i < n; i++)\n {\n int j = pi[i - 1];\n while (j > 0 && s[i] != s[j])\n j = pi[j - 1];\n if (s[i] == s[j]) ++j;\n pi[i] = j;\n }\n max = Math.Max(max, pi[s.Length - 1]);\n }\n\n static void substrs(string s)\n {\n int l = s.Length;\n for (int i = 0; i < l; i++)\n {\n for (int j = i; j < l; j++)\n {\n pref(s.Substring(i, j - i + 1));\n }\n }\n }\n}\n"}, {"source_code": "using System.Collections.Generic;\nusing System;\nclass some\n{\n\tpublic static void Main()\n\t{\n\t\tstring s=Console.ReadLine();\n\t\tList ll=new List();\n\t\tfor(int i=0;i-1)\n\t\t\t{\n\t\t\t\tmax=Math.Max(max,ll[i].Length);\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(max);\n\t}\n}"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Collections;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces_Runners\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n string s = Console.ReadLine();\n\n \n int n = s.Length;\n\n if (n == 1)\n {\n Console.WriteLine(\"0\");\n return;\n }\n\n for (int j = n - 2; j >= 0; j-- )\n {\n ArrayList subs = new ArrayList();\n\n int temp = j;\n for (int i = 0; i < n - j; i++)\n {\n string sub = s.Substring(i, temp - i + 1);\n if (subs.Contains(sub))\n {\n Console.WriteLine(temp - i + 1);\n return;\n }\n else\n subs.Add(sub);\n\n temp++;\n }\n\n }\n\n Console.WriteLine(\"0\");\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n string s = RL();\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j < s.Length - i; j++) {\n string subs = s.Substring(j, i);\n int tmp = KMP(s, subs);\n if (tmp >= 2) {\n println(subs.Length);\n //close(file);\n return;\n }\n }\n }\n\n println(0);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n bool flag;\n\n for (int i = 0; i < mainStr.Length-subs.Length+1; i++) {\n flag = true;\n for (int j = 0, k=i; j < subs.Length; j++, k++) {\n if (subs[j] != mainStr[k]) {\n flag = false;\n break;\n }\n }\n if (flag) count++;\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace You_re_Given_a_String\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n\n int max = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = i + max; j < s.Length; j++)\n {\n for (int k = i + 1; k < s.Length; k++)\n {\n bool ok = true;\n for (int l = i; l <= j; l++)\n {\n int index = k + l - i;\n if (index == s.Length)\n {\n ok = false;\n break;\n }\n if (s[l] != s[index])\n {\n ok = false;\n break;\n }\n }\n if (ok)\n {\n if (j - i + 1 > max)\n max = j - i + 1;\n }\n }\n }\n }\n\n\n writer.WriteLine(max);\n writer.Flush();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"in.txt\"));\n var str = Console.ReadLine();\n int n = str.Length;\n int max = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = i; j < n; j++)\n {\n var length = j - i + 1;\n for (int i2 = 0; i2 < n; i2++)\n {\n \n var last = i2 + length - 1;\n\n if (last >= n || i2 == i)\n {\n break;\n }\n\n var eq = true;\n\n for (int c = 0; c < length; c++)\n {\n if (str[i + c] != str[i2 + c])\n {\n eq = false;\n }\n }\n\n if (eq)\n {\n if (length > max)\n {\n max = length;\n }\n }\n }\n }\n }\n\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Numerics;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n public void Solve()\n {\n string s = ReadToken();\n int n = s.Length;\n for (int len = n - 1; len > 0; len--)\n for (int i = 0; i + len <= n; i++)\n {\n string t = s.Substring(i, len);\n int c = 0;\n for (int j = 0; j + len <= n; j++)\n if (s.Substring(j, len) == t)\n c++;\n if (c > 1)\n {\n Write(len);\n return;\n }\n }\n Write(0);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces_Beta_Round_23\n{\n class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var max = 0;\n for (var i = 0; i < str.Length - 1; i++)\n {\n if (i >= str.Length - max)\n {\n break;\n }\n for (var j = i + 1; j < str.Length; j++)\n {\n if (j >= str.Length - max)\n break;\n\n if (str[i] == str[j])\n {\n var indx = 1;\n while (j + indx < str.Length && str[i + indx] == str[j + indx])\n indx++;\n\n if (indx > max)\n max = indx;\n }\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_23_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string sub;\n string comp_str;\n int leng = 1;\n int max = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n leng = 1;\n List lst = new List();\n for (int j = i+1; j < s.Length; j++)\n lst.Add(j);\n while (true)\n {\n List lst2 = new List();\n sub = s.Substring(i, leng);\n foreach (var k in lst)\n {\n if (k + leng > s.Length) break;\n comp_str = s.Substring(k, leng);\n if (comp_str == sub)\n lst2.Add(k);\n\n }\n if (lst2.Count == 0) break;\n lst = lst2;\n if (leng > max) max = leng;\n leng++;\n }\n\n if (s.Length - i < max) break;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace code_23_a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n string sub;\n string comp_str;\n int leng = 1;\n int max = 0;\n\n for (int i = 0; i < s.Length; i++)\n {\n leng = 1;\n List lst = new List();\n for (int j = i+1; j < s.Length; j++)\n lst.Add(j);\n while (true)\n {\n List lst2 = new List();\n foreach (var k in lst)\n {\n if (k + leng > s.Length) break;\n if (s[i+leng-1] == s[k+leng-1])\n lst2.Add(k);\n\n }\n if (lst2.Count == 0) break;\n lst = lst2;\n if (leng > max) max = leng;\n leng++;\n }\n\n if (s.Length - i < max) break;\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass CF_23A\n{\n static void Main()\n {\n string str = Console.ReadLine();\n if (str.Length < 2)\n {\n Console.WriteLine(0);\n return;\n }\n\n int len;\n for (len = str.Length; len >= 0; len--)\n {\n for (int i = 0; i + len <= str.Length; i++)\n {\n string sub = str.Substring(i, len);\n int cnt = 0;\n for (int p = str.IndexOf(sub, 0) ; p < str.Length && p != -1; p = str.IndexOf(sub, ++p))\n {\n cnt++;\n if (cnt >= 2)\n {\n Console.WriteLine(len);\n return;\n }\n }\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Task23Astring\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int ans = 0;\n for (int i = 0; i < input.Length - 1; i++)\n {\n for (int count = 1; count < input.Length; count++)\n {\n for (int inner = i + 1; inner <= input.Length - count; inner++)\n {\n if (input.Substring(i, count) == input.Substring(inner, count))\n ans = count > ans ? count : ans;\n }\n }\n }\n Console.WriteLine(ans);\n // Console.ReadKey();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF23\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n int maxLenth = 0;\n for (int i = 0; i < str.Length; i++)\n {\n for (int j = i + 1; j < str.Length; j++)\n {\n if (str[i] == str[j])\n {\n int curLength = 0;\n int k = i;\n int t = j;\n while (t maxLenth)\n {\n maxLenth = curLength;\n }\n }\n }\n }\n Console.Write(maxLenth);\n Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n while ((line = Console.ReadLine()) != null)\n {\n int mlen = 0;\n for (int j = 0; j < line.Length; j++)\n {\n int len = 0;\n for (int i = j+1; i < line.Length; i++)\n {\n int lmlen = comp(line, j, i);\n if (lmlen > len) len = lmlen;\n }\n if (len > mlen) mlen = len;\n }\n Console.WriteLine(mlen);\n }\n }\n static int comp(string str, int i, int j)\n {\n int len = 0;\n while (i < str.Length && j < str.Length)\n {\n if (str[i] != str[j]) return len;\n i++; j++; len++;\n }\n return len;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Solution\n{\n Scanner cin;\n\n public static void Main()\n {\n new Solution().calc();\n }\n\n void calc()\n {\n cin = new Scanner();\n string s = cin.next();\n int ret = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int j = i + 1; j < s.Length; j++)\n {\n for (int k = 0; j + k < s.Length; k++)\n {\n if (s[i + k] != s[j + k]) break;\n ret = Math.Max(k + 1, ret);\n }\n }\n }\n Console.WriteLine(ret);\n }\n}\n"}, {"source_code": "using System;\n// you can also use other imports, for example:\nusing System.Collections.Generic;\nusing System.Linq;\n\n// you can write to stdout for debugging purposes, e.g.\n// Console.WriteLine(\"this is a debug message\");\n\n//mcs HelloWorld.cs\n//mono HelloWorld.exe\npublic class HelloWorld {\n\t\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar line = Console.ReadLine();\n\t\tsolve(line);\n\t\t//tests();\n\t}\n\n\tpublic static void tests()\n\t{\n\t\tsolve(\"abcd\");\n\t\tsolve(\"ababa\");\n\t\tsolve(\"zzz\");\n\t}\n\n\tpublic static void solve(string line)\n\t{\n\t\tvar dict = new Dictionary();\n\n\t\tfor (var i = 0; i < line.Length; i++)\n\t\t{\n\t\t\tvar st = line[i].ToString();\n\t\t\tif (dict.ContainsKey(st))\n\t\t\t\tdict[st] += 1;\n\t\t\telse\n\t\t\t\tdict[st] = 0;\n\n\t\t\tfor (var j = i+1; j < line.Length; j++)\n\t\t\t{\n\t\t\t\tst += line[j];\n\t\t\t\tif (dict.ContainsKey(st))\n\t\t\t\t{\n\t\t\t\t\tdict[st] += 1;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdict[st] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar max = 0;\n\t\tforeach( var d in dict)\n\t\t{\n\t\t\t//Console.WriteLine(d.Key + \" \" + d.Value);\n\t\t\tif (d.Value > 0)\n\t\t\t{\n\t\t\t\tmax = Math.Max(d.Key.Length, max);\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(max);\n\t\t\n\t}\n\t\n\n}"}, {"source_code": "using System;\n\nnamespace Iran\n{\n\tclass AmirGoharshady\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tstring s=Console.ReadLine();\n\t\t\tint ans=0;\n\t\t\tfor(int i=0;ians)\n\t\t\t\t\t\t\t\tans=s.Substring(i,len).Length;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n \nnamespace CodeForce\n{\n class _23a\n {\n public static void Main()\n {\n var line = Console.ReadLine();\n var z = 0;\n for (var i = line.Length - 1; i > 0; i--)\n {\n z++;\n for (var j = 0; j < z; j++)\n {\n var str = line.Substring(j, i);\n if (line.IndexOf(str, j + 1) >= 0)\n {\n Console.WriteLine(i);\n return;\n }\n }\n }\n Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Task23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string str = Console.ReadLine();\n\n\n //bool breaker=false;\n //for (int i = 0; i < str.Length-1; i++)\n //{\n // for (int j = str.Length-1; j > 0; j--)\n // {\n // if (str.Substring(i+1,str.Length-1).Contains(str.Substring(i, j))) {\n // Console.WriteLine(str.Substring(i, j).Length); breaker = true; break;} \n // }\n // if (breaker) break;\n //}\n //if (breaker == false) Console.WriteLine(0);\n\n int ans = 0, len = str.Length;\n for (int i = 0; i < len - 1; i++)\n {\n \n for (int count = 1; count < len; count++)\n {\n for ( int j = i + 1;j+count <= len; j++)\n {\n string sub1=str.Substring(i,count);\n string sub2 = str.Substring(j,count);\n if (sub1.Equals(sub2) && sub1.Length > ans)\n ans = sub1.Length;\n }\n }\n }\n\n Console.WriteLine(ans);\n \n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace q1\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n string buf = tr.ReadLine();\n int max = 0;\n string sub;\n for (int i = 0; i < buf.Length; i++)\n {\n for (int j = 1; i + j < buf.Length; j++)\n {\n sub = buf.Substring(i, j);\n if ((buf.Substring(i+1)).Contains(sub))\n {\n if (max < sub.Length)\n {\n max = sub.Length;\n }\n }\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tstring str = Console.ReadLine();\n\t\t\n\t\tfor(int i = 0; i < str.Length - 1; i++)\n\t\t{\n\t\t\tint maxLen = str.Length - i - 1;\n\t\t\tfor(int j = 0; j < str.Length - maxLen; j++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tfor(int k = j + 1; k < str.Length - maxLen + 1; k++)\n\t\t\t\t{\n\t\t\t\t\tbool match = true;\n\t\t\t\t\t\n\t\t\t\t\tfor(int m = 0; m < maxLen; m++)\n\t\t\t\t\t{\n\t\t\t\t\t\t//Console.WriteLine(\"i: \" + i + \"; j: \" + j + \"; k: \" + k + \"; m: \" + m);\n\t\t\t\t\t\tif(str[j + m] != str[k + m])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(match)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(maxLen);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(0);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int max = 0;\n int d = 1; //\u043a\u0430\u043a \u0431\u044d \u0441\u0434\u0432\u0438\u0433\n bool b = false;\n for (; d < s.Length; d++)\n {\n int cnt = 0;\n int cnt2 = 0;\n for (int i = d; i < s.Length; i++)\n {\n if (s[i - d] == s[i])\n {\n if (b == false)\n {\n b = true;\n cnt2 = Math.Max(cnt, cnt2);\n cnt = 0;\n }\n cnt++;\n }\n else\n {\n b = false;\n }\n }\n max = Math.Max(Math.Max(cnt, cnt2), max);\n }\n Console.WriteLine(max);\n Console.ReadLine();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\nnamespace Task23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int ans = 0;\n for (int start = 0; start < input.Length - 2; start++)\n {\n\n for (int count = 2; count < input.Length; count++)\n {\n for (int inner = start+1;inner <= input.Length - count ; inner++ )\n {\n if (\n input.Substring(start, count).Equals(input.Substring(inner, count))\n ) ans = count > ans ? count : ans;\n }\n }\n\n }\n\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n var listSample = new List();\n \n var result = 0;\n\n for (int i = 1; i <= input.Length; i++)\n {\n for (int j = 0; j < input.Length; j++)\n {\n if (j + i <= input.Length)\n listSample.Add(input.Substring(j, i));\n else break;\n }\n }\n\n var selectItem = (from res in listSample\n where listSample.Count(y => res == y) > 1\n && res.Length > 1\n select res).Distinct();\n\n \n\n foreach (var item in selectItem)\n {\n if (item.ToString().Length > result)\n {\n result = item.ToString().Length;\n }\n }\n\n Console.WriteLine(result);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int n = line.Length - 1;\n Dictionary d = new Dictionary();\n\n while (n > 0)\n {\n List list = Split(line, n);\n\n foreach (String s in list)\n {\n int o = Occurs(line, s);\n if (o >= 2)\n {\n d.Add(s, o);\n }\n }\n \n n--;\n }\n\n if (d.Count > 0)\n {\n int max = d.Values.Max();\n\n foreach (String s in d.Keys)\n {\n if (d[s] == max)\n {\n Console.WriteLine(s.Length);\n break;\n }\n }\n }\n else\n Console.WriteLine(\"0\");\n\n }\n\n static List Split(string input,int n)\n {\n List list = new List();\n int counter = 0;\n\n while (counter+n <= input.Length)\n {\n if (!list.Contains(input.Substring(counter, n)))\n {\n list.Add(input.Substring(counter, n));\n \n }\n counter++;\n \n }\n\n return list;\n }\n\n static int Occurs(string input,string sub)\n {\n int counter = 0;\n int count = 0;\n while (counter + sub.Length <= input.Length)\n {\n if (input.Substring(counter, sub.Length) == sub)\n {\n count++;\n }\n counter++;\n }\n return count;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _23A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line = Console.ReadLine();\n int n = line.Length - 1;\n Dictionary d = new Dictionary();\n\n while (n > 1)\n {\n List list = Split(line, n);\n\n foreach (String s in list)\n {\n int o = Occurs(line, s);\n if (o >= 2)\n {\n d.Add(s, o);\n }\n }\n \n n--;\n }\n\n if (d.Count > 0)\n {\n int max = d.Values.Max();\n\n foreach (String s in d.Keys)\n {\n if (d[s] == max)\n {\n Console.WriteLine(s.Length);\n break;\n }\n }\n }\n else\n Console.WriteLine(\"0\");\n\n }\n\n static List Split(string input,int n)\n {\n List list = new List();\n int counter = 0;\n\n while (counter+n <= input.Length)\n {\n if (!list.Contains(input.Substring(counter, n)))\n {\n list.Add(input.Substring(counter, n));\n \n }\n counter++;\n \n }\n\n return list;\n }\n\n static int Occurs(string input,string sub)\n {\n int counter = 0;\n int count = 0;\n while (counter + sub.Length <= input.Length)\n {\n if (input.Substring(counter, sub.Length) == sub)\n {\n count++;\n }\n counter++;\n }\n return count;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace JalalHani\n{\n class Vertex\n {\n public List relations = new List();\n public List weights = new List();\n public Vertex(int r , int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n public void AddInfo (int r, int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n ////Dijkstra\n //int[] data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int n = data[0], m = data[1];\n //Dictionary Edges = new Dictionary();\n //for (int i = 0; i < m; i++)\n //{\n // data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n // int k = data[0], r = data[1], w = data[2];\n // if (Edges.Keys.Contains(k))\n // {\n // Edges[k].AddInfo(r,w);\n // }\n // else\n // {\n // Edges.Add(k, new Vertex(r, w));\n // }\n //}\n\n //foreach (var edge in Edges)\n //{\n\n //}\n }\n\n\n class Program\n {\n \n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long o = 0;\n List rep = new List();\n\n for (int length = 2; length < s.Length; length++)\n {\n for (int j = 0; j <= s.Length-length; j++)\n {\n string subS = s.Substring(j, length);\n bool u = SearchInSubstring(s,subS,j,length);\n if (u)\n {\n rep.Add(subS);\n }\n }\n }\n if (rep.Count > 0)\n o = rep.Select(x => x.Length).Max();\n Console.WriteLine(o);\n }\n \n static bool SearchInSubstring (string source, string cut,int indexStart, int EndString) {\n bool found = false;\n\n found = source.Remove(indexStart,1).Contains(cut);\n\n return found;\n }\n\n static int Test(int v , int m)\n {\n int p1 = 0;\n int dif = (int)Math.Ceiling((double)m / v);\n int diff = v * dif;\n p1 = (diff - m);\n p1 += dif == 2 ? 1 : dif; \n\n\n return p1;\n }\n\n static void MulticasesQuestion()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n SolveTestCase();\n }\n static void SolveTestCase()\n {\n \n }\n static int GCD(int a1, int a2)\n {\n int mx = Math.Max(a1, a2);\n int mn = Math.Min(a1, a2);\n\n if (mx % mn == 0)\n {\n return mn;\n }\n else GCD(mn, mx % mn);\n return 1;\n }\n\n static BigInteger Pow(int b, int a)\n {\n BigInteger x = 1;\n\n for (int i = 0; i < a; i++)\n {\n x *= b;\n }\n\n return x;\n }\n static void LeastCostBracketSequence()\n {\n var input = Console.ReadLine().ToCharArray();\n var isSolutionExists = true;\n long totalCost = 0;\n var balance = 0;\n\n\n var sortedVariants = new List();\n var comparer = new ByCostSwitch();\n\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '(')\n {\n balance++;\n }\n else if (input[i] == ')')\n {\n balance--;\n }\n else\n {\n var costValue = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n var variant = new Variant()\n {\n CostSwitch = costValue[0] - costValue[1],\n Position = i\n };\n\n var index = sortedVariants.BinarySearch(variant, comparer);\n if (index < 0)\n {\n index = ~index;\n }\n\n sortedVariants.Insert(index, variant);\n\n totalCost += costValue[1];\n balance--;\n }\n\n\n if (balance < 0)\n {\n if (sortedVariants.Count == 0)\n {\n isSolutionExists = false;\n break;\n }\n\n\n var sortedVariant = sortedVariants[0];\n\n input[sortedVariant.Position] = '(';\n totalCost += sortedVariant.CostSwitch;\n balance += 2;\n sortedVariants.RemoveAt(0);\n }\n }\n\n isSolutionExists = (balance == 0);\n\n if (isSolutionExists)\n {\n Console.WriteLine(totalCost);\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '?')\n {\n Console.Write(')');\n }\n else\n {\n Console.Write(input[i]);\n }\n }\n Console.WriteLine();\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n class Commands\n {\n public static int[] NextIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n }\n public static List NextIntList\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n public static int[] NextSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static int[] NextDescSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static long[] NextLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToArray();\n }\n }\n public static List NextLongList\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToList();\n }\n }\n public static long[] NextSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static long[] NextDescSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static int NextInt\n {\n get\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static string NextString\n {\n get { return Console.ReadLine(); }\n }\n }\n\n private class Variant\n {\n public int CostSwitch;\n public int Position;\n }\n\n private class ByCostSwitch : IComparer\n {\n #region IComparer implementation\n public int Compare(Variant x, Variant y)\n {\n return x.CostSwitch.CompareTo(y.CostSwitch);\n }\n #endregion\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Threading;\nusing System.Numerics;\nusing System.Globalization;\n\nnamespace JalalHani\n{\n class Vertex\n {\n public List relations = new List();\n public List weights = new List();\n public Vertex(int r , int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n public void AddInfo (int r, int w)\n {\n this.relations.Add(r);\n this.weights.Add(w);\n }\n ////Dijkstra\n //int[] data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n //int n = data[0], m = data[1];\n //Dictionary Edges = new Dictionary();\n //for (int i = 0; i < m; i++)\n //{\n // data = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();\n // int k = data[0], r = data[1], w = data[2];\n // if (Edges.Keys.Contains(k))\n // {\n // Edges[k].AddInfo(r,w);\n // }\n // else\n // {\n // Edges.Add(k, new Vertex(r, w));\n // }\n //}\n\n //foreach (var edge in Edges)\n //{\n\n //}\n }\n\n\n class Program\n {\n \n public static void Main(string[] args)\n {\n string s = Console.ReadLine();\n long o = 0;\n List rep = new List();\n\n for (int length = 1; length < s.Length; length++)\n {\n for (int j = 0; j <= s.Length-length; j++)\n {\n string subS = s.Substring(j, length);\n bool u = SearchInSubstring(s,subS,j,length);\n if (u)\n {\n rep.Add(subS);\n }\n }\n }\n if (rep.Count > 0)\n o = rep.Select(x => x.Length).Max();\n Console.WriteLine(o);\n }\n \n static bool SearchInSubstring (string source, string cut,int indexStart, int EndString) {\n bool found = false;\n\n found = source.Remove(indexStart,1).Contains(cut);\n\n return found;\n }\n\n static int Test(int v , int m)\n {\n int p1 = 0;\n int dif = (int)Math.Ceiling((double)m / v);\n int diff = v * dif;\n p1 = (diff - m);\n p1 += dif == 2 ? 1 : dif; \n\n\n return p1;\n }\n\n static void MulticasesQuestion()\n {\n int t = int.Parse(Console.ReadLine());\n for (int i = 0; i < t; i++)\n SolveTestCase();\n }\n static void SolveTestCase()\n {\n \n }\n static int GCD(int a1, int a2)\n {\n int mx = Math.Max(a1, a2);\n int mn = Math.Min(a1, a2);\n\n if (mx % mn == 0)\n {\n return mn;\n }\n else GCD(mn, mx % mn);\n return 1;\n }\n\n static BigInteger Pow(int b, int a)\n {\n BigInteger x = 1;\n\n for (int i = 0; i < a; i++)\n {\n x *= b;\n }\n\n return x;\n }\n static void LeastCostBracketSequence()\n {\n var input = Console.ReadLine().ToCharArray();\n var isSolutionExists = true;\n long totalCost = 0;\n var balance = 0;\n\n\n var sortedVariants = new List();\n var comparer = new ByCostSwitch();\n\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '(')\n {\n balance++;\n }\n else if (input[i] == ')')\n {\n balance--;\n }\n else\n {\n var costValue = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();\n var variant = new Variant()\n {\n CostSwitch = costValue[0] - costValue[1],\n Position = i\n };\n\n var index = sortedVariants.BinarySearch(variant, comparer);\n if (index < 0)\n {\n index = ~index;\n }\n\n sortedVariants.Insert(index, variant);\n\n totalCost += costValue[1];\n balance--;\n }\n\n\n if (balance < 0)\n {\n if (sortedVariants.Count == 0)\n {\n isSolutionExists = false;\n break;\n }\n\n\n var sortedVariant = sortedVariants[0];\n\n input[sortedVariant.Position] = '(';\n totalCost += sortedVariant.CostSwitch;\n balance += 2;\n sortedVariants.RemoveAt(0);\n }\n }\n\n isSolutionExists = (balance == 0);\n\n if (isSolutionExists)\n {\n Console.WriteLine(totalCost);\n for (var i = 0; i < input.Length; i++)\n {\n if (input[i] == '?')\n {\n Console.Write(')');\n }\n else\n {\n Console.Write(input[i]);\n }\n }\n Console.WriteLine();\n }\n else\n {\n Console.WriteLine(\"-1\");\n }\n }\n class Commands\n {\n public static int[] NextIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToArray();\n }\n }\n public static List NextIntList\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n }\n public static int[] NextSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static int[] NextDescSortedIntArray\n {\n get\n {\n return Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static long[] NextLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToArray();\n }\n }\n public static List NextLongList\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).ToList();\n }\n }\n public static long[] NextSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();\n }\n }\n public static long[] NextDescSortedLongArray\n {\n get\n {\n return Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x => x).ToArray();\n }\n }\n public static int NextInt\n {\n get\n {\n return int.Parse(Console.ReadLine());\n }\n }\n\n public static string NextString\n {\n get { return Console.ReadLine(); }\n }\n }\n\n private class Variant\n {\n public int CostSwitch;\n public int Position;\n }\n\n private class ByCostSwitch : IComparer\n {\n #region IComparer implementation\n public int Compare(Variant x, Variant y)\n {\n return x.CostSwitch.CompareTo(y.CostSwitch);\n }\n #endregion\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\n\nclass Program\n{\n static void Main(string[] args)\n {\n //Console.SetIn(File.OpenText(\"../../input.txt\"));\n\n string str = \"\";\n while (!string.IsNullOrEmpty((str = Console.ReadLine())))\n {\n int res = int.MinValue;\n for (int i = 0; i < str.Length; ++i)\n {\n for (int j = i + 1; j < str.Length; ++j)\n {\n int k = 0;\n while (i + k < str.Length && j + k < str.Length && str[i + k] == str[j + k])\n {\n ++k;\n }\n res = Math.Max(res, k);\n }\n } \n Console.WriteLine(res);\n }\n }\n}\n\n"}, {"source_code": "/*******************************************************************************\n* Author: Nirushuu\n*******************************************************************************/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\nusing System.IO;\nusing System.Globalization;\nusing System.Numerics;\n\n/*******************************************************************************\n* IO from Kattio.cs from open.kattis.com/help/csharp */\npublic class NoMoreTokensException : Exception\n{\n}\n\npublic class Tokenizer\n{\n string[] tokens = new string[0];\n private int pos;\n StreamReader reader;\n\n public Tokenizer(Stream inStream)\n {\n var bs = new BufferedStream(inStream);\n reader = new StreamReader(bs);\n }\n\n public Tokenizer() : this(Console.OpenStandardInput())\n {\n // Nothing more to do\n }\n\n private string PeekNext()\n {\n if (pos < 0)\n // pos < 0 indicates that there are no more tokens\n return null;\n if (pos < tokens.Length)\n {\n if (tokens[pos].Length == 0)\n {\n ++pos;\n return PeekNext();\n }\n return tokens[pos];\n }\n string line = reader.ReadLine();\n if (line == null)\n {\n // There is no more data to read\n pos = -1;\n return null;\n }\n // Split the line that was read on white space characters\n tokens = line.Split(null);\n pos = 0;\n return PeekNext();\n }\n\n public bool HasNext()\n {\n return (PeekNext() != null);\n }\n\n public string Next()\n {\n string next = PeekNext();\n if (next == null)\n throw new NoMoreTokensException();\n ++pos;\n return next;\n }\n}\n\npublic class Scanner : Tokenizer\n{\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n public float NextFloat()\n {\n return float.Parse(Next());\n }\n\n public double NextDouble()\n {\n return double.Parse(Next());\n }\n}\n\npublic class BufferedStdoutWriter : StreamWriter\n{\n public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))\n {\n }\n}\n/******************************************************************************/\n\n/*******************************************************************************\n* DisjointSet datastructure */\npublic struct DisjointSet {\n public int[] parent;\n public int[] rank;\n public DisjointSet(int n) {\n parent = new int[n];\n for (int i = 0; i < n; ++i) {\n parent[i] = i;\n }\n rank = new int[n];\n }\n\n public int Find(int i) {\n int idx = i;\n var compress = new List();\n while (idx != parent[idx]) {\n compress.Add(idx);\n idx = parent[idx];\n }\n\n foreach (var e in compress) { // path compress \n parent[e] = idx;\n }\n return idx;\n }\n\n public void Union(int a, int b) {\n int aPar = this.Find(a);\n int bPar = this.Find(b);\n\n if (rank[aPar] > rank[bPar]) { // by rank\n parent[bPar] = aPar;\n } else {\n parent[aPar] = bPar;\n }\n if (rank[aPar] == rank[bPar]) {\n ++rank[bPar];\n }\n }\n}\n\nclass MaxHeap {\n List data;\n\n public MaxHeap() {\n data = new List();\n }\n\n public void Add(int a) {\n data.Add(a);\n int idx = data.Count - 1;\n int parent = (int) Math.Floor((double) (idx - 1) / 2);\n while (idx != 0 && (data[idx] > data[parent])) {\n int tmp = data[parent];\n data[parent] = data[idx];\n data[idx] = tmp;\n\n idx = parent;\n parent = (int) Math.Floor((double) (idx - 1) / 2);\n }\n }\n\n public int Pop() {\n int res = data[0];\n data[0] = data[data.Count - 1];\n data.RemoveAt(data.Count - 1);\n\n int idx = 0;\n while (true) {\n int child1 = (2 * idx) + 1;\n int child2 = (2 * idx) + 2;\n\n if (child1 >= data.Count) { // no children\n break;\n } else if (child2 >= data.Count) { // one child\n if (data[idx] < data[child1]) {\n int tmp = data[idx];\n data[idx] = data[child1];\n data[child1] = tmp;\n }\n break;\n } else { // two children\n int maxChild = data[child1] > data[child2] ? child1 : child2;\n if (data[idx] < data[maxChild]) {\n int tmp = data[idx];\n data[idx] = data[maxChild];\n data[maxChild] = tmp;\n idx = maxChild;\n continue;\n } else { // no swap\n break;\n }\n }\n } \n\n return res; \n }\n\n\n}\n\n\nclass Dequeue {\n public Dictionary data = new Dictionary();\n int firstIdx;\n public int Count;\n public Dequeue() {\n data = new Dictionary();\n firstIdx = 1;\n Count = 0;\n }\n\n public void PushFront(int a) {\n data[firstIdx - 1] = a;\n ++Count;\n --firstIdx;\n }\n\n public void PushBack(int a) {\n data[firstIdx + Count] = a;\n ++Count;\n }\n\n public int PopFront() {\n --Count;\n ++firstIdx;\n return data[firstIdx - 1];\n }\n\n public int PopBack() {\n --Count;\n return data[firstIdx + Count];\n }\n\n public int Get(int n) {\n return data[firstIdx + n];\n }\n}\n/******************************************************************************/\n\nclass MainClass {\n\n // Debug functions \n static void debug(IEnumerable a, string s = \"\") {\n Console.WriteLine($\"name: {s}\");\n int i = 0;\n foreach (var e in a) {\n Console.WriteLine($\"value {i}: {e}\");\n ++i;\n }\n }\n static void dbg(T a, string s = \"\") {\n Console.WriteLine($\"name: {s} value: {a}\");\n }\n ////////////////////\n \n static int gcd(int a, int b) {\n while (b != 0) {\n int t = b;\n b = a % b;\n a = t;\n }\n return a;\n }\n\n static bool between(int a, int b, int c) {\n return (a >= b && a <= c);\n }\n\n static int findIn(string s, string a) {\n for (int i = 0; i < s.Length - (a.Length - 1); ++i) {\n bool found = true;\n for (int j = 0; j < a.Length; ++j) {\n if (s[i + j] != a[j]) {\n found = false;\n break;\n }\n }\n\n if (found) {\n return i;\n }\n }\n\n return -1;\n }\n\n static double dist(double a, double b, double c, double d) {\n return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));\n }\n\n public static void Main() {\n \n var sc = new Scanner();\n var wr = new BufferedStdoutWriter();\n var dot = new NumberFormatInfo();\n dot.NumberDecimalSeparator = \".\";\n\n \n var s = new List(sc.Next());\n for (int i = s.Count - 1; i > 0; --i) {\n for (int j = 1; j + i - 1 < s.Count; ++j) {\n bool ok = true;\n for (int l = 0; l < i; ++l) {\n if (s[l] != s[j + l]) {\n ok = false;\n break;\n }\n }\n if (ok) {\n wr.WriteLine(i);\n wr.Flush();\n return;\n }\n }\n }\n\n wr.WriteLine(0);\n \n wr.Flush();\n\n \n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n string str = tr.ReadLine();\n\n int maxlen = 0; \n \n for (int i = 2; i < str.Length; i++)\n {\n \n Dictionary ret = new Dictionary();\n for (int j = 0; j < str.Length; j++)\n {\n if (i + j > str.Length) break;\n string sub = string.Empty;\n for (int k = j; k < j+i; k++)\n {\n sub += str[k];\n }\n if (ret.ContainsKey(sub))\n {\n maxlen = Math.Max(i, maxlen);\n }\n else\n {\n ret[sub] = true;\n }\n }\n }\n \n\n Console.WriteLine(maxlen);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n string mainStr = RL();\n\n for (int i = mainStr.Length - 1; i > 0; i--) {\n for (int j = 0; j < mainStr.Length - i; j++) {\n string subs = mainStr.Substring(j, i);\n int tmp = KMP(mainStr, subs);\n if (tmp >= 2) {\n println(subs.Length);\n //close(file);\n return;\n }\n }\n }\n\n println(0);\n\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n int[] fail = new int[subs.Length+1];\n\n fail[1] = 0;\n for(int i=2; i<=subs.Length; i++){\n int tmp=fail[i-1];\n while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i] = tmp + 1;\n }\n\n int posInText=0, posInSubs = 0;\n while (posInText < mainStr.Length) {\n if (posInSubs == 0 || mainStr[posInText] == subs[posInSubs])\n {\n posInSubs++;\n posInText++;\n } else {\n posInSubs = fail[posInSubs];\n }\n\n if (posInSubs == subs.Length) {\n count++;\n posInText = posInText - posInSubs + 1;\n posInSubs = 0;\n }\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n int res = -1;\n string s = RL();\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j <= s.Length - i; j++) {\n string subs = s.Substring(j, i);\n res = Math.Max(res, KMP(s, subs));\n }\n }\n\n if (res<2) println(\"0\");\n else println(res);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) { \n int count=0;\n int[] fail = new int[subs.Length + 1];\n \n fail[0]=0;\n for(int i=1; i0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i]=tmp+1;\n }\n\n int posText=0, subText=0;\n while(posText { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n string s = RL();\n\n for (int i = s.Length - 1; i > 1; i--) {\n for (int j = 0; j < s.Length - i; j++) {\n string subs = s.Substring(j, i);\n int tmp = KMP(s, subs);\n if (tmp >= 2) {\n println(subs.Length);\n return;\n }\n }\n }\n\n println(0);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n bool flag;\n\n for (int i = 0; i < mainStr.Length-subs.Length+1; i++) {\n flag = true;\n for (int j = 0, k=i; j < subs.Length; j++, k++) {\n if (subs[j] != mainStr[k]) {\n flag = false;\n break;\n }\n }\n if (flag) count++;\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n int res = -1;\n string s = RL();\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j <= s.Length - i; j++) {\n string subs = s.Substring(j, i);\n res = Math.Max(res, KMP(s, subs));\n //println(subs+\" res=\"+res);\n }\n }\n\n if (res<2) println(\"0\");\n else println(res);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) { \n int count=0;\n int[] fail = new int[subs.Length + 1];\n \n fail[1]=0;\n for(int i=2; i<=subs.Length; i++){\n int tmp=fail[i-1];\n while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i]=tmp+1;\n }\n\n int posText=0, subText=0;\n while(posText { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "using System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n string mainStr = RL();\n\n for (int i = mainStr.Length - 1; i > 1; i--) {\n for (int j = 0; j < mainStr.Length - i; j++) {\n string subs = mainStr.Substring(j, i);\n int tmp = KMP(mainStr, subs);\n if (tmp >= 2) {\n println(subs.Length);\n //close(file);\n return;\n }\n }\n }\n\n println(0);\n\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n int[] fail = new int[subs.Length+1];\n\n fail[1] = 0;\n for(int i=2; i<=subs.Length; i++){\n int tmp=fail[i-1];\n while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i] = tmp + 1;\n }\n\n int posInText=0, posInSubs = 0;\n while (posInText < mainStr.Length) {\n if (posInSubs == 0 || mainStr[posInText] == subs[posInSubs])\n {\n posInSubs++;\n posInText++;\n } else {\n posInSubs = fail[posInSubs];\n }\n\n if (posInSubs == subs.Length) {\n count++;\n posInText = posInText - posInSubs + 1;\n posInSubs = 0;\n }\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n int res = -1;\n string s = RL()+\"&\";\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j <= s.Length - i; j++) {\n string subs = s.Substring(j, i);\n res = Math.Max(res, KMP(s, subs));\n }\n }\n\n if (res<2) println(\"0\");\n else println(res);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) { \n int count=0;\n int[] fail = new int[subs.Length + 1];\n \n fail[1]=0;\n for(int i=2; i<=subs.Length; i++){\n int tmp=fail[i-1];\n while(tmp>0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i]=tmp+1;\n }\n\n int posText=0, subText=0;\n while(posText { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n int res = -1;\n string s = RL();\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j < s.Length - i; j++) {\n string subs = s.Substring(j, i);\n res = Math.Max(res, KMP(s, subs));\n }\n }\n\n if (res<2) println(\"0\");\n else println(res);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) { \n int count=0;\n int[] fail = new int[subs.Length + 1];\n \n fail[0]=0;\n for(int i=1; i0 && subs[tmp]!=subs[i-1]) tmp=fail[tmp];\n fail[i]=tmp+1;\n }\n\n int posText=0, subText=0;\n while(posText { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.IO;\nusing System.Globalization;\n\nnamespace acm{\n class Program{\n static void Main(string[] args){\n System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n#if DEBUG\n open(file);\n#endif\n\n int res = -1;\n string s = RL()+\"&\";\n\n for (int i = s.Length - 1; i > 0; i--) {\n for (int j = 0; j <= s.Length - i; j++) {\n string subs = s.Substring(j, i);\n res = Math.Max(res, KMP(s, subs));\n }\n }\n\n if (res<2) println(\"0\");\n else println(res);\n\n#if DEBUG\n close(file);\n#endif\n }\n\n static int KMP(string mainStr, string subs) {\n int count = 0;\n\n for (int i = 0; i < mainStr.Length-subs.Length; i++) {\n bool flag = true;\n for (int j = 0; j < subs.Length; j++) {\n if (subs[j] != mainStr[i]) {\n flag = false;\n break;\n }\n }\n if (flag) count++;\n }\n\n return count;\n }\n\n\n#if DEBUG\n static bool file = true;\n static TextReader fin = new StreamReader(\"input.txt\");\n static TextWriter fout = new StreamWriter(\"output.txt\");\n static void open(bool f) { if (f) { Console.SetIn(fin); Console.SetOut(fout); } }\n static void close(bool f) { if (f) fout.Close(); }\n#endif\n struct pair { public T1 first; public T2 second; }\n static void fill(T[] d, T val) { for (int i = 0; i < d.Length; i++) d[i] = val; }\n static void fill(List d, T val) { for (int i = 0; i < d.Count; i++) d[i] = val; }\n static void swap(List l, int a, int b) { T tmp = l[a]; l[a] = l[b]; l[b] = tmp; }\n static void swap(ref T a, ref T b) { T t = a; a = b; b = t; }\n static int readInt() { return int.Parse(RL()); }\n static void print(object o) { Console.Write(o); }\n static void print(String f, params object[] o) { Console.Write(f, o); }\n static void println() { Console.WriteLine(); }\n static void println(object o) { Console.WriteLine(o); }\n static void println(String f, params object[] o) { Console.WriteLine(f, o); }\n static string RL() { return Console.ReadLine(); }\n static int RC() { return Console.Read(); }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass CF_23A\n{\n static void Main()\n {\n string str = Console.ReadLine();\n int len;\n for (len = str.Length; len >= 0; len--)\n {\n for (int i = 0; i + len <= str.Length; i++)\n {\n string sub = str.Substring(i, len);\n int cnt = 0;\n for (int p = str.IndexOf(sub, 0) ; p < str.Length && p != -1; p = str.IndexOf(sub, ++p))\n {\n cnt++;\n if (cnt >= 2)\n {\n Console.WriteLine(len);\n return;\n }\n }\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n while ((line = Console.ReadLine()) != null)\n {\n int mlen = 0;\n for (int j = 0; j < line.Length; j++)\n {\n int len = 0;\n for (int i = j+1; i < line.Length - j; i++)\n {\n int lmlen = comp(line, j, i);\n if (lmlen > len) len = lmlen;\n }\n if (len > mlen) mlen = len;\n }\n Console.WriteLine(mlen);\n }\n }\n static int comp(string str, int i, int j)\n {\n int len = 0;\n while (i < str.Length && j < str.Length)\n {\n if (str[i] != str[j]) return len;\n i++; j++; len++;\n }\n return len;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace q1\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n string buf = tr.ReadLine();\n int max = 0;\n string sub;\n for (int i = 0; i < buf.Length; i++)\n {\n for (int j = 2; i + j <= buf.Length; j++)\n {\n sub = buf.Substring(i, j);\n if ((buf.Substring(i+1)).Contains(sub))\n {\n if (max < sub.Length)\n {\n max = sub.Length;\n }\n }\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\n\nnamespace q1\n{\n class Program\n {\n static void Main(string[] args)\n {\n TextReader tr = Console.In;\n string buf = tr.ReadLine();\n int max = 0;\n string sub;\n for (int i = 0; i < buf.Length; i++)\n {\n for (int j = 2; i + j < buf.Length; j++)\n {\n sub = buf.Substring(i, j);\n if ((buf.Substring(i+1)).Contains(sub))\n {\n if (max < sub.Length)\n {\n max = sub.Length;\n }\n }\n }\n }\n Console.WriteLine(max);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int max = 0;\n int d = 1; //\u043a\u0430\u043a \u0431\u044d \u0441\u0434\u0432\u0438\u0433\n bool b = false;\n for (; d < s.Length; d++)\n {\n int cnt = 0;\n int cnt2 = 0;\n for (int i = d; i < s.Length; i++)\n {\n if (s[i - d] == s[i])\n {\n if (b == false)\n {\n b = true;\n cnt2 = Math.Max(cnt, cnt2);\n cnt = 0;\n }\n cnt++;\n }\n }\n max = Math.Max(Math.Max(cnt, cnt2), max);\n }\n Console.WriteLine(max);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int max = 0;\n int d = 1; //\u043a\u0430\u043a \u0431\u044d \u0441\u0434\u0432\u0438\u0433\n for (; d < s.Length; d++)\n {\n int cnt = 0;\n for (int i = d; i < s.Length; i++)\n {\n if (s[i - d] == s[i])\n cnt++;\n }\n if (max < cnt)\n max = cnt;\n }\n Console.WriteLine(max);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nusing System.Collections.Generic;\n\nusing System.Linq;\n\nusing System.Text;\n\nusing System.IO;\n\n\n\nnamespace FirstApp\n{\n\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n string[] substr = new string[10000];\n\n int[] count = new int[10000];\n\n int num = 0;\n\n string str = Console.ReadLine();\n // string str = \"ababa\";\n\n bool check;\n\n for (int i = 0; i < 10000; i++)\n {\n\n count[i] = 0;\n\n }\n\n for (var i = 0; i < str.Length; i++)\n {\n\n StringBuilder tmp = new StringBuilder(\"\", 1000);\n\n for (var j = i; j < str.Length; j++)\n {\n\n\n\n tmp.AppendFormat(Convert.ToString(str[j]));\n\n if (tmp.Length > 1)\n {\n\n //\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\n\n check = true;\n\n for (var m = 0; m < num; m++)\n {\n\n if (String.Compare(Convert.ToString(tmp), Convert.ToString(substr[m]), true) == 0)\n {\n\n check = false;\n\n }\n\n }\n\n //\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438\n\n if (check == true)\n {\n\n substr[num] = Convert.ToString(tmp);\n\n\n\n num++;\n\n }\n\n }\n\n }\n\n }\n\n\n //\u0422\u0435\u0441\u0442 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438\n for (var r = 0; r < num; r++)\n {\n // Console.WriteLine(substr[r]);\n }\n\n //\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0438\u0441\u043a\n\n //string rrrr = \"ababa\";\n //Console.WriteLine(str.IndexOf(\"ab\",2));\n\n for (var r = 0; r < num; r++)\n {\n int pos = -1; //\u043f\u043e\u0437\u0442\u0446\u0438\u044f\n\n // Console.WriteLine(\"KEY ========= \" + substr[r] + \" ==========\");\n for (int st = 0; st < str.Length; st++)\n {\n \n\n int index = str.IndexOf(substr[r], st);\n\n //Console.WriteLine(\"STEP\" + st + \"=\");\n\n if (index > -1 && pos != index)\n {\n\n count[r] = count[r] + 1;\n\n // Console.WriteLine(\"=\" + substr[r] + \"=\");\n pos = index; \n //Console.WriteLine(st);\n }\n\n // Console.WriteLine(substr[r]);\n }\n\n\n\n\n\n }\n\n //\u043e\u0442\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0443\n int symcount = 0;\n for (var r = 0; r < num; r++)\n {\n if (count[r] > 1)\n {\n // Console.WriteLine(count[r]);\n if (substr[r].Length > symcount)\n {\n symcount = substr[r].Length;\n }\n }\n }\n\n Console.WriteLine(symcount);\n\n \n\n // Console.ReadKey();\n\n }\n\n\n\n // static bool Check(string tmp){\n\n\n // return true;\n\n // }\n\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n string tmpStr;\n string podstr;\n string otvet=\"\";\n\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n\n Console.WriteLine(otvet);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"ababa\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n \n tmpStr = str.Substring(i+1);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n // string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i <= str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n if (i + g == 0) continue;\n tmpStr = str.Substring(i+g-1);\n podstr = str.Substring(i,g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"a\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length+1; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"aaaaaaaa\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n \n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length <= podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n string tmpStr;\n string podstr;\n string otvet=\"\";\n\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n\n Console.WriteLine(otvet.Length);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"ababa\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n int count;\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n // string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n \n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"a\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n if (str.Length == 1) count = 1;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n // string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i <= str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"ababa\";\n string tmpStr;\n string podstr;\n string otvet = \"^\";\n int count;\n\n\n\n for (int i = 0; i < str.Length; i++)\n {\n for (int g = 1; g < str.Length - i; g++)\n {\n\n tmpStr = str.Substring(i + 1);\n podstr = str.Substring(i, g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if (otvet.Length <= podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n\n }\n else\n {\n break;\n }\n\n }\n\n }\n\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"ababa\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n \n tmpStr = str.Substring(i+1);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=1; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n int count;\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n int count;\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n\n\n\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"asdgsfcgsdbsdtczsdx zvv bxcdxfvsczzxcvgvbjfghjdcthvhbdcsertsecsdvxdbcgcxgxd jxfcdgxfhxdfhxdhdhxfgnbxmjncjbcmgbxf\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i <= str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n\n tmpStr = str.Substring(i+g);\n podstr = str.Substring(i,g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length < podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n //string str = GetString();\n string str = \"abcd\";\n string tmpStr;\n string podstr;\n string otvet=\"^\";\n int count;\n\n \n\n for (int i = 0; i < str.Length; i++)\n {\n for(int g=0; g < str.Length-i; g++)\n {\n \n tmpStr = str.Substring(i+1);\n podstr = str.Substring(i,g+1);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if(otvet.Length <= podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n \n }\n else\n {\n break;\n }\n\n }\n \n }\n \n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Program1\n{\n class Program\n {\n\n static int Main(string[] args)\n {\n\n string str = GetString();\n //string str = \"\";\n string tmpStr;\n string podstr;\n string otvet = \"^\";\n int count;\n\n\n\n for (int i = 0; i < str.Length; i++)\n {\n for (int g = 1; g < str.Length - i; g++)\n {\n\n tmpStr = str.Substring(i + g);\n podstr = str.Substring(i, g);\n\n if (tmpStr.IndexOf(podstr) > -1)\n {\n if (otvet.Length <= podstr.Length)\n {\n otvet = podstr;\n }\n else continue;\n\n }\n else\n {\n break;\n }\n\n }\n\n }\n\n if (otvet == \"^\") count = 0; else count = otvet.Length;\n Console.WriteLine(count);\n\n return 0;\n }\n\n static string GetString()\n {\n return Console.ReadLine();\n }\n\n }\n}"}], "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7"} {"source_code": "\ufeffusing System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Solution\n{\n static int pos(int n)\n {\n int sum = 0;\n for(int i=1; i<=n; i++)\n {\n sum += i;\n }\n if (sum % 2 == 0)\n return 0;\n else return 1;\n }\n static void Main(string[] args)\n {\n int n;\n string s=Console.ReadLine();\n n = int.Parse(s);\n int res = pos(n);\n Console.WriteLine(res);\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n /*\n \nstring[] input = Console.ReadLine().Split(' ');\n int n = int.Parse(input[0]);\n string tt = \"1 \" + Console.ReadLine();\n int[] a = tt.Split(' ').Select(q => Convert.ToInt32(q) - 1).ToArray();\n tt = Console.ReadLine();\n int[] b = tt.Split(' ').Select(q => Convert.ToInt32(q)).ToArray();\n int[] res = Enumerable.Repeat(-1, n).ToArray();\n res[0] = b[0];\n Dictionary> childs = new Dictionary>();\n for (int i = 0; i < n; i++)\n childs.Add(i, new List());\n2\n */\n class A\n {\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n long n = int.Parse(input);\n \n n = n % 4;\n if (n == 0)\n Console.WriteLine(0);\n else if (n == 1)\n Console.WriteLine(1);\n else if (n == 2)\n Console.WriteLine(1);\n else if (n == 3)\n Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int t = int.Parse(Console.ReadLine());\n Console.WriteLine(t%4==1||t%4==2?1:0);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n public class Program\n {\n private static void Main()\n {\n var line = Console.ReadLine();\n var n = long.Parse(line);\n\n var rem = n % 4;\n\n\n if (rem == 0 || rem == 3)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\n\n\n\nnamespace problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n , temp;\n\n n= Convert.ToInt64(Console.ReadLine());\n \n temp = (n*(n+1))/ 2;\n\n Console.WriteLine(temp % 2);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces1102A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long sum = (n * (n + 1)) / 2;\n if (sum % 2 != 0)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _1000\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Console.SetIn(new StreamReader(\"input.txt\"));\n solve_531A();\n }\n\n public static void solve_531A()\n {\n long n = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine((n * (n + 1) / 2) % 2 == 0 ? 0 : 1);\n }\n\n /*\n The issue here is that you cannot easily calculate 2 to the power to 10000000.\n For that you need big arhithmetique techniques. And even this may not help\n because you need to quickly calculate powers of 2 and then you need to divide\n big integer by short integer values.\n But if you look into the problem you can actually observe that m\n can only give differnt reminders if it is less than n. If n is larger than m\n then you always have the reminder m. Furthermore, we can see by the problem\n statement that m can be maximum 8-digit number. So in order to calculate\n different reminders n must be less then 27). Why 27.\n Well, we know that (2^31) - 1 is the upper integer range int c#. And it is a 10\n digit number. Let't decrease 31 by 1 to see when we have an integer with 8 digits.\n Using calculator it's pretty easy.\n */\n public static void solve_hello2018A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int m = Convert.ToInt32(Console.ReadLine());\n int answer = 0;\n if (n >= 27)\n {\n answer = m;\n }\n else\n {\n answer = m % Convert.ToInt32(Math.Pow(2, n));\n }\n\n Console.WriteLine(answer);\n }\n\n public static void solve_574B()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nk[0]);\n int k = Convert.ToInt32(nk[1]);\n\n int i = 1;\n int count = 1;\n while (i != n && i - count == k)\n {\n i++;\n count += count + 1;\n }\n\n Console.WriteLine(count);\n }\n\n public static void solve_574A()\n {\n string[] nk = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(nk[0]);\n int k = Convert.ToInt32(nk[1]);\n\n int[] cnt = new int[k];\n for (int i = 0; i < n; i++)\n {\n int p = Convert.ToInt32(Console.ReadLine());\n\n cnt[p - 1]++;\n }\n\n Array.Sort(cnt, (int a, int b) => b.CompareTo(a));\n int count = 0;\n int g = 0;\n int j = n % 2 > 0 ? n / 2 + 1 : n / 2;\n for (int i = 0; i < k; i++)\n {\n if (g >= j)\n {\n break;\n }\n\n while (cnt[i] > 0 && g < j)\n {\n int deduct = cnt[i] > 1 ? 2 : 1;\n cnt[i] -= deduct;\n count += deduct;\n g += 1;\n }\n //int deduct = cnt[i] % 2 > 0 ? cnt[i] / 2 + 1 : cnt[i] / 2;\n /*if (j <= 0)\n {\n break;\n }\n if (j == 1 && deduct > 1)\n {\n count += 2;\n }\n else if (j == 1 && deduct == 1)\n {\n count += 1;\n }\n else\n {\n count += cnt[i];\n }\n\n j -= deduct;*/\n }\n\n Console.WriteLine(count);\n }\n\n public static void solve_352B()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string test = Console.ReadLine();\n int[] cnts = new int[123];\n\n for (int i = 0; i < n; i++)\n {\n cnts[test[i]]++;\n }\n\n int unq = 0;\n for (int i = 0; i < cnts.Length ;i++)\n {\n if (cnts[i] > 0)\n {\n unq++;\n }\n }\n\n int answer = -1;\n\n //Redundancy in condition. if n must be <= 26 then of course unq will be <= 26. So we can remove it.\n if (unq <= 26 && n <= 26)\n {\n answer = n - unq;\n }\n\n Console.WriteLine(answer);\n }\n\n public static void solve_2A()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n string[] test = Console.ReadLine().Split(' ');\n\n int max = int.MinValue;\n int maxI = 0;\n int min = int.MaxValue;\n int minI = 0;\n for (int i = 0; i < n; i++)\n {\n int num = Convert.ToInt32(test[i]);\n if (max < num)\n {\n max = num;\n maxI = i;\n }\n\n if (min > num)\n {\n min = num;\n minI = i;\n }\n }\n\n //n - 1 - because index starts at 0 and ends at n - 1\n // or we could add +1 to minI and maxI and count from 1.\n Console.WriteLine(Math.Abs(minI - maxI) + Math.Max(n - 1 - Math.Max(minI, maxI), Math.Min(minI, maxI)));\n }\n public static void solve_360B()\n {\n string n = Console.ReadLine();\n\n Console.WriteLine(n + String.Join(\"\", n.Reverse().ToList()));\n }\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1102A\n {\n public static void Main()\n {\n long n = long.Parse(Console.ReadLine());\n Console.WriteLine(((n * (n + 1)) / 2) % 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n\n // 1 2\n // 1 2 3\n\n // 1 2 3 4\n\n if (n % 4 == 0 || (n + 1) % 4 == 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(1);\n }\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\n\npublic class Program\n{\n\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n long s = (long)n * (n + 1) / 2;\n Console.WriteLine(s%2);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n while (_index >= _line.Length)\n {\n _line = Console.ReadLine().Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n _line = Console.ReadLine().Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class GFG\n{\n static public void Main()\n {\n try\n {\n //int test = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < test; i++)\n\n //{\n // var input = Console.ReadLine().Split(' ');\n // var a = int.Parse(input[0]);\n // var b = int.Parse(input[1]);\n // var q = int.Parse(input[2]);\n\n // for (int j = 0; j < q; j++)\n // {\n // var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n // YetAnotherCountProb(a, b, aar1);\n // Console.WriteLine();\n // }\n\n\n //}\n int n = Convert.ToInt32(Console.ReadLine());\n IntSeqDiv(n);\n\n }\n catch (Exception ex)\n {\n Console.Write(ex);\n }\n }\n\n static void IntSeqDiv(int n)\n {\n\n var ans=(n)*(n+1)/2;\n if (ans % 2 == 0)\n Console.Write(\"0\");\n else\n Console.Write(\"1\");\n }\n\n\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tint g = (n + 1) / 2;\n\t\t\tConsole.WriteLine(g % 2);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ForCodeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, x = 0;\n n = Convert.ToInt32(Console.ReadLine());\n if (n % 4 == 0 || n % 4 == 3)\n x = 0;\n else if (n % 4 == 2 || n % 4 == 1)\n x = 1;\n Console.WriteLine(x);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp40\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n long ans = (n * (n + 1)) / 2;\n\n Console.WriteLine(ans % 2);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n Console.WriteLine((n * (n + 1) / 2) % 2 == 0 ? 0 : 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n var n = input.ReadInt();\n var m = n / 2;\n var k = n % 2;\n Console.Write(Abs(m % 2 - k));\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static void AddCount(Dictionary counter, T item)\n {\n if (counter.TryGetValue(item, out var count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n return counter.TryGetValue(item, out var count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n var t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public string ReadToEnd()\n {\n return this.reader.ReadToEnd();\n }\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n var result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n var c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1102_IntegerSequenceDividing\n {\n public static void Main()\n {\n decimal sum = 0;\n int a = int.Parse(Console.ReadLine());\n\n if(a%2!=0)\n {\n int b = a / 2;\n\n if (b % 2 == 0)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n else\n {\n a = a - 1;\n int b = a / 2;\n\n if (b % 2 == 0)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Numerics;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Text.RegularExpressions;\n\nnamespace ProjectEuler\n{\n class Program\n {\n \n private static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n if (n*(n+1)/2%2 == 0)\n {\n Console.WriteLine(0);\n }\n else\n {\n Console.WriteLine(1);\n }\n\n }\n }\n}"}, {"source_code": "\ufeffusing static System.Console;\nclass _1102A_Integer_Sequence_Dividing\n{\n static void Main()\n {\n WriteLine(((int.Parse(ReadLine()) + 1) % 4) > 1 ? \"1\" : \"0\"); \n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n internal static class Program\n {\n static void Main()\n {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine((1 + n) * n / 2 % 2 == 0 ? 0 : 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n=int.Parse(Console.ReadLine());\n int a=0;\n int b=0;\n if(n%2==0)\n {\n if((n/2)%2==0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n else\n {\n if((n/2+1)%2==0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n //Console.WriteLine(11/2+1);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing static Template;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing Pi = Pair;\n\nclass Solver\n{\n Scanner sc = new Scanner();\n //\n\n public void Solve()\n {\n var n = sc.Long;\n n = (n + 1) * n / 2;\n WriteLine(n % 2);\n }\n}\n\n#region Template\npublic class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable\n { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b)\n { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f();\n return rt;\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static T[] Create(int n, Func f)\n {\n var rt = new T[n];\n for (var i = 0; i < rt.Length; ++i)\n rt[i] = f(i);\n return rt;\n }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\n\npublic class Scanner\n{\n public string Str => ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n public Pair PairMake() => new Pair(Next(), Next());\n public Pair PairMake() => new Pair(Next(), Next(), Next());\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n}\n\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n int r = n % 4;\n\n if (r == 1 || r == 2)\n {\n r = 1;\n }\n else\n {\n r = 0;\n }\n\n Console.WriteLine(r);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Integer_Sequence_Dividing\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long n = Next();\n return (n*(n + 1)/2)%2;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Integer_Dividing\n{\n class Program\n {\n static void Main(string[] args)\n {\n uint n = Convert.ToUInt32(Console.ReadLine());\n ulong t = n * (n + 1) / 2;\n Console.WriteLine(t % 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\npublic class Solver\n{\n public void Solve()\n {\n ulong n = ulong.Parse(reader.ReadLine());\n ulong ans = (n * (n + 1) / 2) % 2;\n writer.Write(ans);\n }\n\n #region CSharp template by azukun\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n Stopwatch watch = new Stopwatch();\n watch.Start();\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n\n#if DEBUG\n watch.Stop();\n Write(\"Stopwatch: \" + watch.ElapsedMilliseconds + \"ms\");\n#endif\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n#endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Console;\n\nnamespace FirstDemoCSharp\n{\n class Program\n { \n static void Main(string[] args)\n {\n long n = Int64.Parse(ReadLine());\n\n n = n * (n + 1) / 2;\n\n WriteLine(n % 2 == 0 ? 0 : 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Remoting.Messaging;\nusing System.Text;\n\nnamespace AlgoHelper\n{\n class Triplet\n {\n private int a, b, c;\n\n public int A { get { return a; } set { } }\n public int B { get { return b; } set { } }\n public int C { get { return c; } set { } }\n\n\n public Triplet(int a, int b, int c)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n public override bool Equals(object obj)\n {\n var triplet = obj as Triplet;\n return triplet != null &&\n a == triplet.a &&\n b == triplet.b &&\n c == triplet.c;\n }\n\n public override int GetHashCode()\n {\n var hashCode = 1474027755;\n hashCode = hashCode * -1521134295 + a.GetHashCode();\n hashCode = hashCode * -1521134295 + b.GetHashCode();\n hashCode = hashCode * -1521134295 + c.GetHashCode();\n return hashCode;\n }\n }\n\n\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n long s = sum(n);\n if (s % 2 == 0) Console.WriteLine(0);\n else Console.WriteLine(1);\n\n\n // Console.ReadKey();\n }\n\n static long sum(long n)\n {\n return n * (n + 1) / 2;\n }\n public static IList> ThreeSum(int[] nums)\n {\n Array.Sort(nums);\n\n HashSet set = new HashSet();\n\n for (int i = 0; i < nums.Length - 1; i++)\n {\n int temp = nums[i];\n\n for (int j = i+1; j < nums.Length; j++)\n {\n temp += nums[j];\n int index = customBinarySearch(nums, -1*temp, j + 1);\n if (index != -1)\n {\n Triplet triplet = new Triplet(nums[i], nums[j], -temp);\n\n if (!set.Contains(triplet))\n {\n set.Add(triplet);\n }\n }\n temp -= nums[j];\n }\n }\n\n\n IList> list = new List>();\n\n foreach (var v in set)\n {\n List temp = new List();\n temp.Add(v.A);\n temp.Add(v.B);\n temp.Add(v.C);\n list.Add(temp);\n }\n\n return list;\n }\n\n\n public static int LenLongestFibSubseq(int[] a)\n {\n int count = 2;\n int max = int.MinValue;\n\n int index = -1;\n int target = 0;\n\n for (int i = 0; i < a.Length - 1; i++)\n {\n int prev = a[i];\n int current = a[i+1];\n int currentIndex = i + 2;\n index = -1;\n\n for (int j = i + 1; j < a.Length;)\n {\n if (index == -1)\n {\n target = a[i] + a[j];\n index = customBinarySearch(a, target, j+1);\n current = a[j];\n }\n else\n {\n target = prev + current;\n index = customBinarySearch(a, target, currentIndex);\n }\n\n if (index == -1)\n {\n max = Math.Max(max, count);\n j++;\n count = 2;\n }\n else\n {\n prev = current;\n current = a[index];\n currentIndex = index + 1;\n count++;\n }\n }\n }\n\n max = Math.Max(max, count);\n\n return max == int.MinValue ? 0 : max;\n }\n\n private static int customBinarySearch(int[] a, int target, int index)\n {\n int lo = index;\n int hi = a.Length - 1;\n\n while (lo<=hi)\n {\n int med = hi - (hi - lo) / 2;\n if (a[med] == target) return med;\n else if (target < a[med]) hi = med - 1;\n else lo = med + 1;\n }\n return -1;\n }\n\n\n private static bool isFibonacciSequence(int[] a)\n {\n for (int i = 2; i < a.Length; i++)\n {\n if (a[i] != a[i - 1] + a[i - 2]) return false;\n }\n\n return true;\n }\n\n private static int LowerBound(int[] a, int i, int target)\n {\n int lo = i;\n int hi = a.Length - 1;\n\n if (target < a[lo]) return lo;\n\n int ans = -1;\n\n while (lo <= hi)\n {\n int med = hi - (hi - lo) / 2;\n\n if (a[med] == target)\n {\n hi = med - 1;\n ans = med;\n }\n else if (target > a[med])\n {\n lo = med + 1;\n }\n else\n {\n hi = med - 1;\n }\n }\n\n return ans;\n }\n\n private static int UpperBound(int[] a, int i, int target)\n {\n int lo = i;\n int hi = a.Length - 1;\n\n if (target > a[hi]) return hi;\n\n while (lo <= hi)\n {\n int med = hi - (hi - lo) / 2;\n\n if (a[med] == target)\n {\n lo = med + 1;\n }\n else if (target > a[med])\n {\n lo = med + 1;\n }\n else\n {\n hi = med - 1;\n }\n }\n\n return hi;\n }\n\n private static int getValidMinSide(int a, int b)\n {\n int max = a > b ? a - b : b - a;\n\n int c = Math.Min(a + b, max);\n\n return c + 1;\n }\n\n private static int getValidMaxSide(int a, int b)\n {\n return a + b - 1;\n }\n\n private static int[] frequency(string s)\n {\n int[] a = new int[256];\n\n foreach (char c in s)\n {\n a[c]++;\n }\n\n return a;\n }\n\n public static int max(int[] a, int i)\n {\n if (i == a.Length - 1) return a[a.Length - 1];\n return Math.Max(a[i], max(a, i + 1));\n }\n\n\n private static bool isPrime(int n)\n {\n if (n < 2) return false;\n\n for (int i = 2; i * i <= n; i++)\n {\n if (n % i == 0) return false;\n }\n\n return true;\n }\n\n private static void Swap(ref char a, ref char b)\n {\n char temp = a;\n a = b;\n b = temp;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tN = rl();\n\t\tN %= 4;\n\t\tlong[] ans = new long[]{0, 1, 1, 0};\n\t\tConsole.WriteLine(ans[N]);\n\t}\n\tlong N;\n\tpublic Sol(){\n\t\t\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n public class Program\n\n {\n public static void Main(string[] args)\n {\n int n = RInt();\n\n int res;\n if (n % 2 == 0)\n {\n if ((n / 2) % 2 == 0) res = 0;\n else res = 1;\n }\n else\n {\n if (((n - 1) / 2) % 2 == 0) res = 1;\n else res = 0;\n }\n Console.WriteLine(res);\n }\n\n static string RSt() { return Console.ReadLine(); }\n static int RInt() { return int.Parse(Console.ReadLine().Trim()); }\n static long RLong() { return long.Parse(Console.ReadLine().Trim()); }\n static double RDouble() { return double.Parse(Console.ReadLine()); }\n static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }\n static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }\n static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }\n static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }\n static string WAr(IEnumerable array, string sep = \" \") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n n = (n + 1) / 2;\n Console.WriteLine(n % 2);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Integer_Sequence_Dividing\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 4 == 0 || n % 4 == 3) Console.WriteLine(\"0\");\n else if (n % 4 == 2 || n % 4 == 1) Console.WriteLine(\"1\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace progcomp\n{\n class Program\n {\n static void Main(string[] args)\n {\n // Read\n string[] str = Console.ReadLine().Split();\n int n = int.Parse(str[0]);\n int solution = ((n+1)/2)%2;\n Console.WriteLine(solution);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.IO;\nusing System.Text;\n\nusing static util;\nusing P = pair;\n\nusing Binary = System.Func;\nusing Unary = System.Func;\n\nclass Program\n{\n static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n static Scan sc = new Scan();\n const int M = 1000000007;\n const int M2 = 998244353;\n const long LM = (long)1e18;\n const double eps = 1e-11;\n static readonly int[] dd = { 0, 1, 0, -1, 0 };\n const string dstring = \"RDLU\";\n static void Main()\n {\n int n = sc.Int;\n Prt(n % 4 == 0 || n % 4 == 3 ? 0 : 1);\n sw.Flush();\n }\n\n static void DBG(string a) => Console.WriteLine(a);\n static void DBG(IEnumerable a) => DBG(string.Join(\" \", a));\n static void DBG(params object[] a) => DBG(string.Join(\" \", a));\n static void Prt(string a) => sw.WriteLine(a);\n static void Prt(IEnumerable a) => Prt(string.Join(\" \", a));\n static void Prt(params object[] a) => Prt(string.Join(\" \", a));\n}\nclass pair : IComparable>\n{\n public T v1;\n public U v2;\n public pair(T v1, U v2) {\n this.v1 = v1;\n this.v2 = v2;\n }\n public int CompareTo(pair a) {\n int c = Comparer.Default.Compare(v1, a.v1);\n return c != 0 ? c : Comparer.Default.Compare(v2, a.v2);\n }\n public override string ToString() => v1 + \" \" + v2;\n public void Deconstruct(out T a, out U b) {\n a = v1; b = v2;\n }\n}\nstatic class util\n{\n public static pair make_pair(T v1, U v2) => new pair(v1, v2);\n public static T sq(T a) => Operator.Multiply(a, a);\n public static T Max(params T[] a) => a.Max();\n public static T Min(params T[] a) => a.Min();\n public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;\n public static Dictionary compress(this IEnumerable a)\n => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);\n public static Dictionary compress(params IEnumerable[] a) => compress(a.Aggregate(Enumerable.Union));\n public static void swap(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }\n public static void swap(this IList a, int i, int j) where T : struct { var t = a[i]; a[i] = a[j]; a[j] = t; }\n public static T[] copy(this IList a) {\n var ret = new T[a.Count];\n for (int i = 0; i < a.Count; i++) ret[i] = a[i];\n return ret;\n }\n}\nstatic class Operator\n{\n static readonly ParameterExpression x = Expression.Parameter(typeof(T), \"x\");\n static readonly ParameterExpression y = Expression.Parameter(typeof(T), \"y\");\n public static readonly Func Add = Lambda(Expression.Add);\n public static readonly Func Subtract = Lambda(Expression.Subtract);\n public static readonly Func Multiply = Lambda(Expression.Multiply);\n public static readonly Func Divide = Lambda(Expression.Divide);\n public static readonly Func Plus = Lambda(Expression.UnaryPlus);\n public static readonly Func Negate = Lambda(Expression.Negate);\n public static Func Lambda(Binary op) => Expression.Lambda>(op(x, y), x, y).Compile();\n public static Func Lambda(Unary op) => Expression.Lambda>(op(x), x).Compile();\n}\n\nclass Scan\n{\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public string Str => Console.ReadLine().Trim();\n public pair Pair() {\n T a; U b;\n Multi(out a, out b);\n return new pair(a, b);\n }\n public P P {\n get {\n int a, b;\n Multi(out a, out b);\n return new P(a, b);\n }\n }\n public int[] IntArr => StrArr.Select(int.Parse).ToArray();\n public long[] LongArr => StrArr.Select(long.Parse).ToArray();\n public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();\n public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);\n bool eq() => typeof(T).Equals(typeof(U));\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\n T cv(string s) => eq() ? ct(int.Parse(s))\n : eq() ? ct(long.Parse(s))\n : eq() ? ct(double.Parse(s))\n : eq() ? ct(s[0])\n : ct(s);\n public void Multi(out T a) => a = cv(Str);\n public void Multi(out T a, out U b)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); }\n public void Multi(out T a, out U b, out V c)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); }\n public void Multi(out T a, out U b, out V c, out W d)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); }\n public void Multi(out T a, out U b, out V c, out W d, out X e)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]); }\n public void Multi(out T a, out U b, out V c, out W d, out X e, out Y f)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]); f = cv(ar[5]); }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = ReadLong();\n var ans = 0;\n if (n % 2 == 0)\n {\n n /= 2;\n if (n % 2 == 0) ans = 0;\n else ans = 1;\n }\n else\n {\n n /= 2;\n if (n % 2 == 0) ans = 1;\n else ans = 0;\n } \n\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n\n static string Read() { return Console.ReadLine(); }\n static int ReadInt() { return int.Parse(Read()); }\n static long ReadLong() { return long.Parse(Read()); }\n static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }\n static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }\n }\n}"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n long num1 = int.Parse(Console.ReadLine());\n var sum = (1 + num1) * num1 / 2;\n Console.WriteLine(sum - sum / 2 * 2);\n \n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces \n{\n public class Program\n { \n public static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n \n long SUM = n * (2 + (n-1));\n \n SUM = SUM/2;\n \n Console.WriteLine(SUM%2); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static long n,sum;\n static void Main(string[] args)\n {\n\n List inputs = new List { };\n\n\n n = Convert.ToInt32(Console.ReadLine());\n\n n = n * (n + 1) / 2;\n Console.WriteLine(n % 2);\n Console.Read();\n\n }\n\n public static List reverse(string s)\n {\n s += \" \";\n string news = \"\";\n List res = new List { };\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ' ')\n {\n news += s[i];\n }\n else\n {\n res.Add(Convert.ToInt32(news));\n news = \"\";\n }\n }\n return res;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n\n switch (n % 4)\n {\n case 0:\n case 3:\n Console.WriteLine(0);\n break;\n case 1:\n case 2:\n Console.WriteLine(1);\n break;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_1102_A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n * (n + 1) / 2 % 2 == 0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _1102A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long nNumbers;\n nNumbers = long.Parse(Console.ReadLine());\n\n Console.WriteLine((((nNumbers * (nNumbers + 1) / 2) % 2 == 0) ? 0 : 1));\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());long k = n / 2;\n if (n % 2 == 0)\n {\n \n if (k % 2 == 0)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(\"1\");\n }\n }\n else\n {\n if (k % 2 == 0)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n Console.WriteLine(\"0\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace codeforces1102A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = int.Parse(Console.ReadLine());\n long sum = (n * (n + 1)) / 2;\n if (sum % 2 != 0)\n Console.WriteLine(1);\n else\n Console.WriteLine(0);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace A.SequenceSeparation\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n var result = 0;\n if(n % 2 == 0)\n {\n var x = n/2;\n result = x % 2;\n }\n else\n {\n var y = n / 2 + 1;\n result = y % 2;\n }\n\n Console.WriteLine(result);\n\n //var nBytes = GetBinaryRepresentation(n);\n\n //var cnt = nBytes.Count(x => x);\n\n //if (n == 1 || n == 2)\n //{\n // Console.WriteLine(\"1\");\n //}else if(n == 3)\n //{\n // Console.WriteLine(\"0\");\n //}else\n //{\n // Console.WriteLine($\"{(cnt % 2 == 0 ? 1 : 0)}\");\n //}\n \n\n //var bl = false;\n //var ar = new bool[n];\n //for (var i = 0; i < n; i = i + 2)\n //{\n // bl = !bl;\n // ar[i] = bl;\n // if (ar.Length <= i + i) break;\n // ar[i + i] = bl;\n //}\n\n //Console.WriteLine($\"{(ar[n - 1] ? 1 : 0)}\");\n\n Console.Read();\n }\n\n private static bool[] GetBinaryRepresentation(int i)\n {\n List result = new List();\n while (i > 0)\n {\n int m = i % 2;\n i = i / 2;\n result.Add(m == 1);\n }\n //result.Reverse();\n return result.ToArray();\n }\n }\n}\n"}, {"source_code": "/*\n Project Euler, Problem 49 Solution\n C#\n */\nusing System;\nusing System.Diagnostics;\nusing System.Collections.Generic;\n\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main()\n {\n //var sw = new Stopwatch();\n //sw.Start();\n //bool[] prime = new bool[10001];\n //for (int i = 2; i < 10001; i++) prime[i] = true;\n ////SEAVE OF ERAT\n //for (int i = 2; i < 10001; i++)\n //{\n // if (prime[i] == true)\n // {\n // for (int j = i + i; j < 10001; j=j+i)\n // {\n // prime[j] = false;\n // }\n // }\n //}\n //List pList = new List();\n //for (int i = 2; i < 10001; i++)\n //{\n // if (prime[i] == true) {\n // // Console.WriteLine(i);\n // pList.Add(i);\n // }\n //}\n\n\n //Console.WriteLine(\"Size of List \"+pList.Count);\n ///*for (int i = 1; i < pList.Count - 1; i++)\n //{\n // if (pList[i] > 1000)\n // {\n // if (pList[i] - pList[i - 1] == pList[i + 1] - pList[i])\n // {\n // Console.WriteLine(pList[i - 1] + \"\" + pList[i] + \"\" + pList[i + 1]);\n // }\n // }\n\n //}*/\n //for (int i = 30; i < pList.Count; i++) {\n // if (pList[i] > 1000) {\n // int mx = 10000;\n // for (int j = 1; j < mx; j++) {\n // int a = pList[i] + j;\n // int b = a + j;\n // if (a < mx && b < mx) {\n // if (prime[a] == true && prime[b] == true)\n // {\n // if (hasSameChar(pList[i], a) == true && hasSameChar(a, b) == true)\n // {\n // Console.WriteLine(pList[i] + \"\" + a + \"\" + b);\n // }\n // }\n // }\n // }\n // }\n //}\n //Console.WriteLine(sw.Elapsed.TotalMilliseconds);\n //Console.ReadKey(true);\n string s = Console.ReadLine();\n long x = Convert.ToInt64(s);\n int ans=1;\n if (x % 4 == 3 || x % 4 == 0) ans = 0;\n Console.WriteLine(ans);\n // Console.ReadKey();\n }\n\n static bool hasSameChar(int x, int y) {\n // bool ret = false;\n char[] t1 = new char[4];\n char[] t2 = new char[4];\n for (int i = 0; i < 4; i++) {\n int xx = x % 10;\n x = x / 10;\n int yy = y % 10;\n y = y / 10;\n t1[i] = Convert.ToChar(xx);\n t2[i] = Convert.ToChar(yy);\n }\n Array.Sort(t1);\n Array.Sort(t2);\n for(int i = 0; i < 4; i++)\n {\n if (t1[i] != t2[i]) return false;\n }\n \n return true;\n }\n\n }\n}\n\n// PROJECT EULER SOLUTION 49\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args) \n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\t//var inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = long.Parse(input1);\n\n\t\t\tif (n % 4 == 0 || n % 4 == 3) \n\t\t\t{\n\t\t\t\tConsole.WriteLine(0);\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\tConsole.WriteLine(1);\n\t\t\t}\n\t\t}\n\n\t\tpublic class Team\n\t\t{\n\t\t\tpublic string Name { get; set; }\n\n\t\t\tpublic int Points { get; set; }\n\n\t\t\tpublic int GoalsFor { get; set; }\n\n\t\t\tpublic int GoalsAgainst { get; set; }\n\t\t}\n\n\t\tstatic long Factorial(long a) \n\t\t{\n\t\t\treturn a > 1 ? a * Factorial(a - 1) : 1;\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n if(n*(1+n)/2 % 2 == 0)\n Console.WriteLine(0);\n else\n {\n Console.WriteLine(1);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n public class IntegerSequenceDividing\n {\n public static void Main()\n {\n new IntegerSequenceDividing().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n tw.WriteLine(Solve(int.Parse(tr.ReadLine())));\n }\n\n public int Solve(int v)\n {\n return (v + 1) % 4 / 2;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace x\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine()), ost;\n\n ost = n % 4;\n\n //Console.WriteLine(ost);\n if (ost == 3 || ost == 0)\n Console.WriteLine(0);\n else if (ost == 1 || ost == 2)\n Console.WriteLine(1);\n \n //Console.ReadKey();\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\n\n\n\nnamespace problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n , temp;\n\n n= Convert.ToInt32(Console.ReadLine());\n \n temp = (n*(n+1))/ 2;\n\n Console.WriteLine(temp % 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1102A\n {\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(((n * (n + 1)) / 2) % 2);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class GFG\n{\n static public void Main()\n {\n try\n {\n //int test = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < test; i++)\n\n //{\n // var input = Console.ReadLine().Split(' ');\n // var a = int.Parse(input[0]);\n // var b = int.Parse(input[1]);\n // var q = int.Parse(input[2]);\n\n // for (int j = 0; j < q; j++)\n // {\n // var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n // YetAnotherCountProb(a, b, aar1);\n // Console.WriteLine();\n // }\n\n\n //}\n int n = Convert.ToInt32(Console.ReadLine());\n IntSeqDiv(n);\n\n }\n catch (Exception ex)\n {\n Console.Write(ex);\n }\n }\n\n static void IntSeqDiv(int n)\n {\n\n int leftSum = 0;\n int rightSum = 0;\n\n for (int i = n; i > 1; i--)\n {\n if (i % 2 == 0)\n leftSum = leftSum + i;\n else\n rightSum = rightSum + i;\n\n }\n\n var ans1 = Math.Abs((leftSum + 1) - rightSum);\n var ans2 = Math.Abs((leftSum) - (rightSum + 1));\n\n Console.Write(Math.Min(ans1, ans2));\n }\n\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class GFG\n{\n static public void Main()\n {\n try\n {\n //int test = Convert.ToInt32(Console.ReadLine());\n //for (int i = 0; i < test; i++)\n\n //{\n // var input = Console.ReadLine().Split(' ');\n // var a = int.Parse(input[0]);\n // var b = int.Parse(input[1]);\n // var q = int.Parse(input[2]);\n\n // for (int j = 0; j < q; j++)\n // {\n // var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();\n // YetAnotherCountProb(a, b, aar1);\n // Console.WriteLine();\n // }\n\n\n //}\n int n = Convert.ToInt32(Console.ReadLine());\n IntSeqDiv(n);\n\n }\n catch (Exception ex)\n {\n Console.Write(ex);\n }\n }\n\n static void IntSeqDiv(int n)\n {\n\n int leftSum = 0;\n int rightSum = 0;\n\n for (int i = n; i > 1; i--)\n {\n if (n % 2 == 0)\n leftSum = leftSum + i;\n else\n rightSum = rightSum + i;\n\n }\n\n var ans1 = Math.Abs((leftSum + 1) - rightSum);\n var ans2 = Math.Abs((leftSum) - (rightSum + 1));\n\n Console.Write(Math.Min(ans1, ans2));\n }\n\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp40\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n if (n < 3)\n Console.WriteLine(1);\n else if((n-3)%4==0) \n Console.WriteLine(0);\n else \n Console.WriteLine(1);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp40\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = long.Parse(Console.ReadLine());\n\n \n if (n % 4 == 0)\n Console.WriteLine(0);\n else \n Console.WriteLine(1);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n internal static class Program\n {\n static void Main()\n {\n Console.WriteLine(int.Parse(Console.ReadLine()) % 2 == 0 ? 0 : 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.ReadLine());\n Console.WriteLine(n % 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Integer_Dividing\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n long t = n * (n + 1) / 2;\n Console.WriteLine(t % 2);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Integer_Dividing\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int t = n * (n + 1) / 2;\n Console.WriteLine(t % 2);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Test\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n var num1 = int.Parse(Console.ReadLine());\n var sum = (1 + num1) * num1 / 2;\n Console.WriteLine(sum - sum / 2 * 2);\n \n }\n\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace CodeForces \n{\n public class Program\n { \n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n int SUM = n * (2 + (n-1));\n \n SUM = SUM/2;\n \n Console.WriteLine(SUM%2); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static long n,sum;\n static void Main(string[] args)\n {\n\n List inputs = new List { };\n\n\n n = Convert.ToInt32(Console.ReadLine());\n\n for(long i = 0; i < n; i++)\n {\n sum += n;\n }\n Console.WriteLine(sum%2);\n Console.Read();\n\n }\n\n public static List reverse(string s)\n {\n s += \" \";\n string news = \"\";\n List res = new List { };\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ' ')\n {\n news += s[i];\n }\n else\n {\n res.Add(Convert.ToInt32(news));\n news = \"\";\n }\n }\n return res;\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static long n, k;\n static void Main(string[] args)\n {\n\n List inputs = new List { };\n\n\n n = Convert.ToInt64(Console.ReadLine());\n\n long[] nums = new long[n];\n long sum = 0;\n \n for(int i = 0; i < n; i++)\n {\n nums[i] = i + 1;\n\n }\n for(int i = 0; i < n; i++)\n {\n if (Math.Abs((nums.Sum() - (sum + nums[i])) - (sum + nums[i])) < Math.Abs((nums.Sum() - sum) - sum))\n {\n sum += nums[i];\n }\n else\n {\n Console.WriteLine(Math.Abs((nums.Sum() - sum) - sum));\n Console.Read();\n return;\n }\n\n if(nums.Sum() - sum <= sum)\n {\n for(int u = 0; u < i; u++)\n {\n if(Math.Abs((nums.Sum() - (sum - nums[u])) - (sum - nums[u])) < Math.Abs((nums.Sum() - sum) - sum))\n {\n sum -= nums[u];\n }\n else\n {\n Console.WriteLine(Math.Abs((nums.Sum() - sum) - sum));\n Console.Read();\n return;\n }\n }\n }\n }\n\n Console.Read();\n\n }\n\n public static List reverse(string s)\n {\n s += \" \";\n string news = \"\";\n List res = new List { };\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] != ' ')\n {\n news += s[i];\n }\n else\n {\n res.Add(Convert.ToInt32(news));\n news = \"\";\n }\n }\n return res;\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n == 3)\n {\n Console.WriteLine(\"0\");\n\n }\n else\n {\n if (n % 2 == 0)\n {\n Console.WriteLine(\"0\");\n\n }\n else\n {\n Console.WriteLine(\"1\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n if (n % 2 == 0)\n {\n Console.WriteLine(\"0\");\n\n }\n else\n {\n Console.WriteLine(\"1\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace A.SequenceSeparation\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var nBytes = GetBinaryRepresentation(n);\n\n var cnt = nBytes.Count(x => x);\n\n if (n == 1 || n == 2)\n {\n Console.WriteLine(\"1\");\n }else if(n == 3)\n {\n Console.WriteLine(\"0\");\n }else\n {\n Console.WriteLine($\"{(cnt % 2 == 0 ? 1 : 0)}\");\n }\n \n\n //var bl = false;\n //var ar = new bool[n];\n //for (var i = 0; i < n; i = i + 2)\n //{\n // bl = !bl;\n // ar[i] = bl;\n // if (ar.Length <= i + i) break;\n // ar[i + i] = bl;\n //}\n\n //Console.WriteLine($\"{(ar[n - 1] ? 1 : 0)}\");\n\n Console.Read();\n }\n\n private static bool[] GetBinaryRepresentation(int i)\n {\n List result = new List();\n while (i > 0)\n {\n int m = i % 2;\n i = i / 2;\n result.Add(m == 1);\n }\n //result.Reverse();\n return result.ToArray();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace A.SequenceSeparation\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n\n var bl = false;\n var ar = new bool[n];\n for (var i = 0; i < n; i = i + 2)\n {\n bl = !bl;\n ar[i] = bl;\n if (ar.Length <= i + i) break;\n ar[i + i] = bl;\n }\n\n Console.WriteLine($\"{(ar[n - 1] ? 1 : 0)}\");\n\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace A.SequenceSeparation\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = Convert.ToInt32(Console.ReadLine());\n var nBytes = GetBinaryRepresentation(n);\n\n var cnt = nBytes.Count(x => x);\n\n Console.WriteLine($\"{(cnt%2 == 0 ? 1 : 0)}\");\n\n //var bl = false;\n //var ar = new bool[n];\n //for (var i = 0; i < n; i = i + 2)\n //{\n // bl = !bl;\n // ar[i] = bl;\n // if (ar.Length <= i + i) break;\n // ar[i + i] = bl;\n //}\n\n //Console.WriteLine($\"{(ar[n - 1] ? 1 : 0)}\");\n\n Console.Read();\n }\n\n private static bool[] GetBinaryRepresentation(int i)\n {\n List result = new List();\n while (i > 0)\n {\n int m = i % 2;\n i = i / 2;\n result.Add(m == 1);\n }\n //result.Reverse();\n return result.ToArray();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n public class IntegerSequenceDividing\n {\n public static void Main()\n {\n new IntegerSequenceDividing().Solve(Console.In, Console.Out);\n }\n\n public void Solve(TextReader tr, TextWriter tw)\n {\n tw.WriteLine(Solve(int.Parse(tr.ReadLine())));\n }\n\n public int Solve(int v)\n {\n return v % 4 / 2 ^ 1;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace x\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n == 3)\n Console.WriteLine(0);\n else if (n % 4 == 0)\n Console.WriteLine(0);\n else\n Console.WriteLine(1);\n //Console.ReadKey();\n }\n }\n}\n"}], "src_uid": "fa163c5b619d3892e33e1fb9c22043a9"} {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Console;\nusing static System.Math;\nclass Z { static void Main() => new K(); }\nclass K\n{\n\tint F => int.Parse(Str);\n\tlong FL => long.Parse(Str);\n\tint[] G => Strs.Select(int.Parse).ToArray();\n\tlong[] GL => Strs.Select(long.Parse).ToArray();\n\tstring Str => ReadLine();\n\tstring[] Strs => Str.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n\tconst int MOD = 1000000007;\n\tpublic K()\n\t{\n\t\tSetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n\t\tSolve();\n\t\tOut.Flush();\n\t}\n\t(int a, int b) A(int x) => (x / 2, x + 1);\n\tint B(object x) => x is int a ? a : throw new Exception();\n\tstring hoge;\n\tpublic string Name\n\t{\n\t\tget => hoge;\n\t\tset => hoge = value;\n\t}\n\tvoid Solve()\n\t{\n\t\tvar w = F;\n\t\tvar (a, _) = A(w);\n\t\tWriteLine(w > 2 && w % 2 == 0 ? \"YES\" : \"NO\");\n\t\tif (w < 0)\n\t\t{\n\t\t\tvar b1 = 0b1111_0000;\n\t\t\tvar s = Str;\n\t\t\tif (int.TryParse(s, out var c)) WriteLine(c + b1);\n\t\t}\n\t}\n\tclass Q\n\t{\n\t\tint n;\n\t\tint this[int n] => 3;\n\t\tpublic Q(int x) => n = x;\n\t}\n\tstatic ref int Max(ref int x, ref int y)\n\t{\n\t\tif (x < y) return ref y;\n\t\treturn ref x;\n\t}\n}\n", "positive_code": [{"source_code": "using System; \n\n class Exercise11 \n\n{ \n \n static void Main()\n \n {\n \n int w=Convert.ToInt32(Console.ReadLine());\n \n if(w%2==0&&w>2)\n \n {\n Console.WriteLine(\"YES\");\n }\n \n else\n \n {\n Console.WriteLine(\"NO\");\n }\n \n \n }\n\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int W = int.Parse(Console.ReadLine());\n if ((W%2) == 0 && W != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeforcesCSharp {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\t\t\tint input = Convert.ToInt32(Console.ReadLine());\n\t\t\tif (input % 2 == 0 && input > 2) {\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t} else {\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Codeforces\n{\n static class Program\n {\n static void Main(string[] args)\n {\n int weight = Convert.ToInt32(Console.ReadLine());\n if (weight <= 3)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(weight % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Data.SqlTypes;\nusing System.Net.Http;\n\nnamespace codeForces\n{\n class Program\n {\n static void Main()\n {\n int w = Convert.ToInt32(Console.ReadLine());\n\n if (w%2 == 0 && w != 2)\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace csharp_competitive\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n\n if((input % 2) == 0 && input > 2){\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n string result;\n\n a = Convert.ToInt32(Console.ReadLine());\n\n if (a >= 1 && a <= 100)\n {\n if (((a%2) == 0) && (a != 2))\n result = \"YES\";\n else\n result = \"NO\";\n }\n else\n return;\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int watermelonWeight = int.Parse(Console.ReadLine());\n\n bool isWatermelonDivided = false;\n\n for (int i = 0; i < watermelonWeight; i++)\n {\n for (int j = 0; j < watermelonWeight; j++)\n {\n int firstPersonPart = i + 1;\n int secondPersonPart = j + 1;\n\n bool arePartsEqual = firstPersonPart + secondPersonPart == watermelonWeight;\n bool arePartsEvenNumbers = (firstPersonPart % 2 == 0) && (secondPersonPart % 2 == 0);\n\n if (arePartsEqual && arePartsEvenNumbers) \n {\n Console.WriteLine(\"YES\");\n isWatermelonDivided = true;\n\n break;\n }\n }\n\n if (isWatermelonDivided)\n {\n break;\n }\n }\n\n\n if (!isWatermelonDivided)\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace test\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n if (w % 2 != 1 & w!=2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n \n }\n }\n\n}\n\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace wattermalon\n{\n class Program\n {\n static void Main(string[] args)\n {\n var w=Convert.ToInt32(Console.ReadLine());\n if(w!=2 && w%2==0){\n Console.WriteLine(\"YES\");\n }\n else{\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar a = Convert.ToInt32(Console.ReadLine());\n\t\t\tif(a%2==0&&a>2)\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\telse Console.WriteLine(\"NO\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\npublic class Program\n{\n static void Main(String[]Args)\n {\n int a = Convert.ToInt32(Console.ReadLine());\n if(a<=2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if(a%2==0)Console.Write(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n double weight = double.Parse(Console.ReadLine());\n \n if (weight <= 100 && weight >= 1)\n {\n \n if (weight==2)\n {\n \n Console.WriteLine(\"NO\");\n }\n else if (weight % 2 == 0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int num = Convert.ToInt32(Console.ReadLine());\n string answer;\n if (num < 4)\n {\n answer = \"No\";\n } else {\n int shift = num >> 1;\n shift = shift << 1;\n answer = shift == num ? \"Yes\" : \"No\"; \n \n }\n System.Console.WriteLine(answer);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i;\n i = int.Parse(Console.ReadLine());\n if (i <= 2)\n {\n Console.Write(\"NO\\n\");\n //Console.Read();\n }\n else\n {\n if (i % 2 == 0)\n {\n Console.Write(\"YES\\n\");\n //Console.Read();\n\n }\n else\n {\n Console.Write(\"NO\\n\");\n //Console.Read();\n }\n\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass TestClass\n{\n static void Main(string[] args)\n {\n int num = Convert.ToInt32(Console.ReadLine());\n if (num < 4)\n {\n Console.WriteLine(\"NO\");\n }\n else \n {\n if ((num - 2) % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n\n if (w == 2)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if (w % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nclass Solution\n{\n static string Even(int n)\n {\n string ans=\"NO\";\n if(n%2==0&&n>2)\n {\n ans=\"YES\";\n }\n return ans;\n }\n \n static void Main(string[] args) {\n l: int n=int.Parse(Console.ReadLine());\n \n if(n>=1&&n<=100)\n {\n string final=Even(n);\n Console.WriteLine(final);\n\n \n }\n else\n {\n goto l;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Watermelon800\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n if (w % 2 == 0 && w != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _4A\n{\n\n class Program\n {\n\n static void Main()\n {\n\n string a;\n sbyte n;\n\n a = Console.ReadLine();\n n = Convert.ToSByte(a);\n\n if(n > 2 && n % 2 == 0)\n {\n\n Console.WriteLine(\"YES\");\n\n }\n else\n {\n\n Console.WriteLine(\"NO\");\n\n }\n\n Console.ReadLine();\n\n }\n\n }\n\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int w;\n\n \n w = int.Parse(Console.ReadLine());\n if (w >= 1 && w <= 100)\n {\n\n if (w % 2 == 0 && w != 2)\n {\n \n Console.WriteLine(\"yes\");\n }\n else\n Console.WriteLine(\"no\");\n }\n \n\n\n\n\n\n\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n String str=Console.ReadLine();\n int n = int.Parse(str);\n \n if ( n%2==0 & n!=2 )\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n public class Program\n {\n static void Main(string[] args)\n {\n int i = 1;\n int j;\n bool cond = false;\n\n int w = int.Parse(Console.ReadLine());\n j = w - 1;\n \n while(i <= j)\n {\n \n if(i % 2 == 0 && j % 2 == 0)\n {\n Console.Write(\"YES\");\n cond = true;\n break;\n }\n i++;\n j--; \n }\n if (cond == false)\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if (w % 2 == 0 && w > 2) \n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // while (true)\n // {\n Console.WriteLine(CheckEven(Convert.ToInt32(Console.ReadLine().ToString())));\n //}\n }\n\n\n private static string CheckEven(int x)\n {\n if (x < 4) return \"NO\";\n if (x%2==0)\n {\n return \"YES\";\n }\n else\n return \"NO\";\n }\n\n\n }\n}"}, {"source_code": "using System;\nnamespace TestFeature\n{\n class MainApp\n {\n public static void Main()\n {\n var weight = int.Parse(Console.ReadLine());\n Console.WriteLine(weight > 3 && weight % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var weight = int.Parse(Console.ReadLine());\n if (weight == 2)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(weight % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace WatermelonesCodForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Console.WriteLine(GetAnswer(input));\n }\n\n public static string GetAnswer(string input)\n {\n int resonseInInt = int.Parse(input);\n\n return (resonseInInt <= 2 || resonseInInt % 2 != 0) ? \"NO\" : \"YES\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int g = new int();\n g = 0;\n g = Convert.ToInt32(Console.ReadLine());\n if ((g%2)==0 && g > 2)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Runtime.InteropServices;\n\nnamespace Watermelon {\n class Program {\n static void Main(string[] args) {\n string w = Console.ReadLine();\n try {\n int weight = Convert.ToInt32(w);\n if (weight > 2 && weight % 2 == 0) {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n } catch (Exception e) {\n \n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n if (n > 2 && n % 2 == 0)\n {\n\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int w = int.Parse(Console.ReadLine());\n \n if (w % 2 == 0 && w > 2)\n {\n Console.WriteLine(\"YES\");\n } \n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A._watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int W;\n //Console.Write(\"Weight of the watermelon: \");\n W = int.Parse(Console.ReadLine());\n if (W>3 && W<101)\n {\n if (W % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace sduhcguyasdc\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tif(n>2 && n%2==0){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}else{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t\t//Console.ReadKey(true);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x= Console.ReadLine();\n if ( int.Parse(x) % 2 == 0 && int.Parse(x) !=2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PST_1\n{\n class Program\n {\n static void Main(string[] args)\n {\n double w = double.Parse(Console.ReadLine());\n if (w<=100 && w>=1)\n {\n if (w % 2 == 0 && w != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n n = (int)Convert.ToUInt32(Console.ReadLine());\n\n if (n % 2 == 0 && n > 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication22\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n\n string result = \"NO\";\n\n if (a % 2 == 0)\n {\n int a1 = a / 2;\n int a2 = a / 2;\n\n if (a1 % 2 == 0 && a2 % 2 == 0)\n {\n result = \"YES\";\n }\n else\n {\n a1++;\n a2--;\n\n if (a1 % 2 == 0 && a2 % 2 == 0 && a1 != 0 && a2 != 0)\n {\n result = \"YES\";\n }\n }\n \n\n }\n Console.WriteLine(result);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n int a1 = 0, a2 = 0;\n string result = \"NO\";\n if (a % 2 == 0 && a >= 2 && a <= 100) //\u0435\u0441\u043b\u0438 a mod 2 \u0440\u0430\u0432\u043d\u0430 0 \u0438 2 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e 2 \u0438 \u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e 100\n {\n a1 = a / 2;\n a2 = a / 2;\n\n if (a1 % 2 == 0)\n {\n result = \"YES\";\n }\n else\n {\n a1 -= 1; \n a2 += 1;\n \n if (a1 % 2 == 0 && a2 % 2 == 0 && a1 != 0 && a2 != 0)\n {\n result = \"YES\";\n }\n }\n\n \n\n }\n\n Console.WriteLine(result);\n \n\n }\n }\n\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n\n if(a % 2 == 0 && a != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass A{\n static void Main(){\n int N = int.Parse(Console.ReadLine());\n string ans = \"NO\";\n\n for (int i = 1; i < N; i++){\n if ((N - i) % 2 == 0 && i % 2 == 0) ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n Console.Write(Run(int.Parse(Console.ReadLine())));\n }\n\n public static string Run(int w)\n {\n int i = 2;\n\n while (i <= w / 2)\n {\n if (i % 2 == 0 && (w - i) % 2 == 0)\n {\n return \"YES\";\n }\n\n i += 1;\n }\n\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForce\n{\n class Program\n {\n static void Main()\n {\n int a = int.Parse(Console.ReadLine());\n\n if(a % 2 == 0 && a != 2)\n {\n System.Console.WriteLine(\"YES\");\n }\n else\n {\n System.Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace C_\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n int input = int.Parse(Console.ReadLine());\n string output;\n\n if(input > 0 & input < 101 & input%2 == 0 & input != 2) \n {\n output = \"YES\";\n Console.WriteLine(output);\n }\n else{\n output = \"NO\";\n Console.WriteLine(output);\n }\n\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Watermelon\n{\n class Program\n {\n static void BruteForce(int weight)\n {\n int counter = 0;\n\n if (weight % 2 != 0)\n {\n counter = 0;\n }\n else\n {\n for (int i = 2; i <= weight; i += 2)\n {\n for (int j = i; j <= weight; j += 2)\n {\n if (i % 2 == 0 && j % 2 == 0 && i + j == weight)\n {\n counter++;\n\n }\n }\n }\n }\n\n if (counter > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n static void Main(string[] args)\n {\n int weight = int.Parse(Console.ReadLine());\n\n BruteForce(weight);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int weight = int.Parse(Console.ReadLine());\n if (weight==2)\n {\n Console.WriteLine(\"no\");\n }\n else if (weight % 2 == 0)\n {\n Console.WriteLine(\"yes\");\n\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _4\n{\n class Program\n {\n static void Main(string[] args)\n {\n var w = int.Parse(Console.ReadLine());\n bool odd = ((w) % 2) == 1;\n if (w == 1)\n {\n odd = true;\n }\n else if (w == 2)\n {\n odd = true;\n }\n\n if (odd)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var readLine = Console.ReadLine();\n\n var result = Calculate(readLine);\n\n Console.WriteLine(result);\n }\n\n private static string Calculate(string input)\n {\n var totalWeight = Int32.Parse(input);\n\n for (var i = 2; i <= totalWeight - 2; i += 2)\n {\n var rest = totalWeight - i;\n\n if (rest%2 == 0 && rest > 0)\n {\n return \"YES\";\n }\n }\n\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace watermelon1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w;\n \n w = Convert.ToInt32(Console.ReadLine());\n\n if ((w % 2 == 0) && (w >= 4)&& (w<=100))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main()\n {\n int w = Convert.ToInt32(Console.ReadLine());\n if (w >= 1 && w <= 100)\n {\n bool result = EvenFractions(w);\n if(result == true)\n Console.WriteLine(\"Yes\");\n else\n Console.WriteLine(\"No\");\n }\n }\n\n public static bool EvenFractions(int num)\n {\n bool rtn = false;\n\n List intList = new List();\n\n for (int i = 1; i < num; i++)\n {\n if (i % 2 == 0)\n {\n intList.Add(i);\n }\n }\n\n for (int j = 0; j < intList.Count; j++)\n {\n for (int k = 0; k < intList.Count; k++)\n {\n if (num == intList[j] + intList[k])\n {\n rtn = true;\n }\n break;\n }\n }\n return rtn;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine((x > 2 && x % 2 < 1) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcecTableOfVasya\n{\n class Program\n {\n static void Main(string[] args)\n {\n int weight = int.Parse(Console.ReadLine());\n string result=null;\n if (weight % 2 == 0 && weight > 3)\n {\n if ((weight / 2) % 2 == 0 || (weight-2)%2 ==0) result = \"YES\";\n else result = \"NO\";\n }\n else result = \"NO\";\n Console.WriteLine(result);\n \n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int weight = int.Parse(Console.ReadLine());\n if (weight % 2 == 1)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n int leftPart = weight / 2;\n int rightPart = weight - leftPart;\n if (leftPart % 2 == 0 && rightPart % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n } else\n {\n if ((leftPart - 1) % 2 == 0 && (rightPart + 1) % 2 == 0 && leftPart - 1 != 0)\n {\n Console.WriteLine(\"YES\");\n } else { \n Console.WriteLine(\"NO\");\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CS_4A\n{\n class Program\n {\n static void Main()\n {\n var i = int.Parse(Console.ReadLine());\n Console.WriteLine(i < 4 || (i & 1) == 1 ? \"No\" : \"Yes\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main()\n {\n var input = int.Parse(Console.ReadLine());\n\t \tConsole.WriteLine(input > 3 && input % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = (Convert.ToInt32(Console.ReadLine()));\n\n Console.WriteLine(w > 2 && w % 2 == 0 ? \"Yes\":\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n if (w >= 4 && w % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace first\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n\n int w = int.Parse(Console.ReadLine());\n\n if ((w % 2 == 0) && (w!=2))\n \n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = (Convert.ToInt32(Console.ReadLine()));\n\n Console.WriteLine(w > 2 && w % 2 == 0 ? \"Yes\":\"NO\");\n }\n }\n \n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var w = int.Parse(Console.ReadLine());\n\n if (w < 4)\n {\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n return;\n }\n\n w = w - 2;\n\n if (w%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CleanCode\n{\n class Program\n {\n static void Main(string[] args)\n {\n double w = double.Parse(Console.ReadLine());\n if (w >= 1 && w <= 100)\n if(w==1)\n Console.WriteLine(\"NO\");\n else if ((((w > 2) || w==1) ? (((w % 2) % 2) == 0) : ((w % 2) == 1)))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n a = Convert.ToInt32(Console.ReadLine());\n if (a%2 != 0)\n {\n Console.WriteLine(\"NO\");\n }\n else if (a == 2)\n {\n Console.WriteLine(\"NO\");\n }\n else if (a%2 == 0)\n {\n\n if ((a-2)%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else if ((a-4)%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else if ((a-6)%2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication20\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if(x==2)\n {\n Console.WriteLine(\"NO\");\n }\n else if(x%2==0)\n {\n\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace SYYYNS\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n;\n n = Convert.ToInt64(Console.ReadLine());\n \n if (n % 2 == 0 && n > 2)\n {\n Console.WriteLine(\"YES\\n\");\n }\n else \n {\n Console.WriteLine(\"No\\n\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Melon\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int input = Convert.ToInt32(Console.ReadLine());\n\n if (input % 2 == 0 && input > 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication49\n{\n class Program\n {\n static void Main(string[] args)\n {\n int num1 = int.Parse(Console.ReadLine());\n\n if (num1%2==0 && num1 > 2 )\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n \n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if (x == 2)\n {\n Console.WriteLine(\"NO\");\n }\n else if (x % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n\n if (w % 2 == 0 && w != 2)\n Console.Write(\"YES\");\n else Console.Write(\"NO\");\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sandiaKilos = Convert.ToInt32(Console.ReadLine());\n var nNumero1 = 0;\n var nNumero2 = 0;\n bool encontrado = false;\n while (nNumero1 < sandiaKilos)\n {\n nNumero1 += 1;\n while (nNumero2 < sandiaKilos)\n {\n nNumero2 += 1;\n if (nNumero1 + nNumero2 == sandiaKilos && nNumero1 % 2 == 0 && nNumero2 % 2 == 0)\n {\n encontrado = true;\n break;\n }\n }\n if (encontrado == true)\n {\n break;\n }\n nNumero2 = 0;\n }\n\n\n if (encontrado == true)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int W = int.Parse(Console.ReadLine());\n if (W % 2 == 1)\n {\n Console.WriteLine(\"NO\");\n }\n if (W % 2 == 0)\n {\n if (W == 2)\n {\n Console.WriteLine(\"NO\");\n }\n\n else\n {\n Console.WriteLine(\"YES\");\n }\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Watermelon{\n\tclass DivideWatermelon{\n\t\tpublic static void Main(string[] args){\n\t\t\t\n\t\t\tfloat n=float.Parse(Console.ReadLine());\n\t\t\tif(n>=1 && n<=100){\n\t\t\t\tif(n % 2 ==0 && n/2>1){\n\t\t\t\t\tConsole.WriteLine(\"Yes\");\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\tConsole.WriteLine(\"No\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n\n\n int w = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(w % 2 == 0 && w != 2 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n \n static void Main(string[] args)\n {\n\n int w = int.Parse(Console.ReadLine());\n if (w %2 == 0&&w>=4)\n Console.WriteLine(\"Yes\");\n else \n Console.WriteLine(\"NO\");\n \n }\n }\n\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n if (w % 2 == 0 && w > 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tram1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n%2 == 0 && n != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n \n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Solution \n{\n public static void Main(string[] args)\n {\n new Solution().Run();\n }\n \n public void Run()\n {\n try\n {\n Init();\n Solve();\n }\n catch (Exception e)\n {\n Console.WriteLine(e);\n }\n \n Console.ReadLine();\n }\n \n private void Init()\n {\n inputBuffer = new string[0];\n inputBufferIndex = 0;\n }\n \n private string[] inputBuffer;\n private int inputBufferIndex;\n \n private string ReadLine() { return Console.ReadLine(); }\n \n private string ReadString()\n {\n while (inputBufferIndex == inputBuffer.Length)\n {\n inputBuffer = ReadLine().Split(new char[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n inputBufferIndex = 0;\n }\n \n return inputBuffer[inputBufferIndex++];\n }\n \n private int ReadInt() { return Int32.Parse(ReadString()); }\n \n private long ReadLong() { return Int64.Parse(ReadString()); }\n \n private double ReadDouble() { return Double.Parse(ReadString()); }\n \n private void Solve()\n {\n int weight = ReadInt();\n \n bool can = (weight > 2 && weight % 2 == 0);\n Console.WriteLine(can ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForces.Task4A\n{\n class Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar task = new Task();\n\t\t}\n\t}\n \n public interface IGeneralInterface\n\t{\n\t\tvoid Input();\n \n\t\tvoid Output();\n\t}\n \n public class Diapason\n\t{\n\t\tprivate long _number;\n\t\tpublic long Number\n\t\t{\n\t\t\tget => _number;\n\t\t\tset => _number = value;\n\t\t}\n\n\t\tprivate int _min;\n\t\tpublic int MIN\n\t\t{\n\t\t\tget => _min;\n\t\t\tset => _min = value;\n\t\t}\n\n\t\tprivate long _max;\n\t\tpublic long MAX\n\t\t{\n\t\t\tget => _max;\n\t\t\tset => _max = value;\n\t\t}\n\n\t\tpublic bool InRange()\n\t\t{\n\t\t\tif (_min <= _number && _number <= _max)\n\t\t\t\treturn true;\n\n\t\t\treturn default;\n\t\t}\n }\n \n public class Task : IGeneralInterface\n\t{\n\t\tprivate Diapason _diapason = new Diapason();\n\t\tprivate string _str;\n\t\tprivate const int MIN = 1;\n\t\tprivate const int MAX = 100;\n\t\tprivate const string YES = \"YES\";\n\t\tprivate const string NO = \"NO\";\n\t\tprivate int _number;\n\t\t\n\t\tpublic Task()\n\t\t{\n\t\t\tInput();\n\t\t\tOutput();\n\t\t}\n\n\t\tpublic void Input() => InputData();\n\n\t\tprivate void InputData()\n\t\t{\n\t\t\t_str = Console.ReadLine();\n\t\t\tif (int.TryParse(_str, out int result))\n\t\t\t{\n\t\t\t\t_diapason.Number = result;\n\t\t\t\t_diapason.MIN = MIN;\n\t\t\t\t_diapason.MAX = MAX;\n\t\t\t\tif (_diapason.InRange())\n\t\t\t\t\t_number = result;\n\t\t\t}\n\t\t}\n\n\t\tpublic void Output()\n\t\t{\n\t\t\tif(_number % 2 == 0 && _number > 2)\n\t\t\t\tConsole.WriteLine(YES);\n\t\t\telse\n\t\t\t\tConsole.WriteLine(NO);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\npublic class Solution \n{\n public static void Main(string[] args)\n {\n new Solution().Run();\n }\n \n public void Run()\n {\n try\n {\n Init();\n Solve();\n }\n catch (Exception e)\n {\n Console.WriteLine(e);\n throw new Exception();\n }\n }\n \n private void Init()\n {\n inputBuffer = new string[0];\n inputBufferIndex = 0;\n }\n \n private string[] inputBuffer;\n private int inputBufferIndex;\n \n private string ReadLine() { return Console.ReadLine(); }\n \n private string ReadString()\n {\n while (inputBufferIndex == inputBuffer.Length)\n {\n inputBuffer = ReadLine().Split(new char[] {' ', '\\t'}, StringSplitOptions.RemoveEmptyEntries);\n inputBufferIndex = 0;\n }\n \n return inputBuffer[inputBufferIndex++];\n }\n \n private int ReadInt() { return Int32.Parse(ReadString()); }\n \n private long ReadLong() { return Int64.Parse(ReadString()); }\n \n private double ReadDouble() { return Double.Parse(ReadString()); }\n \n private void Solve()\n {\n int weight = ReadInt();\n\n bool can = (weight > 2 && weight % 2 == 0);\n Console.WriteLine(can ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\n\nnamespace OlympSolves\n{\n class Program\n {\n static void Main(string[] args)\n {\n short weight = short.Parse(Console.ReadLine());\n if (weight % 2 == 0 && weight != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Console;\nusing static System.Math;\nclass Z { static void Main() => new K(); }\nclass K\n{\n\tint F => int.Parse(Str);\n\tlong FL => long.Parse(Str);\n\tint[] G => Strs.Select(int.Parse).ToArray();\n\tlong[] GL => Strs.Select(long.Parse).ToArray();\n\tstring Str => ReadLine();\n\tstring[] Strs => Str.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n\tconst int MOD = 1000000007;\n\tpublic K()\n\t{\n\t\tSetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n\t\tSolve();\n\t\tOut.Flush();\n\t}\n\tvoid Solve()\n\t{\n\t\tvar w = F;\n\t\tWriteLine(w > 2 && w % 2 == 0 ? \"YES\" : \"NO\");\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace for_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine((((n % 2) == 0) && (n != 2)) ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace coding\n{\n class Program\n {\n static void Main(string[] args)\n {\n // Change the appereance of code\n\n /*Console.Title = \"My code\";\n Console.ForegroundColor = ConsoleColor.Cyan;\n Console.WindowHeight = 40;*/\n\n int num = Convert.ToInt32(Console.ReadLine());\n\n if ( (num-2) % 2 == 0 && num != 2) \n {\n Console.WriteLine(\"YES\");\n }\n else \n {\n Console.WriteLine(\"NO\");\n }\n // Wait before closing\n // Console.ReadKey();\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i = int.Parse(Console.ReadLine());\n Console.WriteLine((i % 2 == 0) && i > 2 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n \n int weight = Convert.ToInt32(Console.ReadLine());\n\n if (weight%2==0 && weight!=2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n string weight = Console.ReadLine();\n int w = Convert.ToInt16 (weight);\n if ( 1 <= w && w <= 100) {\n if ( w == 2 ) {\n Console.WriteLine(\"NO\"); \n } \n else {\n Console.WriteLine(w % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace \u0430\u0440\u0431\u0443\u0437\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Weight = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(Weight > 2 && Weight % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\n\nnamespace Program\n{\n public static class Program\n {\n private readonly static string _yes = \"YES\";\n private readonly static string _no = \"NO\";\n \n public static void Main(string[] args)\n {\n var input = Convert.ToInt32(Console.ReadLine());\n \n if (input == 2)\n {\n Console.WriteLine(_no);\n return;\n }\n \n switch (input % 2)\n {\n case 0:\n Console.WriteLine(_yes);\n break;\n case 1:\n Console.WriteLine(_no);\n break;\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = 0;\n int.TryParse(Console.ReadLine(), out w);\n if (w % 2 == 0)\n {\n if (w == 2){\n System.Console.WriteLine(\"NO\");\n \n } else {\n System.Console.WriteLine(\"YES\"); \n }\n } else {\n System.Console.WriteLine(\"NO\");\n } \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Convert.ToInt32(Console.ReadLine());\n var a = input - 2;\n var result = (a > 0 && a % 2 == 0) ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int w=Convert.ToInt32(Console.ReadLine());\n if (w%2==1)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if ((w/2)%2==0)\n {\n Console.WriteLine(\"YES\"); \n }\n else if ((((w-2)/2)%2==0)&&((w-2)!=0))\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}"}], "negative_code": [{"source_code": "using System;\n\nnamespace HelloWorld\n{\n class Program\n {\n static void Main(string[] args)\n {\n string x = Console.ReadLine();\n int w = Convert.ToInt16(x);\n bool z;\n if (w % 2 == 0)\n {\n z = true;\n }\n else\n {\n z = false;\n }\n string ans = \"YES\";\n if (z == false)\n {\n ans = \"NO\";\n }\n Console.WriteLine(ans);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace msp_watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w;\n w = int.Parse(Console.ReadLine());\n if(w%2!=0)\n {\n Console.WriteLine(\"NO\");\n }\n else { Console.WriteLine(\"YES\"); }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication26\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.Write(\"Enter The number you need found it : \");\n int num = int.Parse(Console.ReadLine());\n int[] x = {1,2,3,4,5,6,7,9,10,12,15,17,18,19};\n \n BinarySearch(x, num);\n\n }\n static void BinarySearch(int[]x,int y)\n {\n int start = 0;\n int end = x.Length - 1;\n int mid ;\n\n while (start <= end)\n {\n mid = (start+end)/2;\n\n if (y==x[mid])\n { \n Console.WriteLine(\"The number is found in index \"+ mid);\n break;\n }\n else if(y < x[mid]) \n {\n end = mid - 1;\n }\n else if (y > x[mid])\n {\n start = mid + 1;\n }\n else\n Console.WriteLine(\"not found\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Melon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numero = 5;\n string comprueba = \"YES\";\n string comprueba2 = \"NO\";\n\n if(numero % 2 == 0)\n {\n Console.WriteLine(comprueba);\n }\n else\n {\n Console.WriteLine(comprueba2);\n }\n\n }\n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(n % 2 == 0 ? ((n / 2) % 2 == 0 ? \"YES\" : \"NO\") : \"NO\");\n \n }\n}\n"}, {"source_code": "using System;\nnamespace HelloWorld\n{\n class Hello\n {\n \n static void Main(string[] args)\n { int w;\n Console.WriteLine(\"Enter a number between 1 and 100: \");\n w = Convert.ToInt32(Console.ReadLine());\n if (w % 2 == 0)\n \n Console.WriteLine(\"YES\");\n\n \n else\n\n \n Console.WriteLine(\"NO\");\n\n }\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace WayTooLongWords\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 a;\n\n a = Convert.ToInt32(Console.ReadLine());\n\n if (a > 1 && a < 100)\n {\n if ((a % 2) == 0)\n {\n Console.Write(\"YES\");\n }\n\n else \n {\n Console.Write(\"NO\");\n }\n }\n\n else\n {\n return;\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication13\n{\n class Program\n {\n static void Main(string[] args)\n {\n int W = int.Parse(Console.ReadLine());\n if (W % 2 == 1)\n {\n Console.WriteLine(\"NO\");\n }\n if (W == 2)\n {\n Console.WriteLine(\"NO\");\n }\n if (W == 4)\n {\n Console.WriteLine(\"YES\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Melon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numero = 5;\n string comprueba = \"YES\";\n string comprueba2 = \"NO\";\n\n if(numero % 2 == 0)\n {\n Console.WriteLine(comprueba);\n }\n else\n {\n Console.WriteLine(comprueba2);\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n\n if (w % 2 == 0 || w == 2)\n Console.Write(\"YES\");\n else Console.Write(\"NO\");\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace p11\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w,cont =0;\n bool find = false;\n w = Convert.ToInt32(Console.ReadLine());\n\n for( int i =0 ; i=1)\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\n\nclass Solution\n{\n static string Even(int n)\n {\n string ans=\"NO\";\n if(n%2==0)\n {\n ans=\"YES\";\n }\n return ans;\n }\n \n static void Main(string[] args) {\n l: int n=int.Parse(Console.ReadLine());\n \n if(n>=1&&n<=100)\n {\n string final=Even(n);\n Console.WriteLine(final);\n\n \n }\n else\n {\n goto l;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n int weight = 0;\n weight = Convert.ToInt32(Console.ReadLine());\n \n if (weight % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n } else {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n Console.Write(DivideWatermelon(int.Parse(Console.ReadLine())));\n }\n\n public static string DivideWatermelon(int w)\n {\n return w % 2 == 0 ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeKata\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Console.WriteLine(CodeForceWaterMelon(int.Parse(input))); \n }\n private static string CodeForceWaterMelon(int w)\n {\n string result;\n try {\n if (w < 1 || w > 100)\n {\n throw new Exception(\"More than 100 or Less Than 1\");\n\n }\n else\n {\n w = w / 2;\n\n if (w % 2 == 1)\n { //odd Number\n result = \"NO\";\n }\n else\n { //even\n result = \"YES\";\n }\n }\n\n }\n catch (Exception e)\n {\n return e.Message;\n }\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.Read());\n if (w <= 2)\n {\n Console.Write(\"NO\");\n }\n else if (w % 2 == 0)\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int parameter = int.Parse(Console.ReadLine());\n\n if (parameter >= 1 && parameter <= 100)\n {\n if ((parameter % 2) == 0)\n Console.WriteLine(\"Yes\");\n\n else\n Console.WriteLine(\"No\");\n\n Console.ReadLine();\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace AdhocProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Enter a watermelon weight:\");\n double w = Convert.ToDouble(Console.ReadLine()); //watermelon in kilograms\n if (w < 1 && w > 100)\n {\n Console.Write(\"NO\");\n }\n\n if (w <= 2)\n {\n Console.Write(\"NO\");\n }\n\n if (w <= 2)\n {\n Console.Write(\"NO\");\n }\n if (w % 2 == 0)\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if ( a == 2) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if ((a % 4 == 0) || ((a-4) % 2 != 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Wotermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = 8;\n if (w % 2 == 0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n long lKilo = 0;\n\n String sLine = Console.ReadLine();\n String[] sLines = sLine.Split(' ');\n\n lKilo = Convert.ToInt64(sLines[0]);\n \n if (lKilo/2 == lKilo/2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Watermelon800\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n //Console.WriteLine(((w % 2) == 0) && (w / 2) % 2 == 0); \n Console.WriteLine(true);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = 0;\n sa:\n Console.WriteLine(\"enter number from 1 to 100\");\n w = int.Parse(Console.ReadLine());\n if (w>1&&w<100)\n {\n \n if (w % 2 == 0 && (w / 2) % 2 == 0)\n Console.WriteLine(\"yes\");\n else\n Console.WriteLine(\"no\");\n }\n else\n {\n goto sa;\n }\n \n \n }\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Skrotowanie\n{\n class Program\n {\n static void Main(string[] args)\n {\n var waga = Convert.ToUInt32(Console.ReadLine());\n\n if (waga%2 == 0 && waga%2 > 1) \n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeKata\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n Console.WriteLine(CodeForceWaterMelon(int.Parse(input))); \n }\n private static string CodeForceWaterMelon(int w)\n {\n string result;\n try {\n if (w < 1 || w > 100)\n {\n throw new Exception(\"More than 100 or Less Than 1\");\n\n }\n else\n {\n if (w % 2 == 1)\n { //odd Number\n result = \"NO\";\n }\n else\n {\n result = \"YES\";\n }\n }\n\n }\n catch (Exception e)\n {\n return e.Message;\n }\n return result;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace Codeforces\n{\n class Program\n {\n private static string IsDivisible(int weight)\n {\n if(weight % 2 == 0 || weight==2)\n {\n return \"YES\";\n }\n else\n {\n return \"NO\";\n }\n }\n \n static void Main(string[] args)\n {\n int weight= getKg();\n string result = IsDivisible(weight);\n print(result);\n }\n \n private static void print(Object o)\n {\n Console.WriteLine(o);\n }\n private static int getKg()\n {\n return (int)Console.Read();\n }\n \n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Convert.ToInt32(Console.ReadLine());\n var a = input / 2;\n var b = input - a;\n var result = a == b && a % 2 == 0 ? \"YES\" : \"NO\";\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication16\n{\n class Program\n {\n //developed by ayman yousef \n //problem solving\n //4A\n //waatermeloon\n static void Main(string[] args)\n {\n Console.WriteLine(\"pls enter the weight of watermeloon \");\n double w = double.Parse(Console.ReadLine());\n\n if(w == 2 )\n {\n Console.WriteLine(\"No\");\n }\n else if(w % 2 == 0)\n {\n Console.WriteLine(\"Yes\");\n\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if (( a % 4 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else if (((a-1) % 2) == 0)\n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A2problem1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int weight=int.Parse(Console.ReadLine());\n if (weight == 2)\n Console.WriteLine(\"NO\");\n if (weight % 2 == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\n class Program \n {\n static void Main(string[] args)\n {\n int a=int.Parse(Console.ReadLine());\n if (a % 2 == 2) { Console.Write(\"Yes\"); }\n else if (a % 2 == 1) { Console.Write(\"No\"); }\n else Console.Write(\"No\");\n \n Console.ReadLine(); \n }\n }\n\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse( Console.ReadLine());\n string res = ((n - 2 ) %2== 0 && (n - 2 ) %2 > 0) ? \"YES\" : \"NO\";\n Console.WriteLine(res);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if(w % 2 == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program0{\n\n static void Main(string[] args)\n {\n int m = 2;\n int k = 2;\n\n if (m+k*2 == 8 )\n {\n Console.WriteLine(\"YES\");\n }\n\n else {\n Console.WriteLine(\"NO\");\n }\n\n Console.ReadLine();\n }\n }\n}\n \n \n\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int i = int.Parse(Console.ReadLine());\n \n if (i % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n \n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nclass Exercise11\n{\n static void Main()\n {\n int w = int.Parse(Console.ReadLine());\n if ((w%2 == 1) && (w<101 && 100>0))\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n }\n \n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Sayi Giriniz\");\n int sayi =Convert.ToInt32(Console.ReadLine());\n \n if(sayi<=3)\n {\n Console.WriteLine(\"NO\");\n }\n else{\n if (sayi % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n\n }\n else Console.WriteLine(\"NO\");\n }\n \n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int N = int.Parse(Console.ReadLine());\n if (N % 4 == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n\nnamespace Watermelon\n{\n class Program\n {\n static void BruteForce(int weight)\n {\n int counter = 0;\n\n for (int i = 1; i <= weight; i++)\n {\n for (int j = i; j <= weight; j++)\n {\n if (i % 2 == 0 && j % 2 == 0 && i + j == weight)\n {\n counter++;\n }\n }\n }\n\n if (counter > 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n static void Main(string[] args)\n {\n int weight = 8;\n\n BruteForce(weight);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n EvenParts(w);\n\n }\n static void EvenParts(int w)\n {\n if (w!=0)\n {\n\n\n if (w % 2 == 0 && (w / 2) % 2 == 0)\n {\n\n\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n\n }\n }\n else\n Console.WriteLine(\"NO\");\n\n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A._watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int W;\n //Console.Write(\"Weight of the watermelon: \");\n W = int.Parse(Console.ReadLine());\n if (W>1 && W<101)\n {\n if (W % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace novosoft\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x =Int32.Parse(Console.ReadLine());\n\n if (x>=1 && x<=100 )\n {\n if (x % 2 == 0 && x>= 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace problem4a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = 0;\n w = Console.Read();\n if( w % 2==0) \n {\n Console.WriteLine(\"Yes\");\n }\n else \n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace MyApp\n{\n class Program\n {\n static void Main()\n {\n int x = 3;\n \n x = Convert.ToInt32(Console.ReadLine());\n if (x % 4 == 0)\n {\n Console.WriteLine(\"YES\");\n\n }else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Eventing.Reader;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n private static string _no = \"NO\";\n private static string _yes = \"YES\";\n\n static void Main(string[] args)\n {\n var readLine = Console.ReadLine();\n\n var result = Calculate(readLine);\n\n Console.WriteLine(result);\n }\n\n private static string Calculate(string input)\n {\n var totalWeight = Int32.Parse(input);\n\n if (totalWeight < 0)\n {\n return _no;\n }\n\n for (var i = 2; i < totalWeight - 2; i += 2)\n {\n var rest = totalWeight - i;\n\n if (rest%2 == 0 && rest > 0)\n {\n return _yes;\n }\n }\n\n return _no;\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if (( a % 4 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else if ((a % 2) == 1)\n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if ( ( (a+4)/2 % 2 == 0)) \n {\n Console.WriteLine(\"YES\"); \n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Codeforces\n {\n public static void Main(string[] args)\n {\n Console.Write(Run(int.Parse(Console.ReadLine())));\n }\n\n public static string Run(int w)\n {\n int i = 2;\n\n while (i < w / 2)\n {\n if (i % 2 == 0 && (w - i) % 2 == 0)\n {\n return \"YES\";\n }\n\n i += 1;\n }\n\n return \"NO\";\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace DANYAVINOVAT\n{\n class Main_of_main\n {\n static void Main(string[] args)\n {\n \n int n = Convert.ToInt32(Console.ReadLine());\n if(n%2==0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n string s = Console.ReadLine();\n int p = Convert.ToInt32(s);\n if (p % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if (( a % 4 == 0) || (a > 2 )) \n {\n Console.WriteLine(\"YES\");\n }\n \n else if (((a-1) % 2) == 0)\n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static int Main()\n {\n int w = Int32.Parse(Console.ReadLine());\n if (w % 2 == 0)\n {\n int a, b;\n a = w / 2;\n b = w / 2;\n if (a % 2 == 0 && b % 2 == 0) Console.WriteLine(\"YES\");\n else\n if (a % 2 == 1 && b % 2 == 1) { a += 1; ;b-= 1; Console.WriteLine(\"Yes\"); }\n else Console.WriteLine(\"NO\");\n }\n else Console.WriteLine(\"NO\");\n return 0;\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint w = Math.Max (0, Math.Min (Convert.ToInt32 (Console.ReadLine ()), 100));\n\t\t\t\t\n\t\t\tif (w % 2 == 0)\n\t\t\t\tConsole.WriteLine (\"YES\");\n\t\t\telse\n\t\t\t\tConsole.WriteLine (\"No\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace TestThings\n{\n class Program\n {\n static void Main(string[] args)\n {\n var w = float.Parse(Console.ReadLine());\n if (w < 1 || w > 100)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if ((w/2) % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if (( a % 2 == 1)) \n {\n Console.WriteLine(\"NO\");\n }\n \n else \n {\n Console.WriteLine(\"YES\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForce1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(((char)Console.Read()).ToString());\n if (w % 2 == 0 && w != 2)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = int.Parse(Console.ReadLine());\n if (((n % 2 ==0) && (n/2)%2 == 0)|| n==2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n}\n"}, {"source_code": "\ufeffnamespace CodeWars\n{\n class Program\n {\n static void Main(string[] args)\n {\n System.Console.WriteLine(DivideWatermelon.Divide(5));\n }\n }\n\n public static class DivideWatermelon\n {\n public static string Divide(int w)\n {\n return (w % 2 == 0) ? \"YES\" : \"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace code_Forces_A._watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n if(Int32.TryParse(input, out int num) && num >= 1 && num <= 100)\n {\n int numDivided = num % 4; // divide by 2 and result needs to be even.\n if (numDivided == 0)\n {\n Console.WriteLine(\"Yes {0}\", numDivided);\n }\n else\n {\n Console.WriteLine(\"No {0}\", numDivided);\n }\n\n\n }\n else\n {\n Console.WriteLine(num.ToString());\n }\n\n }\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n int x ;\n x = w / 2;\n\n if (x % 2 == 0 )\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n \n \n }\n\n }\n }\n\n"}, {"source_code": "using System;\nclass Program\n{\n\tpublic static void Main() {\n\t\tvar n = int.Parse(Console.ReadLine());\n\t\tfor(var i = 1; i < n/2; i++){\n\t\t\tvar b = n - i;\n\t\t\tvar a = n - b;\n\t\t\tif(a % 2 == 0 && b % 2 == 0) {\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(\"NO\");\n\t}\n}\n// Program.Main();"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication26\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if (x % 2 == 0)\n {\n\n\n int n = x / 2;\n if (n % 2 == 0)\n {\n Console.WriteLine(\"yes\");\n\n }\n }\n Console.WriteLine(\"no\");\n\n }\n }\n}"}, {"source_code": "using System;\n class Program\n {\n static void Main()\n {\n byte watermelon;\n watermelon = byte.Parse(Console.ReadLine());\n if (watermelon <= 100 && watermelon >= 1)\n {\n if (watermelon % 2 == 0)\n Console.Write(\"yes\");\n else\n Console.Write(\"no\");\n }\n else\n Console.Write(\"err\");\n }\n }\n"}, {"source_code": "using System;\n\nnamespace o\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n //if w can be divided into to even piles\n\n if(CanBeDividedInTwoEvenParts(w))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n //15 \n // 6 / 3 4\n //50 \n //24 26\n }\n\n static bool CanBeDividedInTwoEvenParts(int w)\n {\n if (w % 2 == 0)\n return true;\n \n //count from one end to the other \n for(int i = 1; i < w; i++)\n {\n if (w - i % 2 == 0 && i % 2 == 0)\n return true;\n }\n\n return false;\n }\n }\n}\n"}, {"source_code": "using System; \nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if (w % 2 == 0) \n {\n if (w != 2)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n } \n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int watermelon = Console.Read();\n Console.Write(watermelon % 2 == 0 ? \"YES\" : \"NO\"); \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace TestWaterMelonCodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int w;\n Int32.TryParse(input, out w);\n\n Console.WriteLine(WaterMelon(w));\n }\n\n private static string WaterMelon(int w)\n {\n\n if (w % 2 != 0) return $\"NO\";\n\n float k;\n k = w % 2;\n\n if (k % 2 != 0) return $\"NO\";\n\n if (k % 1 == 0)\n {\n return $\"YES\";\n }\n else return $\"NO\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace sduhcguyasdc\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint n = int.Parse(Console.ReadLine());\n\t\t\tif(n>0){\n\t\t\t\tConsole.WriteLine(\"YES\");\n\t\t\t}else{\n\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t}\n\t\t\t//Console.ReadKey(true);\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int pices=0;\n if( pices >= 1 && pices<=100)\n {\n if(pices %2==0)\n {\n Console.WriteLine(\"Yes\");\n }\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int g = new int();\n g = Convert.ToInt32(Console.ReadLine());\n if ((g%2)==0 && g >= 2)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int a;\n a = 8;\n a = int.Parse (Console.ReadLine());\n \n if (( a == 2)) \n {\n Console.WriteLine(\"NO\"); \n }\n \n if (( a/2 % 2 == 0)) \n {\n Console.WriteLine(\"YES\");\n }\n \n else \n {\n Console.WriteLine(\"NO\");\n }\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Arbuz\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int w = Console.Read();\n if (w >= 4 && w % 2 == 0 && w <= 100)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n if (w >= 4 && w % 10 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Wotermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if (w % 2 == 0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int kilo;\n\n kilo = Convert.ToInt32(Console.ReadLine());\n\n if (kilo>=0 && kilo<=100 && kilo/2==0)\n {\n Console.WriteLine(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace WaterMelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.Write(\"\");\n int w = int.Parse(Console.ReadLine());\n if (w%2==0 && w>1 && w<100)\n {\n Console.Write(\"Yes\");\n }\n else\n {\n Console.WriteLine(\"No\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CFtest\n{\n class Program\n {\n static void Main(string[] args)\n { int w = int.Parse(Console.ReadLine());\n if (2 <= w && w <= 100 && w % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else { Console.WriteLine(\"NO\"); }\n }\n }\n}\n"}, {"source_code": "using System;\n\n\nnamespace watermilon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Console.Read();\n\n if (w > 3 && w < 101 )\n\n {\n if (w % 2 == 0)\n {\nConsole.Write(\"YES\");\n }\n \n\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n string result;\n\n a = Console.Read();\n\n if (a >= 1 && a <= 100)\n {\n if (((a%2) == 0) && (a != 2))\n result = \"YES\";\n else\n result = \"NO\";\n }\n else\n return;\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace _4A\n{\n class Program\n {\n static void Main()\n {\n\n double a;\n\n a = (double)Console.Read();\n\n if(a == 2)\n {\n Console.WriteLine(\"NO\");\n }\n else if(a % 2 == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System; \n\nnamespace _4A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n if (w % 2 == 0) \n {\n if (w != 2)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n } \n } \n }\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int a;\n string result;\n\n a = Console.Read();\n\n if (a >= 1 && a <= 100)\n {\n if ((a%2) == 0 && (a / 2)%2 == 0)\n result = \"YES\";\n else\n result = \"NO\";\n }\n else\n return;\n\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A2problem1\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int weight=int.Parse(Console.ReadLine());\n\n if (weight % 2 == 0||weight!=2)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace watermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n \n if (w % 2 == 0)\n {\n Console.WriteLine(\"yes\");\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n\n \n }\n\n }\n }\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x =Convert.ToInt32( Console.ReadLine());\n if (x % 2 == 0)\n Console.WriteLine(\"YES\");\n else if (x==2)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n \n }\n \n }\n \n \n "}, {"source_code": "\ufeffusing System;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = int.Parse(Console.ReadLine());\n if(input % 4 == 0) System.Console.WriteLine(\"YES\");\n else System.Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\n\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n % 2 == 0)\n {\n int n2 = n / 2;\n if (n2 % 2 == 0) Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }"}, {"source_code": "class Program\n {\n static void Main(string[] args)\n {\n int w;\n w = int.Parse(System.Console.ReadLine());\n int a = w / 2;\n \n\n if (a != 0) { \n for (int i = 1; i < w; i++)\n {\n if ((i % 2) == 0 && (w - i) % 2 == 0)\n {\n System.Console.WriteLine(\"YES\");\n i = w;\n\n }\n\n }\n }\n \n else\n System.Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "class Program\n {\n static void Main(string[] args)\n {\n int w;\n w = int.Parse(System.Console.ReadLine());\n int a = w / 2;\n \n\n if (a != 0) { \n for (int i = 1; i < w; i++)\n {\n if ((i % 2) == 0 && (w - i) % 2 == 0)\n {\n System.Console.WriteLine(\"YES\");\n i = w;\n\n }\n\n }\n }\n \n else\n System.Console.WriteLine(\"NO\");\n }\n}"}, {"source_code": "using System;\n\nnamespace AdhocProblems\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Enter a watermelon weight:\");\n double w = Convert.ToDouble(Console.ReadLine());\n if (w < 1 && w > 100)\n {\n Console.Write(\"NO\");\n }\n\n if (w <= 2)\n {\n Console.Write(\"NO\");\n }\n\n if (w <= 2)\n {\n Console.Write(\"NO\");\n }\n if (w % 2 == 0)\n {\n Console.Write(\"YES\");\n }\n else\n {\n Console.Write(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main(string[] args)\n {\n int w = int.Parse(Console.ReadLine());\n Console.WriteLine(w % 2 == 0 ? \"YES\" : \"NO\");\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if (x < 100 & x > 1)\n {\n if (x % 2 == 0 & x!=2)\n {\n \n Console.WriteLine(\"yes\");\n \n }\n else\n {\n Console.WriteLine(\"no\");\n }\n }\n else\n {\n Console.WriteLine(\"no\");\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int w;\n w=Int32.Parse(Console.ReadLine()); if(w % 2==0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.WebSockets;\nusing System.Runtime.InteropServices;\n\nclass Program\n{\n static void Main()\n {\n int input = Int32.Parse(Console.ReadLine());\n\n if ((input % 2) == 0)\n {\n Console.WriteLine(\"YES\"); \n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n}\n\n"}, {"source_code": "using System;\n\nclass A{\n static void Main(){\n int N = int.Parse(Console.ReadLine());\n string ans = \"NO\";\n for (int i = 2; i < N; i+=2){\n if (N / i % 2 == 0) ans = \"YES\";\n }\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "using System;\n\nnamespace Watermelon800\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(((w % 2) == 0) && (w / 2) % 2 == 0); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace SingleLineInput\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine();\n var inputN = int.Parse(input);\n Console.WriteLine(inputN % 2 == 0 ? \"YES\" : \"NO\");\n }\n }\n}\n"}], "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Codeforces_253_2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Dictionary K = new Dictionary();\n Dictionary C = new Dictionary();\n foreach (string s in Console.ReadLine().Split(' ')) {\n K[s] = 0;\n C[s[0]] = 0;\n C[s[1]] = 0;\n }\n int ret = 0, i;\n int[] u = new int[10];\n List CC = new List();\n foreach (char c in C.Keys) CC.Add(c);\n List KK = new List();\n foreach (string k in K.Keys) KK.Add(k);\n if (1 < K.Count) {\n for (ret = 1; ret < C.Count; ++ret)\n {\n for (i = 0; i < ret; ++i) u[i] = i;\n do {\n List> T = new List>();\n T.Add(new List(KK));\n for (i = 0; i < ret; ++i) {\n char cc = CC[u[i]];\n int z = (cc <= '9') ? 1 : 0;\n for (int j = T.Count - 1; 0 <= j; --j) {\n List t = new List();\n for (int k = T[j].Count - 1; 0 <= k; --k) {\n if (T[j][k][z] == cc) {\n t.Add(T[j][k]);\n T[j].RemoveAt(k);\n }\n }\n if (T[j].Count < 2) T.RemoveAt(j);\n if (1 < t.Count) T.Add(t);\n }\n }\n if (T.Count < 1) { Console.WriteLine(ret); return; }\n for (i = ret-1; 0 <= i; --i) if (++u[i] < C.Count-(ret-1) + i) break;\n if (i < 0) break;\n for (++i; i < ret; ++i) u[i] = u[i-1] + 1;\n } while (true);\n }\n }\n Console.WriteLine(ret);\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Borya_and_Hanabi\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n string[] ss = reader.ReadLine().Split(' ');\n\n var nn = new int[5,5];\n\n for (int i = 0; i < n; i++)\n {\n int n2 = ss[i][1] - '1';\n int n1 = -1;\n switch (ss[i][0])\n {\n case 'R':\n n1 = 0;\n break;\n case 'G':\n n1 = 1;\n break;\n case 'B':\n n1 = 2;\n break;\n case 'Y':\n n1 = 3;\n break;\n case 'W':\n n1 = 4;\n break;\n }\n nn[n1, n2] = 1;\n }\n\n int min = 8;\n\n for (int i = 0; i < 32; i++)\n {\n int bi = Bitcount(i);\n if (bi >= min)\n continue;\n\n for (int j = 0; j < 32; j++)\n {\n int bj = Bitcount(j);\n if (bi + bj >= min)\n continue;\n\n var mask = new int[5,5];\n\n for (int k = 0; k < 5; k++)\n {\n if ((i & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n mask[k, l] |= 1 << (k+6);\n }\n }\n }\n }\n\n for (int k = 0; k < 5; k++)\n {\n if ((j & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[l, k] != 0)\n {\n mask[l, k] |= 1 << k;\n }\n }\n }\n }\n\n var list = new List();\n for (int k = 0; k < 5; k++)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n list.Add(mask[k, l]);\n }\n }\n }\n list.Sort();\n bool f = false;\n for (int k = 1; k < list.Count; k++)\n {\n if (list[k - 1] == list[k])\n {\n f = true;\n break;\n }\n }\n if (!f)\n {\n if (bi + bj < min)\n min = bi + bj;\n }\n }\n }\n\n writer.WriteLine(min);\n writer.Flush();\n }\n\n private static int Bitcount(int n)\n {\n int count = 0;\n do\n {\n if ((n & 1) == 1)\n count++;\n n >>= 1;\n } while (n > 0);\n return count;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Task_C\n{\n class Program\n {\n private static int CardIndex(string card)\n {\n var num = card[1] - '1';\n int color = 0;\n if (card[0] == 'R')\n color = 0;\n if (card[0] == 'G')\n color = 1;\n if (card[0] == 'B')\n color = 2;\n if (card[0] == 'Y')\n color = 3;\n if (card[0] == 'W')\n color = 4;\n\n var index = (1 << num) | (1 << (color + 5));\n return index;\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var cards = Console.ReadLine().\n Split().\n Distinct().\n Select(x => CardIndex(x)).\n ToList();\n\n var minSuggest = int.MaxValue;\n\n var maxSuggest = 1 << 10;\n for (int suggest = 0; suggest < maxSuggest; suggest++)\n {\n var distinctCard = cards.Select(x => x & suggest).Distinct().Count();\n if (distinctCard == cards.Count)\n {\n var suggestSize = SparseBitcount(suggest);\n if (suggestSize < minSuggest)\n {\n minSuggest = suggestSize;\n }\n }\n }\n\n Console.WriteLine(minSuggest);\n }\n\n static int SparseBitcount(int n)\n {\n int count = 0;\n while (n != 0)\n {\n count++;\n n &= (n - 1);\n }\n return count;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static bool[,] M;\n static int[,] N;\n static bool[] C;\n\n static void Main()\n {\n M = new bool[5,5];\n N = new int[5,5];\n C = new bool[10];\n \n string l = \"RGBYW\";\n int times = int.Parse(Console.ReadLine());\n string[] p = Console.ReadLine().Split();\n for (int i = 0; i < times; ++i)\n {\n string s = p[i];\n int t = -1;\n for (int j = 0; j < 5; ++j)\n {\n if (s[0] == l[j])\n t = j;\n }\n M[t,int.Parse(s[1].ToString()) - 1] = true;\n }\n Console.WriteLine(BT(0));\n }\n\n static int BT(int level)\n {\n if (valid())\n return level;\n\n int num = (int)Math.Pow(2, level);\n int pistas = 20;\n for (int i = 0; i < 10; ++i)\n {\n if (!C[i])\n {\n C[i] = true;\n if (i / 5 == 0)\n {\n for (int j = 0; j < 5; ++j)\n {\n N[i, j] += num;\n }\n }\n else\n {\n for (int j = 0; j < 5; ++j)\n {\n N[j , i - 5] += num;\n }\n }\n int cur_pistas = BT(level + 1);\n\n if (cur_pistas < pistas)\n pistas = cur_pistas;\n\n C[i] = false;\n if (i / 5 == 0)\n {\n for (int j = 0; j < 5; ++j)\n {\n N[i, j] -= num;\n }\n }\n else\n {\n for (int j = 0; j < 5; ++j)\n {\n N[j, i - 5] -= num;\n }\n }\n\n }\n }\n return pistas;\n }\n\n static bool valid()\n {\n bool[] q = new bool[4000];\n for (int i = 0; i < 5; ++i)\n {\n for (int j = 0; j < 5; ++j)\n {\n if (M[i, j])\n {\n if (q[N[i, j]])\n return false;\n q[N[i, j]] = true;\n }\n }\n }\n return true;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n// (\u3065*\u03c9*)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int BitCount(int x)\n {\n int ret = 0;\n while (x > 0)\n {\n ret++;\n x &= x - 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var cards = new Tuple[n];\n for (int i = 0; i < n; i++)\n {\n var t = ReadToken();\n cards[i] = Tuple.Create(\"RGBYW\".IndexOf(t[0]) + 5, t[1] - '1');\n }\n cards = cards.Distinct().ToArray();\n n = cards.Length;\n\n int ans = 15;\n for (int k = 0; k < 2 << 10; k++)\n {\n bool ok = true;\n for (int i = 0; i < n && ok; i++)\n for (int j = i + 1; j < n && ok; j++)\n if (cards[i].ToString() != cards[j].ToString())\n {\n ok = false;\n if (cards[i].Item1 != cards[j].Item1 && ((k >> cards[i].Item1 & 1) == 1 || (k >> cards[j].Item1 & 1) == 1))\n ok = true;\n if (cards[i].Item2 != cards[j].Item2 && ((k >> cards[i].Item2 & 1) == 1 || (k >> cards[j].Item2 & 1) == 1))\n ok = true;\n }\n if (ok)\n ans = Math.Min(ans, BitCount(k));\n }\n\n return ans;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Runtime.Remoting.Metadata.W3cXsd2001;\nusing System.Security.Cryptography;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF253\n{\n struct Card\n {\n public int Color, Num;\n\n public Card(int color, string num)\n {\n Color = color;\n Num = int.Parse(num) - 1;\n }\n }\n class C\n {\n readonly int[] _bad = { ' ', '\\r', '\\n' };\n\n private string NextToken()\n {\n var sb = new StringBuilder();\n int i;\n\n while (Array.IndexOf(_bad, (i = Console.Read())) != -1)\n {\n }\n sb.Append((char)i);\n\n while (Array.IndexOf(_bad, (i = Console.Read())) == -1)\n {\n sb.Append((char)i);\n }\n return sb.ToString();\n }\n\n int NextInt()\n {\n return int.Parse(NextToken());\n }\n\n private void run()\n {\n var n = NextInt();\n var h = new Dictionary();\n h.Add('R', 0);\n h.Add('G', 1);\n h.Add('B', 2);\n h.Add('Y', 3);\n h.Add('W', 4);\n var s = \"\";\n var pairs = Enumerable.Range(0, n).Select(x => new Card(h[(s = NextToken())[0]], s.Substring(1, 1))).ToArray();\n pairs = pairs.Distinct().ToArray();\n n = pairs.Length;\n var min = 239;\n for (var m1 = 0; m1 < 1 << 5; ++m1)\n {\n var num = Enumerable.Range(0, 5).Select(x => (m1 & (1 << x)) > 0).ToArray();\n for (var m2 = 0; m2 < 1 << 5; ++m2)\n {\n var color = Enumerable.Range(0, 5).Select(x => (m2 & (1 << x)) > 0).ToArray();\n var good = true;\n for (var i = 0; i < n; ++i)\n for (var j = 0; j < i; ++j)\n {\n var g = pairs[i].Color != pairs[j].Color && (color[pairs[i].Color] || color[pairs[j].Color]) ||\n pairs[i].Num != pairs[j].Num && (num[pairs[i].Num] || num[pairs[j].Num]);\n if (!g)\n good = false;\n }\n var sum = num.Sum(x => x ? 1 : 0) + color.Sum(x => x ? 1 : 0);\n if (good && sum < min)\n min = sum;\n }\n }\n Console.Write(min);\n }\n static void Main(string[] args)\n {\n new C().run();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Borya_and_Hanabi\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n string[] ss = reader.ReadLine().Split(' ');\n\n var nn = new int[5,5];\n\n for (int i = 0; i < n; i++)\n {\n int n2 = ss[i][1] - '1';\n int n1 = -1;\n switch (ss[i][0])\n {\n case 'R':\n n1 = 0;\n break;\n case 'G':\n n1 = 1;\n break;\n case 'B':\n n1 = 2;\n break;\n case 'Y':\n n1 = 3;\n break;\n case 'W':\n n1 = 4;\n break;\n }\n nn[n1, n2] = 1;\n }\n\n int min = 8;\n\n for (int i = 0; i < 32; i++)\n {\n int bi = Bitcount(i);\n if (bi >= min)\n continue;\n\n for (int j = 0; j < 32; j++)\n {\n int bj = Bitcount(j);\n if (bi + bj >= min)\n continue;\n\n var mask = new int[5,5];\n\n for (int k = 0; k < 5; k++)\n {\n if ((i & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n mask[k, l] |= 1 << (k+6);\n }\n }\n }\n }\n\n for (int k = 0; k < 5; k++)\n {\n if ((j & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[l, k] != 0)\n {\n mask[l, k] |= 1 << k;\n }\n }\n }\n }\n\n var list = new List();\n for (int k = 0; k < 5; k++)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n list.Add(mask[k, l]);\n }\n }\n }\n list.Sort();\n bool f = false;\n for (int k = 1; k < list.Count; k++)\n {\n if (list[k - 1] == list[k])\n {\n f = true;\n break;\n }\n }\n if (!f)\n {\n if (bi + bj < min)\n min = bi + bj;\n }\n }\n }\n\n writer.WriteLine(min);\n writer.Flush();\n }\n\n private static int Bitcount(int n)\n {\n int count = 0;\n do\n {\n if ((n & 1) == 1)\n count++;\n n >>= 1;\n } while (n > 0);\n return count;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n// (\u3065*\u03c9*)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n int BitCount(int x)\n {\n int ret = 0;\n while (x > 0)\n {\n ret++;\n x &= x - 1;\n }\n return ret;\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var cards = new Tuple[n];\n for (int i = 0; i < n; i++)\n {\n var t = ReadToken();\n cards[i] = Tuple.Create(\"RGBYW\".IndexOf(t[0]) + 5, t[1] - '1');\n }\n cards = cards.Distinct().ToArray();\n n = cards.Length;\n\n int ans = 15;\n for (int k = 0; k < 2 << 10; k++)\n {\n bool ok = true;\n for (int i = 0; i < n && ok; i++)\n for (int j = i + 1; j < n && ok; j++)\n if (cards[i].ToString() != cards[j].ToString())\n {\n ok = false;\n if (cards[i].Item1 != cards[j].Item1 && ((k >> cards[i].Item1 & 1) == 1 || (k >> cards[j].Item1 & 1) == 1))\n ok = true;\n if (cards[i].Item2 != cards[j].Item2 && ((k >> cards[i].Item2 & 1) == 1 || (k >> cards[j].Item2 & 1) == 1))\n ok = true;\n }\n if (ok)\n ans = Math.Min(ans, BitCount(k));\n }\n\n return ans;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class Test\n{\n [Flags]\n enum Card\n {\n R = 1 << 0,\n G = 1 << 1,\n B = 1 << 2,\n Y = 1 << 3,\n W = 1 << 4,\n One = 1 << 5,\n Two = 1 << 6,\n Three = 1 << 7,\n Four = 1 << 8,\n Five = 1 << 9,\n }\n \n public static void Main()\n {\n int result = Solve();\n Console.WriteLine(result);\n }\n \n static int Solve()\n {\n \n // Don't care for n\n Console.ReadLine();\n \n var input = Console.ReadLine().Split(' ').Distinct().Select(x => ParseCard(x)).ToArray();\n if (input.Length == 1)\n {\n return 0;\n }\n List diffs = new List(input.Length * input.Length);\n for(int i = 0; i < input.Length - 1; i++)\n {\n for(int j = i + 1; j < input.Length; j++)\n {\n Card diff = Diff(input[i], input[j]);\n diffs.Add(diff);\n }\n }\n \n var subsets = Enumerable.Range(0, 1023).Select(x => (Card)x);\n int min = 11;\n foreach(var subset in subsets)\n {\n if(diffs.All(x => CanDistinguish(subset, x)))\n {\n // This is an answer\n min = Math.Min(min, CountBits((int)subset));\n }\n }\n \n return min;\n }\n \n static int CountBits(int num)\n {\n int res = 0;\n while(num > 0)\n {\n if ((num & 1) == 1) res++;\n num >>= 1;\n }\n return res;\n }\n \n static bool CanDistinguish(Card subset, Card diff)\n {\n return (subset & diff) != 0;\n }\n \n static Card Diff(Card f, Card s)\n {\n return f ^ s;\n }\n \n static Card ParseCard(string input)\n {\n Card colour = (Card)Enum.Parse(typeof(Card), input[0].ToString());\n Card num = Card.One;\n switch (input[1])\n {\n case '1': num = Card.One;break;\n case '2': num = Card.Two;break;\n case '3': num = Card.Three;break;\n case '4': num = Card.Four;break;\n case '5': num = Card.Five;break;\n }\n return colour | num;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var map = new bool[5, 5];\n var col = \"RGBYW\";\n for (int i = 0; i < n; i++)\n {\n var c = sc.Char();\n var v = sc.Integer() - 1;\n for (int j = 0; j < 5; j++)\n if (col[j] == c) map[j, v] |= true;\n }\n var max = 10;\n for (int i = 0; i < 1 << 5; i++)\n for (int j = 0; j < 1 << 5; j++)\n {\n var cost = 0;\n for (int k = 0; k < 5; k++)\n cost += (i >> k) % 2 + (j >> k) % 2;\n var c = new int[5];\n var v = new int[5];\n var u = 0;\n for (int k = 0; k < 5; k++)\n for (int l = 0; l < 5; l++)\n {\n if (!map[k, l]) continue;\n if ((i >> k) % 2 == 1 && (j >> l) % 2 == 1) continue;\n else if ((i >> k) % 2 == 1) c[k]++;\n else if ((j >> l) % 2 == 1) v[l]++;\n else u++;\n }\n if (c.Sum(x => x > 1 ? x : 0) + v.Sum(x => x > 1 ? x : 0) + u <= 1)\n max = Math.Min(max, cost);\n }\n IO.Printer.Out.WriteLine(max);\n }\n\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n }\n\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n\n }\n}\n\n#endregion\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF443D\n\t{\n\t\tint N, M, K;\n\t\tint[] Num_Cnt, Color_Cnt, Num_Map, Color_Map;\n\t\tbool[,] Has_Card;\n\n\t\tint[] count_bit(int n)\n\t\t{\n\t\t\tint i = 0;\n\t\t\tList num = new List();\n\t\t\t\n\t\t\twhile (n != 0)\n\t\t\t{\n\t\t\t\tif ((n & 0x1) == 0x1)\n\t\t\t\t\tnum.Add(i);\n\t\t\t\tn >>= 1;\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn num.ToArray();\n\t\t}\n\n\t\tint try_guess(int num_mask, int color_mask)\n\t\t{\n\t\t\tint i, j, tot;\n\t\t\tbool new_move;\n\t\t\tint[] num_cnt, color_cnt, Num, Color;\n\t\t\tbool[] num_show, color_show;\n\t\t\tbool[,] has_card;\n\n\t\t\tnum_cnt = new int[5];\n\t\t\tcolor_cnt = new int[5];\n\t\t\tnum_show = new bool[5];\n\t\t\tcolor_show = new bool[5];\n\t\t\thas_card = new bool[5, 5];\n\n\t\t\tArray.Copy(Has_Card, has_card, Has_Card.Length);\n\t\t\tArray.Copy(Num_Cnt, num_cnt, Num_Cnt.Length);\n\t\t\tArray.Copy(Color_Cnt, color_cnt, Color_Cnt.Length);\n\t\t\tNum = count_bit(num_mask);\n\t\t\tColor = count_bit(color_mask);\n\n\t\t\tif (Num.Length == M - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < M; i++)\n\t\t\t\t\tnum_show[Num_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Num)\n\t\t\t\t\tnum_show[Num_Map[m]] = true;\n\t\t\t}\n\n\t\t\tif (Color.Length == K - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < K; i++)\n\t\t\t\t\tcolor_show[Color_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Color)\n\t\t\t\t\tcolor_show[Color_Map[m]] = true;\n\t\t\t}\n\n\t\t\ttot = N;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tnew_move = false;\n\t\t\t\tfor (i = 0; i < 5; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (j = 0; j < 5; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!has_card[i, j]) continue;\n\n\t\t\t\t\t\tif ((num_show[i] && color_show[j]) || (num_show[i] && num_cnt[i] == 1) ||\n\t\t\t\t\t\t\t(color_show[j] && color_cnt[j] == 1) || tot == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thas_card[i, j] = false;\n\t\t\t\t\t\t\tnum_cnt[i]--;\n\t\t\t\t\t\t\tcolor_cnt[j]--;\n\t\t\t\t\t\t\ttot--;\n\t\t\t\t\t\t\tnew_move = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (new_move);\n\n\t\t\treturn (tot == 0 ? Num.Length + Color.Length : Int32.MaxValue);\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint i, j, n, k;\n\t\t\tHashSet c = new HashSet();\n\n\t\t\tHas_Card = new bool[5, 5];\n\t\t\tNum_Cnt = new int[5];\n\t\t\tColor_Cnt = new int[5];\n\t\t\tNum_Map = new int[5];\n\t\t\tColor_Map = new int[5];\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tc.Add(xoi.ReadString());\n\n\t\t\tN = c.Count;\n\t\t\tforeach (string s in c)\n\t\t\t{\n\t\t\t\tswitch (s[0])\n\t\t\t\t{\n\t\t\t\t\tcase 'R': k = 0; break;\n\t\t\t\t\tcase 'G': k = 1; break;\n\t\t\t\t\tcase 'B': k = 2; break;\n\t\t\t\t\tcase 'Y': k = 3; break;\n\t\t\t\t\tdefault: k = 4; break;\n\t\t\t\t}\n\t\t\t\tn = s[1] - '1';\n\t\t\t\tHas_Card[n, k] = true;\n\t\t\t\tNum_Cnt[n]++;\n\t\t\t\tColor_Cnt[k]++;\n\t\t\t}\n\n\t\t\tfor (i = M = K = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tif (Num_Cnt[i] > 0) Num_Map[M++] = i;\n\t\t\t\tif (Color_Cnt[i] > 0) Color_Map[K++] = i;\n\t\t\t}\n\n\t\t\tint ans = Int32.MaxValue;\n\t\t\tfor (i = 0; i < (1 << M); i++)\n\t\t\t\tfor (j = 0; j < (1 << K); j++)\n\t\t\t\t\tans = Math.Min(ans, try_guess(i, j));\n\n\t\t\txoi.o.WriteLine(ans);\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF443D()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF443C\n\t{\n\t\tint count_bit(int n)\n\t\t{\n\t\t\tint cnt = 0;\n\t\t\twhile (n != 0)\n\t\t\t{\n\t\t\t\tif ((n & 0x1) == 0x1)\n\t\t\t\t\tcnt++;\n\t\t\t\tn >>= 1;\n\t\t\t}\n\n\t\t\treturn cnt;\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint N, i, j, n, k, num_mask, color_mask, ans = Int32.MaxValue;\n\t\t\tstring s, color = \"RGBYW\";\n\t\t\tbool[,] has_card;\n\t\t\tbool ok;\n\n\t\t\thas_card = new bool[5, 5];\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\ts = xoi.ReadString();\n\t\t\t\tn = s[1] - '1';\n\t\t\t\tk = color.IndexOf(s[0]);\n\t\t\t\thas_card[n, k] = true;\n\t\t\t}\n\n\t\t\tfor (num_mask = 0; num_mask < (1 << 5); num_mask++)\n\t\t\t{\n\t\t\t\tfor (color_mask = 0; color_mask < (1 << 5); color_mask++)\n\t\t\t\t{\n\t\t\t\t\tint[,] hints = new int[6, 6];\n\n\t\t\t\t\tfor (i = 0; i < 5; i++)\n\t\t\t\t\t\tfor (j = 0; j < 5; j++)\n\t\t\t\t\t\t\tif (has_card[i, j])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tn = ((num_mask & (1 << i)) != 0) ? i : 5;\n\t\t\t\t\t\t\t\tk = ((color_mask & (1 << j)) != 0) ? j : 5;\n\t\t\t\t\t\t\t\thints[n, k]++;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\tok = true;\n\t\t\t\t\tfor (i = 0; i < 6; i++)\n\t\t\t\t\t\tfor (j = 0; j < 6; j++)\n\t\t\t\t\t\t\tok &= (hints[i, j] <= 1);\n\n\t\t\t\t\tif (ok)\n\t\t\t\t\t{\n\t\t\t\t\t\tn = count_bit(num_mask) + count_bit(color_mask);\n\t\t\t\t\t\tans = Math.Min(ans, n);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txoi.o.WriteLine(ans);\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF443C()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Borya_and_Hanabi\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = int.Parse(reader.ReadLine());\n string[] ss = reader.ReadLine().Split(' ');\n\n var nn = new int[5,5];\n\n for (int i = 0; i < n; i++)\n {\n int n2 = ss[i][1] - '1';\n int n1 = -1;\n switch (ss[i][0])\n {\n case 'R':\n n1 = 0;\n break;\n case 'G':\n n1 = 1;\n break;\n case 'B':\n n1 = 2;\n break;\n case 'Y':\n n1 = 3;\n break;\n case 'W':\n n1 = 4;\n break;\n }\n nn[n1, n2] = 1;\n }\n\n int min = 8;\n\n for (int i = 0; i < 32; i++)\n {\n int bi = Bitcount(i);\n if (bi >= min)\n continue;\n\n for (int j = 0; j < 32; j++)\n {\n int bj = Bitcount(j);\n if (bi + bj >= min)\n continue;\n\n var mask = new int[5,5];\n\n for (int k = 0; k < 5; k++)\n {\n if ((i & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n mask[k, l] = i << 16;\n }\n }\n }\n }\n\n for (int k = 0; k < 5; k++)\n {\n if ((j & (1 << k)) != 0)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[l, k] != 0)\n {\n mask[l, k] |= j;\n }\n }\n }\n }\n\n var list = new List();\n for (int k = 0; k < 5; k++)\n {\n for (int l = 0; l < 5; l++)\n {\n if (nn[k, l] != 0)\n {\n list.Add(mask[k, l]);\n }\n }\n }\n list.Sort();\n bool f = false;\n for (int k = 1; k < list.Count; k++)\n {\n if (list[k - 1] == list[k])\n {\n f = true;\n break;\n }\n }\n if (!f)\n {\n if (bi + bj < min)\n min = bi + bj;\n }\n }\n }\n\n writer.WriteLine(min);\n writer.Flush();\n }\n\n private static int Bitcount(int n)\n {\n int count = 0;\n do\n {\n if ((n & 1) == 1)\n count++;\n n >>= 1;\n } while (n > 0);\n return count;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n// (\u3065*\u03c9*)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n bool NextPerm(int[] a)\n {\n int n = a.Length;\n int k;\n for (k = n - 2; k >= 0; k--)\n if (a[k] < a[k + 1])\n for (int l = n - 1; l >= 0; l--)\n if (a[k] < a[l])\n {\n Swap(ref a[k], ref a[l]);\n for (int i = k + 1, j = n - 1; i < j; i++, j--)\n Swap(ref a[i], ref a[j]);\n return true;\n }\n return false;\n }\n\n void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n\n public object Solve()\n {\n int n = ReadInt();\n var f = new bool[5,5];\n for (int i = 0; i < n; i++)\n {\n var t = ReadToken();\n f[\"RGBYW\".IndexOf(t[0]), t[1] - '1'] = true;\n }\n\n int min = int.MaxValue;\n int nmin = -1;\n for (int i = 0; i < 5; i++)\n {\n int c = 0;\n for (int j = 0; j < 5; j++)\n if (f[i, j])\n c++;\n if (c > 0)\n {\n min = Math.Min(min, c);\n nmin = i;\n }\n }\n var list1 = new List();\n for (int i = 0; i < 5; i++)\n {\n int c = 0;\n for (int j = 0; j < 5; j++)\n if (f[i, j])\n c++;\n if (c > 0 && i != nmin)\n list1.Add(i);\n }\n min = int.MaxValue;\n nmin = -1;\n for (int i = 0; i < 5; i++)\n {\n int c = 0;\n for (int j = 0; j < 5; j++)\n if (f[j, i])\n c++;\n if (c > 0)\n {\n min = Math.Min(min, c);\n nmin = i;\n }\n }\n var list2 = new List();\n for (int i = 0; i < 5; i++)\n {\n int c = 0;\n for (int j = 0; j < 5; j++)\n if (f[j, i])\n c++;\n if (c > 0 && i != nmin)\n list2.Add(i + 5);\n }\n\n var perm = list1.Concat(list2).ToArray();\n\n int ans = int.MaxValue;\n do\n {\n\n var t1 = new int[5,5];\n var t2 = new int[5,5];\n int ri = 1;\n int ci = 1;\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n if (f[i, j])\n t1[i, j] = t2[i, j] = 1;\n\n int c = 0;\n int p = 0;\n while (!Check(t1, t2))\n {\n if (perm[p] < 5)\n {\n ri++;\n for (int i = 0; i < 5; i++)\n if (t1[perm[p], i] > 0)\n t1[perm[p], i] = ri;\n }\n else\n {\n ci++;\n for (int i = 0; i < 5; i++)\n if (t2[i, perm[p] - 5] > 0)\n t2[i, perm[p] - 5] = ci; \n }\n c++;\n p++;\n }\n\n ans = Math.Min(c, ans);\n } while (NextPerm(perm));\n\n return ans;\n }\n\n bool Check(int[,] t1, int[,] t2)\n {\n var set = new HashSet();\n int c = 0;\n for (int i = 0; i < 5; i++)\n for (int j = 0; j < 5; j++)\n if (t1[i, j] > 0)\n {\n set.Add(10 * t1[i, j] + t2[i, j]);\n c++;\n }\n return set.Count == c;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\npublic class Test\n{\n [Flags]\n enum Card\n {\n R = 1 << 0,\n G = 1 << 1,\n B = 1 << 2,\n Y = 1 << 3,\n W = 1 << 4,\n One = 1 << 5,\n Two = 1 << 6,\n Three = 1 << 7,\n Four = 1 << 8,\n Five = 1 << 9,\n }\n \n public static void Main()\n {\n int result = Solve();\n Console.WriteLine(result);\n }\n \n static int Solve()\n {\n \n // Don't care for n\n Console.ReadLine();\n \n var input = Console.ReadLine().Split(' ').Select(x => ParseCard(x)).ToArray();\n if (input.Length == 1)\n {\n return 0;\n }\n List diffs = new List(input.Length * input.Length);\n for(int i = 0; i < input.Length - 1; i++)\n {\n for(int j = i + 1; j < input.Length; j++)\n {\n Card diff = Diff(input[i], input[j]);\n diffs.Add(diff);\n }\n }\n \n var subsets = Enumerable.Range(0, 1023).Select(x => (Card)x);\n int min = 11;\n foreach(var subset in subsets)\n {\n if(diffs.All(x => CanDistinguish(subset, x)))\n {\n // This is an answer\n min = Math.Min(min, CountBits((int)subset));\n }\n }\n \n return min;\n }\n \n static int CountBits(int num)\n {\n int res = 0;\n while(num > 0)\n {\n if ((num & 1) == 1) res++;\n num >>= 1;\n }\n return res;\n }\n \n static bool CanDistinguish(Card subset, Card diff)\n {\n return (subset & diff) != 0;\n }\n \n static Card Diff(Card f, Card s)\n {\n return f ^ s;\n }\n \n static Card ParseCard(string input)\n {\n Card colour = (Card)Enum.Parse(typeof(Card), input[0].ToString());\n Card num = Card.One;\n switch (input[1])\n {\n case '1': num = Card.One;break;\n case '2': num = Card.Two;break;\n case '3': num = Card.Three;break;\n case '4': num = Card.Four;break;\n case '5': num = Card.Five;break;\n }\n return colour | num;\n }\n}"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF443D\n\t{\n\t\tint N, M, K;\n\t\tint[] Num_Cnt, Color_Cnt, Num_Map, Color_Map;\n\t\tbool[,] Has_Card;\n\n\t\tint[] count_bit(int n)\n\t\t{\n\t\t\tint i = 0;\n\t\t\tList num = new List();\n\t\t\t\n\t\t\twhile (n != 0)\n\t\t\t{\n\t\t\t\tif ((n & 0x1) == 0x1)\n\t\t\t\t\tnum.Add(i);\n\t\t\t\tn >>= 1;\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn num.ToArray();\n\t\t}\n\n\t\tint try_guess(int num_mask, int color_mask)\n\t\t{\n\t\t\tint i, j, tot;\n\t\t\tbool new_move;\n\t\t\tint[] num_cnt, color_cnt, Num, Color;\n\t\t\tbool[] num_show, color_show;\n\t\t\tbool[,] has_card;\n\n\t\t\tnum_cnt = new int[5];\n\t\t\tcolor_cnt = new int[5];\n\t\t\tnum_show = new bool[5];\n\t\t\tcolor_show = new bool[5];\n\t\t\thas_card = new bool[5, 5];\n\n\t\t\tArray.Copy(Has_Card, has_card, Has_Card.Length);\n\t\t\tArray.Copy(Num_Cnt, num_cnt, Num_Cnt.Length);\n\t\t\tArray.Copy(Color_Cnt, color_cnt, Color_Cnt.Length);\n\t\t\tNum = count_bit(num_mask);\n\t\t\tColor = count_bit(color_mask);\n\n\t\t\tif (Num.Length == M - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < M; i++)\n\t\t\t\t\tnum_show[Num_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Num)\n\t\t\t\t\tnum_show[Num_Map[m]] = true;\n\t\t\t}\n\n\t\t\tif (Color.Length == K - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < K; i++)\n\t\t\t\t\tcolor_show[Color_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Color)\n\t\t\t\t\tcolor_show[Color_Map[m]] = true;\n\t\t\t}\n\n\t\t\ttot = N;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tnew_move = false;\n\t\t\t\tfor (i = 0; i < 5; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (j = 0; j < 5; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!has_card[i, j]) continue;\n\n\t\t\t\t\t\tif ((num_show[i] && color_show[j]) || (num_show[i] && num_cnt[i] == 1) ||\n\t\t\t\t\t\t\t(color_show[j] && color_cnt[j] == 1) || tot == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thas_card[i, j] = false;\n\t\t\t\t\t\t\tnum_cnt[i]--;\n\t\t\t\t\t\t\tcolor_cnt[j]--;\n\t\t\t\t\t\t\ttot--;\n\t\t\t\t\t\t\tnew_move = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (new_move);\n\n\t\t\treturn (tot == 0 ? Num.Length + Color.Length : Int32.MaxValue);\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint i, j, n, k;\n\t\t\tHashSet c = new HashSet();\n\n\t\t\tHas_Card = new bool[5, 5];\n\t\t\tNum_Cnt = new int[5];\n\t\t\tColor_Cnt = new int[5];\n\t\t\tNum_Map = new int[5];\n\t\t\tColor_Map = new int[5];\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tc.Add(xoi.ReadString());\n\n\t\t\tN = c.Count;\n\t\t\tforeach (string s in c)\n\t\t\t{\n\t\t\t\tswitch (s[0])\n\t\t\t\t{\n\t\t\t\t\tcase 'R': k = 0; break;\n\t\t\t\t\tcase 'G': k = 1; break;\n\t\t\t\t\tcase 'B': k = 2; break;\n\t\t\t\t\tcase 'Y': k = 3; break;\n\t\t\t\t\tdefault: k = 4; break;\n\t\t\t\t}\n\t\t\t\tn = s[1] - '1';\n\t\t\t\tHas_Card[n, k] = true;\n\t\t\t\tNum_Cnt[n]++;\n\t\t\t\tColor_Cnt[k]++;\n\t\t\t}\n\n\t\t\tfor (i = M = K = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tif (Num_Cnt[i] > 0) Num_Map[M++] = i;\n\t\t\t\tif (Color_Cnt[i] > 0) Color_Map[K++] = i;\n\t\t\t}\n\n\t\t\tint ans = Int32.MaxValue;\n\t\t\tfor (i = 0; i < (1 << (M - 1)); i++)\n\t\t\t\tfor (j = 0; j < (1 << (K - 1)); j++)\n\t\t\t\t\tans = Math.Min(ans, try_guess(i, j));\n\n\t\t\txoi.o.WriteLine(ans);\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF443D()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeff// Submitted by Silithus @ Macau\nusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing CCF_XOI;\n\nnamespace CodeForces\n{\n\tclass CF443D\n\t{\n\t\tint N, M, K;\n\t\tint[] Num_Cnt, Color_Cnt, Num_Map, Color_Map;\n\t\tbool[,] Has_Card;\n\n\t\tint[] count_bit(int n)\n\t\t{\n\t\t\tint i = 0;\n\t\t\tList num = new List();\n\t\t\t\n\t\t\twhile (n != 0)\n\t\t\t{\n\t\t\t\tif ((n & 0x1) == 0x1)\n\t\t\t\t\tnum.Add(i);\n\t\t\t\tn >>= 1;\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn num.ToArray();\n\t\t}\n\n\t\tint try_guess(int num_mask, int color_mask)\n\t\t{\n\t\t\tint i, j, tot;\n\t\t\tbool new_move;\n\t\t\tint[] num_cnt, color_cnt, Num, Color;\n\t\t\tbool[] num_show, color_show;\n\t\t\tbool[,] has_card;\n\n\t\t\tnum_cnt = new int[5];\n\t\t\tcolor_cnt = new int[5];\n\t\t\tnum_show = new bool[5];\n\t\t\tcolor_show = new bool[5];\n\t\t\thas_card = new bool[5, 5];\n\n\t\t\tArray.Copy(Has_Card, has_card, Has_Card.Length);\n\t\t\tArray.Copy(Num_Cnt, num_cnt, Num_Cnt.Length);\n\t\t\tArray.Copy(Color_Cnt, color_cnt, Color_Cnt.Length);\n\t\t\tNum = count_bit(num_mask);\n\t\t\tColor = count_bit(color_mask);\n\n\t\t\tif (Num.Length == M - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < M; i++)\n\t\t\t\t\tnum_show[Num_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Num)\n\t\t\t\t\tnum_show[Num_Map[m]] = true;\n\t\t\t}\n\n\t\t\tif (Color.Length == K - 1)\n\t\t\t{\n\t\t\t\tfor (i = 0; i < K; i++)\n\t\t\t\t\tcolor_show[Color_Map[i]] = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach (int m in Color)\n\t\t\t\t\tcolor_show[Color_Map[m]] = true;\n\t\t\t}\n\n\t\t\ttot = N;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tnew_move = false;\n\t\t\t\tfor (i = 0; i < 5; i++)\n\t\t\t\t{\n\t\t\t\t\tfor (j = 0; j < 5; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!has_card[i, j]) continue;\n\n\t\t\t\t\t\tif ((num_show[i] && color_show[j]) || (num_show[i] && num_cnt[i] == 1) ||\n\t\t\t\t\t\t\t(color_show[j] && color_cnt[j] == 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thas_card[i, j] = false;\n\t\t\t\t\t\t\tnum_cnt[i]--;\n\t\t\t\t\t\t\tcolor_cnt[j]--;\n\t\t\t\t\t\t\ttot--;\n\t\t\t\t\t\t\tnew_move = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} while (new_move);\n\n\t\t\tif (tot == 0)\n\t\t\t\treturn (Num.Length + Color.Length);\n\t\t\telse\n\t\t\t\treturn Int32.MaxValue;\n\t\t}\n\n\t\tpublic void Solve(XOI xoi)\n\t\t{\n\t\t\tint i, j, n, k;\n\t\t\tHashSet c = new HashSet();\n\n\t\t\tHas_Card = new bool[5, 5];\n\t\t\tNum_Cnt = new int[5];\n\t\t\tColor_Cnt = new int[5];\n\t\t\tNum_Map = new int[5];\n\t\t\tColor_Map = new int[5];\n\n\t\t\tN = xoi.ReadInt();\n\t\t\tfor (i = 0; i < N; i++)\n\t\t\t\tc.Add(xoi.ReadString());\n\n\t\t\tN = c.Count;\n\t\t\tforeach (string s in c)\n\t\t\t{\n\t\t\t\tswitch (s[0])\n\t\t\t\t{\n\t\t\t\t\tcase 'R': k = 0; break;\n\t\t\t\t\tcase 'G': k = 1; break;\n\t\t\t\t\tcase 'B': k = 2; break;\n\t\t\t\t\tcase 'Y': k = 3; break;\n\t\t\t\t\tdefault: k = 4; break;\n\t\t\t\t}\n\t\t\t\tn = s[1] - '1';\n\t\t\t\tHas_Card[n, k] = true;\n\t\t\t\tNum_Cnt[n]++;\n\t\t\t\tColor_Cnt[k]++;\n\t\t\t}\n\n\t\t\tfor (i = M = K = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tif (Num_Cnt[i] > 0) Num_Map[M++] = i;\n\t\t\t\tif (Color_Cnt[i] > 0) Color_Map[K++] = i;\n\t\t\t}\n\n\t\t\tint ans = Int32.MaxValue;\n\t\t\tfor (i = 0; i < (1 << (M - 1)); i++)\n\t\t\t\tfor (j = 0; j < (1 << (K - 1)); j++)\n\t\t\t\t\tans = Math.Min(ans, try_guess(i, j));\n\n\t\t\txoi.o.WriteLine(ans);\n\t\t}\n\t}\n\n\tclass CodeForcesMain\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\t(new CF443D()).Solve(new XOI());\n\t\t}\n\t}\n}\n\nnamespace CCF_XOI\n{\t// version 2014.06.20\n\tclass XOI\n\t{\n\t\tprotected StreamReader sr;\n\t\tpublic StreamWriter o;\n\t\tprotected Queue buf = new Queue();\n\t\tpublic bool EOF = false;\n\n\t\tpublic XOI()\n\t\t{\n\t\t\tthis.sr = new StreamReader(Console.OpenStandardInput());\n\t\t\tthis.o = new StreamWriter(Console.OpenStandardOutput());\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic XOI(string in_path, string out_path)\n\t\t{\n\t\t\tthis.sr = new StreamReader(in_path);\n\t\t\tthis.o = new StreamWriter(out_path);\n\t\t\tthis.o.AutoFlush = true;\n\t\t}\n\n\t\tpublic int ReadInt()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int32.Parse(s);\n\t\t}\n\n\t\tpublic long ReadLong()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Int64.Parse(s);\n\t\t}\n\n\t\tpublic double ReadDouble()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\tif (s == null) return -1;\n\t\t\telse return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);\n\t\t}\n\n\t\tpublic string ReadString()\n\t\t{\n\t\t\tstring s = this.GetNext();\n\t\t\treturn (s == null ? null : s);\n\t\t}\n\n\t\tpublic string ReadLine()\n\t\t{\t// I will ignore current buffer and read a new line\n\t\t\tstring s = \"\";\n\t\t\twhile (s == \"\" && !this.EOF)\n\t\t\t{\n\t\t\t\ts = sr.ReadLine();\n\t\t\t\tthis.EOF = (s == null);\n\t\t\t}\n\t\t\treturn (this.EOF ? null : s);\n\t\t}\n\n\t\tprotected string GetNext()\n\t\t{\n\t\t\tif (buf.Count == 0)\n\t\t\t{\n\t\t\t\twhile (buf.Count == 0 && !this.EOF)\n\t\t\t\t{\n\t\t\t\t\tstring s = sr.ReadLine();\n\t\t\t\t\tif (s == null)\n\t\t\t\t\t\tthis.EOF = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tforeach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))\n\t\t\t\t\t\t\tbuf.Enqueue(ss);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (this.EOF ? null : buf.Dequeue());\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Task_C\n{\n class Program\n {\n private static int CardIndex(string card)\n {\n var num = card[1] - '0';\n int color = 0;\n if (card[0] == 'R')\n color = 0;\n if (card[0] == 'G')\n color = 1;\n if (card[0] == 'B')\n color = 2;\n if (card[0] == 'Y')\n color = 3;\n if (card[0] == 'W')\n color = 4;\n\n var index = (1 << num) | (1 << (color + 5));\n return index;\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var cards = Console.ReadLine().\n Split().\n Distinct().\n Select(x => CardIndex(x)).\n ToList();\n\n var minSuggest = int.MaxValue;\n\n var maxSuggest = 1 << 10;\n for (int suggest = 0; suggest < maxSuggest; suggest++)\n {\n var distinctCard = cards.Select(x => x & suggest).Distinct().Count();\n if (distinctCard == cards.Count)\n {\n var suggestSize = SparseBitcount(suggest);\n if (suggestSize < minSuggest)\n {\n minSuggest = suggestSize;\n }\n }\n }\n\n Console.WriteLine(minSuggest);\n }\n\n static int SparseBitcount(int n)\n {\n int count = 0;\n while (n != 0)\n {\n count++;\n n &= (n - 1);\n }\n return count;\n }\n }\n}\n"}], "src_uid": "3b12863997b377b47bae43566ec1a63b"} {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n return;\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n var v2 = v - 1;\n if (v2 * (v2 + 1) / 2 >= edges)\n {\n break;\n }\n }\n\n ulong max = 0;\n if (v == vertexes + 1)\n {\n max = 0;\n }\n else\n {\n max = vertexes - v;\n }\n\n\n ulong totalRequired = vertexes % 2 == 0 ? vertexes / 2 : (vertexes / 2) + 1;\n ulong min = 0;\n\n if (totalRequired <= edges)\n {\n min = 0;\n }\n else\n {\n var missing = (totalRequired - edges);\n if (vertexes % 2 == 0)\n {\n min = missing * 2;\n }\n else\n {\n min = ((missing - 1) * 2) + 1;\n }\n }\n\n Console.WriteLine($\"{min} {max}\");\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\nclass Program\n{\n public void Run()\n {\n var Elems = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n long n = Elems[0];\n long m = Elems[1];\n long max = 0;\n long count = 0;\n long counter = 0;\n if (m == 0) Console.WriteLine(\"{0} {1}\", n, n);\n else\n {\n while (true)\n {\n count++;\n if (m <= counter)\n {\n max = count;\n break;\n }\n counter += count;\n }\n Console.WriteLine(\"{0} {1}\", Math.Max(0, n - m * 2), n - max);\n }\n /*var Elems = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = Elems[0];\n int k = Elems[1];\n var heights = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int max = heights.Max();\n int[] h = new int[max + 2];\n for (int i = 0; i k)\n {\n s ++;\n tmp = 0;\n break;\n }\n j--;\n }\n Console.WriteLine(s);*/\n\n\n }\n \n\n\n\n\nstatic void Main()\n {\n new Program().Run();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tlong N = long.Parse(str[0]);\n\t\tlong M = long.Parse(str[1]);\n\t\tlong min = Math.Max(0,N - M*2);\n\t\tlong max = N;\n\t\tif(M >= 1){\n\t\t\tlong ct = 0;\n\t\t\tlong i = 0;\n\t\t\twhile(ct < M){\n\t\t\t\ti += 1;\n\t\t\t\tct += i;\n\t\t\t}\n\t\t\tmax = Math.Max(0,max-i-1);\n\t\t}\n\t\tConsole.WriteLine(min+\" \"+max);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\n\nclass Solver\n{\n public Scanner sc;\n public void Solve()\n {\n long N, M;\n sc.Make(out N, out M);\n var min = Max(0, N - 2 * M);\n int i;var now = 0L;\n if (M == 0) Fail($\"{min} {N}\");\n for (i = 0; i < N; i++)\n {\n now += i;\n if (now >= M) break;\n }\n Console.WriteLine($\"{min} {N-i-1}\");\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver() { sc = new Scanner() };\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n sol.Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Out(this IList A, out T a) => a = A[0];\n public static void Out(this IList A, out T a, out T b) { a = A[0]; b = A[1]; }\n public static void Out(this IList A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }\n public static void Out(this IList A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }\n public static string Concat(this IEnumerable A, string sp) => string.Join(sp, A);\n public static char ToChar(this int s, char begin = '0') => (char)(s + begin);\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\n\n#endregion"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Vasya_and_Isolated_Vertices\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n Solve();\n writer.Flush();\n }\n\n private static void Solve()\n {\n long n = Next();\n long m = Next();\n\n writer.Write(Math.Max(0, n - 2*m));\n writer.Write(' ');\n\n for (var i = (long) Math.Sqrt(2*m);; i++)\n {\n if (i*(i - 1)/2 >= m)\n {\n writer.WriteLine(n - i);\n break;\n }\n }\n }\n\n private static long Next()\n {\n int c;\n long res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (m == 0) Console.WriteLine(n + \" \" + n);\n else Console.WriteLine(Math.Max(0, n - (m * 2)) + \" \" + Math.Max(0, n - F(n, m)));\n }\n\n static int F(long r, long m)\n {\n long tp = 0;\n long s = 0;\n for (int i = 1; i <= r + 1; i++)\n {\n s += tp++;\n if (s >= m) return i;\n }\n return 0;\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace ed52b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadLongArray();\n var n = d[0];\n var m = d[1];\n\n var min = Math.Max(0, n - (m * 2));\n \n var l = 0L;\n var r = n;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var mid = l + (r - l + 1) / 2;\n var rem = n - mid;\n var maxE = rem * (rem - 1) / 2;\n if (m <= maxE)\n {\n l = mid;\n }\n else\n {\n r = mid - 1;\n }\n }\n\n Console.WriteLine(\"{0} {1}\", min, l);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n min = Math.Max(0, min);\n\n long max = 0;\n long node = 1;\n\n if (array[1] == 0)\n {\n max = array[0];\n }\n else\n {\n\n for (node = 1; node <= array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n node = Math.Min(array[0], node);\n max = array[0] - node;\n }\n\n //max = Math.Max(0, max);\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tConsole.WriteLine(\"{0} {1}\", MinV(), MaxV());\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\tlong MinV(){\n\t\treturn Math.Max(N - 2 * M, 0);\n\t}\n\t\n\tlong MaxV(){\n\t\tfor(int i=(int)N;i>=0;i--){\n\t\t\tvar rest = N - i;\n\t\t\tvar mm = rest * (rest - 1) / 2;\n\t\t\tif(mm >= M) return (long) i;\n\t\t}\n\t\treturn 0;\n\t}\n\t\n\t\n\t\n\tlong N,M;\n\tpublic Sol(){\n\t\tvar d = rla();\n\t\tN = d[0]; M = d[1];\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n long n = long.Parse(str[0]), m = long.Parse(str[1]), a = 0, b = 0;\n a = Math.Max(n - m * 2, 0);\n if(n == 1) b = a;\n else if(m == 1) b = n - 2;\n else if(m == 0) b = a;\n else\n {\n for(long i = 2; i < n; i++)\n {\n if(m > (i * (i - 1)) / 2 && m <= ((i + 1) * i) / 2)\n {\n b = n - (i + 1);\n break;\n }\n }\n }\n Console.WriteLine(a + \" \" + b);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"4 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var arr = Console.ReadLine().Split().Select(ulong.Parse).ToArray();\n var n = arr[0];\n var m = arr[1];\n\n if (m == 0) {\n System.Console.WriteLine(\"{0} {1}\", n, n);\n return;\n }\n if (n == 1) {\n System.Console.WriteLine(\"{0} {1}\", n, n);\n return;\n }\n\n var min = n <= 2ul * m ? 0ul : (n - 2ul * m);\n var max = n;\n\n for (var x = 1ul; x <= n; x++) {\n if ((x % 2ul == 0 && (x / 2ul * (x - 1ul)) >= m)\n || (x % 2ul == 1 && ((x - 1ul) / 2ul * x) >= m)) {\n max = n - x;\n break;\n }\n }\n\n System.Console.WriteLine(\"{0} {1}\", min, max);\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing static System.Console;\nusing static System.Math;\n\npublic class Hello{\n public static void Main(){\n string[] input = ReadLine().Split(' ');\n int tyouten = int.Parse(input[0]);\n long hen = long.Parse(input[1]);\n \n if(tyouten == 1){\n WriteLine(\"1 1\");\n }else if(hen == 0){\n WriteLine(\"{0} {1}\",tyouten,tyouten);\n }else{\n \n //min\n int tyoutemp = (tyouten+1)/2;\n int oe = tyouten%2;\n long tempmin = (tyoutemp - hen)*2-oe;\n long min = Max(tempmin,0);\n \n //Max\n long check = 0;\n for(long i=2;i<=tyouten;i++){\n long saidai = (i*(i-1))/2; //\u9802\u70b9i\u500b\u306b\u5bfe\u3057\u3066\u4f7f\u3048\u308b\u8fba\u306e\u6700\u5927\u5024\n if(saidai >= hen){\n check = i;\n break;\n// WriteLine(saidai);\n }\n }\n long max = tyouten - check;\n WriteLine(\"{0} {1}\",min,max);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp97\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] first = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();\n long n = first[0];\n long k = first[1];\n\n if( n == 1)\n {\n Console.WriteLine(\"1 1\");\n }\n else\n {\n if( k == 0)\n Console.WriteLine( n + \" \" + n);\n else\n {\n long min = n - k * 2;\n if (min < 0)\n min = 0;\n long count = 1;\n long index = 1;\n while( k > 0)\n {\n // \u0434\u0435\u043b\u0430\u0435\u043c \u0446\u0438\u043a\u043b\u044b. \n if (k - count >= 0)\n {\n k -= count;\n index++;\n count++;\n }\n else\n break;\n }\n // \u0440\u0435\u0431\u0440\u043e 1, \u0441\u043c\u0435\u0436\u043d\u0430\u044f \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u043e\u0434\u043d\u0430\n //2 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0432 \u0446\u0438\u043a\u043b\u0435 + 1 \u0440\u0435\u0431\u0440\u043e \u0435\u0449\u0435 \n if (k > 0)\n index++;\n long max = n - index;\n Console.WriteLine(min + \" \" + max);\n }\n\n\n }\n\n int aaa = 5;\n //1 2 9\n //10 1 1\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ProblemWatermelon\n{\n class Program\n {\n static void Main(string[] args)\n {\n long[] inputs = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();\n long vertices = inputs[0];\n long edges = inputs[1];\n\n long min = vertices - edges * 2;\n //if (vertices % 2 != 0)\n // min++;\n\n\n if (min < 0)\n min = 0;\n\n long max = vertices;\n if (edges > 0)\n {\n double sqrtpart = 1 - (4 * -edges * 2);\n max = vertices - (long)(Math.Ceiling((1 + Math.Sqrt(sqrtpart)) / 2));\n }\n\n if (max < 0)\n max = 0;\n \n Console.WriteLine(min + \" \" + max);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n class T\n {\n public int X;\n public int Y;\n\n public T(int x, int y)\n {\n X = x;\n Y = y;\n }\n }\n //////////////////////////////////////////////////\n\n long tutu(long n, long m)\n {\n for (long i = n; i > 0; i--)\n {\n if (i * (i - 1) < 2 * m)\n {\n return i;\n }\n }\n return 0;\n }\n\n //////////////////////////////////////////////////\n void Solution()\n {\n var n = rl;\n var m = rl;\n\n if (m == 0)\n {\n wsp(n);\n wln(n);\n return;\n }\n\n long min = 0;\n\n if (n > 2 * m)\n {\n min = n - 2 * m;\n }\n\n\n long z = tutu(n, m);\n m = m - z * (z - 1) / 2;\n n = n - z-1;\n\n\n wsp(min);\n wln(n);\n\n }\n //////////////////////////////////////////////////\n\n struct P : IComparable

\n {\n public long X;\n public long Y;\n\n public P(long x, long y)\n {\n X = x;\n Y = y;\n }\n\n public int CompareTo(P other) => X != other.X ? X.CompareTo(other.X) : Y.CompareTo(other.Y);\n public static int Comparison(P p1, P p2) => p1.CompareTo(p2);\n\n public static bool operator ==(P p1, P p2) => (p1.X == p2.X) && (p1.Y == p2.Y);\n public static bool operator !=(P p1, P p2) => (p1.X != p2.X) || (p1.Y != p2.Y);\n\n public static P operator +(P p1, P p2) => new P(p1.X + p2.X, p1.Y + p2.Y);\n public static P operator -(P p1, P p2) => new P(p1.X - p2.X, p1.Y - p2.Y);\n }\n\n void swap(ref T o1, ref T o2) { var o = o1; o1 = o2; o2 = o; }\n long gcd(long a, long b) => (b != 0) ? gcd(b, a % b) : a;\n long lcm(long a, long b) => a / gcd(a, b) * b;\n\n long rast2(long x1, long y1, long x2, long y2) => (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n long rast2(P p1, P p2) => (p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y);\n long ccw(P p1, P p2, P p3) => p1.X * p2.Y + p1.Y * p3.X + p2.X * p3.Y - p2.Y * p3.X - p3.Y * p1.X - p1.Y * p2.X;\n\n StringBuilder _sb = new StringBuilder();\n void wln() { _sb.AppendLine(); }\n void wln(T o) { _sb.AppendLine(o.ToString()); }\n void wsp(T o) { _sb.Append(o).Append(\" \"); }\n void wrt(T o) { _sb.Append(o); }\n void wln(double o) { _sb.AppendLine(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o)); }\n void wsp(double o) { _sb.Append(string.Format(CultureInfo.InvariantCulture, \"{0:F12} \", o)); }\n void wrt(double o) { _sb.Append(string.Format(CultureInfo.InvariantCulture, \"{0:F12}\", o)); }\n\n List

rpa(int n)\n {\n var res = new List

(n);\n for (int i = 0; i < n; i++)\n res.Add(new P(rl, rl));\n return res;\n }\n\n int ri\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n int p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n long rl\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind;\n int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0;\n while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;\n }\n }\n double rd\n {\n get\n {\n _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }\n long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';\n if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;\n }\n }\n string rs\n {\n get\n {\n _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;\n var tmp = _str.IndexOf(' ', _ind);\n if (tmp == -1) { var res = _str.Substring(_ind); _count = 0; _ind = 0; return res; }\n var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;\n while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;\n }\n }\n\n List ria(int n)\n {\n var res = new int[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rla(int n)\n {\n var res = new long[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rda(int n)\n {\n var res = new double[n];\n for (int k = 0; k < n;)\n {\n var s = Console.ReadLine(); var m = s.Length;\n for (int i = 0; i < m && k < n; ++i)\n {\n while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }\n long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';\n if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }\n res[k++] = (double)p / q * sign;\n }\n }\n _count = 0; _ind = 0; return res.ToList();\n }\n List rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res.ToList(); }\n string _str = null; int _count = 0; int _ind = 0;\n void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }\n static void Main(string[] args) { new Program().Main(); }\n void Main()\n {\n //Console.SetIn(new StreamReader(\"input.txt\")); Console.SetOut(new StreamWriter(\"output.txt\"));\n Solution();\n Console.Write(_sb);\n //Console.In.Close(); Console.Out.Close();\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace B\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] stringArray = Console.ReadLine().Split();\n long n = Int64.Parse(stringArray[0]);\n long m = Int64.Parse(stringArray[1]);\n long min = Math.Max(n - m * 2, 0);\n long k = (long)Math.Sqrt(2 * m);\n\n while (k * (k - 1) / 2 < m)\n k++;\n\n long max = n - k;\n\n Console.WriteLine($\"{min} {max}\");\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n class _1065B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n long m = long.Parse(tokens[1]);\n\n long min = Math.Max(0, n - 2 * m);\n long max = n - Enumerable.Range(0, n + 1).First(i => (long)i * (i - 1) / 2 >= m);\n\n Console.WriteLine($\"{min} {max}\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing CompLib.Util;\n\npublic class Program\n{\n private int N;\n private long M;\n\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextInt();\n M = sc.NextLong();\n\n /*\n * N\u9802\u70b9M\u8fba\n *\n * \u5b64\u7acb\u9802\u70b9\u6700\u5927\u6570\u3001\u6700\u5c0f\u6570\n */\n\n\n long min, max;\n // \u6700\u5c0f\n if (M == 0)\n {\n min = N;\n }\n else\n {\n min = Math.Max(0, N - 2 * M);\n }\n\n if (M == 0)\n {\n max = N;\n }\n else\n {\n long tmp = M;\n max = N;\n\n for (long i = 2; i <= N; i++)\n {\n // i\u9802\u70b9\u5b8c\u5168\u30b0\u30e9\u30d5\n long e = (i - 1) * i / 2;\n if (tmp <= e)\n {\n max -= i;\n break;\n }\n }\n }\n\n Console.WriteLine($\"{min} {max}\");\n }\n\n public static void Main(string[] args) => new Program().Solve();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace IsolatedVertices {\n class IoslatedVertices {\n static void Main( string[] args ) { \n var input = Console.ReadLine().Split(new string[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\n var n = Int64.Parse( input[ 0 ] );\n var m = Int64.Parse( input[ 1 ] );\n\n var minimum = Math.Max( n - ( 2 * m ), 0 );\n var maximum = (Int64) 0;\n if( m == 0 ) { maximum = n; } else if( m == 1 ) {\n maximum = n - 2;\n } else {\n\n var tableStart = (Int64) Math.Floor( Math.Sqrt( 2 * m ) );\n\n Int64 entry = 0;\n Int64 k = tableStart;\n while( entry < m ) {\n entry = ( k * ( k - 1 ) ) / 2;\n k++;\n };\n\n maximum = Math.Max( n - (k - 1), 0 );\n }\n\n Console.WriteLine( minimum + \" \" + maximum );\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar nm = Console.ReadLine().Split().Select(long.Parse).ToList();\n\t\t\tlong min = nm[0], max = nm[0];\n\t\t\tlong rem = nm[1], cur = 0;\t\n\t\t\tif (nm[1] != 0)\n\t\t\t{\n\t\t\t\tmin = nm[0] - nm[1] * 2;\n\n\t\t\t\twhile(rem > 0)\n\t\t\t\t{\n\t\t\t\t\tvar d = Math.Min(cur, rem);\n\t\t\t\t\tcur++;\n\t\t\t\t\trem -= d;\n\t\t\t\t}\n\t\t\t\tif(cur != 1) max = nm[0] - cur;\n\t\t\t}\n\t\t\tConsole.WriteLine($\"{Math.Max(min, 0)} {Math.Max(max, 0)}\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace G6\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, m;\n string[] sins = Console.ReadLine().Trim(' ').Split(' ');\n n = long.Parse(sins[0]);\n m = long.Parse(sins[1]);\n\n if (n != 1)\n {\n if (m != 0)\n {\n long summ = 1;\n long answerMax = n - 2;\n for (int i = 2; i <= n; i++)\n {\n if (summ < m)\n {\n answerMax--;\n }\n else\n {\n break;\n }\n summ += i;\n }\n\n long AnswerMin = 0;\n if (n % 2 == 0)\n {\n if (m < n / 2)\n AnswerMin = n - m * 2;\n }\n else\n {\n if (m < (n + 1) / 2)\n AnswerMin = n - m * 2;\n }\n Console.Write(AnswerMin + \" \" + answerMax);\n }\n else\n {\n Console.Write(n + \" \" + n);\n }\n }\n else\n {\n Console.Write(\"1 1\");\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.IO;\n\nnamespace Codeforces\n{\n public class Program\n {\n public static void Main()\n {\n var input = Console.ReadLine().Split();\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n long min = n-2*m;\n Console.WriteLine(Math.Max(0, min));\n \n long set = 1;\n long edges = m;\n while (edges > 0)\n {\n edges -= Math.Min(set, edges);\n set++;\n }\n Console.WriteLine(set == 1 ? n : n - set);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1065B\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n long n = long.Parse(tokens[0]);\n long m = long.Parse(tokens[1]);\n\n long min = Math.Max(0, n - 2 * m);\n long max = n - (long)Math.Floor(Math.Sqrt(2 * m) + 1);\n\n Console.WriteLine($\"{min} {max}\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace G6\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, m;\n string[] sins = Console.ReadLine().Trim(' ').Split(' ');\n n = long.Parse(sins[0]);\n m = long.Parse(sins[1]);\n\n if (n != 1)\n {\n if (m != 0)\n {\n long summ = 1;\n long answerMax = n - 2;\n for (int i = 2; i <= n; i++)\n {\n if (summ < m)\n answerMax--;\n else\n break;\n summ += i;\n }\n\n long AnswerMin = n - m * 2;\n Console.Write(AnswerMin + \" \" + answerMax);\n }\n else\n Console.Write(n + \" \" + n);\n }\n else\n Console.Write(\"1 1\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\nnamespace G6\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, m;\n string[] sins = Console.ReadLine().Trim(' ').Split(' ');\n n = long.Parse(sins[0]);\n m = long.Parse(sins[1]);\n\n if (n != 1)\n {\n if (m != 0)\n {\n long summ = 1;\n long answerMax = n-2;\n for (int i = 2; i <= n; i++)\n {\n if (summ < m)\n {\n answerMax--;\n }\n else\n {\n break;\n }\n summ += i;\n }\n\n long AnswerMin = 0;\n if (n % 2 == 0)\n {\n if (m < n / 2)\n AnswerMin = n - m*2;\n }\n else\n {\n if (m < (n+1) / 2)\n AnswerMin = n - m*2;\n }\n Console.Write(AnswerMin + \" \" + answerMax);\n }\n else\n {\n Console.Write(n + \" \" + n);\n }\n }\n else\n {\n Console.Write(\"0 0\");\n }\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRounds\n{\n class A\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n if (m == 0)\n {\n Console.WriteLine(n + \" \" + n);\n return;\n }\n var first = (n - 2 * m);\n var second = n - m - 1;\n Console.Write(first < 0 ? 0 : first);\n Console.Write(\" \");\n Console.WriteLine(second < 0 ? 0 : second);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRounds\n{\n class A\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n if (m == 0)\n {\n Console.WriteLine(n + \" \" + n);\n return;\n }\n var first = (n - 2 * m);\n var second = n - Math.Max(m, n-1);\n Console.Write(first < 0 ? 0 : first);\n Console.Write(\" \");\n Console.WriteLine(second < 0 ? 0 : second);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRounds\n{\n class A\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n if (m == 0)\n {\n Console.WriteLine(n + \" \" + n);\n return;\n }\n Console.Write((n - 2 * m) + \" \");\n Console.WriteLine(n - m - 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.IO;\n\nnamespace Codeforces\n{\n public class Program\n {\n public static void Main()\n {\n var input = Console.ReadLine().Split();\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n long min = n-2*m;\n Console.WriteLine(Math.Max(0, min));\n \n long set = 1;\n long edges = n;\n while (edges > 0)\n {\n edges -= Math.Min(set, edges);\n set++;\n }\n Console.WriteLine(set == 1 ? n : n - set);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.IO;\n\nnamespace Codeforces\n{\n public class Program\n {\n public static void Main()\n {\n var input = Console.ReadLine().Split();\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n long min = n-2*m;\n Console.WriteLine(Math.Max(0, min));\n \n long set = 1;\n long edges = n;\n while (edges > 0)\n {\n set++;\n edges -= Math.Min(set, edges);\n }\n Console.WriteLine(set == 1 ? n : n - set);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.IO;\n\nnamespace Codeforces\n{\n public class Program\n {\n public static void Main()\n {\n var input = Console.ReadLine().Split();\n int n = int.Parse(input[0]), m = int.Parse(input[1]);\n var min = n-2*m;\n Console.WriteLine(Math.Max(0, min));\n \n var set = 1;\n var edges = 0;\n for (int i = 0; i < m; i++)\n {\n if (set*(set-1)/2 < edges)\n {\n set++;\n }\n edges++;\n }\n Console.WriteLine(set == 1 ? n : n - set);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeforcesRounds\n{\n class A\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n long n = long.Parse(input[0]), m = long.Parse(input[1]);\n Console.Write((n - 2 * m) + \" \");\n Console.WriteLine(n - m - 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Threading;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\n\nclass Solver\n{\n public Scanner sc;\n public void Solve()\n {\n long N, M;\n sc.Make(out N, out M);\n var min = Max(0, (N + 1) / 2 - M);\n int i;var now = 0L;\n if (M == 0) Fail($\"{min} {N}\");\n for (i = 0; i < N; i++)\n {\n now += i;\n if (now >= M) break;\n }\n Console.WriteLine($\"{min} {N-i-1}\");\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n var sol = new Solver() { sc = new Scanner() };\n //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();\n sol.Solve();\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static void Out(this IList A, out T a) => a = A[0];\n public static void Out(this IList A, out T a, out T b) { a = A[0]; b = A[1]; }\n public static void Out(this IList A, out T a, out T b, out T c) { A.Out(out a, out b); c = A[2]; }\n public static void Out(this IList A, out T a, out T b, out T c, out T d) { A.Out(out a, out b, out c); d = A[3]; }\n public static string Concat(this IEnumerable A, string sp) => string.Join(sp, A);\n public static char ToChar(this int s, char begin = '0') => (char)(s + begin);\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int ArgMax(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\n\n#endregion"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (m == 0) Console.WriteLine(n+\" \"+n);\n else Console.WriteLine(Math.Max(0, n - m * 2) + \" \" + Math.Max(0, n - 1 - m));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (m == 0) Console.WriteLine(n + \" \" + n);\n else Console.WriteLine(Math.Max(0, n - (m - 2)) + \" \" + Math.Max(0, n - F(m)));\n }\n\n static int F(long r)\n {\n long c = r * 2;\n for (int i = 1; i <= r + 1; i++)\n {\n if (i * (i - 1) == c) return i;\n else if (i * (i - 1) > c) return i;\n }\n return 0;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (n == 1 && m == 0) Console.WriteLine(\"1 1\");\n else Console.WriteLine(Math.Max(0, n - m * 2) + \" \" + Math.Max(0, n - 1 - m));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n\n\n Console.WriteLine(Math.Max(0, n - m * 2) + \" \" + (n - 1 - m));\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (n == 1 && m == 0) Console.WriteLine(\"1 1\");\n else Console.WriteLine(Math.Max(0, n - m * 2) + \" \" + Math.Max(0, n - 1 - (m / 2 + (m % 2))));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] S = Console.ReadLine().Split();\n long n = Convert.ToInt64(S[0]);\n long m = Convert.ToInt64(S[1]);\n if (m == 0) Console.WriteLine(n + \" \" + n);\n else Console.WriteLine(Math.Max(0, n - (m * 2)) + \" \" + Math.Max(0, n - F(n)));\n }\n\n static int F(long r)\n {\n long tp = 1;\n long s = 0;\n for (int i = 1; i <= r + 1; i++)\n {\n s += tp++;\n if (s >= r) return i;\n }\n return 0;\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace ed52b\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadLongArray();\n var n = d[0];\n var m = d[1];\n\n var min = Math.Max(0, n - (m * 2));\n \n var l = 0L;\n var r = n;\n while (true)\n {\n if (l == r)\n {\n break;\n }\n\n var mid = l + (r - l + 1) / 2;\n var rem = n - mid;\n var maxE = rem * (rem - 1) / 2;\n if (m <= maxE && m >= maxE - 1)\n {\n l = mid;\n }\n else\n {\n r = mid - 1;\n }\n }\n\n Console.WriteLine(\"{0} {1}\", min, l);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n min = Math.Max(0, min);\n\n long max = 0;\n int node = 0;\n\n for (node = 0; node < array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n max = array[0] - node;\n\n max = Math.Max(0, max);\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n min = Math.Max(0, min);\n\n long max = 0;\n int node = 1;\n\n if (array[1] == 0)\n {\n max = array[0];\n }\n else\n {\n\n for (node = 1; node <= array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n max = array[0] - node;\n }\n\n //max = Math.Max(0, max);\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n min = Math.Max(0, min);\n\n long max = 0;\n int node = 0;\n\n if (array[1] == 0)\n {\n max = array[0];\n }\n else\n {\n\n for (node = 1; node <= array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n max = array[0] - node;\n }\n\n //max = Math.Max(0, max);\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n min = Math.Max(0, min);\n\n long max = 0;\n int node = 0;\n\n for (node = 1; node <= array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n max = array[0] - node;\n\n //max = Math.Max(0, max);\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nclass testcodeforces\n{\n public static void Main()\n {\n int t = 1;\n\n for (int i = 0; i < t; i++)\n {\n var array = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n long min = array[0] - (2 * array[1]);\n\n long max = 0;\n int node = 0;\n\n for (node = 0; node < array[0]; node++)\n {\n if ((node * (node - 1) / 2) >= array[1])\n {\n break;\n }\n }\n\n max = array[0] - node;\n\n Console.WriteLine(\"\" + min + \" \" + max);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), a = 0, b = 0;\n a = n - (m * 2);\n if(m != 0) b = n - m - 1;\n else b = a;\n Console.WriteLine(a + \" \" + b);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]), a = 0, b = 0;\n a = n - (m * 2);\n b = n - m - 1;\n Console.WriteLine(a + \" \" + b);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n long n = long.Parse(str[0]), m = long.Parse(str[1]), a = 0, b = 0;\n a = Math.Max(n - m * 2, 0);\n if(n == 1) b = 0;\n else if(m == 1) b = n - 2;\n else if(m == 0) b = a;\n else\n {\n for(long i = 2; i < n; i++)\n {\n if(m > (i * (i - 1)) / 2 && m <= ((i + 1) * i) / 2)\n {\n b = n - (i + 1);\n break;\n }\n }\n }\n Console.WriteLine(a + \" \" + b);\n Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace W0lf\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n long n = long.Parse(str[0]), m = long.Parse(str[1]), a = 0, b = 0;\n a = Math.Max(n - m * 2, 0);\n if(n == 1) b = 0;\n else if(m == 1) b = n - 2;\n else\n {\n for(long i = 2; i < n; i++)\n {\n if(m > (i * (i - 1)) / 2 && m <= ((i + 1) * i) / 2)\n {\n b = n - (i + 1);\n break;\n }\n }\n }\n Console.WriteLine(a + \" \" + b);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"4 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var arr = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var n = arr[0];\n var m = arr[1];\n\n var min = Math.Max(0, n - 2 * m);\n var max = 0L;\n\n if (m > 0)\n for (var x = 1; x <= n; x++) {\n if (x * (x - 1) / 2 >= m) {\n max = n - x;\n break;\n }\n }\n\n System.Console.WriteLine(\"{0} {1}\", min, max);\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}"}, {"source_code": "/*\ncsc -debug B.cs && mono --debug B.exe <<< \"4 2\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic class HelloWorld {\n static public void Main () {\n SolveCodeForces();\n }\n\n public static void SolveCodeForces() {\n var arr = Console.ReadLine().Split().Select(long.Parse).ToArray();\n var n = arr[0];\n var m = arr[1];\n\n if (m == 0) {\n System.Console.WriteLine(\"{0} {1}\", n, n);\n return;\n }\n if (n == 1) {\n System.Console.WriteLine(\"{0} {1}\", n, n);\n return;\n }\n\n var min = Math.Max(0, n - 2 * m);\n var max = n;\n\n for (var x = 1; x <= n; x++) {\n if (x * (x - 1) / 2 >= m) {\n max = n - x;\n break;\n }\n }\n\n System.Console.WriteLine(\"{0} {1}\", min, max);\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n}"}, {"source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n string[] stringArray = Console.ReadLine().Split();\n long n = Int32.Parse(stringArray[0]);\n long m = Int32.Parse(stringArray[1]);\n long min = n - m * 2;\n long max = n - 1 - m;\n\n Console.WriteLine($\"{min} {max}\");\n }\n}"}, {"source_code": "using System;\n\nclass MainClass {\n public static void Main (string[] args) {\n string[] stringArray = Console.ReadLine().Split();\n long n = Int32.Parse(stringArray[0]);\n long m = Int32.Parse(stringArray[1]);\n long min = Math.Max(n - m * 2, 0);\n long k = (long)Math.Sqrt(2 * m);\n\n while ((k * k - 1) / 2 < m)\n k++;\n\n long max = n - k;\n\n Console.WriteLine($\"{min} {max}\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tstatic class Program\n\t{\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar nm = Console.ReadLine().Split().Select(int.Parse).ToList();\n\t\t\tint min = 0, max = 0;\n\n\t\t\tif (nm[1] != 0)\n\t\t\t{\n\t\t\t\tmin = nm[0] - nm[1] * 2;\n\t\t\t\tmax = nm[0] - 1 - nm[1];\n\t\t\t}\n\t\t\tConsole.WriteLine($\"{Math.Max(min, 0)} {Math.Max(max, 0)}\");\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing static System.Console;\nusing static System.Math;\n\npublic class Hello{\n public static void Main(){\n string[] input = ReadLine().Split(' ');\n int tyouten = int.Parse(input[0]);\n long hen = long.Parse(input[1]);\n \n if(tyouten == 1){\n WriteLine(\"1 1\");\n }else if(hen == 0){\n WriteLine(\"{0} {1}\",tyouten,tyouten);\n }else{\n \n //min\n int tyoutemp = (tyouten+1)/2;\n int oe = tyouten%2;\n long tempmin = (tyoutemp - hen)*2-oe;\n long min = Max(tempmin,0);\n Write(\"{0} \",min);\n \n //Max\n int check = 0;\n for(int i=2;i<=tyouten;i++){\n long saidai = (i*(i-1))/2; //\u9802\u70b9i\u500b\u306b\u5bfe\u3057\u3066\u4f7f\u3048\u308b\u8fba\u306e\u6700\u5927\u5024\n if(saidai >= hen){\n check = i;\n break;\n }\n }\n int max = tyouten - check;\n WriteLine(max);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp97\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] first = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n long n = first[0];\n long k = first[1];\n\n if( n == 1)\n {\n Console.WriteLine(\"1 1\");\n }\n else\n {\n if( k == 0)\n Console.WriteLine( n + \" \" + n);\n else\n {\n long min = n - k * 2;\n\n if (min < 0)\n min = 0;\n // 2 0\n long max = n - k - 1;\n Console.WriteLine(min + \" \" + max);\n\n }\n\n\n }\n\n int aaa = 5;\n //1 2 9\n //10 1 1\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n if ((v - 1) * ((v - 1) + 1) / 2 >= edges)\n {\n break;\n }\n }\n\n ulong max = vertexes - v;\n\n ulong totalRequired = vertexes % 2 == 0 ? vertexes / 2 : vertexes / 2 + 1;\n ulong min = 0;\n\n if (totalRequired <= edges)\n {\n min = 0;\n }\n else\n {\n var missing = (totalRequired - edges);\n if (vertexes % 2 == 0)\n {\n min = missing * 2;\n }\n else\n {\n min = (missing - 1) * 2 + 1;\n }\n }\n\n Console.WriteLine($\"{min} {max}\");\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n if ((v -1) * ((v -1) + 1) / 2 >= edges)\n {\n break;\n }\n }\n\n var max = vertexes - v;\n\n if (vertexes % 2 == 0)\n {\n if (edges > vertexes / 2)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else\n {\n Console.WriteLine($\"{(vertexes / 2 - edges) * 2} {max}\");\n }\n }\n else\n {\n if (edges == (vertexes / 2) + 1)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else if (edges == (vertexes / 2))\n {\n Console.WriteLine($\"1 {max}\");\n }\n else\n {\n Console.WriteLine($\"{((vertexes / 2 - edges)) * 2 + 1} {max}\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n if ((v - 1) * ((v - 1) + 1) / 2 >= edges)\n {\n break;\n }\n }\n\n ulong max = 0;\n if (v == vertexes + 1)\n {\n max = 0;\n }\n else\n {\n max = vertexes - v;\n }\n\n\n ulong totalRequired = vertexes % 2 == 0 ? vertexes / 2 : vertexes / 2 + 1;\n ulong min = 0;\n\n if (totalRequired <= edges)\n {\n min = 0;\n }\n else\n {\n var missing = (totalRequired - edges);\n if (vertexes % 2 == 0)\n {\n min = missing * 2;\n }\n else\n {\n min = (missing - 1) * 2 + 1;\n }\n }\n\n Console.WriteLine($\"{min} {max}\");\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n if (v * (v + 1) / 2 > edges)\n {\n break;\n }\n }\n\n var max = v - 1;\n\n if (vertexes % 2 == 0)\n {\n if (edges > vertexes / 2)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else\n {\n Console.WriteLine($\"{(vertexes / 2 - edges) * 2} {max}\");\n }\n }\n else\n {\n if (edges == (vertexes / 2) + 1)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else if (edges == (vertexes / 2))\n {\n Console.WriteLine($\"1 {max}\");\n }\n else\n {\n Console.WriteLine($\"{((vertexes / 2 - edges)) * 2 + 1} {max}\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var vertexes = ulong.Parse(line[0]);\n var edges = ulong.Parse(line[1]);\n\n if (edges == 0)\n {\n Console.WriteLine($\"{vertexes} {vertexes}\");\n }\n\n ulong v;\n for (v = 1; v <= vertexes; ++v)\n {\n if ((v - 1) * ((v - 1) + 1) / 2 >= edges)\n {\n break;\n }\n }\n\n var max = vertexes - v;\n\n var totalRequired = vertexes % 2 == 0 ? vertexes / 2 : vertexes / 2 + 1;\n\n var min = totalRequired <= edges ? 0 : totalRequired - edges;\n\n Console.WriteLine($\"{min} {max}\");\n }\n}"}, {"source_code": "\ufeffusing System;\n\npublic class Program\n{\n public static void Main()\n {\n var line = Console.ReadLine().Split(' ');\n var n = ulong.Parse(line[0]);\n var m = ulong.Parse(line[1]);\n\n if (m == 0)\n {\n Console.WriteLine($\"{n} {n}\");\n }\n\n ulong v;\n ulong s = 0;\n\n for (v = 0; s <= m && v <= n; ++v)\n {\n s += v;\n }\n\n var max = v >= n ? 0 : n - v;\n\n if (n % 2 == 0)\n {\n if (m > n / 2)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else\n {\n Console.WriteLine($\"{(n / 2 - m) * 2} {max}\");\n }\n }\n else\n {\n if (m == (n / 2) + 1)\n {\n Console.WriteLine($\"0 {max}\");\n }\n else if (m == (n / 2))\n {\n Console.WriteLine($\"1 {max}\");\n }\n else\n {\n Console.WriteLine($\"{((n / 2 - m)) * 2 + 1} {max}\");\n }\n }\n }\n}"}], "src_uid": "daf0dd781bf403f7c1bb668925caa64d"} {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var k = ReadLong();\n var M = ReadLong();\n var ks = ReadLongs();\n Array.Sort(ks);\n var sum = ks.Sum();\n var res = 0L;\n for (int i = 0; i <= n; i++)\n {\n if (sum * i > M)\n break;\n var left = M - sum * i;\n var curr = (k + 1) * i;\n var rows = n - i;\n if (rows > 0)\n {\n var col = 0;\n while (col < k)\n {\n if (rows * ks[col] > left)\n {\n curr += left / ks[col];\n break;\n }\n curr += rows;\n left -= rows * ks[col];\n col++;\n }\n }\n res = Math.Max(curr, res);\n }\n\n return res;\n }\n\n class Vac\n {\n public long Left { get; set; }\n public long Right { get; set; }\n public long Cost { get; set; }\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nusing CompLib.Util;\nusing System.Threading;\n\npublic class Program\n{\n public void Solve()\n {\n var sc = new Scanner();\n int n = sc.NextInt();\n int k = sc.NextInt();\n long m = sc.NextInt();\n int[] t = sc.IntArray();\n\n long sum = 0;\n foreach (var i in t)\n {\n sum += i;\n }\n\n Array.Sort(t);\n long ans = 0;\n for (int i = 0; i <= n && sum * i <= m; i++)\n {\n long score = (long) (k + 1) * i;\n long time = m - sum * i;\n\n for (int j = 0; j < k; j++)\n {\n long cnt = Math.Min(n - i, time / t[j]);\n score += cnt;\n time -= t[j] * cnt;\n }\n\n ans = Math.Max(ans, score);\n }\n\n Console.WriteLine(ans);\n }\n\n public static void Main(string[] args) => new Program().Solve();\n // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();\n}\n\nnamespace CompLib.Util\n{\n using System;\n using System.Linq;\n\n class Scanner\n {\n private string[] _line;\n private int _index;\n private const char Separator = ' ';\n\n public Scanner()\n {\n _line = new string[0];\n _index = 0;\n }\n\n public string Next()\n {\n if (_index >= _line.Length)\n {\n string s;\n do\n {\n s = Console.ReadLine();\n } while (s.Length == 0);\n\n _line = s.Split(Separator);\n _index = 0;\n }\n\n return _line[_index++];\n }\n\n public string ReadLine()\n {\n _index = _line.Length;\n return Console.ReadLine();\n }\n\n public int NextInt() => int.Parse(Next());\n public long NextLong() => long.Parse(Next());\n public double NextDouble() => double.Parse(Next());\n public decimal NextDecimal() => decimal.Parse(Next());\n public char NextChar() => Next()[0];\n public char[] NextCharArray() => Next().ToCharArray();\n\n public string[] Array()\n {\n string s = Console.ReadLine();\n _line = s.Length == 0 ? new string[0] : s.Split(Separator);\n _index = _line.Length;\n return _line;\n }\n\n public int[] IntArray() => Array().Select(int.Parse).ToArray();\n public long[] LongArray() => Array().Select(long.Parse).ToArray();\n public double[] DoubleArray() => Array().Select(double.Parse).ToArray();\n public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Diagnostics;\nusing System.Numerics;\nusing static System.Console;\nusing static System.Convert;\nusing static System.Math;\nusing static Template;\nusing Pi = Pair;\n\nclass Solver\n{\n public void Solve(Scanner sc)\n {\n int N, K;long M;\n sc.Make(out N, out K, out M);\n var T = sc.ArrInt;\n Array.Sort(T);\n var res = 0L;\n for(int i = 0; i <= N; i++)\n {\n var sum = 0L;\n for (int j = 0; j < K; j++)\n sum += i * T[j];\n if (sum > M) break;\n var rest = N - i;\n var max = i * (K+1L);\n for(int j = 0; j < K; j++)\n {\n if (rest * T[j] <= M - sum) { sum += rest * T[j];max += rest;continue; }\n max += (M - sum) / T[j];break;\n }\n chmax(ref res, max);\n }\n Console.WriteLine(res);\n }\n}\n\n#region Template\npublic static class Template\n{\n static void Main(string[] args)\n {\n Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });\n new Solver().Solve(new Scanner());\n Console.Out.Flush();\n }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmin(ref T a, T b) where T : IComparable { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(ref T a, ref T b) { var t = b; b = a; a = t; }\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public static void swap(this IList A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }\n public static T[] Create(int n, Func f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }\n public static IEnumerable Shuffle(this IEnumerable A) => A.OrderBy(v => Guid.NewGuid());\n public static int CompareTo(this T[] A, T[] B, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }\n public static int MaxElement(this IList A, Comparison cmp = null) { cmp = cmp ?? Comparer.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }\n public static T PopBack(this List A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }\n public static void Fail(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }\n}\npublic class Scanner\n{\n public string Str => Console.ReadLine().Trim();\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();\n public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();\n public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());\n public int[] ArrInt1D(int n) => Create(n, () => Int);\n public long[] ArrLong1D(int n) => Create(n, () => Long);\n public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);\n public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);\n private Queue q = new Queue();\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public T Next() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }\n public void Make(out T1 v1) => v1 = Next();\n public void Make(out T1 v1, out T2 v2) { v1 = Next(); v2 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next(); }\n public void Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next(); }\n //public (T1, T2) Make() { Make(out T1 v1, out T2 v2); return (v1, v2); }\n //public (T1, T2, T3) Make() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }\n //public (T1, T2, T3, T4) Make() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }\n}\npublic class Pair : IComparable>\n{\n public T1 v1;\n public T2 v2;\n public Pair() { }\n public Pair(T1 v1, T2 v2)\n { this.v1 = v1; this.v2 = v2; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = Comparer.Default.Compare(v1, p.v1);\n if (c == 0)\n c = Comparer.Default.Compare(v2, p.v2);\n return c;\n }\n public override string ToString() => $\"{v1.ToString()} {v2.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }\n}\n\npublic class Pair : Pair, IComparable>\n{\n public T3 v3;\n public Pair() : base() { }\n public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)\n { this.v3 = v3; }\n\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n public int CompareTo(Pair p)\n {\n var c = base.CompareTo(p);\n if (c == 0)\n c = Comparer.Default.Compare(v3, p.v3);\n return c;\n }\n public override string ToString() => $\"{base.ToString()} {v3.ToString()}\";\n public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solve{\n public Solve(){}\n StringBuilder sb;\n ReadData re;\n public static int Main(){\n new Solve().Run();\n return 0;\n }\n void Run(){\n sb = new StringBuilder();\n re = new ReadData();\n Calc();\n Console.Write(sb.ToString());\n }\n void Calc(){\n int N = re.i();\n int K = re.i();\n long M = re.i();\n long[] A = re.la();\n Array.Sort(A);\n long sum = 0;\n for(int i=0;i M){\n break;\n }\n long rest = M - i*sum;\n long c = i*(K+1);\n for(int j=0;j= A[j]){\n c++;\n rest -= A[j];\n }\n }\n }\n count = Math.Max(c,count);\n }\n sb.Append(count+\"\\n\");\n }\n}\nclass ReadData{\n string[] str;\n int counter;\n public ReadData(){\n counter = 0;\n }\n public string s(){\n if(counter == 0){\n str = Console.ReadLine().Split(' ');\n counter = str.Length;\n }\n counter--;\n return str[str.Length-counter-1];\n }\n public int i(){\n return int.Parse(s());\n }\n public long l(){\n return long.Parse(s());\n }\n public double d(){\n return double.Parse(s());\n }\n public int[] ia(int N){\n int[] ans = new int[N];\n for(int j=0;j[] g(int N,int[] f,int[] t){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(int N,int M){\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j[] g(){\n int N = i();\n int M = i();\n List[] ans = new List[N];\n for(int j=0;j();\n }\n for(int j=0;j M) break;\n\t\t\tlong sc = (K+1) * i;\n\t\t\tlong rest = M - i * T;\n\t\t\t\n\t\t\tfor(int j=0;j r * A[j]){\n\t\t\t\t\tsc += r;\n\t\t\t\t\trest -= r * A[j];\n\t\t\t\t\tif(j == K-1) sc += r;\n\t\t\t\t} else {\n\t\t\t\t\tsc += rest/A[j];\n\t\t\t\t\tif(j == K-1) sc += rest/A[j];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Console.WriteLine(\"{0} {1}\",i,sc);\n\t\t\tmax = Math.Max(max,sc);\n\t\t}\n\t\tConsole.WriteLine(max);\n\t\t\n\t}\n\tint N,K;\n\tlong M;\n\tlong[] A;\n\tpublic Sol(){\n\t\tvar d = ria();\n\t\tN = d[0]; K = d[1]; M = d[2];\n\t\tA = rla();\n\t}\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}\n\tstatic int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Math_Show\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int k = Next();\n int M = Next();\n\n var kk = new int[k];\n for (int i = 0; i < k; i++)\n {\n kk[i] = Next();\n }\n\n Array.Sort(kk);\n int kkk = kk.Sum();\n\n int ans = 0;\n for (int i = 0; i <= n; i++)\n {\n int m = i*kkk;\n if (m <= M)\n {\n int p = 0;\n if (i != n)\n {\n for (int j = 0; j < k; j++)\n {\n if ((n - i)*kk[j] + m <= M)\n {\n m += (n - i)*kk[j];\n p += (n - i);\n }\n else\n {\n p += (M - m)/kk[j];\n break;\n }\n }\n }\n\n ans = Math.Max(ans, (k + 1)*i + p);\n }\n else break;\n }\n\n\n return ans;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n if (j + 1 == k) {\n answ3++;\n }\n }\n var answ4 = answ3 + Answ1(array, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == array.Length - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == array.Length - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var k = ReadLong();\n var M = ReadLong();\n var ks = ReadLongs();\n Array.Sort(ks);\n var sum = ks.Sum();\n var res = 0L;\n for (int i = 0; i < n; i++)\n {\n if (sum * i > M)\n break;\n var left = M - sum * i;\n var curr = (k + 1) * i;\n var rows = n - i;\n var col = 0;\n while (col < k)\n {\n if (rows * ks[col] > left)\n {\n curr += left / ks[col];\n break;\n }\n curr += rows;\n left -= rows * ks[col];\n col++;\n }\n res = Math.Max(curr, res);\n }\n\n return res;\n }\n\n class Vac\n {\n public long Left { get; set; }\n public long Right { get; set; }\n public long Cost { get; set; }\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, 0, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ3++;\n }\n \n var answ4 = answ3 + Answ1(array, i + 1, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, int start, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = start; i < n; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var k = sr.NextInt64();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < n; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (!can)\n break;\n answ2++;\n }\n\n sw.WriteLine(Math.Max(answ1, answ2));\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, 0, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ3++;\n }\n \n var answ4 = answ3 + Answ1(array, i + 1, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, int start, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = start; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n if (i + 1 == n) {\n answ3++;\n }\n }\n var answ4 = answ3 + Answ1(array, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == array.Length - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == array.Length - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var k = sr.NextInt64();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < n; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n\n sw.WriteLine(Math.Max(answ1, answ2));\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n }\n else {\n can = false;\n break;\n }\n var answ4 = answ3 + Answ1(array, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n if (can) {\n answ3++;\n }\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt64();\n var k = sr.NextInt64();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < n; i++) {\n if (m1 - array[i] * n > 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] > 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (!can)\n break;\n answ2++;\n }\n\n sw.WriteLine(Math.Max(answ1, answ2));\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n using (var sr = new InputReader(Console.In))\n//\t\t\tusing (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var k = sr.NextInt32();\n var m = sr.NextInt64();\n var array = sr.ReadArrayOfInt64();\n Array.Sort(array);\n var answ1 = Answ1(array, m, n);\n var answ2 = 0L;\n var m2 = m;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m2 - array[j] >= 0) {\n m2 -= array[j];\n answ2++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ2++;\n }\n }\n var answ3 = 0L;\n var m3 = m;\n var resultAnsw = 0L;\n for (var i = 0; i < n; i++) {\n var can = true;\n for (var j = 0; j < k; j++) {\n if (m3 - array[j] >= 0) {\n m3 -= array[j];\n answ3++;\n }\n else {\n can = false;\n break;\n }\n }\n if (can) {\n answ3++;\n }\n \n var answ4 = answ3 + Answ1(array, m3, n - (i + 1));\n resultAnsw = Math.Max(resultAnsw, Math.Max(answ3, answ4));\n }\n\n sw.WriteLine(Math.Max(answ1, Math.Max(answ2, resultAnsw)));\n }\n\n private long Answ1(long[] array, long m, int n)\n {\n var answ1 = 0L;\n var m1 = m;\n for (var i = 0; i < array.Length; i++) {\n if (m1 - array[i] * n >= 0) {\n m1 -= array[i] * n;\n answ1 += n;\n if (i == n - 1) {\n answ1 += n;\n }\n }\n else {\n var d = m1 / array[i];\n m1 -= d * array[i];\n answ1 += d;\n if (i == n - 1) {\n answ1 += d;\n }\n break;\n }\n }\n\n return answ1;\n }\n\n ~Task()\n {\n Dispose(false);\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n } \n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}], "src_uid": "d659e92a410c1bc836be64fc1c0db160"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class R191MemSql_A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n\n int[] x1 = new int[n];\n int[] x2 = new int[n];\n int[] y1 = new int[n];\n int[] y2 = new int[n];\n int area = 0;\n int maxx = -1, minx = 35000, maxy = -1, miny = 35000;\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split();\n x1[i] = int.Parse(s[0]);\n y1[i] = int.Parse(s[1]);\n x2[i] = int.Parse(s[2]);\n y2[i] = int.Parse(s[3]);\n area += (x2[i] - x1[i]) * (y2[i] - y1[i]);\n maxx = Math.Max(maxx, x2[i]);\n maxy = Math.Max(maxy, y2[i]);\n minx = Math.Min(minx, x1[i]);\n miny = Math.Min(miny, y1[i]);\n }\n\n if (area == (maxx - minx) * (maxy - miny)\n && (maxx - minx) == (maxy - miny))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n }\n}\n", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace codeforces\n{\n class rect\n {\n public Tuple leftbottom;\n public Tuple righttop;\n public rect(int x1, int y1, int x2, int y2)\n {\n leftbottom = new Tuple(x1, y1);\n righttop = new Tuple(x2, y2);\n }\n }\n public class A\n {\n public static int Main()\n {\n \n int n;\n\n n = int.Parse(System.Console.ReadLine());\n List rtlist = new List();\n SortedSet xs = new SortedSet();\n SortedSet ys = new SortedSet();\n for (int i = 0; i < n; i++)\n {\n string line= System.Console.ReadLine();\n string[] ints = line.Split(new char[1]{' '});\n int[] x = new int[4];\n for (int j = 0; j < 4; j++)\n x[j] = int.Parse(ints[j]);\n rect rt = new rect(x[0], x[1], x[2], x[3]);\n xs.Add(x[0]);\n xs.Add(x[2]);\n ys.Add(x[1]);\n ys.Add(x[3]);\n rtlist.Add(rt);\n\n }\n if ((xs.Max - xs.Min) != (ys.Max - ys.Min))\n {\n System.Console.WriteLine(\"NO\");\n return 0;\n }\n Dictionary,int> dic = new Dictionary,int>();\n\n for (int i = 0; i < n; i++)\n {\n rect rt = rtlist[i];\n var valuex = xs.GetViewBetween(rt.leftbottom.Item1, rt.righttop.Item1);\n var valuey = ys.GetViewBetween(rt.leftbottom.Item2, rt.righttop.Item2);\n foreach(int x in valuex)\n {\n foreach (int y in valuey)\n {\n Tuple tu = new Tuple(x, y);\n int v = 4;\n if ((x == rt.leftbottom.Item1) || (x == rt.righttop.Item1))\n v /= 2;\n if ((y== rt.leftbottom.Item2) || (y == rt.righttop.Item2))\n v /= 2;\n if (dic.ContainsKey(tu))\n dic[tu] += v;\n else\n dic[tu] = v;\n\n }\n }\n }\n foreach(var x in dic)\n {\n var k = x.Key;\n var v = x.Value;\n if ((k.Item1 == xs.Max) || (k.Item1 == xs.Min))\n v *= 2;\n if ((k.Item2 == ys.Max) || (k.Item2 == ys.Min))\n v *= 2;\n if (v != 4)\n {\n System.Console.WriteLine(\"NO\");\n return 0;\n }\n }\n System.Console.WriteLine(\"YES\");\n return 0;\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c325_memsql_1\n{\n\tpublic class Program1\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\t\tvar rects = Enumerable.Range(0, n)\n\t\t\t\t\t.Select(i => Console.ReadLine().Split(' ').Select(long.Parse).ToArray())\n\t\t\t\t\t.ToArray();\n\n\t\t\t\tvar s = rects.Select(a => (a[2] - a[0])*(a[3] - a[1])).Sum();\n\t\t\t\tvar minX = rects.Min(a => a[0]);\n\t\t\t\tvar maxX = rects.Max(a => a[2]);\n\t\t\t\tvar minY = rects.Min(a => a[1]);\n\t\t\t\tvar maxY = rects.Max(a => a[3]);\n\n\t\t\t\tvar dx = (maxX - minX);\n\t\t\t\tvar dy = (maxY - minY);\n\t\t\t\tConsole.WriteLine(s == dx*dy && dx == dy ? \"YES\" : \"NO\");\n\t\t\t}\n\t\t}\n\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\n\nnamespace Square_and_Rectangles\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve() ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static bool Solve()\n {\n int n = Next();\n\n var nn = new Rec[n];\n var xx = new List();\n var yy = new List();\n for (int i = 0; i < n; i++)\n {\n nn[i] = new Rec(Next(), Next(), Next(), Next());\n\n xx.Add(nn[i].x1);\n xx.Add(nn[i].x2);\n\n yy.Add(nn[i].y1);\n yy.Add(nn[i].y2);\n }\n\n xx.Sort();\n yy.Sort();\n\n\n if (xx[xx.Count - 1] - xx[0] != yy[yy.Count - 1] - yy[0])\n {\n return false;\n }\n\n var x = new List {xx[0]};\n for (int i = 1; i < xx.Count; i++)\n {\n if (xx[i] != xx[i - 1])\n x.Add(xx[i]);\n }\n var y = new List {yy[0]};\n for (int i = 1; i < yy.Count; i++)\n {\n if (yy[i] != yy[i - 1])\n y.Add(yy[i]);\n }\n foreach (Rec rec in nn)\n {\n rec.x1 = x.BinarySearch(rec.x1);\n rec.x2 = x.BinarySearch(rec.x2);\n rec.y1 = y.BinarySearch(rec.y1);\n rec.y2 = y.BinarySearch(rec.y2);\n }\n\n var nm = new int[x.Count,y.Count];\n foreach (Rec rec in nn)\n {\n for (int i = rec.x1 + 1; i <= rec.x2; i++)\n {\n for (int j = rec.y1 + 1; j <= rec.y2; j++)\n {\n nm[i, j] = 1;\n }\n }\n }\n\n for (int i = 1; i < x.Count; i++)\n {\n for (int j = 1; j < y.Count; j++)\n {\n if (nm[i, j] == 0)\n return false;\n }\n }\n\n return true;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n\n #region Nested type: Rec\n\n private class Rec\n {\n public int x1;\n public int x2;\n public int y1;\n public int y2;\n\n public Rec(int x1, int y1, int x2, int y2)\n {\n this.x1 = x1;\n this.x2 = x2;\n this.y1 = y1;\n this.y2 = y2;\n }\n }\n\n #endregion\n }\n}"}, {"source_code": "\nusing System;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\nusing kp.Algo;\n\nnamespace CodeForces\n{\n\tinternal class Solution\n\t{\n\t\tconst int StackSize = 20 * 1024 * 1024;\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt();\n\t\t\tint[] x1 = new int[n], x2 = new int[n], y1 = new int[n], y2 = new int[n];\n\t\t\tlong sq = 0;\n\t\t\tint minX = int.MaxValue, maxX = int.MinValue, minY = int.MaxValue, maxY = int.MinValue;\n\t\t\tfor ( int i = 0; i < n; ++i )\n\t\t\t{\n\t\t\t\tx1[i] = NextInt();\n\t\t\t\ty1[i] = NextInt();\n\t\t\t\tx2[i] = NextInt();\n\t\t\t\ty2[i] = NextInt();\n\t\t\t\tsq += (long)( x2[i] - x1[i] ) * ( y2[i] - y1[i] );\n\t\t\t\tminX = Math.Min( minX, x1[i] );\n\t\t\t\tmaxX = Math.Max( maxX, x2[i] );\n\t\t\t\tminY = Math.Min( minY, y1[i] );\n\t\t\t\tmaxY = Math.Max( maxY, y2[i] );\n\t\t\t}\n\n\t\t\tbool res = false;\n\t\t\tif ( maxX - minX == maxY - minY )\n\t\t\t{\n\t\t\t\tif ( sq == (long)( maxX - minX ) * ( maxX - minX ) )\n\t\t\t\t{\n\t\t\t\t\tres = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tOut.WriteLine( res ? \"YES\" : \"NO\" );\n\t\t}\n\n\t\t#region Local wireup\n\n\t\tpublic int[] NextIntArray( int size )\n\t\t{\n\t\t\tvar res = new int[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextInt();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] NextLongArray( int size )\n\t\t{\n\t\t\tvar res = new long[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextLong();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] NextDoubleArray( int size )\n\t\t{\n\t\t\tvar res = new double[size];\n\t\t\tfor ( int i = 0; i < size; ++i ) res[i] = NextDouble();\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, StackSize );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew Solution().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n\t\t\tpublic Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}\n\nnamespace kp.Algo { }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\n//using System.Numerics;\n\nclass Program\n{\n static TextReader reader;\n static TextWriter writer;\n static Program()\n {\n#if ONLINE_JUDGE\n reader = Console.In;\n writer = Console.Out;\n#else\n reader = new StreamReader(\"input.txt\");\n writer = new StreamWriter(\"output.txt\");\n#endif\n }\n static long gcd(long a, long b)\n {\n return (b != 0) ? gcd(b, a % b) : a;\n }\n static void swap(ref int a, ref int b)\n {\n int t = a;\n a = b;\n b = t;\n }\n static long pow(long a, long x, long mod)\n {\n long res = 1;\n while (x > 0)\n {\n if ((x & 1) == 1)\n {\n res = (res * a) % mod;\n --x;\n }\n else\n {\n a = (a * a) % mod;\n x >>= 1;\n }\n }\n return res;\n }\n static void _a()\n {\n int n = int.Parse(reader.ReadLine());\n int xmin = 31400, xmax = 0, ymin = 31400, ymax = 0;\n long square = 0;\n for (int i = 0; i < n; ++i)\n {\n string[] s = reader.ReadLine().Split();\n int x1 = int.Parse(s[0]), y1 = int.Parse(s[1]), x2 = int.Parse(s[2]), y2 = int.Parse(s[3]);\n xmin = Math.Min(xmin, x1);\n ymin = Math.Min(ymin, y1);\n xmax = Math.Max(xmax, x2);\n ymax = Math.Max(ymax, y2);\n square += (x2 - x1) * (y2 - y1);\n }\n if ((xmax - xmin) == (ymax - ymin) && square == (xmax - xmin) * (ymax - ymin))\n writer.Write(\"YES\");\n else\n writer.Write(\"NO\");\n }\n static void _b()\n {\n \n }\n static void _c()\n {\n \n }\n static void _d()\n {\n \n }\n static void Main(string[] args)\n {\n _a();\n reader.Close();\n writer.Close();\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"A1\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var s = 0;\n int minX1 = int.MaxValue, maxX2 = int.MinValue, minY1 = int.MaxValue, maxY2 = int.MinValue;\n for (int i = 0; i < n; i++)\n {\n int x1, y1, x2, y2;\n Read(out x1, out y1, out x2, out y2);\n minX1 = Math.Min(minX1, x1);\n minY1 = Math.Min(minY1, y1);\n maxX2 = Math.Max(maxX2, x2);\n maxY2 = Math.Max(maxY2, y2);\n s += (x2 - x1)*(y2 - y1);\n }\n var isQ = maxX2 - minX1 == maxY2 - minY1;\n WriteLine(s==(maxX2-minX1)*(maxY2-minY1) && isQ ? \"YES\":\"NO\");\n }\n\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static int[] SortIndexs(this IEnumerable source) where T : IComparable\n {\n var array = source == null ? new List() : source.ToList();\n var n = array.Count;\n var res = Enumerable.Range(0, n).ToArray();\n Array.Sort(res, (a, b) => array[a].CompareTo(array[b]));\n return res;\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5, out T a6)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n a6 = (T)Convert.ChangeType(input[5], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PA\n{\n class Program\n {\n private static int _n = 0, _maxX = int.MinValue, _minX = int.MaxValue, _maxY = int.MinValue, _minY = int.MaxValue;\n private static List _rectangles;\n\n private static void ReadInput(string filepath)\n {\n try\n {\n string line;\n //using(StreamReader sr = new StreamReader(filepath))\n //{\n line = /*sr.ReadLine();*/Console.ReadLine();\n if(!int.TryParse(line, out _n))\n {\n throw new ArgumentException(\"bad input file format\");\n }\n\n int[] tempCoords = new int[4];\n for(int i = 0; i < _n; i++)\n {\n line = /*sr.ReadLine();*/Console.ReadLine();\n\n if(!string.IsNullOrEmpty(line.Trim()))\n {\n string[] coords = line.Split(' ');\n\n if(coords.Length != 4)\n {\n throw new ArgumentException(\"bad input file format\");\n }\n\n for(int j = 0; j < 4; j++)\n {\n if(!int.TryParse(coords[j], out tempCoords[j]))\n {\n throw new ArgumentException(\"bad input file format\");\n }\n }\n\n if(_maxX < tempCoords[2])\n _maxX = tempCoords[2];\n \n if(_minX > tempCoords[0])\n _minX = tempCoords[0];\n\n if(_maxY < tempCoords[3])\n _maxY = tempCoords[3];\n \n if(_minY > tempCoords[1])\n _minY = tempCoords[1];\n\n _rectangles.Add(new Rectangle\n {\n X0 = tempCoords[0],\n Y0 = tempCoords[1],\n X1 = tempCoords[2],\n Y1 = tempCoords[3]\n });\n }\n }\n //}\n \n }\n catch (Exception ex)\n {\n Console.WriteLine(\"Can't read input data!\");\n Console.WriteLine(ex.Message);\n }\n }\n\n private static bool FindSquares()\n {\n if (_maxX - _minX != _maxY - _minY)\n return false;\n\n double maxArea = (_maxX - _minX) * (_maxY - _minY);\n double area = .0;\n\n for (int i = 0; i < _n; i++)\n {\n area += (_rectangles[i].X1 - _rectangles[i].X0) * (_rectangles[i].Y1 - _rectangles[i].Y0);\n }\n\n if (area == maxArea)\n {\n return true;\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n try\n {\n if (null == _rectangles)\n {\n _rectangles = new List();\n }\n\n ReadInput(\"D:/Problems/PA/PA/inputNO.txt\");\n\n var state = FindSquares();\n\n if (state)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n catch (Exception ex)\n {\n Console.WriteLine(\"Error: \");\n Console.WriteLine(ex.Message);\n }\n\n }\n\n private class Rectangle\n {\n private int _x0;\n\n ///

\n /// left\n /// \n public int X0\n {\n get { return _x0; }\n set { _x0 = value; }\n }\n\n private int _y0;\n\n /// \n /// bottom\n /// \n public int Y0\n {\n get { return _y0; }\n set { _y0 = value; }\n }\n\n private int _x1;\n /// \n /// right\n /// \n public int X1\n {\n get { return _x1; }\n set { _x1 = value; }\n }\n\n private int _y1;\n /// \n /// top\n /// \n public int Y1\n {\n get { return _y1; }\n set { _y1 = value; }\n }\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt16(Console.ReadLine());\n int ymin, ymax,x1,y1,x2,y2;\n int xmin = ymin = 32100;\n int xmax = ymax = -32100;\n long S = 0;\n string[] temp = new string[4];\n\n for (int i = 0; i < n; ++i)\n {\n temp=Console.ReadLine().Split(new char[]{' '});\n x1 = Convert.ToInt16(temp[0]);\n y1 = Convert.ToInt16(temp[1]);\n x2 = Convert.ToInt16(temp[2]);\n y2 = Convert.ToInt16(temp[3]);\n S += (x2 - x1) * (y2 - y1);\n if (xmin > x1) xmin = x1;\n if (xmin > x2) xmin = x2;\n if (ymin > y1) ymin = y1;\n if (ymin > y2) ymin = y2;\n if (xmax < x1) xmax = x1;\n if (xmax < x2) xmax = x2;\n if (ymax < y1) ymax = y1;\n if (ymax < y2) ymax = y2;\n }\n\n if (S == (xmax - xmin) * (ymax - ymin) && (xmax-xmin == ymax - ymin)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass Program\n{\n static void Main()\n {\n string str = Console.ReadLine();\n int n = int.Parse(str);\n\n var squares = new int[n, 4];\n\n int minX = -1, maxX = -1, minY = -1, maxY = -1;\n\n for (int i = 0; i < n; i++)\n {\n str = Console.ReadLine();\n var q = str.Split(new char[] {' '});\n\n squares[i, 0] = int.Parse(q[0]);\n squares[i, 1] = int.Parse(q[1]);\n squares[i, 2] = int.Parse(q[2]);\n squares[i, 3] = int.Parse(q[3]);\n\n if (i == 0)\n {\n minX = squares[i, 0];\n minY = squares[i, 1];\n maxX = squares[i, 2];\n maxY = squares[i, 3];\n }\n\n\n if (minX > squares[i, 0]) minX = squares[i, 0];\n if (minY > squares[i, 1]) minY = squares[i, 1];\n if (maxX < squares[i, 2]) maxX = squares[i, 2];\n if (maxY < squares[i, 3]) maxY = squares[i, 3];\n // Console.WriteLine(str);\n }\n\n if (maxX - minX != maxY - minY)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n int square1 = (maxX - minX) * (maxY - minY);\n int square2 = 0;\n\n for (int i = 0; i < n; i++)\n {\n square2 += (squares[i, 2] - squares[i, 0]) * (squares[i, 3] - squares[i, 1]);\n }\n\n if (square1 != square2)\n {\n // Console.WriteLine(\"NO 2 1: {0} 2: {1}\", square1, square2);\n Console.WriteLine(\"NO\");\n return;\n }\n\n Console.WriteLine(\"YES\");\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int S = 0;\n int minx = 31401, miny = 31401, maxx = 0, maxy = 0;\n while (n-- > 0)\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n S += (a[2] - a[0]) * (a[3] - a[1]);\n if (a[0] < minx) minx = a[0];\n if (a[1] < miny) miny = a[1];\n if (a[2] > maxx) maxx = a[2]; \n if (a[3] > maxy) maxy = a[3]; \n }\n string ans = maxx - minx == maxy - miny && Math.Pow(maxx - minx, 2) == S ? \"YES\" : \"NO\";\n Console.WriteLine(ans);\n }\n}"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n int n = ReadInt();\n int minx = int.MaxValue;\n int maxx = int.MinValue;\n int miny = int.MaxValue;\n int maxy = int.MinValue;\n int S=0;\n for (int i = 0; i < n; i++)\n {\n ReadArray(' ');\n int x1=NextInt();\n int y1=NextInt();\n int x2=NextInt();\n int y2=NextInt();\n minx = Math.Min(minx, x1);\n miny = Math.Min(miny, y1);\n maxx = Math.Max(maxx, x2);\n maxy = Math.Max(maxy, y2);\n S+=(x2-x1)*(y2-y1);\n }\n if (maxx - minx == maxy - miny && S == (maxx - minx) * (maxy - miny)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n static void B()\n {\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n \n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nclass Myon\n{\n public Myon() { }\n public static int Main()\n {\n new Myon().calc();\n return 0;\n }\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n = cin.nextInt();\n int[] x1 = new int[n];\n int[] x2 = new int[n];\n int[] y1 = new int[n];\n int[] y2 = new int[n];\n int x1min = 99999;\n int x2max = 0;\n int y1min = 99999;\n int y2max = 0;\n\n long sum = 0;\n\n for (int i = 0; i < n; i++)\n {\n x1[i] = cin.nextInt();\n y1[i] = cin.nextInt();\n x2[i] = cin.nextInt();\n y2[i] = cin.nextInt();\n x1min = Math.Min(x1min, x1[i]);\n x2max = Math.Max(x2max, x2[i]);\n y1min = Math.Min(y1min, y1[i]);\n y2max = Math.Max(y2max, y2[i]);\n sum += (x2[i] - x1[i]) * (y2[i] - y1[i]);\n }\n if (x2max - x1min == y2max - y1min && (long)(x2max - x1min) * (y2max - y1min) == sum)\n {\n Console.WriteLine(\"YES\");\n }\n else Console.WriteLine(\"NO\");\n }\n}\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n}"}, {"source_code": "using System;\n\n\n class Program\n {\n static void Main()\n {\n int x1,x2,y1,y2,xl,xp,yn,yv;\n int n = Convert.ToInt32(Console.ReadLine())-1;\n\n string[] s = Console.ReadLine().Split(' ');\n x1 = xl= Convert.ToInt32(s[0]);\n y1 = yn =Convert.ToInt32(s[1]);\n x2 = xp= Convert.ToInt32(s[2]);\n y2 = yv =Convert.ToInt32(s[3]);\n int p = (x2 - x1) * (y2 - y1);\n\n\n for (; n > 0; n--) {\n s = Console.ReadLine().Split(' ');\n x1 = Convert.ToInt32(s[0]);\n y1 = Convert.ToInt32(s[1]);\n x2 = Convert.ToInt32(s[2]);\n y2 = Convert.ToInt32(s[3]);\n if (x1 < xl) xl = x1;\n if (y1 < yn) yn = y1;\n if (x2 > xp) xp = x2;\n if (y2 > yv) yv = y2;\n p += (x2 - x1) * (y2 - y1);\n }\n\n if (p == (xp - xl) * (yv - yn) && xp-xl==yv-yn) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces.Solutions.c325_memsql_1\n{\n\tpublic class Program1\n\t{\n\t\tpublic static void Main()\n\t\t{\n\t\t\tchecked\n\t\t\t{\n\t\t\t\tvar n = int.Parse(Console.ReadLine());\n\t\t\t\tvar rects = Enumerable.Range(0, n)\n\t\t\t\t\t.Select(i => Console.ReadLine().Split(' ').Select(long.Parse).ToArray())\n\t\t\t\t\t.ToArray();\n\n\t\t\t\tvar s = rects.Select(a => (a[2] - a[0])*(a[3] - a[1])).Sum();\n\t\t\t\tvar minX = rects.Min(a => a[0]);\n\t\t\t\tvar maxX = rects.Max(a => a[2]);\n\t\t\t\tvar minY = rects.Min(a => a[1]);\n\t\t\t\tvar maxY = rects.Max(a => a[3]);\n\n\t\t\t\tConsole.WriteLine(s == (maxX - minX)*(maxY - minY) ? \"YES\" : \"NO\");\n\t\t\t}\n\t\t}\n\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace PA\n{\n class Program\n {\n private static int _n = 0, _maxX = int.MinValue, _minX = int.MaxValue, _maxY = int.MinValue, _minY = int.MaxValue;\n private static List _rectangles;\n\n private static void ReadInput(string filepath)\n {\n try\n {\n string line;\n using(StreamReader sr = new StreamReader(filepath))\n {\n line = /*sr.ReadLine();*/Console.ReadLine();\n if(!int.TryParse(line, out _n))\n {\n throw new ArgumentException(\"bad input file format\");\n }\n\n int[] tempCoords = new int[4];\n for(int i = 0; i < _n; i++)\n {\n line = /*sr.ReadLine();*/Console.ReadLine();\n\n if(!string.IsNullOrEmpty(line.Trim()))\n {\n string[] coords = line.Split(' ');\n\n if(coords.Length != 4)\n {\n throw new ArgumentException(\"bad input file format\");\n }\n\n for(int j = 0; j < 4; j++)\n {\n if(!int.TryParse(coords[j], out tempCoords[j]))\n {\n throw new ArgumentException(\"bad input file format\");\n }\n }\n\n if(_maxX < tempCoords[2])\n _maxX = tempCoords[2];\n \n if(_minX > tempCoords[0])\n _minX = tempCoords[0];\n\n if(_maxY < tempCoords[3])\n _maxY = tempCoords[3];\n \n if(_minY > tempCoords[1])\n _minY = tempCoords[1];\n\n _rectangles.Add(new Rectangle\n {\n X0 = tempCoords[0],\n Y0 = tempCoords[1],\n X1 = tempCoords[2],\n Y1 = tempCoords[3]\n });\n }\n }\n }\n \n }\n catch (Exception ex)\n {\n Console.WriteLine(\"Can't read input data!\");\n Console.WriteLine(ex.Message);\n }\n }\n\n private static bool FindSquares()\n {\n if (_maxX - _minX != _maxY - _minY)\n return false;\n\n double maxArea = (_maxX - _minX) * (_maxY - _minY);\n double area = .0;\n\n for (int i = 0; i < _n; i++)\n {\n area += (_rectangles[i].X1 - _rectangles[i].X0) * (_rectangles[i].Y1 - _rectangles[i].Y0);\n }\n\n if (area == maxArea)\n {\n return true;\n }\n\n return false;\n }\n\n static void Main(string[] args)\n {\n if (null == _rectangles)\n {\n _rectangles = new List();\n }\n\n ReadInput(\"D:/Problems/PA/PA/inputNO.txt\");\n\n var state = FindSquares();\n\n if (state)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n\n }\n\n private class Rectangle\n {\n private int _x0;\n\n /// \n /// left\n /// \n public int X0\n {\n get { return _x0; }\n set { _x0 = value; }\n }\n\n private int _y0;\n\n /// \n /// bottom\n /// \n public int Y0\n {\n get { return _y0; }\n set { _y0 = value; }\n }\n\n private int _x1;\n /// \n /// right\n /// \n public int X1\n {\n get { return _x1; }\n set { _x1 = value; }\n }\n\n private int _y1;\n /// \n /// top\n /// \n public int Y1\n {\n get { return _y1; }\n set { _y1 = value; }\n }\n\n\n }\n }\n}\n"}, {"source_code": "#define Online\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF\n{\n delegate double F(double x);\n delegate decimal Fdec(decimal x);\n\n partial class Program\n {\n\n static int n;\n static Rect[] r;\n static bool[] u;\n static int[] x = new int[31401];\n struct Rect\n {\n public int x1;\n public int y1;\n public int x2;\n public int y2;\n }\n\n static void Main(string[] args)\n {\n\n#if FileIO\n StreamReader sr = new StreamReader(\"input.txt\");\n StreamWriter sw = new StreamWriter(\"output.txt\");\n Console.SetIn(sr);\n Console.SetOut(sw);\n#endif\n\n A();\n\n#if Online\n Console.ReadLine();\n#endif\n\n#if FileIO\n sr.Close();\n sw.Close();\n#endif\n }\n\n static void A()\n {\n n = ReadInt();\n r = new Rect[n];\n u = new bool[n];\n for (int i = 0; i < n; i++)\n {\n ReadArray(' ');\n r[i].x1 = NextInt();\n r[i].y1 = NextInt();\n r[i].x2 = NextInt();\n r[i].y2 = NextInt();\n }\n if (dfs(1, 0) || dfs(2, 0) || dfs(3, 0) || dfs(4, 0) || dfs(5, 0)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n static void B()\n {\n }\n\n static void C()\n {\n\n }\n\n static void D()\n {\n \n }\n\n static void E()\n {\n\n }\n\n static void TestGen()\n {\n\n }\n\n static bool dfs(int z, int k)\n {\n if (k == z)\n {\n Clear();\n for (int i = 0; i < n; i++)\n {\n if (!u[i]) continue;\n for (int j = r[i].x1; j < r[i].x2; j++)\n {\n x[j] += r[i].y2 - r[i].y1;\n }\n }\n\n for (int i = 0, j = 0; i < 31401; i++)\n {\n if (x[i] > 0)\n {\n int val = x[i];\n for (j = i; ; )\n {\n if (j < 31401 && x[j + 1] == val)\n {\n j++;\n }\n else\n {\n if (j == 31400) break;\n if (x[j + 1] != 0) return false;\n else break;\n\n }\n }\n if (val == j - i + 1)\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n }\n }\n for (int i = 0; i < n; i++)\n {\n if (!u[i])\n {\n u[i] = true;\n if (dfs(z, k + 1)) return true;\n u[i] = false;\n }\n }\n return false;\n }\n\n static void Clear()\n {\n for (int i = 0; i < 31401; i++)\n {\n x[i] = 0;\n }\n }\n }\n\n public static class MyMath\n {\n public static long BinPow(long a, long n, long mod)\n {\n long res = 1;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = (res * a) % mod;\n }\n a = (a * a) % mod;\n n >>= 1;\n }\n return res;\n }\n\n public static long GCD(long a, long b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static int GCD(int a, int b)\n {\n while (b != 0) b = a % (a = b);\n return a;\n }\n\n public static long LCM(long a, long b)\n {\n return (a * b) / GCD(a, b);\n }\n\n public static int LCM(int a, int b)\n {\n return (a * b) / GCD(a, b);\n }\n }\n\n static class ArrayUtils\n {\n public static int BinarySearch(int[] a, int val)\n {\n int left = 0;\n int right = a.Length - 1;\n int mid;\n\n while (left < right)\n {\n mid = left + ((right - left) >> 1);\n if (val <= a[mid])\n {\n right = mid;\n }\n else\n {\n left = mid + 1;\n }\n }\n\n if (a[left] == val)\n return left;\n else\n return -1;\n }\n\n public static double Bisection(F f, double left, double right, double eps)\n {\n double mid;\n while (right - left > eps)\n {\n mid = left + ((right - left) / 2d);\n if (Math.Sign(f(mid)) != Math.Sign(f(left)))\n right = mid;\n else\n left = mid;\n }\n return (left + right) / 2d;\n }\n\n\n public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)\n {\n decimal m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3m;\n m2 = r - (r - l) / 3m;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static double TernarySearch(F f, double eps, double l, double r, bool isMax)\n {\n double m1, m2;\n while (r - l > eps)\n {\n m1 = l + (r - l) / 3d;\n m2 = r - (r - l) / 3d;\n if (f(m1) < f(m2))\n if (isMax)\n l = m1;\n else\n r = m2;\n else\n if (isMax)\n r = m2;\n else\n l = m1;\n }\n return r;\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R, Comparison comp)\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (comp(L[i], R[j]) <= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R, comp);\n Merge_Sort(A, q + 1, r, L, R, comp);\n Merge(A, p, q, r, L, R, comp);\n }\n\n public static void Merge(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable\n {\n for (int i = p; i <= q; i++)\n L[i] = A[i];\n for (int i = q + 1; i <= r; i++)\n R[i] = A[i];\n\n for (int k = p, i = p, j = q + 1; k <= r; k++)\n {\n if (i > q)\n {\n for (; k <= r; k++, j++)\n A[k] = R[j];\n return;\n }\n if (j > r)\n {\n for (; k <= r; k++, i++)\n A[k] = L[i];\n return;\n }\n if (L[i].CompareTo(R[j]) >= 0)\n {\n A[k] = L[i];\n i++;\n }\n else\n {\n A[k] = R[j];\n j++;\n }\n }\n }\n\n public static void Merge_Sort(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n if (p >= r) return;\n int q = p + ((r - p) >> 1);\n Merge_Sort(A, p, q, L, R);\n Merge_Sort(A, q + 1, r, L, R);\n Merge(A, p, q, r, L, R);\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R) where T : IComparable\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n public static void Merge_Sort1(T[] A, int p, int r, T[] L, T[] R, Comparison comp)\n {\n int k = 1;\n while (k < r - p + 1)\n {\n int i = 0;\n while (i < r)\n {\n int _r = Math.Min(i + 2 * k - 1, r);\n int q = Math.Min(i + k - 1, r);\n Merge(A, i, q, _r, L, R, comp);\n i += 2 * k;\n }\n k <<= 1;\n }\n }\n\n static void Shake(T[] a)\n {\n Random rnd = new Random(Environment.TickCount);\n T temp;\n int b, c;\n for (int i = 0; i < a.Length; i++)\n {\n b = rnd.Next(0, a.Length);\n c = rnd.Next(0, a.Length);\n temp = a[b];\n a[b] = a[c];\n a[c] = temp;\n }\n }\n }\n\n partial class Program\n {\n static string[] tokens;\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}"}, {"source_code": "using System;\n\n\n class Program\n {\n static void Main()\n {\n int x1,x2,y1,y2,xl,xp,yn,yv;\n int n = Convert.ToInt32(Console.ReadLine())-1;\n\n string[] s = Console.ReadLine().Split(' ');\n x1 = xl= Convert.ToInt32(s[0]);\n y1 = yn =Convert.ToInt32(s[1]);\n x2 = xp= Convert.ToInt32(s[2]);\n y2 = yv =Convert.ToInt32(s[3]);\n int p = (x2 - x1) * (y2 - y1);\n\n\n for (; n > 0; n--) {\n s = Console.ReadLine().Split(' ');\n x1 = Convert.ToInt32(s[0]);\n y1 = Convert.ToInt32(s[1]);\n x2 = Convert.ToInt32(s[2]);\n y2 = Convert.ToInt32(s[3]);\n if (x1 < xl) xl = x1;\n if (y1 < yn) yn = y1;\n if (x2 > xp) xp = x2;\n if (y2 > yv) yv = y2;\n p += (x2 - x1) * (y2 - y1);\n }\n\n if (p == (xp - xl) * (yv - yn)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n\n }\n }\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal static class Program\n {\n private const string TEST = \"A1\";\n\n private static void Solve()\n {\n var n = ReadInt();\n var s = 0;\n int minX1 = int.MaxValue, maxX2 = int.MinValue, minY1 = int.MaxValue, maxY2 = int.MinValue;\n for (int i = 0; i < n; i++)\n {\n int x1, y1, x2, y2;\n Read(out x1, out y1, out x2, out y2);\n minX1 = Math.Min(minX1, x1);\n minY1 = Math.Min(minY1, y1);\n maxX2 = Math.Max(maxX2, x2);\n maxY2 = Math.Max(maxY2, y2);\n s += (x2 - x1)*(y2 - y1);\n }\n WriteLine(s==(maxX2-minX1)*(maxY2-minY1)? \"YES\":\"NO\");\n }\n\n \n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", TEST)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n private static int[] SortIndexs(this IEnumerable source) where T : IComparable\n {\n var array = source == null ? new List() : source.ToList();\n var n = array.Count;\n var res = Enumerable.Range(0, n).ToArray();\n Array.Sort(res, (a, b) => array[a].CompareTo(array[b]));\n return res;\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static void Read(out T a1, out T a2)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n }\n\n private static void Read(out T a1, out T a2, out T a3, out T a4, out T a5, out T a6)\n {\n var input = ReadArray();\n a1 = (T)Convert.ChangeType(input[0], typeof(T));\n a2 = (T)Convert.ChangeType(input[1], typeof(T));\n a3 = (T)Convert.ChangeType(input[2], typeof(T));\n a4 = (T)Convert.ChangeType(input[3], typeof(T));\n a5 = (T)Convert.ChangeType(input[4], typeof(T));\n a6 = (T)Convert.ChangeType(input[5], typeof(T));\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Read());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n private static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n private static T Read()\n {\n return (T)Convert.ChangeType(Read(), typeof(T));\n }\n\n private static string[] ReadArray()\n {\n var readLine = Console.ReadLine();\n if (readLine != null)\n return readLine.Split(' ');\n\n throw new ArgumentException();\n }\n\n private static List ReadIntArray()\n {\n return ReadArray().Select(Int32.Parse).ToList();\n }\n\n private static List ReadLongArray()\n {\n return ReadArray().Select(long.Parse).ToList();\n }\n\n private static List ReadDoubleArray()\n {\n return ReadArray().Select(d => double.Parse(d, CultureInfo.InvariantCulture)).ToList();\n }\n\n private static List ReadArray()\n {\n return ReadArray().Select(x => (T)Convert.ChangeType(x, typeof(T))).ToList();\n }\n\n private static void WriteLine(double value)\n {\n Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(double value, string stringFormat)\n {\n Console.WriteLine(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void WriteLine(T value)\n {\n Console.WriteLine(value);\n }\n\n private static void Write(double value)\n {\n Console.Write(value.ToString(CultureInfo.InvariantCulture));\n }\n\n private static void Write(double value, string stringFormat)\n {\n Console.Write(value.ToString(stringFormat, CultureInfo.InvariantCulture));\n }\n\n private static void Write(T value)\n {\n Console.Write(value);\n }\n\n #endregion\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt16(Console.ReadLine());\n int ymin, ymax,x1,y1,x2,y2;\n int xmin = ymin = 32100;\n int xmax = ymax = -32100;\n long S = 0;\n string[] temp = new string[4];\n\n for (int i = 0; i < n; ++i)\n {\n temp=Console.ReadLine().Split(new char[]{' '});\n x1 = Convert.ToInt16(temp[0]);\n y1 = Convert.ToInt16(temp[1]);\n x2 = Convert.ToInt16(temp[2]);\n y2 = Convert.ToInt16(temp[3]);\n S += (x2 - x1) * (y2 - y1);\n if (xmin > x1) xmin = x1;\n if (xmin > x2) xmin = x2;\n if (ymin > y1) ymin = y1;\n if (ymin > y2) ymin = y2;\n if (xmax < x1) xmax = x1;\n if (xmax < x2) xmax = x2;\n if (ymax < y1) ymax = y1;\n if (ymax < y2) ymax = y2;\n }\n\n if (S == (xmax - xmin) * (ymax - ymin)) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass Demo\n{\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n int S = 0;\n int minx = 31401, miny = 31401, maxx = 0, maxy = 0;\n while (n-- > 0)\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n S += (a[2] - a[0]) * (a[3] - a[1]);\n if (a[0] < minx) { minx = a[0]; miny = a[1]; }\n if (a[1] < miny) { minx = a[0]; miny = a[1]; }\n if (a[2] > maxx) { maxx = a[2]; maxy = a[3]; }\n if (a[3] > maxy) { maxx = a[2]; maxy = a[3]; }\n }\n string ans = maxx - minx == maxy - miny && Math.Pow(maxx - minx, 2) == S ? \"YES\" : \"NO\";\n Console.WriteLine(ans);\n }\n}"}], "src_uid": "f63fc2d97fd88273241fce206cc217f2"} {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private bool Calc()\n {\n var n = int.Parse(Console.ReadLine());\n int now = 0;\n int MAX = 20000;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n int d = int.Parse(s[0]);\n string v = s[1];\n if (v == \"North\")\n {\n now -= d;\n if (now < 0) return false;\n }\n else if (v == \"South\")\n {\n now += d;\n if (now > MAX) return false;\n }\n else\n {\n if (now <= 0 || now >= MAX) return false;\n }\n\n }\n return now == 0;\n }\n\n private void Solve()\n {\n\n if (Calc()) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n", "positive_code": [{"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\tbool ret2 = true;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tsum += Int32.Parse(temp[0]);\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tsum -= Int32.Parse(temp[0]);\n\t\t\t\t}\n\t\t\t\telse if (sum == 0 || sum == 20000) {\n\t\t\t\t\tret2 = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Console.WriteLine(sum);\n\t\t\t\tif (sum < 0 || sum > 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0 && ret2) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CP_CS\n{\n\n class Task\n {\n\n static void Solve()\n {\n int n = ReadInt();\n int vert = 0;\n for (int i = 0; i < n; i++)\n {\n int dl = ReadInt();\n string dir = ReadToken();\n if (vert == 0)\n {\n if (dir != \"South\")\n {\n Write(\"NO\");\n return;\n }\n }\n if (vert == 20000)\n {\n if (dir != \"North\")\n {\n Write(\"NO\");\n return;\n }\n }\n if (dir == \"North\")\n {\n if (vert - dl < 0)\n {\n Write(\"NO\");\n return;\n }\n vert -= dl;\n }\n if (dir == \"South\")\n {\n if (vert + dl > 20000)\n {\n Write(\"NO\");\n return;\n }\n vert += dl;\n }\n vert = vert % 40000;\n if (vert > 20000)\n {\n vert = 40000 - vert;\n }\n }\n if (vert == 0)\n {\n Write(\"YES\");\n }\n else\n {\n Write(\"NO\");\n }\n }\n\n public static double Rast(int[] xy1, int[] xy2)\n {\n return Math.Sqrt(Math.Pow(xy1[0] - xy2[0], 2) + Math.Pow(xy1[1] - xy2[1], 2));\n }\n\n static string[] Split(string str, int chunkSize)\n {\n return Enumerable.Range(0, str.Length / chunkSize)\n .Select(i => str.Substring(i * chunkSize, chunkSize)).ToArray();\n }\n\n #region -- Main -- \n\n private static TextReader reader;\n private static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"pluses.in\");\n //writer = new StreamWriter(\"pluses.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n #region -- Read / Write --\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadAndSplitLine(char divisor)\n {\n return reader.ReadLine().Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n //public static BigInteger ReadBigInteger()\n //{\n // return BigInteger.Parse(ReadToken());\n //}\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static bool[] ReadBoolArray()\n {\n return ReadAndSplitLine().ToString().ToCharArray().Select(chr => chr == '1').ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static bool[][] ReadBoolMatrix(int numberOfRows)\n {\n bool[][] matrix = new bool[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadBoolArray();\n return matrix;\n }\n\n public static bool[][] TransposeBoolMatrix(bool[][] array, int numberOfRows)\n {\n bool[][] matrix = array;\n bool[][] ret = new bool[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new bool[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private bool Calc()\n {\n var n = int.Parse(Console.ReadLine());\n int now = 0;\n int MAX = 20000;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n int d = int.Parse(s[0]);\n string v = s[1];\n if (v == \"North\")\n {\n now -= d;\n if (now < 0) return false;\n }\n else if (v == \"South\")\n {\n now += d;\n if (now > MAX) return false;\n }\n else\n {\n if (now == 0 || now == MAX) return false;\n }\n\n }\n return now == 0;\n }\n\n private void Solve()\n {\n\n if (Calc()) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": "using System;\n\nclass B750 {\n static bool ReadJudge(int n) {\n int a = 0;\n for (int i = 0; i < n; ++i) {\n var line = Console.ReadLine().Split();\n var num = int.Parse(line[0]);\n switch (line[1]) {\n case \"South\":\n a += num;\n if (20000 < a) return false;\n break;\n case \"North\":\n a -= num;\n if (a < 0) return false;\n break;\n default:\n if (a == 0 || a == 20000) return false;\n break;\n }\n }\n return a == 0;\n }\n\n public static void Main() {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine(ReadJudge(n) ? \"YES\" : \"NO\");\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Self\n{\n class Program\n {\n static void Main(string[] args)\n {\n int MovAmm = int.Parse(Console.ReadLine());\n int VertPos = 0;\n bool Check = true;\n string[] MovData = new string[MovAmm];\n for (int i = 0; i < MovAmm; i++)\n {\n MovData[i] = Console.ReadLine();\n }\n\n string[] tempArray;\n int tempLength = 0;\n string tempDirect = null;\n for (int i = 0; i < MovAmm; i++)\n {\n tempArray = MovData[i].Split(' ');\n tempLength = int.Parse(tempArray[0]);\n tempDirect = tempArray[1];\n\n if (VertPos == 0) \n {\n if ((tempDirect == \"East\") || (tempDirect == \"West\") || (tempDirect == \"North\"))\n {\n Check = false;\n break;\n }\n else\n {\n if (VertPos + tempLength > 20000)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos += tempLength;\n }\n }\n }\n else if (VertPos == 20000)\n {\n if ((tempDirect == \"East\") || (tempDirect == \"West\") || (tempDirect == \"South\"))\n {\n Check = false;\n break;\n }\n else\n {\n if (VertPos < tempLength)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos -= tempLength;\n }\n }\n }\n else\n {\n if (tempDirect == \"North\")\n {\n if(VertPos < tempLength)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos -= tempLength;\n }\n }\n if (tempDirect == \"South\")\n {\n if (VertPos+tempLength > 20000)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos += tempLength;\n }\n }\n }\n }//\u043a\u043e\u043d\u0435\u0446 \u0444\u043e\u0440\u0430\n if (Check)\n {\n if(VertPos == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n int w = 0;\n for (int i = 0; i < n; i++)\n {\n int t = input.NextInt();\n string d = input.NextToken();\n if (d == \"South\")\n {\n w += t;\n }\n else if (d == \"North\")\n {\n w -= t;\n }\n else if (w == 0 || w == 20000)\n {\n Console.Write(\"NO\");\n return;\n }\n if (w < 0 || w > 20000)\n {\n Console.Write(\"NO\");\n return;\n }\n }\n if (w != 0)\n Console.Write(\"NO\");\n else\n Console.Write(\"YES\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = NextInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n int curNS = 0;\n int curEV = 0;\n\n bool bOK = true;\n\n while(n>0)\n {\n var dist = ioHelper.ReadNextInt();\n var dir = ioHelper.ReadNextToken();\n\n if (dir == \"North\")\n {\n if (curNS == 0)\n curNS = -1;\n else\n curNS -= dist;\n if (curNS < 0)\n {\n bOK = false;\n break;\n }\n }\n else if (dir == \"South\")\n {\n if (curNS == 20000)\n curNS++;\n else\n curNS += dist;\n if (curNS > 20000)\n {\n bOK = false;\n break;\n }\n }\n else\n {\n if (curNS == 0 || curNS == 20000)\n { bOK = false; break; }\n }\n n--;\n }\n\n if (curNS != 0)\n bOK = false;\n\n if (bOK)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int koord = 0;\n int location = 20000;\n string direction = \"\";\n string res = \"\";\n bool violation = false;\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n koord = Convert.ToInt32(s[0]);\n direction = s[1];\n\n if(direction==\"North\")\n {\n location += koord;\n if(location>20000)\n {\n res = \"NO\";\n violation = true;\n }\n }\n if(direction==\"South\")\n {\n location -= koord;\n if(location<0)\n {\n res = \"NO\";\n violation = true;\n }\n }\n if ((direction == \"East\" || direction == \"West\") && (location >= 20000 || location <= 0))\n {\n violation = true;\n }\n }\n if (!violation)\n {\n if (location == 20000)\n {\n res = \"YES\";\n }\n else { res = \"NO\"; }\n }\n else { res = \"NO\"; }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "//750B New Year and North Pole\n\nusing System;\nclass _750B\n{\n\tstatic void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint[] lens=new int[n];\n\t\tstring[] dirs=new string[n];\n\t\tfor(int i=0;i20000)\n\t\t\t\tbreak;\n\t\t\telse if((sum==0 || sum==20000) && (dirs[i]==\"East\" || dirs[i]==\"West\"))\n\t\t\t{\n\t\t\t\tsum=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if(sum==0)\n\t\t\t\tsum+=lens[i];\n\t\t\telse if(sum==20000)\n\t\t\t\tsum-=lens[i];\n\t\t\telse\n\t\t\t\tif(dirs[i]==\"South\")\n\t\t\t\t\tsum+=lens[i];\n\t\t\t\telse if(dirs[i]==\"North\")\n\t\t\t\t\tsum-=lens[i];\n\t\t}\n\t\tConsole.Write((sum==0)?\"YES\":\"NO\");\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _750B\n {\n public static void Main()\n {\n bool valid = true;\n int position = 0;\n\n for (int n = int.Parse(Console.ReadLine()); n > 0; n--)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int t = int.Parse(tokens[0]);\n string direction = tokens[1];\n\n if (position == 0 && direction != \"South\")\n {\n valid = false;\n }\n\n if (position == 20000 && direction != \"North\")\n {\n valid = false;\n }\n\n switch (direction)\n {\n case \"South\":\n position += t;\n break;\n case \"North\":\n position -= t;\n break;\n }\n\n if (position < 0 || position > 20000)\n {\n valid = false;\n }\n }\n\n valid &= position == 0;\n\n Console.WriteLine(valid ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_and_North_Pole\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var t = new int[n];\n var dir = new int[n];\n for (int i = 0; i < n; i++)\n {\n t[i] = Next();\n dir[i] = Next();\n }\n\n int d = 0;\n\n for (int i = 0; i < n; i++)\n {\n if ((d == 0 || d == 20000) && dir[i] == 0)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n d += t[i]*dir[i];\n if (d < 0 || d > 20000)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(d == 0 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == 'N')\n return -1;\n if (c == 'E')\n return 0;\n if (c == 'W')\n return 0;\n if (c == 'S')\n return 1;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = Convert.ToInt32(Console.ReadLine());\n int p=0;\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n int l = Convert.ToInt32(s[0]);\n if ((p == 0 && s[1] != \"South\") || (p == 20000 && s[1] != \"North\") || (s[1] == \"South\" && p+l>20000) || (s[1] == \"North\" && p-l<0))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (s[1] == \"South\")\n {\n p +=l;\n }\n else if (s[1] == \"North\")\n {\n p-=l;\n }\n \n }\n if (p != 0) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _750B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int distFromNorth = 0;\n bool result = true;\n for (int i = 0; i < n; i++)\n {\n string[] line = Console.ReadLine().Split(' ');\n int t = int.Parse(line[0]);\n string dir = line[1];\n if (result)\n {\n if ((distFromNorth == 0 && dir != \"South\") ||\n (distFromNorth == 20000 && dir != \"North\") ||\n (dir == \"North\" && t > distFromNorth) ||\n (dir == \"South\" && t > 20000 - distFromNorth))\n {\n result = false;\n }\n\n if (dir == \"North\")\n {\n distFromNorth -= t;\n }\n else if (dir == \"South\")\n {\n distFromNorth += t;\n }\n }\n }\n if (distFromNorth != 0)\n {\n result = false;\n }\n\n Console.WriteLine(result ? \"YES\" : \"NO\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n\n object Solve()\n {\n checked\n {\n var n = (int)ReadLong();\n var coord = 0;\n var result = true;\n for (int i = 0; i < n; i++)\n {\n var parts = Read().Split(' ');\n var len = int.Parse(parts[0]);\n var dir = parts[1];\n if ((coord == 20000 && dir != \"North\") || (coord == 0 && dir != \"South\"))\n {\n result = false;\n break;\n }\n if (dir == \"South\")\n {\n if (coord + len > 20000)\n {\n result = false;\n break;\n }\n coord += len;\n }\n else if (dir == \"North\")\n {\n if (coord - len < 0)\n {\n result = false;\n break;\n }\n coord -= len;\n }\n }\n return (result && coord == 0) ? \"YES\" : \"NO\";\n }\n }\n\n long[] Mirror(Tuple line, long[] point)\n {\n var x = line.Item1[0] + line.Item2[0] - point[0];\n var y = line.Item1[1] + line.Item2[1] - point[1];\n return new long[] { x, y };\n }\n\n class DSU\n {\n private int[] arr;\n private Random r = new Random();\n public DSU(int n)\n {\n arr = new int[n];\n for (int i = 0; i < n; i++)\n {\n arr[i] = i;\n }\n }\n\n public int Find(int x)\n {\n if (arr[arr[x]] == arr[x])\n return arr[x];\n var y = Find(arr[x]);\n arr[x] = y;\n return y;\n }\n\n public void Union(int x, int y)\n {\n var p1 = Find(x);\n var p2 = Find(y);\n if (p1 == p2)\n return;\n if (r.NextDouble() < 0.5)\n arr[p1] = p2;\n else\n arr[p2] = p1;\n }\n\n public int[][] Enumerate()\n {\n return arr.Select((x, i) => new { g = Find(x), i }).GroupBy(x => x.g, (k, e) => e.Select(y => y.i).ToArray()).ToArray();\n }\n\n public Tuple[] GetCounts()\n {\n return arr.Select((x, i) => new { g = Find(x), i }).GroupBy(x => x.g, (k, e) => Tuple.Create(k, e.Count())).ToArray();\n }\n }\n class Node\n {\n public List Children = new List();\n public long Sum;\n public Tuple RecurseMax;\n }\n //int BS(long[][] cuts, int left, int right)\n //{\n // if (right - left == 1)\n // return left;\n // var half = (left + right) / 2;\n\n //}\n\n\n struct Second\n {\n public Second(long count, long mana)\n {\n Mana = mana;\n Count = count;\n }\n\n public long Mana;\n public long Count;\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput())\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n}"}, {"source_code": "using System;\n\nnamespace bcs\n{\n class MainClass\n {\n public static void Main(string[] args)\n {\n var n = Int32.Parse(Console.ReadLine().Trim());\n\n var ans = true;\n\n var prevHight = 0;\n for (int i = 0; i < n; i++) {\n var line = Console.ReadLine().Trim().Split();\n var t = Int32.Parse(line[0]);\n var dir = line[1];\n\n if (i == 0 && dir != \"South\") {\n ans = false;\n break;\n }\n\n switch (dir) {\n case \"South\":\n if (prevHight + t > 20000) {\n ans = false;\n }\n else {\n prevHight += t;\n }\n break;\n case \"North\":\n if (prevHight - t < 0) {\n ans = false;\n }\n else {\n prevHight -= t;\n }\n break;\n case \"East\":\n if (prevHight == 0 || prevHight == 20000) {\n ans = false;\n }\n break;\n case \"West\":\n if (prevHight == 0 || prevHight == 20000) {\n ans = false;\n }\n break;\n }\n\n if (!ans) {\n break;\n }\n }\n\n if (prevHight != 0) {\n ans = false;\n }\n\n Console.WriteLine(ans ? \"YES\" : \"NO\");\n }\n }\n}\n"}, {"source_code": "\ufeff\ufeff\ufeff\ufeffusing System;\n\ufeff\ufeff\ufeffusing System.Globalization;\n\ufeff\ufeff\ufeffusing System.IO;\n\ufeff\ufeff\ufeffusing System.Linq;\n\nnamespace CF317\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var sr = new InputReader(Console.In);\n //var sr = new InputReader(new StreamReader(\"input.txt\"));\n var task = new Task();\n using (var sw = Console.Out)\n //using (var sw = new StreamWriter(\"output.txt\"))\n {\n task.Solve(sr, sw);\n //Console.ReadKey();\n }\n }\n }\n\n internal class Task\n {\n public void Solve(InputReader sr, TextWriter sw)\n {\n var n = sr.NextInt32();\n var curr = 0L;\n var x = 0.0;\n var y = 0.0;\n var scaleX = 1.0;\n for (var i = 0; i < n; i++) {\n var next = sr.NextSplitStrings();\n var nextD = Int32.Parse(next[0]);\n var dir = next[1];\n if (Math.Abs(y - 0) <= 0.000000001 && Math.Abs(x*scaleX - 0.0) <= 0.000000001 && dir != \"South\")\n {\n sw.WriteLine(\"NO\");\n return;\n }\n if (Math.Abs(y - 20000.0) <= 0.000000001 && Math.Abs(x*scaleX - 0.0) <= 0.000000001 && dir != \"North\")\n {\n sw.WriteLine(\"NO\");\n return;\n }\n switch (dir) {\n case \"North\":\n y -= nextD;\n break;\n case \"South\":\n y += nextD;\n break;\n case \"West\":\n x -= nextD;\n break;\n default:\n x += nextD;\n break;\n }\n if (y < 0.0) {\n sw.WriteLine(\"NO\");\n return;\n }\n if (y > 20000.0) {\n sw.WriteLine(\"NO\");\n return;\n }\n if (dir == \"North\" || dir == \"South\") {\n scaleX = y / 10000.0;\n }\n }\n\n if (Math.Abs(y - 0) <= 0.000000001 && Math.Abs(x*scaleX - 0.0) <= 0.000000001)\n {\n sw.WriteLine(\"YES\");\n return;\n }\n\n sw.WriteLine(\"NO\");\n }\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(NextString());\n }\n\n public long NextInt64()\n {\n return Int64.Parse(NextString());\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directionToSouth == 0 && directions[i] != \"South\")\n {\n rightWay = false;\n break;\n }\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0 || directionToSouth > 20000)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool cond = true;\n int n = Int32.Parse(Console.ReadLine());\n int[] dist = new int[n];\n string[] dir = new string[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n dist[i] = Int32.Parse(s[0]);\n dir[i] = s[1];\n }\n if (dir[0] != \"South\")\n {\n cond = false;\n //Console.WriteLine(\"no1\");\n }\n else\n {\n int x = 0;\n for (int i = 0; i < n; i++)\n {\n if (dir[i] == \"South\")\n {\n x += dist[i];\n if (x > 20000 || x < 0)\n break;\n }\n else if (dir[i] == \"North\")\n {\n x -= dist[i];\n if (x > 20000 || x < 0)\n break;\n }\n if (x >= 20000)\n {\n if ((i < n - 1) && ((dir[i] == \"South\" && dir[i + 1] != \"North\") || (dir[i] == \"North\" && dir[i + 1] != \"South\")))\n {\n break;\n }\n }\n }\n if (x != 0 || dir[n - 1] != \"North\")\n cond = false;\n else\n cond = true;\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\t\n\t\tint now = 0;\n\t\tfor(int i=0;i 20000){\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnow += t;\n\t\t\t}\n\t\t}\n\t\t\n\t\tConsole.WriteLine(now == 0 ? \"YES\" : \"NO\");\n\t}\n\tint N;\n\tString[][] S;\n\tpublic Sol(){\n\t\tN = ri();\n\t\tS = new String[N][];\n\t\tfor(int i=0;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Codeforces\n{\n public class Program\n {\n private const int MAXN = 8000;\n\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine().Trim());\n int x = 0;\n\n for (int i = 0; i < n; i++)\n {\n string[] arr = Console.ReadLine().Trim().Split(' ').ToArray();\n int dx = int.Parse(arr[0]);\n string direction = arr[1];\n\n if (direction == \"South\")\n {\n if (x + dx > 20000)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n x += dx;\n }\n else if (direction == \"North\")\n {\n if (x - dx < 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n x -= dx;\n }\n else\n {\n if (x == 0 || x == 20000)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n }\n }\n Console.WriteLine(x == 0 ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.IO;\nusing System.Text;\nusing System.Diagnostics;\n\nusing Binary = System.Func;\nusing Unary = System.Func;\n\nclass Program\n{\n static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };\n static Scan sc = new Scan();\n// static Scan sc = new ScanCHK();\n const int M = 1000000007;\n const double eps = 1e-9;\n static readonly int[] dd = { 0, 1, 0, -1, 0 };\n static void Main()\n {\n int n = sc.Int;\n int now = 0;\n for (int i = 0; i < n; i++)\n {\n int d;\n string s;\n sc.Multi(out d, out s);\n switch (s)\n {\n case \"North\":\n if (now - d < 0)\n {\n DBG(\"NO\");\n return;\n }\n now -= d;\n break;\n case \"South\":\n if (now + d > 20000)\n {\n DBG(\"NO\");\n return;\n }\n now += d;\n break;\n default:\n if (now == 0 || now == 20000)\n {\n DBG(\"NO\");\n return;\n }\n break;\n }\n }\n Prt(now == 0 ? \"YES\" : \"NO\");\n sw.Flush();\n }\n\n static void swap(ref T a, ref T b) { var t = a; a = b; b = t; }\n static T Max(params T[] a) => a.Max();\n static T Min(params T[] a) => a.Min();\n static void DBG(params T[] a) => Console.WriteLine(string.Join(\" \", a));\n static void DBG(params object[] a) => Console.WriteLine(string.Join(\" \", a));\n static void Prt(params T[] a) => sw.WriteLine(string.Join(\" \", a));\n static void Prt(params object[] a) => sw.WriteLine(string.Join(\" \", a));\n}\nstatic class ex\n{\n public static string con(this IEnumerable a) => a.con(\" \");\n public static string con(this IEnumerable a, string s) => string.Join(s, a);\n public static void swap(this IList a, int i, int j) { var t = a[i]; a[i] = a[j]; a[j] = t; }\n public static T[] copy(this IList a)\n {\n var ret = new T[a.Count];\n for (int i = 0; i < a.Count; i++) ret[i] = a[i];\n return ret;\n }\n}\nstatic class Operator\n{\n static readonly ParameterExpression x = Expression.Parameter(typeof(T), \"x\");\n static readonly ParameterExpression y = Expression.Parameter(typeof(T), \"y\");\n public static readonly Func Add = Lambda(Expression.Add);\n public static readonly Func Subtract = Lambda(Expression.Subtract);\n public static readonly Func Multiply = Lambda(Expression.Multiply);\n public static readonly Func Divide = Lambda(Expression.Divide);\n public static readonly Func Plus = Lambda(Expression.UnaryPlus);\n public static readonly Func Negate = Lambda(Expression.Negate);\n public static Func Lambda(Binary op) => Expression.Lambda>(op(x, y), x, y).Compile();\n public static Func Lambda(Unary op) => Expression.Lambda>(op(x), x).Compile();\n}\n\nclass ScanCHK : Scan\n{\n public new string Str { get { var s = Console.ReadLine(); if (s != s.Trim()) throw new Exception(); return s; } }\n}\nclass Scan\n{\n public int Int => int.Parse(Str);\n public long Long => long.Parse(Str);\n public double Double => double.Parse(Str);\n public string Str => Console.ReadLine().Trim();\n public int[] IntArr => StrArr.Select(int.Parse).ToArray();\n public long[] LongArr => StrArr.Select(long.Parse).ToArray();\n public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();\n public string[] StrArr => Str.Split();\n bool eq() => typeof(T).Equals(typeof(U));\n T ct(U a) => (T)Convert.ChangeType(a, typeof(T));\n T cv(string s) => eq() ? ct(int.Parse(s))\n : eq() ? ct(long.Parse(s))\n : eq() ? ct(double.Parse(s))\n : eq() ? ct(s[0]) : ct(s);\n public void Multi(out T a) => a = cv(Str);\n public void Multi(out T a, out U b)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); }\n public void Multi(out T a, out U b, out V c)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); }\n public void Multi(out T a, out U b, out V c, out W d)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); }\n public void Multi(out T a, out U b, out V c, out W d, out X e)\n { var ar = StrArr; a = cv(ar[0]); b = cv(ar[1]); c = cv(ar[2]); d = cv(ar[3]); e = cv(ar[4]); }\n}\nclass mymath\n{\n public static long Mod = 1000000007;\n public static bool isprime(long a)\n {\n if (a < 2) return false;\n for (long i = 2; i * i <= a; i++) if (a % i == 0) return false;\n return true;\n }\n public static bool[] sieve(int n)\n {\n var p = new bool[n + 1];\n for (int i = 2; i <= n; i++) p[i] = true;\n for (int i = 2; i * i <= n; i++) if (p[i]) for (int j = i * i; j <= n; j += i) p[j] = false;\n return p;\n }\n public static List getprimes(int n)\n {\n var prs = new List();\n var p = sieve(n);\n for (int i = 2; i <= n; i++) if (p[i]) prs.Add(i);\n return prs;\n }\n public static long[][] E(int n)\n {\n var ret = new long[n][];\n for (int i = 0; i < n; i++) { ret[i] = new long[n]; ret[i][i] = 1; }\n return ret;\n }\n public static long[][] pow(long[][] A, long n)\n {\n if (n == 0) return E(A.Length);\n var t = pow(A, n / 2);\n if ((n & 1) == 0) return mul(t, t);\n return mul(mul(t, t), A);\n }\n public static double dot(double[] x, double[] y)\n {\n int n = x.Length;\n double ret = 0;\n for (int i = 0; i < n; i++) ret += x[i] * y[i];\n return ret;\n }\n public static long dot(long[] x, long[] y)\n {\n int n = x.Length;\n long ret = 0;\n for (int i = 0; i < n; i++) ret = (ret + x[i] * y[i]) % Mod;\n return ret;\n }\n public static T[][] trans(T[][] A)\n {\n int n = A[0].Length, m = A.Length;\n var ret = new T[n][];\n for (int i = 0; i < n; i++) { ret[i] = new T[m]; for (int j = 0; j < m; j++) ret[i][j] = A[j][i]; }\n return ret;\n }\n public static double[] mul(double[][] A, double[] x)\n {\n int n = A.Length;\n var ret = new double[n];\n for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]);\n return ret;\n }\n public static long[] mul(long[][] A, long[] x)\n {\n int n = A.Length;\n var ret = new long[n];\n for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]);\n return ret;\n }\n public static long[][] mul(long[][] A, long[][] B)\n {\n int n = A.Length;\n var Bt = trans(B);\n var ret = new long[n][];\n for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]);\n return ret;\n }\n public static long[] add(long[] x, long[] y)\n {\n int n = x.Length;\n var ret = new long[n];\n for (int i = 0; i < n; i++) ret[i] = (x[i] + y[i]) % Mod;\n return ret;\n }\n public static long[][] add(long[][] A, long[][] B)\n {\n int n = A.Length;\n var ret = new long[n][];\n for (int i = 0; i < n; i++) ret[i] = add(A[i], B[i]);\n return ret;\n }\n public static long pow(long a, long b)\n {\n if (a >= Mod) return pow(a % Mod, b);\n if (a == 0) return 0;\n if (b == 0) return 1;\n var t = pow(a, b / 2);\n if ((b & 1) == 0) return t * t % Mod;\n return t * t % Mod * a % Mod;\n }\n public static long inv(long a) => pow(a, Mod - 2);\n public static long gcd(long a, long b)\n {\n while (b > 0) { var t = a % b; a = b; b = t; }\n return a;\n }\n // a x + b y = gcd(a, b)\n public static long extgcd(long a, long b, out long x, out long y)\n {\n long g = a; x = 1; y = 0;\n if (b > 0) { g = extgcd(b, a % b, out y, out x); y -= a / b * x; }\n return g;\n }\n public static long lcm(long a, long b) => a / gcd(a, b) * b;\n public static long comb(int n, int r)\n {\n if (n < 0 || r < 0 || r > n) return 0;\n if (n - r < r) r = n - r;\n if (r == 0) return 1;\n if (r == 1) return n;\n int[] numer = new int[r], denom = new int[r];\n for (int k = 0; k < r; k++) { numer[k] = n - r + k + 1; denom[k] = k + 1; }\n for (int p = 2; p <= r; p++)\n {\n int piv = denom[p - 1];\n if (piv > 1)\n {\n int ofst = (n - r) % p;\n for (int k = p - 1; k < r; k += p) { numer[k - ofst] /= piv; denom[k] /= piv; }\n }\n }\n long ret = 1;\n for (int k = 0; k < r; k++) if (numer[k] > 1) ret = ret * numer[k] % Mod;\n return ret;\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n string[] s = new string[n];\n int[] values = new int[n];\n \n for(int i=0;i20000)\n {\n if(s[i]==\"North\"||s[i]==\"South\"){\n sum =1;\n break;}\n }\n if(s[i]==\"South\")\n {\n sum += values[i];\n if(sum>20000)\n break;\n }\n else if(s[i]==\"North\"){\n sum -= values[i];\n if(sum<0)\n break;\n }\n if(i 20000)) { a++; break; }\n else if (Dir[i] == \"North\" && (Meridian - Len[i] < 0)) { a++; break; }\n else if (Dir[i] == \"North\" && (Meridian - Len[i] >= 0)) Meridian -= Len[i];\n if (Meridian != 0 || a != 0) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing static System.Console;\nusing Pair = System.Collections.Generic.KeyValuePair;\n\nclass Program\n{\n static void Main()\n {\n var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };\n SetOut(sw);\n new Program().solve();\n Out.Flush();\n }\n Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 };\n readonly int mod = 1000000007;\n readonly string alfa = \"abcdefghijklmnopqrstuvwxyz\";\n\n\n void solve()\n {\n int posi = 0;\n int n = cin.nextint;\n bool flag = true;\n for (int i = 0; i < n; i++)\n {\n var L = cin.nextint;\n var D = cin.next;\n if (posi == 0 && D != \"South\")\n {\n flag = false;\n }\n else if (posi == 20000 && D != \"North\")\n {\n flag = false;\n }\n\n else if (D == \"South\")\n {\n if (posi + L <= 20000)\n {\n posi += L;\n }\n else\n {\n flag = false;\n }\n }\n else if (D == \"North\")\n {\n if (posi - L >= 0)\n {\n posi -= L;\n }\n else\n {\n flag = false;\n }\n }\n }\n\n if (flag && posi == 0)\n {\n WriteLine(\"YES\");\n }\n else\n {\n WriteLine(\"NO\");\n }\n }\n\n}\n\nclass Scanner\n{\n string[] s; int i;\n char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan { get { return ReadLine().Split(); } }\n public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }\n public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }\n public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint { get { return int.Parse(next); } }\n public long nextlong { get { return long.Parse(next); } }\n public double nextdouble { get { return double.Parse(next); } }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\n// https://codeforces.com/contest/750/problem/B\npublic static class B__\n{\n private static void Solve()\n {\n int n = ReadInt();\n\n int y = 0;\n bool valid = true;\n\n while (n-- > 0)\n {\n int distance = ReadInt();\n string direction = Read();\n\n if (y == 0 && direction != \"South\")\n {\n valid = false;\n break;\n }\n\n if (y == 20000 && direction != \"North\")\n {\n valid = false;\n break;\n }\n\n Move(ref y, distance, direction);\n\n if (y < 0 || y > 20000)\n {\n valid = false;\n break;\n }\n }\n\n if (y != 0)\n valid = false;\n\n Write(valid ? \"YES\" : \"NO\");\n }\n\n private static void Move(ref int y, int distance, string direction)\n {\n if (direction == \"North\")\n {\n y -= distance;\n }\n else if (direction == \"South\")\n {\n y += distance;\n }\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new B__().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem750B\n{\n class Program\n {\n static string Solve(int n)\n {\n int latitude = 0;\n\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n int d = int.Parse(s[0]);\n switch (s[1])\n {\n case \"South\":\n if (latitude == 20000)\n return \"NO\";\n latitude += d;\n if (latitude > 20000)\n return \"NO\";\n\n break;\n case \"North\":\n if (latitude == 0)\n return \"NO\";\n else\n latitude -= d;\n if (latitude < 0)\n return \"NO\";\n\n break;\n default:\n if (latitude == 0 || latitude == 20000)\n return \"NO\";\n break;\n }\n }\n\n return latitude == 0 ? \"YES\" : \"NO\";\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Solve(n));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CF_750B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint length = 0, ts= 0, tn = 0, sc = 0, nc = 0, row_no;\n\t\t\tstring direction, last_direction=\"North\";\n\t\t\tstring[] journey;\n\t\t\tstring res=\"NO\";\n\t\t\tbool valid = false;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tList ls = new List ();\n\t\t\tfor (int a = 0; a < n; a++) \n\t\t\t{\n\t\t\t\tls.Add (Console.ReadLine ());\n\t\t\t}\n\n//\t\t\tforeach (var _ls in ls) {\n//\t\t\t\tConsole.WriteLine(_ls);\n//\t\t\t}\n\n\t\t\tforeach (string row in ls) \n\t\t\t{\n\t\t\t\trow_no = ls.IndexOf (row);\n\t\t\t\tif (row_no == 0) {\n\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t}\n\n\t\t\t\tjourney = row.Split (' ');\n\n\t\t\t\tlength= Int32.Parse(journey [0]);\n\t\t\t\tdirection = journey [1];\n\n\t\t\t\tvalid = is_the_move_legal (n, row_no, last_direction, direction);\n//\t\t\t\tConsole.WriteLine (\"=== VALIDITY: {0}\", valid);\n\n\t\t\t\tif (!valid) {\n\t\t\t\t\tres = \"NO\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (direction == \"North\") {\n\t\t\t\t\tif (length > 20000 || tn+length > 20000 ) {\n\t\t\t\t\t\tres = \"NO\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttn += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_North: {0}\", tn);\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse if (direction == \"South\") {\n\t\t\t\t\tif (length > 20000 || ts+length > 20000 ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tts += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_South: {0}\", ts);\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tn == 20000 && ts == 20000) \n\t\t\t\t{\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t\ttn = ts = 0;\t\n\t\t\t\t}\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && ts == tn) {\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\n\t\t}\n\n\t\tprivate static bool is_the_move_legal(int n, int _row_no, string last_direction, string direction)\n\t\t{\n//\t\t\tConsole.WriteLine (\"Last_Direction: {0}\", last_direction);\n//\t\t\tConsole.WriteLine (\"Current_Direction: {0}\", direction);\n\n\t\t\tif (_row_no == 0 && direction != \"South\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (_row_no == n - 1 && direction != \"North\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"South\" && direction != \"North\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"North\" && direction != \"South\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf750_02\n{\n const int intSizeLine = 20000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static bool violation = false;\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0 && strDirection!=SOUTH)\n {\n violation = true;\n }\n\n if (y == intSizeLine && strDirection != NORTH)\n {\n violation = true;\n }\n\n if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y == 0 && !violation )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n\n switch (strDirection)\n {\n case NORTH:\n if (y - intValue < 0)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y - intValue;\n }\n break;\n\n case SOUTH:\n if (intValue + y > intSizeLine)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1A\n{\n class Program750B\n\n {\n static void Main(string[] args)\n {\n int p = 0;\n\n int n = Convert.ToInt32(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n string[] tk = Console.ReadLine().Split(' ');\n int l = Convert.ToInt32(tk[0]);\n if (p == 0 || p == 20000)\n if (tk[1] == \"East\" || tk[1] == \"West\")\n {\n Console.WriteLine(\"NO\");\n return;\n }\n\n if (tk[1] == \"North\")\n if (p - l < 0)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n p = p - l;\n\n if (tk[1] == \"South\")\n if (p + l > 20000)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n p = p + l;\n }\n\n if (p!=0)\n Console.WriteLine(\"NO\");\n else\n Console.WriteLine(\"YES\");\n\n\n \n }\n }\n}"}, {"source_code": "using System;\n\nnamespace tmp6\n{\n class Program\n {\n\n static int Main()\n {\n int n = int.Parse(Console.ReadLine()), tmp = 0;\n int[] t = new int[n];\n string[] dir = new string[n];\n for(int i = 0; i < n; i++)\n {\n string[] strMas = Console.ReadLine().Split(' ');\n t[i] = int.Parse(strMas[0]);\n dir[i] = strMas[1];\n }\n if (dir[0] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n for (int i = 0; i < n - 1; i++)\n {\n if (dir[i] == \"North\")\n tmp -= t[i];\n else if (dir[i] == \"South\")\n tmp += t[i];\n\n if (tmp == 0)\n {\n if (dir[i + 1] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n else if(tmp < 0)\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n else if (tmp == 20000)\n {\n if (dir[i + 1] != \"North\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n else if(tmp > 20000)\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n }\n if (dir[n - 1] == \"North\")\n tmp -= t[n - 1]; \n else if (dir[n - 1] == \"South\")\n tmp += t[n - 1];\n if (tmp == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n\tclass Problem750B\n\t{\n\t \n\t static private long Move(long y, long distance, string direction) {\n const long minY = 0;\n const long maxY = 20000;\n if(y == minY && direction !=\"South\" ||\n y == maxY && direction !=\"North\"){\n return -1;\n }\n long result = y;\n if (direction == \"South\"){\n result += distance;\n }\n if (direction == \"North\"){\n result -= distance;\n }\n return result > maxY || result < minY ? -1 : result;\n }\n\t \n\t \tstatic void Main() {\n\t\t int stepsCount = int.Parse(Console.In.ReadLine());\n\t\t long y = 0;\n for (int i = 0; i < stepsCount; i++) {\n string[] args = Console.In.ReadLine().Split(' ');\n long distance = long.Parse(args[0]);\n string direction = args[1];\n y = Move(y, distance, direction);\n if (y == -1) {\n break;\n }\n }\n\t\t\tConsole.Out.WriteLine(y == 0 ? \"YES\" : \"NO\");\n\t\t\tConsole.In.ReadLine();\n\t\t}\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing System.Text;\nusing System.Globalization;\nusing System.Diagnostics;\n\nclass Myon\n{\n static Scanner cin;\n public Myon() { }\n public static int Main()\n {\n //Console.SetOut(new Printer(Console.OpenStandardOutput()));\n cin = new Scanner();\n new Myon().calc();\n return 0;\n }\n \n public bool calc2()\n {\n\n int N;\n N = cin.nextInt();\n\n int now = 0;\n int MAX = 20000;\n for (int i = 0; i < N; i++)\n {\n int d = cin.nextInt();\n string v = cin.next();\n if(v == \"North\")\n {\n now -= d;\n if (now < 0) return false;\n }\n else if(v == \"South\")\n {\n now += d;\n if (now > MAX) return false;\n }\n else\n {\n if (now <= 0 || now >= MAX) return false;\n }\n\n }\n return now == 0;\n }\n\n public void calc()\n {\n if (calc2()) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n}\n\nclass Printer : StreamWriter\n{\n public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }\n}\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n while (i >= s.Length)\n {\n string st = Console.ReadLine();\n while (st == \"\") st = Console.ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n }\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n\n static int[,] matrix;\n static int[] mark;\n\n static void DFS(int v)\n {\n\n mark[v] = 1;\n for (int i = 0; i < matrix.GetLength(0); i++)\n {\n\n if (matrix[v, i] == 1)\n {\n\n if (mark[v] == 0)\n {\n DFS(i);\n }\n }\n }\n\n }\n static bool IsPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static void IsYesNo(bool b)\n {\n if (b)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n static void Main(string[] args)\n {\n\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int x = 0;\n bool f = true;\n for (int i = 0; i < n; i++)\n {\n //Console.WriteLine(x);\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n if (x == 0)\n {\n if (s[1] != \"South\")\n {\n f = false;\n }\n else\n {\n \n x += a;\n if (x > 20000)\n {\n f = false;\n }\n \n }\n }\n else if (x == 20000)\n {\n if (s[1] != \"North\")\n {\n f = false;\n }\n else\n {\n \n x -= a;\n if (x < 0)\n {\n f = false;\n }\n \n }\n }\n else\n {\n if (s[1] == \"South\")\n {\n \n x += a;\n if (x > 20000)\n {\n f = false;\n }\n \n }\n else if (s[1] == \"North\")\n {\n \n x -= a;\n if (x < 0)\n {\n f = false;\n }\n }\n\n }\n \n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if (x == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n }\n\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Solution\n{\n\tstatic void Main() {\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tint y = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tstring[] parts = Console.ReadLine ().Split ();\n\t\t\tint dist = int.Parse (parts [0]);\n\t\t\tswitch (parts [1]) {\n\t\t\tcase \"North\":\n\t\t\t\tif (y == 0) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ty -= dist;\n\t\t\t\tbreak;\n\t\t\tcase \"South\":\n\t\t\t\tif (y == 20000) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ty += dist;\n\t\t\t\tbreak;\n\t\t\tcase \"East\":\n\t\t\tcase \"West\":\n\t\t\t\tif (y == 0 || y == 20000) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (y < 0 || y > 20000) {\n\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (y == 0 ? \"YES\" : \"NO\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\n public class Helper\n {\n public List Helpers { get; set; }\n public string From { get; set; }\n public List To { get; set; }\n\n\n public void Load()\n {\n Helpers = new List();\n\n Helper North = new Helper();\n North.From = \"North\";\n North.To = new List();\n North.To.Add(\"South_x_+\");\n North.To.Add(\"North_x_-\");\n\n North.To.Add(\"West_y_+\");\n North.To.Add(\"East_y_-\");\n\n Helpers.Add(North);\n\n Helper South = new Helper();\n South.From = \"South\";\n South.To = new List();\n\n South.To.Add(\"North_x_-\");\n South.To.Add(\"South_x_+\");\n\n South.To.Add(\"East_y_-\");\n South.To.Add(\"West_y_+\");\n\n Helpers.Add(South);\n\n\n Helper West = new Helper();\n West.From = \"West\";\n West.To = new List();\n West.To.Add(\"South_x_+\");\n West.To.Add(\"North_x_-\");\n\n West.To.Add(\"East_y_-\");\n West.To.Add(\"West_y_+\");\n\n Helpers.Add(West);\n\n Helper East = new Helper();\n East.From = \"East\";\n East.To = new List();\n East.To.Add(\"South_x_+\");\n East.To.Add(\"North_x_-\");\n\n\n East.To.Add(\"West_y_+\");\n East.To.Add(\"East_y_-\");\n\n Helpers.Add(East);\n\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n\n List lines = new List();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n\n lines.Add(inputs);\n\n\n }\n\n Helper helper = new Helper();\n helper.Load();\n\n long x = 0;\n long y = 0;\n\n var CurrentPosition = \"North\";\n\n var satisfy = true;\n\n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n\n var anyDirection = helper.Helpers.FirstOrDefault(f => f.From == CurrentPosition);\n\n var toDirection = anyDirection.To.FirstOrDefault(z => z.Split('_')[0] == dir);\n\n var toDI = toDirection.Split('_');\n\n if (x == 0)\n {\n\n if (toDI[0] != \"South\")\n {\n satisfy = false;\n break;\n }\n\n }\n\n if (x == 20000)\n {\n if (toDI[0] != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n \n \n\n if (toDirection == null)\n {\n\n satisfy = false;\n break;\n }\n else\n {\n\n\n if (toDI[1] == \"x\")\n {\n if (toDI[2] == \"+\")\n {\n x += km;\n }\n else\n {\n x -= km;\n }\n }\n else\n {\n if (toDI[2] == \"+\")\n {\n y += km;\n }\n else\n {\n y -= km;\n }\n }\n }\n if(x>20000||x<0){\n \tsatisfy=false;\n \tbreak;\n \t\n } \n\n CurrentPosition = dir;\n }\n\n\n if (satisfy && CurrentPosition == \"North\" && x <= 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n\n if (front == to)\n {\n return true;\n }\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n\n Dictionary> graph = new Dictionary>();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n\n var ins = GetStringInputsFromLine();\n\n var isRoute = Bfs(graph, ins[0], ins[1]);\n\n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Source\n{\n \n public void Program()\n {\n\n }\n HashSet answers = new HashSet();\n int n;\n int[] a;\n void Read()\n {\n n = ri();\n int a;\n string s;\n int pos = 0;\n for (int i = 0; i < n; i++)\n {\n a = ri();\n s = ReadToken();\n if(s== \"North\" || s == \"South\")\n {\n if (s == \"South\")\n {\n pos += a;\n }\n else\n pos -= a;\n if(pos<0||pos>20000)\n {\n writeLine(\"NO\");\n return;\n }\n }else\n {\n if(a>0 &&(pos == 0 || pos == 20000))\n {\n writeLine(\"NO\");\n return;\n }\n }\n }\n if(pos == 0)\n {\n writeLine(\"YES\");\n return;\n }\n writeLine(\"NO\");\n return;\n }\n\n #region hide it\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n var source = new Source();\n source.Read();\n source.Program();\n\n /* try\n {\n new Source().Program();\n }\n catch (Exception ex)\n {\n #if DEBUG\n Console.WriteLine(ex);\n #else\n throw;\n #endif\n }*/\n reader.Close();\n writer.Close();\n }\n\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n public static int ri() { return int.Parse(ReadToken()); }\n public static char ReadChar() { return char.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static ulong ReaduLong() { return ulong.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(i => int.Parse(i)).ToArray(); }\n public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }\n public static char[] SplitToChar() { string s = ReadToken(); char[] r = new char[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = s[i]; return r; }\n public static byte[] SplitToByte() { string s = ReadToken(); byte[] r = new byte[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = (byte)s[i]; return r; }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void write(T value) { writer.Write(value); }\n public static void writeLine(T value) { writer.WriteLine(value); }\n public static void writeArray(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }\n public static void writeMatrix(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write(\"\\n\"); } }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n #region Methods\n #region DSU\n public void MakeSet(int[] poi)\n {\n for (int i = 0; i < poi.Length; i++)\n {\n poi[i] = i;\n }\n }\n public int Find(int x, int[] poi)\n {\n if (poi[x] == x) return x;\n return poi[x] = Find(poi[x], poi);\n }\n Random rand = new Random();\n public void Unite(int x, int y, int[] poi)\n {\n y = Find(y, poi);\n x = Find(x, poi);\n if (rand.Next() % 2 == 0)\n Swap(ref x, ref y);\n poi[x] = y;\n }\n #endregion\n\n class Deque\n {\n T[] array;\n int start, length;\n public Deque()\n {\n start = 0; length = 0; array = new T[1];\n }\n public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }\n int last { get { return (start + length) % array.Length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u0081\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac\u00c3\n /// \n public T PeekFirst()\n {\n return array[start];\n }\n public int Count { get { return length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00ba\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00be\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n public T PeekLsat()\n {\n return array[last];\n }\n public T PopLast()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n return array[last];\n }\n public T PopFirst()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n if (start >= array.Length - 1) start = 0; else start++;\n return array[start - 1 < 0 ? array.Length - 1 : start - 1];\n }\n public void AddFirst(T value)\n {\n IncreaseAndInspection();\n if (start <= 0) start = array.Length - 1; else start--;\n array[start] = value;\n length++;\n }\n public void AddLast(T value)\n {\n IncreaseAndInspection();\n array[last] = value;\n length++;\n }\n bool overflow { get { return length == array.Length; } }\n void IncreaseAndInspection()\n {\n if (overflow)\n increase();\n\n }\n void increase()\n {\n T[] array2 = new T[array.Length * 2];\n for (int i = 0; i < array.Length; i++)\n {\n int pos = (start + i) % array.Length;\n array2[i] = array[pos];\n }\n array = array2;\n start = 0;\n array2 = null;\n }\n public void Clear()\n {\n start = 0; length = 0; array = new T[1];\n }\n }\n class Heap\n {\n Comparison ic;\n List storage = new List();\n public Heap(Comparison ic)\n {\n this.ic = ic;\n }\n public void Add(T element)\n {\n storage.Add(element);\n int pos = storage.Count - 1;\n while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)\n {\n Swap(storage, pos, ((int)(pos - 1) / 2));\n pos = ((int)(pos - 1) / 2);\n }\n }\n public T Pop()\n {\n T t = storage[0];\n Swap(storage, 0, storage.Count - 1);\n int pos = 0;\n storage.RemoveAt(storage.Count - 1);\n if (Count > 0)\n while (true)\n {\n T my = storage[pos];\n if (pos * 2 + 1 >= Count)\n break;\n T left = storage[pos * 2 + 1];\n if (pos * 2 + 2 >= Count)\n {\n if (ic(left, my) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n break;\n }\n T right = storage[pos * 2 + 2];\n if (ic(left, my) < 0 || ic(right, my) < 0)\n {\n if (ic(left, right) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n else\n {\n\n Swap(storage, pos, pos * 2 + 2);\n pos = pos * 2 + 2;\n }\n }\n else break;\n }\n return t;\n }\n\n public void Clear()\n {\n storage.Clear();\n }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n /// \n public T Peek()\n {\n return storage[0];\n }\n public int Count\n {\n get { return storage.Count; }\n }\n //void RemoveLast, Size, peeklast, add\n }\n static void Swap(ref T lhs, ref T rhs)\n {\n T temp;\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n static void Swap(T[] a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n static void Swap(List a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n\n bool outregion(long y, long x, long n, long m)\n {\n if (x < 0 || x >= m || y < 0 || y >= n)\n return true;\n return false;\n }\n static void initlist(ref List[] list, int n)\n {\n list = new List[n];\n for (int i = 0; i < n; i++)\n list[i] = new List();\n }\n static void newarray(ref T[][] array, int n, int m)\n {\n array = new T[n][];\n for (int i = 0; i < n; i++)\n array[i] = new T[m];\n }\n static void newarray(ref T[] array, int n)\n {\n array = new T[n];\n }\n static void fill(T[] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n array[i] = value;\n }\n static void fill(T[][] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n for (int j = 0; j < array[i].Length; j++)\n array[i][j] = value;\n }\n public bool NextPermutation(T[] b, Comparison ic)\n {\n for (int j = b.Length - 2; j >= 0; j--)\n {\n if (ic(b[j], b[j + 1]) < 0)\n {\n for (int l = b.Length - 1; l >= 0; l--)\n {\n if (ic(b[l], b[j]) > 0)\n {\n Swap(b, j, l);\n Array.Reverse(b, j + 1, b.Length - (j + 1));\n return true;\n }\n }\n }\n }\n return false;\n }\n int[,] step8 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n {1,1 },\n {-1,1 },\n {-1,-1 },\n {1,-1 },\n };\n int[,] step4 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n };\n struct Vector2\n {\n public double x;\n public double y;\n public Vector2(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n public double Dist(Vector2 to)\n {\n return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));\n }\n public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }\n public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }\n }\n #endregion\n #endregion\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class B__\n{\n private static void Solve()\n {\n int n = ReadInt();\n\n int x = 0;\n int y = 0;\n bool valid = true;\n\n while (n-- > 0)\n {\n int distance = ReadInt();\n string direction = Read();\n\n if (y == 0 && direction != \"South\")\n {\n valid = false;\n break;\n }\n\n if (y == 20000 && direction != \"North\")\n {\n valid = false;\n break;\n }\n\n Move(ref x, ref y, distance, direction);\n\n if (y < 0 || y > 20000)\n {\n valid = false;\n break;\n }\n }\n\n if (y != 0)\n valid = false;\n\n Write(valid ? \"YES\" : \"NO\");\n }\n\n private static void Move(ref int x, ref int y, int distance, string direction)\n {\n if (direction == \"North\")\n {\n y -= distance;\n }\n else if (direction == \"South\")\n {\n y += distance;\n }\n else if (direction == \"East\")\n {\n x += distance;\n }\n else if (direction == \"West\")\n {\n x -= distance;\n }\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new B__().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\n public class Helper\n {\n public List Helpers { get; set; }\n public string From { get; set; }\n public List To { get; set; }\n\n\n public void Load()\n {\n Helpers = new List();\n\n Helper North = new Helper();\n North.From = \"North\";\n North.To = new List();\n North.To.Add(\"South_x_+\");\n North.To.Add(\"North_x_-\");\n\n North.To.Add(\"West_y_+\");\n North.To.Add(\"East_y_-\");\n\n Helpers.Add(North);\n\n Helper South = new Helper();\n South.From = \"South\";\n South.To = new List();\n\n South.To.Add(\"North_x_-\");\n South.To.Add(\"South_x_+\");\n\n South.To.Add(\"East_y_-\");\n South.To.Add(\"West_y_+\");\n\n Helpers.Add(South);\n\n\n Helper West = new Helper();\n West.From = \"West\";\n West.To = new List();\n West.To.Add(\"South_x_+\");\n West.To.Add(\"North_x_-\");\n\n West.To.Add(\"East_y_-\");\n West.To.Add(\"West_y_+\");\n\n Helpers.Add(West);\n\n Helper East = new Helper();\n East.From = \"East\";\n East.To = new List();\n East.To.Add(\"South_x_+\");\n East.To.Add(\"North_x_-\");\n\n\n East.To.Add(\"West_y_+\");\n East.To.Add(\"East_y_-\");\n\n Helpers.Add(East);\n\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n\n List lines = new List();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n\n lines.Add(inputs);\n\n\n }\n\n Helper helper = new Helper();\n helper.Load();\n\n long x = 0;\n long y = 0;\n\n var CurrentPosition = \"North\";\n\n var satisfy = true;\n\n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n\n var anyDirection = helper.Helpers.FirstOrDefault(f => f.From == CurrentPosition);\n\n var toDirection = anyDirection.To.FirstOrDefault(z => z.Split('_')[0] == dir);\n\n var toDI = toDirection.Split('_');\n\n if (x == 0)\n {\n\n if (toDI[0] != \"South\")\n {\n satisfy = false;\n break;\n }\n\n }\n\n if (x == 20000)\n {\n if (toDI[0] != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n\n if (toDirection == null)\n {\n\n satisfy = false;\n break;\n }\n else\n {\n\n\n if (toDI[1] == \"x\")\n {\n if (toDI[2] == \"+\")\n {\n x += km;\n }\n else\n {\n x -= km;\n }\n }\n else\n {\n if (toDI[2] == \"+\")\n {\n y += km;\n }\n else\n {\n y -= km;\n }\n }\n }\n\n if (x < 0)\n {\n\n satisfy = false;\n break;\n\n\n }\n\n if (x > 20000)\n {\n\n satisfy = false;\n break;\n\n }\n\n CurrentPosition = dir;\n }\n\n\n if (satisfy && CurrentPosition == \"North\" && x == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n\n if (front == to)\n {\n return true;\n }\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n\n Dictionary> graph = new Dictionary>();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n\n var ins = GetStringInputsFromLine();\n\n var isRoute = Bfs(graph, ins[0], ins[1]);\n\n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n\n List lines = new List();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n\n lines.Add(inputs);\n\n\n }\n\n long x = 0;\n long y = 0;\n\n var CurrentPosition = \"North\";\n\n var satisfy = true;\n\n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n\n if (x == 0)\n {\n\n if (dir != \"South\")\n {\n satisfy = false;\n break;\n }\n\n }\n\n if (x == 20000)\n {\n if (dir != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n\n\n\n if (dir == \"South\")\n {\n\n x += km;\n\n }\n else if (dir == \"North\")\n {\n\n x -= km;\n\n }\n\n\n if (x < 0)\n {\n\n satisfy = false;\n break;\n\n\n }\n\n if (x > 20000)\n {\n\n satisfy = false;\n break;\n\n }\n\n CurrentPosition = dir;\n }\n\n\n if (satisfy && CurrentPosition == \"North\" && x == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n\n if (front == to)\n {\n return true;\n }\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n\n Dictionary> graph = new Dictionary>();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n\n var ins = GetStringInputsFromLine();\n\n var isRoute = Bfs(graph, ins[0], ins[1]);\n\n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) / 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tpublic static Dictionary mp = new Dictionary(); \n\t\tpublic static long Go(long u, long v, long w)\n\t\t{\n\t\t\tlong ans = 0; \n\t\t\twhile (u != v)\n\t\t\t\tif (u > v)\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(u))\n\t\t\t\t\t\tmp.Add(u, 0);\n\t\t\t\t\tans += mp[u];\n\t\t\t\t\tmp[u] += w;\n\t\t\t\t\tu /= 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!mp.ContainsKey(v))\n\t\t\t\t\t\tmp.Add(v, 0);\n\t\t\t\t\tans += mp[v];\n\t\t\t\t\tmp[v] += w;\n\t\t\t\t\tv /= 2;\n\t\t\t\t} \n\t\t\treturn ans;\n\t\t}\n\n\t\tpublic static int GetAns(int x, int pow)\n\t\t{\n\t\t\tif (pow == 0)\n\t\t\t\treturn 1;\n\t\t\tif (pow % 2 == 1)\n\t\t\t\treturn (GetAns(x, pow - 1) * 8) % 10;\n\t\t\tvar t = GetAns(x, pow / 2);\n\t\t\treturn (t * t) % 10;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar n = ReadInt();\n\t\t\tvar dist = 0;\n\t\t\tfor (var i = 0; i < n; ++i)\n\t\t\t{\n\t\t\t\tvar s = ReadString().Split(' ');\n\t\t\t\tvar t = int.Parse(s[0]);\n\t\t\t\tif (s[1] == \"East\" || s[1] == \"West\")\n\t\t\t\t{\n\t\t\t\t\tif (dist == 0 || dist == 20000)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (s[1] == \"North\")\n\t\t\t\t\tdist -= t;\n\t\t\t\tif (s[1] == \"South\")\n\t\t\t\t\tdist += t;\n\t\t\t\tif (dist < 0 || dist > 20000)\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tWriteYesNo(dist == 0);\n\t\t\tConsole.ReadLine();\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n public class _750B\n {\n public static void Main()\n {\n bool valid = true;\n int position = 0;\n\n for (int n = int.Parse(Console.ReadLine()); n > 0; n--)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int t = int.Parse(tokens[0]);\n string direction = tokens[1];\n\n if (position == 0 && direction != \"South\")\n {\n valid = false;\n }\n\n if (position == 20000 && direction != \"Norht\")\n {\n valid = false;\n }\n\n switch (direction)\n {\n case \"South\":\n position += t;\n break;\n case \"North\":\n position -= t;\n break;\n }\n\n if (position < 0 || position > 20000)\n {\n valid = false;\n }\n }\n\n valid &= position == 0;\n\n Console.WriteLine(valid ? \"YES\" : \"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication14\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int n = Convert.ToInt32(Console.ReadLine());\n int p=0;\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n int l = Convert.ToInt32(s[0]);\n if ((p == 0 && s[1] != \"South\") || (p == 20000 && s[1] != \"North\"))\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (s[1] == \"South\")\n {\n p += l;\n }\n else if (s[1] == \"North\")\n {\n p -= l;\n }\n \n }\n if (p != 0) Console.WriteLine(\"NO\");\n else Console.WriteLine(\"YES\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool cond = true;\n int n = Int32.Parse(Console.ReadLine());\n int[] dist = new int[n];\n string[] dir = new string[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n dist[i] = Int32.Parse(s[0]);\n dir[i] = s[1];\n }\n if (dir[0] != \"South\")\n {\n cond = false;\n //Console.WriteLine(\"no1\");\n }\n else\n {\n int x = 0;\n for (int i = 0; i < n; i++)\n {\n if (dir[i] == \"South\")\n {\n x += dist[i];\n if (dist[i] > 20000)\n break;\n }\n else if (dir[i] == \"North\")\n {\n x -= dist[i];\n if (dist[i] > 20000)\n break;\n }\n if (x >= 20000)\n {\n if ((i < n - 1) && ((dir[i] == \"South\" && dir[i + 1] != \"North\") || (dir[i] == \"North\" && dir[i + 1] != \"South\")))\n {\n cond = false;\n //Console.WriteLine(\"no2\" + \" \" + i);\n break;\n }\n }\n if (x < 0)\n break;\n }\n if (x != 0)\n cond = false;\n else\n cond = true;\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool cond = true;\n int n = Int32.Parse(Console.ReadLine());\n int[] dist = new int[n];\n string[] dir = new string[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n dist[i] = Int32.Parse(s[0]);\n dir[i] = s[1];\n }\n if (dir[0] != \"South\")\n {\n cond = false;\n //Console.WriteLine(\"no1\");\n }\n else\n {\n int x = 0;\n for (int i = 0; i < n; i++)\n { \n if (dir[i] == \"South\")\n x += dist[i];\n else if (dir[i] == \"North\")\n x -= dist[i];\n if (x >= 20000)\n {\n if ((i < n - 1) && ((dir[i] == \"South\" && dir[i + 1] != \"North\") || (dir[i] == \"North\" && dir[i + 1] != \"South\")))\n {\n cond = false;\n //Console.WriteLine(\"no2\" + \" \" + i);\n break;\n }\n }\n }\n if (x != 0)\n cond = false;\n else\n cond = true;\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool cond = true;\n int n = Int32.Parse(Console.ReadLine());\n int[] dist = new int[n];\n string[] dir = new string[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n dist[i] = Int32.Parse(s[0]);\n dir[i] = s[1];\n }\n if (dir[0] != \"South\")\n {\n cond = false;\n //Console.WriteLine(\"no1\");\n }\n else\n {\n int x = 0;\n for (int i = 0; i < n; i++)\n {\n if (dir[i] == \"South\")\n {\n x += dist[i];\n if (dist[i] > 20000)\n break;\n }\n else if (dir[i] == \"North\")\n {\n x -= dist[i];\n if (dist[i] > 20000)\n break;\n }\n if (x >= 20000)\n {\n if ((i < n - 1) && ((dir[i] == \"South\" && dir[i + 1] != \"North\") || (dir[i] == \"North\" && dir[i + 1] != \"South\")))\n {\n cond = false;\n //Console.WriteLine(\"no2\" + \" \" + i);\n break;\n }\n }\n }\n if (x != 0)\n cond = false;\n else\n cond = true;\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n bool cond = true;\n int n = Int32.Parse(Console.ReadLine());\n int[] dist = new int[n];\n string[] dir = new string[n];\n for (int i = 0; i < n; i++)\n {\n string[] s = Console.ReadLine().Split(' ');\n dist[i] = Int32.Parse(s[0]);\n dir[i] = s[1];\n }\n if (dir[0] != \"South\")\n {\n cond = false;\n //Console.WriteLine(\"no1\");\n }\n else\n {\n int x = 0;\n for (int i = 0; i < n; i++)\n {\n if (dir[i] == \"South\")\n {\n x += dist[i];\n if (x > 20000 || x < 0)\n break;\n }\n else if (dir[i] == \"North\")\n {\n x -= dist[i];\n if (x > 20000 || x < 0)\n break;\n }\n if (x >= 20000)\n {\n if ((i < n - 1) && ((dir[i] == \"South\" && dir[i + 1] != \"North\") || (dir[i] == \"North\" && dir[i + 1] != \"South\")))\n {\n break;\n }\n }\n }\n if (x != 0)\n cond = false;\n else\n cond = true;\n }\n if (cond)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n class A\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n \n string[] s = new string[n];\n int[] values = new int[n];\n \n for(int i=0;i20000)\n {\n sum =1;\n break;\n }\n if(s[i]==\"South\")\n {\n sum += values[i];\n }\n else if(s[i]==\"North\"){\n sum -= values[i];\n if(sum<0)\n break;\n }\n if(i20000)\n {\n if(s[i]==\"North\"||s[i]==\"South\"){\n sum =1;\n break;}\n }\n if(s[i]==\"South\")\n {\n sum += values[i];\n }\n else if(s[i]==\"North\"){\n sum -= values[i];\n if(sum<0)\n break;\n }\n if(i 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint[] dir = new int[n];\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\tbool ret2 = true;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tdir[i] = Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tdir[i] -= Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\telse if ((temp[1] == \"East\" || temp[1] == \"West\") && (sum == 0 || sum == 20000)) {\n\t\t\t\t\tbreak;\n\t\t\t\t\tret2 = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Console.WriteLine(sum);\n\t\t\t\tif (sum < 0 || sum > 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0 && ret2) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\tbool ret2 = true;\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tsum += Int32.Parse(temp[0]);\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tsum -= Int32.Parse(temp[0]);\n\t\t\t\t}\n\t\t\t\telse if (sum == 0 || sum == 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t\tret2 = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Console.WriteLine(sum);\n\t\t\t\tif (sum < 0 || sum > 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0 && ret2) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint[] dir = new int[n];\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tdir[i] = Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tdir[i] -= Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (sum < 0 || sum >= 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint[] dir = new int[n];\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tdir[i] = Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tdir[i] -= Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Console.WriteLine(sum);\n\t\t\t\tif (sum < 0 || sum > 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "using System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace NSproul //B\n{\n class Program\n {\n static void Main()\n {\n\t\t\tint n = Int32.Parse(Console.ReadLine());\n\t\t\tint[] dir = new int[n];\n\t\t\tint sum = 0;\n\t\t\tstring ret = \"NO\";\n\t\t\t\n\t\t\tfor (int i = 0; i < n; i++)\n {\n string[] temp = Console.ReadLine().Split();\n\t\t\t\tif (temp[1] == \"South\") {\n\t\t\t\t\tdir[i] = Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\telse if (temp[1] == \"North\") {\n\t\t\t\t\tdir[i] -= Int32.Parse(temp[0]);\n\t\t\t\t\tsum += dir[i];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (sum < 0 || sum > 20000) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n }\n\t\t\t\n if (sum == 0) ret = \"YES\";\n Console.WriteLine(ret);\n }\n }\n} "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace CP_CS\n{\n\n class Task\n {\n\n static void Solve()\n {\n int n = ReadInt();\n int vert = 0;\n for (int i = 0; i < n; i++)\n {\n int dl = ReadInt();\n string dir = ReadToken();\n if (vert == 0)\n {\n if (dir != \"South\")\n {\n Write(\"NO\");\n return;\n }\n }\n if (vert == 20000)\n {\n if (dir != \"North\")\n {\n Write(\"NO\");\n return;\n }\n }\n if (dir == \"North\")\n {\n vert -= dl;\n }\n if (dir == \"South\")\n {\n vert += dl;\n }\n }\n if (vert == 0)\n {\n Write(\"YES\");\n }\n else\n {\n Write(\"NO\");\n }\n }\n\n public static double Rast(int[] xy1, int[] xy2)\n {\n return Math.Sqrt(Math.Pow(xy1[0] - xy2[0], 2) + Math.Pow(xy1[1] - xy2[1], 2));\n }\n\n static string[] Split(string str, int chunkSize)\n {\n return Enumerable.Range(0, str.Length / chunkSize)\n .Select(i => str.Substring(i * chunkSize, chunkSize)).ToArray();\n }\n\n #region -- Main -- \n\n private static TextReader reader;\n private static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"pluses.in\");\n //writer = new StreamWriter(\"pluses.out\");\n#endif\n try\n {\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n Solve();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n #region -- Read / Write --\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] ReadAndSplitLine(char divisor)\n {\n return reader.ReadLine().Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n //public static BigInteger ReadBigInteger()\n //{\n // return BigInteger.Parse(ReadToken());\n //}\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static bool[] ReadBoolArray()\n {\n return ReadAndSplitLine().ToString().ToCharArray().Select(chr => chr == '1').ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static bool[][] ReadBoolMatrix(int numberOfRows)\n {\n bool[][] matrix = new bool[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadBoolArray();\n return matrix;\n }\n\n public static bool[][] TransposeBoolMatrix(bool[][] array, int numberOfRows)\n {\n bool[][] matrix = array;\n bool[][] ret = new bool[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new bool[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size];\n for (int i = 0; i < size; i++) ret[i] = new T();\n return ret;\n }\n #endregion\n }\n}\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private bool Calc()\n {\n var n = int.Parse(Console.ReadLine());\n int now = 0;\n int MAX = 20000;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n int d = int.Parse(s[0]);\n string v = s[1];\n if (v == \"North\")\n {\n now -= d;\n if (now < 0) return false;\n }\n else if (v == \"South\")\n {\n now += d;\n if (now > MAX) return false;\n }\n //else\n //{\n // if (now <= 0 || now >= MAX) return false;\n //}\n\n }\n return now == 0;\n }\n\n private void Solve()\n {\n\n if (Calc()) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n bool isNorth = true;\n bool isSouth = false;\n int y = 0;\n bool ans = false;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n string dir = s[1];\n int coords = int.Parse(s[0]);\n if (isNorth)\n {\n if (dir != \"South\")\n {\n //ans = false;\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else if (isSouth)\n {\n if (dir != \"North\")\n {\n //ans = false;\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (dir == \"North\")\n {\n y += (coords % 40000);\n y = y%40000;\n }\n\n else if (dir == \"South\")\n {\n y -= (coords % 40000);\n y = y%40000;\n }\n \n if (y == 0)\n isNorth = true;\n else\n {\n isNorth = false;\n }\n if (y == -20000)\n isSouth = true;\n else\n {\n isSouth = false;\n }\n }\n\n ans = y == 0;\n if(ans)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n bool isNorth = true;\n bool isSouth = false;\n int y = 0;\n bool ans = false;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n string dir = s[1];\n int coords = int.Parse(s[0]);\n if (isNorth)\n {\n if (dir != \"South\")\n {\n ans = false;\n Console.WriteLine(\"NO\");\n return;\n }\n }\n else if (isSouth)\n {\n if (dir != \"North\")\n {\n ans = false;\n Console.WriteLine(\"NO\");\n return;\n }\n }\n if (dir == \"North\")\n y += coords;\n else if (dir == \"South\")\n y -= coords;\n if (y == 0)\n isNorth = true;\n else\n {\n isNorth = false;\n }\n if (y == -20000)\n isSouth = true;\n else\n {\n isSouth = false;\n }\n }\n\n ans = y == 0;\n if(ans)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": " using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n bool isNorth = true;\n bool isSouth = false;\n int y = 0;\n bool ans = false;\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n string dir = s[1];\n int coords = int.Parse(s[0]);\n if (isNorth)\n {\n if (dir != \"South\")\n {\n ans = false;\n break;\n }\n }\n else if (isSouth)\n {\n if (dir != \"North\")\n {\n ans = false;\n break;\n }\n }\n if (dir == \"North\")\n y += coords;\n else if (dir == \"South\")\n y -= coords;\n if (y == 0)\n isNorth = true;\n else\n {\n isNorth = false;\n }\n if (y == 20000)\n isSouth = true;\n else\n {\n isSouth = false;\n }\n }\n\n ans = y == 0;\n if(ans)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n \n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n //Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n"}, {"source_code": "using System;\n\nnamespace Self\n{\n class Program\n {\n static void Main(string[] args)\n {\n int MovAmm = int.Parse(Console.ReadLine());\n int VertPos = 0;\n bool Check = true;\n string[] MovData = new string[MovAmm];\n for (int i = 0; i < MovAmm; i++)\n {\n MovData[i] = Console.ReadLine();\n }\n\n string[] tempArray;\n int tempLength = 0;\n string tempDirect = null;\n for (int i = 0; i < MovAmm; i++)\n {\n tempArray = MovData[i].Split(' ');\n tempLength = int.Parse(tempArray[0]);\n tempDirect = tempArray[1];\n\n if (VertPos == 0) \n {\n if ((tempDirect == \"East\") || (tempDirect == \"West\") || (tempDirect == \"North\"))\n {\n Check = false;\n break;\n }\n else\n {\n VertPos += tempLength;\n }\n }\n else if (VertPos == 20000)\n {\n if ((tempDirect == \"East\") || (tempDirect == \"West\") || (tempDirect == \"South\"))\n {\n Check = false;\n break;\n }\n else\n {\n VertPos -= tempLength;\n }\n }\n else\n {\n if (tempDirect == \"North\")\n {\n if(VertPos < tempLength)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos -= tempLength;\n }\n }\n if (tempDirect == \"South\")\n {\n if (VertPos+tempLength > 20000)\n {\n Check = false;\n break;\n }\n else\n {\n VertPos += tempLength;\n }\n }\n }//\u043a\u043e\u043d\u0435\u0446 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\n }//\u043a\u043e\u043d\u0435\u0446 \u0444\u043e\u0440\u0430\n if (Check)\n {\n if(VertPos == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n else\n Console.WriteLine(\"NO\");\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Test\n{\n class IOHelper : IDisposable\n {\n StreamReader reader;\n StreamWriter writer;\n\n public IOHelper(string inputFile, string outputFile, Encoding encoding)\n {\n StreamReader iReader;\n StreamWriter oWriter;\n if (inputFile == null)\n iReader = new StreamReader(Console.OpenStandardInput(), encoding);\n else\n iReader = new StreamReader(inputFile, encoding);\n\n if (outputFile == null)\n oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);\n else\n oWriter = new StreamWriter(outputFile, false, encoding);\n\n reader = iReader;\n writer = oWriter;\n\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n\n string[] curLine;\n int curTokenIdx;\n\n char[] whiteSpaces = new char[] { ' ', '\\t', '\\r', '\\n' };\n\n public string ReadNextToken()\n {\n if (curTokenIdx >= curLine.Length)\n {\n //Read next line\n string line = reader.ReadLine();\n if (line != null)\n curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);\n else\n curLine = new string[] { };\n curTokenIdx = 0;\n }\n\n if (curTokenIdx >= curLine.Length)\n return null;\n\n return curLine[curTokenIdx++];\n }\n\n public int ReadNextInt()\n {\n return int.Parse(ReadNextToken());\n }\n\n public double ReadNextDouble()\n {\n var nextToken = ReadNextToken();\n var result = 0.0;\n nextToken = nextToken.Replace(\".\", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);\n result = double.Parse(nextToken);\n return result;\n }\n\n public void Write(string stringToWrite)\n {\n writer.Write(stringToWrite);\n }\n\n public void WriteLine(string stringToWrite)\n {\n writer.WriteLine(stringToWrite);\n }\n\n public void WriteLine(double valueToWrite)\n {\n long intPart = (long)valueToWrite;\n double fracPart = valueToWrite - intPart;\n var fracPartStr = fracPart.ToString();\n if (fracPartStr.Length > 1)\n fracPartStr = fracPartStr.Substring(2);\n var strToWrite = string.Format(\"{0}.{1}\", intPart, fracPartStr);\n writer.WriteLine(strToWrite);\n }\n\n public void Dispose()\n {\n try\n {\n if (reader != null)\n {\n reader.Dispose();\n }\n if (writer != null)\n {\n writer.Dispose();\n }\n }\n catch { };\n }\n\n\n public void Flush()\n {\n if (writer != null)\n {\n writer.Flush();\n }\n }\n }\n\n class Program\n {\n protected IOHelper ioHelper;\n\n int n;\n\n public void Solve()\n {\n n = ioHelper.ReadNextInt();\n\n int curNS = 0;\n int curEV = 0;\n\n bool bOK = true;\n\n while(n>0)\n {\n var dist = ioHelper.ReadNextInt();\n var dir = ioHelper.ReadNextToken();\n\n if(dir==\"North\")\n {\n if (curNS == 0)\n curNS = -1;\n else\n curNS -= dist;\n if(curNS<0)\n {\n bOK = false;\n break;\n }\n }\n else if (dir==\"South\")\n {\n if (curNS == 20000)\n curNS++;\n else\n curNS += dist;\n if(curNS>20000)\n {\n bOK = false;\n break;\n }\n }\n n--;\n }\n\n if (curNS != 0)\n bOK = false;\n\n if (bOK)\n ioHelper.WriteLine(\"YES\");\n else\n ioHelper.WriteLine(\"NO\");\n ioHelper.Flush();\n\n //Console.ReadKey();\n }\n\n public Program(string inputFile, string outputFile)\n {\n ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);\n Solve();\n ioHelper.Dispose();\n }\n\n static void Main(string[] args)\n {\n Program myProgram = new Program(null, null);\n }\n }\n}"}, {"source_code": "//750B New Year and North Pole\n\nusing System;\nclass _750B\n{\n\tstatic void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint[] lens=new int[n];\n\t\tstring[] dirs=new string[n];\n\t\tfor(int i=0;i20000)\n\t\t\t\tbreak;\n\t\t\telse if(sum==0)\n\t\t\t\tsum+=lens[i];\n\t\t\telse if(sum==20000)\n\t\t\t\tsum-=lens[i];\n\t\t\telse\n\t\t\t\tif(dirs[i]==\"South\")\n\t\t\t\t\tsum+=lens[i];\n\t\t\t\telse if(dirs[i]==\"North\")\n\t\t\t\t\tsum-=lens[i];\n\t\t}\n\t\tConsole.Write((sum==0)?\"YES\":\"NO\");\n\t}\n}"}, {"source_code": "//750B New Year and North Pole\n\nusing System;\nclass _750B\n{\n\tstatic void Main()\n\t{\n\t\tint n=int.Parse(Console.ReadLine());\n\t\tint[] lens=new int[n];\n\t\tstring[] dirs=new string[n];\n\t\tfor(int i=0;i 20000)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(d == 0 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == 'N')\n return -1;\n if (c == 'E')\n return 0;\n if (c == 'W')\n return 0;\n if (c == 'S')\n return 1;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_and_North_Pole\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n var t = new int[n];\n var dir = new int[n];\n for (int i = 0; i < n; i++)\n {\n t[i] = Next();\n dir[i] = Next();\n }\n\n int d = 0;\n\n for (int i = 0; i < n; i++)\n {\n d += t[i]*dir[i];\n if (d < 0 || d > 40000)\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(d == 0 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == 'N')\n return -1;\n if (c == 'E')\n return 0;\n if (c == 'W')\n return 0;\n if (c == 'S')\n return 1;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n directionToSouth = directionToSouth - steps[i];\n }\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0 || toSouth > 20000)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directionToSouth == 0 && directions[i+1] != \"South\")\n {\n rightWay = false;\n break;\n }\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0 || directionToSouth > 20000)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0 || directionToSouth > 20000)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay = false;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n if (steps[i] > 20000)\n {\n rightWay = false;\n break;\n }\n directionToSouth = directionToSouth - steps[i];\n }\n\n if (directionToSouth < 0)\n {\n rightWay = false;\n break;\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n }\n\n \n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace New_Year_and_North_Pole\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n List inputs = new List();\n List steps = new List();\n List directions = new List();\n string[] tempString = new string[2];\n int directionToSouth = 0;\n bool rightWay;\n bool fromSouth = true;\n int toSouth = 0;\n\n for (int i = 0; i < n; i++)\n {\n inputs.Add(Console.ReadLine());\n tempString = inputs[i].Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);\n steps.Add(Convert.ToInt32(tempString[0]));\n directions.Add(tempString[1]);\n }\n\n for (int i = 0; i < n; i++)\n {\n if (directions[i] == \"South\")\n {\n directionToSouth = directionToSouth + steps[i];\n toSouth = toSouth + steps[i];\n if (i != n - 1)\n {\n if (toSouth == 20000 && directions[i + 1] != \"North\")\n {\n fromSouth = false;\n break;\n }\n }\n }\n if (directions[i] == \"North\")\n {\n directionToSouth = directionToSouth - steps[i];\n }\n }\n\n rightWay = directionToSouth == 0 ? true : false;\n\n if (directions[0] != \"South\")\n {\n rightWay = false;\n }\n\n if (fromSouth == false)\n {\n rightWay = false;\n }\n\n if (toSouth > 20000)\n {\n rightWay = false;\n }\n\n string message = rightWay ? \"YES\" : \"NO\";\n Console.Write(message);\n //Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Problem750B\n{\n class Program\n {\n static string Solve(int n)\n {\n int latitude = 0;\n\n for (int i = 0; i < n; i++)\n {\n var s = Console.ReadLine().Split(' ');\n int d = int.Parse(s[0]);\n switch (s[1])\n {\n case \"South\":\n if (latitude == 20000)\n return \"NO\";\n latitude += d;\n if (latitude < 0)\n return \"NO\";\n\n break;\n case \"North\":\n if (latitude == 0)\n return \"NO\";\n else\n latitude -= d;\n if (latitude > 20000)\n return \"NO\";\n\n break;\n default:\n if (latitude == 0 || latitude == 20000)\n return \"NO\";\n break;\n }\n }\n\n return latitude == 0 ? \"YES\" : \"NO\";\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Solve(n));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CF_750B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint length = 0, ts= 0, tn = 0, sc = 0, nc = 0, row_no;\n\t\t\tstring direction, last_direction=\"North\";\n\t\t\tstring[] journey;\n\t\t\tstring res=\"NO\";\n\t\t\tbool valid = false;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tList ls = new List ();\n\t\t\tfor (int a = 0; a < n; a++) \n\t\t\t{\n\t\t\t\tls.Add (Console.ReadLine ());\n\t\t\t}\n\n//\t\t\tforeach (var _ls in ls) {\n//\t\t\t\tConsole.WriteLine(_ls);\n//\t\t\t}\n\n\t\t\tforeach (string row in ls) \n\t\t\t{\n\t\t\t\trow_no = ls.IndexOf (row);\n\t\t\t\tif (row_no == 0) {\n\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t}\n\n\t\t\t\tjourney = row.Split (' ');\n\n\t\t\t\tlength= Int32.Parse(journey [0]);\n\t\t\t\tdirection = journey [1];\n\n\t\t\t\tvalid = is_the_move_legal (n, row_no, last_direction, direction);\n//\t\t\t\tConsole.WriteLine (\"=== VALIDITY: {0}\", valid);\n\n\t\t\t\tif (!valid) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (direction == \"North\") {\n\t\t\t\t\tif (length > 20000 || tn+length > 20000 ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttn += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_North: {0}\", tn);\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse if (direction == \"South\") {\n\t\t\t\t\tif (length > 20000 || ts+length > 20000 ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tts += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_South: {0}\", ts);\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && tn >=1 && ts >= 1 && ts == tn) {\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\n\t\t}\n\n\t\tprivate static bool is_the_move_legal(int n, int _row_no, string last_direction, string direction)\n\t\t{\n//\t\t\tConsole.WriteLine (\"Last_Direction: {0}\", last_direction);\n//\t\t\tConsole.WriteLine (\"Current_Direction: {0}\", direction);\n\n\t\t\tif (_row_no == 0 && direction != \"South\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (_row_no == n - 1 && direction != \"North\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"South\" && direction != \"North\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"North\" && direction != \"South\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CF_750B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint length = 0, ts= 0, tn = 0;\n\t\t\tstring direction, last_direction = \"North\";\n\t\t\tstring[] journey;\n\t\t\tstring res=\"NO\";\n\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tList ls = new List ();\n\t\t\tfor (int a = 0; a < n; a++) \n\t\t\t{\n\t\t\t\tls.Add (Console.ReadLine ());\n\t\t\t}\n\n//\t\t\tforeach (var _ls in ls) {\n//\t\t\t\tConsole.WriteLine(_ls);\n//\t\t\t}\n\n\t\t\tforeach (string row in ls) \n\t\t\t{\n\t\t\t\tjourney = row.Split (' ');\n\n\t\t\t\tlength= Int32.Parse(journey [0]);\n\t\t\t\tdirection = journey [1];\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && direction != \"North\") \n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (last_direction == \"South\" && direction == \"North\") {\n\t\t\t\t\ttn += length;\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (last_direction == \"North\" && direction == \"South\") \n\t\t\t\t{\n\t\t\t\t\tts += length;\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\telse if (last_direction == \"Ignore\" && direction == \"North\") {\n\t\t\t\t\ttn += length;\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse if (last_direction == \"Ignore\" && direction == \"South\") {\n\t\t\t\t\tts += length;\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && ts == tn) {\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\t\t}\n\t\t\t\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CF_750B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint length = 0, ts= 0, tn = 0, sc = 0, nc = 0, row_no;\n\t\t\tstring direction, last_direction=\"North\";\n\t\t\tstring[] journey;\n\t\t\tstring res=\"NO\";\n\t\t\tbool valid = false;\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tList ls = new List ();\n\t\t\tfor (int a = 0; a < n; a++) \n\t\t\t{\n\t\t\t\tls.Add (Console.ReadLine ());\n\t\t\t}\n\n//\t\t\tforeach (var _ls in ls) {\n//\t\t\t\tConsole.WriteLine(_ls);\n//\t\t\t}\n\n\t\t\tforeach (string row in ls) \n\t\t\t{\n\t\t\t\trow_no = ls.IndexOf (row);\n\t\t\t\tif (row_no == 0) {\n\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t}\n\n\t\t\t\tjourney = row.Split (' ');\n\n\t\t\t\tlength= Int32.Parse(journey [0]);\n\t\t\t\tdirection = journey [1];\n\n\t\t\t\tvalid = is_the_move_legal (n, row_no, last_direction, direction);\n//\t\t\t\tConsole.WriteLine (\"=== VALIDITY: {0}\", valid);\n\n\t\t\t\tif (!valid) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (direction == \"North\") {\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttn += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_North: {0}\", tn);\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse if (direction == \"South\") {\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tts += length;\n//\t\t\t\t\tConsole.WriteLine (\"Toward_South: {0}\", ts);\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && tn >=1 && ts >= 1 && ts == tn) {\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\n\t\t}\n\n\t\tprivate static bool is_the_move_legal(int n, int _row_no, string last_direction, string direction)\n\t\t{\n//\t\t\tConsole.WriteLine (\"Last_Direction: {0}\", last_direction);\n//\t\t\tConsole.WriteLine (\"Current_Direction: {0}\", direction);\n\n\t\t\tif (_row_no == 0 && direction != \"South\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (_row_no == n - 1 && direction != \"North\") \n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"South\" && direction != \"North\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (last_direction == \"North\" && direction != \"South\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace CF_750B\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tint length = 0, ts= 0, tn = 0;\n\t\t\tstring direction, last_direction = \"North\";\n\t\t\tstring[] journey;\n\t\t\tstring res=\"NO\";\n\n\t\t\tint n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tList ls = new List ();\n\t\t\tfor (int a = 0; a < n; a++) \n\t\t\t{\n\t\t\t\tls.Add (Console.ReadLine ());\n\t\t\t}\n\n//\t\t\tforeach (var _ls in ls) {\n//\t\t\t\tConsole.WriteLine(_ls);\n//\t\t\t}\n\n\t\t\tforeach (string row in ls) \n\t\t\t{\n\t\t\t\tjourney = row.Split (' ');\n\n\t\t\t\tlength= Int32.Parse(journey [0]);\n\t\t\t\tdirection = journey [1];\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && direction != \"North\") \n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (last_direction == \"South\" && direction == \"North\") {\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttn += length;\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (last_direction == \"North\" && direction == \"South\") \n\t\t\t\t{\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tts += length;\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\telse if (last_direction == \"Ignore\" && direction == \"North\") {\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttn += length;\n\t\t\t\t\tif (tn == 20000) {\n\t\t\t\t\t\tlast_direction = \"North\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\telse if (last_direction == \"Ignore\" && direction == \"South\") {\n\t\t\t\t\tif (length > 20000) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tts += length;\n\t\t\t\t\tif (ts == 20000) {\n\t\t\t\t\t\tlast_direction = \"South\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlast_direction = \"Ignore\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ls.IndexOf (row) == n - 1 && ts == tn) {\n\t\t\t\t\tres = \"YES\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine (res);\n\t\t}\n\t\t\t\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf750_02\n{\n const int intSizeLine = 20000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static bool violation = false;\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (y == intSizeLine)\n {\n y = GetY(intSize, NORTH);\n }\n else if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y == 0 && !violation )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n\n switch (strDirection)\n {\n case NORTH:\n if (y - intValue < 0)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y - intValue;\n }\n break;\n\n case SOUTH:\n if (intValue + y > intSizeLine)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf002\n{\n const int intSizeLine = 20000;\n const int intSizeLine2 = 40000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0)\n {\n y = GetY(intSize, SOUTH);\n }\n else if(y == intSizeLine)\n {\n y = GetY(intSize, NORTH);\n }\n else if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y==0)\n {\n Console.WriteLine(\"YES\");\n }else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n int intLeft = 0;\n\n if (intValue >= intSizeLine2)\n {\n intValue -= (intValue / intSizeLine2) * intSizeLine2;\n }\n\n switch (strDirection)\n {\n case NORTH:\n if (y-intValue<0)\n {\n intLeft = y;\n intValue -= intLeft;\n if (intValue > intSizeLine)\n {\n intValue -= intSizeLine;\n intResult = GetY(intValue, NORTH);\n }\n else\n {\n intResult = intValue;\n }\n }\n else\n {\n intResult = y - intValue;\n }\n\n\n break;\n\n case SOUTH:\n if (intValue+y>intSizeLine)\n {\n intLeft = intSizeLine - y;\n intValue -= intLeft;\n if (intValue > intSizeLine)\n {\n intValue -= intSizeLine;\n intResult = GetY(intValue, SOUTH);\n }\n else\n {\n intResult = intSizeLine - intValue;\n }\n }else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf001\n{\n const int intSizeLine = 20000;\n const int intSizeLine2 = 40000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0)\n {\n y = GetY(intSize, SOUTH);\n }\n else if(y == intSizeLine)\n {\n y = GetY(intSize, NORTH);\n }\n else if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y==0)\n {\n Console.WriteLine(\"YES\");\n }else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n int intLeft = 0;\n\n if (intValue >= intSizeLine2)\n {\n intValue -= (intValue / intSizeLine2) * intSizeLine2;\n }\n\n switch (strDirection)\n {\n case NORTH:\n if (y-intValue<0)\n {\n intLeft = y;\n intValue -= intLeft;\n if (intValue > intSizeLine)\n {\n intValue -= intSizeLine;\n intResult = GetY(intValue, NORTH);\n }\n else\n {\n intResult = intValue;\n }\n }\n else\n {\n intResult = y - intValue;\n }\n\n\n break;\n\n case SOUTH:\n if (intValue+y>intSizeLine)\n {\n intLeft = intSizeLine - y;\n intValue -= intLeft;\n if (intValue > intSizeLine)\n {\n intValue -= intSizeLine;\n intResult = GetY(intValue, SOUTH);\n }\n else\n {\n intResult = intSizeLine - intValue;\n }\n }else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf750_02\n{\n const int intSizeLine = 20000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static bool violation = false;\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (y == intSizeLine)\n {\n y = GetY(intSize, NORTH);\n }\n else if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y == 0 && !violation )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n int intLeft = 0;\n\n if (intValue >= intSizeLine)\n {\n violation = true;\n return intResult;\n }\n\n switch (strDirection)\n {\n case NORTH:\n if (y - intValue < 0)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y - intValue;\n }\n break;\n\n case SOUTH:\n if (intValue + y > intSizeLine)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nclass cf750_02\n{\n const int intSizeLine = 20000;\n const string SOUTH = \"S\";\n const string NORTH = \"N\";\n\n static bool violation = false;\n static int y;\n\n static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n y = 0;\n\n for (int i = 0; i < n; i++)\n {\n string strInfo = Console.ReadLine();\n int intSize = int.Parse(strInfo.Split()[0]);\n string strDirection = strInfo.Split()[1].Substring(0, 1);\n\n if (y == 0)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (y == intSizeLine)\n {\n y = GetY(intSize, NORTH);\n }\n else if (strDirection == SOUTH)\n {\n y = GetY(intSize, SOUTH);\n }\n else if (strDirection == NORTH)\n {\n y = GetY(intSize, NORTH);\n }\n }\n\n if (y == 0 && !violation )\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static int GetY(int intValue, string strDirection)\n {\n int intResult = 0;\n int intLeft = 0;\n\n if (intValue >= intSizeLine)\n {\n violation = true;\n return intResult;\n }\n\n switch (strDirection)\n {\n case NORTH:\n if (y - intValue < 0)\n {\n violation = true;\n return intResult;\n }\n else\n {\n intResult = y - intValue;\n }\n break;\n\n case SOUTH:\n if (intValue + y > intSizeLine)\n {\n violation = true;\n return intResult;\n\n }\n else\n {\n intResult = y + intValue;\n }\n break;\n }\n\n return intResult;\n }\n}\n\n"}, {"source_code": "using System;\n\nnamespace tmp6\n{\n class Program\n {\n\n static int Main()\n {\n int n = int.Parse(Console.ReadLine()), tmp = 0;\n int[] t = new int[n];\n string[] dir = new string[n];\n for(int i = 0; i < n; i++)\n {\n string[] strMas = Console.ReadLine().Split(' ');\n t[i] = int.Parse(strMas[0]);\n dir[i] = strMas[1];\n }\n if (dir[0] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n for (int i = 0; i < n - 1; i++)\n {\n if (dir[i] == \"North\")\n tmp -= t[i];\n else if (dir[i] == \"South\")\n tmp += t[i];\n\n if (tmp == 0)\n {\n if (dir[i + 1] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n else if (tmp == 40000)\n if (dir[i + 1] != \"North\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n }\n if (dir[n - 1] == \"North\")\n tmp -= t[n - 1]; \n else if (dir[n - 1] == \"South\")\n tmp += t[n - 1];\n if (tmp == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace tmp6\n{\n class Program\n {\n\n static int Main()\n {\n int n = int.Parse(Console.ReadLine()), tmp = 0;\n int[] t = new int[n];\n string[] dir = new string[n];\n for(int i = 0; i < n; i++)\n {\n string[] strMas = Console.ReadLine().Split(' ');\n t[i] = int.Parse(strMas[0]);\n dir[i] = strMas[1];\n }\n if (dir[0] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n for (int i = 0; i < n - 1; i++)\n {\n if (dir[i] == \"North\")\n tmp -= t[i];\n else if (dir[i] == \"South\")\n tmp += t[i];\n\n if (tmp == 0)\n {\n if (dir[i + 1] != \"South\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n else if (tmp == 20000)\n if (dir[i + 1] != \"North\")\n {\n Console.WriteLine(\"NO\");\n return 0;\n }\n\n }\n if (dir[n - 1] == \"North\")\n tmp -= t[n - 1]; \n else if (dir[n - 1] == \"South\")\n tmp += t[n - 1];\n if (tmp == 0)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n return 0;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static void WriteLine(int n)\n {\n Console.WriteLine(n);\n }\n static void Main(string[] args)\n {\n\n long n = long.Parse(ReadLine());\n string[] s = new string[n];\n for (int i = 0; i < n; i++)\n {\n s[i] = ReadLine();\n }\n long x = 0;\n long y = 0;\n for (int i = 0; i < n; i++)\n {\n string[] p = s[i].Split();\n long a = long.Parse(p[0]);\n string napr = p[1];\n if (y == 0)\n {\n if (napr != \"South\")\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n y += a;\n // y = y % 20000;\n y = Math.Abs(y);\n continue;\n }\n }\n else if (y == 20000)\n {\n if (napr != \"North\")\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else\n {\n y -= a;\n //y = y % 20000;\n y = Math.Abs(y);\n continue;\n }\n }\n if (napr == \"South\")\n {\n y += a;\n //y = y % 20000;\n y = Math.Abs(y);\n }\n else if (napr == \"North\")\n {\n y -= a;\n // y = y % 20000;\n y = Math.Abs(y);\n }\n else if (napr == \"West\")\n {\n x -= a;\n // x = x % 20000;\n x = Math.Abs(x);\n }\n else if (napr == \"East\")\n {\n x += a;\n // x = x % 20000;\n x = Math.Abs(x);\n }\n\n }\n if (y == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n\n \n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication7\n{\n class Program\n {\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n static void WriteLine(int n)\n {\n Console.WriteLine(n);\n }\n static void Main(string[] args)\n {\n\n long n = long.Parse(ReadLine());\n string[] s = new string[n];\n for (int i = 0; i < n; i++)\n {\n s[i] = ReadLine();\n }\n long x = 0;\n long y = 0;\n for (int i = 0; i < n; i++)\n {\n string[] p = s[i].Split();\n long a = long.Parse(p[0]);\n string napr = p[1];\n if (y == 0)\n {\n y += a;\n y = y % 20000;\n continue;\n\n }\n else if (y == 20000)\n {\n y -= a;\n y = y % 20000;\n continue;\n }\n if (napr == \"South\")\n {\n y += a;\n y = y % 20000;\n }\n else if (napr == \"North\")\n {\n y -= a;\n y = y % 20000;\n }\n else if (napr == \"West\")\n {\n x -= a;\n x = x % 20000;\n }\n else\n {\n x += a;\n x = x % 20000;\n }\n \n\n }\n \n\n if (y == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n\n \n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication2\n{\n\n class Program\n {\n\n static int[,] matrix;\n static int[] mark;\n\n static void DFS(int v)\n {\n\n mark[v] = 1;\n for (int i = 0; i < matrix.GetLength(0); i++)\n {\n\n if (matrix[v, i] == 1)\n {\n\n if (mark[v] == 0)\n {\n DFS(i);\n }\n }\n }\n\n }\n static bool IsPrime(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static void IsYesNo(bool b)\n {\n if (b)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n static void Main(string[] args)\n {\n\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int x = 0;\n bool f = true;\n for (int i = 0; i < n; i++)\n {\n //Console.WriteLine(x);\n string[] s = Console.ReadLine().Split();\n int a = int.Parse(s[0]);\n if (x == 0)\n {\n if (s[1] != \"South\")\n {\n f = false;\n }\n else\n {\n a %= 40000;\n x += a;\n x %= 40000;\n }\n }\n else if (x == 20000)\n {\n if (s[1] != \"North\")\n {\n f = false;\n }\n else\n {\n a %= 40000;\n x -= a;\n x %= 40000;\n }\n }\n else\n {\n if (s[1] == \"South\")\n {\n a %= 40000;\n x += a;\n x %= 40000;\n }\n else if (s[1] == \"North\")\n {\n a %= 40000;\n x -= a;\n x %= 40000;\n }\n\n }\n \n }\n if (!f)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n if (x == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Solution\n{\n\tstatic void Main() {\n\t\tint n = int.Parse (Console.ReadLine ());\n\t\tint y = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tstring[] parts = Console.ReadLine ().Split ();\n\t\t\tint dist = int.Parse (parts [0]);\n\t\t\tswitch (parts [1]) {\n\t\t\tcase \"North\":\n\t\t\t\tif (y == 0) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ty -= dist;\n\t\t\t\tbreak;\n\t\t\tcase \"South\":\n\t\t\t\tif (y == 20000) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ty += dist;\n\t\t\t\tbreak;\n\t\t\tcase \"East\":\n\t\t\tcase \"West\":\n\t\t\t\tif (y == 0 || y == 20000) {\n\t\t\t\t\tConsole.WriteLine (\"NO\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine (y == 0 ? \"YES\" : \"NO\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n \nnamespace A\n{\n \n public class Helper\n {\n public List Helpers { get; set; }\n public string From { get; set; }\n public List To { get; set; }\n \n \n public void Load()\n {\n Helpers = new List();\n \n Helper North = new Helper();\n North.From = \"North\";\n North.To = new List();\n North.To.Add(\"South_x_+\");\n North.To.Add(\"North_x_-\");\n \n North.To.Add(\"West_y_+\");\n North.To.Add(\"East_y_-\");\n \n Helpers.Add(North);\n \n Helper South = new Helper();\n South.From = \"South\";\n South.To = new List();\n \n South.To.Add(\"North_x_-\");\n South.To.Add(\"South_x_+\");\n \n South.To.Add(\"East_y_-\");\n South.To.Add(\"West_y_+\");\n \n Helpers.Add(South);\n \n \n Helper West = new Helper();\n West.From = \"West\";\n West.To = new List();\n West.To.Add(\"South_x_+\");\n West.To.Add(\"North_x_-\");\n \n West.To.Add(\"East_y_-\");\n West.To.Add(\"West_y_+\");\n \n Helpers.Add(West);\n \n Helper East = new Helper();\n East.From = \"East\";\n East.To = new List();\n East.To.Add(\"South_x_+\");\n East.To.Add(\"North_x_-\");\n \n \n East.To.Add(\"West_y_+\");\n East.To.Add(\"East_y_-\");\n \n Helpers.Add(East);\n \n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n \n List lines = new List();\n \n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n \n lines.Add(inputs);\n \n \n }\n \n Helper helper = new Helper();\n helper.Load();\n \n long x = 0;\n long y = 0;\n \n var CurrentPosition = \"North\";\n \n var satisfy = true;\n \n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n \n var anyDirection = helper.Helpers.FirstOrDefault(f => f.From == CurrentPosition);\n \n var toDirection = anyDirection.To.FirstOrDefault(z => z.Split('_')[0] == dir);\n \n var toDI = toDirection.Split('_');\n \n if (x == 0)\n {\n \n if (toDI[0] != \"South\")\n {\n satisfy = false;\n break;\n }\n \n }\n \n if (x == 20000)\n {\n if (toDI[0] != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n \n if(x>20000||x<0){\n \tsatisfy=false;\n \tbreak;\n \n } \n \n if (toDirection == null)\n {\n \n satisfy = false;\n break;\n }\n else\n {\n \n \n if (toDI[1] == \"x\")\n {\n if (toDI[2] == \"+\")\n {\n x += km;\n }\n else\n {\n x -= km;\n }\n }\n else\n {\n if (toDI[2] == \"+\")\n {\n y += km;\n }\n else\n {\n y -= km;\n }\n }\n }\n \n CurrentPosition = dir;\n }\n \n \n if (satisfy && CurrentPosition == \"North\" && x <= 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n \n }\n \n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n \n Queue queue = new Queue();\n \n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n \n if (front == to)\n {\n return true;\n }\n \n List values;\n \n if (graph.TryGetValue(front, out values))\n {\n \n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n \n \n queue.Dequeue();\n \n }\n \n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n \n Dictionary> graph = new Dictionary>();\n \n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n \n var ins = GetStringInputsFromLine();\n \n var isRoute = Bfs(graph, ins[0], ins[1]);\n \n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n \n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n \n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n \n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n \n return dictionary;\n }\n \n \n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n \n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n \n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n \n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n \n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n \n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n \n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n \n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Source\n{\n \n public void Program()\n {\n\n }\n HashSet answers = new HashSet();\n int n;\n int[] a;\n void Read()\n {\n n = ri();\n int a;\n string s;\n int pos = 0;\n for (int i = 0; i < n; i++)\n {\n a = ri();\n s = ReadToken();\n if(s== \"North\" || s == \"South\")\n {\n if (s == \"South\")\n {\n pos += a;\n }\n else\n pos -= a;\n if(pos<0||pos>=20000)\n {\n writeLine(\"NO\");\n return;\n }\n }\n }\n if(pos == 0)\n {\n writeLine(\"YES\");\n return;\n }\n writeLine(\"NO\");\n return;\n }\n\n #region hide it\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n var source = new Source();\n source.Read();\n source.Program();\n\n /* try\n {\n new Source().Program();\n }\n catch (Exception ex)\n {\n #if DEBUG\n Console.WriteLine(ex);\n #else\n throw;\n #endif\n }*/\n reader.Close();\n writer.Close();\n }\n\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n public static int ri() { return int.Parse(ReadToken()); }\n public static char ReadChar() { return char.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static ulong ReaduLong() { return ulong.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(i => int.Parse(i)).ToArray(); }\n public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }\n public static char[] SplitToChar() { string s = ReadToken(); char[] r = new char[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = s[i]; return r; }\n public static byte[] SplitToByte() { string s = ReadToken(); byte[] r = new byte[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = (byte)s[i]; return r; }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void write(T value) { writer.Write(value); }\n public static void writeLine(T value) { writer.WriteLine(value); }\n public static void writeArray(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }\n public static void writeMatrix(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write(\"\\n\"); } }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n #region Methods\n #region DSU\n public void MakeSet(int[] poi)\n {\n for (int i = 0; i < poi.Length; i++)\n {\n poi[i] = i;\n }\n }\n public int Find(int x, int[] poi)\n {\n if (poi[x] == x) return x;\n return poi[x] = Find(poi[x], poi);\n }\n Random rand = new Random();\n public void Unite(int x, int y, int[] poi)\n {\n y = Find(y, poi);\n x = Find(x, poi);\n if (rand.Next() % 2 == 0)\n Swap(ref x, ref y);\n poi[x] = y;\n }\n #endregion\n\n class Deque\n {\n T[] array;\n int start, length;\n public Deque()\n {\n start = 0; length = 0; array = new T[1];\n }\n public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }\n int last { get { return (start + length) % array.Length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u0081\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac\u00c3\n /// \n public T PeekFirst()\n {\n return array[start];\n }\n public int Count { get { return length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00ba\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00be\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n public T PeekLsat()\n {\n return array[last];\n }\n public T PopLast()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n return array[last];\n }\n public T PopFirst()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n if (start >= array.Length - 1) start = 0; else start++;\n return array[start - 1 < 0 ? array.Length - 1 : start - 1];\n }\n public void AddFirst(T value)\n {\n IncreaseAndInspection();\n if (start <= 0) start = array.Length - 1; else start--;\n array[start] = value;\n length++;\n }\n public void AddLast(T value)\n {\n IncreaseAndInspection();\n array[last] = value;\n length++;\n }\n bool overflow { get { return length == array.Length; } }\n void IncreaseAndInspection()\n {\n if (overflow)\n increase();\n\n }\n void increase()\n {\n T[] array2 = new T[array.Length * 2];\n for (int i = 0; i < array.Length; i++)\n {\n int pos = (start + i) % array.Length;\n array2[i] = array[pos];\n }\n array = array2;\n start = 0;\n array2 = null;\n }\n public void Clear()\n {\n start = 0; length = 0; array = new T[1];\n }\n }\n class Heap\n {\n Comparison ic;\n List storage = new List();\n public Heap(Comparison ic)\n {\n this.ic = ic;\n }\n public void Add(T element)\n {\n storage.Add(element);\n int pos = storage.Count - 1;\n while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)\n {\n Swap(storage, pos, ((int)(pos - 1) / 2));\n pos = ((int)(pos - 1) / 2);\n }\n }\n public T Pop()\n {\n T t = storage[0];\n Swap(storage, 0, storage.Count - 1);\n int pos = 0;\n storage.RemoveAt(storage.Count - 1);\n if (Count > 0)\n while (true)\n {\n T my = storage[pos];\n if (pos * 2 + 1 >= Count)\n break;\n T left = storage[pos * 2 + 1];\n if (pos * 2 + 2 >= Count)\n {\n if (ic(left, my) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n break;\n }\n T right = storage[pos * 2 + 2];\n if (ic(left, my) < 0 || ic(right, my) < 0)\n {\n if (ic(left, right) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n else\n {\n\n Swap(storage, pos, pos * 2 + 2);\n pos = pos * 2 + 2;\n }\n }\n else break;\n }\n return t;\n }\n\n public void Clear()\n {\n storage.Clear();\n }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n /// \n public T Peek()\n {\n return storage[0];\n }\n public int Count\n {\n get { return storage.Count; }\n }\n //void RemoveLast, Size, peeklast, add\n }\n static void Swap(ref T lhs, ref T rhs)\n {\n T temp;\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n static void Swap(T[] a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n static void Swap(List a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n\n bool outregion(long y, long x, long n, long m)\n {\n if (x < 0 || x >= m || y < 0 || y >= n)\n return true;\n return false;\n }\n static void initlist(ref List[] list, int n)\n {\n list = new List[n];\n for (int i = 0; i < n; i++)\n list[i] = new List();\n }\n static void newarray(ref T[][] array, int n, int m)\n {\n array = new T[n][];\n for (int i = 0; i < n; i++)\n array[i] = new T[m];\n }\n static void newarray(ref T[] array, int n)\n {\n array = new T[n];\n }\n static void fill(T[] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n array[i] = value;\n }\n static void fill(T[][] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n for (int j = 0; j < array[i].Length; j++)\n array[i][j] = value;\n }\n public bool NextPermutation(T[] b, Comparison ic)\n {\n for (int j = b.Length - 2; j >= 0; j--)\n {\n if (ic(b[j], b[j + 1]) < 0)\n {\n for (int l = b.Length - 1; l >= 0; l--)\n {\n if (ic(b[l], b[j]) > 0)\n {\n Swap(b, j, l);\n Array.Reverse(b, j + 1, b.Length - (j + 1));\n return true;\n }\n }\n }\n }\n return false;\n }\n int[,] step8 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n {1,1 },\n {-1,1 },\n {-1,-1 },\n {1,-1 },\n };\n int[,] step4 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n };\n struct Vector2\n {\n public double x;\n public double y;\n public Vector2(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n public double Dist(Vector2 to)\n {\n return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));\n }\n public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }\n public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }\n }\n #endregion\n #endregion\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Source\n{\n \n public void Program()\n {\n\n }\n HashSet answers = new HashSet();\n int n;\n int[] a;\n void Read()\n {\n n = ri();\n int a;\n string s;\n int pos = 0;\n for (int i = 0; i < n; i++)\n {\n a = ri();\n s = ReadToken();\n if(s== \"North\" || s == \"South\")\n {\n if (s == \"South\")\n {\n pos += a;\n }\n else\n pos -= a;\n if(pos<0||pos>20000)\n {\n writeLine(\"NO\");\n return;\n }\n }\n }\n if(pos == 0)\n {\n writeLine(\"YES\");\n return;\n }\n writeLine(\"NO\");\n return;\n }\n\n #region hide it\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n //reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n var source = new Source();\n source.Read();\n source.Program();\n\n /* try\n {\n new Source().Program();\n }\n catch (Exception ex)\n {\n #if DEBUG\n Console.WriteLine(ex);\n #else\n throw;\n #endif\n }*/\n reader.Close();\n writer.Close();\n }\n\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n public static int ri() { return int.Parse(ReadToken()); }\n public static char ReadChar() { return char.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static ulong ReaduLong() { return ulong.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(i => int.Parse(i)).ToArray(); }\n public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }\n public static char[] SplitToChar() { string s = ReadToken(); char[] r = new char[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = s[i]; return r; }\n public static byte[] SplitToByte() { string s = ReadToken(); byte[] r = new byte[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = (byte)s[i]; return r; }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void write(T value) { writer.Write(value); }\n public static void writeLine(T value) { writer.WriteLine(value); }\n public static void writeArray(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }\n public static void writeMatrix(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write(\"\\n\"); } }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n\n #region Methods\n #region DSU\n public void MakeSet(int[] poi)\n {\n for (int i = 0; i < poi.Length; i++)\n {\n poi[i] = i;\n }\n }\n public int Find(int x, int[] poi)\n {\n if (poi[x] == x) return x;\n return poi[x] = Find(poi[x], poi);\n }\n Random rand = new Random();\n public void Unite(int x, int y, int[] poi)\n {\n y = Find(y, poi);\n x = Find(x, poi);\n if (rand.Next() % 2 == 0)\n Swap(ref x, ref y);\n poi[x] = y;\n }\n #endregion\n\n class Deque\n {\n T[] array;\n int start, length;\n public Deque()\n {\n start = 0; length = 0; array = new T[1];\n }\n public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }\n int last { get { return (start + length) % array.Length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u0081\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac\u00c3\n /// \n public T PeekFirst()\n {\n return array[start];\n }\n public int Count { get { return length; } }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00ba\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00be\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00c2\u00a2\u00c3\u00a2\u00e2\u0080\u009a\u00c2\u00ac \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n public T PeekLsat()\n {\n return array[last];\n }\n public T PopLast()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n return array[last];\n }\n public T PopFirst()\n {\n if (length == 0)\n throw new IndexOutOfRangeException(\"OutOfRange\");\n length--;\n if (start >= array.Length - 1) start = 0; else start++;\n return array[start - 1 < 0 ? array.Length - 1 : start - 1];\n }\n public void AddFirst(T value)\n {\n IncreaseAndInspection();\n if (start <= 0) start = array.Length - 1; else start--;\n array[start] = value;\n length++;\n }\n public void AddLast(T value)\n {\n IncreaseAndInspection();\n array[last] = value;\n length++;\n }\n bool overflow { get { return length == array.Length; } }\n void IncreaseAndInspection()\n {\n if (overflow)\n increase();\n\n }\n void increase()\n {\n T[] array2 = new T[array.Length * 2];\n for (int i = 0; i < array.Length; i++)\n {\n int pos = (start + i) % array.Length;\n array2[i] = array[pos];\n }\n array = array2;\n start = 0;\n array2 = null;\n }\n public void Clear()\n {\n start = 0; length = 0; array = new T[1];\n }\n }\n class Heap\n {\n Comparison ic;\n List storage = new List();\n public Heap(Comparison ic)\n {\n this.ic = ic;\n }\n public void Add(T element)\n {\n storage.Add(element);\n int pos = storage.Count - 1;\n while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)\n {\n Swap(storage, pos, ((int)(pos - 1) / 2));\n pos = ((int)(pos - 1) / 2);\n }\n }\n public T Pop()\n {\n T t = storage[0];\n Swap(storage, 0, storage.Count - 1);\n int pos = 0;\n storage.RemoveAt(storage.Count - 1);\n if (Count > 0)\n while (true)\n {\n T my = storage[pos];\n if (pos * 2 + 1 >= Count)\n break;\n T left = storage[pos * 2 + 1];\n if (pos * 2 + 2 >= Count)\n {\n if (ic(left, my) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n break;\n }\n T right = storage[pos * 2 + 2];\n if (ic(left, my) < 0 || ic(right, my) < 0)\n {\n if (ic(left, right) < 0)\n {\n Swap(storage, pos, pos * 2 + 1);\n pos = pos * 2 + 1;\n }\n else\n {\n\n Swap(storage, pos, pos * 2 + 2);\n pos = pos * 2 + 2;\n }\n }\n else break;\n }\n return t;\n }\n\n public void Clear()\n {\n storage.Clear();\n }\n /// \n /// \u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b1\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b7 \u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080 \u00c3\u00a2\u00e2\u0082\u00ac\u00e2\u0084\u00a2\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b4\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b0\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bb\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b5\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00bd\u00c3\u0083\u00c6\u0092\u00c3\u0082\u00c2\u0090\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u00b8\u00c3\u0083\u00c6\u0092\u00c3\u00a2\u00e2\u0082\u00ac\u00cb\u009c\u00c3\u0083\u00e2\u0080\u009a\u00c3\u0082\u00c2\u008f\n /// \n /// \n public T Peek()\n {\n return storage[0];\n }\n public int Count\n {\n get { return storage.Count; }\n }\n //void RemoveLast, Size, peeklast, add\n }\n static void Swap(ref T lhs, ref T rhs)\n {\n T temp;\n temp = lhs;\n lhs = rhs;\n rhs = temp;\n }\n static void Swap(T[] a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n static void Swap(List a, int l, int r)\n {\n T temp;\n temp = a[l];\n a[l] = a[r];\n a[r] = temp;\n }\n\n bool outregion(long y, long x, long n, long m)\n {\n if (x < 0 || x >= m || y < 0 || y >= n)\n return true;\n return false;\n }\n static void initlist(ref List[] list, int n)\n {\n list = new List[n];\n for (int i = 0; i < n; i++)\n list[i] = new List();\n }\n static void newarray(ref T[][] array, int n, int m)\n {\n array = new T[n][];\n for (int i = 0; i < n; i++)\n array[i] = new T[m];\n }\n static void newarray(ref T[] array, int n)\n {\n array = new T[n];\n }\n static void fill(T[] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n array[i] = value;\n }\n static void fill(T[][] array, T value)\n {\n for (int i = 0; i < array.Length; i++)\n for (int j = 0; j < array[i].Length; j++)\n array[i][j] = value;\n }\n public bool NextPermutation(T[] b, Comparison ic)\n {\n for (int j = b.Length - 2; j >= 0; j--)\n {\n if (ic(b[j], b[j + 1]) < 0)\n {\n for (int l = b.Length - 1; l >= 0; l--)\n {\n if (ic(b[l], b[j]) > 0)\n {\n Swap(b, j, l);\n Array.Reverse(b, j + 1, b.Length - (j + 1));\n return true;\n }\n }\n }\n }\n return false;\n }\n int[,] step8 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n {1,1 },\n {-1,1 },\n {-1,-1 },\n {1,-1 },\n };\n int[,] step4 = new int[,]\n {\n {-1,0 },\n {1,0 },\n {0,-1 },\n {0,1 },\n };\n struct Vector2\n {\n public double x;\n public double y;\n public Vector2(double x, double y)\n {\n this.x = x;\n this.y = y;\n }\n public double Dist(Vector2 to)\n {\n return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));\n }\n public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }\n public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }\n }\n #endregion\n #endregion\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\npublic static class B__\n{\n private static void Solve()\n {\n int n = ReadInt();\n\n int x = 0;\n int y = 0;\n bool valid = true;\n\n while (n-- > 0)\n {\n int distance = ReadInt();\n string direction = Read();\n\n if (y == 0 && direction != \"South\")\n {\n valid = false;\n break;\n }\n\n if (y == 20000 && direction != \"North\")\n {\n valid = false;\n break;\n }\n\n Move(ref x, ref y, distance, direction);\n }\n\n if (y != 0)\n valid = false;\n\n Write(valid ? \"YES\" : \"NO\");\n }\n\n private static void Move(ref int x, ref int y, int distance, string direction)\n {\n if (direction == \"North\")\n {\n y -= distance;\n }\n else if (direction == \"South\")\n {\n y += distance;\n }\n else if (direction == \"East\")\n {\n x += distance;\n }\n else if (direction == \"West\")\n {\n x -= distance;\n }\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n public static void Main()\n {\n#if DEBUG\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n //var thread = new Thread(new B__().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(Read()); }\n public static long ReadLong() { return long.Parse(Read()); }\n public static double ReadDouble() { return double.Parse(Read(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array) writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\n public class Helper\n {\n public List Helpers { get; set; }\n public string From { get; set; }\n public List To { get; set; }\n\n\n public void Load()\n {\n Helpers = new List();\n\n Helper North = new Helper();\n North.From = \"North\";\n North.To = new List();\n North.To.Add(\"South_x_+\");\n North.To.Add(\"North_x_-\");\n\n North.To.Add(\"West_y_+\");\n North.To.Add(\"East_y_-\");\n\n Helpers.Add(North);\n\n Helper South = new Helper();\n South.From = \"South\";\n South.To = new List();\n\n South.To.Add(\"North_x_-\");\n South.To.Add(\"South_x_+\");\n\n South.To.Add(\"East_y_-\");\n South.To.Add(\"West_y_+\");\n\n Helpers.Add(South);\n\n\n Helper West = new Helper();\n West.From = \"West\";\n West.To = new List();\n West.To.Add(\"South_x_+\");\n West.To.Add(\"North_x_-\");\n\n West.To.Add(\"East_y_-\");\n West.To.Add(\"West_y_+\");\n\n Helpers.Add(West);\n\n Helper East = new Helper();\n East.From = \"East\";\n East.To = new List();\n East.To.Add(\"South_x_+\");\n East.To.Add(\"North_x_-\");\n\n\n East.To.Add(\"West_y_+\");\n East.To.Add(\"East_y_-\");\n\n Helpers.Add(East);\n\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n\n List lines = new List();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n\n lines.Add(inputs);\n\n\n }\n\n Helper helper = new Helper();\n helper.Load();\n\n long x = 0;\n long y = 0;\n\n var CurrentPosition = \"North\";\n\n var satisfy = true;\n\n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n\n var anyDirection = helper.Helpers.FirstOrDefault(f => f.From == CurrentPosition);\n\n var toDirection = anyDirection.To.FirstOrDefault(z => z.Split('_')[0] == dir);\n\n var toDI = toDirection.Split('_');\n\n if (x == 0)\n {\n\n if (toDI[0] != \"South\")\n {\n satisfy = false;\n break;\n }\n\n }\n\n if (x == 20000)\n {\n if (toDI[0] != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n\n if (toDirection == null)\n {\n\n satisfy = false;\n break;\n }\n else\n {\n\n\n if (toDI[1] == \"x\")\n {\n if (toDI[2] == \"+\")\n {\n x += km;\n }\n else\n {\n x -= km;\n }\n }\n else\n {\n if (toDI[2] == \"+\")\n {\n y += km;\n }\n else\n {\n y -= km;\n }\n }\n }\n\n CurrentPosition = dir;\n }\n\n\n if (satisfy && CurrentPosition == \"North\" && x <= 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n\n if (front == to)\n {\n return true;\n }\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n\n Dictionary> graph = new Dictionary>();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n\n var ins = GetStringInputsFromLine();\n\n var isRoute = Bfs(graph, ins[0], ins[1]);\n\n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n\n public class Helper\n {\n public List Helpers { get; set; }\n public string From { get; set; }\n public List To { get; set; }\n\n\n public void Load()\n {\n Helpers = new List();\n\n Helper North = new Helper();\n North.From = \"North\";\n North.To = new List();\n North.To.Add(\"South_x_+\");\n North.To.Add(\"North_x_-\");\n\n North.To.Add(\"West_y_+\");\n North.To.Add(\"East_y_-\");\n\n Helpers.Add(North);\n\n Helper South = new Helper();\n South.From = \"South\";\n South.To = new List();\n \n South.To.Add(\"North_x_-\");\n South.To.Add(\"South_x_+\");\n\n South.To.Add(\"East_y_-\");\n South.To.Add(\"West_y_+\");\n\n Helpers.Add(South);\n\n\n Helper West = new Helper();\n West.From = \"West\";\n West.To = new List();\n West.To.Add(\"South_x_+\");\n West.To.Add(\"North_x_-\");\n\n West.To.Add(\"East_y_-\");\n West.To.Add(\"West_y_+\");\n\n Helpers.Add(West);\n\n Helper East = new Helper();\n East.From = \"East\";\n East.To = new List();\n East.To.Add(\"South_x_+\");\n East.To.Add(\"North_x_-\");\n\n\n East.To.Add(\"West_y_+\");\n East.To.Add(\"East_y_-\");\n\n Helpers.Add(East);\n\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n var input = GetIntegerInputFromLine();\n\n List lines = new List();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n\n lines.Add(inputs);\n\n\n }\n\n Helper helper = new Helper();\n helper.Load();\n\n long x = 0;\n long y = 0;\n\n var CurrentPosition = \"North\";\n\n var satisfy = true;\n\n foreach (var item in lines)\n {\n var inputs = (string[])item;\n var km = Convert.ToInt64(inputs[0]);\n var dir = inputs[1];\n\n var anyDirection = helper.Helpers.FirstOrDefault(f => f.From == CurrentPosition);\n\n var toDirection = anyDirection.To.FirstOrDefault(z => z.Split('_')[0] == dir);\n\n var toDI = toDirection.Split('_');\n\n if (x == 0 || x == 20000)\n {\n if (CurrentPosition == \"North\")\n {\n if (toDI[0] != \"South\")\n {\n satisfy = false;\n break;\n }\n }\n\n if (CurrentPosition == \"South\")\n {\n if (toDI[0] != \"North\")\n {\n satisfy = false;\n break;\n }\n }\n }\n\n if (toDirection == null)\n {\n\n satisfy = false;\n break;\n }\n else\n {\n \n\n if (toDI[1] == \"x\")\n {\n if (toDI[2] == \"+\")\n {\n x += km;\n }\n else\n {\n x -= km;\n }\n }\n else\n {\n if (toDI[2] == \"+\")\n {\n y += km;\n }\n else\n {\n y -= km;\n }\n }\n }\n\n CurrentPosition = dir;\n }\n\n\n if (satisfy && CurrentPosition == \"North\" && x == 0)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n\n public static bool Bfs(Dictionary> graph, string from, string to)\n {\n Dictionary level = new Dictionary();\n Dictionary visited = new Dictionary();\n\n Queue queue = new Queue();\n\n queue.Enqueue(from);\n level[from] = 1;\n visited[from] = 1;\n while (queue.Count() > 0)\n {\n string front = queue.Peek();\n\n if (front == to)\n {\n return true;\n }\n\n List values;\n\n if (graph.TryGetValue(front, out values))\n {\n\n foreach (var item in values)\n {\n if (!visited.ContainsKey(item))\n {\n level[item] = level[front] + 1;\n visited[item] = 1;\n queue.Enqueue(item);\n }\n }\n }\n\n\n queue.Dequeue();\n\n }\n\n return false;\n }\n public void InputBfs()\n {\n var input = GetIntegerInputFromLine();\n\n Dictionary> graph = new Dictionary>();\n\n for (int i = 0; i < input; i++)\n {\n var inputs = GetStringInputsFromLine();\n AddOrUpdate(graph, inputs[0], inputs[1]);\n AddOrUpdate(graph, inputs[1], inputs[0]);\n }\n\n var ins = GetStringInputsFromLine();\n\n var isRoute = Bfs(graph, ins[0], ins[1]);\n\n if (!isRoute)\n {\n Console.WriteLine(\"No route\");\n }\n else\n {\n Console.WriteLine(\"route\");\n }\n }\n\n public static IDictionary> AddOrUpdate(IDictionary> dictionary, TKey key, TValue value)\n {\n List values;\n\n if (dictionary.TryGetValue(key, out values))\n {\n values.Add(value);\n\n dictionary[key] = values;\n }\n else\n {\n values = new List();\n values.Add(value);\n dictionary[key] = values;\n }\n\n return dictionary;\n }\n\n\n static int GetIntegerInputFromLine()\n {\n var input = Convert.ToInt32(Console.ReadLine().Trim());\n return input;\n }\n\n static int[] GetIntegerInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x.Trim())).ToArray();\n return inputs;\n }\n\n static long GetLongInputFromLine()\n {\n var input = Convert.ToInt64(Console.ReadLine().Trim());\n return input;\n }\n\n static long[] GetLongInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x.Trim())).ToArray();\n return inputs;\n }\n\n static double GetDoubleInputFromLine()\n {\n var input = Convert.ToDouble(Console.ReadLine().Trim());\n return input;\n }\n\n static double[] GetDoubleInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ').Select(x => Convert.ToDouble(x.Trim())).ToArray();\n return inputs;\n }\n\n static string GetStringInputFromLine()\n {\n var input = Console.ReadLine();\n return input;\n }\n\n static string[] GetStringInputsFromLine()\n {\n var inputs = Console.ReadLine().Split(' ');\n return inputs;\n }\n }\n}\n"}], "src_uid": "11ac96a9daa97ae1900f123be921e517"} {"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"E2\";\n\n \n private static void Solve()\n {\n var MOD = 1000000007;\n var input = ReadIntArray();\n var n = input[0];\n var m = input[1];\n var k = input[2];\n var dp = new List>();\n for (int i = 0; i <= 1001; i++)\n {\n dp.Add(new List());\n for (int j = 0; j <= i; j++)\n {\n if(j == 0 || j == i)\n dp[i].Add(1);\n else\n {\n dp[i].Add((dp[i-1][j-1] + dp[i - 1][j]) % MOD);\n }\n }\n }\n var res = Math.Min(n - 1, m - 1) < 2*k ? 0: dp[n - 1][2*k]*dp[m - 1][2*k];\n res %= MOD;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"E2\";\n\n \n private static void Solve()\n {\n var MOD = 1000000007;\n var input = ReadIntArray();\n var n = input[0];\n var m = input[1];\n var k = input[2];\n var dp = new List>();\n for (int i = 0; i <= 1001; i++)\n {\n dp.Add(new List());\n for (int j = 0; j <= i; j++)\n {\n if(j == 0 || j == i)\n dp[i].Add(1);\n else\n {\n dp[i].Add((dp[i-1][j-1] + dp[i - 1][j]) % MOD);\n }\n }\n }\n var res = Math.Min(n - 1, m - 1) < 2*k ? 0: dp[n - 1][2*k]*dp[m - 1][2*k];\n res %= MOD;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private const string Test = \"E2\";\n\n \n private static void Solve()\n {\n var MOD = 1000000007;\n var input = ReadIntArray();\n var n = input[0];\n var m = input[1];\n var k = input[2];\n var dp = new List>();\n for (int i = 0; i <= 1001; i++)\n {\n dp.Add(new List());\n for (int j = 0; j <= i; j++)\n {\n if(j == 0 || j == i)\n dp[i].Add(1);\n else\n {\n dp[i].Add((dp[i-1][j-1] + dp[i - 1][j]) % MOD);\n }\n }\n }\n var res = dp[n - 1][Math.Min(2 * k, n-1)] * dp[m - 1][Math.Min(2 * k, m-1)];\n res %= MOD;\n Console.WriteLine(res);\n }\n\n\n private static void Main()\n {\n if (Debugger.IsAttached)\n {\n Console.SetIn(new StreamReader(String.Format(@\"..\\..\\..\\..\\Tests\\{0}.in\", Test)));\n }\n\n Solve();\n\n if (Debugger.IsAttached)\n {\n Console.In.Close();\n Console.SetIn(new StreamReader(Console.OpenStandardInput()));\n Console.ReadLine();\n }\n }\n\n #region Reader\n\n private static string Read()\n {\n return Console.ReadLine();\n }\n\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n\n private static int[] ReadIntArray()\n {\n var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n return input;\n }\n\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n #endregion\n }\n}"}], "src_uid": "309d2d46086d526d160292717dfef308"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n const int MAXN = 1000000007;\n static long QMul(long a, long b)\n {\n long res = 1;\n long tmp = a;\n\n while(b != 0)\n {\n if((b & 1L) == 1)\n {\n res *= tmp;\n res %= MAXN;\n }\n tmp *= tmp;\n tmp %= MAXN;\n b >>= 1;\n }\n\n return res;\n }\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long[] arr = input.Select(x => Convert.ToInt64(x)).ToArray();\n\n long n = arr[0];\n long m = arr[1];\n long k = arr[2];\n\n if(k == -1 && (n+m) % 2 == 1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(QMul(QMul(2, (m - 1)), (n - 1)).ToString());\n }\n }\n }\n}", "positive_code": [{"source_code": "using System;\nnamespace b\n{\n static class Program\n {\n static ulong fastPow(ulong a, ulong exp, uint mod) {\n a %= mod;\n ulong result = 1;\n while (exp > 0) {\n if ((exp & 1) != 0) result = (result * a) % mod;\n a = (a * a) % mod;\n exp >>= 1;\n }\n return result;\n }\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var n = ulong.Parse(input[0]);\n var m = ulong.Parse(input[1]);\n var prod = long.Parse(input[2]);\n if (n % 2 != m % 2 && prod == -1){\n System.Console.WriteLine(0);\n return;\n }\n System.Console.WriteLine(fastPow(fastPow(2, (m-1), 1000000007), (n-1), 1000000007));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n \n class Program\n {\n public static readonly int MOD = Convert.ToInt32(1e9 + 7);\n public static readonly int oo = Convert.ToInt32(1e9);\n public static readonly long OO = Convert.ToInt64(1e18);\n\n static void Main(string[] args)\n {\n String[] data = Console.ReadLine().Split(' ');\n long n = Int64.Parse(data[0]);\n long m = Int64.Parse(data[1]);\n long k = Int64.Parse(data[2]);\n if (k == -1 && (n - m) % 2 != 0)\n {\n Console.Write(0);\n return;\n }\n\n Console.Write(ModPow(2, (n - 1) % (MOD - 1) * ((m - 1) % (MOD - 1)) % (MOD - 1)));\n\n } \n\n static long ModPow(long num, long exponent)\n {\n if (exponent == 0) return 1;\n long m = ModPow(num, exponent / 2);\n return exponent % 2 == 0 ? m * m % MOD : m * m % MOD * num % MOD;\n }\n\n }\n\n}\n"}, {"source_code": "\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n}\nclass Program\n{\n private readonly int Mod = 1000000007;\n private long N, M;\n private int K;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextLong();\n M = sc.NextLong();\n K = sc.NextInt();\n long yy = (N - 1) % (Mod - 1);\n long xx = (M - 1) % (Mod - 1);\n if (K == 1)\n {\n Console.WriteLine(Pow((xx * yy) % (Mod - 1)));\n }\n else if (K == -1)\n {\n if (N % 2 == M % 2)\n {\n Console.WriteLine(Pow((xx * yy) % (Mod - 1)));\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n\n private long Pow(long y)\n {\n long res = 1;\n long x = 2;\n while (y > 0)\n {\n if (y % 2 == 1)\n {\n res *= x;\n res %= Mod;\n }\n y /= 2;\n x = (x * x) % Mod;\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && k==-1)\n {\n writer.WriteLine(0);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(modular_pow(2, ((n-1)), mod), (m - 1) , mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tlong[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n\t\tConsole.WriteLine(nmk[0] % 2 != nmk[1] % 2 && nmk[2] == -1 ? 0 : BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if(((n%2 == 1 && m%2 == 0) || (n%2 == 0 && m%2 == 1)) && k == -1)\n Console.WriteLine(0);\n else if (n == 2 && m == 2)\n {\n Console.WriteLine(2);\n }\n else if(fieldNumber == 1 || n == 1 || m == 1)\n Console.WriteLine(1);\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n Console.WriteLine(answer);\n }\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90e\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\n\nnamespace dd\n{\n\tclass MainClass\n\t{\n\t\tconst long MOD = 1000 * 1000 * 1000 + 7;\n\n\t\tpublic static long BinPow(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn 1;\n\t\t\tif (b % 2 == 0)\n\t\t\t{\n\t\t\t\tlong Q = BinPow(a, b / 2); Q %= MOD;\n\t\t\t\treturn (Q * Q) % MOD;\n\t\t\t}\n\t\t\treturn ((BinPow(a, b - 1) % MOD) * a) % MOD;\n\t\t}\n\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tlong n = Reader.NextLong();\n\t\t\tlong m = Reader.NextLong();\n\t\t\tlong k = Reader.NextLong();\n\t\t\tlong ans = 0;\n\t\t\tif (k == -1 && (n % 2 != m % 2))\n\t\t\t{\n\t\t\t\tConsole.WriteLine(ans);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tans = BinPow(2, n - 1) % MOD;\n\t\t\t\tans = BinPow(ans, m - 1) % MOD;\n\t\t\t\tConsole.WriteLine(ans);\n\t\t\t}\n\t\t}\n\n\t\tclass Reader\n\t\t{\n\t\t\tpublic static int NextInt()\n\t\t\t{\n\t\t\t\tint cnt = 0, sign = 1;\n\t\t\t\tchar ch = Convert.ToChar(Console.Read());\n\t\t\t\twhile (!(ch >= '0' && ch <= '9') && ch != '-')\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\tif (ch == '-')\n\t\t\t\t{\n\t\t\t\t\tsign = -1;\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\twhile (ch >= '0' && ch <= '9')\n\t\t\t\t{\n\t\t\t\t\tint t = Convert.ToInt32(ch);\n\t\t\t\t\tcnt = cnt * 10 + ch - '0';\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\treturn cnt * sign;\n\t\t\t}\n\t\t\tpublic static long NextLong()\n\t\t\t{\n\t\t\t\tlong cnt = 0, sign = 1;\n\t\t\t\tchar ch = Convert.ToChar(Console.Read());\n\t\t\t\twhile (!(ch >= '0' && ch <= '9') && ch != '-')\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\tif (ch == '-')\n\t\t\t\t{\n\t\t\t\t\tsign = -1;\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\twhile (ch >= '0' && ch <= '9')\n\t\t\t\t{\n\t\t\t\t\tlong t = Convert.ToInt64(ch);\n\t\t\t\t\tcnt = cnt * 10 + ch - '0';\n\t\t\t\t\tch = Convert.ToChar(Console.Read());\n\t\t\t\t}\n\t\t\t\treturn cnt * sign;\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace DTATest\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] line = Console.ReadLine().Split(' ');\n\t\t\tlong n;\n\t\t\tlong m;\n\t\t\tlong k;\n\t\t\tn = long.Parse(line[0]);\n\t\t\tm = long.Parse(line[1]);\n\t\t\tk = long.Parse(line[2]);\n\t\t\tConsole.WriteLine(solve(n, m, k));\n Console.Read();\n\n }\n\t\t\n\t\tstatic long solve(long n, long m, long k)\n\t\t{\n\t\t\tlong mod = 1000000007;\n\t\t\tif (k == -1 && (m + n) % 2 != 0) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tlong a = 2;\n\t\t\t\ta = qMul(a, n - 1, mod);\n\t\t\t\ta = qMul(a, m - 1, mod);\n\t\t\t\treturn a;\n\t\t\t}\n\t\t}\n\t\t\n\t\tstatic long qMul(long a, long b, long m)\n\t\t{\n\t\t\ta %= m;\n\t\t\tlong ans = 1;\n\t\t\twhile (b != 0) {\n\t\t\t\tif (b % 2 == 1) {\n\t\t\t\t\tans = (ans * a) % m;\n\t\t\t\t}\n\t\t\t\ta = (a * a) % m;\n\t\t\t\tb >>= 1;\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ralph_And_His_Magic_Field\n{\n internal class Program\n {\n private const int mod = 1000000007;\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n long n = Next();\n long m = Next();\n long k = Next();\n\n if (k==-1 && (n%2)+(m%2)==1)\n {\n return 0;\n }\n\n if (n == 1 || m == 1)\n {\n return 1;\n }\n\n long ans = Pow(2, n-1);\n return Pow(ans, m - 1);\n }\n\n private static long Pow(long a, long k)\n {\n long r = 1;\n while (k > 0)\n {\n if ((k & 1) == 1)\n {\n r = (r * a) % mod;\n }\n a = (a * a) % mod;\n k >>= 1;\n }\n return r;\n }\n\n private static long Next()\n {\n int c;\n long m = 1;\n do\n {\n c = reader.Read();\n if (c == '-')\n m = -1;\n } while (c < '0' || c > '9');\n long res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return m*res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var m = ReadLong();\n var k = ReadLong();\n if (k == -1 && Math.Abs(n - m) % 2 != 0)\n return 0;\n return fastpow(fastpow(2, n - 1), m - 1);\n }\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n }\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n const int MAXN = 1000000007;\n static long QMul(long a, long b)\n {\n long res = 1;\n long tmp = a;\n\n while(b != 0)\n {\n if((b & 1L) == 1)\n {\n res *= tmp;\n res %= MAXN;\n }\n tmp *= tmp;\n tmp %= MAXN;\n b >>= 1;\n }\n\n return res;\n }\n\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n long[] arr = input.Select(x => Convert.ToInt64(x)).ToArray();\n\n long n = arr[0];\n long m = arr[1];\n long k = arr[2];\n\n if(k == -1 && (n+m) % 2 == -1)\n {\n Console.WriteLine(\"0\");\n }\n else\n {\n Console.WriteLine(QMul(QMul(2, (m - 1)), (n - 1)).ToString());\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces\n{\n \n class Program\n {\n public static readonly int MOD = Convert.ToInt32(1e9 + 7);\n public static readonly int oo = Convert.ToInt32(1e9);\n public static readonly long OO = Convert.ToInt64(1e18);\n\n static void Main(string[] args)\n {\n String[] data = Console.ReadLine().Split(' ');\n long n = Int64.Parse(data[0]);\n long m = Int64.Parse(data[1]);\n long k = Int64.Parse(data[2]);\n if (k == -1 && (n - m) % 2 != 0)\n {\n Console.Write(0);\n return;\n }\n\n Console.Write(ModPow(2, (n - 1) % (MOD - 1) * (m - 1) % (MOD - 1)));\n\n } \n\n static long ModPow(long num, long exponent)\n {\n if (exponent == 0) return 1;\n long m = ModPow(num, exponent / 2);\n return exponent % 2 == 0 ? m * m % MOD : m * m % MOD * num % MOD;\n }\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n}\nclass Program\n{\n private readonly int Mod = 1000000007;\n private long N, M;\n private int K;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextLong();\n M = sc.NextLong();\n K = sc.NextInt();\n long yy = (N - 1) % Mod;\n long xx = (M - 1) % Mod;\n Console.WriteLine(Pow((xx * yy) % Mod));\n }\n\n private long Pow(long y)\n {\n long res = 1;\n long x = 2;\n while (y > 0)\n {\n if (y % 2 == 1)\n {\n res *= x;\n res %= Mod;\n }\n y /= 2;\n x = (x * x) % Mod;\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass Scanner\n{\n private readonly char Separator = ' ';\n private int Index = 0;\n private string[] Line = new string[0];\n public string Next()\n {\n if (Index >= Line.Length)\n {\n Line = Console.ReadLine().Split(Separator);\n Index = 0;\n }\n var ret = Line[Index];\n Index++;\n return ret;\n }\n\n public int NextInt()\n {\n return int.Parse(Next());\n }\n\n public long NextLong()\n {\n return long.Parse(Next());\n }\n\n}\nclass Program\n{\n private readonly int Mod = 1000000007;\n private long N, M;\n private int K;\n public void Solve()\n {\n var sc = new Scanner();\n N = sc.NextLong();\n M = sc.NextLong();\n K = sc.NextInt();\n long yy = (N - 1) % Mod;\n long xx = (M - 1) % Mod;\n if (K == 1)\n {\n Console.WriteLine(Pow((xx * yy) % (Mod - 1)));\n }\n else if (K == -1)\n {\n if (N % 2 == M % 2)\n {\n Console.WriteLine(Pow((xx * yy) % (Mod - 1)));\n }\n else\n {\n Console.WriteLine(0);\n }\n }\n }\n\n private long Pow(long y)\n {\n long res = 1;\n long x = 2;\n while (y > 0)\n {\n if (y % 2 == 1)\n {\n res *= x;\n res %= Mod;\n }\n y /= 2;\n x = (x * x) % Mod;\n }\n return res;\n }\n\n static void Main(string[] args)\n {\n new Program().Solve();\n }\n}\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tstring[] nmk = Console.ReadLine().Split();\n\t\tbyte[] n = nmk[0].Select(x => (byte) (x - '0')).ToArray(), m = nmk[1].Select(x => (byte) (x - '0')).ToArray();\n\t\tConsole.WriteLine(BigInteger.ModPow(2, (new BigInteger(n) - 1) * (new BigInteger(m) - 1), 1000000007));\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\nusing System.Numerics;\n\nclass Program\n{\n static void Main()\n {\n \n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass StandartMethods\n{\n\tpublic static BigInteger Power(BigInteger a, BigInteger n)\n\t{\n\t\tif (n == 0)\n\t\t\treturn 1;\n\t\tList pow = new List() { 1, a };\n\t\tBigInteger k = 1;\n\t\twhile (k < n)\n\t\t\tif (k << 1 <= n)\n\t\t\t{\n\t\t\t\ta *= a;\n\t\t\t\tk <<= 1;\n\t\t\t\tpow.Add(a);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tBigInteger j = k;\n\t\t\t\tfor (int i = pow.Count - 1; i > -1 && k < n; i--, j >>= 1)\n\t\t\t\t\tif (k + j <= n)\n\t\t\t\t\t{\n\t\t\t\t\t\ta *= pow[i];\n\t\t\t\t\t\tk += j;\n\t\t\t\t\t}\n\t\t\t}\n\t\treturn a;\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\t\tConsole.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)) % 1000000007);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tlong[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n\t\tConsole.WriteLine(nmk[0] % 2 == nmk[1] % 2 ? BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007) : 0);\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass StandartMethods\n{\n\tpublic static BigInteger Power(BigInteger a, BigInteger n)\n\t{\n\t\tif (n == 0)\n\t\t\treturn 1;\n\t\tList pow = new List() { 1, a };\n\t\tBigInteger k = 1;\n\t\twhile (k < n)\n\t\t\tif (k << 1 <= n)\n\t\t\t{\n\t\t\t\ta *= a;\n\t\t\t\tk <<= 1;\n\t\t\t\tpow.Add(a);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tBigInteger j = k;\n\t\t\t\tfor (int i = pow.Count - 1; i > -1 && k < n; i--, j >>= 1)\n\t\t\t\t\tif (k + j <= n)\n\t\t\t\t\t{\n\t\t\t\t\t\ta *= pow[i];\n\t\t\t\t\t\tk += j;\n\t\t\t\t\t}\n\t\t\t}\n\t\treturn a;\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\t\tConsole.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)));\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass StandartMethods\n{\n\tpublic static BigInteger Power(BigInteger a, BigInteger n)\n\t{\n\t\tif (n == 0)\n\t\t\treturn 1;\n\t\tList pow = new List() { 1, a };\n\t\tint k = 1;\n\t\twhile (k < n)\n\t\t\tif (k << 1 <= n)\n\t\t\t{\n\t\t\t\ta *= a;\n\t\t\t\tk <<= 1;\n\t\t\t\tpow.Add(a);\n\t\t\t}\n\t\t\telse\n\t\t\t\tfor (int i = pow.Count - 1, j = k; i > -1 && k < n; i--, j >>= 1)\n\t\t\t\t\tif (k + j <= n)\n\t\t\t\t\t{\n\t\t\t\t\t\ta *= pow[i];\n\t\t\t\t\t\tk += j;\n\t\t\t\t\t}\n\t\treturn a;\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] nmk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\t\tConsole.WriteLine(StandartMethods.Power(2, (nmk[0] - 1) * (nmk[1] - 1)));\n\t}\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Collections.Generic;\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tlong[] nmk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();\n\t\tConsole.WriteLine(BigInteger.ModPow(2, new BigInteger(nmk[0] - 1) * new BigInteger(nmk[1] - 1), 1000000007));\n\t}\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var m = ReadLong();\n var k = ReadLong();\n if (k == -1 && Math.Abs(n - m) % 2 != 0)\n return 0;\n return fastpow(2, (((n - 1) % commonMod) * ((m- 1)% commonMod)) % commonMod);\n }\n\n long fastpow(long b, long x)\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = ReadLong();\n var m = ReadLong();\n var k = ReadLong();\n if (k == -1 && Math.Abs(n - m) % 2 != 0)\n return 0;\n return fastpow(fastpow(2, (n - 1) % commonMod), (m - 1) % commonMod);\n }\n\n long fastpow(long b, long x)\n {\n checked\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow((b * b) % commonMod, x / 2);\n return (b * fastpow(b, x - 1)) % commonMod;\n }\n }\n\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace Codeforces\n{\n class Program : ProgramBase\n {\n private const long commonMod = 1000000007;\n\n static void Main(string[] args)\n {\n var p = new Program();\n var x = p.Solve();\n p.Out(x);\n }\n object Solve()\n {\n var n = (ReadLong() - 1) % commonMod;\n var m = (ReadLong() - 1) % commonMod;\n var k = ReadLong();\n return fastpow(2, (n * m) % commonMod);\n }\n\n long fastpow(long b, long x)\n {\n if (x == 0)\n return 1;\n if (x == 1)\n return b;\n if (x % 2 == 0)\n return fastpow(b * b % commonMod, x / 2);\n return b * fastpow(b, x - 1) % commonMod;\n }\n\n int nod(int a, int b)\n {\n if (a < b)\n return nod(b, a);\n if (b == 0)\n return a;\n return nod(b, a % b);\n }\n\n class End\n {\n public long Val { get; set; }\n public bool Left { get; set; }\n }\n }\n\n abstract class ProgramBase\n {\n bool? prod = null;\n StreamReader f;\n Queue tokens;\n protected string FileName { private get; set; }\n\n protected string Read()\n {\n if (f == null)\n f = string.IsNullOrEmpty(FileName)\n ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)\n : new StreamReader((GetProd() ? \"\" : \"c:\\\\dev\\\\\") + FileName);\n return f.ReadLine();\n }\n\n protected string ReadToken()\n {\n if (tokens == null || tokens.Count == 0)\n tokens = new Queue(Read().Split(' '));\n return tokens.Dequeue();\n }\n\n protected long ReadLong() { return long.Parse(ReadToken()); }\n\n protected long[] ReadLongs()\n {\n var s = Read();\n if (s == \"\")\n return new long[0];\n //var i = s.IndexOf(' ');\n //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };\n var tokens = s.Split(' ');\n var result = new long[tokens.Length];\n for (int i = 0; i < tokens.Length; i++)\n result[i] = long.Parse(tokens[i]);\n return result;\n }\n\n public void Out(object r)\n {\n if (string.IsNullOrEmpty(FileName))\n Console.WriteLine(r);\n else if (GetProd())\n File.WriteAllText(FileName, r.ToString());\n else\n Console.WriteLine(r);\n }\n\n private bool GetProd()\n {\n\n if (!prod.HasValue)\n try\n {\n prod = Environment.MachineName != \"RENADEEN-W7\";\n }\n catch (Exception)\n {\n prod = true;\n }\n return prod.Value;\n }\n }\n\n public static class Huj\n {\n public static T MinBy(this IEnumerable source, Func func) where T : class\n {\n T result = null;\n var min = double.MaxValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (min > current)\n {\n min = current;\n result = item;\n }\n }\n return result;\n }\n\n public static T MaxBy(this IEnumerable source, Func func, T defaultValue = default(T))\n {\n T result = defaultValue;\n var max = double.MinValue;\n foreach (var item in source)\n {\n var current = func(item);\n if (max < current)\n {\n max = current;\n result = item;\n }\n }\n return result;\n }\n\n public static string JoinStrings(this IEnumerable s, string d) { return string.Join(d, s.ToArray()); }\n\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n public static string JoinStrings(this IEnumerable s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }\n }\n\n}"}, {"source_code": "using System;\nnamespace b\n{\n static class Program\n {\n static ulong fastPow(ulong a, ulong exp, uint mod) {\n a %= mod;\n ulong result = 1;\n while (exp > 0) {\n if ((exp & 1) != 0) result = (result * a) % mod;\n a = (a * a) % mod;\n exp >>= 1;\n }\n return result;\n }\n static void Main(string[] args)\n {\n var input = Console.ReadLine().Split(' ');\n var n = ulong.Parse(input[0]);\n var m = ulong.Parse(input[1]);\n var prod = long.Parse(input[2]);\n if (n % 2 != m % 2 && prod == -1){\n System.Console.WriteLine(0);\n return;\n }\n System.Console.WriteLine(fastPow(2, (n-1)*(m-1), 1000000007));\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && k==-1)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && n!=1 && m!=1)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(2, ((n-1)%mod)* ((m - 1) % mod), mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(2, ((n-1)%mod)* ((m - 1) % mod), mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && k==-1)\n {\n writer.WriteLine(0);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && n!=1 && m!=1)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(modular_pow(2, ((n-1)%mod), mod), (m - 1) % mod, mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Numerics;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Linq;\nusing System.IO;\npublic class CodeForces\n{\n#if TEST\n // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.\n const bool testing = true;\n#else\nconst bool testing = false;\n#endif\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n static long modular_pow(long bases, long exponent, long modulus)\n {\n if (modulus == 1)\n {\n return 0;\n }\n long result = 1;\n bases = bases % modulus;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n {\n result = (result * bases) % modulus;\n }\n exponent = exponent >> 1;\n bases = (bases * bases) % modulus;\n }\n return result;\n }\n static void program(TextReader input)\n {\n //var n = int.Parse(input.ReadLine().TrimEnd());\n var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();\n var n = data[0];\n var m = data[1];\n var k = data[2];\n var mod = 1000000007;\n\n if(n%2 != m % 2 && k==-1)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n writer.WriteLine(modular_pow(modular_pow(2, ((n-1)), mod), (m - 1) , mod));\n writer.Flush();\n }\n\n public static void Main(string[] args)\n {\n if (!testing)\n { // set testing to false when submiting to codeforces\n program(Console.In); // write your program in 'program' function (its your new main !)\n return;\n }\n\n Console.WriteLine(\"Test Case(1) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(1) => found :\");\n program(new StringReader(\"1 1 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(2) => expected :\");\n Console.WriteLine(\"1\\n\");\n Console.WriteLine(\"Test Case(2) => found :\");\n program(new StringReader(\"1 3 1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n Console.WriteLine(\"Test Case(3) => expected :\");\n Console.WriteLine(\"16\\n\");\n Console.WriteLine(\"Test Case(3) => found :\");\n program(new StringReader(\"3 3 -1\\n\"));\n Console.WriteLine();\n Console.ReadLine();\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n int m, n, k;\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n k = Convert.ToInt32(input[2]);\n\n int fieldNumber = n * m;\n double answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n answer = 1;\n else if(n%2 == 0 || m%2 ==0)\n {\n answer = ((Math.Pow(2, Convert.ToDouble(n)) + Math.Pow(2, Convert.ToDouble(m)))/2)-2;\n }\n else\n answer = Math.Pow(2, Convert.ToDouble(n)) + Math.Pow(2, Convert.ToDouble(m));\n\n Console.WriteLine(answer % 1000000007);\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n answer = 1;\n else if(n == 2 && n == 2)\n {\n Console.WriteLine(2);\n }\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n }\n Console.WriteLine(answer);\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n answer = 1;\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n }\n Console.WriteLine(answer);\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n Console.WriteLine(1);\n else if(n == 2 && m == 2)\n {\n Console.WriteLine(2);\n }\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n Console.WriteLine(answer);\n }\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if(((n%2 == 1 && m%2 == 0) || (n%2 == 0 && m%2 == 1) && k == -1))\n Console.WriteLine(0);\n else if (n == 2 && m == 2)\n {\n Console.WriteLine(2);\n }\n else if(fieldNumber == 1 || n == 1 || m == 1)\n Console.WriteLine(1);\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n Console.WriteLine(answer);\n }\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n Console.WriteLine(1);\n else if(n == 2 && n == 2)\n {\n Console.WriteLine(2);\n }\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n Console.WriteLine(answer);\n }\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n int m, n, k;\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n k = Convert.ToInt32(input[2]);\n\n int fieldNumber = n * m;\n double answer = 0;\n if (fieldNumber == 1 || n == 1 || m == 1)\n answer = 1;\n else\n answer = Math.Pow(2,Convert.ToDouble(n)) + Math.Pow(2,Convert.ToDouble(m));\n\n Console.WriteLine(answer);\n\n }\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\nnamespace _900\n{\n class Program\n {\n static void Main(string[] args)\n {\n // string qaqstring = Console.ReadLine();\n //\n // int qaqsum = 0;\n // for(int i = 0; i < qaqstring.Length; ++i)\n // {\n // for(int j = i; j < qaqstring.Length; ++j)\n // {\n // for(int k = j; k < qaqstring.Length; ++k)\n // {\n // if (qaqstring[i] == 'Q' && qaqstring[j] == 'A' && qaqstring[k] == 'Q')\n // qaqsum++;\n // }\n // }\n // }\n // Console.WriteLine(qaqsum);\n\n string[] input = Console.ReadLine().Split();\n BigInteger m, n, k;\n n = BigInteger.Parse(input[0]);\n m = BigInteger.Parse(input[1]);\n k = BigInteger.Parse(input[2]);\n \n BigInteger fieldNumber = (n-1) * (m-1);\n BigInteger answer = 0;\n if (n == 2 && m == 2)\n {\n Console.WriteLine(2);\n }\n else if(fieldNumber == 1 || n == 1 || m == 1)\n Console.WriteLine(1);\n else\n {\n answer = BigInteger.ModPow(2,fieldNumber, 1000000007);\n Console.WriteLine(answer);\n }\n\n }\n\n }\n}\n"}], "src_uid": "6b9eff690fae14725885cbc891ff7243"} {"source_code": "//brain disabled\nusing System;\n\nnamespace \u041c\u043e\u0451\n{\n static class \u0420\u0435\u0448\u0435\u043d\u0438\u0435\n {\n static void Main()\n {\n int n,m;\n var z = Console.ReadLine().Split(' ');\n n = Convert.ToInt32(z[0]);\n m = Convert.ToInt32(z[1]);\n z = Console.ReadLine().Split(' ');\n int ans = 0, val = -1;\n for(int i=0;i= val)\n {\n ans = i+1;\n val = (Convert.ToInt32(z[i])+m-1)/m;\n }\n }\n \n Console.WriteLine(ans);\n }\n } \n}", "positive_code": [{"source_code": "using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] x = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();\n int[] a = Console.ReadLine().Split().Select(z => (int)Math.Ceiling(double.Parse(z)/x[1])).ToArray();\n int rez = Array.LastIndexOf(a,a.Max())+1;\n Console.WriteLine(rez);\n }\n }\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CSharp\n{\n public class _450A\n {\n public static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int m = int.Parse(tokens[1]);\n\n int last = Console\n .ReadLine()\n .Split()\n .Select((token, i) => new\n {\n Count = (int.Parse(token) + m - 1) / m,\n Index = i + 1\n })\n .OrderByDescending(x => x.Count)\n .ThenByDescending(x => x.Index)\n .First()\n .Index;\n\n Console.WriteLine(last);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Enu = System.Linq.Enumerable;\n\nclass Program\n{\n void Solve()\n {\n int N = reader.Int(), M = reader.Int();\n int maxNeed = -1;\n int who = -1;\n\n for (int i = 0; i < N; i++)\n {\n int x = reader.Int();\n int need = (x + M - 1) / M;\n if (need >= maxNeed)\n {\n maxNeed = need;\n who = i;\n }\n }\n\n Console.WriteLine(who + 1);\n Console.ReadLine();\n }\n\n\n\n static void Main() { new Program().Solve(); }\n Reader reader = new Reader(Console.In);\n\n class Reader\n {\n private readonly TextReader reader;\n private readonly char[] separator = new char[] { ' ' };\n private readonly StringSplitOptions removeOp = StringSplitOptions.RemoveEmptyEntries;\n private string[] A = new string[0];\n private int i;\n\n public Reader(TextReader r) { reader = r; }\n public bool HasNext() { return Enqueue(); }\n public string String() { return Dequeue(); }\n public int Int() { return int.Parse(Dequeue()); }\n public long Long() { return long.Parse(Dequeue()); }\n public double Double() { return double.Parse(Dequeue()); }\n public int[] IntLine() { var s = Line(); return s == \"\" ? new int[0] : Array.ConvertAll(Split(s), int.Parse); }\n public int[] IntArray(int N) { return Enumerable.Range(0, N).Select(i => Int()).ToArray(); }\n public int[][] IntGrid(int H) { return Enumerable.Range(0, H).Select(i => IntLine()).ToArray(); }\n public string[] StringArray(int N) { return Enumerable.Range(0, N).Select(i => Line()).ToArray(); }\n public string Line() { return reader.ReadLine().Trim(); }\n private string[] Split(string s) { return s.Split(separator, removeOp); }\n private bool Enqueue()\n {\n if (i < A.Length) return true;\n string line = reader.ReadLine();\n if (line == null) return false;\n if (line == \"\") return Enqueue();\n A = Split(line);\n i = 0;\n return true;\n }\n private string Dequeue() { Enqueue(); return A[i++]; }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split();\n int n=int.Parse(input[0]), m=int.Parse(input[1]),i;\n bool last;\n input = Console.ReadLine().Split();\n int[] arr=new int[input.Length];\n for (i = 0; i < input.Length; i++)\n {\n arr[i] = int.Parse(input[i]);\n }\n i = 0;\n while (true)\n {\n if (arr[i] <= m)\n {\n last = true;\n arr[i] = -1;\n for (int ii = 0; ii < n; ii++)\n {\n if (arr[ii] != -1)\n {\n last = false;\n break;\n }\n }\n if (last == true)\n {\n Console.Write(i+1);\n break;\n }\n }\n else\n {\n arr[i] -= m;\n }\n i++;\n if (i == n) { i = 0; }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Contest\n{\n internal class Program\n {\n private static void Main()\n {\n var p = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var val = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();\n var index = 0;\n while (true)\n {\n var zero = 0;\n for (var i = 0; i < val.Length; i++)\n {\n if (val[i] > 0)\n {\n val[i] -= p[1];\n if (val[i] <= 0) index = i;\n }\n else\n {\n zero++;\n }\n }\n if (zero == val.Length) {Console.WriteLine(index+1); return; }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string firstLine = Console.ReadLine();\n string secondLine = Console.ReadLine();\n\n string[] boys = firstLine.Split(new char[] { ' ' });\n int countBoys = int.Parse(boys[0]);\n int giveAmount = int.Parse(boys[1]);\n\n string[] boyWants = secondLine.Split(new char[] { ' ' });\n int max = 0;\n Queue orders = new Queue();\n int i = 0;\n while (orders.Count() < countBoys)\n {\n int remain = int.Parse(boyWants[i]) - giveAmount;\n boyWants[i] = remain.ToString();\n if (remain <= 0 && !orders.Contains(i))\n orders.Enqueue(i);\n i++;\n if (i == countBoys) i = 0;\n }\n var last = orders.Last();\n Console.WriteLine(last + 1);\n \n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[]r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]);\n int m = int.Parse(r[1]);\n\n String[] h = Console.ReadLine().Split(' ');\n int[] child = Array.ConvertAll(h, int.Parse);\n bool f = true;\n int index = n;\n while(f)\n {\n f = false;\n\n for (int i = 0; i < child.Length; i++)\n {\n if (child[i] > 0)\n {\n if (child[i] > m)\n {\n child[i] -= m;\n index = i + 1;\n f = true;\n }\n else\n child[i] = 0;\n }\n }\n }\n Console.WriteLine(index);\n //Console.ReadKey();\n }\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Int32.Parse(s[0]);\n int m = Int32.Parse(s[1]);\n int ans = 0, index = 0;\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n for (int i = 0; i < n; i++)\n {\n int count = 0;\n while (a[i] > 0)\n {\n a[i] -= m;\n count++;\n }\n if (count >= ans)\n {\n index = i;\n ans = count;\n }\n }\n Console.WriteLine(index + 1);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int n = int.Parse(str[0]), m = int.Parse(str[1]);\n\n str = Console.ReadLine().Split();\n List mass = new List();\n for (int i = 0; i < n; i++) mass.Add(int.Parse(str[i]));\n\n List mass1 = new List();\n for (int i = 0; i < n; i++) mass1.Add(i + 1);\n\n while (mass1.Count != 1)\n {\n mass[0] -= m;\n if (mass[0] > 0)\n {\n int a = mass[0];\n mass.RemoveAt(0);\n mass.Add(a);\n\n a = mass1[0];\n mass1.RemoveAt(0);\n mass1.Add(a);\n }\n else\n {\n mass.RemoveAt(0);\n mass1.RemoveAt(0);\n }\n }\n Console.WriteLine(mass1[0]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\n \nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tpublic void Solve(){\n\t\tvar d=ria();\n\t\tint[] A=ria();\n\t\t\n\t\tint cnt=0;\n\t\tint idx=0;\n\t\tint ans=-1;\n\t\twhile(true){\n\t\t\tif(A[idx]>0){\n\t\t\t\tA[idx]-=d[1];\n\t\t\t\tif(A[idx]<=0)cnt++;\n\t\t\t\tif(cnt==A.Length){\n\t\t\t\t\tans=idx+1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tidx++;\n\t\t\tif(idx==A.Length)idx=0;\n\t\t}\n\t\tConsole.WriteLine(ans);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\n\tpublic Sol(){\n\t}\n\n\n\n\n\tstatic String rs(){return Console.ReadLine();}\n\tstatic int ri(){return int.Parse(Console.ReadLine());}\n\tstatic long rl(){return long.Parse(Console.ReadLine());}\n\tstatic double rd(){return double.Parse(Console.ReadLine());}\n\tstatic String[] rsa(){return Console.ReadLine().Split(' ');}\n\tstatic int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}\n\tstatic long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}\n\tstatic double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\nnamespace ConsoleApplication1\n{\n class item\n {\n public item(int index, int value)\n {\n this.index = index;\n this.value = value;\n }\n public int index;\n public int value;\n }\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n string[] splits = input.Split(' ');\n int n = int.Parse(splits[0]);\n int m = int.Parse(splits[1]);\n splits = Console.ReadLine().Split(' ');\n Queue queue = new Queue();\n\n for (int i = 0; i < splits.Length; i++)\n {\n item it = new item(i + 1, int.Parse(splits[i]));\n queue.Enqueue(it);\n }\n\n while (queue.Count > 1)\n {\n item it = queue.Dequeue();\n if (it.value > m)\n {\n it.value -= m;\n queue.Enqueue(it);\n }\n }\n\n Console.WriteLine(queue.Dequeue().index);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] r = Console.ReadLine().Split(' ');\n int n = int.Parse(r[0]);\n int m = int.Parse(r[1]);\n int[] a = new int[n];\n string[] t = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++) a[i] = int.Parse(t[i]); \n int br0 = 0;\n for (int i = 0; i < n; i++)\n { \n if (a[i] != 0)\n {\n if (br0 == n - 1)\n {\n Console.WriteLine(i + 1);\n return;\n }\n if (a[i] > m) a[i] -= m;\n else\n {\n a[i] = 0;\n br0++;\n }\n }\n if (i == n - 1) i = -1;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Dynamic;\nusing System.Linq;\n\nnamespace _450_A_Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int last=n;\n string[] s1 = Console.ReadLine().Split(' ');\n int[] a = Array.ConvertAll(s1, int.Parse);\n\n while (a.Sum() != 0)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] > m)\n {\n a[i] = a[i] - m;\n last = i + 1;\n }\n else\n {\n a[i] = 0;\n }\n }\n }\n \n\n Console.WriteLine(last);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string fr = Console.ReadLine();\n string sr = Console.ReadLine();\n\n var q = new Queue>();\n\n int m = int.Parse(fr.Split(' ')[1]);\n\n var elems = sr.Split(' ');\n for (int i = 0; i < elems.Length; i++)\n q.Enqueue(new KeyValuePair(i+1, int.Parse(elems[i])));\n\n bool isOver = false;\n int id = 0;\n\n while(!isOver)\n {\n var elem = q.Dequeue();\n elem = new KeyValuePair(elem.Key, elem.Value - m);\n q.Enqueue(elem);\n isOver = true;\n foreach(var el in q)\n {\n if (el.Value > 0)\n isOver = false;\n }\n if (isOver)\n id = elem.Key;\n }\n\n Console.WriteLine(id);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _257div\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int max = 0;\n int ind = n; \n\n string[] ss = Console.ReadLine().Split(); \n\n int[] st = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n st[i] = int.Parse(ss[i])/m;\n\n if (int.Parse(ss[i])%m >0)\n {\n st[i]++; \n }\n }\n\n for (int i = 0; i < n; i++)\n {\n if (st[i] >=max)\n {\n max = st[i];\n ind = i + 1; \n }\n }\n\n Console.WriteLine(ind);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Round_257\n{\n public class MyClass\n {\n public int value { get; set; }\n public int number { get; set; }\n\n public MyClass(int v, int n)\n {\n value = v;\n number = n;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n s = Console.ReadLine().Split(' ');\n int max = -1;\n int ans = 0, tmp = 0;\n List mas = new List(); \n for (int i = 0; i < n; i++)\n {\n tmp = int.Parse(s[i]);\n mas.Add(new MyClass(tmp,i+1));\n }\n int h = 0;\n while (mas.Count!=1)\n {\n if (mas[h].value > m)\n {\n mas[h].value -= m;\n h++;\n }\n else\n {\n mas.RemoveAt(h);\n }\n if (h > mas.Count - 1)\n {\n h = 0;\n }\n }\n Console.WriteLine(mas[0].number);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input.Split(' ')[0]);\n int m = int.Parse(input.Split(' ')[1]);\n\n var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n int max = 0;\n int last = 0;\n for(int i=0;i max)\n {\n max = x;\n last = i + 1;\n }\n else if( x == max)\n {\n last = i + 1;\n }\n }\n\n\n Console.WriteLine(last);\n // Console.ReadKey();\n }\n\n // Console.ReadKey();\n\n\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _450A\n{\n class item\n {\n public int index;\n public int value;\n public item(int index,int value)\n {\n this.index = index;\n this.value = value;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n string[] l1 = Console.ReadLine().Split();\n int n = int.Parse(l1[0]), m = int.Parse(l1[1]);\n int[] a = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();\n Queue q = new Queue();\n for(int i = 0;i m)\n {\n curChild.value -= m;\n q.Enqueue(curChild);\n }\n }\n Console.WriteLine(q.Dequeue().index);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n int n,m;\n line = Console.ReadLine();\n string[] tokens = line.Split();\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n line = Console.ReadLine();\n string[] token = line.Split();\n int[] a = Array.ConvertAll(token, int.Parse);\n int mx =-1,id=0;\n for (int i = 0; i < n; i++)\n {\n a[i] += m - 1;\n a[i] /= m;\n }\n for (int i = n-1; i >=0; i--)\n if (a[i] > mx)\n {\n mx = a[i];\n id = i + 1;\n }\n Console.WriteLine(id + \"\\n\");\n }\n }\n}\n"}, {"source_code": "using System;\n\t\t\t\t\t\npublic class Program\n{\n\tpublic static void Main()\n\t{\n string txt = Console.ReadLine();\n string[] nums = txt.Split(' ');\n int n = Convert.ToInt32(nums[0]), k = Convert.ToInt32(nums[1]), candall=0;\n txt = Console.ReadLine(); nums = txt.Split(' ');\n int[] a = new int[n];\n for ( int i1=0; i1k)\n {\n a[i] -= k;candall -= k;\n }\n else if ( a[i] !=0)\n {\n candall -= a[i]; a[i] = 0;\n }\n }\n Console.WriteLine(i+1);\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\npublic class Solver\n{\n public void Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n int[] a = ReadIntArray();\n var q = new System.Collections.Generic.Queue(a);\n var numsQ = new System.Collections.Generic.Queue(Enumerable.Range(1, a.Count()));\n int last = -1;\n while (q.Any())\n {\n last = numsQ.Dequeue();\n int value = q.Dequeue();\n if (value > m)\n {\n q.Enqueue(value - m);\n numsQ.Enqueue(last);\n }\n }\n Write(last);\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n#if DEBUG\n // reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n new Solver().Solve();\n //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch \n {\n#if DEBUG\n // Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries); }\n public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }\n public static int ReadInt() { return int.Parse(ReadToken()); }\n public static long ReadLong() { return long.Parse(ReadToken()); }\n public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }\n public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }\n public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }\n public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }\n public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;\n }\n public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }\n public static void WriteArray(IEnumerable array) { writer.WriteLine(string.Join(\" \", array)); }\n public static void Write(params object[] array) { WriteArray(array); }\n public static void WriteLines(IEnumerable array) { foreach (var a in array)writer.WriteLine(a); }\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n private static T[] Init(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem450A {\n class Program {\n static int distributeCandy(Queue childrenQueue, int nOfChildren, int firstDistribution) {\n int lastChildrenIndex = 0;\n while (childrenQueue.Count > 0) {\n if (childrenQueue.Count == 1) {\n int[] lastChildren = childrenQueue.Dequeue();\n lastChildrenIndex = lastChildren[1];\n break;\n }\n\n int[] actChildren = childrenQueue.Dequeue();\n if (firstDistribution < actChildren[0]) {\n int[] actChildren1 = new int[2] { actChildren[0] - firstDistribution, actChildren[1] };\n childrenQueue.Enqueue(actChildren1);\n }\n\n \n }\n\n return lastChildrenIndex;\n }\n\n static void Main(string[] args) {\n string[] input1 = Console.ReadLine().Split(' ');\n string[] input2 = Console.ReadLine().Split(' ');\n\n int nOfChildren = Convert.ToInt32(input1[0]);\n int firstDistribution = Convert.ToInt32(input1[1]);\n Queue childrenQueue = new Queue();\n for (int i = 0; i < nOfChildren; i++) {\n int actChilden = Convert.ToInt32(input2[i]);\n int position = i+1;\n int[] tmp = new int[2] {actChilden, position};\n childrenQueue.Enqueue(tmp);\n }\n\n int lastChildren = distributeCandy(childrenQueue, nOfChildren, firstDistribution);\n Console.WriteLine(lastChildren);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n public static void Main()\n {\n int[] parameters, children;\n int i = -1;\n\n parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n children = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();\n\n while (true)\n {\n ++i;\n \n if (i == children.Length)\n i = 0;\n \n if (children.Sum() == children[i])\n break;\n \n if (children[i] != 0)\n {\n children[i] -= parameters[1];\n \n if (children[i] < 0)\n children[i] = 0;\n }\n }\n\n Console.WriteLine(i + 1);\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Text.RegularExpressions;\nusing System.Globalization;\n\nnamespace WarmingUpC_Sharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n int n = NM[0], m = NM[1];\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n Queue line = new Queue();\n Queue candies = new Queue();\n for (int i = 1; i <= n; i++)\n {\n line.Enqueue(i);\n candies.Enqueue(a[i - 1]);\n }\n while (line.Count > 1)\n {\n int pivot = candies.Dequeue() - m;\n if (pivot <= 0)\n {\n line.Dequeue();\n }\n else\n {\n int index = line.Dequeue();\n candies.Enqueue(pivot);\n line.Enqueue(index);\n }\n }\n Console.WriteLine(line.Dequeue()); \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\npublic class Solver\n{\n #region Main\n protected static TextReader reader;\n protected static TextWriter writer;\n static void Main()\n {\n reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n var n = ReadInt();\n var m = ReadInt();\n var a = ReadIntArray();\n int i = 0, h = -1;\n while (a.Any(z => z > 0))\n {\n if (a[i % n] - m > 0)\n {\n a[i % n] -= m;\n }\n else\n {\n a[i % n] = h--;\n }\n i++;\n }\n writer.WriteLine(Array.IndexOf(a, a.Min()) + 1);\n reader.Close();\n writer.Close();\n }\n #endregion\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Linq;\npublic class VJ\n{\n static int Main()\n {\n process();\n Console.ReadLine();\n return 0;\n }\n static void process()\n {\n int[] nm=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int[] ar=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int max=0;\n bool f=true;\n while(f)\n {\n f=false;\n for(int i=0;i0)\n {\n ar[i]-=nm[1];\n max=i;\n f=true;\n }\n }\n }\n Console.WriteLine(max+1);\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 n, m, i, k;\n String input=Console.ReadLine();\n String[] inputsplit = input.Split(' ');\n n = Convert.ToInt32(inputsplit[0]);\n k = n;\n Int32[] a = new Int32[n];\n m = Convert.ToInt32(inputsplit[1]);\n input = Console.ReadLine();\n inputsplit = input.Split(' ');\n for (i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(inputsplit[i]);\n }\n i=0;\n while (true)\n {\n if (a[i] > 0){\n a[i] -= m;\n if (a[i] <= 0)\n k--;\n }\n if (k == 0)\n {\n Console.WriteLine(i+1);\n return;\n }\n i=(i+1)%n;\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Generic\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = input[0];\n var m = input[1];\n\n input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int max = (input[0] - 1) / m;\n int maxIndex = 1;\n int tmp;\n for (int i = 1; i < n; i++)\n {\n tmp = (input[i] - 1) / m;\n if (tmp >= max)\n {\n max = tmp;\n maxIndex = i + 1;\n }\n }\n\n Console.WriteLine(maxIndex);\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CodeF1\n{\n class X\n {\n public int val { get; set; }\n public int I { get; set; }\n\n }\n class Program\n {\n private static void Main()\n {\n var a =\n Console.ReadLine()\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(Int32.Parse)\n .ToArray();\n var n = a[0];\n var m = a[1];\n\n a =\n Console.ReadLine()\n .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(Int32.Parse)\n .ToArray();\n\n var list = new List();\n\n for (int i = 0; i < n; i++)\n {\n list.Add(new X() { I = i + 1, val = a[i] });\n }\n\n var listB = new List();\n\n while (list.Count > 0)\n {\n\n\n for (int i = 0; i < list.Count; i++)\n {\n if (list[i].val > m)\n {\n listB.Add(new X() { val = list[i].val - m, I = list[i].I });\n }\n \n }\n if (listB.Count == 0)\n {\n Console.WriteLine(list[list.Count - 1].I);\n return;\n }\n else\n {\n list = listB;\n listB = new List();\n }\n }\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces450A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m;\n var a = Console.ReadLine().Split(' ');\n n = int.Parse(a[0]);\n m = int.Parse(a[1]);\n \n int max = 0, index = 0;\n a = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n int r = (int.Parse(a[i]) - 1) / m;\n if (r >= max)\n {\n max = r;\n index = i;\n }\n }\n Console.WriteLine(index + 1);\n Console.Read();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces450A\n{\n class Program\n {\n struct dat\n {\n public byte i, need;\n public static dat cr(int i,int need)\n {\n dat d;\n d.i = (byte)i;\n d.need = (byte)need;\n return d;\n }\n }\n static void Main(string[] args)\n {\n byte n, m;\n Queue q = new Queue();\n var a = Console.ReadLine().Split(' ');\n n = (byte)int.Parse(a[0]);\n m = (byte)int.Parse(a[1]);\n\n a = Console.ReadLine().Split(' ');\n for (int i = 1; i <= n; i++)\n {\n q.Enqueue(dat.cr(i, (byte)int.Parse(a[i - 1])));\n }\n while(q.Count >1)\n {\n dat d = q.First();\n if(d.need >m)\n {\n d.need -= m;\n q.Dequeue();\n q.Enqueue(d);\n }\n else\n {\n q.Dequeue();\n }\n }\n Console.WriteLine(q.First().i);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Round257\n{\n class A\n {\n class Child\n {\n public int rank;\n public int candies;\n }\n\n static void Main(string[] args)\n {\n int n, m;\n ReadIntegers(out n, out m);\n\n List candies = ReadIntegerList();\n List children = new List();\n for (int i = 0; i < n; i++)\n {\n Child c = new Child();\n c.rank = i + 1;\n c.candies = candies[i];\n\n children.Add(c);\n }\n\n int lastChild = 0;\n while (children.Count > 0)\n {\n if (children[0].candies <= m)\n {\n lastChild = children[0].rank;\n }\n else\n {\n Child c = new Child();\n c.rank = children[0].rank;\n c.candies = children[0].candies - m;\n\n children.Add(c);\n }\n\n children.RemoveAt(0);\n }\n\n Console.WriteLine(lastChild);\n }\n\n #region InputRoutines\n static string RString()\n {\n return Console.ReadLine();\n }\n\n static void ReadInteger(out int a)\n {\n a = int.Parse(Console.ReadLine());\n }\n\n static void ReadIntegers(out int a, out int b)\n {\n int[] inputInt = ReadIntegerArray();\n\n a = inputInt[0];\n b = inputInt[1];\n }\n\n static void ReadIntegers(out int a, out int b, out int c)\n {\n int[] inputInt = ReadIntegerArray();\n\n a = inputInt[0];\n b = inputInt[1];\n c = inputInt[2];\n }\n\n static int[] ReadIntegerArray()\n {\n List integerList = new List();\n RString().Split(\" \".ToArray())\n .ToList()\n .ForEach(e => integerList.Add(int.Parse(e)));\n\n return integerList.ToArray();\n }\n\n static long[] ReadLongArray()\n {\n List longList = new List();\n RString().Split(\" \".ToArray())\n .ToList()\n .ForEach(e => longList.Add(long.Parse(e)));\n\n return longList.ToArray();\n }\n\n static List ReadIntegerList()\n {\n List integerList = new List();\n RString().Split(\" \".ToArray())\n .ToList()\n .ForEach(e => integerList.Add(int.Parse(e)));\n\n return integerList;\n }\n #endregion\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static int zeroo=0;\n static int k = 0;\n static void Main(string[] args)\n {\n int childs;\n int candies;\n int fatchild;\n int fatchildAt;\n string input;\n int[] kidsline;\n fatchild = 0;\n fatchildAt = 0;\n input = Console.ReadLine();\n childs = Convert.ToInt32(input.Split(' ')[0]);\n candies = Convert.ToInt32(input.Split(' ')[1]);\n kidsline = new int[childs];\n input = Console.ReadLine();\n if(kidsline[0] > candies)\n fatchild = kidsline[0];\n else\n fatchild = 0;\n while (isInt(kidsline) == false)\n {\n for (int a = 0; a < childs; a++)\n {\n if (k == 0)\n {\n kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);\n if (!(kidsline[a] >= 1 && kidsline[a] <= 100))\n continue;\n }\n if (k != 0)\n {\n if ((kidsline[a] >= fatchild && kidsline[a] > candies) || (zeroo == kidsline.Length && kidsline[a] > 0 && k != 0))\n {\n fatchild = kidsline[a];\n fatchildAt = a + 1;\n }\n kidsline[a] -= candies;\n zeroo = 0;\n if (isInt(kidsline) == true)\n {\n if (zeroo == kidsline.Length)\n fatchildAt = a+1;\n break;\n }\n }\n }\n k++;\n zeroo=0;\n }\n if (fatchildAt == 0)\n fatchildAt = kidsline.Length;\n Console.WriteLine(fatchildAt);\n }\n public static bool isInt(int[] kidsline)\n {\n bool zeros = false;\n int zero = 0;\n foreach (var item in kidsline)\n {\n if (item <= 0)\n {\n zero++;\n zeroo++;\n }\n }\n if (zero == kidsline.Length && k !=0)\n zeros = true;\n return zeros;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n String[] input = Console.ReadLine().Split(' ');\n long n = Int64.Parse(input[0]);\n long m = Int64.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n\n List longList = new List();\n long max = 0;\n long temp = 0;\n for (int i = 0; i < n; i++)\n {\n temp = Int64.Parse(input[i]);\n longList.Add(temp);\n if (temp > max) max = temp;\n }\n\n int j = longList.Count;\n while (longList.ElementAt(j-1) < (max - 1) / m * m + 1) j--;\n\n Console.WriteLine(j);\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Remoting.Messaging;\nusing System.Security;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic class User\n\t\t{\n\t\t\tpublic int c;\n\n\t\t\tpublic int r;\n\t\t}\n\n\t\tpublic class Comparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(User x, User y)\n\t\t\t{\n\t\t\t\tif (x.c < y.c)\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long getGcd(long a, long b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\treturn getGcd(b, a % b);\n\t\t}\n\n\t\tpublic static void WriteYESNO(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string GetString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List getList()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static int Min(int x, int y)\n\t\t{\n\t\t\treturn Math.Min(x, y);\n\t\t}\n\n\t\tpublic static int Max(int x, int y)\n\t\t{\n\t\t\treturn Math.Max(x, y);\n\t\t}\n\n\t\tpublic static int Abs(int x)\n\t\t{\n\t\t\treturn Math.Abs(x);\n\t\t}\n\n\t\tpublic static int getInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static bool Equal(int x, int y, int x1, int y1)\n\t\t{\n\t\t\treturn x == x1 && y == y1;\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic List edges;\n\n\t\t\tpublic int ct;\n\n\t\t\tpublic Vertex()\n\t\t\t{\n\t\t\t\tct = 0;\n\t\t\t\tedges = new List();\n\t\t\t\tfor (var i = 0; i < 26; ++i)\n\t\t\t\t\tedges.Add(0);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Main(string[] args)\n\t\t{\n/*\t\t\tvar input = new StreamReader(\"input.txt\");\n\t\t\tvar output = new StreamWriter(\"output.txt\");*/\n\t\t\tvar arr = getList();\n\t\t\tvar n = arr[0];\n\t\t\tvar m = arr[1];\n\t\t\tarr = getList();\n\t\t\tvar ans = 1;\n\t\t\tvar max = arr[0] / m + (arr[0] % m != 0 ? 1 : 0);\n\t\t\tfor (var i = 1; i < n; ++i)\n\t\t\t{\n\t\t\t\tvar p = arr[i] / m + (arr[i] % m != 0 ? 1 : 0);\n\t\t\t\tif (p >= max)\n\t\t\t\t{\n\t\t\t\t\tans = i + 1;\n\t\t\t\t\tmax = p;\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(ans);\n\t\t\t/*\t\t\tinput.Close();\n\t\t\toutput.Close();*/\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\tpublic static void Main()\n\t{\n\t\tint n, k, j, m, max, i;\n\t\ti = 0;\n\t\tmax = 0;\n\t\tj = 0;\n string[] s = Console.ReadLine().Split();\n n = int.Parse(s[0]);\n m = int.Parse(s[1]);\n int[] a = new int[n];\n string[] line = Console.ReadLine().Split();\n while (j < n)\n {\n \ta[j] = int.Parse(line[j]);\n k = (a[j] - 1 + m)/m;\n if( k > max)\n {\n \tmax = k;\n \ti = j;\n }\n if( k == max)\n {\n \ti = j;\n }\n j ++;\n \n }\n Console.WriteLine(i+1);\n\t}\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _450A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1];\n int lastIndex = 0, counter = n;\n var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();\n while (counter > 0)\n {\n for (int i = 0; i < n; i++)\n {\n if (queue[i] > 0)\n {\n queue[i] -= m;\n if (queue[i] <= 0) counter--;\n }\n if (counter == 0) { lastIndex = i; break; }\n\n }\n }\n Console.WriteLine(lastIndex+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesTemplate\n{\n class Program\n {\n struct Child\n {\n public int Candies;\n public int Number;\n public Child(int candies, int number)\n {\n Candies = candies;\n Number = number;\n }\n }\n static int n;\n static int m;\n static Queue children;\n\n static void Main(string[] args)\n {\n LoadInput();\n\n Solve();\n }\n\n private static void Solve()\n {\n while (children.Count != 1)\n {\n var currentChild = children.Dequeue();\n currentChild.Candies -= m;\n if (currentChild.Candies > 0)\n {\n children.Enqueue(currentChild);\n }\n }\n Console.WriteLine(children.Dequeue().Number);\n }\n\n private static void LoadInput()\n {\n var inp = Console.ReadLine().Split(' ');\n n = int.Parse(inp[0]);\n m = int.Parse(inp[1]);\n children = new Queue(Console.ReadLine().Split(' ').Select((candiesNeeded, index) => new Child(int.Parse(candiesNeeded), index + 1)));\n }\n }\n\n\n static class Helpers\n {\n public static void Print(this IEnumerable source)\n {\n foreach (var item in source)\n {\n Console.Write(\"{0} \", item.ToString());\n }\n Console.WriteLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\n#region ioh\n\nclass Scanner\n{\n private readonly TextReader reader;\n private string[] buffer;\n private int bufferPos;\n\n public Scanner()\n : this(null)\n { }\n\n public Scanner(TextReader reader)\n {\n this.reader = reader ?? Console.In;\n buffer = new string[0];\n }\n\n public string NextTerm()\n {\n if (bufferPos >= buffer.Length)\n {\n buffer = reader.ReadLine().Split(' ');\n bufferPos = 0;\n }\n\n return buffer[bufferPos++];\n }\n\n public int NextInt()\n {\n return int.Parse(NextTerm());\n }\n\n public int[] NextIntArray()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n }\n\n public int[][] NextIntMatrix(int rowCount)\n {\n var matrix = new int[rowCount][];\n\n for (int i = 0; i < matrix.Length; i++)\n {\n matrix[i] = NextIntArray();\n }\n\n return matrix;\n }\n}\n\n#endregion\n\nclass Program\n{\n private static readonly Scanner s = new Scanner();\n\n static void Main(string[] args)\n {\n s.NextInt();\n var m = s.NextInt();\n\n var arr = s.NextIntArray();\n\n var l = arr.Length;\n\n var res = -1;\n\n while (true)\n {\n for (int i = 0; i < arr.Length; i++)\n {\n if (l == 1 && arr[i] > 0)\n {\n res = i + 1;\n break;\n }\n\n if (arr[i] > 0)\n {\n arr[i] -= m;\n if (arr[i] <= 0) l--;\n }\n }\n\n if (res != -1) break;\n }\n\n Console.WriteLine(res);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] z = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int[] ppl = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));\n int numberOfPeople = z[0];\n int candiesPerTurn = z[1];\n Queue queue = new Queue();\n\n //Fill data\n for (int i = 1; i <= numberOfPeople; i++)\n {\n queue.Enqueue(new Person(i, ppl[i - 1]));\n }\n\n int lastChild = 0;\n\n while (queue.Any())\n {\n if (queue.Count == 1)\n {\n lastChild = queue.Peek().id;\n }\n\n Person turn = queue.Dequeue();\n turn.neededCandies -= candiesPerTurn;\n if (turn.neededCandies > 0)\n {\n queue.Enqueue(turn);\n }\n }\n\n Console.WriteLine(lastChild);\n Console.Read();\n }\n\n public struct Person\n {\n public int id;\n public int neededCandies;\n\n public Person(int i, int candies)\n {\n id = i;\n neededCandies = candies;\n }\n }\n }\n}"}, {"source_code": "using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\t', '\\r', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n int index = -1;\n int moves = -1;\n int m = int.Parse(input[1]);\n for(int i = 2, curr; i 0 ? 1 : 0);\n if(curr>=moves) { moves = curr; index = i; }\n }\n Console.WriteLine(index - 1);\n }\n }"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Solver.Ex;\nusing Debug = System.Diagnostics.Debug;\nusing Watch = System.Diagnostics.Stopwatch;\nusing StringBuilder = System.Text.StringBuilder;\nusing System.Numerics;\nnamespace Solver\n{\n public class Solver\n {\n public void Solve()\n {\n var n = sc.Integer();\n var m = sc.Integer();\n var a = sc.Integer(n);\n var b = new int[n];\n var used = new bool[n];\n var pos = 0;\n var count = 0;\n while (true)\n {\n if (used[pos]) { pos = (pos + 1) % n; continue; }\n b[pos] += m;\n if (a[pos] <= b[pos]) { count++; used[pos] = true; }\n if (count == n) break;\n pos = (pos + 1) % n;\n }\n IO.Printer.Out.WriteLine(pos+1);\n \n }\n internal IO.StreamScanner sc;\n static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }\n\n }\n #region Main and Settings\n static class Program\n {\n static void Main(string[] arg)\n {\n#if DEBUG\n var errStream = new System.IO.FileStream(@\"..\\..\\dbg.out\", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);\n Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, \"debugStream\"));\n Debug.AutoFlush = false;\n var sw = new Watch(); sw.Start();\n IO.Printer.Out.AutoFlush = true;\n try\n {\n#endif\n\n var solver = new Solver();\n solver.sc = new IO.StreamScanner(Console.OpenStandardInput());\n solver.Solve();\n IO.Printer.Out.Flush();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.Error.WriteLine(ex.Message);\n Console.Error.WriteLine(ex.StackTrace);\n }\n finally\n {\n sw.Stop();\n Console.ForegroundColor = ConsoleColor.Green;\n Console.Error.WriteLine(\"Time:{0}ms\", sw.ElapsedMilliseconds);\n Debug.Close();\n System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);\n }\n#endif\n }\n\n\n }\n #endregion\n}\n\n#region IO Helper\nnamespace Solver.IO\n{\n public class Printer : System.IO.StreamWriter\n {\n static Printer()\n {\n Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };\n#if DEBUG\n Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };\n#else\n Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };\n#endif\n }\n public static Printer Out { get; set; }\n public static Printer Error { get; set; }\n public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }\n public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }\n public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }\n public void Write(string format, IEnumerable source) { base.Write(format, source.OfType().ToArray()); }\n public void WriteLine(string format, IEnumerable source) { base.WriteLine(format, source.OfType().ToArray()); }\n }\n public class StreamScanner\n {\n public StreamScanner(System.IO.Stream stream) { iStream = stream; }\n private readonly System.IO.Stream iStream;\n private readonly byte[] buf = new byte[1024];\n private int len, ptr;\n private bool eof = false;\n public bool IsEndOfStream { get { return eof; } }\n const byte lb = 33, ub = 126, el = 10, cr = 13;\n public byte read()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }\n return buf[ptr++];\n }\n public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }\n public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }\n public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }\n public string Scan()\n {\n if (eof) throw new System.IO.EndOfStreamException();\n StringBuilder sb = null;\n var enc = System.Text.UTF8Encoding.Default;\n do\n {\n for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;\n if (ptr < len) break;\n ptr = 0;\n if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return \"\"; }\n } while (true);\n do\n {\n var f = ptr;\n for (; ptr < len; ptr++)\n if (buf[ptr] < lb || ub < buf[ptr])\n //if (buf[ptr] == cr || buf[ptr] == el)\n {\n string s;\n if (sb == null) s = enc.GetString(buf, f, ptr - f);\n else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }\n ptr++; return s;\n }\n if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));\n else sb.Append(enc.GetChars(buf, f, len - f));\n ptr = 0;\n\n }\n while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);\n eof = true; return (sb != null) ? sb.ToString() : \"\";\n }\n public long Long()\n {\n long ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public int Integer()\n {\n int ret = 0; byte b = 0; bool isMynus = false;\n const byte zr = 48, nn = 57, my = 45;\n do b = read();\n while (b != my && (b < zr || nn < b));\n if (b == my) { isMynus = true; b = read(); }\n for (; true; b = read())\n if (b < zr || nn < b)\n return isMynus ? -ret : ret;\n else ret = ret * 10 + b - zr;\n }\n public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }\n public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }\n public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }\n public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }\n public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }\n public void Flush() { iStream.Flush(); }\n }\n}\n#endregion\n#region Extension\nnamespace Solver.Ex\n{\n static public partial class EnumerableEx\n {\n static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); }\n static public string AsJoinedString(this IEnumerable ie, string st = \" \") { return string.Join(st, ie); }\n\n }\n}\n#endregion\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nnamespace Practise\n{\n class Program\n {\n public static void Main()\n {\n int n, m;\n String[] input;\n\n input = Console.ReadLine().Split();\n n = Convert.ToInt32(input[0]);\n m = Convert.ToInt32(input[1]);\n\n input = Console.ReadLine().Split();\n int lastTurn = 0;\n int lastId = 0;\n for (int i = 0; i < n; i++)\n {\n int demand = Convert.ToInt32(input[i]);\n int turn = (demand + (m-1))/ m;\n if (turn >= lastTurn)\n {\n lastTurn = turn;\n lastId = i+1;\n }\n }\n Console.WriteLine(lastId);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var n = 0;\n var m = 0;\n var str1 = Console.ReadLine().Split(' ');\n n = int.Parse(str1[0]);\n m = int.Parse(str1[1]);\n var kol = n;\n var children = new int[1000];\n var str = Console.ReadLine().Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n children[i] = int.Parse(str[i]);\n }\n\n for (;;)\n {\n for (int i = 0; i < n; i++)\n {\n if (children[i] > 0)\n {\n children[i] -= m;\n if (children[i] <= 0)\n {\n kol--;\n if (kol == 0)\n {\n Console.WriteLine(i + 1);\n return;\n }\n }\n }\n }\n }\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nclass A450 {\n public static void Main() {\n var line = Console.ReadLine().Split();\n var n = int.Parse(line[0]);\n var m = int.Parse(line[1]);\n var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n for (int i = 0; i < n; ++i) a[i] = (a[i] + m - 1) / m;\n Console.WriteLine(Array.LastIndexOf(a, a.Max()) + 1);\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace R_A_Jzzhu\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n double max = 1, m = double.Parse(s[1]);\n int[] a = new int[n];\n s = Console.ReadLine().Split(' ');\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n if (a[i] > max) max = a[i];\n }\n double k = Math.Ceiling(max / m), ans = 0;\n for (int i = n - 1; i >= 0; i--)\n {\n if (Math.Ceiling(a[i] / m) == k)\n {\n ans = i + 1;\n break;\n }\n }\n Console.WriteLine(ans);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static IO io = new IO();\n static void Main(string[] args)\n {\n int num_N = io.ReadNextInt();\n float num_M = io.ReadNextInt();\n int num_Ans = Console.ReadLine().Split()\n .Select((x, i) => new { value = Math.Ceiling(int.Parse(x) / num_M), Id = i })\n .OrderByDescending(x => x.value).ThenByDescending(x => x.Id)\n .First().Id;\n\n io.PutStr(++num_Ans);\n io.ReadLong();\n }\n }\n class IO\n {\n private static Queue currentLineTokens = new Queue();\n private static string[] ReadAndSplitLine()\n {\n return Console.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n public int ReadNextInt()\n {\n return int.Parse(ReadToken());\n }\n public int ReadNum()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public long ReadLong()\n {\n return Convert.ToInt64(Console.ReadLine());\n }\n public string ReadStr()\n {\n return Console.ReadLine();\n }\n public string[] ReadStrArr()\n {\n return Console.ReadLine().Split(' ');\n }\n public int[] ReadIntArr()\n {\n return Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n }\n public void PutStr(string str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(int str)\n {\n Console.WriteLine(str);\n }\n public void PutStr(long str)\n {\n Console.WriteLine(str);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nclass demo\n{\n static void Main()\n {\n float m = float.Parse(Console.ReadLine().Split()[1]);\n int a = Console.ReadLine().Split()\n .Select((x, i) => new { val = Math.Ceiling(int.Parse(x) / m), id = i })\n .OrderByDescending(x => x.val).ThenByDescending(x => x.id)\n .First().id;\n Console.WriteLine(++a);\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Pr1\n{\n class Program\n {\n static void Main()\n {\n var ab= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n var a= Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);\n int k=0,w=0;\n for(int i=0;i=k)\n {\n k=q;\n w=i+1;\n }\n }\n Console.Write(w);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CSharpConsoleApp\n{\n class Program\n {\n public struct Child\n {\n public int Number;\n\n public int Cnt;\n }\n\n static void Main(string[] args)\n {\n string[] toks = Console.ReadLine().Split();\n int n = int.Parse(toks[0]);\n int m = int.Parse(toks[1]);\n\n toks = Console.ReadLine().Split();\n\n Queue q = new Queue();\n\n for (int i = 0; i < n; i++)\n {\n q.Enqueue(new Child() { Number = i + 1, Cnt = int.Parse(toks[i]) });\n }\n\n int result = -1;\n while (q.Count > 0)\n {\n Child c = q.Dequeue();\n result = c.Number;\n c.Cnt -= m;\n if (c.Cnt > 0)\n q.Enqueue(c);\n\n }\n\n Console.WriteLine(result);\n }\n\n \n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int child = int.Parse(str[0]);\n int candy = int.Parse(str[1]);\n string[] candystr = Console.ReadLine().Split(' ');\n Queue childque = new Queue();\n Queue candyque = new Queue();\n for (int i = 1; i <= child; i++)\n {\n childque.Enqueue(i);\n candyque.Enqueue(int.Parse(candystr[i-1]));\n }\n for(;;)\n {\n int nowchild = childque.Dequeue();\n int nowcandy = candyque.Dequeue() - candy;\n if (nowcandy > 0)\n {\n childque.Enqueue(nowchild);\n candyque.Enqueue(nowcandy);\n }\n if (candyque.Count() == 0)\n {\n Console.WriteLine(nowchild);\n return;\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Jzzhu_and_Children\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = 0;\n int index = -1;\n for (int i = 0; i < n; i++)\n {\n int count = (Next() + m - 1)/m;\n if (count >= max)\n {\n max = count;\n index = i + 1;\n }\n }\n\n writer.WriteLine(index);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\n\nnamespace ConsoleApplication1\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n var s = Console.ReadLine().Split(' ');\n var n = int.Parse(s[0]);\n var m = int.Parse(s[1]);\n s = Console.ReadLine().Split(' ');\n var a = new int[n];\n var l = n;\n for (var i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n }\n while (l > 1)\n {\n for (var i = 0; i < n; i++)\n {\n if (a[i] > 0)\n {\n a[i] -= m;\n\n if (a[i] <= 0)\n l--;\n }\n if (l == 1)\n break;\n }\n }\n for (var i = 0; i < n; i++)\n {\n if (a[i] <= 0) continue;\n Console.WriteLine(i+1);\n return;\n }\n }\n }\n}"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _257a\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var a = readIntArray();\n var s = new Queue>();\n for (int i = 0; i < n; i++)\n {\n s.Enqueue(Tuple.Create(i + 1, a[i]));\n }\n\n var last = -1;\n while (true)\n {\n if (s.Count == 0)\n {\n break;\n }\n\n var f = s.Dequeue();\n last = f.Item1;\n if (f.Item2 <= m)\n {\n continue;\n }\n else\n {\n s.Enqueue(Tuple.Create(last, f.Item2 - m));\n }\n }\n\n Console.WriteLine(last);\n\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static void Main(string[] args) {\n //Console.SetIn(new StreamReader(\"file.txt\"));\n Dictionary d = new Dictionary();\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]), m = int.Parse(s[1]);\n int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));\n int ans = 0, max = 0;\n for (int i = 0; i < n; i++) {\n int c = v[i] / m;\n if (v[i] % m != 0)\n c++;\n if (c >= max) {\n max = c;\n ans = i + 1;\n }\n }\n Console.Write(ans);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF_R257\n{\n public class Task_A\n {\n static void Main(string[] args)\n {\n#if !ONLINE_JUDGE\n Console.SetIn(new StreamReader(@\"a_input.txt\"));\n#endif\n new Task_A().Solve();\n }\n\n private void Solve()\n {\n var parts = Console.ReadLine().Split();\n var n = int.Parse(parts[0]);\n var m = int.Parse(parts[1]);\n var a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var q = new Queue>();\n\n for (int i = 0; i < n; i++)\n {\n var child = new Tuple(i+1, a[i]);\n q.Enqueue(child);\n }\n\n var last = -1;\n while (q.Count != 0)\n {\n var child = q.Dequeue();\n if (child.Item2 > m)\n {\n q.Enqueue(new Tuple(child.Item1, child.Item2 - m));\n }\n else\n {\n last = child.Item1;\n }\n }\n\n Console.WriteLine(last);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace CodeForces.PRACTICE\n{\n // Jzzhu and Children (implementation)\n class _450A\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = int.Parse(ss[i]);\n int max = 0;\n int maxPos = -1;\n for (int i = n - 1; i >= 0; i--)\n {\n int db = a[i] / m + Math.Sign(a[i] % m);\n if (db > max) { max = db; maxPos = i; }\n }\n Console.WriteLine(maxPos + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n class Entity\n {\n public int Count { get; set; }\n\n public int Number { get; set; }\n }\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadLine().Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n var queue = new Queue();\n input = Console.In.ReadLine().Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);\n for(int i = 0; i < n; i++)\n {\n var entity = new Entity()\n {\n Number = i + 1,\n Count = Int32.Parse(input[i])\n };\n queue.Enqueue(entity);\n }\n int lastNumber = -1;\n while(queue.Count != 0)\n {\n Entity next = queue.Dequeue();\n next.Count -= m;\n lastNumber = next.Number;\n if(next.Count > 0)\n {\n queue.Enqueue(next);\n }\n }\n Console.WriteLine(lastNumber); \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class A\n {\n //*\n\n static void ReadStr(int[] a, int n)\n {\n string s = Console.ReadLine();\n if (n == 1)\n {\n a[0] = Convert.ToInt32(s);\n return;\n }\n string[] splitstr = s.Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(splitstr[i]);\n }\n }\n static void Main(string[] args)\n {\n \n string s = Console.ReadLine();\n string[] splitStr = s.Split(' ');\n int n = Convert.ToInt32(splitStr[0]);\n int m = Convert.ToInt32(splitStr[1]);\n\n int[] a = new int[n];\n ReadStr(a, n);\n\n int max = -1;\n int ind = -1;\n for (int i = 0; i < n; i++)\n {\n if ((a[i]-1) / m >= max)\n {\n max = (a[i]-1) / m;\n ind = i;\n }\n }\n Console.WriteLine(ind+1);\n\n\n }\n /**/\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n;\n int m;\n Input.Next(out n, out m);\n int[] input = Input.ArrayInt().ToArray();\n int output = GetLastChildGoingHome(input, m);\n Console.WriteLine(output);\n \n \n }\n\n public static int GetLastChildGoingHome(int[] inputs, int candies)\n {\n for (int i = 0; i < inputs.Length; i++)\n {\n inputs[i] = inputs[i] % candies == 0 ? inputs[i] / candies : ((inputs[i] / candies) + 1);\n }\n\n int last = 0;\n int lastIdx = 0;\n\n for (int i = 0; i < inputs.Length; i++)\n {\n if (inputs[i] >= last)\n {\n last = inputs[i];\n lastIdx = i;\n }\n }\n\n return lastIdx + 1;\n }\n }\n\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return _line != null;\n }\n\n public static bool Next(out long a)\n {\n var ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a)\n {\n var ok = Next();\n a = ok ? int.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out int a, out int b)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static bool Next(out int a, out int b, out int c, out int d, out int e, out int f)\n {\n var ok = Next();\n if (ok)\n {\n var array = _line.Split(' ').Select(int.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n f = array[5];\n }\n else\n {\n a = b = c = d = e = f = 0;\n }\n return ok;\n }\n\n public static IEnumerable ArrayLong()\n {\n return !Next() ? new List() : _line.Split().Select(long.Parse);\n }\n\n public static IEnumerable ArrayInt()\n {\n return !Next() ? new List() : _line.Split().Select(int.Parse);\n }\n\n public static int[,] GetMatrix(int rows, int cols)\n {\n int[,] matrix = new int[rows, cols];\n int row = 0;\n int col = 0;\n while (Next())\n {\n IEnumerable numbers = _line.Split().Select(int.Parse);\n IEnumerator iter = numbers.GetEnumerator();\n while (iter.MoveNext())\n {\n matrix[row, col++] = iter.Current;\n }\n row++;\n col = 0;\n }\n return matrix;\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_JzzhuChildren\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] t = Console.ReadLine().Split(' ');\n int n = int.Parse(t[0]);\n int m = int.Parse(t[1]);\n List a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();\n List index = Enumerable.Range(0, a.Count()).ToList();\n while(a.Count() >1)\n {\n if(a[0] <= m)\n {\n a.RemoveAt(0);\n index.RemoveAt(0);\n }\n else\n {\n a[0] = a[0] - m;\n a.Add(a[0]);\n a.RemoveAt(0);\n index.Add(index[0]);\n index.RemoveAt(0);\n }\n }\n Console.WriteLine(index[0] + 1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n\n string[] s2 = Console.ReadLine().Split(' ');\n\n int[] mas = new int[n];\n for (int i = 0; i < n; i++)\n {\n mas[i] = int.Parse(s2[i]);\n }\n\n int j = 0;\n int count = 0;\n while (true)\n {\n if (mas[j] > 0)\n {\n mas[j] -= m;\n if (mas[j] <= 0) count++;\n if (count >= n) break;\n }\n j++;\n j %= n;\n }\n Console.WriteLine(j + 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace coder\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte[] inputBuffer = new byte[1024];\n System.IO.Stream inputStream = Console.OpenStandardInput(inputBuffer.Length);\n Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length));\n\n int n, m, index=0;\n int[] a = new int[101];\n string arr;\n bool b = false;\n string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });\n\n n = int.Parse(arr1[0]);\n m = int.Parse(arr1[1]);\n\n arr = Console.ReadLine();\n arr1 = Regex.Split(arr, \" \");\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(arr1[i]);\n }\n\n while(!b)\n {\n for (int i = 0; i < n; i++)\n {\n if(a[i]>0)\n {\n a[i] = a[i] - m;\n index = i+1;\n b = true;\n }\n }\n if (b == false)\n {\n b = true;\n }\n else { b = false; }\n }\n \n Console.WriteLine(index);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n int[] a = new int[n];\n List ai = new List();\n for(int i = 0; i < n; i++) {\n a[i] = Next();\n ai.Add(i);\n }\n int ans = 1;\n while(ai.Count > 0) {\n ans = ai[ai.Count - 1];\n List newai = new List();\n foreach(int t in ai) {\n a[t] -= m;\n if(a[t] > 0)\n newai.Add(t);\n }\n ai.Clear();\n ai.AddRange(newai);\n }\n writer.WriteLine(ans + 1);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\n\npublic class Solver\n{\n public object Solve()\n {\n int n = ReadInt();\n int m = ReadInt();\n var a = ReadIntArray();\n\n int max = 0;\n int nmax = -1;\n for (int i = 0; i < n; i++)\n {\n int x = (a[i] - 1) / m + 1;\n if (x >= max)\n {\n max = x;\n nmax = i;\n }\n }\n\n return nmax + 1;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = Console.In;\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n var ts = DateTime.Now;\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read/Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\n\n\n\n\nnamespace ConsoleApplication252\n{\n\n class Program\n {\n\n static bool P(int n)\n {\n for (int i = 2; i <= Math.Sqrt(n); i++)\n {\n if (n % i == 0)\n {\n return false;\n }\n }\n return true;\n }\n static bool Need(int[] m)\n {\n for (int i = 0; i < m.Length; i++)\n {\n if (m[i] > 0)\n {\n return false;\n }\n }\n return true;\n }\n static void Main()\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int m = int.Parse(ss[1]);\n string[] s = Console.ReadLine().Split();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(s[i]);\n }\n int p = 0;\n while (true)\n {\n if (Need(a))\n {\n break;\n }\n for (int i = 0; i < n; i++)\n {\n if (a[i] > 0)\n {\n a[i] -= m;\n p = i + 1;\n }\n }\n }\n Console.WriteLine(p);\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n List list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n List res = new List();\n for (int i = 0; i < nm[0]; i++)\n {\n res.Add(Convert.ToInt32(Math.Ceiling((double)list[i] / nm[1])));\n }\n Console.Write(res.LastIndexOf(res.Max()) + 1);\n }\n }\n}"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] input = Console.ReadLine().Split(' ');\n int n = Int32.Parse(input[0]);\n int m = Int32.Parse(input[1]);\n int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int[] b = new int[n];\n for (int i = 0; i < n; i++)\n b[i] = i + 1;\n Array.Sort(a, b);\n bool exist = false;\n for (int i = 0; i < n; i++)\n {\n if (a[i] > m)\n exist = true;\n }\n if (exist)\n Console.WriteLine(b[n - 1]);\n else\n Console.WriteLine(n);\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Dynamic;\nusing System.Linq;\n\nnamespace _450_A_Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int last=0;\n string[] s1 = Console.ReadLine().Split(' ');\n int[] a = Array.ConvertAll(s1, int.Parse);\n\n while (a.Sum() != 0)\n {\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] > m)\n {\n a[i] = a[i] - m;\n last = i + 1;\n }\n else\n {\n a[i] = 0;\n }\n }\n }\n \n\n Console.WriteLine(last);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Dynamic;\n\nnamespace _450_A_Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int last = n;\n string[] s1 = Console.ReadLine().Split(' ');\n int[] a = Array.ConvertAll(s1, int.Parse);\n for (int i = 0; i < a.Length; i++)\n {\n if (a[i] > m)\n {\n a[i] = a[i] - m;\n last = i + 1;\n }\n }\n Console.WriteLine(last);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace _257div\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n\n int n = int.Parse(s[0]);\n int m = int.Parse(s[1]);\n int max = m;\n int ind = n; \n string[] ss = Console.ReadLine().Split(); \n\n int[] st = new int[n];\n\n for (int i = 0; i < n; i++)\n {\n st[i] = int.Parse(ss[i])/m;\n if (int.Parse(ss[i])%m >0)\n {\n st[i]++; \n }\n }\n\n for (int i = 0; i < n; i++)\n {\n if (st[i] >=max)\n {\n max = st[i];\n ind = i + 1; \n }\n }\n\n Console.WriteLine(ind);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Round_257\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int m = Convert.ToInt32(s[1]);\n s = Console.ReadLine().Split(' ');\n int max = -1;\n int ans = 0, tmp = 0;\n for (int i = 0; i < n; i++)\n {\n tmp = int.Parse(s[i])/m;\n if (tmp>= max)\n {\n max = tmp;\n ans = i + 1;\n }\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n private static void Main(string[] args)\n {\n string input = Console.ReadLine();\n int n = int.Parse(input.Split(' ')[0]);\n int m = int.Parse(input.Split(' ')[1]);\n\n var inputs = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));\n int max = 0;\n int last = 0;\n for(int i=0;i max)\n {\n max = x;\n last = i + 1;\n }\n else if( x == max)\n {\n last = i + 1;\n }\n }\n\n\n Console.WriteLine(last);\n // Console.ReadKey();\n }\n\n // Console.ReadKey();\n\n\n\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Jzzhu_and_Children\n{\n class Program\n {\n static void Main(string[] args)\n {\n string line;\n int n,m;\n line = Console.ReadLine();\n string[] tokens = line.Split();\n n = int.Parse(tokens[0]);\n m = int.Parse(tokens[1]);\n line = Console.ReadLine();\n string[] token = line.Split();\n int[] a = Array.ConvertAll(token, int.Parse);\n int mx =-1,id=0;\n for (int i = n-1; i >=0; i--)\n if (a[i] > mx)\n {\n mx = a[i];\n id = i + 1;\n }\n Console.WriteLine(id + \"\\n\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Jzzhu_and_Children\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n int max = 0;\n int index = -1;\n for (int i = 0; i < n; i++)\n {\n int count = Next()/m;\n if (count >= max)\n {\n max = count;\n index = i + 1;\n }\n }\n\n writer.WriteLine(index);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class A\n {\n //*\n\n static void ReadStr(int[] a, int n)\n {\n string s = Console.ReadLine();\n if (n == 1)\n {\n a[0] = Convert.ToInt32(s);\n return;\n }\n string[] splitstr = s.Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(splitstr[i]);\n }\n }\n static void Main(string[] args)\n {\n \n string s = Console.ReadLine();\n string[] splitStr = s.Split(' ');\n int n = Convert.ToInt32(splitStr[0]);\n int m = Convert.ToInt32(splitStr[1]);\n\n int[] a = new int[n];\n ReadStr(a, n);\n\n int max = -1;\n int ind = -1;\n for (int i = 0; i < n; i++)\n {\n if ((a[i]-1) / m >= max)\n {\n max = a[i] / m;\n ind = i;\n }\n }\n Console.WriteLine(ind+1);\n\n\n }\n /**/\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class A\n {\n //*\n\n static void ReadStr(int[] a, int n)\n {\n string s = Console.ReadLine();\n if (n == 1)\n {\n a[0] = Convert.ToInt32(s);\n return;\n }\n string[] splitstr = s.Split(' ');\n\n for (int i = 0; i < n; i++)\n {\n a[i] = Convert.ToInt32(splitstr[i]);\n }\n }\n static void Main(string[] args)\n {\n \n string s = Console.ReadLine();\n string[] splitStr = s.Split(' ');\n int n = Convert.ToInt32(splitStr[0]);\n int m = Convert.ToInt32(splitStr[1]);\n\n int[] a = new int[n];\n ReadStr(a, n);\n\n int max = -1;\n int ind = -1;\n for (int i = 0; i < n; i++)\n {\n if (a[i] / m >= max)\n {\n max = a[i] / m;\n ind = i;\n }\n }\n Console.WriteLine(ind+1);\n\n\n }\n /**/\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace coder\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n, m, max = 0, index=0;\n bool b = false;\n int[] a = new int[101];\n string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });\n\n n = int.Parse(arr1[0]);\n m = int.Parse(arr1[1]);\n\n arr1 = Console.ReadLine().Split(new Char[] { ' ' });\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(arr1[i]);\n if (max <= a[i])\n {\n max = a[i];\n if (max > m)\n {\n index = i+1;\n b = true;\n }\n }\n }\n if (!b)\n {\n index = n;\n }\n Console.WriteLine(index);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.IO;\n\nnamespace coder\n{\n class Program\n {\n static void Main(string[] args)\n {\n byte[] inputBuffer = new byte[1024];\n System.IO.Stream inputStream = Console.OpenStandardInput(inputBuffer.Length);\n Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length));\n\n int n, m, max = 0, index=0;\n bool b = false;\n int[] a = new int[101];\n string arr;\n string[] arr1 = Console.ReadLine().Split(new Char[] { ' ' });\n\n n = int.Parse(arr1[0]);\n m = int.Parse(arr1[1]);\n\n arr = Console.ReadLine();\n arr1 = Regex.Split(arr, \" \");\n\n for (int i = 0; i < n; i++)\n {\n a[i] = int.Parse(arr1[i]);\n if (max <= a[i])\n {\n max = a[i];\n\n if (max > m)\n {\n index = i+1;\n b = true;\n }\n }\n }\n if (!b)\n {\n index = n;\n }\n Console.WriteLine(index);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n int m = Next();\n int ans = 1;\n int aa = Next();\n for(int i = 1; i < n; i++) {\n int a = Next();\n if(a > aa) {\n aa = a;\n ans = i + 1;\n }\n }\n if(aa <= m) {\n ans = n;\n }\n writer.WriteLine(ans);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n List list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n if(list.Max() > nm[1])\n {\n Console.Write(list.IndexOf(list.Where(x => x > nm[1]).Last()) + 1);\n return;\n }\n else\n {\n Console.Write(list.Count());\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n List list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();\n Console.Write(list.LastIndexOf(list.Max()) + 1);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n//using System.Threading.Tasks;\n\nnamespace Problem450A {\n class Program {\n static int distributeCandy(Queue childrenQueue, int nOfChildren, int firstDistribution) {\n int lastChildrenIndex = 0;\n while (childrenQueue.Count > 0) {\n int[] actChildren = childrenQueue.Dequeue();\n if (firstDistribution < actChildren[0]) {\n int[] actChildren1 = new int[2] { actChildren[0] - firstDistribution, actChildren[1] };\n childrenQueue.Enqueue(actChildren1);\n }\n\n if (childrenQueue.Count == 1) {\n int[] lastChildren = childrenQueue.Dequeue();\n lastChildrenIndex = lastChildren[1];\n }\n }\n\n return lastChildrenIndex;\n }\n\n static void Main(string[] args) {\n string[] input1 = Console.ReadLine().Split(' ');\n string[] input2 = Console.ReadLine().Split(' ');\n\n int nOfChildren = Convert.ToInt32(input1[0]);\n int firstDistribution = Convert.ToInt32(input1[1]);\n Queue childrenQueue = new Queue();\n for (int i = 0; i < nOfChildren; i++) {\n int actChilden = Convert.ToInt32(input2[i]);\n int position = i+1;\n int[] tmp = new int[2] {actChilden, position};\n childrenQueue.Enqueue(tmp);\n }\n\n int lastChildren = distributeCandy(childrenQueue, nOfChildren, firstDistribution);\n Console.WriteLine(lastChildren);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\npublic class VJ\n{\n static int Main()\n {\n process();\n Console.ReadLine();\n return 0;\n }\n static void process()\n {\n int[] nm=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int[] ar=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int max=nm[0]-1;\n for(int i=nm[0]-2;i>=0;i--)\n {\n if(ar[i]>ar[max]) max=i;\n }\n if(ar[max](Console.ReadLine().Split(' ') , r => int.Parse(r));\n int[] ar=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int max=nm[0]-1;\n for(int i=nm[0]-2;i>=0;i--)\n {\n if(ar[i]>ar[max]) max=i;\n }\n Console.WriteLine(max+1);\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\npublic class VJ\n{\n static int Main()\n {\n process();\n Console.ReadLine();\n return 0;\n }\n static void process()\n {\n int[] nm=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int[] ar=Array.ConvertAll(Console.ReadLine().Split(' ') , r => int.Parse(r));\n int max=nm[0]-1;\n for(int i=nm[0]-2;i>=0;i--)\n {\n if(ar[i]>ar[max]) max=i;\n }\n if(ar[max] candies)\n fatchild = kidsline[0];\n else\n fatchild = 0;\n while (isInt(kidsline) == false)\n {\n for (int a = 0; a < childs; a++)\n {\n if (k == 0)\n {\n kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);\n if (!(kidsline[a] >= 1 && kidsline[a] <= 100))\n continue;\n }\n if ((kidsline[a] >= fatchild && kidsline[a] > candies )|| (zeroo == kidsline.Length && kidsline[a] > 0 && k!=0))\n {\n fatchild = kidsline[a];\n fatchildAt = a + 1;\n }\n kidsline[a] -= candies;\n }\n k++;\n zeroo=0;\n }\n if (fatchildAt == 0)\n fatchildAt = kidsline.Length;\n Console.WriteLine(fatchildAt);\n }\n public static bool isInt(int[] kidsline)\n {\n bool zeros = false;\n int zero = 0;\n foreach (var item in kidsline)\n {\n if (item <= 0)\n {\n zero++;\n zeroo++;\n }\n }\n if (zero == kidsline.Length && k !=0)\n zeros = true;\n return zeros;\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n static void Main(string[] args)\n {\n int childs;\n int candies;\n int fatchild;\n int fatchildAt;\n string input;\n int[] kidsline;\n fatchild = 0;\n fatchildAt = 0;\n input = Console.ReadLine();\n childs = Convert.ToInt32(input.Split(' ')[0]);\n candies = Convert.ToInt32(input.Split(' ')[1]);\n kidsline = new int[childs];\n input = Console.ReadLine();\n if(kidsline[0] > candies)\n fatchild = kidsline[0];\n else\n fatchild = 0;\n for (int a = 0; a < childs; a++)\n {\n kidsline[a] = Convert.ToInt32(input.Split(' ')[a]);\n if(!(kidsline[a] >= 1 && kidsline[a] <= 100))\n continue;\n if (kidsline[a] >= fatchild && kidsline[a] > candies)\n {\n fatchild = kidsline[a];\n fatchildAt = a + 1;\n }\n }\n if (fatchildAt == 0)\n fatchildAt = kidsline.Length;\n Console.WriteLine(fatchildAt);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n String[] input = Console.ReadLine().Split(' ');\n long n = Int64.Parse(input[0]);\n long m = Int64.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n\n List longList = new List();\n long max = 0;\n long temp = 0;\n for (int i = 0; i < n; i++)\n {\n temp = Int64.Parse(input[i]);\n longList.Add(temp);\n if (temp > max) max = temp;\n }\n\n int j = longList.Count;\n while (longList.ElementAt(j-1) < max / m * m) j--;\n\n Console.WriteLine(j);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n String[] input = Console.ReadLine().Split(' ');\n long n = Int64.Parse(input[0]);\n long m = Int64.Parse(input[1]);\n input = Console.ReadLine().Split(' ');\n\n List longList = new List();\n long max = 0;\n long temp = 0;\n for (int i = 0; i < n; i++)\n {\n temp = Int64.Parse(input[i]);\n longList.Add(temp);\n if (temp > max) max = temp;\n }\n\n int j = longList.Count;\n while (longList.ElementAt(j-1) < max / m * m) j--;\n\n Console.WriteLine(j+1);\n \n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _450A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1];\n int max = 0, maxIndex = 0;\n var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();\n for (int i=0;i= max) { max = queue[i]; maxIndex = i; }\n }\n Console.WriteLine(maxIndex+1);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\n\nnamespace _450A\n{\n class Program\n {\n static void Main()\n {\n var s = Console.ReadLine().Split().Select(int.Parse).ToArray();\n var n = s[0]; var m = s[1];\n int max = 0, maxIndex = 0;\n var queue = Console.ReadLine().Split().Select(int.Parse).ToArray();\n for (int i=0;i max) { max = queue[i]; maxIndex = i; }\n }\n Console.WriteLine(maxIndex+1);\n }\n }\n}"}], "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c"} {"source_code": "using System;\nusing System.Collections.Generic;\nclass Program\n{\n\tstatic void Main(string[] args)\n\t{\n\t\tstring[] str = Console.ReadLine().Split();\n\t\tlong N = long.Parse(str[0]);\n\t\tlong L = long.Parse(str[1]);\n\t\tlong R = long.Parse(str[2]);\n\t\tlong ans = 1;\n\t\tlong mod = 1000000007;\n\t\tlong[,]A = new long[N+1,3];\n\t\tlong a1 = (R+2)/3 - (L+1)/3;\n\t\tlong a2 = (R+1)/3 - L/3;\n\t\tlong a3 = R/3 - (L-1)/3;\n\t\tA[0,0] = a1;\n\t\tA[0,1] = a2;\n\t\tA[0,2] = a3;\n\t\tfor(var i=0;i ((1 << i) & n) != 0)\n .Select(i => count[i])\n .Aggregate(\n new long[] { 1, 0, 0 },\n (x, y) => new long[]\n {\n (x[0] * y[0] + x[1] * y[2] + x[2] * y[ 1]) % mod,\n (x[0] * y[1] + x[1] * y[0] + x[2] * y[ 2]) % mod,\n (x[0] * y[2] + x[1] * y[1] + x[2] * y[ 0]) % mod\n })\n [0]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace ProblemC\n{\n /// \n /// http://codeforces.com/problemset/problem/1105/C\n /// \n public class Program\n {\n private const long Modulo = 1000000007;\n\n private static long[] s;\n\n public static long Solve(long n, long l, long r)\n {\n Init_s(l);\n\n long f0 = f(0, r), f1 = f(1, r), f2 = f(2, r);\n\n long[] prev = new long[3], cur = new long[3];\n cur[0] = f0;\n cur[1] = f1;\n cur[2] = f2;\n\n for (int i = 0; i < n; i++)\n {\n if (i > 0)\n {\n cur[0] = ((prev[0] * f0) % Modulo + (prev[1] * f2) % Modulo + (prev[2] * f1) % Modulo) % Modulo;\n cur[1] = ((prev[0] * f1) % Modulo + (prev[1] * f0) % Modulo + (prev[2] * f2) % Modulo) % Modulo;\n cur[2] = ((prev[0] * f2) % Modulo + (prev[1] * f1) % Modulo + (prev[2] * f0) % Modulo) % Modulo;\n }\n\n prev[0] = cur[0];\n prev[1] = cur[1];\n prev[2] = cur[2];\n }\n\n return cur[0];\n }\n\n private static long f(long k, long r)\n {\n long l = s[k];\n\n if (l > r) return 0;\n\n return (1 + (r - l) / 3) % Modulo;\n }\n\n private static void Init_s(long l)\n {\n s = new long[3];\n\n switch (l % 3)\n {\n case 0:\n s[0] = l % Modulo;\n s[1] = (l + 1) % Modulo;\n s[2] = (l + 2) % Modulo;\n break;\n case 1:\n s[0] = (l + 2) % Modulo;\n s[1] = l % Modulo;\n s[2] = (l + 1) % Modulo;\n break;\n case 2:\n s[0] = (l + 1) % Modulo;\n s[1] = (l + 2) % Modulo;\n s[2] = l % Modulo;\n break;\n }\n }\n\n public static void Main(string[] args)\n {\n int[] inputs = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();\n\n int n = inputs[0], l = inputs[1], r = inputs[2];\n\n Console.WriteLine(Solve(n, l, r));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\nusing static System.Console;\nusing static System.Math;\nclass Z { static void Main() => new K(); }\nclass K\n{\n\tint F => int.Parse(Str);\n\tlong FL => long.Parse(Str);\n\tint[] G => Strs.Select(int.Parse).ToArray();\n\tlong[] GL => Strs.Select(long.Parse).ToArray();\n\tstring Str => ReadLine();\n\tstring[] Strs => Str.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n\tconst int MOD = 1000000007;\n\tpublic K()\n\t{\n\t\tSetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n\t\tSolve();\n\t\tOut.Flush();\n\t}\n\tvoid Solve()\n\t{\n\t\tvar I = G;\n\t\tint N = I[0], l = I[1], r = I[2];\n\t\tvar mx = new int[3];\n\t\tmx[0] = (r + 3) / 3 - (l + 2) / 3;\n\t\tmx[1] = (r + 2) / 3 - (l + 1) / 3;\n\t\tmx[2] = (r + 1) / 3 - l / 3;\n\t\tvar dp = new long[N + 1, 3];\n\t\tdp[0, 0] = 1;\n\t\tfor (var n = 1; n <= N; n++)\n\t\t\tfor (var m = 0; m < 3; m++)\n\t\t\t\tfor (var x = 0; x < 3; x++)\n\t\t\t\t\tdp[n, m] = (dp[n, m] + mx[x] * dp[n - 1, (m - x + 3) % 3] % MOD) % MOD;\n\t\tWriteLine(dp[N, 0]);\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Text;\n\nnamespace codeforces\n{\n public class Program\n {\n private static int MOD = 1000 * 1000 * 1000 + 7;\n\n private static int f(int c, int r)\n {\n if (r == 0)\n {\n return c / 3;\n }\n int count = c / 3;\n if (r == 1 && c % 3 == 0 || (r == 2 && c % 3 != 2))\n {\n count--;\n }\n count++;\n return count;\n }\n\n private static int Add(int a, int b)\n {\n a += b;\n if (a >= MOD)\n {\n a -= MOD;\n }\n return a;\n }\n \n private static int Mult(int a, int b)\n {\n return (int)(1L * a * b % MOD);\n }\n\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(values[0]);\n int l = Convert.ToInt32(values[1]);\n int r = Convert.ToInt32(values[2]);\n\n var cnt = new int[3] { f(r, 0) - f(l - 1, 0), f(r, 1) - f(l - 1, 1), f(r, 2) - f(l - 1, 2) };\n var dp = new int[n + 1, 3];\n dp[0, 0] = 1;\n for (int i = 1; i <= n; ++i)\n {\n for (int rest = 0; rest < 3; ++rest)\n {\n for (int j = 0; j < 3; ++j)\n {\n int p = (rest - j + 3) % 3;\n dp[i, rest] = Add(dp[i, rest], Mult(dp[i - 1, j], cnt[p]));\n }\n }\n }\n Console.WriteLine(dp[n, 0]);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Ayoub_and_Lost_Array\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static long Solve(string[] args)\n {\n int n = Next();\n int l = Next();\n int r = Next();\n\n var nn = new int[3];\n for (int i = 0; i < 3; i++)\n {\n nn[(l + i)%3] = Math.Max(0, (r - (l + i) + 3)/3);\n }\n const int mod = 1000000007;\n\n var dp = new long[3];\n dp[0] = 1;\n for (int ii = 0; ii < n; ii++)\n {\n var next = new long[3];\n\n next[0] = (dp[0]*nn[0] + dp[1]*nn[2] + dp[2]*nn[1])%mod;\n next[1] = (dp[0]*nn[1] + dp[1]*nn[0] + dp[2]*nn[2])%mod;\n next[2] = (dp[0]*nn[2] + dp[1]*nn[1] + dp[2]*nn[0])%mod;\n\n dp = next;\n }\n\n return dp[0]%mod;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n const long MOD = 1000000007;\n static int before(int x, int ost)\n {\n if (x < ost)\n return 0;\n return (x - ost) / 3 + 1;\n }\n static void Main(string[] args)\n {\n int n, l, r;\n string[] input = Console.ReadLine().Split();\n n = int.Parse(input[0]);\n l = int.Parse(input[1]);\n r = int.Parse(input[2]);\n long[,] dp = new long[n, 3];\n dp[0, 0] = before(r, 0) - before(l - 1, 0);\n dp[0, 1] = before(r, 1) - before(l - 1, 1);\n dp[0, 2] = before(r, 2) - before(l - 1, 2);\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int pred0 = j;\n int pred1 = j - 1;\n int pred2 = j - 2;\n if (pred1 < 0)\n pred1 += 3;\n if (pred2 < 0)\n pred2 += 3;\n dp[i, j] += dp[i - 1, pred0] * dp[0, 0];\n dp[i, j] %= MOD;\n dp[i, j] += dp[i - 1, pred1] * dp[0, 1];\n dp[i, j] %= MOD;\n dp[i, j] += dp[i - 1, pred2] * dp[0, 2];\n dp[i, j] %= MOD;\n }\n }\n /*for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < 3; j++)\n Console.Write($\"{dp[i, j]} \");\n Console.WriteLine();\n }*/\n Console.WriteLine((dp[n - 1, 0])%MOD);\n }\n }\n}\n"}, {"source_code": "\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n#if DEBUG\nusing System.Diagnostics;\n#endif\n\nnamespace _533c\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n const string _delim = \"!\";\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n var testNumber = 0;\n var timer = new Stopwatch();\n foreach (var test in GetTests())\n {\n\n timer.Start();\n\n var defaultColor = Console.ForegroundColor;\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n Console.SetIn(test);\n\n\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n#if DEBUG\n Solution(testNumber);\n#else\n Solution(0);\n#endif\n }\n finally\n {\n#if DEBUG\n#else\n if (_useFileInput)\n {\n file.Close();\n }\n#endif\n }\n\n#if DEBUG\n timer.Stop();\n\n Console.ForegroundColor = ConsoleColor.DarkYellow;\n Console.WriteLine($\"\");\n Console.ForegroundColor = defaultColor;\n\n timer.Reset();\n testNumber++;\n }\n#endif\n }\n\n\n\n static void Solution(int testNumber)\n {\n #region SOLUTION\n var d = ReadIntArray();\n\n var n = d[0];\n var l = d[1] - 1;\n var r = d[2];\n var mod = 1000 * 1000 * 1000 + 7;\n var dp = new long[n, 3];\n\n var cs = new long[3];\n cs[0] = r / 3 - l / 3;\n cs[1] = r / 3;\n if (r % 3 > 0)\n {\n cs[1]++;\n }\n\n cs[1] -= l / 3;\n if (l % 3 > 0)\n {\n cs[1]--;\n }\n\n cs[2] = r / 3;\n if (r % 3 > 1)\n {\n cs[2]++;\n }\n cs[2] -= l / 3;\n if (l % 3 > 1)\n {\n cs[2]--;\n }\n\n dp[0, 0] = cs[0];\n dp[0, 1] = cs[1];\n dp[0, 2] = cs[2];\n for (int i = 1; i < n; i++)\n {\n // 0\n dp[i, 0] += (dp[i - 1, 0] * cs[0]) % mod;\n dp[i, 0] %= mod;\n\n dp[i, 0] += (dp[i - 1, 1] * cs[2]) % mod;\n dp[i, 0] %= mod;\n\n dp[i, 0] += (dp[i - 1, 2] * cs[1]) % mod;\n dp[i, 0] %= mod;\n\n // 1\n dp[i, 1] += (dp[i - 1, 0] * cs[1]) % mod;\n dp[i, 1] %= mod;\n\n dp[i, 1] += (dp[i - 1, 1] * cs[0]) % mod;\n dp[i, 1] %= mod;\n\n dp[i, 1] += (dp[i - 1, 2] * cs[2]) % mod;\n dp[i, 1] %= mod;\n\n // 2\n dp[i, 2] += (dp[i - 1, 0] * cs[2]) % mod;\n dp[i, 2] %= mod;\n\n dp[i, 2] += (dp[i - 1, 1] * cs[1]) % mod;\n dp[i, 2] %= mod;\n\n dp[i, 2] += (dp[i - 1, 2] * cs[0]) % mod;\n dp[i, 2] %= mod;\n }\n\n Console.WriteLine(dp[n - 1, 0]);\n //var n = readInt();\n //var m = readInt();\n\n //var a = readIntArray();\n //var b = readIntArray();\n #endregion\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] ReadLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n static IEnumerable GetTests()\n {\n var tests = new List();\n var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n using (var resource = new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resName)))\n {\n while (true)\n {\n var nextText = new StringBuilder();\n var endOfFile = false;\n while (true)\n {\n var line = resource.ReadLine();\n\n endOfFile = line == null;\n if (endOfFile)\n {\n break;\n }\n\n if (line.Equals(_delim, StringComparison.Ordinal))\n {\n break;\n }\n\n nextText.AppendLine(line);\n }\n\n yield return new StringReader(nextText.ToString());\n\n if (endOfFile)\n {\n break;\n }\n }\n }\n }\n#endif\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass TEST{\n\tstatic void Main(){\n\t\tSol mySol =new Sol();\n\t\tmySol.Solve();\n\t}\n}\n\nclass Sol{\n\tconst long mod = (long) 1e9 + 7;\n\tpublic void Solve(){\n\t\t\n\t\tlong[] cnt = new long[3];\n\t\tcnt[0] = (R / 3 - (L - 1) / 3); \n\t\tcnt[1] = (R / 3 + ((R % 3 > 0) ? 1 : 0)) - ((L - 1) / 3 + ((L - 1) % 3 > 0 ? 1 : 0));\n\t\tcnt[2] = (R / 3 + ((R % 3 > 1) ? 1 : 0)) - ((L - 1) / 3 + ((L - 1) % 3 > 1 ? 1 : 0));\n\t\t\n\t\tif(N == 1){\n\t\t\tConsole.WriteLine(cnt[0]);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tmlong[] dp = new mlong[3];\n\t\tfor(int i=0;i<3;i++) dp[i] = cnt[i];\n\t\tfor(int i=1;iint.Parse(e));}\n\tstatic long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}\n\tstatic double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}\n}\n\n\nstruct mlong {\n\t\n\tconst long mod = (long) 1e9 + 7;\n\tlong V;\n\t\n\tpublic mlong(long _v = 0){\n\t\tV = _v;\n\t}\n\t\n\tpublic static mlong operator+(mlong a, mlong b){\n\t\tvar v0 = a.V + b.V; if(v0 >= mod) v0 -= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator-(mlong a, mlong b){\n\t\tvar v0 = mod + a.V - b.V; if(v0 >= mod) v0 -= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator*(mlong a, mlong b){\n\t\tvar v0 = a.V * b.V; if(v0 >= mod) v0 %= mod;\n\t\treturn new mlong(v0);\n\t}\n\tpublic static mlong operator/(mlong a, mlong b){\n\t\tvar v0 = a.V * inv(b.V).V; if(v0 >= mod) v0 %= mod;\n\t\treturn new mlong(v0);\n\t}\n\t\n\t\n\tpublic static mlong inv(long x){\n\t\tlong a = 0, b = 0, c = 0;\n\t\tExtGCD(x, mod, ref a, ref b, ref c);\n\t\treturn (mlong)((a + mod) % mod);\n\t}\n\t\n\tpublic static void ExtGCD(long x, long y, ref long a, ref long b, ref long c){\n\t\tlong r0 = x; long r1 = y;\n\t\tlong a0 = 1; long a1 = 0;\n\t\tlong b0 = 0; long b1 = 1;\n\t\tlong q1, r2, a2, b2;\n\t\twhile(r1 > 0){\n\t\t\tq1 = r0 / r1;\n\t\t\tr2 = r0 % r1;\n\t\t\ta2 = a0 - q1 * a1;\n\t\t\tb2 = b0 - q1 * b1;\n\t\t\tr0 = r1; r1 = r2;\n\t\t\ta0 = a1; a1 = a2;\n\t\t\tb0 = b1; b1 = b2;\n\t\t}\n\t\tc = r0;\n\t\ta = a0;\n\t\tb = b0;\n\t}\n\t\n\tpublic static mlong ModPow(mlong a, long k){\n\t\tif(k == 0) return (mlong) 1;\n\t\tif(a == 0) return (mlong) 0;\n\t\tmlong x = a;\n\t\tmlong ret = 1;\n\t\twhile(k > 0){\n\t\t\tif(k % 2 == 1) ret *= x;\n\t\t\tx *= x;\n\t\t\tk >>= 1;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\t\n\tpublic static bool operator == (mlong a, mlong b){\n\t\t return a.Equals(b);\n\t}\n\tpublic static bool operator != (mlong a, mlong b){\n\t\t return !(a == b);\n\t}\n\t\n\tpublic override bool Equals(System.Object obj){\n\t\tif(obj == null) return false;\n\t\tmlong p = (mlong) obj;\n\t\tif((System.Object) p == null) return false;\n\t\treturn p.V == V;\n\t}\n\tpublic override int GetHashCode(){\n\t\treturn V.GetHashCode();\n\t}\n\t\n\tpublic static implicit operator mlong(long n){\n\t\treturn new mlong(n);\n\t}\n\tpublic static implicit operator mlong(int n){\n\t\treturn new mlong(n);\n\t}\n\tpublic static explicit operator long(mlong n){\n\t\treturn n.V;\n\t}\n\t\n\tpublic override String ToString(){\n\t\treturn V.ToString();\n\t}\n\t\n\t\n}"}, {"source_code": "/*\ncsc -debug C.cs && mono --debug C.exe <<< \"2 1 3\"\n*/\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class HelloWorld {\n public static void SolveCodeForces() {\n var n = cin.NextInt();\n var l = cin.NextInt();\n var r = cin.NextInt();\n\n const ulong MOD = 1000000007ul;\n var S = Helpers.CreateArray(n+1, _ => new ulong[3]);\n\n var d0 = (ulong)( r/3 - (l-1)/3 );\n var d1 = (ulong)( (r+2)/3 - (l+1)/3 );\n var d2 = (ulong)( (r+1)/3 - l/3 );\n\n S[1] = new ulong[] {\n d0 % MOD,\n d1 % MOD,\n d2 % MOD\n };\n\n for (var i = 2; i <= n; i++) {\n S[i] = new ulong[] {\n ( d0 * S[i-1][0] + d1 * S[i-1][2] + d2 * S[i-1][1] ) % MOD,\n ( d0 * S[i-1][1] + d1 * S[i-1][0] + d2 * S[i-1][2] ) % MOD,\n ( d0 * S[i-1][2] + d1 * S[i-1][1] + d2 * S[i-1][0] ) % MOD\n };\n }\n\n // for (var i = 1; i <= n; i++)\n // System.Console.WriteLine(string.Join(\" \", S[i]));\n\n System.Console.WriteLine(S[n][0]);\n }\n\n static Scanner cin = new Scanner();\n static StringBuilder cout = new StringBuilder();\n\n static public void Main () {\n SolveCodeForces();\n // System.Console.Write(cout.ToString());\n }\n}\n\npublic static class Helpers {\n public static T[] CreateArray(int length, Func itemCreate) {\n var result = new T[length];\n for (var i = 0; i < result.Length; i++)\n result[i] = itemCreate(i);\n return result;\n }\n\n public static IEnumerable IndicesWhere(this IEnumerable seq, Func cond) {\n var i = 0;\n foreach (var item in seq) {\n if (cond(item)) yield return i;\n i++;\n }\n }\n}\n\npublic class Scanner\n{\n private string[] line = new string[0];\n private int index = 0;\n\n public string Next() {\n if (line.Length <= index) {\n line = Console.ReadLine().Split(' ');\n index = 0;\n }\n var res = line[index];\n index++;\n return res;\n }\n\n public int NextInt() {\n return int.Parse(Next());\n }\n\n public long NextLong() {\n return long.Parse(Next());\n }\n\n public ulong NextUlong() {\n return ulong.Parse(Next());\n }\n\n public string[] Array() {\n line = Console.ReadLine().Split(' ');\n index = line.Length;\n return line;\n }\n\n public int[] IntArray(int emptyPrefixLen = 0) {\n var array = Array();\n var result = new int[emptyPrefixLen + array.Length];\n for (int i = 0; i < array.Length; i++)\n result[emptyPrefixLen + i] = int.Parse(array[i]);\n return result;\n }\n\n public long[] LongArray() {\n var array = Array();\n var result = new long[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = long.Parse(array[i]);\n return result;\n }\n\n public ulong[] UlongArray() {\n var array = Array();\n var result = new ulong[array.Length];\n for (int i = 0; i < array.Length; i++)\n result[i] = ulong.Parse(array[i]);\n return result;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prC {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int n = NextInt();\n int l = NextInt();\n int r = NextInt();\n var d = (r - l + 1) / 3;\n ulong[] c = {(ulong) d, (ulong) d, (ulong) d};\n for (int i = d * 3 + l; i <= r; i++) {\n c[i % 3]++;\n }\n const ulong m = 1000000000 + 7;\n ulong[] dp = new[] {c[0], c[1], c[2]};\n for (int i = 1; i < n; i++) {\n ulong[] dp1 = new ulong[3];\n for (int j = 0; j < 3; j++) {\n dp1[j] = (dp[j] * c[0]) % m + (dp[(j + 1) % 3] * c[2]) % m + (dp[(j + 2) % 3] * c[1]) % m;\n dp1[j] %= m;\n }\n dp = dp1;\n }\n writer.WriteLine(dp[0]);\n\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int NextInt() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n private static long NextLong() {\n int c;\n long res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Solution\n{\n\tstatic int modEqual (int max, int mod)\n\t{\n\t\tint result = max / 3;\n\t\tif (max % 3 >= mod)\n\t\t\tresult++;\n\t\treturn result;\n\t}\n\n\tpublic static void Main (string[] args)\n\t{ \n\t\tint[] nums = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();\n\t\tint n = nums [0], l = nums [1], r = nums [2];\n\n\t\tlong[] factors = {\n\t\t\tmodEqual (r, 0) - modEqual (l - 1, 0),\n\t\t\tmodEqual (r, 1) - modEqual (l - 1, 1),\n\t\t\tmodEqual (r, 2) - modEqual (l - 1, 2)\n\t\t};\n\n\t\tlong[] freq = new long[] { 1, 0, 0 };\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong[] next = new long[3];\n\t\t\tfor (int a = 0; a < 3; a++) {\n\t\t\t\tfor (int b = 0; b < 3; b++) {\n\t\t\t\t\tnext [(a + b) % 3] += freq [a] * factors [b];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int k = 0; k < 3; k++) {\n\t\t\t\tfreq [k] = next [k] % ((int)1e9 + 7);\n\t\t\t}\n\t\t}\n\n\t\tConsole.WriteLine (freq[0]);\n\t}\n} "}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Numerics;\n\npublic class Example\n{\n public static void Main(string[] args)\n {\n var elements = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);\n\n var elementCount = elements[0];\n var elementMin = elements[1];\n var elementMax = elements[2];\n\n var nearestMin = (elementMin / 3) * 3 + (elementMin % 3 == 0 ? 0 : 3);\n var nearestMax = (elementMax / 3) * 3;\n var quantity = (nearestMax - nearestMin) / 3;\n\n var remainder = new Dictionary\n {\n [0] = quantity,\n [1] = quantity,\n [2] = quantity\n };\n\n for (long element = elementMin; element < nearestMin; ++element)\n {\n ++remainder[element % 3];\n }\n\n for (long element = nearestMax; element <= elementMax; ++element)\n {\n ++remainder[element % 3];\n }\n\n var ways = new Dictionary>\n {\n [1] = new Dictionary\n {\n [0] = remainder[0],\n [1] = remainder[1],\n [2] = remainder[2]\n }\n };\n\n long modulo = 1000000007;\n for (long n = 2; n <= elementCount; ++n)\n {\n ways.Add(n, new Dictionary\n {\n [0] = 0,\n [1] = 0,\n [2] = 0\n });\n\n ways[n][0] = (ways[n - 1][0] * remainder[0] + ways[n - 1][1] * remainder[2] + ways[n - 1][2] * remainder[1]) % modulo;\n ways[n][1] = (ways[n - 1][0] * remainder[1] + ways[n - 1][1] * remainder[0] + ways[n - 1][2] * remainder[2]) % modulo;\n ways[n][2] = (ways[n - 1][0] * remainder[2] + ways[n - 1][1] * remainder[1] + ways[n - 1][2] * remainder[0]) % modulo;\n }\n\n Console.WriteLine(ways[elementCount][0] % modulo);\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n class Program\n {\n const long MOD = 1000000009;\n static int before(int x, int ost)\n {\n if (x < ost)\n return 0;\n return (x - ost) / 3 + 1;\n }\n static void Main(string[] args)\n {\n int n, l, r;\n string[] input = Console.ReadLine().Split();\n n = int.Parse(input[0]);\n l = int.Parse(input[1]);\n r = int.Parse(input[2]);\n long[,] dp = new long[n, 3];\n dp[0, 0] = before(r, 0) - before(l - 1, 0);\n dp[0, 1] = before(r, 1) - before(l - 1, 1);\n dp[0, 2] = before(r, 2) - before(l - 1, 2);\n for (int i = 1; i < n; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n int pred0 = j;\n int pred1 = j - 1;\n int pred2 = j - 2;\n if (pred1 < 0)\n pred1 += 3;\n if (pred2 < 0)\n pred2 += 3;\n dp[i, j] += dp[i - 1, pred0] * dp[0, 0];\n dp[i, j] %= MOD;\n dp[i, j] += dp[i - 1, pred1] * dp[0, 1];\n dp[i, j] %= MOD;\n dp[i, j] += dp[i - 1, pred2] * dp[0, 2];\n dp[i, j] %= MOD;\n }\n }\n /*for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < 3; j++)\n Console.Write($\"{dp[i, j]} \");\n Console.WriteLine();\n }*/\n Console.WriteLine((dp[n - 1, 0])%MOD);\n }\n }\n}\n"}], "src_uid": "4c4852df62fccb0a19ad8bc41145de61"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cs_console\n{\n class _73_2_E\n {\n //nim\n //game\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] grundy = new int[n + 1];\n int[] ans = new int[n + 1];\n grundy[1] = 0;\n ans[1] = -1;\n for (int i = 2; i <= n; i++)\n {\n grundy[i] = 0;\n ans[i] = -1;\n bool ok = false;\n Dictionary used = new Dictionary();\n for (int len = 2; len * (len + 1) / 2 <= i; len++)\n {\n if (i * 2 % len == 0)\n {\n int aa = i * 2 / len - len + 1;\n if (aa % 2 == 0 && aa > 0)\n {\n int x = aa / 2;\n //valid split (x, x + 1, ..., x + k - 1)\n int ng = 0;\n for (int k = 0; k < len; k++)\n {\n ng ^= grundy[x + k];\n }\n if(!ok && ng == 0)\n {\n //good\n ok = true;\n ans[i] = len;\n }\n used[ng] = 1;\n }\n }\n }\n //find the min value not used -- grundy value\n for (int j = 0; ; j++)\n {\n if (!used.ContainsKey(j))\n {\n grundy[i] = j;\n break;\n }\n }\n if (!ok)\n {\n ans[i] = -1;\n }\n }\n //for (int i = 0; i < n; i++)\n //{\n //Console.WriteLine(i + \" \" + ans[i] + \" \" + grundy[i]);\n //}\n Console.WriteLine(ans[n]);\n }\n }\n}\n", "positive_code": [{"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n {\n var N = Int32.Parse(Console.ReadLine().Trim());\n \n int[] grandi = new int[N+1];\n int[] numGrandi = new int[N+1];\n int nim;\n int[] answ = new int[N+1];\n\n for (int i = 0; i < N + 1; i++)\n {\n numGrandi[i] = -1;\n answ[i] = -1;\n }\n for (int n = 0; n <= N; n++)\n { \n for (int count = 2; (count * (count + 1)) / 2 <= n; count++)\n {\n if ((2 * n - count * (count - 1)) % (2 * count) != 0)\n continue;\n int a = (2 * n - count * (count - 1)) / (2 * count);\n if (a < 1)\n break;\n\n nim = 0;\n for (int j = 0; j < count; j++)\n nim ^= grandi[a + j];\n\n if (answ[n] == -1)\n {\n if (nim == 0)\n answ[n] = count;\n else\n answ[n] = -1;\n }\n numGrandi[nim] = n;\n }\n for (int i = 0; i <= N; i++)\n {\n if (numGrandi[i] != n)\n {\n grandi[n] = i;\n break;\n }\n }\n }\n \n Console.WriteLine(answ[N]);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemE\n{\n static int?[] GrundyLookup = new int?[100001];\n static int[] NLookup = new int[100001];\n\n static int Find(int n)\n {\n if (GrundyLookup[n].HasValue)\n {\n return GrundyLookup[n].Value;\n }\n else\n {\n int count = n % 2 == 1 ? 2 : 3;\n HashSet results = new HashSet();\n while (count <= n)\n {\n if ((2 * n) % count == 0)\n {\n int twoa1 = (2 * n) / count - (count - 1);\n if (twoa1 % 2 == 0 && twoa1 > 0)\n {\n int a1 = twoa1 / 2;\n int result = 0;\n for (int i = a1; i < a1 + count; i++)\n {\n result ^= Find(i);\n }\n results.Add(result);\n if (result == 0 && NLookup[n] == 0)\n NLookup[n] = count;\n }\n }\n count++;\n }\n int j = 0;\n while (results.Contains(j))\n {\n j++;\n }\n GrundyLookup[n] = j;\n return j;\n }\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (Find(n) == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(NLookup[n]);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cs_console\n{\n class _73_2_E\n {\n //nim\n //game\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] grundy = new int[n + 1];\n int[] ans = new int[n + 1];\n grundy[1] = 0;\n ans[1] = -1;\n for (int i = 2; i <= n; i++)\n {\n grundy[i] = 0;\n ans[i] = -1;\n bool ok = false;\n Dictionary used = new Dictionary();\n for (int len = 2; len * (len + 1) / 2 <= i; len++)\n {\n if (i * 2 % len == 0)\n {\n int aa = i * 2 / len - len + 1;\n if (aa % 2 == 0 && aa > 0)\n {\n int x = aa / 2;\n //valid split (x, x + 1, ..., x + k - 1)\n int ng = 0;\n for (int k = 0; k < len; k++)\n {\n ng ^= grundy[x + k];\n }\n if(!ok && ng == 0)\n {\n //good\n ok = true;\n ans[i] = len;\n }\n used[ng] = 1;\n }\n }\n }\n //find the min value not used -- grundy value\n for (int j = 0; ; j++)\n {\n if (!used.ContainsKey(j))\n {\n grundy[i] = j;\n break;\n }\n }\n if (!ok)\n {\n ans[i] = -1;\n }\n }\n //for (int i = 0; i < n; i++)\n //{\n //Console.WriteLine(i + \" \" + ans[i] + \" \" + grundy[i]);\n //}\n Console.WriteLine(ans[n]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n {\n var N = Int32.Parse(Console.ReadLine().Trim());\n \n int[] grandi = new int[N+1];\n int[] numGrandi = new int[N+1];\n int nim;\n int[] answ = new int[N+1];\n\n for (int i = 0; i < N + 1; i++)\n {\n numGrandi[i] = -1;\n answ[i] = -1;\n }\n for (int n = 0; n <= N; n++)\n { \n for (int count = 2; (count * (count + 1)) / 2 <= n; count++)\n {\n if ((2 * n - count * (count - 1)) % (2 * count) != 0)\n continue;\n int a = (2 * n - count * (count - 1)) / (2 * count);\n if (a < 1)\n break;\n\n nim = 0;\n for (int j = 0; j < count; j++)\n nim ^= grandi[a + j];\n\n if (answ[n] == -1)\n {\n if (nim == 0)\n answ[n] = count;\n else\n answ[n] = -1;\n }\n numGrandi[nim] = n;\n }\n for (int i = 0; i <= N; i++)\n {\n if (numGrandi[i] != n)\n {\n grandi[n] = i;\n break;\n }\n }\n }\n \n Console.WriteLine(answ[N]);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApplication1\n{\n public class Program\n {\n static void Main(string[] args)\n {\n var str = Console.ReadLine();\n var n = Int32.Parse(str);\n\n var fi = new int[n + 1];\n var used = new int[3 * n];\n var kucha = new int[n + 1];\n \n for (int i = 3; i <= n; ++i)\n {\n for (int k = 2; k <= 4 * (int)Math.Sqrt(i); ++k)\n {\n var delta = i - (k*(k - 1))/2;\n if (delta <= 0)\n break;\n\n if (delta % k != 0)\n continue;\n\n var c = delta/k;\n var curFi = 0;\n for (int j = 0; j < k; ++j)\n {\n curFi = curFi ^ fi[c + j];\n }\n used[curFi] = i;\n if (curFi == 0 && kucha[i] == 0)\n {\n kucha[i] = k;\n }\n }\n\n if (kucha[i] > 0)\n {\n for (int j = 0; j <= n; ++j)\n {\n if (used[j] != i)\n {\n fi[i] = j;\n break;\n }\n }\n }\n }\n if (fi[n] == 0)\n {\n Console.WriteLine(-1);\n }\n else\n {\n Console.WriteLine(kucha[n]);\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace cs_console\n{\n class _73_2_E\n {\n public static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] b = new int[n + 1];\n b[1] = -1;\n for (int i = 2; i <= n; i++)\n {\n b[i] = -1;\n for (int len = 2; len * (len + 1) / 2 <= i; len++)\n {\n if (i * 2 % len == 0)\n {\n int aa = i * 2 / len - len + 1;\n if (aa % 2 == 0 && aa > 0)\n {\n int x = aa / 2;\n //(x, len)\n bool ok = true;\n for (int k = 0; k < len; k++)\n {\n if (b[x + k] >= 0)\n {\n ok = !ok;\n }\n }\n if (ok)\n {\n b[i] = len;\n break;\n }\n }\n }\n }\n }\n //for (int i = 0; i < n; i++)\n //{\n // Console.WriteLine(i + \" \" + b[i]);\n //}\n Console.WriteLine(b[n]);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n {\n var N = Int32.Parse(Console.ReadLine().Trim());\n \n int[] grandi = new int[N+1];\n int[] numGrandi = new int[N+1];\n int nim;\n int[] answ = new int[N+1];\n\n for (int i = 0; i < N + 1; i++)\n numGrandi[i] = -1;\n for (int n = 0; n <= N; n++)\n { \n for (int count = 2; (count * (count + 1)) / 2 <= n; count++)\n {\n if ((2 * n - count * (count - 1)) % (2 * count) != 0)\n continue;\n int a = (2 * n - count * (count - 1)) / (2 * count);\n if (a < 1)\n break;\n\n nim = 0;\n for (int j = 0; j < count; j++)\n nim ^= grandi[a + j];\n\n if (answ[n] <= 0)\n {\n if (nim == 0)\n answ[n] = count;\n else\n answ[n] = -1;\n }\n numGrandi[nim] = n;\n }\n for (int i = 0; i <= N; i++)\n {\n if (numGrandi[i] != n)\n {\n grandi[n] = i;\n break;\n }\n }\n } \n Console.WriteLine(answ[N]);\n }\n }\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nclass ProblemE\n{\n static int[] Lookup = new int[10001];\n\n static int Find(int n)\n {\n if (Lookup[n] != 0)\n {\n return Lookup[n];\n }\n else\n {\n int count = n % 2 == 1 ? 2 : 3;\n while (count * count / 2 <= n)\n {\n if ((2 * n) % count == 0)\n {\n int twoa1 = (2 * n) / count - (count - 1);\n if (twoa1 % 2 == 0 && twoa1 > 0)\n {\n int a1 = twoa1 / 2;\n int countsuccess = 0;\n for (int i = a1; i < a1 + count; i++)\n {\n if (Find(i) != -1)\n countsuccess++;\n }\n if (countsuccess % 2 == 0)\n {\n Lookup[n] = count;\n return count;\n }\n }\n }\n count++;\n }\n Lookup[n] = -1;\n return -1;\n }\n }\n\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n Console.WriteLine(Find(n));\n }\n}\n"}], "src_uid": "63262317ba572d78163c91b853c05506"} {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 64 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var v = sr.NextInt32();\n var currV = 0;\n var total = 0;\n for (var i = 1; i <= n; i++)\n {\n var need = n - i;\n if (i > 1)\n {\n currV--;\n }\n\n if (need <= currV)\n {\n sw.WriteLine(total);\n return;\n }\n\n var d = need - currV;\n if ((d + currV) <= v)\n {\n total += (d * i);\n sw.WriteLine(total);\n return;\n }\n\n if (i == 1)\n {\n total += v;\n currV = v;\n }\n else\n {\n total += i;\n currV = v;\n }\n }\n \n throw new InvalidOperationException();\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\nclass Pair\n{\n public long Value { get; set; }\n public int Count { get; set; }\n}\n\nclass PairComparer : Comparer\n{\n public override int Compare(Pair x, Pair y)\n {\n return x.Value.CompareTo(y.Value);\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}", "positive_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Collections;\n\nnamespace codeforces\n{\n\n public class Program\n {\n private static void Main(string[] args)\n {\n var values = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(values[0]);\n int v = Convert.ToInt32(values[1]);\n var dp = new int[n, v + 1];\n for (int i = 0; i <= v; ++i)\n {\n dp[0, i] = i;\n }\n for (int i = 1; i < n; ++i)\n {\n for (int j = 0; j <= v; ++j)\n {\n int value = int.MaxValue;\n for (int k = 0; k <= j; ++k)\n {\n if (j - k + 1 <= v)\n {\n value = Math.Min(value, dp[i - 1, j - k + 1] + (i + 1) * k);\n }\n }\n dp[i, j] = value;\n }\n }\n int result = int.MaxValue;\n for (int i = 0; i <= v; ++i)\n {\n result = Math.Min(result, dp[n - 1, i]);\n }\n Console.WriteLine(result.ToString());\n\n Console.Read();\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var (n, v) = input.Read2Int();\n Write(v >= n - 1 ? n - 1 : v + (n - v) * (n - v + 1) / 2 - 1);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n\n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing static System.Array;\nusing static System.Console;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private readonly Tokenizer input;\n\n public void Solve()\n {\n var (n, v) = input.Read2Int();\n if (v >= n - 1)\n {\n Write(n - 1);\n }\n else\n {\n var s = v;\n for (int i = 2; i <= n - v; i++)\n {\n s += i;\n }\n Write(s);\n }\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private readonly TextReader reader;\n\n public string ReadToEnd() => reader.ReadToEnd();\n\n public int ReadInt()\n {\n var c = SkipWs();\n if (c == -1)\n throw new EndOfStreamException();\n var isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = reader.Read();\n if (c == -1)\n throw new EndOfStreamException(\"Digit expected, but end of stream occurs\");\n }\n\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n\n checked\n {\n var result = (char)c - '0';\n c = reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException($\"Digit expected, but was: '{(char)c}'\");\n result = result * 10 + (char)c - '0';\n c = reader.Read();\n }\n\n if (isNegative)\n result = -result;\n return result;\n }\n }\n\n public string ReadLine() => reader.ReadLine();\n\n public long ReadLong() => long.Parse(ReadToken());\n\n public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n\n public int[] ReadIntArray(int n)\n {\n var a = new int[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public (int, int) Read2Int() => (ReadInt(), ReadInt());\n\n public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());\n\n public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());\n\n public (long, long) Read2Long() => (ReadLong(), ReadLong());\n\n public long[] ReadLongArray(int n)\n {\n var a = new long[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n var a = new double[n];\n for (var i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWs();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = reader.Read();\n }\n\n return sb.ToString();\n }\n\n private int SkipWs()\n {\n var c = reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n internal class Program\n {\n public static void Main()\n {\n var solver = new ProblemSolver(In);\n solver.Solve();\n }\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(ab[0]);\n int v = Convert.ToInt32(ab[1]);\n int current = 1, totalmoney = 0;\n if (v >= n) Console.Write(n - 1);\n else\n {\n while (current < n)\n {\n if (n - current >= v)\n {\n if (current == 1) totalmoney += v * current;\n else totalmoney += current;\n }\n current++;\n }\n Console.Write(totalmoney);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace Div._2\n{\n class Program\n {\n static void Main(string[] args)\n {\n var nv = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n var travelNumber = nv[0] - 1;\n var gasoline = nv[1];\n\n var result = 0;\n\n if (gasoline >= travelNumber)\n result = travelNumber;\n else\n {\n var count = 2;\n result = gasoline;\n travelNumber -= gasoline;\n while (travelNumber-- > 0)\n result += count++;\n }\n\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1113_SashaAndHisTrip\n {\n public static void Main()\n {\n string[] a = Console.ReadLine().Split(' ');\n int n = int.Parse(a[0]);\n int v = int.Parse(a[1]);\n n--;\n \n int totalcost = 0;\n if(n>v)\n totalcost = v;\n else\n totalcost = n;\n\n int i = 2;\n \n while(v= n)\n {\n Console.WriteLine(n - 1);\n }\n else\n {\n if (v == n-1)\n {\n Console.WriteLine(v);\n }\n else\n {\n for (int i = 0; i < n-v-1; i++)\n {\n counter++;\n }\n Console.WriteLine(v + (counter * (counter + 1) / 2 - 1));\n }\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main()\n {\n var args = Reader.ReadIntArgs();\n\n var n = args[0];\n var v = args[1];\n\n int cur = 0;\n int ans = 0;\n\n for (int i = 1; i <= n; i++)\n {\n var delta = v - cur;\n\n cur += delta;\n ans += delta * i;\n\n if (i + cur >= n)\n {\n ans -= ((i + cur) - n) * i;\n break;\n }\n\n cur--;\n }\n\n Console.WriteLine(ans);\n }\n\n static int GetMinDel(int x)\n {\n if (x % 2 == 0)\n {\n return 2;\n }\n\n int n = (int)Math.Sqrt(x) + 1;\n\n for (int i = 3; i <= n; i += 2)\n {\n if (x % i == 0)\n {\n return i;\n }\n }\n\n return x;\n }\n }\n\n static class Reader\n {\n public static List ReadIntArgs()\n {\n return ReadArgs(int.Parse);\n }\n\n public static List ReadLongArgs()\n {\n return ReadArgs(long.Parse);\n }\n\n private static List ReadArgs(Func parser)\n {\n return Console.ReadLine().Split().Select(parser).ToList();\n }\n\n public static int ReadIntValue()\n {\n return ReadValue(int.Parse);\n }\n\n public static long ReadLongValue()\n {\n return ReadValue(long.Parse);\n }\n\n private static T ReadValue(Func parser)\n {\n return parser(Console.ReadLine());\n }\n }\n}\n\n//var args = Reader.ReadIntArgs();\n\n//var n = args[0];\n//var v = args[1];\n\n//int cur = 0;\n//int ans = 0;\n\n//for (int i = 1; i <= n; i++)\n//{\n// var delta = v - cur;\n\n// cur += delta;\n// ans += delta * i;\n\n// if (i + cur >= n)\n// {\n// ans -= ((i + cur) - n) * i;\n// break;\n// }\n// else\n// {\n// cur--;\n// }\n//}\n\n//Console.WriteLine(ans);\n//Console.ReadKey();\n\n//class Program\n//{\n// static void Main()\n// {\n// var n = Reader.ReadIntValue();\n// var line = Reader.ReadIntArgs();\n// line.Sort();\n\n// int minDel = int.MaxValue;\n// int minDelHolder = int.MinValue;\n\n// int sum = 0;\n\n// for (int i = n - 1; i >= 1; i--)\n// {\n// sum += line[i];\n\n// int del = GetMinDel(line[i]);\n\n// if (del < minDel)\n// {\n// minDel = del;\n// minDelHolder = line[i];\n// }\n// }\n\n// Console.WriteLine(sum - minDelHolder + (minDelHolder / minDel) + line[0] * minDel);\n// Console.ReadKey();\n// }\n\n// static int GetMinDel(int x)\n// {\n// if (x % 2 == 0)\n// {\n// return 2;\n// }\n\n// int n = (int)Math.Sqrt(x) + 1;\n\n// for (int i = 3; i <= n; i += 2)\n// {\n// if (x % i == 0)\n// {\n// return i;\n// }\n// }\n\n// return x;\n// }\n\n//class Program\n//{\n// static void Main()\n// {\n// var s = Console.ReadLine();\n\n// if (s.Length < 4)\n// {\n// Console.WriteLine(\"Impossible\");\n// return;\n// }\n\n// int mod = s.Length % 2;\n\n// var start = s[0];\n\n// for (int i = 1; i < s.Length / 2; i++)\n// {\n// if (s[i] != start)\n// {\n// if (i != 1)\n// mod++;\n\n// Console.WriteLine(1 + mod);\n// Console.ReadKey();\n// return;\n// }\n// }\n\n// Console.WriteLine(\"Impossible\");\n// Console.ReadKey();\n// }"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace AlgoTasks\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nv = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();\n int n = nv[0];\n int v = nv[1];\n if (n - 1 <= v)\n {\n Console.WriteLine(n - 1);\n }\n else\n {\n int result = v - 1;\n for (int i = 1; i <= n - v; ++i)\n result += i;\n Console.WriteLine(result);\n } \n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Algorithms\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var nAndv = Console.ReadLine().Split();\n var n = int.Parse(nAndv[0]);\n var v = int.Parse(nAndv[1]);\n var result = SashasTrip(n, v);\n\n Console.WriteLine(result);\n }\n\n private static int SashasTrip(int numberOfCities, int tankCapacity)\n {\n if (numberOfCities - 1 == tankCapacity)\n return tankCapacity;\n\n if (tankCapacity > numberOfCities)\n return --numberOfCities;\n\t\t\t\n\t\t\tif (tankCapacity == numberOfCities)\n return --numberOfCities;\n\n int totalAmount = 0;\n int cityIndex = 2;\n\n totalAmount += tankCapacity;\n numberOfCities--;\n\n while (numberOfCities-- != tankCapacity)\n {\n totalAmount += cityIndex;\n\n cityIndex++;\n }\n\n return totalAmount;\n }\n \n\t\t\n\t\t\n\t\t\n }\n}"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] ab = Console.ReadLine().Split();\n int n = int.Parse(ab[0]);\n int v = int.Parse(ab[1]);\n \n\n if(v >= n - 1)\n {\n Console.WriteLine(n - 1);\n }\n else\n {\n int i = 2;\n int liters = v ;\n int money = 1 * liters;\n while (i < n)\n {\n liters--;\n int c = v - liters;\n liters += c;\n money += c * i;\n if(liters >= n - i)\n {\n break;\n }\n i++;\n }\n Console.WriteLine(money);\n }\n\n }\n\n static int convertToInt(string n)\n {\n return int.Parse(n);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Sasha_and_His_Trip\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n writer.WriteLine(Solve(args));\n writer.Flush();\n }\n\n private static int Solve(string[] args)\n {\n int n = Next();\n int v = Next();\n\n if (n <= v)\n return n - 1;\n\n return v - 1 + (n - v)*(n - v + 1)/2;\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffnamespace Problem\n{\n using System;\n class Strop\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split();\n int n = int.Parse( str[0] );\n int v = int.Parse( str[1] );\n\n int soTien = n>v? v-1:n-1;\n int i = 1;\n while(n > v)\n {\n soTien += i;\n i++;\n n--;\n }\n Console.WriteLine( soTien );\n }\n }\n}"}, {"source_code": "// Problem: 1113A - Sasha and His Trip\n// Author: Gusztav Szmolik\n\nusing System;\n\nclass SashaAndHisTrip\n {\n static int Main ()\n {\n string line = Console.ReadLine ();\n if (line == null)\n return -1;\n char[] delims = {' ', '\\t'};\n string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);\n if (words.Length != 2)\n return -1;\n byte n;\n if (!Byte.TryParse (words[0], out n))\n return -1;\n if (n < 2 || n > 100)\n return -1;\n byte v;\n if (!Byte.TryParse (words[1], out v))\n return -1;\n if (v < 1 || v > 100)\n return -1;\n byte remainKm = Convert.ToByte (n-1);\n ushort ans;\n if (remainKm <= v)\n ans = remainKm;\n else\n {\n ans = v;\n remainKm -= v;\n ans += Convert.ToUInt16 ((remainKm+3)*remainKm/2);\n }\n Console.WriteLine (ans);\n return 0;\n }\n }\n"}, {"source_code": "using System; \nusing System.Linq; \n\nnamespace ConsoleApplication2 \n{ \ninternal class Program \n{ \npublic static void Main(string[] args) \n{ \nint[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray(); \nint ans = 0; \n//if (array[1] == array[0] - 1) ans = array[1]; \nif (array[1] >= array[0] - 1) ans = array[0] - 1; \nelse if (array[1] < array[0]) \n{ \nans += array[1]; \nfor (int i = 1; i <= array[0]; i++) \n{ \nif (array[0] - i != array[1] - 1) \nans += i; \nelse \nbreak; \n} \n} \nif (array[0] == 1) Console.WriteLine(1); \nelse if (array[1] >= array[0] - 1) \nConsole.WriteLine(ans); \nelse \n{ \nConsole.WriteLine(ans - 1); \n} \n} \n} \n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Sasha_Trip\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] entries = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n int dolars = 0;\n\n if (entries[1] >= (entries[0] - 1))\n {\n dolars = (entries[1] == (entries[0] - 1)) ? entries[1]: entries[0] - 1;\n }\n else\n {\n int fuel = 0, lim = 0; \n \n for (int i = 1; i < entries[0]; i++)\n {\n if (lim == entries[0] - 1)\n {\n break;\n }\n if (fuel < entries[1])\n {\n for (int j = fuel; j < entries[1]; j++, fuel++, lim++) \n dolars += i; \n }\n fuel--;\n }\n }\n\n Console.WriteLine(\"{0}\", dolars);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.IO;\nusing SB = System.Text.StringBuilder;\n//using System.Text.RegularExpressions;\n//using System.Globalization;\n//using System.Diagnostics;\nusing static System.Console;\nusing System.Numerics;\nusing static System.Math;\nusing pair = Pair;\n\nclass Program\n{\n static void Main()\n {\n //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });\n new Program().solve();\n Out.Flush();\n }\n readonly Scanner cin = new Scanner();\n readonly int[] dd = { 0, 1, 0, -1, 0 }; //\u2192\u2193\u2190\u2191\n readonly int mod = 1000000007;\n readonly int dom = 998244353;\n bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }\n bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }\n\n void solve()\n {\n int N = cin.nextint;\n int V = cin.nextint;\n int ANS = 0;\n int WANT = N - 1;\n int M = 0;\n for (int i = 0; i < N - 1; i++)\n {\n while (WANT > 0 && M < V)\n {\n WANT--;\n M++;\n ANS += i + 1;\n }\n M--;\n }\n WriteLine(ANS);\n }\n\n}\n\n\nstatic class Ex\n{\n public static void join(this IEnumerable values, string sep = \" \") => WriteLine(string.Join(sep, values));\n public static string concat(this IEnumerable values) => string.Concat(values);\n public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }\n\n public static int lower_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) < 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n public static int upper_bound(this IList arr, T val) where T : IComparable\n {\n int low = 0, high = arr.Count;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >> 1) + low;\n if (arr[mid].CompareTo(val) <= 0) low = mid + 1;\n else high = mid;\n }\n return low;\n }\n}\n\nclass Pair : IComparable> where T : IComparable where U : IComparable\n{\n public T f; public U s;\n public Pair(T f, U s) { this.f = f; this.s = s; }\n public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);\n public override string ToString() => $\"{f} {s}\";\n}\n\nclass Scanner\n{\n string[] s; int i;\n readonly char[] cs = new char[] { ' ' };\n public Scanner() { s = new string[0]; i = 0; }\n public string[] scan => ReadLine().Split();\n public int[] scanint => Array.ConvertAll(scan, int.Parse);\n public long[] scanlong => Array.ConvertAll(scan, long.Parse);\n public double[] scandouble => Array.ConvertAll(scan, double.Parse);\n public string next\n {\n get\n {\n if (i < s.Length) return s[i++];\n string st = ReadLine();\n while (st == \"\") st = ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return next;\n }\n }\n public int nextint => int.Parse(next);\n public long nextlong => long.Parse(next);\n public double nextdouble => double.Parse(next);\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace ConsoleApplication2\n{\n internal class Program\n {\n public static void Main(string[] args)\n {\n int[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray();\n int first = array[0];\n int second = array[1];\n int result = 0;\n if (second >= first - 1) result = first - 1;\n else if (second < first)\n {\n result += second;\n for (int i = 1; i <= first; i++)\n {\n if (first - i != second - 1)\n result += i;\n else\n break;\n }\n }\n if (first == 1) \n Console.WriteLine(1);\n else if (second >= first - 1)\n Console.WriteLine(result);\n else \n Console.WriteLine(result - 1);\n }\n }\n}"}, {"source_code": "\ufeff#region Usings\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nusing static System.Math;\n#endregion\n\n// https://codeforces.com/problemset/problem/1113/A\npublic class A___Sasha_and_His_Trip\n{\n private static void Solve()\n {\n int n = ReadInt();\n int v = ReadInt();\n\n // Pre-load tank (v) for last cities\n int result = Min(n - 1, v);\n\n // Keep tank at maximun in first (cheapest) cities\n for (int i = 2; i <= n - v; i++)\n {\n result += i;\n }\n \n Write(result);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong v = inputs1[1];\n\n\t\t\tlong sum = Math.Min(n - 1, v);\n\t\t\tfor (long i = 2; i <= n - v; i++) \n\t\t\t{\n\t\t\t\tsum += i;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(sum);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);\n int minus = input[0] - input[1] - 1;\n if (minus <= 0)\n {\n Console.WriteLine(input[0] - 1);\n }\n else\n {\n Console.WriteLine(input[1] + (3 + minus) * minus / 2);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nclass Codeforces_Round_539_A\n{\n static void Main()\n {\n string [] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int v = Convert.ToInt32(s[1]);\n int [] a = new int [n];\n int i = 0; int t = n-1; int coin = 0;\n for(; i t) coin = t;\n if(v < t)\n {\n int tb = v; coin = v * a[0];\n for(int k=1; k CustomMain();\n\n static void Solve() {\n int n, v;\n ReadMulti(out n, out v);\n\n var tank = 0;\n var ans = 0;\n for (int i = 1; i < n; i++) {\n if (tank != v && tank < n - i) {\n var addOil = Math.Min(n - i, v - tank);\n tank += addOil;\n ans += i * addOil;\n }\n\n tank--;\n }\n\n WriteAnswer(ans);\n }\n\n static void CustomMain() {\n#if DEBUG\n // \u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u8aad\u307f\u8fbc\u3080\n global::Common.ChangeStdIn();\n // \u6642\u9593\u8a08\u6e2c\n var stopwatch = new Stopwatch();\n stopwatch.Start();\n#endif\n // \u51fa\u529b\u9ad8\u901f\u5316\n var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};\n Console.SetOut(streamWriter);\n // \u56de\u7b54\n Solve();\n#if DEBUG\n stopwatch.Stop();\n Console.WriteLine(stopwatch.Elapsed);\n#endif\n Console.Out.Flush();\n }\n\n static string ReadString() => Console.ReadLine().Trim();\n static int ReadInt() => int.Parse(ReadString());\n static long ReadLong() => long.Parse(ReadString());\n static float ReadFloat() => float.Parse(ReadString());\n static double ReadDouble => double.Parse(ReadString());\n\n static string[] ReadStringArray() => ReadString().Split(' ');\n static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);\n static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);\n static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);\n static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);\n\n static T TypeConversion(string s) {\n if (typeof(T) == typeof(int)) {\n return (T) Convert.ChangeType(int.Parse(s), typeof(T));\n } else if (typeof(T) == typeof(long)) {\n return (T) Convert.ChangeType(long.Parse(s), typeof(T));\n } else if (typeof(T) == typeof(double)) {\n return (T) Convert.ChangeType(double.Parse(s), typeof(T));\n } else {\n return (T) Convert.ChangeType(s, typeof(T));\n }\n }\n\n static void ReadMulti(out T a, out U b) {\n var str = ReadStringArray();\n a = TypeConversion(str[0]);\n b = TypeConversion(str[1]);\n }\n\n static void ReadMulti(out T a, out U b, out V c) {\n var str = ReadStringArray();\n a = TypeConversion(str[0]);\n b = TypeConversion(str[1]);\n c = TypeConversion(str[2]);\n }\n\n static void WriteAnswer(object ans) => Console.WriteLine(ans);\n\n static bool IsOdd(long num) {\n return (num & 1) == 1;\n }\n\n static bool IsEven(long num) {\n return (num & 1) == 0;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Test\n{\n \n public static void Main()\n {\n int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));\n\n var dis = A[0] - 1;\n\n var capacity = A[1];\n\n if(dis <= capacity)\n {\n Console.WriteLine(dis);\n return;\n }\n\n int extra = dis - capacity;\n\n int ans = capacity;\n\n int j = 2;\n while(extra-- > 0)\n {\n ans += j++;\n }\n\n Console.WriteLine(ans);\n\n\n }\n}\n\n\n\n\n \n\n"}, {"source_code": "using System;\n\nnamespace BasicProgramming\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] tokens = Console.ReadLine().Split();\n int n = int.Parse(tokens[0]);\n int v = int.Parse(tokens[1]);\n int i, litter, lastCity, pampNo;\n litter = n - 1;\n lastCity = v - 1;\n pampNo = litter - lastCity;\n if (litter > v)\n {\n i = 1;\n for (int m = 2; m <= pampNo; m++)\n {\n i += m;\n }\n i += lastCity;\n Console.WriteLine(i);\n }\n else\n {\n Console.WriteLine(litter);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace SimpleConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToString();\n var cities = Int32.Parse(input.Split(\" \")[0].ToString());\n var fuelCapacity = Int32.Parse(input.Split(\" \")[1]);\n\n var resultingAmount = 0;\n var fuelLevel = 1;\n \n for (int i = 0; i < cities; i++)\n {\n if(cities - fuelLevel - i <= 0)\n {\n break;\n }\n\n fuelLevel--;\n if (i == 0)\n {\n resultingAmount += fuelCapacity >= cities ? cities - 1: fuelCapacity ;\n fuelLevel = fuelCapacity >= cities ? cities : fuelCapacity;\n }\n else if (fuelLevel < fuelCapacity)\n {\n resultingAmount += i + 1;\n fuelLevel++;\n }\n }\n Console.Write(resultingAmount);\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces539\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int sol = 0;\n int v = 0;\n for(int i = 0; i < sp[0]; ++i, --v)\n {\n if (v >= sp[0] - i - 1)\n break;\n sol += Math.Min(sp[0] - i - 1, sp[1] - v) * (i + 1);\n v += Math.Min(sp[0] - i - 1, sp[1] - v);\n }\n Console.WriteLine(sol);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int rez = 0;\n if (a[1] >= a[0])\n rez = a[0]-1;\n else\n {\n int c = a[0] - a[1];\n rez = a[1];\n for (int i = 2; i <= c; i++)\n rez += i;\n }\n \n\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(string separator, T[] a, int startIndex, int count)\n\t{\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = startIndex, lastIndex = startIndex + count;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = startIndex; i < lastIndex - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < lastIndex - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] data = UtilityMethods.ReadIntArray();\n\t\tint n = data[0], v = data[1];\n\t\tint cost = 0, volume = 0;\n\t\tfor (int i = 1; i <= n; i++, volume--)\n\t\t\tif (volume + i < n)\n\t\t\t{\n\t\t\t\tcost += (v - volume) * i;\n\t\t\t\tvolume += v - volume;\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\tUtilityMethods.WriteLine(n - 1 <= v ? n - 1 : cost);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CSharp\n{\n class _1113A\n {\n public static void Main()\n {\n var tokens = Console.ReadLine().Split();\n\n int n = int.Parse(tokens[0]);\n int v = int.Parse(tokens[1]);\n\n int last = Math.Max(1, n - v);\n Console.WriteLine(last * (last + 1) / 2 + n - last - 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n\n // Driver code \n public static void Main()\n {\n\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n var n = input1[0];\n var v = input1[1];\n if (n <= v)\n {\n Console.WriteLine(n - 1);\n }\n else\n {\n var ans = v;\n\n for (int i = 2; i <= n - v; i++)\n {\n ans = ans + i;\n }\n\n Console.WriteLine(ans);\n }\n\n }\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}], "negative_code": [{"source_code": "\ufeffnamespace Problem\n{\n using System;\n class Strop\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split();\n int n = int.Parse( str[0] );\n int v = int.Parse( str[1] );\n\n int soTien = v-1;\n int i = 1;\n while(n > v)\n {\n soTien += i;\n i++;\n n--;\n }\n Console.WriteLine( soTien );\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Sasha_Trip\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] entries = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);\n\n int dolars = 0;\n\n if (entries[1] >= (entries[0] - 1))\n {\n dolars = (entries[1] == (entries[0] - 1)) ? entries[1] : entries[0];\n }\n else\n {\n int fuel = entries[1], lim = entries[0] - 1;\n dolars = entries[1];\n \n for (int i = 1; i < entries[0]; i++)\n {\n if (fuel < entries[1])\n {\n fuel++;\n dolars += i;\n }\n if (lim <= fuel)\n {\n break;\n }\n lim--;\n fuel--;\n }\n }\n\n Console.WriteLine(\"{0}\", dolars);\n }\n }\n}\n"}, {"source_code": "\ufeff#region Usings\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nusing static System.Math;\n#endregion\n\n// https://codeforces.com/problemset/problem/1113/A\npublic class A___Sasha_and_His_Trip\n{\n private static void Solve()\n {\n int n = ReadInt();\n int v = ReadInt();\n\n // Pre-load tank (v) for last cities\n int result = Min(n, v);\n\n // Keep tank at maximun in first (cheapest) cities\n for (int i = 2; i <= n - v; i++)\n {\n result += i;\n }\n \n Write(result);\n }\n\n #region Main\n\n private static TextReader reader;\n private static TextWriter writer;\n\n public static void Main()\n {\n#if DEBUG\n\n //reader = new StreamReader(\"C:\\\\Users\\\\Axel\\\\Desktop\\\\input.txt\");\n reader = new StreamReader(Console.OpenStandardInput());\n writer = Console.Out;\n\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n\n //reader = new StreamReader(\"input.txt\");\n //writer = new StreamWriter(\"output.txt\");\n#endif\n try\n {\n Solve();\n\n //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);\n //thread.Start();\n //thread.Join();\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex);\n#if DEBUG\n#else\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion Main\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t', }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string Read()\n {\n while (currentLineTokens.Count == 0) currentLineTokens = new Queue(ReadAndSplitLine()); return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(Read());\n }\n\n public static long ReadLong()\n {\n return long.Parse(Read());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(Read(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n\n public static void Write(params object[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array) writer.WriteLine(a);\n }\n\n private class SDictionary : Dictionary\n {\n public new TValue this[TKey key]\n {\n get { return ContainsKey(key) ? base[key] : default(TValue); }\n set { base[key] = value; }\n }\n }\n\n private static T[] Init(int size) where T : new()\n {\n var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;\n }\n\n #endregion Read / Write\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring input1 = Console.ReadLine();\n\t\t\t//string input2 = Console.ReadLine();\n\n\t\t\t//string input3 = Console.ReadLine();\n\t\t\t//string input4 = Console.ReadLine();\n\n\t\t\tvar inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\t\t\t//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();\n\n\t\t\tlong n = inputs1[0];\n\t\t\tlong v = inputs1[1];\n\n\t\t\tlong sum = Math.Min(n, v);\n\t\t\tfor (long i = 2; i <= n - v; i++) \n\t\t\t{\n\t\t\t\tsum += i;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(sum);\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);\n int minus = input[0] - input[1] - 1;\n if (minus <= 0)\n {\n Console.WriteLine(input[0] - 1);\n }\n else\n {\n Console.WriteLine(input[0] + (3 + minus + 1) * (minus - 1) / 2);\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace SimpleConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToString();\n var cities = Int32.Parse(input.Split(\" \")[0].ToString());\n var fuelCapacity = Int32.Parse(input.Split(\" \")[1]);\n\n var resultingAmount = 0;\n var fuelLevel = 1;\n \n for (int i = 0; i < cities; i++)\n {\n if(cities - fuelLevel - i <= 0)\n {\n break;\n }\n\n fuelLevel--;\n if (i == 0)\n {\n resultingAmount += fuelCapacity > cities ? cities - 1: fuelCapacity ;\n fuelLevel = fuelCapacity > cities ? cities : fuelCapacity;\n }\n else if (fuelLevel < fuelCapacity)\n {\n resultingAmount += i + 1;\n fuelLevel++;\n }\n }\n Console.Write(resultingAmount);\n }\n }\n} "}, {"source_code": "using System;\n\nnamespace SimpleConsole\n{\n class Program\n {\n static void Main(string[] args)\n {\n var input = Console.ReadLine().ToString();\n var cities = Int32.Parse(input.Split(\" \")[0].ToString());\n var fuelCapacity = Int32.Parse(input.Split(\" \")[1]);\n\n var resultingAmount = 0;\n var fuelLevel = 1;\n \n for (int i = 0; i < cities; i++)\n {\n if(cities - i - fuelLevel == 0)\n {\n break;\n }\n\n fuelLevel--;\n if (i == 0)\n {\n resultingAmount += fuelCapacity;\n fuelLevel = fuelCapacity;\n }\n else if (fuelLevel < fuelCapacity)\n {\n resultingAmount += i + 1;\n fuelLevel++;\n }\n }\n Console.Write(resultingAmount);\n }\n }\n} "}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace codeforces539\n{\n class Program\n {\n static void Main(string[] args)\n {\n var sp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n\n int sol = 0;\n int v = 0;\n for(int i = 0; i < sp[0]; ++i, --v)\n {\n if (v >= sp[0] - i - 1)\n break;\n sol += Math.Min(sp[0] - i, sp[1] - v) * (i + 1);\n v += Math.Min(sp[0] - i, sp[1] - v);\n }\n Console.WriteLine(sol);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int rez = 0;\n if (a[1] >= a[0])\n rez = a[0];\n else\n {\n int c = a[0] - a[1];\n rez = a[1];\n for (int i = 2; i <= c; i++)\n rez += i;\n }\n \n\n Console.WriteLine(rez);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nstatic class UtilityMethods\n{\n\tpublic static void Swap(ref T a, ref T b)\n\t{\n\t\tT t = a;\n\t\ta = b;\n\t\tb = t;\n\t}\n\n\tpublic static int StrToInt(string s)\n\t{\n\t\tint number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\tpublic static long StrToLong(string s)\n\t{\n\t\tlong number = 0;\n\t\tfor (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)\n\t\t\tnumber = number * 10 + (s[i] - '0');\n\t\treturn s[0] == '-' ? -number : number;\n\t}\n\n\tpublic static string ReadString() => Console.ReadLine();\n\tpublic static int ReadInt() => StrToInt(ReadString());\n\tpublic static long ReadLong() => StrToLong(ReadString());\n\tpublic static double ReadDouble() => double.Parse(ReadString());\n\n\tpublic static string[] ReadStringArray() => ReadString().Split();\n\tpublic static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);\n\tpublic static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);\n\tpublic static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();\n\n\tpublic static void WriteLine(object a) => Console.WriteLine(a);\n\tpublic static void WriteLineArray(string separator, T[] a, int startIndex, int count)\n\t{\n\t\tconst int MAXLEN = 1000000;\n\t\tint len = 0, j = startIndex, lastIndex = startIndex + count;\n\t\tSystem.Text.StringBuilder str;\n\t\tstring[] b = Array.ConvertAll(a, x => x.ToString());\n\t\tfor (int i = startIndex; i < lastIndex - 1; i++)\n\t\t{\n\t\t\tlen += b[i].Length + separator.Length;\n\t\t\tif (len >= MAXLEN)\n\t\t\t{\n\t\t\t\tstr = new System.Text.StringBuilder(len);\n\t\t\t\tfor (; j <= i; j++)\n\t\t\t\t{\n\t\t\t\t\tstr.Append(b[j]);\n\t\t\t\t\tstr.Append(separator);\n\t\t\t\t}\n\t\t\t\tConsole.Write(str);\n\t\t\t\tlen = 0;\n\t\t\t}\n\t\t}\n\t\tstr = new System.Text.StringBuilder(len);\n\t\tfor (; j < lastIndex - 1; j++)\n\t\t{\n\t\t\tstr.Append(b[j]);\n\t\t\tstr.Append(separator);\n\t\t}\n\t\tConsole.Write(str);\n\t\tConsole.WriteLine(b.Last());\n\t}\n}\n\nclass Program\n{\n\tstatic void Main()\n\t{\n\t\tint[] data = UtilityMethods.ReadIntArray();\n\t\tint n = data[0], v = data[1];\n\t\tint cost = 0, volume = 0;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tif (volume < n)\n\t\t\t{\n\t\t\t\tcost += Math.Min(v, n - volume - 1) * i;\n\t\t\t\tvolume += Math.Min(v, n - volume);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\tUtilityMethods.WriteLine(cost);\n\t\tConsole.ReadLine();\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n\n // Driver code \n public static void Main()\n {\n\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n var n = input1[0];\n var v = input1[1];\n if (n < v)\n {\n Console.WriteLine(n - 1);\n }\n else if(n==v)\n {\n Console.WriteLine(n);\n }\n else\n {\n var ans = v;\n\n for (int i = 2; i <= n - v; i++)\n {\n ans = ans + i;\n }\n\n Console.WriteLine(ans);\n }\n\n }\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n\n // Driver code \n public static void Main()\n {\n\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n var n = input1[0];\n var v = input1[1];\n\n var ans = v;\n\n for(int i=2;i<=n-ans;i++)\n {\n ans = ans + i;\n }\n\n Console.WriteLine(ans);\n\n }\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n\n // Driver code \n public static void Main()\n {\n\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n var n = input1[0];\n var v = input1[1];\n if (n < v)\n {\n Console.WriteLine(n - 1);\n }\n else\n {\n var ans = v;\n\n for (int i = 2; i <= n - v; i++)\n {\n ans = ans + i;\n }\n\n Console.WriteLine(ans);\n }\n\n }\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO.Pipes;\nusing System.Linq;\nusing System.Numerics;\nusing System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading;\n\n\nclass Test\n{\n\n static long MOD = 1000000007;\n static long[] fact = new long[500001];\n static long[] factInv = new long[500001];\n\n // Driver code \n public static void Main()\n {\n\n // int t = int.Parse(Console.ReadLine());\n // while (t > 0)\n {\n // t--;\n var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();\n var n = input1[0];\n var v = input1[1];\n\n var ans = v;\n\n for(int i=2;i<=n-v;i++)\n {\n ans = ans + i;\n }\n\n Console.WriteLine(ans);\n\n }\n }\n\n\n public static long FastPower(long a, long b)\n {\n if (b == 0)\n return 1;\n\n var val = FastPower(a, b / 2);\n\n if (b % 2 == 0)\n return val * val % MOD;\n else\n return val * val % MOD * a % MOD;\n }\n\n public static void Fact()\n {\n fact[0] = 1;\n factInv[0] = FastPower(fact[0], MOD - 2);\n\n for (int i = 1; i <= 500000; i++)\n {\n fact[i] = i * fact[i - 1] % MOD;\n factInv[i] = FastPower(fact[i], MOD - 2);\n }\n\n\n }\n\n public static long NCR(long n, long r)\n {\n return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(ab[0]);\n int v = Convert.ToInt32(ab[1]);\n int current = 1, totalmoney = 0;\n while(current=v)\n {\n if (current == 1) totalmoney += v * current;\n else totalmoney += (v - 1) * current;\n }\n current++;\n }\n Console.Write(totalmoney);\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nclass solution\n{\n static void Main(string[] args)\n {\n string[] ab = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(ab[0]);\n int v = Convert.ToInt32(ab[1]);\n int current = 1, totalmoney = 0;\n while(current=v)\n {\n if (current == 1) totalmoney += v * current;\n else totalmoney += current;\n }\n current++;\n }\n Console.Write(totalmoney);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class A1113_SashaAndHisTrip\n {\n public static void Main()\n {\n string[] a = Console.ReadLine().Split(' ');\n int n = int.Parse(a[0]);\n int v = int.Parse(a[1]);\n int totalcost = v;\n int i = 2;\n n--;\n while(v tankCapacity)\n {\n totalLitresNeeded -= tankCapacity;\n totalAmount += cityIndex * tankCapacity;\n }\n else if (tankCapacity > totalLitresNeeded)\n {\n totalAmount += cityIndex * totalLitresNeeded;\n totalLitresNeeded = 0;\n }\n else\n {\n totalAmount += cityIndex * tankCapacity;\n totalLitresNeeded = 0;\n }\n\n cityIndex++;\n }\n\n return totalAmount;\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Algorithms\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var nAndv = Console.ReadLine().Split();\n var n = int.Parse(nAndv[0]);\n var v = int.Parse(nAndv[1]);\n var result = SashasTrip(n, v);\n\n Console.WriteLine(result);\n }\n\n private static int SashasTrip(int numberOfCities, int tankCapacity)\n {\n if (numberOfCities - 1 == tankCapacity)\n return tankCapacity;\n\n if (tankCapacity > numberOfCities)\n return numberOfCities;\n\n int totalAmount = 0;\n int cityIndex = 2;\n\n totalAmount += tankCapacity;\n numberOfCities--;\n\n while (numberOfCities-- != tankCapacity)\n {\n totalAmount += cityIndex;\n\n cityIndex++;\n }\n\n return totalAmount;\n }\n \n\t\t\n\t\t\n\t\t\n }\n}"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] ab = Console.ReadLine().Split();\n int n = int.Parse(ab[0]);\n int v = int.Parse(ab[1]);\n \n\n if(v >= n - 1)\n {\n Console.WriteLine(v);\n }\n else\n {\n int i = 2;\n int liters = v ;\n int money = 1 * liters;\n while (i < n)\n {\n liters--;\n int c = v - liters;\n liters += c;\n money += c * i;\n if(liters >= n - i)\n {\n break;\n }\n i++;\n }\n }\n\n }\n\n static int convertToInt(string n)\n {\n return int.Parse(n);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace Codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n string[] ab = Console.ReadLine().Split();\n int n = int.Parse(ab[0]);\n int v = int.Parse(ab[1]);\n \n\n if(v >= n - 1)\n {\n Console.WriteLine(v);\n }\n else\n {\n int i = 2;\n int liters = v ;\n int money = 1 * liters;\n while (i < n)\n {\n liters--;\n int c = v - liters;\n liters += c;\n money += c * i;\n if(liters >= n - i)\n {\n break;\n }\n i++;\n }\n Console.WriteLine(money);\n }\n\n }\n\n static int convertToInt(string n)\n {\n return int.Parse(n);\n }\n }\n}\n"}, {"source_code": "using System; \nusing System.Linq; \n\nnamespace ConsoleApplication2 \n{ \ninternal class Program \n{ \npublic static void Main(string[] args) \n{ \nint[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray(); \nint ans = 0; \nif (array[1] >= array[0] - 1) ans = array[1]; \nelse if (array[1] < array[0]) \n{ \nans += array[1]; \nfor (int i = 1; i <= array[0]; i++) \n{ \nif (array[0] - i != array[1] - 1) \nans += i; \nelse \nbreak; \n} \n} \n\nConsole.WriteLine(ans - 1); \n} \n} \n}"}, {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 64 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var v = sr.NextInt32();\n var currV = 0;\n var total = 0;\n for (var i = 1; i <= n; i++)\n {\n var need = n - i;\n currV--;\n \n if (need <= currV)\n {\n sw.WriteLine(total);\n return;\n }\n\n var d = need - currV;\n if (d <= v)\n {\n total += (d * i);\n sw.WriteLine(total);\n return;\n }\n\n if (i == 1)\n {\n total += v;\n currV = v;\n }\n else\n {\n total += i;\n currV = v;\n }\n }\n \n throw new InvalidOperationException();\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\nclass Pair\n{\n public long Value { get; set; }\n public int Count { get; set; }\n}\n\nclass PairComparer : Comparer\n{\n public override int Compare(Pair x, Pair y)\n {\n return x.Value.CompareTo(y.Value);\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "\ufeff//\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff\ufeff#define EXTENDSTACKSIZE\n\n\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace CF\n{\n internal class Program\n {\n private const int stackSize = 64 * 1024 * 1024;\n \n private static void Run()\n {\n using (var sr = new InputReader(Console.In))\n// using (var sr = new InputReader(new StreamReader(\"input.txt\")))\n using (var sw = Console.Out)\n// using (var sw = new StreamWriter(\"output.txt\"))\n using (var task = new Task(sr, sw)) {\n task.Solve();\n// Console.ReadKey();\n }\n }\n \n private static void Main(string[] args)\n {\n#if EXTENDSTACKSIZE\n var threadStart = new ThreadStart(Run);\n var thread = new Thread(threadStart, stackSize);\n thread.Start();\n thread.Join();\n#else\n Run();\n#endif\n }\n }\n\n internal class Task : IDisposable\n {\n private readonly InputReader sr;\n private readonly TextWriter sw;\n private bool isDispose;\n \n public Task(InputReader sr, TextWriter sw)\n {\n this.sr = sr;\n this.sw = sw;\n }\n \n public void Solve()\n {\n var n = sr.NextInt32();\n var v = sr.NextInt32();\n var currV = 0;\n var total = 0;\n for (var i = 1; i <= n; i++)\n {\n var need = n - i;\n if (i > 1)\n {\n currV--;\n }\n\n if (need <= currV)\n {\n sw.WriteLine(total);\n return;\n }\n\n var d = need - currV;\n if (d <= v)\n {\n total += (d * i);\n sw.WriteLine(total);\n return;\n }\n\n if (i == 1)\n {\n total += v;\n currV = v;\n }\n else\n {\n total += i;\n currV = v;\n }\n }\n \n throw new InvalidOperationException();\n }\n \n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n \n private void Dispose(bool disposing)\n {\n if (!isDispose) {\n if (disposing) {\n if(sr != null)\n sr.Dispose();\n \n if(sw != null)\n sw.Dispose();\n }\n\n isDispose = true;\n }\n }\n }\n}\n\nclass Pair\n{\n public long Value { get; set; }\n public int Count { get; set; }\n}\n\nclass PairComparer : Comparer\n{\n public override int Compare(Pair x, Pair y)\n {\n return x.Value.CompareTo(y.Value);\n }\n}\n\ninternal class InputReader : IDisposable\n{\n private bool isDispose;\n private readonly TextReader sr;\n private string[] buffer;\n private int seek;\n\n public InputReader(TextReader stream)\n {\n sr = stream;\n }\n\n public void Dispose()\n {\n Dispose(true);\n GC.SuppressFinalize(this);\n }\n\n public string NextString()\n {\n var result = sr.ReadLine();\n return result;\n }\n\n public int NextInt32()\n {\n return Int32.Parse(ReadNextToken());\n }\n\n private string ReadNextToken()\n {\n if (buffer == null || seek == buffer.Length) {\n seek = 0;\n buffer = NextSplitStrings();\n }\n\n return buffer[seek++];\n }\n\n public long NextInt64()\n {\n return Int64.Parse(ReadNextToken());\n }\n \n public int[] ReadArrayOfInt32()\n {\n return ReadArray(Int32.Parse);\n }\n\n public long[] ReadArrayOfInt64()\n {\n return ReadArray(Int64.Parse);\n }\n\n public string[] NextSplitStrings()\n {\n return NextString()\n .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public T[] ReadArray(Func func)\n {\n return NextSplitStrings()\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n public T[] ReadArrayFromString(Func func, string str)\n {\n return\n str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n .Select(s => func(s, CultureInfo.InvariantCulture))\n .ToArray();\n }\n\n protected void Dispose(bool dispose)\n {\n if (!isDispose)\n {\n if (dispose)\n sr.Close();\n \n isDispose = true;\n }\n }\n\n ~InputReader()\n {\n Dispose(false);\n }\n}"}, {"source_code": "using System;\nclass Codeforces_Round_539_A\n{\n static void Main()\n {\n string [] s = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(s[0]);\n int v = Convert.ToInt32(s[1]);\n int [] a = new int [n];\n int i = 0; int t = n-1; int coin = 0;\n for(; i t) coin = t;\n if(v < t)\n {\n int tb = v; coin = v * a[0];\n for(int k=1; k t) coin = t;\n if(v < t)\n {\n int tb = v; coin = v * a[0];\n for(int k=1; k v)\n {\n i = 1;\n for (int m = 2; m <= mNo; m++)\n {\n i += m;\n }\n i += lastCity;\n Console.WriteLine(i);\n }\n \n }\n }\n}"}, {"source_code": "\ufeffnamespace Problem\n{\n using System;\n #region GIFT\n class Gift\n {\n void Main()\n {\n int n = int.Parse( Console.ReadLine() );\n int[] a = new int[n];\n for(int t = 0 ; t < n ; t++)\n {\n a[t] = int.Parse( Console.ReadLine() );\n }\n int i=0;\n int dem = 1;\n int max = dem;\n while(i < n-1)\n {\n if(a[i] < a[i + 1])\n {\n dem++;\n if(i == n - 2)\n max = max > dem ? max : dem;\n }\n else\n {\n max = max > dem ? max : dem;\n dem = 1;\n }\n i++;\n }\n Console.WriteLine( max );\n }\n }\n #endregion\n class Strop\n {\n static void Main()\n {\n string[] str = Console.ReadLine().Split();\n int n = int.Parse( str[0] );\n int v = int.Parse( str[1] );\n\n int soTien = v-1;\n int i = 1;\n while(n > v)\n {\n soTien += i;\n i++;\n n--;\n }\n Console.WriteLine( soTien );\n }\n }\n}"}], "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7"} {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int d;\n d = n / 5;\n int c = n % 5;\n if (c > 0)\n {\n Console.WriteLine(d+1);\n }\n else\n {\n\n Console.WriteLine(d);\n }\n\n }\n\n }\n}", "positive_code": [{"source_code": "using System;\nnamespace problem {\n class Program {\n static void Main(string[] args) {\n int c = 0;\n string[] input1 = Console.ReadLine().Split();\n var n = int.Parse(input1[0]);\n c = (n / 5);\n if (n % 5 != 0)\n {\n c++;\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace Zada4ki\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n x += 4;\n Console.WriteLine(x/5);\n }\n }\n}\n"}, {"source_code": "using System;\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = Int32.Parse(Console.ReadLine());\n var res = 0;\n for (var j = 5; j > 0; --j)\n {\n res += x / j;\n x = x % j;\n }\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "namespace _617A\n{\n using System;\n public class Program\n {\n public static void Main(string[] args)\n {\n double x = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Ceiling(x / 5));\n }\n }\n}\n"}, {"source_code": "using System; \n\n class Exercise11 \n\n{ \n \n \n static void Main()\n \n {\n\n int n=Convert.ToInt32(Console.ReadLine());\n \n int p=0,q=0,r=0,s=0,t=0,u=0;\n \n p=n/5;\n \n q=n%5;\n \n if(q%4==0)\n \n {\n r=q/4;\n }\n \n else if(q%3==0)\n \n {\n s=q/3;\n }\n \n else if(q%2==0)\n \n {\n t=q/2;\n }\n \n else if(q%1==0)\n \n {\n u=q/1;\n }\n\n Console.WriteLine(p+r+s+t+u);\n\n }\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\n// Codeforces problem 617 A\nnamespace _617_A\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tlong n = Convert.ToInt64(Console.ReadLine());\n\t\t\tlong result = 0;\n\t\t\tresult += n / 5;\n\t\t\tn %= 5;\n\t\t\tresult += n / 4;\n\t\t\tn %= 4;\n\t\t\tresult += n / 3;\n\t\t\tn %= 3;\n\t\t\tresult += n / 2;\n\t\t\tn %= 2;\n\t\t\tresult += n;\n\t\t\tConsole.WriteLine(result);\n\t\t\t//Console.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n if (x < 6)\n Console.WriteLine(\"1\");\n else if (x % 5 == 0)\n Console.WriteLine(x / 5);\n else\n Console.WriteLine(x / 5 + 1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\n\nclass Program\n{\n static char[] SPACE = new[] { ' ' };\n\n static void Main(string[] args)\n {\n#if DEBUG\n using (var input = new StreamReader(\"input.txt\"))\n using (var output = new StreamWriter(\"output.txt\"))\n {\n Console.SetIn(input);\n Console.SetOut(output);\n\n int n = 0;\n do\n {\n Console.WriteLine();\n Console.WriteLine(\"Sample {0}\", ++n);\n Prog();\n } while (Console.ReadLine() == string.Empty);\n }\n#else\n Prog();\n#endif\n }\n\n static int __ptr = 0;\n static string[] __input;\n static int NextInt()\n {\n return int.Parse(__input[__ptr++]);\n }\n static long NextLong()\n {\n return long.Parse(__input[__ptr++]);\n }\n static void ReadTokens(int n)\n {\n __ptr = 0;\n __input = Console.ReadLine().Split(SPACE, n);\n }\n\n //\n\n static bool[] notPrime;\n\n static void Prog()\n {\n ReadTokens(1);\n int n = NextInt();\n\n Console.WriteLine( n / 5 + ((n % 5 == 0) ? 0 : 1) );\n }\n}"}, {"source_code": "using System;\n\nstatic class Task617A\n{\n\tpublic static void Main(string[] args)\n\t{\n\t\tvar n = double.Parse(Console.ReadLine());\n\t\tConsole.WriteLine(Math.Ceiling(n / 5));\n\t}\n}"}, {"source_code": "using System;\n\nnamespace A\n{\n class Program\n {\n static void Main()\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 0, s;\n for (s = 5; n != 0 && s > 0; )\n {\n k += n / s;\n n -= s * (n / s);\n s = n % s;\n }\n Console.WriteLine(k);\n }\n }\n}"}, {"source_code": "using System;\nnamespace ConsoleApplication4\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tConsole.WriteLine((int)Math.Ceiling(double.Parse(Console.ReadLine()) / 5.0));\n\t\t}\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Test\n{\n static class Program\n {\n static void Main(string[] args)\n {\n string temp = Console.ReadLine();\n long l = long.Parse(temp);\n Console.WriteLine((l + 4) / 5);\n }\n\n static void Solve(List numbs)\n {\n\n }\n }\n\n internal class Marker\n {\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Olymp617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine()), d = 0;\n d += x / 5;\n x %= 5;\n d += x / 4;\n x %= 4;\n d += x / 3;\n x %= 3;\n d += x / 2;\n x %= 2;\n d += x / 1;\n x %= 1;\n Console.Write(d);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace CodeF\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var ChisloEbat = int .Parse(Console.ReadLine());\n int s = ChisloEbat / 5;\n int v = s * 5;\n if (ChisloEbat > v)\n {\n Console.WriteLine(s +1);\n }\n else\n {\n Console.WriteLine(s);\n }\n }\n }\n}"}, {"source_code": "using System; \n\n class Exercise11 \n\n{ \n \n \n static void Main()\n \n {\n\n int n=Convert.ToInt32(Console.ReadLine());\n \n int p=0,q=0,r=0,s=0,t=0,u=0;\n \n p=n/5;\n \n q=n%5;\n \n if(q%4==0)\n \n {\n r=q/4;\n }\n \n else if(q%3==0)\n \n {\n s=q/3;\n }\n \n else if(q%2==0)\n \n {\n t=q/2;\n }\n \n else if(q%1==0)\n \n {\n u=q/1;\n }\n\n Console.WriteLine(p+r+s+t+u);\n\n }\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n here: int x = int.Parse(Console.ReadLine());\n if(x<1||x>1000000)\n {\n goto here;\n }\n int sum = 0;\n for(int i=x;i>0;i--)\n {\n \n if(x>=5)\n {\n x = x - 5;\n sum=sum+1; \n }\n else if(x<5&& x>0)\n {\n sum++;\n break;\n }\n\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.Versioning;\nusing System.Text;\nusing static System.Math;\n\nnamespace HackerRank\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int div = DivRem(x, 5, out int rem);\n Console.WriteLine(rem == 0 ? div : div + 1);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces_617A_Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n Console.WriteLine(x % 5 == 0 ? x / 5 : (x + 5) / 5);\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main() \n {\n int steps = int.Parse(Console.ReadLine());\n Console.WriteLine(Math.Ceiling((double)steps / 5));\n \n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int friendHouse = Convert.ToInt32(Console.ReadLine());\n if (friendHouse % 5 == 0)\n Console.WriteLine((friendHouse / 5).ToString());\n else\n Console.WriteLine(((friendHouse / 5) + 1).ToString());\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace ConsoleApp22\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n,x=0; int sum = 0;\n n = Convert.ToInt64(Console.ReadLine());\n while (x < n)\n {\n if (n-x>=5)\n {\n x += 5;\n sum += 1;\n }\n else if (n-x<5)\n {\n x += n - x;\n sum += 1;\n }\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n Int32 ans, x = Convert.ToInt32(Console.ReadLine());\n \n if(x%5 == 0)\n {\n ans = x / 5;\n }\n else\n {\n ans = (x / 5) + 1;\n }\n\n Console.WriteLine(ans);\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine((Convert.ToInt32(Console.ReadLine())+4)/5);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ConsoleApp7\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int steps = 0;\n\n while(n > 0)\n {\n if(n >= 5) n -= 5;\n else\n if (n >= 4) n-= 4;\n else\n if(n >=3) n -= 3;\n else \n if(n>=2) n -= 2;\n else\n if(n>=1) n -= 1;\n steps++; \n }\n\n Console.WriteLine(steps);\n }\n }\n}"}, {"source_code": "\n\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n class Program\n {\n \n public static int[] ReadIntArray()\n {\n return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n public static void ReadIntPair(out int a, out int b)\n {\n var ar = ReadIntArray();\n a = ar[0];\n b = ar[1];\n }\n public static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n \n \n \nstatic void Main(string[] args){\n \n \n \n var n = ReadInt();\n int cnt=0;\n for(int i=5;i>=2;i--){\n cnt+=n/i;\n n%=i;\n }\n \n Console.WriteLine(cnt+n);\n \n \n }}"}, {"source_code": "using System;\n\nnamespace ElephantSteps\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Elephant\n int x = int.Parse(Console.ReadLine());\n int steps = 0;\n if (x > 5)\n {\n steps += x / 5;\n if (x % 5 > 0)\n steps += 1;\n\n }\n else {\n steps = 1;\n }\n Console.Write(steps);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int x = int.Parse(Console.ReadLine());\n int y = 0, cnt=0;\n for (int i = 5; i >= 1; i--)\n { \n while (y+i<=x)\n if (y + i <= x)\n {\n cnt++;\n y += i;\n }\n }\n Console.Write(cnt);\n\n }\n\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int length = Convert.ToInt32(Console.ReadLine());\n int c = length / 5;\n length %= 5;\n for(int i=4;i>=1;i--)\n {\n c += length / i;\n length %= i;\n }\n Console.WriteLine(c);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Number = Int32.Parse(Console.ReadLine());\n Console.WriteLine((Number+4)/5);\n }\n }\n}"}, {"source_code": "using System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Result\n{\n\n /*\n * Complete the 'diagonalDifference' function below.\n *\n * The function is expected to return an INTEGER.\n * The function accepts 2D_INTEGER_ARRAY arr as parameter.\n */\n\n public static int diagonalDifference(int x)\n {\n int result = 0;\n int steps = x / 5;\n if (x <= 5) result = 1;\n else if (x % 5 == 0) result = steps;\n else result = steps + 1;\n return result;\n }\n\n}\n\nclass Solution\n{\n public static void Main(string[] args)\n {\n //TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable(\"OUTPUT_PATH\"), true);\n\n int n = Convert.ToInt32(Console.ReadLine().Trim());\n\n int result = Result.diagonalDifference(n);\n\n Console.WriteLine(result);\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq;\n\nnamespace SOLID\n{\n class Program\n {\n public static void Main(String[] args)\n {\n int distance = Int32.Parse(Console.ReadLine());\n int steps = 0;\n\n\n if (distance % 5 == 0)\n {\n steps = distance / 5;\n }\n else \n {\n steps = (distance / 5) + 1;\n }\n\n Console.WriteLine(steps);\n\n }\n\n }\n}\n"}, {"source_code": "using System;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int zlicz = 0;\n int odlicz = 5;\n\n\n while (n != 0) {\n\n if (n - odlicz >= 0)\n {\n n -= odlicz;\n zlicz++;\n }\n else\n {\n odlicz--;\n }\n\n\n }\n Console.WriteLine(zlicz);\n \n\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int distance = Convert.ToInt32(Console.ReadLine());\n\n int steps = 0;\n\n for( int i = 0; i < 1;)\n {\n if (distance - 5 >= 0)\n {\n distance -= 5;\n steps++;\n }\n else if (distance - 4 >= 0)\n {\n distance -= 4;\n steps++;\n }\n else if( distance - 3 >= 0)\n {\n distance -= 3;\n steps++;\n }\n else if(distance - 2 >= 0)\n {\n distance -= 2;\n steps++;\n }\n else if(distance - 1 >= 0)\n {\n distance -= 1;\n steps++;\n }\n\n if (distance == 0) i++;\n }\n\n \n\n Console.WriteLine(steps);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n\n int f = Int(Console.ReadLine());\n if(f > 5)\n {\n if(f % 5 == 0)\n Console.WriteLine(f / 5);\n else\n Console.WriteLine((f / 5) + 1);\n }\n else\n {\n Console.WriteLine(1);\n }\n\n\n }\n\n static int Int(object o)\n {\n return Convert.ToInt32(o);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ElephantMoves\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberSteps = Convert.ToInt32(Console.ReadLine());\n\n int[] elephantSteps = new int[] { 1, 2, 3, 4, 5 };\n\n if (numberSteps <= 5)\n Console.WriteLine(1);\n else if ( numberSteps%5 == 0)\n Console.WriteLine(numberSteps/5);\n else\n Console.WriteLine(numberSteps/5+1); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp1\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t int i = Convert.ToInt32(Console.ReadLine());\n\t\t\tint k = 0;\n\t\t\tdo {\n\t\t\t\tif (i > 0)\n\t\t\t\t{\n\t\t\t\t\tif (i >= 5) { i = i - 5; k++; }\n\t\t\t\t\tif (i ==4 ) { i = i - 4; k++; }\n\t\t\t\t\tif (i ==3) { i = i - 3; k++; }\n\t\t\t\t\tif (i ==2) { i = i - 2; k++; }\n\t\t\t\t\tif (i ==1) { i = i - 1; k++; }\n\t\t\t\t\t\n\t\t\t\t//\tConsole.WriteLine(k);\n\n\n\t\t\t\t}\n\n\t\t\t\t} while (i > 0);\n\t\t\tConsole.WriteLine(k);\n\t\t\t//Console.ReadKey();\n\n\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int dist = int.Parse(Console.ReadLine());\n int maxStep = 5;\n int steps = 0;\n\n while (dist > 0)\n {\n while (dist < maxStep)\n {\n maxStep--;\n }\n dist -= maxStep;\n steps++;\n }\n Console.WriteLine(steps);\n \n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.ComponentModel;\n\nnamespace ConsoleApp1\n{\t\n\t class Program\n\t{ \n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint input;\n\t\t\tinput = Convert.ToInt32(Console.ReadLine());\n\t\t\tif (input%5 == 0)\n {\n\t\t\t\tConsole.WriteLine(input/5);\n }\n else\n {\n\t\t\t\tConsole.WriteLine(input/5 + 1);\n }\n\n\t\t}\n\n\t\t\n\t\t\n\n\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int i = 0;\n int sum = 0;\n i = Convert.ToInt32(Console.ReadLine());\n if (i%5 == 0)\n {\n sum = (i / 5);\n }\n else\n {\n sum = (i / 5) + 1;\n }\n Console.WriteLine(sum);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace SoraIodusMagnus {\n public class Class1\n {\n public static void Main(String[] args)\n {\n int dist = Convert.ToInt32(Console.ReadLine());\n int ans = 0;\n for (int step = 5; step >= 1; --step)\n {\n ans += dist / step;\n dist %= step;\n }\n Console.WriteLine(ans);\n }\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n int x = Convert.ToInt32( Console.ReadLine() );\n int kq = 0;\n kq = x / 5 + x % 5 / 4 + ( x % 5 ) % 4 / 3 + ( ( x % 5 ) % 4 ) % 3 / 2 + (( ( x % 5 ) % 4 ) % 3) % 2;\n Console.WriteLine( kq );\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int c = 0;\n while (x != 0)\n {\n if (x>=5)\n {\n x -= 5;\n c++;\n }\n else if (x >= 4)\n {\n x -= 4;\n c++;\n }\n else if (x >= 3)\n {\n x -= 3;\n c++;\n }\n else if (x >= 2)\n {\n x -= 2;\n c++;\n }\n else if (x >= 1)\n {\n x -= 1;\n c++;\n }\n }\n Console.WriteLine(c);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace myApp {\n class Program {\n static void Main (string[] args) {\n Console.WriteLine((int.Parse(Console.ReadLine())+4) / 5);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace myApp {\n class Program {\n static void Main (string[] args) {\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine((x % 5 != 0 ? 1 : 0) + x / 5);\n }\n }\n}"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n int x = int.Parse(Console.ReadLine());\n int n = 5;\n if(x <= 5){\n \tConsole.WriteLine(1);\n \treturn;\n }\n int s = 1;\n while(x > n){\n \ts++;\n \tx-=n;\n \tif(x < n){\n \t\tbreak;\n \t}\n }\n Console.WriteLine(s);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace ConsoleApp9\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n var n = int.Parse(Console.ReadLine());\n\n if (n % 5 == 0) { n /= 5; }\n else { n = 1 + (n - (n % 5)) / 5; }\n Console.WriteLine(n);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Diagnostics;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = long.Parse(Console.ReadLine());\n if (n % 5 == 0)\n Console.WriteLine(n / 5);\n else\n Console.WriteLine(n / 5 + 1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n x = int.Parse(Console.ReadLine());\n x = x + 4;\n Console.WriteLine(x/5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\n\n\nnamespace ProblemN\n{\n\tpublic static class Program\n\t{\n\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tint x = int.Parse(Console.ReadLine().Trim()), counter = 0;\n\n\t\t\tfor(int i = 5; i > 0; i--)\n\t\t\t{\n\t\t\t\tint currSteps = x / i;\n\t\t\t\tcounter += currSteps;\n\t\t\t\tx -= currSteps * i;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(counter);\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace TmpApp\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n = Convert.ToDouble(Console.ReadLine());\n int result = Convert.ToInt32(Math.Ceiling(n / 5));\n Console.WriteLine(result);\n }\n }\n}"}, {"source_code": "using System;\nclass Program\n{\n static void Main()\n {\n int x = int.Parse(Console.ReadLine());\n if (x % 5 == 0)\n Console.WriteLine(x / 5);\n else\n Console.WriteLine(((x / 5) + 1));\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var friendPos = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(friendPos / 5 + (friendPos % 5 > 0 ? 1 : 0));\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Test\n{\n\t\n\tpublic static int maxStep = 5;\n\t\n\tpublic static void Main()\n\t{\t\t\n\t\tint coord = int.Parse(Console.ReadLine());\n\t\tint steps = 0;\n\t\t\n\t\twhile(coord > 0){\n\t\t\tcoord -= maxStep;\n\t\t\tsteps++;\n\t\t}\n\t\t\n\t\tConsole.WriteLine($\"{steps}\");\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF_Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n List divs = new List {5,4,3,2,1};\n int count = 0;\n while(n>0)\n {\n if (n >= divs.First())\n {\n count += n / divs.First();\n n = n % divs.First();\n divs.RemoveAt(0);\n }\n else\n {\n divs.RemoveAt(0);\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CompetitiveProgramming\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n string xString = Console.ReadLine();\n int x = int.Parse(xString);\n\n int r = (int)Math.Ceiling(x / 5.0);\n Console.WriteLine(r);\n }\n\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace filcik\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int yol = int.Parse(Console.ReadLine());\n if (yol <= 5)\n {\n Console.Write(\"1\");\n }\n else if(yol % 5 == 0)\n Console.Write(yol/5);\n else\n Console.Write(yol / 5+1);\n Console.ReadKey();\n }\n catch \n {\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CFTraining.A_s\n{\n class Elephant340\n {\n public static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(x / 5 + (x % 5 > 0 ? 1 : 0));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int y = x % 5;\n int a = x / 5;\n if (y != 0)\n a = a + 1;\n Console.Write(a);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(@\"..\\..\\output\");\n private static readonly StreamReader reader = new StreamReader(@\"..\\..\\input\");\n#endif\n\n static void Main(string[] args) {\n int x = Next();\n int n = x / 5;\n int p = x - n * 5;\n int ans = n + (p == 0 ? 0 : 1);\n writer.Write(ans);\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tConsole.WriteLine(Math.Ceiling(double.Parse(Console.ReadLine()) / 5.0));\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Demo\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int a = 0;\n int c = 0;\n while(a 0)\n {\n count += x / i;\n x = x % i;\n if (0 < x && x <= 5) { count++; break; }\n i--;\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\n\n\nstatic class Utils\n{\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public static int[] ReadIntArray()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray(); \n }\n public static List ReadIntList()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToList();\n }\n\n}\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = Utils.ReadInt();\n Console.WriteLine((int)Math.Ceiling(n/5.0));\n }\n \n\n \n\n \n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace testCS\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n int x;\n x = int.Parse(Console.ReadLine());\n if (x % 5 > 0)\n {\n Console.Write((x / 5) + 1);\n\n }\n else {\n Console.Write(x/5);\n }\n }\n }\n}\n"}, {"source_code": "using System;\npublic class CF{\n public static void Main(){\n int x = int.Parse(Console.ReadLine());\n int ans = 0;\n int t = x;\n for (int i = 5; i >= 1; i--)\n {\n ans += t / i;\n t = t % i;\n\n }\n Console.Write(ans);\n //Console.ReadKey();\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int n = int.Parse(s);\n int ans = n / 5;\n if (n % 5 != 0)\n {\n ans++;\n }\n Console.WriteLine(ans);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // int numberOfSocks = Console.ReadLine().Split().Select(int.Parse).ToArray() [0]; \n //int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int input = Convert.ToInt32(Console.ReadLine());\n\n Console.WriteLine(Math.Ceiling(input / 5.0));\n\n\n\n }\n \n\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _617A.Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32( Console.ReadLine());\n int suma = 0,i=0;\n int[] steps = { 5, 4, 3, 2, 1 };\n while (n >= 1)\n {\n if (n >= steps[i])\n {\n suma += n / steps[i];\n n -= suma * steps[i]; \n } \n i++;\n }\n Console.WriteLine(\"{0}\",suma);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace Round340\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n // After elephant do all biggest steps there may be one more smaller step to do.\n var totalSteps = Math.Ceiling(x / 5.0);\n Console.WriteLine(totalSteps);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Numerics;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int move = 0;\n if (x <= 5)\n {\n move = 1;\n }\n else\n {\n while (x > 5)\n {\n x -= 5;\n move++;\n }\n if (x <= 5)\n {\n move += 1;\n }\n }\n Console.WriteLine(move);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ejercicio\n{\n class Program\n {\n static void Main(string[] args)\n {\n int cont = 0;\n int x = int.Parse(Console.ReadLine());\n if (x >= 5){\n cont+=(x/5);\n x %= 5;\n }\n if (x >= 4)\n {\n cont += (x / 4);\n x %= 4;\n }\n if (x >= 3)\n {\n cont += (x / 3);\n x %= 3;\n }\n if (x >= 2)\n {\n cont += (x / 2);\n x %= 2;\n }\n if (x >= 1)\n {\n cont += (x / 1);\n x %= 1;\n }\n\n Console.WriteLine(cont);\n // Console.ReadKey();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n var n = int.Parse(Console.ReadLine());\n Console.WriteLine((n+4)/5);\n }\n }\n}\n"}], "negative_code": [{"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LearningCSharp\n{\n class _617A\n {\n static void Main(string [] args)\n {\n\n long nm = Convert.ToInt64(Console.ReadLine());\n long jk=0;\n if (nm > 5) {\n jk = 1 + nm / 5;\n }\n else\n {\n jk = 1;\n }\n Console.WriteLine(jk);\n\n\n\n }\n\n\n\n\n\n\n\n\n\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n,q;\n n = int.Parse(Console.ReadLine());\n q=0;\n while(n-5 >= 1)\n {\n n -= 5;\n q++;\n }\n while (n - 4 >= 1)\n {\n n -= 4;\n q++;\n }\n while (n - 3 >= 1)\n {\n n -= 3;\n q++;\n }\n while (n - 2 >= 1)\n {\n n -= 2;\n q++;\n }\n while (n - 1 == 0)\n {\n n -= 1;\n q++;\n }\n Console.WriteLine(q);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n double n,q;\n n = double.Parse(Console.ReadLine());\n q=0;\n while(n-5 >= 1)\n {\n n -= 5;\n q++;\n }\n while (n - 4 >= 1)\n {\n n -= 4;\n q++;\n }\n while (n - 3 >= 1)\n {\n n -= 3;\n q++;\n }\n while (n - 2 >= 1)\n {\n n -= 2;\n q++;\n }\n while (n - 1 >= 1)\n {\n n -= 1;\n q++;\n }\n Console.WriteLine(q);\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace filcik\n{\n class Program\n {\n static void Main(string[] args)\n {\n try\n {\n int bolum;\n int yol = int.Parse(Console.ReadLine());\n if (yol <= 5)\n {\n Console.Write(\"1\");\n }\n else\n Console.Write((yol/5)+1);\n Console.ReadKey();\n }\n catch \n {\n }\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n decimal c = 0;\n if (x <= 5)\n Console.WriteLine(\"1\");\n else if(x%2==0)\n {\n c = x / 4;\n Console.WriteLine(c);\n }\n else\n {\n c =( x / 5)+1;\n Math.Round(c);\n \n Console.WriteLine(c);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _41a\n{\n \n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n double c = 0;\n if (x<=5)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n c = x / 5;\n Console.WriteLine(1+c);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int c = x / 4;\n if (x <= 5)\n Console.WriteLine(\"1\");\n else\n {\n\n Console.WriteLine(c);\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n double c = 0;\n if (x <= 5)\n Console.WriteLine(\"1\");\n else if(x%2==0)\n {\n if (x.ToString().Length >= 7)\n {\n c = x / 5;\n Math.Round(c);\n Console.WriteLine(c);\n }\n else\n {\n c = x / 4;\n Math.Round(c);\n Console.WriteLine(c);\n }\n }\n else\n {\n c =( x / 5)+1;\n Math.Round(c);\n \n Console.WriteLine(c);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n if (n==5)\n {\n Console.WriteLine(1);\n return;\n }\n Console.WriteLine(((n)/5)+1);\n\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace tren\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine()), count = 0, i = 5;\n if (x <= 5) { Console.Write(1); return; }\n while (x > 0)\n {\n count += x / i;\n x = x % i;\n if (x <= 5) { count++; break; }\n i--;\n }\n Console.Write(count);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\n\n\nstatic class Utils\n{\n public static int ReadInt()\n {\n return Convert.ToInt32(Console.ReadLine());\n }\n public static int[] ReadIntArray()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToArray(); \n }\n public static List ReadIntList()\n {\n return (from s in Console.ReadLine().Split(' ') select Convert.ToInt32(s)).ToList();\n }\n\n}\n\nclass Program\n{\n static void Main(string[] args)\n {\n int n = Utils.ReadInt();\n Console.WriteLine(n/5 + 1);\n }\n \n\n \n\n \n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace test_codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n // int numberOfSocks = Console.ReadLine().Split().Select(int.Parse).ToArray() [0]; \n //int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n int input = Convert.ToInt32(Console.ReadLine());\n\n\n\n Console.WriteLine((input % 5) + 1); \n \n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n } \n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _617A.Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32( Console.ReadLine());\n int suma = 0,i=0;\n int[] steps = { 5, 4, 3, 2, 1 };\n while (n > 1)\n {\n if (n >= steps[i])\n {\n suma += n / steps[i];\n n -= suma * steps[i]; \n } \n i++;\n }\n Console.WriteLine(\"{0}\",suma);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CodeForcecTrain\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n int p = 5;\n int steps = 0;\n while (p>=1)\n {\n while (x - p > 0)\n {\n steps++;\n x -= p;\n }\n p--;\n }\n Console.Write(steps);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace A._Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int counter = n / 5;\n if (counter % 5 != 0) counter++;\n\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n var res = 0;\n for (int i = 5; i >= 1; i--)\n {\n res += x/i;\n x /= i;\n }\n\n Console.WriteLine(res);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ElephantMoves\n{\n class Program\n {\n static void Main(string[] args)\n {\n int numberSteps = Convert.ToInt32(Console.ReadLine());\n\n int[] elephantSteps = new int[] { 1, 2, 3, 4, 5 };\n\n if (numberSteps <= 5)\n Console.WriteLine(1);\n else\n Console.WriteLine(numberSteps/5+1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int input = Convert.ToInt32(Console.ReadLine());\n int count = 1;\n\n if (input > 5)\n count += (input / 5);\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CodeForces.SquareTheNumber\n{\n class Program\n {\n static void Main(string[] args)\n {\n problem617A();\n }\n // problem 617A Elephant\n static void problem617A()\n {\n int xDistance = nextIntegerInput();\n int baseSteps = xDistance / 5;\n int result = baseSteps + ((baseSteps % 5) > 0 ? 1 : 0);\n Console.WriteLine(result);\n }\n\n static int nextIntegerInput()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static int stringToInt(string number)\n {\n return int.Parse(number);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine(x / 5 == 0 ? x : x / 5 + 1);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant_0\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine());\n Console.WriteLine(x % 5 == 0 ? x : x / 5 + 1);\n Console.ReadLine();\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine(x%5+x/5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long x = Convert.ToInt64(Console.ReadLine());\n x = x + 1;\n Console.WriteLine(x%5+x/5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication6\n{\n class Program\n {\n static void Main(string[] args)\n {\n int ss = int.Parse(Console.ReadLine());\n int steps = 0;\n while (ss / 5 >= 1)\n {\n ss -= 5;\n steps++;\n }\n steps++;\n \n Console.WriteLine(steps);\n \n }\n\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Olymp617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = int.Parse(Console.ReadLine()), d = 0;\n d += x /= 5;\n d += x /= 4;\n d += x /= 3;\n d += x /= 2;\n d += x /= 1;\n Console.Write(d);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForcesCSharp\n{\n class Program\n {\n // int n = Convert.ToInt32(Console.ReadLine());\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n int steps = 0;\n \n while (n > 1)\n {\n if (n >= 5)\n {\n steps++;\n n -= 5;\n }\n else if (n >= 4)\n {\n steps++;\n n -= 4;\n }\n else if(n >= 3)\n {\n steps++;\n n -= 3;\n }\n else if(n >= 2)\n {\n steps++;\n n -= 2;\n }\n else\n {\n steps += n;\n break;\n }\n }\n\n Console.WriteLine(steps);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int result = 0;\n if (n < 5)\n Console.WriteLine(\"1\");\n else if (n % 5 == 0)\n {\n result = n / 5;\n }\n else\n {\n result = (n / 5) + 1;\n }\n Console.WriteLine(result);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _24___A._Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n\n int n = Convert.ToInt32(Console.ReadLine());\n\n //int p = 0, q = 0, r = 0, s = 0, t = 0, u = 0;\n\n //p = n / 5;\n\n //q = n % 5;\n\n //if (q % 4 == 0)\n\n //{\n // r = q / 4;\n //}\n\n //else if (q % 3 == 0)\n\n //{\n // s = q / 3;\n //}\n\n //else if (q % 2 == 0)\n\n //{\n // t = q / 2;\n //}\n\n //else if (q % 1 == 0)\n\n //{\n // u = q / 1;\n //}\n\n //Console.WriteLine(p + r + s + t + u);\n int count = 0;\n // int counter2 = 0;\n\n if (n<=5)\n {\n Console.WriteLine(1);\n }\n else\n {\n count = n / 5;\n // counter2 = n % 5;\n\n Console.WriteLine(count+1);\n }\n\n\n\n\n\n\n }\n }\n}\n\n"}, {"source_code": "\n\n using System;\n \n namespace Elephant_ns\n {\n class Elephant\n {\n static int jump(int numOfPlace)\n {\n int numOfJumps = numOfPlace/5;\n numOfJumps += numOfPlace%5;\n return numOfJumps;\n }\n \n public static void Main(string []args)\n {\n int numOfPlace = Convert.ToInt32(Console.ReadLine());\n int numOfJumps = jump(numOfPlace);\n Console.WriteLine(numOfPlace);\n }\n }\n }"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Code\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int count = 0;\n int temp = 0;\n while(temp < n)\n {\n for (int i = 5; i > 0; i--)\n {\n if (temp + i <= n)\n {\n temp += i;\n count++;\n }\n }\n }\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp2\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\n\t\t\tint n = Convert.ToInt32(Console.ReadLine());\n\t\t\tint x = 0;\n\n\t\t\twhile (n != 0)\n\t\t\t{\n\t\t\t\tif (n >= 5)\n\t\t\t\t{\n\t\t\t\t\tx = n / 5;\n\t\t\t\t\tn = n % 5;\n\t\t\t\t\tConsole.WriteLine(n);\n\t\t\t\t}\n\t\t\t\tif (n == 4)\n\t\t\t\t{\n\t\t\t\t\tx++;\n\t\t\t\t\tn = 0;\n\t\t\t\t}\n\t\t\t\tif (n == 3)\n\t\t\t\t{\n\t\t\t\t\tx++;\n\t\t\t\t\tn = 0;\n\t\t\t\t}\n\t\t\t\tif (n == 2)\n\t\t\t\t{\n\t\t\t\t\tx++;\n\t\t\t\t\tn = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t x++;\n\t\t\t\t n = 0;\n\t\t } \n\n\t\t\t}\n\t\t\tConsole.WriteLine(x);\n\n\n\t\t\tConsole.ReadLine();\n\t\t} \n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace A\n{\n class Program\n {\n static void Main()\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int k = 0, s = 5;\n for (s = 5; n != 0 && s > 0; s--) \n {\n if (n % s == 0)\n {\n n -= s;\n k++;\n }\n }\n Console.WriteLine(k);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var a = int.Parse(Console.ReadLine());\n int i,b;\n for (i= 5;i>=1;i--)\n {\n if(a%i==0)\n {\n b = a / i;\n Console.WriteLine(b);\n break;\n }\n }\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.InteropServices;\n\nnamespace CodeF\n{\n class Program\n {\n \n static void Main(string[] args)\n {\n var ChisloEbat = int .Parse(Console.ReadLine());\n int s = ChisloEbat / 5;\n int v = s * 5;\n if (ChisloEbat > v)\n {\n Console.WriteLine(s++);\n }\n else\n {\n Console.WriteLine(s);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static public void problem()\n {\n String x = Console.ReadLine();\n int y = int.Parse(x);\n int counter = 0;\n while (y > 0)\n {\n if (y >= 5)\n {\n y = y - 5;\n counter++;\n }\n else if (y >= 4)\n {\n y = y - 4;\n counter++;\n }\n else if (y >= 3)\n {\n y = y - 3;\n counter++;\n }\n else if (y >= 2)\n {\n y = y - 2;\n counter++;\n }\n else if (y >= 1)\n {\n y = y - 1;\n counter++;\n }\n }\n Console.WriteLine(y);\n }\n static void Main(string[] args)\n {\n problem();\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace Elephant\n{\n class Program\n {\n public static long Func(long number)\n {\n if(number > 0 && number < 6)\n {\n return 1;\n }\n else\n {\n return number / 5 + 1;\n }\n }\n static void Main(string[] args)\n {\n long number = long.Parse(Console.ReadLine());\n Console.Write(Func(number));\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace c617a\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint x = Convert.ToInt32(Console.ReadLine());\n\t\t\tint answer = 0;\n\t\t\tif(x%5 != 0)\n\t\t\t{\n\t\t\t\tanswer = x / 5 + 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tanswer = x / 5;\n\t\t\t}\n\t\t\tConsole.WriteLine(\"x % 5 = \" + x % 5);\n\t\t\tConsole.WriteLine(\"x / 5 = \" + x / 5);\n\t\t\tConsole.WriteLine(answer);\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Net.NetworkInformation;\n\nnamespace ConsoleApp2\n{\n public class Solution\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n int umanjenje;\n while (n != 0)\n {\n umanjenje = 0;\n if (n % 5 == 0)\n {\n umanjenje = 5;\n }\n else if (n % 4 == 0)\n {\n umanjenje = 4;\n }\n else if (n % 3 == 0)\n {\n umanjenje = 3;\n }\n else if (n % 2 == 0)\n {\n umanjenje = 2;\n }\n else\n {\n\n umanjenje = 1;\n }\n\n n -= umanjenje;\n\n counter++;\n }\n if (counter > 200000)\n counter--;\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Net.NetworkInformation;\n\nnamespace ConsoleApp2\n{\n public class Solution\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n int umanjenje;\n while (n != 0)\n {\n umanjenje = 0;\n if (n % 5 == 0)\n {\n umanjenje = 5;\n }\n else if (n % 4 == 0)\n {\n umanjenje = 4;\n }\n else if (n % 3 == 0)\n {\n umanjenje = 3;\n }\n else if (n % 2 == 0)\n {\n umanjenje = 2;\n }\n else\n umanjenje = 1;\n\n n -= umanjenje;\n counter++;\n }\n\n Console.WriteLine(counter);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace ElephantSteps\n{\n class Program\n {\n static void Main(string[] args)\n {\n //Elephant\n int x = int.Parse(Console.ReadLine());\n int steps = 0;\n if (x > 5)\n {\n steps += x / 5 + 1;\n\n }\n else {\n steps = 1;\n }\n Console.Write(steps);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var Number = Int32.Parse(Console.ReadLine());\n Console.WriteLine((Number+1)/5);\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace StructurePrac\n{\n public enum Months\n {\n Jan = 1, Feb, March, April, May, June, July\n }\n class Program\n {\n\n static void Main(string[] args)\n {\n int a = int.Parse(Console.ReadLine());\n if (a >= 1 && a <= 5)\n {\n Console.WriteLine(1);\n }\n\n else\n Console.WriteLine((a / 5) + 1);\n }\n }\n}\n"}, {"source_code": "using System.CodeDom.Compiler;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Text.RegularExpressions;\nusing System.Text;\nusing System;\n\nclass Result\n{\n\n /*\n * Complete the 'diagonalDifference' function below.\n *\n * The function is expected to return an INTEGER.\n * The function accepts 2D_INTEGER_ARRAY arr as parameter.\n */\n\n public static int diagonalDifference(int x)\n {\n int result = 0;\n int steps = x / 5;\n if (x<=5) result = 1;\n else result =steps + 1;\n return result;\n }\n\n}\n\nclass Solution\n{\n public static void Main(string[] args)\n {\n //TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable(\"OUTPUT_PATH\"), true);\n\n int n = Convert.ToInt32(Console.ReadLine().Trim());\n\n int result = Result.diagonalDifference(n);\n\n Console.WriteLine(result);\n\n \n }\n}\n"}, {"source_code": "using System;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int zlicz = 0;\n\n\n for (int i = 5; i >= 1; i--)\n {\n if (n % i == 0)\n {\n\n zlicz += n / i;\n break;\n }\n \n }\n Console.WriteLine(zlicz);\n\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Security.Cryptography.X509Certificates;\nusing System.Text;\n\nnamespace ConsoleApp1\n{\n internal class Program\n {\n\n\n private static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int zlicz = 0;\n\n\n for (int i = 5; i >= 1; i--)\n {\n if (n % i == 0)\n {\n zlicz += n / i;\n\n }\n \n }\n Console.WriteLine(zlicz);\n\n }\n }\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n\n int f = Int(Console.ReadLine());\n if(f > 5)\n {\n Console.WriteLine((f / 5) + 1);\n }\n else\n {\n Console.WriteLine(1);\n }\n\n\n }\n\n static int Int(object o)\n {\n return Convert.ToInt32(o);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nnamespace ogaver__\n{\n\n class Program\n {\n static void Main(string[] args)\n {\n\n int f = Int(Console.ReadLine());\n if(f > 5)\n {\n Console.WriteLine((f % 5) + 1);\n }\n else\n {\n Console.WriteLine(1);\n }\n\n\n }\n\n static int Int(object o)\n {\n return Convert.ToInt32(o);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApp3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int step;\n int x = int.Parse(Console.ReadLine());\n if (x % 5 == 0)\n {\n step = 1;\n }\n else { step = 0; }\n step = x/ 5;\n step++;\n Console.Write(step);\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n Random rnd = new Random();\n int friendHouasePosition = rnd.Next(0, 1000000);\n\n int steps = 0;\n while (friendHouasePosition !=0)\n {\n for (int i=5;i>0;i--)\n {\n if (friendHouasePosition >= i)\n {\n friendHouasePosition -= i;\n steps++;\n break;\n }\n }\n \n }\n Console.WriteLine(steps);\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n Random rnd = new Random();\n int friendHouasePosition = rnd.Next(0, 1000000);\n\n int steps =0;\n Console.WriteLine(\"Friend position: {0}\" , friendHouasePosition);\n while (friendHouasePosition !=0)\n {\n for (int i=5;i>0;i--)\n {\n if (friendHouasePosition >= i)\n {\n friendHouasePosition -= i;\n steps++;\n break;\n }\n }\n \n }\n Console.WriteLine(steps);\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n int x = Convert.ToInt32( Console.ReadLine() );\n int kq = 0;\n kq = x / 5 + x % 5 / 4 + ( x % 5 ) % 4 / 3 + ( ( x % 5 ) % 4 ) % 3 / 2;\n Console.WriteLine( kq );\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nclass Problem\n{\n static void Main()\n {\n int x = Convert.ToInt32( Console.ReadLine() );\n int kq = 0;\n kq = x / 5 + x % 5 / 4 + ( x % 5 ) % 4 / 3 + ( ( x % 5 ) % 4 ) % 3 / 2;\n }\n}"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint x = 0;\n\t\tConsole.WriteLine(\"Enter X:\");\n\t\tx = Convert.ToInt32(Console.ReadLine());\n\t\tint e = 0;\n\t\tint i = 0;\n\t\twhile(e < x){\n\t\t\tif(e + 5 <= x){\n\t\t\t\te += 5;\n\t\t\t\ti++;\n\t\t\t} else if(e + 4 <= x){\n\t\t\t\te += 4;\n\t\t\t\ti++;\n\t\t\t} else if(e + 3 <= x){\n\t\t\t\te += 3;\n\t\t\t\ti++;\n\t\t\t} else if(e + 2 <= x){\n\t\t\t\te += 2;\n\t\t\t\ti++;\n\t\t\t} else if(e + 1 <= x){\n\t\t\t\te += 1;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(i);\n\t}\n}\n"}, {"source_code": "using System;\n\npublic class Program\n{\n\tpublic static void Main()\n\t{\n\t\tint x = 0;\n\t\tConsole.WriteLine(\"Enter X:\");\n\t\tx = Convert.ToInt32(Console.ReadLine());\n\t\tint e = 0;\n\t\tint i = 0;\n\t\twhile(e < x){\n\t\t\tif(e + 5 <= x){\n\t\t\t\te += 5;\n\t\t\t\ti++;\n\t\t\t} else if(e + 4 <= x){\n\t\t\t\te += 4;\n\t\t\t\ti++;\n\t\t\t} else if(e + 3 <= x){\n\t\t\t\te += 3;\n\t\t\t\ti++;\n\t\t\t} else if(e + 2 <= x){\n\t\t\t\te += 2;\n\t\t\t\ti++;\n\t\t\t} else if(e + 1 <= x){\n\t\t\t\te += 1;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tConsole.WriteLine(\"Number of steps taken to reach \" + x + \": \" + i);\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\n\nnamespace CF_Elephant\n{\n class Program\n {\n static void Main(string[] args)\n {\n var x = int.Parse(Console.ReadLine());\n var e = 0;\n var count = 0;\n\n while (e + 5 < x)\n {\n e += 5;\n count++;\n }\n\n while (e + 4 < x)\n {\n e += 4;\n count++;\n }\n\n while (e + 3 < x)\n {\n e += 3;\n count++;\n }\n\n while (e + 2 < x)\n {\n e += 2;\n count++;\n }\n\n while (e + 1 < x)\n {\n e += 1;\n count++;\n }\n\n Console.WriteLine(count);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.ComponentModel;\n\nnamespace ConsoleApp1\n{\t\n\t class Program\n\t{ \n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint input = 0;\n\t\t\tinput = Convert.ToInt32(Console.ReadLine());\n\t\t\tif (input%5 == 0)\n {\n\t\t\t\tConsole.WriteLine(input);\n }\n else\n {\n\t\t\t\tConsole.WriteLine(input % 5 + 1);\n }\n\n\t\t}\n\n\t\t\n\t\t\n\n\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.ComponentModel;\n\nnamespace ConsoleApp1\n{\t\n\t class Program\n\t{ \n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tint input = 0;\n\t\t\tinput = Convert.ToInt32(Console.ReadLine());\n\t\t\tif (input%5 == 0)\n {\n\t\t\t\tConsole.WriteLine(input % 5);\n }\n else\n {\n\t\t\t\tConsole.WriteLine(input % 5 + 1);\n }\n\n\t\t}\n\n\t\t\n\t\t\n\n\n\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace A.\u0421\u043b\u043e\u043d\u0438\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int distance = int.Parse(Console.ReadLine());\n int res = 0;\n\n while (distance != 0)\n {\n if (distance % 5 == 0)\n {\n distance -= 5;\n res++;\n }\n else\n {\n if (distance % 4 == 0)\n {\n distance -= 4;\n res++;\n }\n else\n {\n if (distance % 3 == 0)\n {\n distance -= 3;\n res++;\n }\n else\n {\n if (distance % 2 == 0)\n {\n distance -= 2;\n res++;\n }\n else\n {\n distance -= 1;\n res++;\n }\n }\n }\n }\n }\n\n Console.WriteLine(res); \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nclass Program\n{\n static void Main()\n {\n List input = ReadInputParseToList();\n int i = 5;\n int output = 0;\n while (i != 0)\n {\n \n if (input[0] % i == 0)\n {\n output++;\n break;\n }\n else\n {\n i--;\n }\n\n }\n Console.WriteLine(output);\n \n }\n private static List ReadInputParseToList()\n {\n return Console.ReadLine().Split().Select(int.Parse).ToList();\n }\n}\n\n\n\n\n"}, {"source_code": "using System;\nusing System.IO;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace CSharp_Shell\n{\n\n public static class Program \n {\n public static void Main() \n {\n int x = int.Parse(Console.ReadLine());\n int n = 5;\n int s = 0;\n while(x > 0){\n \ts++;\n \tx-=n;\n \tn--;\n \tif(n < 0){\n \t\tn = 5;\n \t}\n }\n Console.WriteLine(s);\n }\n }\n}"}, {"source_code": "using System;\nclass HelloWorld {\n static void Main() {\n int x = Convert.ToInt32(Console.ReadLine());\n int sum;\n if(x > 5) {\n sum = x / 5;\n x -= sum * 5;\n Console.WriteLine(sum + 1);\n }\n else if(x <= 5) {\n Console.WriteLine(1);\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int w;\n int count = 0;\n int res;\n\n\n w = Convert.ToInt32(Console.ReadLine());\n res = w % 5;\n\n if (res == 0)\n {\n count++;\n }\n else\n {\n count++;\n while ((res != 0) && (w>5))\n {\n count++;\n w -= 5;\n\n }\n }\n Console.WriteLine(count);\n Console.Read();\n \n\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x;\n x = (int)Console.Read();\n Console.WriteLine((x + 4) % 5);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace kompet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int a = (x / 5) + 1;\n Console.WriteLine(\"{0}\", a);\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace kompet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n if (x > 5 && x < 1000000)\n {\n int a = (x / 5) + 1;\n Console.WriteLine(\"{0}\", a);\n }\n else if (x < 6)\n {\n Console.WriteLine(\"1\");\n }\n else\n {\n int b = (x / 5);\n Console.WriteLine(\"{0}\", b);\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace kompet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n int a;\n if (x > 5 && x < 1000001)\n {\n if (x % 5 == 1)\n {\n a = (x / 5) + 1;\n }\n else\n {\n a = (x / 5);\n }\n Console.WriteLine(\"{0}\", a);\n }\n else if (x < 6)\n {\n Console.WriteLine(\"1\");\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace kompet\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt32(Console.ReadLine());\n if (x > 5)\n {\n int a = (x / 5) + 1;\n Console.WriteLine(\"{0}\", a);\n }\n else\n Console.WriteLine(\"1\");\n }\n }\n}"}, {"source_code": "using System;\n\nnamespace CF_Elephant {\n class Program {\n static void Main(string[] args) {\n int steps = Int32.Parse(Console.ReadLine());\n if (steps < 6) {\n Console.WriteLine(1);\n return;\n }\n Console.WriteLine((steps / 5) +1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Elephant {\n class Program {\n static void Main(string[] args) {\n Console.WriteLine((Int32.Parse(Console.ReadLine()) % 5) + +1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace CF_Elephant {\n class Program {\n static void Main(string[] args) {\n Console.WriteLine((Int32.Parse(Console.ReadLine()) / 5) +1);\n }\n }\n}\n"}, {"source_code": "using System;\n\nnamespace _617A\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n Console.WriteLine((n + 5) / 5);\n Console.Read();\n }\n }\n}\n"}], "src_uid": "4b3d65b1b593829e92c852be213922b6"} {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\n\nnamespace _140A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Input data = new Input(Console.ReadLine());\n\n string result = Processing.Process(data);\n\n Console.WriteLine(result);\n //Console.ReadKey();\n }\n }\n\n public static class Processing\n {\n public static string Process(Input data)\n {\n string result = \"YES\";\n\n if (data.n == 6 && data.R == 9 && data.r == 3)\n {\n return result;\n }\n\n bool yes;\n\n if (data.n == 1)\n {\n yes = data.r <= data.R;\n }\n else if (data.n == 2)\n {\n yes = 2 * data.r <= data.R;\n }\n else\n {\n yes = Math.Sin(Math.PI / data.n) * (data.R - data.r) >= data.r;\n }\n if (!yes)\n {\n result = \"NO\";\n }\n return result;\n }\n }\n\n public class Input\n {\n public int n { get; private set; }\n public int R { get; private set; }\n public int r { get; private set; }\n\n public Input(string input)\n {\n var array = input.Split(' ');\n n = Int32.Parse(array[0]);\n R = Int32.Parse(array[1]);\n r = Int32.Parse(array[2]);\n }\n }\n}\n", "positive_code": [{"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = (R - r)* Math.Sin(ang) * 1.000000001;\n Console.Write((d >= r) || (n <= 2 && r*n <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int n = int.Parse ( aline[0] );\n int R = int.Parse ( aline[1] );\n int r = int.Parse ( aline[2] );\n int m = new Programku ( ).countmaxplate ( r, R );\n //Console.WriteLine ( m );\n if ( m >= n )\n Console.WriteLine ( \"YES\" );\n else\n Console.WriteLine ( \"NO\" );\n }\n\n public int countmaxplate ( int r, int R )\n {\n if ( r > R )\n return 0;\n if ( r == R )\n return 1;\n int circ;\n if ( ( 2 * r ) > R )\n {\n circ = 1;\n }\n else\n {\n double angle = 2 * Math.Asin ( ( double ) r / ( R - r ) );\n double circd = 2 * Math.PI / angle;\n circ = ( int ) ( circd + 1e-9 );\n }\n return circ;\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), R = NextInt(), r = NextInt();\n\t\t\tif ( r > R )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( r > R - r )\n\t\t\t{\n\t\t\t\tif ( n == 1 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( r == R - r )\n\t\t\t{\n\t\t\t\tif ( n <= 2 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdouble a = Math.Asin( r / ( R - r + 0.0 ) ) * n;\n\n\t\t\tif ( a < Math.PI + 1e-8 )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 64 * 1024 * 1024 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n public Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), R = NextInt(), r = NextInt();\n\t\t\tif ( r > R )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( r > R - r )\n\t\t\t{\n\t\t\t\tif ( n == 1 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( r == R - r )\n\t\t\t{\n\t\t\t\tif ( n <= 2 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdouble a = Math.Asin( r / ( R - r + 0.0 ) );\n\n\t\t\tif ( a < Math.PI / n + 1e-9 )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 64 * 1024 * 1024 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n public Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n // int n = 10;\n // int R = 1000;\n // int r = 250;\n\n double lr = (R - r) * Math.PI;\n\n if (n == 1)\n {\n if(R>=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n\n if (R - r2*r)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(str => int.Parse(str)).ToArray();\n\n int n = arr[0];\n double R = arr[1];\n double r = arr[2];\n\n //double midle = 2.0 * Math.PI * (R - r);\n //int maxCount = (int)(midle / (2.0 * r));\n\n double alfa = Math.Asin(r / (R - r));\n int maxCount = int.MaxValue;\n\n if (Double.IsNaN(alfa))\n {\n maxCount = 0;\n }\n else if (alfa != 0)\n {\n //maxCount = (int)Math.Round((Math.PI / alfa), MidpointRounding.AwayFromZero);\n maxCount = (int)((Math.PI / alfa) + 1e-6);\n }\n\n bool onePlate = (n == 1 && r <= R);\n\n if (n <= maxCount || onePlate)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_Table\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int R = Next();\n int r = Next();\n\n if (n == 1)\n {\n writer.WriteLine(r <= R ? \"YES\" : \"NO\");\n }\n else\n {\n double sin = Math.Sin(Math.PI/n);\n writer.WriteLine(r * (1 + sin) <= R * sin+0.000000001 ? \"YES\" : \"NO\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_Table\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int R = Next();\n int r = Next();\n\n if (n == 1)\n {\n writer.WriteLine(r <= R ? \"YES\" : \"NO\");\n }\n else if (n == 2)\n {\n writer.WriteLine(2*r <= R ? \"YES\" : \"NO\");\n }\n else\n {\n double sin = Math.Sin(Math.PI/n);\n writer.WriteLine(r * (1 + sin) <= R * sin+0.000000001 ? \"YES\" : \"NO\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro-2*ri<0){\n if(n==1){\n Console.WriteLine(\"YES\");\n return 0;\n }\n Console.WriteLine(\"NO\");\n return 0;\n }\n double a = (Math.Asin(ri/(ro-ri))*n)-Math.PI;\n a = Math.Round(a*10000000)/10000000;\n if(a>0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n int h, w;\n string[] s;\n int[,] num;\n int[,] usedcount;\n int count;\n int prenum = 0;\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n, R, r;\n n = cin.nextInt();\n R = cin.nextInt();\n r = cin.nextInt();\n if (R < r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else if (R < 2 * r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (R == 2 * r)\n {\n if (n <= 2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n double length = r * (R / 2.0) / (R / 2.0 - r / 2.0);\n double len2 = Math.Sqrt(2 * (R / 2.0) * (R / 2.0) - 2 * (R / 2.0) * (R / 2.0) * Math.Cos(Math.PI * 2 / n));\n //Console.WriteLine(length + \" \" + len2);\n if (length <= len2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _04_01_12_1_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a=Console.ReadLine();\n string[] am=Regex.Split(a, @\"\\s+\");\n \n int n, R, r;\n double ang=0;\n \n n = int.Parse(am[0]);\n R = int.Parse(am[1]);\n r = int.Parse(am[2]);\n \n if (R < r)\n ang = 10;\n if (R >= r && R < r * 2)\n ang = Math.PI;\n if (R==2*r)\n ang = Math.PI / 2;\n if (R>2*r)\n {\n int g = R - r;\n int k = r;\n ang = Math.Asin((double)k / (double)g);\n }\n if (ang * n <= Math.PI+0.0000000001)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF100\n{\n class Program\n {\n static void Main(string[] args)\n {\n String[] tokens = Console.ReadLine().Split(' ');\n int n = int.Parse(tokens[0]);\n int R = int.Parse(tokens[1]);\n int r = int.Parse(tokens[2]);\n\n if (CanFitAroundTable(n, R, r))\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n }\n\n private static bool CanFitAroundTable(int numPlates, int tableRadius, int plateRadius)\n {\n if (numPlates == 0)\n return true;\n if (numPlates == 1)\n return tableRadius >= plateRadius;\n return tableRadius >= plateRadius * (1.0 + 1.0 / Math.Sin(Math.PI / numPlates));\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n double need = Math.PI / n;\n double needsin = n > 1 ? Math.Sin(need) : 2;\n double mysin = ((double)r) / (R - r);\n\n if (mysin <= (needsin + 0.0000000000000001))\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var rR = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if (r == rR && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if (r >= rR)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if (2 * r > rR)\n {\n if (n == 1)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n if (2 * r == rR)\n {\n if (n <= 2)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n\n var a = 2 * Math.Asin((double)r / (rR - r));\n if (a * n <= 2 * Math.PI + 1e-9)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: zhe\n * Date: 2012/1/4\n * Time: 23:03\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\nusing System.IO;\n\n\nnamespace A_20120104\n{\n class Program\n {\n static public double sqr(double x) {\n return x * x;\n }\n \n public static void Main(string[] args)\n {\n int n, bigR, smallR;\n string cmd = Console.ReadLine();\n string[] str = cmd.Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(str[0]);\n bigR = int.Parse(str[1]);\n smallR = int.Parse(str[2]);\n\n bool res = true;\n if (smallR > bigR) {\n res = false;\n if (n <= 0) res = true;\n } else {\n if (smallR == bigR) {\n if (n <= 1) res = true; else res = false;\n } else {\n \n int totn = 0;\n if (smallR * 2 > bigR) totn = 1; else {\n if (Math.Abs(smallR * 1.0 / (bigR - smallR)) <= 1) {\n \n \n double n0 = Math.PI / Math.Asin(smallR * 1.0 / (bigR - smallR));\n \n if (n0 >= 0) totn += (int) Math.Floor(n0 + 1e-8);\n \n }\n }\n if (totn >= n) res = true; else res = false;\n }\n\n }\n if (res) Console.WriteLine(\"YES\"); else Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "using System;\n\nclass Program\n{\n static void Main()\n {\n int n, R, r;\n string[] valuesStr = Console.ReadLine().Split();\n n = int.Parse(valuesStr[0]);\n R = int.Parse(valuesStr[1]);\n r = int.Parse(valuesStr[2]);\n\n string answer = \"NO\";\n if((n == 1) && (r <= R))\n answer = \"YES\";\n else if((n == 2) && (r + r <= R))\n answer = \"YES\";\n else\n {\n double rr = r / Math.Cos(Math.PI / 2.0 - Math.PI / n);\n if(rr + r <= R)\n answer = \"YES\";\n }\n Console.Write(answer);\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n if (n == 1)\n {\n if( r>R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n if (n == 2)\n {\n if (r*2 > R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n\n var rad = Math.PI/n;\n if( r > (double)(R-r)*Math.Sin(rad)+0.0000001 )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n6 9 3\n\"\n,\n\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}], "negative_code": [{"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = (R - r)* Math.Sin(ang) * 1.00001;\n Console.Write((d >= r) || (n <= 2 && r*n <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = (R - r) / Math.Cos(ang) * Math.Sin(ang);\n Console.Write((d >= r) || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = r / Math.Cos(ang) * Math.Sin(ang);\n Console.Write((d >= r) || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var res = (R - r) * 2 * Math.PI / 2 / r;\n Console.Write((res >= n && r*2 >= R) || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = (R - r)* Math.Sin(ang) * 0.99999;\n Console.Write((d >= r) || (n <= 2 && r*n <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var res = (R - r) * 2 * Math.PI / 2 / r;\n Console.Write(res >= n || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var res = (R - r) * 2 * Math.PI / 2 / r;\n Console.Write(res >= n ? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var ang = 360.0 / n / 2/ 180* Math.PI;\n var d = (R - r)* Math.Sin(ang);\n Console.Write((d >= r) || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System; using System.Linq;\n\nclass P {\n static void Main(){ \n var s =Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var n = s[0]; var R = s[1]; var r= s[2];\n var d = Math.Sqrt(R*R - r*r);\n Console.Write((d >= r) || (n == 1 && r <= R)? \"YES\": \"NO\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n // int n = 10;\n // int R = 1000;\n // int r = 250;\n\n double lr = (R - r) * Math.PI;\n\n if (n == 1)\n {\n if(R>=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n\n if (R - r= 2*r)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n // int n = 10;\n // int R = 1000;\n // int r = 250;\n\n double lr = (R - r) * Math.PI;\n\n if (n == 1)\n {\n if(R>=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n\n if (R - r2*r)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n double lr = (R - r) * Math.PI;\n\n if (r * n <= lr)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n double lr = (R - r) * Math.PI;\n\n if(lr==0){\n if(n==1){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n if (r * n <= lr)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n // int n = 10;\n // int R = 1000;\n // int r = 250;\n\n double lr = (R - r) * Math.PI;\n\n if (n == 1)\n {\n if(R>=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n\n if (R - r2*r)\n {\n Console.WriteLine(\"YES\");\n }\n else {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Tar\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n\n int n = int.Parse(str[0]);\n int R = int.Parse(str[1]);\n int r = int.Parse(str[2]);\n\n double lr = (R - r) * Math.PI;\n\n if (n == 1)\n {\n if(R>=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n if (R - r=r){\n Console.WriteLine(\"YES\");\n return;\n }\n }\n\n\n\n if (R - r '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_Table\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int R = Next();\n int r = Next();\n\n if (n == 1)\n {\n writer.WriteLine(r <= R ? \"YES\" : \"NO\");\n }\n else if (n == 2)\n {\n writer.WriteLine(2*r <= R ? \"YES\" : \"NO\");\n }\n else\n {\n double sin = Math.Sin(Math.PI/n);\n writer.WriteLine(r * (1 + sin) <= R * sin ? \"YES\" : \"NO\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace New_Year_Table\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int R = Next();\n int r = Next();\n\n if (n == 1)\n {\n writer.WriteLine(r <= R ? \"YES\" : \"NO\");\n }\n else if (n == 2)\n {\n writer.WriteLine(2*r <= R ? \"YES\" : \"NO\");\n }\n else\n {\n double sin = Math.Sin(Math.PI/n);\n double maxr = Math.Round(R*sin/(1 + sin),2);\n writer.WriteLine(r <= maxr ? \"YES\" : \"NO\");\n }\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading;\n\nnamespace _140A\n{\n class Program\n {\n static void Main(string[] args)\n {\n Input data = new Input(Console.ReadLine());\n\n string result = Processing.Process(data);\n\n Console.WriteLine(result);\n //Console.ReadKey();\n }\n }\n\n public static class Processing\n {\n public static string Process(Input data)\n {\n string result = \"YES\";\n\n bool yes;\n\n if (data.n == 1)\n {\n yes = data.r <= data.R;\n }\n else if (data.n == 2)\n {\n yes = 2 * data.r <= data.R;\n }\n else\n {\n yes = Math.Sin(Math.PI / data.n) * (data.R - data.r) > data.r;\n }\n if (!yes)\n {\n result = \"NO\";\n }\n return result;\n }\n }\n\n public class Input\n {\n public int n { get; private set; }\n public int R { get; private set; }\n public int r { get; private set; }\n\n public Input(string input)\n {\n var array = input.Split(' ');\n n = Int32.Parse(array[0]);\n R = Int32.Parse(array[1]);\n r = Int32.Parse(array[2]);\n }\n }\n}\n"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro-2*ri<0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n double a = 2*Math.Asin(ri/(ro-ri))*n;\n if(a>2*Math.PI){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n double sum = 0;\n while(true){\n double cr = ro-ri;\n if(cr < 0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro>=2*ri){\n sum += (2*Math.PI)/(2*(Math.Asin(ri/cr)));\n }else if(ro>=ri){\n sum++;\n }\n if(sum>=n){\n Console.WriteLine(\"YES\");\n return 0;\n }\n ro -= 2*ri;\n }\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n double a = 2*Math.Asin(ri/(ro-ri))*n;\n if(a>2*Math.PI){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro-2*ri<0){\n if(n==1){\n Console.WriteLine(\"YES\");\n return 0;\n }\n Console.WriteLine(\"NO\");\n return 0;\n }\n double a = 2*Math.Asin(ri/(ro-ri))*n;\n if(a>2*Math.PI){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro-2*ri<0){\n if(n==1){\n Console.WriteLine(\"YES\");\n return 0;\n }\n Console.WriteLine(\"NO\");\n return 0;\n }\n double a = Math.Floor((2*Math.Asin(ri/(ro-ri))*n)-(2*Math.PI));\n if(a>0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n float n = Single.Parse(str[0]);\n float ro = Single.Parse(str[1]);\n float ri = Single.Parse(str[2]);\n if(ri>ro){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro-2*ri<0){\n if(n==1){\n Console.WriteLine(\"YES\");\n return 0;\n }\n Console.WriteLine(\"NO\");\n return 0;\n }\n float a = ((float)(Math.Asin(ri/(ro-ri))*n))-(float)(Math.PI);\n if(a>0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n Console.WriteLine(\"YES\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n int sum = 0;\n double cr = ro-ri;\n if(cr < 0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro >= 2*ri){\n sum += (int)( Math.Floor( Math.PI / Math.Asin(ri/cr) ) );\n }else if(ro >= ri){\n sum++;\n }\n if(sum >= n){\n Console.WriteLine(\"YES\");\n return 0;\n }\n Console.WriteLine(\"NO\");\n return 0;\n }\n}"}, {"source_code": "using System;\nclass Test {\n static int Main() {\n string [] str = Console.ReadLine().Split();\n double n = Double.Parse(str[0]);\n double ro = Double.Parse(str[1]);\n double ri = Double.Parse(str[2]);\n double sum = 0;\n while(true){\n double cr = ro-ri;\n if(cr < 0){\n Console.WriteLine(\"NO\");\n return 0;\n }\n if(ro>2*ri){\n sum += (2*Math.PI)/(2*(Math.Asin(ri/cr)));\n }else if(ro>=ri){\n sum++;\n }\n if(sum>=n){\n Console.WriteLine(\"YES\");\n return 0;\n }\n ro -= 2*ri;\n }\n return 0;\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _04_01_12_1_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a=Console.ReadLine();\n string[] am=Regex.Split(a, \" \");\n \n int n, R, r;\n double ang=0;\n \n n = Int32.Parse(am[0]);\n R = Int32.Parse(am[1]);\n r = Int32.Parse(am[2]);\n \n if (R < r)\n ang = 10;\n if (R >= r && R < r * 2)\n ang = Math.PI;\n if (R==2*r)\n ang = Math.PI/2;\n if (R>2*r)\n {\n int g = R - r;\n int k = r;\n ang = Math.Asin((double)k / (double)g);\n }\n if (ang * n <= Math.PI)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace _04_01_12_1_\n{\n class Program\n {\n static void Main(string[] args)\n {\n string a=Console.ReadLine();\n string[] am=Regex.Split(a, \" \");\n \n int n, R, r;\n double ang=0;\n \n n = Int32.Parse(am[0]);\n R = Int32.Parse(am[1]);\n r = Int32.Parse(am[2]);\n \n if (R < r)\n ang = 10;\n if (R >= r && R < r * 2)\n ang = Math.PI;\n if (R==2*r)\n ang = Math.PI/2;\n if (R>2*r)\n {\n int g = R - r;\n int k = r;\n ang=Math.Asin(k/g);\n }\n if (ang * n <= Math.PI)\n Console.WriteLine(\"YES\");\n else\n Console.WriteLine(\"NO\");\n //Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var R = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if(r==R && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n var a = Math.Acos(1 - (2.0*r*r)/((R - r)*(R - r)));\n if(a * n <= 2 * Math.PI)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var rR = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if(r==rR && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(r >= rR)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if(2 * r > rR)\n {\n if(n == 1)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n if(2 * r == rR)\n {\n if(n <= 2)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n\n var a = 2 * Math.Asin((double) r/(rR - r));\n if(a * n <= 2 * Math.PI)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var R = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if(r==R && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(r >= R)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n var a = Math.Acos(1 - (2.0*r*r)/((R - r)*(R - r)));\n if(a * n <= 2 * Math.PI)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var rR = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if(r==rR && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(r >= rR)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n if(2 * r > rR)\n {\n if(n == 1)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n return;\n }\n var a = 2 * Math.Asin((double) r/(rR - r));\n if(a * n <= 2 * Math.PI)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var R = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n var len = 2*Math.PI*(R - r);\n if(len >= 2 * r * n || (r == R && n == 1))\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\n\nnamespace Codeforces\n{\n internal class Program\n {\n private static string Read()\n {\n return Console.ReadLine();\n }\n private static string[] ReadArray()\n {\n return Console.ReadLine().Split(' ');\n }\n private static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n private static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n private static int ReadNextInt(string[] input, int index)\n {\n return Int32.Parse(input[index]);\n }\n\n private static void Main()\n {\n var input = ReadArray();\n var n = ReadNextInt(input, 0);\n var rR = ReadNextInt(input, 1);\n var r = ReadNextInt(input, 2);\n if(r==rR && n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n if(r >= rR)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n var a = 2 * Math.Asin((double) r/(rR - r));\n if(a * n <= 2 * Math.PI)\n Console.WriteLine(\"YES\");\n else\n {\n Console.WriteLine(\"NO\");\n }\n\n }\n }\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: zhe\n * Date: 2012/1/4\n * Time: 23:03\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\nusing System.IO;\n\n\nnamespace A_20120104\n{\n class Program\n {\n static public double sqr(double x) {\n return x * x;\n }\n \n public static void Main(string[] args)\n {\n int n, bigR, smallR;\n string cmd = Console.ReadLine();\n string[] str = cmd.Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(str[0]);\n bigR = int.Parse(str[1]);\n smallR = int.Parse(str[2]);\n\n bool res = true;\n if (smallR > bigR) {\n res = false;\n if (n <= 0) res = true;\n } else {\n if (smallR == bigR) {\n if (n <= 1) res = true; else res = false;\n } else {\n int totn = 0;\n if (Math.Abs(smallR * 1.0 / (bigR - smallR)) <= 1) {\n double n0 = Math.PI / Math.Asin(smallR * 1.0 / (bigR - smallR));\n if (n0 >= 0) totn += (int) Math.Floor(n0);\n }\n if (totn >= n) res = true; else res = false;\n }\n\n }\n if (res) Console.WriteLine(\"YES\"); else Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "/*\n * Created by SharpDevelop.\n * User: zhe\n * Date: 2012/1/4\n * Time: 23:03\n * \n * To change this template use Tools | Options | Coding | Edit Standard Headers.\n */\nusing System;\nusing System.IO;\n\n\nnamespace A_20120104\n{\n class Program\n {\n static public double sqr(double x) {\n return x * x;\n }\n \n public static void Main(string[] args)\n {\n int n, bigR, smallR;\n string cmd = Console.ReadLine();\n string[] str = cmd.Split(\" \\t\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(str[0]);\n bigR = int.Parse(str[1]);\n smallR = int.Parse(str[2]);\n\n bool res = true;\n if (smallR > bigR) {\n res = false;\n if (n <= 0) res = true;\n } else {\n if (smallR == bigR) {\n if (n <= 1) res = true; else res = false;\n } else {\n \n int totn = 0;\n if (smallR * 2 > bigR) totn = 1; else {\n if (Math.Abs(smallR * 1.0 / (bigR - smallR)) <= 1) {\n \n \n double n0 = Math.PI / Math.Asin(smallR * 1.0 / (bigR - smallR));\n \n if (n0 >= 0) totn += (int) Math.Floor(n0);\n \n }\n }\n if (totn >= n) res = true; else res = false;\n }\n\n }\n if (res) Console.WriteLine(\"YES\"); else Console.WriteLine(\"NO\");\n Console.ReadLine();\n }\n \n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n if (n == 1)\n {\n if( r>R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n if (n == 2)\n {\n if (r*2 > R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n\n var rad = Math.PI*n;\n if( r > (double)(R-r)*Math.Cos(rad) )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n3 10 5\n\"\n,\n\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n if (n == 1)\n {\n if( r>R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n if (n == 2)\n {\n if (r*2 > R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n\n var rad = Math.PI/n;\n if( r > (double)(R-r)*Math.Sin(rad) )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n10 1000 237\n\"\n,\n\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n\n\n if (r > R - r)\n {\n CF.WriteLine(\"NO\");\n return;\n }\n var rad = Math.Asin((double)r / (R - r));\n \n if( rad*2*n > Math.PI*2 )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n1 10 11\n\"\n,\n\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n var rad = Math.Asin((double)r / (R - r));\n \n if( rad*2*n > Math.PI*2 )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nclass Solver\n{\n public void Solve()\n {\n var ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n\n if (n == 1)\n {\n if( r>R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n if (n == 2)\n {\n if (r*2 > R)\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n return;\n }\n\n if (r > R - r)\n {\n CF.WriteLine(\"NO\");\n return;\n }\n var rad = Math.Asin((double)r / (R - r));\n \n if( rad*2*n > Math.PI*2 )\n CF.WriteLine(\"NO\");\n else\n CF.WriteLine(\"YES\");\n }\n\n\n\n\n // test\n static Utils CF = new Utils(new[]{\n@\"\n3 10 5\n\"\n,\n\n@\"\n4 10 4\n\"\n,\n\n@\"\n5 10 4\n\"\n,\n@\"\n1 10 10\n\"\n\n\n });\n #region test\n\n static void Main(string[] args)\n {\n#if DEBUG\n for (int t=0;t();\n string[] ss = _test_input[t].Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n public int TestCount\n {\n get\n {\n return _test_input.Length;\n }\n }\n\n public string ReadLine()\n {\n#if DEBUG\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n //return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n //_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n //_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n string[] _test_input;\n\n List _lines;\n\n#if DEBUG\n public Utils(string[] test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public Utils(string[] dummy)\n {\n //_sr = new System.IO.StreamReader(\"input.txt\");\n //_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n }\n\n #endregion\n}\n\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int n = int.Parse ( aline[0] );\n int R = int.Parse ( aline[1] );\n int r = int.Parse ( aline[2] );\n int m = new Programku ( ).countmaxplate ( r, R );\n //Console.WriteLine ( m );\n if ( m >= n )\n Console.WriteLine ( \"YES\" );\n else\n Console.WriteLine ( \"NO\" );\n }\n\n public int countmaxplate ( int r, int R )\n {\n if ( r > R )\n return 0;\n if ( r == R )\n return 1;\n int RR = R;\n int circ = 0;\n while ( RR >= r )\n {\n if ( ( 2 * r ) > RR )\n {\n circ += 1;\n }\n else\n {\n double angle = 2 * Math.Asin ( ( double ) r / ( RR - r ) );\n int addcirc = ( int ) ( 2 * Math.PI / angle );\n circ += addcirc;\n }\n RR = RR - ( 2 * r );\n }\n return circ;\n }\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\npublic class Programku\n{\n public static void Main ( )\n {\n string line = Console.ReadLine ( );\n string[] aline = line.Split ( new char[] { ' ' } );\n int n = int.Parse ( aline[0] );\n int R = int.Parse ( aline[1] );\n int r = int.Parse ( aline[2] );\n int m = new Programku ( ).countmaxplate ( r, R );\n //Console.WriteLine ( m );\n if ( m >= n )\n Console.WriteLine ( \"YES\" );\n else\n Console.WriteLine ( \"NO\" );\n }\n\n public int countmaxplate ( int r, int R )\n {\n if ( r > R )\n return 0;\n if ( r == R )\n return 1;\n int circ;\n if ( ( 2 * r ) > R )\n {\n circ = 1;\n }\n else\n {\n double angle = 2 * Math.Asin ( ( double ) r / ( R - r ) );\n circ = ( int ) ( 2 * Math.PI / angle );\n }\n return circ;\n }\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace CodeForces\n{\n\tinternal class A\n\t{\n\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n = NextInt(), R = NextInt(), r = NextInt();\n\t\t\tif ( r > R )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( r > R - r )\n\t\t\t{\n\t\t\t\tif ( n == 1 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( r == R - r )\n\t\t\t{\n\t\t\t\tif ( n <= 2 )\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdouble a = Math.Asin( r / ( R - r + 0.0 ) );\n\n\t\t\tif ( a < Math.PI / n + 1e-8 )\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"YES\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tOut.WriteLine( \"NO\" );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\n\n\n\n\n\t\t#region Local wireup\n\n\t\tpublic int NextInt()\n\t\t{\n\t\t\treturn _in.NextInt();\n\t\t}\n\n\t\tpublic long NextLong()\n\t\t{\n\t\t\treturn _in.NextLong();\n\t\t}\n\n\t\tpublic string NextLine()\n\t\t{\n\t\t\treturn _in.NextLine();\n\t\t}\n\n\t\tpublic double NextDouble()\n\t\t{\n\t\t\treturn _in.NextDouble();\n\t\t}\n\n\t\treadonly Scanner _in = new Scanner();\n\t\tstatic readonly TextWriter Out = Console.Out;\n\n\t\tvoid Start()\n\t\t{\n#if !ONLINE_JUDGE\n\t\t\tvar timer = new Stopwatch();\n\t\t\ttimer.Start();\n#endif\n\t\t\tvar t = new Thread( Solve, 64 * 1024 * 1024 );\n\t\t\tt.Start();\n\t\t\tt.Join();\n#if !ONLINE_JUDGE\n\t\t\ttimer.Stop();\n\t\t\tConsole.WriteLine( string.Format( CultureInfo.InvariantCulture, \"Done in {0} seconds.\\nPress to exit.\", timer.ElapsedMilliseconds / 1000.0 ) );\n\t\t\tConsole.ReadLine();\n#endif\n\t\t}\n\n\t\tstatic void Main()\n\t\t{\n\t\t\tnew A().Start();\n\t\t}\n\n\t\tclass Scanner : IDisposable\n\t\t{\n\t\t\t#region Fields\n\n\t\t\treadonly TextReader _reader;\n\t\t\treadonly int _bufferSize;\n\t\t\treadonly bool _closeReader;\n\t\t\treadonly char[] _buffer;\n\t\t\tint _length, _pos;\n\n\t\t\t#endregion\n\n\t\t\t#region .ctors\n\n\t\t\tpublic Scanner( TextReader reader, int bufferSize, bool closeReader )\n\t\t\t{\n\t\t\t\t_reader = reader;\n\t\t\t\t_bufferSize = bufferSize;\n\t\t\t\t_closeReader = closeReader;\n\t\t\t\t_buffer = new char[_bufferSize];\n\t\t\t\tFillBuffer( false );\n\t\t\t}\n\n\t\t\tpublic Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }\n\n\t\t\tpublic Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }\n\n#if ONLINE_JUDGE\n public Scanner() : this( Console.In, false ) { }\n#else\n\t\t\tpublic Scanner() : this( \"input.txt\" ) { }\n#endif\n\n\t\t\t#endregion\n\n\t\t\t#region IDisposable Members\n\n\t\t\tpublic void Dispose()\n\t\t\t{\n\t\t\t\tif ( _closeReader )\n\t\t\t\t{\n\t\t\t\t\t_reader.Close();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Properties\n\n\t\t\tpublic bool Eof\n\t\t\t{\n\t\t\t\tget\n\t\t\t\t{\n\t\t\t\t\tif ( _pos < _length ) return false;\n\t\t\t\t\tFillBuffer( false );\n\t\t\t\t\treturn _pos >= _length;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t#endregion\n\n\t\t\t#region Methods\n\n\t\t\tprivate char NextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos++];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos++];\n\t\t\t}\n\n\t\t\tprivate char PeekNextChar()\n\t\t\t{\n\t\t\t\tif ( _pos < _length ) return _buffer[_pos];\n\t\t\t\tFillBuffer( true );\n\t\t\t\treturn _buffer[_pos];\n\t\t\t}\n\n\t\t\tprivate void FillBuffer( bool throwOnEof )\n\t\t\t{\n\t\t\t\t_length = _reader.Read( _buffer, 0, _bufferSize );\n\t\t\t\tif ( throwOnEof && Eof )\n\t\t\t\t{\n\t\t\t\t\tthrow new IOException( \"Can't read beyond the end of file\" );\n\t\t\t\t}\n\t\t\t\t_pos = 0;\n\t\t\t}\n\n\t\t\tpublic int NextInt()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tint res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic long NextLong()\n\t\t\t{\n\t\t\t\tvar neg = false;\n\t\t\t\tlong res = 0;\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tif ( !Eof && PeekNextChar() == '-' )\n\t\t\t\t{\n\t\t\t\t\tneg = true;\n\t\t\t\t\t_pos++;\n\t\t\t\t}\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tvar c = NextChar();\n\t\t\t\t\tif ( c < '0' || c > '9' ) throw new ArgumentException( \"Illegal character\" );\n\t\t\t\t\tres = 10 * res + c - '0';\n\t\t\t\t}\n\t\t\t\treturn neg ? -res : res;\n\t\t\t}\n\n\t\t\tpublic string NextLine()\n\t\t\t{\n\t\t\t\tSkipUntilNextLine();\n\t\t\t\tif ( Eof ) return \"\";\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn builder.ToString();\n\t\t\t}\n\n\t\t\tpublic double NextDouble()\n\t\t\t{\n\t\t\t\tSkipWhitespaces();\n\t\t\t\tvar builder = new StringBuilder();\n\t\t\t\twhile ( !Eof && !IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\tbuilder.Append( NextChar() );\n\t\t\t\t}\n\t\t\t\treturn double.Parse( builder.ToString(), CultureInfo.InvariantCulture );\n\t\t\t}\n\n\t\t\tprivate void SkipWhitespaces()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsWhitespace( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate void SkipUntilNextLine()\n\t\t\t{\n\t\t\t\twhile ( !Eof && IsEndOfLine( PeekNextChar() ) )\n\t\t\t\t{\n\t\t\t\t\t++_pos;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static bool IsWhitespace( char c )\n\t\t\t{\n\t\t\t\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\tprivate static bool IsEndOfLine( char c )\n\t\t\t{\n\t\t\t\treturn c == '\\n' || c == '\\r';\n\t\t\t}\n\n\t\t\t#endregion\n\t\t}\n\n\t\t#endregion\n\t}\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(str => int.Parse(str)).ToArray();\n\n int n = arr[0];\n double R = arr[1];\n double r = arr[2];\n\n //double midle = 2.0 * Math.PI * (R - r);\n //int maxCount = (int)(midle / (2.0 * r));\n\n double alfa = Math.Asin(r / (R - r));\n int maxCount = int.MaxValue;\n\n if (alfa != 0)\n {\n maxCount = (int)(Math.PI / alfa);\n }\n\n bool onePlate = (n == 1 && r <= R);\n\n if (n <= maxCount || onePlate)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\"); \n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(str => int.Parse(str)).ToArray();\n\n int n = arr[0];\n double R = arr[1];\n double r = arr[2];\n\n //double midle = 2.0 * Math.PI * (R - r);\n //int maxCount = (int)(midle / (2.0 * r));\n\n double alfa = Math.Asin(r / (R - r));\n int maxCount = int.MaxValue;\n\n if (Double.IsNaN(alfa))\n {\n maxCount = 0;\n }\n else if (alfa != 0)\n {\n maxCount = (int)(Math.PI / alfa);\n }\n\n bool onePlate = (n == 1 && r <= R);\n\n if (n <= maxCount || onePlate)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(str => int.Parse(str)).ToArray();\n\n int n = arr[0];\n int R = arr[1];\n int r = arr[2];\n\n double midle = 2.0 * Math.PI * (R - r);\n int maxCount = (int)(midle / (2.0 * r));\n\n bool onePlate = (n == 1 && r <= R);\n\n if (n <= maxCount || onePlate)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\"); \n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace A\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n int[] arr = s.Split(' ').Select(str => int.Parse(str)).ToArray();\n\n int n = arr[0];\n double R = arr[1];\n double r = arr[2];\n\n //double midle = 2.0 * Math.PI * (R - r);\n //int maxCount = (int)(midle / (2.0 * r));\n\n double alfa = Math.Asin(r / (R - r)) * 2.0;\n int maxCount = int.MaxValue;\n\n if (Double.IsNaN(alfa))\n {\n maxCount = 0;\n }\n else if (alfa != 0)\n {\n maxCount = (int)(Math.PI / alfa);\n }\n\n bool onePlate = (n == 1 && r <= R);\n\n if (n <= maxCount || onePlate)\n {\n Console.WriteLine(\"YES\");\n }\n else\n {\n Console.WriteLine(\"NO\");\n }\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n int h, w;\n string[] s;\n int[,] num;\n int[,] usedcount;\n int count;\n int prenum = 0;\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n, R, r;\n n = cin.nextInt();\n R = cin.nextInt();\n r = cin.nextInt();\n if (R < r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else if (R < 2 * r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (R == 2 * r)\n {\n if (n <= 2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n double length = r * (R / 2.0) / (R / 2.0 - r / 2.0);\n double len2 = Math.Sqrt(2 * (R / 2.0) * (R / 2.0) - 2 * (R / 2.0) * (R / 2.0) * Math.Cos(Math.PI * 2 / n));\n Console.WriteLine(length + \" \" + len2);\n if (length <= len2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n length = r * (R / 2.0) / (R / 2.0 - r / 2.0);\n len2 = Math.Sqrt(2 * (R / 2.0) * (R / 2.0) - 2 * (R / 2.0) * (R / 2.0) * Math.Cos((22.0 / 7.0) * 2 / n));\n Console.WriteLine(length + \" \" + len2);\n if (length <= len2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n int h, w;\n string[] s;\n int[,] num;\n int[,] usedcount;\n int count;\n int prenum = 0;\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n, R, r;\n n = cin.nextInt();\n R = cin.nextInt();\n r = cin.nextInt();\n if (R < r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (n == 1)\n {\n Console.WriteLine(\"YES\");\n return;\n }\n else if (R < 2 * r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (R == 2 * r)\n {\n if (n <= 2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n double length = r * (R / 2.0) / (R / 2.0 - r / 2.0);\n double len2 = Math.Sqrt(2 * (R / 2.0) * (R / 2.0) - 2 * (R / 2.0) * (R / 2.0) * Math.Cos(Math.PI * 2 / n));\n Console.WriteLine(length + \" \" + len2);\n if (length <= len2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n int h, w;\n string[] s;\n int[,] num;\n int[,] usedcount;\n int count;\n int prenum = 0;\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n, R, r;\n n = cin.nextInt();\n R = cin.nextInt();\n r = cin.nextInt();\n if (R < r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (R < 2 * r)\n {\n if (n == 1) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n else if (R == 2 * r)\n {\n if (n <= 2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n double length = r * (R / 2.0) / (R / 2.0 - r / 2.0);\n double len2 = Math.Sqrt(2 * (R / 2.0) * (R / 2.0) - 2 * (R / 2.0) * (R / 2.0) * Math.Cos(Math.PI * 2 / n));\n //Console.WriteLine(length + \" \" + len2);\n if (length <= len2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\n\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n}\n\nclass Myon\n{\n Scanner cin;\n Myon() { }\n\n public static void Main()\n {\n new Myon().calc();\n }\n\n int h, w;\n string[] s;\n int[,] num;\n int[,] usedcount;\n int count;\n int prenum = 0;\n\n void calc()\n {\n Scanner cin = new Scanner();\n int n, R, r;\n n = cin.nextInt();\n R = cin.nextInt();\n r = cin.nextInt();\n if (R < r)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n else if (R < 2 * r)\n {\n if (n == 1) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n else if (R == 2 * r)\n {\n if (n <= 2) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n return;\n }\n double length = 2.0 * r * R / (R - r);\n double cos = (2.0 * Math.Pow(length, 2) - Math.Pow(R, 2)) / (2.0 * Math.Pow(length, 2));\n double turn = Math.Acos(cos);\n double ok = Math.PI / turn;\n //Console.WriteLine(ok + \" \" + turn);\n if (ok >= n) Console.WriteLine(\"YES\");\n else Console.WriteLine(\"NO\");\n }\n\n\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n double need = Math.PI / n;\n double needsin = Math.Sin(need);\n double mysin = ((double)r) / (R - r);\n\n if (mysin <= needsin)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n double need = 2 * Math.PI / n;\n double sinforradii = ((double)r) / (R - r);\n double angleforradii = Math.Asin(sinforradii) * 2;\n if (angleforradii <= need)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n double need = Math.PI / n;\n double needsin = n > 1 ? Math.Sin(need) : 2;\n double mysin = ((double)r) / (R - r);\n\n if (mysin <= (needsin + 0.00001))\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n double need = Math.PI / n;\n double needsin = n > 1 ? Math.Sin(need) : 2;\n double mysin = ((double)r) / (R - r);\n\n if (mysin <= (needsin + 0.00000001))\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CF_100\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int R = int.Parse(ss[1]);\n int r = int.Parse(ss[2]);\n if (r > R)\n {\n Console.Write(\"NO\");\n return;\n }\n if (2 * r > R)\n {\n if (n == 1 || n == 0)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n if (2 * r == R)\n {\n if (n <= 2)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n \n double need = Math.PI / n;\n double needsin = n > 1 ? Math.Sin(need) : 2;\n double mysin = ((double)r) / (R - r);\n\n if (mysin <= needsin)\n Console.Write(\"YES\");\n else\n Console.Write(\"NO\");\n return;\n }\n }\n}\n"}], "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6"} {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tint n = Int32.Parse(line1);\n\t\t\tint[,] columns = new int[11 , 4];\n\t\t\tif (n >= 4)\n\t\t\t{\n\t\t\t\tn -= 4;\n\t\t\t\tfor (int i = 0; i < 4; i++)\n\t\t\t\t{\n\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t}\n\t\t\t\tint column = 1;\n\t\t\t\tint row = 0;\n\t\t\t\twhile (n > 0)\n\t\t\t\t{\n\t\t\t\t\tn -= 1;\n\t\t\t\t\tcolumns[column, row] = 1;\n\t\t\t\t\trow += 1;\n\t\t\t\t\tif (row == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\trow += 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (row == 4)\n\t\t\t\t\t{\n\t\t\t\t\t\trow = 0;\n\t\t\t\t\t\tcolumn += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n == 3)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 2)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 1)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 1; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 0] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|D|)\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 1] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 2] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (i == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"..\");\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"..|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 3] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|)\" + Environment.NewLine);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\n\t\t}\n\n\t}\n\n}", "positive_code": [{"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace BayanCont\n{\n class Program\n {\n const string sample = @\"+------------------------+\n|{1}.{5}.{8}.{11}.{14}.{17}.{20}.{23}.{26}.{29}.{32}.|D|)\n|{2}.{6}.{9}.{12}.{15}.{18}.{21}.{24}.{27}.{30}.{33}.|.|\n|{3}.......................|\n|{4}.{7}.{10}.{13}.{16}.{19}.{22}.{25}.{28}.{31}.{34}.|.|)\n+------------------------+\";\n static void Main(string[] args)\n {\n int passengers = int.Parse(Console.ReadLine());\n Console.WriteLine( getBusFigure(passengers));\n Console.ReadLine();\n }\n\n static string getBusFigure(int passengers)\n {\n string outDat = sample;\n for (int i = 1; i <= passengers; i++)\n {\n outDat = outDat.Replace(\"{\" + i.ToString() + \"}\", \"O\");\n }\n\n for (int i = 34; i > passengers; i--)\n {\n outDat = outDat.Replace(\"{\" + i.ToString() + \"}\", \"#\");\n }\n return outDat;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace work01\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tvar l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;\n\t\t\tvar l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;\n\t\t\tvar l3 = n > 2 ? 1 : 0;\n\t\t\tvar l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;\n\n\t\t\tFunc print = (k, m) => {\n\t\t\t\tvar sb = new StringBuilder();\n\t\t\t\tfor (var i = 1; i <= m; i++) {\n\t\t\t\t\tsb.AppendFormat(\"{0}.\", (i <= k) ? \"O\" : \"#\" );\n\t\t\t\t}\n\t\t\t\treturn sb.ToString();\n\t\t\t};\n\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|{0}|D|)\", print(l1, 11));\n\t\t\tConsole.WriteLine(\"|{0}|.|\", print(l2, 11));\n\t\t\tConsole.WriteLine(\"|{0}......................|\", print(l3, 1));\n\t\t\tConsole.WriteLine(\"|{0}|.|)\", print(l4, 11));\n\t\t\tConsole.WriteLine(\"+------------------------+\");\t\t\t\t\t\t \n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\n\nnamespace Test5\n{\n class MainClass\n {\n static int Besmar = 0;\n static void BesmarU()\n {\n Besmar++;\n if (Besmar == 3) {\n Besmar = 0;\n }\n }\n public static void Main (string[] args)\n {\n int n = int.Parse (Console.ReadLine ());\n string[] Radif = new string[3];\n Radif [0] = \"|O.\";\n Radif [1] = \"|O.\";\n string radif3 = \"|O.......................|\";\n Radif [2] = \"|O.\";\n if (n > 4) {\n n -= 4;\n for (int i = 0; Radif[2].Length != 23; i++) {\n if (n != 0) {\n Radif [Besmar] += \"O.\";\n BesmarU();\n n--;\n } else {\n Radif [Besmar] += \"#.\";\n BesmarU();\n }\n }\n Console.WriteLine (\"+------------------------+\");\n Console.WriteLine (Radif [0] + \"|D|)\");\n Console.WriteLine (Radif [1] + \"|.|\");\n Console.WriteLine (radif3);\n Console.WriteLine (Radif [2] + \"|.|)\");\n Console.WriteLine (\"+------------------------+\");\n } else {\n if (n == 0) {\n Console.WriteLine (\"+------------------------+\\n|#.#.#.#.#.#.#.#.#.#.#.|D|)\\n|#.#.#.#.#.#.#.#.#.#.#.|.|\\n|#.......................|\\n|#.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+\");\n }\n else if (n == 1) {\n Console.WriteLine (\"+------------------------+\\n|O.#.#.#.#.#.#.#.#.#.#.|D|)\\n|#.#.#.#.#.#.#.#.#.#.#.|.|\\n|#.......................|\\n|#.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+\");\n }\n else if (n == 2) {\n Console.WriteLine (\"+------------------------+\\n|O.#.#.#.#.#.#.#.#.#.#.|D|)\\n|O.#.#.#.#.#.#.#.#.#.#.|.|\\n|#.......................|\\n|#.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+\");\n }\n else if (n == 3) {\n Console.WriteLine (\"+------------------------+\\n|O.#.#.#.#.#.#.#.#.#.#.|D|)\\n|O.#.#.#.#.#.#.#.#.#.#.|.|\\n|O.......................|\\n|#.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+\");\n }\n else if (n == 4) {\n Console.WriteLine (\"+------------------------+\\n|O.#.#.#.#.#.#.#.#.#.#.|D|)\\n|O.#.#.#.#.#.#.#.#.#.#.|.|\\n|O.......................|\\n|O.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+\");\n }\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int t = k;\n string s1 = \"+------------------------+\";\n string s2 = \"|O.......................|\";\n string s3 = \"|#.......................|\";\n string[,] mat = new string[3,11];\n if(k>=3)\n k--;\n mat[0, 0] = \"|\";\n mat[1, 0] = \"|\";\n mat[2, 0] = \"|\";\n for (int i = 0; i < 11; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (k > 0)\n { mat[j, i] += \"O\"; k--; }\n else\n mat[j, i] += \"#\";\n }\n }\n Console.WriteLine(s1);\n for (int i = 0; i < 3; i++)\n {\n if (i == 2) \n Console.WriteLine((t>=3)?s2:s3); \n for (int j = 0; j < 11; j++)\n {\n Console.Write(mat[i, j] + \".\");\n }\n if (i == 0)\n Console.Write(\"|D|)\");\n else\n if (i == 2)\n Console.Write(\"|.|)\");\n else\n Console.Write(\"|.|\");\n Console.WriteLine();\n }\n Console.WriteLine(s1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces_475a\n{\n class Program\n {\n static void Main(string[] args)\n {\n //for (int j = 0; j <= 34; j++)\n //{\n int k = Convert.ToInt32(Console.ReadLine());\n //Console.WriteLine(k.ToString());\n if (k > 34)\n k = 34;\n Console.WriteLine(\"+------------------------+\");\n string s1 = \"|\", s2 = \"|\", s3 = \"|\", s4 = \"|\";\n if (k == 0)\n {\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (k <= 4)\n {\n switch (k)\n {\n case 1:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"#.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"#.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 2:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"#.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 3:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"O.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 4:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"O.......................|\";\n s4 += \"O.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n }\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n else\n {\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n k -= 4;\n int n = k / 3;\n if (n != 0)\n {\n s1 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s2 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s4 += string.Concat(Enumerable.Repeat(\"O.\", n));\n k = k % 3;\n }\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n s2 += \"#.\";\n s4 += \"#.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"#.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"O.\";\n break;\n }\n s1 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s1.Length - 1) / 2)))) + \"|D|)\";\n s2 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s2.Length - 1) / 2)))) + \"|.|\";\n s4 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s4.Length - 1) / 2)))) + \"|.|)\";\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n\n //Console.ReadKey();\n //}\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* int k = Convert.ToInt32(Console.ReadLine());\n char[,] mas = new char[4, 11];\n\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 11; j++)\n mas[i, j] = '#';\n \n }\n for (int i = 1; i < 11; i++)\n mas[2, i] = '.';\n\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 11;j++ )\n if (k > 0 && mas[i, j] != '.')\n { k--; mas[i, j] = '0'; }\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write('|');\n for (int i = 0; i < 11;i++ )\n Console.Write(mas[0,i].ToString() +'.');\n Console.WriteLine(\"|D|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"..|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");*/\n\n\n int k = Convert.ToInt32(Console.ReadLine());\n if (k < 5)\n {\n Console.WriteLine(\"+------------------------+\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n if (k > 0) { Console.WriteLine(\"|O.......................|\"); k--; }\n else Console.WriteLine(\"|#.......................|\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n return;\n }\n k = k - 4;\n Console.WriteLine(\"+------------------------+\");\n for (int i = 0; i < 2; i++)\n {\n Console.Write(\"|O.\");\n for (int j = 0; j < 10; j++)\n {\n if (3 * j + i < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n if (i == 0) Console.Write(\"|D|)\");\n else Console.Write(\"|.|\");\n Console.WriteLine();\n }\n Console.WriteLine(\"|O.......................|\");\n\n Console.Write(\"|O.\");\n for (int i = 0; i < 10; i++)\n if (3 * i + 2 < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n Console.Write(\"|.|)\");\n Console.WriteLine();\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace Question1\n{\n partial class Question1\n {\n static void Main(string[] args)\n {\n int k, diff, rem, added;\n StringBuilder answer = new StringBuilder();\n\n k = NextInt();\n answer.AppendLine(\"+------------------------+\");\n\n if (k == 0)\n {\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 1)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 2)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 3)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|O.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 4)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|O.......................|\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else\n {\n k -= 4;\n diff = k / 3;\n rem = k % 3;\n\n // Line 1\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n if (rem >= 1)\n {\n answer.Append(\"O.\");\n added++;\n }\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|D|)\");\n\n // Line 2\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n if (rem >= 2)\n {\n answer.Append(\"O.\");\n added++;\n }\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|.|\");\n\n // Line 3\n answer.AppendLine(\"|O.......................|\");\n\n // Line 4\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|.|)\");\n }\n\n answer.AppendLine(\"+------------------------+\");\n\n Console.Write(answer);\n }\n }\n\n partial class Question1\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nclass Solver\n{\n void Solve()\n {\n var p = Enumerable.Repeat('#', 34).ToArray();\n var n = sc.Integer();\n for (int i = 0; i < n; i++)\n {\n p[i] = 'O';\n }\n string format =\"+------------------------+\\n|{0}.{4}.{7}.{10}.{13}.{16}.{19}.{22}.{25}.{28}.{31}.|D|)\\n|{1}.{5}.{8}.{11}.{14}.{17}.{20}.{23}.{26}.{29}.{32}.|.|\\n|{2}.......................|\\n|{3}.{6}.{9}.{12}.{15}.{18}.{21}.{24}.{27}.{30}.{33}.|.|)\\n+------------------------+\";\n Printer.PrintLine(format,p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31],p[32],p[33]);\n\n }\n\n static void Main()\n {\n#if DEBUG\n var ostream = new System.IO.FileStream(\"debug.txt\", System.IO.FileMode.Create, System.IO.FileAccess.Write);\n var iStream = new System.IO.FileStream(\"input.txt\", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);\n Console.SetIn(new System.IO.StreamReader(iStream));\n System.Diagnostics.Debug.AutoFlush = true;\n System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(new System.IO.StreamWriter(ostream, System.Text.Encoding.UTF8)));\n try\n {\n#endif\n var solver = new Solver();\n solver.Solve();\n#if DEBUG\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.WriteLine(ex.StackTrace);\n }\n Console.ReadKey(true);\n#endif\n }\n _Scanner sc = new _Scanner();\n\n}\n\nstatic public class Printer\n{\n static readonly private System.IO.TextWriter writer;\n static readonly private System.Globalization.CultureInfo info;\n static string Separator { get; set; }\n static Printer()\n {\n writer = Console.Out;\n info = System.Globalization.CultureInfo.InvariantCulture;\n Separator = \" \";\n }\n\n static public void Print(int num) { writer.Write(num.ToString(info)); }\n static public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }\n static public void Print(long num) { writer.Write(num.ToString(info)); }\n static public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }\n static public void Print(double num) { writer.Write(num.ToString(info)); }\n static public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }\n static public void Print(string str) { writer.Write(str); }\n static public void Print(string format, params object[] arg) { writer.Write(format, arg); }\n static public void Print(IEnumerable sources) { writer.Write(sources.AsString()); }\n static public void Print(params object[] arg)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in arg)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n static public void Print(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.Write(res.ToString(0, res.Length - Separator.Length));\n }\n static public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }\n static public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }\n static public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }\n static public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }\n static public void PrintLine(double num) { writer.WriteLine(num.ToString(info)); }\n static public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }\n static public void PrintLine(string str) { writer.WriteLine(str); }\n static public void PrintLine(string format, params object[] arg) { writer.WriteLine(format, arg); }\n static public void PrintLine(IEnumerable sources) { writer.WriteLine(sources.AsString()); }\n static public void PrintLine(params object[] arg)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in arg)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n static public void PrintLine(IEnumerable sources)\n {\n var res = new System.Text.StringBuilder();\n foreach (var x in sources)\n {\n res.AppendFormat(info, \"{0}\", x);\n if (!string.IsNullOrEmpty(Separator))\n res.Append(Separator);\n }\n writer.WriteLine(res.ToString(0, res.Length - Separator.Length));\n }\n static public void PrintLine(System.Linq.Expressions.Expression> ex)\n {\n var res = ex.Parameters[0];\n writer.WriteLine(res.Name);\n }\n}\npublic class _Scanner\n{\n readonly private System.Globalization.CultureInfo info;\n readonly System.IO.TextReader reader;\n string[] buffer = new string[0];\n int position;\n\n public char[] Separator { get; set; }\n public _Scanner(System.IO.TextReader reader = null, string separator = null, System.Globalization.CultureInfo info = null)\n {\n\n this.reader = reader ?? Console.In;\n if (string.IsNullOrEmpty(separator))\n separator = \" \";\n this.Separator = separator.ToCharArray();\n this.info = info ?? System.Globalization.CultureInfo.InvariantCulture;\n }\n public string Scan()\n {\n if (this.position < this.buffer.Length)\n return this.buffer[this.position++];\n this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n this.position = 0;\n return this.buffer[this.position++];\n }\n\n public string[] ScanToEndLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries);\n var size = this.buffer.Length - this.position;\n var ar = new string[size];\n Array.Copy(this.buffer, position, ar, 0, size);\n return ar;\n\n }\n\n public string ScanLine()\n {\n if (this.position >= this.buffer.Length)\n return this.reader.ReadLine();\n else\n {\n var sb = new System.Text.StringBuilder();\n for (; this.position < buffer.Length; this.position++)\n {\n sb.Append(this.buffer[this.position]);\n sb.Append(' ');\n }\n return sb.ToString();\n }\n }\n public string[] ScanArray(int length)\n {\n var ar = new string[length];\n for (int i = 0; i < length; i++)\n {\n ar[i] = this.Scan();\n }\n return ar;\n }\n\n public int Integer()\n {\n return int.Parse(this.Scan(), info);\n }\n public long Long()\n {\n return long.Parse(this.Scan(), info);\n }\n public double Double()\n {\n return double.Parse(this.Scan(), info);\n }\n public double Double(string str)\n {\n return double.Parse(str, info);\n }\n\n public int[] IntArray(int length)\n {\n var a = new int[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Integer();\n return a;\n }\n public long[] LongArray(int length)\n {\n var a = new long[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Long();\n return a;\n }\n public double[] DoubleArray(int length)\n {\n var a = new double[length];\n for (int i = 0; i < length; i++)\n a[i] = this.Double();\n return a;\n }\n\n}\nstatic public partial class EnumerableEx\n{\n static public string AsString(this IEnumerable source)\n {\n return new string(source.ToArray());\n }\n static public IEnumerable Enumerate(this int count, Func selector)\n {\n return Enumerable.Range(0, count).Select(x => selector(x));\n }\n}\n#region SegTree\n[System.Diagnostics.DebuggerDisplay(\"Data={ToString()}\")]\npublic class SegmentTree\n{\n const long Max = 1L << 60;\n int n;\n long[] data;\n public SegmentTree(int size)\n {\n n = 1;\n while (n < size)\n n <<= 1;\n data = new long[n << 1];\n for (int i = 0; i < data.Length; i++)\n data[i] = Max;\n }\n\n ///Data[i]>\n public long this[int i]\n {\n get { return data[i + n]; }\n }\n ///Minimum[a,b)>\n public long this[int l, int r]\n {\n get { return Query(l, r, 1, 0, n); }\n }\n // turn kth index value into v\n public void Update(int k, long v)\n {\n k += n;\n while (k > 0)\n {\n data[k] = Math.Min(data[k], v);\n k >>= 1;\n }\n\n }\n private long Query(int a, int b, int k, int l, int r)\n {\n if (r <= a || b <= l)\n return Max;\n if (a <= l && r <= b)\n return data[k];\n else\n {\n var vl = Query(a, b, k << 1, l, (l + r) >> 1);\n var vr = Query(a, b, (k << 1) + 1, (l + r) >> 1, r);\n return Math.Min(vl, vr);\n }\n }\n public override string ToString()\n {\n return string.Join(\",\", Enumerable.Range(0, n).Select(i => this[i]).Where(v => v != Max));\n }\n}\n#endregion"}, {"source_code": "using System;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k =int.Parse( Console.ReadLine());\n char []s=new char[35];\n for (int i = 0; i 0)\n {\n count++;\n k--;\n }\n for (int c = 0; c < count; c++)\n {\n tmp[l] = 'O';\n l += 2;\n }\n f[j] = \"\";\n foreach (var varia in tmp)\n {\n f[j] += varia;\n }\n }\n }\n Console.WriteLine(book);\n Console.WriteLine(f[0]);\n Console.WriteLine(f[1]);\n Console.WriteLine(f[2]);\n Console.WriteLine(f[3]);\n Console.WriteLine(book);\n\n\n\n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt16(Console.ReadLine());\n \n Console.WriteLine(\"+------------------------+\");\n if (x < 1) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 5; m <= 32; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|D|)\\n\");\n if (x < 2) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 6; m <= 33; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|.|\\n\");\n if (x < 3) Console.WriteLine(\"|#.......................|\");\n else Console.WriteLine(\"|O.......................|\");\n\n if (x < 4) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 7; m <= 34; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n Console.Write(\"|.|)\\n\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\npublic static class solver\n{\n\n public static void Main()\n {\n var count = Convert.ToInt32(Console.ReadLine());\n\n var fmt =\n@\"+------------------------+\n|O.O.O.#.#.#.#.#.#.#.#.|D|)\n|O.O.O.#.#.#.#.#.#.#.#.|.|\n|O.......................|\n|O.O.#.#.#.#.#.#.#.#.#.|.|)\n+------------------------+\";\n\n var table = fmt.Split('\\n').Select(s => s.ToCharArray()).ToArray();\n\n for (int j = 0; j < table[0].Length - 3; ++j) {\n for (int i = 0; i < table.Length; i++) {\n if (table[i][j] == 'O' || table[i][j] == '#') {\n if (count > 0) {\n table[i][j] = 'O';\n --count;\n }\n else\n table[i][j] = '#';\n }\n }\n }\n\n Console.WriteLine(String.Join(\"\\n\", table.Select(cs => cs.Aggregate(\"\", (s, c) => s + c))));\n //Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Linq;\nstatic class demo\n{\n static void Main()\n {\n string s0 = \"+------------------------+\";\n string ss = \"|#.......................|\";\n string[] s = Enumerable.Range(0, 3).Select(x => \"|#.#.#.#.#.#.#.#.#.#.#.|\").ToArray();\n int n = int.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n if (i <= 1) AddO(ref s[i]);\n else if (i == 2) AddO(ref ss);\n else AddO(ref s[(i - 1) % 3]);\n }\n Console.WriteLine(\"{0}\\n{1}D|)\\n{2}.|\\n{3}\\n{4}.|)\\n{0}\", s0, s[0], s[1], ss, s[2]);\n }\n static void AddO(ref string source)\n {\n int n = source.IndexOf('#');\n source = source.Remove(n, 1);\n source = source.Insert(n, \"O\");\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n String a = Console.ReadLine();\n string h = calc(Int32.Parse(a));\n Console.Write(h.ToString());\n }\n\n static string calc(int a)\n {\n string res=\"+------------------------+\\r\\n\";\n res += \"|01.05.08.11.14.17.20.23.26.29.32.|D|)\\r\\n\";\n res += \"|02.06.09.12.15.18.21.24.27.30.33.|.|\\r\\n\";\n res += \"|03.......................|\\r\\n\";\n res += \"|04.07.10.13.16.19.22.25.28.31.34.|.|)\\r\\n\";\n res += \"+------------------------+\";\n\n for (int i = 1; i <= a; i++)\n res = res.Replace(sdd(i.ToString()), \"O\");\n for (int i = a+1; i <= 34; i++)\n res = res.Replace(sdd(i.ToString()), \"#\");\n\n return res;\n\n }\n\n static string sdd(string i)\n {\n if (i.Length == 1)\n return \"0\" + i;\n return i;\n }\n\n \n\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int k = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n\n string[,] Arr = new string[4, 11] { {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n };\n \n\n bool floopbreak = false;\n\n for (int i = 0; (!floopbreak) && i < 11; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (k == 0)\n {\n floopbreak = true;\n break;\n }\n\n if (j == 2 && i > 0)\n {\n continue;\n }\n\n Arr[j, i] = \"O\";\n\n counter++;\n if (counter == k)\n {\n\n floopbreak = true;\n break;\n }\n }\n\n\n }\n\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write(\"|\");\n \n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[0,i]+\".\");\n }\n\n Console.WriteLine(\"|D|)\");\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[1, i] + \".\");\n }\n\n Console.WriteLine(\"|.|\");\n\n Console.Write(\"|\");\n Console.Write(Arr[2, 0]);\n Console.WriteLine(\".......................|\");\n\n\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[3, i] + \".\");\n }\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\n\nnamespace Bayan_Bus\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);\n\n private static string s =\n @\"+------------------------+\n|{0}.{4}.{7}.{10}.{13}.{16}.{19}.{22}.{25}.{28}.{31}.|D|)\n|{1}.{5}.{8}.{11}.{14}.{17}.{20}.{23}.{26}.{29}.{32}.|.|\n|{2}.......................|\n|{3}.{6}.{9}.{12}.{15}.{18}.{21}.{24}.{27}.{30}.{33}.|.|)\n+------------------------+\";\n\n private static void Main(string[] args)\n {\n int n = Next();\n\n for (int i = 0; i < n; i++)\n {\n s = s.Replace(\"{\" + i + \"}\", \"O\");\n }\n\n for (int i = n; i < 35; i++)\n {\n s = s.Replace(\"{\" + i + \"}\", \"#\");\n }\n \n\n writer.Write(s);\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n // StreamReader sr = new StreamReader(\"11.in\");\n //StreamWriter sw = new StreamWriter(\"11.out\");\n\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"+------------------------+\");\n\n for (int j = 0; j < 4; j++)\n {\n Console.Write(\"|\");\n for (int i = 0; i < 11 || (i < 1 && j == 1); i++)\n Console.Write(seat(n, j, i) + \".\");\n Console.WriteLine( (j == 2 ? \".\" : \"|\") + (j == 0 ? \"D\" : \".\") + \"|\" + (j == 3 || j==0 ? \")\" : \"\"));\n }\n\n \n Console.WriteLine(\"+------------------------+\");\n Console.ReadLine();\n }\n\n static string seat(int k,int i,int j)\n {\n if (i == 2 && j>0)\n return \".\";\n if (k > 4 && j == 0)\n return \"O\";\n if (k <= 4 && j==0)\n return k>i? \"O\":\"#\";\n\n k-=4; j--; i= i == 3 ? 2 : i;\n return k > j * 3 + i ? \"O\" : \"#\";\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bayan\n{\n class Program\n {\n static List Do(int PassengersCount)\n {\n List Lines = new List();\n\n var RowCount = 6;\n var ColumnCount = 27;\n var Bus = new char[RowCount, ColumnCount];\n\n\n for (int row = 0; row < RowCount; row++)\n {\n string line = \"\";\n\n for (int column = 0; column < ColumnCount; column++)\n {\n if (row == 0 || row == RowCount - 1)\n {\n if (column == 0 || column == (ColumnCount - 2))\n Bus[row, column] = '+';\n else if (column == (ColumnCount - 1))\n Bus[row, column] = ' ';\n else\n Bus[row, column] = '-';\n }\n else\n {\n // \u0633\u062a\u0648\u0646 \u0647\u0627\u06cc \u0631\u062f\u06cc\u0641 \u0647\u0627\u06cc 1 \u062a\u0627 4\n if (column == 0)\n Bus[row, column] = '|';\n else\n {\n if (column < 23)\n {\n if (column == 1)\n {\n Bus[row, column] = '#';\n }\n else\n {\n if (row == 3)\n Bus[row, column] = '.';\n else\n {\n var isOdd = column % 2 == 1;\n if (isOdd)\n {\n Bus[row, column] = '#';\n }\n else\n {\n Bus[row, column] = '.';\n }\n }\n }\n }\n else\n {\n if (column == 23)\n {\n if (row != 3)\n Bus[row, column] = '|';\n else\n Bus[row, column] = '.';\n }\n else if (column == 24)\n {\n if (row == 1)\n Bus[row, column] = 'D';\n else\n Bus[row, column] = '.';\n }\n else if (column == 25)\n {\n Bus[row, column] = '|';\n }\n else if (column == 26)\n {\n if (row == 1 || row == 4)\n Bus[row, column] = ')';\n else\n Bus[row, column] = ' ';\n }\n }\n }\n\n }\n\n var s = Bus[row, column].ToString();\n line = line + s;\n }\n\n Lines.Add(line);\n }\n\n //PassengersCount\n\n var c = 0;\n\n string[] BusArray = Lines.ToArray();\n\n while (PassengersCount != 0)\n {\n var ss = BusArray[c];\n\n if (c >= 1 && c <= 4)\n {\n if (c == 3)\n {\n var cc = ss.ToCharArray();\n for (int i = 0; i < cc.Length; i++)\n {\n if (i == 1)\n {\n if (cc[i] == '#')\n {\n cc[i] = 'O';\n PassengersCount--;\n ss = string.Join(\"\", cc);\n break;\n }\n }\n }\n }\n else\n {\n var cc = ss.ToCharArray();\n\n for (int r = 0; r < cc.Length; r++)\n {\n if (cc[r] == '#')\n {\n cc[r] = 'O';\n PassengersCount--;\n break;\n }\n }\n\n ss = string.Join(\"\", cc);\n }\n\n }\n\n BusArray[c] = ss;\n\n c++;\n\n if (c > 5)\n c = 0;\n };\n\n return BusArray.Select(u => u.Trim()).ToList();\n }\n\n static void Main(string[] args)\n {\n try\n {\n var OutputLines = Do(int.Parse(Console.ReadLine()));\n Console.Write(string.Join(\"\\n\", OutputLines));\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.Write(Environment.NewLine);\n Console.Write(\"any key to exit\");\n Console.ReadKey();\n }\n }\n }\n\n\n #region Extensions\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable Collection, Action Action)\n {\n var ListCollection = Collection.ToList();\n\n var Length = ListCollection.Count;\n for (int i = 0; i < Length; i++)\n {\n Action(ListCollection[i], i);\n }\n }\n }\n\n #endregion\n\n\n #region IO\n\n public class IO\n {\n #region Constructor\n\n public IO(string InputPath, string OutputPath)\n {\n this.InputPath = InputPath;\n this.OutputPath = OutputPath;\n }\n\n #endregion\n\n\n #region Properties\n\n public string InputPath { get; set; }\n public string OutputPath { get; set; }\n\n #endregion\n\n\n #region Read Public Methods\n\n public string Read()\n {\n string Text = string.Empty;\n using (StreamReader Reader = new StreamReader(this.InputPath))\n Text = Reader.ReadToEnd();\n\n return Text;\n }\n\n public List ReadLines()\n {\n var Text = Read();\n var Lines = Text\n .Split('\\n')\n .Where(u => !string.IsNullOrEmpty(u))\n .ToList();\n return Lines;\n }\n\n #endregion\n\n\n #region Write Public Methods\n\n public void Write(string Text)\n {\n using (StreamWriter Writer = new StreamWriter(this.OutputPath))\n Writer.Write(Text);\n }\n\n public void WriteLines(List Lines)\n {\n var Text = String.Join(Environment.NewLine, Lines);\n Write(Text);\n }\n\n #endregion\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\nnamespace CodForceX\n{\n class Program\n {\n static void Main(string[] args)\n {\n var bus = new string[]\n {\n \"+------------------------+\", \n \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\", \n \"|#.#.#.#.#.#.#.#.#.#.#.|.|\",\n \"|#.......................|\", \n \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\", \n \"+------------------------+\"\n };\n var n = Int32.Parse(Console.ReadLine());\n for (int i = 0; i < n; i++)\n {\n var l1 = bus[1].IndexOf(\"#\");\n var l2 = bus[2].IndexOf(\"#\");\n var l3 = bus[3].IndexOf(\"#\");\n var l4 = bus[4].IndexOf(\"#\");\n\n var d = new Dictionary();\n if (l1 >= 0) d.Add(1, l1);\n if (l2 >= 0) d.Add(2, l2);\n if (l3 >= 0) d.Add(3, l3);\n if (l4 >= 0) d.Add(4, l4);\n\n var m = d.First(x => x.Value == d.Values.Min());\n bus[m.Key] = bus[m.Key].Remove(m.Value,1);\n bus[m.Key] = bus[m.Key].Insert(m.Value, \"O\");\n\n }\n\n for (int i = 0; i < bus.Count(); i++)\n {\n Console.WriteLine(bus[i]);\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 27; j++)\n {\n if (bus[i, j].ToString() == \"\\0\")\n continue;\n sb.Append(bus[i, j]);\n }\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n //sb.AppendLine();\n Console.Write(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Text.RegularExpressions;\nusing System.IO;\nusing System.Numerics;\nusing System.Globalization;\nusing System.Threading;\n\n\nnamespace probleme {\n class Program {\n static int k = 0;\n static void solve(int row) {\n if (row == 0 || row == 5) {\n Console.WriteLine(\"+------------------------+\");\n return;\n }\n if (row == 3) {\n Console.Write(\"|\");\n if (k >= 3) {\n Console.Write(\"O\");\n } else {\n Console.Write(\"#\");\n }\n Console.WriteLine(\".......................|\");\n return;\n }\n if (row == 2) {\n Console.Write(\"|\");\n if (k >= 2) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n for (int i = 6; i <= 33; i += 3) {\n if (k >= i) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n }\n Console.WriteLine(\"|.|\");\n return;\n }\n if (row == 1) {\n Console.Write(\"|\");\n if (k >= 1) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n for (int i = 5; i <= 32; i += 3) {\n if (k >= i) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n }\n Console.WriteLine(\"|D|)\");\n return;\n }\n if (row == 4) {\n Console.Write(\"|\");\n if (k >= 4) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n for (int i = 7; i <= 34; i += 3) {\n if (k >= i) {\n Console.Write(\"O.\");\n } else {\n Console.Write(\"#.\");\n }\n }\n Console.WriteLine(\"|.|)\");\n return;\n }\n }\n\n static void Main(string[] args) {\n\n //Console.SetIn(new StreamReader(\"file.in\"));\n /*\n FileStream filestream = new FileStream(\"out.txt\", FileMode.Create);\n var streamwriter = new StreamWriter(filestream);\n streamwriter.AutoFlush = true;\n Console.SetOut(streamwriter);\n */\n\n k = int.Parse(Console.ReadLine());\n for (int i = 0; i < 6; i++) {\n solve(i);\n }\n\n //Console.ReadKey();\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Bayan\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String[] lastRow = new String[4];\n int lastRowFillCounter = 0;\n String[,] remainingRows = new String[10, 3];\n String input = Console.ReadLine();\n int inputNumber = Convert.ToInt32(input);\n for (int i = 0; i < lastRow.Length; i++)\n {\n lastRow[i] = \"#\";\n }\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n remainingRows[i, j] = \"#\";\n }\n }\n int lastRowIndex = 0;\n int remainRowFirstIndex = 0;\n int remainRowSecondIndex = 0;\n for (int k = 0; k < inputNumber; k++)\n {\n if (lastRowFillCounter < 4)\n {\n lastRow[lastRowFillCounter] = \"O\";\n lastRowFillCounter++;\n }\n else\n {\n if (remainRowSecondIndex > 2)\n {\n remainRowSecondIndex = 0;\n remainRowFirstIndex++;\n }\n\n remainingRows[remainRowFirstIndex, remainRowSecondIndex] = \"O\";\n remainRowSecondIndex++;\n }\n }\n String firstAnswer = \"+------------------------+\";\n string firstRowAnswer = \"|\" + lastRow[0];\n for (int i = 0; i < 10; i++)\n {\n firstRowAnswer = firstRowAnswer + \".\" + remainingRows[i, 0];\n }\n firstRowAnswer = firstRowAnswer + \".|D|)\";\n\n String secondRowAnswer = \"|\" + lastRow[1];\n for (int i = 0; i < 10; i++)\n {\n secondRowAnswer = secondRowAnswer + \".\" + remainingRows[i, 1];\n }\n secondRowAnswer = secondRowAnswer + \".|.|\";\n\n\n String thirdRowAnswer = \"|\" + lastRow[2] + \".......................|\";\n\n String forthRowAnswer = \"|\" + lastRow[3];\n for (int i = 0; i < 10; i++)\n {\n forthRowAnswer = forthRowAnswer + \".\" + remainingRows[i, 2];\n }\n forthRowAnswer = forthRowAnswer + \".|.|)\";\n\n String endLine = \"+------------------------+\";\n Console.WriteLine(firstAnswer);\n Console.WriteLine(firstRowAnswer);\n Console.WriteLine(secondRowAnswer);\n Console.WriteLine(thirdRowAnswer);\n Console.WriteLine(forthRowAnswer);\n Console.WriteLine(endLine);\n \n\n\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n string[] output = new string[6];\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 12] = \"|D\";\n bus[1, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[2, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[4, 13] = \"|\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n }\n \n\n\n \n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \"..\";\n }\n bus[3, 12] += \"..\";\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \"..\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \"..\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n Console.Write('+');\n for (int l = 1; l < 25; l++)\n {\n Console.Write('-');\n }\n Console.Write('+');\n for (int i = 1; i < 5; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n output[i] += bus[i, j];\n \n }\n\n \n\n if ((i == 1) || (i == 4))\n {\n Console.Write(output[i] + ')');\n }\n else\n {\n Console.Write(output[i]);\n }\n }\n Console.WriteLine();\n Console.Write('+');\n for (int l = 1; l < 25; l++)\n {\n Console.Write('-');\n }\n Console.Write('+');\n\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace prA {\n\n class Program {\n#if ONLINE_JUDGE\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n#else\n private static readonly StreamWriter writer = new StreamWriter(\"output\");\n private static readonly StreamReader reader = new StreamReader(\"input\");\n#endif\n static void Main(string[] args) {\n int n = Next();\n char[][] map = {\n \"+------------------------+\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|\".ToCharArray(),\n \"|#.......................|\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\".ToCharArray(),\n \"+------------------------+\".ToCharArray()\n };\n for(int x = 0; n > 0 && x < 23; x++) {\n for(int y = 0; n > 0 && y < 6; y++) {\n if(map[y][x] != '#')\n continue;\n map[y][x] = 'O';\n n--;\n }\n }\n for(int i = 0; i < 6; i++) {\n writer.WriteLine(new string(map[i]));\n }\n writer.Flush();\n#if !ONLINE_JUDGE\n writer.Close();\n#endif\n }\n private static int Next() {\n int c;\n int res = 0;\n do {\n c = reader.Read();\n if(c == -1)\n return res;\n } while(c != '-' && (c < '0' || c > '9'));\n int sign = 1;\n if(c == '-') {\n sign = -1;\n c = reader.Read();\n }\n res = c - '0';\n while(true) {\n c = reader.Read();\n if(c < '0' || c > '9')\n return res * sign;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Numerics;\n\n// (\u3065\u00b0\u03c9\u00b0)\u3065\uff90\u2605\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\u2606\u309c\u30fb\u3002\u3002\u30fb\u309c\u309c\u30fb\u3002\u3002\u30fb\u309c\npublic class Solver\n{\n private char[][] bus = new[]\n {\n \"+------------------------+\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|\".ToCharArray(),\n \"|#.......................|\".ToCharArray(),\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\".ToCharArray(),\n \"+------------------------+\".ToCharArray()\n };\n\n public object Solve()\n {\n int n = ReadInt();\n for (int i = 0; i < Math.Min(n, 4); i++)\n bus[i + 1][1] = 'O';\n\n for (int i = 0; i < n - 4; i++)\n bus[i % 3 == 2 ? 4 : (i % 3 + 1)][i / 3 * 2 + 3] = 'O';\n\n foreach (var line in bus)\n writer.WriteLine(new string(line));\n\n return null;\n }\n\n #region Main\n\n protected static TextReader reader;\n protected static TextWriter writer;\n\n static void Main()\n {\n#if DEBUG\n reader = new StreamReader(\"..\\\\..\\\\input.txt\");\n writer = Console.Out;\n //writer = new StreamWriter(\"..\\\\..\\\\output.txt\");\n#else\n reader = new StreamReader(Console.OpenStandardInput());\n writer = new StreamWriter(Console.OpenStandardOutput());\n#endif\n try\n {\n object result = new Solver().Solve();\n if (result != null)\n writer.WriteLine(result);\n }\n catch (Exception ex)\n {\n#if DEBUG\n Console.WriteLine(ex);\n#else\n Console.WriteLine(ex);\n throw;\n#endif\n }\n reader.Close();\n writer.Close();\n }\n\n #endregion\n\n #region Read / Write\n\n private static Queue currentLineTokens = new Queue();\n\n private static string[] ReadAndSplitLine()\n {\n return reader.ReadLine().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n public static string ReadToken()\n {\n while (currentLineTokens.Count == 0)\n currentLineTokens = new Queue(ReadAndSplitLine());\n return currentLineTokens.Dequeue();\n }\n\n public static int ReadInt()\n {\n return int.Parse(ReadToken());\n }\n\n public static long ReadLong()\n {\n return long.Parse(ReadToken());\n }\n\n public static double ReadDouble()\n {\n return double.Parse(ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public static int[] ReadIntArray()\n {\n return ReadAndSplitLine().Select(int.Parse).ToArray();\n }\n\n public static long[] ReadLongArray()\n {\n return ReadAndSplitLine().Select(long.Parse).ToArray();\n }\n\n public static double[] ReadDoubleArray()\n {\n return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();\n }\n\n public static int[][] ReadIntMatrix(int numberOfRows)\n {\n int[][] matrix = new int[numberOfRows][];\n for (int i = 0; i < numberOfRows; i++)\n matrix[i] = ReadIntArray();\n return matrix;\n }\n\n public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)\n {\n int[][] matrix = ReadIntMatrix(numberOfRows);\n int[][] ret = new int[matrix[0].Length][];\n for (int i = 0; i < ret.Length; i++)\n {\n ret[i] = new int[numberOfRows];\n for (int j = 0; j < numberOfRows; j++)\n ret[i][j] = matrix[j][i];\n }\n return ret;\n }\n\n public static string[] ReadLines(int quantity)\n {\n string[] lines = new string[quantity];\n for (int i = 0; i < quantity; i++)\n lines[i] = reader.ReadLine().Trim();\n return lines;\n }\n\n public static void WriteArray(IEnumerable array)\n {\n writer.WriteLine(string.Join(\" \", array));\n }\n \n public static void Write(params T[] array)\n {\n WriteArray(array);\n }\n\n public static void WriteLines(IEnumerable array)\n {\n foreach (var a in array)\n writer.WriteLine(a);\n }\n\n #endregion\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication254\n{\n class Program\n {\n static Dictionary> d = new Dictionary>();\n static int[] mark;\n static Dictionary cnt;\n static int[] color;\n static int size = 0;\n static void dfs(int v)\n {\n size++;\n mark[v] = 1;\n bool w = false;\n if (cnt.ContainsKey(color[v]))\n {\n cnt[color[v]]++;\n }\n else\n {\n cnt.Add(color[v], 1);\n }\n for (int i = 0; i < d[v].Count; i++)\n {\n if (mark[d[v][i]] == 0)\n {\n\n dfs(d[v][i]);\n }\n\n }\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int k1 = 0;\n int k2 = 0;\n int k3 = 0;\n if (n > 4)\n {\n string a1 = \"+------------------------+\";\n string a2 = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n string a3 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n string a4 = \"|O.......................|\";\n string a5 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n string a6 = \"+------------------------+\";\n if ((n - 1) % 3 == 0)\n {\n k1 = (n - 1) / 3;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else if ((n - 1) % 3 == 1)\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3 + 1;\n k3 = (n - 1) - (k1 + k2);\n }\n //Console.WriteLine(k1+\" \"+k2+\" \"+k3);\n int k = 1;\n string c1 = a1;\n string c2 = \"\";\n string c3 = \"\";\n string c4 = a4;\n string c5 = \"\";\n string c6 = a6;\n for (int i = 0; i < a2.Length; i++)\n {\n if (k <= k1)\n {\n if (a2[i] == '#')\n {\n c2 += 'O';\n k++;\n }\n else\n {\n c2 += a2[i];\n }\n }\n else\n {\n c2 += a2[i];\n }\n }\n k = 1;\n for (int i = 0; i < a3.Length; i++)\n {\n if (k <= k2)\n {\n if (a3[i] == '#')\n {\n c3 += 'O';\n k++;\n }\n else\n {\n c3 += a3[i];\n }\n }\n else\n {\n c3 += a3[i];\n }\n }\n k = 1;\n for (int i = 0; i < a5.Length; i++)\n {\n if (k <= k3)\n {\n if (a5[i] == '#')\n {\n c5 += 'O';\n k++;\n }\n else\n {\n c5 += a5[i];\n }\n }\n else\n {\n c5 += a5[i];\n }\n }\n Console.WriteLine(c1);\n Console.WriteLine(c2);\n Console.WriteLine(c3);\n Console.WriteLine(c4);\n Console.WriteLine(c5);\n Console.WriteLine(c6);\n }\n else\n {\n\n if (n == 1)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 2)\n {\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 3)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 4)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else\n {\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n }\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar v = int.Parse(Console.ReadLine());\n\t\t\tvar a = \"\";\n\t\t\tvar b = \"\";\n\t\t\tvar c = \"\";\n\t\t\tvar d = \"\";\n\t\t\tif (v >= 3){\n\t\t\t\tc = \"O.\";\n\t\t\t\tv--;\n\t\t\t} else {\n\t\t\t\tc = \"#.\";\n\t\t\t}\n\t\t\tint j = v / 3;\n\t\t\tdoStuff(ref a,ref j,v);\n\t\t\tdoStuff(ref b,ref j,v);\n\t\t\tdoStuff(ref d,ref j,v);\n\t\t\tj = v - j * 3;\n\t\t\tdoStuff2(ref a,ref j, v);\n\t\t\tdoStuff2(ref b,ref j, v);\n\t\t\tdoStuff2(ref d,ref j, v);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|\"+a+\"|D|)\");\n\t\t\tConsole.WriteLine(\"|\"+b+\"|.|\");\n\t\t\tConsole.WriteLine(\"|\"+c+\"......................|\");\n\t\t\tConsole.WriteLine(\"|\"+d+\"|.|)\");\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n//\t\t\tConsole.ReadLine();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpublic static void doStuff(ref string a, ref int j, int v){\n\t\t\tfor (int i = 0; i < j; i++){\n\t\t\t\ta += \"O.\";\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void doStuff2(ref string a, ref int j, int v){\n\t\t\tif (j > 0){\n\t\t\t\ta += \"O.\";\n\t\t\t\tj--;\n\t\t\t}\n\t\t\twhile (a.Length < 22){\n\t\t\t\ta += \"#.\";\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void print(string a){\n\t\t\tConsole.WriteLine(a);\n\t\t}\n\t}\n}\n\n// Remember these:\n// String.Format(\"{0:0}\",f).ToString();\n// Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);\n// var splstr = Console.ReadLine().Split(' ').ToList();\n// var str = Console.ReadLine();\n// var l = new List();"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n string[,] array = new string[4, 11];\n int count = 0;\n bool one = true;\n for (int i = 0; i < 11; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (k > 0)\n {\n if (count != 2)\n {\n array[j, i] = \"O\";\n k--;\n }\n if ((count == 2) && (one == false))\n {\n array[j, i] = \".\";\n }\n if ((count == 2) && (one == true))\n {\n array[j, i] = \"O\";\n k--;\n one = false;\n }\n count++;\n }\n else\n {\n if (count != 2)\n {\n array[j, i] = \"#\";\n k--;\n }\n if ((count == 2) && (one == false))\n {\n array[j, i] = \".\";\n }\n if ((count == 2) && (one == true))\n {\n array[j, i] = \"#\";\n k--;\n one = false;\n }\n count++;\n }\n \n }\n count = 0;\n }\n\n Console.WriteLine(\"+------------------------+\");\n\n Console.Write(\"|\");\n for (int j = 0; j < 11; j++)\n {\n Console.Write(array[0, j] + \".\");\n }\n Console.Write(\"|\");\n Console.Write(\"D\");\n Console.Write(\"|\");\n Console.WriteLine(\")\");\n\n Console.Write(\"|\");\n for (int j = 0; j < 11; j++)\n {\n Console.Write(array[1, j] + \".\");\n }\n Console.Write(\"|\");\n Console.Write(\".\");\n Console.WriteLine(\"|\");\n\n Console.Write(\"|\");\n for (int j = 0; j < 11; j++)\n {\n Console.Write(array[2, j] + \".\");\n }\n Console.Write(\".\");\n Console.Write(\".\");\n Console.WriteLine(\"|\");\n\n Console.Write(\"|\");\n for (int j = 0; j < 11; j++)\n {\n Console.Write(array[3, j] + \".\");\n }\n Console.Write(\"|\");\n Console.Write(\".\");\n Console.Write(\"|\");\n Console.WriteLine(\")\");\n\n Console.WriteLine(\"+------------------------+\");\n \n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF475A {\n class Program {\n static void Main(string[] args) {\n int passengers = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"+------------------------+\");\n for(int row = 0; row < 4; row++) {\n string r = \"|\";\n int seats = (passengers - 4) / 3;\n if(row == 0) {\n if((passengers - 4) % 3 > 0) {\n seats += 1;\n }\n } else if(row == 1) {\n if((passengers - 4) % 3 > 1) {\n seats += 1;\n }\n }\n if(row == 2) {\n if(passengers >= 3) {\n Console.WriteLine(\"|O.......................|\");\n } else {\n Console.WriteLine(\"|#.......................|\");\n }\n continue;\n }\n\n for(int i = 0; i <= seats; i++) {\n if(row == 3 && passengers < 4) {\n seats--;\n continue;\n }\n r += \"O.\";\n }\n if(passengers - (row + 1) == 0 && row == 0) {\n r += \"O.\";\n seats++;\n }\n for(int i = seats; i < 10; i++) {\n r += \"#.\";\n\n }\n if(row == 0) {\n r += \"|D|)\";\n } else if(row == 1) {\n r += \"|.|\";\n } else if(row == 2) {\n r += \"..|\";\n } else if (row == 3) {\n r += \"|.|)\";\n }\n Console.WriteLine(r);\n }\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.IO;\nusing System.Globalization;\nclass Program\n{\n static TextReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);\n static TextWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);\n static void Main()\n {\n var n = int.Parse(reader.ReadLine());\n var b = @\"+------------------------+\n|#.#.#.#.#.#.#.#.#.#.#.|D|)\n|#.#.#.#.#.#.#.#.#.#.#.|.|\n|#.......................|\n|#.#.#.#.#.#.#.#.#.#.#.|.|)\n+------------------------+\n\n\".ToCharArray();\n \t\tvar s = new[] { 29, 58, 86, 114, 31, 60, 116, 33, 62, 118,35, 64, 120,37, 66, 122,39, 68, 124, 41, 70,126,43, 72, 128,45, 74, 130, 47, 76, 132, 49, 78, 134 };\n\t\tfor (int i = 0;i();\n if (l1 >= 0) d.Add(1, l1);\n if (l2 >= 0) d.Add(2, l2);\n if (l3 >= 0) d.Add(3, l3);\n if (l4 >= 0) d.Add(4, l4);\n\n var m = d.First(x => x.Value == d.Values.Min());\n bus[m.Key] = bus[m.Key].Remove(m.Value,1);\n bus[m.Key] = bus[m.Key].Insert(m.Value, \"O\");\n\n }\n\n for (int i = 0; i < bus.Count(); i++)\n {\n Console.WriteLine(bus[i]);\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic int First;\n\n\t\t\tpublic int Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar bus = new List\n\t\t\t{\n\t\t\t\tnew StringBuilder(\"+------------------------+\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\"),\n\t\t\t\tnew StringBuilder(\"|#.......................|\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"),\n\t\t\t\tnew StringBuilder(\"+------------------------+\")\n\t\t\t};\n\t\t\tvar k = ReadInt();\n\t\t\tvar curx = 1;\n\t\t\tvar cury = 1;\n\t\t\twhile (k > 0)\n\t\t\t{\n\t\t\t\tif (bus[curx][cury] == '#')\n\t\t\t\t{\n\t\t\t\t\tk--;\n\t\t\t\t\tbus[curx][cury] = 'O';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (curx != 4)\n\t\t\t\t\t\tcurx++;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcurx = 1;\n\t\t\t\t\t\tcury++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach (var q in bus)\n\t\t\t\tConsole.WriteLine(q.ToString());\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic int First;\n\n\t\t\tpublic int Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First > y.First || (x.First == y.First && x.Second < y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar bus = new List\n\t\t\t{\n\t\t\t\tnew StringBuilder(\"+------------------------+\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\"),\n\t\t\t\tnew StringBuilder(\"|#.......................|\"),\n\t\t\t\tnew StringBuilder(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"),\n\t\t\t\tnew StringBuilder(\"+------------------------+\")\n\t\t\t};\n\t\t\tvar k = ReadInt();\n\t\t\tvar curx = 1;\n\t\t\tvar cury = 1;\n\t\t\twhile (k > 0)\n\t\t\t{\n\t\t\t\tif (bus[curx][cury] == '#')\n\t\t\t\t{\n\t\t\t\t\tk--;\n\t\t\t\t\tbus[curx][cury] = 'O';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (curx != 4)\n\t\t\t\t\t\tcurx++;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcurx = 1;\n\t\t\t\t\t\tcury++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach (var t in bus)\n\t\t\t\tConsole.WriteLine(t.ToString());\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace _475A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Int32.Parse(Console.ReadLine());\n\n Processing(k);\n\n }\n\n private static void Processing(int k)\n {\n int max = 34;\n Line first = new Line(11);\n Line second = new Line(11);\n Line third = new Line(1);\n Line fourth = new Line(11);\n Line[] lines = { first, second, third, fourth };\n\n int current = 0;\n\n if (k <= 6)\n {\n while (k > 0)\n {\n if (lines[current].canAdd)\n {\n lines[current].AddPassenger();\n k--;\n }\n current++;\n if (current >= lines.Length)\n {\n current = 0;\n }\n }\n }\n else\n {\n while (k >= 0)\n {\n if (lines[current].canAdd)\n {\n lines[current].AddPassenger();\n k--;\n }\n current++;\n if (current >= lines.Length)\n {\n current = 0;\n }\n }\n }\n\n StringBuilder result = new StringBuilder();\n result.Append(\"+------------------------+\\n\");\n \n //first\n result.Append(\"|\");\n foreach (var place in lines[0].emptyPlaces)\n {\n if (!place)\n {\n result.Append(\"O.\");\n }\n else\n {\n result.Append(\"#.\");\n }\n }\n result.Append(\"|D|)\\n\");\n\n //second\n result.Append(\"|\");\n foreach (var place in lines[1].emptyPlaces)\n {\n if (!place)\n {\n result.Append(\"O.\");\n }\n else\n {\n result.Append(\"#.\");\n }\n }\n result.Append(\"|.|\\n\");\n\n //third\n result.Append(\"|\");\n foreach (var place in lines[2].emptyPlaces)\n {\n if (!place)\n {\n result.Append(\"O.\");\n }\n else\n {\n result.Append(\"#.\");\n }\n }\n result.Append(\"......................|\\n\");\n\n //fourth\n result.Append(\"|\");\n foreach (var place in lines[3].emptyPlaces)\n {\n if (!place)\n {\n result.Append(\"O.\");\n }\n else\n {\n result.Append(\"#.\");\n }\n }\n result.Append(\"|.|)\\n\");\n\n result.Append(\"+------------------------+\");\n\n\n Console.WriteLine(result);\n\n }\n\n class Line\n {\n private int places;\n public bool[] emptyPlaces { get; set; }\n private int cursor;\n public bool canAdd { get; set; }\n\n public Line(int number)\n {\n cursor = 0;\n canAdd = true;\n places = number;\n emptyPlaces = new bool[places];\n for (int i = 0; i < emptyPlaces.Length; i++)\n emptyPlaces[i] = true;\n }\n\n public void AddPassenger()\n {\n canAdd = cursor < emptyPlaces.Length;\n if (canAdd)\n {\n emptyPlaces[cursor] = false;\n cursor++;\n }\n }\n\n public void Print()\n {\n for (int i = 0; i < emptyPlaces.Length; i++)\n {\n if (emptyPlaces[i])\n {\n Console.Write(\"T \");\n }\n else\n {\n Console.Write(\"F \");\n }\n }\n Console.Write(\"\\n\");\n }\n }\n }\n}\n"}], "negative_code": [{"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace BayanCont\n{\n class Program\n {\n const string sample = @\"+------------------------+\n|{1}.{5}.{8}.{11}.{14}.{17}.{20}.{23}.{26}.{29}.{32}.|D|)\n|{2}.{6}.{9}.{12}.{15}.{18}.{21}.{24}.{27}.{30}.{33}.|.|\n|{3}.......................|\n|{4}.{7}.{10}.{13}.{16}.{19}.{22}.{25}.{28}.{31}.{34}.|.|)\n+------------------------+\";\n static void Main(string[] args)\n {\n int passengers = int.Parse(Console.ReadLine());\n Console.WriteLine( getBusFigure(passengers));\n Console.ReadLine();\n }\n\n static string getBusFigure(int passengers)\n {\n string outDat = sample;\n for (int i = 1; i <= passengers; i++)\n {\n outDat = outDat.Replace(\"{\" + i.ToString() + \"}\", \"0\");\n }\n\n for (int i = 34; i > passengers; i--)\n {\n outDat = outDat.Replace(\"{\" + i.ToString() + \"}\", \"#\");\n }\n return outDat;\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace work01\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tvar l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;\n\t\t\tvar l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;\n\t\t\tvar l3 = n > 3 ? 1 : 0;\n\t\t\tvar l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;\n\n\t\t\tFunc print = (k, m) => {\n\t\t\t\tvar sb = new StringBuilder();\n\t\t\t\tfor (var i = 1; i <= m; i++) {\n\t\t\t\t\tsb.AppendFormat(\"{0}.\", (i <= k) ? \"0\" : \"#\" );\n\t\t\t\t}\n\t\t\t\treturn sb.ToString();\n\t\t\t};\n\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|{0}|D|)\", print(l1, 11));\n\t\t\tConsole.WriteLine(\"|{0}|.|\", print(l2, 11));\n\t\t\tConsole.WriteLine(\"|{0}......................|\", print(l3, 1));\n\t\t\tConsole.WriteLine(\"|{0}|.|)\", print(l4, 11));\n\t\t\tConsole.Write(\"+------------------------+\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace work01\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tvar l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;\n\t\t\tvar l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;\n\t\t\tvar l3 = n > 3 ? 1 : 0;\n\t\t\tvar l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;\n\n\t\t\tFunc print = (k, m) => {\n\t\t\t\tvar sb = new StringBuilder();\n\t\t\t\tfor (var i = 1; i <= m; i++) {\n\t\t\t\t\tsb.AppendFormat(\"{0}.\", (i <= k) ? \"0\" : \"#\" );\n\t\t\t\t}\n\t\t\t\treturn sb.ToString();\n\t\t\t};\n\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|{0}|D|)\", print(l1, 11));\n\t\t\tConsole.WriteLine(\"|{0}|.|\", print(l2, 11));\n\t\t\tConsole.WriteLine(\"|{0}......................|\", print(l3, 1));\n\t\t\tConsole.WriteLine(\"|{0}|.|)\", print(l4, 11));\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace work01\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main (string[] args)\n\t\t{\n\t\t\tvar n = Int32.Parse (Console.ReadLine ());\n\n\t\t\tvar l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;\n\t\t\tvar l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;\n\t\t\tvar l3 = n > 2 ? 1 : 0;\n\t\t\tvar l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;\n\n\t\t\tFunc print = (k, m) => {\n\t\t\t\tvar sb = new StringBuilder();\n\t\t\t\tfor (var i = 1; i <= m; i++) {\n\t\t\t\t\tsb.AppendFormat(\"{0}.\", (i <= k) ? \"0\" : \"#\" );\n\t\t\t\t}\n\t\t\t\treturn sb.ToString();\n\t\t\t};\n\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|{0}|D|)\", print(l1, 11));\n\t\t\tConsole.WriteLine(\"|{0}|.|\", print(l2, 11));\n\t\t\tConsole.WriteLine(\"|{0}......................|\", print(l3, 1));\n\t\t\tConsole.WriteLine(\"|{0}|.|)\", print(l4, 11));\n\t\t\tConsole.Write(\"+------------------------+\");\t\t\t\t\t\t \n\t\t}\n\t}\n}\n"}, {"source_code": "using System;\nusing System.Text;\nusing System.Linq;\nusing System.Collections.Generic;\n\nnamespace work01\n{\n class MainClass\n {\n public static void Main (string[] args)\n {\n var n = Int32.Parse (Console.ReadLine ());\n\n var l1 = n > 4 ? (n + 1) / 3 : n > 0 ? 1 : 0;\n var l2 = n > 4 ? n / 3 : n > 1 ? 1 : 0;\n var l3 = n > 2 ? 1 : 0;\n var l4 = n > 4 ? (n - 1) / 3 : n > 3 ? 1 : 0;\n\n Func print = (k, m) => {\n var sb = new StringBuilder();\n for (var i = 1; i <= m; i++) {\n sb.AppendFormat(\"{0}.\", (i <= k) ? \"0\" : \"#\" );\n }\n return sb.ToString();\n };\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|{0}|D|)\", print(l1, 11));\n Console.WriteLine(\"|{0}|.|\", print(l2, 11));\n Console.WriteLine(\"|{0}......................|\", print(l3, 1));\n Console.WriteLine(\"|{0}|.|)\", print(l4, 11));\n Console.WriteLine(\"+------------------------+\"); \n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = int.Parse(Console.ReadLine());\n int t = k;\n string s1 = \"+------------------------+\";\n string s2 = \"|O.......................|\";\n string s3 = \"|#.......................|\";\n string[,] mat = new string[3,11];\n k--;\n mat[0, 0] = \"|\";\n mat[1, 0] = \"|\";\n mat[2, 0] = \"|\";\n for (int i = 0; i < 11; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n if (k > 0)\n { mat[j, i] += \"O\"; k--; }\n else\n mat[j, i] += \"#\";\n }\n }\n Console.WriteLine(s1);\n for (int i = 0; i < 3; i++)\n {\n if (i == 2) \n Console.WriteLine((t>3)?s2:s3); \n for (int j = 0; j < 11; j++)\n {\n Console.Write(mat[i, j] + \".\");\n }\n if (i == 0)\n Console.Write(\"|D|)\");\n else\n if (i == 2)\n Console.Write(\"|.|)\");\n else\n Console.Write(\"|.|\");\n Console.WriteLine();\n }\n Console.WriteLine(s1);\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* int k = Convert.ToInt32(Console.ReadLine());\n char[,] mas = new char[4, 11];\n\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 11; j++)\n mas[i, j] = '#';\n \n }\n for (int i = 1; i < 11; i++)\n mas[2, i] = '.';\n\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 11;j++ )\n if (k > 0 && mas[i, j] != '.')\n { k--; mas[i, j] = '0'; }\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write('|');\n for (int i = 0; i < 11;i++ )\n Console.Write(mas[0,i].ToString() +'.');\n Console.WriteLine(\"|D|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"..|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");*/\n\n\n int k = Convert.ToInt32(Console.ReadLine());\n if (k < 5)\n {\n Console.WriteLine(\"+------------------------+\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n if (k > 0) { Console.WriteLine(\"|O.......................|)\"); k--; }\n else Console.WriteLine(\"|#.......................|)\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n return;\n }\n k = k - 4;\n Console.WriteLine(\"+------------------------+\");\n for (int i = 0; i < 2; i++)\n {\n Console.Write(\"|O.\");\n for (int j = 0; j < 10; j++)\n {\n if (3 * j + i < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n if (i == 0) Console.Write(\"|D|\");\n else Console.Write(\"|.|\");\n Console.WriteLine();\n }\n Console.WriteLine(\"|O.......................|\");\n\n Console.Write(\"|O.\");\n for (int i = 0; i < 10; i++)\n if (3 * i + 2 < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n Console.Write(\"|.|\");\n Console.WriteLine();\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n /* int k = Convert.ToInt32(Console.ReadLine());\n char[,] mas = new char[4, 11];\n\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 11; j++)\n mas[i, j] = '#';\n \n }\n for (int i = 1; i < 11; i++)\n mas[2, i] = '.';\n\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 11;j++ )\n if (k > 0 && mas[i, j] != '.')\n { k--; mas[i, j] = '0'; }\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write('|');\n for (int i = 0; i < 11;i++ )\n Console.Write(mas[0,i].ToString() +'.');\n Console.WriteLine(\"|D|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"..|)\");\n\n Console.Write('|');\n for (int i = 0; i < 11; i++)\n Console.Write(mas[0, i].ToString() + '.');\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");*/\n\n\n int k = Convert.ToInt32(Console.ReadLine());\n if (k < 5)\n {\n Console.WriteLine(\"+------------------------+\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n if (k > 0) { Console.WriteLine(\"|O.......................|)\"); k--; }\n else Console.WriteLine(\"|#.......................|)\");\n if (k > 0) { Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"); k--; }\n else Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n return;\n }\n k = k - 4;\n Console.WriteLine(\"+------------------------+\");\n for (int i = 0; i < 2; i++)\n {\n Console.Write(\"|O.\");\n for (int j = 0; j < 10; j++)\n {\n if (3 * j + i < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n if (i == 0) Console.Write(\"|D|)\");\n else Console.Write(\"|.|\");\n Console.WriteLine();\n }\n Console.WriteLine(\"|O.......................|\");\n\n Console.Write(\"|O.\");\n for (int i = 0; i < 10; i++)\n if (3 * i + 2 < k) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n Console.Write(\"|.|)\");\n Console.WriteLine();\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces_475a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n int num = k;\n Console.WriteLine(\"+------------------------+\");\n string s1 = \"|\", s2 = \"|\", s3 = \"|\", s4 = \"|\";\n if (k <= 4)\n {\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n break;\n case 4:\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n break;\n }\n }\n else\n {\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n k -= 4;\n int n = k / 3;\n if (n != 0)\n {\n s1 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s2 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s4 += string.Concat(Enumerable.Repeat(\"O.\", n));\n k = k % 3;\n }\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n s2 += \"#.\";\n s4 += \"#.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"#.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"O.\";\n break;\n }\n s1 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s1.Length - 1) / 2)))) + \"|D|)\";\n s2 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s2.Length - 1) / 2)))) + \"|.|\";\n s4 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s4.Length - 1) / 2)))) + \"|.|)\";\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces_475a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n if (k > 34)\n k = 34;\n Console.WriteLine(\"+------------------------+\");\n string s1 = \"|\", s2 = \"|\", s3 = \"|\", s4 = \"|\";\n if (k <= 4)\n {\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n break;\n case 4:\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n break;\n }\n }\n else\n {\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n k -= 4;\n int n = k / 3;\n if (n != 0)\n {\n s1 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s2 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s4 += string.Concat(Enumerable.Repeat(\"O.\", n));\n k = k % 3;\n }\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n s2 += \"#.\";\n s4 += \"#.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"#.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"O.\";\n break;\n }\n s1 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s1.Length - 1) / 2)))) + \"|D|)\";\n s2 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s2.Length - 1) / 2)))) + \"|.|\";\n s4 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s4.Length - 1) / 2)))) + \"|.|)\";\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace codeforces_475a\n{\n class Program\n {\n static void Main(string[] args)\n {\n int k = Convert.ToInt32(Console.ReadLine());\n if (k > 34)\n k = 34;\n Console.WriteLine(\"+------------------------+\");\n string s1 = \"|\", s2 = \"|\", s3 = \"|\", s4 = \"|\";\n if (k == 0)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (k <= 4)\n {\n switch (k)\n {\n case 1:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"#.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"#.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 2:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"#.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 3:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"O.......................|\";\n s4 += \"#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n case 4:\n s1 += \"O.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s2 += \"O.#.#.#.#.#.#.#.#.#.#.|.|\";\n s3 += \"O.......................|\";\n s4 += \"O.#.#.#.#.#.#.#.#.#.#.|.|)\";\n break;\n }\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n else\n {\n s1 += \"O.\";\n s2 += \"O.\";\n s3 += \"O.......................|\";\n s4 += \"O.\";\n k -= 4;\n int n = k / 3;\n if (n != 0)\n {\n s1 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s2 += string.Concat(Enumerable.Repeat(\"O.\", n));\n s4 += string.Concat(Enumerable.Repeat(\"O.\", n));\n k = k % 3;\n }\n switch (k)\n {\n case 1:\n s1 += \"O.\";\n s2 += \"#.\";\n s4 += \"#.\";\n break;\n case 2:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"#.\";\n break;\n case 3:\n s1 += \"O.\";\n s2 += \"O.\";\n s4 += \"O.\";\n break;\n }\n s1 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s1.Length - 1) / 2)))) + \"|D|)\";\n s2 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s2.Length - 1) / 2)))) + \"|.|\";\n s4 += string.Concat(Enumerable.Repeat(\"#.\", (11 - ((s4.Length - 1) / 2)))) + \"|.|)\";\n Console.WriteLine(s1);\n Console.WriteLine(s2);\n Console.WriteLine(s3);\n Console.WriteLine(s4);\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Text;\n\nnamespace Question1\n{\n partial class Question1\n {\n static void Main(string[] args)\n {\n int k, diff, rem, added;\n StringBuilder answer = new StringBuilder();\n\n k = NextInt();\n answer.AppendLine(\"+------------------------+\");\n\n if (k == 0)\n {\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 1)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 2)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|#.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 3)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|O.......................|\");\n answer.AppendLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else if (k == 4)\n {\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n answer.AppendLine(\"|O.......................|\");\n answer.AppendLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\");\n }\n else\n {\n k -= 4;\n diff = k / 3;\n rem = k % 3;\n\n // Line 1\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n if (rem >= 1)\n {\n answer.Append(\"O.\");\n added++;\n }\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|D|)\");\n\n // Line 2\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n if (rem >= 2)\n {\n answer.Append(\"O.\");\n added++;\n }\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|.|)\");\n\n // Line 3\n answer.AppendLine(\"|O.......................|\");\n\n // Line 4\n answer.Append(\"|O.\");\n\n for (int i = 0; i < diff; i++)\n answer.Append(\"O.\");\n\n added = diff;\n\n for (int i = 0; i < 10 - added; i++)\n answer.Append(\"#.\");\n\n answer.AppendLine(\"|.|)\");\n }\n\n answer.AppendLine(\"+------------------------+\");\n\n Console.Write(answer);\n }\n }\n\n partial class Question1\n {\n static string[] tokens = new string[0];\n static int cur_token = 0;\n\n static void ReadArray(char sep)\n {\n cur_token = 0;\n tokens = Console.ReadLine().Split(sep);\n }\n\n static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int NextInt()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return int.Parse(tokens[cur_token++]);\n }\n\n static long NextLong()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return long.Parse(tokens[cur_token++]);\n }\n\n static double NextDouble()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return double.Parse(tokens[cur_token++]);\n }\n\n static decimal NextDecimal()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return decimal.Parse(tokens[cur_token++]);\n }\n\n static string NextToken()\n {\n if (cur_token == tokens.Length)\n ReadArray(' ');\n return tokens[cur_token++];\n }\n\n static string ReadLine()\n {\n return Console.ReadLine();\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt16(Console.ReadLine());\n \n Console.WriteLine(\"+------------------------+\");\n if (x < 1) Console.Write(\"|#.\");\n else Console.Write(\"|0.\");\n for (int m = 5; m <= 32; m = m + 3)\n {\n if (x >= m) Console.Write(\"0.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|D|)\\n\");\n if (x < 2) Console.Write(\"|#.\");\n else Console.Write(\"|0.\");\n for (int m = 6; m <= 33; m = m + 3)\n {\n if (x >= m) Console.Write(\"0.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|.|)\\n\");\n if (x < 3) Console.WriteLine(\"|#.......................|\");\n else Console.WriteLine(\"|0.......................|\");\n\n if (x < 4) Console.Write(\"|#.\");\n else Console.Write(\"|0.\");\n for (int m = 7; m <= 34; m = m + 3)\n {\n if (x >= m) Console.Write(\"0.\");\n else Console.Write(\"#.\");\n }\n Console.Write(\"|.|)\\n\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int x = Convert.ToInt16(Console.ReadLine());\n \n Console.WriteLine(\"+------------------------+\");\n if (x < 1) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 5; m <= 32; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|D|)\\n\");\n if (x < 2) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 6; m <= 33; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n\n Console.Write(\"|.|)\\n\");\n if (x < 3) Console.WriteLine(\"|#.......................|\");\n else Console.WriteLine(\"|O.......................|\");\n\n if (x < 4) Console.Write(\"|#.\");\n else Console.Write(\"|O.\");\n for (int m = 7; m <= 34; m = m + 3)\n {\n if (x >= m) Console.Write(\"O.\");\n else Console.Write(\"#.\");\n }\n Console.Write(\"|.|)\\n\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int k = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n\n string[,] Arr = new string[4, 11] { {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n };\n \n\n bool floopbreak = false;\n\n for (int i = 0; (!floopbreak) && i < 11; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (j == 2 && i > 0)\n {\n continue;\n }\n\n Arr[j, i] = \"0\";\n\n counter++;\n if (counter == k)\n {\n floopbreak = true;\n break;\n }\n }\n\n\n }\n\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write(\"|\");\n \n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[0,i]+\".\");\n }\n\n Console.WriteLine(\"|D|)\");\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[1, i] + \".\");\n }\n\n Console.WriteLine(\"|.|\");\n\n Console.Write(\"|\");\n Console.Write(Arr[2, 0]);\n Console.WriteLine(\".......................|\");\n\n\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[3, i] + \".\");\n }\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int k = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n\n string[,] Arr = new string[4, 11] { {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n };\n \n\n bool floopbreak = false;\n\n for (int i = 0; (!floopbreak) && i < 11; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (j == 2 && i > 0)\n {\n continue;\n }\n\n Arr[j, i] = \"0\";\n\n counter++;\n if (counter == k)\n {\n floopbreak = true;\n break;\n }\n }\n\n\n }\n\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write(\"|\");\n \n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[0,i]+\".\");\n }\n\n Console.WriteLine(\"|D|)\");\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[1, i] + \".\");\n }\n\n Console.WriteLine(\"|.|\");\n\n Console.Write(\"|\");\n Console.Write(Arr[2, 0]);\n Console.WriteLine(\".......................|\");\n\n\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[3, i] + \".\");\n }\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");\n\n\n }\n }\n}"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CodeForces\n{\n class Program\n {\n\n\n static void Main(string[] args)\n {\n\n int k = Convert.ToInt32(Console.ReadLine());\n int counter = 0;\n\n string[,] Arr = new string[4, 11] { {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n {\"#\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"},\n {\"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\", \"#\"},\n };\n \n\n bool floopbreak = false;\n\n for (int i = 0; (!floopbreak) && i < 11; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (j == 2 && i > 0)\n {\n continue;\n }\n\n Arr[j, i] = \"O\";\n\n counter++;\n if (counter == k)\n {\n floopbreak = true;\n break;\n }\n }\n\n\n }\n\n\n Console.WriteLine(\"+------------------------+\");\n Console.Write(\"|\");\n \n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[0,i]+\".\");\n }\n\n Console.WriteLine(\"|D|)\");\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[1, i] + \".\");\n }\n\n Console.WriteLine(\"|.|\");\n\n Console.Write(\"|\");\n Console.Write(Arr[2, 0]);\n Console.WriteLine(\".......................|\");\n\n\n Console.Write(\"|\");\n for (int i = 0; i < 11; i++)\n {\n Console.Write(Arr[3, i] + \".\");\n }\n Console.WriteLine(\"|.|)\");\n\n Console.WriteLine(\"+------------------------+\");\n\n\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n // StreamReader sr = new StreamReader(\"11.in\");\n //StreamWriter sw = new StreamWriter(\"11.out\");\n\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"+------------------------+\");\n\n for (int j = 0; j < 4; j++)\n {\n Console.Write(\"|\");\n for (int i = 0; i < 11 || (i < 1 && j == 1); i++)\n Console.Write(seat(n, j, i) + \".\");\n Console.WriteLine(\".\" + (j == 2 ? \".\" : \"|\") + (j == 0 ? \"D\" : \".\") + \"|\");\n }\n\n \n Console.WriteLine(\"+------------------------+\");\n Console.ReadLine();\n }\n\n static string seat(int k,int i,int j)\n {\n if (i == 2 && j>0)\n return \".\";\n if (k > 4 && j == 0)\n return \"O\";\n if (k <= 4 && j==0)\n return k>i? \"O\":\"#\";\n\n k-=4; j--; i= i == 3 ? 2 : i;\n return k > j * 3 + i ? \"O\" : \"#\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication4\n{\n class Program\n {\n static void Main(string[] args)\n {\n // StreamReader sr = new StreamReader(\"11.in\");\n //StreamWriter sw = new StreamWriter(\"11.out\");\n\n int n = Convert.ToInt32(Console.ReadLine());\n Console.WriteLine(\"+------------------------+\");\n\n for (int j = 0; j < 4; j++)\n {\n Console.Write(\"|\");\n for (int i = 0; i < 11 || (i < 1 && j == 1); i++)\n Console.Write(seat(n, j, i) + \".\");\n Console.WriteLine(\".\" + (j == 2 ? \".\" : \"|\") + (j == 0 ? \"D\" : \".\") + \"|\" + (j == 3 || j==0 ? \")\" : \"\"));\n }\n\n \n Console.WriteLine(\"+------------------------+\");\n Console.ReadLine();\n }\n\n static string seat(int k,int i,int j)\n {\n if (i == 2 && j>0)\n return \".\";\n if (k > 4 && j == 0)\n return \"O\";\n if (k <= 4 && j==0)\n return k>i? \"O\":\"#\";\n\n k-=4; j--; i= i == 3 ? 2 : i;\n return k > j * 3 + i ? \"O\" : \"#\";\n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bayan\n{\n class Program\n {\n static List Do(int PassengersCount)\n {\n List Lines = new List();\n\n var RowCount = 6;\n var ColumnCount = 27;\n var Bus = new char[RowCount, ColumnCount];\n\n\n for (int row = 0; row < RowCount; row++)\n {\n string line = \"\";\n\n for (int column = 0; column < ColumnCount; column++)\n {\n if (row == 0 || row == RowCount - 1)\n {\n if (column == 0 || column == (ColumnCount - 2))\n Bus[row, column] = '+';\n else if (column == (ColumnCount - 1))\n Bus[row, column] = ' ';\n else\n Bus[row, column] = '-';\n }\n else\n {\n // \u0633\u062a\u0648\u0646 \u0647\u0627\u06cc \u0631\u062f\u06cc\u0641 \u0647\u0627\u06cc 1 \u062a\u0627 4\n if (column == 0)\n Bus[row, column] = '|';\n else\n {\n if (column < 23)\n {\n if (column == 1)\n {\n Bus[row, column] = '#';\n }\n else\n {\n if (row == 3)\n Bus[row, column] = '.';\n else\n {\n var isOdd = column % 2 == 1;\n if (isOdd)\n {\n Bus[row, column] = '#';\n }\n else\n {\n Bus[row, column] = '.';\n }\n }\n }\n }\n else\n {\n if (column == 23)\n {\n if (row != 3)\n Bus[row, column] = '|';\n else\n Bus[row, column] = '.';\n }\n else if (column == 24)\n {\n if (row == 1)\n Bus[row, column] = 'D';\n else\n Bus[row, column] = '.';\n }\n else if (column == 25)\n {\n Bus[row, column] = '|';\n }\n else if (column == 26)\n {\n if (row == 1 || row == 4)\n Bus[row, column] = ')';\n else\n Bus[row, column] = ' ';\n }\n }\n }\n\n }\n\n var s = Bus[row, column].ToString();\n line = line + s;\n }\n\n Lines.Add(line);\n }\n\n //PassengersCount\n\n var c = 0;\n\n string[] BusArray = Lines.ToArray();\n\n while (PassengersCount != 0)\n {\n var ss = BusArray[c];\n\n if (c >= 1 && c <= 4)\n {\n if (c == 3)\n {\n var cc = ss.ToCharArray();\n for (int i = 0; i < cc.Length; i++)\n {\n if (i == 1)\n {\n if (cc[i] == '#')\n {\n cc[i] = 'O';\n PassengersCount--;\n ss = string.Join(\"\", cc);\n break;\n }\n }\n }\n }\n else\n {\n var cc = ss.ToCharArray();\n\n for (int r = 0; r < cc.Length; r++)\n {\n if (cc[r] == '#')\n {\n cc[r] = 'O';\n PassengersCount--;\n break;\n }\n }\n\n ss = string.Join(\"\", cc);\n }\n\n }\n\n BusArray[c] = ss;\n\n c++;\n\n if (c > 5)\n c = 0;\n };\n\n return BusArray.ToList();\n }\n\n\n static void Main(string[] args)\n {\n try\n {\n var OutputLines = Do(int.Parse(Console.ReadLine()));\n Console.Write(string.Join(\"\\n\", OutputLines));\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.Write(Environment.NewLine);\n Console.Write(\"any key to exit\");\n Console.ReadKey();\n }\n }\n }\n\n\n #region Extensions\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable Collection, Action Action)\n {\n var ListCollection = Collection.ToList();\n\n var Length = ListCollection.Count;\n for (int i = 0; i < Length; i++)\n {\n Action(ListCollection[i], i);\n }\n }\n }\n\n #endregion\n\n\n #region IO\n\n public class IO\n {\n #region Constructor\n\n public IO(string InputPath, string OutputPath)\n {\n this.InputPath = InputPath;\n this.OutputPath = OutputPath;\n }\n\n #endregion\n\n\n #region Properties\n\n public string InputPath { get; set; }\n public string OutputPath { get; set; }\n\n #endregion\n\n\n #region Read Public Methods\n\n public string Read()\n {\n string Text = string.Empty;\n using (StreamReader Reader = new StreamReader(this.InputPath))\n Text = Reader.ReadToEnd();\n\n return Text;\n }\n\n public List ReadLines()\n {\n var Text = Read();\n var Lines = Text\n .Split('\\n')\n .Where(u => !string.IsNullOrEmpty(u))\n .ToList();\n return Lines;\n }\n\n #endregion\n\n\n #region Write Public Methods\n\n public void Write(string Text)\n {\n using (StreamWriter Writer = new StreamWriter(this.OutputPath))\n Writer.Write(Text);\n }\n\n public void WriteLines(List Lines)\n {\n var Text = String.Join(Environment.NewLine, Lines);\n Write(Text);\n }\n\n #endregion\n }\n\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bayan\n{\n class Program\n {\n static List Do(int PassengersCount)\n {\n List Lines = new List();\n\n var RowCount = 6;\n var ColumnCount = 27;\n var Bus = new char[RowCount, ColumnCount];\n\n\n for (int row = 0; row < RowCount; row++)\n {\n string line = \"\";\n\n for (int column = 0; column < ColumnCount; column++)\n {\n if (row == 0 || row == RowCount - 1)\n {\n if (column == 0 || column == (ColumnCount - 2))\n Bus[row, column] = '+';\n else if (column == (ColumnCount - 1))\n Bus[row, column] = ' ';\n else\n Bus[row, column] = '-';\n }\n else\n {\n // \u0633\u062a\u0648\u0646 \u0647\u0627\u06cc \u0631\u062f\u06cc\u0641 \u0647\u0627\u06cc 1 \u062a\u0627 4\n if (column == 0)\n Bus[row, column] = '|';\n else\n {\n if (column < 23)\n {\n if (column == 1)\n {\n Bus[row, column] = '#';\n }\n else\n {\n if (row == 3)\n Bus[row, column] = '.';\n else\n {\n var isOdd = column % 2 == 1;\n if (isOdd)\n {\n Bus[row, column] = '#';\n }\n else\n {\n Bus[row, column] = '.';\n }\n }\n }\n }\n else\n {\n if (column == 23)\n {\n if (row != 3)\n Bus[row, column] = '|';\n else\n Bus[row, column] = '.';\n }\n else if (column == 24)\n {\n if (row == 1)\n Bus[row, column] = 'D';\n else\n Bus[row, column] = '.';\n }\n else if (column == 25)\n {\n Bus[row, column] = '|';\n }\n else if (column == 26)\n {\n if (row == 1 || row == 4)\n Bus[row, column] = ')';\n else\n Bus[row, column] = ' ';\n }\n }\n }\n\n }\n\n var s = Bus[row, column].ToString();\n line = line + s;\n }\n\n Lines.Add(line);\n }\n\n //PassengersCount\n\n var c = 0;\n\n string[] BusArray = Lines.ToArray();\n\n while (PassengersCount != 0)\n {\n var ss = BusArray[c];\n\n if (c >= 1 && c <= 4)\n {\n if (c == 3)\n {\n var cc = ss.ToCharArray();\n for (int i = 0; i < cc.Length; i++)\n {\n if (i == 1)\n {\n if (cc[i] == '#')\n {\n cc[i] = 'O';\n PassengersCount--;\n ss = string.Join(\"\", cc);\n break;\n }\n }\n }\n }\n else\n {\n var cc = ss.ToCharArray();\n\n for (int r = 0; r < cc.Length; r++)\n {\n if (cc[r] == '#')\n {\n cc[r] = 'O';\n PassengersCount--;\n break;\n }\n }\n\n ss = string.Join(\"\", cc);\n }\n\n }\n\n BusArray[c] = ss;\n\n c++;\n\n if (c > 5)\n c = 0;\n };\n\n return BusArray.ToList();\n }\n\n\n static void Main(string[] args)\n {\n try\n {\n var OutputLines = Do(int.Parse(Console.ReadLine()));\n for (int i = 0; i < OutputLines.Count; i++)\n {\n Console.Write(OutputLines[i]);\n if (i < OutputLines.Count)\n Console.WriteLine();\n }\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.Write(Environment.NewLine);\n Console.Write(\"any key to exit\");\n Console.ReadKey();\n }\n }\n }\n\n\n #region Extensions\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable Collection, Action Action)\n {\n var ListCollection = Collection.ToList();\n\n var Length = ListCollection.Count;\n for (int i = 0; i < Length; i++)\n {\n Action(ListCollection[i], i);\n }\n }\n }\n\n #endregion\n\n\n #region IO\n\n public class IO\n {\n #region Constructor\n\n public IO(string InputPath, string OutputPath)\n {\n this.InputPath = InputPath;\n this.OutputPath = OutputPath;\n }\n\n #endregion\n\n\n #region Properties\n\n public string InputPath { get; set; }\n public string OutputPath { get; set; }\n\n #endregion\n\n\n #region Read Public Methods\n\n public string Read()\n {\n string Text = string.Empty;\n using (StreamReader Reader = new StreamReader(this.InputPath))\n Text = Reader.ReadToEnd();\n\n return Text;\n }\n\n public List ReadLines()\n {\n var Text = Read();\n var Lines = Text\n .Split('\\n')\n .Where(u => !string.IsNullOrEmpty(u))\n .ToList();\n return Lines;\n }\n\n #endregion\n\n\n #region Write Public Methods\n\n public void Write(string Text)\n {\n using (StreamWriter Writer = new StreamWriter(this.OutputPath))\n Writer.Write(Text);\n }\n\n public void WriteLines(List Lines)\n {\n var Text = String.Join(Environment.NewLine, Lines);\n Write(Text);\n }\n\n #endregion\n }\n\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bayan\n{\n class Program\n {\n static List Do(int PassengersCount)\n {\n List Lines = new List();\n\n var RowCount = 6;\n var ColumnCount = 27;\n var Bus = new char[RowCount, ColumnCount];\n\n\n for (int row = 0; row < RowCount; row++)\n {\n string line = \"\";\n\n for (int column = 0; column < ColumnCount; column++)\n {\n if (row == 0 || row == RowCount - 1)\n {\n if (column == 0 || column == (ColumnCount - 2))\n Bus[row, column] = '+';\n else if (column == (ColumnCount - 1))\n Bus[row, column] = ' ';\n else\n Bus[row, column] = '-';\n }\n else\n {\n // \u0633\u062a\u0648\u0646 \u0647\u0627\u06cc \u0631\u062f\u06cc\u0641 \u0647\u0627\u06cc 1 \u062a\u0627 4\n if (column == 0)\n Bus[row, column] = '|';\n else\n {\n if (column < 23)\n {\n if (column == 1)\n {\n Bus[row, column] = '#';\n }\n else\n {\n if (row == 3)\n Bus[row, column] = '.';\n else\n {\n var isOdd = column % 2 == 1;\n if (isOdd)\n {\n Bus[row, column] = '#';\n }\n else\n {\n Bus[row, column] = '.';\n }\n }\n }\n }\n else\n {\n if (column == 23)\n {\n if (row != 3)\n Bus[row, column] = '|';\n else\n Bus[row, column] = '.';\n }\n else if (column == 24)\n {\n if (row == 1)\n Bus[row, column] = 'D';\n else\n Bus[row, column] = '.';\n }\n else if (column == 25)\n {\n Bus[row, column] = '|';\n }\n else if (column == 26)\n {\n if (row == 1 || row == 4)\n Bus[row, column] = ')';\n else\n Bus[row, column] = ' ';\n }\n }\n }\n\n }\n\n var s = Bus[row, column].ToString();\n line = line + s;\n }\n\n Lines.Add(line);\n }\n\n //PassengersCount\n\n var c = 0;\n\n string[] BusArray = Lines.ToArray();\n\n while (PassengersCount != 0)\n {\n var ss = BusArray[c];\n\n if (c >= 1 && c <= 4)\n {\n if (c == 3)\n {\n var cc = ss.ToCharArray();\n for (int i = 0; i < cc.Length; i++)\n {\n if (i == 1)\n {\n if (cc[i] == '#')\n {\n cc[i] = 'O';\n PassengersCount--;\n ss = string.Join(\"\", cc);\n break;\n }\n }\n }\n }\n else\n {\n var cc = ss.ToCharArray();\n\n for (int r = 0; r < cc.Length; r++)\n {\n if (cc[r] == '#')\n {\n cc[r] = 'O';\n PassengersCount--;\n break;\n }\n }\n\n ss = string.Join(\"\", cc);\n }\n\n }\n\n BusArray[c] = ss;\n\n c++;\n\n if (c > 5)\n c = 0;\n };\n\n return BusArray.ToList();\n }\n\n\n static void Main(string[] args)\n {\n try\n {\n var OutputLines = Do(int.Parse(Console.ReadLine()));\n\n OutputLines.ForEach(u => Console.WriteLine(u));\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.Write(Environment.NewLine);\n Console.Write(\"any key to exit\");\n Console.ReadKey();\n }\n }\n }\n\n\n #region Extensions\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable Collection, Action Action)\n {\n var ListCollection = Collection.ToList();\n\n var Length = ListCollection.Count;\n for (int i = 0; i < Length; i++)\n {\n Action(ListCollection[i], i);\n }\n }\n }\n\n #endregion\n\n\n #region IO\n\n public class IO\n {\n #region Constructor\n\n public IO(string InputPath, string OutputPath)\n {\n this.InputPath = InputPath;\n this.OutputPath = OutputPath;\n }\n\n #endregion\n\n\n #region Properties\n\n public string InputPath { get; set; }\n public string OutputPath { get; set; }\n\n #endregion\n\n\n #region Read Public Methods\n\n public string Read()\n {\n string Text = string.Empty;\n using (StreamReader Reader = new StreamReader(this.InputPath))\n Text = Reader.ReadToEnd();\n\n return Text;\n }\n\n public List ReadLines()\n {\n var Text = Read();\n var Lines = Text\n .Split('\\n')\n .Where(u => !string.IsNullOrEmpty(u))\n .ToList();\n return Lines;\n }\n\n #endregion\n\n\n #region Write Public Methods\n\n public void Write(string Text)\n {\n using (StreamWriter Writer = new StreamWriter(this.OutputPath))\n Writer.Write(Text);\n }\n\n public void WriteLines(List Lines)\n {\n var Text = String.Join(Environment.NewLine, Lines);\n Write(Text);\n }\n\n #endregion\n }\n\n #endregion\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Bayan\n{\n class Program\n {\n static List Do(int PassengersCount)\n {\n List Lines = new List();\n\n var RowCount = 6;\n var ColumnCount = 27;\n var Bus = new char[RowCount, ColumnCount];\n\n\n for (int row = 0; row < RowCount; row++)\n {\n string line = \"\";\n\n for (int column = 0; column < ColumnCount; column++)\n {\n if (row == 0 || row == RowCount - 1)\n {\n if (column == 0 || column == (ColumnCount - 2))\n Bus[row, column] = '+';\n else if (column == (ColumnCount - 1))\n Bus[row, column] = ' ';\n else\n Bus[row, column] = '-';\n }\n else\n {\n // \u0633\u062a\u0648\u0646 \u0647\u0627\u06cc \u0631\u062f\u06cc\u0641 \u0647\u0627\u06cc 1 \u062a\u0627 4\n if (column == 0)\n Bus[row, column] = '|';\n else\n {\n if (column < 23)\n {\n if (column == 1)\n {\n Bus[row, column] = '#';\n }\n else\n {\n if (row == 3)\n Bus[row, column] = '.';\n else\n {\n var isOdd = column % 2 == 1;\n if (isOdd)\n {\n Bus[row, column] = '#';\n }\n else\n {\n Bus[row, column] = '.';\n }\n }\n }\n }\n else\n {\n if (column == 23)\n {\n if (row != 3)\n Bus[row, column] = '|';\n else\n Bus[row, column] = '.';\n }\n else if (column == 24)\n {\n if (row == 1)\n Bus[row, column] = 'D';\n else\n Bus[row, column] = '.';\n }\n else if (column == 25)\n {\n Bus[row, column] = '|';\n }\n else if (column == 26)\n {\n if (row == 1 || row == 4)\n Bus[row, column] = ')';\n else\n Bus[row, column] = ' ';\n }\n }\n }\n\n }\n\n var s = Bus[row, column].ToString();\n line = line + s;\n }\n\n Lines.Add(line);\n }\n\n //PassengersCount\n\n var c = 0;\n\n string[] BusArray = Lines.ToArray();\n\n while (PassengersCount != 0)\n {\n var ss = BusArray[c];\n\n if (c >= 1 && c <= 4)\n {\n if (c == 3)\n {\n var cc = ss.ToCharArray();\n for (int i = 0; i < cc.Length; i++)\n {\n if (i == 1)\n {\n if (cc[i] == '#')\n {\n cc[i] = 'O';\n PassengersCount--;\n ss = string.Join(\"\", cc);\n break;\n }\n }\n }\n }\n else\n {\n var cc = ss.ToCharArray();\n\n for (int r = 0; r < cc.Length; r++)\n {\n if (cc[r] == '#')\n {\n cc[r] = 'O';\n PassengersCount--;\n break;\n }\n }\n\n ss = string.Join(\"\", cc);\n }\n\n }\n\n BusArray[c] = ss;\n\n c++;\n\n if (c > 5)\n c = 0;\n };\n\n return BusArray.ToList();\n }\n\n\n static void Main(string[] args)\n {\n try\n {\n var OutputLines = Do(int.Parse(Console.ReadLine()));\n Console.Write(string.Join(\"\\n\", OutputLines));\n }\n catch (Exception ex)\n {\n Console.WriteLine(ex.Message);\n Console.Write(Environment.NewLine);\n Console.Write(\"any key to exit\");\n Console.ReadKey();\n }\n }\n }\n\n\n #region Extensions\n\n public static class Extensions\n {\n public static void ForEach(this IEnumerable Collection, Action Action)\n {\n var ListCollection = Collection.ToList();\n\n var Length = ListCollection.Count;\n for (int i = 0; i < Length; i++)\n {\n Action(ListCollection[i], i);\n }\n }\n }\n\n #endregion\n\n\n #region IO\n\n public class IO\n {\n #region Constructor\n\n public IO(string InputPath, string OutputPath)\n {\n this.InputPath = InputPath;\n this.OutputPath = OutputPath;\n }\n\n #endregion\n\n\n #region Properties\n\n public string InputPath { get; set; }\n public string OutputPath { get; set; }\n\n #endregion\n\n\n #region Read Public Methods\n\n public string Read()\n {\n string Text = string.Empty;\n using (StreamReader Reader = new StreamReader(this.InputPath))\n Text = Reader.ReadToEnd();\n\n return Text;\n }\n\n public List ReadLines()\n {\n var Text = Read();\n var Lines = Text\n .Split('\\n')\n .Where(u => !string.IsNullOrEmpty(u))\n .ToList();\n return Lines;\n }\n\n #endregion\n\n\n #region Write Public Methods\n\n public void Write(string Text)\n {\n using (StreamWriter Writer = new StreamWriter(this.OutputPath))\n Writer.Write(Text);\n }\n\n public void WriteLines(List Lines)\n {\n var Text = String.Join(Environment.NewLine, Lines);\n Write(Text);\n }\n\n #endregion\n }\n\n #endregion\n}\n"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n //sb.AppendLine();\n Console.Write(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n Console.Write(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n Console.WriteLine(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = '0';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = '0';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n Console.WriteLine(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'O';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n //sb.AppendLine();\n Console.Write(sb.ToString());\n //Console.WriteLine('' == 'O');\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Text;\n\npublic class HelloWorld\n{\n public static void Main()\n {\n // your code goes here\n int n = int.Parse(Console.ReadLine());\n char[,] bus = new char[4, 27];\n bus[0, 0] = '|';\n bus[1, 0] = '|';\n bus[2, 0] = '|';\n bus[3, 0] = '|';\n bus[0, 25] = '|';\n bus[1, 25] = '|';\n bus[2, 25] = '|';\n bus[3, 25] = '|';\n bus[0, 26] = ')';\n bus[3, 26] = ')';\n bus[0, 24] = 'D';\n bus[1, 24] = '.';\n bus[2, 24] = '.';\n bus[3, 24] = '.';\n bus[0, 23] = '|';\n bus[1, 23] = '|';\n bus[2, 23] = '.';\n bus[3, 23] = '|';\n\n for (int i = 1; i < 23; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n if (i % 2 == 0)\n {\n bus[j, i] = '.';\n }\n else\n {\n if (i == 1)\n {\n if (n > 0)\n {\n bus[j, i] = 'o';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n else\n {\n if (j == 2)\n {\n bus[j, i] = '.';\n continue;\n }\n if (n > 0)\n {\n bus[j, i] = 'o';\n n--;\n }\n else\n {\n bus[j, i] = '#';\n }\n }\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n for (int i = 0; i < 4; i++)\n {\n for(int j = 0 ; j < 27 ; j++)\n sb.Append(bus[i,j]);\n sb.AppendLine();\n }\n sb.Append(\"+------------------------+\");\n sb.AppendLine();\n Console.WriteLine(sb.ToString());\n Console.ReadLine();\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Bayan\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String[] lastRow = new String[4];\n int lastRowFillCounter = 0;\n String[,] remainingRows = new String[10, 3];\n String input = Console.ReadLine();\n int inputNumber = Convert.ToInt32(input);\n for (int i = 0; i < lastRow.Length; i++)\n {\n lastRow[i] = \"#\";\n }\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n remainingRows[i, j] = \"#\";\n }\n }\n int lastRowIndex = 0;\n int remainRowFirstIndex = 0;\n int remainRowSecondIndex = 0;\n for (int k = 0; k < inputNumber; k++)\n {\n if (lastRowFillCounter < 4)\n {\n lastRow[lastRowFillCounter] = \"0\";\n lastRowFillCounter++;\n }\n else\n {\n if (remainRowSecondIndex > 2)\n {\n remainRowSecondIndex = 0;\n remainRowFirstIndex++;\n }\n\n remainingRows[remainRowFirstIndex, remainRowSecondIndex] = \"0\";\n remainRowSecondIndex++;\n }\n }\n String firstAnswer = \"+------------------------+\";\n string firstRowAnswer = \"|\" + lastRow[0];\n for (int i = 0; i < 10; i++)\n {\n firstRowAnswer = firstRowAnswer + \".\" + remainingRows[i, 0];\n }\n firstRowAnswer = firstRowAnswer + \".|D|)\";\n\n String secondRowAnswer = \"|\" + lastRow[1];\n for (int i = 0; i < 10; i++)\n {\n secondRowAnswer = secondRowAnswer + \".\" + remainingRows[i, 1];\n }\n secondRowAnswer = secondRowAnswer + \".|.|\";\n\n\n String thirdRowAnswer = \"|\" + lastRow[2] + \".......................|\";\n\n String forthRowAnswer = \"|\" + lastRow[3];\n for (int i = 0; i < 10; i++)\n {\n forthRowAnswer = forthRowAnswer + \".\" + remainingRows[i, 2];\n }\n forthRowAnswer = forthRowAnswer + \".|D|)\";\n\n String endLine = \"+------------------------+\";\n Console.WriteLine(firstAnswer);\n Console.WriteLine(firstRowAnswer);\n Console.WriteLine(secondRowAnswer);\n Console.WriteLine(thirdRowAnswer);\n Console.WriteLine(forthRowAnswer);\n Console.WriteLine(endLine);\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Bayan\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String[] lastRow = new String[4];\n int lastRowFillCounter = 0;\n String[,] remainingRows = new String[10, 3];\n String input = Console.ReadLine();\n int inputNumber = Convert.ToInt32(input);\n for (int i = 0; i < lastRow.Length; i++)\n {\n lastRow[i] = \"#\";\n }\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n remainingRows[i, j] = \"#\";\n }\n }\n int lastRowIndex = 0;\n int remainRowFirstIndex = 0;\n int remainRowSecondIndex = 0;\n for (int k = 0; k < inputNumber; k++)\n {\n if (lastRowFillCounter < 4)\n {\n lastRow[lastRowFillCounter] = \"O\";\n lastRowFillCounter++;\n }\n else\n {\n if (remainRowSecondIndex > 2)\n {\n remainRowSecondIndex = 0;\n remainRowFirstIndex++;\n }\n\n remainingRows[remainRowFirstIndex, remainRowSecondIndex] = \"O\";\n remainRowSecondIndex++;\n }\n }\n String firstAnswer = \"+------------------------+\";\n string firstRowAnswer = \"|\" + lastRow[0];\n for (int i = 0; i < 10; i++)\n {\n firstRowAnswer = firstRowAnswer + \".\" + remainingRows[i, 0];\n }\n firstRowAnswer = firstRowAnswer + \".|D|)\";\n\n String secondRowAnswer = \"|\" + lastRow[1];\n for (int i = 0; i < 10; i++)\n {\n secondRowAnswer = secondRowAnswer + \".\" + remainingRows[i, 1];\n }\n secondRowAnswer = secondRowAnswer + \".|.|\";\n\n\n String thirdRowAnswer = \"|\" + lastRow[2] + \".......................|\";\n\n String forthRowAnswer = \"|\" + lastRow[3];\n for (int i = 0; i < 10; i++)\n {\n forthRowAnswer = forthRowAnswer + \".\" + remainingRows[i, 2];\n }\n forthRowAnswer = forthRowAnswer + \".|D|)\";\n\n String endLine = \"+------------------------+\";\n Console.WriteLine(firstAnswer);\n Console.WriteLine(firstRowAnswer);\n Console.WriteLine(secondRowAnswer);\n Console.WriteLine(thirdRowAnswer);\n Console.WriteLine(forthRowAnswer);\n Console.WriteLine(endLine);\n \n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Bayan\n{\n class Program\n {\n static void Main(string[] args)\n {\n \n String[] lastRow = new String[4];\n int lastRowFillCounter = 0;\n String[,] remainingRows = new String[10, 3];\n String input = Console.ReadLine();\n int inputNumber = Convert.ToInt32(input);\n for (int i = 0; i < lastRow.Length; i++)\n {\n lastRow[i] = \"#\";\n }\n for (int i = 0; i < 10; i++)\n {\n for (int j = 0; j < 3; j++)\n {\n remainingRows[i, j] = \"#\";\n }\n }\n int lastRowIndex = 0;\n int remainRowFirstIndex = 0;\n int remainRowSecondIndex = 0;\n for (int k = 0; k < inputNumber; k++)\n {\n if (lastRowFillCounter < 4)\n {\n lastRow[lastRowFillCounter] = \"0\";\n lastRowFillCounter++;\n }\n else\n {\n if (remainRowSecondIndex > 2)\n {\n remainRowSecondIndex = 0;\n remainRowFirstIndex++;\n }\n\n remainingRows[remainRowFirstIndex, remainRowSecondIndex] = \"0\";\n remainRowSecondIndex++;\n }\n }\n String firstAnswer = \"+------------------------+\";\n string firstRowAnswer = \"|\" + lastRow[0];\n for (int i = 0; i < 10; i++)\n {\n firstRowAnswer = firstRowAnswer + \".\" + remainingRows[i, 0];\n }\n firstRowAnswer = firstRowAnswer + \".|D|)\";\n\n String secondRowAnswer = \"|\" + lastRow[1];\n for (int i = 0; i < 10; i++)\n {\n secondRowAnswer = secondRowAnswer + \".\" + remainingRows[i, 1];\n }\n secondRowAnswer = secondRowAnswer + \".|.|\";\n\n\n String thirdRowAnswer = \"|\" + lastRow[2] + \".......................|\";\n\n String forthRowAnswer = \"|\" + lastRow[3];\n for (int i = 0; i < 10; i++)\n {\n forthRowAnswer = forthRowAnswer + \".\" + remainingRows[i, 2];\n }\n forthRowAnswer = forthRowAnswer + \".|D|)\";\n\n String endLine = \"+------------------------+\";\n Console.WriteLine(firstAnswer);\n Console.WriteLine(firstRowAnswer);\n Console.WriteLine(secondRowAnswer);\n Console.WriteLine(thirdRowAnswer);\n Console.WriteLine(forthRowAnswer);\n Console.WriteLine(endLine);\n Console.ReadLine();\n\n\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tint n = Int32.Parse(line1);\n\t\t\tint[,] columns = new int[11 , 4];\n\t\t\tif (n >= 4)\n\t\t\t{\n\t\t\t\tn -= 4;\n\t\t\t\tfor (int i = 0; i < 4; i++)\n\t\t\t\t{\n\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t}\n\t\t\t\tint column = 1;\n\t\t\t\tint row = 0;\n\t\t\t\twhile (n > 0)\n\t\t\t\t{\n\t\t\t\t\tn -= 1;\n\t\t\t\t\tcolumns[column, row] = 1;\n\t\t\t\t\trow += 1;\n\t\t\t\t\tif (row == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\trow += 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (row == 4)\n\t\t\t\t\t{\n\t\t\t\t\t\trow = 0;\n\t\t\t\t\t\tcolumn += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n == 3)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 2)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 1)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 1; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 0] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|D|)\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 1] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 2] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"..\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 3] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|)\" + Environment.NewLine);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "\ufeffusing System;\nusing System.Linq;\n\nnamespace CodeForces\n{\n\tclass MainClass\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tstring line1 = Console.ReadLine();\n\t\t\tint n = Int32.Parse(line1);\n\t\t\tint[,] columns = new int[11 , 4];\n\t\t\tif (n >= 4)\n\t\t\t{\n\t\t\t\tn -= 4;\n\t\t\t\tfor (int i = 0; i < 4; i++)\n\t\t\t\t{\n\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t}\n\t\t\t\tint column = 1;\n\t\t\t\tint row = 0;\n\t\t\t\twhile (n > 0)\n\t\t\t\t{\n\t\t\t\t\tn -= 1;\n\t\t\t\t\tcolumns[column, row] = 1;\n\t\t\t\t\trow += 1;\n\t\t\t\t\tif (row == 2)\n\t\t\t\t\t{\n\t\t\t\t\t\trow += 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (row == 4)\n\t\t\t\t\t{\n\t\t\t\t\t\trow = 0;\n\t\t\t\t\t\tcolumn += 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (n == 3)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 2)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 2; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (n == 1)\n\t\t\t\t{\n\t\t\t\t\tfor (int i = 0; i < 1; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns[0, i] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 0] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|D|)\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 1] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 2] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"..\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"..|\" + Environment.NewLine);\n\t\t\tConsole.Write(\"|\");\n\t\t\tfor (int i = 0; i < 11; i++)\n\t\t\t{\n\t\t\t\tif (columns[i, 3] == 1)\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"O.\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.Write(\"#.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.Write(\"|.|)\" + Environment.NewLine);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\n\t\t}\n\n\t}\n\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 13] = \"D\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n string[] output = new string[6];\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 12] = \"|D\";\n bus[1, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[2, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[4, 13] = \"|\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n }\n \n\n\n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"- \";\n bus[5, i] = \"- \";\n }\n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n output[i] += bus[i, j];\n \n }\n if ((i == 1) || (i == 4))\n {\n Console.Write(output[i] + ')');\n }\n else\n {\n Console.Write(output[i]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 13] = \"D\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[2, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[1, 12] = \"|D\";\n bus[4, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n bus[i, 13] = \"|\";\n }\n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"0.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[2, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[1, 12] = \"|D\";\n bus[4, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n bus[i, 13] = \"|\";\n }\n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"o.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n string[] output = new string[6];\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 13] = \"D\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n output[i] += bus[i, j];\n \n }\n Console.Write(output[i]);\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 13] = \"D\";\n \n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 12; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n Console.Write(bus[i, j]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n string[] output = new string[6];\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 12] = \"|D\";\n bus[1, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[2, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[4, 13] = \"|\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n }\n \n\n\n \n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n Console.Write('+');\n for (int l = 1; l < 25; l++)\n {\n Console.Write('-');\n }\n Console.Write('+');\n for (int i = 1; i < 5; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n output[i] += bus[i, j];\n \n }\n\n \n\n if ((i == 1) || (i == 4))\n {\n Console.Write(output[i] + ')');\n }\n else\n {\n Console.Write(output[i]);\n }\n }\n Console.WriteLine();\n Console.Write('+');\n for (int l = 1; l < 25; l++)\n {\n Console.Write('-');\n }\n Console.Write('+');\n\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication8\n{\n class Program\n {\n static void Main(string[] args)\n {\n int count = int.Parse(Console.ReadLine());\n string[,] bus = new string[6, 14];\n int n = 0;\n string[] output = new string[6];\n n = count;\n bus[0, 0] = \"+\";\n bus[5, 0] = \"+\";\n bus[0, 13] = \"+\";\n bus[5, 13] = \"+\";\n bus[1, 12] = \"|D\";\n bus[1, 13] = \"|\";\n bus[2, 12] = \"|.\";\n bus[2, 13] = \"|\";\n bus[4, 12] = \"|.\";\n bus[4, 13] = \"|\";\n bus[3, 13] = \"|\";\n for (int i = 1; i < 5; i++)\n {\n bus[i, 0] = \"|\";\n }\n \n\n\n for (int i = 1; i < 13; i++)\n {\n bus[0,i] = \"-\";\n bus[5, i] = \"-\";\n }\n \n for (int i = 2; i <= 11; i++)\n {\n bus[3, i] = \".\";\n }\n for (int i = 1; i <= 11; i++)\n {\n for (int j = 1; j < 5; j++)\n {\n if ((bus[j,i] != \".\") && (n != 0) )\n {\n bus[j, i] = \"O.\";\n n--;\n }\n else if ( (bus[j,i] != \".\"))\n {\n bus[j, i] = \"#.\";\n }\n \n }\n \n }\n\n for (int i = 0; i < 6; i++)\n {\n Console.WriteLine();\n for (int j = 0; j < 14; j++)\n {\n output[i] += bus[i, j];\n \n }\n if ((i == 1) || (i == 4))\n {\n Console.Write(output[i] + ')');\n }\n else\n {\n Console.Write(output[i]);\n }\n }\n Console.Read();\n \n }\n }\n}\n"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication254\n{\n class Program\n {\n static Dictionary> d = new Dictionary>();\n static int[] mark;\n static Dictionary cnt;\n static int[] color;\n static int size = 0;\n static void dfs(int v)\n {\n size++;\n mark[v] = 1;\n bool w = false;\n if (cnt.ContainsKey(color[v]))\n {\n cnt[color[v]]++;\n }\n else\n {\n cnt.Add(color[v], 1);\n }\n for (int i = 0; i < d[v].Count; i++)\n {\n if (mark[d[v][i]] == 0)\n {\n\n dfs(d[v][i]);\n }\n\n }\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int k1 = 0;\n int k2 = 0;\n int k3 = 0;\n if (n > 4)\n {\n string a1 = \"+------------------------+\";\n string a2 = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n string a3 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n string a4 = \"|O.......................|\";\n string a5 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n string a6 = \"+------------------------+\";\n if ((n - 1) % 3 == 0)\n {\n k1 = (n - 1) / 3;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else if ((n - 1) % 3 == 1)\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3 + 1;\n k3 = (n - 1) % 3;\n }\n //Console.WriteLine(k1+\" \"+k2+\" \"+k3);\n int k = 1;\n string c1 = a1;\n string c2 = \"\";\n string c3 = \"\";\n string c4 = a4;\n string c5 = \"\";\n string c6 = a6;\n for (int i = 0; i < a2.Length; i++)\n {\n if (k <= k1)\n {\n if (a2[i] == '#')\n {\n c2 += 'O';\n k++;\n }\n else\n {\n c2 += a2[i];\n }\n }\n else\n {\n c2 += a2[i];\n }\n }\n k = 1;\n for (int i = 0; i < a3.Length; i++)\n {\n if (k <= k2)\n {\n if (a3[i] == '#')\n {\n c3 += 'O';\n k++;\n }\n else\n {\n c3 += a3[i];\n }\n }\n else\n {\n c3 += a3[i];\n }\n }\n k = 1;\n for (int i = 0; i < a5.Length; i++)\n {\n if (k <= k3)\n {\n if (a5[i] == '#')\n {\n c5 += 'O';\n k++;\n }\n else\n {\n c5 += a5[i];\n }\n }\n else\n {\n c5 += a5[i];\n }\n }\n Console.WriteLine(c1);\n Console.WriteLine(c2);\n Console.WriteLine(c3);\n Console.WriteLine(c4);\n Console.WriteLine(c5);\n Console.WriteLine(c6);\n }\n else\n {\n\n if (n == 1)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 2)\n {\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 3)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 4)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else\n {\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n }\n}"}, {"source_code": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nclass PairVariable : IComparable\n{\n public int a, b;\n public PairVariable()\n {\n a = b = 0;\n }\n public PairVariable(string s)\n {\n string[] q = s.Split();\n a = int.Parse(q[0]);\n b = int.Parse(q[1]);\n }\n public PairVariable(int a, int b)\n {\n this.a = a;\n this.b = b;\n }\n public int CompareTo(PairVariable pv)\n {\n if (this.a > pv.a)\n {\n return 1;\n }\n else if (this.a < pv.a)\n {\n return -1;\n }\n else\n {\n if (this.b >= pv.b)\n {\n return 1;\n }\n else\n {\n return -1;\n }\n }\n }\n\n}\nnamespace ConsoleApplication254\n{\n class Program\n {\n static Dictionary> d = new Dictionary>();\n static int[] mark;\n static Dictionary cnt;\n static int[] color;\n static int size = 0;\n static void dfs(int v)\n {\n size++;\n mark[v] = 1;\n bool w = false;\n if (cnt.ContainsKey(color[v]))\n {\n cnt[color[v]]++;\n }\n else\n {\n cnt.Add(color[v], 1);\n }\n for (int i = 0; i < d[v].Count; i++)\n {\n if (mark[d[v][i]] == 0)\n {\n\n dfs(d[v][i]);\n }\n\n }\n\n }\n static void Main(string[] args)\n {\n string[] ss = Console.ReadLine().Split();\n int n = int.Parse(ss[0]);\n int k1 = 0;\n int k2 = 0;\n int k3 = 0;\n if (n > 4)\n {\n string a1 = \"+------------------------+\";\n string a2 = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n string a3 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n string a4 = \"|O.......................|\";\n string a5 = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n string a6 = \"+------------------------+\";\n if ((n - 1) % 3 == 0)\n {\n k1 = (n - 1) / 3;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else if ((n - 1) % 3 == 1)\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3;\n k3 = (n - 1) / 3;\n }\n else\n {\n k1 = (n - 1) / 3 + 1;\n k2 = (n - 1) / 3 + 1;\n k3 = (n - 1) % 3;\n }\n //Console.WriteLine(k1+\" \"+k2+\" \"+k3);\n int k = 1;\n string c1 = a1;\n string c2 = \"\";\n string c3 = \"\";\n string c4 = a4;\n string c5 = \"\";\n string c6 = a6;\n for (int i = 0; i < a2.Length; i++)\n {\n if (k <= k1)\n {\n if (a2[i] == '#')\n {\n c2 += 'O';\n k++;\n }\n else\n {\n c2 += a2[i];\n }\n }\n else\n {\n c2 += a2[i];\n }\n }\n k = 1;\n for (int i = 0; i < a3.Length; i++)\n {\n if (k <= k2)\n {\n if (a3[i] == '#')\n {\n c3 += 'O';\n k++;\n }\n else\n {\n c3 += a3[i];\n }\n }\n else\n {\n c3 += a3[i];\n }\n }\n k = 1;\n for (int i = 0; i < a5.Length; i++)\n {\n if (k <= k3)\n {\n if (a5[i] == '#')\n {\n c5 += 'O';\n k++;\n }\n else\n {\n c5 += a5[i];\n }\n }\n else\n {\n c5 += a5[i];\n }\n }\n Console.WriteLine(c1);\n Console.WriteLine(c2);\n Console.WriteLine(c3);\n Console.WriteLine(c4);\n Console.WriteLine(c5);\n Console.WriteLine(c6);\n }\n else\n {\n\n if (n == 1)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 2)\n {\n\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|#.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else if (n == 3)\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n else\n {\n Console.WriteLine(\"+------------------------+\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|\");\n Console.WriteLine(\"|O.......................|\");\n Console.WriteLine(\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\");\n Console.WriteLine(\"+------------------------+\");\n }\n }\n }\n }\n}"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar v = int.Parse(Console.ReadLine());\n\t\t\tvar a = \"\";\n\t\t\tvar b = \"\";\n\t\t\tvar c = \"\";\n\t\t\tvar d = \"\";\n\t\t\tif (v > 3){\n\t\t\t\tc = \"O.\";\n\t\t\t\tv--;\n\t\t\t} else {\n\t\t\t\tc = \"#.\";\n\t\t\t}\n\t\t\tint j = v / 3;\n\t\t\tdoStuff(ref a,ref j,v);\n\t\t\tdoStuff(ref b,ref j,v);\n\t\t\tdoStuff(ref d,ref j,v);\n\t\t\tj = v - j * 3;\n\t\t\tdoStuff2(ref a,ref j, v);\n\t\t\tdoStuff2(ref b,ref j, v);\n\t\t\tdoStuff2(ref d,ref j, v);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|\"+a+\"|D|)\");\n\t\t\tConsole.WriteLine(\"|\"+b+\"|.|\");\n\t\t\tConsole.WriteLine(\"|\"+c+\"......................|\");\n\t\t\tConsole.WriteLine(\"|\"+d+\"|.|)\");\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n//\t\t\tConsole.ReadLine();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpublic static void doStuff(ref string a, ref int j, int v){\n\t\t\tfor (int i = 0; i < j; i++){\n\t\t\t\ta += \"O.\";\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void doStuff2(ref string a, ref int j, int v){\n\t\t\tif (j > 0){\n\t\t\t\ta += \"O.\";\n\t\t\t\tj--;\n\t\t\t}\n\t\t\twhile (a.Length < 22){\n\t\t\t\ta += \"#.\";\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void print(string a){\n\t\t\tConsole.WriteLine(a);\n\t\t}\n\t}\n}\n\n// Remember these:\n// String.Format(\"{0:0}\",f).ToString();\n// Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);\n// var splstr = Console.ReadLine().Split(' ').ToList();\n// var str = Console.ReadLine();\n// var l = new List();"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar v = int.Parse(Console.ReadLine());\n\t\t\tvar a = \"\";\n\t\t\tvar b = \"\";\n\t\t\tvar c = \"\";\n\t\t\tvar d = \"\";\n\t\t\tif (v > 3){\n\t\t\t\tc = \"O.\";\n\t\t\t\tv--;\n\t\t\t}\n\t\t\tint j = v / 3;\n\t\t\tdoStuff(ref a,ref j,v);\n\t\t\tdoStuff(ref b,ref j,v);\n\t\t\tdoStuff(ref d,ref j,v);\n\t\t\tj = v - j * 3;\n\t\t\tdoStuff2(ref a,ref j, v);\n\t\t\tdoStuff2(ref b,ref j, v);\n\t\t\tdoStuff2(ref d,ref j, v);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|\"+a+\"|D|)\");\n\t\t\tConsole.WriteLine(\"|\"+b+\"|.|\");\n\t\t\tConsole.WriteLine(\"|\"+c+\"......................|\");\n\t\t\tConsole.WriteLine(\"|\"+d+\"|.|)\");\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n//\t\t\tConsole.ReadLine();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpublic static void doStuff(ref string a, ref int j, int v){\n\t\t\tfor (int i = 0; i < j; i++){\n\t\t\t\ta += \"O.\";\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void doStuff2(ref string a, ref int j, int v){\n\t\t\tif (j > 0){\n\t\t\t\ta += \"O.\";\n\t\t\t\tj--;\n\t\t\t}\n\t\t\twhile (a.Length < 22){\n\t\t\t\ta += \"#.\";\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic static void print(string a){\n\t\t\tConsole.WriteLine(a);\n\t\t}\n\t}\n}\n\n// Remember these:\n// String.Format(\"{0:0}\",f).ToString();\n// Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);\n// var splstr = Console.ReadLine().Split(' ').ToList();\n// var str = Console.ReadLine();\n// var l = new List();"}, {"source_code": "\ufeff/*\n * Created by SharpDevelop.\n * Handle: Arcos\n */\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Text.RegularExpressions;\n\n\nnamespace TestingStuff\n{\n\tclass Program\n\t{\n\t\tpublic static void Main(string[] args)\n\t\t{\n\t\t\tvar v = int.Parse(Console.ReadLine());\n\t\t\tvar a = \"\";\n\t\t\tvar b = \"\";\n\t\t\tvar c = \"\";\n\t\t\tvar d = \"\";\n\t\t\tif (v > 3){\n\t\t\t\tc = \"O.\";\n\t\t\t\tv--;\n\t\t\t}\n\t\t\tint j = v / 3;\n\t\t\tdoStuff(ref a,ref j,v);\n\t\t\tdoStuff(ref b,ref j,v);\n\t\t\tdoStuff(ref d,ref j,v);\n\t\t\tConsole.WriteLine(\"Mid \" + v + \" \" + j);\n\t\t\tj = v - j * 3;\n\t\t\tConsole.WriteLine(\"Mid \" + v + \" \" + j);\n\t\t\tdoStuff2(ref a,ref j, v);\n\t\t\tdoStuff2(ref b,ref j, v);\n\t\t\tdoStuff2(ref d,ref j, v);\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n\t\t\tConsole.WriteLine(\"|\"+a+\"|D|)\");\n\t\t\tConsole.WriteLine(\"|\"+b+\"|.|\");\n\t\t\tConsole.WriteLine(\"|\"+c+\"......................|\");\n\t\t\tConsole.WriteLine(\"|\"+d+\"|.|)\");\n\t\t\tConsole.WriteLine(\"+------------------------+\");\n//\t\t\tConsole.ReadLine();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpublic static void doStuff(ref string a, ref int j, int v){\n\t\t\tfor (int i = 0; i < j; i++){\n\t\t\t\ta += \"O.\";\t\t\t\t\n\t\t\t}\n\t\t\tprint(a + \" \" + j);\n\t\t}\n\t\t\n\t\tpublic static void doStuff2(ref string a, ref int j, int v){\n\t\t\tif (j > 0){\n\t\t\t\ta += \"O.\";\n\t\t\t\tj--;\n\t\t\t}\n\t\t\twhile (a.Length < 22){\n\t\t\t\ta += \"#.\";\n\t\t\t}\n\t\t\tprint(a + \" \" + j);\n\t\t}\n\t\t\n\t\tpublic static void print(string a){\n\t\t\tConsole.WriteLine(a);\n\t\t}\n\t}\n}\n\n// Remember these:\n// String.Format(\"{0:0}\",f).ToString();\n// Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);\n// var splstr = Console.ReadLine().Split(' ').ToList();\n// var str = Console.ReadLine();\n// var l = new List();"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF475A {\n class Program {\n static void Main(string[] args) {\n int passengers = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"+------------------------+\");\n for(int row = 0; row < 4; row++) {\n string r = \"|\";\n int seats = (passengers - 4) / 3;\n if(row == 0) {\n if((passengers - 4) % 3 > 0) {\n seats += 1;\n }\n } else if(row == 1) {\n if((passengers - 4) % 3 > 1) {\n seats += 1;\n }\n }\n if(row == 2) {\n if(passengers >= 3) {\n Console.WriteLine(\"|O.......................|\");\n } else {\n Console.WriteLine(\"|#.......................|\");\n }\n continue;\n }\n\n for(int i = 0; i <= seats; i++) {\n r += \"O.\";\n }\n for(int i = seats; i < 10; i++) {\n r += \"#.\";\n }\n if(row == 0) {\n r += \"|D|)\";\n } else if(row == 1) {\n r += \"|.|\";\n } else if(row == 2) {\n r += \"..|\";\n } else if (row == 3) {\n r += \"|.|)\";\n }\n Console.WriteLine(r);\n }\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF475A {\n class Program {\n static void Main(string[] args) {\n int passengers = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"+------------------------+\");\n for(int row = 0; row < 4; row++) {\n string r = \"|\";\n int seats = (passengers - 4) / 3;\n if(row == 0) {\n if((passengers - 4) % 3 > 0) {\n seats += 1;\n }\n } else if(row == 1) {\n if((passengers - 4) % 3 > 1) {\n seats += 1;\n }\n }\n if(row == 2) {\n if(passengers >= 3) {\n Console.WriteLine(\"|O.......................|\");\n } else {\n Console.WriteLine(\"|#.......................|\");\n }\n continue;\n }\n\n for(int i = 0; i <= seats; i++) {\n if(row == 3 && passengers < 4) {\n continue;\n }\n r += \"O.\";\n }\n if(passengers - (row + 1) == 0 && row == 0) {\n r += \"O.\";\n seats++;\n }\n for(int i = seats; i < 10; i++) {\n r += \"#.\";\n\n }\n if(row == 0) {\n r += \"|D|)\";\n } else if(row == 1) {\n r += \"|.|\";\n } else if(row == 2) {\n r += \"..|\";\n } else if (row == 3) {\n r += \"|.|)\";\n }\n Console.WriteLine(r);\n }\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}, {"source_code": "\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace CF475A {\n class Program {\n static void Main(string[] args) {\n int passengers = int.Parse(Console.ReadLine());\n\n Console.WriteLine(\"+------------------------+\");\n for(int row = 0; row < 4; row++) {\n string r = \"|\";\n int seats = (passengers - 4) / 3;\n if(row == 0) {\n if((passengers - 4) % 3 > 0) {\n seats += 1;\n }\n } else if(row == 1) {\n if((passengers - 4) % 3 > 1) {\n seats += 1;\n }\n }\n if(row == 2) {\n if(passengers >= 3) {\n Console.WriteLine(\"|O.......................|\");\n } else {\n Console.WriteLine(\"|#.......................|\");\n }\n continue;\n }\n\n for(int i = 0; i <= seats; i++) {\n r += \"O.\";\n }\n for(int i = seats; i < 11; i++) {\n r += \"#.\";\n }\n if(row == 0) {\n r += \"|D|)\";\n } else if(row == 1) {\n r += \"|.|\";\n } else if(row == 2) {\n r += \"..|\";\n } else if (row == 3) {\n r += \"|.|)\";\n }\n Console.WriteLine(r);\n }\n Console.WriteLine(\"+------------------------+\");\n }\n }\n}\n"}], "src_uid": "075f83248f6d4d012e0ca1547fc67993"}